@agimon-ai/doompi-task 0.0.1-alpha.49 → 0.0.1-alpha.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- const e=[`Capture a whole plan in one call: {"action":"upsert","tasks":[{"subject":"Research existing tool"},{"subject":"Write the reducer"},{"subject":"Add tests"}]}. Batch whenever you are writing the plan down — the initial list, a revised plan, or wiring dependencies across several tasks — because one call keeps ids and blockers consistent and shows the user the whole plan at once.`,`Do not batch parent progress. Mark a task in_progress with its own call BEFORE beginning work, and completed with its own call IMMEDIATELY when it is done. upsert accepts many tasks, but a batch of completions sent at the end of a turn is still wrong: upsert batching is for writing a plan down, single calls are for reporting progress, and the user watches the task list to see where you are. Native assignments[] fan-out is separate from progress reporting. Exactly one task should be in_progress for your own work; delegated tasks run in parallel and do not count against that.`,`Never mark a task completed if tests are failing, the implementation is partial, or you hit unresolved errors, use status "failed" or keep it in_progress and add a new task for the blocker in the same upsert.`,`When every non-deleted task is completed, review the full task list once more and call task {"action":"clear"} to close it. Do not leave an all-completed list open.`,`Status is a state machine: pending in_progress completed, plus failed (recoverable, can go back to pending or in_progress) and deleted as a tombstone. Pass activeForm (present-continuous, e.g. 'writing tests') when marking in_progress.`,`One call does both: an entry with an id changes that task, an entry without an id creates one. To change status, upsert the task by id, e.g. {"action":"upsert","tasks":[{"id":3,"status":"completed"}]}. Never omit the id when you meant to change an existing task — an entry with no id creates a new one instead. An entry that carries an id and no other field is rejected.`,`Use blockedBy for dependencies (A is blocked by B). On an entry with no id pass blockedBy as the initial set; on an entry with an id use addBlockedBy / removeBlockedBy (additive merge, do not resend the full array). To depend on a task created earlier in the SAME call, give that earlier entry a "ref" and list the ref string in place of an id: [{"ref":"api","subject":"Design the API"},{"subject":"Implement the API","blockedBy":["api"]}]. A ref must be declared before it is used. Cycles are rejected.`,`upsert applies each entry independently: the entries that pass are committed and the failures are reported with their array index. A failed entry changed nothing, so resend only the corrected failures — never resend the whole call, because an already-applied entry with no id would create a duplicate task.`,`Before assigning work, call subagent with {"action":"agents"} and match each task to an exact discovered agent name. Prefer a discovered general-purpose write-capable agent such as delegate or worker when no specialist fits. Use a focused inlineAgent only for read-only work.`,`Apply the session's general delegation criteria before selecting tracked work. Use assignments[] for every assign call, including one task: {"action":"assign","assignments":[{"id":1,"agent":"researcher"}]}. Put every assign-time field, including model, inlineAgent, instructions, relevantFiles, priorFindings, and context, inside its assignments[] entry; assign has no top-level single-task form. For two or more independent ready tasks selected for delegation, use one native batch instead of repeated calls. Do not wrap repeated task assign calls in multi_tool; assignments[] reduces tool overhead and returns one indexed result. Do not use a direct subagent run for work already represented in the shared task list, so ownership and terminal results stay visible.`,`A batched assign applies each entry independently. Successful entries are already running if another entry fails; retry only failed entries after correcting them, and never resend successful entries.`,`Populate relevantFiles only with files you actually read or located, and priorFindings only with verified facts such as symbol names, call sites, the selected approach, and ruled-out alternatives. Send at most a dozen files; a guessed path costs more than an omitted one. Keep priorFindings to a few lines of facts, not directives.`,`When delegated task completion unblocks another tracked task, reconsider that newly eligible task promptly and repeat agent discovery before assigning it if needed.`,`If a child asks for a decision through intercom, or an assignment fails to start for another concrete issue, respond, rescope, or retry explicitly. Do not silently leave the task pending.`,`assign refuses tasks that are blocked, already delegated, or completed. Resolve blockers first. Use {"action":"cancel","id":3} to stop a running delegation; the task returns to pending.`,`Doom Task records delegated lifecycle and results on the shared task. The child does not update task status directly.`,`The task list is scoped to this session tree: delegated subagents share it, while unrelated sessions start empty. It persists for later inspection until retention cleanup.`,`Subject must be short and imperative (e.g. 'Research existing tool'); description is long-form detail written when you plan the task, and the delegated brief is that description plus the assign-time instructions, relevantFiles and priorFindings. Put durable scope in description and what you learned while exploring in the assign-time pack — do not repeat one in the other.`];exports.DEFAULT_PROMPT_GUIDELINES=e;
1
+ const e=[`Batch the whole plan in one upsert: {"action":"upsert","tasks":[{"subject":"Research the store"},{"subject":"Write the reducer"}]}. Report progress one call at a time: mark a task in_progress before you start it and completed the moment it lands, never batched at the end of a turn. Keep one task in_progress for your own work; delegated tasks run in parallel and do not count.`,`Never mark a task completed while tests fail or the work is partial. Use failed, or keep it in_progress and add a task for the blocker in the same upsert.`,`When every non-deleted task is completed, review the list once and call {"action":"clear"}.`,`Status flow: pending, in_progress, completed. failed is recoverable, deleted is a tombstone. Pass activeForm (e.g. 'writing tests') when marking in_progress.`,`upsert applies each entry independently: passing entries commit and failures are reported by array index. Resend only the corrected failures, because resending an applied entry with no id creates a duplicate task.`,`Apply the session delegation criteria before choosing what to delegate, then call subagent {"action":"agents"} and use an exact discovered name. Prefer a general-purpose write-capable agent such as delegate or worker when no specialist fits, and use a focused inlineAgent only for read-only work.`,`Assign through assignments[] even for a single task: {"action":"assign","assignments":[{"id":1,"agent":"researcher"}]}. Put independent ready tasks in one batch rather than repeated calls or multi_tool, and do not start a direct subagent run for work already on the task list. Successful entries keep running when another entry fails, so retry only the failures.`,`Fill relevantFiles only with files you actually read or located, and priorFindings only with verified facts in a few lines, not directives. A guessed path costs more than an omitted one.`,`Subject stays short and imperative. description is the durable brief handed to the subagent, extended at assign time by instructions, relevantFiles and priorFindings, so do not repeat one in the other.`,`When a delegated task completes and unblocks another, reconsider it promptly. If a child asks for a decision or an assignment fails to start, respond, rescope or retry instead of leaving it pending. Doom Task records delegated lifecycle and results on the task itself.`];exports.DEFAULT_PROMPT_GUIDELINES=e;
2
2
  //# sourceMappingURL=promptGuidelines.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"promptGuidelines.cjs","names":[],"sources":["../../../src/commands/task/promptGuidelines.ts"],"sourcesContent":["export const DEFAULT_PROMPT_GUIDELINES: string[] = [\n 'Capture a whole plan in one call: {\"action\":\"upsert\",\"tasks\":[{\"subject\":\"Research existing tool\"},{\"subject\":\"Write the reducer\"},{\"subject\":\"Add tests\"}]}. Batch whenever you are writing the plan down the initial list, a revised plan, or wiring dependencies across several tasks because one call keeps ids and blockers consistent and shows the user the whole plan at once.',\n 'Do not batch parent progress. Mark a task in_progress with its own call BEFORE beginning work, and completed with its own call IMMEDIATELY when it is done. upsert accepts many tasks, but a batch of completions sent at the end of a turn is still wrong: upsert batching is for writing a plan down, single calls are for reporting progress, and the user watches the task list to see where you are. Native assignments[] fan-out is separate from progress reporting. Exactly one task should be in_progress for your own work; delegated tasks run in parallel and do not count against that.',\n 'Never mark a task completed if tests are failing, the implementation is partial, or you hit unresolved errors, use status \"failed\" or keep it in_progress and add a new task for the blocker in the same upsert.',\n 'When every non-deleted task is completed, review the full task list once more and call task {\"action\":\"clear\"} to close it. Do not leave an all-completed list open.',\n \"Status is a state machine: pending in_progress completed, plus failed (recoverable, can go back to pending or in_progress) and deleted as a tombstone. Pass activeForm (present-continuous, e.g. 'writing tests') when marking in_progress.\",\n 'One call does both: an entry with an id changes that task, an entry without an id creates one. To change status, upsert the task by id, e.g. {\"action\":\"upsert\",\"tasks\":[{\"id\":3,\"status\":\"completed\"}]}. Never omit the id when you meant to change an existing task — an entry with no id creates a new one instead. An entry that carries an id and no other field is rejected.',\n 'Use blockedBy for dependencies (A is blocked by B). On an entry with no id pass blockedBy as the initial set; on an entry with an id use addBlockedBy / removeBlockedBy (additive merge, do not resend the full array). To depend on a task created earlier in the SAME call, give that earlier entry a \"ref\" and list the ref string in place of an id: [{\"ref\":\"api\",\"subject\":\"Design the API\"},{\"subject\":\"Implement the API\",\"blockedBy\":[\"api\"]}]. A ref must be declared before it is used. Cycles are rejected.',\n 'upsert applies each entry independently: the entries that pass are committed and the failures are reported with their array index. A failed entry changed nothing, so resend only the corrected failures — never resend the whole call, because an already-applied entry with no id would create a duplicate task.',\n 'Before assigning work, call subagent with {\"action\":\"agents\"} and match each task to an exact discovered agent name. Prefer a discovered general-purpose write-capable agent such as delegate or worker when no specialist fits. Use a focused inlineAgent only for read-only work.',\n 'Apply the session\\'s general delegation criteria before selecting tracked work. Use assignments[] for every assign call, including one task: {\"action\":\"assign\",\"assignments\":[{\"id\":1,\"agent\":\"researcher\"}]}. Put every assign-time field, including model, inlineAgent, instructions, relevantFiles, priorFindings, and context, inside its assignments[] entry; assign has no top-level single-task form. For two or more independent ready tasks selected for delegation, use one native batch instead of repeated calls. Do not wrap repeated task assign calls in multi_tool; assignments[] reduces tool overhead and returns one indexed result. Do not use a direct subagent run for work already represented in the shared task list, so ownership and terminal results stay visible.',\n 'A batched assign applies each entry independently. Successful entries are already running if another entry fails; retry only failed entries after correcting them, and never resend successful entries.',\n 'Populate relevantFiles only with files you actually read or located, and priorFindings only with verified facts such as symbol names, call sites, the selected approach, and ruled-out alternatives. Send at most a dozen files; a guessed path costs more than an omitted one. Keep priorFindings to a few lines of facts, not directives.',\n 'When delegated task completion unblocks another tracked task, reconsider that newly eligible task promptly and repeat agent discovery before assigning it if needed.',\n 'If a child asks for a decision through intercom, or an assignment fails to start for another concrete issue, respond, rescope, or retry explicitly. Do not silently leave the task pending.',\n 'assign refuses tasks that are blocked, already delegated, or completed. Resolve blockers first. Use {\"action\":\"cancel\",\"id\":3} to stop a running delegation; the task returns to pending.',\n 'Doom Task records delegated lifecycle and results on the shared task. The child does not update task status directly.',\n 'The task list is scoped to this session tree: delegated subagents share it, while unrelated sessions start empty. It persists for later inspection until retention cleanup.',\n \"Subject must be short and imperative (e.g. 'Research existing tool'); description is long-form detail written when you plan the task, and the delegated brief is that description plus the assign-time instructions, relevantFiles and priorFindings. Put durable scope in description and what you learned while exploring in the assign-time pack — do not repeat one in the other.\",\n];\n"],"mappings":"AAAA,MAAa,EAAsC,CACjD,6XACA,ukBACA,mNACA,uKACA,kPACA,qXACA,0fACA,qTACA,sRACA,iwBACA,0MACA,8UACA,uKACA,8LACA,4LACA,wHACA,8KACA,uXACF"}
1
+ {"version":3,"file":"promptGuidelines.cjs","names":[],"sources":["../../../src/commands/task/promptGuidelines.ts"],"sourcesContent":["/**\n * Cross-call behaviour the schema cannot express.\n *\n * Every rule lives in exactly one surface. Argument-site mechanics belong to\n * the parameter descriptions in `schemas/task.ts`, the use/do-not-use policy\n * and session scoping belong to the tool description, and general delegation\n * judgement belongs to the Team orchestrator prompt. What is left here is what\n * none of those three can carry: how calls should be sequenced across a turn.\n */\nexport const DEFAULT_PROMPT_GUIDELINES: string[] = [\n 'Batch the whole plan in one upsert: {\"action\":\"upsert\",\"tasks\":[{\"subject\":\"Research the store\"},{\"subject\":\"Write the reducer\"}]}. Report progress one call at a time: mark a task in_progress before you start it and completed the moment it lands, never batched at the end of a turn. Keep one task in_progress for your own work; delegated tasks run in parallel and do not count.',\n 'Never mark a task completed while tests fail or the work is partial. Use failed, or keep it in_progress and add a task for the blocker in the same upsert.',\n 'When every non-deleted task is completed, review the list once and call {\"action\":\"clear\"}.',\n \"Status flow: pending, in_progress, completed. failed is recoverable, deleted is a tombstone. Pass activeForm (e.g. 'writing tests') when marking in_progress.\",\n 'upsert applies each entry independently: passing entries commit and failures are reported by array index. Resend only the corrected failures, because resending an applied entry with no id creates a duplicate task.',\n 'Apply the session delegation criteria before choosing what to delegate, then call subagent {\"action\":\"agents\"} and use an exact discovered name. Prefer a general-purpose write-capable agent such as delegate or worker when no specialist fits, and use a focused inlineAgent only for read-only work.',\n 'Assign through assignments[] even for a single task: {\"action\":\"assign\",\"assignments\":[{\"id\":1,\"agent\":\"researcher\"}]}. Put independent ready tasks in one batch rather than repeated calls or multi_tool, and do not start a direct subagent run for work already on the task list. Successful entries keep running when another entry fails, so retry only the failures.',\n 'Fill relevantFiles only with files you actually read or located, and priorFindings only with verified facts in a few lines, not directives. A guessed path costs more than an omitted one.',\n 'Subject stays short and imperative. description is the durable brief handed to the subagent, extended at assign time by instructions, relevantFiles and priorFindings, so do not repeat one in the other.',\n 'When a delegated task completes and unblocks another, reconsider it promptly. If a child asks for a decision or an assignment fails to start, respond, rescope or retry instead of leaving it pending. Doom Task records delegated lifecycle and results on the task itself.',\n];\n"],"mappings":"AASA,MAAa,EAAsC,CACjD,4XACA,6JACA,8FACA,gKACA,wNACA,2SACA,6WACA,6LACA,4MACA,8QACF"}
@@ -1,4 +1,13 @@
1
1
  //#region src/commands/task/promptGuidelines.d.ts
2
+ /**
3
+ * Cross-call behaviour the schema cannot express.
4
+ *
5
+ * Every rule lives in exactly one surface. Argument-site mechanics belong to
6
+ * the parameter descriptions in `schemas/task.ts`, the use/do-not-use policy
7
+ * and session scoping belong to the tool description, and general delegation
8
+ * judgement belongs to the Team orchestrator prompt. What is left here is what
9
+ * none of those three can carry: how calls should be sequenced across a turn.
10
+ */
2
11
  declare const DEFAULT_PROMPT_GUIDELINES: string[];
3
12
  //#endregion
4
13
  export { DEFAULT_PROMPT_GUIDELINES };
@@ -1 +1 @@
1
- {"version":3,"file":"promptGuidelines.d.cts","names":[],"sources":["../../../src/commands/task/promptGuidelines.ts"],"mappings":";cAAa"}
1
+ {"version":3,"file":"promptGuidelines.d.cts","names":[],"sources":["../../../src/commands/task/promptGuidelines.ts"],"mappings":";;;;;;;;;;cASa"}
@@ -1,4 +1,13 @@
1
1
  //#region src/commands/task/promptGuidelines.d.ts
2
+ /**
3
+ * Cross-call behaviour the schema cannot express.
4
+ *
5
+ * Every rule lives in exactly one surface. Argument-site mechanics belong to
6
+ * the parameter descriptions in `schemas/task.ts`, the use/do-not-use policy
7
+ * and session scoping belong to the tool description, and general delegation
8
+ * judgement belongs to the Team orchestrator prompt. What is left here is what
9
+ * none of those three can carry: how calls should be sequenced across a turn.
10
+ */
2
11
  declare const DEFAULT_PROMPT_GUIDELINES: string[];
3
12
  //#endregion
4
13
  export { DEFAULT_PROMPT_GUIDELINES };
