@agimon-ai/doompi-task 0.0.1-alpha.13 → 0.0.1-alpha.14

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.
Files changed (53) hide show
  1. package/dist/commands/task/promptGuidelines.cjs +1 -1
  2. package/dist/commands/task/promptGuidelines.cjs.map +1 -1
  3. package/dist/commands/task/promptGuidelines.mjs +1 -1
  4. package/dist/commands/task/promptGuidelines.mjs.map +1 -1
  5. package/dist/commands/task/responseEnvelope.cjs +6 -5
  6. package/dist/commands/task/responseEnvelope.cjs.map +1 -1
  7. package/dist/commands/task/responseEnvelope.d.cts +14 -2
  8. package/dist/commands/task/responseEnvelope.d.cts.map +1 -1
  9. package/dist/commands/task/responseEnvelope.d.mts +14 -2
  10. package/dist/commands/task/responseEnvelope.d.mts.map +1 -1
  11. package/dist/commands/task/responseEnvelope.mjs +6 -5
  12. package/dist/commands/task/responseEnvelope.mjs.map +1 -1
  13. package/dist/commands/task/taskTool.cjs +2 -2
  14. package/dist/commands/task/taskTool.cjs.map +1 -1
  15. package/dist/commands/task/taskTool.d.cts.map +1 -1
  16. package/dist/commands/task/taskTool.d.mts.map +1 -1
  17. package/dist/commands/task/taskTool.mjs +2 -2
  18. package/dist/commands/task/taskTool.mjs.map +1 -1
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.d.cts +4 -4
  21. package/dist/index.d.mts +4 -4
  22. package/dist/index.mjs +1 -1
  23. package/dist/schemas/task.cjs +1 -1
  24. package/dist/schemas/task.cjs.map +1 -1
  25. package/dist/schemas/task.d.cts +28 -11
  26. package/dist/schemas/task.d.cts.map +1 -1
  27. package/dist/schemas/task.d.mts +28 -11
  28. package/dist/schemas/task.d.mts.map +1 -1
  29. package/dist/schemas/task.mjs +1 -1
  30. package/dist/schemas/task.mjs.map +1 -1
  31. package/dist/services/store/types.cjs.map +1 -1
  32. package/dist/services/store/types.d.cts +22 -10
  33. package/dist/services/store/types.d.cts.map +1 -1
  34. package/dist/services/store/types.d.mts +22 -10
  35. package/dist/services/store/types.d.mts.map +1 -1
  36. package/dist/services/store/types.mjs.map +1 -1
  37. package/dist/store/types.d.cts +2 -2
  38. package/dist/store/types.d.mts +2 -2
  39. package/dist/tool/responseEnvelope.cjs +1 -1
  40. package/dist/tool/responseEnvelope.d.cts +2 -2
  41. package/dist/tool/responseEnvelope.d.mts +2 -2
  42. package/dist/tool/responseEnvelope.mjs +1 -1
  43. package/dist/tool/schema.cjs +1 -1
  44. package/dist/tool/schema.d.cts +2 -2
  45. package/dist/tool/schema.d.mts +2 -2
  46. package/dist/tool/schema.mjs +1 -1
  47. package/dist/tui/format.cjs +3 -3
  48. package/dist/tui/format.cjs.map +1 -1
  49. package/dist/tui/format.d.cts.map +1 -1
  50. package/dist/tui/format.d.mts.map +1 -1
  51. package/dist/tui/format.mjs +3 -3
  52. package/dist/tui/format.mjs.map +1 -1
  53. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"taskTool.mjs","names":[],"sources":["../../../src/commands/task/taskTool.ts"],"sourcesContent":["import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';\nimport { TASK_EVENT, type TaskFailureReporter } from '../../adapters/telemetry/logSinkTelemetry.ts';\nimport {\n MSG_UPSERT_FIELD_MISPLACED,\n TaskParamsSchema,\n TOOL_LABEL,\n TOOL_NAME,\n taskActionAcceptsField,\n} from '../../schemas/task.ts';\nimport type { DelegationManager, DelegationOutcome } from '../../services/delegation/manager.ts';\nimport { applyTaskMutation, isCommittingOp, type ReducerAction } from '../../services/store/reducer.ts';\nimport type { TaskStore } from '../../services/store/taskStore.ts';\nimport type { TaskAction, TaskMutationParams } from '../../services/store/types.ts';\nimport { renderTaskCall, renderTaskResult } from '../../tui/format.ts';\nimport { DEFAULT_PROMPT_GUIDELINES } from './promptGuidelines.ts';\nimport { buildTextResult, buildToolResult, formatUpsertFailureText, type ToolResult } from './responseEnvelope.ts';\n\nexport { DEFAULT_PROMPT_GUIDELINES } from './promptGuidelines.ts';\n\nexport const DEFAULT_PROMPT_SNIPPET =\n 'Manage a shared task list to track multi-step progress, and delegate tasks to subagents';\n\nexport interface TaskToolDependencies {\n store: TaskStore;\n delegation: DelegationManager;\n onChange?: () => void;\n report?: TaskFailureReporter;\n}\n\nconst ACTION_ATTRIBUTE = 'tool.action';\nconst TASK_ID_ATTRIBUTE = 'task.id';\n\nconst REDUCER_ACTIONS = new Set<TaskAction>(['upsert', 'list', 'get', 'delete', 'clear']);\n\nclass TaskToolExecutionError extends Error {}\n\nfunction actionableTaskError(action: TaskAction, message: string): TaskToolExecutionError {\n return new TaskToolExecutionError(\n [\n `Task ${action} failed: ${message}`,\n '',\n 'Options:',\n '- List the task board and inspect the current ids, states, and blockers.',\n '- Correct the arguments or state conflict, then retry once.',\n '- Ask the user before cancelling work or changing dependencies to recover.',\n ].join('\\n'),\n );\n}\n\n/**\n * Reject a field that belongs to a different action.\n *\n * The params schema is flat and shared across every action, so this is the only\n * place `{\"action\":\"upsert\",\"id\":3}` can be caught — and it must be, because\n * the entry it carries has no id and would silently create a duplicate task.\n */\nfunction rejectStrayFields(action: TaskAction, params: TaskMutationParams): void {\n const stray = Object.keys(params).filter((key) => params[key] !== undefined && !taskActionAcceptsField(action, key));\n if (stray.length === 0) return;\n const hint = action === 'upsert' ? ` ${MSG_UPSERT_FIELD_MISPLACED}` : '';\n throw actionableTaskError(action, `${action} does not accept ${stray.join(', ')}.${hint}`);\n}\n\n/** Run an action through the reducer, persisting only when it produced a change. */\nasync function executeReducerAction(\n store: TaskStore,\n action: ReducerAction,\n params: TaskMutationParams,\n): Promise<ToolResult> {\n const { document, value } = await store.mutate((current) => {\n const result = applyTaskMutation(current, action, params);\n return {\n ...(isCommittingOp(result.op) ? { document: result.document } : {}),\n value: result,\n };\n });\n if (value.op.kind === 'error') throw actionableTaskError(action, value.op.message);\n // An upsert that applied nothing is a failed call: it wrote nothing and left\n // `rev` alone, so it must not read to the model as a success. A batch where\n // some entries landed returns normally — that is what partial apply means.\n if (value.op.kind === 'upsert' && value.op.applied === 0) {\n throw actionableTaskError(action, formatUpsertFailureText(value.op));\n }\n // `document` is the committed document, so `details.rev` matches what landed\n // on disk; `value.document` is the pre-write copy and lags by one.\n return buildToolResult(action, params, document, value.op);\n}\n\nexport function registerTaskTool(pi: ExtensionAPI, dependencies: TaskToolDependencies): void {\n const { store, delegation } = dependencies;\n\n pi.registerTool({\n name: TOOL_NAME,\n label: TOOL_LABEL,\n description:\n 'Manage a shared task list for tracking multi-step progress, and delegate tasks to subagents. Actions: upsert (write tasks — a tasks[] array where an entry with an id changes that task and an entry without an id creates one, so one call can capture a whole plan), list, get, delete (tombstone), clear (close/reset the list), assign (hand the task to a named subagent that works it in the background), cancel (stop a delegated run). upsert applies each entry independently: successes are committed and failures are reported by array index, and an entry can depend on a task created by an earlier entry in the same call via a ref. Batch when writing a plan down; report progress one task at a time. Status: pending → in_progress → completed, plus failed and a deleted tombstone. The list is shared within the current session tree, including delegated subagents, while unrelated sessions start empty. Session stores persist until retention cleanup.',\n promptSnippet: DEFAULT_PROMPT_SNIPPET,\n promptGuidelines: DEFAULT_PROMPT_GUIDELINES,\n parameters: TaskParamsSchema,\n // Task rows carry their own status colors. Owning the shell prevents Pi's\n // pending/success/error background fill from obscuring those row states.\n renderShell: 'self',\n\n async execute(_toolCallId, params, signal, onUpdate, _ctx) {\n const action = params.action as TaskAction;\n const mutationParams = params as TaskMutationParams;\n\n try {\n rejectStrayFields(action, mutationParams);\n if (REDUCER_ACTIONS.has(action)) {\n const result = await executeReducerAction(store, action as ReducerAction, mutationParams);\n dependencies.onChange?.();\n return result;\n }\n\n let outcome: DelegationOutcome;\n if (action === 'assign') {\n onUpdate?.(\n buildTextResult(\n action,\n mutationParams,\n store.snapshot,\n `Delegating task #${mutationParams.id ?? 'unknown'}...`,\n ),\n );\n outcome = await delegation.assign(mutationParams.id ?? Number.NaN, {\n agent: mutationParams.agent,\n inlineAgent: mutationParams.inlineAgent,\n instructions: mutationParams.instructions,\n relevantFiles: mutationParams.relevantFiles,\n priorFindings: mutationParams.priorFindings,\n model: mutationParams.model,\n context: mutationParams.context,\n signal,\n });\n } else {\n onUpdate?.(\n buildTextResult(\n action,\n mutationParams,\n store.snapshot,\n `Requesting cancellation for task #${mutationParams.id ?? 'unknown'}...`,\n ),\n );\n outcome = await delegation.cancel(mutationParams.id ?? Number.NaN);\n }\n\n dependencies.onChange?.();\n if (!outcome.ok) throw actionableTaskError(action, outcome.message);\n return buildTextResult(action, mutationParams, store.snapshot, outcome.message, undefined);\n } catch (error) {\n // Rethrown so pi still renders the failure to the model; recorded\n // because this is where a store fault becomes visible to the user.\n dependencies.report?.error(TASK_EVENT.toolFailed, error, {\n [ACTION_ATTRIBUTE]: action,\n ...(mutationParams.id === undefined ? {} : { [TASK_ID_ATTRIBUTE]: mutationParams.id }),\n });\n if (error instanceof TaskToolExecutionError) throw error;\n throw actionableTaskError(action, error instanceof Error ? error.message : String(error));\n }\n },\n\n // Render hooks receive no session identity, so they read the store snapshot\n // that the executing session last loaded. That is the foreground session's\n // own view, which is exactly what its transcript should show.\n renderCall(args, theme, _context) {\n return renderTaskCall(args as never, theme, store.snapshot.tasks);\n },\n\n renderResult(result, options, theme, _context) {\n return renderTaskResult(result, options, theme);\n },\n });\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"taskTool.mjs","names":[],"sources":["../../../src/commands/task/taskTool.ts"],"sourcesContent":["import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';\nimport { TASK_EVENT, type TaskFailureReporter } from '../../adapters/telemetry/logSinkTelemetry.ts';\nimport {\n MSG_UPSERT_FIELD_MISPLACED,\n TaskParamsSchema,\n TOOL_LABEL,\n TOOL_NAME,\n taskActionAcceptsField,\n} from '../../schemas/task.ts';\nimport type { AssignOptions, DelegationManager, DelegationOutcome } from '../../services/delegation/manager.ts';\nimport { applyTaskMutation, isCommittingOp, type ReducerAction } from '../../services/store/reducer.ts';\nimport type { TaskStore } from '../../services/store/taskStore.ts';\nimport type { TaskAction, TaskAssignment, TaskMutationParams } from '../../services/store/types.ts';\nimport { renderTaskCall, renderTaskResult } from '../../tui/format.ts';\nimport { DEFAULT_PROMPT_GUIDELINES } from './promptGuidelines.ts';\nimport {\n buildAssignmentResult,\n buildTextResult,\n buildToolResult,\n formatAssignmentResults,\n formatUpsertFailureText,\n type AssignmentItemResult,\n type ToolResult,\n} from './responseEnvelope.ts';\n\nexport { DEFAULT_PROMPT_GUIDELINES } from './promptGuidelines.ts';\n\nexport const DEFAULT_PROMPT_SNIPPET =\n 'Manage a shared task list to track multi-step progress, and delegate tasks to subagents';\n\nexport interface TaskToolDependencies {\n store: TaskStore;\n delegation: DelegationManager;\n onChange?: () => void;\n report?: TaskFailureReporter;\n}\n\nconst ACTION_ATTRIBUTE = 'tool.action';\nconst TASK_ID_ATTRIBUTE = 'task.id';\nconst REDUCER_ACTIONS = new Set<TaskAction>(['upsert', 'list', 'get', 'delete', 'clear']);\n\nclass TaskToolExecutionError extends Error {}\n\nfunction actionableTaskError(action: TaskAction, message: string): TaskToolExecutionError {\n return new TaskToolExecutionError(\n [\n `Task ${action} failed: ${message}`,\n '',\n 'Options:',\n '- List the task board and inspect the current ids, states, and blockers.',\n '- Correct the arguments or state conflict, then retry once.',\n '- Ask the user before cancelling work or changing dependencies to recover.',\n ].join('\\n'),\n );\n}\n\n/**\n * Reject a field that belongs to a different action.\n *\n * The params schema is flat and shared across every action, so this is the only\n * place `{\"action\":\"upsert\",\"id\":3}` can be caught — and it must be, because\n * the entry it carries has no id and would silently create a duplicate task.\n */\nfunction rejectStrayFields(action: TaskAction, params: TaskMutationParams): void {\n const stray = Object.keys(params).filter((key) => params[key] !== undefined && !taskActionAcceptsField(action, key));\n if (stray.length === 0) return;\n const hint = action === 'upsert' ? ` ${MSG_UPSERT_FIELD_MISPLACED}` : '';\n throw actionableTaskError(action, `${action} does not accept ${stray.join(', ')}.${hint}`);\n}\n\n/** assignments[] is the only assign contract, even when it contains one task. */\nfunction resolveAssignments(params: TaskMutationParams): TaskAssignment[] {\n const assignments = params.assignments;\n if (!assignments || assignments.length === 0) {\n throw actionableTaskError('assign', 'assign requires a non-empty assignments[] array');\n }\n return assignments;\n}\n\nfunction assignOptions(request: TaskAssignment, signal: AbortSignal | undefined): AssignOptions {\n return {\n agent: request.agent,\n inlineAgent: request.inlineAgent,\n instructions: request.instructions,\n relevantFiles: request.relevantFiles,\n priorFindings: request.priorFindings,\n model: request.model,\n context: request.context,\n signal,\n };\n}\n\nasync function executeAssignmentBatch(\n delegation: DelegationManager,\n assignments: readonly TaskAssignment[],\n signal: AbortSignal | undefined,\n report: TaskFailureReporter | undefined,\n): Promise<AssignmentItemResult[]> {\n const results: AssignmentItemResult[] = [];\n for (const [index, assignment] of assignments.entries()) {\n let outcome: DelegationOutcome;\n try {\n outcome = await delegation.assign(assignment.id, assignOptions(assignment, signal));\n } catch (error) {\n report?.error(TASK_EVENT.toolFailed, error, {\n [ACTION_ATTRIBUTE]: 'assign',\n [TASK_ID_ATTRIBUTE]: assignment.id,\n });\n outcome = { ok: false, message: error instanceof Error ? error.message : String(error) };\n }\n results.push({ index, id: assignment.id, agent: assignment.agent, ...outcome });\n }\n return results;\n}\n\n/** Run an action through the reducer, persisting only when it produced a change. */\nasync function executeReducerAction(\n store: TaskStore,\n action: ReducerAction,\n params: TaskMutationParams,\n): Promise<ToolResult> {\n const { document, value } = await store.mutate((current) => {\n const result = applyTaskMutation(current, action, params);\n return {\n ...(isCommittingOp(result.op) ? { document: result.document } : {}),\n value: result,\n };\n });\n if (value.op.kind === 'error') throw actionableTaskError(action, value.op.message);\n // An upsert that applied nothing is a failed call: it wrote nothing and left\n // `rev` alone, so it must not read to the model as a success. A batch where\n // some entries landed returns normally — that is what partial apply means.\n if (value.op.kind === 'upsert' && value.op.applied === 0) {\n throw actionableTaskError(action, formatUpsertFailureText(value.op));\n }\n // `document` is the committed document, so `details.rev` matches what landed\n // on disk; `value.document` is the pre-write copy and lags by one.\n return buildToolResult(action, params, document, value.op);\n}\n\nexport function registerTaskTool(pi: ExtensionAPI, dependencies: TaskToolDependencies): void {\n const { store, delegation } = dependencies;\n\n pi.registerTool({\n name: TOOL_NAME,\n label: TOOL_LABEL,\n description:\n 'Manage a shared task list for tracking multi-step progress, and delegate tasks to subagents. Actions: upsert (write tasks — a tasks[] array where an entry with an id changes that task and an entry without an id creates one, so one call can capture a whole plan), list, get, delete (tombstone), clear (close/reset the list), assign (hand one or more tasks through assignments[] to named subagents that work in the background), cancel (stop a delegated run). upsert and assign apply entries independently: successes remain committed or delegated and failures are reported by array index. Batch a plan and independent assignments, but report progress one task at a time. Status: pending → in_progress → completed, plus failed and a deleted tombstone. The list is shared within the current session tree, including delegated subagents, while unrelated sessions start empty. Session stores persist until retention cleanup.',\n promptSnippet: DEFAULT_PROMPT_SNIPPET,\n promptGuidelines: DEFAULT_PROMPT_GUIDELINES,\n parameters: TaskParamsSchema,\n // Task rows carry their own status colors. Owning the shell prevents Pi's\n // pending/success/error background fill from obscuring those row states.\n renderShell: 'self',\n\n async execute(_toolCallId, params, signal, onUpdate, _ctx) {\n const action = params.action as TaskAction;\n const mutationParams = params as TaskMutationParams;\n\n try {\n rejectStrayFields(action, mutationParams);\n if (REDUCER_ACTIONS.has(action)) {\n const result = await executeReducerAction(store, action as ReducerAction, mutationParams);\n dependencies.onChange?.();\n return result;\n }\n\n if (action === 'assign') {\n const assignments = resolveAssignments(mutationParams);\n const first = assignments[0];\n const progress =\n assignments.length === 1 && first\n ? `Delegating task #${first.id}...`\n : `Delegating ${assignments.length} tasks...`;\n onUpdate?.(buildTextResult(action, mutationParams, store.snapshot, progress));\n const results = await executeAssignmentBatch(delegation, assignments, signal, dependencies.report);\n dependencies.onChange?.();\n const text = formatAssignmentResults(results);\n const assigned = results.flatMap((item) => (item.ok ? [item.id] : []));\n if (assigned.length === 0) throw actionableTaskError(action, text);\n return buildAssignmentResult(mutationParams, store.snapshot, text, {\n assigned,\n failed: results.length - assigned.length,\n });\n }\n\n onUpdate?.(\n buildTextResult(\n action,\n mutationParams,\n store.snapshot,\n `Requesting cancellation for task #${mutationParams.id ?? 'unknown'}...`,\n ),\n );\n const outcome = await delegation.cancel(mutationParams.id ?? Number.NaN);\n dependencies.onChange?.();\n if (!outcome.ok) throw actionableTaskError(action, outcome.message);\n return buildTextResult(action, mutationParams, store.snapshot, outcome.message, undefined);\n } catch (error) {\n // Rethrown so pi still renders the failure to the model; recorded\n // because this is where a store fault becomes visible to the user.\n dependencies.report?.error(TASK_EVENT.toolFailed, error, {\n [ACTION_ATTRIBUTE]: action,\n ...(mutationParams.id === undefined ? {} : { [TASK_ID_ATTRIBUTE]: mutationParams.id }),\n });\n if (error instanceof TaskToolExecutionError) throw error;\n throw actionableTaskError(action, error instanceof Error ? error.message : String(error));\n }\n },\n\n // Render hooks receive no session identity, so they read the store snapshot\n // that the executing session last loaded. That is the foreground session's\n // own view, which is exactly what its transcript should show.\n renderCall(args, theme, _context) {\n return renderTaskCall(args as never, theme, store.snapshot.tasks);\n },\n\n renderResult(result, options, theme, _context) {\n return renderTaskResult(result, options, theme);\n },\n });\n}\n"],"mappings":"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"}
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./services/store/types.cjs"),t=require("./services/store/reconcile.cjs"),n=require("./services/store/taskGraph.cjs"),r=require("./services/delegation/manager.cjs"),i=require("./schemas/task.cjs"),a=require("./services/store/reducer.cjs"),o=require("./tui/selectors.cjs"),s=require("./commands/task/promptGuidelines.cjs"),c=require("./commands/task/responseEnvelope.cjs"),l=require("./commands/task/taskTool.cjs"),u=require("./adapters/store/paths.cjs");require("./services/store/paths.cjs");const d=require("./adapters/store/taskStore.cjs");require("./services/store/taskStore.cjs");const f=require("./types/config.cjs"),p=require("./adapters/pi/extension.cjs");exports.BACKGROUND_WORK_PROVIDER=r.BACKGROUND_WORK_PROVIDER,exports.COLLAPSE_KEY_ENV=f.COLLAPSE_KEY_ENV,exports.COLLAPSE_KEY_OFF=f.COLLAPSE_KEY_OFF,exports.COMMAND_NAME=i.COMMAND_NAME,exports.DEFAULT_COLLAPSE_KEY=f.DEFAULT_COLLAPSE_KEY,exports.DEFAULT_DELEGATION_TIMEOUT_MS=f.DEFAULT_DELEGATION_TIMEOUT_MS,exports.DEFAULT_MAX_WIDGET_LINES=f.DEFAULT_MAX_WIDGET_LINES,exports.DEFAULT_PROMPT_GUIDELINES=s.DEFAULT_PROMPT_GUIDELINES,exports.DEFAULT_PROMPT_SNIPPET=l.DEFAULT_PROMPT_SNIPPET,exports.DEFAULT_STORE_TTL_MS=f.DEFAULT_STORE_TTL_MS,exports.DELEGATION_TIMEOUT_MS_ENV=f.DELEGATION_TIMEOUT_MS_ENV,exports.DELETED_STATUS=e.DELETED_STATUS,exports.DelegationManager=r.DelegationManager,exports.ERR_CANCEL_UNACKNOWLEDGED=r.ERR_CANCEL_UNACKNOWLEDGED,exports.ERR_CHILD_SESSION=r.ERR_CHILD_SESSION,exports.ERR_NO_RUNTIME=r.ERR_NO_RUNTIME,exports.ERR_ORPHANED_BY_RESTART=t.ERR_ORPHANED_BY_RESTART,exports.ERR_ORPHANED_BY_SESSION=t.ERR_ORPHANED_BY_SESSION,exports.ERR_REQUIRES_INTERACTIVE=i.ERR_REQUIRES_INTERACTIVE,exports.MAX_BRIEF_FILES=r.MAX_BRIEF_FILES,exports.MAX_UPSERT_ITEMS=a.MAX_UPSERT_ITEMS,exports.MAX_WIDGET_LINES_ENV=f.MAX_WIDGET_LINES_ENV,exports.MSG_ALL_COMPLETE_CLEAR=c.MSG_ALL_COMPLETE_CLEAR,exports.MSG_NO_TASKS=i.MSG_NO_TASKS,exports.MSG_UPSERT_FIELD_MISPLACED=i.MSG_UPSERT_FIELD_MISPLACED,exports.MSG_UPSERT_NONE_APPLIED=c.MSG_UPSERT_NONE_APPLIED,exports.MSG_UPSERT_PARTIAL=c.MSG_UPSERT_PARTIAL,exports.NOTIFY_CUSTOM_TYPE=r.NOTIFY_CUSTOM_TYPE,exports.REF_PATTERN=a.REF_PATTERN,exports.STORE_PATH_ENV=u.STORE_PATH_ENV,exports.STORE_SCHEMA_VERSION=e.STORE_SCHEMA_VERSION,exports.STORE_TTL_MS_ENV=f.STORE_TTL_MS_ENV,exports.TASK_ACTIONS=i.TASK_ACTIONS,exports.TASK_ACTION_FIELDS=i.TASK_ACTION_FIELDS,exports.TASK_CONTEXTS=i.TASK_CONTEXTS,exports.TASK_STATUSES=i.TASK_STATUSES,exports.TOOL_LABEL=i.TOOL_LABEL,exports.TOOL_NAME=i.TOOL_NAME,exports.TaskItemSchema=i.TaskItemSchema,exports.TaskParamsSchema=i.TaskParamsSchema,exports.TaskStore=d.TaskStore,exports.applyTaskMutation=a.applyTaskMutation,exports.buildTextResult=c.buildTextResult,exports.buildToolResult=c.buildToolResult,exports.countTasks=o.countTasks,exports.deriveBlocks=n.deriveBlocks,exports.deriveTaskProjection=o.deriveTaskProjection,exports.detectCycle=n.detectCycle,exports.emptyDocument=e.emptyDocument,exports.formatContent=c.formatContent,exports.formatUpsertFailure=a.formatUpsertFailure,exports.formatUpsertFailureText=c.formatUpsertFailureText,exports.getDelegationTimeoutMs=f.getDelegationTimeoutMs,exports.getMaxWidgetLines=f.getMaxWidgetLines,exports.getStoreTtlMs=f.getStoreTtlMs,exports.groupTasks=o.groupTasks,exports.hasActiveWork=o.hasActiveWork,exports.hasStorePathOverride=u.hasStorePathOverride,exports.isBlocked=n.isBlocked,exports.isCommittingOp=a.isCommittingOp,exports.isDelegationActive=e.isDelegationActive,exports.isTaskListComplete=n.isTaskListComplete,exports.lockPathFor=u.lockPathFor,exports.parsePiTaskConfig=f.parsePiTaskConfig,exports.reconcileOrphanedDelegations=t.reconcileOrphanedDelegations,exports.registerTaskTool=l.registerTaskTool,exports.removeLegacyStoreDirectory=u.removeLegacyStoreDirectory,exports.removeLegacyStoreDirectoryAsync=u.removeLegacyStoreDirectoryAsync,exports.resolveCollapseKey=f.resolveCollapseKey,exports.resolveLegacyStoreDirectory=u.resolveLegacyStoreDirectory,exports.resolveLegacyStoreDirectoryAsync=u.resolveLegacyStoreDirectoryAsync,exports.resolveSessionKey=u.resolveSessionKey,exports.resolveStorePath=u.resolveStorePath,exports.selectOverlayLayout=o.selectOverlayLayout,exports.selectOverlayLayoutFromProjection=o.selectOverlayLayoutFromProjection,exports.shouldShowIds=o.shouldShowIds,exports.singleItemOutcome=a.singleItemOutcome,exports.sweepStoreFiles=u.sweepStoreFiles,exports.sweepStoreFilesAsync=u.sweepStoreFilesAsync,exports.taskActionAcceptsField=i.taskActionAcceptsField,exports.taskExtension=p.default,exports.tempPathFor=u.tempPathFor,exports.unresolvedBlockers=n.unresolvedBlockers,exports.visibleTasks=o.visibleTasks;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./services/store/types.cjs"),t=require("./services/store/reconcile.cjs"),n=require("./services/store/taskGraph.cjs"),r=require("./services/delegation/manager.cjs"),i=require("./schemas/task.cjs"),a=require("./services/store/reducer.cjs"),o=require("./tui/selectors.cjs"),s=require("./commands/task/promptGuidelines.cjs"),c=require("./commands/task/responseEnvelope.cjs"),l=require("./commands/task/taskTool.cjs"),u=require("./adapters/store/paths.cjs");require("./services/store/paths.cjs");const d=require("./adapters/store/taskStore.cjs");require("./services/store/taskStore.cjs");const f=require("./types/config.cjs"),p=require("./adapters/pi/extension.cjs");exports.BACKGROUND_WORK_PROVIDER=r.BACKGROUND_WORK_PROVIDER,exports.COLLAPSE_KEY_ENV=f.COLLAPSE_KEY_ENV,exports.COLLAPSE_KEY_OFF=f.COLLAPSE_KEY_OFF,exports.COMMAND_NAME=i.COMMAND_NAME,exports.DEFAULT_COLLAPSE_KEY=f.DEFAULT_COLLAPSE_KEY,exports.DEFAULT_DELEGATION_TIMEOUT_MS=f.DEFAULT_DELEGATION_TIMEOUT_MS,exports.DEFAULT_MAX_WIDGET_LINES=f.DEFAULT_MAX_WIDGET_LINES,exports.DEFAULT_PROMPT_GUIDELINES=s.DEFAULT_PROMPT_GUIDELINES,exports.DEFAULT_PROMPT_SNIPPET=l.DEFAULT_PROMPT_SNIPPET,exports.DEFAULT_STORE_TTL_MS=f.DEFAULT_STORE_TTL_MS,exports.DELEGATION_TIMEOUT_MS_ENV=f.DELEGATION_TIMEOUT_MS_ENV,exports.DELETED_STATUS=e.DELETED_STATUS,exports.DelegationManager=r.DelegationManager,exports.ERR_CANCEL_UNACKNOWLEDGED=r.ERR_CANCEL_UNACKNOWLEDGED,exports.ERR_CHILD_SESSION=r.ERR_CHILD_SESSION,exports.ERR_NO_RUNTIME=r.ERR_NO_RUNTIME,exports.ERR_ORPHANED_BY_RESTART=t.ERR_ORPHANED_BY_RESTART,exports.ERR_ORPHANED_BY_SESSION=t.ERR_ORPHANED_BY_SESSION,exports.ERR_REQUIRES_INTERACTIVE=i.ERR_REQUIRES_INTERACTIVE,exports.MAX_BRIEF_FILES=r.MAX_BRIEF_FILES,exports.MAX_UPSERT_ITEMS=a.MAX_UPSERT_ITEMS,exports.MAX_WIDGET_LINES_ENV=f.MAX_WIDGET_LINES_ENV,exports.MSG_ALL_COMPLETE_CLEAR=c.MSG_ALL_COMPLETE_CLEAR,exports.MSG_ASSIGN_PARTIAL=c.MSG_ASSIGN_PARTIAL,exports.MSG_NO_TASKS=i.MSG_NO_TASKS,exports.MSG_UPSERT_FIELD_MISPLACED=i.MSG_UPSERT_FIELD_MISPLACED,exports.MSG_UPSERT_NONE_APPLIED=c.MSG_UPSERT_NONE_APPLIED,exports.MSG_UPSERT_PARTIAL=c.MSG_UPSERT_PARTIAL,exports.NOTIFY_CUSTOM_TYPE=r.NOTIFY_CUSTOM_TYPE,exports.REF_PATTERN=a.REF_PATTERN,exports.STORE_PATH_ENV=u.STORE_PATH_ENV,exports.STORE_SCHEMA_VERSION=e.STORE_SCHEMA_VERSION,exports.STORE_TTL_MS_ENV=f.STORE_TTL_MS_ENV,exports.TASK_ACTIONS=i.TASK_ACTIONS,exports.TASK_ACTION_FIELDS=i.TASK_ACTION_FIELDS,exports.TASK_CONTEXTS=i.TASK_CONTEXTS,exports.TASK_STATUSES=i.TASK_STATUSES,exports.TOOL_LABEL=i.TOOL_LABEL,exports.TOOL_NAME=i.TOOL_NAME,exports.TaskAssignmentSchema=i.TaskAssignmentSchema,exports.TaskItemSchema=i.TaskItemSchema,exports.TaskParamsSchema=i.TaskParamsSchema,exports.TaskStore=d.TaskStore,exports.applyTaskMutation=a.applyTaskMutation,exports.buildAssignmentResult=c.buildAssignmentResult,exports.buildTextResult=c.buildTextResult,exports.buildToolResult=c.buildToolResult,exports.countTasks=o.countTasks,exports.deriveBlocks=n.deriveBlocks,exports.deriveTaskProjection=o.deriveTaskProjection,exports.detectCycle=n.detectCycle,exports.emptyDocument=e.emptyDocument,exports.formatAssignmentResults=c.formatAssignmentResults,exports.formatContent=c.formatContent,exports.formatUpsertFailure=a.formatUpsertFailure,exports.formatUpsertFailureText=c.formatUpsertFailureText,exports.getDelegationTimeoutMs=f.getDelegationTimeoutMs,exports.getMaxWidgetLines=f.getMaxWidgetLines,exports.getStoreTtlMs=f.getStoreTtlMs,exports.groupTasks=o.groupTasks,exports.hasActiveWork=o.hasActiveWork,exports.hasStorePathOverride=u.hasStorePathOverride,exports.isBlocked=n.isBlocked,exports.isCommittingOp=a.isCommittingOp,exports.isDelegationActive=e.isDelegationActive,exports.isTaskListComplete=n.isTaskListComplete,exports.lockPathFor=u.lockPathFor,exports.parsePiTaskConfig=f.parsePiTaskConfig,exports.reconcileOrphanedDelegations=t.reconcileOrphanedDelegations,exports.registerTaskTool=l.registerTaskTool,exports.removeLegacyStoreDirectory=u.removeLegacyStoreDirectory,exports.removeLegacyStoreDirectoryAsync=u.removeLegacyStoreDirectoryAsync,exports.resolveCollapseKey=f.resolveCollapseKey,exports.resolveLegacyStoreDirectory=u.resolveLegacyStoreDirectory,exports.resolveLegacyStoreDirectoryAsync=u.resolveLegacyStoreDirectoryAsync,exports.resolveSessionKey=u.resolveSessionKey,exports.resolveStorePath=u.resolveStorePath,exports.selectOverlayLayout=o.selectOverlayLayout,exports.selectOverlayLayoutFromProjection=o.selectOverlayLayoutFromProjection,exports.shouldShowIds=o.shouldShowIds,exports.singleItemOutcome=a.singleItemOutcome,exports.sweepStoreFiles=u.sweepStoreFiles,exports.sweepStoreFilesAsync=u.sweepStoreFilesAsync,exports.taskActionAcceptsField=i.taskActionAcceptsField,exports.taskExtension=p.default,exports.tempPathFor=u.tempPathFor,exports.unresolvedBlockers=n.unresolvedBlockers,exports.visibleTasks=o.visibleTasks;
package/dist/index.d.cts CHANGED
@@ -1,16 +1,16 @@
1
- import { DELETED_STATUS, DelegationResult, DelegationState, DepToken, STORE_SCHEMA_VERSION, Task, TaskAction, TaskDelegation, TaskDetails, TaskDocument, TaskItemMutation, TaskMutationParams, TaskStatus, UpsertItemOutcome, UpsertSummary, emptyDocument, isDelegationActive } from "./services/store/types.cjs";
1
+ import { AssignmentSummary, DELETED_STATUS, DelegationResult, DelegationState, DepToken, STORE_SCHEMA_VERSION, Task, TaskAction, TaskAssignment, TaskDelegation, TaskDetails, TaskDocument, TaskItemMutation, TaskMutationParams, TaskStatus, UpsertItemOutcome, UpsertSummary, emptyDocument, isDelegationActive } from "./services/store/types.cjs";
2
2
  import { TaskStore, TaskStoreCommitListener, TaskStoreOptions } from "./adapters/store/taskStore.cjs";
