(
completion: Promise<{ result: string }>,
description: string,
options: {
readonly agentId?: string;
readonly subagentType?: string;
readonly subagentHost?: Pick<SessionSubagentHost, 'markActiveChildDetached'>;
readonly abortController?: AbortController;
} = {},
)
| 68 | } |
| 69 | |
| 70 | export function agentTask( |
| 71 | completion: Promise<{ result: string }>, |
| 72 | description: string, |
| 73 | options: { |
| 74 | readonly agentId?: string; |
| 75 | readonly subagentType?: string; |
| 76 | readonly subagentHost?: Pick<SessionSubagentHost, 'markActiveChildDetached'>; |
| 77 | readonly abortController?: AbortController; |
| 78 | } = {}, |
| 79 | ): AgentBackgroundTask { |
| 80 | const handle: SubagentHandle = { |
| 81 | agentId: options.agentId ?? 'agent-child', |
| 82 | profileName: options.subagentType ?? 'coder', |
| 83 | resumed: false, |
| 84 | completion, |
| 85 | }; |
| 86 | return new AgentBackgroundTask( |
| 87 | handle, |
| 88 | description, |
| 89 | options.subagentHost ?? { markActiveChildDetached: vi.fn() }, |
| 90 | options.abortController ?? new AbortController(), |
| 91 | ); |
| 92 | } |
| 93 | |
| 94 | export async function waitForTerminal( |
| 95 | manager: BackgroundManager, |
no outgoing calls
no test coverage detected