@@ -1 +1 @@
1
- {"version":3,"file":"promptGuidelines.d.mts","names":[],"sources":["../../../src/commands/task/promptGuidelines.ts"],"mappings":";cAAa"}
1
+ {"version":3,"file":"promptGuidelines.d.mts","names":[],"sources":["../../../src/commands/task/promptGuidelines.ts"],"mappings":";;;;;;;;;;cASa"}
@@ -1,2 +1,2 @@
1
- const e=[`Capture a whole plan in one call: {"action":"upsert","tasks":[{"subject":"Research existing tool"},{"subject":"Write the reducer"},{"subject":"Add tests"}]}. Batch whenever you are writing the plan down — the initial list, a revised plan, or wiring dependencies across several tasks — because one call keeps ids and blockers consistent and shows the user the whole plan at once.`,`Do not batch parent progress. Mark a task in_progress with its own call BEFORE beginning work, and completed with its own call IMMEDIATELY when it is done. upsert accepts many tasks, but a batch of completions sent at the end of a turn is still wrong: upsert batching is for writing a plan down, single calls are for reporting progress, and the user watches the task list to see where you are. Native assignments[] fan-out is separate from progress reporting. Exactly one task should be in_progress for your own work; delegated tasks run in parallel and do not count against that.`,`Never mark a task completed if tests are failing, the implementation is partial, or you hit unresolved errors, use status "failed" or keep it in_progress and add a new task for the blocker in the same upsert.`,`When every non-deleted task is completed, review the full task list once more and call task {"action":"clear"} to close it. Do not leave an all-completed list open.`,`Status is a state machine: pending in_progress completed, plus failed (recoverable, can go back to pending or in_progress) and deleted as a tombstone. Pass activeForm (present-continuous, e.g. 'writing tests') when marking in_progress.`,`One call does both: an entry with an id changes that task, an entry without an id creates one. To change status, upsert the task by id, e.g. {"action":"upsert","tasks":[{"id":3,"status":"completed"}]}. Never omit the id when you meant to change an existing task — an entry with no id creates a new one instead. An entry that carries an id and no other field is rejected.`,`Use blockedBy for dependencies (A is blocked by B). On an entry with no id pass blockedBy as the initial set; on an entry with an id use addBlockedBy / removeBlockedBy (additive merge, do not resend the full array). To depend on a task created earlier in the SAME call, give that earlier entry a "ref" and list the ref string in place of an id: [{"ref":"api","subject":"Design the API"},{"subject":"Implement the API","blockedBy":["api"]}]. A ref must be declared before it is used. Cycles are rejected.`,`upsert applies each entry independently: the entries that pass are committed and the failures are reported with their array index. A failed entry changed nothing, so resend only the corrected failures — never resend the whole call, because an already-applied entry with no id would create a duplicate task.`,`Before assigning work, call subagent with {"action":"agents"} and match each task to an exact discovered agent name. Prefer a discovered general-purpose write-capable agent such as delegate or worker when no specialist fits. Use a focused inlineAgent only for read-only work.`,`Apply the session's general delegation criteria before selecting tracked work. Use assignments[] for every assign call, including one task: {"action":"assign","assignments":[{"id":1,"agent":"researcher"}]}. Put every assign-time field, including model, inlineAgent, instructions, relevantFiles, priorFindings, and context, inside its assignments[] entry; assign has no top-level single-task form. For two or more independent ready tasks selected for delegation, use one native batch instead of repeated calls. Do not wrap repeated task assign calls in multi_tool; assignments[] reduces tool overhead and returns one indexed result. Do not use a direct subagent run for work already represented in the shared task list, so ownership and terminal results stay visible.`,`A batched assign applies each entry independently. Successful entries are already running if another entry fails; retry only failed entries after correcting them, and never resend successful entries.`,`Populate relevantFiles only with files you actually read or located, and priorFindings only with verified facts such as symbol names, call sites, the selected approach, and ruled-out alternatives. Send at most a dozen files; a guessed path costs more than an omitted one. Keep priorFindings to a few lines of facts, not directives.`,`When delegated task completion unblocks another tracked task, reconsider that newly eligible task promptly and repeat agent discovery before assigning it if needed.`,`If a child asks for a decision through intercom, or an assignment fails to start for another concrete issue, respond, rescope, or retry explicitly. Do not silently leave the task pending.`,`assign refuses tasks that are blocked, already delegated, or completed. Resolve blockers first. Use {"action":"cancel","id":3} to stop a running delegation; the task returns to pending.`,`Doom Task records delegated lifecycle and results on the shared task. The child does not update task status directly.`,`The task list is scoped to this session tree: delegated subagents share it, while unrelated sessions start empty. It persists for later inspection until retention cleanup.`,`Subject must be short and imperative (e.g. 'Research existing tool'); description is long-form detail written when you plan the task, and the delegated brief is that description plus the assign-time instructions, relevantFiles and priorFindings. Put durable scope in description and what you learned while exploring in the assign-time pack — do not repeat one in the other.`];export{e as DEFAULT_PROMPT_GUIDELINES};
1
+ const e=[`Batch the whole plan in one upsert: {"action":"upsert","tasks":[{"subject":"Research the store"},{"subject":"Write the reducer"}]}. Report progress one call at a time: mark a task in_progress before you start it and completed the moment it lands, never batched at the end of a turn. Keep one task in_progress for your own work; delegated tasks run in parallel and do not count.`,`Never mark a task completed while tests fail or the work is partial. Use failed, or keep it in_progress and add a task for the blocker in the same upsert.`,`When every non-deleted task is completed, review the list once and call {"action":"clear"}.`,`Status flow: pending, in_progress, completed. failed is recoverable, deleted is a tombstone. Pass activeForm (e.g. 'writing tests') when marking in_progress.`,`upsert applies each entry independently: passing entries commit and failures are reported by array index. Resend only the corrected failures, because resending an applied entry with no id creates a duplicate task.`,`Apply the session delegation criteria before choosing what to delegate, then call subagent {"action":"agents"} and use an exact discovered name. Prefer a general-purpose write-capable agent such as delegate or worker when no specialist fits, and use a focused inlineAgent only for read-only work.`,`Assign through assignments[] even for a single task: {"action":"assign","assignments":[{"id":1,"agent":"researcher"}]}. Put independent ready tasks in one batch rather than repeated calls or multi_tool, and do not start a direct subagent run for work already on the task list. Successful entries keep running when another entry fails, so retry only the failures.`,`Fill relevantFiles only with files you actually read or located, and priorFindings only with verified facts in a few lines, not directives. A guessed path costs more than an omitted one.`,`Subject stays short and imperative. description is the durable brief handed to the subagent, extended at assign time by instructions, relevantFiles and priorFindings, so do not repeat one in the other.`,`When a delegated task completes and unblocks another, reconsider it promptly. If a child asks for a decision or an assignment fails to start, respond, rescope or retry instead of leaving it pending. Doom Task records delegated lifecycle and results on the task itself.`];export{e as DEFAULT_PROMPT_GUIDELINES};
2
2
  //# sourceMappingURL=promptGuidelines.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"promptGuidelines.mjs","names":[],"sources":["../../../src/commands/task/promptGuidelines.ts"],"sourcesContent":["export const DEFAULT_PROMPT_GUIDELINES: string[] = [\n 'Capture a whole plan in one call: {\"action\":\"upsert\",\"tasks\":[{\"subject\":\"Research existing tool\"},{\"subject\":\"Write the reducer\"},{\"subject\":\"Add tests\"}]}. Batch whenever you are writing the plan down the initial list, a revised plan, or wiring dependencies across several tasks because one call keeps ids and blockers consistent and shows the user the whole plan at once.',\n 'Do not batch parent progress. Mark a task in_progress with its own call BEFORE beginning work, and completed with its own call IMMEDIATELY when it is done. upsert accepts many tasks, but a batch of completions sent at the end of a turn is still wrong: upsert batching is for writing a plan down, single calls are for reporting progress, and the user watches the task list to see where you are. Native assignments[] fan-out is separate from progress reporting. Exactly one task should be in_progress for your own work; delegated tasks run in parallel and do not count against that.',\n 'Never mark a task completed if tests are failing, the implementation is partial, or you hit unresolved errors, use status \"failed\" or keep it in_progress and add a new task for the blocker in the same upsert.',\n 'When every non-deleted task is completed, review the full task list once more and call task {\"action\":\"clear\"} to close it. Do not leave an all-completed list open.',\n \"Status is a state machine: pending in_progress completed, plus failed (recoverable, can go back to pending or in_progress) and deleted as a tombstone. Pass activeForm (present-continuous, e.g. 'writing tests') when marking in_progress.\",\n 'One call does both: an entry with an id changes that task, an entry without an id creates one. To change status, upsert the task by id, e.g. {\"action\":\"upsert\",\"tasks\":[{\"id\":3,\"status\":\"completed\"}]}. Never omit the id when you meant to change an existing task — an entry with no id creates a new one instead. An entry that carries an id and no other field is rejected.',\n 'Use blockedBy for dependencies (A is blocked by B). On an entry with no id pass blockedBy as the initial set; on an entry with an id use addBlockedBy / removeBlockedBy (additive merge, do not resend the full array). To depend on a task created earlier in the SAME call, give that earlier entry a \"ref\" and list the ref string in place of an id: [{\"ref\":\"api\",\"subject\":\"Design the API\"},{\"subject\":\"Implement the API\",\"blockedBy\":[\"api\"]}]. A ref must be declared before it is used. Cycles are rejected.',\n 'upsert applies each entry independently: the entries that pass are committed and the failures are reported with their array index. A failed entry changed nothing, so resend only the corrected failures — never resend the whole call, because an already-applied entry with no id would create a duplicate task.',\n 'Before assigning work, call subagent with {\"action\":\"agents\"} and match each task to an exact discovered agent name. Prefer a discovered general-purpose write-capable agent such as delegate or worker when no specialist fits. Use a focused inlineAgent only for read-only work.',\n 'Apply the session\\'s general delegation criteria before selecting tracked work. Use assignments[] for every assign call, including one task: {\"action\":\"assign\",\"assignments\":[{\"id\":1,\"agent\":\"researcher\"}]}. Put every assign-time field, including model, inlineAgent, instructions, relevantFiles, priorFindings, and context, inside its assignments[] entry; assign has no top-level single-task form. For two or more independent ready tasks selected for delegation, use one native batch instead of repeated calls. Do not wrap repeated task assign calls in multi_tool; assignments[] reduces tool overhead and returns one indexed result. Do not use a direct subagent run for work already represented in the shared task list, so ownership and terminal results stay visible.',\n 'A batched assign applies each entry independently. Successful entries are already running if another entry fails; retry only failed entries after correcting them, and never resend successful entries.',\n 'Populate relevantFiles only with files you actually read or located, and priorFindings only with verified facts such as symbol names, call sites, the selected approach, and ruled-out alternatives. Send at most a dozen files; a guessed path costs more than an omitted one. Keep priorFindings to a few lines of facts, not directives.',\n 'When delegated task completion unblocks another tracked task, reconsider that newly eligible task promptly and repeat agent discovery before assigning it if needed.',\n 'If a child asks for a decision through intercom, or an assignment fails to start for another concrete issue, respond, rescope, or retry explicitly. Do not silently leave the task pending.',\n 'assign refuses tasks that are blocked, already delegated, or completed. Resolve blockers first. Use {\"action\":\"cancel\",\"id\":3} to stop a running delegation; the task returns to pending.',\n 'Doom Task records delegated lifecycle and results on the shared task. The child does not update task status directly.',\n 'The task list is scoped to this session tree: delegated subagents share it, while unrelated sessions start empty. It persists for later inspection until retention cleanup.',\n \"Subject must be short and imperative (e.g. 'Research existing tool'); description is long-form detail written when you plan the task, and the delegated brief is that description plus the assign-time instructions, relevantFiles and priorFindings. Put durable scope in description and what you learned while exploring in the assign-time pack — do not repeat one in the other.\",\n];\n"],"mappings":"AAAA,MAAa,EAAsC,CACjD,6XACA,ukBACA,mNACA,uKACA,kPACA,qXACA,0fACA,qTACA,sRACA,iwBACA,0MACA,8UACA,uKACA,8LACA,4LACA,wHACA,8KACA,uXACF"}
