@agimon-ai/doompi-task 0.0.1-alpha.72 → 0.0.1-alpha.75
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 +12 -3
- package/package.json +15 -14
- package/dist/_virtual/_rolldown/runtime.cjs +0 -1
- package/dist/api-contracts.cjs +0 -1
- package/dist/api-contracts.d.cts +0 -2
- package/dist/api-contracts.d.mts +0 -2
- package/dist/api-contracts.mjs +0 -1
- package/dist/commands.cjs +0 -1
- package/dist/commands.d.cts +0 -2
- package/dist/commands.d.mts +0 -2
- package/dist/commands.mjs +0 -1
- package/dist/config.cjs +0 -1
- package/dist/config.d.cts +0 -2
- package/dist/config.d.mts +0 -2
- package/dist/config.mjs +0 -1
- package/dist/constants/promptGuidelines.cjs +0 -2
- package/dist/constants/promptGuidelines.cjs.map +0 -1
- package/dist/constants/promptGuidelines.d.cts +0 -13
- package/dist/constants/promptGuidelines.d.cts.map +0 -1
- package/dist/constants/promptGuidelines.d.mts +0 -13
- package/dist/constants/promptGuidelines.d.mts.map +0 -1
- package/dist/constants/promptGuidelines.mjs +0 -2
- package/dist/constants/promptGuidelines.mjs.map +0 -1
- package/dist/constants/task.cjs +0 -2
- package/dist/constants/task.cjs.map +0 -1
- package/dist/constants/task.d.cts +0 -4
- package/dist/constants/task.d.cts.map +0 -1
- package/dist/constants/task.d.mts +0 -4
- package/dist/constants/task.d.mts.map +0 -1
- package/dist/constants/task.mjs +0 -2
- package/dist/constants/task.mjs.map +0 -1
- package/dist/controllers/tasksCommand.cjs +0 -2
- package/dist/controllers/tasksCommand.cjs.map +0 -1
- package/dist/controllers/tasksCommand.d.cts +0 -15
- package/dist/controllers/tasksCommand.d.cts.map +0 -1
- package/dist/controllers/tasksCommand.d.mts +0 -15
- package/dist/controllers/tasksCommand.d.mts.map +0 -1
- package/dist/controllers/tasksCommand.mjs +0 -2
- package/dist/controllers/tasksCommand.mjs.map +0 -1
- package/dist/controllers/webTasksChannel.cjs +0 -2
- package/dist/controllers/webTasksChannel.cjs.map +0 -1
- package/dist/controllers/webTasksChannel.mjs +0 -2
- package/dist/controllers/webTasksChannel.mjs.map +0 -1
- package/dist/delegation-manager.cjs +0 -1
- package/dist/delegation-manager.d.cts +0 -3
- package/dist/delegation-manager.d.mts +0 -3
- package/dist/delegation-manager.mjs +0 -1
- package/dist/extensions/pi.cjs +0 -3
- package/dist/extensions/pi.cjs.map +0 -1
- package/dist/extensions/pi.d.cts +0 -6
- package/dist/extensions/pi.d.cts.map +0 -1
- package/dist/extensions/pi.d.mts +0 -6
- package/dist/extensions/pi.d.mts.map +0 -1
- package/dist/extensions/pi.mjs +0 -3
- package/dist/extensions/pi.mjs.map +0 -1
- package/dist/extensions/server.cjs +0 -2
- package/dist/extensions/server.cjs.map +0 -1
- package/dist/extensions/server.d.cts +0 -5
- package/dist/extensions/server.d.cts.map +0 -1
- package/dist/extensions/server.d.mts +0 -5
- package/dist/extensions/server.d.mts.map +0 -1
- package/dist/extensions/server.mjs +0 -2
- package/dist/extensions/server.mjs.map +0 -1
- package/dist/index.cjs +0 -1
- package/dist/index.d.cts +0 -16
- package/dist/index.d.mts +0 -16
- package/dist/index.mjs +0 -1
- package/dist/logSinkTelemetry.cjs +0 -1
- package/dist/logSinkTelemetry.d.cts +0 -3
- package/dist/logSinkTelemetry.d.mts +0 -3
- package/dist/logSinkTelemetry.mjs +0 -1
- package/dist/models/task.cjs +0 -2
- package/dist/models/task.cjs.map +0 -1
- package/dist/models/task.d.cts +0 -176
- package/dist/models/task.d.cts.map +0 -1
- package/dist/models/task.d.mts +0 -176
- package/dist/models/task.d.mts.map +0 -1
- package/dist/models/task.mjs +0 -2
- package/dist/models/task.mjs.map +0 -1
- package/dist/models/taskGraph.cjs +0 -2
- package/dist/models/taskGraph.cjs.map +0 -1
- package/dist/models/taskGraph.d.cts +0 -24
- package/dist/models/taskGraph.d.cts.map +0 -1
- package/dist/models/taskGraph.d.mts +0 -24
- package/dist/models/taskGraph.d.mts.map +0 -1
- package/dist/models/taskGraph.mjs +0 -2
- package/dist/models/taskGraph.mjs.map +0 -1
- package/dist/schemas/apiContracts.cjs +0 -2
- package/dist/schemas/apiContracts.cjs.map +0 -1
- package/dist/schemas/apiContracts.d.cts +0 -53
- package/dist/schemas/apiContracts.d.cts.map +0 -1
- package/dist/schemas/apiContracts.d.mts +0 -53
- package/dist/schemas/apiContracts.d.mts.map +0 -1
- package/dist/schemas/apiContracts.mjs +0 -2
- package/dist/schemas/apiContracts.mjs.map +0 -1
- package/dist/schemas/task.cjs +0 -2
- package/dist/schemas/task.cjs.map +0 -1
- package/dist/schemas/task.d.cts +0 -103
- package/dist/schemas/task.d.cts.map +0 -1
- package/dist/schemas/task.d.mts +0 -103
- package/dist/schemas/task.d.mts.map +0 -1
- package/dist/schemas/task.mjs +0 -2
- package/dist/schemas/task.mjs.map +0 -1
- package/dist/services/config/index.cjs +0 -2
- package/dist/services/config/index.cjs.map +0 -1
- package/dist/services/config/index.d.cts +0 -42
- package/dist/services/config/index.d.cts.map +0 -1
- package/dist/services/config/index.d.mts +0 -42
- package/dist/services/config/index.d.mts.map +0 -1
- package/dist/services/config/index.mjs +0 -2
- package/dist/services/config/index.mjs.map +0 -1
- package/dist/services/contextContribution/index.cjs +0 -3
- package/dist/services/contextContribution/index.cjs.map +0 -1
- package/dist/services/contextContribution/index.mjs +0 -3
- package/dist/services/contextContribution/index.mjs.map +0 -1
- package/dist/services/delegation/index.cjs +0 -6
- package/dist/services/delegation/index.cjs.map +0 -1
- package/dist/services/delegation/index.d.cts +0 -192
- package/dist/services/delegation/index.d.cts.map +0 -1
- package/dist/services/delegation/index.d.mts +0 -192
- package/dist/services/delegation/index.d.mts.map +0 -1
- package/dist/services/delegation/index.mjs +0 -6
- package/dist/services/delegation/index.mjs.map +0 -1
- package/dist/services/delegationPlatform/index.cjs +0 -2
- package/dist/services/delegationPlatform/index.cjs.map +0 -1
- package/dist/services/delegationPlatform/index.mjs +0 -2
- package/dist/services/delegationPlatform/index.mjs.map +0 -1
- package/dist/services/invariants/index.cjs +0 -2
- package/dist/services/invariants/index.cjs.map +0 -1
- package/dist/services/invariants/index.d.cts +0 -23
- package/dist/services/invariants/index.d.cts.map +0 -1
- package/dist/services/invariants/index.d.mts +0 -23
- package/dist/services/invariants/index.d.mts.map +0 -1
- package/dist/services/invariants/index.mjs +0 -2
- package/dist/services/invariants/index.mjs.map +0 -1
- package/dist/services/logSinkTelemetry/index.cjs +0 -2
- package/dist/services/logSinkTelemetry/index.cjs.map +0 -1
- package/dist/services/logSinkTelemetry/index.d.cts +0 -23
- package/dist/services/logSinkTelemetry/index.d.cts.map +0 -1
- package/dist/services/logSinkTelemetry/index.d.mts +0 -23
- package/dist/services/logSinkTelemetry/index.d.mts.map +0 -1
- package/dist/services/logSinkTelemetry/index.mjs +0 -2
- package/dist/services/logSinkTelemetry/index.mjs.map +0 -1
- package/dist/services/paths/index.cjs +0 -2
- package/dist/services/paths/index.cjs.map +0 -1
- package/dist/services/paths/index.d.cts +0 -25
- package/dist/services/paths/index.d.cts.map +0 -1
- package/dist/services/paths/index.d.mts +0 -25
- package/dist/services/paths/index.d.mts.map +0 -1
- package/dist/services/paths/index.mjs +0 -2
- package/dist/services/paths/index.mjs.map +0 -1
- package/dist/services/processLiveness/index.cjs +0 -2
- package/dist/services/processLiveness/index.cjs.map +0 -1
- package/dist/services/processLiveness/index.d.cts +0 -11
- package/dist/services/processLiveness/index.d.cts.map +0 -1
- package/dist/services/processLiveness/index.d.mts +0 -11
- package/dist/services/processLiveness/index.d.mts.map +0 -1
- package/dist/services/processLiveness/index.mjs +0 -2
- package/dist/services/processLiveness/index.mjs.map +0 -1
- package/dist/services/reconcile/index.cjs +0 -2
- package/dist/services/reconcile/index.cjs.map +0 -1
- package/dist/services/reconcile/index.d.cts +0 -33
- package/dist/services/reconcile/index.d.cts.map +0 -1
- package/dist/services/reconcile/index.d.mts +0 -33
- package/dist/services/reconcile/index.d.mts.map +0 -1
- package/dist/services/reconcile/index.mjs +0 -2
- package/dist/services/reconcile/index.mjs.map +0 -1
- package/dist/services/reducer/index.cjs +0 -3
- package/dist/services/reducer/index.cjs.map +0 -1
- package/dist/services/reducer/index.d.cts +0 -71
- package/dist/services/reducer/index.d.cts.map +0 -1
- package/dist/services/reducer/index.d.mts +0 -71
- package/dist/services/reducer/index.d.mts.map +0 -1
- package/dist/services/reducer/index.mjs +0 -3
- package/dist/services/reducer/index.mjs.map +0 -1
- package/dist/services/taskNarration/index.cjs +0 -2
- package/dist/services/taskNarration/index.cjs.map +0 -1
- package/dist/services/taskNarration/index.mjs +0 -2
- package/dist/services/taskNarration/index.mjs.map +0 -1
- package/dist/services/taskResult/index.cjs +0 -7
- package/dist/services/taskResult/index.cjs.map +0 -1
- package/dist/services/taskResult/index.d.cts +0 -50
- package/dist/services/taskResult/index.d.cts.map +0 -1
- package/dist/services/taskResult/index.d.mts +0 -50
- package/dist/services/taskResult/index.d.mts.map +0 -1
- package/dist/services/taskResult/index.mjs +0 -7
- package/dist/services/taskResult/index.mjs.map +0 -1
- package/dist/services/taskStore/index.cjs +0 -2
- package/dist/services/taskStore/index.cjs.map +0 -1
- package/dist/services/taskStore/index.d.cts +0 -69
- package/dist/services/taskStore/index.d.cts.map +0 -1
- package/dist/services/taskStore/index.d.mts +0 -69
- package/dist/services/taskStore/index.d.mts.map +0 -1
- package/dist/services/taskStore/index.mjs +0 -2
- package/dist/services/taskStore/index.mjs.map +0 -1
- package/dist/store-invariants.cjs +0 -1
- package/dist/store-invariants.d.cts +0 -2
- package/dist/store-invariants.d.mts +0 -2
- package/dist/store-invariants.mjs +0 -1
- package/dist/store-paths.cjs +0 -1
- package/dist/store-paths.d.cts +0 -2
- package/dist/store-paths.d.mts +0 -2
- package/dist/store-paths.mjs +0 -1
- package/dist/store-process-liveness.cjs +0 -1
- package/dist/store-process-liveness.d.cts +0 -2
- package/dist/store-process-liveness.d.mts +0 -2
- package/dist/store-process-liveness.mjs +0 -1
- package/dist/store-reconcile.cjs +0 -1
- package/dist/store-reconcile.d.cts +0 -2
- package/dist/store-reconcile.d.mts +0 -2
- package/dist/store-reconcile.mjs +0 -1
- package/dist/store-reducer.cjs +0 -1
- package/dist/store-reducer.d.cts +0 -2
- package/dist/store-reducer.d.mts +0 -2
- package/dist/store-reducer.mjs +0 -1
- package/dist/store-task-graph.cjs +0 -1
- package/dist/store-task-graph.d.cts +0 -2
- package/dist/store-task-graph.d.mts +0 -2
- package/dist/store-task-graph.mjs +0 -1
- package/dist/store-task-store.cjs +0 -1
- package/dist/store-task-store.d.cts +0 -2
- package/dist/store-task-store.d.mts +0 -2
- package/dist/store-task-store.mjs +0 -1
- package/dist/store-types.cjs +0 -1
- package/dist/store-types.d.cts +0 -2
- package/dist/store-types.d.mts +0 -2
- package/dist/store-types.mjs +0 -1
- package/dist/tool-prompt-guidelines.cjs +0 -1
- package/dist/tool-prompt-guidelines.d.cts +0 -2
- package/dist/tool-prompt-guidelines.d.mts +0 -2
- package/dist/tool-prompt-guidelines.mjs +0 -1
- package/dist/tool-response-envelope.cjs +0 -1
- package/dist/tool-response-envelope.d.cts +0 -2
- package/dist/tool-response-envelope.d.mts +0 -2
- package/dist/tool-response-envelope.mjs +0 -1
- package/dist/tool-schema.cjs +0 -1
- package/dist/tool-schema.d.cts +0 -3
- package/dist/tool-schema.d.mts +0 -3
- package/dist/tool-schema.mjs +0 -1
- package/dist/tool-task-tool.cjs +0 -1
- package/dist/tool-task-tool.d.cts +0 -3
- package/dist/tool-task-tool.d.mts +0 -3
- package/dist/tool-task-tool.mjs +0 -1
- package/dist/tools/task.cjs +0 -3
- package/dist/tools/task.cjs.map +0 -1
- package/dist/tools/task.d.cts +0 -22
- package/dist/tools/task.d.cts.map +0 -1
- package/dist/tools/task.d.mts +0 -22
- package/dist/tools/task.d.mts.map +0 -1
- package/dist/tools/task.mjs +0 -3
- package/dist/tools/task.mjs.map +0 -1
- package/dist/tui/format.cjs +0 -4
- package/dist/tui/format.cjs.map +0 -1
- package/dist/tui/format.d.cts +0 -61
- package/dist/tui/format.d.cts.map +0 -1
- package/dist/tui/format.d.mts +0 -61
- package/dist/tui/format.d.mts.map +0 -1
- package/dist/tui/format.mjs +0 -4
- package/dist/tui/format.mjs.map +0 -1
- package/dist/tui/selectors.cjs +0 -2
- package/dist/tui/selectors.cjs.map +0 -1
- package/dist/tui/selectors.d.cts +0 -59
- package/dist/tui/selectors.d.cts.map +0 -1
- package/dist/tui/selectors.d.mts +0 -59
- package/dist/tui/selectors.d.mts.map +0 -1
- package/dist/tui/selectors.mjs +0 -2
- package/dist/tui/selectors.mjs.map +0 -1
- package/dist/tui/taskOverlay.cjs +0 -2
- package/dist/tui/taskOverlay.cjs.map +0 -1
- package/dist/tui/taskOverlay.d.cts +0 -37
- package/dist/tui/taskOverlay.d.cts.map +0 -1
- package/dist/tui/taskOverlay.d.mts +0 -37
- package/dist/tui/taskOverlay.d.mts.map +0 -1
- package/dist/tui/taskOverlay.mjs +0 -2
- package/dist/tui/taskOverlay.mjs.map +0 -1
- package/dist/tui/taskSpace.cjs +0 -5
- package/dist/tui/taskSpace.cjs.map +0 -1
- package/dist/tui/taskSpace.d.cts +0 -60
- package/dist/tui/taskSpace.d.cts.map +0 -1
- package/dist/tui/taskSpace.d.mts +0 -60
- package/dist/tui/taskSpace.d.mts.map +0 -1
- package/dist/tui/taskSpace.mjs +0 -5
- package/dist/tui/taskSpace.mjs.map +0 -1
- package/dist/tui-format.cjs +0 -1
- package/dist/tui-format.d.cts +0 -2
- package/dist/tui-format.d.mts +0 -2
- package/dist/tui-format.mjs +0 -1
- package/dist/tui-selectors.cjs +0 -1
- package/dist/tui-selectors.d.cts +0 -2
- package/dist/tui-selectors.d.mts +0 -2
- package/dist/tui-selectors.mjs +0 -1
- package/dist/tui-task-overlay.cjs +0 -1
- package/dist/tui-task-overlay.d.cts +0 -2
- package/dist/tui-task-overlay.d.mts +0 -2
- package/dist/tui-task-overlay.mjs +0 -1
- package/dist/tui-task-space.cjs +0 -1
- package/dist/tui-task-space.d.cts +0 -2
- package/dist/tui-task-space.d.mts +0 -2
- package/dist/tui-task-space.mjs +0 -1
- package/dist/types/delegation.cjs +0 -2
- package/dist/types/delegation.cjs.map +0 -1
- package/dist/types/delegation.d.cts +0 -5
- package/dist/types/delegation.d.cts.map +0 -1
- package/dist/types/delegation.d.mts +0 -5
- package/dist/types/delegation.d.mts.map +0 -1
- package/dist/types/delegation.mjs +0 -2
- package/dist/types/delegation.mjs.map +0 -1
- package/dist/types/telemetry.cjs +0 -2
- package/dist/types/telemetry.cjs.map +0 -1
- package/dist/types/telemetry.d.cts +0 -35
- package/dist/types/telemetry.d.cts.map +0 -1
- package/dist/types/telemetry.d.mts +0 -35
- package/dist/types/telemetry.d.mts.map +0 -1
- package/dist/types/telemetry.mjs +0 -2
- package/dist/types/telemetry.mjs.map +0 -1
- package/dist/types/webTasks.cjs +0 -2
- package/dist/types/webTasks.cjs.map +0 -1
- package/dist/types/webTasks.mjs +0 -2
- package/dist/types/webTasks.mjs.map +0 -1
- package/src/extensions/web.ts +0 -18
- package/src/web/components/TaskDetailDialog.tsx +0 -251
- package/src/web/components/TaskToolMessage.tsx +0 -120
- package/src/web/components/TasksActivitySection.tsx +0 -200
- package/src/web/lib/taskToolFormat.ts +0 -330
- package/src/web/stores/tasksStore.ts +0 -114
- package/src/web/tsconfig.json +0 -23
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../services/delegation/index.cjs"),t=require("../constants/task.cjs"),n=require("../schemas/task.cjs"),r=require("../services/taskResult/index.cjs"),i=require("../services/config/index.cjs"),a=require("../services/paths/index.cjs"),o=require("../services/taskStore/index.cjs"),s=require("../services/reducer/index.cjs"),c=require("../services/delegationPlatform/index.cjs"),l=require("../types/webTasks.cjs"),u=require("../controllers/webTasksChannel.cjs");let d=require("@agimon-ai/doompi-core/delegation"),f=require("@agimon-ai/doompi-core/server-facet"),p=require("typebox/value");const m=`@agimon-ai/doompi-task`;function h(e){return typeof e==`object`&&e&&`content`in e?e:{content:[{type:`text`,text:typeof e==`string`?e:JSON.stringify(e,null,2)}],details:e}}function g(e){return{content:[{type:`text`,text:e instanceof Error?e.message:String(e)}],isError:!0}}async function _(e,t,n,i){let{document:a,value:o}=await e.mutate(e=>{let r=s.applyTaskMutation(e,t,n,void 0,i);return{...s.isCommittingOp(r.op)?{document:r.document}:{},value:r}});if(o.op.kind===`error`)throw Error(o.op.message);return r.buildToolResult(t,n,a,o.op)}async function v(e,t,n){let r=[];for(let[i,a]of t.entries())try{let t=await e.assign(a.id,{agent:a.agent,inlineAgent:a.inlineAgent,instructions:a.instructions,relevantFiles:a.relevantFiles,priorFindings:a.priorFindings,model:a.model,...a.context===`fork`||a.context===`fresh`?{context:a.context}:{},signal:n});r.push({index:i,id:a.id,agent:a.agent,...t})}catch(e){r.push({index:i,id:a.id,agent:a.agent,ok:!1,message:String(e)})}return r}function y(e,t,i){return{name:`task`,label:`Task`,description:`Maintain a persistent task graph and delegate ready tasks to background agents.`,parameters:n.TaskParamsSchema,promptSnippet:`Track complex work persistently and delegate ready tasks`,executionMode:`serial`,async execute(a,o,s,c){if(!(0,p.Check)(n.TaskParamsSchema,o))return g(`Invalid task parameters.`);let l=o;try{if(l.action===`assign`){if(!l.assignments?.length)throw Error(`assign requires a non-empty assignments[] array`);c?.(h(`Delegating ${l.assignments.length} task${l.assignments.length===1?``:`s`}...`));let n=await v(t,l.assignments,s),i=n.filter(e=>e.ok).map(e=>e.id),a=r.formatAssignmentResults(n);if(i.length===0)throw Error(a);return r.buildAssignmentResult(l,e.snapshot,a,{assigned:i,failed:n.length-i.length})}if(l.action===`cancel`){let n=await t.cancel(l.id??NaN);if(!n.ok)throw Error(n.message);return r.buildTextResult(`cancel`,l,e.snapshot,n.message)}return _(e,l.action,l,i)}catch(e){return g(e)}}}}const b=(0,f.defineServerPlugin)({name:m,global:{channels:[u.createTasksChannel]},workspace:{channels:[u.createTasksChannel]},session:({host:n,agent:r})=>{if(!r)throw Error(`Task session requires the headless host.`);let s=r.context;if(n.context.directEvents===void 0)throw Error(`Task headless facet requires the session direct event bus.`);let u=n.context.directEvents,f=i.getMaxTasks(s.environment),p=new o.TaskStore({env:s.environment,onCommitted:(e,t)=>{s.client.setStatus(m,`tasks: ${t.tasks.length}`),u.publish(l.TASKS_CHANNEL_TYPE,s.sessionId,t)}});p.configureSession(a.resolveSessionKey(s.sessionId,s.environment));let h=new e.DelegationManager({store:p,cwd:s.cwd,platform:c.createNodeDelegationPlatform(s.environment),getSessionId:()=>s.sessionId,notify:e=>void s.client.notify({body:e.content,level:`info`}),onChange:()=>s.client.setStatus(m,`tasks: ${p.snapshot.tasks.length}`),runTimeoutMs:i.getDelegationTimeoutMs(s.environment),onNotifyError:e=>void s.client.notify({body:String(e),level:`warning`})});return{services:[e=>{e.inject([d.DOOM_DELEGATION_SERVICE],e=>{let t=(0,d.readDoomDelegationService)(e);t&&h.bind(e,t)})}],onDispose(){h.dispose(),p.dispose()},tools:[y(p,h,f)],commands:[{name:t.COMMAND_NAME,description:`List or clear the persistent task graph.`,async execute(e,t){let n=e.trim()===`clear`?`clear`:`list`,r=(await _(p,n,{action:n},f)).content[0];await t.client.notify({body:r?.type===`text`?r.text:`No tasks`,level:`info`})}}],resources:[{name:`doompi/task-board`,kind:`context`,read:()=>JSON.stringify(p.snapshot,null,2)}],activities:[{name:m,async start(e){return p.configureSession(a.resolveSessionKey(e.sessionId,e.environment)),await a.removeLegacyStoreDirectoryAsync(p.storePath,e.cwd),e.environment.DOOM_TASK_STORE_PATH||await a.sweepStoreFilesAsync(p.storePath,i.getStoreTtlMs(e.environment)),await p.readAsync(),await h.reconcile(),r.context.client.setStatus(m,`tasks: ${p.snapshot.tasks.length}`),()=>{h.reset(),r.context.client.setStatus(m,void 0)}}}]}}});exports.default=b,exports.taskServerFacet=b;
|
|
2
|
-
//# sourceMappingURL=server.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.cjs","names":["applyTaskMutation","isCommittingOp","buildToolResult","TaskParamsSchema","Check","formatAssignmentResults","buildAssignmentResult","buildTextResult","defineServerPlugin","createTasksChannel","getMaxTasks","TaskStore","TASKS_CHANNEL_TYPE","resolveSessionKey","DelegationManager","createNodeDelegationPlatform","getDelegationTimeoutMs","DOOM_DELEGATION_SERVICE","readDoomDelegationService","COMMAND_NAME","removeLegacyStoreDirectoryAsync","sweepStoreFilesAsync","getStoreTtlMs"],"sources":["../../src/extensions/server.ts"],"sourcesContent":["import { DOOM_DELEGATION_SERVICE, readDoomDelegationService } from '@agimon-ai/doompi-core/delegation';\nimport { type DoomHeadlessExecutionContext, type DoomHeadlessToolResult } from '@agimon-ai/doompi-core/headless';\nimport type { DoomHeadlessTool } from '@agimon-ai/doompi-core/headless';\nimport { defineServerPlugin } from '@agimon-ai/doompi-core/server-facet';\nimport type { Context } from '@deepseek-ai/cordis';\nimport { Check } from 'typebox/value';\n\nimport { COMMAND_NAME } from '../constants/task';\nimport { createTasksChannel } from '../controllers/webTasksChannel';\nimport type { TaskMutationParams } from '../models/task';\nimport { TaskParamsSchema, type TaskParams, type TaskAssignmentParams } from '../schemas/task';\nimport { getMaxTasks, getDelegationTimeoutMs, getStoreTtlMs } from '../services/config';\nimport { DelegationManager } from '../services/delegation';\nimport { createNodeDelegationPlatform } from '../services/delegationPlatform';\nimport { resolveSessionKey } from '../services/paths';\nimport { removeLegacyStoreDirectoryAsync, sweepStoreFilesAsync } from '../services/paths';\nimport { applyTaskMutation, isCommittingOp, type ReducerAction } from '../services/reducer';\nimport {\n buildAssignmentResult,\n buildTextResult,\n buildToolResult,\n formatAssignmentResults,\n} from '../services/taskResult';\nimport { TaskStore } from '../services/taskStore';\nimport { TASKS_CHANNEL_TYPE } from '../types/webTasks';\n\nconst SOURCE = '@agimon-ai/doompi-task';\n\nfunction output(value: unknown): DoomHeadlessToolResult {\n if (typeof value === 'object' && value !== null && 'content' in value) return value as DoomHeadlessToolResult;\n const text = typeof value === 'string' ? value : JSON.stringify(value, null, 2);\n return { content: [{ type: 'text', text }], details: value };\n}\n\nfunction failure(error: unknown): DoomHeadlessToolResult {\n return { content: [{ type: 'text', text: error instanceof Error ? error.message : String(error) }], isError: true };\n}\n\nasync function reducerAction(\n store: TaskStore,\n action: ReducerAction,\n params: TaskMutationParams,\n maxTasks: number,\n): Promise<DoomHeadlessToolResult> {\n const { document, value } = await store.mutate((current) => {\n const result = applyTaskMutation(current, action, params, undefined, maxTasks);\n return { ...(isCommittingOp(result.op) ? { document: result.document } : {}), value: result };\n });\n if (value.op.kind === 'error') throw new Error(value.op.message);\n return buildToolResult(action, params, document, value.op);\n}\n\ninterface AssignmentItemResult {\n index: number;\n id: number;\n agent: string;\n ok: boolean;\n message: string;\n}\n\nasync function assignmentBatch(\n manager: DelegationManager,\n assignments: readonly TaskAssignmentParams[],\n signal?: AbortSignal,\n): Promise<AssignmentItemResult[]> {\n const result: AssignmentItemResult[] = [];\n for (const [index, assignment] of assignments.entries()) {\n try {\n const outcome = await manager.assign(assignment.id, {\n agent: assignment.agent,\n inlineAgent: assignment.inlineAgent,\n instructions: assignment.instructions,\n relevantFiles: assignment.relevantFiles,\n priorFindings: assignment.priorFindings,\n model: assignment.model,\n ...(assignment.context === 'fork' || assignment.context === 'fresh' ? { context: assignment.context } : {}),\n signal,\n });\n result.push({ index, id: assignment.id, agent: assignment.agent, ...outcome });\n } catch (error) {\n result.push({ index, id: assignment.id, agent: assignment.agent, ok: false, message: String(error) });\n }\n }\n return result;\n}\n\nfunction createTaskTool(\n store: TaskStore,\n manager: DelegationManager,\n maxTasks: number,\n): DoomHeadlessTool<typeof TaskParamsSchema> {\n return {\n name: 'task',\n label: 'Task',\n description: 'Maintain a persistent task graph and delegate ready tasks to background agents.',\n parameters: TaskParamsSchema,\n promptSnippet: 'Track complex work persistently and delegate ready tasks',\n executionMode: 'serial',\n async execute(_toolCallId, rawParams, signal, onUpdate) {\n if (!Check(TaskParamsSchema, rawParams)) return failure('Invalid task parameters.');\n const params = rawParams as TaskParams;\n try {\n if (params.action === 'assign') {\n if (!params.assignments?.length) throw new Error('assign requires a non-empty assignments[] array');\n onUpdate?.(\n output(`Delegating ${params.assignments.length} task${params.assignments.length === 1 ? '' : 's'}...`),\n );\n const items = await assignmentBatch(manager, params.assignments, signal);\n const assigned = items.filter((item) => item.ok).map((item) => item.id);\n const text = formatAssignmentResults(items);\n if (assigned.length === 0) throw new Error(text);\n return buildAssignmentResult(params as TaskMutationParams, store.snapshot, text, {\n assigned,\n failed: items.length - assigned.length,\n });\n }\n if (params.action === 'cancel') {\n const outcome = await manager.cancel(params.id ?? Number.NaN);\n if (!outcome.ok) throw new Error(outcome.message);\n return buildTextResult('cancel', params as TaskMutationParams, store.snapshot, outcome.message);\n }\n return reducerAction(store, params.action as ReducerAction, params as TaskMutationParams, maxTasks);\n } catch (error) {\n return failure(error);\n }\n },\n };\n}\n\nexport const taskServerFacet = defineServerPlugin({\n name: SOURCE,\n global: { channels: [createTasksChannel] },\n workspace: { channels: [createTasksChannel] },\n session: ({ host: serverHost, agent: host }) => {\n if (!host) throw new Error('Task session requires the headless host.');\n const execution = host.context;\n if (serverHost.context.directEvents === undefined)\n throw new Error('Task headless facet requires the session direct event bus.');\n const directEvents = serverHost.context.directEvents;\n const maxTasks = getMaxTasks(execution.environment);\n const store = new TaskStore({\n env: execution.environment,\n onCommitted: (_previous, committed) => {\n execution.client.setStatus(SOURCE, `tasks: ${committed.tasks.length}`);\n directEvents.publish(TASKS_CHANNEL_TYPE, execution.sessionId, committed);\n },\n });\n store.configureSession(resolveSessionKey(execution.sessionId, execution.environment));\n const manager = new DelegationManager({\n store,\n cwd: execution.cwd,\n platform: createNodeDelegationPlatform(execution.environment),\n getSessionId: () => execution.sessionId,\n notify: (message) => void execution.client.notify({ body: message.content, level: 'info' }),\n onChange: () => execution.client.setStatus(SOURCE, `tasks: ${store.snapshot.tasks.length}`),\n runTimeoutMs: getDelegationTimeoutMs(execution.environment),\n onNotifyError: (error) => void execution.client.notify({ body: String(error), level: 'warning' }),\n });\n return {\n services: [\n (serviceContextOwner: Context) => {\n serviceContextOwner.inject([DOOM_DELEGATION_SERVICE], (serviceContext) => {\n const service = readDoomDelegationService(serviceContext);\n if (service) manager.bind(serviceContext, service);\n });\n },\n ],\n onDispose() {\n manager.dispose();\n store.dispose();\n },\n tools: [createTaskTool(store, manager, maxTasks)],\n commands: [\n {\n name: COMMAND_NAME,\n description: 'List or clear the persistent task graph.',\n async execute(args: string, commandContext: DoomHeadlessExecutionContext) {\n const action = args.trim() === 'clear' ? 'clear' : 'list';\n const response = await reducerAction(store, action, { action }, maxTasks);\n const content = response.content[0];\n await commandContext.client.notify({\n body: content?.type === 'text' ? content.text : 'No tasks',\n level: 'info',\n });\n },\n },\n ],\n resources: [\n {\n name: 'doompi/task-board',\n kind: 'context',\n read: () => JSON.stringify(store.snapshot, null, 2),\n },\n ],\n activities: [\n {\n name: SOURCE,\n async start(activityContext) {\n store.configureSession(resolveSessionKey(activityContext.sessionId, activityContext.environment));\n await removeLegacyStoreDirectoryAsync(store.storePath, activityContext.cwd);\n if (!activityContext.environment.DOOM_TASK_STORE_PATH)\n await sweepStoreFilesAsync(store.storePath, getStoreTtlMs(activityContext.environment));\n await store.readAsync();\n await manager.reconcile();\n host.context.client.setStatus(SOURCE, `tasks: ${store.snapshot.tasks.length}`);\n return () => {\n manager.reset();\n host.context.client.setStatus(SOURCE, undefined);\n };\n },\n },\n ],\n };\n },\n});\n\nexport default taskServerFacet;\n"],"mappings":"wrBA0BA,MAAM,EAAS,yBAEf,SAAS,EAAO,EAAwC,CAGtD,OAFI,OAAO,GAAU,UAAY,GAAkB,YAAa,EAAc,EAEvE,CAAE,QAAS,CAAC,CAAE,KAAM,OAAQ,KADtB,OAAO,GAAU,SAAW,EAAQ,KAAK,UAAU,EAAO,KAAM,CAAC,CACtC,CAAC,EAAG,QAAS,CAAM,CAC7D,CAEA,SAAS,EAAQ,EAAwC,C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EAAO,EAAS,CAAQ,CAAC,EAChD,SAAU,CACR,CACE,KAAMC,EAAAA,aACN,YAAa,2CACb,MAAM,QAAQ,EAAc,EAA8C,CACxE,IAAM,EAAS,EAAK,KAAK,IAAM,QAAU,QAAU,OAE7C,GAAU,MADO,EAAc,EAAO,EAAQ,CAAE,QAAO,EAAG,CAAQ,EAAA,CAC/C,QAAQ,GACjC,MAAM,EAAe,OAAO,OAAO,CACjC,KAAM,GAAS,OAAS,OAAS,EAAQ,KAAO,WAChD,MAAO,MACT,CAAC,CACH,CACF,CACF,EACA,UAAW,CACT,CACE,KAAM,oBACN,KAAM,UACN,SAAY,KAAK,UAAU,EAAM,SAAU,KAAM,CAAC,CACpD,CACF,EACA,WAAY,CACV,CACE,KAAM,EACN,MAAM,MAAM,EAAiB,CAQ3B,OAPA,EAAM,iBAAiBN,EAAAA,kBAAkB,EAAgB,UAAW,EAAgB,WAAW,CAAC,EAChG,MAAMO,EAAAA,gCAAgC,EAAM,UAAW,EAAgB,GAAG,EACrE,EAAgB,YAAY,sBAC/B,MAAMC,EAAAA,qBAAqB,EAAM,UAAWC,EAAAA,cAAc,EAAgB,WAAW,CAAC,EACxF,MAAM,EAAM,UAAU,EACtB,MAAM,EAAQ,UAAU,EACxB,EAAK,QAAQ,OAAO,UAAU,EAAQ,UAAU,EAAM,SAAS,MAAM,QAAQ,MAChE,CACX,EAAQ,MAAM,EACd,EAAK,QAAQ,OAAO,UAAU,EAAQ,IAAA,EAAS,CACjD,CACF,CACF,CACF,CACF,CACF,CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.cts","names":[],"sources":["../../src/extensions/server.ts"],"mappings":";qBAiIa,+DAAe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.mts","names":[],"sources":["../../src/extensions/server.ts"],"mappings":";qBAiIa,+DAAe"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{DelegationManager as e}from"../services/delegation/index.mjs";import{COMMAND_NAME as t}from"../constants/task.mjs";import{TaskParamsSchema as n}from"../schemas/task.mjs";import{buildAssignmentResult as r,buildTextResult as i,buildToolResult as a,formatAssignmentResults as o}from"../services/taskResult/index.mjs";import{getDelegationTimeoutMs as s,getMaxTasks as c,getStoreTtlMs as l}from"../services/config/index.mjs";import{removeLegacyStoreDirectoryAsync as u,resolveSessionKey as d,sweepStoreFilesAsync as f}from"../services/paths/index.mjs";import{TaskStore as p}from"../services/taskStore/index.mjs";import{applyTaskMutation as m,isCommittingOp as h}from"../services/reducer/index.mjs";import{createNodeDelegationPlatform as g}from"../services/delegationPlatform/index.mjs";import{TASKS_CHANNEL_TYPE as _}from"../types/webTasks.mjs";import{createTasksChannel as v}from"../controllers/webTasksChannel.mjs";import{DOOM_DELEGATION_SERVICE as y,readDoomDelegationService as b}from"@agimon-ai/doompi-core/delegation";import{defineServerPlugin as x}from"@agimon-ai/doompi-core/server-facet";import{Check as S}from"typebox/value";const C=`@agimon-ai/doompi-task`;function w(e){return typeof e==`object`&&e&&`content`in e?e:{content:[{type:`text`,text:typeof e==`string`?e:JSON.stringify(e,null,2)}],details:e}}function T(e){return{content:[{type:`text`,text:e instanceof Error?e.message:String(e)}],isError:!0}}async function E(e,t,n,r){let{document:i,value:o}=await e.mutate(e=>{let i=m(e,t,n,void 0,r);return{...h(i.op)?{document:i.document}:{},value:i}});if(o.op.kind===`error`)throw Error(o.op.message);return a(t,n,i,o.op)}async function D(e,t,n){let r=[];for(let[i,a]of t.entries())try{let t=await e.assign(a.id,{agent:a.agent,inlineAgent:a.inlineAgent,instructions:a.instructions,relevantFiles:a.relevantFiles,priorFindings:a.priorFindings,model:a.model,...a.context===`fork`||a.context===`fresh`?{context:a.context}:{},signal:n});r.push({index:i,id:a.id,agent:a.agent,...t})}catch(e){r.push({index:i,id:a.id,agent:a.agent,ok:!1,message:String(e)})}return r}function O(e,t,a){return{name:`task`,label:`Task`,description:`Maintain a persistent task graph and delegate ready tasks to background agents.`,parameters:n,promptSnippet:`Track complex work persistently and delegate ready tasks`,executionMode:`serial`,async execute(s,c,l,u){if(!S(n,c))return T(`Invalid task parameters.`);let d=c;try{if(d.action===`assign`){if(!d.assignments?.length)throw Error(`assign requires a non-empty assignments[] array`);u?.(w(`Delegating ${d.assignments.length} task${d.assignments.length===1?``:`s`}...`));let n=await D(t,d.assignments,l),i=n.filter(e=>e.ok).map(e=>e.id),a=o(n);if(i.length===0)throw Error(a);return r(d,e.snapshot,a,{assigned:i,failed:n.length-i.length})}if(d.action===`cancel`){let n=await t.cancel(d.id??NaN);if(!n.ok)throw Error(n.message);return i(`cancel`,d,e.snapshot,n.message)}return E(e,d.action,d,a)}catch(e){return T(e)}}}}const k=x({name:C,global:{channels:[v]},workspace:{channels:[v]},session:({host:n,agent:r})=>{if(!r)throw Error(`Task session requires the headless host.`);let i=r.context;if(n.context.directEvents===void 0)throw Error(`Task headless facet requires the session direct event bus.`);let a=n.context.directEvents,o=c(i.environment),m=new p({env:i.environment,onCommitted:(e,t)=>{i.client.setStatus(C,`tasks: ${t.tasks.length}`),a.publish(_,i.sessionId,t)}});m.configureSession(d(i.sessionId,i.environment));let h=new e({store:m,cwd:i.cwd,platform:g(i.environment),getSessionId:()=>i.sessionId,notify:e=>void i.client.notify({body:e.content,level:`info`}),onChange:()=>i.client.setStatus(C,`tasks: ${m.snapshot.tasks.length}`),runTimeoutMs:s(i.environment),onNotifyError:e=>void i.client.notify({body:String(e),level:`warning`})});return{services:[e=>{e.inject([y],e=>{let t=b(e);t&&h.bind(e,t)})}],onDispose(){h.dispose(),m.dispose()},tools:[O(m,h,o)],commands:[{name:t,description:`List or clear the persistent task graph.`,async execute(e,t){let n=e.trim()===`clear`?`clear`:`list`,r=(await E(m,n,{action:n},o)).content[0];await t.client.notify({body:r?.type===`text`?r.text:`No tasks`,level:`info`})}}],resources:[{name:`doompi/task-board`,kind:`context`,read:()=>JSON.stringify(m.snapshot,null,2)}],activities:[{name:C,async start(e){return m.configureSession(d(e.sessionId,e.environment)),await u(m.storePath,e.cwd),e.environment.DOOM_TASK_STORE_PATH||await f(m.storePath,l(e.environment)),await m.readAsync(),await h.reconcile(),r.context.client.setStatus(C,`tasks: ${m.snapshot.tasks.length}`),()=>{h.reset(),r.context.client.setStatus(C,void 0)}}}]}}});export{k as default,k as taskServerFacet};
|
|
2
|
-
//# sourceMappingURL=server.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.mjs","names":[],"sources":["../../src/extensions/server.ts"],"sourcesContent":["import { DOOM_DELEGATION_SERVICE, readDoomDelegationService } from '@agimon-ai/doompi-core/delegation';\nimport { type DoomHeadlessExecutionContext, type DoomHeadlessToolResult } from '@agimon-ai/doompi-core/headless';\nimport type { DoomHeadlessTool } from '@agimon-ai/doompi-core/headless';\nimport { defineServerPlugin } from '@agimon-ai/doompi-core/server-facet';\nimport type { Context } from '@deepseek-ai/cordis';\nimport { Check } from 'typebox/value';\n\nimport { COMMAND_NAME } from '../constants/task';\nimport { createTasksChannel } from '../controllers/webTasksChannel';\nimport type { TaskMutationParams } from '../models/task';\nimport { TaskParamsSchema, type TaskParams, type TaskAssignmentParams } from '../schemas/task';\nimport { getMaxTasks, getDelegationTimeoutMs, getStoreTtlMs } from '../services/config';\nimport { DelegationManager } from '../services/delegation';\nimport { createNodeDelegationPlatform } from '../services/delegationPlatform';\nimport { resolveSessionKey } from '../services/paths';\nimport { removeLegacyStoreDirectoryAsync, sweepStoreFilesAsync } from '../services/paths';\nimport { applyTaskMutation, isCommittingOp, type ReducerAction } from '../services/reducer';\nimport {\n buildAssignmentResult,\n buildTextResult,\n buildToolResult,\n formatAssignmentResults,\n} from '../services/taskResult';\nimport { TaskStore } from '../services/taskStore';\nimport { TASKS_CHANNEL_TYPE } from '../types/webTasks';\n\nconst SOURCE = '@agimon-ai/doompi-task';\n\nfunction output(value: unknown): DoomHeadlessToolResult {\n if (typeof value === 'object' && value !== null && 'content' in value) return value as DoomHeadlessToolResult;\n const text = typeof value === 'string' ? value : JSON.stringify(value, null, 2);\n return { content: [{ type: 'text', text }], details: value };\n}\n\nfunction failure(error: unknown): DoomHeadlessToolResult {\n return { content: [{ type: 'text', text: error instanceof Error ? error.message : String(error) }], isError: true };\n}\n\nasync function reducerAction(\n store: TaskStore,\n action: ReducerAction,\n params: TaskMutationParams,\n maxTasks: number,\n): Promise<DoomHeadlessToolResult> {\n const { document, value } = await store.mutate((current) => {\n const result = applyTaskMutation(current, action, params, undefined, maxTasks);\n return { ...(isCommittingOp(result.op) ? { document: result.document } : {}), value: result };\n });\n if (value.op.kind === 'error') throw new Error(value.op.message);\n return buildToolResult(action, params, document, value.op);\n}\n\ninterface AssignmentItemResult {\n index: number;\n id: number;\n agent: string;\n ok: boolean;\n message: string;\n}\n\nasync function assignmentBatch(\n manager: DelegationManager,\n assignments: readonly TaskAssignmentParams[],\n signal?: AbortSignal,\n): Promise<AssignmentItemResult[]> {\n const result: AssignmentItemResult[] = [];\n for (const [index, assignment] of assignments.entries()) {\n try {\n const outcome = await manager.assign(assignment.id, {\n agent: assignment.agent,\n inlineAgent: assignment.inlineAgent,\n instructions: assignment.instructions,\n relevantFiles: assignment.relevantFiles,\n priorFindings: assignment.priorFindings,\n model: assignment.model,\n ...(assignment.context === 'fork' || assignment.context === 'fresh' ? { context: assignment.context } : {}),\n signal,\n });\n result.push({ index, id: assignment.id, agent: assignment.agent, ...outcome });\n } catch (error) {\n result.push({ index, id: assignment.id, agent: assignment.agent, ok: false, message: String(error) });\n }\n }\n return result;\n}\n\nfunction createTaskTool(\n store: TaskStore,\n manager: DelegationManager,\n maxTasks: number,\n): DoomHeadlessTool<typeof TaskParamsSchema> {\n return {\n name: 'task',\n label: 'Task',\n description: 'Maintain a persistent task graph and delegate ready tasks to background agents.',\n parameters: TaskParamsSchema,\n promptSnippet: 'Track complex work persistently and delegate ready tasks',\n executionMode: 'serial',\n async execute(_toolCallId, rawParams, signal, onUpdate) {\n if (!Check(TaskParamsSchema, rawParams)) return failure('Invalid task parameters.');\n const params = rawParams as TaskParams;\n try {\n if (params.action === 'assign') {\n if (!params.assignments?.length) throw new Error('assign requires a non-empty assignments[] array');\n onUpdate?.(\n output(`Delegating ${params.assignments.length} task${params.assignments.length === 1 ? '' : 's'}...`),\n );\n const items = await assignmentBatch(manager, params.assignments, signal);\n const assigned = items.filter((item) => item.ok).map((item) => item.id);\n const text = formatAssignmentResults(items);\n if (assigned.length === 0) throw new Error(text);\n return buildAssignmentResult(params as TaskMutationParams, store.snapshot, text, {\n assigned,\n failed: items.length - assigned.length,\n });\n }\n if (params.action === 'cancel') {\n const outcome = await manager.cancel(params.id ?? Number.NaN);\n if (!outcome.ok) throw new Error(outcome.message);\n return buildTextResult('cancel', params as TaskMutationParams, store.snapshot, outcome.message);\n }\n return reducerAction(store, params.action as ReducerAction, params as TaskMutationParams, maxTasks);\n } catch (error) {\n return failure(error);\n }\n },\n };\n}\n\nexport const taskServerFacet = defineServerPlugin({\n name: SOURCE,\n global: { channels: [createTasksChannel] },\n workspace: { channels: [createTasksChannel] },\n session: ({ host: serverHost, agent: host }) => {\n if (!host) throw new Error('Task session requires the headless host.');\n const execution = host.context;\n if (serverHost.context.directEvents === undefined)\n throw new Error('Task headless facet requires the session direct event bus.');\n const directEvents = serverHost.context.directEvents;\n const maxTasks = getMaxTasks(execution.environment);\n const store = new TaskStore({\n env: execution.environment,\n onCommitted: (_previous, committed) => {\n execution.client.setStatus(SOURCE, `tasks: ${committed.tasks.length}`);\n directEvents.publish(TASKS_CHANNEL_TYPE, execution.sessionId, committed);\n },\n });\n store.configureSession(resolveSessionKey(execution.sessionId, execution.environment));\n const manager = new DelegationManager({\n store,\n cwd: execution.cwd,\n platform: createNodeDelegationPlatform(execution.environment),\n getSessionId: () => execution.sessionId,\n notify: (message) => void execution.client.notify({ body: message.content, level: 'info' }),\n onChange: () => execution.client.setStatus(SOURCE, `tasks: ${store.snapshot.tasks.length}`),\n runTimeoutMs: getDelegationTimeoutMs(execution.environment),\n onNotifyError: (error) => void execution.client.notify({ body: String(error), level: 'warning' }),\n });\n return {\n services: [\n (serviceContextOwner: Context) => {\n serviceContextOwner.inject([DOOM_DELEGATION_SERVICE], (serviceContext) => {\n const service = readDoomDelegationService(serviceContext);\n if (service) manager.bind(serviceContext, service);\n });\n },\n ],\n onDispose() {\n manager.dispose();\n store.dispose();\n },\n tools: [createTaskTool(store, manager, maxTasks)],\n commands: [\n {\n name: COMMAND_NAME,\n description: 'List or clear the persistent task graph.',\n async execute(args: string, commandContext: DoomHeadlessExecutionContext) {\n const action = args.trim() === 'clear' ? 'clear' : 'list';\n const response = await reducerAction(store, action, { action }, maxTasks);\n const content = response.content[0];\n await commandContext.client.notify({\n body: content?.type === 'text' ? content.text : 'No tasks',\n level: 'info',\n });\n },\n },\n ],\n resources: [\n {\n name: 'doompi/task-board',\n kind: 'context',\n read: () => JSON.stringify(store.snapshot, null, 2),\n },\n ],\n activities: [\n {\n name: SOURCE,\n async start(activityContext) {\n store.configureSession(resolveSessionKey(activityContext.sessionId, activityContext.environment));\n await removeLegacyStoreDirectoryAsync(store.storePath, activityContext.cwd);\n if (!activityContext.environment.DOOM_TASK_STORE_PATH)\n await sweepStoreFilesAsync(store.storePath, getStoreTtlMs(activityContext.environment));\n await store.readAsync();\n await manager.reconcile();\n host.context.client.setStatus(SOURCE, `tasks: ${store.snapshot.tasks.length}`);\n return () => {\n manager.reset();\n host.context.client.setStatus(SOURCE, undefined);\n };\n },\n },\n ],\n };\n },\n});\n\nexport default taskServerFacet;\n"],"mappings":"inCA0BA,MAAM,EAAS,yBAEf,SAAS,EAAO,EAAwC,CAGtD,OAFI,OAAO,GAAU,UAAY,GAAkB,YAAa,EAAc,EAEvE,CAAE,QAAS,CAAC,CAAE,KAAM,OAAQ,KADtB,OAAO,GAAU,SAAW,EAAQ,KAAK,UAAU,EAAO,KAAM,CAAC,CACtC,CAAC,EAAG,QAAS,CAAM,CAC7D,CAEA,SAAS,EAAQ,EAAwC,CACvD,M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AM,EAAe,OAAO,OAAO,CACjC,KAAM,GAAS,OAAS,OAAS,EAAQ,KAAO,WAChD,MAAO,MACT,CAAC,CACH,CACF,CACF,EACA,UAAW,CACT,CACE,KAAM,oBACN,KAAM,UACN,SAAY,KAAK,UAAU,EAAM,SAAU,KAAM,CAAC,CACpD,CACF,EACA,WAAY,CACV,CACE,KAAM,EACN,MAAM,MAAM,EAAiB,CAQ3B,OAPA,EAAM,iBAAiB,EAAkB,EAAgB,UAAW,EAAgB,WAAW,CAAC,EAChG,MAAM,EAAgC,EAAM,UAAW,EAAgB,GAAG,EACrE,EAAgB,YAAY,sBAC/B,MAAM,EAAqB,EAAM,UAAW,EAAc,EAAgB,WAAW,CAAC,EACxF,MAAM,EAAM,UAAU,EACtB,MAAM,EAAQ,UAAU,EACxB,EAAK,QAAQ,OAAO,UAAU,EAAQ,UAAU,EAAM,SAAS,MAAM,QAAQ,MAChE,CACX,EAAQ,MAAM,EACd,EAAK,QAAQ,OAAO,UAAU,EAAQ,IAAA,EAAS,CACjD,CACF,CACF,CACF,CACF,CACF,CACF,CAAC"}
|
package/dist/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./models/taskGraph.cjs"),t=require("./types/delegation.cjs"),n=require("./models/task.cjs"),r=require("./services/reconcile/index.cjs"),i=require("./services/delegation/index.cjs"),a=require("./constants/task.cjs"),o=require("./schemas/task.cjs"),s=require("./services/taskResult/index.cjs"),c=require("./services/config/index.cjs"),l=require("./tui/selectors.cjs"),u=require("./constants/promptGuidelines.cjs"),d=require("./services/paths/index.cjs"),f=require("./services/taskStore/index.cjs"),p=require("./services/reducer/index.cjs"),m=require("./tools/task.cjs");exports.BACKGROUND_WORK_PROVIDER=i.BACKGROUND_WORK_PROVIDER,exports.COLLAPSE_KEY_ENV=c.COLLAPSE_KEY_ENV,exports.COLLAPSE_KEY_OFF=c.COLLAPSE_KEY_OFF,exports.COMMAND_NAME=a.COMMAND_NAME,exports.DEFAULT_COLLAPSE_KEY=c.DEFAULT_COLLAPSE_KEY,exports.DEFAULT_DELEGATION_TIMEOUT_MS=c.DEFAULT_DELEGATION_TIMEOUT_MS,exports.DEFAULT_MAX_TASKS=c.DEFAULT_MAX_TASKS,exports.DEFAULT_MAX_WIDGET_LINES=c.DEFAULT_MAX_WIDGET_LINES,exports.DEFAULT_PROMPT_GUIDELINES=u.DEFAULT_PROMPT_GUIDELINES,exports.DEFAULT_PROMPT_SNIPPET=m.DEFAULT_PROMPT_SNIPPET,exports.DEFAULT_STORE_TTL_MS=c.DEFAULT_STORE_TTL_MS,exports.DELEGATION_TIMEOUT_MS_ENV=c.DELEGATION_TIMEOUT_MS_ENV,exports.DELETED_STATUS=n.DELETED_STATUS,exports.DelegationManager=i.DelegationManager,exports.ERR_CANCEL_UNACKNOWLEDGED=i.ERR_CANCEL_UNACKNOWLEDGED,exports.ERR_CHILD_SESSION=i.ERR_CHILD_SESSION,exports.ERR_NO_RUNTIME=i.ERR_NO_RUNTIME,exports.ERR_ORPHANED_BY_RESTART=r.ERR_ORPHANED_BY_RESTART,exports.ERR_ORPHANED_BY_SESSION=r.ERR_ORPHANED_BY_SESSION,exports.ERR_REQUIRES_INTERACTIVE=o.ERR_REQUIRES_INTERACTIVE,exports.MAX_BRIEF_FILES=t.MAX_BRIEF_FILES,exports.MAX_TASKS_ENV=c.MAX_TASKS_ENV,exports.MAX_UPSERT_ITEMS=p.MAX_UPSERT_ITEMS,exports.MAX_WIDGET_LINES_ENV=c.MAX_WIDGET_LINES_ENV,exports.MSG_ALL_COMPLETE_CLEAR=s.MSG_ALL_COMPLETE_CLEAR,exports.MSG_ASSIGN_PARTIAL=s.MSG_ASSIGN_PARTIAL,exports.MSG_NO_TASKS=o.MSG_NO_TASKS,exports.MSG_UPSERT_FIELD_MISPLACED=o.MSG_UPSERT_FIELD_MISPLACED,exports.MSG_UPSERT_NONE_APPLIED=s.MSG_UPSERT_NONE_APPLIED,exports.MSG_UPSERT_PARTIAL=s.MSG_UPSERT_PARTIAL,exports.NOTIFY_CUSTOM_TYPE=i.NOTIFY_CUSTOM_TYPE,exports.REF_PATTERN=p.REF_PATTERN,exports.STORE_PATH_ENV=d.STORE_PATH_ENV,exports.STORE_SCHEMA_VERSION=n.STORE_SCHEMA_VERSION,exports.STORE_TTL_MS_ENV=c.STORE_TTL_MS_ENV,exports.TASK_ACTIONS=o.TASK_ACTIONS,exports.TASK_ACTION_FIELDS=o.TASK_ACTION_FIELDS,exports.TASK_CONTEXTS=o.TASK_CONTEXTS,exports.TASK_STATUSES=o.TASK_STATUSES,exports.TOOL_LABEL=o.TOOL_LABEL,exports.TOOL_NAME=o.TOOL_NAME,exports.TaskAssignmentSchema=o.TaskAssignmentSchema,exports.TaskItemSchema=o.TaskItemSchema,exports.TaskParamsSchema=o.TaskParamsSchema,exports.TaskStore=f.TaskStore,exports.applyTaskMutation=p.applyTaskMutation,exports.buildAssignmentResult=s.buildAssignmentResult,exports.buildTextResult=s.buildTextResult,exports.buildToolResult=s.buildToolResult,exports.countTasks=l.countTasks,exports.createTaskTool=m.createTaskTool,exports.deriveBlocks=e.deriveBlocks,exports.deriveTaskProjection=l.deriveTaskProjection,exports.detectCycle=e.detectCycle,exports.emptyDocument=n.emptyDocument,exports.formatAssignmentResults=s.formatAssignmentResults,exports.formatContent=s.formatContent,exports.formatUpsertFailure=p.formatUpsertFailure,exports.formatUpsertFailureText=s.formatUpsertFailureText,exports.getDelegationTimeoutMs=c.getDelegationTimeoutMs,exports.getMaxTasks=c.getMaxTasks,exports.getMaxWidgetLines=c.getMaxWidgetLines,exports.getStoreTtlMs=c.getStoreTtlMs,exports.groupTasks=l.groupTasks,exports.hasActiveWork=l.hasActiveWork,exports.hasStorePathOverride=d.hasStorePathOverride,exports.isBlocked=e.isBlocked,exports.isCommittingOp=p.isCommittingOp,exports.isDelegationActive=n.isDelegationActive,exports.isTaskListComplete=e.isTaskListComplete,exports.lockPathFor=d.lockPathFor,exports.parsePiTaskConfig=c.parsePiTaskConfig,exports.reconcileOrphanedDelegations=r.reconcileOrphanedDelegations,exports.removeLegacyStoreDirectory=d.removeLegacyStoreDirectory,exports.removeLegacyStoreDirectoryAsync=d.removeLegacyStoreDirectoryAsync,exports.resolveCollapseKey=c.resolveCollapseKey,exports.resolveLegacyStoreDirectory=d.resolveLegacyStoreDirectory,exports.resolveLegacyStoreDirectoryAsync=d.resolveLegacyStoreDirectoryAsync,exports.resolveSessionKey=d.resolveSessionKey,exports.resolveStorePath=d.resolveStorePath,exports.selectOverlayLayout=l.selectOverlayLayout,exports.selectOverlayLayoutFromProjection=l.selectOverlayLayoutFromProjection,exports.shouldShowIds=l.shouldShowIds,exports.singleItemOutcome=p.singleItemOutcome,exports.sweepStoreFiles=d.sweepStoreFiles,exports.sweepStoreFilesAsync=d.sweepStoreFilesAsync,exports.taskActionAcceptsField=o.taskActionAcceptsField,exports.tempPathFor=d.tempPathFor,exports.unresolvedBlockers=e.unresolvedBlockers,exports.visibleTasks=l.visibleTasks;
|
package/dist/index.d.cts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AssignmentSummary, DELETED_STATUS, DelegationResult, DelegationState, DepToken, STORE_SCHEMA_VERSION, Task, TaskAction, TaskAssignment, TaskDelegation, TaskDetails, TaskDocument, TaskItemMutation, TaskMutationParams, TaskStatus, UpsertItemOutcome, UpsertSummary, emptyDocument, isDelegationActive } from "./models/task.cjs";
|
|
2
|
-
import { TaskStore, TaskStoreCommitListener, TaskStoreOptions } from "./services/taskStore/index.cjs";
|
|
3
|
-
import { COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_TASKS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, MAX_TASKS_ENV, MAX_WIDGET_LINES_ENV, PiTaskConfig, STORE_TTL_MS_ENV, getDelegationTimeoutMs, getMaxTasks, getMaxWidgetLines, getStoreTtlMs, parsePiTaskConfig, resolveCollapseKey } from "./services/config/index.cjs";
|
|
4
|
-
import { MAX_BRIEF_FILES } from "./types/delegation.cjs";
|
|
5
|
-
import { AssignOptions, BACKGROUND_WORK_PROVIDER, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, DelegationPlatform, DelegationProgress, ERR_CANCEL_UNACKNOWLEDGED, ERR_CHILD_SESSION, ERR_NO_RUNTIME, NOTIFY_CUSTOM_TYPE } from "./services/delegation/index.cjs";
|
|
6
|
-
import { ApplyResult, MAX_UPSERT_ITEMS, Op, REF_PATTERN, ReducerAction, applyTaskMutation, formatUpsertFailure, isCommittingOp, singleItemOutcome } from "./services/reducer/index.cjs";
|
|
7
|
-
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";
|
|
8
|
-
import { COMMAND_NAME } from "./constants/task.cjs";
|
|
9
|
-
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";
|
|
10
|
-
import { DEFAULT_PROMPT_GUIDELINES } from "./constants/promptGuidelines.cjs";
|
|
11
|
-
import { DEFAULT_PROMPT_SNIPPET, TaskToolDependencies, createTaskTool } from "./tools/task.cjs";
|
|
12
|
-
import { STORE_PATH_ENV, StoreSweepResult, hasStorePathOverride, lockPathFor, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, sweepStoreFiles, sweepStoreFilesAsync, tempPathFor } from "./services/paths/index.cjs";
|
|
13
|
-
import { ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ReconcileResult, ReconcileSelf, reconcileOrphanedDelegations } from "./services/reconcile/index.cjs";
|
|
14
|
-
import { deriveBlocks, detectCycle, isBlocked, isTaskListComplete, unresolvedBlockers } from "./models/taskGraph.cjs";
|
|
15
|
-
import { OverlayLayout, TaskCounts, TaskGroups, TaskProjection, countTasks, deriveTaskProjection, groupTasks, hasActiveWork, selectOverlayLayout, selectOverlayLayoutFromProjection, shouldShowIds, visibleTasks } from "./tui/selectors.cjs";
|
|
16
|
-
export { ApplyResult, AssignOptions, AssignmentItemResult, AssignmentSummary, BACKGROUND_WORK_PROVIDER, COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, COMMAND_NAME, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_TASKS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_PROMPT_GUIDELINES, DEFAULT_PROMPT_SNIPPET, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, DELETED_STATUS, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, DelegationPlatform, DelegationProgress, DelegationResult, DelegationState, DepToken, ERR_CANCEL_UNACKNOWLEDGED, ERR_CHILD_SESSION, ERR_NO_RUNTIME, ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ERR_REQUIRES_INTERACTIVE, MAX_BRIEF_FILES, MAX_TASKS_ENV, MAX_UPSERT_ITEMS, MAX_WIDGET_LINES_ENV, MSG_ALL_COMPLETE_CLEAR, MSG_ASSIGN_PARTIAL, MSG_NO_TASKS, MSG_UPSERT_FIELD_MISPLACED, MSG_UPSERT_NONE_APPLIED, MSG_UPSERT_PARTIAL, NOTIFY_CUSTOM_TYPE, Op, OverlayLayout, PiTaskConfig, REF_PATTERN, ReconcileResult, ReconcileSelf, ReducerAction, STORE_PATH_ENV, STORE_SCHEMA_VERSION, STORE_TTL_MS_ENV, StoreSweepResult, TASK_ACTIONS, TASK_ACTION_FIELDS, TASK_CONTEXTS, TASK_STATUSES, TOOL_LABEL, TOOL_NAME, Task, TaskAction, TaskAssignment, TaskAssignmentParams, TaskAssignmentSchema, TaskCounts, TaskDelegation, TaskDetails, TaskDocument, TaskGroups, TaskItemMutation, TaskItemParams, TaskItemSchema, TaskMutationParams, TaskParams, TaskParamsSchema, TaskProjection, TaskStatus, TaskStore, TaskStoreCommitListener, TaskStoreOptions, TaskToolDependencies, ToolResult, UpsertItemOutcome, UpsertSummary, applyTaskMutation, buildAssignmentResult, buildTextResult, buildToolResult, countTasks, createTaskTool, deriveBlocks, deriveTaskProjection, detectCycle, emptyDocument, formatAssignmentResults, formatContent, formatUpsertFailure, formatUpsertFailureText, getDelegationTimeoutMs, getMaxTasks, getMaxWidgetLines, getStoreTtlMs, groupTasks, hasActiveWork, hasStorePathOverride, isBlocked, isCommittingOp, isDelegationActive, isTaskListComplete, lockPathFor, parsePiTaskConfig, reconcileOrphanedDelegations, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveCollapseKey, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, selectOverlayLayout, selectOverlayLayoutFromProjection, shouldShowIds, singleItemOutcome, sweepStoreFiles, sweepStoreFilesAsync, taskActionAcceptsField, tempPathFor, unresolvedBlockers, visibleTasks };
|
package/dist/index.d.mts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AssignmentSummary, DELETED_STATUS, DelegationResult, DelegationState, DepToken, STORE_SCHEMA_VERSION, Task, TaskAction, TaskAssignment, TaskDelegation, TaskDetails, TaskDocument, TaskItemMutation, TaskMutationParams, TaskStatus, UpsertItemOutcome, UpsertSummary, emptyDocument, isDelegationActive } from "./models/task.mjs";
|
|
2
|
-
import { TaskStore, TaskStoreCommitListener, TaskStoreOptions } from "./services/taskStore/index.mjs";
|
|
3
|
-
import { COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_TASKS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, MAX_TASKS_ENV, MAX_WIDGET_LINES_ENV, PiTaskConfig, STORE_TTL_MS_ENV, getDelegationTimeoutMs, getMaxTasks, getMaxWidgetLines, getStoreTtlMs, parsePiTaskConfig, resolveCollapseKey } from "./services/config/index.mjs";
|
|
4
|
-
import { MAX_BRIEF_FILES } from "./types/delegation.mjs";
|
|
5
|
-
import { AssignOptions, BACKGROUND_WORK_PROVIDER, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, DelegationPlatform, DelegationProgress, ERR_CANCEL_UNACKNOWLEDGED, ERR_CHILD_SESSION, ERR_NO_RUNTIME, NOTIFY_CUSTOM_TYPE } from "./services/delegation/index.mjs";
|
|
6
|
-
import { ApplyResult, MAX_UPSERT_ITEMS, Op, REF_PATTERN, ReducerAction, applyTaskMutation, formatUpsertFailure, isCommittingOp, singleItemOutcome } from "./services/reducer/index.mjs";
|
|
7
|
-
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";
|
|
8
|
-
import { COMMAND_NAME } from "./constants/task.mjs";
|
|
9
|
-
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";
|
|
10
|
-
import { DEFAULT_PROMPT_GUIDELINES } from "./constants/promptGuidelines.mjs";
|
|
11
|
-
import { DEFAULT_PROMPT_SNIPPET, TaskToolDependencies, createTaskTool } from "./tools/task.mjs";
|
|
12
|
-
import { STORE_PATH_ENV, StoreSweepResult, hasStorePathOverride, lockPathFor, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, sweepStoreFiles, sweepStoreFilesAsync, tempPathFor } from "./services/paths/index.mjs";
|
|
13
|
-
import { ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ReconcileResult, ReconcileSelf, reconcileOrphanedDelegations } from "./services/reconcile/index.mjs";
|
|
14
|
-
import { deriveBlocks, detectCycle, isBlocked, isTaskListComplete, unresolvedBlockers } from "./models/taskGraph.mjs";
|
|
15
|
-
import { OverlayLayout, TaskCounts, TaskGroups, TaskProjection, countTasks, deriveTaskProjection, groupTasks, hasActiveWork, selectOverlayLayout, selectOverlayLayoutFromProjection, shouldShowIds, visibleTasks } from "./tui/selectors.mjs";
|
|
16
|
-
export { ApplyResult, AssignOptions, AssignmentItemResult, AssignmentSummary, BACKGROUND_WORK_PROVIDER, COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, COMMAND_NAME, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_TASKS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_PROMPT_GUIDELINES, DEFAULT_PROMPT_SNIPPET, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, DELETED_STATUS, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, DelegationPlatform, DelegationProgress, DelegationResult, DelegationState, DepToken, ERR_CANCEL_UNACKNOWLEDGED, ERR_CHILD_SESSION, ERR_NO_RUNTIME, ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ERR_REQUIRES_INTERACTIVE, MAX_BRIEF_FILES, MAX_TASKS_ENV, MAX_UPSERT_ITEMS, MAX_WIDGET_LINES_ENV, MSG_ALL_COMPLETE_CLEAR, MSG_ASSIGN_PARTIAL, MSG_NO_TASKS, MSG_UPSERT_FIELD_MISPLACED, MSG_UPSERT_NONE_APPLIED, MSG_UPSERT_PARTIAL, NOTIFY_CUSTOM_TYPE, Op, OverlayLayout, PiTaskConfig, REF_PATTERN, ReconcileResult, ReconcileSelf, ReducerAction, STORE_PATH_ENV, STORE_SCHEMA_VERSION, STORE_TTL_MS_ENV, StoreSweepResult, TASK_ACTIONS, TASK_ACTION_FIELDS, TASK_CONTEXTS, TASK_STATUSES, TOOL_LABEL, TOOL_NAME, Task, TaskAction, TaskAssignment, TaskAssignmentParams, TaskAssignmentSchema, TaskCounts, TaskDelegation, TaskDetails, TaskDocument, TaskGroups, TaskItemMutation, TaskItemParams, TaskItemSchema, TaskMutationParams, TaskParams, TaskParamsSchema, TaskProjection, TaskStatus, TaskStore, TaskStoreCommitListener, TaskStoreOptions, TaskToolDependencies, ToolResult, UpsertItemOutcome, UpsertSummary, applyTaskMutation, buildAssignmentResult, buildTextResult, buildToolResult, countTasks, createTaskTool, deriveBlocks, deriveTaskProjection, detectCycle, emptyDocument, formatAssignmentResults, formatContent, formatUpsertFailure, formatUpsertFailureText, getDelegationTimeoutMs, getMaxTasks, getMaxWidgetLines, getStoreTtlMs, groupTasks, hasActiveWork, hasStorePathOverride, isBlocked, isCommittingOp, isDelegationActive, isTaskListComplete, lockPathFor, parsePiTaskConfig, reconcileOrphanedDelegations, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveCollapseKey, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, selectOverlayLayout, selectOverlayLayoutFromProjection, shouldShowIds, singleItemOutcome, sweepStoreFiles, sweepStoreFilesAsync, taskActionAcceptsField, tempPathFor, unresolvedBlockers, visibleTasks };
|
package/dist/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{deriveBlocks as e,detectCycle as t,isBlocked as n,isTaskListComplete as r,unresolvedBlockers as i}from"./models/taskGraph.mjs";import{MAX_BRIEF_FILES as a}from"./types/delegation.mjs";import{DELETED_STATUS as o,STORE_SCHEMA_VERSION as s,emptyDocument as c,isDelegationActive as l}from"./models/task.mjs";import{ERR_ORPHANED_BY_RESTART as u,ERR_ORPHANED_BY_SESSION as d,reconcileOrphanedDelegations as f}from"./services/reconcile/index.mjs";import{BACKGROUND_WORK_PROVIDER as p,DelegationManager as m,ERR_CANCEL_UNACKNOWLEDGED as h,ERR_CHILD_SESSION as g,ERR_NO_RUNTIME as _,NOTIFY_CUSTOM_TYPE as v}from"./services/delegation/index.mjs";import{COMMAND_NAME as y}from"./constants/task.mjs";import{ERR_REQUIRES_INTERACTIVE as b,MSG_NO_TASKS as x,MSG_UPSERT_FIELD_MISPLACED as S,TASK_ACTIONS as C,TASK_ACTION_FIELDS as w,TASK_CONTEXTS as T,TASK_STATUSES as E,TOOL_LABEL as D,TOOL_NAME as O,TaskAssignmentSchema as k,TaskItemSchema as A,TaskParamsSchema as j,taskActionAcceptsField as M}from"./schemas/task.mjs";import{MSG_ALL_COMPLETE_CLEAR as N,MSG_ASSIGN_PARTIAL as P,MSG_UPSERT_NONE_APPLIED as F,MSG_UPSERT_PARTIAL as I,buildAssignmentResult as L,buildTextResult as R,buildToolResult as z,formatAssignmentResults as B,formatContent as V,formatUpsertFailureText as H}from"./services/taskResult/index.mjs";import{COLLAPSE_KEY_ENV as U,COLLAPSE_KEY_OFF as W,DEFAULT_COLLAPSE_KEY as G,DEFAULT_DELEGATION_TIMEOUT_MS as K,DEFAULT_MAX_TASKS as q,DEFAULT_MAX_WIDGET_LINES as J,DEFAULT_STORE_TTL_MS as Y,DELEGATION_TIMEOUT_MS_ENV as X,MAX_TASKS_ENV as Z,MAX_WIDGET_LINES_ENV as Q,STORE_TTL_MS_ENV as $,getDelegationTimeoutMs as ee,getMaxTasks as te,getMaxWidgetLines as ne,getStoreTtlMs as re,parsePiTaskConfig as ie,resolveCollapseKey as ae}from"./services/config/index.mjs";import{countTasks as oe,deriveTaskProjection as se,groupTasks as ce,hasActiveWork as le,selectOverlayLayout as ue,selectOverlayLayoutFromProjection as de,shouldShowIds as fe,visibleTasks as pe}from"./tui/selectors.mjs";import{DEFAULT_PROMPT_GUIDELINES as me}from"./constants/promptGuidelines.mjs";import{STORE_PATH_ENV as he,hasStorePathOverride as ge,lockPathFor as _e,removeLegacyStoreDirectory as ve,removeLegacyStoreDirectoryAsync as ye,resolveLegacyStoreDirectory as be,resolveLegacyStoreDirectoryAsync as xe,resolveSessionKey as Se,resolveStorePath as Ce,sweepStoreFiles as we,sweepStoreFilesAsync as Te,tempPathFor as Ee}from"./services/paths/index.mjs";import{TaskStore as De}from"./services/taskStore/index.mjs";import{MAX_UPSERT_ITEMS as Oe,REF_PATTERN as ke,applyTaskMutation as Ae,formatUpsertFailure as je,isCommittingOp as Me,singleItemOutcome as Ne}from"./services/reducer/index.mjs";import{DEFAULT_PROMPT_SNIPPET as Pe,createTaskTool as Fe}from"./tools/task.mjs";export{p as BACKGROUND_WORK_PROVIDER,U as COLLAPSE_KEY_ENV,W as COLLAPSE_KEY_OFF,y as COMMAND_NAME,G as DEFAULT_COLLAPSE_KEY,K as DEFAULT_DELEGATION_TIMEOUT_MS,q as DEFAULT_MAX_TASKS,J as DEFAULT_MAX_WIDGET_LINES,me as DEFAULT_PROMPT_GUIDELINES,Pe as DEFAULT_PROMPT_SNIPPET,Y as DEFAULT_STORE_TTL_MS,X as DELEGATION_TIMEOUT_MS_ENV,o as DELETED_STATUS,m as DelegationManager,h as ERR_CANCEL_UNACKNOWLEDGED,g as ERR_CHILD_SESSION,_ as ERR_NO_RUNTIME,u as ERR_ORPHANED_BY_RESTART,d as ERR_ORPHANED_BY_SESSION,b as ERR_REQUIRES_INTERACTIVE,a as MAX_BRIEF_FILES,Z as MAX_TASKS_ENV,Oe as MAX_UPSERT_ITEMS,Q as MAX_WIDGET_LINES_ENV,N as MSG_ALL_COMPLETE_CLEAR,P as MSG_ASSIGN_PARTIAL,x as MSG_NO_TASKS,S as MSG_UPSERT_FIELD_MISPLACED,F as MSG_UPSERT_NONE_APPLIED,I as MSG_UPSERT_PARTIAL,v as NOTIFY_CUSTOM_TYPE,ke as REF_PATTERN,he as STORE_PATH_ENV,s as STORE_SCHEMA_VERSION,$ as STORE_TTL_MS_ENV,C as TASK_ACTIONS,w as TASK_ACTION_FIELDS,T as TASK_CONTEXTS,E as TASK_STATUSES,D as TOOL_LABEL,O as TOOL_NAME,k as TaskAssignmentSchema,A as TaskItemSchema,j as TaskParamsSchema,De as TaskStore,Ae as applyTaskMutation,L as buildAssignmentResult,R as buildTextResult,z as buildToolResult,oe as countTasks,Fe as createTaskTool,e as deriveBlocks,se as deriveTaskProjection,t as detectCycle,c as emptyDocument,B as formatAssignmentResults,V as formatContent,je as formatUpsertFailure,H as formatUpsertFailureText,ee as getDelegationTimeoutMs,te as getMaxTasks,ne as getMaxWidgetLines,re as getStoreTtlMs,ce as groupTasks,le as hasActiveWork,ge as hasStorePathOverride,n as isBlocked,Me as isCommittingOp,l as isDelegationActive,r as isTaskListComplete,_e as lockPathFor,ie as parsePiTaskConfig,f as reconcileOrphanedDelegations,ve as removeLegacyStoreDirectory,ye as removeLegacyStoreDirectoryAsync,ae as resolveCollapseKey,be as resolveLegacyStoreDirectory,xe as resolveLegacyStoreDirectoryAsync,Se as resolveSessionKey,Ce as resolveStorePath,ue as selectOverlayLayout,de as selectOverlayLayoutFromProjection,fe as shouldShowIds,Ne as singleItemOutcome,we as sweepStoreFiles,Te as sweepStoreFilesAsync,M as taskActionAcceptsField,Ee as tempPathFor,i as unresolvedBlockers,pe as visibleTasks};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./types/telemetry.cjs"),t=require("./services/logSinkTelemetry/index.cjs");exports.TASK_EVENT=e.TASK_EVENT,exports.createTaskErrorReporter=t.createTaskErrorReporter,exports.toFailureReporter=t.toFailureReporter;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { TASK_EVENT, TaskErrorAttributes, TaskErrorSink, TaskEventName, TaskEventSink, TaskFailureReporter } from "./types/telemetry.cjs";
|
|
2
|
-
import { TaskErrorReporter, TaskErrorReporterOptions, createTaskErrorReporter, toFailureReporter } from "./services/logSinkTelemetry/index.cjs";
|
|
3
|
-
export { TASK_EVENT, type TaskErrorAttributes, TaskErrorReporter, TaskErrorReporterOptions, type TaskErrorSink, type TaskEventName, type TaskEventSink, type TaskFailureReporter, createTaskErrorReporter, toFailureReporter };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { TASK_EVENT, TaskErrorAttributes, TaskErrorSink, TaskEventName, TaskEventSink, TaskFailureReporter } from "./types/telemetry.mjs";
|
|
2
|
-
import { TaskErrorReporter, TaskErrorReporterOptions, createTaskErrorReporter, toFailureReporter } from "./services/logSinkTelemetry/index.mjs";
|
|
3
|
-
export { TASK_EVENT, type TaskErrorAttributes, TaskErrorReporter, TaskErrorReporterOptions, type TaskErrorSink, type TaskEventName, type TaskEventSink, type TaskFailureReporter, createTaskErrorReporter, toFailureReporter };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{TASK_EVENT as e}from"./types/telemetry.mjs";import{createTaskErrorReporter as t,toFailureReporter as n}from"./services/logSinkTelemetry/index.mjs";export{e as TASK_EVENT,t as createTaskErrorReporter,n as toFailureReporter};
|
package/dist/models/task.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function e(){return{version:1,rev:0,nextId:1,tasks:[]}}function t(e){let t=e.delegation?.state;return t===`requested`||t===`running`}exports.DELETED_STATUS=`deleted`,exports.STORE_SCHEMA_VERSION=1,exports.emptyDocument=e,exports.isDelegationActive=t;
|
|
2
|
-
//# sourceMappingURL=task.cjs.map
|
package/dist/models/task.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task.cjs","names":[],"sources":["../../src/models/task.ts"],"sourcesContent":["/**\n * Domain types for the file-backed task store.\n *\n * The on-disk document is the durable source of truth (unlike rpiv-todo, which\n * replayed state from the transcript). Every field here round-trips through\n * JSON, so nothing may hold non-serializable values.\n */\n\nimport type { InlineAgent } from '@agimon-ai/doompi-core/delegation';\n\nexport type TaskStatus = 'pending' | 'in_progress' | 'completed' | 'failed' | 'deleted';\n\nexport const DELETED_STATUS: TaskStatus = 'deleted';\n\nexport type TaskAction = 'upsert' | 'list' | 'get' | 'delete' | 'clear' | 'assign' | 'cancel';\n\nexport type DelegationState = 'requested' | 'running' | 'completed' | 'failed' | 'cancelled';\n\n/** Terminal result of a delegated subagent run, copied off the delegation response. */\nexport interface DelegationResult {\n status: string;\n output?: string;\n outputPath?: string;\n sessionFile?: string;\n error?: string;\n durationMs?: number;\n toolCount?: number;\n}\n\n/**\n * Delegation bookkeeping attached to a task that was handed to a subagent.\n *\n * `pid` is the harness process that owns the run: it is the only way to tell an\n * genuinely-running delegation from one orphaned by a harness crash, since the\n * child dies with its parent but the file survives.\n */\nexport interface TaskDelegation {\n requestId: string;\n agent: string;\n state: DelegationState;\n sessionId?: string;\n pid?: number;\n runId?: string;\n model?: string;\n startedAt?: string;\n endedAt?: string;\n result?: DelegationResult;\n}\n\nexport interface Task {\n id: number;\n subject: string;\n description?: string;\n activeForm?: string;\n status: TaskStatus;\n blockedBy?: number[];\n owner?: string;\n metadata?: Record<string, unknown>;\n createdAt?: string;\n updatedAt?: string;\n delegation?: TaskDelegation;\n}\n\nexport const STORE_SCHEMA_VERSION = 1;\n\n/** The complete on-disk document. `rev` increments on every committed write. */\nexport interface TaskDocument {\n version: number;\n rev: number;\n nextId: number;\n tasks: Task[];\n}\n\nexport function emptyDocument(): TaskDocument {\n return { version: STORE_SCHEMA_VERSION, rev: 0, nextId: 1, tasks: [] };\n}\n\n/**\n * A dependency target inside an upsert item: an existing task id, or the `ref`\n * of a task created earlier in the same call.\n *\n * Refs must start with a letter (see `REF_PATTERN`), so a ref is structurally\n * unconfusable with a stringified id and the discrimination is just `typeof`.\n */\nexport type DepToken = number | string;\n\n/**\n * One entry of an `upsert` call. No `id` creates a task; an `id` updates one.\n *\n * `blockedBy` (absolute set) is create-only and `addBlockedBy`/`removeBlockedBy`\n * (additive merge) are update-only, matching the split the two former actions\n * had. A field used against the wrong kind fails that item rather than being\n * silently ignored.\n */\nexport interface TaskItemMutation {\n id?: number;\n ref?: string;\n subject?: string;\n description?: string;\n activeForm?: string;\n status?: TaskStatus;\n blockedBy?: DepToken[];\n addBlockedBy?: DepToken[];\n removeBlockedBy?: DepToken[];\n owner?: string;\n metadata?: Record<string, unknown>;\n}\n\n/**\n * What one upsert item did. `index` is its position in the request array, so a\n * model reading a partial result can tell which entries still need resending.\n *\n * `message` is unprefixed: the `item[N] failed:` framing belongs to the\n * formatter, because the Task Space overlay shows this text on its own.\n */\nexport type UpsertItemOutcome =\n | {\n index: number;\n kind: 'created';\n id: number;\n subject: string;\n status: TaskStatus;\n ref?: string;\n blockedBy?: number[];\n }\n | { index: number; kind: 'updated'; id: number; fromStatus: TaskStatus; toStatus: TaskStatus }\n | { index: number; kind: 'unchanged'; id: number; status: TaskStatus }\n | { index: number; kind: 'failed'; message: string; id?: number; ref?: string };\n\n/** Which tasks an upsert touched, so renderResult names them instead of guessing. */\nexport interface UpsertSummary {\n /** Ids of applied entries, in request order. A failed entry contributes nothing. */\n applied: number[];\n failed: number;\n}\n\n/** One task-to-agent handoff inside a native assignment batch. */\nexport interface TaskAssignment {\n id: number;\n agent: string;\n inlineAgent?: InlineAgent;\n instructions?: string;\n relevantFiles?: string[];\n priorFindings?: string;\n model?: string;\n context?: 'fresh' | 'fork';\n}\n\n/** Which assignment entries started, so renderResult can show one consolidated batch. */\nexport interface AssignmentSummary {\n /** Ids of successful entries, in request order. A failed entry contributes nothing. */\n assigned: number[];\n failed: number;\n}\n\n/**\n * Open-shape input bag the reducer accepts. The index signature lets the\n * runtime pass a TypeBox `Static<typeof TaskParamsSchema>` through without\n * casting each field.\n *\n * Per-task fields live on `tasks[]`, not here: a top-level `subject` or\n * `status` would be ambiguous once one call can carry many tasks.\n */\nexport interface TaskMutationParams {\n [key: string]: unknown;\n tasks?: TaskItemMutation[];\n /** `assign` only: independent task-to-agent handoffs dispatched by one tool call. */\n assignments?: TaskAssignment[];\n /** `list` filter only. To set a status, upsert the task by id. */\n status?: TaskStatus;\n /** `get`, `delete`, and `cancel` only. Assign ids live in `assignments[]`. */\n id?: number;\n includeDeleted?: boolean;\n}\n\n/** Snapshot returned under a tool result's `details` for renderResult. */\nexport interface TaskDetails {\n action: TaskAction;\n params: Record<string, unknown>;\n tasks: Task[];\n nextId: number;\n rev: number;\n error?: string;\n upsert?: UpsertSummary;\n assignment?: AssignmentSummary;\n}\n\n/** A delegation is \"live\" while the owning run may still produce a response. */\nexport function isDelegationActive(task: Task): boolean {\n const state = task.delegation?.state;\n return state === 'requested' || state === 'running';\n}\n"],"mappings":"AAyEA,SAAgB,GAA8B,CAC5C,MAAO,CAAE,QAAA,EAA+B,IAAK,EAAG,OAAQ,EAAG,MAAO,CAAC,CAAE,CACvE,CAiHA,SAAgB,EAAmB,EAAqB,CACtD,IAAM,EAAQ,EAAK,YAAY,MAC/B,OAAO,IAAU,aAAe,IAAU,SAC5C"}
|
package/dist/models/task.d.cts
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { InlineAgent } from "@agimon-ai/doompi-core/delegation";
|
|
2
|
-
//#region src/models/task.d.ts
|
|
3
|
-
export type TaskStatus = 'pending' | 'in_progress' | 'completed' | 'failed' | 'deleted';
|
|
4
|
-
export declare const DELETED_STATUS: TaskStatus;
|
|
5
|
-
export type TaskAction = 'upsert' | 'list' | 'get' | 'delete' | 'clear' | 'assign' | 'cancel';
|
|
6
|
-
export type DelegationState = 'requested' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
7
|
-
/** Terminal result of a delegated subagent run, copied off the delegation response. */
|
|
8
|
-
export interface DelegationResult {
|
|
9
|
-
status: string;
|
|
10
|
-
output?: string;
|
|
11
|
-
outputPath?: string;
|
|
12
|
-
sessionFile?: string;
|
|
13
|
-
error?: string;
|
|
14
|
-
durationMs?: number;
|
|
15
|
-
toolCount?: number;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Delegation bookkeeping attached to a task that was handed to a subagent.
|
|
19
|
-
*
|
|
20
|
-
* `pid` is the harness process that owns the run: it is the only way to tell an
|
|
21
|
-
* genuinely-running delegation from one orphaned by a harness crash, since the
|
|
22
|
-
* child dies with its parent but the file survives.
|
|
23
|
-
*/
|
|
24
|
-
export interface TaskDelegation {
|
|
25
|
-
requestId: string;
|
|
26
|
-
agent: string;
|
|
27
|
-
state: DelegationState;
|
|
28
|
-
sessionId?: string;
|
|
29
|
-
pid?: number;
|
|
30
|
-
runId?: string;
|
|
31
|
-
model?: string;
|
|
32
|
-
startedAt?: string;
|
|
33
|
-
endedAt?: string;
|
|
34
|
-
result?: DelegationResult;
|
|
35
|
-
}
|
|
36
|
-
export interface Task {
|
|
37
|
-
id: number;
|
|
38
|
-
subject: string;
|
|
39
|
-
description?: string;
|
|
40
|
-
activeForm?: string;
|
|
41
|
-
status: TaskStatus;
|
|
42
|
-
blockedBy?: number[];
|
|
43
|
-
owner?: string;
|
|
44
|
-
metadata?: Record<string, unknown>;
|
|
45
|
-
createdAt?: string;
|
|
46
|
-
updatedAt?: string;
|
|
47
|
-
delegation?: TaskDelegation;
|
|
48
|
-
}
|
|
49
|
-
export declare const STORE_SCHEMA_VERSION = 1;
|
|
50
|
-
/** The complete on-disk document. `rev` increments on every committed write. */
|
|
51
|
-
export interface TaskDocument {
|
|
52
|
-
version: number;
|
|
53
|
-
rev: number;
|
|
54
|
-
nextId: number;
|
|
55
|
-
tasks: Task[];
|
|
56
|
-
}
|
|
57
|
-
export declare function emptyDocument(): TaskDocument;
|
|
58
|
-
/**
|
|
59
|
-
* A dependency target inside an upsert item: an existing task id, or the `ref`
|
|
60
|
-
* of a task created earlier in the same call.
|
|
61
|
-
*
|
|
62
|
-
* Refs must start with a letter (see `REF_PATTERN`), so a ref is structurally
|
|
63
|
-
* unconfusable with a stringified id and the discrimination is just `typeof`.
|
|
64
|
-
*/
|
|
65
|
-
export type DepToken = number | string;
|
|
66
|
-
/**
|
|
67
|
-
* One entry of an `upsert` call. No `id` creates a task; an `id` updates one.
|
|
68
|
-
*
|
|
69
|
-
* `blockedBy` (absolute set) is create-only and `addBlockedBy`/`removeBlockedBy`
|
|
70
|
-
* (additive merge) are update-only, matching the split the two former actions
|
|
71
|
-
* had. A field used against the wrong kind fails that item rather than being
|
|
72
|
-
* silently ignored.
|
|
73
|
-
*/
|
|
74
|
-
export interface TaskItemMutation {
|
|
75
|
-
id?: number;
|
|
76
|
-
ref?: string;
|
|
77
|
-
subject?: string;
|
|
78
|
-
description?: string;
|
|
79
|
-
activeForm?: string;
|
|
80
|
-
status?: TaskStatus;
|
|
81
|
-
blockedBy?: DepToken[];
|
|
82
|
-
addBlockedBy?: DepToken[];
|
|
83
|
-
removeBlockedBy?: DepToken[];
|
|
84
|
-
owner?: string;
|
|
85
|
-
metadata?: Record<string, unknown>;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* What one upsert item did. `index` is its position in the request array, so a
|
|
89
|
-
* model reading a partial result can tell which entries still need resending.
|
|
90
|
-
*
|
|
91
|
-
* `message` is unprefixed: the `item[N] failed:` framing belongs to the
|
|
92
|
-
* formatter, because the Task Space overlay shows this text on its own.
|
|
93
|
-
*/
|
|
94
|
-
export type UpsertItemOutcome = {
|
|
95
|
-
index: number;
|
|
96
|
-
kind: 'created';
|
|
97
|
-
id: number;
|
|
98
|
-
subject: string;
|
|
99
|
-
status: TaskStatus;
|
|
100
|
-
ref?: string;
|
|
101
|
-
blockedBy?: number[];
|
|
102
|
-
} | {
|
|
103
|
-
index: number;
|
|
104
|
-
kind: 'updated';
|
|
105
|
-
id: number;
|
|
106
|
-
fromStatus: TaskStatus;
|
|
107
|
-
toStatus: TaskStatus;
|
|
108
|
-
} | {
|
|
109
|
-
index: number;
|
|
110
|
-
kind: 'unchanged';
|
|
111
|
-
id: number;
|
|
112
|
-
status: TaskStatus;
|
|
113
|
-
} | {
|
|
114
|
-
index: number;
|
|
115
|
-
kind: 'failed';
|
|
116
|
-
message: string;
|
|
117
|
-
id?: number;
|
|
118
|
-
ref?: string;
|
|
119
|
-
};
|
|
120
|
-
/** Which tasks an upsert touched, so renderResult names them instead of guessing. */
|
|
121
|
-
export interface UpsertSummary {
|
|
122
|
-
/** Ids of applied entries, in request order. A failed entry contributes nothing. */
|
|
123
|
-
applied: number[];
|
|
124
|
-
failed: number;
|
|
125
|
-
}
|
|
126
|
-
/** One task-to-agent handoff inside a native assignment batch. */
|
|
127
|
-
export interface TaskAssignment {
|
|
128
|
-
id: number;
|
|
129
|
-
agent: string;
|
|
130
|
-
inlineAgent?: InlineAgent;
|
|
131
|
-
instructions?: string;
|
|
132
|
-
relevantFiles?: string[];
|
|
133
|
-
priorFindings?: string;
|
|
134
|
-
model?: string;
|
|
135
|
-
context?: 'fresh' | 'fork';
|
|
136
|
-
}
|
|
137
|
-
/** Which assignment entries started, so renderResult can show one consolidated batch. */
|
|
138
|
-
export interface AssignmentSummary {
|
|
139
|
-
/** Ids of successful entries, in request order. A failed entry contributes nothing. */
|
|
140
|
-
assigned: number[];
|
|
141
|
-
failed: number;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Open-shape input bag the reducer accepts. The index signature lets the
|
|
145
|
-
* runtime pass a TypeBox `Static<typeof TaskParamsSchema>` through without
|
|
146
|
-
* casting each field.
|
|
147
|
-
*
|
|
148
|
-
* Per-task fields live on `tasks[]`, not here: a top-level `subject` or
|
|
149
|
-
* `status` would be ambiguous once one call can carry many tasks.
|
|
150
|
-
*/
|
|
151
|
-
export interface TaskMutationParams {
|
|
152
|
-
[key: string]: unknown;
|
|
153
|
-
tasks?: TaskItemMutation[];
|
|
154
|
-
/** `assign` only: independent task-to-agent handoffs dispatched by one tool call. */
|
|
155
|
-
assignments?: TaskAssignment[];
|
|
156
|
-
/** `list` filter only. To set a status, upsert the task by id. */
|
|
157
|
-
status?: TaskStatus;
|
|
158
|
-
/** `get`, `delete`, and `cancel` only. Assign ids live in `assignments[]`. */
|
|
159
|
-
id?: number;
|
|
160
|
-
includeDeleted?: boolean;
|
|
161
|
-
}
|
|
162
|
-
/** Snapshot returned under a tool result's `details` for renderResult. */
|
|
163
|
-
export interface TaskDetails {
|
|
164
|
-
action: TaskAction;
|
|
165
|
-
params: Record<string, unknown>;
|
|
166
|
-
tasks: Task[];
|
|
167
|
-
nextId: number;
|
|
168
|
-
rev: number;
|
|
169
|
-
error?: string;
|
|
170
|
-
upsert?: UpsertSummary;
|
|
171
|
-
assignment?: AssignmentSummary;
|
|
172
|
-
}
|
|
173
|
-
/** A delegation is "live" while the owning run may still produce a response. */
|
|
174
|
-
export declare function isDelegationActive(task: Task): boolean;
|
|
175
|
-
//#endregion
|
|
176
|
-
//# sourceMappingURL=task.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task.d.cts","names":[],"sources":["../../src/models/task.ts"],"mappings":";;YAUY;qBAEC,gBAAgB;YAEjB;YAEA;;iBAGK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;iBAUe;EACf;EACA;EACA,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;;iBAGM;EACf;EACA;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA,WAAW;EACX;EACA;EACA,aAAa;;qBAGF;;iBAGI;EACf;EACA;EACA;EACA,OAAO;;wBAGO,iBAAiB;;;;;;;;YAWrB;;;;;;;;;iBAUK;EACf;EACA;EACA;EACA;EACA;EACA,SAAS;EACT,YAAY;EACZ,eAAe;EACf,kBAAkB;EAClB;EACA,WAAW;;;;;;;;;YAUD;EAEN;EACA;EACA;EACA;EACA,QAAQ;EACR;EACA;;EAEA;EAAe;EAAiB;EAAY,YAAY;EAAY,UAAU;;EAC9E;EAAe;EAAmB;EAAY,QAAQ;;EACtD;EAAe;EAAgB;EAAiB;EAAa;;;iBAGlD;;EAEf;EACA;;;iBAIe;EACf;EACA;EACA,cAAc;EACd;EACA;EACA;EACA;EACA;;;iBAIe;;EAEf;EACA;;;;;;;;;;iBAWe;GACd;EACD,QAAQ;;EAER,cAAc;;EAEd,SAAS;;EAET;EACA;;;iBAIe;EACf,QAAQ;EACR,QAAQ;EACR,OAAO;EACP;EACA;EACA;EACA,SAAS;EACT,aAAa;;;wBAIC,mBAAmB,MAAM"}
|
package/dist/models/task.d.mts
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { InlineAgent } from "@agimon-ai/doompi-core/delegation";
|
|
2
|
-
//#region src/models/task.d.ts
|
|
3
|
-
export type TaskStatus = 'pending' | 'in_progress' | 'completed' | 'failed' | 'deleted';
|
|
4
|
-
export declare const DELETED_STATUS: TaskStatus;
|
|
5
|
-
export type TaskAction = 'upsert' | 'list' | 'get' | 'delete' | 'clear' | 'assign' | 'cancel';
|
|
6
|
-
export type DelegationState = 'requested' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
7
|
-
/** Terminal result of a delegated subagent run, copied off the delegation response. */
|
|
8
|
-
export interface DelegationResult {
|
|
9
|
-
status: string;
|
|
10
|
-
output?: string;
|
|
11
|
-
outputPath?: string;
|
|
12
|
-
sessionFile?: string;
|
|
13
|
-
error?: string;
|
|
14
|
-
durationMs?: number;
|
|
15
|
-
toolCount?: number;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Delegation bookkeeping attached to a task that was handed to a subagent.
|
|
19
|
-
*
|
|
20
|
-
* `pid` is the harness process that owns the run: it is the only way to tell an
|
|
21
|
-
* genuinely-running delegation from one orphaned by a harness crash, since the
|
|
22
|
-
* child dies with its parent but the file survives.
|
|
23
|
-
*/
|
|
24
|
-
export interface TaskDelegation {
|
|
25
|
-
requestId: string;
|
|
26
|
-
agent: string;
|
|
27
|
-
state: DelegationState;
|
|
28
|
-
sessionId?: string;
|
|
29
|
-
pid?: number;
|
|
30
|
-
runId?: string;
|
|
31
|
-
model?: string;
|
|
32
|
-
startedAt?: string;
|
|
33
|
-
endedAt?: string;
|
|
34
|
-
result?: DelegationResult;
|
|
35
|
-
}
|
|
36
|
-
export interface Task {
|
|
37
|
-
id: number;
|
|
38
|
-
subject: string;
|
|
39
|
-
description?: string;
|
|
40
|
-
activeForm?: string;
|
|
41
|
-
status: TaskStatus;
|
|
42
|
-
blockedBy?: number[];
|
|
43
|
-
owner?: string;
|
|
44
|
-
metadata?: Record<string, unknown>;
|
|
45
|
-
createdAt?: string;
|
|
46
|
-
updatedAt?: string;
|
|
47
|
-
delegation?: TaskDelegation;
|
|
48
|
-
}
|
|
49
|
-
export declare const STORE_SCHEMA_VERSION = 1;
|
|
50
|
-
/** The complete on-disk document. `rev` increments on every committed write. */
|
|
51
|
-
export interface TaskDocument {
|
|
52
|
-
version: number;
|
|
53
|
-
rev: number;
|
|
54
|
-
nextId: number;
|
|
55
|
-
tasks: Task[];
|
|
56
|
-
}
|
|
57
|
-
export declare function emptyDocument(): TaskDocument;
|
|
58
|
-
/**
|
|
59
|
-
* A dependency target inside an upsert item: an existing task id, or the `ref`
|
|
60
|
-
* of a task created earlier in the same call.
|
|
61
|
-
*
|
|
62
|
-
* Refs must start with a letter (see `REF_PATTERN`), so a ref is structurally
|
|
63
|
-
* unconfusable with a stringified id and the discrimination is just `typeof`.
|
|
64
|
-
*/
|
|
65
|
-
export type DepToken = number | string;
|
|
66
|
-
/**
|
|
67
|
-
* One entry of an `upsert` call. No `id` creates a task; an `id` updates one.
|
|
68
|
-
*
|
|
69
|
-
* `blockedBy` (absolute set) is create-only and `addBlockedBy`/`removeBlockedBy`
|
|
70
|
-
* (additive merge) are update-only, matching the split the two former actions
|
|
71
|
-
* had. A field used against the wrong kind fails that item rather than being
|
|
72
|
-
* silently ignored.
|
|
73
|
-
*/
|
|
74
|
-
export interface TaskItemMutation {
|
|
75
|
-
id?: number;
|
|
76
|
-
ref?: string;
|
|
77
|
-
subject?: string;
|
|
78
|
-
description?: string;
|
|
79
|
-
activeForm?: string;
|
|
80
|
-
status?: TaskStatus;
|
|
81
|
-
blockedBy?: DepToken[];
|
|
82
|
-
addBlockedBy?: DepToken[];
|
|
83
|
-
removeBlockedBy?: DepToken[];
|
|
84
|
-
owner?: string;
|
|
85
|
-
metadata?: Record<string, unknown>;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* What one upsert item did. `index` is its position in the request array, so a
|
|
89
|
-
* model reading a partial result can tell which entries still need resending.
|
|
90
|
-
*
|
|
91
|
-
* `message` is unprefixed: the `item[N] failed:` framing belongs to the
|
|
92
|
-
* formatter, because the Task Space overlay shows this text on its own.
|
|
93
|
-
*/
|
|
94
|
-
export type UpsertItemOutcome = {
|
|
95
|
-
index: number;
|
|
96
|
-
kind: 'created';
|
|
97
|
-
id: number;
|
|
98
|
-
subject: string;
|
|
99
|
-
status: TaskStatus;
|
|
100
|
-
ref?: string;
|
|
101
|
-
blockedBy?: number[];
|
|
102
|
-
} | {
|
|
103
|
-
index: number;
|
|
104
|
-
kind: 'updated';
|
|
105
|
-
id: number;
|
|
106
|
-
fromStatus: TaskStatus;
|
|
107
|
-
toStatus: TaskStatus;
|
|
108
|
-
} | {
|
|
109
|
-
index: number;
|
|
110
|
-
kind: 'unchanged';
|
|
111
|
-
id: number;
|
|
112
|
-
status: TaskStatus;
|
|
113
|
-
} | {
|
|
114
|
-
index: number;
|
|
115
|
-
kind: 'failed';
|
|
116
|
-
message: string;
|
|
117
|
-
id?: number;
|
|
118
|
-
ref?: string;
|
|
119
|
-
};
|
|
120
|
-
/** Which tasks an upsert touched, so renderResult names them instead of guessing. */
|
|
121
|
-
export interface UpsertSummary {
|
|
122
|
-
/** Ids of applied entries, in request order. A failed entry contributes nothing. */
|
|
123
|
-
applied: number[];
|
|
124
|
-
failed: number;
|
|
125
|
-
}
|
|
126
|
-
/** One task-to-agent handoff inside a native assignment batch. */
|
|
127
|
-
export interface TaskAssignment {
|
|
128
|
-
id: number;
|
|
129
|
-
agent: string;
|
|
130
|
-
inlineAgent?: InlineAgent;
|
|
131
|
-
instructions?: string;
|
|
132
|
-
relevantFiles?: string[];
|
|
133
|
-
priorFindings?: string;
|
|
134
|
-
model?: string;
|
|
135
|
-
context?: 'fresh' | 'fork';
|
|
136
|
-
}
|
|
137
|
-
/** Which assignment entries started, so renderResult can show one consolidated batch. */
|
|
138
|
-
export interface AssignmentSummary {
|
|
139
|
-
/** Ids of successful entries, in request order. A failed entry contributes nothing. */
|
|
140
|
-
assigned: number[];
|
|
141
|
-
failed: number;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Open-shape input bag the reducer accepts. The index signature lets the
|
|
145
|
-
* runtime pass a TypeBox `Static<typeof TaskParamsSchema>` through without
|
|
146
|
-
* casting each field.
|
|
147
|
-
*
|
|
148
|
-
* Per-task fields live on `tasks[]`, not here: a top-level `subject` or
|
|
149
|
-
* `status` would be ambiguous once one call can carry many tasks.
|
|
150
|
-
*/
|
|
151
|
-
export interface TaskMutationParams {
|
|
152
|
-
[key: string]: unknown;
|
|
153
|
-
tasks?: TaskItemMutation[];
|
|
154
|
-
/** `assign` only: independent task-to-agent handoffs dispatched by one tool call. */
|
|
155
|
-
assignments?: TaskAssignment[];
|
|
156
|
-
/** `list` filter only. To set a status, upsert the task by id. */
|
|
157
|
-
status?: TaskStatus;
|
|
158
|
-
/** `get`, `delete`, and `cancel` only. Assign ids live in `assignments[]`. */
|
|
159
|
-
id?: number;
|
|
160
|
-
includeDeleted?: boolean;
|
|
161
|
-
}
|
|
162
|
-
/** Snapshot returned under a tool result's `details` for renderResult. */
|
|
163
|
-
export interface TaskDetails {
|
|
164
|
-
action: TaskAction;
|
|
165
|
-
params: Record<string, unknown>;
|
|
166
|
-
tasks: Task[];
|
|
167
|
-
nextId: number;
|
|
168
|
-
rev: number;
|
|
169
|
-
error?: string;
|
|
170
|
-
upsert?: UpsertSummary;
|
|
171
|
-
assignment?: AssignmentSummary;
|
|
172
|
-
}
|
|
173
|
-
/** A delegation is "live" while the owning run may still produce a response. */
|
|
174
|
-
export declare function isDelegationActive(task: Task): boolean;
|
|
175
|
-
//#endregion
|
|
176
|
-
//# sourceMappingURL=task.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task.d.mts","names":[],"sources":["../../src/models/task.ts"],"mappings":";;YAUY;qBAEC,gBAAgB;YAEjB;YAEA;;iBAGK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;iBAUe;EACf;EACA;EACA,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;;iBAGM;EACf;EACA;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA,WAAW;EACX;EACA;EACA,aAAa;;qBAGF;;iBAGI;EACf;EACA;EACA;EACA,OAAO;;wBAGO,iBAAiB;;;;;;;;YAWrB;;;;;;;;;iBAUK;EACf;EACA;EACA;EACA;EACA;EACA,SAAS;EACT,YAAY;EACZ,eAAe;EACf,kBAAkB;EAClB;EACA,WAAW;;;;;;;;;YAUD;EAEN;EACA;EACA;EACA;EACA,QAAQ;EACR;EACA;;EAEA;EAAe;EAAiB;EAAY,YAAY;EAAY,UAAU;;EAC9E;EAAe;EAAmB;EAAY,QAAQ;;EACtD;EAAe;EAAgB;EAAiB;EAAa;;;iBAGlD;;EAEf;EACA;;;iBAIe;EACf;EACA;EACA,cAAc;EACd;EACA;EACA;EACA;EACA;;;iBAIe;;EAEf;EACA;;;;;;;;;;iBAWe;GACd;EACD,QAAQ;;EAER,cAAc;;EAEd,SAAS;;EAET;EACA;;;iBAIe;EACf,QAAQ;EACR,QAAQ;EACR,OAAO;EACP;EACA;EACA;EACA,SAAS;EACT,aAAa;;;wBAIC,mBAAmB,MAAM"}
|
package/dist/models/task.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=`deleted`,t=1;function n(){return{version:1,rev:0,nextId:1,tasks:[]}}function r(e){let t=e.delegation?.state;return t===`requested`||t===`running`}export{e as DELETED_STATUS,t as STORE_SCHEMA_VERSION,n as emptyDocument,r as isDelegationActive};
|
|
2
|
-
//# sourceMappingURL=task.mjs.map
|
package/dist/models/task.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task.mjs","names":[],"sources":["../../src/models/task.ts"],"sourcesContent":["/**\n * Domain types for the file-backed task store.\n *\n * The on-disk document is the durable source of truth (unlike rpiv-todo, which\n * replayed state from the transcript). Every field here round-trips through\n * JSON, so nothing may hold non-serializable values.\n */\n\nimport type { InlineAgent } from '@agimon-ai/doompi-core/delegation';\n\nexport type TaskStatus = 'pending' | 'in_progress' | 'completed' | 'failed' | 'deleted';\n\nexport const DELETED_STATUS: TaskStatus = 'deleted';\n\nexport type TaskAction = 'upsert' | 'list' | 'get' | 'delete' | 'clear' | 'assign' | 'cancel';\n\nexport type DelegationState = 'requested' | 'running' | 'completed' | 'failed' | 'cancelled';\n\n/** Terminal result of a delegated subagent run, copied off the delegation response. */\nexport interface DelegationResult {\n status: string;\n output?: string;\n outputPath?: string;\n sessionFile?: string;\n error?: string;\n durationMs?: number;\n toolCount?: number;\n}\n\n/**\n * Delegation bookkeeping attached to a task that was handed to a subagent.\n *\n * `pid` is the harness process that owns the run: it is the only way to tell an\n * genuinely-running delegation from one orphaned by a harness crash, since the\n * child dies with its parent but the file survives.\n */\nexport interface TaskDelegation {\n requestId: string;\n agent: string;\n state: DelegationState;\n sessionId?: string;\n pid?: number;\n runId?: string;\n model?: string;\n startedAt?: string;\n endedAt?: string;\n result?: DelegationResult;\n}\n\nexport interface Task {\n id: number;\n subject: string;\n description?: string;\n activeForm?: string;\n status: TaskStatus;\n blockedBy?: number[];\n owner?: string;\n metadata?: Record<string, unknown>;\n createdAt?: string;\n updatedAt?: string;\n delegation?: TaskDelegation;\n}\n\nexport const STORE_SCHEMA_VERSION = 1;\n\n/** The complete on-disk document. `rev` increments on every committed write. */\nexport interface TaskDocument {\n version: number;\n rev: number;\n nextId: number;\n tasks: Task[];\n}\n\nexport function emptyDocument(): TaskDocument {\n return { version: STORE_SCHEMA_VERSION, rev: 0, nextId: 1, tasks: [] };\n}\n\n/**\n * A dependency target inside an upsert item: an existing task id, or the `ref`\n * of a task created earlier in the same call.\n *\n * Refs must start with a letter (see `REF_PATTERN`), so a ref is structurally\n * unconfusable with a stringified id and the discrimination is just `typeof`.\n */\nexport type DepToken = number | string;\n\n/**\n * One entry of an `upsert` call. No `id` creates a task; an `id` updates one.\n *\n * `blockedBy` (absolute set) is create-only and `addBlockedBy`/`removeBlockedBy`\n * (additive merge) are update-only, matching the split the two former actions\n * had. A field used against the wrong kind fails that item rather than being\n * silently ignored.\n */\nexport interface TaskItemMutation {\n id?: number;\n ref?: string;\n subject?: string;\n description?: string;\n activeForm?: string;\n status?: TaskStatus;\n blockedBy?: DepToken[];\n addBlockedBy?: DepToken[];\n removeBlockedBy?: DepToken[];\n owner?: string;\n metadata?: Record<string, unknown>;\n}\n\n/**\n * What one upsert item did. `index` is its position in the request array, so a\n * model reading a partial result can tell which entries still need resending.\n *\n * `message` is unprefixed: the `item[N] failed:` framing belongs to the\n * formatter, because the Task Space overlay shows this text on its own.\n */\nexport type UpsertItemOutcome =\n | {\n index: number;\n kind: 'created';\n id: number;\n subject: string;\n status: TaskStatus;\n ref?: string;\n blockedBy?: number[];\n }\n | { index: number; kind: 'updated'; id: number; fromStatus: TaskStatus; toStatus: TaskStatus }\n | { index: number; kind: 'unchanged'; id: number; status: TaskStatus }\n | { index: number; kind: 'failed'; message: string; id?: number; ref?: string };\n\n/** Which tasks an upsert touched, so renderResult names them instead of guessing. */\nexport interface UpsertSummary {\n /** Ids of applied entries, in request order. A failed entry contributes nothing. */\n applied: number[];\n failed: number;\n}\n\n/** One task-to-agent handoff inside a native assignment batch. */\nexport interface TaskAssignment {\n id: number;\n agent: string;\n inlineAgent?: InlineAgent;\n instructions?: string;\n relevantFiles?: string[];\n priorFindings?: string;\n model?: string;\n context?: 'fresh' | 'fork';\n}\n\n/** Which assignment entries started, so renderResult can show one consolidated batch. */\nexport interface AssignmentSummary {\n /** Ids of successful entries, in request order. A failed entry contributes nothing. */\n assigned: number[];\n failed: number;\n}\n\n/**\n * Open-shape input bag the reducer accepts. The index signature lets the\n * runtime pass a TypeBox `Static<typeof TaskParamsSchema>` through without\n * casting each field.\n *\n * Per-task fields live on `tasks[]`, not here: a top-level `subject` or\n * `status` would be ambiguous once one call can carry many tasks.\n */\nexport interface TaskMutationParams {\n [key: string]: unknown;\n tasks?: TaskItemMutation[];\n /** `assign` only: independent task-to-agent handoffs dispatched by one tool call. */\n assignments?: TaskAssignment[];\n /** `list` filter only. To set a status, upsert the task by id. */\n status?: TaskStatus;\n /** `get`, `delete`, and `cancel` only. Assign ids live in `assignments[]`. */\n id?: number;\n includeDeleted?: boolean;\n}\n\n/** Snapshot returned under a tool result's `details` for renderResult. */\nexport interface TaskDetails {\n action: TaskAction;\n params: Record<string, unknown>;\n tasks: Task[];\n nextId: number;\n rev: number;\n error?: string;\n upsert?: UpsertSummary;\n assignment?: AssignmentSummary;\n}\n\n/** A delegation is \"live\" while the owning run may still produce a response. */\nexport function isDelegationActive(task: Task): boolean {\n const state = task.delegation?.state;\n return state === 'requested' || state === 'running';\n}\n"],"mappings":"AAYA,MAAa,EAA6B,UAmD7B,EAAuB,EAUpC,SAAgB,GAA8B,CAC5C,MAAO,CAAE,QAAA,EAA+B,IAAK,EAAG,OAAQ,EAAG,MAAO,CAAC,CAAE,CACvE,CAiHA,SAAgB,EAAmB,EAAqB,CACtD,IAAM,EAAQ,EAAK,YAAY,MAC/B,OAAO,IAAU,aAAe,IAAU,SAC5C"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=`completed`,t=`deleted`;function n(n){let r=n.filter(e=>e.status!==t);return r.length>0&&r.every(t=>t.status===e)}function r(e,t,n){let r=new Map;for(let i of e)i.id===t?r.set(i.id,[...new Set([...i.blockedBy??[],...n])]):r.set(i.id,i.blockedBy?[...i.blockedBy]:[]);let i=new Set,a=new Set,o=e=>{if(i.has(e))return!0;if(a.has(e))return!1;i.add(e);for(let t of r.get(e)??[])if(o(t))return!0;return i.delete(e),a.add(e),!1};for(let e of r.keys())if(o(e))return!0;return!1}function i(e){let t=new Map;for(let n of e)for(let e of n.blockedBy??[]){let r=t.get(e)??[];r.push(n.id),t.set(e,r)}return t}function a(n,r){return(r.blockedBy??[]).filter(r=>{let i=n.find(e=>e.id===r);return i?i.status!==e&&i.status!==t:!1})}function o(e,t){return a(e,t).length>0}exports.deriveBlocks=i,exports.detectCycle=r,exports.isBlocked=o,exports.isTaskListComplete=n,exports.unresolvedBlockers=a;
|
|
2
|
-
//# sourceMappingURL=taskGraph.cjs.map
|