@osolmaz/pi-workflows 0.14.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/README.md +78 -110
  2. package/dist/builtins/autoimplement.workflow.js +3 -1
  3. package/dist/builtins/autoimplement.workflow.js.map +1 -1
  4. package/dist/builtins/change-verification.workflow.js +7 -2
  5. package/dist/builtins/change-verification.workflow.js.map +1 -1
  6. package/dist/builtins/metadata.d.ts +22 -0
  7. package/dist/builtins/metadata.js +10 -0
  8. package/dist/builtins/metadata.js.map +1 -0
  9. package/dist/builtins/monitor.workflow.js +4 -1
  10. package/dist/builtins/monitor.workflow.js.map +1 -1
  11. package/dist/builtins/sanity-check.workflow.js +4 -1
  12. package/dist/builtins/sanity-check.workflow.js.map +1 -1
  13. package/dist/builtins/workspace-preparation.workflow.js +3 -1
  14. package/dist/builtins/workspace-preparation.workflow.js.map +1 -1
  15. package/dist/controllers/index.d.ts +0 -1
  16. package/dist/controllers/index.js +0 -1
  17. package/dist/controllers/index.js.map +1 -1
  18. package/dist/controllers/sqlite.d.ts +51 -0
  19. package/dist/controllers/sqlite.js +433 -57
  20. package/dist/controllers/sqlite.js.map +1 -1
  21. package/dist/controllers/store.d.ts +1 -0
  22. package/dist/extension/controller-command.d.ts +22 -0
  23. package/dist/extension/controller-command.js +32 -0
  24. package/dist/extension/controller-command.js.map +1 -0
  25. package/dist/extension/index.d.ts +2 -9
  26. package/dist/extension/index.js +876 -3447
  27. package/dist/extension/index.js.map +1 -1
  28. package/dist/extension/message-card.d.ts +13 -0
  29. package/dist/extension/message-card.js +46 -0
  30. package/dist/extension/message-card.js.map +1 -0
  31. package/dist/extension/step-message.d.ts +5 -6
  32. package/dist/extension/step-message.js +41 -52
  33. package/dist/extension/step-message.js.map +1 -1
  34. package/dist/host/child-worker-supervisor.d.ts +50 -0
  35. package/dist/host/child-worker-supervisor.js +159 -0
  36. package/dist/host/child-worker-supervisor.js.map +1 -0
  37. package/dist/host/client.d.ts +48 -0
  38. package/dist/host/client.js +216 -0
  39. package/dist/host/client.js.map +1 -0
  40. package/dist/host/controller-worker-entry.d.ts +2 -0
  41. package/dist/host/controller-worker-entry.js +244 -0
  42. package/dist/host/controller-worker-entry.js.map +1 -0
  43. package/dist/host/controller-worker-protocol.d.ts +36 -0
  44. package/dist/host/controller-worker-protocol.js +49 -0
  45. package/dist/host/controller-worker-protocol.js.map +1 -0
  46. package/dist/host/controller-worker-supervisor.d.ts +21 -0
  47. package/dist/host/controller-worker-supervisor.js +54 -0
  48. package/dist/host/controller-worker-supervisor.js.map +1 -0
  49. package/dist/host/host-entry.d.ts +2 -0
  50. package/dist/host/host-entry.js +23 -0
  51. package/dist/host/host-entry.js.map +1 -0
  52. package/dist/host/processes.d.ts +17 -12
  53. package/dist/host/processes.js +154 -50
  54. package/dist/host/processes.js.map +1 -1
  55. package/dist/host/protocol.d.ts +38 -0
  56. package/dist/host/protocol.js +156 -0
  57. package/dist/host/protocol.js.map +1 -0
  58. package/dist/host/resolver-entry.d.ts +49 -0
  59. package/dist/host/resolver-entry.js +149 -0
  60. package/dist/host/resolver-entry.js.map +1 -0
  61. package/dist/host/rpc-executor.d.ts +14 -3
  62. package/dist/host/rpc-executor.js +63 -30
  63. package/dist/host/rpc-executor.js.map +1 -1
  64. package/dist/host/runner.d.ts +95 -29
  65. package/dist/host/runner.js +2311 -348
  66. package/dist/host/runner.js.map +1 -1
  67. package/dist/host/state.d.ts +174 -0
  68. package/dist/host/state.js +689 -0
  69. package/dist/host/state.js.map +1 -0
  70. package/dist/host/worker-entry.d.ts +10 -0
  71. package/dist/host/worker-entry.js +446 -0
  72. package/dist/host/worker-entry.js.map +1 -0
  73. package/dist/host/worker-protocol.d.ts +31 -0
  74. package/dist/host/worker-protocol.js +122 -0
  75. package/dist/host/worker-protocol.js.map +1 -0
  76. package/dist/host/worker-store.d.ts +80 -0
  77. package/dist/host/worker-store.js +91 -0
  78. package/dist/host/worker-store.js.map +1 -0
  79. package/dist/host/worker-supervisor.d.ts +22 -0
  80. package/dist/host/worker-supervisor.js +54 -0
  81. package/dist/host/worker-supervisor.js.map +1 -0
  82. package/dist/render/canvas.d.ts +2 -1
  83. package/dist/render/canvas.js +40 -15
  84. package/dist/render/canvas.js.map +1 -1
  85. package/dist/render/graph-render.d.ts +7 -3
  86. package/dist/render/graph-render.js +125 -74
  87. package/dist/render/graph-render.js.map +1 -1
  88. package/dist/state/database.js +3 -1
  89. package/dist/state/database.js.map +1 -1
  90. package/dist/state/index.d.ts +1 -0
  91. package/dist/state/index.js +1 -0
  92. package/dist/state/index.js.map +1 -1
  93. package/dist/state/schema.d.ts +1 -1
  94. package/dist/state/schema.js +171 -3
  95. package/dist/state/schema.js.map +1 -1
  96. package/dist/state/viewer.d.ts +46 -0
  97. package/dist/state/viewer.js +249 -0
  98. package/dist/state/viewer.js.map +1 -0
  99. package/dist/viewer/cli.d.ts +1 -1
  100. package/dist/viewer/cli.js +47 -18
  101. package/dist/viewer/cli.js.map +1 -1
  102. package/dist/workflows/composition.js +25 -2
  103. package/dist/workflows/composition.js.map +1 -1
  104. package/dist/workflows/definition.d.ts +3 -1
  105. package/dist/workflows/definition.js +25 -0
  106. package/dist/workflows/definition.js.map +1 -1
  107. package/dist/workflows/engine.d.ts +1 -0
  108. package/dist/workflows/engine.js +157 -42
  109. package/dist/workflows/engine.js.map +1 -1
  110. package/dist/workflows/errors.d.ts +3 -1
  111. package/dist/workflows/errors.js +4 -7
  112. package/dist/workflows/errors.js.map +1 -1
  113. package/dist/workflows/human-decision.d.ts +3 -0
  114. package/dist/workflows/human-decision.js +31 -0
  115. package/dist/workflows/human-decision.js.map +1 -1
  116. package/dist/workflows/index.d.ts +1 -1
  117. package/dist/workflows/index.js +1 -1
  118. package/dist/workflows/index.js.map +1 -1
  119. package/dist/workflows/schema.js +17 -6
  120. package/dist/workflows/schema.js.map +1 -1
  121. package/dist/{viewer → workflows}/session-reducer.d.ts +3 -1
  122. package/dist/{viewer → workflows}/session-reducer.js +4 -0
  123. package/dist/workflows/session-reducer.js.map +1 -0
  124. package/dist/workflows/store.d.ts +87 -1
  125. package/dist/workflows/store.js +892 -93
  126. package/dist/workflows/store.js.map +1 -1
  127. package/dist/workflows/tool-input.d.ts +0 -26
  128. package/dist/workflows/tool-input.js +2 -50
  129. package/dist/workflows/tool-input.js.map +1 -1
  130. package/dist/workflows/types.d.ts +36 -4
  131. package/docs/2026-08-30-out-of-process-workflow-host-plan.md +353 -0
  132. package/docs/CONTROLLERS.md +11 -11
  133. package/docs/DEFERRED_TURNS.md +23 -2
  134. package/docs/SQLITE_STATE.md +41 -31
  135. package/docs/WORKFLOW_HOST.md +452 -0
  136. package/docs/development.md +46 -30
  137. package/docs/live-replay-protocol.md +129 -100
  138. package/docs/plans/2026-08-27-workflow-terminal-restart-plan.md +42 -0
  139. package/docs/plans/2026-08-28-piw-incremental-viewer-plan.md +293 -0
  140. package/docs/plans/piw-viewer-experience-implementation-plan.md +11 -1
  141. package/docs/plans/tui-viewer-implementation-plan.md +5 -0
  142. package/docs/tui-viewer.md +18 -3
  143. package/docs/workflows.md +162 -210
  144. package/examples/workflows/command-batch.workflow.ts +2 -0
  145. package/examples/workflows/shell.workflow.ts +2 -1
  146. package/herdr-plugin.toml +1 -1
  147. package/package.json +1 -1
  148. package/src/builtins/autoimplement.workflow.ts +3 -0
  149. package/src/builtins/change-verification.workflow.ts +7 -2
  150. package/src/builtins/metadata.ts +9 -0
  151. package/src/builtins/monitor.workflow.ts +4 -0
  152. package/src/builtins/sanity-check.workflow.ts +4 -0
  153. package/src/builtins/workspace-preparation.workflow.ts +3 -1
  154. package/src/controllers/index.ts +0 -5
  155. package/src/controllers/sqlite.ts +709 -76
  156. package/src/controllers/store.ts +1 -0
  157. package/src/extension/controller-command.ts +45 -0
  158. package/src/extension/index.ts +944 -4163
  159. package/src/extension/message-card.ts +61 -0
  160. package/src/extension/step-message.ts +58 -63
  161. package/src/host/child-worker-supervisor.ts +183 -0
  162. package/src/host/client.ts +293 -0
  163. package/src/host/controller-worker-entry.ts +311 -0
  164. package/src/host/controller-worker-protocol.ts +104 -0
  165. package/src/host/controller-worker-supervisor.ts +79 -0
  166. package/src/host/host-entry.ts +23 -0
  167. package/src/host/processes.ts +171 -54
  168. package/src/host/protocol.ts +196 -0
  169. package/src/host/resolver-entry.ts +241 -0
  170. package/src/host/rpc-executor.ts +76 -34
  171. package/src/host/runner.ts +2813 -422
  172. package/src/host/state.ts +1160 -0
  173. package/src/host/worker-entry.ts +533 -0
  174. package/src/host/worker-protocol.ts +165 -0
  175. package/src/host/worker-store.ts +229 -0
  176. package/src/host/worker-supervisor.ts +74 -0
  177. package/src/render/canvas.ts +44 -10
  178. package/src/render/graph-render.ts +145 -90
  179. package/src/state/database.ts +2 -1
  180. package/src/state/index.ts +14 -0
  181. package/src/state/schema.ts +171 -3
  182. package/src/state/viewer.ts +356 -0
  183. package/src/viewer/cli.ts +49 -17
  184. package/src/workflows/composition.ts +36 -2
  185. package/src/workflows/definition.ts +32 -0
  186. package/src/workflows/engine.ts +157 -54
  187. package/src/workflows/errors.ts +11 -2
  188. package/src/workflows/human-decision.ts +49 -0
  189. package/src/workflows/index.ts +2 -0
  190. package/src/workflows/schema.ts +19 -6
  191. package/src/{viewer → workflows}/session-reducer.ts +11 -1
  192. package/src/workflows/store.ts +1316 -108
  193. package/src/workflows/tool-input.ts +3 -69
  194. package/src/workflows/types.ts +32 -4
  195. package/dist/controllers/workflow-engine-scheduler.d.ts +0 -29
  196. package/dist/controllers/workflow-engine-scheduler.js +0 -175
  197. package/dist/controllers/workflow-engine-scheduler.js.map +0 -1
  198. package/dist/extension/controller-host.d.ts +0 -48
  199. package/dist/extension/controller-host.js +0 -110
  200. package/dist/extension/controller-host.js.map +0 -1
  201. package/dist/extension/deferred-turn-coordinator.d.ts +0 -32
  202. package/dist/extension/deferred-turn-coordinator.js +0 -143
  203. package/dist/extension/deferred-turn-coordinator.js.map +0 -1
  204. package/dist/extension/deferred-turn.d.ts +0 -44
  205. package/dist/extension/deferred-turn.js +0 -110
  206. package/dist/extension/deferred-turn.js.map +0 -1
  207. package/dist/extension/executor.d.ts +0 -86
  208. package/dist/extension/executor.js +0 -311
  209. package/dist/extension/executor.js.map +0 -1
  210. package/dist/extension/follow-up-coordinator.d.ts +0 -27
  211. package/dist/extension/follow-up-coordinator.js +0 -131
  212. package/dist/extension/follow-up-coordinator.js.map +0 -1
  213. package/dist/extension/recorder.d.ts +0 -84
  214. package/dist/extension/recorder.js +0 -528
  215. package/dist/extension/recorder.js.map +0 -1
  216. package/dist/extension/restart-policy.d.ts +0 -38
  217. package/dist/extension/restart-policy.js +0 -116
  218. package/dist/extension/restart-policy.js.map +0 -1
  219. package/dist/extension/session-events.d.ts +0 -133
  220. package/dist/extension/session-events.js +0 -61
  221. package/dist/extension/session-events.js.map +0 -1
  222. package/dist/extension/terminal-decision.d.ts +0 -51
  223. package/dist/extension/terminal-decision.js +0 -110
  224. package/dist/extension/terminal-decision.js.map +0 -1
  225. package/dist/viewer/session-reducer.js.map +0 -1
  226. package/src/controllers/workflow-engine-scheduler.ts +0 -246
  227. package/src/extension/controller-host.ts +0 -167
  228. package/src/extension/deferred-turn-coordinator.ts +0 -171
  229. package/src/extension/deferred-turn.ts +0 -166
  230. package/src/extension/executor.ts +0 -411
  231. package/src/extension/follow-up-coordinator.ts +0 -151
  232. package/src/extension/recorder.ts +0 -655
  233. package/src/extension/restart-policy.ts +0 -163
  234. package/src/extension/session-events.ts +0 -121
  235. package/src/extension/terminal-decision.ts +0 -172
