320
* which indicates a programming error in the caller.
321
*/
323
>
subagentUri: URI,
324
>
parentRegistry: SubagentRegistry,
325
>
sdk: IClaudeAgentSdkService,
326
>
logService: ILogService,
327
>
token: CancellationToken,
328
>
): Promise<readonly Turn[]> {
329
>
const parsed = parseSubagentSessionUri(subagentUri);
330
>
if (!parsed) {
331
throw new Error(`getSubagentTranscript: not a subagent URI: ${subagentUri.toString()}`);
332
}
334
>
const parentSessionId = AgentSession.id(parentSession);
335
>
const agentId = await resolveAgentIdViaChain(toolCallId, {
336
>
parentUri: parentSession,
337
>
parentSessionId,
338
>
token,
339
>
}, {
340
>
strategies: buildDefaultStrategies(sdk, logService),
341
>
cacheGet: id => parentRegistry.getSpawn(id)?.agentId,
342
>
cacheSet: (id, resolved) => { parentRegistry.recordSpawn(id, { agentId: resolved }); },
343
>
});
344
>
if (!agentId) {
345
return [];
346
}
348
>
try {
349
>
messages = await sdk.getSubagentMessages(parentSessionId, agentId);
350
>
} catch (err) {
351
logService.warn(`[getSubagentTranscript] getSubagentMessages(${agentId}) failed: ${err}`);
352
return [];