refactor(core): use SubagentState enum in RemoteSessionInvocation

This commit is contained in:
Adam Weidman
2026-05-12 14:35:28 -04:00
parent 3f97e7e7a4
commit 42ac315d87
@@ -17,6 +17,7 @@ import {
type RemoteAgentDefinition, type RemoteAgentDefinition,
type AgentInputs, type AgentInputs,
type SubagentProgress, type SubagentProgress,
SubagentState,
} from './types.js'; } from './types.js';
import { type AgentLoopContext } from '../config/agent-loop-context.js'; import { type AgentLoopContext } from '../config/agent-loop-context.js';
import type { MessageBus } from '../confirmation-bus/message-bus.js'; import type { MessageBus } from '../confirmation-bus/message-bus.js';
@@ -139,13 +140,13 @@ export class RemoteSessionInvocation extends BaseToolInvocation<
updateOutput({ updateOutput({
isSubagentProgress: true, isSubagentProgress: true,
agentName, agentName,
state: 'running', state: SubagentState.RUNNING,
recentActivity: [ recentActivity: [
{ {
id: 'pending', id: 'pending',
type: 'thought', type: 'thought',
content: 'Working...', content: 'Working...',
status: 'running', status: SubagentState.RUNNING,
}, },
], ],
}); });
@@ -164,7 +165,7 @@ export class RemoteSessionInvocation extends BaseToolInvocation<
const errorProgress: SubagentProgress = { const errorProgress: SubagentProgress = {
isSubagentProgress: true, isSubagentProgress: true,
agentName, agentName,
state: 'error', state: SubagentState.ERROR,
result: result:
typeof partialProgress?.result === 'string' typeof partialProgress?.result === 'string'
? partialProgress.result ? partialProgress.result
@@ -199,7 +200,7 @@ export class RemoteSessionInvocation extends BaseToolInvocation<
const errorProgress: SubagentProgress = { const errorProgress: SubagentProgress = {
isSubagentProgress: true, isSubagentProgress: true,
agentName, agentName,
state: 'error', state: SubagentState.ERROR,
result: fullDisplay, result: fullDisplay,
recentActivity: partialProgress?.recentActivity ?? [], recentActivity: partialProgress?.recentActivity ?? [],
}; };