@@ -6,10 +6,10 @@ const workflowSchema = Type.String({
6
6
  description: "Discovered workflow name or workflow file path; required when action is start",
7
7
  });
8
8
  const inputSchema = Type.Unknown({
9
- description: "Checkpoint answer for answer; optional structured workflow input for start",
9
+ description: "Ordinary checkpoint answer for answer; protected human decisions require a human channel; optional structured workflow input for start",
10
10
  });
11
11
  const runIdSchema = Type.String({
12
- description: "Run id; required for restart and optional for status, cancel, and answer",
12
+ description: "Run id; optional for status, cancel, and answer",
13
13
  });
14
14
  const stepSchema = Type.String({
15
15
  description: "Workflow step id; required when action is update or submit",
@@ -25,29 +25,6 @@ const updateSchema = Type.Object({
25
25
  const outputSchema = Type.Unknown({
26
26
  description: "Step output matching the expected shape; required when action is submit",
27
27
  });
28
- const scopeIdSchema = Type.String({
29
- description: "Settings scope id; defaults to the active node scope",
30
- });
31
- const expectedChangeNumberSchema = Type.Integer({
32
- minimum: 0,
33
- description: "Optional settings change number for an atomic compare-and-change",
34
- });
35
- const patchOperationSchema = Type.Object({
36
- op: Type.String({ enum: ["add", "remove", "replace", "move", "copy", "test"] }),
37
- path: Type.String(),
38
- from: Type.Optional(Type.String()),
39
- value: Type.Optional(Type.Unknown()),
40
- }, noExtraProperties);
41
- const patchSchema = Type.Array(patchOperationSchema, {
42
- maxItems: 256,
43
- description: "RFC 6902 JSON Patch operations",
44
- });
45
- const followUpPromptSchema = Type.String({
46
- minLength: 1,
47
- maxLength: 65536,
48
- description: "Normal user prompt to send after successful workflow completion",
49
- });
50
- const followUpIdSchema = Type.String({ description: "Queued follow-up id" });
51
28
  export const WorkflowActionSchemas = {
52
29
  list: Type.Object({ action: Type.Literal("list"), offset: Type.Optional(offsetSchema) }, noExtraProperties),
53
30
  start: Type.Object({
@@ -55,10 +32,6 @@ export const WorkflowActionSchemas = {
55
32
  workflow: workflowSchema,
56
33
  input: Type.Optional(inputSchema),
57
34
  }, noExtraProperties),
58
- restart: Type.Object({
59
- action: Type.Literal("restart"),
60
- runId: runIdSchema,
61
- }, noExtraProperties),
62
35
  status: Type.Object({ action: Type.Literal("status"), runId: Type.Optional(runIdSchema) }, noExtraProperties),
63
36
  pause: Type.Object({ action: Type.Literal("pause") }, noExtraProperties),
64
37
  resume: Type.Object({ action: Type.Literal("resume") }, noExtraProperties),
@@ -68,23 +41,6 @@ export const WorkflowActionSchemas = {
68
41
  input: inputSchema,
69
42
  runId: Type.Optional(runIdSchema),
70
43
  }, noExtraProperties),
71
- "change-settings": Type.Object({
72
- action: Type.Literal("change-settings"),
73
- runId: Type.Optional(runIdSchema),
74
- scopeId: Type.Optional(scopeIdSchema),
75
- expectedChangeNumber: Type.Optional(expectedChangeNumberSchema),
76
- patch: patchSchema,
77
- }, noExtraProperties),
78
- "queue-follow-up": Type.Object({
79
- action: Type.Literal("queue-follow-up"),
80
- runId: Type.Optional(runIdSchema),
81
- prompt: followUpPromptSchema,
82
- }, noExtraProperties),
83
- "remove-follow-up": Type.Object({
84
- action: Type.Literal("remove-follow-up"),
85
- runId: Type.Optional(runIdSchema),
86
- followUpId: followUpIdSchema,
87
- }, noExtraProperties),
88
44
  update: Type.Object({
89
45
  action: Type.Literal("update"),
90
46
  step: stepSchema,
@@ -107,15 +63,11 @@ export const WorkflowSubmissionToolParameters = providerObjectSchema(Object.valu
107
63
  const workflowInputParsers = {
108
64
  list: (value) => parseToolInput(WorkflowActionSchemas.list, value, "workflow"),
109
65
  start: (value) => parseToolInput(WorkflowActionSchemas.start, value, "workflow"),
110
- restart: (value) => parseToolInput(WorkflowActionSchemas.restart, value, "workflow"),
111
66
  status: (value) => parseToolInput(WorkflowActionSchemas.status, value, "workflow"),
112
67
  pause: (value) => parseToolInput(WorkflowActionSchemas.pause, value, "workflow"),
113
68
  resume: (value) => parseToolInput(WorkflowActionSchemas.resume, value, "workflow"),
114
69
  cancel: (value) => parseToolInput(WorkflowActionSchemas.cancel, value, "workflow"),
115
70
  answer: (value) => parseToolInput(WorkflowActionSchemas.answer, value, "workflow"),
116
- "change-settings": (value) => parseToolInput(WorkflowActionSchemas["change-settings"], value, "workflow"),
117
- "queue-follow-up": (value) => parseToolInput(WorkflowActionSchemas["queue-follow-up"], value, "workflow"),
118
- "remove-follow-up": (value) => parseToolInput(WorkflowActionSchemas["remove-follow-up"], value, "workflow"),
119
71
  update: (value) => parseToolInput(WorkflowActionSchemas.update, value, "workflow"),
120
72
  submit: (value) => parseToolInput(WorkflowActionSchemas.submit, value, "workflow"),
121
73
  };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AC;AACH,CAAC"}
@@ -40,9 +40,31 @@ export type WorkflowUpdateRecord = {
40
40
  data: Record<string, unknown>;
41
41
  };
42
42
  export type WorkflowUpdateReceipt = Pick<WorkflowUpdateRecord, "updateId" | "seq" | "at" | "type" | "key">;
43
+ export type WorkflowEffectRecovery = "idempotent" | "manual";
44
+ export type WorkflowManagedEffect = {
45
+ /** Stable external effect category, for example `github.comment`. */
46
+ type: string;
47
+ /** Stable key. Idempotent adapters must pass this key to the external system. */
48
+ idempotencyKey: string | ((context: WorkflowNodeContext) => MaybePromise<string>);
49
+ /** Canonical request data used to reject key reuse with another operation. */
50
+ request: unknown | ((context: WorkflowNodeContext) => MaybePromise<unknown>);
51
+ /** `manual` never retries after an uncertain child exit. */
52
+ recovery: WorkflowEffectRecovery;
53
+ };
43
54
  export type WorkflowActionContext<TInput = unknown> = WorkflowNodeContext<TInput> & {
55
+ effect: {
56
+ type: string;
57
+ idempotencyKey: string;
58
+ recovery: WorkflowEffectRecovery;
59
+ };
44
60
  publishUpdate(update: WorkflowUpdateInput): Promise<WorkflowUpdateReceipt>;
45
61
  };
62
+ export type WorkflowEffectReservation = {
63
+ effectId: string;
64
+ attemptNumber: number;
65
+ disposition: "execute" | "adopted" | "ambiguous";
66
+ result?: unknown;
67
+ };
46
68
  export type WorkflowProgressStatus = "pending" | "running" | "waiting" | "blocked" | "completed" | "failed" | "cancelled" | "unknown";
47
69
  export type WorkflowProgressData = {
48
70
  schema: "pi-workflows.progress.v1";
@@ -119,6 +141,7 @@ export type NotifyNodeDefinition = WorkflowNodeCommon & {
119
141
  /** A deterministic runtime-owned step implemented as a local function. */
120
142
  export type FunctionActionNodeDefinition = WorkflowNodeCommon & {
121
143
  nodeType: "action";
144
+ effect?: WorkflowManagedEffect;
122
145
  run: (context: WorkflowActionContext) => MaybePromise<unknown>;
123
146
  };
124
147
  export type ShellActionExecution = {
@@ -154,8 +177,9 @@ export type ShellActionUpdates = {
154
177
  };
155
178
  export type ShellActionNodeDefinition = WorkflowNodeCommon & {
156
179
  nodeType: "action";
157
- exec: (context: WorkflowNodeContext) => MaybePromise<ShellActionExecution>;
158
- parse?: (result: ShellActionResult, context: WorkflowNodeContext) => MaybePromise<unknown>;
180
+ effect?: WorkflowManagedEffect;
181
+ exec: (context: WorkflowActionContext) => MaybePromise<ShellActionExecution>;
182
+ parse?: (result: ShellActionResult, context: WorkflowActionContext) => MaybePromise<unknown>;
159
183
  updates?: ShellActionUpdates;
160
184
  };
161
185
  export type ActionNodeDefinition = FunctionActionNodeDefinition | ShellActionNodeDefinition;
@@ -565,6 +589,8 @@ export type WorkflowRunState = {
565
589
  currentNode?: string;
566
590
  currentAttemptId?: string;
567
591
  currentNodeStartedAt?: string;
592
+ /** Durable wall-clock deadline for the current attempt. Null disables the deadline. */
593
+ currentNodeDeadlineAt?: string | null;
568
594
  currentSettingsScopeId?: string;
569
595
  currentSettingsChangeNumber?: number;
570
596
  currentSettingsHash?: string;
@@ -585,6 +611,10 @@ export type WorkflowNodeSnapshot = {
585
611
  expectedOutput?: AgentExpectedOutput;
586
612
  settingsRoute?: true;
587
613
  actionExecution?: "function" | "shell";
614
+ effect?: {
615
+ type: string;
616
+ recovery: WorkflowEffectRecovery;
617
+ };
588
618
  mountPath?: string[];
589
619
  localNodeId?: string;
590
620
  includeTransition?: "entry" | "exit";
@@ -753,6 +783,8 @@ export interface AgentStepExecutor {
753
783
  * leave the run claimable for an origin session. Omission is unsupported.
754
784
  */
755
785
  readonly assistantMessageMode?: "visible" | "park" | "unsupported";
786
+ /** True when the executor can park outside this process and resume the same attempt. */
787
+ readonly preservesDeadlineWhileParked?: boolean;
756
788
  runAgentStep(request: AgentStepRequest, signal: AbortSignal): Promise<AgentStepSubmission>;
757
789
  }
758
790
  export type WorkflowNotificationRequest = {
@@ -778,8 +810,8 @@ export type WorkflowEngineOptions = {
778
810
  notificationSink?: WorkflowNotificationSink;
779
811
  /** Canonical SQLite database. Defaults to `~/.pi/agent/workflows/state.sqlite`. */
780
812
  databasePath?: string;
781
- /** Shared SQLite run store. */
782
- store?: import("./store.js").WorkflowRunStore;
813
+ /** Durable execution store. Workers use a host-backed implementation. */
814
+ store?: import("./store.js").WorkflowExecutionStore;
783
815
  /**
784
816
  * Awaited after `run_started` is persisted, before any node executes.
785
817
  */
@@ -0,0 +1,353 @@
1
+ ---
2
+ title: Run workflows outside Pi
3
+ author: Onur Solmaz <2453968+osolmaz@users.noreply.github.com>
4
+ date: 2026-08-30
5
+ ---
6
+
7
+ # Run workflows outside Pi
8
+
9
+ Status: implemented on the `feat/out-of-process-workflow-host` branch. The implementation keeps schema version 1, uses one global on-demand host, and has no embedded production fallback.
10
+
11
+ A live workflow lost its lease while it was still working. The workflow engine kept the Node.js event loop busy, so its renewal timer did not run before the 30-second lease expired. The next state write used a generic error, the extension treated the error as a crash, and durable state was left with a running queue row, a running attempt, an expired lease, and a separate failed audit event.
12
+
13
+ This plan fixes that failure first, then removes its root architectural cause. One user-level host will own workflow state. Each active run will execute in a supervised child process. Pi will become a client that starts work, presents interactive requests, and submits answers through documented extension APIs.
14
+
15
+ [Workflow host](WORKFLOW_HOST.md) defines the complete target process, protocol, state, recovery, and Pi integration contracts. This plan gives the implementation order and acceptance checks.
16
+
17
+ ## Goals
18
+
19
+ - Renew a valid run lease in the same transaction as every protected state write.
20
+ - Reject every stale writer with a typed claim-loss result.
21
+ - Keep run, queue, attempt, decision, lease, audit, and viewer state consistent.
22
+ - Recover or cancel expired running rows without treating a live owner as stale.
23
+ - Move workflow code out of the Pi extension and host processes.
24
+ - Make the host the only normal writer to the workflow database.
25
+ - Preserve interactive workflow steps in the original Pi session.
26
+ - Supervise workflow children with bounded startup, runtime, output, and shutdown behavior.
27
+ - Make retries safe for pure work and explicit for external effects.
28
+ - Keep the workflow engine independent of Pi and use documented Pi extension APIs only.
29
+
30
+ ## Non-goals
31
+
32
+ - Do not change Pi source, private Pi APIs, or Pi session schemas.
33
+ - Do not add a remote service, distributed consensus, or network database.
34
+ - Do not claim exactly-once execution when an external system has no idempotency support.
35
+ - Do not keep the embedded runner as a fallback after the host path is complete.
36
+ - Do not add a compatibility reader, dual path, `v2` schema, or automatic state migration for older alpha databases.
37
+ - Do not install an operating-system service as part of this change.
38
+
39
+ ## Original failure
40
+
41
+ The former extension and host renewed 30-second run claims from 10-second `setInterval` callbacks. `src/workflows/engine.ts` can execute a long sequence of synchronous graph transitions without a macrotask yield. A long synchronous node can also block the event loop by itself.
42
+
43
+ `src/workflows/store.ts` checks lease expiry during a protected write. Every ownership failure currently becomes `Error("Workflow run write rejected because ownership changed")`. The extension handles `ClaimLostError` as a normal handoff, but it handles this generic error as a workflow crash.
44
+
45
+ The former public cancellation path handled an in-memory run, a queued or starting row, or a waiting human decision. It could not claim and cancel an expired running row.
46
+
47
+ The former standalone host executed the workflow engine in the same process that renewed claims. Workflow code could therefore block host renewal too.
48
+
49
+ ## Core rules
50
+
51
+ 1. A run has one current claim generation.
52
+ 2. A stale generation cannot write.
53
+ 3. An expired claim cannot renew itself.
54
+ 4. A valid protected write renews the claim and updates state in one SQLite transaction.
55
+ 5. A true claim loss stops the old runner without a terminal run write.
56
+ 6. One lifecycle transition updates every related projection in one transaction.
57
+ 7. Waiting and paused runs release their claim and need no live child.
58
+ 8. The host executes no workflow code.
59
+ 9. A workflow child writes no workflow state directly.
60
+ 10. Pi is the origin client, not the run owner.
61
+ 11. A durable command is acknowledged only after it is committed.
62
+ 12. A side effect is retried only when its contract makes the retry safe.
63
+ 13. The production runtime has one execution path.
64
+
65
+ ## Part 1: Correct lease handling now
66
+
67
+ ### Typed claim loss
68
+
69
+ Replace the generic ownership error with `ClaimLostError`. Add a nonsecret internal reason for missing authority, expiry, owner mismatch, token mismatch, and generation mismatch. Logs may include the run ID and reason. They must not include the claim token.
70
+
71
+ ### One fenced write transaction
72
+
73
+ Route every ownership-protected run mutation through one store operation. The operation will:
74
+
75
+ 1. Read the expected resource revision and current lease.
76
+ 2. Compare owner type, owner ID, token hash, and generation.
77
+ 3. Require `expires_at` to be later than the transaction time.
78
+ 4. Update `heartbeat_at` and `expires_at` for the same owner, token, and generation.
79
+ 5. Apply the domain mutation, event, viewer delta, and revision bump.
80
+ 6. Commit the complete change.
81
+
82
+ The claim identity provider may return the caller's identity after local expiry so the store can classify the exact failure. The store remains the authority. It must never renew a lease whose stored expiry has passed.
83
+
84
+ The timer remains as a backup for asynchronous waits. Correctness must not depend on the timer firing between normal state writes.
85
+
86
+ ### Engine fairness
87
+
88
+ Yield with `setImmediate` after each committed graph transition. This lets timers, cancellation, and UI work run between fast synchronous nodes. The yield is a fairness measure. Process isolation remains the fix for one long synchronous node.
89
+
90
+ ### Crash classification
91
+
92
+ A claim-loss catch path will:
93
+
94
+ - stop the old engine;
95
+ - skip terminal run writes;
96
+ - skip failed audit events, fallback turns, and terminal callbacks;
97
+ - report that the run is available to another runner or already continues there.
98
+
99
+ Unknown database and engine errors remain failures.
100
+
101
+ ## Part 2: Keep lifecycle state consistent
102
+
103
+ Create one lifecycle store boundary for run and queue changes. Start, park, wait, resume, complete, fail, and cancel operations will update these facts together:
104
+
105
+ - run status and finish data;
106
+ - queue status and availability;
107
+ - active node attempt;
108
+ - human decision state when applicable;
109
+ - claim release or renewal;
110
+ - immutable event;
111
+ - viewer projection.
112
+
113
+ The store will reject impossible transitions. It will not add an audit event without the matching current projection.
114
+
115
+ Add a read-only diagnosis for contradictory rows. Add a focused repair operation only for states that have exact durable evidence. The repair must not invent successful work.
116
+
117
+ ## Part 3: Recover and cancel stale runs
118
+
119
+ Add an atomic control claim for an expired run. It will require an expired or absent lease, reject terminal rows, increase the claim generation, and bind a new token before any mutation.
120
+
121
+ Cancellation will use that claim to commit one terminal cancellation. It will also close an active attempt, cancel pending interactions and human decisions, cancel effects that have not started, and mark applying effects ambiguous. A live claim cannot use this path.
122
+
123
+ Startup recovery will make expired running rows claimable. A resumable run will continue from its last durable boundary. A run with an uncertain unmanaged side effect will stop for manual review instead of retrying.
124
+
125
+ ## Part 4: One global host
126
+
127
+ The state database is global to one user installation. Use one host for that database, not one writing host per project.
128
+
129
+ The host will:
130
+
131
+ - own all run claims;
132
+ - accept commands from Pi clients and command-line clients;
133
+ - validate and commit state transitions;
134
+ - supervise workflow child processes;
135
+ - dispatch durable interactive requests;
136
+ - recover work after restart;
137
+ - reconcile controllers;
138
+ - expose safe status without payloads or tokens.
139
+
140
+ The host event loop will contain only bounded IPC, short SQLite transactions, timers, and process supervision. It will not load or execute workflow definitions.
141
+
142
+ The existing package CLI will provide explicit host start, status, and stop behavior. The Pi extension may start the package host on demand. The package will not install systemd, launchd, or another operating-system service.
143
+
144
+ ## Part 5: Local protocol
145
+
146
+ Use a versioned package-owned local protocol over a user-only Unix socket or the platform equivalent. Socket permissions must limit access to the current user.
147
+
148
+ Every request will include:
149
+
150
+ - protocol schema;
151
+ - request ID;
152
+ - command kind;
153
+ - run ID when applicable;
154
+ - node and attempt ID when applicable;
155
+ - claim generation;
156
+ - expected revision;
157
+ - idempotency key;
158
+ - bounded payload.
159
+
160
+ The protocol will support start, pause, resume, cancel, ordinary checkpoint answers, protected human answers, interactive step submission, notification delivery, terminal turn delivery, node transition proposals, child progress, child exit, and managed effect operations.
161
+
162
+ A command is successful only after the host commits it. Duplicate request IDs return the stored receipt. Stale revisions, generations, attempts, and idempotency conflicts return typed rejections.
163
+
164
+ The host will bound message size and connection buffering. Malformed messages will close only that connection.
165
+
166
+ ## Part 6: One child per active run
167
+
168
+ Each active workflow runs in a supervised child process. The child receives an immutable launch envelope with the run ID, generation, workflow source identity, project directory, input hash, and protocol endpoint.
169
+
170
+ The child will:
171
+
172
+ - verify the root and every mounted source identity before it loads workflow modules;
173
+ - load the workflow and compare the resolved mounted-source map with the saved map;
174
+ - execute graph and node code;
175
+ - propose state transitions to the host;
176
+ - request interactive work or managed effects;
177
+ - exit when the run parks, waits, finishes, or loses its generation.
178
+
179
+ The child will not receive a writable state store. This is an architectural boundary against accidental writes, not a security sandbox against malicious same-user code.
180
+
181
+ The host will enforce:
182
+
183
+ - startup handshake timeout;
184
+ - node and run cancellation;
185
+ - bounded stdout and stderr capture;
186
+ - process-group termination;
187
+ - `SIGTERM` followed by bounded `SIGKILL`;
188
+ - orphan cleanup on host restart;
189
+ - portable limits where Node and the operating system expose them.
190
+
191
+ ## Part 7: Preserve interactive Pi steps
192
+
193
+ Interactive agent and assistant-message steps remain in the origin Pi session.
194
+
195
+ When a child reaches one of these steps:
196
+
197
+ 1. It sends a durable interactive request to the host.
198
+ 2. The host commits the request and parks the run.
199
+ 3. The child exits and the claim is released.
200
+ 4. The Pi extension presents the exact step contract through documented Pi messaging and tool APIs.
201
+ 5. The extension sends a provisional result to the host with the request, node, attempt, and revision identifiers.
202
+ 6. The host records it as `validating` and schedules a new supervised child from that durable boundary.
203
+ 7. The child loads the workflow and runs the node's `validate` function.
204
+ 8. The host settles the request only after the child accepts it. A rejection keeps the request pending and returns the durable validation error to the model.
205
+
206
+ If Pi closes, the request stays pending until its durable node deadline. Reopening the same session presents the same request once. A duplicate submission returns the original receipt. The host enforces the saved deadline while the worker is absent and after restart. An expired request atomically closes and starts a supervised child that records the same attempt as timed out. The workflow can route that result through `$result.outcome`; otherwise the run becomes terminal and releases its session reservation. A child failure during validation rejects only that provisional submission and leaves the request ready for a corrected retry. If the host stops after it records `validating` but before activation, startup recovery schedules that same submission unless its deadline expired.
207
+
208
+ Keep one active interactive request per Pi session. Other requests remain ordered and durable.
209
+
210
+ A protected human decision is displayed without starting a model turn. The model-facing workflow tool rejects it. A person answers it through the origin Pi session, while an ordinary checkpoint keeps its model-facing answer path.
211
+
212
+ Notify nodes use the durable notification outbox. A root presentation prompt creates a durable terminal turn intent before completion and becomes eligible in the terminal transaction. The origin Pi session claims and adopts both message types through the host.
213
+
214
+ Detached workflows can use host-managed `pi --mode rpc` children. Their execution mode and origin are durable provenance.
215
+
216
+ ## Part 8: Safe effects and retries
217
+
218
+ Treat compute nodes as pure work. A child crash may rerun a compute node from its last committed boundary.
219
+
220
+ Side-effecting action nodes must use a managed effect record with a stable key and request fingerprint. The host reserves the effect before execution and stores its receipt after execution. Duplicate requests return the stored receipt.
221
+
222
+ An adapter may report safe retry only when the external system supports an idempotency key or a read-back check proves the result. If a child can have completed an external action but no receipt exists, mark the effect uncertain and stop for manual recovery.
223
+
224
+ Migrate package-owned workflows to this rule before the host path becomes the only runtime. Do not silently treat arbitrary action code as exactly once.
225
+
226
+ ## Part 9: Alpha state change
227
+
228
+ This repository's alpha policy requires an in-place schema change with the current schema identifiers. Do not add a migration, compatibility reader, dual path, alias, or `v2` schema.
229
+
230
+ The changed DDL digest will reject an older state database with the standard clear reset instruction. The old file remains untouched. Documentation must tell users how to back it up before resetting.
231
+
232
+ The new state shape will add the minimum durable records needed for:
233
+
234
+ - host command receipts;
235
+ - interactive requests and submissions;
236
+ - child process epochs and exits;
237
+ - uncertain effects when existing effect rows cannot express the state.
238
+
239
+ Reuse current notifications, turn intents, attempts, and effects when they already provide the required contract. Add no parallel record for the same fact.
240
+
241
+ ## Part 10: Hard cutover
242
+
243
+ Land the work in coherent commits and keep one implementation pull request. The final production change will:
244
+
245
+ 1. Use the host path for every new run.
246
+ 2. Remove embedded engine execution from the extension.
247
+ 3. Remove host-side in-process workflow execution.
248
+ 4. Remove old renewal-only ownership handling.
249
+ 5. Keep read-only viewers on the same canonical database.
250
+ 6. Keep the extension as a documented Pi client.
251
+ 7. Keep no fallback or feature flag for the old path.
252
+
253
+ The host protocol and worker runtime may exist under tests before the final switch. There must never be two selectable production runtimes.
254
+
255
+ ## Tests
256
+
257
+ ### Lease regression
258
+
259
+ - Run more than one lease interval of synchronous transitions with a fake clock and blocked timers.
260
+ - Prove that each valid write renews the lease atomically.
261
+ - Prove that an expired claim cannot renew itself.
262
+ - Prove that a new generation fences the old token.
263
+ - Prove that claim loss adds no failed run event.
264
+
265
+ ### Lifecycle consistency
266
+
267
+ - Crash before and after every lifecycle commit.
268
+ - Verify run, queue, attempt, decision, lease, event, and viewer state.
269
+ - Cancel an expired running row.
270
+ - Commit live cancellation and its command receipt in one transaction before worker shutdown.
271
+ - Cancel a committed run before its scheduled worker activation.
272
+ - Reject stale cancellation against a live owner.
273
+ - Recover a resumable expired run.
274
+ - Stop an uncertain effect for manual review.
275
+
276
+ ### Host and child isolation
277
+
278
+ - Block a child event loop longer than the run lease and prove the host keeps ownership.
279
+ - Kill Pi while a run computes.
280
+ - Kill a child before and after a proposed transition.
281
+ - Kill the host before and after a committed transition.
282
+ - Restart after a provisional interaction submission commits but before child activation.
283
+ - Change an included source and prove the resumed child rejects it before module execution.
284
+ - Start two hosts and prove that one is rejected or fenced.
285
+ - Reject stale child messages after a generation change.
286
+ - Kill complete process groups on cancellation.
287
+ - Bound malformed input and output floods.
288
+
289
+ ### Interactive bridge
290
+
291
+ - Start a workflow from real Pi with the mock provider.
292
+ - Commit and present an interactive request.
293
+ - Restart Pi before submission and present the same request once.
294
+ - Restart the host after an interactive deadline expires, close the request, and resume the same attempt into its timeout route.
295
+ - Submit once and replay the same receipt for a duplicate.
296
+ - Run workflow-specific submission validation only in a supervised child.
297
+ - Return an actionable validation error and accept a corrected submission for the same request.
298
+ - Reject a stale attempt submission.
299
+ - Continue an ordinary checkpoint through the model-facing answer action.
300
+ - Reject a protected human decision from that model-facing action.
301
+ - Deliver a notify node through the durable origin-session outbox.
302
+ - Start one terminal presentation turn only after completion commits.
303
+ - Finish the run and preserve normal visible session entries.
304
+
305
+ ### Effects
306
+
307
+ - Deduplicate a repeated effect request.
308
+ - Recover a stored effect receipt after child and host restart.
309
+ - Mark a request uncertain when completion cannot be proved.
310
+ - Never auto-retry an uncertain effect.
311
+
312
+ ### Repository gates
313
+
314
+ Run:
315
+
316
+ ```bash
317
+ npm run check
318
+ npm run test:e2e
319
+ npx slophammer-ts@latest dry .
320
+ npx slophammer-ts@latest check . --only ts.dependency-boundaries-required
321
+ npx -y @simpledoc/simpledoc check
322
+ git diff --check
323
+ ```
324
+
325
+ Run Pi Reviewer against `main` until no P0 or P1 findings remain. Check pull-request comments and CI after the final review passes.
326
+
327
+ ## Acceptance criteria
328
+
329
+ - The observed event-loop starvation cannot reproduce false ownership loss.
330
+ - A stale runner cannot write after expiry or generation change.
331
+ - A child blocked longer than the lease cannot block host renewal.
332
+ - Run lifecycle projections remain consistent after injected crashes.
333
+ - Expired running rows can be resumed or cancelled safely.
334
+ - Pi restart does not lose or falsely fail pending work.
335
+ - An unanswered interactive request keeps its original node deadline, follows its timeout route, and cannot hold a stale session reservation forever.
336
+ - Host restart recovers durable work without duplicate transitions.
337
+ - Interactive steps still use the origin Pi session.
338
+ - Duplicate commands and submissions return stored receipts.
339
+ - A submission is not accepted until supervised workflow validation succeeds.
340
+ - Effects are deduplicated or marked uncertain.
341
+ - The extension and host execute no workflow code in production.
342
+ - Pi source, private APIs, and session schemas remain unchanged.
343
+ - The old in-process runtime and all compatibility paths are removed.
344
+ - Local checks, real Pi end-to-end tests, Pi Reviewer, pull-request review, and CI pass.
345
+
346
+ ## Contract impact
347
+
348
+ - **Session state:** Normal Pi messages and tool results continue to append through documented Pi behavior. Pi Workflows does not edit Pi session files or schemas.
349
+ - **Other persistent data:** The canonical workflow SQLite shape changes in place. Older alpha state requires an explicit backup and reset.
350
+ - **Pi internals:** None.
351
+ - **Public Pi APIs:** The extension uses documented commands, tools, session lifecycle events, message sending, widgets, and status APIs.
352
+ - **Workflow authoring API:** Graph structure stays stable. Side-effecting actions gain an explicit managed-effect or manual-recovery requirement.
353
+ - **Runtime:** Workflow graphs execute in supervised child processes. One global host owns state and claims.