1
+ {"version":3,"file":"promptGuidelines.mjs","names":[],"sources":["../../../src/commands/task/promptGuidelines.ts"],"sourcesContent":["/**\n * Cross-call behaviour the schema cannot express.\n *\n * Every rule lives in exactly one surface. Argument-site mechanics belong to\n * the parameter descriptions in `schemas/task.ts`, the use/do-not-use policy\n * and session scoping belong to the tool description, and general delegation\n * judgement belongs to the Team orchestrator prompt. What is left here is what\n * none of those three can carry: how calls should be sequenced across a turn.\n */\nexport const DEFAULT_PROMPT_GUIDELINES: string[] = [\n 'Batch the whole plan in one upsert: {\"action\":\"upsert\",\"tasks\":[{\"subject\":\"Research the store\"},{\"subject\":\"Write the reducer\"}]}. Report progress one call at a time: mark a task in_progress before you start it and completed the moment it lands, never batched at the end of a turn. Keep one task in_progress for your own work; delegated tasks run in parallel and do not count.',\n 'Never mark a task completed while tests fail or the work is partial. Use failed, or keep it in_progress and add a task for the blocker in the same upsert.',\n 'When every non-deleted task is completed, review the list once and call {\"action\":\"clear\"}.',\n \"Status flow: pending, in_progress, completed. failed is recoverable, deleted is a tombstone. Pass activeForm (e.g. 'writing tests') when marking in_progress.\",\n 'upsert applies each entry independently: passing entries commit and failures are reported by array index. Resend only the corrected failures, because resending an applied entry with no id creates a duplicate task.',\n 'Apply the session delegation criteria before choosing what to delegate, then call subagent {\"action\":\"agents\"} and use an exact discovered name. Prefer a general-purpose write-capable agent such as delegate or worker when no specialist fits, and use a focused inlineAgent only for read-only work.',\n 'Assign through assignments[] even for a single task: {\"action\":\"assign\",\"assignments\":[{\"id\":1,\"agent\":\"researcher\"}]}. Put independent ready tasks in one batch rather than repeated calls or multi_tool, and do not start a direct subagent run for work already on the task list. Successful entries keep running when another entry fails, so retry only the failures.',\n 'Fill relevantFiles only with files you actually read or located, and priorFindings only with verified facts in a few lines, not directives. A guessed path costs more than an omitted one.',\n 'Subject stays short and imperative. description is the durable brief handed to the subagent, extended at assign time by instructions, relevantFiles and priorFindings, so do not repeat one in the other.',\n 'When a delegated task completes and unblocks another, reconsider it promptly. If a child asks for a decision or an assignment fails to start, respond, rescope or retry instead of leaving it pending. Doom Task records delegated lifecycle and results on the task itself.',\n];\n"],"mappings":"AASA,MAAa,EAAsC,CACjD,4XACA,6JACA,8FACA,gKACA,wNACA,2SACA,6WACA,6LACA,4MACA,8QACF"}
@@ -1,3 +1,3 @@
1
1
  const e=require("../../schemas/task.cjs"),t=require("../../services/store/reducer.cjs"),n=require("../../types/telemetry.cjs"),r=require("../../tui/format2.cjs");require("../../types/config.cjs");const i=require("./promptGuidelines.cjs"),a=require("./responseEnvelope.cjs"),o=`tool.action`,s=`task.id`,c=new Set([`upsert`,`list`,`get`,`delete`,`clear`]);var l=class extends Error{};function u(e,t){return new l([`Task ${e} failed: ${t}`,``,`Options:`,`- List the task board and inspect the current ids, states, and blockers.`,`- Correct the arguments or state conflict, then retry once.`,`- Ask the user before cancelling work or changing dependencies to recover.`].join(`
2
- `))}function d(t,n){let r=Object.keys(n).filter(r=>n[r]!==void 0&&!e.taskActionAcceptsField(t,r));if(r.length===0)return;let i=t===`upsert`?` ${e.MSG_UPSERT_FIELD_MISPLACED}`:``;throw u(t,`${t} does not accept ${r.join(`, `)}.${i}`)}function f(e){let t=e.assignments;if(!t||t.length===0)throw u(`assign`,`assign requires a non-empty assignments[] array`);return t}function p(e,t){return{agent:e.agent,inlineAgent:e.inlineAgent,instructions:e.instructions,relevantFiles:e.relevantFiles,priorFindings:e.priorFindings,model:e.model,context:e.context,signal:t}}async function m(e,t,r,i){let a=[];for(let[c,l]of t.entries()){let t;try{t=await e.assign(l.id,p(l,r))}catch(e){i?.error(n.TASK_EVENT.toolFailed,e,{[o]:`assign`,[s]:l.id}),t={ok:!1,message:e instanceof Error?e.message:String(e)}}a.push({index:c,id:l.id,agent:l.agent,...t})}return a}async function h(e,n,r,i){let{document:o,value:s}=await e.mutate(e=>{let a=t.applyTaskMutation(e,n,r,void 0,i);return{...t.isCommittingOp(a.op)?{document:a.document}:{},value:a}});if(s.op.kind===`error`)throw u(n,s.op.message);if(s.op.kind===`upsert`&&s.op.applied===0)throw u(n,a.formatUpsertFailureText(s.op));return a.buildToolResult(n,r,o,s.op)}function g(t,p){let{store:g,delegation:_,maxTasks:v=15}=p;t.registerTool({name:e.TOOL_NAME,label:e.TOOL_LABEL,description:`Track complex jobs with a shared task list and delegate tracked work to subagents. Use this only when persistent coordination is useful, such as work with dependencies, parallel workstreams, or a long-running plan. Do not use it for simple requests, routine edits, straightforward command sequences, or merely because the user listed multiple steps. Actions: upsert (write tasks: an entry with an id changes that task and one without an id creates one), list, get, delete (tombstone), clear (close/reset the list), assign (hand tasks through assignments[] to named background subagents), cancel (stop a delegated run). upsert and assign apply entries independently: successes remain committed or delegated and failures are reported by array index. Batch a plan and independent assignments, but report progress one task at a time. Status: pending → in_progress → completed, plus failed and a deleted tombstone. The list is shared within the current session tree, including delegated subagents, while unrelated sessions start empty. Session stores persist until retention cleanup.`,promptGuidelines:i.DEFAULT_PROMPT_GUIDELINES,parameters:e.TaskParamsSchema,renderShell:`self`,async execute(e,t,r,i,y){let b=t.action,x=t;try{if(await p.waitUntilReady?.(y,r),d(b,x),c.has(b)){let e=await h(g,b,x,v);return p.onChange?.(),e}if(b===`assign`){let e=f(x),t=e[0],n=e.length===1&&t?`Delegating task #${t.id}...`:`Delegating ${e.length} tasks...`;i?.(a.buildTextResult(b,x,g.snapshot,n));let o=await m(_,e,r,p.report);p.onChange?.();let s=a.formatAssignmentResults(o),c=o.flatMap(e=>e.ok?[e.id]:[]);if(c.length===0)throw u(b,s);return a.buildAssignmentResult(x,g.snapshot,s,{assigned:c,failed:o.length-c.length})}i?.(a.buildTextResult(b,x,g.snapshot,`Requesting cancellation for task #${x.id??`unknown`}...`));let e=await _.cancel(x.id??NaN);if(p.onChange?.(),!e.ok)throw u(b,e.message);return a.buildTextResult(b,x,g.snapshot,e.message,void 0)}catch(e){throw p.report?.error(n.TASK_EVENT.toolFailed,e,{[o]:b,...x.id===void 0?{}:{[s]:x.id}}),e instanceof l?e:u(b,e instanceof Error?e.message:String(e))}},renderCall(e,t,n){return r.renderTaskCall(e,t,g.snapshot.tasks)},renderResult(e,t,n,i){return r.renderTaskResult(e,t,n)}})}exports.DEFAULT_PROMPT_GUIDELINES=i.DEFAULT_PROMPT_GUIDELINES,exports.DEFAULT_PROMPT_SNIPPET=`Track only complex, multi-step jobs that benefit from persistent progress or delegation; skip simple work`,exports.registerTaskTool=g;
2
+ `))}function d(t,n){let r=Object.keys(n).filter(r=>n[r]!==void 0&&!e.taskActionAcceptsField(t,r));if(r.length===0)return;let i=t===`upsert`?` ${e.MSG_UPSERT_FIELD_MISPLACED}`:``;throw u(t,`${t} does not accept ${r.join(`, `)}.${i}`)}function f(e){let t=e.assignments;if(!t||t.length===0)throw u(`assign`,`assign requires a non-empty assignments[] array`);return t}function p(e,t){return{agent:e.agent,inlineAgent:e.inlineAgent,instructions:e.instructions,relevantFiles:e.relevantFiles,priorFindings:e.priorFindings,model:e.model,context:e.context,signal:t}}async function m(e,t,r,i){let a=[];for(let[c,l]of t.entries()){let t;try{t=await e.assign(l.id,p(l,r))}catch(e){i?.error(n.TASK_EVENT.toolFailed,e,{[o]:`assign`,[s]:l.id}),t={ok:!1,message:e instanceof Error?e.message:String(e)}}a.push({index:c,id:l.id,agent:l.agent,...t})}return a}async function h(e,n,r,i){let{document:o,value:s}=await e.mutate(e=>{let a=t.applyTaskMutation(e,n,r,void 0,i);return{...t.isCommittingOp(a.op)?{document:a.document}:{},value:a}});if(s.op.kind===`error`)throw u(n,s.op.message);if(s.op.kind===`upsert`&&s.op.applied===0)throw u(n,a.formatUpsertFailureText(s.op));return a.buildToolResult(n,r,o,s.op)}function g(t,p){let{store:g,delegation:_,maxTasks:v=15}=p;t.registerTool({name:e.TOOL_NAME,label:e.TOOL_LABEL,description:`Shared task list for complex jobs, plus delegation of tracked tasks to background subagents. Use it only when persistent coordination pays off: dependencies, parallel workstreams, or a long-running plan. Do not use it for simple requests, routine edits, straightforward command sequences, or merely because the user listed multiple steps. Actions: upsert (create and change tasks), list, get, delete (tombstone), clear (close the list), assign (delegate through assignments[]), cancel (stop a delegated run). The list is shared across the current session tree, including delegated subagents, while unrelated sessions start empty and stores persist until retention cleanup.`,promptGuidelines:i.DEFAULT_PROMPT_GUIDELINES,parameters:e.TaskParamsSchema,renderShell:`self`,async execute(e,t,r,i,y){let b=t.action,x=t;try{if(await p.waitUntilReady?.(y,r),d(b,x),c.has(b)){let e=await h(g,b,x,v);return p.onChange?.(),e}if(b===`assign`){let e=f(x),t=e[0],n=e.length===1&&t?`Delegating task #${t.id}...`:`Delegating ${e.length} tasks...`;i?.(a.buildTextResult(b,x,g.snapshot,n));let o=await m(_,e,r,p.report);p.onChange?.();let s=a.formatAssignmentResults(o),c=o.flatMap(e=>e.ok?[e.id]:[]);if(c.length===0)throw u(b,s);return a.buildAssignmentResult(x,g.snapshot,s,{assigned:c,failed:o.length-c.length})}i?.(a.buildTextResult(b,x,g.snapshot,`Requesting cancellation for task #${x.id??`unknown`}...`));let e=await _.cancel(x.id??NaN);if(p.onChange?.(),!e.ok)throw u(b,e.message);return a.buildTextResult(b,x,g.snapshot,e.message,void 0)}catch(e){throw p.report?.error(n.TASK_EVENT.toolFailed,e,{[o]:b,...x.id===void 0?{}:{[s]:x.id}}),e instanceof l?e:u(b,e instanceof Error?e.message:String(e))}},renderCall(e,t,n){return r.renderTaskCall(e,t,g.snapshot.tasks)},renderResult(e,t,n,i){return r.renderTaskResult(e,t,n)}})}exports.DEFAULT_PROMPT_GUIDELINES=i.DEFAULT_PROMPT_GUIDELINES,exports.DEFAULT_PROMPT_SNIPPET=`Track only complex, multi-step jobs that benefit from persistent progress or delegation; skip simple work`,exports.registerTaskTool=g;
3
3
  //# sourceMappingURL=taskTool.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"taskTool.cjs","names":["taskActionAcceptsField","MSG_UPSERT_FIELD_MISPLACED","TASK_EVENT","applyTaskMutation","isCommittingOp","formatUpsertFailureText","buildToolResult","TOOL_NAME","TOOL_LABEL","DEFAULT_PROMPT_GUIDELINES","TaskParamsSchema","buildTextResult","formatAssignmentResults","buildAssignmentResult","renderTaskCall","renderTaskResult"],"sources":["../../../src/commands/task/taskTool.ts"],"sourcesContent":["import type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\nimport {\n MSG_UPSERT_FIELD_MISPLACED,\n TaskParamsSchema,\n TOOL_LABEL,\n TOOL_NAME,\n taskActionAcceptsField,\n} from '../../schemas/task.ts';\nimport type { AssignOptions, DelegationManager, DelegationOutcome } from '../../services/delegation/manager.ts';\nimport { applyTaskMutation, isCommittingOp, type ReducerAction } from '../../services/store/reducer.ts';\nimport type { TaskStore } from '../../adapters/store/taskStore';\nimport type { TaskAction, TaskAssignment, TaskMutationParams } from '../../services/store/types.ts';\nimport { renderTaskCall, renderTaskResult } from '../../tui/format.ts';\nimport { DEFAULT_MAX_TASKS } from '../../types/config.ts';\nimport { TASK_EVENT, type TaskFailureReporter } from '../../types/telemetry.ts';\nimport { DEFAULT_PROMPT_GUIDELINES } from './promptGuidelines.ts';\nimport {\n type AssignmentItemResult,\n buildAssignmentResult,\n buildTextResult,\n buildToolResult,\n formatAssignmentResults,\n formatUpsertFailureText,\n type ToolResult,\n} from './responseEnvelope.ts';\n\nexport { DEFAULT_PROMPT_GUIDELINES } from './promptGuidelines.ts';\n\n/** @deprecated Task usage policy now lives only in the tool description. */\nexport const DEFAULT_PROMPT_SNIPPET =\n 'Track only complex, multi-step jobs that benefit from persistent progress or delegation; skip simple work';\n\nexport interface TaskToolDependencies {\n store: TaskStore;\n delegation: DelegationManager;\n maxTasks?: number;\n onChange?: () => void;\n report?: TaskFailureReporter;\n waitUntilReady?: (context: ExtensionContext, signal?: AbortSignal) => Promise<void>;\n}\n\nconst ACTION_ATTRIBUTE = 'tool.action';\nconst TASK_ID_ATTRIBUTE = 'task.id';\nconst REDUCER_ACTIONS = new Set<TaskAction>(['upsert', 'list', 'get', 'delete', 'clear']);\n\nclass TaskToolExecutionError extends Error {}\n\nfunction actionableTaskError(action: TaskAction, message: string): TaskToolExecutionError {\n return new TaskToolExecutionError(\n [\n `Task ${action} failed: ${message}`,\n '',\n 'Options:',\n '- List the task board and inspect the current ids, states, and blockers.',\n '- Correct the arguments or state conflict, then retry once.',\n '- Ask the user before cancelling work or changing dependencies to recover.',\n ].join('\\n'),\n );\n}\n\n/**\n * Reject a field that belongs to a different action.\n *\n * The params schema is flat and shared across every action, so this is the only\n * place `{\"action\":\"upsert\",\"id\":3}` can be caught — and it must be, because\n * the entry it carries has no id and would silently create a duplicate task.\n */\nfunction rejectStrayFields(action: TaskAction, params: TaskMutationParams): void {\n const stray = Object.keys(params).filter((key) => params[key] !== undefined && !taskActionAcceptsField(action, key));\n if (stray.length === 0) return;\n const hint = action === 'upsert' ? ` ${MSG_UPSERT_FIELD_MISPLACED}` : '';\n throw actionableTaskError(action, `${action} does not accept ${stray.join(', ')}.${hint}`);\n}\n\n/** assignments[] is the only assign contract, even when it contains one task. */\nfunction resolveAssignments(params: TaskMutationParams): TaskAssignment[] {\n const assignments = params.assignments;\n if (!assignments || assignments.length === 0) {\n throw actionableTaskError('assign', 'assign requires a non-empty assignments[] array');\n }\n return assignments;\n}\n\nfunction assignOptions(request: TaskAssignment, signal: AbortSignal | undefined): AssignOptions {\n return {\n agent: request.agent,\n inlineAgent: request.inlineAgent,\n instructions: request.instructions,\n relevantFiles: request.relevantFiles,\n priorFindings: request.priorFindings,\n model: request.model,\n context: request.context,\n signal,\n };\n}\n\nasync function executeAssignmentBatch(\n delegation: DelegationManager,\n assignments: readonly TaskAssignment[],\n signal: AbortSignal | undefined,\n report: TaskFailureReporter | undefined,\n): Promise<AssignmentItemResult[]> {\n const results: AssignmentItemResult[] = [];\n for (const [index, assignment] of assignments.entries()) {\n let outcome: DelegationOutcome;\n try {\n outcome = await delegation.assign(assignment.id, assignOptions(assignment, signal));\n } catch (error) {\n report?.error(TASK_EVENT.toolFailed, error, {\n [ACTION_ATTRIBUTE]: 'assign',\n [TASK_ID_ATTRIBUTE]: assignment.id,\n });\n outcome = { ok: false, message: error instanceof Error ? error.message : String(error) };\n }\n results.push({ index, id: assignment.id, agent: assignment.agent, ...outcome });\n }\n return results;\n}\n\n/** Run an action through the reducer, persisting only when it produced a change. */\nasync function executeReducerAction(\n store: TaskStore,\n action: ReducerAction,\n params: TaskMutationParams,\n maxTasks: number,\n): Promise<ToolResult> {\n const { document, value } = await store.mutate((current) => {\n const result = applyTaskMutation(current, action, params, undefined, maxTasks);\n return {\n ...(isCommittingOp(result.op) ? { document: result.document } : {}),\n value: result,\n };\n });\n if (value.op.kind === 'error') throw actionableTaskError(action, value.op.message);\n // An upsert that applied nothing is a failed call: it wrote nothing and left\n // `rev` alone, so it must not read to the model as a success. A batch where\n // some entries landed returns normally — that is what partial apply means.\n if (value.op.kind === 'upsert' && value.op.applied === 0) {\n throw actionableTaskError(action, formatUpsertFailureText(value.op));\n }\n // `document` is the committed document, so `details.rev` matches what landed\n // on disk; `value.document` is the pre-write copy and lags by one.\n return buildToolResult(action, params, document, value.op);\n}\n\nexport function registerTaskTool(pi: ExtensionAPI, dependencies: TaskToolDependencies): void {\n const { store, delegation, maxTasks = DEFAULT_MAX_TASKS } = dependencies;\n\n pi.registerTool({\n name: TOOL_NAME,\n label: TOOL_LABEL,\n description:\n 'Track complex jobs with a shared task list and delegate tracked work to subagents. Use this only when persistent coordination is useful, such as work with dependencies, parallel workstreams, or a long-running plan. Do not use it for simple requests, routine edits, straightforward command sequences, or merely because the user listed multiple steps. Actions: upsert (write tasks: an entry with an id changes that task and one without an id creates one), list, get, delete (tombstone), clear (close/reset the list), assign (hand tasks through assignments[] to named background subagents), cancel (stop a delegated run). upsert and assign apply entries independently: successes remain committed or delegated and failures are reported by array index. Batch a plan and independent assignments, but report progress one task at a time. Status: pending → in_progress → completed, plus failed and a deleted tombstone. The list is shared within the current session tree, including delegated subagents, while unrelated sessions start empty. Session stores persist until retention cleanup.',\n promptGuidelines: DEFAULT_PROMPT_GUIDELINES,\n parameters: TaskParamsSchema,\n // Task rows carry their own status colors. Owning the shell prevents Pi's\n // pending/success/error background fill from obscuring those row states.\n renderShell: 'self',\n\n async execute(_toolCallId, params, signal, onUpdate, ctx) {\n const action = params.action as TaskAction;\n const mutationParams = params as TaskMutationParams;\n\n try {\n await dependencies.waitUntilReady?.(ctx, signal);\n rejectStrayFields(action, mutationParams);\n if (REDUCER_ACTIONS.has(action)) {\n const result = await executeReducerAction(store, action as ReducerAction, mutationParams, maxTasks);\n dependencies.onChange?.();\n return result;\n }\n\n if (action === 'assign') {\n const assignments = resolveAssignments(mutationParams);\n const first = assignments[0];\n const progress =\n assignments.length === 1 && first\n ? `Delegating task #${first.id}...`\n : `Delegating ${assignments.length} tasks...`;\n onUpdate?.(buildTextResult(action, mutationParams, store.snapshot, progress));\n const results = await executeAssignmentBatch(delegation, assignments, signal, dependencies.report);\n dependencies.onChange?.();\n const text = formatAssignmentResults(results);\n const assigned = results.flatMap((item) => (item.ok ? [item.id] : []));\n if (assigned.length === 0) throw actionableTaskError(action, text);\n return buildAssignmentResult(mutationParams, store.snapshot, text, {\n assigned,\n failed: results.length - assigned.length,\n });\n }\n\n onUpdate?.(\n buildTextResult(\n action,\n mutationParams,\n store.snapshot,\n `Requesting cancellation for task #${mutationParams.id ?? 'unknown'}...`,\n ),\n );\n const outcome = await delegation.cancel(mutationParams.id ?? Number.NaN);\n dependencies.onChange?.();\n if (!outcome.ok) throw actionableTaskError(action, outcome.message);\n return buildTextResult(action, mutationParams, store.snapshot, outcome.message, undefined);\n } catch (error) {\n // Rethrown so pi still renders the failure to the model; recorded\n // because this is where a store fault becomes visible to the user.\n dependencies.report?.error(TASK_EVENT.toolFailed, error, {\n [ACTION_ATTRIBUTE]: action,\n ...(mutationParams.id === undefined ? {} : { [TASK_ID_ATTRIBUTE]: mutationParams.id }),\n });\n if (error instanceof TaskToolExecutionError) throw error;\n throw actionableTaskError(action, error instanceof Error ? error.message : String(error));\n }\n },\n\n // Render hooks receive no session identity, so they read the store snapshot\n // that the executing session last loaded. That is the foreground session's\n // own view, which is exactly what its transcript should show.\n renderCall(args, theme, _context) {\n return renderTaskCall(args as never, theme, store.snapshot.tasks);\n },\n\n renderResult(result, options, theme, _context) {\n return renderTaskResult(result, options, theme);\n },\n });\n}\n"],"mappings":"kRAyCM,EAAmB,cACnB,EAAoB,UACpB,EAAkB,IAAI,IAAgB,CAAC,SAAU,OAAQ,MAAO,SAAU,OAAO,CAAC,EAExF,IAAM,EAAN,cAAqC,KAAM,CAAC,EAE5C,SAAS,EAAoB,EAAoB,EAAyC,CACxF,OAAO,IAAI,EACT,CACE,QAAQ,EAAO,WAAW,IAC1B,GACA,WACA,2E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SERT_FIELD_MISPLACED","TASK_EVENT","applyTaskMutation","isCommittingOp","formatUpsertFailureText","buildToolResult","TOOL_NAME","TOOL_LABEL","DEFAULT_PROMPT_GUIDELINES","TaskParamsSchema","buildTextResult","formatAssignmentResults","buildAssignmentResult","renderTaskCall","renderTaskResult"],"sources":["../../../src/commands/task/taskTool.ts"],"sourcesContent":["import type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\nimport {\n MSG_UPSERT_FIELD_MISPLACED,\n TaskParamsSchema,\n TOOL_LABEL,\n TOOL_NAME,\n taskActionAcceptsField,\n} from '../../schemas/task.ts';\nimport type { AssignOptions, DelegationManager, DelegationOutcome } from '../../services/delegation/manager.ts';\nimport { applyTaskMutation, isCommittingOp, type ReducerAction } from '../../services/store/reducer.ts';\nimport type { TaskStore } from '../../adapters/store/taskStore';\nimport type { TaskAction, TaskAssignment, TaskMutationParams } from '../../services/store/types.ts';\nimport { renderTaskCall, renderTaskResult } from '../../tui/format.ts';\nimport { DEFAULT_MAX_TASKS } from '../../types/config.ts';\nimport { TASK_EVENT, type TaskFailureReporter } from '../../types/telemetry.ts';\nimport { DEFAULT_PROMPT_GUIDELINES } from './promptGuidelines.ts';\nimport {\n type AssignmentItemResult,\n buildAssignmentResult,\n buildTextResult,\n buildToolResult,\n formatAssignmentResults,\n formatUpsertFailureText,\n type ToolResult,\n} from './responseEnvelope.ts';\n\nexport { DEFAULT_PROMPT_GUIDELINES } from './promptGuidelines.ts';\n\n/** @deprecated Task usage policy now lives only in the tool description. */\nexport const DEFAULT_PROMPT_SNIPPET =\n 'Track only complex, multi-step jobs that benefit from persistent progress or delegation; skip simple work';\n\nexport interface TaskToolDependencies {\n store: TaskStore;\n delegation: DelegationManager;\n maxTasks?: number;\n onChange?: () => void;\n report?: TaskFailureReporter;\n waitUntilReady?: (context: ExtensionContext, signal?: AbortSignal) => Promise<void>;\n}\n\nconst ACTION_ATTRIBUTE = 'tool.action';\nconst TASK_ID_ATTRIBUTE = 'task.id';\nconst REDUCER_ACTIONS = new Set<TaskAction>(['upsert', 'list', 'get', 'delete', 'clear']);\n\nclass TaskToolExecutionError extends Error {}\n\nfunction actionableTaskError(action: TaskAction, message: string): TaskToolExecutionError {\n return new TaskToolExecutionError(\n [\n `Task ${action} failed: ${message}`,\n '',\n 'Options:',\n '- List the task board and inspect the current ids, states, and blockers.',\n '- Correct the arguments or state conflict, then retry once.',\n '- Ask the user before cancelling work or changing dependencies to recover.',\n ].join('\\n'),\n );\n}\n\n/**\n * Reject a field that belongs to a different action.\n *\n * The params schema is flat and shared across every action, so this is the only\n * place `{\"action\":\"upsert\",\"id\":3}` can be caught — and it must be, because\n * the entry it carries has no id and would silently create a duplicate task.\n */\nfunction rejectStrayFields(action: TaskAction, params: TaskMutationParams): void {\n const stray = Object.keys(params).filter((key) => params[key] !== undefined && !taskActionAcceptsField(action, key));\n if (stray.length === 0) return;\n const hint = action === 'upsert' ? ` ${MSG_UPSERT_FIELD_MISPLACED}` : '';\n throw actionableTaskError(action, `${action} does not accept ${stray.join(', ')}.${hint}`);\n}\n\n/** assignments[] is the only assign contract, even when it contains one task. */\nfunction resolveAssignments(params: TaskMutationParams): TaskAssignment[] {\n const assignments = params.assignments;\n if (!assignments || assignments.length === 0) {\n throw actionableTaskError('assign', 'assign requires a non-empty assignments[] array');\n }\n return assignments;\n}\n\nfunction assignOptions(request: TaskAssignment, signal: AbortSignal | undefined): AssignOptions {\n return {\n agent: request.agent,\n inlineAgent: request.inlineAgent,\n instructions: request.instructions,\n relevantFiles: request.relevantFiles,\n priorFindings: request.priorFindings,\n model: request.model,\n context: request.context,\n signal,\n };\n}\n\nasync function executeAssignmentBatch(\n delegation: DelegationManager,\n assignments: readonly TaskAssignment[],\n signal: AbortSignal | undefined,\n report: TaskFailureReporter | undefined,\n): Promise<AssignmentItemResult[]> {\n const results: AssignmentItemResult[] = [];\n for (const [index, assignment] of assignments.entries()) {\n let outcome: DelegationOutcome;\n try {\n outcome = await delegation.assign(assignment.id, assignOptions(assignment, signal));\n } catch (error) {\n report?.error(TASK_EVENT.toolFailed, error, {\n [ACTION_ATTRIBUTE]: 'assign',\n [TASK_ID_ATTRIBUTE]: assignment.id,\n });\n outcome = { ok: false, message: error instanceof Error ? error.message : String(error) };\n }\n results.push({ index, id: assignment.id, agent: assignment.agent, ...outcome });\n }\n return results;\n}\n\n/** Run an action through the reducer, persisting only when it produced a change. */\nasync function executeReducerAction(\n store: TaskStore,\n action: ReducerAction,\n params: TaskMutationParams,\n maxTasks: number,\n): Promise<ToolResult> {\n const { document, value } = await store.mutate((current) => {\n const result = applyTaskMutation(current, action, params, undefined, maxTasks);\n return {\n ...(isCommittingOp(result.op) ? { document: result.document } : {}),\n value: result,\n };\n });\n if (value.op.kind === 'error') throw actionableTaskError(action, value.op.message);\n // An upsert that applied nothing is a failed call: it wrote nothing and left\n // `rev` alone, so it must not read to the model as a success. A batch where\n // some entries landed returns normally — that is what partial apply means.\n if (value.op.kind === 'upsert' && value.op.applied === 0) {\n throw actionableTaskError(action, formatUpsertFailureText(value.op));\n }\n // `document` is the committed document, so `details.rev` matches what landed\n // on disk; `value.document` is the pre-write copy and lags by one.\n return buildToolResult(action, params, document, value.op);\n}\n\nexport function registerTaskTool(pi: ExtensionAPI, dependencies: TaskToolDependencies): void {\n const { store, delegation, maxTasks = DEFAULT_MAX_TASKS } = dependencies;\n\n pi.registerTool({\n name: TOOL_NAME,\n label: TOOL_LABEL,\n description:\n 'Shared task list for complex jobs, plus delegation of tracked tasks to background subagents. Use it only when persistent coordination pays off: dependencies, parallel workstreams, or a long-running plan. Do not use it for simple requests, routine edits, straightforward command sequences, or merely because the user listed multiple steps. Actions: upsert (create and change tasks), list, get, delete (tombstone), clear (close the list), assign (delegate through assignments[]), cancel (stop a delegated run). The list is shared across the current session tree, including delegated subagents, while unrelated sessions start empty and stores persist until retention cleanup.',\n promptGuidelines: DEFAULT_PROMPT_GUIDELINES,\n parameters: TaskParamsSchema,\n // Task rows carry their own status colors. Owning the shell prevents Pi's\n // pending/success/error background fill from obscuring those row states.\n renderShell: 'self',\n\n async execute(_toolCallId, params, signal, onUpdate, ctx) {\n const action = params.action as TaskAction;\n const mutationParams = params as TaskMutationParams;\n\n try {\n await dependencies.waitUntilReady?.(ctx, signal);\n rejectStrayFields(action, mutationParams);\n if (REDUCER_ACTIONS.has(action)) {\n const result = await executeReducerAction(store, action as ReducerAction, mutationParams, maxTasks);\n dependencies.onChange?.();\n return result;\n }\n\n if (action === 'assign') {\n const assignments = resolveAssignments(mutationParams);\n const first = assignments[0];\n const progress =\n assignments.length === 1 && first\n ? `Delegating task #${first.id}...`\n : `Delegating ${assignments.length} tasks...`;\n onUpdate?.(buildTextResult(action, mutationParams, store.snapshot, progress));\n const results = await executeAssignmentBatch(delegation, assignments, signal, dependencies.report);\n dependencies.onChange?.();\n const text = formatAssignmentResults(results);\n const assigned = results.flatMap((item) => (item.ok ? [item.id] : []));\n if (assigned.length === 0) throw actionableTaskError(action, text);\n return buildAssignmentResult(mutationParams, store.snapshot, text, {\n assigned,\n failed: results.length - assigned.length,\n });\n }\n\n onUpdate?.(\n buildTextResult(\n action,\n mutationParams,\n store.snapshot,\n `Requesting cancellation for task #${mutationParams.id ?? 'unknown'}...`,\n ),\n );\n const outcome = await delegation.cancel(mutationParams.id ?? Number.NaN);\n dependencies.onChange?.();\n if (!outcome.ok) throw actionableTaskError(action, outcome.message);\n return buildTextResult(action, mutationParams, store.snapshot, outcome.message, undefined);\n } catch (error) {\n // Rethrown so pi still renders the failure to the model; recorded\n // because this is where a store fault becomes visible to the user.\n dependencies.report?.error(TASK_EVENT.toolFailed, error, {\n [ACTION_ATTRIBUTE]: action,\n ...(mutationParams.id === undefined ? {} : { [TASK_ID_ATTRIBUTE]: mutationParams.id }),\n });\n if (error instanceof TaskToolExecutionError) throw error;\n throw actionableTaskError(action, error instanceof Error ? error.message : String(error));\n }\n },\n\n // Render hooks receive no session identity, so they read the store snapshot\n // that the executing session last loaded. That is the foreground session's\n // own view, which is exactly what its transcript should show.\n renderCall(args, theme, _context) {\n return renderTaskCall(args as never, theme, store.snapshot.tasks);\n },\n\n renderResult(result, options, theme, _context) {\n return renderTaskResult(result, options, theme);\n },\n });\n}\n"],"mappings":"kRAyCM,EAAmB,cACnB,EAAoB,UACpB,EAAkB,IAAI,IAAgB,CAAC,SAAU,OAAQ,MAAO,SAAU,OAAO,CAAC,EAExF,IAAM,EAAN,cAAqC,KAAM,CAAC,EAE5C,SAAS,EAAoB,EAAoB,EAAyC,CACxF,OAAO,IAAI,EACT,CACE,QAAQ,EAAO,WAAW,IAC1B,GACA,WACA,2EACA,8DACA,4EACF,CAAC,CAAC,KAAK;CAAI,CACb,CACF,CASA,SAAS,EAAkB,EAAoB,EAAkC,CAC/E,IAAM,EAAQ,OAAO,KAAK,CAAM,CAAC,CAAC,OAAQ,GAAQ,EAAO,KAAS,IAAA,IAAa,CAACA,EAAAA,uBAAuB,EAAQ,CAAG,CAAC,EACnH,GAAI,EAAM,SAAW,EAAG,OACxB,IAAM,EAAO,IAAW,SAAW,IAAIC,EAAAA,6BAA+B,GACtE,MAAM,EAAoB,EAAQ,GAAG,EAAO,mBAAmB,EAAM,KAAK,IAAI,EAAE,GAAG,GAAM,CAC3F,CAGA,SAAS,EAAmB,EAA8C,CACxE,IAAM,EAAc,EAAO,YAC3B,GAAI,CAAC,GAAe,EAAY,SAAW,EACzC,MAAM,EAAoB,SAAU,iDAAiD,EAEvF,OAAO,CACT,CAEA,SAAS,EAAc,EAAyB,EAAgD,CAC9F,MAAO,CACL,MAAO,EAAQ,MACf,YAAa,EAAQ,YACrB,aAAc,EAAQ,aACtB,cAAe,EAAQ,cACvB,cAAe,EAAQ,cACvB,MAAO,EAAQ,MACf,QAAS,EAAQ,QACjB,QACF,CACF,CAEA,eAAe,EACb,EACA,EACA,EACA,EACiC,CACjC,IAAM,EAAkC,CAAC,EACzC,IAAK,GAAM,CAAC,EAAO,KAAe,EAAY,QAAQ,EAAG,CACvD,IAAI,EACJ,GA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EAAe,EAAG,CACtF,CAAC,EACG,aAAiB,EAA8B,EAC7C,EAAoB,EAAQ,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,CAAC,CAC1F,CACF,EAKA,WAAW,EAAM,EAAO,EAAU,CAChC,OAAOY,EAAAA,eAAe,EAAe,EAAO,EAAM,SAAS,KAAK,CAClE,EAEA,aAAa,EAAQ,EAAS,EAAO,EAAU,CAC7C,OAAOC,EAAAA,iBAAiB,EAAQ,EAAS,CAAK,CAChD,CACF,CAAC,CACH"}
@@ -1,3 +1,3 @@
1
1
  import{MSG_UPSERT_FIELD_MISPLACED as e,TOOL_LABEL as t,TOOL_NAME as n,TaskParamsSchema as r,taskActionAcceptsField as i}from"../../schemas/task.mjs";import{applyTaskMutation as a,isCommittingOp as o}from"../../services/store/reducer.mjs";import{TASK_EVENT as s}from"../../types/telemetry.mjs";import{renderTaskCall as c,renderTaskResult as l}from"../../tui/format2.mjs";import"../../types/config.mjs";import{DEFAULT_PROMPT_GUIDELINES as u}from"./promptGuidelines.mjs";import{buildAssignmentResult as d,buildTextResult as f,buildToolResult as p,formatAssignmentResults as m,formatUpsertFailureText as h}from"./responseEnvelope.mjs";const g=`Track only complex, multi-step jobs that benefit from persistent progress or delegation; skip simple work`,_=`tool.action`,v=`task.id`,y=new Set([`upsert`,`list`,`get`,`delete`,`clear`]);var b=class extends Error{};function x(e,t){return new b([`Task ${e} failed: ${t}`,``,`Options:`,`- List the task board and inspect the current ids, states, and blockers.`,`- Correct the arguments or state conflict, then retry once.`,`- Ask the user before cancelling work or changing dependencies to recover.`].join(`
2
- `))}function S(t,n){let r=Object.keys(n).filter(e=>n[e]!==void 0&&!i(t,e));if(r.length===0)return;let a=t===`upsert`?` ${e}`:``;throw x(t,`${t} does not accept ${r.join(`, `)}.${a}`)}function C(e){let t=e.assignments;if(!t||t.length===0)throw x(`assign`,`assign requires a non-empty assignments[] array`);return t}function w(e,t){return{agent:e.agent,inlineAgent:e.inlineAgent,instructions:e.instructions,relevantFiles:e.relevantFiles,priorFindings:e.priorFindings,model:e.model,context:e.context,signal:t}}async function T(e,t,n,r){let i=[];for(let[a,o]of t.entries()){let t;try{t=await e.assign(o.id,w(o,n))}catch(e){r?.error(s.toolFailed,e,{[_]:`assign`,[v]:o.id}),t={ok:!1,message:e instanceof Error?e.message:String(e)}}i.push({index:a,id:o.id,agent:o.agent,...t})}return i}async function E(e,t,n,r){let{document:i,value:s}=await e.mutate(e=>{let i=a(e,t,n,void 0,r);return{...o(i.op)?{document:i.document}:{},value:i}});if(s.op.kind===`error`)throw x(t,s.op.message);if(s.op.kind===`upsert`&&s.op.applied===0)throw x(t,h(s.op));return p(t,n,i,s.op)}function D(e,i){let{store:a,delegation:o,maxTasks:p=15}=i;e.registerTool({name:n,label:t,description:`Track complex jobs with a shared task list and delegate tracked work to subagents. Use this only when persistent coordination is useful, such as work with dependencies, parallel workstreams, or a long-running plan. Do not use it for simple requests, routine edits, straightforward command sequences, or merely because the user listed multiple steps. Actions: upsert (write tasks: an entry with an id changes that task and one without an id creates one), list, get, delete (tombstone), clear (close/reset the list), assign (hand tasks through assignments[] to named background subagents), cancel (stop a delegated run). upsert and assign apply entries independently: successes remain committed or delegated and failures are reported by array index. Batch a plan and independent assignments, but report progress one task at a time. Status: pending → in_progress → completed, plus failed and a deleted tombstone. The list is shared within the current session tree, including delegated subagents, while unrelated sessions start empty. Session stores persist until retention cleanup.`,promptGuidelines:u,parameters:r,renderShell:`self`,async execute(e,t,n,r,c){let l=t.action,u=t;try{if(await i.waitUntilReady?.(c,n),S(l,u),y.has(l)){let e=await E(a,l,u,p);return i.onChange?.(),e}if(l===`assign`){let e=C(u),t=e[0],s=e.length===1&&t?`Delegating task #${t.id}...`:`Delegating ${e.length} tasks...`;r?.(f(l,u,a.snapshot,s));let c=await T(o,e,n,i.report);i.onChange?.();let p=m(c),h=c.flatMap(e=>e.ok?[e.id]:[]);if(h.length===0)throw x(l,p);return d(u,a.snapshot,p,{assigned:h,failed:c.length-h.length})}r?.(f(l,u,a.snapshot,`Requesting cancellation for task #${u.id??`unknown`}...`));let e=await o.cancel(u.id??NaN);if(i.onChange?.(),!e.ok)throw x(l,e.message);return f(l,u,a.snapshot,e.message,void 0)}catch(e){throw i.report?.error(s.toolFailed,e,{[_]:l,...u.id===void 0?{}:{[v]:u.id}}),e instanceof b?e:x(l,e instanceof Error?e.message:String(e))}},renderCall(e,t,n){return c(e,t,a.snapshot.tasks)},renderResult(e,t,n,r){return l(e,t,n)}})}export{u as DEFAULT_PROMPT_GUIDELINES,g as DEFAULT_PROMPT_SNIPPET,D as registerTaskTool};
2
+ `))}function S(t,n){let r=Object.keys(n).filter(e=>n[e]!==void 0&&!i(t,e));if(r.length===0)return;let a=t===`upsert`?` ${e}`:``;throw x(t,`${t} does not accept ${r.join(`, `)}.${a}`)}function C(e){let t=e.assignments;if(!t||t.length===0)throw x(`assign`,`assign requires a non-empty assignments[] array`);return t}function w(e,t){return{agent:e.agent,inlineAgent:e.inlineAgent,instructions:e.instructions,relevantFiles:e.relevantFiles,priorFindings:e.priorFindings,model:e.model,context:e.context,signal:t}}async function T(e,t,n,r){let i=[];for(let[a,o]of t.entries()){let t;try{t=await e.assign(o.id,w(o,n))}catch(e){r?.error(s.toolFailed,e,{[_]:`assign`,[v]:o.id}),t={ok:!1,message:e instanceof Error?e.message:String(e)}}i.push({index:a,id:o.id,agent:o.agent,...t})}return i}async function E(e,t,n,r){let{document:i,value:s}=await e.mutate(e=>{let i=a(e,t,n,void 0,r);return{...o(i.op)?{document:i.document}:{},value:i}});if(s.op.kind===`error`)throw x(t,s.op.message);if(s.op.kind===`upsert`&&s.op.applied===0)throw x(t,h(s.op));return p(t,n,i,s.op)}function D(e,i){let{store:a,delegation:o,maxTasks:p=15}=i;e.registerTool({name:n,label:t,description:`Shared task list for complex jobs, plus delegation of tracked tasks to background subagents. Use it only when persistent coordination pays off: dependencies, parallel workstreams, or a long-running plan. Do not use it for simple requests, routine edits, straightforward command sequences, or merely because the user listed multiple steps. Actions: upsert (create and change tasks), list, get, delete (tombstone), clear (close the list), assign (delegate through assignments[]), cancel (stop a delegated run). The list is shared across the current session tree, including delegated subagents, while unrelated sessions start empty and stores persist until retention cleanup.`,promptGuidelines:u,parameters:r,renderShell:`self`,async execute(e,t,n,r,c){let l=t.action,u=t;try{if(await i.waitUntilReady?.(c,n),S(l,u),y.has(l)){let e=await E(a,l,u,p);return i.onChange?.(),e}if(l===`assign`){let e=C(u),t=e[0],s=e.length===1&&t?`Delegating task #${t.id}...`:`Delegating ${e.length} tasks...`;r?.(f(l,u,a.snapshot,s));let c=await T(o,e,n,i.report);i.onChange?.();let p=m(c),h=c.flatMap(e=>e.ok?[e.id]:[]);if(h.length===0)throw x(l,p);return d(u,a.snapshot,p,{assigned:h,failed:c.length-h.length})}r?.(f(l,u,a.snapshot,`Requesting cancellation for task #${u.id??`unknown`}...`));let e=await o.cancel(u.id??NaN);if(i.onChange?.(),!e.ok)throw x(l,e.message);return f(l,u,a.snapshot,e.message,void 0)}catch(e){throw i.report?.error(s.toolFailed,e,{[_]:l,...u.id===void 0?{}:{[v]:u.id}}),e instanceof b?e:x(l,e instanceof Error?e.message:String(e))}},renderCall(e,t,n){return c(e,t,a.snapshot.tasks)},renderResult(e,t,n,r){return l(e,t,n)}})}export{u as DEFAULT_PROMPT_GUIDELINES,g as DEFAULT_PROMPT_SNIPPET,D as registerTaskTool};
3
3
  //# sourceMappingURL=taskTool.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"taskTool.mjs","names":[],"sources":["../../../src/commands/task/taskTool.ts"],"sourcesContent":["import type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\nimport {\n MSG_UPSERT_FIELD_MISPLACED,\n TaskParamsSchema,\n TOOL_LABEL,\n TOOL_NAME,\n taskActionAcceptsField,\n} from '../../schemas/task.ts';\nimport type { AssignOptions, DelegationManager, DelegationOutcome } from '../../services/delegation/manager.ts';\nimport { applyTaskMutation, isCommittingOp, type ReducerAction } from '../../services/store/reducer.ts';\nimport type { TaskStore } from '../../adapters/store/taskStore';\nimport type { TaskAction, TaskAssignment, TaskMutationParams } from '../../services/store/types.ts';\nimport { renderTaskCall, renderTaskResult } from '../../tui/format.ts';\nimport { DEFAULT_MAX_TASKS } from '../../types/config.ts';\nimport { TASK_EVENT, type TaskFailureReporter } from '../../types/telemetry.ts';\nimport { DEFAULT_PROMPT_GUIDELINES } from './promptGuidelines.ts';\nimport {\n type AssignmentItemResult,\n buildAssignmentResult,\n buildTextResult,\n buildToolResult,\n formatAssignmentResults,\n formatUpsertFailureText,\n type ToolResult,\n} from './responseEnvelope.ts';\n\nexport { DEFAULT_PROMPT_GUIDELINES } from './promptGuidelines.ts';\n\n/** @deprecated Task usage policy now lives only in the tool description. */\nexport const DEFAULT_PROMPT_SNIPPET =\n 'Track only complex, multi-step jobs that benefit from persistent progress or delegation; skip simple work';\n\nexport interface TaskToolDependencies {\n store: TaskStore;\n delegation: DelegationManager;\n maxTasks?: number;\n onChange?: () => void;\n report?: TaskFailureReporter;\n waitUntilReady?: (context: ExtensionContext, signal?: AbortSignal) => Promise<void>;\n}\n\nconst ACTION_ATTRIBUTE = 'tool.action';\nconst TASK_ID_ATTRIBUTE = 'task.id';\nconst REDUCER_ACTIONS = new Set<TaskAction>(['upsert', 'list', 'get', 'delete', 'clear']);\n\nclass TaskToolExecutionError extends Error {}\n\nfunction actionableTaskError(action: TaskAction, message: string): TaskToolExecutionError {\n return new TaskToolExecutionError(\n [\n `Task ${action} failed: ${message}`,\n '',\n 'Options:',\n '- List the task board and inspect the current ids, states, and blockers.',\n '- Correct the arguments or state conflict, then retry once.',\n '- Ask the user before cancelling work or changing dependencies to recover.',\n ].join('\\n'),\n );\n}\n\n/**\n * Reject a field that belongs to a different action.\n *\n * The params schema is flat and shared across every action, so this is the only\n * place `{\"action\":\"upsert\",\"id\":3}` can be caught — and it must be, because\n * the entry it carries has no id and would silently create a duplicate task.\n */\nfunction rejectStrayFields(action: TaskAction, params: TaskMutationParams): void {\n const stray = Object.keys(params).filter((key) => params[key] !== undefined && !taskActionAcceptsField(action, key));\n if (stray.length === 0) return;\n const hint = action === 'upsert' ? ` ${MSG_UPSERT_FIELD_MISPLACED}` : '';\n throw actionableTaskError(action, `${action} does not accept ${stray.join(', ')}.${hint}`);\n}\n\n/** assignments[] is the only assign contract, even when it contains one task. */\nfunction resolveAssignments(params: TaskMutationParams): TaskAssignment[] {\n const assignments = params.assignments;\n if (!assignments || assignments.length === 0) {\n throw actionableTaskError('assign', 'assign requires a non-empty assignments[] array');\n }\n return assignments;\n}\n\nfunction assignOptions(request: TaskAssignment, signal: AbortSignal | undefined): AssignOptions {\n return {\n agent: request.agent,\n inlineAgent: request.inlineAgent,\n instructions: request.instructions,\n relevantFiles: request.relevantFiles,\n priorFindings: request.priorFindings,\n model: request.model,\n context: request.context,\n signal,\n };\n}\n\nasync function executeAssignmentBatch(\n delegation: DelegationManager,\n assignments: readonly TaskAssignment[],\n signal: AbortSignal | undefined,\n report: TaskFailureReporter | undefined,\n): Promise<AssignmentItemResult[]> {\n const results: AssignmentItemResult[] = [];\n for (const [index, assignment] of assignments.entries()) {\n let outcome: DelegationOutcome;\n try {\n outcome = await delegation.assign(assignment.id, assignOptions(assignment, signal));\n } catch (error) {\n report?.error(TASK_EVENT.toolFailed, error, {\n [ACTION_ATTRIBUTE]: 'assign',\n [TASK_ID_ATTRIBUTE]: assignment.id,\n });\n outcome = { ok: false, message: error instanceof Error ? error.message : String(error) };\n }\n results.push({ index, id: assignment.id, agent: assignment.agent, ...outcome });\n }\n return results;\n}\n\n/** Run an action through the reducer, persisting only when it produced a change. */\nasync function executeReducerAction(\n store: TaskStore,\n action: ReducerAction,\n params: TaskMutationParams,\n maxTasks: number,\n): Promise<ToolResult> {\n const { document, value } = await store.mutate((current) => {\n const result = applyTaskMutation(current, action, params, undefined, maxTasks);\n return {\n ...(isCommittingOp(result.op) ? { document: result.document } : {}),\n value: result,\n };\n });\n if (value.op.kind === 'error') throw actionableTaskError(action, value.op.message);\n // An upsert that applied nothing is a failed call: it wrote nothing and left\n // `rev` alone, so it must not read to the model as a success. A batch where\n // some entries landed returns normally — that is what partial apply means.\n if (value.op.kind === 'upsert' && value.op.applied === 0) {\n throw actionableTaskError(action, formatUpsertFailureText(value.op));\n }\n // `document` is the committed document, so `details.rev` matches what landed\n // on disk; `value.document` is the pre-write copy and lags by one.\n return buildToolResult(action, params, document, value.op);\n}\n\nexport function registerTaskTool(pi: ExtensionAPI, dependencies: TaskToolDependencies): void {\n const { store, delegation, maxTasks = DEFAULT_MAX_TASKS } = dependencies;\n\n pi.registerTool({\n name: TOOL_NAME,\n label: TOOL_LABEL,\n description:\n 'Track complex jobs with a shared task list and delegate tracked work to subagents. Use this only when persistent coordination is useful, such as work with dependencies, parallel workstreams, or a long-running plan. Do not use it for simple requests, routine edits, straightforward command sequences, or merely because the user listed multiple steps. Actions: upsert (write tasks: an entry with an id changes that task and one without an id creates one), list, get, delete (tombstone), clear (close/reset the list), assign (hand tasks through assignments[] to named background subagents), cancel (stop a delegated run). upsert and assign apply entries independently: successes remain committed or delegated and failures are reported by array index. Batch a plan and independent assignments, but report progress one task at a time. Status: pending → in_progress → completed, plus failed and a deleted tombstone. The list is shared within the current session tree, including delegated subagents, while unrelated sessions start empty. Session stores persist until retention cleanup.',\n promptGuidelines: DEFAULT_PROMPT_GUIDELINES,\n parameters: TaskParamsSchema,\n // Task rows carry their own status colors. Owning the shell prevents Pi's\n // pending/success/error background fill from obscuring those row states.\n renderShell: 'self',\n\n async execute(_toolCallId, params, signal, onUpdate, ctx) {\n const action = params.action as TaskAction;\n const mutationParams = params as TaskMutationParams;\n\n try {\n await dependencies.waitUntilReady?.(ctx, signal);\n rejectStrayFields(action, mutationParams);\n if (REDUCER_ACTIONS.has(action)) {\n const result = await executeReducerAction(store, action as ReducerAction, mutationParams, maxTasks);\n dependencies.onChange?.();\n return result;\n }\n\n if (action === 'assign') {\n const assignments = resolveAssignments(mutationParams);\n const first = assignments[0];\n const progress =\n assignments.length === 1 && first\n ? `Delegating task #${first.id}...`\n : `Delegating ${assignments.length} tasks...`;\n onUpdate?.(buildTextResult(action, mutationParams, store.snapshot, progress));\n const results = await executeAssignmentBatch(delegation, assignments, signal, dependencies.report);\n dependencies.onChange?.();\n const text = formatAssignmentResults(results);\n const assigned = results.flatMap((item) => (item.ok ? [item.id] : []));\n if (assigned.length === 0) throw actionableTaskError(action, text);\n return buildAssignmentResult(mutationParams, store.snapshot, text, {\n assigned,\n failed: results.length - assigned.length,\n });\n }\n\n onUpdate?.(\n buildTextResult(\n action,\n mutationParams,\n store.snapshot,\n `Requesting cancellation for task #${mutationParams.id ?? 'unknown'}...`,\n ),\n );\n const outcome = await delegation.cancel(mutationParams.id ?? Number.NaN);\n dependencies.onChange?.();\n if (!outcome.ok) throw actionableTaskError(action, outcome.message);\n return buildTextResult(action, mutationParams, store.snapshot, outcome.message, undefined);\n } catch (error) {\n // Rethrown so pi still renders the failure to the model; recorded\n // because this is where a store fault becomes visible to the user.\n dependencies.report?.error(TASK_EVENT.toolFailed, error, {\n [ACTION_ATTRIBUTE]: action,\n ...(mutationParams.id === undefined ? {} : { [TASK_ID_ATTRIBUTE]: mutationParams.id }),\n });\n if (error instanceof TaskToolExecutionError) throw error;\n throw actionableTaskError(action, error instanceof Error ? error.message : String(error));\n }\n },\n\n // Render hooks receive no session identity, so they read the store snapshot\n // that the executing session last loaded. That is the foreground session's\n // own view, which is exactly what its transcript should show.\n renderCall(args, theme, _context) {\n return renderTaskCall(args as never, theme, store.snapshot.tasks);\n },\n\n renderResult(result, options, theme, _context) {\n return renderTaskResult(result, options, theme);\n },\n });\n}\n"],"mappings":"unBA6BA,MAAa,EACX,4GAWI,EAAmB,cACnB,EAAoB,UACpB,EAAkB,IAAI,IAAgB,CAAC,SAAU,OAAQ,MAAO,SAAU,OAAO,CAAC,EAExF,IAAM,EAAN,cAAqC,KAAM,CAAC,EAE5C,SAAS,EAAoB,EAAoB,EAAyC,CACxF,OAAO,I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AU,MAAM,EAAuB,EAAY,EAAa,EAAQ,EAAa,MAAM,EACjG,EAAa,WAAW,EACxB,IAAM,EAAO,EAAwB,CAAO,EACtC,EAAW,EAAQ,QAAS,GAAU,EAAK,GAAK,CAAC,EAAK,EAAE,EAAI,CAAC,CAAE,EACrE,GAAI,EAAS,SAAW,EAAG,MAAM,EAAoB,EAAQ,CAAI,EACjE,OAAO,EAAsB,EAAgB,EAAM,SAAU,EAAM,CACjE,WACA,OAAQ,EAAQ,OAAS,EAAS,MACpC,CAAC,CACH,CAEA,IACE,EACE,EACA,EACA,EAAM,SACN,qCAAqC,EAAe,IAAM,UAAU,IACtE,CACF,EACA,IAAM,EAAU,MAAM,EAAW,OAAO,EAAe,IAAM,GAAU,EAEvE,GADA,EAAa,WAAW,EACpB,CAAC,EAAQ,GAAI,MAAM,EAAoB,EAAQ,EAAQ,OAAO,EAClE,OAAO,EAAgB,EAAQ,EAAgB,EAAM,SAAU,EAAQ,QAAS,IAAA,EAAS,CAC3F,OAAS,EAAO,CAQd,MALA,EAAa,QAAQ,MAAM,EAAW,WAAY,EAAO,EACtD,GAAmB,EACpB,GAAI,EAAe,KAAO,IAAA,GAAY,CAAC,EAAI,EAAG,GAAoB,EAAe,EAAG,CACtF,CAAC,EACG,aAAiB,EAA8B,EAC7C,EAAoB,EAAQ,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,CAAC,CAC1F,CACF,EAKA,WAAW,EAAM,EAAO,EAAU,CAChC,OAAO,EAAe,EAAe,EAAO,EAAM,SAAS,KAAK,CAClE,EAEA,aAAa,EAAQ,EAAS,EAAO,EAAU,CAC7C,OAAO,EAAiB,EAAQ,EAAS,CAAK,CAChD,CACF,CAAC,CACH"}
