@osolmaz/pi-workflows 0.12.1 → 0.13.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.
- package/README.md +59 -33
- package/dist/builtins/autodoc.workflow.d.ts +194 -7
- package/dist/builtins/autodoc.workflow.js +156 -30
- package/dist/builtins/autodoc.workflow.js.map +1 -1
- package/dist/builtins/autoimplement-command-batches.d.ts +1 -0
- package/dist/builtins/autoimplement-command-batches.js +29 -31
- package/dist/builtins/autoimplement-command-batches.js.map +1 -1
- package/dist/builtins/autoimplement.workflow.d.ts +1619 -97
- package/dist/builtins/autoimplement.workflow.js +416 -153
- package/dist/builtins/autoimplement.workflow.js.map +1 -1
- package/dist/builtins/autoplan.workflow.d.ts +126 -13
- package/dist/builtins/autoplan.workflow.js +200 -29
- package/dist/builtins/autoplan.workflow.js.map +1 -1
- package/dist/builtins/catalog.js +7 -5
- package/dist/builtins/catalog.js.map +1 -1
- package/dist/builtins/change-verification.workflow.d.ts +110 -0
- package/dist/builtins/change-verification.workflow.js +860 -0
- package/dist/builtins/change-verification.workflow.js.map +1 -0
- package/dist/builtins/index.d.ts +2 -1
- package/dist/builtins/index.js +1 -0
- package/dist/builtins/index.js.map +1 -1
- package/dist/builtins/monitor.workflow.d.ts +56 -21
- package/dist/builtins/monitor.workflow.js +499 -217
- package/dist/builtins/monitor.workflow.js.map +1 -1
- package/dist/builtins/plain-summary.workflow.d.ts +32 -0
- package/dist/builtins/plain-summary.workflow.js +134 -0
- package/dist/builtins/plain-summary.workflow.js.map +1 -0
- package/dist/builtins/plan-change.workflow.d.ts +527 -26
- package/dist/builtins/plan-change.workflow.js +26 -0
- package/dist/builtins/plan-change.workflow.js.map +1 -1
- package/dist/builtins/sanity-check.workflow.d.ts +45 -3
- package/dist/builtins/sanity-check.workflow.js +45 -7
- package/dist/builtins/sanity-check.workflow.js.map +1 -1
- package/dist/builtins/workspace-preparation.workflow.d.ts +75 -0
- package/dist/builtins/workspace-preparation.workflow.js +498 -0
- package/dist/builtins/workspace-preparation.workflow.js.map +1 -0
- package/dist/controllers/effects.d.ts +3 -2
- package/dist/controllers/effects.js +8 -1
- package/dist/controllers/effects.js.map +1 -1
- package/dist/controllers/index.d.ts +1 -1
- package/dist/controllers/index.js +1 -1
- package/dist/controllers/index.js.map +1 -1
- package/dist/controllers/manager.d.ts +1 -0
- package/dist/controllers/manager.js +41 -17
- package/dist/controllers/manager.js.map +1 -1
- package/dist/controllers/sqlite.d.ts +107 -85
- package/dist/controllers/sqlite.js +1611 -1486
- package/dist/controllers/sqlite.js.map +1 -1
- package/dist/controllers/store.d.ts +9 -8
- package/dist/controllers/store.js +1 -31
- package/dist/controllers/store.js.map +1 -1
- package/dist/controllers/types.d.ts +3 -0
- package/dist/controllers/workflow-engine-scheduler.d.ts +1 -1
- package/dist/controllers/workflow-engine-scheduler.js +3 -5
- package/dist/controllers/workflow-engine-scheduler.js.map +1 -1
- package/dist/controllers/workflows.d.ts +2 -2
- package/dist/controllers/workflows.js +11 -10
- package/dist/controllers/workflows.js.map +1 -1
- package/dist/extension/controller-host.js +2 -2
- package/dist/extension/controller-host.js.map +1 -1
- package/dist/extension/decision-channels.d.ts +2 -0
- package/dist/extension/decision-channels.js +311 -118
- package/dist/extension/decision-channels.js.map +1 -1
- package/dist/extension/executor.d.ts +9 -2
- package/dist/extension/executor.js +90 -6
- package/dist/extension/executor.js.map +1 -1
- package/dist/extension/herdr-viewer.d.ts +0 -1
- package/dist/extension/herdr-viewer.js +0 -4
- package/dist/extension/herdr-viewer.js.map +1 -1
- package/dist/extension/index.js +156 -117
- package/dist/extension/index.js.map +1 -1
- package/dist/extension/recorder.d.ts +3 -10
- package/dist/extension/recorder.js +13 -22
- package/dist/extension/recorder.js.map +1 -1
- package/dist/extension/step-message.d.ts +7 -2
- package/dist/extension/step-message.js +94 -2
- package/dist/extension/step-message.js.map +1 -1
- package/dist/extension/widget.js +6 -0
- package/dist/extension/widget.js.map +1 -1
- package/dist/host/rpc-executor.d.ts +3 -0
- package/dist/host/rpc-executor.js +2 -0
- package/dist/host/rpc-executor.js.map +1 -1
- package/dist/host/runner.d.ts +3 -6
- package/dist/host/runner.js +83 -32
- package/dist/host/runner.js.map +1 -1
- package/dist/render/graph-render.js +14 -8
- package/dist/render/graph-render.js.map +1 -1
- package/dist/state/database.d.ts +35 -0
- package/dist/state/database.js +287 -0
- package/dist/state/database.js.map +1 -0
- package/dist/state/index.d.ts +4 -0
- package/dist/state/index.js +5 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/json.d.ts +6 -0
- package/dist/state/json.js +38 -0
- package/dist/state/json.js.map +1 -0
- package/dist/state/mutation.d.ts +57 -0
- package/dist/state/mutation.js +255 -0
- package/dist/state/mutation.js.map +1 -0
- package/dist/state/schema.d.ts +6 -0
- package/dist/state/schema.js +473 -0
- package/dist/state/schema.js.map +1 -0
- package/dist/viewer/cli.d.ts +2 -2
- package/dist/viewer/cli.js +142 -122
- package/dist/viewer/cli.js.map +1 -1
- package/dist/viewer/render.d.ts +4 -4
- package/dist/viewer/render.js +2 -17
- package/dist/viewer/render.js.map +1 -1
- package/dist/viewer/session-reducer.d.ts +1 -1
- package/dist/viewer/session-reducer.js +1 -1
- package/dist/viewer/tui.d.ts +3 -3
- package/dist/viewer/tui.js +15 -13
- package/dist/viewer/tui.js.map +1 -1
- package/dist/viewer/watch.d.ts +2 -5
- package/dist/viewer/watch.js +13 -13
- package/dist/viewer/watch.js.map +1 -1
- package/dist/workflows/composition.js +12 -2
- package/dist/workflows/composition.js.map +1 -1
- package/dist/workflows/definition.d.ts +6 -2
- package/dist/workflows/definition.js +17 -0
- package/dist/workflows/definition.js.map +1 -1
- package/dist/workflows/engine.d.ts +6 -6
- package/dist/workflows/engine.js +183 -103
- package/dist/workflows/engine.js.map +1 -1
- package/dist/workflows/errors.d.ts +3 -3
- package/dist/workflows/errors.js +3 -3
- package/dist/workflows/human-decision.d.ts +29 -4
- package/dist/workflows/human-decision.js +547 -283
- package/dist/workflows/human-decision.js.map +1 -1
- package/dist/workflows/index.d.ts +4 -5
- package/dist/workflows/index.js +3 -4
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/schema.js +17 -1
- package/dist/workflows/schema.js.map +1 -1
- package/dist/workflows/store.d.ts +83 -103
- package/dist/workflows/store.js +902 -951
- package/dist/workflows/store.js.map +1 -1
- package/dist/workflows/types.d.ts +55 -81
- package/docs/CONTROLLERS.md +10 -8
- package/docs/DEFERRED_TURNS.md +2 -2
- package/docs/DESIGN_PHILOSOPHY.md +4 -2
- package/docs/HUMAN_DECISIONS.md +13 -14
- package/docs/MONITOR.md +179 -231
- package/docs/SQLITE_STATE.md +219 -0
- package/docs/WORKFLOW_COMPOSITION.md +27 -19
- package/docs/WORKFLOW_STEP_MESSAGES.md +20 -18
- package/docs/WORKFLOW_UPDATES.md +10 -9
- package/docs/development.md +9 -9
- package/docs/live-replay-protocol.md +28 -37
- package/docs/plans/2026-08-16-workflow-updates-plan.md +1 -1
- package/docs/plans/2026-08-19-human-decision-gates-plan.md +1 -1
- package/docs/plans/2026-08-21-autoimplement-timeout-fallback-plan.md +1 -1
- package/docs/plans/2026-08-21-plan-change-approval-policy-plan.md +1 -1
- package/docs/plans/2026-08-21-sanity-check-plan.md +30 -16
- package/docs/plans/2026-08-22-goal-finishing-monitor-plan.md +200 -0
- package/docs/plans/2026-08-23-assistant-agent-completion-plan.md +701 -0
- package/docs/plans/2026-08-23-sqlite-state-plan.md +970 -0
- package/docs/plans/2026-08-24-change-scoped-verification-plan.md +419 -0
- package/docs/plans/replayable-run-bundles-implementation-plan.md +2 -2
- package/docs/plans/session-event-replay-implementation-plan.md +1 -1
- package/docs/plans/tui-viewer-implementation-plan.md +1 -1
- package/docs/session-event-journal.md +63 -434
- package/docs/tui-viewer.md +13 -15
- package/docs/workflows.md +111 -62
- package/examples/workflows/plain-summary.workflow.ts +1 -0
- package/herdr-plugin.toml +1 -1
- package/package.json +1 -1
- package/plugins/herdr/viewer.mjs +1 -11
- package/skills/autodoc/SKILL.md +7 -0
- package/skills/autoimplement/SKILL.md +4 -0
- package/skills/autoplan/SKILL.md +5 -4
- package/skills/monitor/SKILL.md +91 -163
- package/skills/pi-workflows/SKILL.md +7 -7
- package/skills/sanity-check/SKILL.md +1 -1
- package/src/builtins/autodoc.workflow.ts +184 -33
- package/src/builtins/autoimplement-command-batches.ts +39 -33
- package/src/builtins/autoimplement.workflow.ts +483 -175
- package/src/builtins/autoplan.workflow.ts +290 -40
- package/src/builtins/catalog.ts +7 -5
- package/src/builtins/change-verification.workflow.ts +1143 -0
- package/src/builtins/index.ts +7 -1
- package/src/builtins/monitor.workflow.ts +667 -250
- package/src/builtins/plain-summary.workflow.ts +185 -0
- package/src/builtins/plan-change.workflow.ts +35 -0
- package/src/builtins/sanity-check.workflow.ts +62 -7
- package/src/builtins/workspace-preparation.workflow.ts +668 -0
- package/src/controllers/effects.ts +7 -0
- package/src/controllers/index.ts +0 -6
- package/src/controllers/manager.ts +72 -32
- package/src/controllers/sqlite.ts +2420 -1948
- package/src/controllers/store.ts +17 -38
- package/src/controllers/types.ts +3 -0
- package/src/controllers/workflow-engine-scheduler.ts +4 -8
- package/src/controllers/workflows.ts +45 -21
- package/src/extension/controller-host.ts +1 -2
- package/src/extension/decision-channels.ts +427 -144
- package/src/extension/executor.ts +106 -6
- package/src/extension/herdr-viewer.ts +0 -5
- package/src/extension/index.ts +180 -132
- package/src/extension/recorder.ts +13 -22
- package/src/extension/step-message.ts +106 -4
- package/src/extension/widget.ts +8 -0
- package/src/host/rpc-executor.ts +4 -0
- package/src/host/runner.ts +93 -41
- package/src/render/graph-render.ts +11 -4
- package/src/state/database.ts +375 -0
- package/src/state/index.ts +29 -0
- package/src/state/json.ts +42 -0
- package/src/state/mutation.ts +435 -0
- package/src/state/schema.ts +475 -0
- package/src/viewer/cli.ts +151 -144
- package/src/viewer/render.ts +12 -24
- package/src/viewer/session-reducer.ts +1 -1
- package/src/viewer/tui.ts +18 -17
- package/src/viewer/watch.ts +13 -17
- package/src/workflows/composition.ts +12 -3
- package/src/workflows/definition.ts +36 -3
- package/src/workflows/engine.ts +212 -116
- package/src/workflows/errors.ts +3 -3
- package/src/workflows/human-decision.ts +795 -340
- package/src/workflows/index.ts +15 -19
- package/src/workflows/schema.ts +19 -1
- package/src/workflows/store.ts +1295 -1163
- package/src/workflows/types.ts +61 -81
- package/dist/workflows/artifacts.d.ts +0 -40
- package/dist/workflows/artifacts.js +0 -155
- package/dist/workflows/artifacts.js.map +0 -1
- package/dist/workflows/migrate-sources.d.ts +0 -42
- package/dist/workflows/migrate-sources.js +0 -133
- package/dist/workflows/migrate-sources.js.map +0 -1
- package/docs/run-bundles.md +0 -481
- package/src/workflows/artifacts.ts +0 -188
- package/src/workflows/migrate-sources.ts +0 -178
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# Live replay protocol
|
|
2
2
|
|
|
3
|
-
The Rust viewer (`tui/`) can watch runs in two ways: by reading
|
|
3
|
+
The Rust viewer (`tui/`) can watch runs in two ways: by reading SQLite runs
|
|
4
4
|
directly from the filesystem (the default, in-process) or by connecting to a
|
|
5
5
|
`piw serve` WebSocket server. Both paths produce the same semantic state; the
|
|
6
6
|
protocol below is the network form of that state. Protocol id:
|
|
7
7
|
`pi-workflows.replay.v1`.
|
|
8
8
|
|
|
9
|
-
The server is a reader like any other: it only consumes
|
|
10
|
-
[
|
|
9
|
+
The server is a reader like any other: it only consumes SQLite runs (see
|
|
10
|
+
[SQLITE_STATE.md](SQLITE_STATE.md)) and never writes them. The protocol has no
|
|
11
11
|
authentication, so the server only accepts loopback bind addresses and refuses
|
|
12
|
-
to start on anything else;
|
|
12
|
+
to start on anything else; workflow state contains private data, and remote viewing
|
|
13
13
|
goes through an SSH tunnel. Handshakes that
|
|
14
14
|
carry an `Origin` header are rejected: browsers always send one, and a web
|
|
15
|
-
page must not be able to read
|
|
15
|
+
page must not be able to read workflow state by opening a WebSocket to localhost.
|
|
16
16
|
|
|
17
17
|
## Transport and framing
|
|
18
18
|
|
|
@@ -49,18 +49,15 @@ run:
|
|
|
49
49
|
}
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
- `manifest`, `workflow`, `state`, `events`, and every `session` field are
|
|
53
|
-
|
|
54
|
-
top-level `events` are
|
|
55
|
-
|
|
56
|
-
`session.capture` is capture integrity. `session
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
bundle has not changed for 60 seconds.
|
|
62
|
-
- Artifact references inside the view stay references; contents are fetched
|
|
63
|
-
on demand.
|
|
52
|
+
- `manifest`, `workflow`, `state`, `events`, and every `session` field are
|
|
53
|
+
semantic projections from SQLite. `workflow` is the definition snapshot,
|
|
54
|
+
top-level `events` are workflow events, `session.entries` are settled Pi
|
|
55
|
+
entries, `session.events` are normalized temporal events, and
|
|
56
|
+
`session.capture` is capture integrity. `session` is `null` until a binding
|
|
57
|
+
exists.
|
|
58
|
+
- `live` is true while the run status is non-terminal. `possiblyInterrupted`
|
|
59
|
+
is a reader-side diagnostic based on current ownership and update time.
|
|
60
|
+
- Values are resolved from content-addressed SQLite blobs.
|
|
64
61
|
|
|
65
62
|
Because the full trace and session history are part of the view, replay
|
|
66
63
|
scrubbing is a pure client-side operation; rewinding never requires the
|
|
@@ -106,7 +103,7 @@ Client to server:
|
|
|
106
103
|
| `watch_runs` | — | subscribe to the run listing |
|
|
107
104
|
| `watch_run` | `runId` | subscribe to one run's view |
|
|
108
105
|
| `unwatch_run` | `runId` | end a run subscription |
|
|
109
|
-
| `fetch_artifact` | `runId`, `path` |
|
|
106
|
+
| `fetch_artifact` | `runId`, `path` | unsupported; returns `error` |
|
|
110
107
|
|
|
111
108
|
Server to client:
|
|
112
109
|
|
|
@@ -116,13 +113,11 @@ Server to client:
|
|
|
116
113
|
| `runs` | `runs` | full run listing (summaries), re-sent on change |
|
|
117
114
|
| `run_snapshot` | `runId`, `revision`, `view` | full view after subscribe |
|
|
118
115
|
| `run_patch` | `runId`, `revision`, `patch` | incremental view update |
|
|
119
|
-
| `artifact` | `runId`, `path`, `content` |
|
|
116
|
+
| `artifact` | `runId`, `path`, `content` | reserved; not sent by SQLite-backed servers |
|
|
120
117
|
| `error` | `message`, `runId?` | request failed |
|
|
121
118
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
symlinks whose canonical targets leave it are refused. Responses are capped at
|
|
125
|
-
4 MiB of actual file size; anything else produces an `error`.
|
|
119
|
+
SQLite-backed views contain resolved values. A `fetch_artifact` request returns
|
|
120
|
+
an `error` because there is no artifact directory.
|
|
126
121
|
|
|
127
122
|
Run listing summaries are the manifest plus `live` and
|
|
128
123
|
`possiblyInterrupted`:
|
|
@@ -136,20 +131,16 @@ run views use patches.
|
|
|
136
131
|
|
|
137
132
|
## Reconnection
|
|
138
133
|
|
|
139
|
-
The native client treats the run listing
|
|
140
|
-
|
|
134
|
+
The native client treats the run listing and selected run as desired state rather
|
|
135
|
+
than one-shot commands. After a connection closes,
|
|
141
136
|
it keeps the cached run visible with a stale/reconnecting label, retries with
|
|
142
137
|
bounded backoff, sends `watch_runs` after the next valid `hello`, and restores
|
|
143
138
|
the current `watch_run`. A reconnect receives a fresh snapshot before later
|
|
144
|
-
patches.
|
|
145
|
-
|
|
146
|
-
##
|
|
147
|
-
|
|
148
|
-
The server
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
`manifest.json` are
|
|
153
|
-
re-read on change; a `state.json` whose `traceSeq` is older than the last
|
|
154
|
-
tailed trace event is stale and is replaced when the writer catches up. After
|
|
155
|
-
a terminal status, watching stops.
|
|
139
|
+
patches.
|
|
140
|
+
|
|
141
|
+
## SQLite semantics behind the protocol
|
|
142
|
+
|
|
143
|
+
The server polls `state.sqlite` through a query-only connection. Each refresh
|
|
144
|
+
reads a committed run projection, immutable events, session rows, and blob
|
|
145
|
+
values. A transaction is either fully visible or not visible, so a client never
|
|
146
|
+
observes half of a state transition.
|
|
@@ -68,7 +68,7 @@ Pi and Telegram implement one channel interface. Workflows address a named audie
|
|
|
68
68
|
### Documentation and display
|
|
69
69
|
|
|
70
70
|
- Add the authoring API to `docs/workflows.md`.
|
|
71
|
-
- Add human decision state to `docs/
|
|
71
|
+
- Add human decision state to `docs/SQLITE_STATE.md`.
|
|
72
72
|
- Add channel setup and recovery instructions.
|
|
73
73
|
- Add a custom gate example and a composed plan approval example.
|
|
74
74
|
- Show pending and accepted choices in TypeScript and Rust viewers.
|
|
@@ -153,7 +153,7 @@ A repeated node performs only missing work. It must not create a duplicate commi
|
|
|
153
153
|
7. Route supported `timed_out` outcomes to the fallback. Preserve success, failure, and cancellation behavior.
|
|
154
154
|
8. Update consequential-node prompts so repeated attempts inspect state and perform only missing work.
|
|
155
155
|
9. Increment the built-in Autoimplement revision from 5 to 6 in `src/builtins/catalog.ts`.
|
|
156
|
-
10. Update `docs/workflows.md` and `docs/
|
|
156
|
+
10. Update `docs/workflows.md` and `docs/SQLITE_STATE.md` when implementation ships so public documentation matches the code.
|
|
157
157
|
|
|
158
158
|
## Alpha cutover
|
|
159
159
|
|
|
@@ -238,7 +238,7 @@ When implementation ships, update:
|
|
|
238
238
|
- `docs/WORKFLOW_COMPOSITION.md` for the shared plan-change workflow;
|
|
239
239
|
- `docs/workflows.md` for the public API and Autoimplement behavior;
|
|
240
240
|
- `docs/MONITOR.md` for repair-plan decisions;
|
|
241
|
-
- `docs/
|
|
241
|
+
- `docs/SQLITE_STATE.md` for request, resolution, continuation, and snapshot fields;
|
|
242
242
|
- Autoimplement and Monitor skill text and examples; and
|
|
243
243
|
- package examples and generated layout fixtures affected by the graph change.
|
|
244
244
|
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
title: Run Sanity Check with Provider Extensions
|
|
3
3
|
author: Onur Solmaz <2453968+osolmaz@users.noreply.github.com>
|
|
4
4
|
date: 2026-08-21
|
|
5
|
-
updated: 2026-08-
|
|
5
|
+
updated: 2026-08-23
|
|
6
|
+
status: implemented
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
# Run Sanity Check with Provider Extensions
|
|
@@ -19,9 +20,9 @@ The workflow keeps only the final bounded answer and safe operational facts. It
|
|
|
19
20
|
|
|
20
21
|
The change is limited to Pi Workflows. It changes the private SDK agent-group runner, Sanity Check composition, extension admission, model runtime construction, tests, and canonical documentation.
|
|
21
22
|
|
|
22
|
-
The workflow
|
|
23
|
+
The workflow uses existing `action`, `agent`, and `compute` nodes and includes the existing `plain-summary` workflow. `src/workflows` and `WorkflowActionContext` remain Pi-independent. The change does not add a workflow primitive, public agent-group export, persisted schema, child workflow run, service, queue, store, transport, Pi core change, or private Pi API.
|
|
23
24
|
|
|
24
|
-
Sanity Check keeps its existing input, review areas, prompts, evidence rules, session counts, strict result validation, verdicts,
|
|
25
|
+
Sanity Check keeps its existing input, review areas, child prompts, evidence rules, session counts, strict result validation, verdicts, and progress schema. After verification, it shows two ordered normal assistant responses: the full detailed report first, then a short plain-language summary.
|
|
25
26
|
|
|
26
27
|
## Child session contract
|
|
27
28
|
|
|
@@ -187,6 +188,14 @@ Updates are deduplicated, throttled, and observational. They cannot change agent
|
|
|
187
188
|
|
|
188
189
|
The Pi widget shows the aggregate plus failed and active children within its ten-line limit. `piw` shows all durable child tracks and samples. Both views use existing progress records. No new persisted field or schema is added.
|
|
189
190
|
|
|
191
|
+
## Ordered assistant reports
|
|
192
|
+
|
|
193
|
+
After strict verification succeeds, an assistant-message `agent` shows the complete bounded report. Its prompt supplies the deterministic report and requires a verbatim response without tools. A mismatch stops before summary generation. This replaces the old final workflow notification.
|
|
194
|
+
|
|
195
|
+
The graph then includes `plain-summary`. The summarizer receives the verified verdict and detailed report, keeps the verdict, and writes one short plain-language response. It uses the plain-summary workflow limits of 2,000 characters and five sentences. The detailed response always settles before the summary starts.
|
|
196
|
+
|
|
197
|
+
Neither response uses `presentationPrompt`, and neither can change the verified verdict. A final compute node returns the original strict `SanityCheckResult` as the workflow result. Both visible responses and their normal assistant receipts use existing Pi session and SQLite records. A detached host parks before these session-visible nodes until the origin Pi session can continue them.
|
|
198
|
+
|
|
190
199
|
## Implementation plan
|
|
191
200
|
|
|
192
201
|
1. Update the Pi SDK development baseline to one compatible 0.84.x release. Keep the Pi coding-agent, Pi AI, and Pi TUI packages aligned and set an honest peer compatibility floor. Do not add Pi Factory or a provider extension as a dependency.
|
|
@@ -198,17 +207,18 @@ The Pi widget shows the aggregate plus failed and active children within its ten
|
|
|
198
207
|
7. Verify exact provider, model, thinking, authentication, admitted extensions, active tools, and tool sources before every prompt.
|
|
199
208
|
8. Complete provider, extension, and session cleanup on every exit path.
|
|
200
209
|
9. Pass the private profile and exact dispatch through Sanity Check without changing its review behavior or progress schema. Remove any `--no-extensions` launch guidance.
|
|
201
|
-
10.
|
|
202
|
-
11.
|
|
203
|
-
12.
|
|
204
|
-
13.
|
|
205
|
-
14.
|
|
210
|
+
10. Add the ordered detailed assistant response and included plain summary, then return the original verified result from a final compute node.
|
|
211
|
+
11. Change the built-in Sanity Check revision from 3 to 4 for the presentation graph change.
|
|
212
|
+
12. Add temporary fixture extensions and full unit, integration, interactive Pi, and standalone host coverage.
|
|
213
|
+
13. Update this plan and `docs/workflows.md` to match the shipped behavior.
|
|
214
|
+
14. Run the complete repository gate and inspect the full public diff.
|
|
215
|
+
15. After mock-provider verification of the provider architecture, run one bounded real acceptance on OpenClaw pull request 126028 with `openai-codex/gpt-5.6-sol` and high thinking. Abort immediately if any child reports another provider or model. Do not modify OpenClaw.
|
|
206
216
|
|
|
207
217
|
## Revision and compatibility
|
|
208
218
|
|
|
209
|
-
Sanity Check
|
|
219
|
+
Sanity Check revision 3 introduced the provider-first child runtime. Revision 4 replaces the final notification with the ordered detailed and plain assistant responses.
|
|
210
220
|
|
|
211
|
-
This is an alpha hard cutover. Do not retain the revision-
|
|
221
|
+
This is an alpha hard cutover. Do not retain the revision-3 notification graph, compatibility runner, migration, alias, dual path, or feature flag. An unfinished revision-3 run must fail with clear cancel-and-restart guidance. Terminal older runs remain readable historical evidence because the persisted schema does not change.
|
|
212
222
|
|
|
213
223
|
## Tests
|
|
214
224
|
|
|
@@ -231,8 +241,10 @@ Unit and integration tests must cover:
|
|
|
231
241
|
- interactive Pi with normal extensions enabled and the local mock provider;
|
|
232
242
|
- standalone `WorkflowHost` through the same private runtime path;
|
|
233
243
|
- no child session files or child workflow runs;
|
|
234
|
-
- built-in revision
|
|
235
|
-
-
|
|
244
|
+
- built-in revision 4 and historical terminal run reading;
|
|
245
|
+
- one full detailed assistant response followed by one short plain-language assistant response;
|
|
246
|
+
- unchanged strict final result after both visible responses;
|
|
247
|
+
- no final notification or root presentation turn.
|
|
236
248
|
|
|
237
249
|
Tests use mock providers and temporary directories. They do not call real models or write outside temporary directories.
|
|
238
250
|
|
|
@@ -251,7 +263,7 @@ After these checks and Pi Reviewer pass, perform the one explicitly authorized b
|
|
|
251
263
|
|
|
252
264
|
The implementation is complete when:
|
|
253
265
|
|
|
254
|
-
- `/workflow sanity-check` discovers built-in revision
|
|
266
|
+
- `/workflow sanity-check` discovers built-in revision 4;
|
|
255
267
|
- the parent Pi process runs with its normal configured extensions;
|
|
256
268
|
- serial mode uses two independent in-memory SDK sessions;
|
|
257
269
|
- parallel mode uses five independent in-memory SDK sessions, with four reviews running concurrently;
|
|
@@ -263,14 +275,16 @@ The implementation is complete when:
|
|
|
263
275
|
- the workflow keeps only bounded final answers and safe operational facts;
|
|
264
276
|
- child prompts, reasoning, tool payloads, histories, credentials, and extension state do not enter run bundles or progress updates;
|
|
265
277
|
- provider, extension, and session cleanup completes on every exit path;
|
|
266
|
-
- Sanity Check review behavior, strict validation, verdicts,
|
|
267
|
-
-
|
|
278
|
+
- Sanity Check review behavior, strict validation, verdicts, and progress remain unchanged;
|
|
279
|
+
- the full detailed assistant response appears before the short plain-language summary;
|
|
280
|
+
- the final workflow result remains the strict verified result;
|
|
281
|
+
- interactive and headless runs use the same private SDK path, while session-visible reports wait for the origin Pi session;
|
|
268
282
|
- all required checks pass with coverage margin;
|
|
269
283
|
- the bounded acceptance run on OpenClaw pull request 126028 reports GPT-5.6 Sol for every child and completes with a strict verdict without modifying OpenClaw.
|
|
270
284
|
|
|
271
285
|
## Contract impact
|
|
272
286
|
|
|
273
|
-
- **Origin session:** The normal workflow start record and one
|
|
287
|
+
- **Origin session:** The normal workflow start record, one detailed assistant response, and one short plain-language assistant response.
|
|
274
288
|
- **Parent extensions:** The parent Pi process loads its normal configured extensions.
|
|
275
289
|
- **Child extensions:** Only the exact provider owner and explicit private behavior paths are admitted.
|
|
276
290
|
- **Child sessions:** Independent in-memory contexts and complete per-child runtimes in the same Node process. No child session file or child workflow run.
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Make Monitor finish authorized goals
|
|
3
|
+
author: Onur Solmaz <2453968+osolmaz@users.noreply.github.com>
|
|
4
|
+
date: 2026-08-22
|
|
5
|
+
status: implemented
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Goal-finishing Monitor plan
|
|
9
|
+
|
|
10
|
+
## Goal
|
|
11
|
+
|
|
12
|
+
Change the built-in Monitor workflow so it finishes the user's authorized goal instead of only checking it.
|
|
13
|
+
|
|
14
|
+
A request such as "resume this work and monitor it" must resume the work, prove that useful work is moving, and then check it on schedule. Monitor continues until the full goal is complete or cannot continue safely.
|
|
15
|
+
|
|
16
|
+
The canonical behavior is specified in [Built-in monitor](../MONITOR.md).
|
|
17
|
+
|
|
18
|
+
## Boundaries
|
|
19
|
+
|
|
20
|
+
The implementation must:
|
|
21
|
+
|
|
22
|
+
- preserve the full goal and authority from `task`, `stopWhen`, repository instructions, and the conversation
|
|
23
|
+
- keep the first observation read-only
|
|
24
|
+
- use normal Pi tools for observations and actions
|
|
25
|
+
- keep only `task`, `stopWhen`, `everyMinutes`, and `maxChecks` as public inputs
|
|
26
|
+
- reject unknown input fields before run creation
|
|
27
|
+
- keep target processes and systems independent of Pi Workflows
|
|
28
|
+
- use the existing plan-change and Autoimplement workflows for real repairs
|
|
29
|
+
- keep normal starts, resumes, and restarts direct and small
|
|
30
|
+
- stop before an action exceeds authority, cost, provider, runtime, credential, or safety limits
|
|
31
|
+
- stop paid workers before repairing a shared code or data defect
|
|
32
|
+
- avoid compatibility aliases or shims for removed alpha inputs and routes
|
|
33
|
+
|
|
34
|
+
The work may change the Pi Workflows source, Monitor tests, the Monitor skill, and relevant documentation. It may run local checks and the non-destructive real-Pi end-to-end suite. It may commit and push the verified change directly to `origin/main`.
|
|
35
|
+
|
|
36
|
+
The work must not:
|
|
37
|
+
|
|
38
|
+
- add a target-specific Pi API, transport, schema, store, file, command, service, or dependency
|
|
39
|
+
- copy the planning, documentation, implementation, review, or delivery logic from existing workflows
|
|
40
|
+
- open a pull request
|
|
41
|
+
- deploy, publish an npm package, or create a release
|
|
42
|
+
- change OnurPi or another repository
|
|
43
|
+
|
|
44
|
+
## Selected design
|
|
45
|
+
|
|
46
|
+
### Strict input
|
|
47
|
+
|
|
48
|
+
Replace the Monitor input parser with strict validation for:
|
|
49
|
+
|
|
50
|
+
- `task`
|
|
51
|
+
- `stopWhen`
|
|
52
|
+
- `everyMinutes`
|
|
53
|
+
- `maxChecks`
|
|
54
|
+
|
|
55
|
+
Keep the full goal, scope, authority, constraints, and recovery contract in `task` instead of adding process-specific or provider-specific fields. Reject all other fields with a direct unsupported-field error.
|
|
56
|
+
|
|
57
|
+
### Read-only observation
|
|
58
|
+
|
|
59
|
+
Replace the current check result with a read-only observation result. Its route is one of:
|
|
60
|
+
|
|
61
|
+
- `wait`: Work is moving, or an external event must finish.
|
|
62
|
+
- `act`: The goal is incomplete and a safe authorized action is available.
|
|
63
|
+
- `stop`: The goal is complete or cannot continue safely.
|
|
64
|
+
|
|
65
|
+
The observation records goal state and target work state separately. It includes factual evidence, the safe actions already authorized by the user, optional progress, a stable target-state ID, and a concise report.
|
|
66
|
+
|
|
67
|
+
An `act` result also includes:
|
|
68
|
+
|
|
69
|
+
- action kind: `advance`, `recover`, or `repair`
|
|
70
|
+
- what is incomplete
|
|
71
|
+
- evidence that proves it
|
|
72
|
+
- the exact next action
|
|
73
|
+
- why existing authority covers it
|
|
74
|
+
- files, systems, and resources it may change
|
|
75
|
+
- how to verify it
|
|
76
|
+
- a stable failure ID
|
|
77
|
+
|
|
78
|
+
The observation cannot grant new authority.
|
|
79
|
+
|
|
80
|
+
### Direct action step
|
|
81
|
+
|
|
82
|
+
Add one mutation-capable agent step that uses normal Pi tools. It performs only the action stated by the observation.
|
|
83
|
+
|
|
84
|
+
Route `advance` and `recover` directly to this step. These actions cover normal starts, resumes, restarts, next commands, launch-file refreshes, safe retries, and verified checkpoint continuation. They do not run planning or documentation workflows.
|
|
85
|
+
|
|
86
|
+
The step returns a factual success, failure, or blocked result with verification evidence.
|
|
87
|
+
|
|
88
|
+
### Existing repair path
|
|
89
|
+
|
|
90
|
+
Route `repair` through the existing shared plan-change workflow and Autoimplement workflow. Pass the observed defect, evidence, repository, authority, constraints, and delivery boundaries into those workflows.
|
|
91
|
+
|
|
92
|
+
Do not copy or replace their design, documentation, approval, implementation, test, review, or delivery behavior.
|
|
93
|
+
|
|
94
|
+
Stop affected paid workers at safe boundaries before repairing a shared code or data defect.
|
|
95
|
+
|
|
96
|
+
### Immediate verification
|
|
97
|
+
|
|
98
|
+
Run a new read-only observation immediately after every direct action or completed repair. Do not schedule or sleep first.
|
|
99
|
+
|
|
100
|
+
The immediate observation must establish one of these states:
|
|
101
|
+
|
|
102
|
+
- the goal is complete
|
|
103
|
+
- useful work is moving
|
|
104
|
+
- the action failed in a new way
|
|
105
|
+
- the same failure returned
|
|
106
|
+
- a blocker exists
|
|
107
|
+
|
|
108
|
+
Only the `wait` route can publish the next schedule and enter the timer.
|
|
109
|
+
|
|
110
|
+
### Repeated failure guard
|
|
111
|
+
|
|
112
|
+
Store stable failure and target-state IDs in accepted outputs. After one repair completes, compare the next observation with prior repaired failures.
|
|
113
|
+
|
|
114
|
+
If the same failure ID and target-state ID return, stop. Do not run the same repair cycle again.
|
|
115
|
+
|
|
116
|
+
A failed direct action can produce a new `recover` action when the new observation proves that recovery is authorized. All loops remain bounded by accepted observations and the Monitor safety limit.
|
|
117
|
+
|
|
118
|
+
### Reports
|
|
119
|
+
|
|
120
|
+
Format every observation report with separate facts for:
|
|
121
|
+
|
|
122
|
+
- Monitor state
|
|
123
|
+
- goal state
|
|
124
|
+
- target work state
|
|
125
|
+
- factual progress when available
|
|
126
|
+
- last action or next action
|
|
127
|
+
- next check when scheduled
|
|
128
|
+
|
|
129
|
+
Never report target work as running only because Monitor is active.
|
|
130
|
+
|
|
131
|
+
### Workflow graph
|
|
132
|
+
|
|
133
|
+
```text
|
|
134
|
+
observe
|
|
135
|
+
├─ stop → finish
|
|
136
|
+
├─ wait → report → schedule → sleep → observe
|
|
137
|
+
└─ act
|
|
138
|
+
├─ advance → direct action → observe immediately
|
|
139
|
+
├─ recover → direct action → observe immediately
|
|
140
|
+
└─ repair → plan change → Autoimplement → observe immediately
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The timer belongs only on the `wait` path.
|
|
144
|
+
|
|
145
|
+
## Implementation steps
|
|
146
|
+
|
|
147
|
+
1. Replace Monitor's public input parser with strict validation for `task`, `stopWhen`, `everyMinutes`, and `maxChecks` only.
|
|
148
|
+
2. Replace `continue`, `repair`, and `stop` observation routes with `wait`, `act`, and `stop`.
|
|
149
|
+
3. Add structured goal state, work state, evidence, progress, stable IDs, and complete action details to observation output validation.
|
|
150
|
+
4. Add the direct mutation-capable action step for `advance` and `recover`.
|
|
151
|
+
5. Keep the existing shared plan-change and Autoimplement includes for `repair`.
|
|
152
|
+
6. Route every action result directly back to read-only observation.
|
|
153
|
+
7. Route only `wait` through report, schedule, sleep, and the next observation.
|
|
154
|
+
8. Add the repeated repaired-failure guard using stable failure and target-state IDs.
|
|
155
|
+
9. Update report formatting so Monitor, goal, and target work states remain separate.
|
|
156
|
+
10. Update the Monitor skill and workflow documentation for the new graph and simple input contract.
|
|
157
|
+
11. Replace and extend Monitor tests for the new behavior.
|
|
158
|
+
12. Run all required checks, review the diff, commit, and push directly to `origin/main`.
|
|
159
|
+
|
|
160
|
+
## Tests
|
|
161
|
+
|
|
162
|
+
Add tests for these cases:
|
|
163
|
+
|
|
164
|
+
1. The goal is already complete.
|
|
165
|
+
2. Work is active, so Monitor waits.
|
|
166
|
+
3. Work is idle, so Monitor starts it.
|
|
167
|
+
4. Saved work exists, so Monitor resumes it.
|
|
168
|
+
5. An action succeeds, so Monitor observes again immediately.
|
|
169
|
+
6. An action fails once, then recovery succeeds.
|
|
170
|
+
7. The same repaired failure returns, so Monitor stops.
|
|
171
|
+
8. An action is outside authority, so Monitor stops.
|
|
172
|
+
9. A paid action exceeds the limit, so Monitor does not launch it.
|
|
173
|
+
10. Monitor is active while the target is idle.
|
|
174
|
+
11. The target completes between timed observations.
|
|
175
|
+
12. Unknown input fields fail clearly before run creation.
|
|
176
|
+
13. A normal restart does not trigger planning or documentation.
|
|
177
|
+
14. A real code defect uses the existing repair path.
|
|
178
|
+
15. No target-specific monitoring API is required.
|
|
179
|
+
|
|
180
|
+
Keep applicable existing tests for progress, reports, notifications, schedule updates, safety limits, cancellation, interruption, resume, and the widget.
|
|
181
|
+
|
|
182
|
+
## Verification
|
|
183
|
+
|
|
184
|
+
Run:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
npm run check
|
|
188
|
+
npm run test:e2e
|
|
189
|
+
npx slophammer-ts@latest dry .
|
|
190
|
+
npx slophammer-ts@latest check . --only ts.dependency-boundaries-required
|
|
191
|
+
git diff --check
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Review the full diff and fix each valid issue before delivery.
|
|
195
|
+
|
|
196
|
+
## Delivery
|
|
197
|
+
|
|
198
|
+
Commit the verified change with a Conventional Commit message and push it directly to `origin/main` without a pull request.
|
|
199
|
+
|
|
200
|
+
Do not deploy, publish, or create a release.
|