@agimon-ai/doompi-task 0.0.1-alpha.0 → 0.0.1-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/pi/extension.cjs +3 -0
- package/dist/adapters/pi/extension.cjs.map +1 -0
- package/dist/adapters/pi/extension.d.cts +12 -0
- package/dist/adapters/pi/extension.d.cts.map +1 -0
- package/dist/adapters/pi/extension.d.mts +12 -0
- package/dist/adapters/pi/extension.d.mts.map +1 -0
- package/dist/adapters/pi/extension.mjs +3 -0
- package/dist/adapters/pi/extension.mjs.map +1 -0
- package/dist/adapters/store/paths.cjs +2 -0
- package/dist/adapters/store/paths.cjs.map +1 -0
- package/dist/adapters/store/paths.d.cts +26 -0
- package/dist/adapters/store/paths.d.cts.map +1 -0
- package/dist/adapters/store/paths.d.mts +26 -0
- package/dist/adapters/store/paths.d.mts.map +1 -0
- package/dist/adapters/store/paths.mjs +2 -0
- package/dist/adapters/store/paths.mjs.map +1 -0
- package/dist/adapters/store/taskStore.cjs +2 -0
- package/dist/adapters/store/taskStore.cjs.map +1 -0
- package/dist/adapters/store/taskStore.d.cts +87 -0
- package/dist/adapters/store/taskStore.d.cts.map +1 -0
- package/dist/adapters/store/taskStore.d.mts +87 -0
- package/dist/adapters/store/taskStore.d.mts.map +1 -0
- package/dist/adapters/store/taskStore.mjs +2 -0
- package/dist/adapters/store/taskStore.mjs.map +1 -0
- package/dist/adapters/telemetry/logSinkTelemetry.cjs +2 -0
- package/dist/adapters/telemetry/logSinkTelemetry.cjs.map +1 -0
- package/dist/adapters/telemetry/logSinkTelemetry.d.cts +52 -0
- package/dist/adapters/telemetry/logSinkTelemetry.d.cts.map +1 -0
- package/dist/adapters/telemetry/logSinkTelemetry.d.mts +52 -0
- package/dist/adapters/telemetry/logSinkTelemetry.d.mts.map +1 -0
- package/dist/adapters/telemetry/logSinkTelemetry.mjs +2 -0
- package/dist/adapters/telemetry/logSinkTelemetry.mjs.map +1 -0
- package/dist/commands/index.cjs +2 -0
- package/dist/commands/index.cjs.map +1 -0
- package/dist/commands/index.d.cts +15 -0
- package/dist/commands/index.d.cts.map +1 -0
- package/dist/commands/index.d.mts +15 -0
- package/dist/commands/index.d.mts.map +1 -0
- package/dist/commands/index.mjs +2 -0
- package/dist/commands/index.mjs.map +1 -0
- package/dist/commands/task/promptGuidelines.cjs +2 -0
- package/dist/commands/task/promptGuidelines.cjs.map +1 -0
- package/dist/commands/task/promptGuidelines.d.cts +5 -0
- package/dist/commands/task/promptGuidelines.d.cts.map +1 -0
- package/dist/commands/task/promptGuidelines.d.mts +5 -0
- package/dist/commands/task/promptGuidelines.d.mts.map +1 -0
- package/dist/commands/task/promptGuidelines.mjs +2 -0
- package/dist/commands/task/promptGuidelines.mjs.map +1 -0
- package/dist/commands/task/responseEnvelope.cjs +6 -0
- package/dist/commands/task/responseEnvelope.cjs.map +1 -0
- package/dist/commands/task/responseEnvelope.d.cts +39 -0
- package/dist/commands/task/responseEnvelope.d.cts.map +1 -0
- package/dist/commands/task/responseEnvelope.d.mts +39 -0
- package/dist/commands/task/responseEnvelope.d.mts.map +1 -0
- package/dist/commands/task/responseEnvelope.mjs +6 -0
- package/dist/commands/task/responseEnvelope.mjs.map +1 -0
- package/dist/commands/task/taskTool.cjs +3 -0
- package/dist/commands/task/taskTool.cjs.map +1 -0
- package/dist/commands/task/taskTool.d.cts +18 -0
- package/dist/commands/task/taskTool.d.cts.map +1 -0
- package/dist/commands/task/taskTool.d.mts +18 -0
- package/dist/commands/task/taskTool.d.mts.map +1 -0
- package/dist/commands/task/taskTool.mjs +3 -0
- package/dist/commands/task/taskTool.mjs.map +1 -0
- package/dist/commands.cjs +1 -2
- package/dist/commands.d.cts +2 -14
- package/dist/commands.d.mts +2 -14
- package/dist/commands.mjs +1 -2
- package/dist/config.cjs +1 -2
- package/dist/config.d.cts +2 -38
- package/dist/config.d.mts +2 -38
- package/dist/config.mjs +1 -2
- package/dist/delegation/manager.cjs +1 -5
- package/dist/delegation/manager.d.cts +2 -189
- package/dist/delegation/manager.d.mts +2 -189
- package/dist/delegation/manager.mjs +1 -5
- package/dist/extension.cjs +1 -3
- package/dist/extension.d.cts +2 -12
- package/dist/extension.d.mts +2 -12
- package/dist/extension.mjs +1 -3
- package/dist/extensions/doom.cjs +1 -1
- package/dist/extensions/doom.cjs.map +1 -1
- package/dist/extensions/doom.mjs +1 -1
- package/dist/extensions/doom.mjs.map +1 -1
- package/dist/extensions/pi.cjs +1 -1
- package/dist/extensions/pi.cjs.map +1 -1
- package/dist/extensions/pi.d.cts +1 -1
- package/dist/extensions/pi.d.mts +1 -1
- package/dist/extensions/pi.mjs +1 -1
- package/dist/extensions/pi.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +16 -15
- package/dist/index.d.mts +16 -15
- package/dist/index.mjs +1 -1
- package/dist/logSinkTelemetry.cjs +1 -2
- package/dist/logSinkTelemetry.d.cts +2 -51
- package/dist/logSinkTelemetry.d.mts +2 -51
- package/dist/logSinkTelemetry.mjs +1 -2
- package/dist/schemas/task.cjs +2 -0
- package/dist/schemas/task.cjs.map +1 -0
- package/dist/schemas/task.d.cts +86 -0
- package/dist/schemas/task.d.cts.map +1 -0
- package/dist/schemas/task.d.mts +86 -0
- package/dist/schemas/task.d.mts.map +1 -0
- package/dist/schemas/task.mjs +2 -0
- package/dist/schemas/task.mjs.map +1 -0
- package/dist/services/delegation/manager.cjs +6 -0
- package/dist/services/delegation/manager.cjs.map +1 -0
- package/dist/services/delegation/manager.d.cts +188 -0
- package/dist/services/delegation/manager.d.cts.map +1 -0
- package/dist/services/delegation/manager.d.mts +188 -0
- package/dist/services/delegation/manager.d.mts.map +1 -0
- package/dist/services/delegation/manager.mjs +6 -0
- package/dist/services/delegation/manager.mjs.map +1 -0
- package/dist/services/narration/taskNarration.cjs +2 -0
- package/dist/services/narration/taskNarration.cjs.map +1 -0
- package/dist/services/narration/taskNarration.mjs +2 -0
- package/dist/services/narration/taskNarration.mjs.map +1 -0
- package/dist/services/store/invariants.cjs +2 -0
- package/dist/services/store/invariants.cjs.map +1 -0
- package/dist/services/store/invariants.d.cts +14 -0
- package/dist/services/store/invariants.d.cts.map +1 -0
- package/dist/services/store/invariants.d.mts +14 -0
- package/dist/services/store/invariants.d.mts.map +1 -0
- package/dist/services/store/invariants.mjs +2 -0
- package/dist/services/store/invariants.mjs.map +1 -0
- package/dist/services/store/paths.cjs +1 -0
- package/dist/services/store/paths.mjs +1 -0
- package/dist/services/store/processLiveness.cjs +2 -0
- package/dist/services/store/processLiveness.cjs.map +1 -0
- package/dist/services/store/processLiveness.d.cts +12 -0
- package/dist/services/store/processLiveness.d.cts.map +1 -0
- package/dist/services/store/processLiveness.d.mts +12 -0
- package/dist/services/store/processLiveness.d.mts.map +1 -0
- package/dist/services/store/processLiveness.mjs +2 -0
- package/dist/services/store/processLiveness.mjs.map +1 -0
- package/dist/services/store/reconcile.cjs +2 -0
- package/dist/services/store/reconcile.cjs.map +1 -0
- package/dist/services/store/reconcile.d.cts +34 -0
- package/dist/services/store/reconcile.d.cts.map +1 -0
- package/dist/services/store/reconcile.d.mts +34 -0
- package/dist/services/store/reconcile.d.mts.map +1 -0
- package/dist/services/store/reconcile.mjs +2 -0
- package/dist/services/store/reconcile.mjs.map +1 -0
- package/dist/services/store/reducer.cjs +3 -0
- package/dist/services/store/reducer.cjs.map +1 -0
- package/dist/services/store/reducer.d.cts +72 -0
- package/dist/services/store/reducer.d.cts.map +1 -0
- package/dist/services/store/reducer.d.mts +72 -0
- package/dist/services/store/reducer.d.mts.map +1 -0
- package/dist/services/store/reducer.mjs +3 -0
- package/dist/services/store/reducer.mjs.map +1 -0
- package/dist/services/store/taskGraph.cjs +2 -0
- package/dist/services/store/taskGraph.cjs.map +1 -0
- package/dist/services/store/taskGraph.d.cts +25 -0
- package/dist/services/store/taskGraph.d.cts.map +1 -0
- package/dist/services/store/taskGraph.d.mts +25 -0
- package/dist/services/store/taskGraph.d.mts.map +1 -0
- package/dist/services/store/taskGraph.mjs +2 -0
- package/dist/services/store/taskGraph.mjs.map +1 -0
- package/dist/services/store/taskStore.cjs +1 -0
- package/dist/services/store/taskStore.d.cts +2 -0
- package/dist/services/store/taskStore.d.mts +2 -0
- package/dist/services/store/taskStore.mjs +1 -0
- package/dist/services/store/types.cjs +2 -0
- package/dist/services/store/types.cjs.map +1 -0
- package/dist/services/store/types.d.cts +165 -0
- package/dist/services/store/types.d.cts.map +1 -0
- package/dist/services/store/types.d.mts +165 -0
- package/dist/services/store/types.d.mts.map +1 -0
- package/dist/services/store/types.mjs +2 -0
- package/dist/services/store/types.mjs.map +1 -0
- package/dist/store/invariants.cjs +1 -2
- package/dist/store/invariants.d.cts +2 -14
- package/dist/store/invariants.d.mts +2 -14
- package/dist/store/invariants.mjs +1 -2
- package/dist/store/paths.cjs +1 -2
- package/dist/store/paths.d.cts +2 -23
- package/dist/store/paths.d.mts +2 -23
- package/dist/store/paths.mjs +1 -2
- package/dist/store/processLiveness.cjs +1 -2
- package/dist/store/processLiveness.d.cts +2 -12
- package/dist/store/processLiveness.d.mts +2 -12
- package/dist/store/processLiveness.mjs +1 -2
- package/dist/store/reconcile.cjs +1 -2
- package/dist/store/reconcile.d.cts +2 -34
- package/dist/store/reconcile.d.mts +2 -34
- package/dist/store/reconcile.mjs +1 -2
- package/dist/store/reducer.cjs +1 -3
- package/dist/store/reducer.d.cts +2 -72
- package/dist/store/reducer.d.mts +2 -72
- package/dist/store/reducer.mjs +1 -3
- package/dist/store/taskGraph.cjs +1 -2
- package/dist/store/taskGraph.d.cts +2 -25
- package/dist/store/taskGraph.d.mts +2 -25
- package/dist/store/taskGraph.mjs +1 -2
- package/dist/store/taskStore.cjs +1 -2
- package/dist/store/taskStore.d.cts +3 -77
- package/dist/store/taskStore.d.mts +3 -77
- package/dist/store/taskStore.mjs +1 -2
- package/dist/store/types.cjs +1 -2
- package/dist/store/types.d.cts +2 -165
- package/dist/store/types.d.mts +2 -165
- package/dist/store/types.mjs +1 -2
- package/dist/tool/promptGuidelines.cjs +1 -2
- package/dist/tool/promptGuidelines.d.cts +2 -5
- package/dist/tool/promptGuidelines.d.mts +2 -5
- package/dist/tool/promptGuidelines.mjs +1 -2
- package/dist/tool/responseEnvelope.cjs +1 -6
- package/dist/tool/responseEnvelope.d.cts +2 -39
- package/dist/tool/responseEnvelope.d.mts +2 -39
- package/dist/tool/responseEnvelope.mjs +1 -6
- package/dist/tool/schema.cjs +1 -2
- package/dist/tool/schema.d.cts +2 -86
- package/dist/tool/schema.d.mts +2 -86
- package/dist/tool/schema.mjs +1 -2
- package/dist/tool/taskTool.cjs +1 -3
- package/dist/tool/taskTool.d.cts +3 -17
- package/dist/tool/taskTool.d.mts +3 -17
- package/dist/tool/taskTool.mjs +1 -3
- package/dist/tui/format.cjs +3 -3
- package/dist/tui/format.cjs.map +1 -1
- package/dist/tui/format.d.cts +3 -3
- package/dist/tui/format.d.cts.map +1 -1
- package/dist/tui/format.d.mts +3 -3
- package/dist/tui/format.d.mts.map +1 -1
- package/dist/tui/format.mjs +3 -3
- package/dist/tui/format.mjs.map +1 -1
- package/dist/tui/selectors.cjs +1 -1
- package/dist/tui/selectors.cjs.map +1 -1
- package/dist/tui/selectors.d.cts +17 -9
- package/dist/tui/selectors.d.cts.map +1 -1
- package/dist/tui/selectors.d.mts +17 -9
- package/dist/tui/selectors.d.mts.map +1 -1
- package/dist/tui/selectors.mjs +1 -1
- package/dist/tui/selectors.mjs.map +1 -1
- package/dist/tui/taskOverlay.cjs +1 -1
- package/dist/tui/taskOverlay.cjs.map +1 -1
- package/dist/tui/taskOverlay.d.cts +2 -2
- package/dist/tui/taskOverlay.d.cts.map +1 -1
- package/dist/tui/taskOverlay.d.mts +2 -2
- package/dist/tui/taskOverlay.d.mts.map +1 -1
- package/dist/tui/taskOverlay.mjs +1 -1
- package/dist/tui/taskOverlay.mjs.map +1 -1
- package/dist/tui/taskSpace.cjs +1 -1
- package/dist/tui/taskSpace.cjs.map +1 -1
- package/dist/tui/taskSpace.d.cts +2 -1
- package/dist/tui/taskSpace.d.cts.map +1 -1
- package/dist/tui/taskSpace.d.mts +2 -1
- package/dist/tui/taskSpace.d.mts.map +1 -1
- package/dist/tui/taskSpace.mjs +1 -1
- package/dist/tui/taskSpace.mjs.map +1 -1
- package/dist/types/config.cjs +2 -0
- package/dist/types/config.cjs.map +1 -0
- package/dist/types/config.d.cts +38 -0
- package/dist/types/config.d.cts.map +1 -0
- package/dist/types/config.d.mts +38 -0
- package/dist/types/config.d.mts.map +1 -0
- package/dist/types/config.mjs +2 -0
- package/dist/types/config.mjs.map +1 -0
- package/package.json +4 -4
- package/dist/commands.cjs.map +0 -1
- package/dist/commands.d.cts.map +0 -1
- package/dist/commands.d.mts.map +0 -1
- package/dist/commands.mjs.map +0 -1
- package/dist/config.cjs.map +0 -1
- package/dist/config.d.cts.map +0 -1
- package/dist/config.d.mts.map +0 -1
- package/dist/config.mjs.map +0 -1
- package/dist/delegation/manager.cjs.map +0 -1
- package/dist/delegation/manager.d.cts.map +0 -1
- package/dist/delegation/manager.d.mts.map +0 -1
- package/dist/delegation/manager.mjs.map +0 -1
- package/dist/extension.cjs.map +0 -1
- package/dist/extension.d.cts.map +0 -1
- package/dist/extension.d.mts.map +0 -1
- package/dist/extension.mjs.map +0 -1
- package/dist/logSinkTelemetry.cjs.map +0 -1
- package/dist/logSinkTelemetry.d.cts.map +0 -1
- package/dist/logSinkTelemetry.d.mts.map +0 -1
- package/dist/logSinkTelemetry.mjs.map +0 -1
- package/dist/store/invariants.cjs.map +0 -1
- package/dist/store/invariants.d.cts.map +0 -1
- package/dist/store/invariants.d.mts.map +0 -1
- package/dist/store/invariants.mjs.map +0 -1
- package/dist/store/paths.cjs.map +0 -1
- package/dist/store/paths.d.cts.map +0 -1
- package/dist/store/paths.d.mts.map +0 -1
- package/dist/store/paths.mjs.map +0 -1
- package/dist/store/processLiveness.cjs.map +0 -1
- package/dist/store/processLiveness.d.cts.map +0 -1
- package/dist/store/processLiveness.d.mts.map +0 -1
- package/dist/store/processLiveness.mjs.map +0 -1
- package/dist/store/reconcile.cjs.map +0 -1
- package/dist/store/reconcile.d.cts.map +0 -1
- package/dist/store/reconcile.d.mts.map +0 -1
- package/dist/store/reconcile.mjs.map +0 -1
- package/dist/store/reducer.cjs.map +0 -1
- package/dist/store/reducer.d.cts.map +0 -1
- package/dist/store/reducer.d.mts.map +0 -1
- package/dist/store/reducer.mjs.map +0 -1
- package/dist/store/taskGraph.cjs.map +0 -1
- package/dist/store/taskGraph.d.cts.map +0 -1
- package/dist/store/taskGraph.d.mts.map +0 -1
- package/dist/store/taskGraph.mjs.map +0 -1
- package/dist/store/taskStore.cjs.map +0 -1
- package/dist/store/taskStore.d.cts.map +0 -1
- package/dist/store/taskStore.d.mts.map +0 -1
- package/dist/store/taskStore.mjs.map +0 -1
- package/dist/store/types.cjs.map +0 -1
- package/dist/store/types.d.cts.map +0 -1
- package/dist/store/types.d.mts.map +0 -1
- package/dist/store/types.mjs.map +0 -1
- package/dist/tool/promptGuidelines.cjs.map +0 -1
- package/dist/tool/promptGuidelines.d.cts.map +0 -1
- package/dist/tool/promptGuidelines.d.mts.map +0 -1
- package/dist/tool/promptGuidelines.mjs.map +0 -1
- package/dist/tool/responseEnvelope.cjs.map +0 -1
- package/dist/tool/responseEnvelope.d.cts.map +0 -1
- package/dist/tool/responseEnvelope.d.mts.map +0 -1
- package/dist/tool/responseEnvelope.mjs.map +0 -1
- package/dist/tool/schema.cjs.map +0 -1
- package/dist/tool/schema.d.cts.map +0 -1
- package/dist/tool/schema.d.mts.map +0 -1
- package/dist/tool/schema.mjs.map +0 -1
- package/dist/tool/taskTool.cjs.map +0 -1
- package/dist/tool/taskTool.d.cts.map +0 -1
- package/dist/tool/taskTool.d.mts.map +0 -1
- package/dist/tool/taskTool.mjs.map +0 -1
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { InlineAgent } from "@agimon-ai/doompi-extension-contracts/subagent-tool";
|
|
2
|
+
//#region src/services/store/types.d.ts
|
|
3
|
+
type TaskStatus = 'pending' | 'in_progress' | 'completed' | 'failed' | 'deleted';
|
|
4
|
+
declare const DELETED_STATUS: TaskStatus;
|
|
5
|
+
type TaskAction = 'upsert' | 'list' | 'get' | 'delete' | 'clear' | 'assign' | 'cancel';
|
|
6
|
+
type DelegationState = 'requested' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
7
|
+
/** Terminal result of a delegated subagent run, copied off the delegation response. */
|
|
8
|
+
interface DelegationResult {
|
|
9
|
+
status: string;
|
|
10
|
+
output?: string;
|
|
11
|
+
outputPath?: string;
|
|
12
|
+
sessionFile?: string;
|
|
13
|
+
error?: string;
|
|
14
|
+
durationMs?: number;
|
|
15
|
+
toolCount?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Delegation bookkeeping attached to a task that was handed to a subagent.
|
|
19
|
+
*
|
|
20
|
+
* `pid` is the harness process that owns the run: it is the only way to tell an
|
|
21
|
+
* genuinely-running delegation from one orphaned by a harness crash, since the
|
|
22
|
+
* child dies with its parent but the file survives.
|
|
23
|
+
*/
|
|
24
|
+
interface TaskDelegation {
|
|
25
|
+
requestId: string;
|
|
26
|
+
agent: string;
|
|
27
|
+
state: DelegationState;
|
|
28
|
+
sessionId?: string;
|
|
29
|
+
pid?: number;
|
|
30
|
+
runId?: string;
|
|
31
|
+
model?: string;
|
|
32
|
+
startedAt?: string;
|
|
33
|
+
endedAt?: string;
|
|
34
|
+
result?: DelegationResult;
|
|
35
|
+
}
|
|
36
|
+
interface Task {
|
|
37
|
+
id: number;
|
|
38
|
+
subject: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
activeForm?: string;
|
|
41
|
+
status: TaskStatus;
|
|
42
|
+
blockedBy?: number[];
|
|
43
|
+
owner?: string;
|
|
44
|
+
metadata?: Record<string, unknown>;
|
|
45
|
+
createdAt?: string;
|
|
46
|
+
updatedAt?: string;
|
|
47
|
+
delegation?: TaskDelegation;
|
|
48
|
+
}
|
|
49
|
+
declare const STORE_SCHEMA_VERSION = 1;
|
|
50
|
+
/** The complete on-disk document. `rev` increments on every committed write. */
|
|
51
|
+
interface TaskDocument {
|
|
52
|
+
version: number;
|
|
53
|
+
rev: number;
|
|
54
|
+
nextId: number;
|
|
55
|
+
tasks: Task[];
|
|
56
|
+
}
|
|
57
|
+
declare function emptyDocument(): TaskDocument;
|
|
58
|
+
/**
|
|
59
|
+
* A dependency target inside an upsert item: an existing task id, or the `ref`
|
|
60
|
+
* of a task created earlier in the same call.
|
|
61
|
+
*
|
|
62
|
+
* Refs must start with a letter (see `REF_PATTERN`), so a ref is structurally
|
|
63
|
+
* unconfusable with a stringified id and the discrimination is just `typeof`.
|
|
64
|
+
*/
|
|
65
|
+
type DepToken = number | string;
|
|
66
|
+
/**
|
|
67
|
+
* One entry of an `upsert` call. No `id` creates a task; an `id` updates one.
|
|
68
|
+
*
|
|
69
|
+
* `blockedBy` (absolute set) is create-only and `addBlockedBy`/`removeBlockedBy`
|
|
70
|
+
* (additive merge) are update-only, matching the split the two former actions
|
|
71
|
+
* had. A field used against the wrong kind fails that item rather than being
|
|
72
|
+
* silently ignored.
|
|
73
|
+
*/
|
|
74
|
+
interface TaskItemMutation {
|
|
75
|
+
id?: number;
|
|
76
|
+
ref?: string;
|
|
77
|
+
subject?: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
activeForm?: string;
|
|
80
|
+
status?: TaskStatus;
|
|
81
|
+
blockedBy?: DepToken[];
|
|
82
|
+
addBlockedBy?: DepToken[];
|
|
83
|
+
removeBlockedBy?: DepToken[];
|
|
84
|
+
owner?: string;
|
|
85
|
+
metadata?: Record<string, unknown>;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* What one upsert item did. `index` is its position in the request array, so a
|
|
89
|
+
* model reading a partial result can tell which entries still need resending.
|
|
90
|
+
*
|
|
91
|
+
* `message` is unprefixed: the `item[N] failed:` framing belongs to the
|
|
92
|
+
* formatter, because the Task Space overlay shows this text on its own.
|
|
93
|
+
*/
|
|
94
|
+
type UpsertItemOutcome = {
|
|
95
|
+
index: number;
|
|
96
|
+
kind: 'created';
|
|
97
|
+
id: number;
|
|
98
|
+
subject: string;
|
|
99
|
+
status: TaskStatus;
|
|
100
|
+
ref?: string;
|
|
101
|
+
blockedBy?: number[];
|
|
102
|
+
} | {
|
|
103
|
+
index: number;
|
|
104
|
+
kind: 'updated';
|
|
105
|
+
id: number;
|
|
106
|
+
fromStatus: TaskStatus;
|
|
107
|
+
toStatus: TaskStatus;
|
|
108
|
+
} | {
|
|
109
|
+
index: number;
|
|
110
|
+
kind: 'unchanged';
|
|
111
|
+
id: number;
|
|
112
|
+
status: TaskStatus;
|
|
113
|
+
} | {
|
|
114
|
+
index: number;
|
|
115
|
+
kind: 'failed';
|
|
116
|
+
message: string;
|
|
117
|
+
id?: number;
|
|
118
|
+
ref?: string;
|
|
119
|
+
};
|
|
120
|
+
/** Which tasks an upsert touched, so renderResult names them instead of guessing. */
|
|
121
|
+
interface UpsertSummary {
|
|
122
|
+
/** Ids of applied entries, in request order. A failed entry contributes nothing. */
|
|
123
|
+
applied: number[];
|
|
124
|
+
failed: number;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Open-shape input bag the reducer accepts. The index signature lets the
|
|
128
|
+
* runtime pass a TypeBox `Static<typeof TaskParamsSchema>` through without
|
|
129
|
+
* casting each field.
|
|
130
|
+
*
|
|
131
|
+
* Per-task fields live on `tasks[]`, not here: a top-level `subject` or
|
|
132
|
+
* `status` would be ambiguous once one call can carry many tasks.
|
|
133
|
+
*/
|
|
134
|
+
interface TaskMutationParams {
|
|
135
|
+
[key: string]: unknown;
|
|
136
|
+
tasks?: TaskItemMutation[];
|
|
137
|
+
/** `list` filter only. To set a status, upsert the task by id. */
|
|
138
|
+
status?: TaskStatus;
|
|
139
|
+
/** `get`, `delete`, `assign` and `cancel` only. */
|
|
140
|
+
id?: number;
|
|
141
|
+
includeDeleted?: boolean;
|
|
142
|
+
agent?: string;
|
|
143
|
+
inlineAgent?: InlineAgent;
|
|
144
|
+
instructions?: string;
|
|
145
|
+
/** `assign` only: the context pack the parent hands to the child. */
|
|
146
|
+
relevantFiles?: string[];
|
|
147
|
+
priorFindings?: string;
|
|
148
|
+
model?: string;
|
|
149
|
+
context?: 'fresh' | 'fork';
|
|
150
|
+
}
|
|
151
|
+
/** Snapshot returned under a tool result's `details` for renderResult. */
|
|
152
|
+
interface TaskDetails {
|
|
153
|
+
action: TaskAction;
|
|
154
|
+
params: Record<string, unknown>;
|
|
155
|
+
tasks: Task[];
|
|
156
|
+
nextId: number;
|
|
157
|
+
rev: number;
|
|
158
|
+
error?: string;
|
|
159
|
+
upsert?: UpsertSummary;
|
|
160
|
+
}
|
|
161
|
+
/** A delegation is "live" while the owning run may still produce a response. */
|
|
162
|
+
declare function isDelegationActive(task: Task): boolean;
|
|
163
|
+
//#endregion
|
|
164
|
+
export { DELETED_STATUS, DelegationResult, DelegationState, DepToken, STORE_SCHEMA_VERSION, Task, TaskAction, TaskDelegation, TaskDetails, TaskDocument, TaskItemMutation, TaskMutationParams, TaskStatus, UpsertItemOutcome, UpsertSummary, emptyDocument, isDelegationActive };
|
|
165
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../src/services/store/types.ts"],"mappings":";;KAUY;cAEC,gBAAgB;KAEjB;KAEA;;UAGK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;UAUe;EACf;EACA;EACA,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;;UAGM;EACf;EACA;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA,WAAW;EACX;EACA;EACA,aAAa;;cAGF;;UAGI;EACf;EACA;EACA;EACA,OAAO;;iBAGO,iBAAiB;;;;;;;;KAWrB;;;;;;;;;UAUK;EACf;EACA;EACA;EACA;EACA;EACA,SAAS;EACT,YAAY;EACZ,eAAe;EACf,kBAAkB;EAClB;EACA,WAAW;;;;;;;;;KAUD;EAEN;EACA;EACA;EACA;EACA,QAAQ;EACR;EACA;;EAEA;EAAe;EAAiB;EAAY,YAAY;EAAY,UAAU;;EAC9E;EAAe;EAAmB;EAAY,QAAQ;;EACtD;EAAe;EAAgB;EAAiB;EAAa;;;UAGlD;;EAEf;EACA;;;;;;;;;;UAWe;GACd;EACD,QAAQ;;EAER,SAAS;;EAET;EACA;EACA;EACA,cAAc;EACd;;EAEA;EACA;EACA;EACA;;;UAIe;EACf,QAAQ;EACR,QAAQ;EACR,OAAO;EACP;EACA;EACA;EACA,SAAS;;;iBAIK,mBAAmB,MAAM"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=`deleted`,t=1;function n(){return{version:1,rev:0,nextId:1,tasks:[]}}function r(e){let t=e.delegation?.state;return t===`requested`||t===`running`}export{e as DELETED_STATUS,t as STORE_SCHEMA_VERSION,n as emptyDocument,r as isDelegationActive};
|
|
2
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","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":"AAYA,MAAa,EAA6B,UAmD7B,EAAuB,EAUpC,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,2 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=
|
|
2
|
-
//# sourceMappingURL=invariants.cjs.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../services/store/invariants.cjs");exports.VALID_TRANSITIONS=e.VALID_TRANSITIONS,exports.isTransitionValid=e.isTransitionValid;
|
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Allowed forward transitions per source status.
|
|
5
|
-
*
|
|
6
|
-
* `failed` is recoverable (a delegation can be retried) so it may return to
|
|
7
|
-
* pending or in_progress. `completed` is one-way to `deleted`; `deleted` is a
|
|
8
|
-
* terminal tombstone.
|
|
9
|
-
*/
|
|
10
|
-
declare const VALID_TRANSITIONS: Record<TaskStatus, ReadonlySet<TaskStatus>>;
|
|
11
|
-
declare function isTransitionValid(from: TaskStatus, to: TaskStatus): boolean;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { VALID_TRANSITIONS, isTransitionValid };
|
|
14
|
-
//# sourceMappingURL=invariants.d.cts.map
|
|
1
|
+
import { VALID_TRANSITIONS, isTransitionValid } from "../services/store/invariants.cjs";
|
|
2
|
+
export { VALID_TRANSITIONS, isTransitionValid };
|
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Allowed forward transitions per source status.
|
|
5
|
-
*
|
|
6
|
-
* `failed` is recoverable (a delegation can be retried) so it may return to
|
|
7
|
-
* pending or in_progress. `completed` is one-way to `deleted`; `deleted` is a
|
|
8
|
-
* terminal tombstone.
|
|
9
|
-
*/
|
|
10
|
-
declare const VALID_TRANSITIONS: Record<TaskStatus, ReadonlySet<TaskStatus>>;
|
|
11
|
-
declare function isTransitionValid(from: TaskStatus, to: TaskStatus): boolean;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { VALID_TRANSITIONS, isTransitionValid };
|
|
14
|
-
//# sourceMappingURL=invariants.d.mts.map
|
|
1
|
+
import { VALID_TRANSITIONS, isTransitionValid } from "../services/store/invariants.mjs";
|
|
2
|
+
export { VALID_TRANSITIONS, isTransitionValid };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=invariants.mjs.map
|
|
1
|
+
import{VALID_TRANSITIONS as e,isTransitionValid as t}from"../services/store/invariants.mjs";export{e as VALID_TRANSITIONS,t as isTransitionValid};
|
package/dist/store/paths.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../
|
|
2
|
-
//# sourceMappingURL=paths.cjs.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../adapters/store/paths.cjs");require("../services/store/paths.cjs"),exports.STORE_PATH_ENV=e.STORE_PATH_ENV,exports.hasStorePathOverride=e.hasStorePathOverride,exports.lockPathFor=e.lockPathFor,exports.removeLegacyStoreDirectory=e.removeLegacyStoreDirectory,exports.removeLegacyStoreDirectoryAsync=e.removeLegacyStoreDirectoryAsync,exports.resolveLegacyStoreDirectory=e.resolveLegacyStoreDirectory,exports.resolveLegacyStoreDirectoryAsync=e.resolveLegacyStoreDirectoryAsync,exports.resolveSessionKey=e.resolveSessionKey,exports.resolveStorePath=e.resolveStorePath,exports.sweepStoreFiles=e.sweepStoreFiles,exports.sweepStoreFilesAsync=e.sweepStoreFilesAsync,exports.tempPathFor=e.tempPathFor;
|
package/dist/store/paths.d.cts
CHANGED
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/** Resolve the tree root without relying on extension startup order. */
|
|
4
|
-
declare function resolveSessionKey(rootSessionId: string, env?: NodeJS.ProcessEnv): string;
|
|
5
|
-
/** Resolve one root session tree to a task document under the Pi agent directory. */
|
|
6
|
-
declare function resolveStorePath(_cwd?: string, env?: NodeJS.ProcessEnv, sessionKey?: string): string;
|
|
7
|
-
/** Whether a deliberate unscoped task-store override is active. */
|
|
8
|
-
declare function hasStorePathOverride(env?: NodeJS.ProcessEnv): boolean;
|
|
9
|
-
/** Exact legacy Git-directory store, if the current working tree has one. */
|
|
10
|
-
declare function resolveLegacyStoreDirectory(cwd?: string): string | undefined;
|
|
11
|
-
interface StoreSweepResult {
|
|
12
|
-
removed: string[];
|
|
13
|
-
errors: string[];
|
|
14
|
-
}
|
|
15
|
-
/** Remove only the validated legacy Git store unless it contains the active override. */
|
|
16
|
-
declare function removeLegacyStoreDirectory(currentStorePath: string, cwd?: string): StoreSweepResult;
|
|
17
|
-
/** Delete expired sibling session stores while preserving active or unreadable stores. */
|
|
18
|
-
declare function sweepStoreFiles(currentStorePath: string, ttlMs: number, now?: number): StoreSweepResult;
|
|
19
|
-
declare function lockPathFor(storePath: string): string;
|
|
20
|
-
declare function tempPathFor(storePath: string, pid?: number): string;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { STORE_PATH_ENV, StoreSweepResult, hasStorePathOverride, lockPathFor, removeLegacyStoreDirectory, resolveLegacyStoreDirectory, resolveSessionKey, resolveStorePath, sweepStoreFiles, tempPathFor };
|
|
23
|
-
//# sourceMappingURL=paths.d.cts.map
|
|
1
|
+
import { STORE_PATH_ENV, StoreSweepResult, hasStorePathOverride, lockPathFor, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, sweepStoreFiles, sweepStoreFilesAsync, tempPathFor } from "../adapters/store/paths.cjs";
|
|
2
|
+
export { STORE_PATH_ENV, type StoreSweepResult, hasStorePathOverride, lockPathFor, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, sweepStoreFiles, sweepStoreFilesAsync, tempPathFor };
|
package/dist/store/paths.d.mts
CHANGED
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/** Resolve the tree root without relying on extension startup order. */
|
|
4
|
-
declare function resolveSessionKey(rootSessionId: string, env?: NodeJS.ProcessEnv): string;
|
|
5
|
-
/** Resolve one root session tree to a task document under the Pi agent directory. */
|
|
6
|
-
declare function resolveStorePath(_cwd?: string, env?: NodeJS.ProcessEnv, sessionKey?: string): string;
|
|
7
|
-
/** Whether a deliberate unscoped task-store override is active. */
|
|
8
|
-
declare function hasStorePathOverride(env?: NodeJS.ProcessEnv): boolean;
|
|
9
|
-
/** Exact legacy Git-directory store, if the current working tree has one. */
|
|
10
|
-
declare function resolveLegacyStoreDirectory(cwd?: string): string | undefined;
|
|
11
|
-
interface StoreSweepResult {
|
|
12
|
-
removed: string[];
|
|
13
|
-
errors: string[];
|
|
14
|
-
}
|
|
15
|
-
/** Remove only the validated legacy Git store unless it contains the active override. */
|
|
16
|
-
declare function removeLegacyStoreDirectory(currentStorePath: string, cwd?: string): StoreSweepResult;
|
|
17
|
-
/** Delete expired sibling session stores while preserving active or unreadable stores. */
|
|
18
|
-
declare function sweepStoreFiles(currentStorePath: string, ttlMs: number, now?: number): StoreSweepResult;
|
|
19
|
-
declare function lockPathFor(storePath: string): string;
|
|
20
|
-
declare function tempPathFor(storePath: string, pid?: number): string;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { STORE_PATH_ENV, StoreSweepResult, hasStorePathOverride, lockPathFor, removeLegacyStoreDirectory, resolveLegacyStoreDirectory, resolveSessionKey, resolveStorePath, sweepStoreFiles, tempPathFor };
|
|
23
|
-
//# sourceMappingURL=paths.d.mts.map
|
|
1
|
+
import { STORE_PATH_ENV, StoreSweepResult, hasStorePathOverride, lockPathFor, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, sweepStoreFiles, sweepStoreFilesAsync, tempPathFor } from "../adapters/store/paths.mjs";
|
|
2
|
+
export { STORE_PATH_ENV, type StoreSweepResult, hasStorePathOverride, lockPathFor, removeLegacyStoreDirectory, removeLegacyStoreDirectoryAsync, resolveLegacyStoreDirectory, resolveLegacyStoreDirectoryAsync, resolveSessionKey, resolveStorePath, sweepStoreFiles, sweepStoreFilesAsync, tempPathFor };
|
package/dist/store/paths.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
//# sourceMappingURL=paths.mjs.map
|
|
1
|
+
import{STORE_PATH_ENV as e,hasStorePathOverride as t,lockPathFor as n,removeLegacyStoreDirectory as r,removeLegacyStoreDirectoryAsync as i,resolveLegacyStoreDirectory as a,resolveLegacyStoreDirectoryAsync as o,resolveSessionKey as s,resolveStorePath as c,sweepStoreFiles as l,sweepStoreFilesAsync as u,tempPathFor as d}from"../adapters/store/paths.mjs";import"../services/store/paths.mjs";export{e as STORE_PATH_ENV,t as hasStorePathOverride,n as lockPathFor,r as removeLegacyStoreDirectory,i as removeLegacyStoreDirectoryAsync,a as resolveLegacyStoreDirectory,o as resolveLegacyStoreDirectoryAsync,s as resolveSessionKey,c as resolveStorePath,l as sweepStoreFiles,u as sweepStoreFilesAsync,d as tempPathFor};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});
|
|
2
|
-
//# sourceMappingURL=processLiveness.cjs.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../services/store/processLiveness.cjs");exports.isProcessAlive=e.isProcessAlive;
|
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Is a process still running?
|
|
4
|
-
*
|
|
5
|
-
* Signal 0 performs the permission and existence check without delivering a
|
|
6
|
-
* signal. EPERM means the process exists but belongs to another user, which
|
|
7
|
-
* still counts as alive.
|
|
8
|
-
*/
|
|
9
|
-
declare function isProcessAlive(pid: number): boolean;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { isProcessAlive };
|
|
12
|
-
//# sourceMappingURL=processLiveness.d.cts.map
|
|
1
|
+
import { isProcessAlive } from "../services/store/processLiveness.cjs";
|
|
2
|
+
export { isProcessAlive };
|
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Is a process still running?
|
|
4
|
-
*
|
|
5
|
-
* Signal 0 performs the permission and existence check without delivering a
|
|
6
|
-
* signal. EPERM means the process exists but belongs to another user, which
|
|
7
|
-
* still counts as alive.
|
|
8
|
-
*/
|
|
9
|
-
declare function isProcessAlive(pid: number): boolean;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { isProcessAlive };
|
|
12
|
-
//# sourceMappingURL=processLiveness.d.mts.map
|
|
1
|
+
import { isProcessAlive } from "../services/store/processLiveness.mjs";
|
|
2
|
+
export { isProcessAlive };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=processLiveness.mjs.map
|
|
1
|
+
import{isProcessAlive as e}from"../services/store/processLiveness.mjs";export{e as isProcessAlive};
|
package/dist/store/reconcile.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("
|
|
2
|
-
//# sourceMappingURL=reconcile.cjs.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../services/store/reconcile.cjs");exports.ERR_ORPHANED_BY_RESTART=e.ERR_ORPHANED_BY_RESTART,exports.ERR_ORPHANED_BY_SESSION=e.ERR_ORPHANED_BY_SESSION,exports.reconcileOrphanedDelegations=e.reconcileOrphanedDelegations;
|
|
@@ -1,34 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare const ERR_ORPHANED_BY_RESTART = "Delegation orphaned by harness restart";
|
|
4
|
-
declare const ERR_ORPHANED_BY_SESSION = "Delegation orphaned by session restart";
|
|
5
|
-
interface ReconcileResult {
|
|
6
|
-
document: TaskDocument;
|
|
7
|
-
orphaned: Task[];
|
|
8
|
-
}
|
|
9
|
-
/** The delegations this process can still settle, used to spot its own leftovers. */
|
|
10
|
-
interface ReconcileSelf {
|
|
11
|
-
pid: number;
|
|
12
|
-
liveRequestIds: ReadonlySet<string>;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Recover tasks that no longer have anyone able to finish them.
|
|
16
|
-
*
|
|
17
|
-
* A subagent run dies with the harness that spawned it, but the store file
|
|
18
|
-
* outlives both, so a crash leaves tasks stuck in `in_progress` forever. Two
|
|
19
|
-
* kinds of delegation qualify as dead:
|
|
20
|
-
*
|
|
21
|
-
* - the owning pid is gone, so nothing is left to report a result;
|
|
22
|
-
* - the owning pid is *this* process, yet the request is absent from the live
|
|
23
|
-
* set. Settling requires an in-memory record, so an in-process session
|
|
24
|
-
* restart (which clears that map without writing to the store) leaves rows
|
|
25
|
-
* nothing can ever resolve. Checking pid liveness alone misses these, because
|
|
26
|
-
* the pid is our own and very much alive.
|
|
27
|
-
*
|
|
28
|
-
* Delegations owned by a different, still-running pid belong to a parallel
|
|
29
|
-
* session and are left untouched.
|
|
30
|
-
*/
|
|
31
|
-
declare function reconcileOrphanedDelegations(document: TaskDocument, now?: string, isAlive?: (pid: number) => boolean, self?: ReconcileSelf): ReconcileResult;
|
|
32
|
-
//#endregion
|
|
33
|
-
export { ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ReconcileResult, ReconcileSelf, reconcileOrphanedDelegations };
|
|
34
|
-
//# sourceMappingURL=reconcile.d.cts.map
|
|
1
|
+
import { ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ReconcileResult, ReconcileSelf, reconcileOrphanedDelegations } from "../services/store/reconcile.cjs";
|
|
2
|
+
export { ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ReconcileResult, ReconcileSelf, reconcileOrphanedDelegations };
|
|
@@ -1,34 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare const ERR_ORPHANED_BY_RESTART = "Delegation orphaned by harness restart";
|
|
4
|
-
declare const ERR_ORPHANED_BY_SESSION = "Delegation orphaned by session restart";
|
|
5
|
-
interface ReconcileResult {
|
|
6
|
-
document: TaskDocument;
|
|
7
|
-
orphaned: Task[];
|
|
8
|
-
}
|
|
9
|
-
/** The delegations this process can still settle, used to spot its own leftovers. */
|
|
10
|
-
interface ReconcileSelf {
|
|
11
|
-
pid: number;
|
|
12
|
-
liveRequestIds: ReadonlySet<string>;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Recover tasks that no longer have anyone able to finish them.
|
|
16
|
-
*
|
|
17
|
-
* A subagent run dies with the harness that spawned it, but the store file
|
|
18
|
-
* outlives both, so a crash leaves tasks stuck in `in_progress` forever. Two
|
|
19
|
-
* kinds of delegation qualify as dead:
|
|
20
|
-
*
|
|
21
|
-
* - the owning pid is gone, so nothing is left to report a result;
|
|
22
|
-
* - the owning pid is *this* process, yet the request is absent from the live
|
|
23
|
-
* set. Settling requires an in-memory record, so an in-process session
|
|
24
|
-
* restart (which clears that map without writing to the store) leaves rows
|
|
25
|
-
* nothing can ever resolve. Checking pid liveness alone misses these, because
|
|
26
|
-
* the pid is our own and very much alive.
|
|
27
|
-
*
|
|
28
|
-
* Delegations owned by a different, still-running pid belong to a parallel
|
|
29
|
-
* session and are left untouched.
|
|
30
|
-
*/
|
|
31
|
-
declare function reconcileOrphanedDelegations(document: TaskDocument, now?: string, isAlive?: (pid: number) => boolean, self?: ReconcileSelf): ReconcileResult;
|
|
32
|
-
//#endregion
|
|
33
|
-
export { ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ReconcileResult, ReconcileSelf, reconcileOrphanedDelegations };
|
|
34
|
-
//# sourceMappingURL=reconcile.d.mts.map
|
|
1
|
+
import { ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ReconcileResult, ReconcileSelf, reconcileOrphanedDelegations } from "../services/store/reconcile.mjs";
|
|
2
|
+
export { ERR_ORPHANED_BY_RESTART, ERR_ORPHANED_BY_SESSION, ReconcileResult, ReconcileSelf, reconcileOrphanedDelegations };
|
package/dist/store/reconcile.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=reconcile.mjs.map
|
|
1
|
+
import{ERR_ORPHANED_BY_RESTART as e,ERR_ORPHANED_BY_SESSION as t,reconcileOrphanedDelegations as n}from"../services/store/reconcile.mjs";export{e as ERR_ORPHANED_BY_RESTART,t as ERR_ORPHANED_BY_SESSION,n as reconcileOrphanedDelegations};
|
package/dist/store/reducer.cjs
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("
|
|
2
|
-
`)}function o(e){return e.kind===`upsert`?e.items[0]:void 0}function s(e,t){return{document:e,op:{kind:`error`,message:t}}}function c(e,t){let n=e??[],r=t??[];return n.length===r.length&&n.every((e,t)=>e===r[t])}function l(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function u(e,t){return e.subject!==t.subject||e.status!==t.status||e.description!==t.description||e.activeForm!==t.activeForm||e.owner!==t.owner||!c(e.blockedBy,t.blockedBy)||!l(e.metadata,t.metadata)}function d(e,t,n=e.nextId){return{...e,tasks:t,nextId:n}}function f(e,t){let n={...e};for(let[e,r]of Object.entries(t))r===null?delete n[e]:n[e]=r;return Object.keys(n).length?n:void 0}function p(e,t){if(t.subject!==void 0&&(e.subject=t.subject),t.description!==void 0&&(e.description=t.description),t.activeForm!==void 0&&(e.activeForm=t.activeForm),t.owner!==void 0&&(e.owner=t.owner),t.metadata!==void 0){let n=f(e.metadata,t.metadata);n===void 0?delete e.metadata:e.metadata=n}}function m(e,t,n){if(typeof n==`number`)return{ok:!0,id:n};if(!r.test(n))return{ok:!1,message:`${t}: "${n}" is not a valid ref; pass an existing task id as a number`};let i=e.refIds.get(n);if(i!==void 0)return{ok:!0,id:i};let a=e.failedRefs.get(n);return a===void 0?{ok:!1,message:`${t}: unknown ref "${n}" — a ref must be declared by an earlier entry in the same call`}:{ok:!1,message:`${t}: ref "${n}" refers to item[${a}], which failed`}}function h(e){return{ok:!1,message:e}}function g(e,t){if(t.ref!==void 0){if(t.id!==void 0)return`ref is only valid when creating a task; drop the id, or drop the ref`;if(!r.test(t.ref))return`ref "${t.ref}" is invalid: a ref must start with a letter and contain only letters, digits, - or _`;if(e.refIds.get(t.ref)!==void 0||e.failedRefs.has(t.ref))return`duplicate ref "${t.ref}": it was already declared by an earlier entry`}}function _(e,t,n,r){if(t.subject===void 0)return h(`subject is required when the entry has no id`);if(!t.subject.trim())return h(`subject must not be blank`);if(t.addBlockedBy!==void 0||t.removeBlockedBy!==void 0)return h(`addBlockedBy / removeBlockedBy are only for an entry with an id; a new task uses blockedBy`);if(t.status===`deleted`)return h(`cannot create a task with status deleted; create it, then use action delete`);let i=[];for(let n of t.blockedBy??[]){let t=m(e,`blockedBy`,n);if(!t.ok)return h(t.message);let r=e.tasks.find(e=>e.id===t.id);if(!r)return h(`blockedBy: #${t.id} not found`);if(r.status===`deleted`)return h(`blockedBy: #${t.id} is deleted`);i.includes(t.id)||i.push(t.id)}let a={id:e.nextId,subject:t.subject,status:t.status??`pending`,createdAt:r,updatedAt:r};return p(a,t),i.length&&(a.blockedBy=i),e.nextId+=1,e.tasks.push(a),t.ref&&e.refIds.set(t.ref,a.id),{ok:!0,outcome:{index:n,kind:`created`,id:a.id,subject:a.subject,status:a.status,...t.ref?{ref:t.ref}:{},...i.length?{blockedBy:i}:{}}}}function v(e,r,i,a){let o=r.id,s=e.tasks.findIndex(e=>e.id===o);if(s===-1)return h(`#${o} not found`);if(r.blockedBy!==void 0)return h(`blockedBy is only for a new entry; use addBlockedBy / removeBlockedBy on an entry that has an id`);if(!(r.subject!==void 0||r.description!==void 0||r.activeForm!==void 0||r.status!==void 0||r.owner!==void 0||r.metadata!==void 0||r.addBlockedBy?.length||r.removeBlockedBy?.length))return h(`nothing to change: provide at least one of subject, description, activeForm, status, owner, metadata, addBlockedBy, or removeBlockedBy`);let c=e.tasks[s];if(r.subject!==void 0&&!r.subject.trim())return h(`subject must not be blank`);let l=c.status;if(r.status!==void 0){if(!n.isTransitionValid(c.status,r.status))return h(`illegal transition ${c.status} -> ${r.status}`);l=r.status}let d=c.blockedBy?[...c.blockedBy]:[];for(let t of r.removeBlockedBy??[]){let n=m(e,`removeBlockedBy`,t);if(!n.ok)return h(n.message);d=d.filter(e=>e!==n.id)}for(let t of r.addBlockedBy??[]){let n=m(e,`addBlockedBy`,t);if(!n.ok)return h(n.message);if(n.id===o)return h(`cannot block #${o} on itself`);let r=e.tasks.find(e=>e.id===n.id);if(!r)return h(`addBlockedBy: #${n.id} not found`);if(r.status===`deleted`)return h(`addBlockedBy: #${n.id} is deleted`);d.includes(n.id)||d.push(n.id)}let f={...c,status:l};p(f,r),d.length?f.blockedBy=d:delete f.blockedBy;let g=[...e.tasks];if(g[s]=f,r.addBlockedBy?.length&&t.detectCycle(g,o,d))return h(`addBlockedBy would create a cycle in the blockedBy graph`);let _=u(c,f);return _&&(f.updatedAt=a),e.tasks=g,{ok:!0,outcome:_?{index:i,kind:`updated`,id:o,fromStatus:c.status,toStatus:l}:{index:i,kind:`unchanged`,id:o,status:l}}}function y(e,t,n){let i={tasks:[...e.tasks],nextId:e.nextId,refIds:new Map,failedRefs:new Map},a=[],o=0;for(let[e,s]of t.entries()){let t=g(i,s),c=t?h(t):s.id===void 0?_(i,s,e,n):v(i,s,e,n);if(c.ok){a.push(c.outcome),o+=1;continue}s.ref&&r.test(s.ref)&&!i.refIds.has(s.ref)&&i.failedRefs.set(s.ref,e),a.push({index:e,kind:`failed`,message:c.message,...s.id===void 0?{}:{id:s.id},...s.ref?{ref:s.ref}:{}})}return{document:o>0?d(e,i.tasks,i.nextId):e,op:{kind:`upsert`,items:a,applied:o,failed:a.length-o}}}function b(t,n,r,i=new Date().toISOString()){switch(n){case`upsert`:{let e=r.tasks;return!Array.isArray(e)||e.length===0?s(t,`upsert requires a non-empty tasks array, e.g. {"action":"upsert","tasks":[{"subject":"Write tests"}]}`):e.length>100?s(t,`upsert accepts at most 100 entries per call (received ${e.length})`):y(t,e,i)}case`list`:return{document:t,op:{kind:`list`,includeDeleted:r.includeDeleted===!0,...r.status===void 0?{}:{statusFilter:r.status}}};case`get`:{if(r.id===void 0)return s(t,`id required for get`);let e=t.tasks.find(e=>e.id===r.id);return e?{document:t,op:{kind:`get`,task:e}}:s(t,`#${r.id} not found`)}case`delete`:{if(r.id===void 0)return s(t,`id required for delete`);let n=t.tasks.findIndex(e=>e.id===r.id);if(n===-1)return s(t,`#${r.id} not found`);let a=t.tasks[n];if(a.status===`deleted`)return s(t,`#${a.id} is already deleted`);if(e.isDelegationActive(a))return s(t,`#${a.id} has a running delegation — cancel it before deleting`);let o=[...t.tasks];return o[n]={...a,status:e.DELETED_STATUS,updatedAt:i},{document:d(t,o),op:{kind:`delete`,id:a.id,subject:a.subject}}}case`clear`:{let n=t.tasks.filter(e.isDelegationActive);if(n.length>0)return s(t,`cannot clear while delegations are running (${n.map(e=>`#${e.id}`).join(`, `)}) — cancel them first`);let r=t.tasks.length;return{document:d(t,[],1),op:{kind:`clear`,count:r}}}}}exports.MAX_UPSERT_ITEMS=100,exports.REF_PATTERN=r,exports.applyTaskMutation=b,exports.formatUpsertFailure=a,exports.isCommittingOp=i,exports.singleItemOutcome=o;
|
|
3
|
-
//# sourceMappingURL=reducer.cjs.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../services/store/reducer.cjs");exports.MAX_UPSERT_ITEMS=e.MAX_UPSERT_ITEMS,exports.REF_PATTERN=e.REF_PATTERN,exports.applyTaskMutation=e.applyTaskMutation,exports.formatUpsertFailure=e.formatUpsertFailure,exports.isCommittingOp=e.isCommittingOp,exports.singleItemOutcome=e.singleItemOutcome;
|
package/dist/store/reducer.d.cts
CHANGED
|
@@ -1,72 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/** Bounds the work one call can do, and with it the size of one committed write. */
|
|
4
|
-
declare const MAX_UPSERT_ITEMS = 100;
|
|
5
|
-
/**
|
|
6
|
-
* A ref must start with a letter, which makes it structurally unconfusable with
|
|
7
|
-
* a stringified id. That is why resolving a dependency token is just a `typeof`
|
|
8
|
-
* check with no coercion heuristics.
|
|
9
|
-
*/
|
|
10
|
-
declare const REF_PATTERN: RegExp;
|
|
11
|
-
/**
|
|
12
|
-
* Reducer outcome. Closed tagged union: adding an action requires extending
|
|
13
|
-
* this union and the response formatter, which the compiler enforces.
|
|
14
|
-
*
|
|
15
|
-
* `upsert` carries one outcome per request item. It is returned even when every
|
|
16
|
-
* item failed — `error` is reserved for whole-call faults — so the tool layer
|
|
17
|
-
* still has the per-item messages to report.
|
|
18
|
-
*/
|
|
19
|
-
type Op = {
|
|
20
|
-
kind: 'upsert';
|
|
21
|
-
items: UpsertItemOutcome[];
|
|
22
|
-
applied: number;
|
|
23
|
-
failed: number;
|
|
24
|
-
} | {
|
|
25
|
-
kind: 'delete';
|
|
26
|
-
id: number;
|
|
27
|
-
subject: string;
|
|
28
|
-
} | {
|
|
29
|
-
kind: 'list';
|
|
30
|
-
statusFilter?: TaskStatus;
|
|
31
|
-
includeDeleted: boolean;
|
|
32
|
-
} | {
|
|
33
|
-
kind: 'get';
|
|
34
|
-
task: Task;
|
|
35
|
-
} | {
|
|
36
|
-
kind: 'clear';
|
|
37
|
-
count: number;
|
|
38
|
-
} | {
|
|
39
|
-
kind: 'error';
|
|
40
|
-
message: string;
|
|
41
|
-
};
|
|
42
|
-
interface ApplyResult {
|
|
43
|
-
document: TaskDocument;
|
|
44
|
-
op: Op;
|
|
45
|
-
}
|
|
46
|
-
/** Actions the reducer owns. `assign`/`cancel` are handled by the delegation manager. */
|
|
47
|
-
type ReducerAction = Exclude<TaskAction, 'assign' | 'cancel'>;
|
|
48
|
-
/**
|
|
49
|
-
* Does this op represent state that must reach disk?
|
|
50
|
-
*
|
|
51
|
-
* The exhaustive switch is the point: a future `Op` variant cannot be added
|
|
52
|
-
* without declaring its persistence intent, so nothing silently starts or stops
|
|
53
|
-
* bumping `rev`.
|
|
54
|
-
*/
|
|
55
|
-
declare function isCommittingOp(op: Op): boolean;
|
|
56
|
-
/** Joined per-item failures, for the thrown error when an upsert applied nothing. */
|
|
57
|
-
declare function formatUpsertFailure(op: Extract<Op, {
|
|
58
|
-
kind: 'upsert';
|
|
59
|
-
}>): string;
|
|
60
|
-
/** The single item's outcome, for callers that only ever send a batch of one. */
|
|
61
|
-
declare function singleItemOutcome(op: Op): UpsertItemOutcome | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* Pure reducer: (document, action, params) -> (document, op).
|
|
64
|
-
*
|
|
65
|
-
* All validation is in-line: structural guards plus state-aware checks
|
|
66
|
-
* (transition legality, dangling or deleted blockedBy, self-block, cycles,
|
|
67
|
-
* in-flight delegations). The caller owns persistence and formatting.
|
|
68
|
-
*/
|
|
69
|
-
declare function applyTaskMutation(document: TaskDocument, action: ReducerAction, params: TaskMutationParams, now?: string): ApplyResult;
|
|
70
|
-
//#endregion
|
|
71
|
-
export { ApplyResult, MAX_UPSERT_ITEMS, Op, REF_PATTERN, ReducerAction, applyTaskMutation, formatUpsertFailure, isCommittingOp, singleItemOutcome };
|
|
72
|
-
//# sourceMappingURL=reducer.d.cts.map
|
|
1
|
+
import { ApplyResult, MAX_UPSERT_ITEMS, Op, REF_PATTERN, ReducerAction, applyTaskMutation, formatUpsertFailure, isCommittingOp, singleItemOutcome } from "../services/store/reducer.cjs";
|
|
2
|
+
export { ApplyResult, MAX_UPSERT_ITEMS, Op, REF_PATTERN, ReducerAction, applyTaskMutation, formatUpsertFailure, isCommittingOp, singleItemOutcome };
|
package/dist/store/reducer.d.mts
CHANGED
|
@@ -1,72 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/** Bounds the work one call can do, and with it the size of one committed write. */
|
|
4
|
-
declare const MAX_UPSERT_ITEMS = 100;
|
|
5
|
-
/**
|
|
6
|
-
* A ref must start with a letter, which makes it structurally unconfusable with
|
|
7
|
-
* a stringified id. That is why resolving a dependency token is just a `typeof`
|
|
8
|
-
* check with no coercion heuristics.
|
|
9
|
-
*/
|
|
10
|
-
declare const REF_PATTERN: RegExp;
|
|
11
|
-
/**
|
|
12
|
-
* Reducer outcome. Closed tagged union: adding an action requires extending
|
|
13
|
-
* this union and the response formatter, which the compiler enforces.
|
|
14
|
-
*
|
|
15
|
-
* `upsert` carries one outcome per request item. It is returned even when every
|
|
16
|
-
* item failed — `error` is reserved for whole-call faults — so the tool layer
|
|
17
|
-
* still has the per-item messages to report.
|
|
18
|
-
*/
|
|
19
|
-
type Op = {
|
|
20
|
-
kind: 'upsert';
|
|
21
|
-
items: UpsertItemOutcome[];
|
|
22
|
-
applied: number;
|
|
23
|
-
failed: number;
|
|
24
|
-
} | {
|
|
25
|
-
kind: 'delete';
|
|
26
|
-
id: number;
|
|
27
|
-
subject: string;
|
|
28
|
-
} | {
|
|
29
|
-
kind: 'list';
|
|
30
|
-
statusFilter?: TaskStatus;
|
|
31
|
-
includeDeleted: boolean;
|
|
32
|
-
} | {
|
|
33
|
-
kind: 'get';
|
|
34
|
-
task: Task;
|
|
35
|
-
} | {
|
|
36
|
-
kind: 'clear';
|
|
37
|
-
count: number;
|
|
38
|
-
} | {
|
|
39
|
-
kind: 'error';
|
|
40
|
-
message: string;
|
|
41
|
-
};
|
|
42
|
-
interface ApplyResult {
|
|
43
|
-
document: TaskDocument;
|
|
44
|
-
op: Op;
|
|
45
|
-
}
|
|
46
|
-
/** Actions the reducer owns. `assign`/`cancel` are handled by the delegation manager. */
|
|
47
|
-
type ReducerAction = Exclude<TaskAction, 'assign' | 'cancel'>;
|
|
48
|
-
/**
|
|
49
|
-
* Does this op represent state that must reach disk?
|
|
50
|
-
*
|
|
51
|
-
* The exhaustive switch is the point: a future `Op` variant cannot be added
|
|
52
|
-
* without declaring its persistence intent, so nothing silently starts or stops
|
|
53
|
-
* bumping `rev`.
|
|
54
|
-
*/
|
|
55
|
-
declare function isCommittingOp(op: Op): boolean;
|
|
56
|
-
/** Joined per-item failures, for the thrown error when an upsert applied nothing. */
|
|
57
|
-
declare function formatUpsertFailure(op: Extract<Op, {
|
|
58
|
-
kind: 'upsert';
|
|
59
|
-
}>): string;
|
|
60
|
-
/** The single item's outcome, for callers that only ever send a batch of one. */
|
|
61
|
-
declare function singleItemOutcome(op: Op): UpsertItemOutcome | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* Pure reducer: (document, action, params) -> (document, op).
|
|
64
|
-
*
|
|
65
|
-
* All validation is in-line: structural guards plus state-aware checks
|
|
66
|
-
* (transition legality, dangling or deleted blockedBy, self-block, cycles,
|
|
67
|
-
* in-flight delegations). The caller owns persistence and formatting.
|
|
68
|
-
*/
|
|
69
|
-
declare function applyTaskMutation(document: TaskDocument, action: ReducerAction, params: TaskMutationParams, now?: string): ApplyResult;
|
|
70
|
-
//#endregion
|
|
71
|
-
export { ApplyResult, MAX_UPSERT_ITEMS, Op, REF_PATTERN, ReducerAction, applyTaskMutation, formatUpsertFailure, isCommittingOp, singleItemOutcome };
|
|
72
|
-
//# sourceMappingURL=reducer.d.mts.map
|
|
1
|
+
import { ApplyResult, MAX_UPSERT_ITEMS, Op, REF_PATTERN, ReducerAction, applyTaskMutation, formatUpsertFailure, isCommittingOp, singleItemOutcome } from "../services/store/reducer.mjs";
|
|
2
|
+
export { ApplyResult, MAX_UPSERT_ITEMS, Op, REF_PATTERN, ReducerAction, applyTaskMutation, formatUpsertFailure, isCommittingOp, singleItemOutcome };
|