fix: fix subagent live streaming not updating during execution (#493)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2026-01-07 23:46:50 -08:00
committed by GitHub
parent 49225d0a80
commit 39dde2ddbb

View File

@@ -149,16 +149,20 @@ function handleApprovalRequestEvent(
* Handle an auto_approval event
*/
function handleAutoApprovalEvent(
event: { tool_call_id?: string; tool_name?: string; tool_args?: string },
event: {
tool_call?: { tool_call_id?: string; name?: string; arguments?: string };
},
state: ExecutionState,
subagentId: string,
): void {
const { tool_call_id, tool_name, tool_args = "{}" } = event;
if (tool_call_id && tool_name) {
const tc = event.tool_call;
if (!tc) return;
const { tool_call_id, name, arguments: tool_args = "{}" } = tc;
if (tool_call_id && name) {
recordToolCall(
subagentId,
tool_call_id,
tool_name,
name,
tool_args,
state.displayedToolCalls,
);
@@ -222,7 +226,11 @@ function processStreamEvent(
switch (event.type) {
case "init":
handleInitEvent(event, state, baseURL, subagentId);
case "system":
// Handle both legacy "init" type and new "system" type with subtype "init"
if (event.type === "init" || event.subtype === "init") {
handleInitEvent(event, state, baseURL, subagentId);
}
break;
case "message":