fix(swarm): ignore heartbeats for silent worker timeout
This commit is contained in:
parent
e464a1bd6e
commit
f9c147a08b
1 changed files with 13 additions and 1 deletions
|
|
@ -84,6 +84,16 @@ function createSubagentUIContext(): ExtensionUIContext {
|
|||
};
|
||||
}
|
||||
|
||||
function isMeaningfulSubagentOutputEvent(event: AgentSessionEvent): boolean {
|
||||
if (String(event.type) === "runtime_heartbeat") return false;
|
||||
if (event.type === "message_update") {
|
||||
const streamEvent = event.assistantMessageEvent;
|
||||
if (streamEvent.type === "text_delta") return streamEvent.delta.length > 0;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export interface RunSubagentOptions {
|
||||
signal?: AbortSignal;
|
||||
timeoutMs?: number;
|
||||
|
|
@ -321,7 +331,9 @@ export async function runSubagent(
|
|||
options = {
|
||||
...options,
|
||||
onEvent: (event) => {
|
||||
if (!noOutputTimedOut) armNoOutputTimer();
|
||||
if (!noOutputTimedOut && isMeaningfulSubagentOutputEvent(event)) {
|
||||
armNoOutputTimer();
|
||||
}
|
||||
previousOnEvent?.(event);
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue