@agimon-ai/doompi-task 0.0.1-alpha.26 → 0.0.1-alpha.27
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.
- package/package.json +4 -4
- package/dist/_virtual/_rolldown/runtime.cjs +0 -1
- package/dist/adapters/node/delegationPlatform.cjs +0 -2
- package/dist/adapters/node/delegationPlatform.cjs.map +0 -1
- package/dist/adapters/node/delegationPlatform.mjs +0 -2
- package/dist/adapters/node/delegationPlatform.mjs.map +0 -1
- package/dist/adapters/pi/extension.cjs +0 -3
- package/dist/adapters/pi/extension.cjs.map +0 -1
- package/dist/adapters/pi/extension.d.cts +0 -10
- package/dist/adapters/pi/extension.d.cts.map +0 -1
- package/dist/adapters/pi/extension.d.mts +0 -10
- package/dist/adapters/pi/extension.d.mts.map +0 -1
- package/dist/adapters/pi/extension.mjs +0 -3
- package/dist/adapters/pi/extension.mjs.map +0 -1
- package/dist/adapters/store/paths.cjs +0 -2
- package/dist/adapters/store/paths.cjs.map +0 -1
- package/dist/adapters/store/paths.d.cts +0 -26
- package/dist/adapters/store/paths.d.cts.map +0 -1
- package/dist/adapters/store/paths.d.mts +0 -26
- package/dist/adapters/store/paths.d.mts.map +0 -1
- package/dist/adapters/store/paths.mjs +0 -2
- package/dist/adapters/store/paths.mjs.map +0 -1
- package/dist/adapters/store/taskStore.cjs +0 -2
- package/dist/adapters/store/taskStore.cjs.map +0 -1
- package/dist/adapters/store/taskStore.d.cts +0 -87
- package/dist/adapters/store/taskStore.d.cts.map +0 -1
- package/dist/adapters/store/taskStore.d.mts +0 -87
- package/dist/adapters/store/taskStore.d.mts.map +0 -1
- package/dist/adapters/store/taskStore.mjs +0 -2
- package/dist/adapters/store/taskStore.mjs.map +0 -1
- package/dist/adapters/telemetry/logSinkTelemetry.cjs +0 -2
- package/dist/adapters/telemetry/logSinkTelemetry.cjs.map +0 -1
- package/dist/adapters/telemetry/logSinkTelemetry.d.cts +0 -23
- package/dist/adapters/telemetry/logSinkTelemetry.d.cts.map +0 -1
- package/dist/adapters/telemetry/logSinkTelemetry.d.mts +0 -23
- package/dist/adapters/telemetry/logSinkTelemetry.d.mts.map +0 -1
- package/dist/adapters/telemetry/logSinkTelemetry.mjs +0 -2
- package/dist/adapters/telemetry/logSinkTelemetry.mjs.map +0 -1
- package/dist/commands/index.cjs +0 -2
- package/dist/commands/index.cjs.map +0 -1
- package/dist/commands/index.d.cts +0 -14
- package/dist/commands/index.d.cts.map +0 -1
- package/dist/commands/index.d.mts +0 -14
- package/dist/commands/index.d.mts.map +0 -1
- package/dist/commands/index.mjs +0 -2
- package/dist/commands/index.mjs.map +0 -1
- package/dist/commands/task/promptGuidelines.cjs +0 -2
- package/dist/commands/task/promptGuidelines.cjs.map +0 -1
- package/dist/commands/task/promptGuidelines.d.cts +0 -5
- package/dist/commands/task/promptGuidelines.d.cts.map +0 -1
- package/dist/commands/task/promptGuidelines.d.mts +0 -5
- package/dist/commands/task/promptGuidelines.d.mts.map +0 -1
- package/dist/commands/task/promptGuidelines.mjs +0 -2
- package/dist/commands/task/promptGuidelines.mjs.map +0 -1
- package/dist/commands/task/responseEnvelope.cjs +0 -7
- package/dist/commands/task/responseEnvelope.cjs.map +0 -1
- package/dist/commands/task/responseEnvelope.d.cts +0 -51
- package/dist/commands/task/responseEnvelope.d.cts.map +0 -1
- package/dist/commands/task/responseEnvelope.d.mts +0 -51
- package/dist/commands/task/responseEnvelope.d.mts.map +0 -1
- package/dist/commands/task/responseEnvelope.mjs +0 -7
- package/dist/commands/task/responseEnvelope.mjs.map +0 -1
- package/dist/commands/task/taskTool.cjs +0 -3
- package/dist/commands/task/taskTool.cjs.map +0 -1
- package/dist/commands/task/taskTool.d.cts +0 -19
- package/dist/commands/task/taskTool.d.cts.map +0 -1
- package/dist/commands/task/taskTool.d.mts +0 -19
- package/dist/commands/task/taskTool.d.mts.map +0 -1
- package/dist/commands/task/taskTool.mjs +0 -3
- package/dist/commands/task/taskTool.mjs.map +0 -1
- package/dist/commands.cjs +0 -1
- package/dist/commands.d.cts +0 -2
- package/dist/commands.d.mts +0 -2
- package/dist/commands.mjs +0 -1
- package/dist/config.cjs +0 -1
- package/dist/config.d.cts +0 -2
- package/dist/config.d.mts +0 -2
- package/dist/config.mjs +0 -1
- package/dist/delegation/manager.cjs +0 -1
- package/dist/delegation/manager.d.cts +0 -3
- package/dist/delegation/manager.d.mts +0 -3
- package/dist/delegation/manager.mjs +0 -1
- package/dist/extension.cjs +0 -1
- package/dist/extension.d.cts +0 -2
- package/dist/extension.d.mts +0 -2
- package/dist/extension.mjs +0 -1
- package/dist/extensions/pi.cjs +0 -1
- package/dist/extensions/pi.d.cts +0 -2
- package/dist/extensions/pi.d.mts +0 -2
- package/dist/extensions/pi.mjs +0 -1
- package/dist/index.cjs +0 -1
- package/dist/index.d.cts +0 -16
- package/dist/index.d.mts +0 -16
- package/dist/index.mjs +0 -1
- package/dist/logSinkTelemetry.cjs +0 -1
- package/dist/logSinkTelemetry.d.cts +0 -3
- package/dist/logSinkTelemetry.d.mts +0 -3
- package/dist/logSinkTelemetry.mjs +0 -1
- package/dist/schemas/task.cjs +0 -2
- package/dist/schemas/task.cjs.map +0 -1
- package/dist/schemas/task.d.cts +0 -103
- package/dist/schemas/task.d.cts.map +0 -1
- package/dist/schemas/task.d.mts +0 -103
- package/dist/schemas/task.d.mts.map +0 -1
- package/dist/schemas/task.mjs +0 -2
- package/dist/schemas/task.mjs.map +0 -1
- package/dist/services/delegation/manager.cjs +0 -6
- package/dist/services/delegation/manager.cjs.map +0 -1
- package/dist/services/delegation/manager.d.cts +0 -192
- package/dist/services/delegation/manager.d.cts.map +0 -1
- package/dist/services/delegation/manager.d.mts +0 -192
- package/dist/services/delegation/manager.d.mts.map +0 -1
- package/dist/services/delegation/manager.mjs +0 -6
- package/dist/services/delegation/manager.mjs.map +0 -1
- package/dist/services/narration/taskNarration.cjs +0 -2
- package/dist/services/narration/taskNarration.cjs.map +0 -1
- package/dist/services/narration/taskNarration.mjs +0 -2
- package/dist/services/narration/taskNarration.mjs.map +0 -1
- package/dist/services/store/invariants.cjs +0 -2
- package/dist/services/store/invariants.cjs.map +0 -1
- package/dist/services/store/invariants.d.cts +0 -24
- package/dist/services/store/invariants.d.cts.map +0 -1
- package/dist/services/store/invariants.d.mts +0 -24
- package/dist/services/store/invariants.d.mts.map +0 -1
- package/dist/services/store/invariants.mjs +0 -2
- package/dist/services/store/invariants.mjs.map +0 -1
- package/dist/services/store/processLiveness.cjs +0 -2
- package/dist/services/store/processLiveness.cjs.map +0 -1
- package/dist/services/store/processLiveness.d.cts +0 -12
- package/dist/services/store/processLiveness.d.cts.map +0 -1
- package/dist/services/store/processLiveness.d.mts +0 -12
- package/dist/services/store/processLiveness.d.mts.map +0 -1
- package/dist/services/store/processLiveness.mjs +0 -2
- package/dist/services/store/processLiveness.mjs.map +0 -1
- package/dist/services/store/reconcile.cjs +0 -2
- package/dist/services/store/reconcile.cjs.map +0 -1
- package/dist/services/store/reconcile.d.cts +0 -34
- package/dist/services/store/reconcile.d.cts.map +0 -1
- package/dist/services/store/reconcile.d.mts +0 -34
- package/dist/services/store/reconcile.d.mts.map +0 -1
- package/dist/services/store/reconcile.mjs +0 -2
- package/dist/services/store/reconcile.mjs.map +0 -1
- package/dist/services/store/reducer.cjs +0 -3
- package/dist/services/store/reducer.cjs.map +0 -1
- package/dist/services/store/reducer.d.cts +0 -72
- package/dist/services/store/reducer.d.cts.map +0 -1
- package/dist/services/store/reducer.d.mts +0 -72
- package/dist/services/store/reducer.d.mts.map +0 -1
- package/dist/services/store/reducer.mjs +0 -3
- package/dist/services/store/reducer.mjs.map +0 -1
- package/dist/services/store/taskGraph.cjs +0 -2
- package/dist/services/store/taskGraph.cjs.map +0 -1
- package/dist/services/store/taskGraph.d.cts +0 -25
- package/dist/services/store/taskGraph.d.cts.map +0 -1
- package/dist/services/store/taskGraph.d.mts +0 -25
- package/dist/services/store/taskGraph.d.mts.map +0 -1
- package/dist/services/store/taskGraph.mjs +0 -2
- package/dist/services/store/taskGraph.mjs.map +0 -1
- package/dist/services/store/types.cjs +0 -2
- package/dist/services/store/types.cjs.map +0 -1
- package/dist/services/store/types.d.cts +0 -177
- package/dist/services/store/types.d.cts.map +0 -1
- package/dist/services/store/types.d.mts +0 -177
- package/dist/services/store/types.d.mts.map +0 -1
- package/dist/services/store/types.mjs +0 -2
- package/dist/services/store/types.mjs.map +0 -1
- package/dist/store/invariants.cjs +0 -1
- package/dist/store/invariants.d.cts +0 -2
- package/dist/store/invariants.d.mts +0 -2
- package/dist/store/invariants.mjs +0 -1
- package/dist/store/paths.cjs +0 -1
- package/dist/store/paths.d.cts +0 -2
- package/dist/store/paths.d.mts +0 -2
- package/dist/store/paths.mjs +0 -1
- package/dist/store/processLiveness.cjs +0 -1
- package/dist/store/processLiveness.d.cts +0 -2
- package/dist/store/processLiveness.d.mts +0 -2
- package/dist/store/processLiveness.mjs +0 -1
- package/dist/store/reconcile.cjs +0 -1
- package/dist/store/reconcile.d.cts +0 -2
- package/dist/store/reconcile.d.mts +0 -2
- package/dist/store/reconcile.mjs +0 -1
- package/dist/store/reducer.cjs +0 -1
- package/dist/store/reducer.d.cts +0 -2
- package/dist/store/reducer.d.mts +0 -2
- package/dist/store/reducer.mjs +0 -1
- package/dist/store/taskGraph.cjs +0 -1
- package/dist/store/taskGraph.d.cts +0 -2
- package/dist/store/taskGraph.d.mts +0 -2
- package/dist/store/taskGraph.mjs +0 -1
- package/dist/store/taskStore.cjs +0 -1
- package/dist/store/taskStore.d.cts +0 -2
- package/dist/store/taskStore.d.mts +0 -2
- package/dist/store/taskStore.mjs +0 -1
- package/dist/store/types.cjs +0 -1
- package/dist/store/types.d.cts +0 -2
- package/dist/store/types.d.mts +0 -2
- package/dist/store/types.mjs +0 -1
- package/dist/tool/promptGuidelines.cjs +0 -1
- package/dist/tool/promptGuidelines.d.cts +0 -2
- package/dist/tool/promptGuidelines.d.mts +0 -2
- package/dist/tool/promptGuidelines.mjs +0 -1
- package/dist/tool/responseEnvelope.cjs +0 -1
- package/dist/tool/responseEnvelope.d.cts +0 -2
- package/dist/tool/responseEnvelope.d.mts +0 -2
- package/dist/tool/responseEnvelope.mjs +0 -1
- package/dist/tool/schema.cjs +0 -1
- package/dist/tool/schema.d.cts +0 -2
- package/dist/tool/schema.d.mts +0 -2
- package/dist/tool/schema.mjs +0 -1
- package/dist/tool/taskTool.cjs +0 -1
- package/dist/tool/taskTool.d.cts +0 -3
- package/dist/tool/taskTool.d.mts +0 -3
- package/dist/tool/taskTool.mjs +0 -1
- package/dist/tui/format.cjs +0 -1
- package/dist/tui/format.d.cts +0 -62
- package/dist/tui/format.d.cts.map +0 -1
- package/dist/tui/format.d.mts +0 -62
- package/dist/tui/format.d.mts.map +0 -1
- package/dist/tui/format.mjs +0 -1
- package/dist/tui/format2.cjs +0 -4
- package/dist/tui/format2.cjs.map +0 -1
- package/dist/tui/format2.d.cts +0 -2
- package/dist/tui/format2.d.mts +0 -2
- package/dist/tui/format2.mjs +0 -4
- package/dist/tui/format2.mjs.map +0 -1
- package/dist/tui/selectors.cjs +0 -1
- package/dist/tui/selectors.d.cts +0 -60
- package/dist/tui/selectors.d.cts.map +0 -1
- package/dist/tui/selectors.d.mts +0 -60
- package/dist/tui/selectors.d.mts.map +0 -1
- package/dist/tui/selectors.mjs +0 -1
- package/dist/tui/selectors2.cjs +0 -2
- package/dist/tui/selectors2.cjs.map +0 -1
- package/dist/tui/selectors2.d.cts +0 -2
- package/dist/tui/selectors2.d.mts +0 -2
- package/dist/tui/selectors2.mjs +0 -2
- package/dist/tui/selectors2.mjs.map +0 -1
- package/dist/tui/taskOverlay.cjs +0 -1
- package/dist/tui/taskOverlay.d.cts +0 -38
- package/dist/tui/taskOverlay.d.cts.map +0 -1
- package/dist/tui/taskOverlay.d.mts +0 -38
- package/dist/tui/taskOverlay.d.mts.map +0 -1
- package/dist/tui/taskOverlay.mjs +0 -1
- package/dist/tui/taskOverlay2.cjs +0 -2
- package/dist/tui/taskOverlay2.cjs.map +0 -1
- package/dist/tui/taskOverlay2.d.cts +0 -2
- package/dist/tui/taskOverlay2.d.mts +0 -2
- package/dist/tui/taskOverlay2.mjs +0 -2
- package/dist/tui/taskOverlay2.mjs.map +0 -1
- package/dist/tui/taskSpace.cjs +0 -1
- package/dist/tui/taskSpace.d.cts +0 -61
- package/dist/tui/taskSpace.d.cts.map +0 -1
- package/dist/tui/taskSpace.d.mts +0 -61
- package/dist/tui/taskSpace.d.mts.map +0 -1
- package/dist/tui/taskSpace.mjs +0 -1
- package/dist/tui/taskSpace2.cjs +0 -5
- package/dist/tui/taskSpace2.cjs.map +0 -1
- package/dist/tui/taskSpace2.d.cts +0 -2
- package/dist/tui/taskSpace2.d.mts +0 -2
- package/dist/tui/taskSpace2.mjs +0 -5
- package/dist/tui/taskSpace2.mjs.map +0 -1
- package/dist/types/config.cjs +0 -2
- package/dist/types/config.cjs.map +0 -1
- package/dist/types/config.d.cts +0 -43
- package/dist/types/config.d.cts.map +0 -1
- package/dist/types/config.d.mts +0 -43
- package/dist/types/config.d.mts.map +0 -1
- package/dist/types/config.mjs +0 -2
- package/dist/types/config.mjs.map +0 -1
- package/dist/types/delegation.cjs +0 -2
- package/dist/types/delegation.cjs.map +0 -1
- package/dist/types/delegation.d.cts +0 -6
- package/dist/types/delegation.d.cts.map +0 -1
- package/dist/types/delegation.d.mts +0 -6
- package/dist/types/delegation.d.mts.map +0 -1
- package/dist/types/delegation.mjs +0 -2
- package/dist/types/delegation.mjs.map +0 -1
- package/dist/types/telemetry.cjs +0 -2
- package/dist/types/telemetry.cjs.map +0 -1
- package/dist/types/telemetry.d.cts +0 -35
- package/dist/types/telemetry.d.cts.map +0 -1
- package/dist/types/telemetry.d.mts +0 -35
- package/dist/types/telemetry.d.mts.map +0 -1
- package/dist/types/telemetry.mjs +0 -2
- package/dist/types/telemetry.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"responseEnvelope.mjs","names":[],"sources":["../../../src/commands/task/responseEnvelope.ts"],"sourcesContent":["import type { Op } from '../../services/store/reducer.ts';\nimport { deriveBlocks, isTaskListComplete } from '../../services/store/taskGraph.ts';\nimport type {\n AssignmentSummary,\n Task,\n TaskAction,\n TaskDetails,\n TaskDocument,\n TaskMutationParams,\n UpsertItemOutcome,\n} from '../../services/store/types.ts';\n\nexport const MSG_ALL_COMPLETE_CLEAR =\n 'All tasks are completed. Review the full task list once more, then close it with task {\"action\":\"clear\"}.';\n\n/**\n * Steering for a mixed batch. Unlike a batch of spawned subagents, a failed\n * entry here had no side effect at all, so retrying the failures is the safe\n * move and the model must be told so or it will do nothing. The hazard is the\n * other half: resending an applied create would make a second task.\n */\nexport const MSG_UPSERT_PARTIAL =\n 'The applied entries are committed. Resend only the failed entries, corrected — a failed entry changed nothing, so a corrected retry is safe. Do not resend an entry that already applied: an entry without an id creates a second task.';\n\nexport const MSG_UPSERT_NONE_APPLIED = 'No task changed, so the whole call can be resent once corrected.';\n\nexport const MSG_ASSIGN_PARTIAL =\n 'Successful assignments are already running. Retry only the failed entries after correcting their task state or arguments; do not resend successful entries.';\n\nexport interface AssignmentItemResult {\n index: number;\n id: number;\n agent: string;\n ok: boolean;\n message: string;\n}\n\n/** LLM-facing report for a native assignment batch. */\nexport function formatAssignmentResults(items: readonly AssignmentItemResult[]): string {\n if (items.length === 1) return items[0].message;\n\n const succeeded = items.filter((item) => item.ok).length;\n const failed = items.length - succeeded;\n const lines = [\n `Assigned ${succeeded}/${items.length} tasks${failed > 0 ? `; ${failed} failed` : ''}.`,\n ...items.map((item) =>\n item.ok\n ? `- [${item.index}] Delegated #${item.id} to ${item.agent}`\n : `- [${item.index}] Failed #${item.id} → ${item.agent}: ${item.message}`,\n ),\n ];\n\n if (failed > 0 && succeeded > 0) lines.push('', MSG_ASSIGN_PARTIAL);\n if (failed === 0) {\n lines.push(\n '',\n 'All assignments are running independently in the background. Continue non-overlapping work, or end your turn.',\n );\n }\n return lines.join('\\n');\n}\n\n/** `[status] #id subject (activeForm) [agent] ⛓ #dep` — the `list` line format. */\nfunction formatListLine(task: Task): string {\n const block = task.blockedBy?.length ? ` ⛓ ${task.blockedBy.map((id) => `#${id}`).join(',')}` : '';\n const form = task.status === 'in_progress' && task.activeForm ? ` (${task.activeForm})` : '';\n const delegated = task.delegation && task.delegation.state !== 'cancelled' ? ` [${task.delegation.agent}]` : '';\n return `[${task.status}] #${task.id} ${task.subject}${form}${delegated}${block}`;\n}\n\nfunction formatDelegationLines(task: Task): string[] {\n const delegation = task.delegation;\n if (!delegation) return [];\n\n const lines = [` delegated to: ${delegation.agent} (${delegation.state})`];\n if (delegation.model) lines.push(` model: ${delegation.model}`);\n if (delegation.result?.error) lines.push(` error: ${delegation.result.error}`);\n if (delegation.result?.outputPath) lines.push(` output file: ${delegation.result.outputPath}`);\n if (delegation.result?.output) lines.push(` output: ${delegation.result.output}`);\n return lines;\n}\n\nfunction formatGetLines(task: Task, document: TaskDocument): string {\n const blocks = deriveBlocks(document.tasks).get(task.id) ?? [];\n const lines = [`#${task.id} [${task.status}] ${task.subject}`];\n if (task.description) lines.push(` description: ${task.description}`);\n if (task.activeForm) lines.push(` activeForm: ${task.activeForm}`);\n if (task.blockedBy?.length) lines.push(` blockedBy: ${task.blockedBy.map((id) => `#${id}`).join(', ')}`);\n if (blocks.length) lines.push(` blocks: ${blocks.map((id) => `#${id}`).join(', ')}`);\n if (task.owner) lines.push(` owner: ${task.owner}`);\n lines.push(...formatDelegationLines(task));\n return lines.join('\\n');\n}\n\n/** One entry's outcome. Batch lines prefix this with `- [n] `. */\nfunction formatUpsertItem(item: UpsertItemOutcome): string {\n switch (item.kind) {\n case 'created': {\n const ref = item.ref ? ` (ref \"${item.ref}\")` : '';\n const deps = item.blockedBy?.length ? ` — blocked by ${item.blockedBy.map((id) => `#${id}`).join(', ')}` : '';\n return `Created #${item.id}${ref}: ${item.subject} (${item.status})${deps}`;\n }\n case 'updated': {\n const transition = item.fromStatus === item.toStatus ? '' : ` (${item.fromStatus} -> ${item.toStatus})`;\n return `Updated #${item.id}${transition}`;\n }\n case 'unchanged':\n return `No change: #${item.id} already matches the requested values (status: ${item.status})`;\n case 'failed':\n return `Failed${item.id === undefined ? '' : ` #${item.id}`}: ${item.message}`;\n }\n}\n\n/**\n * The thrown message when an upsert applied nothing. Kept separate from\n * `formatContent` because the caller wraps it in the actionable Options block\n * rather than returning it as a successful result.\n */\nexport function formatUpsertFailureText(op: Extract<Op, { kind: 'upsert' }>): string {\n if (op.items.length === 1) return op.items[0].kind === 'failed' ? op.items[0].message : 'no entry was applied';\n return [\n 'no entry was applied.',\n ...op.items.map((item) => `- [${item.index}] ${formatUpsertItem(item)}`),\n MSG_UPSERT_NONE_APPLIED,\n ].join('\\n');\n}\n\n/**\n * Pure formatter: `(op, document) -> string`. The switch is closed over `Op`,\n * so a new reducer variant fails to compile until it is handled here.\n */\nexport function formatContent(op: Op, document: TaskDocument): string {\n switch (op.kind) {\n case 'upsert': {\n // A batch of one is the common case and must not read like a bulk\n // report, so it keeps the exact single-line shape it has always had.\n const lines =\n op.items.length === 1\n ? [formatUpsertItem(op.items[0])]\n : [\n `Upsert applied ${op.applied}/${op.items.length} entries${op.failed > 0 ? `; ${op.failed} failed` : ''}.`,\n ...op.items.map((item) => `- [${item.index}] ${formatUpsertItem(item)}`),\n ...(op.failed > 0 ? ['', MSG_UPSERT_PARTIAL] : []),\n ];\n // Once, last, and only when something landed: emitting it per entry\n // would repeat it for every completion in a batch.\n if (op.applied > 0 && isTaskListComplete(document.tasks)) lines.push(MSG_ALL_COMPLETE_CLEAR);\n return lines.join('\\n');\n }\n case 'delete':\n return `Deleted #${op.id}: ${op.subject}`;\n case 'clear':\n return `Closed task list (cleared ${op.count} tasks)`;\n case 'list': {\n let view = document.tasks;\n if (!op.includeDeleted) view = view.filter((task) => task.status !== 'deleted');\n if (op.statusFilter) view = view.filter((task) => task.status === op.statusFilter);\n return view.length === 0 ? 'No tasks' : view.map(formatListLine).join('\\n');\n }\n case 'get':\n return formatGetLines(op.task, document);\n case 'error':\n return `Error: ${op.message}`;\n }\n}\n\nexport interface ToolResult {\n content: Array<{ type: 'text'; text: string }>;\n details: TaskDetails;\n}\n\n/** Build the LLM-facing envelope. `details` carries the post-mutation snapshot. */\nexport function buildToolResult(\n action: TaskAction,\n params: TaskMutationParams,\n document: TaskDocument,\n op: Op,\n): ToolResult {\n return {\n content: [{ type: 'text', text: formatContent(op, document) }],\n details: {\n action,\n params: params as Record<string, unknown>,\n tasks: document.tasks,\n nextId: document.nextId,\n rev: document.rev,\n ...(op.kind === 'error' ? { error: op.message } : {}),\n // Deliberately no `error` on a partial success: renderResult treats\n // `details.error` as total failure and would hide the rows for the\n // entries that did land.\n ...(op.kind === 'upsert'\n ? {\n upsert: {\n applied: op.items.flatMap((item) => (item.kind === 'failed' ? [] : [item.id])),\n failed: op.failed,\n },\n }\n : {}),\n },\n };\n}\n\n/** Envelope for a native assignment batch, including ids used by the consolidated TUI result. */\nexport function buildAssignmentResult(\n params: TaskMutationParams,\n document: TaskDocument,\n text: string,\n assignment: AssignmentSummary,\n): ToolResult {\n return {\n content: [{ type: 'text', text }],\n details: {\n action: 'assign',\n params: params as Record<string, unknown>,\n tasks: document.tasks,\n nextId: document.nextId,\n rev: document.rev,\n assignment,\n },\n };\n}\n\n/** Envelope for delegation actions, which do not flow through the reducer. */\nexport function buildTextResult(\n action: TaskAction,\n params: TaskMutationParams,\n document: TaskDocument,\n text: string,\n error?: string,\n): ToolResult {\n return {\n content: [{ type: 'text', text: error ? `Error: ${error}` : text }],\n details: {\n action,\n params: params as Record<string, unknown>,\n tasks: document.tasks,\n nextId: document.nextId,\n rev: document.rev,\n ...(error ? { error } : {}),\n },\n };\n}\n"],"mappings":"0FAYA,MAAa,EACX,4GAQW,EACX,0OAEW,EAA0B,mEAE1B,EACX,8JAWF,SAAgB,EAAwB,EAAgD,CACtF,GAAI,EAAM,SAAW,EAAG,OAAO,EAAM,EAAE,CAAC,QAExC,IAAM,EAAY,EAAM,O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,SACxB,CACF,CAQA,SAAgB,EACd,EACA,EACA,EACA,EACY,CACZ,MAAO,CACL,QAAS,CAAC,CAAE,KAAM,OAAQ,KAAM,EAAc,EAAI,CAAQ,CAAE,CAAC,EAC7D,QAAS,CACP,SACQ,SACR,MAAO,EAAS,MAChB,OAAQ,EAAS,OACjB,IAAK,EAAS,IACd,GAAI,EAAG,OAAS,QAAU,CAAE,MAAO,EAAG,OAAQ,EAAI,CAAC,EAInD,GAAI,EAAG,OAAS,SACZ,CACE,OAAQ,CACN,QAAS,EAAG,MAAM,QAAS,GAAU,EAAK,OAAS,SAAW,CAAC,EAAI,CAAC,EAAK,EAAE,CAAE,EAC7E,OAAQ,EAAG,MACb,CACF,EACA,CAAC,CACP,CACF,CACF,CAGA,SAAgB,EACd,EACA,EACA,EACA,EACY,CACZ,MAAO,CACL,QAAS,CAAC,CAAE,KAAM,OAAQ,MAAK,CAAC,EAChC,QAAS,CACP,OAAQ,SACA,SACR,MAAO,EAAS,MAChB,OAAQ,EAAS,OACjB,IAAK,EAAS,IACd,YACF,CACF,CACF,CAGA,SAAgB,EACd,EACA,EACA,EACA,EACA,EACY,CACZ,MAAO,CACL,QAAS,CAAC,CAAE,KAAM,OAAQ,KAAM,EAAQ,UAAU,IAAU,CAAK,CAAC,EAClE,QAAS,CACP,SACQ,SACR,MAAO,EAAS,MAChB,OAAQ,EAAS,OACjB,IAAK,EAAS,IACd,GAAI,EAAQ,CAAE,OAAM,EAAI,CAAC,CAC3B,CACF,CACF"}
|
|
@@ -1,3 +0,0 @@
|
|
|
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=`Manage a shared task list to track multi-step progress, and delegate tasks to subagents`,s=`tool.action`,c=`task.id`,l=new Set([`upsert`,`list`,`get`,`delete`,`clear`]);var u=class extends Error{};function d(e,t){return new u([`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 f(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 d(t,`${t} does not accept ${r.join(`, `)}.${i}`)}function p(e){let t=e.assignments;if(!t||t.length===0)throw d(`assign`,`assign requires a non-empty assignments[] array`);return t}function m(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 h(e,t,r,i){let a=[];for(let[o,l]of t.entries()){let t;try{t=await e.assign(l.id,m(l,r))}catch(e){i?.error(n.TASK_EVENT.toolFailed,e,{[s]:`assign`,[c]:l.id}),t={ok:!1,message:e instanceof Error?e.message:String(e)}}a.push({index:o,id:l.id,agent:l.agent,...t})}return a}async function g(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 d(n,s.op.message);if(s.op.kind===`upsert`&&s.op.applied===0)throw d(n,a.formatUpsertFailureText(s.op));return a.buildToolResult(n,r,o,s.op)}function _(t,m){let{store:_,delegation:v,maxTasks:y=15}=m;t.registerTool({name:e.TOOL_NAME,label:e.TOOL_LABEL,description:`Manage a shared task list for tracking multi-step progress, and delegate tasks to subagents. Actions: upsert (write tasks — a tasks[] array where an entry with an id changes that task and an entry without an id creates one, so one call can capture a whole plan), list, get, delete (tombstone), clear (close/reset the list), assign (hand one or more tasks through assignments[] to named subagents that work in the background), 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.`,promptSnippet:o,promptGuidelines:i.DEFAULT_PROMPT_GUIDELINES,parameters:e.TaskParamsSchema,renderShell:`self`,async execute(e,t,r,i,o){let b=t.action,x=t;try{if(await m.waitUntilReady?.(o,r),f(b,x),l.has(b)){let e=await g(_,b,x,y);return m.onChange?.(),e}if(b===`assign`){let e=p(x),t=e[0],n=e.length===1&&t?`Delegating task #${t.id}...`:`Delegating ${e.length} tasks...`;i?.(a.buildTextResult(b,x,_.snapshot,n));let o=await h(v,e,r,m.report);m.onChange?.();let s=a.formatAssignmentResults(o),c=o.flatMap(e=>e.ok?[e.id]:[]);if(c.length===0)throw d(b,s);return a.buildAssignmentResult(x,_.snapshot,s,{assigned:c,failed:o.length-c.length})}i?.(a.buildTextResult(b,x,_.snapshot,`Requesting cancellation for task #${x.id??`unknown`}...`));let e=await v.cancel(x.id??NaN);if(m.onChange?.(),!e.ok)throw d(b,e.message);return a.buildTextResult(b,x,_.snapshot,e.message,void 0)}catch(e){throw m.report?.error(n.TASK_EVENT.toolFailed,e,{[s]:b,...x.id===void 0?{}:{[c]:x.id}}),e instanceof u?e:d(b,e instanceof Error?e.message:String(e))}},renderCall(e,t,n){return r.renderTaskCall(e,t,_.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=o,exports.registerTaskTool=_;
|
|
3
|
-
//# sourceMappingURL=taskTool.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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\nexport const DEFAULT_PROMPT_SNIPPET =\n 'Manage a shared task list to track multi-step progress, and delegate tasks to subagents';\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 'Manage a shared task list for tracking multi-step progress, and delegate tasks to subagents. Actions: upsert (write tasks — a tasks[] array where an entry with an id changes that task and an entry without an id creates one, so one call can capture a whole plan), list, get, delete (tombstone), clear (close/reset the list), assign (hand one or more tasks through assignments[] to named subagents that work in the background), 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 promptSnippet: DEFAULT_PROMPT_SNIPPET,\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":"kRA4Ba,EACX,0FAWI,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,GAAI,CACF,EAAU,MAAM,EAAW,OAAO,EAA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ACG,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,19 +0,0 @@
|
|
|
1
|
-
import { TaskFailureReporter } from "../../types/telemetry.cjs";
|
|
2
|
-
import { TaskStore } from "../../adapters/store/taskStore.cjs";
|
|
3
|
-
import { DelegationManager } from "../../services/delegation/manager.cjs";
|
|
4
|
-
import { DEFAULT_PROMPT_GUIDELINES } from "./promptGuidelines.cjs";
|
|
5
|
-
import { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
6
|
-
//#region src/commands/task/taskTool.d.ts
|
|
7
|
-
declare const DEFAULT_PROMPT_SNIPPET = "Manage a shared task list to track multi-step progress, and delegate tasks to subagents";
|
|
8
|
-
interface TaskToolDependencies {
|
|
9
|
-
store: TaskStore;
|
|
10
|
-
delegation: DelegationManager;
|
|
11
|
-
maxTasks?: number;
|
|
12
|
-
onChange?: () => void;
|
|
13
|
-
report?: TaskFailureReporter;
|
|
14
|
-
waitUntilReady?: (context: ExtensionContext, signal?: AbortSignal) => Promise<void>;
|
|
15
|
-
}
|
|
16
|
-
declare function registerTaskTool(pi: ExtensionAPI, dependencies: TaskToolDependencies): void;
|
|
17
|
-
//#endregion
|
|
18
|
-
export { DEFAULT_PROMPT_GUIDELINES, DEFAULT_PROMPT_SNIPPET, TaskToolDependencies, registerTaskTool };
|
|
19
|
-
//# sourceMappingURL=taskTool.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"taskTool.d.cts","names":[],"sources":["../../../src/commands/task/taskTool.ts"],"mappings":";;;;;;cA4Ba;UAGI;EACf,OAAO;EACP,YAAY;EACZ;EACA;EACA,SAAS;EACT,kBAAkB,SAAS,kBAAkB,SAAS,gBAAgB;;iBA2GxD,iBAAiB,IAAI,cAAc,cAAc"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { TaskFailureReporter } from "../../types/telemetry.mjs";
|
|
2
|
-
import { TaskStore } from "../../adapters/store/taskStore.mjs";
|
|
3
|
-
import { DelegationManager } from "../../services/delegation/manager.mjs";
|
|
4
|
-
import { DEFAULT_PROMPT_GUIDELINES } from "./promptGuidelines.mjs";
|
|
5
|
-
import { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
6
|
-
//#region src/commands/task/taskTool.d.ts
|
|
7
|
-
declare const DEFAULT_PROMPT_SNIPPET = "Manage a shared task list to track multi-step progress, and delegate tasks to subagents";
|
|
8
|
-
interface TaskToolDependencies {
|
|
9
|
-
store: TaskStore;
|
|
10
|
-
delegation: DelegationManager;
|
|
11
|
-
maxTasks?: number;
|
|
12
|
-
onChange?: () => void;
|
|
13
|
-
report?: TaskFailureReporter;
|
|
14
|
-
waitUntilReady?: (context: ExtensionContext, signal?: AbortSignal) => Promise<void>;
|
|
15
|
-
}
|
|
16
|
-
declare function registerTaskTool(pi: ExtensionAPI, dependencies: TaskToolDependencies): void;
|
|
17
|
-
//#endregion
|
|
18
|
-
export { DEFAULT_PROMPT_GUIDELINES, DEFAULT_PROMPT_SNIPPET, TaskToolDependencies, registerTaskTool };
|
|
19
|
-
//# sourceMappingURL=taskTool.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"taskTool.d.mts","names":[],"sources":["../../../src/commands/task/taskTool.ts"],"mappings":";;;;;;cA4Ba;UAGI;EACf,OAAO;EACP,YAAY;EACZ;EACA;EACA,SAAS;EACT,kBAAkB,SAAS,kBAAkB,SAAS,gBAAgB;;iBA2GxD,iBAAiB,IAAI,cAAc,cAAc"}
|
|
@@ -1,3 +0,0 @@
|
|
|
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=`Manage a shared task list to track multi-step progress, and delegate tasks to subagents`,_=`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:`Manage a shared task list for tracking multi-step progress, and delegate tasks to subagents. Actions: upsert (write tasks — a tasks[] array where an entry with an id changes that task and an entry without an id creates one, so one call can capture a whole plan), list, get, delete (tombstone), clear (close/reset the list), assign (hand one or more tasks through assignments[] to named subagents that work in the background), 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.`,promptSnippet:g,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
|
-
//# sourceMappingURL=taskTool.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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\nexport const DEFAULT_PROMPT_SNIPPET =\n 'Manage a shared task list to track multi-step progress, and delegate tasks to subagents';\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 'Manage a shared task list for tracking multi-step progress, and delegate tasks to subagents. Actions: upsert (write tasks — a tasks[] array where an entry with an id changes that task and an entry without an id creates one, so one call can capture a whole plan), list, get, delete (tombstone), clear (close/reset the list), assign (hand one or more tasks through assignments[] to named subagents that work in the background), 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 promptSnippet: DEFAULT_PROMPT_SNIPPET,\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":"unBA4BA,MAAa,EACX,0FAWI,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,CAAC,EAAuB,EAAQ,CAAG,CAAC,EACnH,GAAI,EAAM,SAAW,EAAG,OACxB,IAAM,EAAO,IAAW,SAAW,IAAI,IAA+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,G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KA,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"}
|
package/dist/commands.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./commands/index.cjs");exports.registerTasksCommand=e.registerTasksCommand;
|
package/dist/commands.d.cts
DELETED
package/dist/commands.d.mts
DELETED
package/dist/commands.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{registerTasksCommand as e}from"./commands/index.mjs";export{e as registerTasksCommand};
|
package/dist/config.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./types/config.cjs");exports.COLLAPSE_KEY_ENV=e.COLLAPSE_KEY_ENV,exports.COLLAPSE_KEY_OFF=e.COLLAPSE_KEY_OFF,exports.DEFAULT_COLLAPSE_KEY=e.DEFAULT_COLLAPSE_KEY,exports.DEFAULT_DELEGATION_TIMEOUT_MS=e.DEFAULT_DELEGATION_TIMEOUT_MS,exports.DEFAULT_MAX_TASKS=e.DEFAULT_MAX_TASKS,exports.DEFAULT_MAX_WIDGET_LINES=e.DEFAULT_MAX_WIDGET_LINES,exports.DEFAULT_STORE_TTL_MS=e.DEFAULT_STORE_TTL_MS,exports.DELEGATION_TIMEOUT_MS_ENV=e.DELEGATION_TIMEOUT_MS_ENV,exports.MAX_TASKS_ENV=e.MAX_TASKS_ENV,exports.MAX_WIDGET_LINES_ENV=e.MAX_WIDGET_LINES_ENV,exports.STORE_TTL_MS_ENV=e.STORE_TTL_MS_ENV,exports.getDelegationTimeoutMs=e.getDelegationTimeoutMs,exports.getMaxTasks=e.getMaxTasks,exports.getMaxWidgetLines=e.getMaxWidgetLines,exports.getStoreTtlMs=e.getStoreTtlMs,exports.parsePiTaskConfig=e.parsePiTaskConfig,exports.resolveCollapseKey=e.resolveCollapseKey;
|
package/dist/config.d.cts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_TASKS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, MAX_TASKS_ENV, MAX_WIDGET_LINES_ENV, PiTaskConfig, STORE_TTL_MS_ENV, getDelegationTimeoutMs, getMaxTasks, getMaxWidgetLines, getStoreTtlMs, parsePiTaskConfig, resolveCollapseKey } from "./types/config.cjs";
|
|
2
|
-
export { COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_TASKS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, MAX_TASKS_ENV, MAX_WIDGET_LINES_ENV, PiTaskConfig, STORE_TTL_MS_ENV, getDelegationTimeoutMs, getMaxTasks, getMaxWidgetLines, getStoreTtlMs, parsePiTaskConfig, resolveCollapseKey };
|
package/dist/config.d.mts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_TASKS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, MAX_TASKS_ENV, MAX_WIDGET_LINES_ENV, PiTaskConfig, STORE_TTL_MS_ENV, getDelegationTimeoutMs, getMaxTasks, getMaxWidgetLines, getStoreTtlMs, parsePiTaskConfig, resolveCollapseKey } from "./types/config.mjs";
|
|
2
|
-
export { COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_TASKS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, MAX_TASKS_ENV, MAX_WIDGET_LINES_ENV, PiTaskConfig, STORE_TTL_MS_ENV, getDelegationTimeoutMs, getMaxTasks, getMaxWidgetLines, getStoreTtlMs, parsePiTaskConfig, resolveCollapseKey };
|
package/dist/config.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{COLLAPSE_KEY_ENV as e,COLLAPSE_KEY_OFF as t,DEFAULT_COLLAPSE_KEY as n,DEFAULT_DELEGATION_TIMEOUT_MS as r,DEFAULT_MAX_TASKS as i,DEFAULT_MAX_WIDGET_LINES as a,DEFAULT_STORE_TTL_MS as o,DELEGATION_TIMEOUT_MS_ENV as s,MAX_TASKS_ENV as c,MAX_WIDGET_LINES_ENV as l,STORE_TTL_MS_ENV as u,getDelegationTimeoutMs as d,getMaxTasks as f,getMaxWidgetLines as p,getStoreTtlMs as m,parsePiTaskConfig as h,resolveCollapseKey as g}from"./types/config.mjs";export{e as COLLAPSE_KEY_ENV,t as COLLAPSE_KEY_OFF,n as DEFAULT_COLLAPSE_KEY,r as DEFAULT_DELEGATION_TIMEOUT_MS,i as DEFAULT_MAX_TASKS,a as DEFAULT_MAX_WIDGET_LINES,o as DEFAULT_STORE_TTL_MS,s as DELEGATION_TIMEOUT_MS_ENV,c as MAX_TASKS_ENV,l as MAX_WIDGET_LINES_ENV,u as STORE_TTL_MS_ENV,d as getDelegationTimeoutMs,f as getMaxTasks,p as getMaxWidgetLines,m as getStoreTtlMs,h as parsePiTaskConfig,g as resolveCollapseKey};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../types/delegation.cjs"),t=require("../services/delegation/manager.cjs");exports.BACKGROUND_WORK_PROVIDER=t.BACKGROUND_WORK_PROVIDER,exports.DelegationManager=t.DelegationManager,exports.ERR_CANCEL_UNACKNOWLEDGED=t.ERR_CANCEL_UNACKNOWLEDGED,exports.ERR_CHILD_SESSION=t.ERR_CHILD_SESSION,exports.ERR_NO_RUNTIME=t.ERR_NO_RUNTIME,exports.MAX_BRIEF_FILES=e.MAX_BRIEF_FILES,exports.NOTIFY_CUSTOM_TYPE=t.NOTIFY_CUSTOM_TYPE;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { MAX_BRIEF_FILES } from "../types/delegation.cjs";
|
|
2
|
-
import { AssignOptions, BACKGROUND_WORK_PROVIDER, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, DelegationPlatform, DelegationProgress, ERR_CANCEL_UNACKNOWLEDGED, ERR_CHILD_SESSION, ERR_NO_RUNTIME, NOTIFY_CUSTOM_TYPE } from "../services/delegation/manager.cjs";
|
|
3
|
-
export { AssignOptions, BACKGROUND_WORK_PROVIDER, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, DelegationPlatform, DelegationProgress, ERR_CANCEL_UNACKNOWLEDGED, ERR_CHILD_SESSION, ERR_NO_RUNTIME, MAX_BRIEF_FILES, NOTIFY_CUSTOM_TYPE };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { MAX_BRIEF_FILES } from "../types/delegation.mjs";
|
|
2
|
-
import { AssignOptions, BACKGROUND_WORK_PROVIDER, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, DelegationPlatform, DelegationProgress, ERR_CANCEL_UNACKNOWLEDGED, ERR_CHILD_SESSION, ERR_NO_RUNTIME, NOTIFY_CUSTOM_TYPE } from "../services/delegation/manager.mjs";
|
|
3
|
-
export { AssignOptions, BACKGROUND_WORK_PROVIDER, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, DelegationPlatform, DelegationProgress, ERR_CANCEL_UNACKNOWLEDGED, ERR_CHILD_SESSION, ERR_NO_RUNTIME, MAX_BRIEF_FILES, NOTIFY_CUSTOM_TYPE };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MAX_BRIEF_FILES as e}from"../types/delegation.mjs";import{BACKGROUND_WORK_PROVIDER as t,DelegationManager as n,ERR_CANCEL_UNACKNOWLEDGED as r,ERR_CHILD_SESSION as i,ERR_NO_RUNTIME as a,NOTIFY_CUSTOM_TYPE as o}from"../services/delegation/manager.mjs";export{t as BACKGROUND_WORK_PROVIDER,n as DelegationManager,r as ERR_CANCEL_UNACKNOWLEDGED,i as ERR_CHILD_SESSION,a as ERR_NO_RUNTIME,e as MAX_BRIEF_FILES,o as NOTIFY_CUSTOM_TYPE};
|
package/dist/extension.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./adapters/pi/extension.cjs");exports.default=e.default,exports.installTaskRuntime=e.installTaskRuntime,exports.taskExtension=e.default;
|
package/dist/extension.d.cts
DELETED
package/dist/extension.d.mts
DELETED
package/dist/extension.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e,{installTaskRuntime as t}from"./adapters/pi/extension.mjs";export{e as default,t as installTaskRuntime,e as taskExtension};
|
package/dist/extensions/pi.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("../adapters/pi/extension.cjs");module.exports=e.default;
|
package/dist/extensions/pi.d.cts
DELETED
package/dist/extensions/pi.d.mts
DELETED
package/dist/extensions/pi.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"../adapters/pi/extension.mjs";export{e as default};
|
package/dist/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./types/delegation.cjs"),t=require("./schemas/task.cjs"),n=require("./services/store/taskGraph.cjs"),r=require("./services/store/types.cjs"),i=require("./services/store/reducer.cjs"),a=require("./services/store/reconcile.cjs"),o=require("./services/delegation/manager.cjs"),s=require("./tui/selectors2.cjs"),c=require("./types/config.cjs"),l=require("./commands/task/promptGuidelines.cjs"),u=require("./commands/task/responseEnvelope.cjs"),d=require("./commands/task/taskTool.cjs"),f=require("./adapters/store/paths.cjs"),p=require("./adapters/store/taskStore.cjs"),m=require("./adapters/pi/extension.cjs");exports.BACKGROUND_WORK_PROVIDER=o.BACKGROUND_WORK_PROVIDER,exports.COLLAPSE_KEY_ENV=c.COLLAPSE_KEY_ENV,exports.COLLAPSE_KEY_OFF=c.COLLAPSE_KEY_OFF,exports.COMMAND_NAME=t.COMMAND_NAME,exports.DEFAULT_COLLAPSE_KEY=c.DEFAULT_COLLAPSE_KEY,exports.DEFAULT_DELEGATION_TIMEOUT_MS=c.DEFAULT_DELEGATION_TIMEOUT_MS,exports.DEFAULT_MAX_TASKS=c.DEFAULT_MAX_TASKS,exports.DEFAULT_MAX_WIDGET_LINES=c.DEFAULT_MAX_WIDGET_LINES,exports.DEFAULT_PROMPT_GUIDELINES=l.DEFAULT_PROMPT_GUIDELINES,exports.DEFAULT_PROMPT_SNIPPET=d.DEFAULT_PROMPT_SNIPPET,exports.DEFAULT_STORE_TTL_MS=c.DEFAULT_STORE_TTL_MS,exports.DELEGATION_TIMEOUT_MS_ENV=c.DELEGATION_TIMEOUT_MS_ENV,exports.DELETED_STATUS=r.DELETED_STATUS,exports.DelegationManager=o.DelegationManager,exports.ERR_CANCEL_UNACKNOWLEDGED=o.ERR_CANCEL_UNACKNOWLEDGED,exports.ERR_CHILD_SESSION=o.ERR_CHILD_SESSION,exports.ERR_NO_RUNTIME=o.ERR_NO_RUNTIME,exports.ERR_ORPHANED_BY_RESTART=a.ERR_ORPHANED_BY_RESTART,exports.ERR_ORPHANED_BY_SESSION=a.ERR_ORPHANED_BY_SESSION,exports.ERR_REQUIRES_INTERACTIVE=t.ERR_REQUIRES_INTERACTIVE,exports.MAX_BRIEF_FILES=e.MAX_BRIEF_FILES,exports.MAX_TASKS_ENV=c.MAX_TASKS_ENV,exports.MAX_UPSERT_ITEMS=i.MAX_UPSERT_ITEMS,exports.MAX_WIDGET_LINES_ENV=c.MAX_WIDGET_LINES_ENV,exports.MSG_ALL_COMPLETE_CLEAR=u.MSG_ALL_COMPLETE_CLEAR,exports.MSG_ASSIGN_PARTIAL=u.MSG_ASSIGN_PARTIAL,exports.MSG_NO_TASKS=t.MSG_NO_TASKS,exports.MSG_UPSERT_FIELD_MISPLACED=t.MSG_UPSERT_FIELD_MISPLACED,exports.MSG_UPSERT_NONE_APPLIED=u.MSG_UPSERT_NONE_APPLIED,exports.MSG_UPSERT_PARTIAL=u.MSG_UPSERT_PARTIAL,exports.NOTIFY_CUSTOM_TYPE=o.NOTIFY_CUSTOM_TYPE,exports.REF_PATTERN=i.REF_PATTERN,exports.STORE_PATH_ENV=f.STORE_PATH_ENV,exports.STORE_SCHEMA_VERSION=r.STORE_SCHEMA_VERSION,exports.STORE_TTL_MS_ENV=c.STORE_TTL_MS_ENV,exports.TASK_ACTIONS=t.TASK_ACTIONS,exports.TASK_ACTION_FIELDS=t.TASK_ACTION_FIELDS,exports.TASK_CONTEXTS=t.TASK_CONTEXTS,exports.TASK_STATUSES=t.TASK_STATUSES,exports.TOOL_LABEL=t.TOOL_LABEL,exports.TOOL_NAME=t.TOOL_NAME,exports.TaskAssignmentSchema=t.TaskAssignmentSchema,exports.TaskItemSchema=t.TaskItemSchema,exports.TaskParamsSchema=t.TaskParamsSchema,exports.TaskStore=p.TaskStore,exports.applyTaskMutation=i.applyTaskMutation,exports.buildAssignmentResult=u.buildAssignmentResult,exports.buildTextResult=u.buildTextResult,exports.buildToolResult=u.buildToolResult,exports.countTasks=s.countTasks,exports.deriveBlocks=n.deriveBlocks,exports.deriveTaskProjection=s.deriveTaskProjection,exports.detectCycle=n.detectCycle,exports.emptyDocument=r.emptyDocument,exports.formatAssignmentResults=u.formatAssignmentResults,exports.formatContent=u.formatContent,exports.formatUpsertFailure=i.formatUpsertFailure,exports.formatUpsertFailureText=u.formatUpsertFailureText,exports.getDelegationTimeoutMs=c.getDelegationTimeoutMs,exports.getMaxTasks=c.getMaxTasks,exports.getMaxWidgetLines=c.getMaxWidgetLines,exports.getStoreTtlMs=c.getStoreTtlMs,exports.groupTasks=s.groupTasks,exports.hasActiveWork=s.hasActiveWork,exports.hasStorePathOverride=f.hasStorePathOverride,exports.isBlocked=n.isBlocked,exports.isCommittingOp=i.isCommittingOp,exports.isDelegationActive=r.isDelegationActive,exports.isTaskListComplete=n.isTaskListComplete,exports.lockPathFor=f.lockPathFor,exports.parsePiTaskConfig=c.parsePiTaskConfig,exports.reconcileOrphanedDelegations=a.reconcileOrphanedDelegations,exports.registerTaskTool=d.registerTaskTool,exports.removeLegacyStoreDirectory=f.removeLegacyStoreDirectory,exports.removeLegacyStoreDirectoryAsync=f.removeLegacyStoreDirectoryAsync,exports.resolveCollapseKey=c.resolveCollapseKey,exports.resolveLegacyStoreDirectory=f.resolveLegacyStoreDirectory,exports.resolveLegacyStoreDirectoryAsync=f.resolveLegacyStoreDirectoryAsync,exports.resolveSessionKey=f.resolveSessionKey,exports.resolveStorePath=f.resolveStorePath,exports.selectOverlayLayout=s.selectOverlayLayout,exports.selectOverlayLayoutFromProjection=s.selectOverlayLayoutFromProjection,exports.shouldShowIds=s.shouldShowIds,exports.singleItemOutcome=i.singleItemOutcome,exports.sweepStoreFiles=f.sweepStoreFiles,exports.sweepStoreFilesAsync=f.sweepStoreFilesAsync,exports.taskActionAcceptsField=t.taskActionAcceptsField,exports.taskExtension=m.default,exports.tempPathFor=f.tempPathFor,exports.unresolvedBlockers=n.unresolvedBlockers,exports.visibleTasks=s.visibleTasks;
|
package/dist/index.d.cts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AssignmentSummary, DELETED_STATUS, DelegationResult, DelegationState, DepToken, STORE_SCHEMA_VERSION, Task, TaskAction, TaskAssignment, TaskDelegation, TaskDetails, TaskDocument, TaskItemMutation, TaskMutationParams, TaskStatus, UpsertItemOutcome, UpsertSummary, emptyDocument, isDelegationActive } from "./services/store/types.cjs";
|
|
2
|
-
import { TaskStore, TaskStoreCommitListener, TaskStoreOptions } from "./adapters/store/taskStore.cjs";
|
|
3
|
-
import { COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_TASKS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, MAX_TASKS_ENV, MAX_WIDGET_LINES_ENV, PiTaskConfig, STORE_TTL_MS_ENV, getDelegationTimeoutMs, getMaxTasks, getMaxWidgetLines, getStoreTtlMs, parsePiTaskConfig, resolveCollapseKey } from "./types/config.cjs";
|
|
4
|
-
import { MAX_BRIEF_FILES } from "./types/delegation.cjs";
|
|
5
|
-
import { AssignOptions, BACKGROUND_WORK_PROVIDER, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, DelegationPlatform, DelegationProgress, ERR_CANCEL_UNACKNOWLEDGED, ERR_CHILD_SESSION, ERR_NO_RUNTIME, NOTIFY_CUSTOM_TYPE } from "./services/delegation/manager.cjs";
|
|
6
|
-
import taskExtension from "./adapters/pi/extension.cjs";
|
|
7
|
-
import { ApplyResult, MAX_UPSERT_ITEMS, Op, REF_PATTERN, ReducerAction, applyTaskMutation, formatUpsertFailure, isCommittingOp, singleItemOutcome } from "./services/store/reducer.cjs";
|
|
8
|
-
import { AssignmentItemResult, MSG_ALL_COMPLETE_CLEAR, MSG_ASSIGN_PARTIAL, MSG_UPSERT_NONE_APPLIED, MSG_UPSERT_PARTIAL, ToolResult, buildAssignmentResult, buildTextResult, buildToolResult, formatAssignmentResults, formatContent, formatUpsertFailureText } from "./commands/task/responseEnvelope.cjs";
|
|
9
|
-
import { DEFAULT_PROMPT_GUIDELINES } from "./commands/task/promptGuidelines.cjs";
|
|
10
|
-
import { DEFAULT_PROMPT_SNIPPET, TaskToolDependencies, registerTaskTool } from "./commands/task/taskTool.cjs";
|
|
11
|
-
import { COMMAND_NAME, ERR_REQUIRES_INTERACTIVE, MSG_NO_TASKS, MSG_UPSERT_FIELD_MISPLACED, TASK_ACTIONS, TASK_ACTION_FIELDS, TASK_CONTEXTS, TASK_STATUSES, TOOL_LABEL, TOOL_NAME, TaskAssignmentParams, TaskAssignmentSchema, TaskItemParams, TaskItemSchema, TaskParams, TaskParamsSchema, taskActionAcceptsField } from "./schemas/task.cjs";
|
|
12
|
-
import { STORE_PATH_ENV, StoreSweepResult, hasStorePathOverride, lockPathFor, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, sweepStoreFiles, sweepStoreFilesAsync, tempPathFor } from "./adapters/store/paths.cjs";
|
|
13
|
-
import { ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ReconcileResult, ReconcileSelf, reconcileOrphanedDelegations } from "./services/store/reconcile.cjs";
|
|
14
|
-
import { deriveBlocks, detectCycle, isBlocked, isTaskListComplete, unresolvedBlockers } from "./services/store/taskGraph.cjs";
|
|
15
|
-
import { OverlayLayout, TaskCounts, TaskGroups, TaskProjection, countTasks, deriveTaskProjection, groupTasks, hasActiveWork, selectOverlayLayout, selectOverlayLayoutFromProjection, shouldShowIds, visibleTasks } from "./tui/selectors.cjs";
|
|
16
|
-
export { ApplyResult, AssignOptions, AssignmentItemResult, AssignmentSummary, BACKGROUND_WORK_PROVIDER, COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, COMMAND_NAME, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_TASKS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_PROMPT_GUIDELINES, DEFAULT_PROMPT_SNIPPET, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, DELETED_STATUS, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, DelegationPlatform, DelegationProgress, DelegationResult, DelegationState, DepToken, ERR_CANCEL_UNACKNOWLEDGED, ERR_CHILD_SESSION, ERR_NO_RUNTIME, ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ERR_REQUIRES_INTERACTIVE, MAX_BRIEF_FILES, MAX_TASKS_ENV, MAX_UPSERT_ITEMS, MAX_WIDGET_LINES_ENV, MSG_ALL_COMPLETE_CLEAR, MSG_ASSIGN_PARTIAL, MSG_NO_TASKS, MSG_UPSERT_FIELD_MISPLACED, MSG_UPSERT_NONE_APPLIED, MSG_UPSERT_PARTIAL, NOTIFY_CUSTOM_TYPE, Op, OverlayLayout, PiTaskConfig, REF_PATTERN, ReconcileResult, ReconcileSelf, ReducerAction, STORE_PATH_ENV, STORE_SCHEMA_VERSION, STORE_TTL_MS_ENV, StoreSweepResult, TASK_ACTIONS, TASK_ACTION_FIELDS, TASK_CONTEXTS, TASK_STATUSES, TOOL_LABEL, TOOL_NAME, Task, TaskAction, TaskAssignment, TaskAssignmentParams, TaskAssignmentSchema, TaskCounts, TaskDelegation, TaskDetails, TaskDocument, TaskGroups, TaskItemMutation, TaskItemParams, TaskItemSchema, TaskMutationParams, TaskParams, TaskParamsSchema, TaskProjection, TaskStatus, TaskStore, TaskStoreCommitListener, TaskStoreOptions, TaskToolDependencies, ToolResult, UpsertItemOutcome, UpsertSummary, applyTaskMutation, buildAssignmentResult, buildTextResult, buildToolResult, countTasks, deriveBlocks, deriveTaskProjection, detectCycle, emptyDocument, formatAssignmentResults, formatContent, formatUpsertFailure, formatUpsertFailureText, getDelegationTimeoutMs, getMaxTasks, getMaxWidgetLines, getStoreTtlMs, groupTasks, hasActiveWork, hasStorePathOverride, isBlocked, isCommittingOp, isDelegationActive, isTaskListComplete, lockPathFor, parsePiTaskConfig, reconcileOrphanedDelegations, registerTaskTool, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveCollapseKey, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, selectOverlayLayout, selectOverlayLayoutFromProjection, shouldShowIds, singleItemOutcome, sweepStoreFiles, sweepStoreFilesAsync, taskActionAcceptsField, taskExtension, tempPathFor, unresolvedBlockers, visibleTasks };
|
package/dist/index.d.mts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AssignmentSummary, DELETED_STATUS, DelegationResult, DelegationState, DepToken, STORE_SCHEMA_VERSION, Task, TaskAction, TaskAssignment, TaskDelegation, TaskDetails, TaskDocument, TaskItemMutation, TaskMutationParams, TaskStatus, UpsertItemOutcome, UpsertSummary, emptyDocument, isDelegationActive } from "./services/store/types.mjs";
|
|
2
|
-
import { TaskStore, TaskStoreCommitListener, TaskStoreOptions } from "./adapters/store/taskStore.mjs";
|
|
3
|
-
import { COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_TASKS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, MAX_TASKS_ENV, MAX_WIDGET_LINES_ENV, PiTaskConfig, STORE_TTL_MS_ENV, getDelegationTimeoutMs, getMaxTasks, getMaxWidgetLines, getStoreTtlMs, parsePiTaskConfig, resolveCollapseKey } from "./types/config.mjs";
|
|
4
|
-
import { MAX_BRIEF_FILES } from "./types/delegation.mjs";
|
|
5
|
-
import { AssignOptions, BACKGROUND_WORK_PROVIDER, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, DelegationPlatform, DelegationProgress, ERR_CANCEL_UNACKNOWLEDGED, ERR_CHILD_SESSION, ERR_NO_RUNTIME, NOTIFY_CUSTOM_TYPE } from "./services/delegation/manager.mjs";
|
|
6
|
-
import taskExtension from "./adapters/pi/extension.mjs";
|
|
7
|
-
import { ApplyResult, MAX_UPSERT_ITEMS, Op, REF_PATTERN, ReducerAction, applyTaskMutation, formatUpsertFailure, isCommittingOp, singleItemOutcome } from "./services/store/reducer.mjs";
|
|
8
|
-
import { AssignmentItemResult, MSG_ALL_COMPLETE_CLEAR, MSG_ASSIGN_PARTIAL, MSG_UPSERT_NONE_APPLIED, MSG_UPSERT_PARTIAL, ToolResult, buildAssignmentResult, buildTextResult, buildToolResult, formatAssignmentResults, formatContent, formatUpsertFailureText } from "./commands/task/responseEnvelope.mjs";
|
|
9
|
-
import { DEFAULT_PROMPT_GUIDELINES } from "./commands/task/promptGuidelines.mjs";
|
|
10
|
-
import { DEFAULT_PROMPT_SNIPPET, TaskToolDependencies, registerTaskTool } from "./commands/task/taskTool.mjs";
|
|
11
|
-
import { COMMAND_NAME, ERR_REQUIRES_INTERACTIVE, MSG_NO_TASKS, MSG_UPSERT_FIELD_MISPLACED, TASK_ACTIONS, TASK_ACTION_FIELDS, TASK_CONTEXTS, TASK_STATUSES, TOOL_LABEL, TOOL_NAME, TaskAssignmentParams, TaskAssignmentSchema, TaskItemParams, TaskItemSchema, TaskParams, TaskParamsSchema, taskActionAcceptsField } from "./schemas/task.mjs";
|
|
12
|
-
import { STORE_PATH_ENV, StoreSweepResult, hasStorePathOverride, lockPathFor, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, sweepStoreFiles, sweepStoreFilesAsync, tempPathFor } from "./adapters/store/paths.mjs";
|
|
13
|
-
import { ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ReconcileResult, ReconcileSelf, reconcileOrphanedDelegations } from "./services/store/reconcile.mjs";
|
|
14
|
-
import { deriveBlocks, detectCycle, isBlocked, isTaskListComplete, unresolvedBlockers } from "./services/store/taskGraph.mjs";
|
|
15
|
-
import { OverlayLayout, TaskCounts, TaskGroups, TaskProjection, countTasks, deriveTaskProjection, groupTasks, hasActiveWork, selectOverlayLayout, selectOverlayLayoutFromProjection, shouldShowIds, visibleTasks } from "./tui/selectors.mjs";
|
|
16
|
-
export { ApplyResult, AssignOptions, AssignmentItemResult, AssignmentSummary, BACKGROUND_WORK_PROVIDER, COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, COMMAND_NAME, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_TASKS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_PROMPT_GUIDELINES, DEFAULT_PROMPT_SNIPPET, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, DELETED_STATUS, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, DelegationPlatform, DelegationProgress, DelegationResult, DelegationState, DepToken, ERR_CANCEL_UNACKNOWLEDGED, ERR_CHILD_SESSION, ERR_NO_RUNTIME, ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ERR_REQUIRES_INTERACTIVE, MAX_BRIEF_FILES, MAX_TASKS_ENV, MAX_UPSERT_ITEMS, MAX_WIDGET_LINES_ENV, MSG_ALL_COMPLETE_CLEAR, MSG_ASSIGN_PARTIAL, MSG_NO_TASKS, MSG_UPSERT_FIELD_MISPLACED, MSG_UPSERT_NONE_APPLIED, MSG_UPSERT_PARTIAL, NOTIFY_CUSTOM_TYPE, Op, OverlayLayout, PiTaskConfig, REF_PATTERN, ReconcileResult, ReconcileSelf, ReducerAction, STORE_PATH_ENV, STORE_SCHEMA_VERSION, STORE_TTL_MS_ENV, StoreSweepResult, TASK_ACTIONS, TASK_ACTION_FIELDS, TASK_CONTEXTS, TASK_STATUSES, TOOL_LABEL, TOOL_NAME, Task, TaskAction, TaskAssignment, TaskAssignmentParams, TaskAssignmentSchema, TaskCounts, TaskDelegation, TaskDetails, TaskDocument, TaskGroups, TaskItemMutation, TaskItemParams, TaskItemSchema, TaskMutationParams, TaskParams, TaskParamsSchema, TaskProjection, TaskStatus, TaskStore, TaskStoreCommitListener, TaskStoreOptions, TaskToolDependencies, ToolResult, UpsertItemOutcome, UpsertSummary, applyTaskMutation, buildAssignmentResult, buildTextResult, buildToolResult, countTasks, deriveBlocks, deriveTaskProjection, detectCycle, emptyDocument, formatAssignmentResults, formatContent, formatUpsertFailure, formatUpsertFailureText, getDelegationTimeoutMs, getMaxTasks, getMaxWidgetLines, getStoreTtlMs, groupTasks, hasActiveWork, hasStorePathOverride, isBlocked, isCommittingOp, isDelegationActive, isTaskListComplete, lockPathFor, parsePiTaskConfig, reconcileOrphanedDelegations, registerTaskTool, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveCollapseKey, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, selectOverlayLayout, selectOverlayLayoutFromProjection, shouldShowIds, singleItemOutcome, sweepStoreFiles, sweepStoreFilesAsync, taskActionAcceptsField, taskExtension, tempPathFor, unresolvedBlockers, visibleTasks };
|
package/dist/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MAX_BRIEF_FILES as e}from"./types/delegation.mjs";import{COMMAND_NAME as t,ERR_REQUIRES_INTERACTIVE as n,MSG_NO_TASKS as r,MSG_UPSERT_FIELD_MISPLACED as i,TASK_ACTIONS as a,TASK_ACTION_FIELDS as o,TASK_CONTEXTS as s,TASK_STATUSES as c,TOOL_LABEL as l,TOOL_NAME as u,TaskAssignmentSchema as d,TaskItemSchema as f,TaskParamsSchema as p,taskActionAcceptsField as m}from"./schemas/task.mjs";import{deriveBlocks as h,detectCycle as g,isBlocked as _,isTaskListComplete as v,unresolvedBlockers as y}from"./services/store/taskGraph.mjs";import{DELETED_STATUS as b,STORE_SCHEMA_VERSION as x,emptyDocument as S,isDelegationActive as C}from"./services/store/types.mjs";import{MAX_UPSERT_ITEMS as w,REF_PATTERN as T,applyTaskMutation as E,formatUpsertFailure as D,isCommittingOp as O,singleItemOutcome as k}from"./services/store/reducer.mjs";import{ERR_ORPHANED_BY_RESTART as A,ERR_ORPHANED_BY_SESSION as j,reconcileOrphanedDelegations as M}from"./services/store/reconcile.mjs";import{BACKGROUND_WORK_PROVIDER as N,DelegationManager as P,ERR_CANCEL_UNACKNOWLEDGED as F,ERR_CHILD_SESSION as I,ERR_NO_RUNTIME as L,NOTIFY_CUSTOM_TYPE as R}from"./services/delegation/manager.mjs";import{countTasks as z,deriveTaskProjection as B,groupTasks as V,hasActiveWork as H,selectOverlayLayout as U,selectOverlayLayoutFromProjection as W,shouldShowIds as G,visibleTasks as K}from"./tui/selectors2.mjs";import{COLLAPSE_KEY_ENV as q,COLLAPSE_KEY_OFF as J,DEFAULT_COLLAPSE_KEY as Y,DEFAULT_DELEGATION_TIMEOUT_MS as X,DEFAULT_MAX_TASKS as Z,DEFAULT_MAX_WIDGET_LINES as Q,DEFAULT_STORE_TTL_MS as $,DELEGATION_TIMEOUT_MS_ENV as ee,MAX_TASKS_ENV as te,MAX_WIDGET_LINES_ENV as ne,STORE_TTL_MS_ENV as re,getDelegationTimeoutMs as ie,getMaxTasks as ae,getMaxWidgetLines as oe,getStoreTtlMs as se,parsePiTaskConfig as ce,resolveCollapseKey as le}from"./types/config.mjs";import{DEFAULT_PROMPT_GUIDELINES as ue}from"./commands/task/promptGuidelines.mjs";import{MSG_ALL_COMPLETE_CLEAR as de,MSG_ASSIGN_PARTIAL as fe,MSG_UPSERT_NONE_APPLIED as pe,MSG_UPSERT_PARTIAL as me,buildAssignmentResult as he,buildTextResult as ge,buildToolResult as _e,formatAssignmentResults as ve,formatContent as ye,formatUpsertFailureText as be}from"./commands/task/responseEnvelope.mjs";import{DEFAULT_PROMPT_SNIPPET as xe,registerTaskTool as Se}from"./commands/task/taskTool.mjs";import{STORE_PATH_ENV as Ce,hasStorePathOverride as we,lockPathFor as Te,removeLegacyStoreDirectory as Ee,removeLegacyStoreDirectoryAsync as De,resolveLegacyStoreDirectory as Oe,resolveLegacyStoreDirectoryAsync as ke,resolveSessionKey as Ae,resolveStorePath as je,sweepStoreFiles as Me,sweepStoreFilesAsync as Ne,tempPathFor as Pe}from"./adapters/store/paths.mjs";import{TaskStore as Fe}from"./adapters/store/taskStore.mjs";import Ie from"./adapters/pi/extension.mjs";export{N as BACKGROUND_WORK_PROVIDER,q as COLLAPSE_KEY_ENV,J as COLLAPSE_KEY_OFF,t as COMMAND_NAME,Y as DEFAULT_COLLAPSE_KEY,X as DEFAULT_DELEGATION_TIMEOUT_MS,Z as DEFAULT_MAX_TASKS,Q as DEFAULT_MAX_WIDGET_LINES,ue as DEFAULT_PROMPT_GUIDELINES,xe as DEFAULT_PROMPT_SNIPPET,$ as DEFAULT_STORE_TTL_MS,ee as DELEGATION_TIMEOUT_MS_ENV,b as DELETED_STATUS,P as DelegationManager,F as ERR_CANCEL_UNACKNOWLEDGED,I as ERR_CHILD_SESSION,L as ERR_NO_RUNTIME,A as ERR_ORPHANED_BY_RESTART,j as ERR_ORPHANED_BY_SESSION,n as ERR_REQUIRES_INTERACTIVE,e as MAX_BRIEF_FILES,te as MAX_TASKS_ENV,w as MAX_UPSERT_ITEMS,ne as MAX_WIDGET_LINES_ENV,de as MSG_ALL_COMPLETE_CLEAR,fe as MSG_ASSIGN_PARTIAL,r as MSG_NO_TASKS,i as MSG_UPSERT_FIELD_MISPLACED,pe as MSG_UPSERT_NONE_APPLIED,me as MSG_UPSERT_PARTIAL,R as NOTIFY_CUSTOM_TYPE,T as REF_PATTERN,Ce as STORE_PATH_ENV,x as STORE_SCHEMA_VERSION,re as STORE_TTL_MS_ENV,a as TASK_ACTIONS,o as TASK_ACTION_FIELDS,s as TASK_CONTEXTS,c as TASK_STATUSES,l as TOOL_LABEL,u as TOOL_NAME,d as TaskAssignmentSchema,f as TaskItemSchema,p as TaskParamsSchema,Fe as TaskStore,E as applyTaskMutation,he as buildAssignmentResult,ge as buildTextResult,_e as buildToolResult,z as countTasks,h as deriveBlocks,B as deriveTaskProjection,g as detectCycle,S as emptyDocument,ve as formatAssignmentResults,ye as formatContent,D as formatUpsertFailure,be as formatUpsertFailureText,ie as getDelegationTimeoutMs,ae as getMaxTasks,oe as getMaxWidgetLines,se as getStoreTtlMs,V as groupTasks,H as hasActiveWork,we as hasStorePathOverride,_ as isBlocked,O as isCommittingOp,C as isDelegationActive,v as isTaskListComplete,Te as lockPathFor,ce as parsePiTaskConfig,M as reconcileOrphanedDelegations,Se as registerTaskTool,Ee as removeLegacyStoreDirectory,De as removeLegacyStoreDirectoryAsync,le as resolveCollapseKey,Oe as resolveLegacyStoreDirectory,ke as resolveLegacyStoreDirectoryAsync,Ae as resolveSessionKey,je as resolveStorePath,U as selectOverlayLayout,W as selectOverlayLayoutFromProjection,G as shouldShowIds,k as singleItemOutcome,Me as sweepStoreFiles,Ne as sweepStoreFilesAsync,m as taskActionAcceptsField,Ie as taskExtension,Pe as tempPathFor,y as unresolvedBlockers,K as visibleTasks};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./types/telemetry.cjs"),t=require("./adapters/telemetry/logSinkTelemetry.cjs");exports.TASK_EVENT=e.TASK_EVENT,exports.createTaskErrorReporter=t.createTaskErrorReporter,exports.toFailureReporter=t.toFailureReporter;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { TASK_EVENT, TaskErrorAttributes, TaskErrorSink, TaskEventName, TaskEventSink, TaskFailureReporter } from "./types/telemetry.cjs";
|
|
2
|
-
import { TaskErrorReporter, TaskErrorReporterOptions, createTaskErrorReporter, toFailureReporter } from "./adapters/telemetry/logSinkTelemetry.cjs";
|
|
3
|
-
export { TASK_EVENT, type TaskErrorAttributes, TaskErrorReporter, TaskErrorReporterOptions, type TaskErrorSink, type TaskEventName, type TaskEventSink, type TaskFailureReporter, createTaskErrorReporter, toFailureReporter };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { TASK_EVENT, TaskErrorAttributes, TaskErrorSink, TaskEventName, TaskEventSink, TaskFailureReporter } from "./types/telemetry.mjs";
|
|
2
|
-
import { TaskErrorReporter, TaskErrorReporterOptions, createTaskErrorReporter, toFailureReporter } from "./adapters/telemetry/logSinkTelemetry.mjs";
|
|
3
|
-
export { TASK_EVENT, type TaskErrorAttributes, TaskErrorReporter, TaskErrorReporterOptions, type TaskErrorSink, type TaskEventName, type TaskEventSink, type TaskFailureReporter, createTaskErrorReporter, toFailureReporter };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{TASK_EVENT as e}from"./types/telemetry.mjs";import{createTaskErrorReporter as t,toFailureReporter as n}from"./adapters/telemetry/logSinkTelemetry.mjs";export{e as TASK_EVENT,t as createTaskErrorReporter,n as toFailureReporter};
|
package/dist/schemas/task.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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;
|
|
2
|
-
//# sourceMappingURL=task.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAAA,KAAK,OACjC,CACE,GAAIA,EAAAA,KAAK,SACPA,EAAAA,KAAK,QAAQ,CACX,YACE,wIACJ,CAAC,CACH,EACA,IAAKA,EAAAA,KAAK,SACRA,EAAAA,KAAK,OAAO,CACV,YACE,6PACJ,CAAC,CACH,EACA,QAASA,EAAAA,KAAK,SACZA,EAAAA,KAAK,OAAO,CACV,YACE,+IACJ,CAAC,CACH,EACA,YAAaA,EAAAA,KAAK,SAChBA,EAAAA,KAAK,OAAO,CACV,YAAa,iGACf,CAAC,CACH,EACA,WAAYA,EAAAA,KAAK,SACfA,EAAAA,KAAK,OAAO,CACV,YAAa,2FACf,CAAC,CACH,EACA,OAAQA,EAAAA,KAAK,SACXA,EAAAA,KAAK,OAAO,CACV,KAAM,CAAC,GAAG,CAAa,EACvB,YACE,2JACJ,CAAC,CACH,EACA,UAAWA,EAAAA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AK,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"}
|
package/dist/schemas/task.d.cts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { TaskAction } from "../services/store/types.cjs";
|
|
2
|
-
import { Static, Type } from "typebox";
|
|
3
|
-
//#region src/schemas/task.d.ts
|
|
4
|
-
declare const TASK_ACTIONS: readonly ["upsert", "list", "get", "delete", "clear", "assign", "cancel"];
|
|
5
|
-
declare const TASK_STATUSES: readonly ["pending", "in_progress", "completed", "failed", "deleted"];
|
|
6
|
-
declare const TASK_CONTEXTS: readonly ["fresh", "fork"];
|
|
7
|
-
declare const TOOL_NAME = "task";
|
|
8
|
-
declare const TOOL_LABEL = "Task";
|
|
9
|
-
declare const COMMAND_NAME = "tasks";
|
|
10
|
-
declare const ERR_REQUIRES_INTERACTIVE = "/tasks requires interactive mode";
|
|
11
|
-
declare const MSG_NO_TASKS = "No tasks yet. Ask the agent to add some!";
|
|
12
|
-
/**
|
|
13
|
-
* Which top-level fields each action accepts.
|
|
14
|
-
*
|
|
15
|
-
* The params object is flat and shared across every action, so the schema alone
|
|
16
|
-
* cannot express "upsert has no top-level id". That gap matters: a call like
|
|
17
|
-
* `{"action":"upsert","id":3,"tasks":[{"status":"completed"}]}` would otherwise
|
|
18
|
-
* silently create a duplicate task, because the entry itself carries no id.
|
|
19
|
-
*/
|
|
20
|
-
declare const TASK_ACTION_FIELDS: {
|
|
21
|
-
readonly upsert: readonly ["action", "tasks"];
|
|
22
|
-
readonly list: readonly ["action", "status", "includeDeleted"];
|
|
23
|
-
readonly get: readonly ["action", "id"];
|
|
24
|
-
readonly delete: readonly ["action", "id"];
|
|
25
|
-
readonly clear: readonly ["action"];
|
|
26
|
-
readonly assign: readonly ["action", "assignments"];
|
|
27
|
-
readonly cancel: readonly ["action", "id"];
|
|
28
|
-
};
|
|
29
|
-
declare function taskActionAcceptsField(action: TaskAction, field: string): boolean;
|
|
30
|
-
/** Correction hint appended when a per-task field lands at the top level. */
|
|
31
|
-
declare const MSG_UPSERT_FIELD_MISPLACED = "Per-task fields belong inside each tasks[] entry, not at the top level: {\"action\":\"upsert\",\"tasks\":[{\"id\":3,\"status\":\"completed\"}]}.";
|
|
32
|
-
/**
|
|
33
|
-
* One entry of an upsert. `additionalProperties: false` is load-bearing: pi
|
|
34
|
-
* validates tool arguments against this schema before `execute` runs, so a
|
|
35
|
-
* stray `{"action":"update"}` inside an entry is rejected at the boundary.
|
|
36
|
-
*/
|
|
37
|
-
declare const TaskItemSchema: Type.TObject<{
|
|
38
|
-
id: Type.TOptional<Type.TInteger>;
|
|
39
|
-
ref: Type.TOptional<Type.TString>;
|
|
40
|
-
subject: Type.TOptional<Type.TString>;
|
|
41
|
-
description: Type.TOptional<Type.TString>;
|
|
42
|
-
activeForm: Type.TOptional<Type.TString>;
|
|
43
|
-
status: Type.TOptional<Type.TString>;
|
|
44
|
-
blockedBy: Type.TOptional<Type.TArray<Type.TUnion<[Type.TInteger, Type.TString]>>>;
|
|
45
|
-
addBlockedBy: Type.TOptional<Type.TArray<Type.TUnion<[Type.TInteger, Type.TString]>>>;
|
|
46
|
-
removeBlockedBy: Type.TOptional<Type.TArray<Type.TUnion<[Type.TInteger, Type.TString]>>>;
|
|
47
|
-
owner: Type.TOptional<Type.TString>;
|
|
48
|
-
metadata: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
|
|
49
|
-
}>;
|
|
50
|
-
/** One task-to-agent handoff in a native assignment batch. */
|
|
51
|
-
declare const TaskAssignmentSchema: Type.TObject<{
|
|
52
|
-
id: Type.TInteger;
|
|
53
|
-
agent: Type.TString;
|
|
54
|
-
inlineAgent: Type.TOptional<Type.TObject<{
|
|
55
|
-
systemPrompt: Type.TString;
|
|
56
|
-
}>>;
|
|
57
|
-
instructions: Type.TOptional<Type.TString>;
|
|
58
|
-
relevantFiles: Type.TOptional<Type.TArray<Type.TString>>;
|
|
59
|
-
priorFindings: Type.TOptional<Type.TString>;
|
|
60
|
-
model: Type.TOptional<Type.TString>;
|
|
61
|
-
context: Type.TOptional<Type.TString>;
|
|
62
|
-
}>;
|
|
63
|
-
/**
|
|
64
|
-
* Tool parameters. Every `description` doubles as LLM-facing prompt copy, so
|
|
65
|
-
* wording changes here change model behaviour.
|
|
66
|
-
*/
|
|
67
|
-
declare const TaskParamsSchema: Type.TObject<{
|
|
68
|
-
action: Type.TString;
|
|
69
|
-
tasks: Type.TOptional<Type.TArray<Type.TObject<{
|
|
70
|
-
id: Type.TOptional<Type.TInteger>;
|
|
71
|
-
ref: Type.TOptional<Type.TString>;
|
|
72
|
-
subject: Type.TOptional<Type.TString>;
|
|
73
|
-
description: Type.TOptional<Type.TString>;
|
|
74
|
-
activeForm: Type.TOptional<Type.TString>;
|
|
75
|
-
status: Type.TOptional<Type.TString>;
|
|
76
|
-
blockedBy: Type.TOptional<Type.TArray<Type.TUnion<[Type.TInteger, Type.TString]>>>;
|
|
77
|
-
addBlockedBy: Type.TOptional<Type.TArray<Type.TUnion<[Type.TInteger, Type.TString]>>>;
|
|
78
|
-
removeBlockedBy: Type.TOptional<Type.TArray<Type.TUnion<[Type.TInteger, Type.TString]>>>;
|
|
79
|
-
owner: Type.TOptional<Type.TString>;
|
|
80
|
-
metadata: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
|
|
81
|
-
}>>>;
|
|
82
|
-
assignments: Type.TOptional<Type.TArray<Type.TObject<{
|
|
83
|
-
id: Type.TInteger;
|
|
84
|
-
agent: Type.TString;
|
|
85
|
-
inlineAgent: Type.TOptional<Type.TObject<{
|
|
86
|
-
systemPrompt: Type.TString;
|
|
87
|
-
}>>;
|
|
88
|
-
instructions: Type.TOptional<Type.TString>;
|
|
89
|
-
relevantFiles: Type.TOptional<Type.TArray<Type.TString>>;
|
|
90
|
-
priorFindings: Type.TOptional<Type.TString>;
|
|
91
|
-
model: Type.TOptional<Type.TString>;
|
|
92
|
-
context: Type.TOptional<Type.TString>;
|
|
93
|
-
}>>>;
|
|
94
|
-
id: Type.TOptional<Type.TInteger>;
|
|
95
|
-
status: Type.TOptional<Type.TString>;
|
|
96
|
-
includeDeleted: Type.TOptional<Type.TBoolean>;
|
|
97
|
-
}>;
|
|
98
|
-
type TaskItemParams = Static<typeof TaskItemSchema>;
|
|
99
|
-
type TaskAssignmentParams = Static<typeof TaskAssignmentSchema>;
|
|
100
|
-
type TaskParams = Static<typeof TaskParamsSchema>;
|
|
101
|
-
//#endregion
|
|
102
|
-
export { COMMAND_NAME, ERR_REQUIRES_INTERACTIVE, MSG_NO_TASKS, MSG_UPSERT_FIELD_MISPLACED, TASK_ACTIONS, TASK_ACTION_FIELDS, TASK_CONTEXTS, TASK_STATUSES, TOOL_LABEL, TOOL_NAME, TaskAssignmentParams, TaskAssignmentSchema, TaskItemParams, TaskItemSchema, TaskParams, TaskParamsSchema, taskActionAcceptsField };
|
|
103
|
-
//# sourceMappingURL=task.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|