@osolmaz/pi-workflows 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -31
- package/dist/builtins/autodoc.workflow.d.ts +4 -4
- package/dist/builtins/autoimplement.workflow.d.ts +797 -142
- package/dist/builtins/autoimplement.workflow.js +17 -105
- package/dist/builtins/autoimplement.workflow.js.map +1 -1
- package/dist/builtins/autoplan.workflow.d.ts +126 -13
- package/dist/builtins/autoplan.workflow.js +200 -29
- package/dist/builtins/autoplan.workflow.js.map +1 -1
- package/dist/builtins/catalog.js +7 -5
- package/dist/builtins/catalog.js.map +1 -1
- package/dist/builtins/index.d.ts +4 -2
- package/dist/builtins/index.js +3 -1
- package/dist/builtins/index.js.map +1 -1
- package/dist/builtins/monitor.workflow.d.ts +56 -23
- package/dist/builtins/monitor.workflow.js +508 -329
- package/dist/builtins/monitor.workflow.js.map +1 -1
- package/dist/builtins/pi-agent-group.d.ts +72 -0
- package/dist/builtins/pi-agent-group.js +1087 -0
- package/dist/builtins/pi-agent-group.js.map +1 -0
- package/dist/builtins/plain-summary.workflow.d.ts +32 -0
- package/dist/builtins/plain-summary.workflow.js +134 -0
- package/dist/builtins/plain-summary.workflow.js.map +1 -0
- package/dist/builtins/plan-approval.workflow.d.ts +39 -5
- package/dist/builtins/plan-approval.workflow.js +92 -14
- package/dist/builtins/plan-approval.workflow.js.map +1 -1
- package/dist/builtins/plan-change.workflow.d.ts +449 -0
- package/dist/builtins/plan-change.workflow.js +256 -0
- package/dist/builtins/plan-change.workflow.js.map +1 -0
- package/dist/builtins/plan-presentation.js +2 -2
- package/dist/builtins/plan-presentation.js.map +1 -1
- package/dist/builtins/sanity-check.workflow.d.ts +50 -6
- package/dist/builtins/sanity-check.workflow.js +150 -28
- package/dist/builtins/sanity-check.workflow.js.map +1 -1
- package/dist/controllers/effects.d.ts +3 -2
- package/dist/controllers/effects.js +8 -1
- package/dist/controllers/effects.js.map +1 -1
- package/dist/controllers/index.d.ts +1 -1
- package/dist/controllers/index.js +1 -1
- package/dist/controllers/index.js.map +1 -1
- package/dist/controllers/manager.d.ts +1 -0
- package/dist/controllers/manager.js +41 -17
- package/dist/controllers/manager.js.map +1 -1
- package/dist/controllers/sqlite.d.ts +107 -85
- package/dist/controllers/sqlite.js +1611 -1486
- package/dist/controllers/sqlite.js.map +1 -1
- package/dist/controllers/store.d.ts +9 -8
- package/dist/controllers/store.js +1 -31
- package/dist/controllers/store.js.map +1 -1
- package/dist/controllers/types.d.ts +3 -0
- package/dist/controllers/workflow-engine-scheduler.d.ts +1 -1
- package/dist/controllers/workflow-engine-scheduler.js +3 -5
- package/dist/controllers/workflow-engine-scheduler.js.map +1 -1
- package/dist/controllers/workflows.d.ts +2 -2
- package/dist/controllers/workflows.js +11 -10
- package/dist/controllers/workflows.js.map +1 -1
- package/dist/extension/controller-host.js +2 -2
- package/dist/extension/controller-host.js.map +1 -1
- package/dist/extension/decision-channels.d.ts +4 -2
- package/dist/extension/decision-channels.js +333 -146
- package/dist/extension/decision-channels.js.map +1 -1
- package/dist/extension/executor.d.ts +9 -2
- package/dist/extension/executor.js +89 -2
- package/dist/extension/executor.js.map +1 -1
- package/dist/extension/herdr-viewer.d.ts +0 -1
- package/dist/extension/herdr-viewer.js +0 -4
- package/dist/extension/herdr-viewer.js.map +1 -1
- package/dist/extension/index.js +209 -127
- package/dist/extension/index.js.map +1 -1
- package/dist/extension/recorder.d.ts +3 -10
- package/dist/extension/recorder.js +13 -22
- package/dist/extension/recorder.js.map +1 -1
- package/dist/extension/session-events.d.ts +2 -2
- package/dist/extension/step-message.d.ts +7 -2
- package/dist/extension/step-message.js +94 -2
- package/dist/extension/step-message.js.map +1 -1
- package/dist/extension/widget.js +29 -3
- package/dist/extension/widget.js.map +1 -1
- package/dist/host/rpc-executor.d.ts +3 -0
- package/dist/host/rpc-executor.js +2 -0
- package/dist/host/rpc-executor.js.map +1 -1
- package/dist/host/runner.d.ts +3 -6
- package/dist/host/runner.js +83 -32
- package/dist/host/runner.js.map +1 -1
- package/dist/render/graph-render.js +15 -10
- package/dist/render/graph-render.js.map +1 -1
- package/dist/state/database.d.ts +35 -0
- package/dist/state/database.js +287 -0
- package/dist/state/database.js.map +1 -0
- package/dist/state/index.d.ts +4 -0
- package/dist/state/index.js +5 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/json.d.ts +6 -0
- package/dist/state/json.js +38 -0
- package/dist/state/json.js.map +1 -0
- package/dist/state/mutation.d.ts +57 -0
- package/dist/state/mutation.js +255 -0
- package/dist/state/mutation.js.map +1 -0
- package/dist/state/schema.d.ts +6 -0
- package/dist/state/schema.js +473 -0
- package/dist/state/schema.js.map +1 -0
- package/dist/viewer/cli.d.ts +2 -2
- package/dist/viewer/cli.js +142 -122
- package/dist/viewer/cli.js.map +1 -1
- package/dist/viewer/render.d.ts +4 -4
- package/dist/viewer/render.js +9 -23
- package/dist/viewer/render.js.map +1 -1
- package/dist/viewer/session-reducer.d.ts +1 -1
- package/dist/viewer/session-reducer.js +1 -1
- package/dist/viewer/tui.d.ts +3 -3
- package/dist/viewer/tui.js +15 -13
- package/dist/viewer/tui.js.map +1 -1
- package/dist/viewer/watch.d.ts +2 -5
- package/dist/viewer/watch.js +13 -13
- package/dist/viewer/watch.js.map +1 -1
- package/dist/workflows/catalog.js +7 -2
- package/dist/workflows/catalog.js.map +1 -1
- package/dist/workflows/composition.js +20 -2
- package/dist/workflows/composition.js.map +1 -1
- package/dist/workflows/decision-presentation.d.ts +1 -1
- package/dist/workflows/decision-presentation.js +51 -38
- package/dist/workflows/decision-presentation.js.map +1 -1
- package/dist/workflows/definition.d.ts +6 -2
- package/dist/workflows/definition.js +17 -0
- package/dist/workflows/definition.js.map +1 -1
- package/dist/workflows/engine.d.ts +7 -7
- package/dist/workflows/engine.js +196 -115
- package/dist/workflows/engine.js.map +1 -1
- package/dist/workflows/errors.d.ts +16 -3
- package/dist/workflows/errors.js +18 -3
- package/dist/workflows/errors.js.map +1 -1
- package/dist/workflows/human-decision.d.ts +45 -8
- package/dist/workflows/human-decision.js +641 -274
- package/dist/workflows/human-decision.js.map +1 -1
- package/dist/workflows/index.d.ts +5 -6
- package/dist/workflows/index.js +4 -5
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/progress.d.ts +1 -0
- package/dist/workflows/progress.js +15 -3
- package/dist/workflows/progress.js.map +1 -1
- package/dist/workflows/schema.js +27 -1
- package/dist/workflows/schema.js.map +1 -1
- package/dist/workflows/store.d.ts +83 -103
- package/dist/workflows/store.js +907 -951
- package/dist/workflows/store.js.map +1 -1
- package/dist/workflows/types.d.ts +88 -126
- package/docs/CONTROLLERS.md +10 -8
- package/docs/DEFERRED_TURNS.md +2 -2
- package/docs/DESIGN_PHILOSOPHY.md +4 -2
- package/docs/HUMAN_DECISIONS.md +36 -47
- package/docs/HUMAN_DECISION_PRESENTATIONS.md +14 -24
- package/docs/MONITOR.md +179 -237
- package/docs/SQLITE_STATE.md +219 -0
- package/docs/WORKFLOW_COMPOSITION.md +27 -26
- package/docs/WORKFLOW_STEP_MESSAGES.md +20 -18
- package/docs/WORKFLOW_UPDATES.md +10 -9
- package/docs/development.md +9 -9
- package/docs/live-replay-protocol.md +28 -37
- package/docs/plans/2026-08-16-workflow-updates-plan.md +1 -1
- package/docs/plans/2026-08-19-human-decision-gates-plan.md +1 -1
- package/docs/plans/2026-08-21-autoimplement-timeout-fallback-plan.md +1 -1
- package/docs/plans/2026-08-21-plan-change-approval-policy-plan.md +322 -0
- package/docs/plans/2026-08-21-sanity-check-plan.md +217 -95
- package/docs/plans/2026-08-22-goal-finishing-monitor-plan.md +200 -0
- package/docs/plans/2026-08-23-assistant-agent-completion-plan.md +701 -0
- package/docs/plans/2026-08-23-sqlite-state-plan.md +970 -0
- package/docs/plans/replayable-run-bundles-implementation-plan.md +2 -2
- package/docs/plans/session-event-replay-implementation-plan.md +1 -1
- package/docs/plans/tui-viewer-implementation-plan.md +1 -1
- package/docs/session-event-journal.md +63 -434
- package/docs/tui-viewer.md +13 -15
- package/docs/workflows.md +127 -53
- package/examples/workflows/approved-plan.workflow.ts +19 -46
- package/examples/workflows/plain-summary.workflow.ts +1 -0
- package/herdr-plugin.toml +1 -1
- package/package.json +7 -7
- package/plugins/herdr/viewer.mjs +1 -11
- package/schemas/human-decision-accepted-v1.schema.json +15 -3
- package/schemas/human-decision-continuation-v1.schema.json +10 -1
- package/schemas/human-decision-delivery-v1.schema.json +8 -0
- package/schemas/human-decision-receipt-v1.schema.json +8 -0
- package/schemas/human-decision-request-v1.schema.json +24 -4
- package/skills/autoimplement/SKILL.md +27 -0
- package/skills/autoplan/SKILL.md +5 -4
- package/skills/monitor/SKILL.md +91 -135
- package/skills/pi-workflows/SKILL.md +9 -8
- package/skills/sanity-check/SKILL.md +44 -0
- package/src/builtins/autoimplement.workflow.ts +19 -118
- package/src/builtins/autoplan.workflow.ts +290 -40
- package/src/builtins/catalog.ts +7 -5
- package/src/builtins/index.ts +18 -1
- package/src/builtins/monitor.workflow.ts +673 -382
- package/src/builtins/pi-agent-group.ts +1407 -0
- package/src/builtins/plain-summary.workflow.ts +185 -0
- package/src/builtins/plan-approval.workflow.ts +157 -24
- package/src/builtins/plan-change.workflow.ts +321 -0
- package/src/builtins/plan-presentation.ts +2 -2
- package/src/builtins/sanity-check.workflow.ts +248 -48
- package/src/controllers/effects.ts +7 -0
- package/src/controllers/index.ts +0 -6
- package/src/controllers/manager.ts +72 -32
- package/src/controllers/sqlite.ts +2420 -1948
- package/src/controllers/store.ts +17 -38
- package/src/controllers/types.ts +3 -0
- package/src/controllers/workflow-engine-scheduler.ts +4 -8
- package/src/controllers/workflows.ts +45 -21
- package/src/extension/controller-host.ts +1 -2
- package/src/extension/decision-channels.ts +456 -203
- package/src/extension/executor.ts +105 -2
- package/src/extension/herdr-viewer.ts +0 -5
- package/src/extension/index.ts +251 -151
- package/src/extension/recorder.ts +13 -22
- package/src/extension/session-events.ts +2 -2
- package/src/extension/step-message.ts +106 -4
- package/src/extension/widget.ts +32 -5
- package/src/host/rpc-executor.ts +4 -0
- package/src/host/runner.ts +93 -41
- package/src/render/graph-render.ts +12 -6
- package/src/state/database.ts +375 -0
- package/src/state/index.ts +29 -0
- package/src/state/json.ts +42 -0
- package/src/state/mutation.ts +435 -0
- package/src/state/schema.ts +475 -0
- package/src/viewer/cli.ts +151 -144
- package/src/viewer/render.ts +19 -30
- package/src/viewer/session-reducer.ts +1 -1
- package/src/viewer/tui.ts +18 -17
- package/src/viewer/watch.ts +13 -17
- package/src/workflows/catalog.ts +7 -2
- package/src/workflows/composition.ts +21 -3
- package/src/workflows/decision-presentation.ts +56 -43
- package/src/workflows/definition.ts +36 -3
- package/src/workflows/engine.ts +228 -130
- package/src/workflows/errors.ts +27 -3
- package/src/workflows/human-decision.ts +921 -349
- package/src/workflows/index.ts +20 -30
- package/src/workflows/progress.ts +18 -3
- package/src/workflows/schema.ts +36 -1
- package/src/workflows/store.ts +1300 -1163
- package/src/workflows/types.ts +100 -137
- package/dist/builtins/sanity-check-session.d.ts +0 -17
- package/dist/builtins/sanity-check-session.js +0 -168
- package/dist/builtins/sanity-check-session.js.map +0 -1
- package/dist/workflows/artifacts.d.ts +0 -40
- package/dist/workflows/artifacts.js +0 -155
- package/dist/workflows/artifacts.js.map +0 -1
- package/dist/workflows/migrate-sources.d.ts +0 -42
- package/dist/workflows/migrate-sources.js +0 -133
- package/dist/workflows/migrate-sources.js.map +0 -1
- package/docs/run-bundles.md +0 -481
- package/schemas/human-decision-accepted-v2.schema.json +0 -50
- package/schemas/human-decision-delivery-v2.schema.json +0 -36
- package/schemas/human-decision-receipt-v2.schema.json +0 -39
- package/schemas/human-decision-request-v2.schema.json +0 -69
- package/schemas/human-decision-resolution-v2.schema.json +0 -27
- package/src/builtins/sanity-check-session.ts +0 -205
- package/src/workflows/artifacts.ts +0 -188
- package/src/workflows/migrate-sources.ts +0 -178
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StateDatabase } from "../state/database.js";
|
|
2
|
+
import type { ControllerStore, EffectReservation, QueueItem, QueueRequeueOptions, WorkflowRecordUpdate, WorkflowReservation } from "./store.js";
|
|
2
3
|
import type { ChildWorkflowRecord, ControllerEvent, ControllerQueueClaim, ControllerResource, ControllerResourceRef, ControllerResourceStatus, EffectRecord, JsonObject } from "./types.js";
|
|
3
4
|
declare const TURN_INTENT_FACTS_SCHEMA = "pi-workflows.deferred-turn-facts.v1";
|
|
4
5
|
export type WorkflowRunLaunchStatus = "queued" | "starting" | "running" | "parked" | "done" | "failed" | "cancelled";
|
|
5
|
-
/** A user-started workflow run tracked by the durable run queue. */
|
|
6
6
|
export type WorkflowRunQueueRecord = {
|
|
7
7
|
runId: string;
|
|
8
|
-
/** Human-readable workflow name used in status and event output. */
|
|
9
8
|
workflowName: string;
|
|
10
|
-
/** Canonical source reference used to reopen the run. */
|
|
11
9
|
workflowSourceRef: string;
|
|
12
10
|
workflowSource: unknown;
|
|
11
|
+
initialized: boolean;
|
|
13
12
|
definitionDigest: string;
|
|
14
13
|
input: unknown;
|
|
15
14
|
launchOptions: unknown;
|
|
16
15
|
status: WorkflowRunLaunchStatus;
|
|
17
16
|
runnerId: string | null;
|
|
18
17
|
claimToken: string | null;
|
|
18
|
+
claimGeneration: number | null;
|
|
19
19
|
claimExpiresAt: string | null;
|
|
20
20
|
affinityRunnerId: string | null;
|
|
21
|
-
/** Pi session that owns delivery and interactive execution, or null for detached runs. */
|
|
22
21
|
originSessionId: string | null;
|
|
23
22
|
parentRunId: string | null;
|
|
24
23
|
errorCode: string | null;
|
|
@@ -71,7 +70,6 @@ export type WorkflowTurnIntentRecord = {
|
|
|
71
70
|
resolutionMessageId: string | null;
|
|
72
71
|
deliveryClaimExpiresAt: string | null;
|
|
73
72
|
};
|
|
74
|
-
/** One run lifecycle transition in the cross-session event feed. */
|
|
75
73
|
export type RunEventRecord = {
|
|
76
74
|
seq: number;
|
|
77
75
|
recordedAt: string;
|
|
@@ -83,10 +81,14 @@ export type RunEventRecord = {
|
|
|
83
81
|
};
|
|
84
82
|
export declare class SqliteControllerStore implements ControllerStore {
|
|
85
83
|
readonly filePath: string;
|
|
86
|
-
|
|
84
|
+
readonly state: StateDatabase;
|
|
85
|
+
private readonly ownsState;
|
|
86
|
+
private readonly projectId;
|
|
87
87
|
private closed;
|
|
88
88
|
constructor(filePath?: string, options?: {
|
|
89
89
|
readOnly?: boolean;
|
|
90
|
+
projectPath?: string;
|
|
91
|
+
state?: StateDatabase;
|
|
90
92
|
});
|
|
91
93
|
close(): void;
|
|
92
94
|
putResource<TSpec, TStatus>(options: {
|
|
@@ -104,31 +106,34 @@ export declare class SqliteControllerStore implements ControllerStore {
|
|
|
104
106
|
updateStatus<TStatus>(options: {
|
|
105
107
|
ref: ControllerResourceRef;
|
|
106
108
|
expectedResourceVersion: number;
|
|
109
|
+
claim: ControllerQueueClaim;
|
|
107
110
|
status: ControllerResourceStatus<TStatus>;
|
|
108
111
|
finalizers?: string[];
|
|
109
112
|
now?: string;
|
|
110
113
|
}): ControllerResource<unknown, TStatus>;
|
|
111
|
-
requestDeletion(ref: ControllerResourceRef,
|
|
114
|
+
requestDeletion(ref: ControllerResourceRef, nowValue?: string): ControllerResource;
|
|
112
115
|
updateFinalizers(options: {
|
|
113
116
|
ref: ControllerResourceRef;
|
|
114
117
|
expectedResourceVersion: number;
|
|
115
118
|
finalizers: string[];
|
|
116
119
|
now?: string;
|
|
117
120
|
}): ControllerResource;
|
|
118
|
-
deleteResource(ref: ControllerResourceRef, expectedResourceVersion: number): boolean;
|
|
121
|
+
deleteResource(ref: ControllerResourceRef, expectedResourceVersion: number, claim: ControllerQueueClaim): boolean;
|
|
119
122
|
enqueue(ref: ControllerResourceRef, availableAt?: string): void;
|
|
120
123
|
claimNext(options: {
|
|
121
124
|
controllers: string[];
|
|
125
|
+
ownerId: string;
|
|
122
126
|
leaseMs: number;
|
|
123
127
|
now?: string;
|
|
124
128
|
}): ControllerQueueClaim | undefined;
|
|
125
|
-
renewClaim(claim: ControllerQueueClaim, leaseMs: number,
|
|
126
|
-
settleClaim(claim: ControllerQueueClaim,
|
|
127
|
-
requeueClaim(claim: ControllerQueueClaim, options: QueueRequeueOptions,
|
|
129
|
+
renewClaim(claim: ControllerQueueClaim, leaseMs: number, nowValue?: string): boolean;
|
|
130
|
+
settleClaim(claim: ControllerQueueClaim, nowValue?: string): boolean;
|
|
131
|
+
requeueClaim(claim: ControllerQueueClaim, options: QueueRequeueOptions, nowValue?: string): boolean;
|
|
128
132
|
listQueue(): QueueItem[];
|
|
129
133
|
reserveEffect(options: {
|
|
130
134
|
key: string;
|
|
131
135
|
resourceUid: string;
|
|
136
|
+
claim: ControllerQueueClaim;
|
|
132
137
|
generation: number;
|
|
133
138
|
kind: string;
|
|
134
139
|
requestFingerprint: string;
|
|
@@ -138,6 +143,7 @@ export declare class SqliteControllerStore implements ControllerStore {
|
|
|
138
143
|
updateEffect(options: {
|
|
139
144
|
resourceUid: string;
|
|
140
145
|
key: string;
|
|
146
|
+
claim: ControllerQueueClaim;
|
|
141
147
|
state: EffectRecord["state"];
|
|
142
148
|
externalRef?: string;
|
|
143
149
|
error?: string;
|
|
@@ -146,17 +152,20 @@ export declare class SqliteControllerStore implements ControllerStore {
|
|
|
146
152
|
listEffects(resourceUid: string): EffectRecord[];
|
|
147
153
|
reserveWorkflow(options: {
|
|
148
154
|
resourceUid: string;
|
|
155
|
+
claim: ControllerQueueClaim;
|
|
149
156
|
requestKey: string;
|
|
150
157
|
workflow: string;
|
|
151
158
|
inputFingerprint: string;
|
|
152
159
|
}): WorkflowReservation;
|
|
153
160
|
getWorkflow(resourceUid: string, requestKey: string): ChildWorkflowRecord | undefined;
|
|
154
161
|
getWorkflowByRequestId(requestId: string): ChildWorkflowRecord | undefined;
|
|
155
|
-
updateWorkflow(requestId: string, update: WorkflowRecordUpdate): ChildWorkflowRecord;
|
|
162
|
+
updateWorkflow(requestId: string, update: WorkflowRecordUpdate, claim: ControllerQueueClaim): ChildWorkflowRecord;
|
|
163
|
+
completeWorkflow(requestId: string, update: WorkflowRecordUpdate): ChildWorkflowRecord;
|
|
156
164
|
listWorkflows(resourceUid: string): ChildWorkflowRecord[];
|
|
157
165
|
recordEvent(options: {
|
|
158
166
|
controller: string;
|
|
159
167
|
key: string;
|
|
168
|
+
claim?: ControllerQueueClaim;
|
|
160
169
|
type: string;
|
|
161
170
|
payload?: JsonObject;
|
|
162
171
|
now?: string;
|
|
@@ -166,27 +175,13 @@ export declare class SqliteControllerStore implements ControllerStore {
|
|
|
166
175
|
key?: string;
|
|
167
176
|
limit?: number;
|
|
168
177
|
}): ControllerEvent[];
|
|
169
|
-
private configure;
|
|
170
|
-
private initializeSchema;
|
|
171
|
-
private assertAlphaSchemaLayout;
|
|
172
|
-
private assertNoLegacyPendingLaunchNotifications;
|
|
173
|
-
private transaction;
|
|
174
|
-
private resourceRow;
|
|
175
|
-
private requireResource;
|
|
176
|
-
private throwMissingOrConflict;
|
|
177
|
-
private enqueueRow;
|
|
178
|
-
private claimedRow;
|
|
179
|
-
private effectRow;
|
|
180
|
-
private requireEffect;
|
|
181
|
-
private workflowRow;
|
|
182
|
-
private requireWorkflow;
|
|
183
|
-
/** Reserve a user-started run before the initiating agent turn settles. */
|
|
184
178
|
reserveWorkflowRun(options: {
|
|
185
179
|
runId: string;
|
|
186
180
|
workflowName: string;
|
|
187
181
|
workflowSourceRef: string;
|
|
188
182
|
workflowSource: unknown;
|
|
189
183
|
definitionDigest: string;
|
|
184
|
+
definitionSnapshot: unknown;
|
|
190
185
|
input: unknown;
|
|
191
186
|
launchOptions?: unknown;
|
|
192
187
|
runnerId: string;
|
|
@@ -194,26 +189,27 @@ export declare class SqliteControllerStore implements ControllerStore {
|
|
|
194
189
|
parentRunId?: string;
|
|
195
190
|
now?: string;
|
|
196
191
|
}): WorkflowRunQueueRecord;
|
|
197
|
-
/** Insert a run that will start immediately outside a live model turn. */
|
|
198
192
|
enqueueWorkflowRun(options: {
|
|
199
193
|
runId: string;
|
|
200
194
|
workflowName: string;
|
|
201
195
|
workflowSourceRef: string;
|
|
202
|
-
workflowSource
|
|
203
|
-
definitionDigest
|
|
196
|
+
workflowSource: unknown;
|
|
197
|
+
definitionDigest: string;
|
|
198
|
+
definitionSnapshot: unknown;
|
|
204
199
|
input: unknown;
|
|
205
200
|
launchOptions?: unknown;
|
|
206
201
|
runnerId: string;
|
|
207
202
|
claimToken: string;
|
|
208
203
|
leaseMs: number;
|
|
209
|
-
|
|
210
|
-
originSessionId?: string;
|
|
204
|
+
originSessionId: string;
|
|
211
205
|
parentRunId?: string;
|
|
212
206
|
now?: string;
|
|
213
207
|
}): WorkflowRunQueueRecord;
|
|
214
208
|
getWorkflowRun(runId: string): WorkflowRunQueueRecord | undefined;
|
|
215
209
|
listWorkflowRuns(options?: {
|
|
216
|
-
|
|
210
|
+
statuses?: WorkflowRunLaunchStatus[];
|
|
211
|
+
excludeRunIds?: string[];
|
|
212
|
+
limit?: number;
|
|
217
213
|
}): WorkflowRunQueueRecord[];
|
|
218
214
|
findSessionReservation(sessionId: string): WorkflowRunQueueRecord | undefined;
|
|
219
215
|
claimWorkflowRun(options: {
|
|
@@ -228,35 +224,35 @@ export declare class SqliteControllerStore implements ControllerStore {
|
|
|
228
224
|
claimToken: string;
|
|
229
225
|
now?: string;
|
|
230
226
|
}): boolean;
|
|
231
|
-
/**
|
|
232
|
-
* Claim the oldest claimable run, preferring runs with affinity to this
|
|
233
|
-
* runner. Parked rows are claimable immediately; claimed rows become
|
|
234
|
-
* claimable once their lease expires, so a dead or stalled runner never
|
|
235
|
-
* strands a run. Returns undefined when nothing is claimable.
|
|
236
|
-
*/
|
|
237
227
|
claimNextWorkflowRun(options: {
|
|
238
228
|
runnerId: string;
|
|
229
|
+
sessionId?: string;
|
|
239
230
|
claimToken: string;
|
|
240
231
|
leaseMs: number;
|
|
241
|
-
excludeRunIds?: string[];
|
|
242
|
-
/** Interactive sessions provide their id; detached hosts omit it. */
|
|
243
|
-
sessionId?: string;
|
|
244
232
|
now?: string;
|
|
233
|
+
excludeRunIds?: string[];
|
|
245
234
|
}): WorkflowRunQueueRecord | undefined;
|
|
246
|
-
/** Extend a live claim. Rejects expired or foreign claims. */
|
|
247
235
|
renewWorkflowRunClaim(options: {
|
|
248
236
|
runId: string;
|
|
249
237
|
claimToken: string;
|
|
250
238
|
leaseMs: number;
|
|
251
239
|
now?: string;
|
|
252
240
|
}): boolean;
|
|
253
|
-
/** The fence check: true only while this exact claim is live. */
|
|
254
241
|
verifyWorkflowRunClaim(options: {
|
|
255
242
|
runId: string;
|
|
256
243
|
claimToken: string;
|
|
257
244
|
now?: string;
|
|
258
245
|
}): boolean;
|
|
259
|
-
|
|
246
|
+
workflowRunAuthority(runId: string, claimToken: string): {
|
|
247
|
+
actor: {
|
|
248
|
+
type: "session" | "host";
|
|
249
|
+
id: string;
|
|
250
|
+
};
|
|
251
|
+
ownerType: "session" | "host";
|
|
252
|
+
ownerId: string;
|
|
253
|
+
token: string;
|
|
254
|
+
generation: number;
|
|
255
|
+
} | undefined;
|
|
260
256
|
parkWorkflowRun(options: {
|
|
261
257
|
runId: string;
|
|
262
258
|
claimToken: string;
|
|
@@ -274,52 +270,25 @@ export declare class SqliteControllerStore implements ControllerStore {
|
|
|
274
270
|
claimToken?: string;
|
|
275
271
|
now?: string;
|
|
276
272
|
}): boolean;
|
|
277
|
-
/**
|
|
278
|
-
* Delete a claimed row. Used when a continuation fails before its bundle
|
|
279
|
-
* exists, so the parent's one-continuation slot is not consumed by a run
|
|
280
|
-
* that never happened.
|
|
281
|
-
*/
|
|
282
273
|
deleteWorkflowRun(options: {
|
|
283
274
|
runId: string;
|
|
284
275
|
claimToken: string;
|
|
285
276
|
}): boolean;
|
|
286
|
-
/** Release a claim and mark the run terminal in the queue. */
|
|
287
277
|
completeWorkflowRun(options: {
|
|
288
278
|
runId: string;
|
|
289
279
|
claimToken: string;
|
|
290
280
|
now?: string;
|
|
291
281
|
}): boolean;
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
runId: string;
|
|
295
|
-
workflowName: string;
|
|
296
|
-
workflowSourceRef: string;
|
|
297
|
-
runnerId: string;
|
|
298
|
-
claimToken: string;
|
|
299
|
-
leaseMs: number;
|
|
300
|
-
now?: string;
|
|
301
|
-
}): "unchanged" | "claimed" | false;
|
|
302
|
-
/** Claim and rewrite one proved legacy workflow source queue row atomically. */
|
|
303
|
-
claimLegacyWorkflowSourceRun(options: {
|
|
304
|
-
runId: string;
|
|
305
|
-
workflowName: string;
|
|
306
|
-
oldWorkflowPath: string;
|
|
307
|
-
workflowSourceRef: string;
|
|
308
|
-
runnerId: string;
|
|
309
|
-
claimToken: string;
|
|
310
|
-
leaseMs: number;
|
|
311
|
-
now?: string;
|
|
312
|
-
}): boolean;
|
|
313
|
-
/** Append a run lifecycle transition to the event feed. */
|
|
282
|
+
repairCanonicalWorkflowSourceRun(): never;
|
|
283
|
+
claimLegacyWorkflowSourceRun(): never;
|
|
314
284
|
recordRunEvent(options: {
|
|
315
285
|
runId: string;
|
|
316
286
|
workflowRef: string;
|
|
317
287
|
type: string;
|
|
318
|
-
runnerId?: string;
|
|
319
288
|
payload?: JsonObject;
|
|
289
|
+
runnerId?: string;
|
|
320
290
|
now?: string;
|
|
321
|
-
}):
|
|
322
|
-
/** List run events after a watermark, oldest first. */
|
|
291
|
+
}): RunEventRecord;
|
|
323
292
|
listRunEventsAfter(seq: number, options?: {
|
|
324
293
|
limit?: number;
|
|
325
294
|
}): RunEventRecord[];
|
|
@@ -333,8 +302,8 @@ export declare class SqliteControllerStore implements ControllerStore {
|
|
|
333
302
|
nodeId?: string | null;
|
|
334
303
|
attemptId?: string | null;
|
|
335
304
|
fallbackFacts: WorkflowTurnIntentFacts;
|
|
336
|
-
eligible
|
|
337
|
-
|
|
305
|
+
eligible: boolean;
|
|
306
|
+
requestedAt?: string;
|
|
338
307
|
}): WorkflowTurnIntentRecord;
|
|
339
308
|
getWorkflowTurnIntent(intentId: string): WorkflowTurnIntentRecord | undefined;
|
|
340
309
|
findPendingWorkflowTurnIntent(options: {
|
|
@@ -352,12 +321,13 @@ export declare class SqliteControllerStore implements ControllerStore {
|
|
|
352
321
|
targetSessionId: string;
|
|
353
322
|
claimToken: string;
|
|
354
323
|
leaseMs: number;
|
|
355
|
-
limit?: number;
|
|
356
324
|
now?: string;
|
|
325
|
+
limit?: number;
|
|
357
326
|
}): WorkflowTurnIntentRecord[];
|
|
358
327
|
makeWorkflowTurnIntentEligible(options: {
|
|
359
328
|
intentId: string;
|
|
360
329
|
fallbackFacts: WorkflowTurnIntentFacts;
|
|
330
|
+
eligibleAt?: string;
|
|
361
331
|
now?: string;
|
|
362
332
|
}): boolean;
|
|
363
333
|
resolveWorkflowTurnIntent(options: {
|
|
@@ -365,7 +335,7 @@ export declare class SqliteControllerStore implements ControllerStore {
|
|
|
365
335
|
targetSessionId: string;
|
|
366
336
|
claimToken: string;
|
|
367
337
|
resolution: WorkflowTurnIntentResolution;
|
|
368
|
-
messageId
|
|
338
|
+
messageId?: string;
|
|
369
339
|
now?: string;
|
|
370
340
|
}): boolean;
|
|
371
341
|
releaseWorkflowTurnIntentClaim(options: {
|
|
@@ -374,8 +344,9 @@ export declare class SqliteControllerStore implements ControllerStore {
|
|
|
374
344
|
claimToken: string;
|
|
375
345
|
}): boolean;
|
|
376
346
|
listWorkflowTurnIntents(options?: {
|
|
377
|
-
targetSessionId?: string;
|
|
378
347
|
runId?: string;
|
|
348
|
+
targetSessionId?: string;
|
|
349
|
+
unresolvedOnly?: boolean;
|
|
379
350
|
limit?: number;
|
|
380
351
|
}): WorkflowTurnIntentRecord[];
|
|
381
352
|
enqueueWorkflowNotification(options: {
|
|
@@ -386,15 +357,14 @@ export declare class SqliteControllerStore implements ControllerStore {
|
|
|
386
357
|
targetSessionId: string;
|
|
387
358
|
kind: "progress" | "final";
|
|
388
359
|
content: string;
|
|
389
|
-
notificationId?: string;
|
|
390
360
|
now?: string;
|
|
391
361
|
}): WorkflowNotificationRecord;
|
|
392
362
|
claimPendingWorkflowNotifications(options: {
|
|
393
363
|
targetSessionId: string;
|
|
394
364
|
claimToken: string;
|
|
395
365
|
leaseMs: number;
|
|
396
|
-
limit?: number;
|
|
397
366
|
now?: string;
|
|
367
|
+
limit?: number;
|
|
398
368
|
}): WorkflowNotificationRecord[];
|
|
399
369
|
markWorkflowNotificationDelivered(options: {
|
|
400
370
|
notificationId: string;
|
|
@@ -402,8 +372,60 @@ export declare class SqliteControllerStore implements ControllerStore {
|
|
|
402
372
|
claimToken: string;
|
|
403
373
|
now?: string;
|
|
404
374
|
}): boolean;
|
|
375
|
+
settleRunEffect(runId: string, effectType: "run.park_queue" | "run.settle_queue"): void;
|
|
405
376
|
setWorkflowRunOriginSession(runId: string, originSessionId: string): boolean;
|
|
377
|
+
private ensureProject;
|
|
378
|
+
private findProject;
|
|
379
|
+
private requireProjectId;
|
|
380
|
+
private controllerRow;
|
|
381
|
+
private requireControllerRow;
|
|
382
|
+
private requireControllerRowByUid;
|
|
383
|
+
private requireResource;
|
|
384
|
+
private mapControllerResource;
|
|
385
|
+
private finalizers;
|
|
386
|
+
private replaceFinalizers;
|
|
387
|
+
private enqueueControllerRow;
|
|
388
|
+
private queueErrors;
|
|
389
|
+
private queueVersion;
|
|
390
|
+
private settleControllerClaim;
|
|
391
|
+
private assertControllerClaim;
|
|
392
|
+
private requireLease;
|
|
393
|
+
private releaseLease;
|
|
394
|
+
private resourceRevision;
|
|
395
|
+
private bumpResource;
|
|
396
|
+
private insertEvent;
|
|
397
|
+
private effectRow;
|
|
398
|
+
private requireEffectRow;
|
|
399
|
+
private mapEffect;
|
|
400
|
+
private effectKey;
|
|
401
|
+
private workflowRow;
|
|
402
|
+
private workflowRowById;
|
|
403
|
+
private requireWorkflowRow;
|
|
404
|
+
private mapWorkflow;
|
|
405
|
+
private workflowRunRow;
|
|
406
|
+
private requireWorkflowRunRow;
|
|
406
407
|
private requireWorkflowRun;
|
|
407
|
-
private
|
|
408
|
+
private mapWorkflowRun;
|
|
409
|
+
private claimRun;
|
|
410
|
+
private updateClaimedRunStatus;
|
|
411
|
+
private releaseRunClaim;
|
|
412
|
+
private terminalRun;
|
|
413
|
+
private turnIntent;
|
|
414
|
+
private requireTurnIntent;
|
|
415
|
+
private turnIntentRow;
|
|
416
|
+
private turnIntentBySource;
|
|
417
|
+
private mapTurnIntent;
|
|
418
|
+
private claimEffectForTurn;
|
|
419
|
+
private claimEffect;
|
|
420
|
+
private verifyEffectToken;
|
|
421
|
+
private releaseEffectLease;
|
|
422
|
+
private completeEffect;
|
|
423
|
+
private insertEffectResource;
|
|
424
|
+
private notification;
|
|
425
|
+
private requireNotification;
|
|
426
|
+
private notificationRows;
|
|
427
|
+
private notificationRowById;
|
|
428
|
+
private mapNotification;
|
|
429
|
+
private assertWritable;
|
|
408
430
|
}
|
|
409
431
|
export {};
|