2026-10-15 09:40:30 -07:00
import { post } from "./api.js" ;
import { h } from "./dom.js" ;
import { currentLead , state } from "./state.js" ;
import { compactButton , mountChat } from "./task.js" ;
const leadSource = {
key : () => "lead" ,
events : () => state . leadTranscript ,
session : currentLead ,
root : () => "" ,
taskId : () => undefined ,
resetTopics : [],
refreshTopics : [ "lead.sessions" ],
transcriptTopic : "lead.transcript" ,
streamTopic : "lead.stream" ,
empty : "" ,
canSend : () => true ,
2026-10-15 18:33:18 -07:00
placeholder : ( s ) => ( s === "running" ? "Message your lead; it reads this after its next tool call, or when its turn ends" : "Message your lead. Paste or drop images to attach them." ),
2026-10-15 09:40:30 -07:00
send : async ({ text , images , model , firstModel , sessionId }) => {
await post ( "/api/me/lead/messages" , { body : { text , images , model : sessionId ? model : firstModel } });
},
};
function leadHead () {
return {
render : ( usage ) => {
const sess = currentLead ();
const live = sess && sess . state !== "completed" ? sess : undefined ;
return [ h ( "div" , { class : "head-actions session-actions" }, compactButton ( live ? . id , live ? . state , live && usage ( live . id )))];
},
};
}
export function mountLead ( root ) {
return mountChat ( root , leadSource , leadHead );
}
//# sourceMappingURL=lead.js.map