refactor(task): drop session_id resume alias
This commit is contained in:
@@ -143,7 +143,7 @@ describe("createToolExecuteBeforeHandler", () => {
|
||||
expect(output.args.subagent_type).toBe("sisyphus-junior")
|
||||
})
|
||||
|
||||
test("resolves subagent_type from session first message when session_id provided without subagent_type", async () => {
|
||||
test("resolves subagent_type from session first message when task_id is provided without subagent_type", async () => {
|
||||
//#given
|
||||
const ctx = createCtxWithSessionMessages([
|
||||
{ info: { role: "user" } },
|
||||
@@ -152,7 +152,7 @@ describe("createToolExecuteBeforeHandler", () => {
|
||||
])
|
||||
const handler = createToolExecuteBeforeHandler({ ctx, hooks: emptyHooks })
|
||||
const input = { tool: "task", sessionID: "ses_123", callID: "call_1" }
|
||||
const output = { args: { session_id: "ses_abc123", description: "Continue task", prompt: "fix it" } as Record<string, unknown> }
|
||||
const output = { args: { task_id: "ses_abc123", description: "Continue task", prompt: "fix it" } as Record<string, unknown> }
|
||||
|
||||
//#when
|
||||
await handler(input, output)
|
||||
@@ -186,7 +186,7 @@ describe("createToolExecuteBeforeHandler", () => {
|
||||
])
|
||||
const handler = createToolExecuteBeforeHandler({ ctx, hooks: emptyHooks })
|
||||
const input = { tool: "task", sessionID: "ses_123", callID: "call_1" }
|
||||
const output = { args: { session_id: "ses_abc123", description: "Continue task", prompt: "fix it" } as Record<string, unknown> }
|
||||
const output = { args: { task_id: "ses_abc123", description: "Continue task", prompt: "fix it" } as Record<string, unknown> }
|
||||
|
||||
//#when
|
||||
await handler(input, output)
|
||||
@@ -195,12 +195,12 @@ describe("createToolExecuteBeforeHandler", () => {
|
||||
expect(output.args.subagent_type).toBe("continue")
|
||||
})
|
||||
|
||||
test("preserves subagent_type when session_id is provided with explicit subagent_type", async () => {
|
||||
test("preserves subagent_type when task_id is provided with explicit subagent_type", async () => {
|
||||
//#given
|
||||
const ctx = createCtxWithSessionMessages()
|
||||
const handler = createToolExecuteBeforeHandler({ ctx, hooks: emptyHooks })
|
||||
const input = { tool: "task", sessionID: "ses_123", callID: "call_1" }
|
||||
const output = { args: { session_id: "ses_abc123", subagent_type: "explore", description: "Continue explore" } as Record<string, unknown> }
|
||||
const output = { args: { task_id: "ses_abc123", subagent_type: "explore", description: "Continue explore" } as Record<string, unknown> }
|
||||
|
||||
//#when
|
||||
await handler(input, output)
|
||||
@@ -223,7 +223,7 @@ describe("createToolExecuteBeforeHandler", () => {
|
||||
expect(output.args.subagent_type).toBeUndefined()
|
||||
})
|
||||
|
||||
test("does not set subagent_type when neither category nor session_id is provided and subagent_type is present", async () => {
|
||||
test("does not set subagent_type when neither category nor task_id is provided and subagent_type is present", async () => {
|
||||
//#given
|
||||
const ctx = createCtxWithSessionMessages()
|
||||
const handler = createToolExecuteBeforeHandler({ ctx, hooks: emptyHooks })
|
||||
|
||||
@@ -100,16 +100,7 @@ export function createToolExecuteBeforeHandler(args: {
|
||||
const argsObject = output.args
|
||||
const category = typeof argsObject.category === "string" ? argsObject.category : undefined
|
||||
const subagentType = typeof argsObject.subagent_type === "string" ? argsObject.subagent_type : undefined
|
||||
const taskId =
|
||||
typeof argsObject.task_id === "string"
|
||||
? argsObject.task_id
|
||||
: typeof argsObject.session_id === "string"
|
||||
? argsObject.session_id
|
||||
: undefined
|
||||
|
||||
if (taskId && typeof argsObject.task_id !== "string") {
|
||||
argsObject.task_id = taskId
|
||||
}
|
||||
const taskId = typeof argsObject.task_id === "string" ? argsObject.task_id : undefined
|
||||
|
||||
if (category) {
|
||||
argsObject.subagent_type = "sisyphus-junior"
|
||||
|
||||
Reference in New Issue
Block a user