1
+ {"version":3,"file":"taskTool.mjs","names":[],"sources":["../../../src/commands/task/taskTool.ts"],"sourcesContent":["import type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\nimport {\n MSG_UPSERT_FIELD_MISPLACED,\n TaskParamsSchema,\n TOOL_LABEL,\n TOOL_NAME,\n taskActionAcceptsField,\n} from '../../schemas/task.ts';\nimport type { AssignOptions, DelegationManager, DelegationOutcome } from '../../services/delegation/manager.ts';\nimport { applyTaskMutation, isCommittingOp, type ReducerAction } from '../../services/store/reducer.ts';\nimport type { TaskStore } from '../../adapters/store/taskStore';\nimport type { TaskAction, TaskAssignment, TaskMutationParams } from '../../services/store/types.ts';\nimport { renderTaskCall, renderTaskResult } from '../../tui/format.ts';\nimport { DEFAULT_MAX_TASKS } from '../../types/config.ts';\nimport { TASK_EVENT, type TaskFailureReporter } from '../../types/telemetry.ts';\nimport { DEFAULT_PROMPT_GUIDELINES } from './promptGuidelines.ts';\nimport {\n type AssignmentItemResult,\n buildAssignmentResult,\n buildTextResult,\n buildToolResult,\n formatAssignmentResults,\n formatUpsertFailureText,\n type ToolResult,\n} from './responseEnvelope.ts';\n\nexport { DEFAULT_PROMPT_GUIDELINES } from './promptGuidelines.ts';\n\n/** @deprecated Task usage policy now lives only in the tool description. */\nexport const DEFAULT_PROMPT_SNIPPET =\n 'Track only complex, multi-step jobs that benefit from persistent progress or delegation; skip simple work';\n\nexport interface TaskToolDependencies {\n store: TaskStore;\n delegation: DelegationManager;\n maxTasks?: number;\n onChange?: () => void;\n report?: TaskFailureReporter;\n waitUntilReady?: (context: ExtensionContext, signal?: AbortSignal) => Promise<void>;\n}\n\nconst ACTION_ATTRIBUTE = 'tool.action';\nconst TASK_ID_ATTRIBUTE = 'task.id';\nconst REDUCER_ACTIONS = new Set<TaskAction>(['upsert', 'list', 'get', 'delete', 'clear']);\n\nclass TaskToolExecutionError extends Error {}\n\nfunction actionableTaskError(action: TaskAction, message: string): TaskToolExecutionError {\n return new TaskToolExecutionError(\n [\n `Task ${action} failed: ${message}`,\n '',\n 'Options:',\n '- List the task board and inspect the current ids, states, and blockers.',\n '- Correct the arguments or state conflict, then retry once.',\n '- Ask the user before cancelling work or changing dependencies to recover.',\n ].join('\\n'),\n );\n}\n\n/**\n * Reject a field that belongs to a different action.\n *\n * The params schema is flat and shared across every action, so this is the only\n * place `{\"action\":\"upsert\",\"id\":3}` can be caught — and it must be, because\n * the entry it carries has no id and would silently create a duplicate task.\n */\nfunction rejectStrayFields(action: TaskAction, params: TaskMutationParams): void {\n const stray = Object.keys(params).filter((key) => params[key] !== undefined && !taskActionAcceptsField(action, key));\n if (stray.length === 0) return;\n const hint = action === 'upsert' ? ` ${MSG_UPSERT_FIELD_MISPLACED}` : '';\n throw actionableTaskError(action, `${action} does not accept ${stray.join(', ')}.${hint}`);\n}\n\n/** assignments[] is the only assign contract, even when it contains one task. */\nfunction resolveAssignments(params: TaskMutationParams): TaskAssignment[] {\n const assignments = params.assignments;\n if (!assignments || assignments.length === 0) {\n throw actionableTaskError('assign', 'assign requires a non-empty assignments[] array');\n }\n return assignments;\n}\n\nfunction assignOptions(request: TaskAssignment, signal: AbortSignal | undefined): AssignOptions {\n return {\n agent: request.agent,\n inlineAgent: request.inlineAgent,\n instructions: request.instructions,\n relevantFiles: request.relevantFiles,\n priorFindings: request.priorFindings,\n model: request.model,\n context: request.context,\n signal,\n };\n}\n\nasync function executeAssignmentBatch(\n delegation: DelegationManager,\n assignments: readonly TaskAssignment[],\n signal: AbortSignal | undefined,\n report: TaskFailureReporter | undefined,\n): Promise<AssignmentItemResult[]> {\n const results: AssignmentItemResult[] = [];\n for (const [index, assignment] of assignments.entries()) {\n let outcome: DelegationOutcome;\n try {\n outcome = await delegation.assign(assignment.id, assignOptions(assignment, signal));\n } catch (error) {\n report?.error(TASK_EVENT.toolFailed, error, {\n [ACTION_ATTRIBUTE]: 'assign',\n [TASK_ID_ATTRIBUTE]: assignment.id,\n });\n outcome = { ok: false, message: error instanceof Error ? error.message : String(error) };\n }\n results.push({ index, id: assignment.id, agent: assignment.agent, ...outcome });\n }\n return results;\n}\n\n/** Run an action through the reducer, persisting only when it produced a change. */\nasync function executeReducerAction(\n store: TaskStore,\n action: ReducerAction,\n params: TaskMutationParams,\n maxTasks: number,\n): Promise<ToolResult> {\n const { document, value } = await store.mutate((current) => {\n const result = applyTaskMutation(current, action, params, undefined, maxTasks);\n return {\n ...(isCommittingOp(result.op) ? { document: result.document } : {}),\n value: result,\n };\n });\n if (value.op.kind === 'error') throw actionableTaskError(action, value.op.message);\n // An upsert that applied nothing is a failed call: it wrote nothing and left\n // `rev` alone, so it must not read to the model as a success. A batch where\n // some entries landed returns normally — that is what partial apply means.\n if (value.op.kind === 'upsert' && value.op.applied === 0) {\n throw actionableTaskError(action, formatUpsertFailureText(value.op));\n }\n // `document` is the committed document, so `details.rev` matches what landed\n // on disk; `value.document` is the pre-write copy and lags by one.\n return buildToolResult(action, params, document, value.op);\n}\n\nexport function registerTaskTool(pi: ExtensionAPI, dependencies: TaskToolDependencies): void {\n const { store, delegation, maxTasks = DEFAULT_MAX_TASKS } = dependencies;\n\n pi.registerTool({\n name: TOOL_NAME,\n label: TOOL_LABEL,\n description:\n 'Shared task list for complex jobs, plus delegation of tracked tasks to background subagents. Use it only when persistent coordination pays off: dependencies, parallel workstreams, or a long-running plan. Do not use it for simple requests, routine edits, straightforward command sequences, or merely because the user listed multiple steps. Actions: upsert (create and change tasks), list, get, delete (tombstone), clear (close the list), assign (delegate through assignments[]), cancel (stop a delegated run). The list is shared across the current session tree, including delegated subagents, while unrelated sessions start empty and stores persist until retention cleanup.',\n promptGuidelines: DEFAULT_PROMPT_GUIDELINES,\n parameters: TaskParamsSchema,\n // Task rows carry their own status colors. Owning the shell prevents Pi's\n // pending/success/error background fill from obscuring those row states.\n renderShell: 'self',\n\n async execute(_toolCallId, params, signal, onUpdate, ctx) {\n const action = params.action as TaskAction;\n const mutationParams = params as TaskMutationParams;\n\n try {\n await dependencies.waitUntilReady?.(ctx, signal);\n rejectStrayFields(action, mutationParams);\n if (REDUCER_ACTIONS.has(action)) {\n const result = await executeReducerAction(store, action as ReducerAction, mutationParams, maxTasks);\n dependencies.onChange?.();\n return result;\n }\n\n if (action === 'assign') {\n const assignments = resolveAssignments(mutationParams);\n const first = assignments[0];\n const progress =\n assignments.length === 1 && first\n ? `Delegating task #${first.id}...`\n : `Delegating ${assignments.length} tasks...`;\n onUpdate?.(buildTextResult(action, mutationParams, store.snapshot, progress));\n const results = await executeAssignmentBatch(delegation, assignments, signal, dependencies.report);\n dependencies.onChange?.();\n const text = formatAssignmentResults(results);\n const assigned = results.flatMap((item) => (item.ok ? [item.id] : []));\n if (assigned.length === 0) throw actionableTaskError(action, text);\n return buildAssignmentResult(mutationParams, store.snapshot, text, {\n assigned,\n failed: results.length - assigned.length,\n });\n }\n\n onUpdate?.(\n buildTextResult(\n action,\n mutationParams,\n store.snapshot,\n `Requesting cancellation for task #${mutationParams.id ?? 'unknown'}...`,\n ),\n );\n const outcome = await delegation.cancel(mutationParams.id ?? Number.NaN);\n dependencies.onChange?.();\n if (!outcome.ok) throw actionableTaskError(action, outcome.message);\n return buildTextResult(action, mutationParams, store.snapshot, outcome.message, undefined);\n } catch (error) {\n // Rethrown so pi still renders the failure to the model; recorded\n // because this is where a store fault becomes visible to the user.\n dependencies.report?.error(TASK_EVENT.toolFailed, error, {\n [ACTION_ATTRIBUTE]: action,\n ...(mutationParams.id === undefined ? {} : { [TASK_ID_ATTRIBUTE]: mutationParams.id }),\n });\n if (error instanceof TaskToolExecutionError) throw error;\n throw actionableTaskError(action, error instanceof Error ? error.message : String(error));\n }\n },\n\n // Render hooks receive no session identity, so they read the store snapshot\n // that the executing session last loaded. That is the foreground session's\n // own view, which is exactly what its transcript should show.\n renderCall(args, theme, _context) {\n return renderTaskCall(args as never, theme, store.snapshot.tasks);\n },\n\n renderResult(result, options, theme, _context) {\n return renderTaskResult(result, options, theme);\n },\n });\n}\n"],"mappings":"unBA6BA,MAAa,EACX,4GAWI,EAAmB,cACnB,EAAoB,UACpB,EAAkB,IAAI,IAAgB,CAAC,SAAU,OAAQ,MAAO,SAAU,OAAO,CAAC,EAExF,IAAM,EAAN,cAAqC,KAAM,CAAC,EAE5C,SAAS,EAAoB,EAAoB,EA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C,EAC5E,IAAM,EAAU,MAAM,EAAuB,EAAY,EAAa,EAAQ,EAAa,MAAM,EACjG,EAAa,WAAW,EACxB,IAAM,EAAO,EAAwB,CAAO,EACtC,EAAW,EAAQ,QAAS,GAAU,EAAK,GAAK,CAAC,EAAK,EAAE,EAAI,CAAC,CAAE,EACrE,GAAI,EAAS,SAAW,EAAG,MAAM,EAAoB,EAAQ,CAAI,EACjE,OAAO,EAAsB,EAAgB,EAAM,SAAU,EAAM,CACjE,WACA,OAAQ,EAAQ,OAAS,EAAS,MACpC,CAAC,CACH,CAEA,IACE,EACE,EACA,EACA,EAAM,SACN,qCAAqC,EAAe,IAAM,UAAU,IACtE,CACF,EACA,IAAM,EAAU,MAAM,EAAW,OAAO,EAAe,IAAM,GAAU,EAEvE,GADA,EAAa,WAAW,EACpB,CAAC,EAAQ,GAAI,MAAM,EAAoB,EAAQ,EAAQ,OAAO,EAClE,OAAO,EAAgB,EAAQ,EAAgB,EAAM,SAAU,EAAQ,QAAS,IAAA,EAAS,CAC3F,OAAS,EAAO,CAQd,MALA,EAAa,QAAQ,MAAM,EAAW,WAAY,EAAO,EACtD,GAAmB,EACpB,GAAI,EAAe,KAAO,IAAA,GAAY,CAAC,EAAI,EAAG,GAAoB,EAAe,EAAG,CACtF,CAAC,EACG,aAAiB,EAA8B,EAC7C,EAAoB,EAAQ,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,CAAC,CAC1F,CACF,EAKA,WAAW,EAAM,EAAO,EAAU,CAChC,OAAO,EAAe,EAAe,EAAO,EAAM,SAAS,KAAK,CAClE,EAEA,aAAa,EAAQ,EAAS,EAAO,EAAU,CAC7C,OAAO,EAAiB,EAAQ,EAAS,CAAK,CAChD,CACF,CAAC,CACH"}
@@ -1,2 +1,2 @@
1
- require("../types/delegation.cjs");let e=require("@agimon-ai/doompi-extension-contracts/subagent-tool"),t=require("typebox");const n=[`upsert`,`list`,`get`,`delete`,`clear`,`assign`,`cancel`],r=[`pending`,`in_progress`,`completed`,`failed`,`deleted`],i=[`fresh`,`fork`],a={upsert:[`action`,`tasks`],list:[`action`,`status`,`includeDeleted`],get:[`action`,`id`],delete:[`action`,`id`],clear:[`action`],assign:[`action`,`assignments`],cancel:[`action`,`id`]};function o(e,t){return a[e].includes(t)}const s=t.Type.Union([t.Type.Integer(),t.Type.String()]),c=t.Type.Object({id:t.Type.Optional(t.Type.Integer({description:`Existing task id to change. Omit to create a new task. An entry with an id never creates: if the id is unknown, only that entry fails.`})),ref:t.Type.Optional(t.Type.String({description:`Temporary name for a task created by this entry, so a LATER entry in the same tasks[] can list it in blockedBy before its real id exists. Must start with a letter. Scoped to this one call and never stored; the response reports which real id it became.`})),subject:t.Type.Optional(t.Type.String({description:`Short imperative subject line (e.g. 'Research existing tool'). Required when the entry has no id; on an entry with an id it renames the task.`})),description:t.Type.Optional(t.Type.String({description:`Long-form task detail. This becomes the brief handed to the subagent when the task is assigned.`})),activeForm:t.Type.Optional(t.Type.String({description:`Present-continuous spinner label shown while status is in_progress (e.g. 'writing tests')`})),status:t.Type.Optional(t.Type.String({enum:[...r],description:`Starting status for a new entry (default pending; deleted is rejected), or the target status for an entry with an id, where the transition must be legal.`})),blockedBy:t.Type.Optional(t.Type.Array(s,{description:`Dependencies for a NEW entry (one with no id): this task is blocked by each target. A number is an existing task id; a string is the ref of a task created by an EARLIER entry in this same array. Use addBlockedBy / removeBlockedBy on an entry that has an id.`})),addBlockedBy:t.Type.Optional(t.Type.Array(s,{description:`Dependencies to add, for an entry with an id. Task ids, or refs declared by an earlier entry. Additive merge — do not resend the full array.`})),removeBlockedBy:t.Type.Optional(t.Type.Array(s,{description:`Dependencies to remove, for an entry with an id. Additive merge — do not resend the full array.`})),owner:t.Type.Optional(t.Type.String({description:`Owner label for this task. assign sets this to the subagent name automatically.`})),metadata:t.Type.Optional(t.Type.Record(t.Type.String(),t.Type.Unknown(),{description:`Arbitrary metadata merged into the task; pass null as a value to delete that key`}))},{additionalProperties:!1}),l=t.Type.Object({id:t.Type.Integer({description:`Pending, unblocked task id to delegate`}),agent:t.Type.String({description:`Exact discovered subagent name`}),inlineAgent:t.Type.Optional(e.InlineAgentSchema),instructions:t.Type.Optional(t.Type.String({description:`Extra instructions appended to this delegated brief`})),relevantFiles:t.Type.Optional(t.Type.Array(t.Type.String(),{description:`Files already read or located for this task. Paths are relative to the working directory; at most 12 are used.`})),priorFindings:t.Type.Optional(t.Type.String({description:`Established facts this child should consume rather than re-derive`})),model:t.Type.Optional(t.Type.String({description:`Model override for this delegated run`})),context:t.Type.Optional(t.Type.String({enum:[...i],description:`Starting context for this child: 'fresh' or 'fork'`}))},{additionalProperties:!1}),u=t.Type.Object({action:t.Type.String({enum:[...n],description:`upsert (create new tasks and change existing ones, one or many per call), list, get, delete (tombstone), clear (close/reset the list), assign (delegate one or more tasks through assignments[]), cancel (stop a delegated run)`}),tasks:t.Type.Optional(t.Type.Array(c,{minItems:1,description:`upsert only. One entry per task: an entry with an id changes that task, an entry without an id creates one. Entries apply in array order, so a later entry can depend on an earlier one by ref. Each entry succeeds or fails on its own: the ones that succeed are committed and the ones that fail are reported by their array index.`})),assignments:t.Type.Optional(t.Type.Array(l,{minItems:1,description:`Required for assign, including one task. Each entry selects its own pending, unblocked task, agent, model, and context pack; successful entries remain delegated if another entry fails. assign has no top-level single-task form.`})),id:t.Type.Optional(t.Type.Integer({description:`Task id, for get, delete, and cancel. For assign, put every id inside assignments[]. upsert does not accept this field — put the id inside the tasks[] entry you want to change.`})),status:t.Type.Optional(t.Type.String({enum:[...r],description:`list only: return just the tasks in this status. To SET a status, use upsert with the task id inside tasks[].`})),includeDeleted:t.Type.Optional(t.Type.Boolean({description:`If true, list returns deleted (tombstoned) tasks as well. Default: false.`}))});exports.COMMAND_NAME=`tasks`,exports.ERR_REQUIRES_INTERACTIVE=`/tasks requires interactive mode`,exports.MSG_NO_TASKS=`No tasks yet. Ask the agent to add some!`,exports.MSG_UPSERT_FIELD_MISPLACED=`Per-task fields belong inside each tasks[] entry, not at the top level: {"action":"upsert","tasks":[{"id":3,"status":"completed"}]}.`,exports.TASK_ACTIONS=n,exports.TASK_ACTION_FIELDS=a,exports.TASK_CONTEXTS=i,exports.TASK_STATUSES=r,exports.TOOL_LABEL=`Task`,exports.TOOL_NAME=`task`,exports.TaskAssignmentSchema=l,exports.TaskItemSchema=c,exports.TaskParamsSchema=u,exports.taskActionAcceptsField=o;
1
+ require("../types/delegation.cjs");let e=require("@agimon-ai/doompi-extension-contracts/subagent-tool"),t=require("typebox");const n=[`upsert`,`list`,`get`,`delete`,`clear`,`assign`,`cancel`],r=[`pending`,`in_progress`,`completed`,`failed`,`deleted`],i=[`fresh`,`fork`],a={upsert:[`action`,`tasks`],list:[`action`,`status`,`includeDeleted`],get:[`action`,`id`],delete:[`action`,`id`],clear:[`action`],assign:[`action`,`assignments`],cancel:[`action`,`id`]};function o(e,t){return a[e].includes(t)}const s=t.Type.Union([t.Type.Integer(),t.Type.String()]),c=t.Type.Object({id:t.Type.Optional(t.Type.Integer({description:`Existing task id to change. Omit to create. An unknown id fails only that entry; it never creates.`})),ref:t.Type.Optional(t.Type.String({description:`Temporary name for a task created by this entry, so a LATER entry in this array can list it in blockedBy. Must start with a letter; never stored.`})),subject:t.Type.Optional(t.Type.String({description:`Short imperative subject. Required when the entry has no id; on an entry with an id it renames.`})),description:t.Type.Optional(t.Type.String({description:`Long-form detail; becomes the brief handed to the subagent on assign.`})),activeForm:t.Type.Optional(t.Type.String({description:`Present-continuous label shown while in_progress (e.g. 'writing tests')`})),status:t.Type.Optional(t.Type.String({enum:[...r],description:`New entries default to pending and cannot start deleted; on an entry with an id the transition must be legal.`})),blockedBy:t.Type.Optional(t.Type.Array(s,{description:`Dependencies for a NEW entry: task ids, or refs of tasks created EARLIER in this array. On an entry with an id use addBlockedBy / removeBlockedBy instead.`})),addBlockedBy:t.Type.Optional(t.Type.Array(s,{description:`Dependencies to add (ids or earlier refs). Additive; do not resend the full array.`})),removeBlockedBy:t.Type.Optional(t.Type.Array(s,{description:`Dependencies to remove. Additive; do not resend the full array.`})),owner:t.Type.Optional(t.Type.String({description:`Owner label; assign sets it to the subagent name.`})),metadata:t.Type.Optional(t.Type.Record(t.Type.String(),t.Type.Unknown(),{description:`Merged into the task; a null value deletes that key.`}))},{additionalProperties:!1}),l=t.Type.Object({id:t.Type.Integer({description:`Pending, unblocked task id to delegate`}),agent:t.Type.String({description:`Exact discovered subagent name`}),inlineAgent:t.Type.Optional(e.InlineAgentSchema),instructions:t.Type.Optional(t.Type.String({description:`Extra instructions appended to this delegated brief`})),relevantFiles:t.Type.Optional(t.Type.Array(t.Type.String(),{description:`Files already read or located, relative to the working directory; at most 12 are used.`})),priorFindings:t.Type.Optional(t.Type.String({description:`Established facts this child should consume rather than re-derive`})),model:t.Type.Optional(t.Type.String({description:`Model override for this delegated run`})),context:t.Type.Optional(t.Type.String({enum:[...i],description:`Starting context for this child: 'fresh' or 'fork'`}))},{additionalProperties:!1}),u=t.Type.Object({action:t.Type.String({enum:[...n]}),tasks:t.Type.Optional(t.Type.Array(c,{minItems:1,description:`upsert only. An entry with an id changes that task, an entry without an id creates one. Entries apply in array order, so a later entry can depend on an earlier one by ref.`})),assignments:t.Type.Optional(t.Type.Array(l,{minItems:1,description:`Required for assign, one entry per task, including when there is only one.`})),id:t.Type.Optional(t.Type.Integer({description:`Task id, for get, delete and cancel. Not accepted by upsert or assign: those carry ids inside tasks[] and assignments[] entries.`})),status:t.Type.Optional(t.Type.String({enum:[...r],description:`list only: return just the tasks in this status. To SET a status, upsert the task by id.`})),includeDeleted:t.Type.Optional(t.Type.Boolean({description:`list only: also return deleted tombstones. Default false.`}))});exports.COMMAND_NAME=`tasks`,exports.ERR_REQUIRES_INTERACTIVE=`/tasks requires interactive mode`,exports.MSG_NO_TASKS=`No tasks yet. Ask the agent to add some!`,exports.MSG_UPSERT_FIELD_MISPLACED=`Per-task fields belong inside each tasks[] entry, not at the top level: {"action":"upsert","tasks":[{"id":3,"status":"completed"}]}.`,exports.TASK_ACTIONS=n,exports.TASK_ACTION_FIELDS=a,exports.TASK_CONTEXTS=i,exports.TASK_STATUSES=r,exports.TOOL_LABEL=`Task`,exports.TOOL_NAME=`task`,exports.TaskAssignmentSchema=l,exports.TaskItemSchema=c,exports.TaskParamsSchema=u,exports.taskActionAcceptsField=o;
2
2
  //# sourceMappingURL=task.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"task.cjs","names":["Type","InlineAgentSchema"],"sources":["../../src/schemas/task.ts"],"sourcesContent":["import { InlineAgentSchema } from '@agimon-ai/doompi-extension-contracts/subagent-tool';\nimport { type Static, Type } from 'typebox';\nimport { MAX_BRIEF_FILES } from '../types/delegation';\nimport type { TaskAction } from '../services/store/types.ts';\n\nexport const TASK_ACTIONS = ['upsert', 'list', 'get', 'delete', 'clear', 'assign', 'cancel'] as const;\nexport const TASK_STATUSES = ['pending', 'in_progress', 'completed', 'failed', 'deleted'] as const;\nexport const TASK_CONTEXTS = ['fresh', 'fork'] as const;\n\nexport const TOOL_NAME = 'task';\nexport const TOOL_LABEL = 'Task';\nexport const COMMAND_NAME = 'tasks';\n\nexport const ERR_REQUIRES_INTERACTIVE = '/tasks requires interactive mode';\nexport const MSG_NO_TASKS = 'No tasks yet. Ask the agent to add some!';\n\n/**\n * Which top-level fields each action accepts.\n *\n * The params object is flat and shared across every action, so the schema alone\n * cannot express \"upsert has no top-level id\". That gap matters: a call like\n * `{\"action\":\"upsert\",\"id\":3,\"tasks\":[{\"status\":\"completed\"}]}` would otherwise\n * silently create a duplicate task, because the entry itself carries no id.\n */\nexport const TASK_ACTION_FIELDS = {\n upsert: ['action', 'tasks'],\n list: ['action', 'status', 'includeDeleted'],\n get: ['action', 'id'],\n delete: ['action', 'id'],\n clear: ['action'],\n assign: ['action', 'assignments'],\n cancel: ['action', 'id'],\n} as const satisfies Record<TaskAction, readonly string[]>;\n\nexport function taskActionAcceptsField(action: TaskAction, field: string): boolean {\n return (TASK_ACTION_FIELDS[action] as readonly string[]).includes(field);\n}\n\n/** Correction hint appended when a per-task field lands at the top level. */\nexport const MSG_UPSERT_FIELD_MISPLACED =\n 'Per-task fields belong inside each tasks[] entry, not at the top level: {\"action\":\"upsert\",\"tasks\":[{\"id\":3,\"status\":\"completed\"}]}.';\n\n/**\n * A dependency target: an existing task id, or the `ref` of a task created\n * earlier in the same call.\n */\nconst DepTokenSchema = Type.Union([Type.Integer(), Type.String()]);\n\n/**\n * One entry of an upsert. `additionalProperties: false` is load-bearing: pi\n * validates tool arguments against this schema before `execute` runs, so a\n * stray `{\"action\":\"update\"}` inside an entry is rejected at the boundary.\n */\nexport const TaskItemSchema = Type.Object(\n {\n id: Type.Optional(\n Type.Integer({\n description:\n 'Existing task id to change. Omit to create a new task. An entry with an id never creates: if the id is unknown, only that entry fails.',\n }),\n ),\n ref: Type.Optional(\n Type.String({\n description:\n 'Temporary name for a task created by this entry, so a LATER entry in the same tasks[] can list it in blockedBy before its real id exists. Must start with a letter. Scoped to this one call and never stored; the response reports which real id it became.',\n }),\n ),\n subject: Type.Optional(\n Type.String({\n description:\n \"Short imperative subject line (e.g. 'Research existing tool'). Required when the entry has no id; on an entry with an id it renames the task.\",\n }),\n ),\n description: Type.Optional(\n Type.String({\n description: 'Long-form task detail. This becomes the brief handed to the subagent when the task is assigned.',\n }),\n ),\n activeForm: Type.Optional(\n Type.String({\n description: \"Present-continuous spinner label shown while status is in_progress (e.g. 'writing tests')\",\n }),\n ),\n status: Type.Optional(\n Type.String({\n enum: [...TASK_STATUSES],\n description:\n 'Starting status for a new entry (default pending; deleted is rejected), or the target status for an entry with an id, where the transition must be legal.',\n }),\n ),\n blockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description:\n 'Dependencies for a NEW entry (one with no id): this task is blocked by each target. A number is an existing task id; a string is the ref of a task created by an EARLIER entry in this same array. Use addBlockedBy / removeBlockedBy on an entry that has an id.',\n }),\n ),\n addBlockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description:\n 'Dependencies to add, for an entry with an id. Task ids, or refs declared by an earlier entry. Additive merge — do not resend the full array.',\n }),\n ),\n removeBlockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description: 'Dependencies to remove, for an entry with an id. Additive merge — do not resend the full array.',\n }),\n ),\n owner: Type.Optional(\n Type.String({ description: 'Owner label for this task. assign sets this to the subagent name automatically.' }),\n ),\n metadata: Type.Optional(\n Type.Record(Type.String(), Type.Unknown(), {\n description: 'Arbitrary metadata merged into the task; pass null as a value to delete that key',\n }),\n ),\n },\n { additionalProperties: false },\n);\n\n/** One task-to-agent handoff in a native assignment batch. */\nexport const TaskAssignmentSchema = Type.Object(\n {\n id: Type.Integer({ description: 'Pending, unblocked task id to delegate' }),\n agent: Type.String({ description: 'Exact discovered subagent name' }),\n inlineAgent: Type.Optional(InlineAgentSchema),\n instructions: Type.Optional(Type.String({ description: 'Extra instructions appended to this delegated brief' })),\n relevantFiles: Type.Optional(\n Type.Array(Type.String(), {\n description: `Files already read or located for this task. Paths are relative to the working directory; at most ${MAX_BRIEF_FILES} are used.`,\n }),\n ),\n priorFindings: Type.Optional(\n Type.String({ description: 'Established facts this child should consume rather than re-derive' }),\n ),\n model: Type.Optional(Type.String({ description: 'Model override for this delegated run' })),\n context: Type.Optional(\n Type.String({\n enum: [...TASK_CONTEXTS],\n description: \"Starting context for this child: 'fresh' or 'fork'\",\n }),\n ),\n },\n { additionalProperties: false },\n);\n\n/**\n * Tool parameters. Every `description` doubles as LLM-facing prompt copy, so\n * wording changes here change model behaviour.\n */\nexport const TaskParamsSchema = Type.Object({\n action: Type.String({\n enum: [...TASK_ACTIONS],\n description:\n 'upsert (create new tasks and change existing ones, one or many per call), list, get, delete (tombstone), clear (close/reset the list), assign (delegate one or more tasks through assignments[]), cancel (stop a delegated run)',\n }),\n tasks: Type.Optional(\n Type.Array(TaskItemSchema, {\n minItems: 1,\n description:\n 'upsert only. One entry per task: an entry with an id changes that task, an entry without an id creates one. Entries apply in array order, so a later entry can depend on an earlier one by ref. Each entry succeeds or fails on its own: the ones that succeed are committed and the ones that fail are reported by their array index.',\n }),\n ),\n assignments: Type.Optional(\n Type.Array(TaskAssignmentSchema, {\n minItems: 1,\n description:\n 'Required for assign, including one task. Each entry selects its own pending, unblocked task, agent, model, and context pack; successful entries remain delegated if another entry fails. assign has no top-level single-task form.',\n }),\n ),\n id: Type.Optional(\n Type.Integer({\n description:\n 'Task id, for get, delete, and cancel. For assign, put every id inside assignments[]. upsert does not accept this field — put the id inside the tasks[] entry you want to change.',\n }),\n ),\n status: Type.Optional(\n Type.String({\n enum: [...TASK_STATUSES],\n description:\n 'list only: return just the tasks in this status. To SET a status, use upsert with the task id inside tasks[].',\n }),\n ),\n includeDeleted: Type.Optional(\n Type.Boolean({\n description: 'If true, list returns deleted (tombstoned) tasks as well. Default: false.',\n }),\n ),\n});\n\nexport type TaskItemParams = Static<typeof TaskItemSchema>;\nexport type TaskAssignmentParams = Static<typeof TaskAssignmentSchema>;\nexport type TaskParams = Static<typeof TaskParamsSchema>;\n"],"mappings":"6HAKA,MAAa,EAAe,CAAC,SAAU,OAAQ,MAAO,SAAU,QAAS,SAAU,QAAQ,EAC9E,EAAgB,CAAC,UAAW,cAAe,YAAa,SAAU,SAAS,EAC3E,EAAgB,CAAC,QAAS,MAAM,EAiBhC,EAAqB,CAChC,OAAQ,CAAC,SAAU,OAAO,EAC1B,KAAM,CAAC,SAAU,SAAU,gBAAgB,EAC3C,IAAK,CAAC,SAAU,IAAI,EACpB,OAAQ,CAAC,SAAU,IAAI,EACvB,MAAO,CAAC,QAAQ,EAChB,OAAQ,CAAC,SAAU,aAAa,EAChC,OAAQ,CAAC,SAAU,IAAI,CACzB,EAEA,SAAgB,EAAuB,EAAoB,EAAwB,CACjF,OAAQ,EAAmB,EAAO,CAAuB,SAAS,CAAK,CACzE,CAGA,MAOM,EAAiBA,EAAAA,KAAK,MAAM,CAACA,EAAAA,KAAK,QAAQ,EAAGA,EAAAA,KAAK,OAAO,CAAC,CAAC,EAOpD,EAAiBA,EAA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B,EAC5C,aAAcD,EAAAA,KAAK,SAASA,EAAAA,KAAK,OAAO,CAAE,YAAa,qDAAsD,CAAC,CAAC,EAC/G,cAAeA,EAAAA,KAAK,SAClBA,EAAAA,KAAK,MAAMA,EAAAA,KAAK,OAAO,EAAG,CACxB,YAAa,gHACf,CAAC,CACH,EACA,cAAeA,EAAAA,KAAK,SAClBA,EAAAA,KAAK,OAAO,CAAE,YAAa,mEAAoE,CAAC,CAClG,EACA,MAAOA,EAAAA,KAAK,SAASA,EAAAA,KAAK,OAAO,CAAE,YAAa,uCAAwC,CAAC,CAAC,EAC1F,QAASA,EAAAA,KAAK,SACZA,EAAAA,KAAK,OAAO,CACV,KAAM,CAAC,GAAG,CAAa,EACvB,YAAa,oDACf,CAAC,CACH,CACF,EACA,CAAE,qBAAsB,EAAM,CAChC,EAMa,EAAmBA,EAAAA,KAAK,OAAO,CAC1C,OAAQA,EAAAA,KAAK,OAAO,CAClB,KAAM,CAAC,GAAG,CAAY,EACtB,YACE,iOACJ,CAAC,EACD,MAAOA,EAAAA,KAAK,SACVA,EAAAA,KAAK,MAAM,EAAgB,CACzB,SAAU,EACV,YACE,wUACJ,CAAC,CACH,EACA,YAAaA,EAAAA,KAAK,SAChBA,EAAAA,KAAK,MAAM,EAAsB,CAC/B,SAAU,EACV,YACE,oOACJ,CAAC,CACH,EACA,GAAIA,EAAAA,KAAK,SACPA,EAAAA,KAAK,QAAQ,CACX,YACE,kLACJ,CAAC,CACH,EACA,OAAQA,EAAAA,KAAK,SACXA,EAAAA,KAAK,OAAO,CACV,KAAM,CAAC,GAAG,CAAa,EACvB,YACE,+GACJ,CAAC,CACH,EACA,eAAgBA,EAAAA,KAAK,SACnBA,EAAAA,KAAK,QAAQ,CACX,YAAa,2EACf,CAAC,CACH,CACF,CAAC"}
