@osolmaz/pi-workflows 0.16.4 → 0.16.6
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 +5 -5
- package/dist/builtins/autoimplement.workflow.d.ts +5 -1
- package/dist/builtins/autoimplement.workflow.js +29 -10
- package/dist/builtins/autoimplement.workflow.js.map +1 -1
- package/dist/client/client.js +3 -1
- package/dist/client/client.js.map +1 -1
- package/dist/client/protocol.d.ts +1 -1
- package/dist/client/protocol.js +18 -1
- package/dist/client/protocol.js.map +1 -1
- package/dist/client/view.d.ts +7 -5
- package/dist/extension/index.d.ts +2 -1
- package/dist/extension/index.js +115 -165
- package/dist/extension/index.js.map +1 -1
- package/dist/extension/recorder.d.ts +1 -1
- package/dist/extension/recorder.js +2 -2
- package/dist/extension/recorder.js.map +1 -1
- package/dist/extension/step-message.d.ts +1 -1
- package/dist/extension/step-message.js +4 -4
- package/dist/extension/step-message.js.map +1 -1
- package/dist/extension/workflow-message-coordinator.d.ts +12 -1
- package/dist/extension/workflow-message-coordinator.js +65 -54
- package/dist/extension/workflow-message-coordinator.js.map +1 -1
- package/dist/resource-managers/index.d.ts +1 -2
- package/dist/resource-managers/index.js +1 -2
- package/dist/resource-managers/index.js.map +1 -1
- package/dist/resource-managers/sqlite.d.ts +2 -295
- package/dist/resource-managers/sqlite.js +71 -1528
- package/dist/resource-managers/sqlite.js.map +1 -1
- package/dist/resource-managers/types.d.ts +2 -7
- package/dist/server/resource-runner-entry.js +2 -6
- package/dist/server/resource-runner-entry.js.map +1 -1
- package/dist/server/rpc-bridge.js +1 -1
- package/dist/server/rpc-bridge.js.map +1 -1
- package/dist/server/rpc-executor.js +2 -4
- package/dist/server/rpc-executor.js.map +1 -1
- package/dist/server/server-entry.js +3 -0
- package/dist/server/server-entry.js.map +1 -1
- package/dist/server/server.d.ts +22 -8
- package/dist/server/server.js +498 -543
- package/dist/server/server.js.map +1 -1
- package/dist/server/state.d.ts +16 -29
- package/dist/server/state.js +105 -319
- package/dist/server/state.js.map +1 -1
- package/dist/server/view.d.ts +4 -5
- package/dist/server/view.js +51 -51
- package/dist/server/view.js.map +1 -1
- package/dist/server/workflow-runner-entry.d.ts +1 -1
- package/dist/server/workflow-runner-entry.js +1 -49
- package/dist/server/workflow-runner-entry.js.map +1 -1
- package/dist/server/workflow-runner-protocol.d.ts +2 -7
- package/dist/server/workflow-runner-protocol.js +5 -10
- package/dist/server/workflow-runner-protocol.js.map +1 -1
- package/dist/server/workflow-runner-store.d.ts +5 -6
- package/dist/server/workflow-runner-store.js +7 -14
- package/dist/server/workflow-runner-store.js.map +1 -1
- package/dist/state/attempt-time.d.ts +21 -0
- package/dist/state/attempt-time.js +95 -0
- package/dist/state/attempt-time.js.map +1 -0
- package/dist/state/json.d.ts +2 -1
- package/dist/state/json.js.map +1 -1
- package/dist/state/project-store.d.ts +39 -0
- package/dist/state/project-store.js +154 -0
- package/dist/state/project-store.js.map +1 -0
- package/dist/state/prune.d.ts +28 -0
- package/dist/state/prune.js +278 -83
- package/dist/state/prune.js.map +1 -1
- package/dist/state/schema.js +23 -23
- package/dist/state/workflow-messages.d.ts +1 -1
- package/dist/state/workflow-messages.js +3 -1
- package/dist/state/workflow-messages.js.map +1 -1
- package/dist/viewer/backup.js +5 -0
- package/dist/viewer/backup.js.map +1 -1
- package/dist/workflows/diagnostics.d.ts +8 -0
- package/dist/workflows/diagnostics.js +61 -0
- package/dist/workflows/diagnostics.js.map +1 -0
- package/dist/workflows/engine.d.ts +2 -15
- package/dist/workflows/engine.js +125 -245
- package/dist/workflows/engine.js.map +1 -1
- package/dist/workflows/human-decision.d.ts +3 -7
- package/dist/workflows/human-decision.js +2 -56
- package/dist/workflows/human-decision.js.map +1 -1
- package/dist/workflows/index.d.ts +2 -1
- package/dist/workflows/index.js +1 -0
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/queue.d.ts +267 -0
- package/dist/workflows/queue.js +1248 -0
- package/dist/workflows/queue.js.map +1 -0
- package/dist/workflows/requests.d.ts +47 -0
- package/dist/workflows/requests.js +158 -0
- package/dist/workflows/requests.js.map +1 -0
- package/dist/workflows/schema.js +2 -4
- package/dist/workflows/schema.js.map +1 -1
- package/dist/workflows/store.d.ts +11 -16
- package/dist/workflows/store.js +174 -169
- package/dist/workflows/store.js.map +1 -1
- package/dist/workflows/tool-input.d.ts +6 -9
- package/dist/workflows/tool-input.js +15 -12
- package/dist/workflows/tool-input.js.map +1 -1
- package/dist/workflows/transitions.d.ts +38 -0
- package/dist/workflows/transitions.js +276 -0
- package/dist/workflows/transitions.js.map +1 -0
- package/dist/workflows/types.d.ts +9 -42
- package/dist/workflows/workflow-message-content.d.ts +7 -1
- package/dist/workflows/workflow-message-content.js +22 -4
- package/dist/workflows/workflow-message-content.js.map +1 -1
- package/docs/2026-08-25-workflow-follow-ups.md +5 -5
- package/docs/2026-09-02-unify-workflow-messages-plan.md +2 -0
- package/docs/2026-09-04-workflow-run-state-plan.md +2 -0
- package/docs/2026-09-06-durable-execution-plan.md +176 -0
- package/docs/DEFERRED_TURNS.md +84 -105
- package/docs/HUMAN_DECISIONS.md +17 -19
- package/docs/HUMAN_DECISION_PRESENTATIONS.md +1 -1
- package/docs/SQLITE_STATE.md +87 -30
- package/docs/WORKFLOW_SERVER.md +50 -11
- package/docs/WORKFLOW_STEP_MESSAGES.md +72 -54
- package/docs/plans/2026-08-04-controller-runtime-plan.md +2 -0
- package/docs/plans/2026-08-21-deferred-turn-intents-plan.md +2 -0
- package/docs/plans/2026-08-27-workflow-terminal-restart-plan.md +2 -0
- package/docs/plans/2026-09-04-automatic-state-retention-plan.md +283 -0
- package/docs/workflows.md +109 -44
- package/examples/workflows/autoresearch.workflow.ts +0 -2
- package/examples/workflows/branch.workflow.ts +0 -4
- package/examples/workflows/echo.workflow.ts +0 -2
- package/examples/workflows/live-settings.workflow.ts +0 -2
- package/examples/workflows/two-turn.workflow.ts +0 -2
- package/herdr-plugin.toml +1 -1
- package/package.json +1 -1
- package/protocol/fixtures/client-v1.json +1 -1
- package/skills/pi-workflows/SKILL.md +8 -7
- package/src/builtins/autoimplement.workflow.ts +31 -10
- package/src/client/client.ts +3 -1
- package/src/client/protocol.ts +21 -1
- package/src/client/view.ts +9 -5
- package/src/extension/index.ts +117 -189
- package/src/extension/recorder.ts +2 -2
- package/src/extension/step-message.ts +4 -4
- package/src/extension/workflow-message-coordinator.ts +78 -50
- package/src/resource-managers/index.ts +1 -9
- package/src/resource-managers/sqlite.ts +330 -2655
- package/src/resource-managers/types.ts +2 -3
- package/src/server/resource-runner-entry.ts +2 -7
- package/src/server/rpc-bridge.ts +1 -1
- package/src/server/rpc-executor.ts +4 -9
- package/src/server/server-entry.ts +3 -0
- package/src/server/server.ts +568 -644
- package/src/server/state.ts +122 -466
- package/src/server/view.ts +56 -60
- package/src/server/workflow-runner-entry.ts +2 -55
- package/src/server/workflow-runner-protocol.ts +5 -15
- package/src/server/workflow-runner-store.ts +12 -27
- package/src/state/attempt-time.ts +122 -0
- package/src/state/json.ts +2 -1
- package/src/state/project-store.ts +218 -0
- package/src/state/prune.ts +408 -95
- package/src/state/schema.ts +23 -23
- package/src/state/workflow-messages.ts +4 -2
- package/src/viewer/backup.ts +7 -0
- package/src/workflows/diagnostics.ts +78 -0
- package/src/workflows/engine.ts +133 -291
- package/src/workflows/human-decision.ts +3 -81
- package/src/workflows/index.ts +8 -2
- package/src/workflows/queue.ts +2091 -0
- package/src/workflows/requests.ts +283 -0
- package/src/workflows/schema.ts +2 -6
- package/src/workflows/store.ts +223 -231
- package/src/workflows/tool-input.ts +20 -12
- package/src/workflows/transitions.ts +330 -0
- package/src/workflows/types.ts +9 -46
- package/src/workflows/workflow-message-content.ts +28 -4
- package/dist/resource-managers/runtime.d.ts +0 -59
- package/dist/resource-managers/runtime.js +0 -423
- package/dist/resource-managers/runtime.js.map +0 -1
- package/src/resource-managers/runtime.ts +0 -576
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { WorkflowRunQueueStore, type RunEventRecord, type WorkflowRunPreparationResult, type WorkflowRunQueueRecord, type WorkflowRunQueueViewRecord, type WorkflowRunReservationOptions, } from "./queue.js";
|
|
1
2
|
export { agent, assistantMessage, action, checkpoint, compute, defineWorkflow, defineWorkflowRegistry, idempotentEffect, includeWorkflow, includedResult, manualEffect, isWorkflowDefinition, notify, shell, } from "./definition.js";
|
|
2
3
|
export { decision, decisionEdge, type DecisionDefinition } from "./decision.js";
|
|
3
4
|
export { MAX_PRESENTATION_BLOCKS, MAX_PRESENTATION_CODE_UNITS, MAX_PRESENTATION_ITEMS, MAX_PRESENTATION_STRING_CODE_UNITS, MAX_PRESENTATION_TRANSPORT_PARTS, decisionDocumentSegments, decisionPresentationDigest, decisionPresentationFingerprint, digestCanonical, humanDecisionChannelRequest, normalizeDecisionPresentation, valueDecisionPresentation, validateHumanDecisionRequestIntegrity, type DecisionDocumentSegment, } from "./decision-presentation.js";
|
|
@@ -16,4 +17,4 @@ export { estimateProgress, formatProgressLine, formatProgressReport, formatRemai
|
|
|
16
17
|
export { MAX_CURRENT_UPDATES, MAX_UPDATE_DATA_BYTES, UPDATE_RATE_BURST, UPDATE_RATE_PER_SECOND, updateProjection, validateProgressData, validateWorkflowUpdate, } from "./updates.js";
|
|
17
18
|
export { sanitizeText, stripAnsi } from "./text.js";
|
|
18
19
|
export { DEFINITION_SNAPSHOT_SCHEMA, RUN_STATE_SCHEMA, SESSION_BINDING_SCHEMA, WorkflowRunStore, createDefinitionSnapshot, createRunId, listWorkflowRuns, readLastTraceEvent, readWorkflowRun, workflowStateDatabasePath, type LoadedWorkflowRun, type ReadWorkflowRunOptions, type RunWriteAuthority, } from "./store.js";
|
|
19
|
-
export type { AcceptedHumanDecision, DefaultedHumanDecision, ResolvedHumanDecision, AgentNodeDefinition, AgentExpectedOutput, AgentStepCompletion, AgentStepContract, AssistantAgentNodeDefinition, AssistantMessageOutput, AssistantMessageReceipt, AgentStepExecutor, AgentStepPresentation, AgentStepRequest, AgentStepSubmission, ActionNodeDefinition, CheckpointNodeDefinition, ConversationRange, ComputeNodeDefinition, FunctionActionNodeDefinition, DecisionPresentation, DecisionPresentationBlock, DecisionPresentationBullets, DecisionPresentationFields, DecisionPresentationParagraph, DecisionPresentationPreformatted, DecisionPresentationSection, HumanDecisionAnswerSource, HumanDecisionAudience, HumanDecisionCancellationRecord, HumanDecisionChannelRequest, HumanDecisionChoice, HumanDecisionChoiceMap,
|
|
20
|
+
export type { AcceptedHumanDecision, DefaultedHumanDecision, ResolvedHumanDecision, AgentNodeDefinition, AgentExpectedOutput, AgentStepCompletion, AgentStepContract, AssistantAgentNodeDefinition, AssistantMessageOutput, AssistantMessageReceipt, AgentStepExecutor, AgentStepPresentation, AgentStepRequest, AgentStepSubmission, ActionNodeDefinition, CheckpointNodeDefinition, ConversationRange, ComputeNodeDefinition, FunctionActionNodeDefinition, DecisionPresentation, DecisionPresentationBlock, DecisionPresentationBullets, DecisionPresentationFields, DecisionPresentationParagraph, DecisionPresentationPreformatted, DecisionPresentationSection, HumanDecisionAnswerSource, HumanDecisionAudience, HumanDecisionCancellationRecord, HumanDecisionChannelRequest, HumanDecisionChoice, HumanDecisionChoiceMap, HumanDecisionDeliveryRecord, HumanDecisionNodeContract, HumanDecisionPrompt, HumanDecisionReceipt, HumanDecisionRequest, HumanDecisionResponse, HumanDecisionSettlementRecord, HumanDecisionSubmission, HumanDecisionTextInput, HumanDecisionTimeout, HumanDecisionTimeoutPolicy, MaybePromise, NotifyNodeDefinition, ShellActionExecution, ShellActionNodeDefinition, SubmittedAgentNodeDefinition, ShellActionResult, WorkflowActionContext, WorkflowActionReceipt, WorkflowCompositionSnapshot, WorkflowDefinition, WorkflowDefinitionSnapshot, WorkflowEdge, WorkflowExitDefinition, WorkflowExitMap, WorkflowExitOutputs, WorkflowIncludeDefinition, WorkflowIncludedResult, WorkflowInputOf, WorkflowSettingsOf, WorkflowMountedSource, WorkflowMountSnapshot, WorkflowValueParser, WorkflowEngineOptions, WorkflowNodeCommon, WorkflowNodeContext, WorkflowNodeDefinition, WorkflowNodeOutcome, WorkflowNodeResult, WorkflowNodeSnapshot, WorkflowNotificationReceipt, WorkflowNotificationRequest, WorkflowNotificationSink, WorkflowProgressData, WorkflowProgressStatus, WorkflowRunResult, WorkflowRunState, WorkflowRunStatus, WorkflowSource, WorkflowSessionBinding, WorkflowSessionEntryRecord, WorkflowSettingsSnapshot, WorkflowStepRecord, WorkflowTraceEvent, WorkflowTraceEventDraft, WorkflowUpdateInput, WorkflowUpdateReceipt, WorkflowUpdateRecord, ShellActionUpdates, ShellUpdateLine, } from "./types.js";
|
package/dist/workflows/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { WorkflowRunQueueStore, } from "./queue.js";
|
|
1
2
|
export { agent, assistantMessage, action, checkpoint, compute, defineWorkflow, defineWorkflowRegistry, idempotentEffect, includeWorkflow, includedResult, manualEffect, isWorkflowDefinition, notify, shell, } from "./definition.js";
|
|
2
3
|
export { decision, decisionEdge } from "./decision.js";
|
|
3
4
|
export { MAX_PRESENTATION_BLOCKS, MAX_PRESENTATION_CODE_UNITS, MAX_PRESENTATION_ITEMS, MAX_PRESENTATION_STRING_CODE_UNITS, MAX_PRESENTATION_TRANSPORT_PARTS, decisionDocumentSegments, decisionPresentationDigest, decisionPresentationFingerprint, digestCanonical, humanDecisionChannelRequest, normalizeDecisionPresentation, valueDecisionPresentation, validateHumanDecisionRequestIntegrity, } from "./decision-presentation.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workflows/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,gBAAgB,EAChB,MAAM,EACN,UAAU,EACV,OAAO,EACP,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,MAAM,EACN,KAAK,GACN,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,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B,EAChB,kBAAkB,GAGnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,EAC7B,uBAAuB,EACvB,8BAA8B,EAC9B,4BAA4B,EAC5B,eAAe,EACf,2BAA2B,GAO5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,GAK1B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,wBAAwB,EACxB,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,yBAAyB,GAI1B,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workflows/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GAMtB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,EACL,gBAAgB,EAChB,MAAM,EACN,UAAU,EACV,OAAO,EACP,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,MAAM,EACN,KAAK,GACN,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAA2B,MAAM,eAAe,CAAC;AAChF,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,sBAAsB,EACtB,kCAAkC,EAClC,gCAAgC,E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EACL,2BAA2B,EAC3B,6BAA6B,EAC7B,uBAAuB,EACvB,8BAA8B,EAC9B,4BAA4B,EAC5B,eAAe,EACf,2BAA2B,GAO5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,GAK1B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,wBAAwB,EACxB,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,yBAAyB,GAI1B,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { type JsonObject } from "../state/json.js";
|
|
2
|
+
import { ProjectStore } from "../state/project-store.js";
|
|
3
|
+
export type WorkflowRunLaunchStatus = "queued" | "starting" | "running" | "parked" | "done" | "failed" | "cancelled";
|
|
4
|
+
export type WorkflowRunReservationOptions = {
|
|
5
|
+
runId: string;
|
|
6
|
+
workflowName: string;
|
|
7
|
+
workflowSourceRef: string;
|
|
8
|
+
workflowSource: unknown;
|
|
9
|
+
definitionDigest: string;
|
|
10
|
+
definitionSnapshot: unknown;
|
|
11
|
+
input: unknown;
|
|
12
|
+
launchOptions?: unknown;
|
|
13
|
+
originSessionId: string;
|
|
14
|
+
executionMode?: "interactive" | "headless";
|
|
15
|
+
parentRunId?: string;
|
|
16
|
+
lineageKind?: "restart";
|
|
17
|
+
restartNumber?: number;
|
|
18
|
+
parentRunRevision?: number;
|
|
19
|
+
now?: string;
|
|
20
|
+
};
|
|
21
|
+
export type WorkflowRunQueueViewRecord = {
|
|
22
|
+
runId: string;
|
|
23
|
+
workflowName: string;
|
|
24
|
+
workflowSourceRef: string;
|
|
25
|
+
workflowSource: unknown;
|
|
26
|
+
initialized: boolean;
|
|
27
|
+
definitionDigest: string;
|
|
28
|
+
runStateStatus: string;
|
|
29
|
+
paused: boolean;
|
|
30
|
+
status: WorkflowRunLaunchStatus;
|
|
31
|
+
originSessionId: string | null;
|
|
32
|
+
executionMode: "interactive" | "headless";
|
|
33
|
+
parentRunId: string | null;
|
|
34
|
+
rootRunId: string;
|
|
35
|
+
lineageKind: "restart" | null;
|
|
36
|
+
restartNumber: number;
|
|
37
|
+
parentRunRevision: number | null;
|
|
38
|
+
errorCode: string | null;
|
|
39
|
+
errorMessage: string | null;
|
|
40
|
+
createdAt: string;
|
|
41
|
+
updatedAt: string;
|
|
42
|
+
startedAt: string | null;
|
|
43
|
+
finishedAt: string | null;
|
|
44
|
+
};
|
|
45
|
+
export type WorkflowRunQueueRecord = {
|
|
46
|
+
runId: string;
|
|
47
|
+
workflowName: string;
|
|
48
|
+
workflowSourceRef: string;
|
|
49
|
+
workflowSource: unknown;
|
|
50
|
+
initialized: boolean;
|
|
51
|
+
definitionDigest: string;
|
|
52
|
+
input: unknown;
|
|
53
|
+
launchOptions: unknown;
|
|
54
|
+
status: WorkflowRunLaunchStatus;
|
|
55
|
+
runnerId: string | null;
|
|
56
|
+
claimToken: string | null;
|
|
57
|
+
claimGeneration: number | null;
|
|
58
|
+
claimExpiresAt: string | null;
|
|
59
|
+
originSessionId: string | null;
|
|
60
|
+
executionMode: "interactive" | "headless";
|
|
61
|
+
parentRunId: string | null;
|
|
62
|
+
rootRunId: string;
|
|
63
|
+
lineageKind: "restart" | null;
|
|
64
|
+
restartNumber: number;
|
|
65
|
+
parentRunRevision: number | null;
|
|
66
|
+
errorCode: string | null;
|
|
67
|
+
errorMessage: string | null;
|
|
68
|
+
createdAt: string;
|
|
69
|
+
updatedAt: string;
|
|
70
|
+
startedAt: string | null;
|
|
71
|
+
finishedAt: string | null;
|
|
72
|
+
};
|
|
73
|
+
export type WorkflowRunPreparationResult = {
|
|
74
|
+
state: "reserved";
|
|
75
|
+
run: WorkflowRunQueueRecord;
|
|
76
|
+
} | {
|
|
77
|
+
state: "adopted";
|
|
78
|
+
run: WorkflowRunQueueRecord;
|
|
79
|
+
};
|
|
80
|
+
export type RunEventRecord = {
|
|
81
|
+
seq: number;
|
|
82
|
+
recordedAt: string;
|
|
83
|
+
runId: string;
|
|
84
|
+
workflowRef: string;
|
|
85
|
+
type: string;
|
|
86
|
+
runnerId: string | null;
|
|
87
|
+
payload: JsonObject;
|
|
88
|
+
};
|
|
89
|
+
export declare class WorkflowRunQueueStore extends ProjectStore {
|
|
90
|
+
private readonly workflowMessages;
|
|
91
|
+
reserveWorkflowRun(options: WorkflowRunReservationOptions): WorkflowRunQueueRecord;
|
|
92
|
+
private reserveWorkflowRunInTransaction;
|
|
93
|
+
reserveOrAdoptWorkflowRun(options: WorkflowRunReservationOptions): WorkflowRunPreparationResult;
|
|
94
|
+
getWorkflowRun(runId: string): WorkflowRunQueueRecord | undefined;
|
|
95
|
+
getWorkflowRunView(runId: string): WorkflowRunQueueViewRecord | undefined;
|
|
96
|
+
workflowRunListRevision(): {
|
|
97
|
+
total: number;
|
|
98
|
+
revision: string;
|
|
99
|
+
};
|
|
100
|
+
listWorkflowRunViews(options: {
|
|
101
|
+
offset: number;
|
|
102
|
+
limit: number;
|
|
103
|
+
}): {
|
|
104
|
+
total: number;
|
|
105
|
+
revision: string;
|
|
106
|
+
runs: WorkflowRunQueueViewRecord[];
|
|
107
|
+
};
|
|
108
|
+
workflowRunProjectPath(runId: string): string | undefined;
|
|
109
|
+
listWorkflowRuns(options?: {
|
|
110
|
+
statuses?: WorkflowRunLaunchStatus[];
|
|
111
|
+
excludeRunIds?: string[];
|
|
112
|
+
limit?: number;
|
|
113
|
+
}): WorkflowRunQueueRecord[];
|
|
114
|
+
findSessionReservation(sessionId: string): WorkflowRunQueueRecord | undefined;
|
|
115
|
+
findSessionReservationView(sessionId: string): WorkflowRunQueueViewRecord | undefined;
|
|
116
|
+
claimWorkflowRun(options: {
|
|
117
|
+
runId: string;
|
|
118
|
+
runnerId: string;
|
|
119
|
+
claimToken: string;
|
|
120
|
+
leaseMs: number;
|
|
121
|
+
now?: string;
|
|
122
|
+
}): WorkflowRunQueueRecord | undefined;
|
|
123
|
+
/** Schedule a runner that validates one pending interactive submission. */
|
|
124
|
+
claimWorkflowRunForInteractionValidation(options: {
|
|
125
|
+
runId: string;
|
|
126
|
+
runnerId: string;
|
|
127
|
+
claimToken: string;
|
|
128
|
+
leaseMs: number;
|
|
129
|
+
now?: string;
|
|
130
|
+
}): WorkflowRunQueueRecord | undefined;
|
|
131
|
+
/** Take a short server claim without scheduling a parked interactive run. */
|
|
132
|
+
claimWorkflowRunForControl(options: {
|
|
133
|
+
runId: string;
|
|
134
|
+
runnerId: string;
|
|
135
|
+
claimToken: string;
|
|
136
|
+
leaseMs: number;
|
|
137
|
+
now?: string;
|
|
138
|
+
}): WorkflowRunQueueRecord | undefined;
|
|
139
|
+
beginWorkflowRunInteractionTimeout(options: {
|
|
140
|
+
runId: string;
|
|
141
|
+
targetSessionId: string;
|
|
142
|
+
claimToken: string;
|
|
143
|
+
now?: string;
|
|
144
|
+
}): boolean;
|
|
145
|
+
markWorkflowRunRunning(options: {
|
|
146
|
+
runId: string;
|
|
147
|
+
claimToken: string;
|
|
148
|
+
now?: string;
|
|
149
|
+
}): boolean;
|
|
150
|
+
claimNextWorkflowRun(options: {
|
|
151
|
+
runnerId: string;
|
|
152
|
+
claimToken: string;
|
|
153
|
+
leaseMs: number;
|
|
154
|
+
now?: string;
|
|
155
|
+
excludeRunIds?: string[];
|
|
156
|
+
}): WorkflowRunQueueRecord | undefined;
|
|
157
|
+
renewWorkflowRunClaim(options: {
|
|
158
|
+
runId: string;
|
|
159
|
+
claimToken: string;
|
|
160
|
+
leaseMs: number;
|
|
161
|
+
now?: string;
|
|
162
|
+
}): boolean;
|
|
163
|
+
verifyWorkflowRunClaim(options: {
|
|
164
|
+
runId: string;
|
|
165
|
+
claimToken: string;
|
|
166
|
+
now?: string;
|
|
167
|
+
}): boolean;
|
|
168
|
+
workflowRunAuthority(runId: string, claimToken: string): {
|
|
169
|
+
actor: {
|
|
170
|
+
type: "session" | "host";
|
|
171
|
+
id: string;
|
|
172
|
+
};
|
|
173
|
+
ownerType: "session" | "host";
|
|
174
|
+
ownerId: string;
|
|
175
|
+
token: string;
|
|
176
|
+
generation: number;
|
|
177
|
+
leaseMs: number;
|
|
178
|
+
} | undefined;
|
|
179
|
+
parkWorkflowRun(options: {
|
|
180
|
+
runId: string;
|
|
181
|
+
claimToken: string;
|
|
182
|
+
now?: string;
|
|
183
|
+
}): boolean;
|
|
184
|
+
parkWorkflowRunForRunnerNoProgress(options: {
|
|
185
|
+
runId: string;
|
|
186
|
+
claimToken: string;
|
|
187
|
+
detail: string;
|
|
188
|
+
now?: string;
|
|
189
|
+
}): boolean;
|
|
190
|
+
pauseParkedWorkflowRun(options: {
|
|
191
|
+
runId: string;
|
|
192
|
+
now?: string;
|
|
193
|
+
}): boolean;
|
|
194
|
+
resumePausedInteraction(options: {
|
|
195
|
+
runId: string;
|
|
196
|
+
now?: string;
|
|
197
|
+
}): boolean;
|
|
198
|
+
requestWorkflowRunResume(options: {
|
|
199
|
+
runId: string;
|
|
200
|
+
now?: string;
|
|
201
|
+
}): boolean;
|
|
202
|
+
isWorkflowRunPaused(runId: string): boolean;
|
|
203
|
+
parkWorkflowRunForSourceChange(options: {
|
|
204
|
+
runId: string;
|
|
205
|
+
claimToken: string;
|
|
206
|
+
detail: string;
|
|
207
|
+
now?: string;
|
|
208
|
+
}): boolean;
|
|
209
|
+
parkWorkflowRunForAmbiguousEffect(options: {
|
|
210
|
+
runId: string;
|
|
211
|
+
claimToken: string;
|
|
212
|
+
now?: string;
|
|
213
|
+
}): boolean;
|
|
214
|
+
failWorkflowRun(options: {
|
|
215
|
+
runId: string;
|
|
216
|
+
claimToken?: string;
|
|
217
|
+
errorCode: string;
|
|
218
|
+
errorMessage: string;
|
|
219
|
+
now?: string;
|
|
220
|
+
}): boolean;
|
|
221
|
+
cancelWorkflowRun(options: {
|
|
222
|
+
runId: string;
|
|
223
|
+
claimToken?: string;
|
|
224
|
+
now?: string;
|
|
225
|
+
}): boolean;
|
|
226
|
+
/** Cancel a nonterminal run only when its claim is absent or expired. */
|
|
227
|
+
cancelStaleWorkflowRun(options: {
|
|
228
|
+
runId: string;
|
|
229
|
+
controlId?: string;
|
|
230
|
+
claimToken?: string;
|
|
231
|
+
now?: string;
|
|
232
|
+
}): boolean;
|
|
233
|
+
deleteWorkflowRun(options: {
|
|
234
|
+
runId: string;
|
|
235
|
+
claimToken: string;
|
|
236
|
+
}): boolean;
|
|
237
|
+
completeWorkflowRun(options: {
|
|
238
|
+
runId: string;
|
|
239
|
+
claimToken: string;
|
|
240
|
+
now?: string;
|
|
241
|
+
}): boolean;
|
|
242
|
+
recordRunEvent(options: {
|
|
243
|
+
runId: string;
|
|
244
|
+
workflowRef: string;
|
|
245
|
+
type: string;
|
|
246
|
+
payload?: JsonObject;
|
|
247
|
+
runnerId?: string;
|
|
248
|
+
now?: string;
|
|
249
|
+
}): RunEventRecord;
|
|
250
|
+
listRunEventsAfter(seq: number, options?: {
|
|
251
|
+
limit?: number;
|
|
252
|
+
}): RunEventRecord[];
|
|
253
|
+
settleRunEffect(runId: string, effectType: "run.park_queue" | "run.settle_queue"): void;
|
|
254
|
+
private workflowRunRow;
|
|
255
|
+
private requireWorkflowRunRow;
|
|
256
|
+
private requireWorkflowRun;
|
|
257
|
+
private assertWorkflowRunPreparationCompatible;
|
|
258
|
+
private workflowRunViewRows;
|
|
259
|
+
private mapWorkflowRun;
|
|
260
|
+
private claimRun;
|
|
261
|
+
private claimRunInTransaction;
|
|
262
|
+
private updateClaimedRunStatus;
|
|
263
|
+
private releaseRunClaim;
|
|
264
|
+
private terminalRun;
|
|
265
|
+
private settleWorkflowRunMessages;
|
|
266
|
+
private cancelWorkflowRunDependents;
|
|
267
|
+
}
|