feat(webui): keep delegated work within reach (#6443)

This commit is contained in:
chengyongru authored and GitHub committed 2026-10-26 13:16:44 +08:00
1 parent 9270137d65
commit 9b3af7b66c
27 files changed
+2265 -234

No files matched your search

+15 -1
View File
@@ -1,9 +1,23 @@
import type { SubagentTaskSnapshot } from "./types";
import type { SubagentTaskSnapshot, UIMessage } from "./types";
export interface ObservedSubagentTask extends SubagentTaskSnapshot {
observedAtMs: number;
}
export function isActiveSubagentTask(task: SubagentTaskSnapshot): boolean {
return task.state === "queued" || task.state === "running" || task.state === "stopping";
}
export function latestSubagentInputKey(messages: readonly UIMessage[]): string | null {
for (let index = messages.length - 1; index >= 0; index--) {
const message = messages[index];
if (message.role === "user" && !message.sessionMessage) {
return message.turnId ? `user:${message.turnId}` : `replay:${message.id}`;
}
}
return null;
}
function isRecord(value: unknown): value is Record<string, unknown> {
return value !== null && typeof value === "object" && !Array.isArray(value);
}