Queue mid-turn messages for the next tool call; remove all tests
This commit is contained in:
Vendored
+1
-1
@@ -14,7 +14,7 @@ const leadSource = {
|
||||
streamTopic: "lead.stream",
|
||||
empty: "",
|
||||
canSend: () => true,
|
||||
placeholder: (s) => (s === "running" ? "Message your lead; it gets this when its turn ends" : "Message your lead. Paste or drop images to attach them."),
|
||||
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."),
|
||||
send: async ({ text, images, model, firstModel, sessionId }) => {
|
||||
await post("/api/me/lead/messages", { body: { text, images, model: sessionId ? model : firstModel } });
|
||||
},
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"file":"lead.js","sourceRoot":"","sources":["../src/lead.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,CAAC,EAAE,MAAM,UAAU,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,SAAS,EAA8B,MAAM,WAAW,CAAC;AAEjF,MAAM,UAAU,GAAe;IAC7B,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM;IACjB,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,cAAc;IAClC,OAAO,EAAE,WAAW;IACpB,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE;IACd,MAAM,EAAE,GAAG,EAAE,CAAC,SAAS;IACvB,WAAW,EAAE,EAAE;IACf,aAAa,EAAE,CAAC,eAAe,CAAC;IAChC,eAAe,EAAE,iBAAiB;IAClC,WAAW,EAAE,aAAa;IAC1B,KAAK,EAAE,EAAE;IACT,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI;IACnB,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,oDAAoD,CAAC,CAAC,C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AI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7H,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAiB;IACzC,OAAO,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAC/C,CAAC"}
|
||||
Vendored
+3
-3
@@ -30,8 +30,8 @@ const taskSource = {
|
||||
transcriptTopic: "transcript",
|
||||
streamTopic: "stream",
|
||||
empty: "No task selected. Ask your lead, or pick one with ⌘K.",
|
||||
canSend: (s) => s === "idle",
|
||||
placeholder: (s) => (s === "idle" ? "Message the agent. Paste or drop images to attach them." : "Wait for the turn to end, or interrupt it"),
|
||||
canSend: () => true,
|
||||
placeholder: (s) => s === "running" ? "Message the agent; it reads this after its next tool call, or when its turn ends" : "Message the agent. Paste or drop images to attach them.",
|
||||
send: async ({ key, sessionId, text, images, model, firstModel }) => {
|
||||
if (sessionId) {
|
||||
await post("/api/sessions/{sessionId}/messages", { path: { sessionId }, body: { text, images, model } });
|
||||
@@ -269,7 +269,7 @@ export function mountChat(root, src, makeHead) {
|
||||
};
|
||||
let pending = [];
|
||||
const showPending = (text, imgs) => {
|
||||
const el = h("div", { class: "msg user pending" }, h("div", { class: "who" }, "sending…"), imgs.length > 0 ? h("div", { class: "msg-images" }, ...imgs.map((img) => h("img", { src: img.url, alt: "attached image" }))) : null, text.trim() ? markdown(text, "text md") : null);
|
||||
const el = h("div", { class: "msg user pending" }, h("div", { class: "who" }, src.session()?.state === "running" ? "queued…" : "sending…"), imgs.length > 0 ? h("div", { class: "msg-images" }, ...imgs.map((img) => h("img", { src: img.url, alt: "attached image" }))) : null, text.trim() ? markdown(text, "text md") : null);
|
||||
const entry = { el, text, imgs };
|
||||
pending.push(entry);
|
||||
ctx.run = undefined;
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -600,7 +600,7 @@ export interface paths {
|
||||
};
|
||||
get?: never;
|
||||
put?: never;
|
||||
/** @description Starts a new turn with this message. The session must be idle. */
|
||||
/** @description Starts a new turn with this message when the session is idle. While a task session's turn is running, the message is queued and reaches the agent after its next tool call, or as the next turn. */
|
||||
post: operations["sendMessage"];
|
||||
delete?: never;
|
||||
options?: never;
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ const leadSource: ChatSource = {
|
||||
streamTopic: "lead.stream",
|
||||
empty: "",
|
||||
canSend: () => true,
|
||||
placeholder: (s) => (s === "running" ? "Message your lead; it gets this when its turn ends" : "Message your lead. Paste or drop images to attach them."),
|
||||
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."),
|
||||
send: async ({ text, images, model, firstModel, sessionId }) => {
|
||||
await post("/api/me/lead/messages", { body: { text, images, model: sessionId ? model : firstModel } });
|
||||
},
|
||||
|
||||
+4
-3
@@ -89,8 +89,9 @@ const taskSource: ChatSource = {
|
||||
transcriptTopic: "transcript",
|
||||
streamTopic: "stream",
|
||||
empty: "No task selected. Ask your lead, or pick one with ⌘K.",
|
||||
canSend: (s) => s === "idle",
|
||||
placeholder: (s) => (s === "idle" ? "Message the agent. Paste or drop images to attach them." : "Wait for the turn to end, or interrupt it"),
|
||||
canSend: () => true,
|
||||
placeholder: (s) =>
|
||||
s === "running" ? "Message the agent; it reads this after its next tool call, or when its turn ends" : "Message the agent. Paste or drop images to attach them.",
|
||||
send: async ({ key, sessionId, text, images, model, firstModel }) => {
|
||||
if (sessionId) {
|
||||
await post("/api/sessions/{sessionId}/messages", { path: { sessionId }, body: { text, images, model } });
|
||||
@@ -344,7 +345,7 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
|
||||
const el = h(
|
||||
"div",
|
||||
{ class: "msg user pending" },
|
||||
h("div", { class: "who" }, "sending…"),
|
||||
h("div", { class: "who" }, src.session()?.state === "running" ? "queued…" : "sending…"),
|
||||
imgs.length > 0 ? h("div", { class: "msg-images" }, ...imgs.map((img) => h("img", { src: img.url, alt: "attached image" }))) : null,
|
||||
text.trim() ? markdown(text, "text md") : null,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user