3
3
  import "./services/store/taskStore.cjs";
4
4
  import { COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, MAX_WIDGET_LINES_ENV, PiTaskConfig, STORE_TTL_MS_ENV, getDelegationTimeoutMs, getMaxWidgetLines, getStoreTtlMs, parsePiTaskConfig, resolveCollapseKey } from "./types/config.cjs";
5
5
  import { AssignOptions, BACKGROUND_WORK_PROVIDER, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, DelegationProgress, ERR_CANCEL_UNACKNOWLEDGED, ERR_CHILD_SESSION, ERR_NO_RUNTIME, MAX_BRIEF_FILES, NOTIFY_CUSTOM_TYPE } from "./services/delegation/manager.cjs";
6
6
  import taskExtension from "./adapters/pi/extension.cjs";
7
7
  import { ApplyResult, MAX_UPSERT_ITEMS, Op, REF_PATTERN, ReducerAction, applyTaskMutation, formatUpsertFailure, isCommittingOp, singleItemOutcome } from "./services/store/reducer.cjs";
8
- import { MSG_ALL_COMPLETE_CLEAR, MSG_UPSERT_NONE_APPLIED, MSG_UPSERT_PARTIAL, ToolResult, buildTextResult, buildToolResult, formatContent, formatUpsertFailureText } from "./commands/task/responseEnvelope.cjs";
8
+ import { AssignmentItemResult, MSG_ALL_COMPLETE_CLEAR, MSG_ASSIGN_PARTIAL, MSG_UPSERT_NONE_APPLIED, MSG_UPSERT_PARTIAL, ToolResult, buildAssignmentResult, buildTextResult, buildToolResult, formatAssignmentResults, formatContent, formatUpsertFailureText } from "./commands/task/responseEnvelope.cjs";
9
9
  import { DEFAULT_PROMPT_GUIDELINES } from "./commands/task/promptGuidelines.cjs";
