(
input: Record<string, any>,
path: string,
sessions: Session[] | undefined,
agents?: readonly { name: string; color?: string }[],
)
| 541 | } |
| 542 | |
| 543 | function taskSession( |
| 544 | input: Record<string, any>, |
| 545 | path: string, |
| 546 | sessions: Session[] | undefined, |
| 547 | agents?: readonly { name: string; color?: string }[], |
| 548 | ) { |
| 549 | const parentID = currentSession(path) |
| 550 | if (!parentID) return |
| 551 | const description = typeof input.description === "string" ? input.description : "" |
| 552 | const agent = taskAgent(input.subagent_type, agents).name |
| 553 | return (sessions ?? []) |
| 554 | .filter((session) => session.parentID === parentID && !session.time?.archived) |
| 555 | .filter((session) => (description ? session.title.startsWith(description) : true)) |
| 556 | .filter((session) => (agent ? session.title.includes(`@${agent}`) : true)) |
| 557 | .sort((a, b) => (b.time.created ?? 0) - (a.time.created ?? 0))[0]?.id |
| 558 | } |
| 559 | |
| 560 | const CONTEXT_GROUP_TOOLS = new Set(["read", "glob", "grep", "list"]) |
| 561 | const HIDDEN_TOOLS = new Set(["todowrite"]) |
no test coverage detected