@osolmaz/pi-workflows 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -110
- package/dist/builtins/autoimplement.workflow.js +3 -1
- package/dist/builtins/autoimplement.workflow.js.map +1 -1
- package/dist/builtins/change-verification.workflow.js +7 -2
- package/dist/builtins/change-verification.workflow.js.map +1 -1
- package/dist/builtins/metadata.d.ts +22 -0
- package/dist/builtins/metadata.js +10 -0
- package/dist/builtins/metadata.js.map +1 -0
- package/dist/builtins/monitor.workflow.js +4 -1
- package/dist/builtins/monitor.workflow.js.map +1 -1
- package/dist/builtins/sanity-check.workflow.js +4 -1
- package/dist/builtins/sanity-check.workflow.js.map +1 -1
- package/dist/builtins/workspace-preparation.workflow.js +3 -1
- package/dist/builtins/workspace-preparation.workflow.js.map +1 -1
- package/dist/controllers/index.d.ts +0 -1
- package/dist/controllers/index.js +0 -1
- package/dist/controllers/index.js.map +1 -1
- package/dist/controllers/sqlite.d.ts +51 -0
- package/dist/controllers/sqlite.js +433 -57
- package/dist/controllers/sqlite.js.map +1 -1
- package/dist/controllers/store.d.ts +1 -0
- package/dist/extension/controller-command.d.ts +22 -0
- package/dist/extension/controller-command.js +32 -0
- package/dist/extension/controller-command.js.map +1 -0
- package/dist/extension/index.d.ts +2 -9
- package/dist/extension/index.js +876 -3447
- package/dist/extension/index.js.map +1 -1
- package/dist/extension/message-card.d.ts +13 -0
- package/dist/extension/message-card.js +46 -0
- package/dist/extension/message-card.js.map +1 -0
- package/dist/extension/step-message.d.ts +5 -6
- package/dist/extension/step-message.js +41 -52
- package/dist/extension/step-message.js.map +1 -1
- package/dist/host/child-worker-supervisor.d.ts +50 -0
- package/dist/host/child-worker-supervisor.js +159 -0
- package/dist/host/child-worker-supervisor.js.map +1 -0
- package/dist/host/client.d.ts +48 -0
- package/dist/host/client.js +216 -0
- package/dist/host/client.js.map +1 -0
- package/dist/host/controller-worker-entry.d.ts +2 -0
- package/dist/host/controller-worker-entry.js +244 -0
- package/dist/host/controller-worker-entry.js.map +1 -0
- package/dist/host/controller-worker-protocol.d.ts +36 -0
- package/dist/host/controller-worker-protocol.js +49 -0
- package/dist/host/controller-worker-protocol.js.map +1 -0
- package/dist/host/controller-worker-supervisor.d.ts +21 -0
- package/dist/host/controller-worker-supervisor.js +54 -0
- package/dist/host/controller-worker-supervisor.js.map +1 -0
- package/dist/host/host-entry.d.ts +2 -0
- package/dist/host/host-entry.js +23 -0
- package/dist/host/host-entry.js.map +1 -0
- package/dist/host/processes.d.ts +17 -12
- package/dist/host/processes.js +154 -50
- package/dist/host/processes.js.map +1 -1
- package/dist/host/protocol.d.ts +38 -0
- package/dist/host/protocol.js +156 -0
- package/dist/host/protocol.js.map +1 -0
- package/dist/host/resolver-entry.d.ts +49 -0
- package/dist/host/resolver-entry.js +149 -0
- package/dist/host/resolver-entry.js.map +1 -0
- package/dist/host/rpc-executor.d.ts +14 -3
- package/dist/host/rpc-executor.js +63 -30
- package/dist/host/rpc-executor.js.map +1 -1
- package/dist/host/runner.d.ts +95 -29
- package/dist/host/runner.js +2311 -348
- package/dist/host/runner.js.map +1 -1
- package/dist/host/state.d.ts +174 -0
- package/dist/host/state.js +689 -0
- package/dist/host/state.js.map +1 -0
- package/dist/host/worker-entry.d.ts +10 -0
- package/dist/host/worker-entry.js +446 -0
- package/dist/host/worker-entry.js.map +1 -0
- package/dist/host/worker-protocol.d.ts +31 -0
- package/dist/host/worker-protocol.js +122 -0
- package/dist/host/worker-protocol.js.map +1 -0
- package/dist/host/worker-store.d.ts +80 -0
- package/dist/host/worker-store.js +91 -0
- package/dist/host/worker-store.js.map +1 -0
- package/dist/host/worker-supervisor.d.ts +22 -0
- package/dist/host/worker-supervisor.js +54 -0
- package/dist/host/worker-supervisor.js.map +1 -0
- package/dist/render/canvas.d.ts +2 -1
- package/dist/render/canvas.js +40 -15
- package/dist/render/canvas.js.map +1 -1
- package/dist/render/graph-render.d.ts +7 -3
- package/dist/render/graph-render.js +125 -74
- package/dist/render/graph-render.js.map +1 -1
- package/dist/state/database.js +3 -1
- package/dist/state/database.js.map +1 -1
- package/dist/state/index.d.ts +1 -0
- package/dist/state/index.js +1 -0
- package/dist/state/index.js.map +1 -1
- package/dist/state/schema.d.ts +1 -1
- package/dist/state/schema.js +171 -3
- package/dist/state/schema.js.map +1 -1
- package/dist/state/viewer.d.ts +46 -0
- package/dist/state/viewer.js +249 -0
- package/dist/state/viewer.js.map +1 -0
- package/dist/viewer/cli.d.ts +1 -1
- package/dist/viewer/cli.js +47 -18
- package/dist/viewer/cli.js.map +1 -1
- package/dist/workflows/composition.js +25 -2
- package/dist/workflows/composition.js.map +1 -1
- package/dist/workflows/definition.d.ts +3 -1
- package/dist/workflows/definition.js +25 -0
- package/dist/workflows/definition.js.map +1 -1
- package/dist/workflows/engine.d.ts +1 -0
- package/dist/workflows/engine.js +157 -42
- package/dist/workflows/engine.js.map +1 -1
- package/dist/workflows/errors.d.ts +3 -1
- package/dist/workflows/errors.js +4 -7
- package/dist/workflows/errors.js.map +1 -1
- package/dist/workflows/human-decision.d.ts +3 -0
- package/dist/workflows/human-decision.js +31 -0
- package/dist/workflows/human-decision.js.map +1 -1
- package/dist/workflows/index.d.ts +1 -1
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/schema.js +17 -6
- package/dist/workflows/schema.js.map +1 -1
- package/dist/{viewer → workflows}/session-reducer.d.ts +3 -1
- package/dist/{viewer → workflows}/session-reducer.js +4 -0
- package/dist/workflows/session-reducer.js.map +1 -0
- package/dist/workflows/store.d.ts +87 -1
- package/dist/workflows/store.js +892 -93
- package/dist/workflows/store.js.map +1 -1
- package/dist/workflows/tool-input.d.ts +0 -26
- package/dist/workflows/tool-input.js +2 -50
- package/dist/workflows/tool-input.js.map +1 -1
- package/dist/workflows/types.d.ts +36 -4
- package/docs/2026-08-30-out-of-process-workflow-host-plan.md +353 -0
- package/docs/CONTROLLERS.md +11 -11
- package/docs/DEFERRED_TURNS.md +23 -2
- package/docs/SQLITE_STATE.md +41 -31
- package/docs/WORKFLOW_HOST.md +452 -0
- package/docs/development.md +46 -30
- package/docs/live-replay-protocol.md +129 -100
- package/docs/plans/2026-08-27-workflow-terminal-restart-plan.md +42 -0
- package/docs/plans/2026-08-28-piw-incremental-viewer-plan.md +293 -0
- package/docs/plans/piw-viewer-experience-implementation-plan.md +11 -1
- package/docs/plans/tui-viewer-implementation-plan.md +5 -0
- package/docs/tui-viewer.md +18 -3
- package/docs/workflows.md +162 -210
- package/examples/workflows/command-batch.workflow.ts +2 -0
- package/examples/workflows/shell.workflow.ts +2 -1
- package/herdr-plugin.toml +1 -1
- package/package.json +1 -1
- package/src/builtins/autoimplement.workflow.ts +3 -0
- package/src/builtins/change-verification.workflow.ts +7 -2
- package/src/builtins/metadata.ts +9 -0
- package/src/builtins/monitor.workflow.ts +4 -0
- package/src/builtins/sanity-check.workflow.ts +4 -0
- package/src/builtins/workspace-preparation.workflow.ts +3 -1
- package/src/controllers/index.ts +0 -5
- package/src/controllers/sqlite.ts +709 -76
- package/src/controllers/store.ts +1 -0
- package/src/extension/controller-command.ts +45 -0
- package/src/extension/index.ts +944 -4163
- package/src/extension/message-card.ts +61 -0
- package/src/extension/step-message.ts +58 -63
- package/src/host/child-worker-supervisor.ts +183 -0
- package/src/host/client.ts +293 -0
- package/src/host/controller-worker-entry.ts +311 -0
- package/src/host/controller-worker-protocol.ts +104 -0
- package/src/host/controller-worker-supervisor.ts +79 -0
- package/src/host/host-entry.ts +23 -0
- package/src/host/processes.ts +171 -54
- package/src/host/protocol.ts +196 -0
- package/src/host/resolver-entry.ts +241 -0
- package/src/host/rpc-executor.ts +76 -34
- package/src/host/runner.ts +2813 -422
- package/src/host/state.ts +1160 -0
- package/src/host/worker-entry.ts +533 -0
- package/src/host/worker-protocol.ts +165 -0
- package/src/host/worker-store.ts +229 -0
- package/src/host/worker-supervisor.ts +74 -0
- package/src/render/canvas.ts +44 -10
- package/src/render/graph-render.ts +145 -90
- package/src/state/database.ts +2 -1
- package/src/state/index.ts +14 -0
- package/src/state/schema.ts +171 -3
- package/src/state/viewer.ts +356 -0
- package/src/viewer/cli.ts +49 -17
- package/src/workflows/composition.ts +36 -2
- package/src/workflows/definition.ts +32 -0
- package/src/workflows/engine.ts +157 -54
- package/src/workflows/errors.ts +11 -2
- package/src/workflows/human-decision.ts +49 -0
- package/src/workflows/index.ts +2 -0
- package/src/workflows/schema.ts +19 -6
- package/src/{viewer → workflows}/session-reducer.ts +11 -1
- package/src/workflows/store.ts +1316 -108
- package/src/workflows/tool-input.ts +3 -69
- package/src/workflows/types.ts +32 -4
- package/dist/controllers/workflow-engine-scheduler.d.ts +0 -29
- package/dist/controllers/workflow-engine-scheduler.js +0 -175
- package/dist/controllers/workflow-engine-scheduler.js.map +0 -1
- package/dist/extension/controller-host.d.ts +0 -48
- package/dist/extension/controller-host.js +0 -110
- package/dist/extension/controller-host.js.map +0 -1
- package/dist/extension/deferred-turn-coordinator.d.ts +0 -32
- package/dist/extension/deferred-turn-coordinator.js +0 -143
- package/dist/extension/deferred-turn-coordinator.js.map +0 -1
- package/dist/extension/deferred-turn.d.ts +0 -44
- package/dist/extension/deferred-turn.js +0 -110
- package/dist/extension/deferred-turn.js.map +0 -1
- package/dist/extension/executor.d.ts +0 -86
- package/dist/extension/executor.js +0 -311
- package/dist/extension/executor.js.map +0 -1
- package/dist/extension/follow-up-coordinator.d.ts +0 -27
- package/dist/extension/follow-up-coordinator.js +0 -131
- package/dist/extension/follow-up-coordinator.js.map +0 -1
- package/dist/extension/recorder.d.ts +0 -84
- package/dist/extension/recorder.js +0 -528
- package/dist/extension/recorder.js.map +0 -1
- package/dist/extension/restart-policy.d.ts +0 -38
- package/dist/extension/restart-policy.js +0 -116
- package/dist/extension/restart-policy.js.map +0 -1
- package/dist/extension/session-events.d.ts +0 -133
- package/dist/extension/session-events.js +0 -61
- package/dist/extension/session-events.js.map +0 -1
- package/dist/extension/terminal-decision.d.ts +0 -51
- package/dist/extension/terminal-decision.js +0 -110
- package/dist/extension/terminal-decision.js.map +0 -1
- package/dist/viewer/session-reducer.js.map +0 -1
- package/src/controllers/workflow-engine-scheduler.ts +0 -246
- package/src/extension/controller-host.ts +0 -167
- package/src/extension/deferred-turn-coordinator.ts +0 -171
- package/src/extension/deferred-turn.ts +0 -166
- package/src/extension/executor.ts +0 -411
- package/src/extension/follow-up-coordinator.ts +0 -151
- package/src/extension/recorder.ts +0 -655
- package/src/extension/restart-policy.ts +0 -163
- package/src/extension/session-events.ts +0 -121
- package/src/extension/terminal-decision.ts +0 -172
package/README.md
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
pi-workflows is a workflow extension for the [Pi coding agent](https://pi.dev).
|
|
8
|
-
It lets you define multi-step agent workflows as TypeScript graphs
|
|
9
|
-
them at any point in a Pi conversation with `/workflow
|
|
10
|
-
|
|
8
|
+
It lets you define multi-step agent workflows as TypeScript graphs and trigger
|
|
9
|
+
them at any point in a Pi conversation with `/workflow`. A standalone terminal
|
|
10
|
+
viewer shows each run live.
|
|
11
11
|
|
|
12
12
|
Agent steps run inside your current Pi conversation, so the model keeps
|
|
13
13
|
everything it already knows from the discussion. A submitted agent step
|
|
@@ -41,7 +41,7 @@ The Pi package includes the extension and six optional skills:
|
|
|
41
41
|
- `autoplan` selects the best practical solution and writes an implementation plan.
|
|
42
42
|
- `autodoc` records an existing plan in canonical documentation.
|
|
43
43
|
- `autoimplement` implements an existing plan and verifies the result.
|
|
44
|
-
- `sanity-check` reviews whether a contribution is necessary, focused
|
|
44
|
+
- `sanity-check` reviews whether a contribution is necessary, and whether it is focused and well supported.
|
|
45
45
|
|
|
46
46
|
Pi discovers these skills when it loads the package. Use `pi config` to disable
|
|
47
47
|
the extension, all bundled skills, or one skill independently. The equivalent
|
|
@@ -96,7 +96,6 @@ import { agent, defineWorkflow } from "@osolmaz/pi-workflows";
|
|
|
96
96
|
|
|
97
97
|
export default defineWorkflow({
|
|
98
98
|
name: "echo",
|
|
99
|
-
presentationPrompt: "Give the user the concise reply from the workflow result.",
|
|
100
99
|
startAt: "reply",
|
|
101
100
|
nodes: {
|
|
102
101
|
reply: agent({
|
|
@@ -115,32 +114,20 @@ Then, from any Pi conversation:
|
|
|
115
114
|
```
|
|
116
115
|
|
|
117
116
|
`/workflow` with no arguments lists discovered workflows. `/workflow pause`
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
`/workflow
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
`list`, `pause`, `resume`, and `status` are reserved and rejected as workflow
|
|
128
|
-
names.
|
|
117
|
+
stops the worker and parks the run at its last durable boundary. `/workflow
|
|
118
|
+
resume` starts a new worker generation from that boundary. `/workflow cancel`
|
|
119
|
+
stops the active run; `/workflow cancel <run-id>` can also cancel a named stale
|
|
120
|
+
run when no live owner holds it. A checkpoint waits until `/workflow answer
|
|
121
|
+
<json-or-text>` supplies its input.
|
|
122
|
+
|
|
123
|
+
Trailing text becomes `{ task: "..." }`, and `--input-json {"key": "value"}`
|
|
124
|
+
passes arbitrary input. The names `answer`, `cancel`, `list`, `pause`, `resume`,
|
|
125
|
+
and `status` are reserved and rejected as workflow names.
|
|
129
126
|
|
|
130
127
|
A workflow can also expose [settings that change during a
|
|
131
128
|
run](docs/2026-08-25-workflow-settings.md) and queue [normal follow-up work
|
|
132
129
|
after completion](docs/2026-08-25-workflow-follow-ups.md).
|
|
133
130
|
|
|
134
|
-
While a run is on screen, the footer status bar shows a compact
|
|
135
|
-
`wf <name> [status] <node>` indicator alongside the widget.
|
|
136
|
-
|
|
137
|
-
`presentationPrompt` is optional. After each top-level interactive run ends,
|
|
138
|
-
pi-workflows gives the model one normal terminal decision turn with the exact
|
|
139
|
-
stored input, result, terminal reason, and restart history. A presentation
|
|
140
|
-
prompt adds instructions for the human-readable response. Presentation and
|
|
141
|
-
factual fallback share one durable turn intent, so only one decision turn is
|
|
142
|
-
sent. Waiting checkpoints and controller child runs do not create this turn.
|
|
143
|
-
|
|
144
131
|
Use `expectedOutput: assistantMessage()` when a normal assistant response must
|
|
145
132
|
be a node inside the graph rather than a presentation after the run. Its exact
|
|
146
133
|
visible text becomes the node output after the turn settles. The helper has no
|
|
@@ -183,26 +170,18 @@ trace, pause state, and cancellation state. See
|
|
|
183
170
|
|
|
184
171
|
## Agent-managed workflows
|
|
185
172
|
|
|
186
|
-
The model can use the
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
`submit`
|
|
191
|
-
response instead.
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
A model-started workflow is saved before the tool reports it as
|
|
195
|
-
returned run ID works with `workflow status` and `workflow cancel`
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
Monitor run, or other workflow start. Activation waits for that turn to settle.
|
|
199
|
-
If activation fails, pi-workflows saves the failure and sends one decision turn
|
|
200
|
-
so the model can correct the cause safely.
|
|
201
|
-
|
|
202
|
-
Restart is never automatic. Explicit cancellation is not restartable through
|
|
203
|
-
the shortcut. A chain permits at most three restarts and rejects a repeated
|
|
204
|
-
terminal fingerprint. Pi Workflows uses Pi's current conversation for the
|
|
205
|
-
continuation decision and does not capture or persist an original user message.
|
|
173
|
+
The model can use the `workflow` tool to list, start, inspect, pause, resume,
|
|
174
|
+
cancel, and answer ordinary checkpoints. It cannot answer a protected human
|
|
175
|
+
decision. A person must answer that request through `/workflow answer` in the
|
|
176
|
+
origin Pi session. The model uses `update` for durable progress from the current
|
|
177
|
+
attempt and `submit` for structured step output. Assistant-message steps require
|
|
178
|
+
a normal visible assistant response instead. The extension sends all lifecycle
|
|
179
|
+
mutations to the host and reports success only after the host commits them.
|
|
180
|
+
|
|
181
|
+
A model-started workflow is saved before the tool reports it as accepted, so
|
|
182
|
+
the returned run ID works with `workflow status` and `workflow cancel`
|
|
183
|
+
immediately. Duplicate host commands and step submissions adopt their stored
|
|
184
|
+
receipts instead of repeating a committed transition.
|
|
206
185
|
|
|
207
186
|
pi-workflows includes a [monitor](docs/MONITOR.md) workflow for plain-language
|
|
208
187
|
requests such as:
|
|
@@ -221,14 +200,15 @@ target again after repair and stops when the same issue and target evidence
|
|
|
221
200
|
return without progress. Project and global workflows can replace the built-in
|
|
222
201
|
`monitor` by using the same file name.
|
|
223
202
|
|
|
224
|
-
A monitor occupies the session's one active workflow slot. If its
|
|
225
|
-
stops during the shell wait, the run parks and repeats that wait
|
|
226
|
-
|
|
203
|
+
A monitor occupies the session's one active workflow slot. If its worker or the
|
|
204
|
+
host stops during the shell wait, the run parks and repeats that idempotent wait
|
|
205
|
+
node when the host resumes it.
|
|
227
206
|
|
|
228
|
-
Because
|
|
229
|
-
discussion first and then trigger a workflow that builds on it. The
|
|
230
|
-
`autoplan` example does exactly that. It frames the problem and scope,
|
|
231
|
-
an elegant production-ready solution
|
|
207
|
+
Because interactive agent steps run in the origin conversation, you can have a
|
|
208
|
+
long discussion first and then trigger a workflow that builds on it. The
|
|
209
|
+
`autoplan` example does exactly that. It frames the problem and scope, then
|
|
210
|
+
devises an elegant production-ready solution and compares it with the holy
|
|
211
|
+
grail. It
|
|
232
212
|
then selects the best practical in-scope solution without asking the user to
|
|
233
213
|
resolve the gap. The ideal can win when it is feasible, but work outside the
|
|
234
214
|
current authority cannot block a valid practical solution. The workflow keeps
|
|
@@ -248,48 +228,18 @@ pi-workflows runs # plain list of recent runs
|
|
|
248
228
|
pi-workflows view --once # print a snapshot and exit (good for scripts)
|
|
249
229
|
```
|
|
250
230
|
|
|
251
|
-
The run detail view draws the workflow as a boxed graph
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
hierarchical labels such as `implementation › redesign › plan`, and each card
|
|
255
|
-
shows its step name plus node type, status, attempts, and timing in compact
|
|
256
|
-
symbol rows. Node types have distinct semantic colors, active cards use a
|
|
257
|
-
heavy border, branches carry their case labels, the taken path is highlighted,
|
|
258
|
-
and loops route through a gutter on the right back into their target from
|
|
259
|
-
above. `←/→` scrubs backwards and forwards through the recorded steps and
|
|
260
|
-
re-derives every node's status as of that step, with the selected step's full
|
|
261
|
-
output shown below. Scrubbing to the end snaps back to following the run live.
|
|
231
|
+
The run detail view draws the workflow as a boxed graph. `←/→` replays the
|
|
232
|
+
recorded steps with each step's full output, and scrubbing to the end snaps
|
|
233
|
+
back to following the run live.
|
|
262
234
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
267
|
-
┃ ● agent ◐ running ┃
|
|
268
|
-
┃ ↻ 2 ◷ 12s ┃
|
|
269
|
-
┃ ◇ clean ┃
|
|
270
|
-
┃ ◇ issues_found ┃
|
|
271
|
-
┃ … reviewing implementation ┃
|
|
272
|
-
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
The Rust `piw` viewer under `tui/` adds a Catppuccin interface, selectable
|
|
276
|
-
themes, centered active-node following, draggable browser and inspector sizes,
|
|
277
|
-
detailed trace and conversation inspection, temporal replay, and reconnecting
|
|
278
|
-
remote viewing. Cards have one fixed graph-wide size, so streaming, selection,
|
|
279
|
-
timer ticks, and replay never move nodes or edges. Live conversation capture
|
|
280
|
-
shows text, thinking, tool calls, and tool execution as they happen, then
|
|
281
|
-
reconciles settled messages to verbatim Pi entries. See
|
|
235
|
+
The Rust `piw` viewer under `tui/` is the full interactive terminal UI, with
|
|
236
|
+
selectable themes, detailed trace and conversation inspection, temporal
|
|
237
|
+
replay, and reconnecting remote viewing. See
|
|
282
238
|
[the piw guide](docs/tui-viewer.md).
|
|
283
239
|
|
|
284
|
-
Inside Pi, a compact widget above the editor shows one line per workflow node
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
`◆` checkpoint. Repeated visits, runtime details, and timing appear on the same
|
|
288
|
-
line when they apply. Pi's current theme highlights the full active-node line,
|
|
289
|
-
while status glyphs keep every state readable without color. Long workflows are
|
|
290
|
-
windowed around the active node. Scroll the list with `shift+↑` / `shift+↓`.
|
|
291
|
-
It snaps back to following the active node whenever the workflow advances a
|
|
292
|
-
step. Use `piw` when you need the full boxed graph and its edges.
|
|
240
|
+
Inside Pi, a compact widget above the editor shows one line per workflow node,
|
|
241
|
+
with glyphs for node status and type. Scroll it with `shift+↑` / `shift+↓`.
|
|
242
|
+
Use `piw` when you need the full boxed graph and its edges.
|
|
293
243
|
|
|
294
244
|
## Herdr integration
|
|
295
245
|
|
|
@@ -300,10 +250,8 @@ pi-workflows also ships as a [Herdr](https://herdr.dev) plugin. After installing
|
|
|
300
250
|
pi-workflows herdr sync
|
|
301
251
|
```
|
|
302
252
|
|
|
303
|
-
Run the same command after a pi-workflows update.
|
|
304
|
-
|
|
305
|
-
`pi-workflows herdr setup` remains an alias for existing installations. Use
|
|
306
|
-
`--json` for versioned machine-readable output.
|
|
253
|
+
Run the same command after a pi-workflows update. `pi-workflows herdr setup`
|
|
254
|
+
remains an alias for existing installations.
|
|
307
255
|
|
|
308
256
|
When Pi runs inside Herdr, the workflow widget shows a `Ctrl+Shift+R piw`
|
|
309
257
|
shortcut. The shortcut opens the exact SQLite run state and lets you choose a
|
|
@@ -320,16 +268,16 @@ is also available through the [Herdr plugin marketplace](https://herdr.dev/plugi
|
|
|
320
268
|
A workflow is a graph of named nodes with exactly one entry point. Each node
|
|
321
269
|
finishes with an output, and edges decide what runs next.
|
|
322
270
|
|
|
323
|
-
An `agent` node sends a prompt into the Pi conversation as a compact
|
|
271
|
+
An `agent` node sends a prompt into the origin Pi conversation as a compact
|
|
324
272
|
[workflow step message](docs/WORKFLOW_STEP_MESSAGES.md). By default, it waits
|
|
325
273
|
for structured output through the `workflow` tool. With
|
|
326
274
|
`expectedOutput: assistantMessage()`, it waits for a normal visible assistant
|
|
327
275
|
response and uses the exact text as its output. A `compute` node runs a pure
|
|
328
276
|
TypeScript function. A `notify` node writes a durable message for the Pi
|
|
329
|
-
session that started the run. An `action`
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
277
|
+
session that started the run. An `action` or `shell` node must declare an
|
|
278
|
+
`idempotentEffect(...)` or `manualEffect(...)` recovery contract before it can
|
|
279
|
+
perform a side effect. A `checkpoint` node ends the run in a `waiting` state so
|
|
280
|
+
a human can pick it up. On top of `agent`, the `decision` helper asks
|
|
333
281
|
the model to pick from a fixed set of choices and validates the answer, and
|
|
334
282
|
`decisionEdge` routes on the result with compile-time case checking.
|
|
335
283
|
|
|
@@ -341,7 +289,7 @@ and [docs/SQLITE_STATE.md](docs/SQLITE_STATE.md) for the on-disk run format.
|
|
|
341
289
|
|
|
342
290
|
## Controllers
|
|
343
291
|
|
|
344
|
-
Controllers keep long-running automation aligned with current external state. They store desired state in `spec
|
|
292
|
+
Controllers keep long-running automation aligned with current external state. They store desired state in `spec` and report observed state through conditions and `status`, then reconcile a deduplicated resource key whenever an event or retry makes it ready.
|
|
345
293
|
|
|
346
294
|
Put `*.controller.ts` files in `.pi/controllers/` or `~/.pi/agent/controllers/`. Import the API from `@osolmaz/pi-workflows/controllers`:
|
|
347
295
|
|
|
@@ -367,21 +315,36 @@ Apply and inspect resources from Pi:
|
|
|
367
315
|
/controller reconcile example item-1
|
|
368
316
|
```
|
|
369
317
|
|
|
370
|
-
The standalone CLI provides read-only views with `pi-workflows controllers` and `pi-workflows controller <controller> <key>`. See [docs/CONTROLLERS.md](docs/CONTROLLERS.md) for reconciliation, queue, effect, and child workflow semantics.
|
|
318
|
+
The extension resolves controller initialization in a child process, then sends the declarative resource to the global host. Controller reconciliation also runs in supervised children. The standalone CLI provides read-only views with `pi-workflows controllers` and `pi-workflows controller <controller> <key>`. See [docs/CONTROLLERS.md](docs/CONTROLLERS.md) for reconciliation, queue, effect, and child workflow semantics.
|
|
371
319
|
|
|
372
320
|
## Always-on workflows
|
|
373
321
|
|
|
374
|
-
|
|
322
|
+
Every workflow enters one durable global queue. The extension starts the
|
|
323
|
+
package-owned host on demand. Closing Pi does not stop a compute, action, or
|
|
324
|
+
shell node. When a run reaches an interactive agent, assistant-message, or
|
|
325
|
+
human-decision step, the host parks it and saves a request for the origin Pi
|
|
326
|
+
session. Reopening that session presents the same request once. A protected
|
|
327
|
+
human decision does not start a model turn; a person answers it with
|
|
328
|
+
`/workflow answer`.
|
|
375
329
|
|
|
376
|
-
|
|
330
|
+
The host also reconciles controllers. Controller child workflows without an
|
|
331
|
+
origin session can use headless `pi --mode rpc` agent steps. A child that needs
|
|
332
|
+
a visible assistant response must have an origin-session binding.
|
|
377
333
|
|
|
378
|
-
|
|
334
|
+
Use the CLI to inspect or control the on-demand process:
|
|
379
335
|
|
|
380
336
|
```bash
|
|
381
|
-
pi-workflows host
|
|
337
|
+
pi-workflows host start
|
|
338
|
+
pi-workflows host status
|
|
339
|
+
pi-workflows host stop
|
|
340
|
+
pi-workflows host run # stay attached; stop with Ctrl-C
|
|
382
341
|
```
|
|
383
342
|
|
|
384
|
-
|
|
343
|
+
These commands manage one host for the complete user database, not one host per
|
|
344
|
+
project. They do not install an operating-system service. A new host reaps exact
|
|
345
|
+
orphan process identities and resumes safe work from committed state. See
|
|
346
|
+
[docs/workflows.md](docs/workflows.md#durable-runs-parking-and-resume) and
|
|
347
|
+
[docs/WORKFLOW_HOST.md](docs/WORKFLOW_HOST.md).
|
|
385
348
|
|
|
386
349
|
## Examples
|
|
387
350
|
|
|
@@ -404,8 +367,8 @@ workflow examples. Copy any of them into `.pi/workflows/` to use them:
|
|
|
404
367
|
- `autoimplement` finds a clear existing plan, prepares a safe branch or
|
|
405
368
|
worktree before mutation, documents it when needed, and verifies the current
|
|
406
369
|
change against eligible base-branch failures. It writes and runs the exact
|
|
407
|
-
pi-reviewer command
|
|
408
|
-
finalizes the PR. P0 and P1 fixes require another review, while P2-only work
|
|
370
|
+
pi-reviewer command and tracks P0 through P2 findings, then handles PR
|
|
371
|
+
comments and CI and finalizes the PR. P0 and P1 fixes require another review, while P2-only work
|
|
409
372
|
is verified without another reviewer round. A five-minute CI wait routes to
|
|
410
373
|
additional useful local testing, and new evidence can route through autoplan
|
|
411
374
|
and autodoc before implementation resumes.
|
|
@@ -426,6 +389,11 @@ The controller example at `examples/controllers/pull-request.controller.ts`
|
|
|
426
389
|
shows child repair work and check polling. It also uses expected-head guards
|
|
427
390
|
and recoverable merge effects.
|
|
428
391
|
|
|
392
|
+
## Origins
|
|
393
|
+
|
|
394
|
+
The workflow model was originally ported from
|
|
395
|
+
[openclaw/acpx](https://github.com/openclaw/acpx) flows.
|
|
396
|
+
|
|
429
397
|
## License
|
|
430
398
|
|
|
431
399
|
[MIT](LICENSE)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { runCommandBatch, } from "../workflows/command-batch.js";
|
|
3
|
-
import { action, agent, compute, defineWorkflow, includeWorkflow, includedResult, } from "../workflows/definition.js";
|
|
3
|
+
import { action, agent, compute, defineWorkflow, includeWorkflow, includedResult, manualEffect, } from "../workflows/definition.js";
|
|
4
4
|
import { digest } from "../workflows/human-decision.js";
|
|
5
5
|
import { allowSettingsPath, workflowSettings } from "../workflows/settings.js";
|
|
6
6
|
import autodocWorkflow, {} from "./autodoc.workflow.js";
|
|
@@ -1413,6 +1413,7 @@ export const autoimplementWorkflow = defineWorkflow({
|
|
|
1413
1413
|
run: selectReviewCommands,
|
|
1414
1414
|
}),
|
|
1415
1415
|
runReview: action({
|
|
1416
|
+
effect: manualEffect("pi-workflows.autoimplement.review"),
|
|
1416
1417
|
statusDetail: "running pi-reviewer commands",
|
|
1417
1418
|
timeoutMs: (context) => {
|
|
1418
1419
|
const selected = latestOutput(context, ["selectReviewCommands"]);
|
|
@@ -1517,6 +1518,7 @@ export const autoimplementWorkflow = defineWorkflow({
|
|
|
1517
1518
|
validate: parseCiInspectionForPublished,
|
|
1518
1519
|
}),
|
|
1519
1520
|
trackCi: action({
|
|
1521
|
+
effect: manualEffect("pi-workflows.autoimplement.track-ci"),
|
|
1520
1522
|
statusDetail: "tracking pending CI commands",
|
|
1521
1523
|
timeoutMs: (context) => {
|
|
1522
1524
|
const inspected = latestOutput(context, ["inspectCi"]);
|