10
10
  import { DEFAULT_PROMPT_SNIPPET, TaskToolDependencies, registerTaskTool } from "./commands/task/taskTool.cjs";
11
- import { COMMAND_NAME, ERR_REQUIRES_INTERACTIVE, MSG_NO_TASKS, MSG_UPSERT_FIELD_MISPLACED, TASK_ACTIONS, TASK_ACTION_FIELDS, TASK_CONTEXTS, TASK_STATUSES, TOOL_LABEL, TOOL_NAME, TaskItemParams, TaskItemSchema, TaskParams, TaskParamsSchema, taskActionAcceptsField } from "./schemas/task.cjs";
11
+ import { COMMAND_NAME, ERR_REQUIRES_INTERACTIVE, MSG_NO_TASKS, MSG_UPSERT_FIELD_MISPLACED, TASK_ACTIONS, TASK_ACTION_FIELDS, TASK_CONTEXTS, TASK_STATUSES, TOOL_LABEL, TOOL_NAME, TaskAssignmentParams, TaskAssignmentSchema, TaskItemParams, TaskItemSchema, TaskParams, TaskParamsSchema, taskActionAcceptsField } from "./schemas/task.cjs";
12
12
  import { STORE_PATH_ENV, StoreSweepResult, hasStorePathOverride, lockPathFor, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, sweepStoreFiles, sweepStoreFilesAsync, tempPathFor } from "./adapters/store/paths.cjs";
13
13
  import { ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ReconcileResult, ReconcileSelf, reconcileOrphanedDelegations } from "./services/store/reconcile.cjs";
14
14
  import { deriveBlocks, detectCycle, isBlocked, isTaskListComplete, unresolvedBlockers } from "./services/store/taskGraph.cjs";
15
15
  import { OverlayLayout, TaskCounts, TaskGroups, TaskProjection, countTasks, deriveTaskProjection, groupTasks, hasActiveWork, selectOverlayLayout, selectOverlayLayoutFromProjection, shouldShowIds, visibleTasks } from "./tui/selectors.cjs";
16
- export { ApplyResult, AssignOptions, BACKGROUND_WORK_PROVIDER, COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, COMMAND_NAME, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_PROMPT_GUIDELINES, DEFAULT_PROMPT_SNIPPET, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, DELETED_STATUS, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, 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_UPSERT_ITEMS, MAX_WIDGET_LINES_ENV, MSG_ALL_COMPLETE_CLEAR, 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, type StoreSweepResult, TASK_ACTIONS, TASK_ACTION_FIELDS, TASK_CONTEXTS, TASK_STATUSES, TOOL_LABEL, TOOL_NAME, Task, TaskAction, TaskCounts, TaskDelegation, TaskDetails, TaskDocument, TaskGroups, TaskItemMutation, TaskItemParams, TaskItemSchema, TaskMutationParams, TaskParams, TaskParamsSchema, TaskProjection, TaskStatus, TaskStore, type TaskStoreCommitListener, type TaskStoreOptions, TaskToolDependencies, ToolResult, UpsertItemOutcome, UpsertSummary, applyTaskMutation, buildTextResult, buildToolResult, countTasks, deriveBlocks, deriveTaskProjection, detectCycle, emptyDocument, formatContent, formatUpsertFailure, formatUpsertFailureText, getDelegationTimeoutMs, getMaxWidgetLines, getStoreTtlMs, groupTasks, hasActiveWork, hasStorePathOverride, isBlocked, isCommittingOp, isDelegationActive, isTaskListComplete, lockPathFor, parsePiTaskConfig, reconcileOrphanedDelegations, registerTaskTool, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveCollapseKey, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, selectOverlayLayout, selectOverlayLayoutFromProjection, shouldShowIds, singleItemOutcome, sweepStoreFiles, sweepStoreFilesAsync, taskActionAcceptsField, taskExtension, tempPathFor, unresolvedBlockers, visibleTasks };
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_WIDGET_LINES, DEFAULT_PROMPT_GUIDELINES, DEFAULT_PROMPT_SNIPPET, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, DELETED_STATUS, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, 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_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, type 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, type TaskStoreCommitListener, type TaskStoreOptions, TaskToolDependencies, ToolResult, UpsertItemOutcome, UpsertSummary, applyTaskMutation, buildAssignmentResult, buildTextResult, buildToolResult, countTasks, deriveBlocks, deriveTaskProjection, detectCycle, emptyDocument, formatAssignmentResults, formatContent, formatUpsertFailure, formatUpsertFailureText, getDelegationTimeoutMs, getMaxWidgetLines, getStoreTtlMs, groupTasks, hasActiveWork, hasStorePathOverride, isBlocked, isCommittingOp, isDelegationActive, isTaskListComplete, lockPathFor, parsePiTaskConfig, reconcileOrphanedDelegations, registerTaskTool, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveCollapseKey, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, selectOverlayLayout, selectOverlayLayoutFromProjection, shouldShowIds, singleItemOutcome, sweepStoreFiles, sweepStoreFilesAsync, taskActionAcceptsField, taskExtension, tempPathFor, unresolvedBlockers, visibleTasks };
package/dist/index.d.mts CHANGED
@@ -1,16 +1,16 @@
1
- import { DELETED_STATUS, DelegationResult, DelegationState, DepToken, STORE_SCHEMA_VERSION, Task, TaskAction, TaskDelegation, TaskDetails, TaskDocument, TaskItemMutation, TaskMutationParams, TaskStatus, UpsertItemOutcome, UpsertSummary, emptyDocument, isDelegationActive } from "./services/store/types.mjs";
1
+ import { AssignmentSummary, DELETED_STATUS, DelegationResult, DelegationState, DepToken, STORE_SCHEMA_VERSION, Task, TaskAction, TaskAssignment, TaskDelegation, TaskDetails, TaskDocument, TaskItemMutation, TaskMutationParams, TaskStatus, UpsertItemOutcome, UpsertSummary, emptyDocument, isDelegationActive } from "./services/store/types.mjs";
2
2
  import { TaskStore, TaskStoreCommitListener, TaskStoreOptions } from "./adapters/store/taskStore.mjs";
3
3
  import "./services/store/taskStore.mjs";
4
4
  import { COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, MAX_WIDGET_LINES_ENV, PiTaskConfig, STORE_TTL_MS_ENV, getDelegationTimeoutMs, getMaxWidgetLines, getStoreTtlMs, parsePiTaskConfig, resolveCollapseKey } from "./types/config.mjs";
5
5
  import { AssignOptions, BACKGROUND_WORK_PROVIDER, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, DelegationProgress, ERR_CANCEL_UNACKNOWLEDGED, ERR_CHILD_SESSION, ERR_NO_RUNTIME, MAX_BRIEF_FILES, NOTIFY_CUSTOM_TYPE } from "./services/delegation/manager.mjs";
6
6
  import taskExtension from "./adapters/pi/extension.mjs";
7
7
  import { ApplyResult, MAX_UPSERT_ITEMS, Op, REF_PATTERN, ReducerAction, applyTaskMutation, formatUpsertFailure, isCommittingOp, singleItemOutcome } from "./services/store/reducer.mjs";
8
- import { MSG_ALL_COMPLETE_CLEAR, MSG_UPSERT_NONE_APPLIED, MSG_UPSERT_PARTIAL, ToolResult, buildTextResult, buildToolResult, formatContent, formatUpsertFailureText } from "./commands/task/responseEnvelope.mjs";
8
+ import { AssignmentItemResult, MSG_ALL_COMPLETE_CLEAR, MSG_ASSIGN_PARTIAL, MSG_UPSERT_NONE_APPLIED, MSG_UPSERT_PARTIAL, ToolResult, buildAssignmentResult, buildTextResult, buildToolResult, formatAssignmentResults, formatContent, formatUpsertFailureText } from "./commands/task/responseEnvelope.mjs";
9
9
  import { DEFAULT_PROMPT_GUIDELINES } from "./commands/task/promptGuidelines.mjs";
10
10
  import { DEFAULT_PROMPT_SNIPPET, TaskToolDependencies, registerTaskTool } from "./commands/task/taskTool.mjs";
11
- import { COMMAND_NAME, ERR_REQUIRES_INTERACTIVE, MSG_NO_TASKS, MSG_UPSERT_FIELD_MISPLACED, TASK_ACTIONS, TASK_ACTION_FIELDS, TASK_CONTEXTS, TASK_STATUSES, TOOL_LABEL, TOOL_NAME, TaskItemParams, TaskItemSchema, TaskParams, TaskParamsSchema, taskActionAcceptsField } from "./schemas/task.mjs";
11
+ import { COMMAND_NAME, ERR_REQUIRES_INTERACTIVE, MSG_NO_TASKS, MSG_UPSERT_FIELD_MISPLACED, TASK_ACTIONS, TASK_ACTION_FIELDS, TASK_CONTEXTS, TASK_STATUSES, TOOL_LABEL, TOOL_NAME, TaskAssignmentParams, TaskAssignmentSchema, TaskItemParams, TaskItemSchema, TaskParams, TaskParamsSchema, taskActionAcceptsField } from "./schemas/task.mjs";
12
12
  import { STORE_PATH_ENV, StoreSweepResult, hasStorePathOverride, lockPathFor, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, sweepStoreFiles, sweepStoreFilesAsync, tempPathFor } from "./adapters/store/paths.mjs";
13
13
  import { ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ReconcileResult, ReconcileSelf, reconcileOrphanedDelegations } from "./services/store/reconcile.mjs";
14
14
  import { deriveBlocks, detectCycle, isBlocked, isTaskListComplete, unresolvedBlockers } from "./services/store/taskGraph.mjs";
15
15
  import { OverlayLayout, TaskCounts, TaskGroups, TaskProjection, countTasks, deriveTaskProjection, groupTasks, hasActiveWork, selectOverlayLayout, selectOverlayLayoutFromProjection, shouldShowIds, visibleTasks } from "./tui/selectors.mjs";
