@agimon-ai/doompi-task 0.0.1-alpha.7 → 0.0.1-alpha.71
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/README.md +114 -15
- package/dist/api-contracts.cjs +1 -0
- package/dist/api-contracts.d.cts +2 -0
- package/dist/api-contracts.d.mts +2 -0
- package/dist/api-contracts.mjs +1 -0
- package/dist/commands.cjs +1 -2
- package/dist/commands.d.cts +2 -14
- package/dist/commands.d.mts +2 -14
- package/dist/commands.mjs +1 -2
- package/dist/config.cjs +1 -2
- package/dist/config.d.cts +2 -38
- package/dist/config.d.mts +2 -38
- package/dist/config.mjs +1 -2
- package/dist/constants/promptGuidelines.cjs +2 -0
- package/dist/constants/promptGuidelines.cjs.map +1 -0
- package/dist/constants/promptGuidelines.d.cts +13 -0
- package/dist/constants/promptGuidelines.d.cts.map +1 -0
- package/dist/constants/promptGuidelines.d.mts +13 -0
- package/dist/constants/promptGuidelines.d.mts.map +1 -0
- package/dist/constants/promptGuidelines.mjs +2 -0
- package/dist/constants/promptGuidelines.mjs.map +1 -0
- package/dist/constants/task.cjs +2 -0
- package/dist/constants/task.cjs.map +1 -0
- package/dist/constants/task.d.cts +4 -0
- package/dist/constants/task.d.cts.map +1 -0
- package/dist/constants/task.d.mts +4 -0
- package/dist/constants/task.d.mts.map +1 -0
- package/dist/constants/task.mjs +2 -0
- package/dist/constants/task.mjs.map +1 -0
- package/dist/controllers/tasksCommand.cjs +2 -0
- package/dist/controllers/tasksCommand.cjs.map +1 -0
- package/dist/controllers/tasksCommand.d.cts +15 -0
- package/dist/controllers/tasksCommand.d.cts.map +1 -0
- package/dist/controllers/tasksCommand.d.mts +15 -0
- package/dist/controllers/tasksCommand.d.mts.map +1 -0
- package/dist/controllers/tasksCommand.mjs +2 -0
- package/dist/controllers/tasksCommand.mjs.map +1 -0
- package/dist/controllers/webTasksChannel.cjs +2 -0
- package/dist/controllers/webTasksChannel.cjs.map +1 -0
- package/dist/controllers/webTasksChannel.mjs +2 -0
- package/dist/controllers/webTasksChannel.mjs.map +1 -0
- package/dist/delegation-manager.cjs +1 -0
- package/dist/delegation-manager.d.cts +3 -0
- package/dist/delegation-manager.d.mts +3 -0
- package/dist/delegation-manager.mjs +1 -0
- package/dist/extensions/pi.cjs +2 -1
- package/dist/extensions/pi.cjs.map +1 -1
- package/dist/extensions/pi.d.cts +6 -2
- package/dist/extensions/pi.d.cts.map +1 -0
- package/dist/extensions/pi.d.mts +6 -2
- package/dist/extensions/pi.d.mts.map +1 -0
- package/dist/extensions/pi.mjs +2 -1
- package/dist/extensions/pi.mjs.map +1 -1
- package/dist/extensions/server.cjs +2 -0
- package/dist/extensions/server.cjs.map +1 -0
- package/dist/extensions/server.d.cts +5 -0
- package/dist/extensions/server.d.cts.map +1 -0
- package/dist/extensions/server.d.mts +5 -0
- package/dist/extensions/server.d.mts.map +1 -0
- package/dist/extensions/server.mjs +2 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +15 -14
- package/dist/index.d.mts +15 -14
- package/dist/index.mjs +1 -1
- package/dist/logSinkTelemetry.cjs +1 -2
- package/dist/logSinkTelemetry.d.cts +3 -51
- package/dist/logSinkTelemetry.d.mts +3 -51
- package/dist/logSinkTelemetry.mjs +1 -2
- package/dist/models/task.cjs +2 -0
- package/dist/models/task.cjs.map +1 -0
- package/dist/{store/types.d.cts → models/task.d.cts} +41 -30
- package/dist/models/task.d.cts.map +1 -0
- package/dist/{store/types.d.mts → models/task.d.mts} +41 -30
- package/dist/models/task.d.mts.map +1 -0
- package/dist/{store/types.mjs → models/task.mjs} +1 -1
- package/dist/models/task.mjs.map +1 -0
- package/dist/models/taskGraph.cjs +2 -0
- package/dist/models/taskGraph.cjs.map +1 -0
- package/dist/{store → models}/taskGraph.d.cts +7 -8
- package/dist/models/taskGraph.d.cts.map +1 -0
- package/dist/{store → models}/taskGraph.d.mts +7 -8
- package/dist/models/taskGraph.d.mts.map +1 -0
- package/dist/models/taskGraph.mjs.map +1 -0
- package/dist/schemas/apiContracts.cjs +2 -0
- package/dist/schemas/apiContracts.cjs.map +1 -0
- package/dist/schemas/apiContracts.d.cts +53 -0
- package/dist/schemas/apiContracts.d.cts.map +1 -0
- package/dist/schemas/apiContracts.d.mts +53 -0
- package/dist/schemas/apiContracts.d.mts.map +1 -0
- package/dist/schemas/apiContracts.mjs +2 -0
- package/dist/schemas/apiContracts.mjs.map +1 -0
- package/dist/schemas/task.cjs +2 -0
- package/dist/schemas/task.cjs.map +1 -0
- package/dist/{tool/schema.d.cts → schemas/task.d.cts} +46 -29
- package/dist/schemas/task.d.cts.map +1 -0
- package/dist/{tool/schema.d.mts → schemas/task.d.mts} +46 -29
- package/dist/schemas/task.d.mts.map +1 -0
- package/dist/schemas/task.mjs +2 -0
- package/dist/schemas/task.mjs.map +1 -0
- package/dist/services/config/index.cjs +2 -0
- package/dist/services/config/index.cjs.map +1 -0
- package/dist/services/config/index.d.cts +42 -0
- package/dist/services/config/index.d.cts.map +1 -0
- package/dist/services/config/index.d.mts +42 -0
- package/dist/services/config/index.d.mts.map +1 -0
- package/dist/services/config/index.mjs +2 -0
- package/dist/services/config/index.mjs.map +1 -0
- package/dist/services/contextContribution/index.cjs +3 -0
- package/dist/services/contextContribution/index.cjs.map +1 -0
- package/dist/services/contextContribution/index.mjs +3 -0
- package/dist/services/contextContribution/index.mjs.map +1 -0
- package/dist/services/delegation/index.cjs +6 -0
- package/dist/services/delegation/index.cjs.map +1 -0
- package/dist/{delegation/manager.d.cts → services/delegation/index.d.cts} +52 -49
- package/dist/services/delegation/index.d.cts.map +1 -0
- package/dist/{delegation/manager.d.mts → services/delegation/index.d.mts} +52 -49
- package/dist/services/delegation/index.d.mts.map +1 -0
- package/dist/services/delegation/index.mjs +6 -0
- package/dist/services/delegation/index.mjs.map +1 -0
- package/dist/services/delegationPlatform/index.cjs +2 -0
- package/dist/services/delegationPlatform/index.cjs.map +1 -0
- package/dist/services/delegationPlatform/index.mjs +2 -0
- package/dist/services/delegationPlatform/index.mjs.map +1 -0
- package/dist/services/invariants/index.cjs +2 -0
- package/dist/services/invariants/index.cjs.map +1 -0
- package/dist/services/invariants/index.d.cts +23 -0
- package/dist/services/invariants/index.d.cts.map +1 -0
- package/dist/services/invariants/index.d.mts +23 -0
- package/dist/services/invariants/index.d.mts.map +1 -0
- package/dist/services/invariants/index.mjs +2 -0
- package/dist/services/invariants/index.mjs.map +1 -0
- package/dist/services/logSinkTelemetry/index.cjs +2 -0
- package/dist/services/logSinkTelemetry/index.cjs.map +1 -0
- package/dist/services/logSinkTelemetry/index.d.cts +23 -0
- package/dist/services/logSinkTelemetry/index.d.cts.map +1 -0
- package/dist/services/logSinkTelemetry/index.d.mts +23 -0
- package/dist/services/logSinkTelemetry/index.d.mts.map +1 -0
- package/dist/services/logSinkTelemetry/index.mjs +2 -0
- package/dist/services/logSinkTelemetry/index.mjs.map +1 -0
- package/dist/services/paths/index.cjs +2 -0
- package/dist/services/paths/index.cjs.map +1 -0
- package/dist/services/paths/index.d.cts +25 -0
- package/dist/services/paths/index.d.cts.map +1 -0
- package/dist/services/paths/index.d.mts +25 -0
- package/dist/services/paths/index.d.mts.map +1 -0
- package/dist/services/paths/index.mjs +2 -0
- package/dist/services/paths/index.mjs.map +1 -0
- package/dist/services/processLiveness/index.cjs +2 -0
- package/dist/services/processLiveness/index.cjs.map +1 -0
- package/dist/{store/processLiveness.d.cts → services/processLiveness/index.d.cts} +3 -4
- package/dist/services/processLiveness/index.d.cts.map +1 -0
- package/dist/{store/processLiveness.d.mts → services/processLiveness/index.d.mts} +3 -4
- package/dist/services/processLiveness/index.d.mts.map +1 -0
- package/dist/{store/processLiveness.mjs → services/processLiveness/index.mjs} +1 -1
- package/dist/services/processLiveness/index.mjs.map +1 -0
- package/dist/services/reconcile/index.cjs +2 -0
- package/dist/services/reconcile/index.cjs.map +1 -0
- package/dist/{store/reconcile.d.cts → services/reconcile/index.d.cts} +8 -9
- package/dist/services/reconcile/index.d.cts.map +1 -0
- package/dist/{store/reconcile.d.mts → services/reconcile/index.d.mts} +8 -9
- package/dist/services/reconcile/index.d.mts.map +1 -0
- package/dist/services/reconcile/index.mjs +2 -0
- package/dist/services/reconcile/index.mjs.map +1 -0
- package/dist/services/reducer/index.cjs +3 -0
- package/dist/services/reducer/index.cjs.map +1 -0
- package/dist/{store/reducer.d.cts → services/reducer/index.d.cts} +12 -13
- package/dist/services/reducer/index.d.cts.map +1 -0
- package/dist/{store/reducer.d.mts → services/reducer/index.d.mts} +12 -13
- package/dist/services/reducer/index.d.mts.map +1 -0
- package/dist/services/reducer/index.mjs +3 -0
- package/dist/services/reducer/index.mjs.map +1 -0
- package/dist/services/taskNarration/index.cjs +2 -0
- package/dist/services/taskNarration/index.cjs.map +1 -0
- package/dist/services/taskNarration/index.mjs +2 -0
- package/dist/services/taskNarration/index.mjs.map +1 -0
- package/dist/services/taskResult/index.cjs +7 -0
- package/dist/services/taskResult/index.cjs.map +1 -0
- package/dist/services/taskResult/index.d.cts +50 -0
- package/dist/services/taskResult/index.d.cts.map +1 -0
- package/dist/services/taskResult/index.d.mts +50 -0
- package/dist/services/taskResult/index.d.mts.map +1 -0
- package/dist/services/taskResult/index.mjs +7 -0
- package/dist/services/taskResult/index.mjs.map +1 -0
- package/dist/services/taskStore/index.cjs +2 -0
- package/dist/services/taskStore/index.cjs.map +1 -0
- package/dist/{store/taskStore.d.cts → services/taskStore/index.d.cts} +17 -25
- package/dist/services/taskStore/index.d.cts.map +1 -0
- package/dist/{store/taskStore.d.mts → services/taskStore/index.d.mts} +17 -25
- package/dist/services/taskStore/index.d.mts.map +1 -0
- package/dist/services/taskStore/index.mjs +2 -0
- package/dist/services/taskStore/index.mjs.map +1 -0
- package/dist/store-invariants.cjs +1 -0
- package/dist/store-invariants.d.cts +2 -0
- package/dist/store-invariants.d.mts +2 -0
- package/dist/store-invariants.mjs +1 -0
- package/dist/store-paths.cjs +1 -0
- package/dist/store-paths.d.cts +2 -0
- package/dist/store-paths.d.mts +2 -0
- package/dist/store-paths.mjs +1 -0
- package/dist/store-process-liveness.cjs +1 -0
- package/dist/store-process-liveness.d.cts +2 -0
- package/dist/store-process-liveness.d.mts +2 -0
- package/dist/store-process-liveness.mjs +1 -0
- package/dist/store-reconcile.cjs +1 -0
- package/dist/store-reconcile.d.cts +2 -0
- package/dist/store-reconcile.d.mts +2 -0
- package/dist/store-reconcile.mjs +1 -0
- package/dist/store-reducer.cjs +1 -0
- package/dist/store-reducer.d.cts +2 -0
- package/dist/store-reducer.d.mts +2 -0
- package/dist/store-reducer.mjs +1 -0
- package/dist/store-task-graph.cjs +1 -0
- package/dist/store-task-graph.d.cts +2 -0
- package/dist/store-task-graph.d.mts +2 -0
- package/dist/store-task-graph.mjs +1 -0
- package/dist/store-task-store.cjs +1 -0
- package/dist/store-task-store.d.cts +2 -0
- package/dist/store-task-store.d.mts +2 -0
- package/dist/store-task-store.mjs +1 -0
- package/dist/store-types.cjs +1 -0
- package/dist/store-types.d.cts +2 -0
- package/dist/store-types.d.mts +2 -0
- package/dist/store-types.mjs +1 -0
- package/dist/tool-prompt-guidelines.cjs +1 -0
- package/dist/tool-prompt-guidelines.d.cts +2 -0
- package/dist/tool-prompt-guidelines.d.mts +2 -0
- package/dist/tool-prompt-guidelines.mjs +1 -0
- package/dist/tool-response-envelope.cjs +1 -0
- package/dist/tool-response-envelope.d.cts +2 -0
- package/dist/tool-response-envelope.d.mts +2 -0
- package/dist/tool-response-envelope.mjs +1 -0
- package/dist/tool-schema.cjs +1 -0
- package/dist/tool-schema.d.cts +3 -0
- package/dist/tool-schema.d.mts +3 -0
- package/dist/tool-schema.mjs +1 -0
- package/dist/tool-task-tool.cjs +1 -0
- package/dist/tool-task-tool.d.cts +3 -0
- package/dist/tool-task-tool.d.mts +3 -0
- package/dist/tool-task-tool.mjs +1 -0
- package/dist/tools/task.cjs +3 -0
- package/dist/tools/task.cjs.map +1 -0
- package/dist/tools/task.d.cts +22 -0
- package/dist/tools/task.d.cts.map +1 -0
- package/dist/tools/task.d.mts +22 -0
- package/dist/tools/task.d.mts.map +1 -0
- package/dist/tools/task.mjs +3 -0
- package/dist/tools/task.mjs.map +1 -0
- package/dist/tui/format.cjs +3 -3
- package/dist/tui/format.cjs.map +1 -1
- package/dist/tui/format.d.cts +19 -20
- package/dist/tui/format.d.cts.map +1 -1
- package/dist/tui/format.d.mts +19 -20
- package/dist/tui/format.d.mts.map +1 -1
- package/dist/tui/format.mjs +3 -3
- package/dist/tui/format.mjs.map +1 -1
- package/dist/tui/selectors.cjs +1 -1
- package/dist/tui/selectors.cjs.map +1 -1
- package/dist/tui/selectors.d.cts +20 -14
- package/dist/tui/selectors.d.cts.map +1 -1
- package/dist/tui/selectors.d.mts +20 -14
- package/dist/tui/selectors.d.mts.map +1 -1
- package/dist/tui/selectors.mjs +1 -1
- package/dist/tui/selectors.mjs.map +1 -1
- package/dist/tui/taskOverlay.cjs +1 -1
- package/dist/tui/taskOverlay.cjs.map +1 -1
- package/dist/tui/taskOverlay.d.cts +4 -5
- package/dist/tui/taskOverlay.d.cts.map +1 -1
- package/dist/tui/taskOverlay.d.mts +4 -5
- package/dist/tui/taskOverlay.d.mts.map +1 -1
- package/dist/tui/taskOverlay.mjs +1 -1
- package/dist/tui/taskOverlay.mjs.map +1 -1
- package/dist/tui/taskSpace.cjs +3 -3
- package/dist/tui/taskSpace.cjs.map +1 -1
- package/dist/tui/taskSpace.d.cts +9 -10
- package/dist/tui/taskSpace.d.cts.map +1 -1
- package/dist/tui/taskSpace.d.mts +9 -10
- package/dist/tui/taskSpace.d.mts.map +1 -1
- package/dist/tui/taskSpace.mjs +3 -3
- package/dist/tui/taskSpace.mjs.map +1 -1
- package/dist/tui-format.cjs +1 -0
- package/dist/tui-format.d.cts +2 -0
- package/dist/tui-format.d.mts +2 -0
- package/dist/tui-format.mjs +1 -0
- package/dist/tui-selectors.cjs +1 -0
- package/dist/tui-selectors.d.cts +2 -0
- package/dist/tui-selectors.d.mts +2 -0
- package/dist/tui-selectors.mjs +1 -0
- package/dist/tui-task-overlay.cjs +1 -0
- package/dist/tui-task-overlay.d.cts +2 -0
- package/dist/tui-task-overlay.d.mts +2 -0
- package/dist/tui-task-overlay.mjs +1 -0
- package/dist/tui-task-space.cjs +1 -0
- package/dist/tui-task-space.d.cts +2 -0
- package/dist/tui-task-space.d.mts +2 -0
- package/dist/tui-task-space.mjs +1 -0
- package/dist/types/delegation.cjs +2 -0
- package/dist/types/delegation.cjs.map +1 -0
- package/dist/types/delegation.d.cts +5 -0
- package/dist/types/delegation.d.cts.map +1 -0
- package/dist/types/delegation.d.mts +5 -0
- package/dist/types/delegation.d.mts.map +1 -0
- package/dist/types/delegation.mjs +2 -0
- package/dist/types/delegation.mjs.map +1 -0
- package/dist/types/telemetry.cjs +2 -0
- package/dist/types/telemetry.cjs.map +1 -0
- package/dist/types/telemetry.d.cts +35 -0
- package/dist/types/telemetry.d.cts.map +1 -0
- package/dist/types/telemetry.d.mts +35 -0
- package/dist/types/telemetry.d.mts.map +1 -0
- package/dist/types/telemetry.mjs +2 -0
- package/dist/types/telemetry.mjs.map +1 -0
- package/dist/types/webTasks.cjs +2 -0
- package/dist/types/webTasks.cjs.map +1 -0
- package/dist/types/webTasks.mjs +2 -0
- package/dist/types/webTasks.mjs.map +1 -0
- package/package.json +158 -109
- package/src/extensions/web.ts +18 -0
- package/src/types/webTasks.ts +24 -0
- package/src/web/components/TaskDetailDialog.tsx +251 -0
- package/src/web/components/TaskToolMessage.tsx +120 -0
- package/src/web/components/TasksActivitySection.tsx +200 -0
- package/src/web/lib/taskToolFormat.ts +330 -0
- package/src/web/stores/tasksStore.ts +114 -0
- package/src/web/tsconfig.json +23 -0
- package/dist/commands.cjs.map +0 -1
- package/dist/commands.d.cts.map +0 -1
- package/dist/commands.d.mts.map +0 -1
- package/dist/commands.mjs.map +0 -1
- package/dist/config.cjs.map +0 -1
- package/dist/config.d.cts.map +0 -1
- package/dist/config.d.mts.map +0 -1
- package/dist/config.mjs.map +0 -1
- package/dist/delegation/manager.cjs +0 -6
- package/dist/delegation/manager.cjs.map +0 -1
- package/dist/delegation/manager.d.cts.map +0 -1
- package/dist/delegation/manager.d.mts.map +0 -1
- package/dist/delegation/manager.mjs +0 -6
- package/dist/delegation/manager.mjs.map +0 -1
- package/dist/extension.cjs +0 -3
- package/dist/extension.cjs.map +0 -1
- package/dist/extension.d.cts +0 -12
- package/dist/extension.d.cts.map +0 -1
- package/dist/extension.d.mts +0 -12
- package/dist/extension.d.mts.map +0 -1
- package/dist/extension.mjs +0 -3
- package/dist/extension.mjs.map +0 -1
- package/dist/extensions/doom.cjs +0 -2
- package/dist/extensions/doom.cjs.map +0 -1
- package/dist/extensions/doom.d.cts +0 -6
- package/dist/extensions/doom.d.cts.map +0 -1
- package/dist/extensions/doom.d.mts +0 -7
- package/dist/extensions/doom.d.mts.map +0 -1
- package/dist/extensions/doom.mjs +0 -2
- package/dist/extensions/doom.mjs.map +0 -1
- package/dist/logSinkTelemetry.cjs.map +0 -1
- package/dist/logSinkTelemetry.d.cts.map +0 -1
- package/dist/logSinkTelemetry.d.mts.map +0 -1
- package/dist/logSinkTelemetry.mjs.map +0 -1
- package/dist/store/invariants.cjs +0 -2
- package/dist/store/invariants.cjs.map +0 -1
- package/dist/store/invariants.d.cts +0 -14
- package/dist/store/invariants.d.cts.map +0 -1
- package/dist/store/invariants.d.mts +0 -14
- package/dist/store/invariants.d.mts.map +0 -1
- package/dist/store/invariants.mjs +0 -2
- package/dist/store/invariants.mjs.map +0 -1
- package/dist/store/paths.cjs +0 -2
- package/dist/store/paths.cjs.map +0 -1
- package/dist/store/paths.d.cts +0 -23
- package/dist/store/paths.d.cts.map +0 -1
- package/dist/store/paths.d.mts +0 -23
- package/dist/store/paths.d.mts.map +0 -1
- package/dist/store/paths.mjs +0 -2
- package/dist/store/paths.mjs.map +0 -1
- package/dist/store/processLiveness.cjs +0 -2
- package/dist/store/processLiveness.cjs.map +0 -1
- package/dist/store/processLiveness.d.cts.map +0 -1
- package/dist/store/processLiveness.d.mts.map +0 -1
- package/dist/store/processLiveness.mjs.map +0 -1
- package/dist/store/reconcile.cjs +0 -2
- package/dist/store/reconcile.cjs.map +0 -1
- package/dist/store/reconcile.d.cts.map +0 -1
- package/dist/store/reconcile.d.mts.map +0 -1
- package/dist/store/reconcile.mjs +0 -2
- package/dist/store/reconcile.mjs.map +0 -1
- package/dist/store/reducer.cjs +0 -3
- package/dist/store/reducer.cjs.map +0 -1
- package/dist/store/reducer.d.cts.map +0 -1
- package/dist/store/reducer.d.mts.map +0 -1
- package/dist/store/reducer.mjs +0 -3
- package/dist/store/reducer.mjs.map +0 -1
- package/dist/store/taskGraph.cjs +0 -2
- package/dist/store/taskGraph.cjs.map +0 -1
- package/dist/store/taskGraph.d.cts.map +0 -1
- package/dist/store/taskGraph.d.mts.map +0 -1
- package/dist/store/taskGraph.mjs.map +0 -1
- package/dist/store/taskStore.cjs +0 -2
- package/dist/store/taskStore.cjs.map +0 -1
- package/dist/store/taskStore.d.cts.map +0 -1
- package/dist/store/taskStore.d.mts.map +0 -1
- package/dist/store/taskStore.mjs +0 -2
- package/dist/store/taskStore.mjs.map +0 -1
- package/dist/store/types.cjs +0 -2
- package/dist/store/types.cjs.map +0 -1
- package/dist/store/types.d.cts.map +0 -1
- package/dist/store/types.d.mts.map +0 -1
- package/dist/store/types.mjs.map +0 -1
- package/dist/tool/promptGuidelines.cjs +0 -2
- package/dist/tool/promptGuidelines.cjs.map +0 -1
- package/dist/tool/promptGuidelines.d.cts +0 -5
- package/dist/tool/promptGuidelines.d.cts.map +0 -1
- package/dist/tool/promptGuidelines.d.mts +0 -5
- package/dist/tool/promptGuidelines.d.mts.map +0 -1
- package/dist/tool/promptGuidelines.mjs +0 -2
- package/dist/tool/promptGuidelines.mjs.map +0 -1
- package/dist/tool/responseEnvelope.cjs +0 -6
- package/dist/tool/responseEnvelope.cjs.map +0 -1
- package/dist/tool/responseEnvelope.d.cts +0 -39
- package/dist/tool/responseEnvelope.d.cts.map +0 -1
- package/dist/tool/responseEnvelope.d.mts +0 -39
- package/dist/tool/responseEnvelope.d.mts.map +0 -1
- package/dist/tool/responseEnvelope.mjs +0 -6
- package/dist/tool/responseEnvelope.mjs.map +0 -1
- package/dist/tool/schema.cjs +0 -2
- package/dist/tool/schema.cjs.map +0 -1
- package/dist/tool/schema.d.cts.map +0 -1
- package/dist/tool/schema.d.mts.map +0 -1
- package/dist/tool/schema.mjs +0 -2
- package/dist/tool/schema.mjs.map +0 -1
- package/dist/tool/taskTool.cjs +0 -3
- package/dist/tool/taskTool.cjs.map +0 -1
- package/dist/tool/taskTool.d.cts +0 -17
- package/dist/tool/taskTool.d.cts.map +0 -1
- package/dist/tool/taskTool.d.mts +0 -17
- package/dist/tool/taskTool.d.mts.map +0 -1
- package/dist/tool/taskTool.mjs +0 -3
- package/dist/tool/taskTool.mjs.map +0 -1
- /package/dist/{store → models}/taskGraph.mjs +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/services/taskResult/index.ts"],"sourcesContent":["import type {\n AssignmentSummary,\n Task,\n TaskAction,\n TaskDetails,\n TaskDocument,\n TaskMutationParams,\n UpsertItemOutcome,\n} from '../../models/task';\nimport { deriveBlocks, isTaskListComplete } from '../../models/taskGraph';\nimport type { Op } from '../reducer';\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":"kFAYA,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,OAAQ,GAAS,EAAK,EAAE,CAAC,CAAC,OAC5C,EAAS,EAAM,OAAS,EACxB,EAAQ,CACZ,YAAY,EAAU,GAAG,EAAM,OAAO,QAAQ,EAAS,EAAI,KAAK,EAAO,SAAW,GAAG,GACrF,GAAG,EAAM,IAAK,GACZ,EAAK,GACD,MAAM,EAAK,MAAM,eAAe,EAAK,GAAG,MAAM,EAAK,QACnD,MAAM,EAAK,MAAM,YAAY,EAAK,GAAG,KAAK,EAAK,MAAM,IAAI,EAAK,SACpE,CACF,EASA,OAPI,EAAS,GAAK,EAAY,GAAG,EAAM,KAAK,GAAI,CAAkB,EAC9D,IAAW,GACb,EAAM,KACJ,GACA,+GACF,EAEK,EAAM,KAAK;CAAI,CACxB,CAGA,SAAS,EAAe,EAAoB,CAC1C,IAAM,EAAQ,EAAK,WAAW,OAAS,MAAM,EAAK,UAAU,IAAK,GAAO,IAAI,GAAI,CAAC,CAAC,KAAK,GAAG,IAAM,GAC1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AAO,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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../processLiveness/index.cjs"),n=require("../../types/telemetry.cjs"),r=require("../../models/task.cjs"),i=require("../invariants/index.cjs"),a=require("../paths/index.cjs");let o=require("node:fs");o=e.__toESM(o,1);let s=require("node:path");s=e.__toESM(s,1);const c=`utf8`,l=`ENOENT`,u=`store.path`;function d(e){return new Promise(t=>setTimeout(t,e))}function f(e){if(!e||typeof e!=`object`)return r.emptyDocument();let t=e;if(!Array.isArray(t.tasks))return r.emptyDocument();let n=i.canonicalizeTasks(t.tasks.filter(e=>!!e&&typeof e==`object`&&typeof e.id==`number`)),a=n.reduce((e,t)=>Math.max(e,t.id),0);return{version:typeof t.version==`number`?t.version:1,rev:typeof t.rev==`number`?t.rev:0,nextId:typeof t.nextId==`number`&&t.nextId>a?t.nextId:a+1,tasks:n}}var p=class{storePath;cwd;env;cached=r.emptyDocument();listeners=new Set;lockTimeoutMs;report;onCommitted;constructor(e={}){this.cwd=e.cwd??process.cwd(),this.env=e.env??process.env,this.storePath=e.storePath??a.resolveStorePath(this.cwd,this.env),this.lockTimeoutMs=e.lockTimeoutMs??2e3,this.report=e.report,this.onCommitted=e.onCommitted}configureSession(e){this.env.DOOM_TASK_STORE?.trim()||(this.storePath=a.resolveStorePath(this.cwd,this.env,e),this.cached=r.emptyDocument())}get snapshot(){return this.cached}read(){try{let e=o.default.readFileSync(this.storePath,c);this.cached=f(JSON.parse(e))}catch(e){e.code!==l&&this.report?.error(n.TASK_EVENT.storeReadFailed,e,{[u]:this.storePath}),this.cached=r.emptyDocument()}return this.cached}async readAsync(e=()=>!0){let t=this.storePath,n=await this.readDocumentAsync(t);return e()&&(this.cached=n),n}async readDocumentAsync(e=this.storePath){try{let t=await o.default.promises.readFile(e,c);return f(JSON.parse(t))}catch(t){return t.code!==l&&this.report?.error(n.TASK_EVENT.storeReadFailed,t,{[u]:e}),r.emptyDocument()}}async mutate(e){let t=await this.acquireLock(),n=(()=>{try{let t=this.read(),n=e(t);if(!n.document)return{result:{document:t,value:n.value}};let r=this.write(n.document);return{result:{document:r,value:n.value},notification:{previous:t,committed:r}}}finally{t()}})();return n.notification&&this.notifyCommitted(n.notification.previous,n.notification.committed),n.result}notifyCommitted(e,t){try{this.onCommitted?.(e,t)}catch(e){this.report?.error(n.TASK_EVENT.storeCommitListenerFailed,e,{[u]:this.storePath})}for(let e of this.listeners)try{e(t)}catch(e){this.report?.error(n.TASK_EVENT.storeListenerFailed,e,{[u]:this.storePath})}}write(e){let t={...e,version:1,rev:e.rev+1};o.default.mkdirSync(s.default.dirname(this.storePath),{recursive:!0});let n=a.tempPathFor(this.storePath);return o.default.writeFileSync(n,`${JSON.stringify(t,void 0,2)}\n`,c),o.default.renameSync(n,this.storePath),this.cached=t,t}async acquireLock(){let e=a.lockPathFor(this.storePath);o.default.mkdirSync(s.default.dirname(this.storePath),{recursive:!0});let t=Date.now()+this.lockTimeoutMs;for(;;)try{let t=o.default.openSync(e,`wx`);return o.default.writeSync(t,JSON.stringify({pid:process.pid,time:Date.now()})),o.default.closeSync(t),()=>o.default.rmSync(e,{force:!0})}catch(r){if(r.code!==`EEXIST`)throw r;if(Date.now()>=t)return this.report?.warn(n.TASK_EVENT.storeLockTimeout,Error(`Task store lock still held after ${this.lockTimeoutMs}ms; proceeding without it`),{[u]:this.storePath}),()=>{};this.breakStaleLock(e),await d(10+Math.random()*60)}}breakStaleLock(e){try{let n=JSON.parse(o.default.readFileSync(e,c)),r=typeof n.time==`number`&&Date.now()-n.time>1e4,i=typeof n.pid==`number`&&!t.isProcessAlive(n.pid);return!r&&!i?!1:(o.default.unlinkSync(e),!0)}catch(t){return t.code!==l&&this.report?.warn(n.TASK_EVENT.storeLockBreakFailed,t,{[u]:e}),!1}}onExternalChange(e){return this.listeners.add(e),()=>this.listeners.delete(e)}dispose(){this.listeners.clear()}};exports.TaskStore=p;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["emptyDocument","canonicalizeTasks","resolveStorePath","fs","TASK_EVENT","path","tempPathFor","lockPathFor","isProcessAlive"],"sources":["../../../src/services/taskStore/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { emptyDocument, STORE_SCHEMA_VERSION, type Task, type TaskDocument } from '../../models/task';\nimport { TASK_EVENT, type TaskFailureReporter } from '../../types/telemetry';\nimport { canonicalizeTasks } from '../invariants';\nimport { lockPathFor, resolveStorePath, STORE_PATH_ENV, tempPathFor } from '../paths';\nimport { isProcessAlive } from '../processLiveness';\n\nconst LOCK_TIMEOUT_MS = 2000;\nconst LOCK_STALE_MS = 10_000;\nconst LOCK_RETRY_BASE_MS = 10;\nconst LOCK_RETRY_MAX_MS = 60;\nconst UTF8_ENCODING = 'utf8';\nconst MISSING_FILE_CODE = 'ENOENT';\nconst LOCK_EXISTS_CODE = 'EEXIST';\nconst STORE_PATH_ATTRIBUTE = 'store.path';\n\nexport type TaskStoreCommitListener = (previous: TaskDocument, committed: TaskDocument) => void;\n\nexport interface TaskStoreOptions {\n cwd?: string;\n env?: Readonly<Record<string, string | undefined>>;\n storePath?: string;\n onCommitted?: TaskStoreCommitListener;\n /** How long to wait for the advisory lock before proceeding lock-free. */\n lockTimeoutMs?: number;\n /** Where swallowed failures go, so silent degradation stays visible. */\n report?: TaskFailureReporter;\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Coerce arbitrary parsed JSON into a valid document.\n *\n * A corrupt or truncated store must not take the session down: the worst\n * acceptable outcome is starting from an empty list, never a crash on startup.\n */\nfunction normalizeDocument(parsed: unknown): TaskDocument {\n if (!parsed || typeof parsed !== 'object') return emptyDocument();\n const candidate = parsed as Partial<TaskDocument>;\n if (!Array.isArray(candidate.tasks)) return emptyDocument();\n\n const tasks = canonicalizeTasks(\n candidate.tasks.filter(\n (task): task is Task => Boolean(task) && typeof task === 'object' && typeof (task as Task).id === 'number',\n ),\n );\n const maxId = tasks.reduce((max, task) => Math.max(max, task.id), 0);\n return {\n version: typeof candidate.version === 'number' ? candidate.version : STORE_SCHEMA_VERSION,\n rev: typeof candidate.rev === 'number' ? candidate.rev : 0,\n nextId: typeof candidate.nextId === 'number' && candidate.nextId > maxId ? candidate.nextId : maxId + 1,\n tasks,\n };\n}\n\n/**\n * File-backed task store shared by one root session and its delegated children.\n *\n * Durability model: the JSON file is the source of truth. Mutations are\n * read-modify-write under an advisory lock so concurrent delegated processes\n * cannot clobber each other, and writes land via temp-file rename so a\n * crash mid-write can never leave a partial document behind.\n */\nexport class TaskStore {\n storePath: string;\n\n private readonly cwd: string;\n private readonly env: Readonly<Record<string, string | undefined>>;\n private cached: TaskDocument = emptyDocument();\n private readonly listeners = new Set<(document: TaskDocument) => void>();\n private readonly lockTimeoutMs: number;\n private readonly report?: TaskFailureReporter;\n private readonly onCommitted?: TaskStoreCommitListener;\n\n constructor(options: TaskStoreOptions = {}) {\n this.cwd = options.cwd ?? process.cwd();\n this.env = options.env ?? process.env;\n this.storePath = options.storePath ?? resolveStorePath(this.cwd, this.env);\n this.lockTimeoutMs = options.lockTimeoutMs ?? LOCK_TIMEOUT_MS;\n this.report = options.report;\n this.onCommitted = options.onCommitted;\n }\n\n /** Bind a default store to the current session tree before reading it. */\n configureSession(sessionKey: string): void {\n if (this.env[STORE_PATH_ENV]?.trim()) return;\n this.storePath = resolveStorePath(this.cwd, this.env, sessionKey);\n this.cached = emptyDocument();\n }\n\n /** Last document read from disk, without hitting the filesystem. */\n get snapshot(): TaskDocument {\n return this.cached;\n }\n\n read(): TaskDocument {\n try {\n const raw = fs.readFileSync(this.storePath, UTF8_ENCODING);\n this.cached = normalizeDocument(JSON.parse(raw));\n } catch (error) {\n // A missing file is the normal state before the first write. Anything\n // else means the task list just silently became empty, which is worth a\n // record: unreadable or corrupt JSON looks identical to \"no tasks yet\".\n if ((error as NodeJS.ErrnoException).code !== MISSING_FILE_CODE) {\n this.report?.error(TASK_EVENT.storeReadFailed, error, { [STORE_PATH_ATTRIBUTE]: this.storePath });\n }\n this.cached = emptyDocument();\n }\n return this.cached;\n }\n\n async readAsync(shouldApply: () => boolean = () => true): Promise<TaskDocument> {\n const storePath = this.storePath;\n const document = await this.readDocumentAsync(storePath);\n if (!shouldApply()) return document;\n this.cached = document;\n return document;\n }\n\n private async readDocumentAsync(storePath: string = this.storePath): Promise<TaskDocument> {\n try {\n const raw = await fs.promises.readFile(storePath, UTF8_ENCODING);\n return normalizeDocument(JSON.parse(raw));\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== MISSING_FILE_CODE) {\n this.report?.error(TASK_EVENT.storeReadFailed, error, { [STORE_PATH_ATTRIBUTE]: storePath });\n }\n return emptyDocument();\n }\n }\n\n /**\n * Apply a mutation under the store lock.\n *\n * `mutate` receives the freshest on-disk document and returns either the next\n * document to commit or `undefined` for a read-only action (list/get), which\n * skips the write entirely so queries never bump `rev`.\n */\n async mutate<T>(\n mutate: (document: TaskDocument) => { document?: TaskDocument; value: T },\n ): Promise<{ document: TaskDocument; value: T }> {\n const release = await this.acquireLock();\n const outcome = (() => {\n try {\n const current = this.read();\n const mutation = mutate(current);\n if (!mutation.document) {\n return { result: { document: current, value: mutation.value } };\n }\n const committed = this.write(mutation.document);\n return {\n result: { document: committed, value: mutation.value },\n notification: { previous: current, committed },\n };\n } finally {\n release();\n }\n })();\n if (outcome.notification) {\n this.notifyCommitted(outcome.notification.previous, outcome.notification.committed);\n }\n return outcome.result;\n }\n\n private notifyCommitted(previous: TaskDocument, committed: TaskDocument): void {\n try {\n this.onCommitted?.(previous, committed);\n } catch (error) {\n this.report?.error(TASK_EVENT.storeCommitListenerFailed, error, { [STORE_PATH_ATTRIBUTE]: this.storePath });\n }\n for (const listener of this.listeners) {\n try {\n listener(committed);\n } catch (error) {\n this.report?.error(TASK_EVENT.storeListenerFailed, error, { [STORE_PATH_ATTRIBUTE]: this.storePath });\n }\n }\n }\n\n private write(document: TaskDocument): TaskDocument {\n const next: TaskDocument = { ...document, version: STORE_SCHEMA_VERSION, rev: document.rev + 1 };\n fs.mkdirSync(path.dirname(this.storePath), { recursive: true });\n const temp = tempPathFor(this.storePath);\n fs.writeFileSync(temp, `${JSON.stringify(next, undefined, 2)}\\n`, UTF8_ENCODING);\n fs.renameSync(temp, this.storePath);\n this.cached = next;\n return next;\n }\n\n private async acquireLock(): Promise<() => void> {\n const lockPath = lockPathFor(this.storePath);\n fs.mkdirSync(path.dirname(this.storePath), { recursive: true });\n const deadline = Date.now() + this.lockTimeoutMs;\n\n for (;;) {\n try {\n const handle = fs.openSync(lockPath, 'wx');\n fs.writeSync(handle, JSON.stringify({ pid: process.pid, time: Date.now() }));\n fs.closeSync(handle);\n return () => fs.rmSync(lockPath, { force: true });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== LOCK_EXISTS_CODE) throw error;\n // The deadline is checked before breaking a stale lock so a peer that\n // keeps recreating one cannot spin this loop without bound.\n if (Date.now() >= deadline) {\n // Proceeding lock-free beats stalling the agent: the rename is atomic,\n // so the worst case is a lost concurrent update, not a corrupt file.\n // Reported because a lost update here can strand a delegation.\n this.report?.warn(\n TASK_EVENT.storeLockTimeout,\n new Error(`Task store lock still held after ${this.lockTimeoutMs}ms; proceeding without it`),\n { [STORE_PATH_ATTRIBUTE]: this.storePath },\n );\n return () => {};\n }\n // Clearing a dead holder's lock still goes through the backoff. Yielding\n // on every iteration is what stops a peer that keeps recreating the\n // lock from turning this into a spin.\n this.breakStaleLock(lockPath);\n await sleep(LOCK_RETRY_BASE_MS + Math.random() * LOCK_RETRY_MAX_MS);\n }\n }\n }\n\n /** Remove a lock left behind by a dead process or one held implausibly long. */\n private breakStaleLock(lockPath: string): boolean {\n try {\n const holder = JSON.parse(fs.readFileSync(lockPath, UTF8_ENCODING)) as { pid?: number; time?: number };\n const expired = typeof holder.time === 'number' && Date.now() - holder.time > LOCK_STALE_MS;\n const dead = typeof holder.pid === 'number' && !isProcessAlive(holder.pid);\n if (!expired && !dead) return false;\n fs.unlinkSync(lockPath);\n return true;\n } catch (error) {\n // Losing the race to another breaker is normal; a persistent failure here\n // shows up as the lock timeout above, so this stays a warning.\n if ((error as NodeJS.ErrnoException).code !== MISSING_FILE_CODE) {\n this.report?.warn(TASK_EVENT.storeLockBreakFailed, error, { [STORE_PATH_ATTRIBUTE]: lockPath });\n }\n return false;\n }\n }\n\n /**\n * Listen for commits made through this store instance.\n *\n * Live cross-process updates use the owning session's direct event bus. This\n * listener remains for local terminal views and never watches the filesystem.\n */\n onExternalChange(listener: (document: TaskDocument) => void): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n dispose(): void {\n this.listeners.clear();\n }\n}\n"],"mappings":"uUASA,MAIM,EAAgB,OAChB,EAAoB,SAEpB,EAAuB,aAe7B,SAAS,EAAM,EAA2B,CACxC,OAAO,IAAI,QAAS,GAAY,WAAW,EAAS,CAAE,CAAC,CACzD,CAQA,SAAS,EAAkB,EAA+B,CACxD,GAAI,CAAC,GAAU,OAAO,GAAW,SAAU,OAAOA,EAAAA,cAAc,EAChE,IAAM,EAAY,EAClB,GAAI,CAAC,MAAM,QAAQ,EAAU,KAAK,EAAG,OAAOA,EAAAA,cAAc,EAE1D,IAAM,EAAQC,EAAAA,kBACZ,EAAU,MAAM,OACb,GAAuB,EAAQ,GAAS,OAAO,GAAS,UAAY,OAA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AI,EAAiB,CACpE,CAEJ,CAGA,eAAuB,EAA2B,CAChD,GAAI,CACF,IAAM,EAAS,KAAK,MAAMD,EAAAA,QAAG,aAAa,EAAU,CAAa,CAAC,EAC5D,EAAU,OAAO,EAAO,MAAS,UAAY,KAAK,IAAI,EAAI,EAAO,KAAO,IACxE,EAAO,OAAO,EAAO,KAAQ,UAAY,CAACK,EAAAA,eAAe,EAAO,GAAG,EAGzE,MAFI,CAAC,GAAW,CAAC,EAAa,IAC9B,EAAA,QAAG,WAAW,CAAQ,EACf,GACT,OAAS,EAAO,CAMd,OAHK,EAAgC,OAAS,GAC5C,KAAK,QAAQ,KAAKJ,EAAAA,WAAW,qBAAsB,EAAO,EAAG,GAAuB,CAAS,CAAC,EAEzF,EACT,CACF,CAQA,iBAAiB,EAAwD,CAEvE,OADA,KAAK,UAAU,IAAI,CAAQ,MACd,KAAK,UAAU,OAAO,CAAQ,CAC7C,CAEA,SAAgB,CACd,KAAK,UAAU,MAAM,CACvB,CACF"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
//#region src/
|
|
4
|
-
|
|
1
|
+
import { TaskDocument } from "../../models/task.cjs";
|
|
2
|
+
import { TaskFailureReporter } from "../../types/telemetry.cjs";
|
|
3
|
+
//#region src/services/taskStore/index.d.ts
|
|
4
|
+
export type TaskStoreCommitListener = (previous: TaskDocument, committed: TaskDocument) => void;
|
|
5
|
+
export interface TaskStoreOptions {
|
|
5
6
|
cwd?: string;
|
|
6
|
-
env?:
|
|
7
|
+
env?: Readonly<Record<string, string | undefined>>;
|
|
7
8
|
storePath?: string;
|
|
8
|
-
|
|
9
|
-
* not depend on `fs.watch`, whose delivery timing is platform-dependent. */
|
|
10
|
-
pollIntervalMs?: number;
|
|
9
|
+
onCommitted?: TaskStoreCommitListener;
|
|
11
10
|
/** How long to wait for the advisory lock before proceeding lock-free. */
|
|
12
11
|
lockTimeoutMs?: number;
|
|
13
12
|
/** Where swallowed failures go, so silent degradation stays visible. */
|
|
@@ -21,25 +20,23 @@ interface TaskStoreOptions {
|
|
|
21
20
|
* cannot clobber each other, and writes land via temp-file rename so a
|
|
22
21
|
* crash mid-write can never leave a partial document behind.
|
|
23
22
|
*/
|
|
24
|
-
declare class TaskStore {
|
|
23
|
+
export declare class TaskStore {
|
|
25
24
|
storePath: string;
|
|
26
25
|
private readonly cwd;
|
|
27
26
|
private readonly env;
|
|
28
27
|
private cached;
|
|
29
|
-
private lastKnownRev;
|
|
30
|
-
private watcher?;
|
|
31
|
-
private pollTimer?;
|
|
32
|
-
private debounceTimer?;
|
|
33
28
|
private readonly listeners;
|
|
34
|
-
private readonly pollIntervalMs;
|
|
35
29
|
private readonly lockTimeoutMs;
|
|
36
30
|
private readonly report?;
|
|
31
|
+
private readonly onCommitted?;
|
|
37
32
|
constructor(options?: TaskStoreOptions);
|
|
38
|
-
/** Bind a default store to the current session tree before reading
|
|
33
|
+
/** Bind a default store to the current session tree before reading it. */
|
|
39
34
|
configureSession(sessionKey: string): void;
|
|
40
35
|
/** Last document read from disk, without hitting the filesystem. */
|
|
41
36
|
get snapshot(): TaskDocument;
|
|
42
37
|
read(): TaskDocument;
|
|
38
|
+
readAsync(shouldApply?: () => boolean): Promise<TaskDocument>;
|
|
39
|
+
private readDocumentAsync;
|
|
43
40
|
/**
|
|
44
41
|
* Apply a mutation under the store lock.
|
|
45
42
|
*
|
|
@@ -54,24 +51,19 @@ declare class TaskStore {
|
|
|
54
51
|
document: TaskDocument;
|
|
55
52
|
value: T;
|
|
56
53
|
}>;
|
|
54
|
+
private notifyCommitted;
|
|
57
55
|
private write;
|
|
58
56
|
private acquireLock;
|
|
59
57
|
/** Remove a lock left behind by a dead process or one held implausibly long. */
|
|
60
58
|
private breakStaleLock;
|
|
61
59
|
/**
|
|
62
|
-
*
|
|
60
|
+
* Listen for commits made through this store instance.
|
|
63
61
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* process are filtered out by revision so the UI does not redraw twice.
|
|
62
|
+
* Live cross-process updates use the owning session's direct event bus. This
|
|
63
|
+
* listener remains for local terminal views and never watches the filesystem.
|
|
67
64
|
*/
|
|
68
65
|
onExternalChange(listener: (document: TaskDocument) => void): () => void;
|
|
69
|
-
private startWatching;
|
|
70
|
-
private scheduleCheck;
|
|
71
|
-
private checkForChange;
|
|
72
|
-
private stopWatching;
|
|
73
66
|
dispose(): void;
|
|
74
67
|
}
|
|
75
68
|
//#endregion
|
|
76
|
-
|
|
77
|
-
//# sourceMappingURL=taskStore.d.cts.map
|
|
69
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/services/taskStore/index.ts"],"mappings":";;;YAkBY,2BAA2B,UAAU,cAAc,WAAW;iBAEzD;EACf;EACA,MAAM,SAAS;EACf;EACA,cAAc;;EAEd;;EAEA,SAAS;;;;;;;;;;qBAwCE;EACX;mBAEiB;mBACA;UACT;mBACS;mBACA;mBACA;mBACA;EAEjB,YAAY,UAAS;;EAUrB,iBAAiB;;MAOb,YAAY;EAIhB,QAAQ;EAgBF,UAAU,8BAA0C,QAAQ;UAQpD;;;;;;;;EAmBR,OAAO,GACX,SAAS,UAAU;IAAmB,WAAW;IAAc,OAAO;MACrE;IAAU,UAAU;IAAc,OAAO;;UAwBpC;UAeA;UAUM;;UAoCN;;;;;;;EAwBR,iBAAiB,WAAW,UAAU;EAKtC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
//#region src/
|
|
4
|
-
|
|
1
|
+
import { TaskDocument } from "../../models/task.mjs";
|
|
2
|
+
import { TaskFailureReporter } from "../../types/telemetry.mjs";
|
|
3
|
+
//#region src/services/taskStore/index.d.ts
|
|
4
|
+
export type TaskStoreCommitListener = (previous: TaskDocument, committed: TaskDocument) => void;
|
|
5
|
+
export interface TaskStoreOptions {
|
|
5
6
|
cwd?: string;
|
|
6
|
-
env?:
|
|
7
|
+
env?: Readonly<Record<string, string | undefined>>;
|
|
7
8
|
storePath?: string;
|
|
8
|
-
|
|
9
|
-
* not depend on `fs.watch`, whose delivery timing is platform-dependent. */
|
|
10
|
-
pollIntervalMs?: number;
|
|
9
|
+
onCommitted?: TaskStoreCommitListener;
|
|
11
10
|
/** How long to wait for the advisory lock before proceeding lock-free. */
|
|
12
11
|
lockTimeoutMs?: number;
|
|
13
12
|
/** Where swallowed failures go, so silent degradation stays visible. */
|
|
@@ -21,25 +20,23 @@ interface TaskStoreOptions {
|
|
|
21
20
|
* cannot clobber each other, and writes land via temp-file rename so a
|
|
22
21
|
* crash mid-write can never leave a partial document behind.
|
|
23
22
|
*/
|
|
24
|
-
declare class TaskStore {
|
|
23
|
+
export declare class TaskStore {
|
|
25
24
|
storePath: string;
|
|
26
25
|
private readonly cwd;
|
|
27
26
|
private readonly env;
|
|
28
27
|
private cached;
|
|
29
|
-
private lastKnownRev;
|
|
30
|
-
private watcher?;
|
|
31
|
-
private pollTimer?;
|
|
32
|
-
private debounceTimer?;
|
|
33
28
|
private readonly listeners;
|
|
34
|
-
private readonly pollIntervalMs;
|
|
35
29
|
private readonly lockTimeoutMs;
|
|
36
30
|
private readonly report?;
|
|
31
|
+
private readonly onCommitted?;
|
|
37
32
|
constructor(options?: TaskStoreOptions);
|
|
38
|
-
/** Bind a default store to the current session tree before reading
|
|
33
|
+
/** Bind a default store to the current session tree before reading it. */
|
|
39
34
|
configureSession(sessionKey: string): void;
|
|
40
35
|
/** Last document read from disk, without hitting the filesystem. */
|
|
41
36
|
get snapshot(): TaskDocument;
|
|
42
37
|
read(): TaskDocument;
|
|
38
|
+
readAsync(shouldApply?: () => boolean): Promise<TaskDocument>;
|
|
39
|
+
private readDocumentAsync;
|
|
43
40
|
/**
|
|
44
41
|
* Apply a mutation under the store lock.
|
|
45
42
|
*
|
|
@@ -54,24 +51,19 @@ declare class TaskStore {
|
|
|
54
51
|
document: TaskDocument;
|
|
55
52
|
value: T;
|
|
56
53
|
}>;
|
|
54
|
+
private notifyCommitted;
|
|
57
55
|
private write;
|
|
58
56
|
private acquireLock;
|
|
59
57
|
/** Remove a lock left behind by a dead process or one held implausibly long. */
|
|
60
58
|
private breakStaleLock;
|
|
61
59
|
/**
|
|
62
|
-
*
|
|
60
|
+
* Listen for commits made through this store instance.
|
|
63
61
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* process are filtered out by revision so the UI does not redraw twice.
|
|
62
|
+
* Live cross-process updates use the owning session's direct event bus. This
|
|
63
|
+
* listener remains for local terminal views and never watches the filesystem.
|
|
67
64
|
*/
|
|
68
65
|
onExternalChange(listener: (document: TaskDocument) => void): () => void;
|
|
69
|
-
private startWatching;
|
|
70
|
-
private scheduleCheck;
|
|
71
|
-
private checkForChange;
|
|
72
|
-
private stopWatching;
|
|
73
66
|
dispose(): void;
|
|
74
67
|
}
|
|
75
68
|
//#endregion
|
|
76
|
-
|
|
77
|
-
//# sourceMappingURL=taskStore.d.mts.map
|
|
69
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/services/taskStore/index.ts"],"mappings":";;;YAkBY,2BAA2B,UAAU,cAAc,WAAW;iBAEzD;EACf;EACA,MAAM,SAAS;EACf;EACA,cAAc;;EAEd;;EAEA,SAAS;;;;;;;;;;qBAwCE;EACX;mBAEiB;mBACA;UACT;mBACS;mBACA;mBACA;mBACA;EAEjB,YAAY,UAAS;;EAUrB,iBAAiB;;MAOb,YAAY;EAIhB,QAAQ;EAgBF,UAAU,8BAA0C,QAAQ;UAQpD;;;;;;;;EAmBR,OAAO,GACX,SAAS,UAAU;IAAmB,WAAW;IAAc,OAAO;MACrE;IAAU,UAAU;IAAc,OAAO;;UAwBpC;UAeA;UAUM;;UAoCN;;;;;;;EAwBR,iBAAiB,WAAW,UAAU;EAKtC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{isProcessAlive as e}from"../processLiveness/index.mjs";import{TASK_EVENT as t}from"../../types/telemetry.mjs";import{emptyDocument as n}from"../../models/task.mjs";import{canonicalizeTasks as r}from"../invariants/index.mjs";import{lockPathFor as i,resolveStorePath as a,tempPathFor as o}from"../paths/index.mjs";import s from"node:fs";import c from"node:path";const l=`utf8`,u=`ENOENT`,d=`store.path`;function f(e){return new Promise(t=>setTimeout(t,e))}function p(e){if(!e||typeof e!=`object`)return n();let t=e;if(!Array.isArray(t.tasks))return n();let i=r(t.tasks.filter(e=>!!e&&typeof e==`object`&&typeof e.id==`number`)),a=i.reduce((e,t)=>Math.max(e,t.id),0);return{version:typeof t.version==`number`?t.version:1,rev:typeof t.rev==`number`?t.rev:0,nextId:typeof t.nextId==`number`&&t.nextId>a?t.nextId:a+1,tasks:i}}var m=class{storePath;cwd;env;cached=n();listeners=new Set;lockTimeoutMs;report;onCommitted;constructor(e={}){this.cwd=e.cwd??process.cwd(),this.env=e.env??process.env,this.storePath=e.storePath??a(this.cwd,this.env),this.lockTimeoutMs=e.lockTimeoutMs??2e3,this.report=e.report,this.onCommitted=e.onCommitted}configureSession(e){this.env.DOOM_TASK_STORE?.trim()||(this.storePath=a(this.cwd,this.env,e),this.cached=n())}get snapshot(){return this.cached}read(){try{let e=s.readFileSync(this.storePath,l);this.cached=p(JSON.parse(e))}catch(e){e.code!==u&&this.report?.error(t.storeReadFailed,e,{[d]:this.storePath}),this.cached=n()}return this.cached}async readAsync(e=()=>!0){let t=this.storePath,n=await this.readDocumentAsync(t);return e()&&(this.cached=n),n}async readDocumentAsync(e=this.storePath){try{let t=await s.promises.readFile(e,l);return p(JSON.parse(t))}catch(r){return r.code!==u&&this.report?.error(t.storeReadFailed,r,{[d]:e}),n()}}async mutate(e){let t=await this.acquireLock(),n=(()=>{try{let t=this.read(),n=e(t);if(!n.document)return{result:{document:t,value:n.value}};let r=this.write(n.document);return{result:{document:r,value:n.value},notification:{previous:t,committed:r}}}finally{t()}})();return n.notification&&this.notifyCommitted(n.notification.previous,n.notification.committed),n.result}notifyCommitted(e,n){try{this.onCommitted?.(e,n)}catch(e){this.report?.error(t.storeCommitListenerFailed,e,{[d]:this.storePath})}for(let e of this.listeners)try{e(n)}catch(e){this.report?.error(t.storeListenerFailed,e,{[d]:this.storePath})}}write(e){let t={...e,version:1,rev:e.rev+1};s.mkdirSync(c.dirname(this.storePath),{recursive:!0});let n=o(this.storePath);return s.writeFileSync(n,`${JSON.stringify(t,void 0,2)}\n`,l),s.renameSync(n,this.storePath),this.cached=t,t}async acquireLock(){let e=i(this.storePath);s.mkdirSync(c.dirname(this.storePath),{recursive:!0});let n=Date.now()+this.lockTimeoutMs;for(;;)try{let t=s.openSync(e,`wx`);return s.writeSync(t,JSON.stringify({pid:process.pid,time:Date.now()})),s.closeSync(t),()=>s.rmSync(e,{force:!0})}catch(r){if(r.code!==`EEXIST`)throw r;if(Date.now()>=n)return this.report?.warn(t.storeLockTimeout,Error(`Task store lock still held after ${this.lockTimeoutMs}ms; proceeding without it`),{[d]:this.storePath}),()=>{};this.breakStaleLock(e),await f(10+Math.random()*60)}}breakStaleLock(n){try{let t=JSON.parse(s.readFileSync(n,l)),r=typeof t.time==`number`&&Date.now()-t.time>1e4,i=typeof t.pid==`number`&&!e(t.pid);return!r&&!i?!1:(s.unlinkSync(n),!0)}catch(e){return e.code!==u&&this.report?.warn(t.storeLockBreakFailed,e,{[d]:n}),!1}}onExternalChange(e){return this.listeners.add(e),()=>this.listeners.delete(e)}dispose(){this.listeners.clear()}};export{m as TaskStore};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/services/taskStore/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { emptyDocument, STORE_SCHEMA_VERSION, type Task, type TaskDocument } from '../../models/task';\nimport { TASK_EVENT, type TaskFailureReporter } from '../../types/telemetry';\nimport { canonicalizeTasks } from '../invariants';\nimport { lockPathFor, resolveStorePath, STORE_PATH_ENV, tempPathFor } from '../paths';\nimport { isProcessAlive } from '../processLiveness';\n\nconst LOCK_TIMEOUT_MS = 2000;\nconst LOCK_STALE_MS = 10_000;\nconst LOCK_RETRY_BASE_MS = 10;\nconst LOCK_RETRY_MAX_MS = 60;\nconst UTF8_ENCODING = 'utf8';\nconst MISSING_FILE_CODE = 'ENOENT';\nconst LOCK_EXISTS_CODE = 'EEXIST';\nconst STORE_PATH_ATTRIBUTE = 'store.path';\n\nexport type TaskStoreCommitListener = (previous: TaskDocument, committed: TaskDocument) => void;\n\nexport interface TaskStoreOptions {\n cwd?: string;\n env?: Readonly<Record<string, string | undefined>>;\n storePath?: string;\n onCommitted?: TaskStoreCommitListener;\n /** How long to wait for the advisory lock before proceeding lock-free. */\n lockTimeoutMs?: number;\n /** Where swallowed failures go, so silent degradation stays visible. */\n report?: TaskFailureReporter;\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Coerce arbitrary parsed JSON into a valid document.\n *\n * A corrupt or truncated store must not take the session down: the worst\n * acceptable outcome is starting from an empty list, never a crash on startup.\n */\nfunction normalizeDocument(parsed: unknown): TaskDocument {\n if (!parsed || typeof parsed !== 'object') return emptyDocument();\n const candidate = parsed as Partial<TaskDocument>;\n if (!Array.isArray(candidate.tasks)) return emptyDocument();\n\n const tasks = canonicalizeTasks(\n candidate.tasks.filter(\n (task): task is Task => Boolean(task) && typeof task === 'object' && typeof (task as Task).id === 'number',\n ),\n );\n const maxId = tasks.reduce((max, task) => Math.max(max, task.id), 0);\n return {\n version: typeof candidate.version === 'number' ? candidate.version : STORE_SCHEMA_VERSION,\n rev: typeof candidate.rev === 'number' ? candidate.rev : 0,\n nextId: typeof candidate.nextId === 'number' && candidate.nextId > maxId ? candidate.nextId : maxId + 1,\n tasks,\n };\n}\n\n/**\n * File-backed task store shared by one root session and its delegated children.\n *\n * Durability model: the JSON file is the source of truth. Mutations are\n * read-modify-write under an advisory lock so concurrent delegated processes\n * cannot clobber each other, and writes land via temp-file rename so a\n * crash mid-write can never leave a partial document behind.\n */\nexport class TaskStore {\n storePath: string;\n\n private readonly cwd: string;\n private readonly env: Readonly<Record<string, string | undefined>>;\n private cached: TaskDocument = emptyDocument();\n private readonly listeners = new Set<(document: TaskDocument) => void>();\n private readonly lockTimeoutMs: number;\n private readonly report?: TaskFailureReporter;\n private readonly onCommitted?: TaskStoreCommitListener;\n\n constructor(options: TaskStoreOptions = {}) {\n this.cwd = options.cwd ?? process.cwd();\n this.env = options.env ?? process.env;\n this.storePath = options.storePath ?? resolveStorePath(this.cwd, this.env);\n this.lockTimeoutMs = options.lockTimeoutMs ?? LOCK_TIMEOUT_MS;\n this.report = options.report;\n this.onCommitted = options.onCommitted;\n }\n\n /** Bind a default store to the current session tree before reading it. */\n configureSession(sessionKey: string): void {\n if (this.env[STORE_PATH_ENV]?.trim()) return;\n this.storePath = resolveStorePath(this.cwd, this.env, sessionKey);\n this.cached = emptyDocument();\n }\n\n /** Last document read from disk, without hitting the filesystem. */\n get snapshot(): TaskDocument {\n return this.cached;\n }\n\n read(): TaskDocument {\n try {\n const raw = fs.readFileSync(this.storePath, UTF8_ENCODING);\n this.cached = normalizeDocument(JSON.parse(raw));\n } catch (error) {\n // A missing file is the normal state before the first write. Anything\n // else means the task list just silently became empty, which is worth a\n // record: unreadable or corrupt JSON looks identical to \"no tasks yet\".\n if ((error as NodeJS.ErrnoException).code !== MISSING_FILE_CODE) {\n this.report?.error(TASK_EVENT.storeReadFailed, error, { [STORE_PATH_ATTRIBUTE]: this.storePath });\n }\n this.cached = emptyDocument();\n }\n return this.cached;\n }\n\n async readAsync(shouldApply: () => boolean = () => true): Promise<TaskDocument> {\n const storePath = this.storePath;\n const document = await this.readDocumentAsync(storePath);\n if (!shouldApply()) return document;\n this.cached = document;\n return document;\n }\n\n private async readDocumentAsync(storePath: string = this.storePath): Promise<TaskDocument> {\n try {\n const raw = await fs.promises.readFile(storePath, UTF8_ENCODING);\n return normalizeDocument(JSON.parse(raw));\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== MISSING_FILE_CODE) {\n this.report?.error(TASK_EVENT.storeReadFailed, error, { [STORE_PATH_ATTRIBUTE]: storePath });\n }\n return emptyDocument();\n }\n }\n\n /**\n * Apply a mutation under the store lock.\n *\n * `mutate` receives the freshest on-disk document and returns either the next\n * document to commit or `undefined` for a read-only action (list/get), which\n * skips the write entirely so queries never bump `rev`.\n */\n async mutate<T>(\n mutate: (document: TaskDocument) => { document?: TaskDocument; value: T },\n ): Promise<{ document: TaskDocument; value: T }> {\n const release = await this.acquireLock();\n const outcome = (() => {\n try {\n const current = this.read();\n const mutation = mutate(current);\n if (!mutation.document) {\n return { result: { document: current, value: mutation.value } };\n }\n const committed = this.write(mutation.document);\n return {\n result: { document: committed, value: mutation.value },\n notification: { previous: current, committed },\n };\n } finally {\n release();\n }\n })();\n if (outcome.notification) {\n this.notifyCommitted(outcome.notification.previous, outcome.notification.committed);\n }\n return outcome.result;\n }\n\n private notifyCommitted(previous: TaskDocument, committed: TaskDocument): void {\n try {\n this.onCommitted?.(previous, committed);\n } catch (error) {\n this.report?.error(TASK_EVENT.storeCommitListenerFailed, error, { [STORE_PATH_ATTRIBUTE]: this.storePath });\n }\n for (const listener of this.listeners) {\n try {\n listener(committed);\n } catch (error) {\n this.report?.error(TASK_EVENT.storeListenerFailed, error, { [STORE_PATH_ATTRIBUTE]: this.storePath });\n }\n }\n }\n\n private write(document: TaskDocument): TaskDocument {\n const next: TaskDocument = { ...document, version: STORE_SCHEMA_VERSION, rev: document.rev + 1 };\n fs.mkdirSync(path.dirname(this.storePath), { recursive: true });\n const temp = tempPathFor(this.storePath);\n fs.writeFileSync(temp, `${JSON.stringify(next, undefined, 2)}\\n`, UTF8_ENCODING);\n fs.renameSync(temp, this.storePath);\n this.cached = next;\n return next;\n }\n\n private async acquireLock(): Promise<() => void> {\n const lockPath = lockPathFor(this.storePath);\n fs.mkdirSync(path.dirname(this.storePath), { recursive: true });\n const deadline = Date.now() + this.lockTimeoutMs;\n\n for (;;) {\n try {\n const handle = fs.openSync(lockPath, 'wx');\n fs.writeSync(handle, JSON.stringify({ pid: process.pid, time: Date.now() }));\n fs.closeSync(handle);\n return () => fs.rmSync(lockPath, { force: true });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== LOCK_EXISTS_CODE) throw error;\n // The deadline is checked before breaking a stale lock so a peer that\n // keeps recreating one cannot spin this loop without bound.\n if (Date.now() >= deadline) {\n // Proceeding lock-free beats stalling the agent: the rename is atomic,\n // so the worst case is a lost concurrent update, not a corrupt file.\n // Reported because a lost update here can strand a delegation.\n this.report?.warn(\n TASK_EVENT.storeLockTimeout,\n new Error(`Task store lock still held after ${this.lockTimeoutMs}ms; proceeding without it`),\n { [STORE_PATH_ATTRIBUTE]: this.storePath },\n );\n return () => {};\n }\n // Clearing a dead holder's lock still goes through the backoff. Yielding\n // on every iteration is what stops a peer that keeps recreating the\n // lock from turning this into a spin.\n this.breakStaleLock(lockPath);\n await sleep(LOCK_RETRY_BASE_MS + Math.random() * LOCK_RETRY_MAX_MS);\n }\n }\n }\n\n /** Remove a lock left behind by a dead process or one held implausibly long. */\n private breakStaleLock(lockPath: string): boolean {\n try {\n const holder = JSON.parse(fs.readFileSync(lockPath, UTF8_ENCODING)) as { pid?: number; time?: number };\n const expired = typeof holder.time === 'number' && Date.now() - holder.time > LOCK_STALE_MS;\n const dead = typeof holder.pid === 'number' && !isProcessAlive(holder.pid);\n if (!expired && !dead) return false;\n fs.unlinkSync(lockPath);\n return true;\n } catch (error) {\n // Losing the race to another breaker is normal; a persistent failure here\n // shows up as the lock timeout above, so this stays a warning.\n if ((error as NodeJS.ErrnoException).code !== MISSING_FILE_CODE) {\n this.report?.warn(TASK_EVENT.storeLockBreakFailed, error, { [STORE_PATH_ATTRIBUTE]: lockPath });\n }\n return false;\n }\n }\n\n /**\n * Listen for commits made through this store instance.\n *\n * Live cross-process updates use the owning session's direct event bus. This\n * listener remains for local terminal views and never watches the filesystem.\n */\n onExternalChange(listener: (document: TaskDocument) => void): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n dispose(): void {\n this.listeners.clear();\n }\n}\n"],"mappings":"+WASA,MAIM,EAAgB,OAChB,EAAoB,SAEpB,EAAuB,aAe7B,SAAS,EAAM,EAA2B,CACxC,OAAO,IAAI,QAAS,GAAY,WAAW,EAAS,CAAE,CAAC,CACzD,CAQA,SAAS,EAAkB,EAA+B,CACxD,GAAI,CAAC,GAAU,OAAO,GAAW,SAAU,OAAO,EAAc,EAChE,IAAM,EAAY,EAClB,GAAI,CAAC,MAAM,QAAQ,EAAU,KAAK,EAAG,OAAO,EAAc,EAE1D,IAAM,EAAQ,EACZ,EAAU,MAAM,OACb,GAAuB,EAAQ,GAAS,OAAO,GAAS,UAAY,OAAQ,EAAc,IAAO,QACpG,CACF,EACM,EAAQ,EAAM,QAAQ,EAAK,IAAS,KAAK,IAAI,EAAK,EAAK,EAAE,EAAG,CAAC,EACnE,MAAO,CACL,QAAS,OAAO,EAAU,SAAY,SAAW,EAAU,QAAA,EAC3D,IAAK,OAAO,EAAU,KAAQ,SAAW,EAAU,IAAM,EACzD,OAAQ,OAAO,EAAU,QAAW,UAAY,EAAU,OAAS,EAAQ,EAAU,OAAS,EAAQ,EACtG,OACF,CACF,CAUA,IAAa,EAAb,KAAuB,CACrB,UAEA,IACA,IACA,OAA+B,EAAc,EAC7C,UAA6B,IAAI,IACjC,cACA,OACA,YAEA,YAAY,EAA4B,CAAC,EAAG,CAC1C,KAAK,IAAM,EAAQ,KAAO,QAAQ,IAAI,EACtC,KAAK,IAAM,EAAQ,KAAO,QAAQ,IAClC,KAAK,UAAY,EAAQ,WAAa,EAAiB,KAAK,IAAK,KAAK,GAAG,EACzE,KAAK,cAAgB,EAAQ,eAAiB,IAC9C,KAAK,OAAS,EAAQ,OACtB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KAAM,KAAK,IAAI,CAAE,CAAC,CAAC,EAC3E,EAAG,UAAU,CAAM,MACN,EAAG,OAAO,EAAU,CAAE,MAAO,EAAK,CAAC,CAClD,OAAS,EAAO,CACd,GAAK,EAAgC,OAAS,SAAkB,MAAM,EAGtE,GAAI,KAAK,IAAI,GAAK,EAShB,OALA,KAAK,QAAQ,KACX,EAAW,iBACP,MAAM,oCAAoC,KAAK,cAAc,0BAA0B,EAC3F,EAAG,GAAuB,KAAK,SAAU,CAC3C,MACa,CAAC,EAKhB,KAAK,eAAe,CAAQ,EAC5B,MAAM,EAAM,GAAqB,KAAK,OAAO,EAAI,EAAiB,CACpE,CAEJ,CAGA,eAAuB,EAA2B,CAChD,GAAI,CACF,IAAM,EAAS,KAAK,MAAM,EAAG,aAAa,EAAU,CAAa,CAAC,EAC5D,EAAU,OAAO,EAAO,MAAS,UAAY,KAAK,IAAI,EAAI,EAAO,KAAO,IACxE,EAAO,OAAO,EAAO,KAAQ,UAAY,CAAC,EAAe,EAAO,GAAG,EAGzE,MAFI,CAAC,GAAW,CAAC,EAAa,IAC9B,EAAG,WAAW,CAAQ,EACf,GACT,OAAS,EAAO,CAMd,OAHK,EAAgC,OAAS,GAC5C,KAAK,QAAQ,KAAK,EAAW,qBAAsB,EAAO,EAAG,GAAuB,CAAS,CAAC,EAEzF,EACT,CACF,CAQA,iBAAiB,EAAwD,CAEvE,OADA,KAAK,UAAU,IAAI,CAAQ,MACd,KAAK,UAAU,OAAO,CAAQ,CAC7C,CAEA,SAAgB,CACd,KAAK,UAAU,MAAM,CACvB,CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./services/invariants/index.cjs");exports.VALID_TRANSITIONS=e.VALID_TRANSITIONS,exports.canonicalizeTasks=e.canonicalizeTasks,exports.isTransitionValid=e.isTransitionValid;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{VALID_TRANSITIONS as e,canonicalizeTasks as t,isTransitionValid as n}from"./services/invariants/index.mjs";export{e as VALID_TRANSITIONS,t as canonicalizeTasks,n as isTransitionValid};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./services/paths/index.cjs");exports.STORE_PATH_ENV=e.STORE_PATH_ENV,exports.hasStorePathOverride=e.hasStorePathOverride,exports.lockPathFor=e.lockPathFor,exports.removeLegacyStoreDirectory=e.removeLegacyStoreDirectory,exports.removeLegacyStoreDirectoryAsync=e.removeLegacyStoreDirectoryAsync,exports.resolveLegacyStoreDirectory=e.resolveLegacyStoreDirectory,exports.resolveLegacyStoreDirectoryAsync=e.resolveLegacyStoreDirectoryAsync,exports.resolveSessionKey=e.resolveSessionKey,exports.resolveStorePath=e.resolveStorePath,exports.sweepStoreFiles=e.sweepStoreFiles,exports.sweepStoreFilesAsync=e.sweepStoreFilesAsync,exports.tempPathFor=e.tempPathFor;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { STORE_PATH_ENV, StoreSweepResult, hasStorePathOverride, lockPathFor, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, sweepStoreFiles, sweepStoreFilesAsync, tempPathFor } from "./services/paths/index.cjs";
|
|
2
|
+
export { STORE_PATH_ENV, StoreSweepResult, hasStorePathOverride, lockPathFor, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, sweepStoreFiles, sweepStoreFilesAsync, tempPathFor };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { STORE_PATH_ENV, StoreSweepResult, hasStorePathOverride, lockPathFor, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, sweepStoreFiles, sweepStoreFilesAsync, tempPathFor } from "./services/paths/index.mjs";
|
|
2
|
+
export { STORE_PATH_ENV, StoreSweepResult, hasStorePathOverride, lockPathFor, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, sweepStoreFiles, sweepStoreFilesAsync, tempPathFor };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{STORE_PATH_ENV as e,hasStorePathOverride as t,lockPathFor as n,removeLegacyStoreDirectory as r,removeLegacyStoreDirectoryAsync as i,resolveLegacyStoreDirectory as a,resolveLegacyStoreDirectoryAsync as o,resolveSessionKey as s,resolveStorePath as c,sweepStoreFiles as l,sweepStoreFilesAsync as u,tempPathFor as d}from"./services/paths/index.mjs";export{e as STORE_PATH_ENV,t as hasStorePathOverride,n as lockPathFor,r as removeLegacyStoreDirectory,i as removeLegacyStoreDirectoryAsync,a as resolveLegacyStoreDirectory,o as resolveLegacyStoreDirectoryAsync,s as resolveSessionKey,c as resolveStorePath,l as sweepStoreFiles,u as sweepStoreFilesAsync,d as tempPathFor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./services/processLiveness/index.cjs");exports.isProcessAlive=e.isProcessAlive;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isProcessAlive as e}from"./services/processLiveness/index.mjs";export{e as isProcessAlive};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./services/reconcile/index.cjs");exports.ERR_ORPHANED_BY_RESTART=e.ERR_ORPHANED_BY_RESTART,exports.ERR_ORPHANED_BY_SESSION=e.ERR_ORPHANED_BY_SESSION,exports.reconcileOrphanedDelegations=e.reconcileOrphanedDelegations;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ReconcileResult, ReconcileSelf, reconcileOrphanedDelegations } from "./services/reconcile/index.cjs";
|
|
2
|
+
export { ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ReconcileResult, ReconcileSelf, reconcileOrphanedDelegations };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ReconcileResult, ReconcileSelf, reconcileOrphanedDelegations } from "./services/reconcile/index.mjs";
|
|
2
|
+
export { ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ReconcileResult, ReconcileSelf, reconcileOrphanedDelegations };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ERR_ORPHANED_BY_RESTART as e,ERR_ORPHANED_BY_SESSION as t,reconcileOrphanedDelegations as n}from"./services/reconcile/index.mjs";export{e as ERR_ORPHANED_BY_RESTART,t as ERR_ORPHANED_BY_SESSION,n as reconcileOrphanedDelegations};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./services/reducer/index.cjs");exports.MAX_UPSERT_ITEMS=e.MAX_UPSERT_ITEMS,exports.REF_PATTERN=e.REF_PATTERN,exports.applyTaskMutation=e.applyTaskMutation,exports.formatUpsertFailure=e.formatUpsertFailure,exports.isCommittingOp=e.isCommittingOp,exports.singleItemOutcome=e.singleItemOutcome;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ApplyResult, MAX_UPSERT_ITEMS, Op, REF_PATTERN, ReducerAction, applyTaskMutation, formatUpsertFailure, isCommittingOp, singleItemOutcome } from "./services/reducer/index.cjs";
|
|
2
|
+
export { ApplyResult, MAX_UPSERT_ITEMS, Op, REF_PATTERN, ReducerAction, applyTaskMutation, formatUpsertFailure, isCommittingOp, singleItemOutcome };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ApplyResult, MAX_UPSERT_ITEMS, Op, REF_PATTERN, ReducerAction, applyTaskMutation, formatUpsertFailure, isCommittingOp, singleItemOutcome } from "./services/reducer/index.mjs";
|
|
2
|
+
export { ApplyResult, MAX_UPSERT_ITEMS, Op, REF_PATTERN, ReducerAction, applyTaskMutation, formatUpsertFailure, isCommittingOp, singleItemOutcome };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MAX_UPSERT_ITEMS as e,REF_PATTERN as t,applyTaskMutation as n,formatUpsertFailure as r,isCommittingOp as i,singleItemOutcome as a}from"./services/reducer/index.mjs";export{e as MAX_UPSERT_ITEMS,t as REF_PATTERN,n as applyTaskMutation,r as formatUpsertFailure,i as isCommittingOp,a as singleItemOutcome};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./models/taskGraph.cjs");exports.deriveBlocks=e.deriveBlocks,exports.detectCycle=e.detectCycle,exports.isBlocked=e.isBlocked,exports.isTaskListComplete=e.isTaskListComplete,exports.unresolvedBlockers=e.unresolvedBlockers;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{deriveBlocks as e,detectCycle as t,isBlocked as n,isTaskListComplete as r,unresolvedBlockers as i}from"./models/taskGraph.mjs";export{e as deriveBlocks,t as detectCycle,n as isBlocked,r as isTaskListComplete,i as unresolvedBlockers};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./services/taskStore/index.cjs");exports.TaskStore=e.TaskStore;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{TaskStore as e}from"./services/taskStore/index.mjs";export{e as TaskStore};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./models/task.cjs");exports.DELETED_STATUS=e.DELETED_STATUS,exports.STORE_SCHEMA_VERSION=e.STORE_SCHEMA_VERSION,exports.emptyDocument=e.emptyDocument,exports.isDelegationActive=e.isDelegationActive;
|
|
@@ -0,0 +1,2 @@
|
|
|
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 "./models/task.cjs";
|
|
2
|
+
export { AssignmentSummary, DELETED_STATUS, DelegationResult, DelegationState, DepToken, STORE_SCHEMA_VERSION, Task, TaskAction, TaskAssignment, TaskDelegation, TaskDetails, TaskDocument, TaskItemMutation, TaskMutationParams, TaskStatus, UpsertItemOutcome, UpsertSummary, emptyDocument, isDelegationActive };
|
|
@@ -0,0 +1,2 @@
|
|
|
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 "./models/task.mjs";
|
|
2
|
+
export { AssignmentSummary, DELETED_STATUS, DelegationResult, DelegationState, DepToken, STORE_SCHEMA_VERSION, Task, TaskAction, TaskAssignment, TaskDelegation, TaskDetails, TaskDocument, TaskItemMutation, TaskMutationParams, TaskStatus, UpsertItemOutcome, UpsertSummary, emptyDocument, isDelegationActive };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DELETED_STATUS as e,STORE_SCHEMA_VERSION as t,emptyDocument as n,isDelegationActive as r}from"./models/task.mjs";export{e as DELETED_STATUS,t as STORE_SCHEMA_VERSION,n as emptyDocument,r as isDelegationActive};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./constants/promptGuidelines.cjs");exports.DEFAULT_PROMPT_GUIDELINES=e.DEFAULT_PROMPT_GUIDELINES;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEFAULT_PROMPT_GUIDELINES as e}from"./constants/promptGuidelines.mjs";export{e as DEFAULT_PROMPT_GUIDELINES};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./services/taskResult/index.cjs");exports.MSG_ALL_COMPLETE_CLEAR=e.MSG_ALL_COMPLETE_CLEAR,exports.MSG_ASSIGN_PARTIAL=e.MSG_ASSIGN_PARTIAL,exports.MSG_UPSERT_NONE_APPLIED=e.MSG_UPSERT_NONE_APPLIED,exports.MSG_UPSERT_PARTIAL=e.MSG_UPSERT_PARTIAL,exports.buildAssignmentResult=e.buildAssignmentResult,exports.buildTextResult=e.buildTextResult,exports.buildToolResult=e.buildToolResult,exports.formatAssignmentResults=e.formatAssignmentResults,exports.formatContent=e.formatContent,exports.formatUpsertFailureText=e.formatUpsertFailureText;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { AssignmentItemResult, MSG_ALL_COMPLETE_CLEAR, MSG_ASSIGN_PARTIAL, MSG_UPSERT_NONE_APPLIED, MSG_UPSERT_PARTIAL, ToolResult, buildAssignmentResult, buildTextResult, buildToolResult, formatAssignmentResults, formatContent, formatUpsertFailureText } from "./services/taskResult/index.cjs";
|
|
2
|
+
export { AssignmentItemResult, MSG_ALL_COMPLETE_CLEAR, MSG_ASSIGN_PARTIAL, MSG_UPSERT_NONE_APPLIED, MSG_UPSERT_PARTIAL, ToolResult, buildAssignmentResult, buildTextResult, buildToolResult, formatAssignmentResults, formatContent, formatUpsertFailureText };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { AssignmentItemResult, MSG_ALL_COMPLETE_CLEAR, MSG_ASSIGN_PARTIAL, MSG_UPSERT_NONE_APPLIED, MSG_UPSERT_PARTIAL, ToolResult, buildAssignmentResult, buildTextResult, buildToolResult, formatAssignmentResults, formatContent, formatUpsertFailureText } from "./services/taskResult/index.mjs";
|
|
2
|
+
export { AssignmentItemResult, MSG_ALL_COMPLETE_CLEAR, MSG_ASSIGN_PARTIAL, MSG_UPSERT_NONE_APPLIED, MSG_UPSERT_PARTIAL, ToolResult, buildAssignmentResult, buildTextResult, buildToolResult, formatAssignmentResults, formatContent, formatUpsertFailureText };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MSG_ALL_COMPLETE_CLEAR as e,MSG_ASSIGN_PARTIAL as t,MSG_UPSERT_NONE_APPLIED as n,MSG_UPSERT_PARTIAL as r,buildAssignmentResult as i,buildTextResult as a,buildToolResult as o,formatAssignmentResults as s,formatContent as c,formatUpsertFailureText as l}from"./services/taskResult/index.mjs";export{e as MSG_ALL_COMPLETE_CLEAR,t as MSG_ASSIGN_PARTIAL,n as MSG_UPSERT_NONE_APPLIED,r as MSG_UPSERT_PARTIAL,i as buildAssignmentResult,a as buildTextResult,o as buildToolResult,s as formatAssignmentResults,c as formatContent,l as formatUpsertFailureText};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./constants/task.cjs"),t=require("./schemas/task.cjs");exports.COMMAND_NAME=e.COMMAND_NAME,exports.ERR_REQUIRES_INTERACTIVE=t.ERR_REQUIRES_INTERACTIVE,exports.MSG_NO_TASKS=t.MSG_NO_TASKS,exports.MSG_UPSERT_FIELD_MISPLACED=t.MSG_UPSERT_FIELD_MISPLACED,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.taskActionAcceptsField=t.taskActionAcceptsField;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { COMMAND_NAME } from "./constants/task.cjs";
|
|
2
|
+
import { 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";
|
|
3
|
+
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 };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { COMMAND_NAME } from "./constants/task.mjs";
|
|
2
|
+
import { 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";
|
|
3
|
+
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 };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{COMMAND_NAME as e}from"./constants/task.mjs";import{ERR_REQUIRES_INTERACTIVE as t,MSG_NO_TASKS as n,MSG_UPSERT_FIELD_MISPLACED as r,TASK_ACTIONS as i,TASK_ACTION_FIELDS as a,TASK_CONTEXTS as o,TASK_STATUSES as s,TOOL_LABEL as c,TOOL_NAME as l,TaskAssignmentSchema as u,TaskItemSchema as d,TaskParamsSchema as f,taskActionAcceptsField as p}from"./schemas/task.mjs";export{e as COMMAND_NAME,t as ERR_REQUIRES_INTERACTIVE,n as MSG_NO_TASKS,r as MSG_UPSERT_FIELD_MISPLACED,i as TASK_ACTIONS,a as TASK_ACTION_FIELDS,o as TASK_CONTEXTS,s as TASK_STATUSES,c as TOOL_LABEL,l as TOOL_NAME,u as TaskAssignmentSchema,d as TaskItemSchema,f as TaskParamsSchema,p as taskActionAcceptsField};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./constants/promptGuidelines.cjs"),t=require("./tools/task.cjs");exports.DEFAULT_PROMPT_GUIDELINES=e.DEFAULT_PROMPT_GUIDELINES,exports.DEFAULT_PROMPT_SNIPPET=t.DEFAULT_PROMPT_SNIPPET,exports.createTaskTool=t.createTaskTool;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DEFAULT_PROMPT_GUIDELINES } from "./constants/promptGuidelines.cjs";
|
|
2
|
+
import { DEFAULT_PROMPT_SNIPPET, TaskToolDependencies, createTaskTool } from "./tools/task.cjs";
|
|
3
|
+
export { DEFAULT_PROMPT_GUIDELINES, DEFAULT_PROMPT_SNIPPET, TaskToolDependencies, createTaskTool };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DEFAULT_PROMPT_GUIDELINES } from "./constants/promptGuidelines.mjs";
|
|
2
|
+
import { DEFAULT_PROMPT_SNIPPET, TaskToolDependencies, createTaskTool } from "./tools/task.mjs";
|
|
3
|
+
export { DEFAULT_PROMPT_GUIDELINES, DEFAULT_PROMPT_SNIPPET, TaskToolDependencies, createTaskTool };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEFAULT_PROMPT_GUIDELINES as e}from"./constants/promptGuidelines.mjs";import{DEFAULT_PROMPT_SNIPPET as t,createTaskTool as n}from"./tools/task.mjs";export{e as DEFAULT_PROMPT_GUIDELINES,t as DEFAULT_PROMPT_SNIPPET,n as createTaskTool};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const e=require("../types/telemetry.cjs"),t=require("../schemas/task.cjs"),n=require("../services/taskResult/index.cjs");require("../services/config/index.cjs");const r=require("../constants/promptGuidelines.cjs"),i=require("../services/reducer/index.cjs"),a=`tool.action`,o=`task.id`,s=new Set([`upsert`,`list`,`get`,`delete`,`clear`]);var c=class extends Error{};function l(e,t){return new c([`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 u(e,n){let r=Object.keys(n).filter(r=>n[r]!==void 0&&!t.taskActionAcceptsField(e,r));if(r.length===0)return;let i=e===`upsert`?` ${t.MSG_UPSERT_FIELD_MISPLACED}`:``;throw l(e,`${e} does not accept ${r.join(`, `)}.${i}`)}function d(e){let t=e.assignments;if(!t||t.length===0)throw l(`assign`,`assign requires a non-empty assignments[] array`);return t}function f(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 p(t,n,r,i){let s=[];for(let[c,l]of n.entries()){let n;try{n=await t.assign(l.id,f(l,r))}catch(t){i?.error(e.TASK_EVENT.toolFailed,t,{[a]:`assign`,[o]:l.id}),n={ok:!1,message:t instanceof Error?t.message:String(t)}}s.push({index:c,id:l.id,agent:l.agent,...n})}return s}async function m(e,t,r,a){let{document:o,value:s}=await e.mutate(e=>{let n=i.applyTaskMutation(e,t,r,void 0,a);return{...i.isCommittingOp(n.op)?{document:n.document}:{},value:n}});if(s.op.kind===`error`)throw l(t,s.op.message);if(s.op.kind===`upsert`&&s.op.applied===0)throw l(t,n.formatUpsertFailureText(s.op));return n.buildToolResult(t,r,o,s.op)}function h(i,f={}){let{store:h,delegation:g,maxTasks:_=15}=i;return{name:t.TOOL_NAME,label:t.TOOL_LABEL,description:`Shared task list for complex jobs, plus delegation of tracked tasks to background subagents. Use it only when persistent coordination pays off: dependencies, parallel workstreams, or a long-running plan. Do not use it for simple requests, routine edits, straightforward command sequences, or merely because the user listed multiple steps. Actions: upsert (create and change tasks), list, get, delete (tombstone), clear (close the list), assign (delegate through assignments[]), cancel (stop a delegated run). The list is shared across the current session tree, including delegated subagents, while unrelated sessions start empty and stores persist until retention cleanup.`,promptGuidelines:r.DEFAULT_PROMPT_GUIDELINES,parameters:t.TaskParamsSchema,renderShell:`self`,async execute(t,r,f,v,y){let b=r.action,x=r;try{if(await i.waitUntilReady?.(y,f),u(b,x),s.has(b)){let e=await m(h,b,x,_);return i.onChange?.(),e}if(b===`assign`){let e=d(x),t=e[0],r=e.length===1&&t?`Delegating task #${t.id}...`:`Delegating ${e.length} tasks...`;v?.(n.buildTextResult(b,x,h.snapshot,r));let a=await p(g,e,f,i.report);i.onChange?.();let o=n.formatAssignmentResults(a),s=a.flatMap(e=>e.ok?[e.id]:[]);if(s.length===0)throw l(b,o);return n.buildAssignmentResult(x,h.snapshot,o,{assigned:s,failed:a.length-s.length})}v?.(n.buildTextResult(b,x,h.snapshot,`Requesting cancellation for task #${x.id??`unknown`}...`));let e=await g.cancel(x.id??NaN);if(i.onChange?.(),!e.ok)throw l(b,e.message);return n.buildTextResult(b,x,h.snapshot,e.message,void 0)}catch(t){throw i.report?.error(e.TASK_EVENT.toolFailed,t,{[a]:b,...x.id===void 0?{}:{[o]:x.id}}),t instanceof c?t:l(b,t instanceof Error?t.message:String(t))}},...f}}exports.DEFAULT_PROMPT_GUIDELINES=r.DEFAULT_PROMPT_GUIDELINES,exports.DEFAULT_PROMPT_SNIPPET=`Track only complex, multi-step jobs that benefit from persistent progress or delegation; skip simple work`,exports.createTaskTool=h;
|
|
3
|
+
//# sourceMappingURL=task.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.cjs","names":["taskActionAcceptsField","MSG_UPSERT_FIELD_MISPLACED","TASK_EVENT","applyTaskMutation","isCommittingOp","formatUpsertFailureText","buildToolResult","TOOL_NAME","TOOL_LABEL","DEFAULT_PROMPT_GUIDELINES","TaskParamsSchema","buildTextResult","formatAssignmentResults","buildAssignmentResult"],"sources":["../../src/tools/task.ts"],"sourcesContent":["import type { ToolDefinition, ExtensionContext } from '@earendil-works/pi-coding-agent';\n\nimport { DEFAULT_PROMPT_GUIDELINES } from '../constants/promptGuidelines';\nimport type { TaskAction, TaskAssignment, TaskMutationParams } from '../models/task';\nimport {\n MSG_UPSERT_FIELD_MISPLACED,\n TaskParamsSchema,\n TOOL_LABEL,\n TOOL_NAME,\n taskActionAcceptsField,\n} from '../schemas/task';\nimport { DEFAULT_MAX_TASKS } from '../services/config';\nimport type { AssignOptions, DelegationManager, DelegationOutcome } from '../services/delegation';\nimport { applyTaskMutation, isCommittingOp, type ReducerAction } from '../services/reducer';\nimport {\n type AssignmentItemResult,\n buildAssignmentResult,\n buildTextResult,\n buildToolResult,\n formatAssignmentResults,\n formatUpsertFailureText,\n type ToolResult,\n} from '../services/taskResult';\nimport type { TaskStore } from '../services/taskStore';\nimport { TASK_EVENT, type TaskFailureReporter } from '../types/telemetry';\n\nexport { DEFAULT_PROMPT_GUIDELINES } from '../constants/promptGuidelines';\n\n/** @deprecated Task usage policy now lives only in the tool description. */\nexport const DEFAULT_PROMPT_SNIPPET =\n 'Track only complex, multi-step jobs that benefit from persistent progress or delegation; skip simple work';\n\nexport interface TaskToolDependencies {\n store: TaskStore;\n delegation: DelegationManager;\n maxTasks?: number;\n onChange?: () => void;\n report?: TaskFailureReporter;\n waitUntilReady?: (context: ExtensionContext, signal?: AbortSignal) => Promise<void>;\n}\n\nconst ACTION_ATTRIBUTE = 'tool.action';\nconst TASK_ID_ATTRIBUTE = 'task.id';\nconst REDUCER_ACTIONS = new Set<TaskAction>(['upsert', 'list', 'get', 'delete', 'clear']);\n\nclass TaskToolExecutionError extends Error {}\n\nfunction actionableTaskError(action: TaskAction, message: string): TaskToolExecutionError {\n return new TaskToolExecutionError(\n [\n `Task ${action} failed: ${message}`,\n '',\n 'Options:',\n '- List the task board and inspect the current ids, states, and blockers.',\n '- Correct the arguments or state conflict, then retry once.',\n '- Ask the user before cancelling work or changing dependencies to recover.',\n ].join('\\n'),\n );\n}\n\n/**\n * Reject a field that belongs to a different action.\n *\n * The params schema is flat and shared across every action, so this is the only\n * place `{\"action\":\"upsert\",\"id\":3}` can be caught — and it must be, because\n * the entry it carries has no id and would silently create a duplicate task.\n */\nfunction rejectStrayFields(action: TaskAction, params: TaskMutationParams): void {\n const stray = Object.keys(params).filter((key) => params[key] !== undefined && !taskActionAcceptsField(action, key));\n if (stray.length === 0) return;\n const hint = action === 'upsert' ? ` ${MSG_UPSERT_FIELD_MISPLACED}` : '';\n throw actionableTaskError(action, `${action} does not accept ${stray.join(', ')}.${hint}`);\n}\n\n/** assignments[] is the only assign contract, even when it contains one task. */\nfunction resolveAssignments(params: TaskMutationParams): TaskAssignment[] {\n const assignments = params.assignments;\n if (!assignments || assignments.length === 0) {\n throw actionableTaskError('assign', 'assign requires a non-empty assignments[] array');\n }\n return assignments;\n}\n\nfunction assignOptions(request: TaskAssignment, signal: AbortSignal | undefined): AssignOptions {\n return {\n agent: request.agent,\n inlineAgent: request.inlineAgent,\n instructions: request.instructions,\n relevantFiles: request.relevantFiles,\n priorFindings: request.priorFindings,\n model: request.model,\n context: request.context,\n signal,\n };\n}\n\nasync function executeAssignmentBatch(\n delegation: DelegationManager,\n assignments: readonly TaskAssignment[],\n signal: AbortSignal | undefined,\n report: TaskFailureReporter | undefined,\n): Promise<AssignmentItemResult[]> {\n const results: AssignmentItemResult[] = [];\n for (const [index, assignment] of assignments.entries()) {\n let outcome: DelegationOutcome;\n try {\n outcome = await delegation.assign(assignment.id, assignOptions(assignment, signal));\n } catch (error) {\n report?.error(TASK_EVENT.toolFailed, error, {\n [ACTION_ATTRIBUTE]: 'assign',\n [TASK_ID_ATTRIBUTE]: assignment.id,\n });\n outcome = { ok: false, message: error instanceof Error ? error.message : String(error) };\n }\n results.push({ index, id: assignment.id, agent: assignment.agent, ...outcome });\n }\n return results;\n}\n\n/** Run an action through the reducer, persisting only when it produced a change. */\nasync function executeReducerAction(\n store: TaskStore,\n action: ReducerAction,\n params: TaskMutationParams,\n maxTasks: number,\n): Promise<ToolResult> {\n const { document, value } = await store.mutate((current) => {\n const result = applyTaskMutation(current, action, params, undefined, maxTasks);\n return {\n ...(isCommittingOp(result.op) ? { document: result.document } : {}),\n value: result,\n };\n });\n if (value.op.kind === 'error') throw actionableTaskError(action, value.op.message);\n // An upsert that applied nothing is a failed call: it wrote nothing and left\n // `rev` alone, so it must not read to the model as a success. A batch where\n // some entries landed returns normally — that is what partial apply means.\n if (value.op.kind === 'upsert' && value.op.applied === 0) {\n throw actionableTaskError(action, formatUpsertFailureText(value.op));\n }\n // `document` is the committed document, so `details.rev` matches what landed\n // on disk; `value.document` is the pre-write copy and lags by one.\n return buildToolResult(action, params, document, value.op);\n}\n\nexport function createTaskTool(\n dependencies: TaskToolDependencies,\n renderers: Pick<ToolDefinition<typeof TaskParamsSchema, ToolResult['details']>, 'renderCall' | 'renderResult'> = {},\n): ToolDefinition<typeof TaskParamsSchema, ToolResult['details']> {\n const { store, delegation, maxTasks = DEFAULT_MAX_TASKS } = dependencies;\n\n return {\n name: TOOL_NAME,\n label: TOOL_LABEL,\n description:\n 'Shared task list for complex jobs, plus delegation of tracked tasks to background subagents. Use it only when persistent coordination pays off: dependencies, parallel workstreams, or a long-running plan. Do not use it for simple requests, routine edits, straightforward command sequences, or merely because the user listed multiple steps. Actions: upsert (create and change tasks), list, get, delete (tombstone), clear (close the list), assign (delegate through assignments[]), cancel (stop a delegated run). The list is shared across the current session tree, including delegated subagents, while unrelated sessions start empty and stores persist until retention cleanup.',\n promptGuidelines: DEFAULT_PROMPT_GUIDELINES,\n parameters: TaskParamsSchema,\n // Task rows carry their own status colors. Owning the shell prevents Pi's\n // pending/success/error background fill from obscuring those row states.\n renderShell: 'self',\n\n async execute(_toolCallId, params, signal, onUpdate, ctx) {\n const action = params.action as TaskAction;\n const mutationParams = params as TaskMutationParams;\n\n try {\n await dependencies.waitUntilReady?.(ctx, signal);\n rejectStrayFields(action, mutationParams);\n if (REDUCER_ACTIONS.has(action)) {\n const result = await executeReducerAction(store, action as ReducerAction, mutationParams, maxTasks);\n dependencies.onChange?.();\n return result;\n }\n\n if (action === 'assign') {\n const assignments = resolveAssignments(mutationParams);\n const first = assignments[0];\n const progress =\n assignments.length === 1 && first\n ? `Delegating task #${first.id}...`\n : `Delegating ${assignments.length} tasks...`;\n onUpdate?.(buildTextResult(action, mutationParams, store.snapshot, progress));\n const results = await executeAssignmentBatch(delegation, assignments, signal, dependencies.report);\n dependencies.onChange?.();\n const text = formatAssignmentResults(results);\n const assigned = results.flatMap((item) => (item.ok ? [item.id] : []));\n if (assigned.length === 0) throw actionableTaskError(action, text);\n return buildAssignmentResult(mutationParams, store.snapshot, text, {\n assigned,\n failed: results.length - assigned.length,\n });\n }\n\n onUpdate?.(\n buildTextResult(\n action,\n mutationParams,\n store.snapshot,\n `Requesting cancellation for task #${mutationParams.id ?? 'unknown'}...`,\n ),\n );\n const outcome = await delegation.cancel(mutationParams.id ?? Number.NaN);\n dependencies.onChange?.();\n if (!outcome.ok) throw actionableTaskError(action, outcome.message);\n return buildTextResult(action, mutationParams, store.snapshot, outcome.message, undefined);\n } catch (error) {\n // Rethrown so pi still renders the failure to the model; recorded\n // because this is where a store fault becomes visible to the user.\n dependencies.report?.error(TASK_EVENT.toolFailed, error, {\n [ACTION_ATTRIBUTE]: action,\n ...(mutationParams.id === undefined ? {} : { [TASK_ID_ATTRIBUTE]: mutationParams.id }),\n });\n if (error instanceof TaskToolExecutionError) throw error;\n throw actionableTaskError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,EAAM,QAAU,OAAO,CAAK,CAAC,CAC1F,CACF,EAEA,GAAG,CACL,CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TaskFailureReporter } from "../types/telemetry.cjs";
|
|
2
|
+
import { TaskStore } from "../services/taskStore/index.cjs";
|
|
3
|
+
import { DelegationManager } from "../services/delegation/index.cjs";
|
|
4
|
+
import { ToolResult } from "../services/taskResult/index.cjs";
|
|
5
|
+
import { TaskParamsSchema } from "../schemas/task.cjs";
|
|
6
|
+
import { DEFAULT_PROMPT_GUIDELINES } from "../constants/promptGuidelines.cjs";
|
|
7
|
+
import { ExtensionContext, ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
8
|
+
//#region src/tools/task.d.ts
|
|
9
|
+
/** @deprecated Task usage policy now lives only in the tool description. */
|
|
10
|
+
export declare const DEFAULT_PROMPT_SNIPPET = "Track only complex, multi-step jobs that benefit from persistent progress or delegation; skip simple work";
|
|
11
|
+
export interface TaskToolDependencies {
|
|
12
|
+
store: TaskStore;
|
|
13
|
+
delegation: DelegationManager;
|
|
14
|
+
maxTasks?: number;
|
|
15
|
+
onChange?: () => void;
|
|
16
|
+
report?: TaskFailureReporter;
|
|
17
|
+
waitUntilReady?: (context: ExtensionContext, signal?: AbortSignal) => Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export declare function createTaskTool(dependencies: TaskToolDependencies, renderers?: Pick<ToolDefinition<typeof TaskParamsSchema, ToolResult['details']>, 'renderCall' | 'renderResult'>): ToolDefinition<typeof TaskParamsSchema, ToolResult['details']>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { DEFAULT_PROMPT_GUIDELINES };
|
|
22
|
+
//# sourceMappingURL=task.d.cts.map
|