@osolmaz/pi-workflows 0.16.1 → 0.16.3
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 +41 -41
- package/dist/builtins/monitor.workflow.d.ts +1 -1
- package/dist/builtins/monitor.workflow.js +8 -8
- package/dist/builtins/pi-agent-group.js +3 -3
- package/dist/builtins/pi-agent-group.js.map +1 -1
- package/dist/channels/adapter-entry.js +14 -14
- package/dist/channels/adapter-entry.js.map +1 -1
- package/dist/client/client.d.ts +6 -6
- package/dist/client/client.js +27 -27
- package/dist/client/client.js.map +1 -1
- package/dist/client/protocol.d.ts +4 -1
- package/dist/client/protocol.js +17 -11
- package/dist/client/protocol.js.map +1 -1
- package/dist/client/resolver.d.ts +4 -4
- package/dist/client/view.d.ts +7 -1
- package/dist/client/view.js +1 -0
- package/dist/client/view.js.map +1 -1
- package/dist/extension/index.d.ts +1 -1
- package/dist/extension/index.js +66 -47
- package/dist/extension/index.js.map +1 -1
- package/dist/extension/recorder.d.ts +1 -1
- package/dist/extension/recorder.js +1 -1
- package/dist/extension/recorder.js.map +1 -1
- package/dist/extension/remote-recorder-store.d.ts +1 -1
- package/dist/extension/remote-recorder-store.js +2 -2
- package/dist/extension/remote-recorder-store.js.map +1 -1
- package/dist/extension/{controller-command.d.ts → resource-manager-command.d.ts} +6 -6
- package/dist/extension/{controller-command.js → resource-manager-command.js} +7 -7
- package/dist/extension/resource-manager-command.js.map +1 -0
- package/dist/extension/session-delivery.d.ts +1 -1
- package/dist/extension/session-delivery.js +2 -2
- package/dist/extension/session-delivery.js.map +1 -1
- package/dist/extension/session-view.d.ts +1 -1
- package/dist/extension/session-view.js +1 -1
- package/dist/extension/session-view.js.map +1 -1
- package/dist/extension/workflow-message-coordinator.d.ts +4 -3
- package/dist/extension/workflow-message-coordinator.js +81 -29
- package/dist/extension/workflow-message-coordinator.js.map +1 -1
- package/dist/resource-managers/conditions.d.ts +6 -0
- package/dist/{controllers → resource-managers}/conditions.js +3 -3
- package/dist/resource-managers/conditions.js.map +1 -0
- package/dist/resource-managers/definition.d.ts +6 -0
- package/dist/resource-managers/definition.js +45 -0
- package/dist/resource-managers/definition.js.map +1 -0
- package/dist/resource-managers/effects.d.ts +15 -0
- package/dist/{controllers → resource-managers}/effects.js +2 -2
- package/dist/resource-managers/effects.js.map +1 -0
- package/dist/resource-managers/errors.d.ts +12 -0
- package/dist/resource-managers/errors.js +25 -0
- package/dist/resource-managers/errors.js.map +1 -0
- package/dist/resource-managers/index.d.ts +12 -0
- package/dist/resource-managers/index.js +12 -0
- package/dist/resource-managers/index.js.map +1 -0
- package/dist/resource-managers/json.js.map +1 -0
- package/dist/resource-managers/loader.d.ts +23 -0
- package/dist/resource-managers/loader.js +75 -0
- package/dist/resource-managers/loader.js.map +1 -0
- package/dist/resource-managers/results.d.ts +5 -0
- package/dist/resource-managers/results.js.map +1 -0
- package/dist/resource-managers/runtime.d.ts +59 -0
- package/dist/{controllers/manager.js → resource-managers/runtime.js} +57 -57
- package/dist/resource-managers/runtime.js.map +1 -0
- package/dist/{controllers → resource-managers}/sqlite.d.ts +51 -43
- package/dist/{controllers → resource-managers}/sqlite.js +187 -125
- package/dist/resource-managers/sqlite.js.map +1 -0
- package/dist/{controllers → resource-managers}/store.d.ts +33 -33
- package/dist/{controllers → resource-managers}/store.js.map +1 -1
- package/dist/{controllers → resource-managers}/types.d.ts +41 -41
- package/dist/{controllers → resource-managers}/types.js.map +1 -1
- package/dist/resource-managers/workflows.d.ts +34 -0
- package/dist/{controllers → resource-managers}/workflows.js +15 -15
- package/dist/resource-managers/workflows.js.map +1 -0
- package/dist/server/channel-effects.js.map +1 -0
- package/dist/{host → server}/channel-supervisor.d.ts +6 -6
- package/dist/{host → server}/channel-supervisor.js +3 -3
- package/dist/server/channel-supervisor.js.map +1 -0
- package/dist/{host/child-worker-supervisor.d.ts → server/child-runner-supervisor.d.ts} +15 -13
- package/dist/{host/child-worker-supervisor.js → server/child-runner-supervisor.js} +6 -5
- package/dist/server/child-runner-supervisor.js.map +1 -0
- package/dist/{host → server}/processes.d.ts +3 -3
- package/dist/{host → server}/processes.js +3 -3
- package/dist/server/processes.js.map +1 -0
- package/dist/{host → server}/resolver-entry.d.ts +6 -6
- package/dist/{host → server}/resolver-entry.js +14 -14
- package/dist/server/resolver-entry.js.map +1 -0
- package/dist/server/resource-runner-entry.d.ts +2 -0
- package/dist/{host/controller-worker-entry.js → server/resource-runner-entry.js} +33 -33
- package/dist/server/resource-runner-entry.js.map +1 -0
- package/dist/server/resource-runner-protocol.d.ts +36 -0
- package/dist/server/resource-runner-protocol.js +49 -0
- package/dist/server/resource-runner-protocol.js.map +1 -0
- package/dist/server/resource-runner-supervisor.d.ts +21 -0
- package/dist/{host/worker-supervisor.js → server/resource-runner-supervisor.js} +17 -17
- package/dist/server/resource-runner-supervisor.js.map +1 -0
- package/dist/{host → server}/rpc-bridge.d.ts +3 -3
- package/dist/{host → server}/rpc-bridge.js +3 -3
- package/dist/server/rpc-bridge.js.map +1 -0
- package/dist/{host → server}/rpc-executor.d.ts +1 -1
- package/dist/{host → server}/rpc-executor.js +3 -3
- package/dist/server/rpc-executor.js.map +1 -0
- package/dist/{host/host-entry.js → server/server-entry.js} +6 -6
- package/dist/server/server-entry.js.map +1 -0
- package/dist/{host/runner.d.ts → server/server.d.ts} +47 -39
- package/dist/{host/runner.js → server/server.js} +624 -535
- package/dist/server/server.js.map +1 -0
- package/dist/{host → server}/state.d.ts +25 -25
- package/dist/{host → server}/state.js +49 -49
- package/dist/server/state.js.map +1 -0
- package/dist/{host → server}/view.d.ts +7 -7
- package/dist/{host → server}/view.js +19 -15
- package/dist/server/view.js.map +1 -0
- package/dist/server/workflow-runner-content.d.ts +6 -0
- package/dist/server/workflow-runner-content.js +96 -0
- package/dist/server/workflow-runner-content.js.map +1 -0
- package/dist/server/workflow-runner-entry.d.ts +13 -0
- package/dist/{host/worker-entry.js → server/workflow-runner-entry.js} +89 -57
- package/dist/server/workflow-runner-entry.js.map +1 -0
- package/dist/server/workflow-runner-protocol.d.ts +69 -0
- package/dist/server/workflow-runner-protocol.js +176 -0
- package/dist/server/workflow-runner-protocol.js.map +1 -0
- package/dist/{host/worker-store.d.ts → server/workflow-runner-store.d.ts} +11 -11
- package/dist/{host/worker-store.js → server/workflow-runner-store.js} +8 -8
- package/dist/server/workflow-runner-store.js.map +1 -0
- package/dist/server/workflow-runner-supervisor.d.ts +22 -0
- package/dist/server/workflow-runner-supervisor.js +56 -0
- package/dist/server/workflow-runner-supervisor.js.map +1 -0
- package/dist/state/prune.d.ts +1 -1
- package/dist/state/prune.js +17 -10
- package/dist/state/prune.js.map +1 -1
- package/dist/state/schema.js +2 -2
- package/dist/state/workflow-messages.d.ts +3 -1
- package/dist/state/workflow-messages.js +32 -1
- package/dist/state/workflow-messages.js.map +1 -1
- package/dist/viewer/backup.js +1 -1
- package/dist/viewer/backup.js.map +1 -1
- package/dist/viewer/cli.d.ts +2 -2
- package/dist/viewer/cli.js +46 -32
- package/dist/viewer/cli.js.map +1 -1
- package/dist/viewer/tui.d.ts +1 -1
- package/dist/viewer/tui.js +1 -1
- package/dist/viewer/tui.js.map +1 -1
- package/dist/workflows/command-batch.js +2 -2
- package/dist/workflows/composition.js +0 -4
- package/dist/workflows/composition.js.map +1 -1
- package/dist/workflows/definition.js +0 -8
- package/dist/workflows/definition.js.map +1 -1
- package/dist/workflows/engine.js +18 -20
- package/dist/workflows/engine.js.map +1 -1
- package/dist/workflows/schema.js +0 -4
- package/dist/workflows/schema.js.map +1 -1
- package/dist/workflows/store.d.ts +27 -11
- package/dist/workflows/store.js +66 -18
- package/dist/workflows/store.js.map +1 -1
- package/dist/workflows/types.d.ts +3 -5
- package/docs/2026-08-20-durable-workflow-launch-plan.md +12 -12
- package/docs/2026-08-25-workflow-follow-ups.md +7 -7
- package/docs/2026-08-25-workflow-settings.md +3 -3
- package/docs/2026-08-30-out-of-process-workflow-host-plan.md +3 -3
- package/docs/2026-09-01-restore-session-delivery-controls-plan.md +5 -5
- package/docs/2026-09-01-unified-workflow-client-plan.md +6 -6
- package/docs/2026-09-02-installed-live-e2e-plan.md +3 -3
- package/docs/2026-09-02-unify-workflow-messages-plan.md +8 -8
- package/docs/2026-09-04-workflow-run-state-plan.md +363 -0
- package/docs/DEFERRED_TURNS.md +7 -7
- package/docs/DESIGN_PHILOSOPHY.md +1 -1
- package/docs/HUMAN_DECISIONS.md +11 -11
- package/docs/HUMAN_DECISION_PRESENTATIONS.md +4 -4
- package/docs/MONITOR.md +1 -1
- package/docs/RESOURCE_MANAGERS.md +221 -0
- package/docs/SQLITE_STATE.md +40 -34
- package/docs/WORKFLOW_COMPOSITION.md +1 -1
- package/docs/{WORKFLOW_HOST.md → WORKFLOW_SERVER.md} +131 -116
- package/docs/WORKFLOW_STEP_MESSAGES.md +18 -18
- package/docs/WORKFLOW_UPDATES.md +16 -16
- package/docs/development.md +15 -14
- package/docs/live-replay-protocol.md +20 -20
- package/docs/plans/2026-08-04-controller-runtime-plan.md +25 -25
- package/docs/plans/2026-08-05-always-on-workflows-plan.md +8 -8
- package/docs/plans/2026-08-10-agent-managed-monitor-workflows-plan.md +2 -2
- package/docs/plans/2026-08-13-session-addressed-workflow-notifications-plan.md +1 -1
- package/docs/plans/2026-08-16-workflow-updates-plan.md +5 -5
- package/docs/plans/2026-08-19-human-decision-gates-plan.md +1 -1
- package/docs/plans/2026-08-20-bounded-command-batches-plan.md +1 -1
- package/docs/plans/2026-08-21-deferred-turn-intents-plan.md +3 -3
- package/docs/plans/2026-08-21-sanity-check-plan.md +2 -2
- package/docs/plans/2026-08-23-assistant-agent-completion-plan.md +5 -5
- package/docs/plans/2026-08-23-sqlite-state-plan.md +25 -25
- package/docs/plans/2026-08-25-live-workflow-settings-plan.md +4 -4
- package/docs/plans/2026-08-27-workflow-terminal-restart-plan.md +3 -3
- package/docs/plans/2026-09-04-workflow-runner-resume-state-plan.md +318 -0
- package/docs/plans/piw-viewer-experience-implementation-plan.md +1 -1
- package/docs/tui-viewer.md +9 -9
- package/docs/workflows.md +78 -63
- package/examples/{controllers/pull-request.controller.ts → resource-managers/pull-request.resource-manager.ts} +12 -12
- package/herdr-plugin.toml +1 -1
- package/package.json +5 -5
- package/protocol/client.v1.schema.json +7 -7
- package/protocol/fixtures/client-v1.json +1 -1
- package/src/builtins/monitor.workflow.ts +9 -9
- package/src/builtins/pi-agent-group.ts +3 -3
- package/src/channels/adapter-entry.ts +14 -14
- package/src/client/client.ts +33 -32
- package/src/client/protocol.ts +16 -11
- package/src/client/resolver.ts +4 -4
- package/src/client/view.ts +9 -1
- package/src/extension/index.ts +81 -53
- package/src/extension/recorder.ts +1 -1
- package/src/extension/remote-recorder-store.ts +2 -2
- package/src/extension/resource-manager-command.ts +45 -0
- package/src/extension/session-delivery.ts +2 -2
- package/src/extension/session-view.ts +1 -1
- package/src/extension/workflow-message-coordinator.ts +94 -30
- package/src/{controllers → resource-managers}/conditions.ts +23 -23
- package/src/resource-managers/definition.ts +71 -0
- package/src/{controllers → resource-managers}/effects.ts +9 -9
- package/src/resource-managers/errors.ts +27 -0
- package/src/resource-managers/index.ts +88 -0
- package/src/resource-managers/loader.ts +111 -0
- package/src/{controllers → resource-managers}/results.ts +4 -4
- package/src/{controllers/manager.ts → resource-managers/runtime.ts} +95 -92
- package/src/{controllers → resource-managers}/sqlite.ts +275 -181
- package/src/{controllers → resource-managers}/store.ts +46 -38
- package/src/{controllers → resource-managers}/types.ts +50 -41
- package/src/{controllers → resource-managers}/workflows.ts +43 -41
- package/src/{host → server}/channel-supervisor.ts +8 -8
- package/src/{host/child-worker-supervisor.ts → server/child-runner-supervisor.ts} +22 -18
- package/src/{host → server}/processes.ts +3 -3
- package/src/{host → server}/resolver-entry.ts +28 -25
- package/src/{host/controller-worker-entry.ts → server/resource-runner-entry.ts} +67 -65
- package/src/server/resource-runner-protocol.ts +103 -0
- package/src/server/resource-runner-supervisor.ts +76 -0
- package/src/{host → server}/rpc-bridge.ts +3 -3
- package/src/{host → server}/rpc-executor.ts +4 -4
- package/src/{host/host-entry.ts → server/server-entry.ts} +5 -5
- package/src/{host/runner.ts → server/server.ts} +786 -672
- package/src/{host → server}/state.ts +78 -67
- package/src/{host → server}/view.ts +21 -17
- package/src/server/workflow-runner-content.ts +119 -0
- package/src/{host/worker-entry.ts → server/workflow-runner-entry.ts} +131 -82
- package/src/server/workflow-runner-protocol.ts +241 -0
- package/src/{host/worker-store.ts → server/workflow-runner-store.ts} +18 -20
- package/src/server/workflow-runner-supervisor.ts +79 -0
- package/src/state/prune.ts +27 -9
- package/src/state/schema.ts +2 -2
- package/src/state/workflow-messages.ts +52 -1
- package/src/viewer/backup.ts +1 -1
- package/src/viewer/cli.ts +50 -36
- package/src/viewer/tui.ts +1 -1
- package/src/workflows/command-batch.ts +2 -2
- package/src/workflows/composition.ts +0 -5
- package/src/workflows/definition.ts +0 -8
- package/src/workflows/engine.ts +18 -21
- package/src/workflows/schema.ts +0 -6
- package/src/workflows/store.ts +95 -28
- package/src/workflows/types.ts +3 -5
- package/dist/controllers/conditions.d.ts +0 -6
- package/dist/controllers/conditions.js.map +0 -1
- package/dist/controllers/definition.d.ts +0 -6
- package/dist/controllers/definition.js +0 -45
- package/dist/controllers/definition.js.map +0 -1
- package/dist/controllers/effects.d.ts +0 -15
- package/dist/controllers/effects.js.map +0 -1
- package/dist/controllers/errors.d.ts +0 -12
- package/dist/controllers/errors.js +0 -25
- package/dist/controllers/errors.js.map +0 -1
- package/dist/controllers/index.d.ts +0 -12
- package/dist/controllers/index.js +0 -12
- package/dist/controllers/index.js.map +0 -1
- package/dist/controllers/json.js.map +0 -1
- package/dist/controllers/loader.d.ts +0 -23
- package/dist/controllers/loader.js +0 -74
- package/dist/controllers/loader.js.map +0 -1
- package/dist/controllers/manager.d.ts +0 -59
- package/dist/controllers/manager.js.map +0 -1
- package/dist/controllers/results.d.ts +0 -5
- package/dist/controllers/results.js.map +0 -1
- package/dist/controllers/sqlite.js.map +0 -1
- package/dist/controllers/workflows.d.ts +0 -34
- package/dist/controllers/workflows.js.map +0 -1
- package/dist/extension/controller-command.js.map +0 -1
- package/dist/host/channel-effects.js.map +0 -1
- package/dist/host/channel-supervisor.js.map +0 -1
- package/dist/host/child-worker-supervisor.js.map +0 -1
- package/dist/host/controller-worker-entry.d.ts +0 -2
- package/dist/host/controller-worker-entry.js.map +0 -1
- package/dist/host/controller-worker-protocol.d.ts +0 -36
- package/dist/host/controller-worker-protocol.js +0 -49
- package/dist/host/controller-worker-protocol.js.map +0 -1
- package/dist/host/controller-worker-supervisor.d.ts +0 -21
- package/dist/host/controller-worker-supervisor.js +0 -54
- package/dist/host/controller-worker-supervisor.js.map +0 -1
- package/dist/host/host-entry.js.map +0 -1
- package/dist/host/processes.js.map +0 -1
- package/dist/host/resolver-entry.js.map +0 -1
- package/dist/host/rpc-bridge.js.map +0 -1
- package/dist/host/rpc-executor.js.map +0 -1
- package/dist/host/runner.js.map +0 -1
- package/dist/host/state.js.map +0 -1
- package/dist/host/view.js.map +0 -1
- package/dist/host/worker-entry.d.ts +0 -10
- package/dist/host/worker-entry.js.map +0 -1
- package/dist/host/worker-protocol.d.ts +0 -31
- package/dist/host/worker-protocol.js +0 -122
- package/dist/host/worker-protocol.js.map +0 -1
- package/dist/host/worker-store.js.map +0 -1
- package/dist/host/worker-supervisor.d.ts +0 -22
- package/dist/host/worker-supervisor.js.map +0 -1
- package/docs/CONTROLLERS.md +0 -217
- package/src/controllers/definition.ts +0 -65
- package/src/controllers/errors.ts +0 -27
- package/src/controllers/index.ts +0 -88
- package/src/controllers/loader.ts +0 -104
- package/src/extension/controller-command.ts +0 -45
- package/src/host/controller-worker-protocol.ts +0 -104
- package/src/host/controller-worker-supervisor.ts +0 -79
- package/src/host/worker-protocol.ts +0 -165
- package/src/host/worker-supervisor.ts +0 -74
- /package/dist/{controllers → resource-managers}/json.d.ts +0 -0
- /package/dist/{controllers → resource-managers}/json.js +0 -0
- /package/dist/{controllers → resource-managers}/results.js +0 -0
- /package/dist/{controllers → resource-managers}/store.js +0 -0
- /package/dist/{controllers → resource-managers}/types.js +0 -0
- /package/dist/{host → server}/channel-effects.d.ts +0 -0
- /package/dist/{host → server}/channel-effects.js +0 -0
- /package/dist/{host/host-entry.d.ts → server/server-entry.d.ts} +0 -0
- /package/src/{controllers → resource-managers}/json.ts +0 -0
- /package/src/{host → server}/channel-effects.ts +0 -0
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
# Workflow
|
|
1
|
+
# Workflow server
|
|
2
2
|
|
|
3
|
-
Status: the out-of-process
|
|
3
|
+
Status: the out-of-process server, unified live client, workflow-message contract, and restored session behavior are implemented. [Unify workflow run state](2026-09-04-workflow-run-state-plan.md) records the approved refactor for turn ownership, managed effects, restarts, terminal data, cancellation, and runner recovery. [Unify workflow messages and restore hosted behavior](2026-09-02-unify-workflow-messages-plan.md), [run workflows outside Pi](2026-08-30-out-of-process-workflow-host-plan.md), [restore workflow session delivery and controls](2026-09-01-restore-session-delivery-controls-plan.md), and [unify live workflow clients](2026-09-01-unified-workflow-client-plan.md) record the earlier design and implementation plans.
|
|
4
4
|
|
|
5
5
|
## Purpose
|
|
6
6
|
|
|
7
|
-
The workflow
|
|
7
|
+
The workflow server keeps durable workflow state correct when Pi, a workflow, or the server stops unexpectedly. It owns the workflow database and supervises a separate process for each active run. Pi remains the user interface and performs interactive model turns through its documented extension APIs.
|
|
8
8
|
|
|
9
|
-
The
|
|
9
|
+
The server solves two different failures:
|
|
10
10
|
|
|
11
11
|
- A busy workflow cannot block the process that renews run claims.
|
|
12
12
|
- A crashed or stale runner cannot leave contradictory state or continue writing after another runner takes over.
|
|
13
13
|
|
|
14
14
|
## Terms
|
|
15
15
|
|
|
16
|
-
- **
|
|
17
|
-
- **Client:** A Pi extension instance or command-line process connected to the
|
|
18
|
-
- **
|
|
16
|
+
- **Server:** The single user-level process that owns workflow state, claims, commands, and runner supervision.
|
|
17
|
+
- **Client:** A Pi extension instance or command-line process connected to the server.
|
|
18
|
+
- **Runner:** A child process that loads one workflow and executes one active run generation.
|
|
19
19
|
- **Origin session:** The Pi session that started an interactive run.
|
|
20
20
|
- **Claim:** A time-limited right to change one run.
|
|
21
21
|
- **Generation:** A number increased each time a new owner claims a run. It fences older owners.
|
|
22
22
|
- **Durable boundary:** A committed node or lifecycle transition from which execution can resume.
|
|
23
23
|
- **Interactive request:** A durable agent or assistant-message step that must run in the origin Pi session.
|
|
24
|
-
- **Workflow message:**
|
|
24
|
+
- **Workflow message:** Server-owned content that Pi must add to an origin conversation, such as a step, reminder, decision, notification, terminal result, or follow-up.
|
|
25
25
|
- **Managed effect:** A side effect reserved and settled through an idempotent durable record.
|
|
26
|
-
- **Live run view:** The
|
|
26
|
+
- **Live run view:** The server's versioned, bounded projection of one run, including its durable state, current origin-session activity, allowed controls, and page cursors.
|
|
27
27
|
- **Renderer:** A Pi widget, status line, command-line view, Herdr adapter, or `piw` screen that displays or acts on a live run view without deriving workflow state.
|
|
28
28
|
|
|
29
29
|
## Boundaries
|
|
30
30
|
|
|
31
|
-
The
|
|
31
|
+
The server belongs to the `@osolmaz/pi-workflows` package. It uses the existing SQLite database at `~/.pi/agent/workflows/state.sqlite` and documented Pi extension APIs.
|
|
32
32
|
|
|
33
33
|
The design does not change Pi source, Pi session files, Pi message schemas, or private Pi APIs. It does not add a remote service or a second database. The package does not install an operating-system service.
|
|
34
34
|
|
|
@@ -36,46 +36,46 @@ SQLite remains local to one machine. The protocol does not provide distributed c
|
|
|
36
36
|
|
|
37
37
|
## Process model
|
|
38
38
|
|
|
39
|
-
One
|
|
39
|
+
One server owns the global workflow database for one user installation.
|
|
40
40
|
|
|
41
41
|
```text
|
|
42
42
|
Pi extension ─┐
|
|
43
|
-
CLI client ───┼── WorkflowClient v1 ── local socket ── workflow
|
|
43
|
+
CLI client ───┼── WorkflowClient v1 ── local socket ── workflow server ── SQLite
|
|
44
44
|
piw ──────────┘ │
|
|
45
|
-
├──
|
|
45
|
+
├── workflow runner A
|
|
46
46
|
Remote piw ── SSH tunnel ── loopback WebSocket relay ────────┤
|
|
47
|
-
├──
|
|
48
|
-
├──
|
|
47
|
+
├── workflow runner B ── headless pi --mode rpc
|
|
48
|
+
├── resource runner
|
|
49
49
|
├── channel adapter child
|
|
50
50
|
└── source resolver
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
The local socket and loopback WebSocket relay carry the same logical client protocol and live run view. The relay reads no state and translates no domain contract. The
|
|
53
|
+
The local socket and loopback WebSocket relay carry the same logical client protocol and live run view. The relay reads no state and translates no domain contract. The server is the only production process that opens the live SQLite database. Runner, channel-adapter, and source-resolver channels are private supervision protocols, not alternate client interfaces.
|
|
54
54
|
|
|
55
|
-
The
|
|
55
|
+
The server may manage runs from more than one project. Each run keeps its canonical project path and source identity.
|
|
56
56
|
|
|
57
|
-
The
|
|
57
|
+
The server process performs only bounded protocol handling, live-view projection, short SQLite transactions, timers, queue scheduling, and process supervision. It does not import or execute workflow definitions.
|
|
58
58
|
|
|
59
|
-
A
|
|
59
|
+
A runner loads one workflow source and executes one run generation. It cannot receive a writable `WorkflowRunStore`. It proposes changes to the server over a private child channel. This is an architectural guard against accidental writes. It is not a security sandbox against code running as the same operating-system user.
|
|
60
60
|
|
|
61
|
-
A channel adapter child handles one approved external presentation channel. It receives only the rendered presentation and the private channel configuration needed for its work. It does not open SQLite or receive the decision subject. The
|
|
61
|
+
A channel adapter child handles one approved external presentation channel. It receives only the rendered presentation and the private channel configuration needed for its work. It does not open SQLite or receive the decision subject. The server owns claims, answer verification, settlement, and process supervision.
|
|
62
62
|
|
|
63
|
-
##
|
|
63
|
+
## Server lifecycle
|
|
64
64
|
|
|
65
|
-
The package CLI owns
|
|
65
|
+
The package CLI owns server lifecycle commands:
|
|
66
66
|
|
|
67
67
|
```text
|
|
68
|
-
pi-workflows
|
|
69
|
-
pi-workflows
|
|
70
|
-
pi-workflows
|
|
71
|
-
pi-workflows
|
|
68
|
+
pi-workflows server start
|
|
69
|
+
pi-workflows server status
|
|
70
|
+
pi-workflows server stop
|
|
71
|
+
pi-workflows server run
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
`run` stays attached for direct operation and tests. `start` starts the package process on demand and waits for a ready handshake. It does not install systemd, launchd, or another persistent service.
|
|
75
75
|
|
|
76
|
-
The
|
|
76
|
+
The server uses one global lock and one server epoch. Socket creation and the SQLite server claim must agree before the server accepts commands. A second live server refuses to start. After the old server lease expires, a new server increases the epoch before it handles work. Messages from an older epoch are rejected.
|
|
77
77
|
|
|
78
|
-
The
|
|
78
|
+
The server stays alive while it has a connected client, an active runner, a scheduled wake, a pending managed resource, a pending external-channel decision, or other unsettled work. An idle server may exit after a documented idle period. A later client can start it again.
|
|
79
79
|
|
|
80
80
|
## Claim rules
|
|
81
81
|
|
|
@@ -103,7 +103,7 @@ The transaction fails without changes when any check fails.
|
|
|
103
103
|
|
|
104
104
|
An expired claim cannot renew itself, even when the owner ID and token hash still match. Recovery first takes a new claim and increases the generation.
|
|
105
105
|
|
|
106
|
-
The
|
|
106
|
+
The server also renews active claims from a timer. The timer is a backup for a run with no state writes. Normal write correctness does not depend on the timer.
|
|
107
107
|
|
|
108
108
|
Claim rejection uses `ClaimLostError` with one internal reason:
|
|
109
109
|
|
|
@@ -119,11 +119,11 @@ Logs may show the run ID, generation, and reason. They must not show a raw token
|
|
|
119
119
|
|
|
120
120
|
The run and queue projections follow these states:
|
|
121
121
|
|
|
122
|
-
| Run state | Queue state | Claim |
|
|
122
|
+
| Run state | Queue state | Claim | Runner | Meaning |
|
|
123
123
|
| ----------- | ----------- | ----- | -------- | ------------------------------------------------------- |
|
|
124
|
-
| `queued` | `queued` | none | none | Ready for
|
|
125
|
-
| `running` | `starting` | host | starting | A
|
|
126
|
-
| `running` | `running` | host | live | A
|
|
124
|
+
| `queued` | `queued` | none | none | Ready for server scheduling. |
|
|
125
|
+
| `running` | `starting` | host | starting | A runner launch is being recorded. |
|
|
126
|
+
| `running` | `running` | host | live | A runner is executing one node. |
|
|
127
127
|
| `running` | `parked` | none | none | Execution stopped at a durable boundary and can resume. |
|
|
128
128
|
| `waiting` | `parked` | none | none | A checkpoint or interactive request needs input. |
|
|
129
129
|
| `completed` | `done` | none | none | The run finished successfully. |
|
|
@@ -131,20 +131,24 @@ The run and queue projections follow these states:
|
|
|
131
131
|
| `timed_out` | `failed` | none | none | The run exceeded a declared timeout. |
|
|
132
132
|
| `cancelled` | `cancelled` | none | none | Cancellation completed. |
|
|
133
133
|
|
|
134
|
+
The `host` claim-owner value and `pi-workflows.worker-launch.v1` launch schema are retained version-1 internal identifiers. They do not name public components.
|
|
135
|
+
|
|
134
136
|
A lifecycle transaction updates the run, queue, attempt, decision, lease, event, and viewer facts that belong to one transition. The database must not commit a failed event while the run remains running, or a terminal queue row while the run remains nonterminal.
|
|
135
137
|
|
|
136
|
-
|
|
138
|
+
A terminal state commits before the server builds its terminal workflow message. Missing or invalid presentation data can prevent that message, but it cannot roll back completion, failure, or cancellation. The server schedules another attempt and also finds missing terminal messages when it starts, so repaired presentation data can produce the same terminal message later.
|
|
139
|
+
|
|
140
|
+
Waiting and paused work does not keep a runner or a live claim. Resume takes a new claim generation and starts a new runner from the last durable boundary.
|
|
137
141
|
|
|
138
|
-
##
|
|
142
|
+
## Runner lifecycle
|
|
139
143
|
|
|
140
|
-
A
|
|
144
|
+
A runner launch envelope contains:
|
|
141
145
|
|
|
142
146
|
```json
|
|
143
147
|
{
|
|
144
148
|
"schema": "pi-workflows.worker-launch.v1",
|
|
145
149
|
"runId": "run-id",
|
|
146
150
|
"generation": 2,
|
|
147
|
-
"
|
|
151
|
+
"runnerEpoch": "opaque-id",
|
|
148
152
|
"projectPath": "/canonical/project/path",
|
|
149
153
|
"workflowSource": {
|
|
150
154
|
"root": {
|
|
@@ -160,11 +164,13 @@ A worker launch envelope contains:
|
|
|
160
164
|
}
|
|
161
165
|
```
|
|
162
166
|
|
|
163
|
-
Before it loads workflow modules, the
|
|
167
|
+
Before it loads workflow modules, the runner verifies the root identity and every saved mounted file hash or built-in revision. After loading, it also checks the complete mounted-source map against the saved map. A mismatch parks the run with `workflowSourceChanged`. The normal scheduler does not claim that run again. The operator can restore the recorded source and explicitly resume the run, or cancel it. Changed included code does not execute.
|
|
164
168
|
|
|
165
|
-
|
|
169
|
+
After the ready message, the server sends one explicit command: `start`, `resume`, `continue`, or `restart`. A continuation names its waiting checkpoint parent. A restart begins a new run from the workflow start. The runner never infers the command from a nullable parent ID.
|
|
166
170
|
|
|
167
|
-
The
|
|
171
|
+
The server records a runner epoch before spawn. The child must return a ready message before the startup deadline. Every later child message includes the run ID, generation, and runner epoch.
|
|
172
|
+
|
|
173
|
+
The server records one terminal runner outcome:
|
|
168
174
|
|
|
169
175
|
- `exited`
|
|
170
176
|
- `cancelled`
|
|
@@ -173,13 +179,13 @@ The host records one terminal worker outcome:
|
|
|
173
179
|
- `claimLost`
|
|
174
180
|
- `orphaned`
|
|
175
181
|
|
|
176
|
-
A
|
|
182
|
+
A runner exit is not automatically a run failure. The server decides from the last committed attempt and effect state whether it can resume, must park, or must fail. If the saved run revision did not advance after the runner became ready, the server parks the run with `runnerNoProgress` and does not claim it again automatically. An explicit resume can make one new attempt after the operator corrects the cause.
|
|
177
183
|
|
|
178
184
|
## Process supervision
|
|
179
185
|
|
|
180
|
-
Each
|
|
186
|
+
Each runner starts in its own process group. A headless Pi child starts in another process group so normal runner completion can stop all Pi tool descendants without signaling the runner itself. The runner registers that direct child with the server before it sends a prompt and unregisters it only after group shutdown. The server owns the one process registry and reaps a registered child if its runner exits first.
|
|
181
187
|
|
|
182
|
-
The
|
|
188
|
+
The server enforces:
|
|
183
189
|
|
|
184
190
|
- a startup handshake deadline;
|
|
185
191
|
- node deadlines already declared by the workflow engine;
|
|
@@ -187,18 +193,22 @@ The host enforces:
|
|
|
187
193
|
- bounded captured stdout and stderr;
|
|
188
194
|
- cancellation with `SIGTERM` and bounded `SIGKILL` escalation;
|
|
189
195
|
- process-group cleanup;
|
|
190
|
-
- orphan checks after
|
|
196
|
+
- orphan checks after server restart;
|
|
191
197
|
- portable memory or process limits where Node and the operating system support them.
|
|
192
198
|
|
|
193
|
-
The child protocol
|
|
199
|
+
The child protocol applies backpressure and has an independent 1 MiB frame limit. Before the server sends a reply, it measures the encoded response. An oversized required result is stored in the existing content-addressed blob store. The server returns a small digest-bound reference, and the runner reads and verifies the value in bounded 512 KiB parts. Missing content, bad ranges, wrong lengths, wrong digests, invalid media types, malformed JSON, and oversized errors return bounded failures. They do not crash the runner.
|
|
200
|
+
|
|
201
|
+
Execution reads are narrow. `prepareRunResume()` and continuation reads return only `WorkflowRunState`. Pi session entries, tool results, activity events, viewer history, workflow snapshots, settings, and follow-ups stay in server-owned SQLite unless one exact execution operation needs them. The runner cannot request a complete `LoadedWorkflowRun`. The server measures every runner reply, so another operation cannot silently cross the frame limit.
|
|
194
202
|
|
|
195
|
-
The
|
|
203
|
+
The full logical result and request receipt remain durable for repeat handling. Matching repeated requests return the same value or content reference. Normal blob pruning removes unreferenced transfer content. Viewer history continues through its separate bounded page and content-reference interface.
|
|
204
|
+
|
|
205
|
+
The process registry includes a process start identity, not only a PID. The server accepts a runner registration only when the PID is a direct child of that active runner. A reused PID cannot let a new server kill an unrelated process.
|
|
196
206
|
|
|
197
207
|
## Live client protocol
|
|
198
208
|
|
|
199
209
|
Every production client uses one versioned `WorkflowClient` protocol. No extension, CLI command, Herdr adapter, or `piw` mode opens the live SQLite database. Clients connect through a user-only local socket. Unix socket mode is `0600`. Other platforms use their equivalent local transport and access control. Remote viewing uses a loopback-only WebSocket relay through an SSH tunnel. The relay carries the same messages and does not read SQLite.
|
|
200
210
|
|
|
201
|
-
The alpha hard cut replaces the existing
|
|
211
|
+
The alpha hard cut replaces the existing server request and replay protocols in place with `pi-workflows.client.v1`. It adds no `v2`, compatibility path, fallback reader, or second live protocol. One neutral JSON schema is the wire-contract source for TypeScript and Rust. Shared conformance fixtures must pass in both languages.
|
|
202
212
|
|
|
203
213
|
Messages use newline-delimited canonical JSON on the local socket and one canonical JSON object per WebSocket message. TypeScript and Rust use the same ECMAScript number formatting and UTF-16 object-key order for canonical JSON. Both parsers reject unknown envelope fields and non-canonical framing. One message is at most 1 MiB, matching the existing durable event limit. The receiver closes only the offending connection when framing or validation fails.
|
|
204
214
|
|
|
@@ -220,70 +230,70 @@ Each message uses one envelope:
|
|
|
220
230
|
|
|
221
231
|
The `type` is `hello`, `request`, `response`, or `event`. A response repeats the request ID and includes its outcome, revision, receipt, or bounded safe error. An event names its subscription and carries one revisioned run-list snapshot, run-view snapshot, patch, page, origin-session workflow-message change, or availability change. Valid command outcomes remain `accepted`, `adopted`, `rejected`, `conflict`, `notFound`, `claimLost`, and `unavailable`.
|
|
222
232
|
|
|
223
|
-
The
|
|
233
|
+
The server commits a command receipt before it acknowledges success. The request ID identifies one transport attempt and is excluded from the durable fingerprint. The Pi extension sends state-changing commands through the durable client path. If a connection closes after commit but before response, a retry uses a new request ID with the same client ID, idempotency key, operation, and payload, then adopts the stored receipt. Reusing a request ID or idempotency key with another durable payload returns a conflict. An `interaction.submit` response stays pending while the supervised child validates the value and settles only after the durable outcome is `accepted`, `adopted`, or `rejected`. A reconnect with the same durable identity and payload waits for and returns that same outcome. Clients do not poll SQLite for submission results.
|
|
224
234
|
|
|
225
|
-
View and subscription reads do not create receipts. Reconnection restores desired subscriptions from the last accepted presentation revision. A retained revision receives patches. A stale revision receives a bounded snapshot. A slow subscriber gets at most one socket-buffered snapshot at a time because the
|
|
235
|
+
View and subscription reads do not create receipts. Reconnection restores desired subscriptions from the last accepted presentation revision. A retained revision receives patches. A stale revision receives a bounded snapshot. A slow subscriber gets at most one socket-buffered snapshot at a time because the server waits for drain and coalesces later polls. A backpressured client write stops waiting when its connection closes, its socket fails, or its request is cancelled. Every explicit client unsubscribe removes the matching server subscription, including run-list and origin-session subscriptions.
|
|
226
236
|
|
|
227
237
|
The protocol owns four operation groups:
|
|
228
238
|
|
|
229
|
-
- run and
|
|
239
|
+
- run and resource manager commands, including start, pause, resume, cancel, restart, decisions, updates, submissions, settings, follow-ups, reconciliation, and server control;
|
|
230
240
|
- live views and recording, including run lists, snapshots, subscriptions, pages, referenced content, origin-session workflow messages, terminal-view clear, and batched session events;
|
|
231
241
|
- active-branch and model-turn reports;
|
|
232
|
-
- state and channel maintenance, including status, verification, backup, prune, channel status, channel reload, and explicit channel recovery against the active database. Backup and applied prune use one fresh CLI idempotency key per user invocation. An automatic reconnect retry keeps that key and uses a new request ID. A later invocation gets a new key. The
|
|
242
|
+
- state and channel maintenance, including status, verification, backup, prune, channel status, channel reload, and explicit channel recovery against the active database. Backup and applied prune use one fresh CLI idempotency key per user invocation. An automatic reconnect retry keeps that key and uses a new request ID. A later invocation gets a new key. The server finishes an in-flight operation after a disconnect, stores its accepted or rejected receipt before response, waits for it during shutdown, and adopts an exact retry.
|
|
233
243
|
|
|
234
|
-
`workflowMessage.reportBranch` reports workflow message IDs and Pi entry IDs from the complete origin-session view window together with `isIdle` and `hasPendingMessages`. The
|
|
244
|
+
`workflowMessage.reportBranch` reports workflow message IDs and Pi entry IDs from the complete origin-session view window together with `isIdle` and `hasPendingMessages`. The server adopts matching entries, changes a matching pending or cancelled message to `sent`, closes proved-lost turns, and creates one missing message of the source's own kind after a branch change. `workflowTurn.report` records exact model-turn starts and ends. The server keeps one active coordinator connection and process-local epoch for each origin session. A replacement connection fences the old one. Only the active epoch receives the next eligible pending message or can report branch and turn state. Polling alone creates no durable command.
|
|
235
245
|
|
|
236
246
|
### Live run view
|
|
237
247
|
|
|
238
|
-
The
|
|
248
|
+
The server returns one canonical `pi-workflows.run-view.v1` document. It contains the existing bounded workflow projection and page cursors plus a `display` object. The queue field contains display metadata only. It does not repeat the input, launch options, runner affinity, or claim capability; the complete input remains reachable through the state projection. The `display` object contains the effective status, current activity kind, allowed controls, and the stored reason when action is required. A reason above the shared 16 KiB inline-content threshold uses a small `reason` notice and a digest-bound `reasonContent` reference, so one diagnostic cannot exceed the 1 MiB protocol frame while the complete reason remains available. Renderers use this object directly. They must not combine separate queries or infer status from durable rows.
|
|
239
249
|
|
|
240
|
-
The unfinished node-attempt row is the one durable source for the current node. A running run exposes it as `currentNode`. A parked interactive run exposes the same node as `waitingOn`. A checkpoint has no unfinished attempt, so its completed checkpoint node supplies `waitingOn`. During an exact origin-session model turn, the
|
|
250
|
+
The unfinished node-attempt row is the one durable source for the current node. A running run exposes it as `currentNode`. A parked interactive run exposes the same node as `waitingOn`. A checkpoint has no unfinished attempt, so its completed checkpoint node supplies `waitingOn`. During an exact origin-session model turn, the server `display` changes that waiting node to running for presentation only. It does not infer another node or change the durable run state.
|
|
241
251
|
|
|
242
252
|
Generated referenced content is stored directly in `run_view_content` under its exact run ID, content digest, and media type. It does not share general state-blob media metadata. A content read must match all three values, so a reference from another run or another media representation is unavailable.
|
|
243
253
|
|
|
244
254
|
The origin-session response contains the active run view. When no run is active, it keeps the most recent terminal run visible while its terminal workflow message is pending or its first model turn is open, and then for 60 seconds after that turn ends. A newer run or `sessionView.clearTerminal` removes the retained terminal view. `/workflow clear` and the matching `piw` action call that control without changing workflow state.
|
|
245
255
|
|
|
246
|
-
The response also contains an ordered byte-bounded window of all nonterminal workflow messages and open sent messages needed for recovery, their complete count, and the next eligible pending message ID only for the active coordinator epoch. Message records include the source, content reference, order, state, and Pi entry needed by the shared coordinator. A branch report can name only IDs from this complete window. The
|
|
256
|
+
The response also contains an ordered byte-bounded window of all nonterminal workflow messages and open sent messages needed for recovery, their complete count, and the next eligible pending message ID only for the active coordinator epoch. Message records include the source, content reference, order, state, and Pi entry needed by the shared coordinator. A branch report can name only IDs from this complete window. The server returns all these facts from one consistent read. The extension materializes the complete run revision and message content before it updates the widget or coordinator. After every server connection, it reports the active branch before it sends a workflow message or reports a model turn. Polling an idle session creates no durable command.
|
|
247
257
|
|
|
248
|
-
Each history page has both an item limit and an encoded byte budget. Oversized values become digest-bound content references. Large workflow topology uses bounded node, edge, graph-step, and transition projections plus references for the complete original definition and complete graph history. Before the
|
|
258
|
+
Each history page has both an item limit and an encoded byte budget. Oversized values become digest-bound content references. Large workflow topology uses bounded node, edge, graph-step, and transition projections plus references for the complete original definition and complete graph history. Before the server advertises a generated reference, it stores the bytes under the exact run ID, content digest, and media type in `run_view_content`. It does not share media metadata with general state blobs. Memory-cache eviction cannot make a reference unavailable. `view.content` returns bounded chunks until the client has the complete value. The client verifies the assembled bytes against both the response digest and the digest in the advertised reference. TypeScript clients assemble every run-history page for one revision and hydrate the complete definition, complete graph history, and all referenced content before they emit a complete non-interactive view or update the Pi widget. Rust automatically requests and verifies the complete referenced definition and graph history, decodes the complete values, and then builds its graph layout. Session-event pages include the replay checkpoint immediately before the first event in the page. A large checkpoint is also a referenced value. TypeScript hydrates it with the run view, and Rust requests and resolves it before replay. A step-centered trace page selects the exact stored attempt first and uses the node ID only if that attempt has no trace event. The run list reads only status facts and never loads complete run histories.
|
|
249
259
|
|
|
250
260
|
The closed `display.status` set is `queued`, `running`, `waiting`, `paused`, `completed`, `failed`, `timed_out`, `cancelled`, and `ambiguous`.
|
|
251
261
|
|
|
252
|
-
The
|
|
262
|
+
The server computes effective status in this order:
|
|
253
263
|
|
|
254
|
-
1. A durable ambiguous external effect that requires explicit review is `ambiguous`. An effect that is still applying under a live
|
|
255
|
-
2. A live supervised
|
|
264
|
+
1. A durable ambiguous external effect that requires explicit review is `ambiguous`. An effect that is still applying under a live runner is not ambiguous.
|
|
265
|
+
2. A live supervised runner or an exact active origin-session workflow turn is `running`.
|
|
256
266
|
3. A durable terminal result keeps its terminal label after its presentation turn ends.
|
|
257
267
|
4. A durable pause is `paused` after its active Pi turn ends.
|
|
258
268
|
5. A pending interaction, decision, or presentation with no exact active turn is `waiting`.
|
|
259
269
|
6. Parked resumable work with no pending interaction is `queued`.
|
|
260
270
|
7. Admitted work that has not started is `queued`.
|
|
261
271
|
|
|
262
|
-
|
|
272
|
+
Server connection failure is the client condition `unavailable`, not a `display.status` value. `paused` is never inferred from a parked queue, pending interaction, stale cursor, or missing activity report.
|
|
263
273
|
|
|
264
274
|
### Origin-session activity
|
|
265
275
|
|
|
266
|
-
`agent_start` has no message payload. The extension binds it through the current origin-session view. The latest sent step is open while its interaction remains pending and its run is not paused. Any turn that starts in that state is workflow work. A terminal or follow-up message is open only until its first turn ends. Decisions and notifications never open a turn. The
|
|
276
|
+
`agent_start` has no message payload. The extension binds it through the current origin-session view. The latest sent step is open while its interaction remains pending and its run is not paused. Any turn that starts in that state is workflow work. A terminal or follow-up message is open only until its first turn ends. Decisions and notifications never open a turn. The server rejects a start against a closed message.
|
|
267
277
|
|
|
268
|
-
Each report names the sent workflow message, workflow turn ID, run, and origin session. The extension creates the turn ID at start and keeps it through the matching end and
|
|
278
|
+
Each report names the sent workflow message, workflow turn ID, run, and origin session. The extension creates the turn ID at start and keeps it through the matching end and server reconnect. If the session view or message receipt is still loading, it buffers start and end and reports them in order when the message becomes available.
|
|
269
279
|
|
|
270
|
-
At `agent_end`, the extension derives `completed`, `aborted`, or `error` from the documented assistant messages. It reads response-entry evidence from `ctx.sessionManager.getBranch()`; the entry ID can be null. The
|
|
280
|
+
At `agent_end`, the extension derives `completed`, `aborted`, or `error` from the documented assistant messages. It reads response-entry evidence from `ctx.sessionManager.getBranch()`; the entry ID can be null. The server applies the end, activity update, pause, unproductive-turn counter, and pending step-message cancellation in one transaction. A repeated report adopts that result. A stale turn ID cannot clear newer activity.
|
|
271
281
|
|
|
272
282
|
An aborted turn sets the run pause, cancels pending step messages, and does not increment `unproductiveTurnEnds`. The interaction derives its paused state from the run. Resuming that submitted-output step atomically clears the pause, increments the interaction revision, and creates one step message with reason `resumed`. Pi starts a fresh model turn from that message. A protected decision does not start a model turn, so pause and resume do not change its interaction revision or create another decision message. A completed, recoverably failed, or proved-lost turn increments the counter only when the submitted-output step remains pending, not paused, and has no accepted or validating submission. Values one and two create one step message with reason `reminder`; a value above two fails the attempt. At most one pending reminder-reason step exists. Acceptance, pause, cancellation, timeout, and branch re-presentation cancel pending step messages.
|
|
273
283
|
|
|
274
|
-
The process-local coordinator epoch ends on client disconnect, but an open reported workflow turn does not end.
|
|
284
|
+
The process-local coordinator epoch ends on client disconnect, but an open reported workflow turn does not end. Server startup does not close Pi turns. On `session_start`, `workflowMessage.reportBranch` closes an unended open message as `lost` only when Pi is idle. A busy Pi session re-reports the same started turn. A lost step follows the unproductive-turn rule. A lost terminal or follow-up closes after its first turn. Follow-up activity controls ordering but does not show the completed workflow as `running`. Activity cannot grant workflow authority or settle a workflow request.
|
|
275
285
|
|
|
276
286
|
### Renderers and controls
|
|
277
287
|
|
|
278
288
|
The Pi widget, Pi status line, `/piw`, `Ctrl+Shift+R`, Herdr placement adapter, CLI status output, and every local or remote `piw` screen consume the same live run view. The Pi extension subscribes by origin session and materializes the complete step history before it renders the widget. The Herdr adapter receives the exact run target from that view and owns only pane placement and focus. The TypeScript CLI and Rust TUI subscribe by run ID and use protocol pages and referenced content. Explicit `piw <runId>` mode keeps the requested run selected and does not replace it with the newest run-list item. They do not open live SQLite or compile or validate its DDL digest.
|
|
279
289
|
|
|
280
|
-
Local `piw` may start the
|
|
290
|
+
Local `piw` may start the server only by executing the installed `pi-workflows server start` command. It does not reimplement server lifecycle. A foreground TypeScript client keeps its cold-start retry timer referenced until the server is ready or the start deadline expires. It uses the package socket on Unix and the same package-derived named pipe as TypeScript on Windows. `piw serve` becomes a loopback WebSocket relay for the same client protocol. It opens one server socket connection for each WebSocket connection and couples their lifecycles one to one. It never multiplexes clients, translates state, or opens the database. A client that cannot start or reach the matching server fails with one clear unavailable or package-version error. It must not fall back to direct SQLite access.
|
|
281
291
|
|
|
282
|
-
##
|
|
292
|
+
## Runner protocol
|
|
283
293
|
|
|
284
|
-
The private
|
|
294
|
+
The private runner channel accepts these message kinds:
|
|
285
295
|
|
|
286
|
-
- `
|
|
296
|
+
- `runner.ready`
|
|
287
297
|
- `node.started`
|
|
288
298
|
- `node.update`
|
|
289
299
|
- `node.finished`
|
|
@@ -297,16 +307,16 @@ The private worker channel accepts these message kinds:
|
|
|
297
307
|
- `presentation.requested`
|
|
298
308
|
- `effect.reserve`
|
|
299
309
|
- `effect.settle`
|
|
300
|
-
- `
|
|
301
|
-
- `
|
|
310
|
+
- `runner.progress`
|
|
311
|
+
- `runner.exiting`
|
|
302
312
|
|
|
303
|
-
Every
|
|
313
|
+
Every runner message includes the runner launch schema, run ID, generation, runner epoch, attempt ID when applicable, expected revision, and a stable message ID. Headless runners use `process.register` and `process.unregister` operations under `runner.progress` to attach their Pi child group to server supervision. Registration requires the live run claim. Unregistration remains valid after a terminal state releases that claim so cleanup can finish.
|
|
304
314
|
|
|
305
|
-
The
|
|
315
|
+
The server checks the generation and epoch before it reads the payload. A stale runner gets one claim-loss response and must exit. The server stores receipts for accepted state-changing messages so a retry receives the same answer.
|
|
306
316
|
|
|
307
317
|
## Supervised channel adapters
|
|
308
318
|
|
|
309
|
-
The
|
|
319
|
+
The server launches one transport-only child for each configured Telegram profile. The child receives only the complete operator presentation, allowed Telegram identities, and the one profile credential that it needs. It does not receive the canonical decision subject, open SQLite, load workflow code, or change run state.
|
|
310
320
|
|
|
311
321
|
The private version-1 channel protocol has these message kinds:
|
|
312
322
|
|
|
@@ -316,9 +326,9 @@ The private version-1 channel protocol has these message kinds:
|
|
|
316
326
|
- `channel.settle`; and
|
|
317
327
|
- `channel.exiting`.
|
|
318
328
|
|
|
319
|
-
Each message includes the adapter epoch, profile, sequence, expected channel revision, and stable attempt ID. The
|
|
329
|
+
Each message includes the adapter epoch, profile, sequence, expected channel revision, and stable attempt ID. The server validates these values before it accepts a result or answer. A stale adapter or stale attempt cannot settle newer work.
|
|
320
330
|
|
|
321
|
-
Before the child sends or edits an external message, the
|
|
331
|
+
Before the child sends or edits an external message, the server records a managed effect in `effects` and `effect_attempts`. A confirmed result stores its Telegram message references in the effect result. A known rejection can start a bounded new attempt. If the server or adapter stops while an exact attempt is applying, only that in-flight attempt becomes `ambiguous`; the server does not send it again automatically.
|
|
322
332
|
|
|
323
333
|
The operator checks Telegram before resolving an ambiguous attempt. `/workflow-channel recover <message-id> confirm` records that the external work happened. `/workflow-channel recover <message-id> retry` starts a new numbered attempt and warns that a duplicate is possible. `channel_messages` remains the decision feature record for delivery and settlement; it does not duplicate the external-effect state or Telegram references.
|
|
324
334
|
|
|
@@ -333,11 +343,11 @@ Reuse current rows when they already own a fact:
|
|
|
333
343
|
- `workflow_messages` owns all content that Pi must add to an origin conversation.
|
|
334
344
|
- `run_bindings` owns origin session and execution mode.
|
|
335
345
|
|
|
336
|
-
`workflow_messages` contains the target session, message kind, source record, content digest, session order, state, confirmed Pi entry ID, and timestamps. Its states are `pending`, `sent`, and `cancelled`; it has no separate sent timestamp. Active-branch evidence changes a matching pending or cancelled message to `sent`. Message kind determines its renderer, turn behavior, and
|
|
346
|
+
`workflow_messages` contains the target session, message kind, source record, content digest, session order, state, confirmed Pi entry ID, and timestamps. Its states are `pending`, `sent`, and `cancelled`; it has no separate sent timestamp. Active-branch evidence changes a matching pending or cancelled message to `sent`. Message kind determines its renderer, turn behavior, and server eligibility rule. A partial unique index allows at most one pending step message for one interactive request. The table stores no sender, send lease, duplicate flag, or message-to-message pointer.
|
|
337
347
|
|
|
338
348
|
Add only these records if implementation proves the current rows cannot hold the contract:
|
|
339
349
|
|
|
340
|
-
###
|
|
350
|
+
### Server commands
|
|
341
351
|
|
|
342
352
|
`host_commands` stores request ID, client ID, operation, idempotency key, durable request fingerprint, run ID, accepted revision, outcome, receipt or error hash, and timestamps. The request ID is transport identity and is not part of the fingerprint. The request primary key prevents one request ID from naming two payloads. The client and idempotency-key uniqueness adopts the same durable payload across transport attempts.
|
|
343
353
|
|
|
@@ -347,9 +357,9 @@ Add only these records if implementation proves the current rows cannot hold the
|
|
|
347
357
|
|
|
348
358
|
`interactive_submissions` stores request ID, submission ID, idempotency key, payload hash, validating, accepted, or rejected outcome, receipt hash, and submission time. Repeated keys return the same receipt.
|
|
349
359
|
|
|
350
|
-
###
|
|
360
|
+
### Runner epochs
|
|
351
361
|
|
|
352
|
-
`run_workers` stores run ID, generation,
|
|
362
|
+
`run_workers` stores run ID, generation, runner epoch, launch envelope hash, process identity, status, start time, ready time, finish time, exit code, signal, and bounded diagnostic hash. One run and generation can have several sequential runner epochs, but only one may be active.
|
|
353
363
|
|
|
354
364
|
These tables remain part of `pi-workflows-state` schema version 1. The DDL digest changes in place under the alpha policy.
|
|
355
365
|
|
|
@@ -357,23 +367,27 @@ These tables remain part of `pi-workflows-state` schema version 1. The DDL diges
|
|
|
357
367
|
|
|
358
368
|
Agent and assistant-message steps for an interactive run execute in the origin Pi session.
|
|
359
369
|
|
|
360
|
-
The
|
|
370
|
+
The runner commits the node's resolved wall-clock deadline before it proposes `interaction.requested`. The server commits the request, changes the node attempt to waiting, parks the queue row, releases the claim, and acknowledges the runner. The runner then exits. The server continues to enforce the durable deadline while no runner exists. If the deadline passes, one control claim atomically closes the stale request and schedules a supervised timeout-resume child. The child preserves the same attempt and deadline, records `timed_out`, and follows any `$result.outcome` edge. A run with no timeout recovery edge becomes terminal and releases its session reservation. Restart recovery starts this timeout path before it schedules other work.
|
|
361
371
|
|
|
362
|
-
The extension finds eligible workflow messages during `session_start`, after model turns settle, and once per second while the session is open. The same poll also establishes the one session subscription when initial
|
|
372
|
+
The extension finds eligible workflow messages during `session_start`, after model turns settle, and once per second while the session is open. The same poll also establishes the one session subscription when initial server startup or connection fails. It keeps at most one connection attempt and one active subscription, so the open Pi session recovers without a restart and without duplicate coordinators. One `WorkflowMessageCoordinator` handles every message kind. After every server connection, it waits for the complete origin-session view and reports the active branch before it sends a workflow message or reports a model turn. The server view names the next eligible pending message only to the active coordinator epoch.
|
|
363
373
|
|
|
364
374
|
The coordinator waits until Pi is idle and has no queued user input, keeps the message ID in its in-memory queued map, and searches the active branch for that hidden ID. It reports a matching entry before any send. Otherwise, it rechecks synchronously that Pi is idle, has no pending input, the message is absent, and its connection still owns the active epoch. It calls documented `pi.sendMessage()` with no `await` between the final check and call. A poll can discover work, but it cannot send an ID already in the queued map.
|
|
365
375
|
|
|
366
|
-
After a send, the coordinator waits for the matching Pi entry and reports the active branch so the
|
|
376
|
+
After a send, the coordinator waits for the matching Pi entry and reports the active branch so the server records its entry ID and marks the message `sent`. Branch evidence marks a matching message `sent` even if its source cancelled it after the send. If Pi emits `agent_start` before that report or before the session view loads, the coordinator buffers the start and matching end, records the message first, and then reports the turn events in order.
|
|
377
|
+
|
|
378
|
+
The server alone decides whether that Pi model turn belongs to the workflow message. `workflowTurn.report` returns a version-1 receipt with `active`, `settled`, or `absent` ownership and the exact saved turn when one exists. The extension exposes workflow activity and starts session capture only after an `active` receipt. It clears its temporary copy after settlement, rejection, or disconnect. Every new Pi `agent_start` replaces any older local copy and requires fresh server acceptance before the turn can become workflow work.
|
|
379
|
+
|
|
380
|
+
Turn start and end use the exact message, run, session, and turn IDs. A matching repeat adopts the saved result. A conflicting repeat remains an error. When a run becomes terminal, the same transaction ends its open turns as `lost` and cancels pending step and decision messages. Failure and cancellation also cancel pending follow-ups. A committed notification stays eligible for delivery. A late matching end report adopts that terminal cleanup. A terminal run cannot start another step turn, and a later ordinary Pi turn cannot inherit its old workflow ownership.
|
|
367
381
|
|
|
368
|
-
Active-branch absence is usable only when the branch has no matching ID, Pi is idle, and Pi has no pending messages. If Pi or the extension disappears after the send call but before inspection, the message stays `pending`. A replacement extension reports the branch before another send. Documented Pi APIs do not prove cross-branch absence or exactly-once model execution.
|
|
382
|
+
Active-branch absence is usable only when the branch has no matching ID, Pi is idle, and Pi has no pending messages. If Pi or the extension disappears after the send call but before inspection, the message stays `pending`. A replacement extension reports the branch before another send. The idle branch report settles an unproved open server turn as `lost`. Documented Pi APIs do not prove cross-branch absence or exactly-once model execution.
|
|
369
383
|
|
|
370
384
|
The extension subscribes to the active origin-session live run view and projects it into Pi's documented widget and status APIs. It never opens SQLite, runs workflow code, or derives a display status. `Shift+Up` and `Shift+Down` scroll the widget. When Herdr is available, the widget also shows `Ctrl+Shift+R piw`, and `/piw` remains the command fallback. Both actions open or focus the exact run from the same view.
|
|
371
385
|
|
|
372
|
-
A tool update or submission goes to the
|
|
386
|
+
A tool update or submission goes to the server. It includes the exact request, node, attempt, expected revision, and tool-call idempotency key. The server first checks this transport contract and records a provisional `validating` submission. It then schedules a supervised workflow child. Only that child loads workflow code and runs the node's `validate` function. The child reports `interaction.accepted` or `interaction.rejected` to the server. The server settles the request only after acceptance. A rejected payload leaves the same request pending and returns the stored actionable error to the model. If the child stops before it reports a result, the server rejects the provisional submission and leaves the request ready for a corrected retry.
|
|
373
387
|
|
|
374
|
-
An ordinary checkpoint accepts the model-facing `answer` action and starts a continuation run. A protected human decision never accepts that tool action. The extension displays the decision without starting a model turn, and a person answers it with `/workflow answer` through `decision.answer`. When a protected decision reaches its saved `onTimeout` deadline, the
|
|
388
|
+
An ordinary checkpoint accepts the model-facing `answer` action and starts a continuation run. A protected human decision never accepts that tool action. The extension displays the decision without starting a model turn, and a person answers it with `/workflow answer` through `decision.answer`. When a protected decision reaches its saved `onTimeout` deadline, the server takes a control claim on the waiting parent, atomically records the validated default, closes the pending interaction, releases the parent claim, and reserves the continuation. A human answer cannot win after that deadline.
|
|
375
389
|
|
|
376
|
-
The session keeps normal Pi entries for prompts, tools, and replies. Pi Workflows stores the public session entry ID used for presentation adoption. It does not edit the Pi session file or schema. A normal
|
|
390
|
+
The session keeps normal Pi entries for prompts, tools, and replies. Pi Workflows stores the public session entry ID used for presentation adoption. It does not edit the Pi session file or schema. A normal runner continuation leaves an active session capture open until the matching Pi turn ends. Only proved interruption can fail that capture; runner handoff alone cannot report that the server stopped.
|
|
377
391
|
|
|
378
392
|
One session sends one workflow message at a time. Messages keep acceptance order, but an earlier ineligible or cancelled message does not block unrelated eligible work. Source state and message kind decide eligibility. A reload clears only process-local queued state. `workflowMessage.reportBranch` adopts existing entries and closes lost turns. When a pending source has no entry on the active branch, it creates one message of that source's own kind: a step with reason `resumed` for an interaction, or a decision for a protected decision. Repeating a report or returning to a branch that already contains that source creates no new message.
|
|
379
393
|
|
|
@@ -381,7 +395,7 @@ A notify node creates a passive `notification` message in the same transaction a
|
|
|
381
395
|
|
|
382
396
|
## Detached execution
|
|
383
397
|
|
|
384
|
-
A run with headless execution mode uses the existing `pi --mode rpc` integration for agent steps. The Pi child uses a separate process group registered with the
|
|
398
|
+
A run with headless execution mode uses the existing `pi --mode rpc` integration for agent steps. The Pi child uses a separate process group registered with the server. The runner stops that group during normal completion. Cancellation gives the runner a bounded cleanup interval, and the server reaps the registered group if the runner exits first.
|
|
385
399
|
|
|
386
400
|
The headless child receives only the workflow step prompt, configured model arguments, and the bridge extension. Its submission uses the same step and attempt contract as origin-session work. A headless run cannot use a visible assistant-message step because it has no origin Pi session.
|
|
387
401
|
|
|
@@ -389,9 +403,9 @@ The run binding records `interactive` or `headless` execution mode. Viewers show
|
|
|
389
403
|
|
|
390
404
|
## Pause and cancellation
|
|
391
405
|
|
|
392
|
-
An explicit pause command atomically commits `paused = 1` on the run, parks the queue, releases the exact claim, cancels pending step messages, and stores the command receipt. The fenced
|
|
406
|
+
An explicit pause command atomically commits `paused = 1` on the run, parks the queue, releases the exact claim, cancels pending step messages, and stores the command receipt. The fenced runner process group then stops. When Escape aborts an origin-session turn, the extension sends one `workflowTurn.report` end message with `stopReason: "aborted"`. The server atomically ends that exact activity, sets the run pause, derives the pending interaction as paused, and cancels its pending step messages. The extension does not send a second pause command. A parked interaction has no runner or live run claim. While its run is paused, updates, submissions, and decision answers are rejected. Resume clears the run pause; work for the same pending interaction continues in place, while other paused work takes a new generation and starts another runner from the last durable boundary. An uncommitted pure node can run again after resume.
|
|
393
407
|
|
|
394
|
-
Cancellation against a live
|
|
408
|
+
Cancellation against a live runner atomically commits terminal cancellation, cancels pending attempt and interaction state, settles effect recovery state, releases the exact claim, and stores the command receipt. A pending effect becomes cancelled. An applying effect becomes ambiguous because the server cannot prove its external outcome. The server then stops the fenced runner process group. A server crash after the receipt cannot resume the cancelled run or retry the ambiguous effect. If the child does not stop by the deadline, the server kills its process group.
|
|
395
409
|
|
|
396
410
|
Cancellation against an expired running row first takes a new control claim. The claim operation must prove that the old lease is absent or expired. The new owner then cancels the active attempt, effect recovery state, and pending interaction or human decision in one lifecycle transaction.
|
|
397
411
|
|
|
@@ -399,18 +413,18 @@ A client cannot force-cancel a live claim through the stale recovery path.
|
|
|
399
413
|
|
|
400
414
|
## Recovery
|
|
401
415
|
|
|
402
|
-
At startup the
|
|
416
|
+
At startup the server:
|
|
403
417
|
|
|
404
|
-
1. Takes the global
|
|
405
|
-
2. Reaps
|
|
418
|
+
1. Takes the global server epoch.
|
|
419
|
+
2. Reaps runner records that match an exact stale process identity.
|
|
406
420
|
3. Finds expired running runs and active attempts.
|
|
407
421
|
4. Reads managed effect state before deciding whether work can repeat.
|
|
408
422
|
5. Parks uncertain effects for manual review.
|
|
409
423
|
6. Makes pure and fully settled work claimable.
|
|
410
|
-
7. Restores pending interactive requests, workflow messages, external-channel decisions, and scheduled
|
|
411
|
-
8. Starts supervised timeout recovery for pending interactive requests only when their durable deadline expired during a reported model turn from an active connected session. A disconnect suspends the timer, and a new branch report resumes it without losing the prior active time. Message delivery, waiting, paused time,
|
|
424
|
+
7. Restores pending interactive requests, workflow messages, external-channel decisions, and scheduled resource manager work without changing Pi message or turn state.
|
|
425
|
+
8. Starts supervised timeout recovery for pending interactive requests only when their durable deadline expired during a reported model turn from an active connected session. A disconnect suspends the timer, and a new branch report resumes it without losing the prior active time. Message delivery, waiting, paused time, server downtime, and a closed Pi session do not consume the node timeout.
|
|
412
426
|
9. Resumes any remaining provisional `validating` submission in a new supervised child.
|
|
413
|
-
10. Waits for the extension's active-branch report before it confirms pending entries as sent, closes a turn as `lost`, or creates a branch-specific replacement. The extension sends this report after every
|
|
427
|
+
10. Waits for the extension's active-branch report before it confirms pending entries as sent, closes a turn as `lost`, or creates a branch-specific replacement. The extension sends this report after every server connection.
|
|
414
428
|
11. Starts no model turn until a matching Pi session connects or headless mode is declared.
|
|
415
429
|
|
|
416
430
|
Recovery resumes from the last committed boundary. An uncommitted compute node may run again because compute is pure. An action with a stored effect receipt adopts that receipt. An effect in `ambiguous` state requires explicit recovery.
|
|
@@ -419,7 +433,7 @@ Claim loss is a handoff, not a run failure. The old owner writes no terminal eve
|
|
|
419
433
|
|
|
420
434
|
## Effects and retry safety
|
|
421
435
|
|
|
422
|
-
Compute nodes must not perform external side effects. They can repeat after a
|
|
436
|
+
Compute nodes must not perform external side effects. They can repeat after a runner crash.
|
|
423
437
|
|
|
424
438
|
Side-effecting action and shell behavior must have one of these contracts:
|
|
425
439
|
|
|
@@ -427,26 +441,27 @@ Side-effecting action and shell behavior must have one of these contracts:
|
|
|
427
441
|
- a managed effect with a read-back check that proves whether it applied;
|
|
428
442
|
- an explicit non-resumable result that becomes `ambiguous` after an uncertain crash.
|
|
429
443
|
|
|
430
|
-
The
|
|
444
|
+
The server reserves an effect before execution. The engine creates the idempotency key from the run ID, effect type, full compiled node path, and node visit number. Workflow code provides the effect type and request, but it does not provide this internal key. Included workflows can use the same local node name without sharing a key. The request fingerprint prevents key reuse with another payload.
|
|
431
445
|
|
|
432
446
|
An applied, rejected, or cancelled effect is terminal. An ambiguous effect is also terminal for automatic retry. An operator may use a separate reviewed recovery action after inspecting the external system.
|
|
433
447
|
|
|
434
|
-
##
|
|
448
|
+
## Resource managers
|
|
435
449
|
|
|
436
|
-
The global
|
|
450
|
+
The global server also reconciles managed resources. Resource managers keep their existing resource claims, queue, effects, and child workflow request keys.
|
|
437
451
|
|
|
438
|
-
A
|
|
452
|
+
A resource manager child run enters the same global run queue and runner process model. It does not need an origin Pi session unless its workflow declares an interactive step. A headless child uses the declared provider path. A child that needs an origin session parks with a clear unsupported-input result unless the resource manager supplied an approved session binding.
|
|
439
453
|
|
|
440
|
-
|
|
454
|
+
Resource manager reconcile code runs in a supervised resource runner, not in the server event loop. Resource manager initialization also runs in a source resolver child. Before `resourceManager.apply` commits, the server checks that the resolved source still matches resource manager discovery rules and the exact source digest.
|
|
441
455
|
|
|
442
456
|
## Failure classification
|
|
443
457
|
|
|
444
458
|
Use separate states and messages for these failures:
|
|
445
459
|
|
|
446
460
|
- `claimLost`: another generation owns the run, or the claim expired.
|
|
447
|
-
- `workerCrashed`: the child exited without a terminal protocol message.
|
|
461
|
+
- `workerCrashed`: the child exited without a terminal protocol message after it saved progress.
|
|
462
|
+
- `runnerNoProgress`: the child exited before the saved run revision advanced and needs explicit resume or cancellation.
|
|
448
463
|
- `workerTimedOut`: the child exceeded a declared deadline.
|
|
449
|
-
- `hostUnavailable`: the client cannot reach or start the
|
|
464
|
+
- `hostUnavailable`: the client cannot reach or start the server.
|
|
450
465
|
- `sourceChanged`: the workflow source does not match the saved identity.
|
|
451
466
|
- `effectAmbiguous`: an external action may have applied without a receipt.
|
|
452
467
|
- `nodeFailed`: workflow code returned a normal failure.
|
|
@@ -456,11 +471,11 @@ A failure in one class must not be reported as another. In particular, claim los
|
|
|
456
471
|
|
|
457
472
|
## Status and privacy
|
|
458
473
|
|
|
459
|
-
`pi-workflows
|
|
474
|
+
`pi-workflows server status` reports:
|
|
460
475
|
|
|
461
|
-
-
|
|
476
|
+
- server state and epoch;
|
|
462
477
|
- socket availability;
|
|
463
|
-
- active
|
|
478
|
+
- active runner count;
|
|
464
479
|
- queued, running, parked, and waiting counts;
|
|
465
480
|
- expired claim count;
|
|
466
481
|
- pending interaction count;
|
|
@@ -492,10 +507,10 @@ The implementation conforms when:
|
|
|
492
507
|
|
|
493
508
|
- every protected write checks and renews one live claim atomically;
|
|
494
509
|
- an expired or replaced owner cannot write;
|
|
495
|
-
- a blocked
|
|
510
|
+
- a blocked runner cannot stop server renewal;
|
|
496
511
|
- Pi can restart while work computes or waits;
|
|
497
|
-
- an open Pi session reconnects after initial
|
|
498
|
-
- the
|
|
512
|
+
- an open Pi session reconnects after initial server startup or connection fails;
|
|
513
|
+
- the server can restart and recover from committed state;
|
|
499
514
|
- run, queue, attempt, decision, lease, event, and viewer projections remain consistent after injected crashes;
|
|
500
515
|
- an expired running row can be resumed or cancelled safely;
|
|
501
516
|
- duplicate commands and submissions return stored receipts;
|
|
@@ -505,10 +520,10 @@ The implementation conforms when:
|
|
|
505
520
|
- a busy Pi session with a pending message does not queue duplicate messages or model turns;
|
|
506
521
|
- two Pi processes cannot send for one origin session because only one coordinator epoch is active;
|
|
507
522
|
- active-branch absence requires no hidden message ID, an idle Pi session, and no pending Pi messages;
|
|
508
|
-
- every
|
|
523
|
+
- every server connection reports the active branch before any workflow-message send or turn report;
|
|
509
524
|
- a crash after send leaves the message pending until branch evidence adopts it;
|
|
510
525
|
- active-branch evidence changes a matching pending or cancelled message to sent;
|
|
511
|
-
-
|
|
526
|
+
- server restart alone never closes an active Pi turn as `lost`;
|
|
512
527
|
- a branch change creates at most one source-kind message when that source has no entry on the active branch;
|
|
513
528
|
- a partial unique index allows at most one pending step message for each interactive request;
|
|
514
529
|
- pause is stored once on the run and derived for its interaction;
|
|
@@ -522,16 +537,16 @@ The implementation conforms when:
|
|
|
522
537
|
- a stale adapter epoch or attempt cannot settle newer channel work;
|
|
523
538
|
- an interrupted exact in-flight channel attempt becomes ambiguous and is never retried without explicit recovery;
|
|
524
539
|
- explicit confirmation records observed success, while explicit retry creates a new attempt and warns about possible duplication;
|
|
525
|
-
- the extension and
|
|
540
|
+
- the extension and server run no workflow or resource manager code in their own event loops;
|
|
526
541
|
- the production package contains no embedded execution fallback;
|
|
527
|
-
- the
|
|
528
|
-
- the widget, status line, Herdr actions, CLI, and `piw` render the same
|
|
542
|
+
- the server is the only production process that opens live SQLite state;
|
|
543
|
+
- the widget, status line, Herdr actions, CLI, and `piw` render the same server-produced status and controls;
|
|
529
544
|
- running and waiting projections identify the current workflow node from the same unfinished attempt, while checkpoint waits use the completed checkpoint node;
|
|
530
545
|
- an exact origin-session model turn presents that same waiting node as running without changing its durable identity;
|
|
531
546
|
- a busy origin session displays `running` for the full exact workflow turn, including a terminal or pausing turn, and a stale turn-end report cannot clear newer activity;
|
|
532
|
-
- normal
|
|
547
|
+
- normal runner continuation does not fail an active Pi session capture or report a false server interruption;
|
|
533
548
|
- `paused` appears only after a durable pause and matching turn end;
|
|
534
549
|
- a terminal run remains in the origin-session view while its terminal message is pending or its first turn is open, and then for 60 seconds after that turn ends, without retaining execution authority;
|
|
535
550
|
- a TypeScript-created live database is viewable by the matching Rust `piw` through the client protocol without a duplicated SQLite digest;
|
|
536
|
-
- no removed
|
|
551
|
+
- no removed server, replay, or direct SQLite client path remains selectable;
|
|
537
552
|
- real Pi end-to-end tests, repository checks, reviewer checks, and CI pass.
|