feat(webui): keep delegated work within reach (#6443)
This commit is contained in:
1 parent
9270137d65
commit
9b3af7b66c
27 files changed
+2265
-234
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user