16
- export { ApplyResult, AssignOptions, BACKGROUND_WORK_PROVIDER, COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, COMMAND_NAME, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_PROMPT_GUIDELINES, DEFAULT_PROMPT_SNIPPET, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, DELETED_STATUS, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, 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_UPSERT_ITEMS, MAX_WIDGET_LINES_ENV, MSG_ALL_COMPLETE_CLEAR, 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, type StoreSweepResult, TASK_ACTIONS, TASK_ACTION_FIELDS, TASK_CONTEXTS, TASK_STATUSES, TOOL_LABEL, TOOL_NAME, Task, TaskAction, TaskCounts, TaskDelegation, TaskDetails, TaskDocument, TaskGroups, TaskItemMutation, TaskItemParams, TaskItemSchema, TaskMutationParams, TaskParams, TaskParamsSchema, TaskProjection, TaskStatus, TaskStore, type TaskStoreCommitListener, type TaskStoreOptions, TaskToolDependencies, ToolResult, UpsertItemOutcome, UpsertSummary, applyTaskMutation, buildTextResult, buildToolResult, countTasks, deriveBlocks, deriveTaskProjection, detectCycle, emptyDocument, formatContent, formatUpsertFailure, formatUpsertFailureText, getDelegationTimeoutMs, getMaxWidgetLines, getStoreTtlMs, groupTasks, hasActiveWork, hasStorePathOverride, isBlocked, isCommittingOp, isDelegationActive, isTaskListComplete, lockPathFor, parsePiTaskConfig, reconcileOrphanedDelegations, registerTaskTool, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveCollapseKey, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, selectOverlayLayout, selectOverlayLayoutFromProjection, shouldShowIds, singleItemOutcome, sweepStoreFiles, sweepStoreFilesAsync, taskActionAcceptsField, taskExtension, tempPathFor, unresolvedBlockers, visibleTasks };
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_WIDGET_LINES, DEFAULT_PROMPT_GUIDELINES, DEFAULT_PROMPT_SNIPPET, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, DELETED_STATUS, DelegationManager, DelegationManagerOptions, DelegationNotifier, DelegationOutcome, 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_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, type 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, type TaskStoreCommitListener, type TaskStoreOptions, TaskToolDependencies, ToolResult, UpsertItemOutcome, UpsertSummary, applyTaskMutation, buildAssignmentResult, buildTextResult, buildToolResult, countTasks, deriveBlocks, deriveTaskProjection, detectCycle, emptyDocument, formatAssignmentResults, formatContent, formatUpsertFailure, formatUpsertFailureText, getDelegationTimeoutMs, getMaxWidgetLines, getStoreTtlMs, groupTasks, hasActiveWork, hasStorePathOverride, isBlocked, isCommittingOp, isDelegationActive, isTaskListComplete, lockPathFor, parsePiTaskConfig, reconcileOrphanedDelegations, registerTaskTool, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveCollapseKey, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, selectOverlayLayout, selectOverlayLayoutFromProjection, shouldShowIds, singleItemOutcome, sweepStoreFiles, sweepStoreFilesAsync, taskActionAcceptsField, taskExtension, tempPathFor, unresolvedBlockers, visibleTasks };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{DELETED_STATUS as e,STORE_SCHEMA_VERSION as t,emptyDocument as n,isDelegationActive as r}from"./services/store/types.mjs";import{ERR_ORPHANED_BY_RESTART as i,ERR_ORPHANED_BY_SESSION as a,reconcileOrphanedDelegations as o}from"./services/store/reconcile.mjs";import{deriveBlocks as s,detectCycle as c,isBlocked as l,isTaskListComplete as u,unresolvedBlockers as d}from"./services/store/taskGraph.mjs";import{BACKGROUND_WORK_PROVIDER as f,DelegationManager as p,ERR_CANCEL_UNACKNOWLEDGED as m,ERR_CHILD_SESSION as h,ERR_NO_RUNTIME as g,MAX_BRIEF_FILES as _,NOTIFY_CUSTOM_TYPE as v}from"./services/delegation/manager.mjs";import{COMMAND_NAME as y,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,TaskItemSchema as k,TaskParamsSchema as A,taskActionAcceptsField as j}from"./schemas/task.mjs";import{MAX_UPSERT_ITEMS as M,REF_PATTERN as N,applyTaskMutation as P,formatUpsertFailure as F,isCommittingOp as I,singleItemOutcome as L}from"./services/store/reducer.mjs";import{countTasks as R,deriveTaskProjection as z,groupTasks as B,hasActiveWork as V,selectOverlayLayout as H,selectOverlayLayoutFromProjection as U,shouldShowIds as W,visibleTasks as G}from"./tui/selectors.mjs";import{DEFAULT_PROMPT_GUIDELINES as K}from"./commands/task/promptGuidelines.mjs";import{MSG_ALL_COMPLETE_CLEAR as q,MSG_UPSERT_NONE_APPLIED as J,MSG_UPSERT_PARTIAL as Y,buildTextResult as X,buildToolResult as Z,formatContent as Q,formatUpsertFailureText as $}from"./commands/task/responseEnvelope.mjs";import{DEFAULT_PROMPT_SNIPPET as ee,registerTaskTool as te}from"./commands/task/taskTool.mjs";import{STORE_PATH_ENV as ne,hasStorePathOverride as re,lockPathFor as ie,removeLegacyStoreDirectory as ae,removeLegacyStoreDirectoryAsync as oe,resolveLegacyStoreDirectory as se,resolveLegacyStoreDirectoryAsync as ce,resolveSessionKey as le,resolveStorePath as ue,sweepStoreFiles as de,sweepStoreFilesAsync as fe,tempPathFor as pe}from"./adapters/store/paths.mjs";import"./services/store/paths.mjs";import{TaskStore as me}from"./adapters/store/taskStore.mjs";import"./services/store/taskStore.mjs";import{COLLAPSE_KEY_ENV as he,COLLAPSE_KEY_OFF as ge,DEFAULT_COLLAPSE_KEY as _e,DEFAULT_DELEGATION_TIMEOUT_MS as ve,DEFAULT_MAX_WIDGET_LINES as ye,DEFAULT_STORE_TTL_MS as be,DELEGATION_TIMEOUT_MS_ENV as xe,MAX_WIDGET_LINES_ENV as Se,STORE_TTL_MS_ENV as Ce,getDelegationTimeoutMs as we,getMaxWidgetLines as Te,getStoreTtlMs as Ee,parsePiTaskConfig as De,resolveCollapseKey as Oe}from"./types/config.mjs";import ke from"./adapters/pi/extension.mjs";export{f as BACKGROUND_WORK_PROVIDER,he as COLLAPSE_KEY_ENV,ge as COLLAPSE_KEY_OFF,y as COMMAND_NAME,_e as DEFAULT_COLLAPSE_KEY,ve as DEFAULT_DELEGATION_TIMEOUT_MS,ye as DEFAULT_MAX_WIDGET_LINES,K as DEFAULT_PROMPT_GUIDELINES,ee as DEFAULT_PROMPT_SNIPPET,be as DEFAULT_STORE_TTL_MS,xe as DELEGATION_TIMEOUT_MS_ENV,e as DELETED_STATUS,p as DelegationManager,m as ERR_CANCEL_UNACKNOWLEDGED,h as ERR_CHILD_SESSION,g as ERR_NO_RUNTIME,i as ERR_ORPHANED_BY_RESTART,a as ERR_ORPHANED_BY_SESSION,b as ERR_REQUIRES_INTERACTIVE,_ as MAX_BRIEF_FILES,M as MAX_UPSERT_ITEMS,Se as MAX_WIDGET_LINES_ENV,q as MSG_ALL_COMPLETE_CLEAR,x as MSG_NO_TASKS,S as MSG_UPSERT_FIELD_MISPLACED,J as MSG_UPSERT_NONE_APPLIED,Y as MSG_UPSERT_PARTIAL,v as NOTIFY_CUSTOM_TYPE,N as REF_PATTERN,ne as STORE_PATH_ENV,t as STORE_SCHEMA_VERSION,Ce 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 TaskItemSchema,A as TaskParamsSchema,me as TaskStore,P as applyTaskMutation,X as buildTextResult,Z as buildToolResult,R as countTasks,s as deriveBlocks,z as deriveTaskProjection,c as detectCycle,n as emptyDocument,Q as formatContent,F as formatUpsertFailure,$ as formatUpsertFailureText,we as getDelegationTimeoutMs,Te as getMaxWidgetLines,Ee as getStoreTtlMs,B as groupTasks,V as hasActiveWork,re as hasStorePathOverride,l as isBlocked,I as isCommittingOp,r as isDelegationActive,u as isTaskListComplete,ie as lockPathFor,De as parsePiTaskConfig,o as reconcileOrphanedDelegations,te as registerTaskTool,ae as removeLegacyStoreDirectory,oe as removeLegacyStoreDirectoryAsync,Oe as resolveCollapseKey,se as resolveLegacyStoreDirectory,ce as resolveLegacyStoreDirectoryAsync,le as resolveSessionKey,ue as resolveStorePath,H as selectOverlayLayout,U as selectOverlayLayoutFromProjection,W as shouldShowIds,L as singleItemOutcome,de as sweepStoreFiles,fe as sweepStoreFilesAsync,j as taskActionAcceptsField,ke as taskExtension,pe as tempPathFor,d as unresolvedBlockers,G as visibleTasks};
1
+ import{DELETED_STATUS as e,STORE_SCHEMA_VERSION as t,emptyDocument as n,isDelegationActive as r}from"./services/store/types.mjs";import{ERR_ORPHANED_BY_RESTART as i,ERR_ORPHANED_BY_SESSION as a,reconcileOrphanedDelegations as o}from"./services/store/reconcile.mjs";import{deriveBlocks as s,detectCycle as c,isBlocked as l,isTaskListComplete as u,unresolvedBlockers as d}from"./services/store/taskGraph.mjs";import{BACKGROUND_WORK_PROVIDER as f,DelegationManager as p,ERR_CANCEL_UNACKNOWLEDGED as m,ERR_CHILD_SESSION as h,ERR_NO_RUNTIME as g,MAX_BRIEF_FILES as _,NOTIFY_CUSTOM_TYPE as v}from"./services/delegation/manager.mjs";import{COMMAND_NAME as y,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{MAX_UPSERT_ITEMS as N,REF_PATTERN as P,applyTaskMutation as F,formatUpsertFailure as I,isCommittingOp as L,singleItemOutcome as R}from"./services/store/reducer.mjs";import{countTasks as z,deriveTaskProjection as B,groupTasks as V,hasActiveWork as H,selectOverlayLayout as U,selectOverlayLayoutFromProjection as W,shouldShowIds as G,visibleTasks as K}from"./tui/selectors.mjs";import{DEFAULT_PROMPT_GUIDELINES as q}from"./commands/task/promptGuidelines.mjs";import{MSG_ALL_COMPLETE_CLEAR as J,MSG_ASSIGN_PARTIAL as Y,MSG_UPSERT_NONE_APPLIED as X,MSG_UPSERT_PARTIAL as Z,buildAssignmentResult as Q,buildTextResult as $,buildToolResult as ee,formatAssignmentResults as te,formatContent as ne,formatUpsertFailureText as re}from"./commands/task/responseEnvelope.mjs";import{DEFAULT_PROMPT_SNIPPET as ie,registerTaskTool as ae}from"./commands/task/taskTool.mjs";import{STORE_PATH_ENV as oe,hasStorePathOverride as se,lockPathFor as ce,removeLegacyStoreDirectory as le,removeLegacyStoreDirectoryAsync as ue,resolveLegacyStoreDirectory as de,resolveLegacyStoreDirectoryAsync as fe,resolveSessionKey as pe,resolveStorePath as me,sweepStoreFiles as he,sweepStoreFilesAsync as ge,tempPathFor as _e}from"./adapters/store/paths.mjs";import"./services/store/paths.mjs";import{TaskStore as ve}from"./adapters/store/taskStore.mjs";import"./services/store/taskStore.mjs";import{COLLAPSE_KEY_ENV as ye,COLLAPSE_KEY_OFF as be,DEFAULT_COLLAPSE_KEY as xe,DEFAULT_DELEGATION_TIMEOUT_MS as Se,DEFAULT_MAX_WIDGET_LINES as Ce,DEFAULT_STORE_TTL_MS as we,DELEGATION_TIMEOUT_MS_ENV as Te,MAX_WIDGET_LINES_ENV as Ee,STORE_TTL_MS_ENV as De,getDelegationTimeoutMs as Oe,getMaxWidgetLines as ke,getStoreTtlMs as Ae,parsePiTaskConfig as je,resolveCollapseKey as Me}from"./types/config.mjs";import Ne from"./adapters/pi/extension.mjs";export{f as BACKGROUND_WORK_PROVIDER,ye as COLLAPSE_KEY_ENV,be as COLLAPSE_KEY_OFF,y as COMMAND_NAME,xe as DEFAULT_COLLAPSE_KEY,Se as DEFAULT_DELEGATION_TIMEOUT_MS,Ce as DEFAULT_MAX_WIDGET_LINES,q as DEFAULT_PROMPT_GUIDELINES,ie as DEFAULT_PROMPT_SNIPPET,we as DEFAULT_STORE_TTL_MS,Te as DELEGATION_TIMEOUT_MS_ENV,e as DELETED_STATUS,p as DelegationManager,m as ERR_CANCEL_UNACKNOWLEDGED,h as ERR_CHILD_SESSION,g as ERR_NO_RUNTIME,i as ERR_ORPHANED_BY_RESTART,a as ERR_ORPHANED_BY_SESSION,b as ERR_REQUIRES_INTERACTIVE,_ as MAX_BRIEF_FILES,N as MAX_UPSERT_ITEMS,Ee as MAX_WIDGET_LINES_ENV,J as MSG_ALL_COMPLETE_CLEAR,Y as MSG_ASSIGN_PARTIAL,x as MSG_NO_TASKS,S as MSG_UPSERT_FIELD_MISPLACED,X as MSG_UPSERT_NONE_APPLIED,Z as MSG_UPSERT_PARTIAL,v as NOTIFY_CUSTOM_TYPE,P as REF_PATTERN,oe as STORE_PATH_ENV,t as STORE_SCHEMA_VERSION,De 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,ve as TaskStore,F as applyTaskMutation,Q as buildAssignmentResult,$ as buildTextResult,ee as buildToolResult,z as countTasks,s as deriveBlocks,B as deriveTaskProjection,c as detectCycle,n as emptyDocument,te as formatAssignmentResults,ne as formatContent,I as formatUpsertFailure,re as formatUpsertFailureText,Oe as getDelegationTimeoutMs,ke as getMaxWidgetLines,Ae as getStoreTtlMs,V as groupTasks,H as hasActiveWork,se as hasStorePathOverride,l as isBlocked,L as isCommittingOp,r as isDelegationActive,u as isTaskListComplete,ce as lockPathFor,je as parsePiTaskConfig,o as reconcileOrphanedDelegations,ae as registerTaskTool,le as removeLegacyStoreDirectory,ue as removeLegacyStoreDirectoryAsync,Me as resolveCollapseKey,de as resolveLegacyStoreDirectory,fe as resolveLegacyStoreDirectoryAsync,pe as resolveSessionKey,me as resolveStorePath,U as selectOverlayLayout,W as selectOverlayLayoutFromProjection,G as shouldShowIds,R as singleItemOutcome,he as sweepStoreFiles,ge as sweepStoreFilesAsync,M as taskActionAcceptsField,Ne as taskExtension,_e as tempPathFor,d as unresolvedBlockers,K as visibleTasks};
@@ -1,2 +1,2 @@
1
- require("../services/delegation/manager.cjs");let e=require("@agimon-ai/doompi-extension-contracts/subagent-tool"),t=require("typebox");const n=[`upsert`,`list`,`get`,`delete`,`clear`,`assign`,`cancel`],r=[`pending`,`in_progress`,`completed`,`failed`,`deleted`],i=[`fresh`,`fork`],a={upsert:[`action`,`tasks`],list:[`action`,`status`,`includeDeleted`],get:[`action`,`id`],delete:[`action`,`id`],clear:[`action`],assign:[`action`,`id`,`agent`,`inlineAgent`,`instructions`,`relevantFiles`,`priorFindings`,`model`,`context`],cancel:[`action`,`id`]};function o(e,t){return a[e].includes(t)}const s=t.Type.Union([t.Type.Integer(),t.Type.String()]),c=t.Type.Object({id:t.Type.Optional(t.Type.Integer({description:`Existing task id to change. Omit to create a new task. An entry with an id never creates: if the id is unknown, only that entry fails.`})),ref:t.Type.Optional(t.Type.String({description:`Temporary name for a task created by this entry, so a LATER entry in the same tasks[] can list it in blockedBy before its real id exists. Must start with a letter. Scoped to this one call and never stored; the response reports which real id it became.`})),subject:t.Type.Optional(t.Type.String({description:`Short imperative subject line (e.g. 'Research existing tool'). Required when the entry has no id; on an entry with an id it renames the task.`})),description:t.Type.Optional(t.Type.String({description:`Long-form task detail. This becomes the brief handed to the subagent when the task is assigned.`})),activeForm:t.Type.Optional(t.Type.String({description:`Present-continuous spinner label shown while status is in_progress (e.g. 'writing tests')`})),status:t.Type.Optional(t.Type.String({enum:[...r],description:`Starting status for a new entry (default pending; deleted is rejected), or the target status for an entry with an id, where the transition must be legal.`})),blockedBy:t.Type.Optional(t.Type.Array(s,{description:`Dependencies for a NEW entry (one with no id): this task is blocked by each target. A number is an existing task id; a string is the ref of a task created by an EARLIER entry in this same array. Use addBlockedBy / removeBlockedBy on an entry that has an id.`})),addBlockedBy:t.Type.Optional(t.Type.Array(s,{description:`Dependencies to add, for an entry with an id. Task ids, or refs declared by an earlier entry. Additive merge — do not resend the full array.`})),removeBlockedBy:t.Type.Optional(t.Type.Array(s,{description:`Dependencies to remove, for an entry with an id. Additive merge — do not resend the full array.`})),owner:t.Type.Optional(t.Type.String({description:`Owner label for this task. assign sets this to the subagent name automatically.`})),metadata:t.Type.Optional(t.Type.Record(t.Type.String(),t.Type.Unknown(),{description:`Arbitrary metadata merged into the task; pass null as a value to delete that key`}))},{additionalProperties:!1}),l=t.Type.Object({action:t.Type.String({enum:[...n],description:`upsert (create new tasks and change existing ones, one or many per call), list, get, delete (tombstone), clear (close/reset the list), assign (delegate to a subagent), cancel (stop a delegated run)`}),tasks:t.Type.Optional(t.Type.Array(c,{minItems:1,description:`upsert only. One entry per task: an entry with an id changes that task, an entry without an id creates one. Entries apply in array order, so a later entry can depend on an earlier one by ref. Each entry succeeds or fails on its own: the ones that succeed are committed and the ones that fail are reported by their array index.`})),id:t.Type.Optional(t.Type.Integer({description:`Task id, for get, delete, assign and cancel. upsert does not accept this field — put the id inside the tasks[] entry you want to change.`})),status:t.Type.Optional(t.Type.String({enum:[...r],description:`list only: return just the tasks in this status. To SET a status, use upsert with the task id inside tasks[].`})),includeDeleted:t.Type.Optional(t.Type.Boolean({description:`If true, list returns deleted (tombstoned) tasks as well. Default: false.`})),agent:t.Type.Optional(t.Type.String({description:`Name of the subagent to delegate this task to (required for assign)`})),inlineAgent:t.Type.Optional(e.InlineAgentSchema),instructions:t.Type.Optional(t.Type.String({description:`Extra instructions appended to the delegated brief (assign only)`})),relevantFiles:t.Type.Optional(t.Type.Array(t.Type.String(),{description:`Files you have ALREADY read or located that the subagent should open first (assign only). Paths relative to the working directory. A child starts with none of your context and otherwise spends most of its run rediscovering the repo. Send only files you actually looked at — a guessed path costs the child more than an omitted one. At most 12; extras are dropped.`})),priorFindings:t.Type.Optional(t.Type.String({description:`What you already established about this task and the subagent should not re-derive (assign only): symbol names, call sites, the approach you chose, what you already ruled out. Facts you discovered, not directives — put directives in instructions. Keep it to a few lines; it is truncated past ~1500 characters.`})),model:t.Type.Optional(t.Type.String({description:`Model override for the delegated run (assign only)`})),context:t.Type.Optional(t.Type.String({enum:[...i],description:`Subagent starting context (assign only): 'fresh' starts clean, 'fork' inherits this conversation. If omitted, uses the agent default, then fresh.`}))});exports.COMMAND_NAME=`tasks`,exports.ERR_REQUIRES_INTERACTIVE=`/tasks requires interactive mode`,exports.MSG_NO_TASKS=`No tasks yet. Ask the agent to add some!`,exports.MSG_UPSERT_FIELD_MISPLACED=`Per-task fields belong inside each tasks[] entry, not at the top level: {"action":"upsert","tasks":[{"id":3,"status":"completed"}]}.`,exports.TASK_ACTIONS=n,exports.TASK_ACTION_FIELDS=a,exports.TASK_CONTEXTS=i,exports.TASK_STATUSES=r,exports.TOOL_LABEL=`Task`,exports.TOOL_NAME=`task`,exports.TaskItemSchema=c,exports.TaskParamsSchema=l,exports.taskActionAcceptsField=o;
1
+ require("../services/delegation/manager.cjs");let e=require("@agimon-ai/doompi-extension-contracts/subagent-tool"),t=require("typebox");const n=[`upsert`,`list`,`get`,`delete`,`clear`,`assign`,`cancel`],r=[`pending`,`in_progress`,`completed`,`failed`,`deleted`],i=[`fresh`,`fork`],a={upsert:[`action`,`tasks`],list:[`action`,`status`,`includeDeleted`],get:[`action`,`id`],delete:[`action`,`id`],clear:[`action`],assign:[`action`,`assignments`],cancel:[`action`,`id`]};function o(e,t){return a[e].includes(t)}const s=t.Type.Union([t.Type.Integer(),t.Type.String()]),c=t.Type.Object({id:t.Type.Optional(t.Type.Integer({description:`Existing task id to change. Omit to create a new task. An entry with an id never creates: if the id is unknown, only that entry fails.`})),ref:t.Type.Optional(t.Type.String({description:`Temporary name for a task created by this entry, so a LATER entry in the same tasks[] can list it in blockedBy before its real id exists. Must start with a letter. Scoped to this one call and never stored; the response reports which real id it became.`})),subject:t.Type.Optional(t.Type.String({description:`Short imperative subject line (e.g. 'Research existing tool'). Required when the entry has no id; on an entry with an id it renames the task.`})),description:t.Type.Optional(t.Type.String({description:`Long-form task detail. This becomes the brief handed to the subagent when the task is assigned.`})),activeForm:t.Type.Optional(t.Type.String({description:`Present-continuous spinner label shown while status is in_progress (e.g. 'writing tests')`})),status:t.Type.Optional(t.Type.String({enum:[...r],description:`Starting status for a new entry (default pending; deleted is rejected), or the target status for an entry with an id, where the transition must be legal.`})),blockedBy:t.Type.Optional(t.Type.Array(s,{description:`Dependencies for a NEW entry (one with no id): this task is blocked by each target. A number is an existing task id; a string is the ref of a task created by an EARLIER entry in this same array. Use addBlockedBy / removeBlockedBy on an entry that has an id.`})),addBlockedBy:t.Type.Optional(t.Type.Array(s,{description:`Dependencies to add, for an entry with an id. Task ids, or refs declared by an earlier entry. Additive merge — do not resend the full array.`})),removeBlockedBy:t.Type.Optional(t.Type.Array(s,{description:`Dependencies to remove, for an entry with an id. Additive merge — do not resend the full array.`})),owner:t.Type.Optional(t.Type.String({description:`Owner label for this task. assign sets this to the subagent name automatically.`})),metadata:t.Type.Optional(t.Type.Record(t.Type.String(),t.Type.Unknown(),{description:`Arbitrary metadata merged into the task; pass null as a value to delete that key`}))},{additionalProperties:!1}),l=t.Type.Object({id:t.Type.Integer({description:`Pending, unblocked task id to delegate`}),agent:t.Type.String({description:`Exact discovered subagent name`}),inlineAgent:t.Type.Optional(e.InlineAgentSchema),instructions:t.Type.Optional(t.Type.String({description:`Extra instructions appended to this delegated brief`})),relevantFiles:t.Type.Optional(t.Type.Array(t.Type.String(),{description:`Files already read or located for this task. Paths are relative to the working directory; at most 12 are used.`})),priorFindings:t.Type.Optional(t.Type.String({description:`Established facts this child should consume rather than re-derive`})),model:t.Type.Optional(t.Type.String({description:`Model override for this delegated run`})),context:t.Type.Optional(t.Type.String({enum:[...i],description:`Starting context for this child: 'fresh' or 'fork'`}))},{additionalProperties:!1}),u=t.Type.Object({action:t.Type.String({enum:[...n],description:`upsert (create new tasks and change existing ones, one or many per call), list, get, delete (tombstone), clear (close/reset the list), assign (delegate one or more tasks through assignments[]), cancel (stop a delegated run)`}),tasks:t.Type.Optional(t.Type.Array(c,{minItems:1,description:`upsert only. One entry per task: an entry with an id changes that task, an entry without an id creates one. Entries apply in array order, so a later entry can depend on an earlier one by ref. Each entry succeeds or fails on its own: the ones that succeed are committed and the ones that fail are reported by their array index.`})),assignments:t.Type.Optional(t.Type.Array(l,{minItems:1,description:`Required for assign, including one task. Each entry selects its own pending, unblocked task, agent, model, and context pack; successful entries remain delegated if another entry fails. assign has no top-level single-task form.`})),id:t.Type.Optional(t.Type.Integer({description:`Task id, for get, delete, and cancel. For assign, put every id inside assignments[]. upsert does not accept this field — put the id inside the tasks[] entry you want to change.`})),status:t.Type.Optional(t.Type.String({enum:[...r],description:`list only: return just the tasks in this status. To SET a status, use upsert with the task id inside tasks[].`})),includeDeleted:t.Type.Optional(t.Type.Boolean({description:`If true, list returns deleted (tombstoned) tasks as well. Default: false.`}))});exports.COMMAND_NAME=`tasks`,exports.ERR_REQUIRES_INTERACTIVE=`/tasks requires interactive mode`,exports.MSG_NO_TASKS=`No tasks yet. Ask the agent to add some!`,exports.MSG_UPSERT_FIELD_MISPLACED=`Per-task fields belong inside each tasks[] entry, not at the top level: {"action":"upsert","tasks":[{"id":3,"status":"completed"}]}.`,exports.TASK_ACTIONS=n,exports.TASK_ACTION_FIELDS=a,exports.TASK_CONTEXTS=i,exports.TASK_STATUSES=r,exports.TOOL_LABEL=`Task`,exports.TOOL_NAME=`task`,exports.TaskAssignmentSchema=l,exports.TaskItemSchema=c,exports.TaskParamsSchema=u,exports.taskActionAcceptsField=o;
2
2
  //# sourceMappingURL=task.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"task.cjs","names":["Type","InlineAgentSchema"],"sources":["../../src/schemas/task.ts"],"sourcesContent":["import { InlineAgentSchema } from '@agimon-ai/doompi-extension-contracts/subagent-tool';\nimport { type Static, Type } from 'typebox';\nimport { MAX_BRIEF_FILES } from '../services/delegation/manager.ts';\nimport type { TaskAction } from '../services/store/types.ts';\n\nexport const TASK_ACTIONS = ['upsert', 'list', 'get', 'delete', 'clear', 'assign', 'cancel'] as const;\nexport const TASK_STATUSES = ['pending', 'in_progress', 'completed', 'failed', 'deleted'] as const;\nexport const TASK_CONTEXTS = ['fresh', 'fork'] as const;\n\nexport const TOOL_NAME = 'task';\nexport const TOOL_LABEL = 'Task';\nexport const COMMAND_NAME = 'tasks';\n\nexport const ERR_REQUIRES_INTERACTIVE = '/tasks requires interactive mode';\nexport const MSG_NO_TASKS = 'No tasks yet. Ask the agent to add some!';\n\n/**\n * Which top-level fields each action accepts.\n *\n * The params object is flat and shared across every action, so the schema alone\n * cannot express \"upsert has no top-level id\". That gap matters: a call like\n * `{\"action\":\"upsert\",\"id\":3,\"tasks\":[{\"status\":\"completed\"}]}` would otherwise\n * silently create a duplicate task, because the entry itself carries no id.\n */\nexport const TASK_ACTION_FIELDS = {\n upsert: ['action', 'tasks'],\n list: ['action', 'status', 'includeDeleted'],\n get: ['action', 'id'],\n delete: ['action', 'id'],\n clear: ['action'],\n assign: [\n 'action',\n 'id',\n 'agent',\n 'inlineAgent',\n 'instructions',\n 'relevantFiles',\n 'priorFindings',\n 'model',\n 'context',\n ],\n cancel: ['action', 'id'],\n} as const satisfies Record<TaskAction, readonly string[]>;\n\nexport function taskActionAcceptsField(action: TaskAction, field: string): boolean {\n return (TASK_ACTION_FIELDS[action] as readonly string[]).includes(field);\n}\n\n/** Correction hint appended when a per-task field lands at the top level. */\nexport const MSG_UPSERT_FIELD_MISPLACED =\n 'Per-task fields belong inside each tasks[] entry, not at the top level: {\"action\":\"upsert\",\"tasks\":[{\"id\":3,\"status\":\"completed\"}]}.';\n\n/**\n * A dependency target: an existing task id, or the `ref` of a task created\n * earlier in the same call.\n */\nconst DepTokenSchema = Type.Union([Type.Integer(), Type.String()]);\n\n/**\n * One entry of an upsert. `additionalProperties: false` is load-bearing: pi\n * validates tool arguments against this schema before `execute` runs, so a\n * stray `{\"action\":\"update\"}` inside an entry is rejected at the boundary.\n */\nexport const TaskItemSchema = Type.Object(\n {\n id: Type.Optional(\n Type.Integer({\n description:\n 'Existing task id to change. Omit to create a new task. An entry with an id never creates: if the id is unknown, only that entry fails.',\n }),\n ),\n ref: Type.Optional(\n Type.String({\n description:\n 'Temporary name for a task created by this entry, so a LATER entry in the same tasks[] can list it in blockedBy before its real id exists. Must start with a letter. Scoped to this one call and never stored; the response reports which real id it became.',\n }),\n ),\n subject: Type.Optional(\n Type.String({\n description:\n \"Short imperative subject line (e.g. 'Research existing tool'). Required when the entry has no id; on an entry with an id it renames the task.\",\n }),\n ),\n description: Type.Optional(\n Type.String({\n description: 'Long-form task detail. This becomes the brief handed to the subagent when the task is assigned.',\n }),\n ),\n activeForm: Type.Optional(\n Type.String({\n description: \"Present-continuous spinner label shown while status is in_progress (e.g. 'writing tests')\",\n }),\n ),\n status: Type.Optional(\n Type.String({\n enum: [...TASK_STATUSES],\n description:\n 'Starting status for a new entry (default pending; deleted is rejected), or the target status for an entry with an id, where the transition must be legal.',\n }),\n ),\n blockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description:\n 'Dependencies for a NEW entry (one with no id): this task is blocked by each target. A number is an existing task id; a string is the ref of a task created by an EARLIER entry in this same array. Use addBlockedBy / removeBlockedBy on an entry that has an id.',\n }),\n ),\n addBlockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description:\n 'Dependencies to add, for an entry with an id. Task ids, or refs declared by an earlier entry. Additive merge — do not resend the full array.',\n }),\n ),\n removeBlockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description: 'Dependencies to remove, for an entry with an id. Additive merge — do not resend the full array.',\n }),\n ),\n owner: Type.Optional(\n Type.String({ description: 'Owner label for this task. assign sets this to the subagent name automatically.' }),\n ),\n metadata: Type.Optional(\n Type.Record(Type.String(), Type.Unknown(), {\n description: 'Arbitrary metadata merged into the task; pass null as a value to delete that key',\n }),\n ),\n },\n { additionalProperties: false },\n);\n\n/**\n * Tool parameters. Every `description` doubles as LLM-facing prompt copy, so\n * wording changes here change model behaviour.\n */\nexport const TaskParamsSchema = Type.Object({\n action: Type.String({\n enum: [...TASK_ACTIONS],\n description:\n 'upsert (create new tasks and change existing ones, one or many per call), list, get, delete (tombstone), clear (close/reset the list), assign (delegate to a subagent), cancel (stop a delegated run)',\n }),\n tasks: Type.Optional(\n Type.Array(TaskItemSchema, {\n minItems: 1,\n description:\n 'upsert only. One entry per task: an entry with an id changes that task, an entry without an id creates one. Entries apply in array order, so a later entry can depend on an earlier one by ref. Each entry succeeds or fails on its own: the ones that succeed are committed and the ones that fail are reported by their array index.',\n }),\n ),\n id: Type.Optional(\n Type.Integer({\n description:\n 'Task id, for get, delete, assign and cancel. upsert does not accept this field — put the id inside the tasks[] entry you want to change.',\n }),\n ),\n status: Type.Optional(\n Type.String({\n enum: [...TASK_STATUSES],\n description:\n 'list only: return just the tasks in this status. To SET a status, use upsert with the task id inside tasks[].',\n }),\n ),\n includeDeleted: Type.Optional(\n Type.Boolean({\n description: 'If true, list returns deleted (tombstoned) tasks as well. Default: false.',\n }),\n ),\n agent: Type.Optional(\n Type.String({\n description: 'Name of the subagent to delegate this task to (required for assign)',\n }),\n ),\n inlineAgent: Type.Optional(InlineAgentSchema),\n instructions: Type.Optional(\n Type.String({\n description: 'Extra instructions appended to the delegated brief (assign only)',\n }),\n ),\n relevantFiles: Type.Optional(\n Type.Array(Type.String(), {\n description: `Files you have ALREADY read or located that the subagent should open first (assign only). Paths relative to the working directory. A child starts with none of your context and otherwise spends most of its run rediscovering the repo. Send only files you actually looked at — a guessed path costs the child more than an omitted one. At most ${MAX_BRIEF_FILES}; extras are dropped.`,\n }),\n ),\n priorFindings: Type.Optional(\n Type.String({\n description:\n 'What you already established about this task and the subagent should not re-derive (assign only): symbol names, call sites, the approach you chose, what you already ruled out. Facts you discovered, not directives — put directives in instructions. Keep it to a few lines; it is truncated past ~1500 characters.',\n }),\n ),\n model: Type.Optional(Type.String({ description: 'Model override for the delegated run (assign only)' })),\n context: Type.Optional(\n Type.String({\n enum: [...TASK_CONTEXTS],\n description:\n \"Subagent starting context (assign only): 'fresh' starts clean, 'fork' inherits this conversation. If omitted, uses the agent default, then fresh.\",\n }),\n ),\n});\n\nexport type TaskItemParams = Static<typeof TaskItemSchema>;\nexport type TaskParams = Static<typeof TaskParamsSchema>;\n"],"mappings":"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"}
1
+ {"version":3,"file":"task.cjs","names":["Type","InlineAgentSchema"],"sources":["../../src/schemas/task.ts"],"sourcesContent":["import { InlineAgentSchema } from '@agimon-ai/doompi-extension-contracts/subagent-tool';\nimport { type Static, Type } from 'typebox';\nimport { MAX_BRIEF_FILES } from '../services/delegation/manager.ts';\nimport type { TaskAction } from '../services/store/types.ts';\n\nexport const TASK_ACTIONS = ['upsert', 'list', 'get', 'delete', 'clear', 'assign', 'cancel'] as const;\nexport const TASK_STATUSES = ['pending', 'in_progress', 'completed', 'failed', 'deleted'] as const;\nexport const TASK_CONTEXTS = ['fresh', 'fork'] as const;\n\nexport const TOOL_NAME = 'task';\nexport const TOOL_LABEL = 'Task';\nexport const COMMAND_NAME = 'tasks';\n\nexport const ERR_REQUIRES_INTERACTIVE = '/tasks requires interactive mode';\nexport const MSG_NO_TASKS = 'No tasks yet. Ask the agent to add some!';\n\n/**\n * Which top-level fields each action accepts.\n *\n * The params object is flat and shared across every action, so the schema alone\n * cannot express \"upsert has no top-level id\". That gap matters: a call like\n * `{\"action\":\"upsert\",\"id\":3,\"tasks\":[{\"status\":\"completed\"}]}` would otherwise\n * silently create a duplicate task, because the entry itself carries no id.\n */\nexport const TASK_ACTION_FIELDS = {\n upsert: ['action', 'tasks'],\n list: ['action', 'status', 'includeDeleted'],\n get: ['action', 'id'],\n delete: ['action', 'id'],\n clear: ['action'],\n assign: ['action', 'assignments'],\n cancel: ['action', 'id'],\n} as const satisfies Record<TaskAction, readonly string[]>;\n\nexport function taskActionAcceptsField(action: TaskAction, field: string): boolean {\n return (TASK_ACTION_FIELDS[action] as readonly string[]).includes(field);\n}\n\n/** Correction hint appended when a per-task field lands at the top level. */\nexport const MSG_UPSERT_FIELD_MISPLACED =\n 'Per-task fields belong inside each tasks[] entry, not at the top level: {\"action\":\"upsert\",\"tasks\":[{\"id\":3,\"status\":\"completed\"}]}.';\n\n/**\n * A dependency target: an existing task id, or the `ref` of a task created\n * earlier in the same call.\n */\nconst DepTokenSchema = Type.Union([Type.Integer(), Type.String()]);\n\n/**\n * One entry of an upsert. `additionalProperties: false` is load-bearing: pi\n * validates tool arguments against this schema before `execute` runs, so a\n * stray `{\"action\":\"update\"}` inside an entry is rejected at the boundary.\n */\nexport const TaskItemSchema = Type.Object(\n {\n id: Type.Optional(\n Type.Integer({\n description:\n 'Existing task id to change. Omit to create a new task. An entry with an id never creates: if the id is unknown, only that entry fails.',\n }),\n ),\n ref: Type.Optional(\n Type.String({\n description:\n 'Temporary name for a task created by this entry, so a LATER entry in the same tasks[] can list it in blockedBy before its real id exists. Must start with a letter. Scoped to this one call and never stored; the response reports which real id it became.',\n }),\n ),\n subject: Type.Optional(\n Type.String({\n description:\n \"Short imperative subject line (e.g. 'Research existing tool'). Required when the entry has no id; on an entry with an id it renames the task.\",\n }),\n ),\n description: Type.Optional(\n Type.String({\n description: 'Long-form task detail. This becomes the brief handed to the subagent when the task is assigned.',\n }),\n ),\n activeForm: Type.Optional(\n Type.String({\n description: \"Present-continuous spinner label shown while status is in_progress (e.g. 'writing tests')\",\n }),\n ),\n status: Type.Optional(\n Type.String({\n enum: [...TASK_STATUSES],\n description:\n 'Starting status for a new entry (default pending; deleted is rejected), or the target status for an entry with an id, where the transition must be legal.',\n }),\n ),\n blockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description:\n 'Dependencies for a NEW entry (one with no id): this task is blocked by each target. A number is an existing task id; a string is the ref of a task created by an EARLIER entry in this same array. Use addBlockedBy / removeBlockedBy on an entry that has an id.',\n }),\n ),\n addBlockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description:\n 'Dependencies to add, for an entry with an id. Task ids, or refs declared by an earlier entry. Additive merge — do not resend the full array.',\n }),\n ),\n removeBlockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description: 'Dependencies to remove, for an entry with an id. Additive merge — do not resend the full array.',\n }),\n ),\n owner: Type.Optional(\n Type.String({ description: 'Owner label for this task. assign sets this to the subagent name automatically.' }),\n ),\n metadata: Type.Optional(\n Type.Record(Type.String(), Type.Unknown(), {\n description: 'Arbitrary metadata merged into the task; pass null as a value to delete that key',\n }),\n ),\n },\n { additionalProperties: false },\n);\n\n/** One task-to-agent handoff in a native assignment batch. */\nexport const TaskAssignmentSchema = Type.Object(\n {\n id: Type.Integer({ description: 'Pending, unblocked task id to delegate' }),\n agent: Type.String({ description: 'Exact discovered subagent name' }),\n inlineAgent: Type.Optional(InlineAgentSchema),\n instructions: Type.Optional(Type.String({ description: 'Extra instructions appended to this delegated brief' })),\n relevantFiles: Type.Optional(\n Type.Array(Type.String(), {\n description: `Files already read or located for this task. Paths are relative to the working directory; at most ${MAX_BRIEF_FILES} are used.`,\n }),\n ),\n priorFindings: Type.Optional(\n Type.String({ description: 'Established facts this child should consume rather than re-derive' }),\n ),\n model: Type.Optional(Type.String({ description: 'Model override for this delegated run' })),\n context: Type.Optional(\n Type.String({\n enum: [...TASK_CONTEXTS],\n description: \"Starting context for this child: 'fresh' or 'fork'\",\n }),\n ),\n },\n { additionalProperties: false },\n);\n\n/**\n * Tool parameters. Every `description` doubles as LLM-facing prompt copy, so\n * wording changes here change model behaviour.\n */\nexport const TaskParamsSchema = Type.Object({\n action: Type.String({\n enum: [...TASK_ACTIONS],\n description:\n 'upsert (create new tasks and change existing ones, one or many per call), list, get, delete (tombstone), clear (close/reset the list), assign (delegate one or more tasks through assignments[]), cancel (stop a delegated run)',\n }),\n tasks: Type.Optional(\n Type.Array(TaskItemSchema, {\n minItems: 1,\n description:\n 'upsert only. One entry per task: an entry with an id changes that task, an entry without an id creates one. Entries apply in array order, so a later entry can depend on an earlier one by ref. Each entry succeeds or fails on its own: the ones that succeed are committed and the ones that fail are reported by their array index.',\n }),\n ),\n assignments: Type.Optional(\n Type.Array(TaskAssignmentSchema, {\n minItems: 1,\n description:\n 'Required for assign, including one task. Each entry selects its own pending, unblocked task, agent, model, and context pack; successful entries remain delegated if another entry fails. assign has no top-level single-task form.',\n }),\n ),\n id: Type.Optional(\n Type.Integer({\n description:\n 'Task id, for get, delete, and cancel. For assign, put every id inside assignments[]. upsert does not accept this field — put the id inside the tasks[] entry you want to change.',\n }),\n ),\n status: Type.Optional(\n Type.String({\n enum: [...TASK_STATUSES],\n description:\n 'list only: return just the tasks in this status. To SET a status, use upsert with the task id inside tasks[].',\n }),\n ),\n includeDeleted: Type.Optional(\n Type.Boolean({\n description: 'If true, list returns deleted (tombstoned) tasks as well. Default: false.',\n }),\n ),\n});\n\nexport type TaskItemParams = Static<typeof TaskItemSchema>;\nexport type TaskAssignmentParams = Static<typeof TaskAssignmentSchema>;\nexport type TaskParams = Static<typeof TaskParamsSchema>;\n"],"mappings":"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"}
@@ -23,7 +23,7 @@ declare const TASK_ACTION_FIELDS: {
23
23
  readonly get: readonly ["action", "id"];
24
24
  readonly delete: readonly ["action", "id"];
25
25
  readonly clear: readonly ["action"];
26
- readonly assign: readonly ["action", "id", "agent", "inlineAgent", "instructions", "relevantFiles", "priorFindings", "model", "context"];
26
+ readonly assign: readonly ["action", "assignments"];
27
27
  readonly cancel: readonly ["action", "id"];
28
28
  };
29
29
  declare function taskActionAcceptsField(action: TaskAction, field: string): boolean;
@@ -47,6 +47,19 @@ declare const TaskItemSchema: Type.TObject<{
47
47
  owner: Type.TOptional<Type.TString>;
48
48
  metadata: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
49
49
  }>;
50
+ /** One task-to-agent handoff in a native assignment batch. */
51
+ declare const TaskAssignmentSchema: Type.TObject<{
52
+ id: Type.TInteger;
53
+ agent: Type.TString;
54
+ inlineAgent: Type.TOptional<Type.TObject<{
55
+ systemPrompt: Type.TString;
56
+ }>>;
57
+ instructions: Type.TOptional<Type.TString>;
58
+ relevantFiles: Type.TOptional<Type.TArray<Type.TString>>;
59
+ priorFindings: Type.TOptional<Type.TString>;
60
+ model: Type.TOptional<Type.TString>;
61
+ context: Type.TOptional<Type.TString>;
62
+ }>;
50
63
  /**
51
64
  * Tool parameters. Every `description` doubles as LLM-facing prompt copy, so
52
65
  * wording changes here change model behaviour.
@@ -66,21 +79,25 @@ declare const TaskParamsSchema: Type.TObject<{
66
79
  owner: Type.TOptional<Type.TString>;
67
80
  metadata: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
68
81
  }>>>;
82
+ assignments: Type.TOptional<Type.TArray<Type.TObject<{
83
+ id: Type.TInteger;
84
+ agent: Type.TString;
85
+ inlineAgent: Type.TOptional<Type.TObject<{
86
+ systemPrompt: Type.TString;
87
+ }>>;
88
+ instructions: Type.TOptional<Type.TString>;
89
+ relevantFiles: Type.TOptional<Type.TArray<Type.TString>>;
90
+ priorFindings: Type.TOptional<Type.TString>;
91
+ model: Type.TOptional<Type.TString>;
92
+ context: Type.TOptional<Type.TString>;
93
+ }>>>;
69
94
  id: Type.TOptional<Type.TInteger>;
70
95
  status: Type.TOptional<Type.TString>;
71
96
  includeDeleted: Type.TOptional<Type.TBoolean>;
72
- agent: Type.TOptional<Type.TString>;
73
- inlineAgent: Type.TOptional<Type.TObject<{
74
- systemPrompt: Type.TString;
75
- }>>;
76
- instructions: Type.TOptional<Type.TString>;
77
- relevantFiles: Type.TOptional<Type.TArray<Type.TString>>;
78
- priorFindings: Type.TOptional<Type.TString>;
79
- model: Type.TOptional<Type.TString>;
80
- context: Type.TOptional<Type.TString>;
81
97
  }>;
82
98
  type TaskItemParams = Static<typeof TaskItemSchema>;
99
+ type TaskAssignmentParams = Static<typeof TaskAssignmentSchema>;
83
100
  type TaskParams = Static<typeof TaskParamsSchema>;
84
101
  //#endregion
85
- export { COMMAND_NAME, ERR_REQUIRES_INTERACTIVE, MSG_NO_TASKS, MSG_UPSERT_FIELD_MISPLACED, TASK_ACTIONS, TASK_ACTION_FIELDS, TASK_CONTEXTS, TASK_STATUSES, TOOL_LABEL, TOOL_NAME, TaskItemParams, TaskItemSchema, TaskParams, TaskParamsSchema, taskActionAcceptsField };
102
+ export { COMMAND_NAME, ERR_REQUIRES_INTERACTIVE, MSG_NO_TASKS, MSG_UPSERT_FIELD_MISPLACED, TASK_ACTIONS, TASK_ACTION_FIELDS, TASK_CONTEXTS, TASK_STATUSES, TOOL_LABEL, TOOL_NAME, TaskAssignmentParams, TaskAssignmentSchema, TaskItemParams, TaskItemSchema, TaskParams, TaskParamsSchema, taskActionAcceptsField };
86
103
  //# sourceMappingURL=task.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"task.d.cts","names":[],"sources":["../../src/schemas/task.ts"],"mappings":";;;cAKa;cACA;cACA;cAEA;cACA;cACA;cAEA;cACA;;;;;;;;;cAUA;;;;;;;;;iBAoBG,uBAAuB,QAAQ,YAAY;;cAK9C;;;;;;cAcA,gBAAc,KAAA;;;;;;;;;;;;;;;;;cAsEd,kBAAgB,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+DjB,iBAAiB,cAAc;KAC/B,aAAa,cAAc"}
1
+ {"version":3,"file":"task.d.cts","names":[],"sources":["../../src/schemas/task.ts"],"mappings":";;;cAKa;cACA;cACA;cAEA;cACA;cACA;cAEA;cACA;;;;;;;;;cAUA;;;;;;;;;iBAUG,uBAAuB,QAAQ,YAAY;;cAK9C;;;;;;cAcA,gBAAc,KAAA;;;;;;;;;;;;;;cAmEd,sBAAoB,KAAA;;;;;;;;;;;;;;;;cA6BpB,kBAAgB,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwCjB,iBAAiB,cAAc;KAC/B,uBAAuB,cAAc;KACrC,aAAa,cAAc"}
@@ -23,7 +23,7 @@ declare const TASK_ACTION_FIELDS: {
23
23
  readonly get: readonly ["action", "id"];
24
24
  readonly delete: readonly ["action", "id"];
25
25
  readonly clear: readonly ["action"];
26
- readonly assign: readonly ["action", "id", "agent", "inlineAgent", "instructions", "relevantFiles", "priorFindings", "model", "context"];
26
+ readonly assign: readonly ["action", "assignments"];
27
27
  readonly cancel: readonly ["action", "id"];
28
28
  };
29
29
  declare function taskActionAcceptsField(action: TaskAction, field: string): boolean;
@@ -47,6 +47,19 @@ declare const TaskItemSchema: Type.TObject<{
47
47
  owner: Type.TOptional<Type.TString>;
48
48
  metadata: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
49
49
  }>;
50
+ /** One task-to-agent handoff in a native assignment batch. */
51
+ declare const TaskAssignmentSchema: Type.TObject<{
52
+ id: Type.TInteger;
53
+ agent: Type.TString;
54
+ inlineAgent: Type.TOptional<Type.TObject<{
55
+ systemPrompt: Type.TString;
56
+ }>>;
57
+ instructions: Type.TOptional<Type.TString>;
58
+ relevantFiles: Type.TOptional<Type.TArray<Type.TString>>;
59
+ priorFindings: Type.TOptional<Type.TString>;
60
+ model: Type.TOptional<Type.TString>;
61
+ context: Type.TOptional<Type.TString>;
62
+ }>;
50
63
  /**
51
64
  * Tool parameters. Every `description` doubles as LLM-facing prompt copy, so
52
65
  * wording changes here change model behaviour.
@@ -66,21 +79,25 @@ declare const TaskParamsSchema: Type.TObject<{
66
79
  owner: Type.TOptional<Type.TString>;
67
80
  metadata: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
68
81
  }>>>;
82
+ assignments: Type.TOptional<Type.TArray<Type.TObject<{
83
+ id: Type.TInteger;
84
+ agent: Type.TString;
85
+ inlineAgent: Type.TOptional<Type.TObject<{
86
+ systemPrompt: Type.TString;
87
+ }>>;
88
+ instructions: Type.TOptional<Type.TString>;
89
+ relevantFiles: Type.TOptional<Type.TArray<Type.TString>>;
90
+ priorFindings: Type.TOptional<Type.TString>;
91
+ model: Type.TOptional<Type.TString>;
92
+ context: Type.TOptional<Type.TString>;
93
+ }>>>;
69
94
  id: Type.TOptional<Type.TInteger>;
70
95
  status: Type.TOptional<Type.TString>;
71
96
  includeDeleted: Type.TOptional<Type.TBoolean>;
72
- agent: Type.TOptional<Type.TString>;
73
- inlineAgent: Type.TOptional<Type.TObject<{
74
- systemPrompt: Type.TString;
75
- }>>;
76
- instructions: Type.TOptional<Type.TString>;
77
- relevantFiles: Type.TOptional<Type.TArray<Type.TString>>;
78
- priorFindings: Type.TOptional<Type.TString>;
79
- model: Type.TOptional<Type.TString>;
80
- context: Type.TOptional<Type.TString>;
81
97
  }>;
82
98
  type TaskItemParams = Static<typeof TaskItemSchema>;
99
+ type TaskAssignmentParams = Static<typeof TaskAssignmentSchema>;
83
100
  type TaskParams = Static<typeof TaskParamsSchema>;
84
101
  //#endregion
85
- export { COMMAND_NAME, ERR_REQUIRES_INTERACTIVE, MSG_NO_TASKS, MSG_UPSERT_FIELD_MISPLACED, TASK_ACTIONS, TASK_ACTION_FIELDS, TASK_CONTEXTS, TASK_STATUSES, TOOL_LABEL, TOOL_NAME, TaskItemParams, TaskItemSchema, TaskParams, TaskParamsSchema, taskActionAcceptsField };
102
+ export { COMMAND_NAME, ERR_REQUIRES_INTERACTIVE, MSG_NO_TASKS, MSG_UPSERT_FIELD_MISPLACED, TASK_ACTIONS, TASK_ACTION_FIELDS, TASK_CONTEXTS, TASK_STATUSES, TOOL_LABEL, TOOL_NAME, TaskAssignmentParams, TaskAssignmentSchema, TaskItemParams, TaskItemSchema, TaskParams, TaskParamsSchema, taskActionAcceptsField };
86
103
  //# sourceMappingURL=task.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"task.d.mts","names":[],"sources":["../../src/schemas/task.ts"],"mappings":";;;cAKa;cACA;cACA;cAEA;cACA;cACA;cAEA;cACA;;;;;;;;;cAUA;;;;;;;;;iBAoBG,uBAAuB,QAAQ,YAAY;;cAK9C;;;;;;cAcA,gBAAc,KAAA;;;;;;;;;;;;;;;;;cAsEd,kBAAgB,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+DjB,iBAAiB,cAAc;KAC/B,aAAa,cAAc"}
1
+ {"version":3,"file":"task.d.mts","names":[],"sources":["../../src/schemas/task.ts"],"mappings":";;;cAKa;cACA;cACA;cAEA;cACA;cACA;cAEA;cACA;;;;;;;;;cAUA;;;;;;;;;iBAUG,uBAAuB,QAAQ,YAAY;;cAK9C;;;;;;cAcA,gBAAc,KAAA;;;;;;;;;;;;;;cAmEd,sBAAoB,KAAA;;;;;;;;;;;;;;;;cA6BpB,kBAAgB,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwCjB,iBAAiB,cAAc;KAC/B,uBAAuB,cAAc;KACrC,aAAa,cAAc"}
@@ -1,2 +1,2 @@
1
- import"../services/delegation/manager.mjs";import{InlineAgentSchema as e}from"@agimon-ai/doompi-extension-contracts/subagent-tool";import{Type as t}from"typebox";const n=[`upsert`,`list`,`get`,`delete`,`clear`,`assign`,`cancel`],r=[`pending`,`in_progress`,`completed`,`failed`,`deleted`],i=[`fresh`,`fork`],a=`task`,o=`Task`,s=`tasks`,c=`/tasks requires interactive mode`,l=`No tasks yet. Ask the agent to add some!`,u={upsert:[`action`,`tasks`],list:[`action`,`status`,`includeDeleted`],get:[`action`,`id`],delete:[`action`,`id`],clear:[`action`],assign:[`action`,`id`,`agent`,`inlineAgent`,`instructions`,`relevantFiles`,`priorFindings`,`model`,`context`],cancel:[`action`,`id`]};function d(e,t){return u[e].includes(t)}const f=`Per-task fields belong inside each tasks[] entry, not at the top level: {"action":"upsert","tasks":[{"id":3,"status":"completed"}]}.`,p=t.Union([t.Integer(),t.String()]),m=t.Object({id:t.Optional(t.Integer({description:`Existing task id to change. Omit to create a new task. An entry with an id never creates: if the id is unknown, only that entry fails.`})),ref:t.Optional(t.String({description:`Temporary name for a task created by this entry, so a LATER entry in the same tasks[] can list it in blockedBy before its real id exists. Must start with a letter. Scoped to this one call and never stored; the response reports which real id it became.`})),subject:t.Optional(t.String({description:`Short imperative subject line (e.g. 'Research existing tool'). Required when the entry has no id; on an entry with an id it renames the task.`})),description:t.Optional(t.String({description:`Long-form task detail. This becomes the brief handed to the subagent when the task is assigned.`})),activeForm:t.Optional(t.String({description:`Present-continuous spinner label shown while status is in_progress (e.g. 'writing tests')`})),status:t.Optional(t.String({enum:[...r],description:`Starting status for a new entry (default pending; deleted is rejected), or the target status for an entry with an id, where the transition must be legal.`})),blockedBy:t.Optional(t.Array(p,{description:`Dependencies for a NEW entry (one with no id): this task is blocked by each target. A number is an existing task id; a string is the ref of a task created by an EARLIER entry in this same array. Use addBlockedBy / removeBlockedBy on an entry that has an id.`})),addBlockedBy:t.Optional(t.Array(p,{description:`Dependencies to add, for an entry with an id. Task ids, or refs declared by an earlier entry. Additive merge — do not resend the full array.`})),removeBlockedBy:t.Optional(t.Array(p,{description:`Dependencies to remove, for an entry with an id. Additive merge — do not resend the full array.`})),owner:t.Optional(t.String({description:`Owner label for this task. assign sets this to the subagent name automatically.`})),metadata:t.Optional(t.Record(t.String(),t.Unknown(),{description:`Arbitrary metadata merged into the task; pass null as a value to delete that key`}))},{additionalProperties:!1}),h=t.Object({action:t.String({enum:[...n],description:`upsert (create new tasks and change existing ones, one or many per call), list, get, delete (tombstone), clear (close/reset the list), assign (delegate to a subagent), cancel (stop a delegated run)`}),tasks:t.Optional(t.Array(m,{minItems:1,description:`upsert only. One entry per task: an entry with an id changes that task, an entry without an id creates one. Entries apply in array order, so a later entry can depend on an earlier one by ref. Each entry succeeds or fails on its own: the ones that succeed are committed and the ones that fail are reported by their array index.`})),id:t.Optional(t.Integer({description:`Task id, for get, delete, assign and cancel. upsert does not accept this field — put the id inside the tasks[] entry you want to change.`})),status:t.Optional(t.String({enum:[...r],description:`list only: return just the tasks in this status. To SET a status, use upsert with the task id inside tasks[].`})),includeDeleted:t.Optional(t.Boolean({description:`If true, list returns deleted (tombstoned) tasks as well. Default: false.`})),agent:t.Optional(t.String({description:`Name of the subagent to delegate this task to (required for assign)`})),inlineAgent:t.Optional(e),instructions:t.Optional(t.String({description:`Extra instructions appended to the delegated brief (assign only)`})),relevantFiles:t.Optional(t.Array(t.String(),{description:`Files you have ALREADY read or located that the subagent should open first (assign only). Paths relative to the working directory. A child starts with none of your context and otherwise spends most of its run rediscovering the repo. Send only files you actually looked at — a guessed path costs the child more than an omitted one. At most 12; extras are dropped.`})),priorFindings:t.Optional(t.String({description:`What you already established about this task and the subagent should not re-derive (assign only): symbol names, call sites, the approach you chose, what you already ruled out. Facts you discovered, not directives — put directives in instructions. Keep it to a few lines; it is truncated past ~1500 characters.`})),model:t.Optional(t.String({description:`Model override for the delegated run (assign only)`})),context:t.Optional(t.String({enum:[...i],description:`Subagent starting context (assign only): 'fresh' starts clean, 'fork' inherits this conversation. If omitted, uses the agent default, then fresh.`}))});export{s as COMMAND_NAME,c as ERR_REQUIRES_INTERACTIVE,l as MSG_NO_TASKS,f as MSG_UPSERT_FIELD_MISPLACED,n as TASK_ACTIONS,u as TASK_ACTION_FIELDS,i as TASK_CONTEXTS,r as TASK_STATUSES,o as TOOL_LABEL,a as TOOL_NAME,m as TaskItemSchema,h as TaskParamsSchema,d as taskActionAcceptsField};
1
+ import"../services/delegation/manager.mjs";import{InlineAgentSchema as e}from"@agimon-ai/doompi-extension-contracts/subagent-tool";import{Type as t}from"typebox";const n=[`upsert`,`list`,`get`,`delete`,`clear`,`assign`,`cancel`],r=[`pending`,`in_progress`,`completed`,`failed`,`deleted`],i=[`fresh`,`fork`],a=`task`,o=`Task`,s=`tasks`,c=`/tasks requires interactive mode`,l=`No tasks yet. Ask the agent to add some!`,u={upsert:[`action`,`tasks`],list:[`action`,`status`,`includeDeleted`],get:[`action`,`id`],delete:[`action`,`id`],clear:[`action`],assign:[`action`,`assignments`],cancel:[`action`,`id`]};function d(e,t){return u[e].includes(t)}const f=`Per-task fields belong inside each tasks[] entry, not at the top level: {"action":"upsert","tasks":[{"id":3,"status":"completed"}]}.`,p=t.Union([t.Integer(),t.String()]),m=t.Object({id:t.Optional(t.Integer({description:`Existing task id to change. Omit to create a new task. An entry with an id never creates: if the id is unknown, only that entry fails.`})),ref:t.Optional(t.String({description:`Temporary name for a task created by this entry, so a LATER entry in the same tasks[] can list it in blockedBy before its real id exists. Must start with a letter. Scoped to this one call and never stored; the response reports which real id it became.`})),subject:t.Optional(t.String({description:`Short imperative subject line (e.g. 'Research existing tool'). Required when the entry has no id; on an entry with an id it renames the task.`})),description:t.Optional(t.String({description:`Long-form task detail. This becomes the brief handed to the subagent when the task is assigned.`})),activeForm:t.Optional(t.String({description:`Present-continuous spinner label shown while status is in_progress (e.g. 'writing tests')`})),status:t.Optional(t.String({enum:[...r],description:`Starting status for a new entry (default pending; deleted is rejected), or the target status for an entry with an id, where the transition must be legal.`})),blockedBy:t.Optional(t.Array(p,{description:`Dependencies for a NEW entry (one with no id): this task is blocked by each target. A number is an existing task id; a string is the ref of a task created by an EARLIER entry in this same array. Use addBlockedBy / removeBlockedBy on an entry that has an id.`})),addBlockedBy:t.Optional(t.Array(p,{description:`Dependencies to add, for an entry with an id. Task ids, or refs declared by an earlier entry. Additive merge — do not resend the full array.`})),removeBlockedBy:t.Optional(t.Array(p,{description:`Dependencies to remove, for an entry with an id. Additive merge — do not resend the full array.`})),owner:t.Optional(t.String({description:`Owner label for this task. assign sets this to the subagent name automatically.`})),metadata:t.Optional(t.Record(t.String(),t.Unknown(),{description:`Arbitrary metadata merged into the task; pass null as a value to delete that key`}))},{additionalProperties:!1}),h=t.Object({id:t.Integer({description:`Pending, unblocked task id to delegate`}),agent:t.String({description:`Exact discovered subagent name`}),inlineAgent:t.Optional(e),instructions:t.Optional(t.String({description:`Extra instructions appended to this delegated brief`})),relevantFiles:t.Optional(t.Array(t.String(),{description:`Files already read or located for this task. Paths are relative to the working directory; at most 12 are used.`})),priorFindings:t.Optional(t.String({description:`Established facts this child should consume rather than re-derive`})),model:t.Optional(t.String({description:`Model override for this delegated run`})),context:t.Optional(t.String({enum:[...i],description:`Starting context for this child: 'fresh' or 'fork'`}))},{additionalProperties:!1}),g=t.Object({action:t.String({enum:[...n],description:`upsert (create new tasks and change existing ones, one or many per call), list, get, delete (tombstone), clear (close/reset the list), assign (delegate one or more tasks through assignments[]), cancel (stop a delegated run)`}),tasks:t.Optional(t.Array(m,{minItems:1,description:`upsert only. One entry per task: an entry with an id changes that task, an entry without an id creates one. Entries apply in array order, so a later entry can depend on an earlier one by ref. Each entry succeeds or fails on its own: the ones that succeed are committed and the ones that fail are reported by their array index.`})),assignments:t.Optional(t.Array(h,{minItems:1,description:`Required for assign, including one task. Each entry selects its own pending, unblocked task, agent, model, and context pack; successful entries remain delegated if another entry fails. assign has no top-level single-task form.`})),id:t.Optional(t.Integer({description:`Task id, for get, delete, and cancel. For assign, put every id inside assignments[]. upsert does not accept this field — put the id inside the tasks[] entry you want to change.`})),status:t.Optional(t.String({enum:[...r],description:`list only: return just the tasks in this status. To SET a status, use upsert with the task id inside tasks[].`})),includeDeleted:t.Optional(t.Boolean({description:`If true, list returns deleted (tombstoned) tasks as well. Default: false.`}))});export{s as COMMAND_NAME,c as ERR_REQUIRES_INTERACTIVE,l as MSG_NO_TASKS,f as MSG_UPSERT_FIELD_MISPLACED,n as TASK_ACTIONS,u as TASK_ACTION_FIELDS,i as TASK_CONTEXTS,r as TASK_STATUSES,o as TOOL_LABEL,a as TOOL_NAME,h as TaskAssignmentSchema,m as TaskItemSchema,g as TaskParamsSchema,d as taskActionAcceptsField};
2
2
  //# sourceMappingURL=task.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"task.mjs","names":[],"sources":["../../src/schemas/task.ts"],"sourcesContent":["import { InlineAgentSchema } from '@agimon-ai/doompi-extension-contracts/subagent-tool';\nimport { type Static, Type } from 'typebox';\nimport { MAX_BRIEF_FILES } from '../services/delegation/manager.ts';\nimport type { TaskAction } from '../services/store/types.ts';\n\nexport const TASK_ACTIONS = ['upsert', 'list', 'get', 'delete', 'clear', 'assign', 'cancel'] as const;\nexport const TASK_STATUSES = ['pending', 'in_progress', 'completed', 'failed', 'deleted'] as const;\nexport const TASK_CONTEXTS = ['fresh', 'fork'] as const;\n\nexport const TOOL_NAME = 'task';\nexport const TOOL_LABEL = 'Task';\nexport const COMMAND_NAME = 'tasks';\n\nexport const ERR_REQUIRES_INTERACTIVE = '/tasks requires interactive mode';\nexport const MSG_NO_TASKS = 'No tasks yet. Ask the agent to add some!';\n\n/**\n * Which top-level fields each action accepts.\n *\n * The params object is flat and shared across every action, so the schema alone\n * cannot express \"upsert has no top-level id\". That gap matters: a call like\n * `{\"action\":\"upsert\",\"id\":3,\"tasks\":[{\"status\":\"completed\"}]}` would otherwise\n * silently create a duplicate task, because the entry itself carries no id.\n */\nexport const TASK_ACTION_FIELDS = {\n upsert: ['action', 'tasks'],\n list: ['action', 'status', 'includeDeleted'],\n get: ['action', 'id'],\n delete: ['action', 'id'],\n clear: ['action'],\n assign: [\n 'action',\n 'id',\n 'agent',\n 'inlineAgent',\n 'instructions',\n 'relevantFiles',\n 'priorFindings',\n 'model',\n 'context',\n ],\n cancel: ['action', 'id'],\n} as const satisfies Record<TaskAction, readonly string[]>;\n\nexport function taskActionAcceptsField(action: TaskAction, field: string): boolean {\n return (TASK_ACTION_FIELDS[action] as readonly string[]).includes(field);\n}\n\n/** Correction hint appended when a per-task field lands at the top level. */\nexport const MSG_UPSERT_FIELD_MISPLACED =\n 'Per-task fields belong inside each tasks[] entry, not at the top level: {\"action\":\"upsert\",\"tasks\":[{\"id\":3,\"status\":\"completed\"}]}.';\n\n/**\n * A dependency target: an existing task id, or the `ref` of a task created\n * earlier in the same call.\n */\nconst DepTokenSchema = Type.Union([Type.Integer(), Type.String()]);\n\n/**\n * One entry of an upsert. `additionalProperties: false` is load-bearing: pi\n * validates tool arguments against this schema before `execute` runs, so a\n * stray `{\"action\":\"update\"}` inside an entry is rejected at the boundary.\n */\nexport const TaskItemSchema = Type.Object(\n {\n id: Type.Optional(\n Type.Integer({\n description:\n 'Existing task id to change. Omit to create a new task. An entry with an id never creates: if the id is unknown, only that entry fails.',\n }),\n ),\n ref: Type.Optional(\n Type.String({\n description:\n 'Temporary name for a task created by this entry, so a LATER entry in the same tasks[] can list it in blockedBy before its real id exists. Must start with a letter. Scoped to this one call and never stored; the response reports which real id it became.',\n }),\n ),\n subject: Type.Optional(\n Type.String({\n description:\n \"Short imperative subject line (e.g. 'Research existing tool'). Required when the entry has no id; on an entry with an id it renames the task.\",\n }),\n ),\n description: Type.Optional(\n Type.String({\n description: 'Long-form task detail. This becomes the brief handed to the subagent when the task is assigned.',\n }),\n ),\n activeForm: Type.Optional(\n Type.String({\n description: \"Present-continuous spinner label shown while status is in_progress (e.g. 'writing tests')\",\n }),\n ),\n status: Type.Optional(\n Type.String({\n enum: [...TASK_STATUSES],\n description:\n 'Starting status for a new entry (default pending; deleted is rejected), or the target status for an entry with an id, where the transition must be legal.',\n }),\n ),\n blockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description:\n 'Dependencies for a NEW entry (one with no id): this task is blocked by each target. A number is an existing task id; a string is the ref of a task created by an EARLIER entry in this same array. Use addBlockedBy / removeBlockedBy on an entry that has an id.',\n }),\n ),\n addBlockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description:\n 'Dependencies to add, for an entry with an id. Task ids, or refs declared by an earlier entry. Additive merge — do not resend the full array.',\n }),\n ),\n removeBlockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description: 'Dependencies to remove, for an entry with an id. Additive merge — do not resend the full array.',\n }),\n ),\n owner: Type.Optional(\n Type.String({ description: 'Owner label for this task. assign sets this to the subagent name automatically.' }),\n ),\n metadata: Type.Optional(\n Type.Record(Type.String(), Type.Unknown(), {\n description: 'Arbitrary metadata merged into the task; pass null as a value to delete that key',\n }),\n ),\n },\n { additionalProperties: false },\n);\n\n/**\n * Tool parameters. Every `description` doubles as LLM-facing prompt copy, so\n * wording changes here change model behaviour.\n */\nexport const TaskParamsSchema = Type.Object({\n action: Type.String({\n enum: [...TASK_ACTIONS],\n description:\n 'upsert (create new tasks and change existing ones, one or many per call), list, get, delete (tombstone), clear (close/reset the list), assign (delegate to a subagent), cancel (stop a delegated run)',\n }),\n tasks: Type.Optional(\n Type.Array(TaskItemSchema, {\n minItems: 1,\n description:\n 'upsert only. One entry per task: an entry with an id changes that task, an entry without an id creates one. Entries apply in array order, so a later entry can depend on an earlier one by ref. Each entry succeeds or fails on its own: the ones that succeed are committed and the ones that fail are reported by their array index.',\n }),\n ),\n id: Type.Optional(\n Type.Integer({\n description:\n 'Task id, for get, delete, assign and cancel. upsert does not accept this field — put the id inside the tasks[] entry you want to change.',\n }),\n ),\n status: Type.Optional(\n Type.String({\n enum: [...TASK_STATUSES],\n description:\n 'list only: return just the tasks in this status. To SET a status, use upsert with the task id inside tasks[].',\n }),\n ),\n includeDeleted: Type.Optional(\n Type.Boolean({\n description: 'If true, list returns deleted (tombstoned) tasks as well. Default: false.',\n }),\n ),\n agent: Type.Optional(\n Type.String({\n description: 'Name of the subagent to delegate this task to (required for assign)',\n }),\n ),\n inlineAgent: Type.Optional(InlineAgentSchema),\n instructions: Type.Optional(\n Type.String({\n description: 'Extra instructions appended to the delegated brief (assign only)',\n }),\n ),\n relevantFiles: Type.Optional(\n Type.Array(Type.String(), {\n description: `Files you have ALREADY read or located that the subagent should open first (assign only). Paths relative to the working directory. A child starts with none of your context and otherwise spends most of its run rediscovering the repo. Send only files you actually looked at — a guessed path costs the child more than an omitted one. At most ${MAX_BRIEF_FILES}; extras are dropped.`,\n }),\n ),\n priorFindings: Type.Optional(\n Type.String({\n description:\n 'What you already established about this task and the subagent should not re-derive (assign only): symbol names, call sites, the approach you chose, what you already ruled out. Facts you discovered, not directives — put directives in instructions. Keep it to a few lines; it is truncated past ~1500 characters.',\n }),\n ),\n model: Type.Optional(Type.String({ description: 'Model override for the delegated run (assign only)' })),\n context: Type.Optional(\n Type.String({\n enum: [...TASK_CONTEXTS],\n description:\n \"Subagent starting context (assign only): 'fresh' starts clean, 'fork' inherits this conversation. If omitted, uses the agent default, then fresh.\",\n }),\n ),\n});\n\nexport type TaskItemParams = Static<typeof TaskItemSchema>;\nexport type TaskParams = Static<typeof TaskParamsSchema>;\n"],"mappings":"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"}
1
+ {"version":3,"file":"task.mjs","names":[],"sources":["../../src/schemas/task.ts"],"sourcesContent":["import { InlineAgentSchema } from '@agimon-ai/doompi-extension-contracts/subagent-tool';\nimport { type Static, Type } from 'typebox';\nimport { MAX_BRIEF_FILES } from '../services/delegation/manager.ts';\nimport type { TaskAction } from '../services/store/types.ts';\n\nexport const TASK_ACTIONS = ['upsert', 'list', 'get', 'delete', 'clear', 'assign', 'cancel'] as const;\nexport const TASK_STATUSES = ['pending', 'in_progress', 'completed', 'failed', 'deleted'] as const;\nexport const TASK_CONTEXTS = ['fresh', 'fork'] as const;\n\nexport const TOOL_NAME = 'task';\nexport const TOOL_LABEL = 'Task';\nexport const COMMAND_NAME = 'tasks';\n\nexport const ERR_REQUIRES_INTERACTIVE = '/tasks requires interactive mode';\nexport const MSG_NO_TASKS = 'No tasks yet. Ask the agent to add some!';\n\n/**\n * Which top-level fields each action accepts.\n *\n * The params object is flat and shared across every action, so the schema alone\n * cannot express \"upsert has no top-level id\". That gap matters: a call like\n * `{\"action\":\"upsert\",\"id\":3,\"tasks\":[{\"status\":\"completed\"}]}` would otherwise\n * silently create a duplicate task, because the entry itself carries no id.\n */\nexport const TASK_ACTION_FIELDS = {\n upsert: ['action', 'tasks'],\n list: ['action', 'status', 'includeDeleted'],\n get: ['action', 'id'],\n delete: ['action', 'id'],\n clear: ['action'],\n assign: ['action', 'assignments'],\n cancel: ['action', 'id'],\n} as const satisfies Record<TaskAction, readonly string[]>;\n\nexport function taskActionAcceptsField(action: TaskAction, field: string): boolean {\n return (TASK_ACTION_FIELDS[action] as readonly string[]).includes(field);\n}\n\n/** Correction hint appended when a per-task field lands at the top level. */\nexport const MSG_UPSERT_FIELD_MISPLACED =\n 'Per-task fields belong inside each tasks[] entry, not at the top level: {\"action\":\"upsert\",\"tasks\":[{\"id\":3,\"status\":\"completed\"}]}.';\n\n/**\n * A dependency target: an existing task id, or the `ref` of a task created\n * earlier in the same call.\n */\nconst DepTokenSchema = Type.Union([Type.Integer(), Type.String()]);\n\n/**\n * One entry of an upsert. `additionalProperties: false` is load-bearing: pi\n * validates tool arguments against this schema before `execute` runs, so a\n * stray `{\"action\":\"update\"}` inside an entry is rejected at the boundary.\n */\nexport const TaskItemSchema = Type.Object(\n {\n id: Type.Optional(\n Type.Integer({\n description:\n 'Existing task id to change. Omit to create a new task. An entry with an id never creates: if the id is unknown, only that entry fails.',\n }),\n ),\n ref: Type.Optional(\n Type.String({\n description:\n 'Temporary name for a task created by this entry, so a LATER entry in the same tasks[] can list it in blockedBy before its real id exists. Must start with a letter. Scoped to this one call and never stored; the response reports which real id it became.',\n }),\n ),\n subject: Type.Optional(\n Type.String({\n description:\n \"Short imperative subject line (e.g. 'Research existing tool'). Required when the entry has no id; on an entry with an id it renames the task.\",\n }),\n ),\n description: Type.Optional(\n Type.String({\n description: 'Long-form task detail. This becomes the brief handed to the subagent when the task is assigned.',\n }),\n ),\n activeForm: Type.Optional(\n Type.String({\n description: \"Present-continuous spinner label shown while status is in_progress (e.g. 'writing tests')\",\n }),\n ),\n status: Type.Optional(\n Type.String({\n enum: [...TASK_STATUSES],\n description:\n 'Starting status for a new entry (default pending; deleted is rejected), or the target status for an entry with an id, where the transition must be legal.',\n }),\n ),\n blockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description:\n 'Dependencies for a NEW entry (one with no id): this task is blocked by each target. A number is an existing task id; a string is the ref of a task created by an EARLIER entry in this same array. Use addBlockedBy / removeBlockedBy on an entry that has an id.',\n }),\n ),\n addBlockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description:\n 'Dependencies to add, for an entry with an id. Task ids, or refs declared by an earlier entry. Additive merge — do not resend the full array.',\n }),\n ),\n removeBlockedBy: Type.Optional(\n Type.Array(DepTokenSchema, {\n description: 'Dependencies to remove, for an entry with an id. Additive merge — do not resend the full array.',\n }),\n ),\n owner: Type.Optional(\n Type.String({ description: 'Owner label for this task. assign sets this to the subagent name automatically.' }),\n ),\n metadata: Type.Optional(\n Type.Record(Type.String(), Type.Unknown(), {\n description: 'Arbitrary metadata merged into the task; pass null as a value to delete that key',\n }),\n ),\n },\n { additionalProperties: false },\n);\n\n/** One task-to-agent handoff in a native assignment batch. */\nexport const TaskAssignmentSchema = Type.Object(\n {\n id: Type.Integer({ description: 'Pending, unblocked task id to delegate' }),\n agent: Type.String({ description: 'Exact discovered subagent name' }),\n inlineAgent: Type.Optional(InlineAgentSchema),\n instructions: Type.Optional(Type.String({ description: 'Extra instructions appended to this delegated brief' })),\n relevantFiles: Type.Optional(\n Type.Array(Type.String(), {\n description: `Files already read or located for this task. Paths are relative to the working directory; at most ${MAX_BRIEF_FILES} are used.`,\n }),\n ),\n priorFindings: Type.Optional(\n Type.String({ description: 'Established facts this child should consume rather than re-derive' }),\n ),\n model: Type.Optional(Type.String({ description: 'Model override for this delegated run' })),\n context: Type.Optional(\n Type.String({\n enum: [...TASK_CONTEXTS],\n description: \"Starting context for this child: 'fresh' or 'fork'\",\n }),\n ),\n },\n { additionalProperties: false },\n);\n\n/**\n * Tool parameters. Every `description` doubles as LLM-facing prompt copy, so\n * wording changes here change model behaviour.\n */\nexport const TaskParamsSchema = Type.Object({\n action: Type.String({\n enum: [...TASK_ACTIONS],\n description:\n 'upsert (create new tasks and change existing ones, one or many per call), list, get, delete (tombstone), clear (close/reset the list), assign (delegate one or more tasks through assignments[]), cancel (stop a delegated run)',\n }),\n tasks: Type.Optional(\n Type.Array(TaskItemSchema, {\n minItems: 1,\n description:\n 'upsert only. One entry per task: an entry with an id changes that task, an entry without an id creates one. Entries apply in array order, so a later entry can depend on an earlier one by ref. Each entry succeeds or fails on its own: the ones that succeed are committed and the ones that fail are reported by their array index.',\n }),\n ),\n assignments: Type.Optional(\n Type.Array(TaskAssignmentSchema, {\n minItems: 1,\n description:\n 'Required for assign, including one task. Each entry selects its own pending, unblocked task, agent, model, and context pack; successful entries remain delegated if another entry fails. assign has no top-level single-task form.',\n }),\n ),\n id: Type.Optional(\n Type.Integer({\n description:\n 'Task id, for get, delete, and cancel. For assign, put every id inside assignments[]. upsert does not accept this field — put the id inside the tasks[] entry you want to change.',\n }),\n ),\n status: Type.Optional(\n Type.String({\n enum: [...TASK_STATUSES],\n description:\n 'list only: return just the tasks in this status. To SET a status, use upsert with the task id inside tasks[].',\n }),\n ),\n includeDeleted: Type.Optional(\n Type.Boolean({\n description: 'If true, list returns deleted (tombstoned) tasks as well. Default: false.',\n }),\n ),\n});\n\nexport type TaskItemParams = Static<typeof TaskItemSchema>;\nexport type TaskAssignmentParams = Static<typeof TaskAssignmentSchema>;\nexport type TaskParams = Static<typeof TaskParamsSchema>;\n"],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","names":[],"sources":["../../../src/services/store/types.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-extension-contracts/subagent-tool';\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/**\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 /** `list` filter only. To set a status, upsert the task by id. */\n status?: TaskStatus;\n /** `get`, `delete`, `assign` and `cancel` only. */\n id?: number;\n includeDeleted?: boolean;\n agent?: string;\n inlineAgent?: InlineAgent;\n instructions?: string;\n /** `assign` only: the context pack the parent hands to the child. */\n relevantFiles?: string[];\n priorFindings?: string;\n model?: string;\n context?: 'fresh' | 'fork';\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}\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,CAmGA,SAAgB,EAAmB,EAAqB,CACtD,IAAM,EAAQ,EAAK,YAAY,MAC/B,OAAO,IAAU,aAAe,IAAU,SAC5C"}
1
+ {"version":3,"file":"types.cjs","names":[],"sources":["../../../src/services/store/types.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-extension-contracts/subagent-tool';\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"}