1
+ {"version":3,"file":"task.cjs","names":["Type","InlineAgentSchema"],"sources":["../../src/schemas/task.ts"],"sourcesContent":["import { InlineAgentSchema } from '@agimon-ai/doompi-extension-contracts/subagent-tool';\nimport { type Static, Type } from 'typebox';\nimport { MAX_BRIEF_FILES } from '../types/delegation';\nimport type { TaskAction } from '../services/store/types.ts';\n\nexport const TASK_ACTIONS = ['upsert', 'list', 'get', 'delete', 'clear', 'assign', 'cancel'] as const;\nexport const TASK_STATUSES = ['pending', 'in_progress', 'completed', 'failed', 'deleted'] as const;\nexport const TASK_CONTEXTS = ['fresh', 'fork'] as const;\n\nexport const TOOL_NAME = 'task';\nexport const TOOL_LABEL = 'Task';\nexport const COMMAND_NAME = 'tasks';\n\nexport const ERR_REQUIRES_INTERACTIVE = '/tasks requires interactive mode';\nexport const MSG_NO_TASKS = 'No tasks yet. Ask the agent to add some!';\n\n/**\n * Which top-level fields each action accepts.\n *\n * The params object is flat and shared across every action, so the schema alone\n * cannot express \"upsert has no top-level id\". That gap matters: a call like\n * `{\"action\":\"upsert\",\"id\":3,\"tasks\":[{\"status\":\"completed\"}]}` would otherwise\n * silently create a duplicate task, because the entry itself carries no id.\n */\nexport const TASK_ACTION_FIELDS = {\n upsert: ['action', 'tasks'],\n list: ['action', 'status', 'includeDeleted'],\n get: ['action', 'id'],\n delete: ['action', 'id'],\n clear: ['action'],\n assign: ['action', 'assignments'],\n cancel: ['action', 'id'],\n} as const satisfies Record<TaskAction, readonly string[]>;\n\nexport function taskActionAcceptsField(action: TaskAction, field: string): boolean {\n return (TASK_ACTION_FIELDS[action] as readonly string[]).includes(field);\n}\n\n/** Correction hint appended when a per-task field lands at the top level. */\nexport const MSG_UPSERT_FIELD_MISPLACED =\n 'Per-task fields belong inside each tasks[] entry, not at the top level: {\"action\":\"upsert\",\"tasks\":[{\"id\":3,\"status\":\"completed\"}]}.';\n\n/**\n * A dependency target: an existing task id, or the `ref` of a task created\n * earlier in the same call.\n */\nconst DepTokenSchema = Type.Union([Type.Integer(), Type.String()]);\n\n/**\n * One entry of an upsert. `additionalProperties: false` is load-bearing: pi\n * validates tool arguments against this schema before `execute` runs, so a\n * stray `{\"action\":\"update\"}` inside an entry is rejected at the boundary.\n */\nexport const TaskItemSchema = Type.Object(\n {\n id: Type.Optional(\n Type.Integer({\n description:\n 'Existing task id to change. Omit to create. An unknown id fails only that entry; it never creates.',\n }),\n ),\n ref: Type.Optional(\n Type.String({\n description:\n 'Temporary name for a task created by this entry, so a LATER entry in this array can list it in blockedBy. Must start with a letter; never stored.',\n }),\n ),\n subject: Type.Optional(\n Type.String({\n description: 'Short imperative subject. Required when the entry has no id; on an entry with an id it renames.',\n }),\n ),\n description: Type.Optional(\n Type.String({ description: 'Long-form detail; becomes the brief handed to the subagent on assign.' }),\n ),\n activeForm: Type.Optional(\n Type.String({ description: \"Present-continuous label shown while in_progress (e.g. 'writing tests')\" }),\n ),\n status: Type.Optional(\n Type.String({\n enum: [...TASK_STATUSES],\n description:\n 'New entries default to pending and cannot start deleted; on an entry with an id the transition must be legal.',\n }),\n ),\n blockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description:\n 'Dependencies for a NEW entry: task ids, or refs of tasks created EARLIER in this array. On an entry with an id use addBlockedBy / removeBlockedBy instead.',\n }),\n ),\n addBlockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description: 'Dependencies to add (ids or earlier refs). Additive; do not resend the full array.',\n }),\n ),\n removeBlockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description: 'Dependencies to remove. Additive; do not resend the full array.',\n }),\n ),\n owner: Type.Optional(Type.String({ description: 'Owner label; assign sets it to the subagent name.' })),\n metadata: Type.Optional(\n Type.Record(Type.String(), Type.Unknown(), {\n description: 'Merged into the task; a null value deletes that key.',\n }),\n ),\n },\n { additionalProperties: false },\n);\n\n/** One task-to-agent handoff in a native assignment batch. */\nexport const TaskAssignmentSchema = Type.Object(\n {\n id: Type.Integer({ description: 'Pending, unblocked task id to delegate' }),\n agent: Type.String({ description: 'Exact discovered subagent name' }),\n inlineAgent: Type.Optional(InlineAgentSchema),\n instructions: Type.Optional(Type.String({ description: 'Extra instructions appended to this delegated brief' })),\n relevantFiles: Type.Optional(\n Type.Array(Type.String(), {\n description: `Files already read or located, relative to the working directory; at most ${MAX_BRIEF_FILES} are used.`,\n }),\n ),\n priorFindings: Type.Optional(\n Type.String({ description: 'Established facts this child should consume rather than re-derive' }),\n ),\n model: Type.Optional(Type.String({ description: 'Model override for this delegated run' })),\n context: Type.Optional(\n Type.String({\n enum: [...TASK_CONTEXTS],\n description: \"Starting context for this child: 'fresh' or 'fork'\",\n }),\n ),\n },\n { additionalProperties: false },\n);\n\n/**\n * Tool parameters. Every `description` doubles as LLM-facing prompt copy, so\n * wording changes here change model behaviour.\n */\nexport const TaskParamsSchema = Type.Object({\n action: Type.String({ enum: [...TASK_ACTIONS] }),\n tasks: Type.Optional(\n Type.Array(TaskItemSchema, {\n minItems: 1,\n description:\n 'upsert only. An entry with an id changes that task, an entry without an id creates one. Entries apply in array order, so a later entry can depend on an earlier one by ref.',\n }),\n ),\n assignments: Type.Optional(\n Type.Array(TaskAssignmentSchema, {\n minItems: 1,\n description: 'Required for assign, one entry per task, including when there is only one.',\n }),\n ),\n id: Type.Optional(\n Type.Integer({\n description:\n 'Task id, for get, delete and cancel. Not accepted by upsert or assign: those carry ids inside tasks[] and assignments[] entries.',\n }),\n ),\n status: Type.Optional(\n Type.String({\n enum: [...TASK_STATUSES],\n description: 'list only: return just the tasks in this status. To SET a status, upsert the task by id.',\n }),\n ),\n includeDeleted: Type.Optional(\n Type.Boolean({ description: 'list only: also return deleted tombstones. Default false.' }),\n ),\n});\n\nexport type TaskItemParams = Static<typeof TaskItemSchema>;\nexport type TaskAssignmentParams = Static<typeof TaskAssignmentSchema>;\nexport type TaskParams = Static<typeof TaskParamsSchema>;\n"],"mappings":"6HAKA,MAAa,EAAe,CAAC,SAAU,OAAQ,MAAO,SAAU,QAAS,SAAU,QAAQ,EAC9E,EAAgB,CAAC,UAAW,cAAe,YAAa,SAAU,SAAS,EAC3E,EAAgB,CAAC,QAAS,MAAM,EAiBhC,EAAqB,CAChC,OAAQ,CAAC,SAAU,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CAAC,CACH,EACA,GAAIA,EAAAA,KAAK,SACPA,EAAAA,KAAK,QAAQ,CACX,YACE,kIACJ,CAAC,CACH,EACA,OAAQA,EAAAA,KAAK,SACXA,EAAAA,KAAK,OAAO,CACV,KAAM,CAAC,GAAG,CAAa,EACvB,YAAa,0FACf,CAAC,CACH,EACA,eAAgBA,EAAAA,KAAK,SACnBA,EAAAA,KAAK,QAAQ,CAAE,YAAa,2DAA4D,CAAC,CAC3F,CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"task.d.cts","names":[],"sources":["../../src/schemas/task.ts"],"mappings":";;;cAKa;cACA;cACA;cAEA;cACA;cACA;cAEA;cACA;;;;;;;;;cAUA;;;;;;;;;iBAUG,uBAAuB,QAAQ,YAAY;;cAK9C;;;;;;cAcA,gBAAc,KAAA;;;;;;;;;;;;;;cAmEd,sBAAoB,KAAA;;;;;;;;;;;;;;;;cA6BpB,kBAAgB,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwCjB,iBAAiB,cAAc;KAC/B,uBAAuB,cAAc;KACrC,aAAa,cAAc"}
1
+ {"version":3,"file":"task.d.cts","names":[],"sources":["../../src/schemas/task.ts"],"mappings":";;;cAKa;cACA;cACA;cAEA;cACA;cACA;cAEA;cACA;;;;;;;;;cAUA;;;;;;;;;iBAUG,uBAAuB,QAAQ,YAAY;;cAK9C;;;;;;cAcA,gBAAc,KAAA;;;;;;;;;;;;;;cA2Dd,sBAAoB,KAAA;;;;;;;;;;;;;;;;cA6BpB,kBAAgB,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgCjB,iBAAiB,cAAc;KAC/B,uBAAuB,cAAc;KACrC,aAAa,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"task.d.mts","names":[],"sources":["../../src/schemas/task.ts"],"mappings":";;;cAKa;cACA;cACA;cAEA;cACA;cACA;cAEA;cACA;;;;;;;;;cAUA;;;;;;;;;iBAUG,uBAAuB,QAAQ,YAAY;;cAK9C;;;;;;cAcA,gBAAc,KAAA;;;;;;;;;;;;;;cAmEd,sBAAoB,KAAA;;;;;;;;;;;;;;;;cA6BpB,kBAAgB,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwCjB,iBAAiB,cAAc;KAC/B,uBAAuB,cAAc;KACrC,aAAa,cAAc"}
1
+ {"version":3,"file":"task.d.mts","names":[],"sources":["../../src/schemas/task.ts"],"mappings":";;;cAKa;cACA;cACA;cAEA;cACA;cACA;cAEA;cACA;;;;;;;;;cAUA;;;;;;;;;iBAUG,uBAAuB,QAAQ,YAAY;;cAK9C;;;;;;cAcA,gBAAc,KAAA;;;;;;;;;;;;;;cA2Dd,sBAAoB,KAAA;;;;;;;;;;;;;;;;cA6BpB,kBAAgB,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgCjB,iBAAiB,cAAc;KAC/B,uBAAuB,cAAc;KACrC,aAAa,cAAc"}
@@ -1,2 +1,2 @@
1
- import"../types/delegation.mjs";import{InlineAgentSchema as e}from"@agimon-ai/doompi-extension-contracts/subagent-tool";import{Type as t}from"typebox";const n=[`upsert`,`list`,`get`,`delete`,`clear`,`assign`,`cancel`],r=[`pending`,`in_progress`,`completed`,`failed`,`deleted`],i=[`fresh`,`fork`],a=`task`,o=`Task`,s=`tasks`,c=`/tasks requires interactive mode`,l=`No tasks yet. Ask the agent to add some!`,u={upsert:[`action`,`tasks`],list:[`action`,`status`,`includeDeleted`],get:[`action`,`id`],delete:[`action`,`id`],clear:[`action`],assign:[`action`,`assignments`],cancel:[`action`,`id`]};function d(e,t){return u[e].includes(t)}const f=`Per-task fields belong inside each tasks[] entry, not at the top level: {"action":"upsert","tasks":[{"id":3,"status":"completed"}]}.`,p=t.Union([t.Integer(),t.String()]),m=t.Object({id:t.Optional(t.Integer({description:`Existing task id to change. Omit to create a new task. An entry with an id never creates: if the id is unknown, only that entry fails.`})),ref:t.Optional(t.String({description:`Temporary name for a task created by this entry, so a LATER entry in the same tasks[] can list it in blockedBy before its real id exists. Must start with a letter. Scoped to this one call and never stored; the response reports which real id it became.`})),subject:t.Optional(t.String({description:`Short imperative subject line (e.g. 'Research existing tool'). Required when the entry has no id; on an entry with an id it renames the task.`})),description:t.Optional(t.String({description:`Long-form task detail. This becomes the brief handed to the subagent when the task is assigned.`})),activeForm:t.Optional(t.String({description:`Present-continuous spinner label shown while status is in_progress (e.g. 'writing tests')`})),status:t.Optional(t.String({enum:[...r],description:`Starting status for a new entry (default pending; deleted is rejected), or the target status for an entry with an id, where the transition must be legal.`})),blockedBy:t.Optional(t.Array(p,{description:`Dependencies for a NEW entry (one with no id): this task is blocked by each target. A number is an existing task id; a string is the ref of a task created by an EARLIER entry in this same array. Use addBlockedBy / removeBlockedBy on an entry that has an id.`})),addBlockedBy:t.Optional(t.Array(p,{description:`Dependencies to add, for an entry with an id. Task ids, or refs declared by an earlier entry. Additive merge — do not resend the full array.`})),removeBlockedBy:t.Optional(t.Array(p,{description:`Dependencies to remove, for an entry with an id. Additive merge — do not resend the full array.`})),owner:t.Optional(t.String({description:`Owner label for this task. assign sets this to the subagent name automatically.`})),metadata:t.Optional(t.Record(t.String(),t.Unknown(),{description:`Arbitrary metadata merged into the task; pass null as a value to delete that key`}))},{additionalProperties:!1}),h=t.Object({id:t.Integer({description:`Pending, unblocked task id to delegate`}),agent:t.String({description:`Exact discovered subagent name`}),inlineAgent:t.Optional(e),instructions:t.Optional(t.String({description:`Extra instructions appended to this delegated brief`})),relevantFiles:t.Optional(t.Array(t.String(),{description:`Files already read or located for this task. Paths are relative to the working directory; at most 12 are used.`})),priorFindings:t.Optional(t.String({description:`Established facts this child should consume rather than re-derive`})),model:t.Optional(t.String({description:`Model override for this delegated run`})),context:t.Optional(t.String({enum:[...i],description:`Starting context for this child: 'fresh' or 'fork'`}))},{additionalProperties:!1}),g=t.Object({action:t.String({enum:[...n],description:`upsert (create new tasks and change existing ones, one or many per call), list, get, delete (tombstone), clear (close/reset the list), assign (delegate one or more tasks through assignments[]), cancel (stop a delegated run)`}),tasks:t.Optional(t.Array(m,{minItems:1,description:`upsert only. One entry per task: an entry with an id changes that task, an entry without an id creates one. Entries apply in array order, so a later entry can depend on an earlier one by ref. Each entry succeeds or fails on its own: the ones that succeed are committed and the ones that fail are reported by their array index.`})),assignments:t.Optional(t.Array(h,{minItems:1,description:`Required for assign, including one task. Each entry selects its own pending, unblocked task, agent, model, and context pack; successful entries remain delegated if another entry fails. assign has no top-level single-task form.`})),id:t.Optional(t.Integer({description:`Task id, for get, delete, and cancel. For assign, put every id inside assignments[]. upsert does not accept this field — put the id inside the tasks[] entry you want to change.`})),status:t.Optional(t.String({enum:[...r],description:`list only: return just the tasks in this status. To SET a status, use upsert with the task id inside tasks[].`})),includeDeleted:t.Optional(t.Boolean({description:`If true, list returns deleted (tombstoned) tasks as well. Default: false.`}))});export{s as COMMAND_NAME,c as ERR_REQUIRES_INTERACTIVE,l as MSG_NO_TASKS,f as MSG_UPSERT_FIELD_MISPLACED,n as TASK_ACTIONS,u as TASK_ACTION_FIELDS,i as TASK_CONTEXTS,r as TASK_STATUSES,o as TOOL_LABEL,a as TOOL_NAME,h as TaskAssignmentSchema,m as TaskItemSchema,g as TaskParamsSchema,d as taskActionAcceptsField};
1
+ import"../types/delegation.mjs";import{InlineAgentSchema as e}from"@agimon-ai/doompi-extension-contracts/subagent-tool";import{Type as t}from"typebox";const n=[`upsert`,`list`,`get`,`delete`,`clear`,`assign`,`cancel`],r=[`pending`,`in_progress`,`completed`,`failed`,`deleted`],i=[`fresh`,`fork`],a=`task`,o=`Task`,s=`tasks`,c=`/tasks requires interactive mode`,l=`No tasks yet. Ask the agent to add some!`,u={upsert:[`action`,`tasks`],list:[`action`,`status`,`includeDeleted`],get:[`action`,`id`],delete:[`action`,`id`],clear:[`action`],assign:[`action`,`assignments`],cancel:[`action`,`id`]};function d(e,t){return u[e].includes(t)}const f=`Per-task fields belong inside each tasks[] entry, not at the top level: {"action":"upsert","tasks":[{"id":3,"status":"completed"}]}.`,p=t.Union([t.Integer(),t.String()]),m=t.Object({id:t.Optional(t.Integer({description:`Existing task id to change. Omit to create. An unknown id fails only that entry; it never creates.`})),ref:t.Optional(t.String({description:`Temporary name for a task created by this entry, so a LATER entry in this array can list it in blockedBy. Must start with a letter; never stored.`})),subject:t.Optional(t.String({description:`Short imperative subject. Required when the entry has no id; on an entry with an id it renames.`})),description:t.Optional(t.String({description:`Long-form detail; becomes the brief handed to the subagent on assign.`})),activeForm:t.Optional(t.String({description:`Present-continuous label shown while in_progress (e.g. 'writing tests')`})),status:t.Optional(t.String({enum:[...r],description:`New entries default to pending and cannot start deleted; on an entry with an id the transition must be legal.`})),blockedBy:t.Optional(t.Array(p,{description:`Dependencies for a NEW entry: task ids, or refs of tasks created EARLIER in this array. On an entry with an id use addBlockedBy / removeBlockedBy instead.`})),addBlockedBy:t.Optional(t.Array(p,{description:`Dependencies to add (ids or earlier refs). Additive; do not resend the full array.`})),removeBlockedBy:t.Optional(t.Array(p,{description:`Dependencies to remove. Additive; do not resend the full array.`})),owner:t.Optional(t.String({description:`Owner label; assign sets it to the subagent name.`})),metadata:t.Optional(t.Record(t.String(),t.Unknown(),{description:`Merged into the task; a null value deletes that key.`}))},{additionalProperties:!1}),h=t.Object({id:t.Integer({description:`Pending, unblocked task id to delegate`}),agent:t.String({description:`Exact discovered subagent name`}),inlineAgent:t.Optional(e),instructions:t.Optional(t.String({description:`Extra instructions appended to this delegated brief`})),relevantFiles:t.Optional(t.Array(t.String(),{description:`Files already read or located, relative to the working directory; at most 12 are used.`})),priorFindings:t.Optional(t.String({description:`Established facts this child should consume rather than re-derive`})),model:t.Optional(t.String({description:`Model override for this delegated run`})),context:t.Optional(t.String({enum:[...i],description:`Starting context for this child: 'fresh' or 'fork'`}))},{additionalProperties:!1}),g=t.Object({action:t.String({enum:[...n]}),tasks:t.Optional(t.Array(m,{minItems:1,description:`upsert only. An entry with an id changes that task, an entry without an id creates one. Entries apply in array order, so a later entry can depend on an earlier one by ref.`})),assignments:t.Optional(t.Array(h,{minItems:1,description:`Required for assign, one entry per task, including when there is only one.`})),id:t.Optional(t.Integer({description:`Task id, for get, delete and cancel. Not accepted by upsert or assign: those carry ids inside tasks[] and assignments[] entries.`})),status:t.Optional(t.String({enum:[...r],description:`list only: return just the tasks in this status. To SET a status, upsert the task by id.`})),includeDeleted:t.Optional(t.Boolean({description:`list only: also return deleted tombstones. Default false.`}))});export{s as COMMAND_NAME,c as ERR_REQUIRES_INTERACTIVE,l as MSG_NO_TASKS,f as MSG_UPSERT_FIELD_MISPLACED,n as TASK_ACTIONS,u as TASK_ACTION_FIELDS,i as TASK_CONTEXTS,r as TASK_STATUSES,o as TOOL_LABEL,a as TOOL_NAME,h as TaskAssignmentSchema,m as TaskItemSchema,g as TaskParamsSchema,d as taskActionAcceptsField};
2
2
  //# sourceMappingURL=task.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"task.mjs","names":[],"sources":["../../src/schemas/task.ts"],"sourcesContent":["import { InlineAgentSchema } from '@agimon-ai/doompi-extension-contracts/subagent-tool';\nimport { type Static, Type } from 'typebox';\nimport { MAX_BRIEF_FILES } from '../types/delegation';\nimport type { TaskAction } from '../services/store/types.ts';\n\nexport const TASK_ACTIONS = ['upsert', 'list', 'get', 'delete', 'clear', 'assign', 'cancel'] as const;\nexport const TASK_STATUSES = ['pending', 'in_progress', 'completed', 'failed', 'deleted'] as const;\nexport const TASK_CONTEXTS = ['fresh', 'fork'] as const;\n\nexport const TOOL_NAME = 'task';\nexport const TOOL_LABEL = 'Task';\nexport const COMMAND_NAME = 'tasks';\n\nexport const ERR_REQUIRES_INTERACTIVE = '/tasks requires interactive mode';\nexport const MSG_NO_TASKS = 'No tasks yet. Ask the agent to add some!';\n\n/**\n * Which top-level fields each action accepts.\n *\n * The params object is flat and shared across every action, so the schema alone\n * cannot express \"upsert has no top-level id\". That gap matters: a call like\n * `{\"action\":\"upsert\",\"id\":3,\"tasks\":[{\"status\":\"completed\"}]}` would otherwise\n * silently create a duplicate task, because the entry itself carries no id.\n */\nexport const TASK_ACTION_FIELDS = {\n upsert: ['action', 'tasks'],\n list: ['action', 'status', 'includeDeleted'],\n get: ['action', 'id'],\n delete: ['action', 'id'],\n clear: ['action'],\n assign: ['action', 'assignments'],\n cancel: ['action', 'id'],\n} as const satisfies Record<TaskAction, readonly string[]>;\n\nexport function taskActionAcceptsField(action: TaskAction, field: string): boolean {\n return (TASK_ACTION_FIELDS[action] as readonly string[]).includes(field);\n}\n\n/** Correction hint appended when a per-task field lands at the top level. */\nexport const MSG_UPSERT_FIELD_MISPLACED =\n 'Per-task fields belong inside each tasks[] entry, not at the top level: {\"action\":\"upsert\",\"tasks\":[{\"id\":3,\"status\":\"completed\"}]}.';\n\n/**\n * A dependency target: an existing task id, or the `ref` of a task created\n * earlier in the same call.\n */\nconst DepTokenSchema = Type.Union([Type.Integer(), Type.String()]);\n\n/**\n * One entry of an upsert. `additionalProperties: false` is load-bearing: pi\n * validates tool arguments against this schema before `execute` runs, so a\n * stray `{\"action\":\"update\"}` inside an entry is rejected at the boundary.\n */\nexport const TaskItemSchema = Type.Object(\n {\n id: Type.Optional(\n Type.Integer({\n description:\n 'Existing task id to change. Omit to create a new task. An entry with an id never creates: if the id is unknown, only that entry fails.',\n }),\n ),\n ref: Type.Optional(\n Type.String({\n description:\n 'Temporary name for a task created by this entry, so a LATER entry in the same tasks[] can list it in blockedBy before its real id exists. Must start with a letter. Scoped to this one call and never stored; the response reports which real id it became.',\n }),\n ),\n subject: Type.Optional(\n Type.String({\n description:\n \"Short imperative subject line (e.g. 'Research existing tool'). Required when the entry has no id; on an entry with an id it renames the task.\",\n }),\n ),\n description: Type.Optional(\n Type.String({\n description: 'Long-form task detail. This becomes the brief handed to the subagent when the task is assigned.',\n }),\n ),\n activeForm: Type.Optional(\n Type.String({\n description: \"Present-continuous spinner label shown while status is in_progress (e.g. 'writing tests')\",\n }),\n ),\n status: Type.Optional(\n Type.String({\n enum: [...TASK_STATUSES],\n description:\n 'Starting status for a new entry (default pending; deleted is rejected), or the target status for an entry with an id, where the transition must be legal.',\n }),\n ),\n blockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description:\n 'Dependencies for a NEW entry (one with no id): this task is blocked by each target. A number is an existing task id; a string is the ref of a task created by an EARLIER entry in this same array. Use addBlockedBy / removeBlockedBy on an entry that has an id.',\n }),\n ),\n addBlockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description:\n 'Dependencies to add, for an entry with an id. Task ids, or refs declared by an earlier entry. Additive merge — do not resend the full array.',\n }),\n ),\n removeBlockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description: 'Dependencies to remove, for an entry with an id. Additive merge — do not resend the full array.',\n }),\n ),\n owner: Type.Optional(\n Type.String({ description: 'Owner label for this task. assign sets this to the subagent name automatically.' }),\n ),\n metadata: Type.Optional(\n Type.Record(Type.String(), Type.Unknown(), {\n description: 'Arbitrary metadata merged into the task; pass null as a value to delete that key',\n }),\n ),\n },\n { additionalProperties: false },\n);\n\n/** One task-to-agent handoff in a native assignment batch. */\nexport const TaskAssignmentSchema = Type.Object(\n {\n id: Type.Integer({ description: 'Pending, unblocked task id to delegate' }),\n agent: Type.String({ description: 'Exact discovered subagent name' }),\n inlineAgent: Type.Optional(InlineAgentSchema),\n instructions: Type.Optional(Type.String({ description: 'Extra instructions appended to this delegated brief' })),\n relevantFiles: Type.Optional(\n Type.Array(Type.String(), {\n description: `Files already read or located for this task. Paths are relative to the working directory; at most ${MAX_BRIEF_FILES} are used.`,\n }),\n ),\n priorFindings: Type.Optional(\n Type.String({ description: 'Established facts this child should consume rather than re-derive' }),\n ),\n model: Type.Optional(Type.String({ description: 'Model override for this delegated run' })),\n context: Type.Optional(\n Type.String({\n enum: [...TASK_CONTEXTS],\n description: \"Starting context for this child: 'fresh' or 'fork'\",\n }),\n ),\n },\n { additionalProperties: false },\n);\n\n/**\n * Tool parameters. Every `description` doubles as LLM-facing prompt copy, so\n * wording changes here change model behaviour.\n */\nexport const TaskParamsSchema = Type.Object({\n action: Type.String({\n enum: [...TASK_ACTIONS],\n description:\n 'upsert (create new tasks and change existing ones, one or many per call), list, get, delete (tombstone), clear (close/reset the list), assign (delegate one or more tasks through assignments[]), cancel (stop a delegated run)',\n }),\n tasks: Type.Optional(\n Type.Array(TaskItemSchema, {\n minItems: 1,\n description:\n 'upsert only. One entry per task: an entry with an id changes that task, an entry without an id creates one. Entries apply in array order, so a later entry can depend on an earlier one by ref. Each entry succeeds or fails on its own: the ones that succeed are committed and the ones that fail are reported by their array index.',\n }),\n ),\n assignments: Type.Optional(\n Type.Array(TaskAssignmentSchema, {\n minItems: 1,\n description:\n 'Required for assign, including one task. Each entry selects its own pending, unblocked task, agent, model, and context pack; successful entries remain delegated if another entry fails. assign has no top-level single-task form.',\n }),\n ),\n id: Type.Optional(\n Type.Integer({\n description:\n 'Task id, for get, delete, and cancel. For assign, put every id inside assignments[]. upsert does not accept this field — put the id inside the tasks[] entry you want to change.',\n }),\n ),\n status: Type.Optional(\n Type.String({\n enum: [...TASK_STATUSES],\n description:\n 'list only: return just the tasks in this status. To SET a status, use upsert with the task id inside tasks[].',\n }),\n ),\n includeDeleted: Type.Optional(\n Type.Boolean({\n description: 'If true, list returns deleted (tombstoned) tasks as well. Default: false.',\n }),\n ),\n});\n\nexport type TaskItemParams = Static<typeof TaskItemSchema>;\nexport type TaskAssignmentParams = Static<typeof TaskAssignmentSchema>;\nexport type TaskParams = Static<typeof TaskParamsSchema>;\n"],"mappings":"uJAKA,MAAa,EAAe,CAAC,SAAU,OAAQ,MAAO,SAAU,QAAS,SAAU,QAAQ,EAC9E,EAAgB,CAAC,UAAW,cAAe,YAAa,SAAU,SAAS,EAC3E,EAAgB,CAAC,QAAS,MAAM,EAEhC,EAAY,OACZ,EAAa,OACb,EAAe,QAEf,EAA2B,mCAC3B,EAAe,2CAUf,EAAqB,CAChC,OAAQ,CAAC,SAAU,OAAO,EAC1B,KAAM,CAAC,SAAU,SAAU,gBAAgB,EAC3C,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Aa,wCAAyC,CAAC,EAC1E,MAAO,EAAK,OAAO,CAAE,YAAa,gCAAiC,CAAC,EACpE,YAAa,EAAK,SAAS,CAAiB,EAC5C,aAAc,EAAK,SAAS,EAAK,OAAO,CAAE,YAAa,qDAAsD,CAAC,CAAC,EAC/G,cAAe,EAAK,SAClB,EAAK,MAAM,EAAK,OAAO,EAAG,CACxB,YAAa,gHACf,CAAC,CACH,EACA,cAAe,EAAK,SAClB,EAAK,OAAO,CAAE,YAAa,mEAAoE,CAAC,CAClG,EACA,MAAO,EAAK,SAAS,EAAK,OAAO,CAAE,YAAa,uCAAwC,CAAC,CAAC,EAC1F,QAAS,EAAK,SACZ,EAAK,OAAO,CACV,KAAM,CAAC,GAAG,CAAa,EACvB,YAAa,oDACf,CAAC,CACH,CACF,EACA,CAAE,qBAAsB,EAAM,CAChC,EAMa,EAAmB,EAAK,OAAO,CAC1C,OAAQ,EAAK,OAAO,CAClB,KAAM,CAAC,GAAG,CAAY,EACtB,YACE,iOACJ,CAAC,EACD,MAAO,EAAK,SACV,EAAK,MAAM,EAAgB,CACzB,SAAU,EACV,YACE,wUACJ,CAAC,CACH,EACA,YAAa,EAAK,SAChB,EAAK,MAAM,EAAsB,CAC/B,SAAU,EACV,YACE,oOACJ,CAAC,CACH,EACA,GAAI,EAAK,SACP,EAAK,QAAQ,CACX,YACE,kLACJ,CAAC,CACH,EACA,OAAQ,EAAK,SACX,EAAK,OAAO,CACV,KAAM,CAAC,GAAG,CAAa,EACvB,YACE,+GACJ,CAAC,CACH,EACA,eAAgB,EAAK,SACnB,EAAK,QAAQ,CACX,YAAa,2EACf,CAAC,CACH,CACF,CAAC"}
1
+ {"version":3,"file":"task.mjs","names":[],"sources":["../../src/schemas/task.ts"],"sourcesContent":["import { InlineAgentSchema } from '@agimon-ai/doompi-extension-contracts/subagent-tool';\nimport { type Static, Type } from 'typebox';\nimport { MAX_BRIEF_FILES } from '../types/delegation';\nimport type { TaskAction } from '../services/store/types.ts';\n\nexport const TASK_ACTIONS = ['upsert', 'list', 'get', 'delete', 'clear', 'assign', 'cancel'] as const;\nexport const TASK_STATUSES = ['pending', 'in_progress', 'completed', 'failed', 'deleted'] as const;\nexport const TASK_CONTEXTS = ['fresh', 'fork'] as const;\n\nexport const TOOL_NAME = 'task';\nexport const TOOL_LABEL = 'Task';\nexport const COMMAND_NAME = 'tasks';\n\nexport const ERR_REQUIRES_INTERACTIVE = '/tasks requires interactive mode';\nexport const MSG_NO_TASKS = 'No tasks yet. Ask the agent to add some!';\n\n/**\n * Which top-level fields each action accepts.\n *\n * The params object is flat and shared across every action, so the schema alone\n * cannot express \"upsert has no top-level id\". That gap matters: a call like\n * `{\"action\":\"upsert\",\"id\":3,\"tasks\":[{\"status\":\"completed\"}]}` would otherwise\n * silently create a duplicate task, because the entry itself carries no id.\n */\nexport const TASK_ACTION_FIELDS = {\n upsert: ['action', 'tasks'],\n list: ['action', 'status', 'includeDeleted'],\n get: ['action', 'id'],\n delete: ['action', 'id'],\n clear: ['action'],\n assign: ['action', 'assignments'],\n cancel: ['action', 'id'],\n} as const satisfies Record<TaskAction, readonly string[]>;\n\nexport function taskActionAcceptsField(action: TaskAction, field: string): boolean {\n return (TASK_ACTION_FIELDS[action] as readonly string[]).includes(field);\n}\n\n/** Correction hint appended when a per-task field lands at the top level. */\nexport const MSG_UPSERT_FIELD_MISPLACED =\n 'Per-task fields belong inside each tasks[] entry, not at the top level: {\"action\":\"upsert\",\"tasks\":[{\"id\":3,\"status\":\"completed\"}]}.';\n\n/**\n * A dependency target: an existing task id, or the `ref` of a task created\n * earlier in the same call.\n */\nconst DepTokenSchema = Type.Union([Type.Integer(), Type.String()]);\n\n/**\n * One entry of an upsert. `additionalProperties: false` is load-bearing: pi\n * validates tool arguments against this schema before `execute` runs, so a\n * stray `{\"action\":\"update\"}` inside an entry is rejected at the boundary.\n */\nexport const TaskItemSchema = Type.Object(\n {\n id: Type.Optional(\n Type.Integer({\n description:\n 'Existing task id to change. Omit to create. An unknown id fails only that entry; it never creates.',\n }),\n ),\n ref: Type.Optional(\n Type.String({\n description:\n 'Temporary name for a task created by this entry, so a LATER entry in this array can list it in blockedBy. Must start with a letter; never stored.',\n }),\n ),\n subject: Type.Optional(\n Type.String({\n description: 'Short imperative subject. Required when the entry has no id; on an entry with an id it renames.',\n }),\n ),\n description: Type.Optional(\n Type.String({ description: 'Long-form detail; becomes the brief handed to the subagent on assign.' }),\n ),\n activeForm: Type.Optional(\n Type.String({ description: \"Present-continuous label shown while in_progress (e.g. 'writing tests')\" }),\n ),\n status: Type.Optional(\n Type.String({\n enum: [...TASK_STATUSES],\n description:\n 'New entries default to pending and cannot start deleted; on an entry with an id the transition must be legal.',\n }),\n ),\n blockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description:\n 'Dependencies for a NEW entry: task ids, or refs of tasks created EARLIER in this array. On an entry with an id use addBlockedBy / removeBlockedBy instead.',\n }),\n ),\n addBlockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description: 'Dependencies to add (ids or earlier refs). Additive; do not resend the full array.',\n }),\n ),\n removeBlockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description: 'Dependencies to remove. Additive; do not resend the full array.',\n }),\n ),\n owner: Type.Optional(Type.String({ description: 'Owner label; assign sets it to the subagent name.' })),\n metadata: Type.Optional(\n Type.Record(Type.String(), Type.Unknown(), {\n description: 'Merged into the task; a null value deletes that key.',\n }),\n ),\n },\n { additionalProperties: false },\n);\n\n/** One task-to-agent handoff in a native assignment batch. */\nexport const TaskAssignmentSchema = Type.Object(\n {\n id: Type.Integer({ description: 'Pending, unblocked task id to delegate' }),\n agent: Type.String({ description: 'Exact discovered subagent name' }),\n inlineAgent: Type.Optional(InlineAgentSchema),\n instructions: Type.Optional(Type.String({ description: 'Extra instructions appended to this delegated brief' })),\n relevantFiles: Type.Optional(\n Type.Array(Type.String(), {\n description: `Files already read or located, relative to the working directory; at most ${MAX_BRIEF_FILES} are used.`,\n }),\n ),\n priorFindings: Type.Optional(\n Type.String({ description: 'Established facts this child should consume rather than re-derive' }),\n ),\n model: Type.Optional(Type.String({ description: 'Model override for this delegated run' })),\n context: Type.Optional(\n Type.String({\n enum: [...TASK_CONTEXTS],\n description: \"Starting context for this child: 'fresh' or 'fork'\",\n }),\n ),\n },\n { additionalProperties: false },\n);\n\n/**\n * Tool parameters. Every `description` doubles as LLM-facing prompt copy, so\n * wording changes here change model behaviour.\n */\nexport const TaskParamsSchema = Type.Object({\n action: Type.String({ enum: [...TASK_ACTIONS] }),\n tasks: Type.Optional(\n Type.Array(TaskItemSchema, {\n minItems: 1,\n description:\n 'upsert only. An entry with an id changes that task, an entry without an id creates one. Entries apply in array order, so a later entry can depend on an earlier one by ref.',\n }),\n ),\n assignments: Type.Optional(\n Type.Array(TaskAssignmentSchema, {\n minItems: 1,\n description: 'Required for assign, one entry per task, including when there is only one.',\n }),\n ),\n id: Type.Optional(\n Type.Integer({\n description:\n 'Task id, for get, delete and cancel. Not accepted by upsert or assign: those carry ids inside tasks[] and assignments[] entries.',\n }),\n ),\n status: Type.Optional(\n Type.String({\n enum: [...TASK_STATUSES],\n description: 'list only: return just the tasks in this status. To SET a status, upsert the task by id.',\n }),\n ),\n includeDeleted: Type.Optional(\n Type.Boolean({ description: 'list only: also return deleted tombstones. Default false.' }),\n ),\n});\n\nexport type TaskItemParams = Static<typeof TaskItemSchema>;\nexport type TaskAssignmentParams = Static<typeof TaskAssignmentSchema>;\nexport type TaskParams = Static<typeof TaskParamsSchema>;\n"],"mappings":"uJAKA,MAAa,EAAe,CAAC,SAAU,OAAQ,MAAO,SAAU,QAAS,SAAU,QAAQ,EAC9E,EAAgB,CAAC,UAAW,cAAe,YAAa,SAAU,SAAS,EAC3E,EAAgB,CAAC,QAAS,MAAM,EAEhC,EAAY,OACZ,EAAa,OACb,EAAe,QAEf,EAA2B,mCAC3B,EAAe,2CAUf,EAAqB,CAChC,OAAQ,CAAC,SAAU,OAAO,EAC1B,KAAM,CAAC,SAAU,SAAU,gBA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I,EAAK,QAAQ,CAAE,YAAa,wCAAyC,CAAC,EAC1E,MAAO,EAAK,OAAO,CAAE,YAAa,gCAAiC,CAAC,EACpE,YAAa,EAAK,SAAS,CAAiB,EAC5C,aAAc,EAAK,SAAS,EAAK,OAAO,CAAE,YAAa,qDAAsD,CAAC,CAAC,EAC/G,cAAe,EAAK,SAClB,EAAK,MAAM,EAAK,OAAO,EAAG,CACxB,YAAa,wFACf,CAAC,CACH,EACA,cAAe,EAAK,SAClB,EAAK,OAAO,CAAE,YAAa,mEAAoE,CAAC,CAClG,EACA,MAAO,EAAK,SAAS,EAAK,OAAO,CAAE,YAAa,uCAAwC,CAAC,CAAC,EAC1F,QAAS,EAAK,SACZ,EAAK,OAAO,CACV,KAAM,CAAC,GAAG,CAAa,EACvB,YAAa,oDACf,CAAC,CACH,CACF,EACA,CAAE,qBAAsB,EAAM,CAChC,EAMa,EAAmB,EAAK,OAAO,CAC1C,OAAQ,EAAK,OAAO,CAAE,KAAM,CAAC,GAAG,CAAY,CAAE,CAAC,EAC/C,MAAO,EAAK,SACV,EAAK,MAAM,EAAgB,CACzB,SAAU,EACV,YACE,6KACJ,CAAC,CACH,EACA,YAAa,EAAK,SAChB,EAAK,MAAM,EAAsB,CAC/B,SAAU,EACV,YAAa,4EACf,CAAC,CACH,EACA,GAAI,EAAK,SACP,EAAK,QAAQ,CACX,YACE,kIACJ,CAAC,CACH,EACA,OAAQ,EAAK,SACX,EAAK,OAAO,CACV,KAAM,CAAC,GAAG,CAAa,EACvB,YAAa,0FACf,CAAC,CACH,EACA,eAAgB,EAAK,SACnB,EAAK,QAAQ,CAAE,YAAa,2DAA4D,CAAC,CAC3F,CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/doompi-task",
3
- "version": "0.0.1-alpha.49",
3
+ "version": "0.0.1-alpha.50",
4
4
  "description": "Persistent, dependency-aware task graphs and subagent delegation for Pi coding sessions.",
5
5
  "keywords": [
6
6
  "ai",
@@ -166,11 +166,11 @@
166
166
  "dependencies": {
167
167
  "@deepseek-ai/cordis": "4.0.1",
168
168
  "typebox": "1.3.19",
169
- "@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.48",
170
- "@agimon-ai/doompi-ui": "0.0.1-alpha.49",
171
- "@agimon-ai/doompi-telemetry": "0.0.1-alpha.48",
172
- "@agimon-ai/doompi-web-components": "0.0.1-alpha.9",
173
- "@agimon-ai/doompi-web-contracts": "0.0.1-alpha.12"
169
+ "@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.49",
170
+ "@agimon-ai/doompi-telemetry": "0.0.1-alpha.49",
171
+ "@agimon-ai/doompi-ui": "0.0.1-alpha.50",
172
+ "@agimon-ai/doompi-web-components": "0.0.1-alpha.10",
173
+ "@agimon-ai/doompi-web-contracts": "0.0.1-alpha.13"
174
174
  },
175
175
  "devDependencies": {
176
176
  "@earendil-works/pi-coding-agent": "0.84.4",