Improve the transcript: tool grouping, report auto-ack, context meter, spinner, Enter to send
This commit is contained in:
Vendored
+14
-3
@@ -71,24 +71,30 @@ export async function loadInbox() {
|
||||
state.inbox = await get("/api/inbox");
|
||||
notify("inbox");
|
||||
}
|
||||
let liveDuringLoad;
|
||||
export async function selectTask(taskId) {
|
||||
state.selectedTaskId = taskId;
|
||||
state.transcript = [];
|
||||
state.lastTranscriptSeq = 0;
|
||||
liveDuringLoad = undefined;
|
||||
notify("selection");
|
||||
if (!taskId) {
|
||||
return;
|
||||
}
|
||||
const held = [];
|
||||
liveDuringLoad = held;
|
||||
for (;;) {
|
||||
const page = await get("/api/tasks/{taskId}/events", { path: { taskId }, query: { after: state.lastTranscriptSeq, limit: 1000 } });
|
||||
if (state.selectedTaskId !== taskId) {
|
||||
if (state.selectedTaskId !== taskId || liveDuringLoad !== held) {
|
||||
return;
|
||||
}
|
||||
appendTranscript(page);
|
||||
if (page.length < 1000) {
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
liveDuringLoad = undefined;
|
||||
appendTranscript(held);
|
||||
}
|
||||
function appendTranscript(events) {
|
||||
const fresh = events.filter((ev) => ev.seq > state.lastTranscriptSeq);
|
||||
@@ -101,7 +107,12 @@ function appendTranscript(events) {
|
||||
}
|
||||
export function handleEvent(ev) {
|
||||
if (ev.task_id && ev.task_id === state.selectedTaskId) {
|
||||
appendTranscript([ev]);
|
||||
if (liveDuringLoad) {
|
||||
liveDuringLoad.push(ev);
|
||||
}
|
||||
else {
|
||||
appendTranscript([ev]);
|
||||
}
|
||||
}
|
||||
switch (ev.kind) {
|
||||
case "user.updated":
|
||||
|
||||
Reference in New Issue
Block a user