feat: include subagent in task_metadata when resuming sessions

When delegate-task resumes a session via session_id, the response
task_metadata now includes a subagent field identifying which agent
was running in the resumed session. This allows the parent agent to
know what type of subagent it is continuing.

- sync-continuation: uses resumeAgent extracted from session messages
- background-continuation: uses task.agent from BackgroundTask object
- Gracefully omits subagent when agent info is unavailable
This commit is contained in:
YeonGyu-Kim
2026-02-12 19:09:15 +09:00
parent c6349dc38a
commit 95aa7595f8
4 changed files with 205 additions and 2 deletions
@@ -50,7 +50,7 @@ Use \`background_output\` with task_id="${task.id}" to check progress.
<task_metadata>
session_id: ${task.sessionID}
</task_metadata>`
${task.agent ? `subagent: ${task.agent}\n` : ""}</task_metadata>`
} catch (error) {
return formatDetailedError(error, {
operation: "Continue background task",