refactor(delegate-task): improve session title format and add task_metadata block

- Change session title from 'Task: {desc}' to '{desc} (@{agent} subagent)'
- Move session_id to structured <task_metadata> block for better parsing
- Add category tracking to BackgroundTask type and LaunchInput
- Add tests for new title format and metadata block
This commit is contained in:
YeonGyu-Kim
2026-02-01 19:44:22 +09:00
parent 865e6cc506
commit 6b866e106e
4 changed files with 184 additions and 16 deletions
+2 -1
View File
@@ -138,6 +138,7 @@ export class BackgroundManager {
parentModel: input.parentModel,
parentAgent: input.parentAgent,
model: input.model,
category: input.category,
}
this.tasks.set(task.id, task)
@@ -231,7 +232,7 @@ export class BackgroundManager {
const createResult = await this.client.session.create({
body: {
parentID: input.parentSessionID,
title: `Background: ${input.description}`,
title: `${input.description} (@${input.agent} subagent)`,
permission: [
{ permission: "question", action: "deny" as const, pattern: "*" },
],
+3
View File
@@ -38,6 +38,8 @@ export interface BackgroundTask {
parentAgent?: string
/** Marks if the task was launched from an unstable agent/category */
isUnstableAgent?: boolean
/** Category used for this task (e.g., 'quick', 'visual-engineering') */
category?: string
/** Last message count for stability detection */
lastMsgCount?: number
@@ -57,6 +59,7 @@ export interface LaunchInput {
isUnstableAgent?: boolean
skills?: string[]
skillContent?: string
category?: string
}
export interface ResumeInput {