@osolmaz/pi-workflows 0.11.2 → 0.12.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 +15 -10
- package/dist/builtins/autoimplement-command-batches.d.ts +52 -0
- package/dist/builtins/autoimplement-command-batches.js +258 -0
- package/dist/builtins/autoimplement-command-batches.js.map +1 -0
- package/dist/builtins/autoimplement.workflow.d.ts +509 -124
- package/dist/builtins/autoimplement.workflow.js +884 -327
- package/dist/builtins/autoimplement.workflow.js.map +1 -1
- package/dist/builtins/catalog.js +5 -3
- package/dist/builtins/catalog.js.map +1 -1
- package/dist/builtins/index.d.ts +4 -1
- package/dist/builtins/index.js +3 -1
- package/dist/builtins/index.js.map +1 -1
- package/dist/builtins/monitor.workflow.d.ts +2 -4
- package/dist/builtins/monitor.workflow.js +26 -128
- package/dist/builtins/monitor.workflow.js.map +1 -1
- package/dist/builtins/pi-agent-group.d.ts +72 -0
- package/dist/builtins/pi-agent-group.js +1087 -0
- package/dist/builtins/pi-agent-group.js.map +1 -0
- package/dist/builtins/plan-approval.workflow.d.ts +39 -5
- package/dist/builtins/plan-approval.workflow.js +92 -14
- package/dist/builtins/plan-approval.workflow.js.map +1 -1
- package/dist/builtins/plan-change.workflow.d.ts +301 -0
- package/dist/builtins/plan-change.workflow.js +256 -0
- package/dist/builtins/plan-change.workflow.js.map +1 -0
- package/dist/builtins/plan-presentation.js +2 -2
- package/dist/builtins/plan-presentation.js.map +1 -1
- package/dist/builtins/sanity-check.workflow.d.ts +85 -0
- package/dist/builtins/sanity-check.workflow.js +482 -0
- package/dist/builtins/sanity-check.workflow.js.map +1 -0
- package/dist/controllers/sqlite.d.ts +90 -2
- package/dist/controllers/sqlite.js +380 -5
- package/dist/controllers/sqlite.js.map +1 -1
- package/dist/extension/decision-channels.d.ts +2 -2
- package/dist/extension/decision-channels.js +29 -35
- package/dist/extension/decision-channels.js.map +1 -1
- package/dist/extension/deferred-turn-coordinator.d.ts +32 -0
- package/dist/extension/deferred-turn-coordinator.js +143 -0
- package/dist/extension/deferred-turn-coordinator.js.map +1 -0
- package/dist/extension/deferred-turn.d.ts +44 -0
- package/dist/extension/deferred-turn.js +110 -0
- package/dist/extension/deferred-turn.js.map +1 -0
- package/dist/extension/index.js +348 -80
- package/dist/extension/index.js.map +1 -1
- package/dist/extension/session-events.d.ts +2 -2
- package/dist/extension/step-message.d.ts +1 -0
- package/dist/extension/step-message.js.map +1 -1
- package/dist/extension/widget.js +23 -3
- package/dist/extension/widget.js.map +1 -1
- package/dist/herdr/setup.js +4 -4
- package/dist/render/graph-render.js +1 -2
- package/dist/render/graph-render.js.map +1 -1
- package/dist/viewer/render.js +7 -6
- package/dist/viewer/render.js.map +1 -1
- package/dist/workflows/catalog.js +7 -2
- package/dist/workflows/catalog.js.map +1 -1
- package/dist/workflows/command-batch.d.ts +38 -0
- package/dist/workflows/command-batch.js +176 -0
- package/dist/workflows/command-batch.js.map +1 -0
- package/dist/workflows/composition.js +8 -0
- package/dist/workflows/composition.js.map +1 -1
- package/dist/workflows/decision-presentation.d.ts +1 -1
- package/dist/workflows/decision-presentation.js +51 -38
- package/dist/workflows/decision-presentation.js.map +1 -1
- package/dist/workflows/engine.d.ts +2 -2
- package/dist/workflows/engine.js +22 -17
- package/dist/workflows/engine.js.map +1 -1
- package/dist/workflows/errors.d.ts +13 -0
- package/dist/workflows/errors.js +15 -0
- package/dist/workflows/errors.js.map +1 -1
- package/dist/workflows/human-decision.d.ts +16 -4
- package/dist/workflows/human-decision.js +175 -72
- package/dist/workflows/human-decision.js.map +1 -1
- package/dist/workflows/index.d.ts +3 -2
- package/dist/workflows/index.js +2 -1
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/progress.d.ts +1 -0
- package/dist/workflows/progress.js +15 -3
- package/dist/workflows/progress.js.map +1 -1
- package/dist/workflows/schema.js +12 -1
- package/dist/workflows/schema.js.map +1 -1
- package/dist/workflows/shell.d.ts +4 -0
- package/dist/workflows/shell.js +6 -0
- package/dist/workflows/shell.js.map +1 -1
- package/dist/workflows/store.js +8 -1
- package/dist/workflows/store.js.map +1 -1
- package/dist/workflows/types.d.ts +37 -48
- package/docs/2026-08-18-herdr-piw-plan.md +1 -1
- package/docs/2026-08-20-durable-workflow-launch-plan.md +19 -23
- package/docs/CONTROLLERS.md +2 -2
- package/docs/DEFERRED_TURNS.md +298 -0
- package/docs/DESIGN_PHILOSOPHY.md +1 -1
- package/docs/HUMAN_DECISIONS.md +30 -40
- package/docs/HUMAN_DECISION_PRESENTATIONS.md +17 -27
- package/docs/MONITOR.md +7 -13
- package/docs/WORKFLOW_COMPOSITION.md +10 -9
- package/docs/WORKFLOW_STEP_MESSAGES.md +5 -5
- package/docs/WORKFLOW_UPDATES.md +28 -5
- package/docs/plans/2026-08-04-controller-runtime-plan.md +1 -1
- package/docs/plans/2026-08-05-always-on-workflows-plan.md +1 -1
- package/docs/plans/2026-08-10-agent-managed-monitor-workflows-plan.md +9 -9
- package/docs/plans/2026-08-13-built-in-workflow-catalog-plan.md +1 -1
- package/docs/plans/2026-08-13-session-addressed-workflow-notifications-plan.md +1 -1
- package/docs/plans/2026-08-16-workflow-updates-plan.md +3 -3
- package/docs/plans/2026-08-17-bundled-skills-plan.md +6 -6
- package/docs/plans/2026-08-19-human-decision-gates-plan.md +5 -5
- package/docs/plans/2026-08-19-human-decision-presentations-plan.md +1 -1
- package/docs/plans/2026-08-19-provider-compatible-workflow-tool-schema-plan.md +1 -1
- package/docs/plans/2026-08-19-workflow-composition-plan.md +6 -6
- package/docs/plans/2026-08-20-autoimplement-blocker-challenge-plan.md +3 -3
- package/docs/plans/2026-08-20-bounded-command-batches-plan.md +206 -0
- package/docs/plans/2026-08-20-herdr-plugin-sync-plan.md +9 -9
- package/docs/plans/2026-08-21-autoimplement-timeout-fallback-plan.md +242 -0
- package/docs/plans/2026-08-21-deferred-turn-intents-plan.md +324 -0
- package/docs/plans/2026-08-21-plan-change-approval-policy-plan.md +322 -0
- package/docs/plans/2026-08-21-sanity-check-plan.md +283 -0
- package/docs/run-bundles.md +8 -6
- package/docs/workflows.md +85 -22
- package/examples/workflows/approved-plan.workflow.ts +19 -46
- package/examples/workflows/command-batch.workflow.ts +50 -0
- package/examples/workflows/sanity-check.workflow.ts +1 -0
- package/herdr-plugin.toml +3 -3
- package/package.json +7 -7
- package/schemas/decision-presentation-v1.schema.json +1 -1
- package/schemas/human-decision-accepted-v1.schema.json +16 -4
- package/schemas/human-decision-answer-attempt-v1.schema.json +1 -1
- package/schemas/human-decision-cancellation-v1.schema.json +1 -1
- package/schemas/human-decision-continuation-v1.schema.json +11 -2
- package/schemas/human-decision-delivery-v1.schema.json +9 -1
- package/schemas/human-decision-receipt-v1.schema.json +9 -1
- package/schemas/human-decision-request-v1.schema.json +25 -5
- package/schemas/human-decision-resolution-v1.schema.json +1 -1
- package/schemas/human-decision-settlement-v1.schema.json +1 -1
- package/skills/autodoc/SKILL.md +33 -2
- package/skills/autoimplement/SKILL.md +93 -12
- package/skills/autoplan/SKILL.md +26 -2
- package/skills/monitor/SKILL.md +66 -24
- package/skills/pi-workflows/SKILL.md +21 -6
- package/skills/sanity-check/SKILL.md +44 -0
- package/src/builtins/autoimplement-command-batches.ts +364 -0
- package/src/builtins/autoimplement.workflow.ts +1075 -370
- package/src/builtins/catalog.ts +5 -3
- package/src/builtins/index.ts +24 -0
- package/src/builtins/monitor.workflow.ts +27 -150
- package/src/builtins/pi-agent-group.ts +1407 -0
- package/src/builtins/plan-approval.workflow.ts +157 -24
- package/src/builtins/plan-change.workflow.ts +321 -0
- package/src/builtins/plan-presentation.ts +2 -2
- package/src/builtins/sanity-check.workflow.ts +769 -0
- package/src/controllers/sqlite.ts +580 -7
- package/src/extension/decision-channels.ts +36 -66
- package/src/extension/deferred-turn-coordinator.ts +171 -0
- package/src/extension/deferred-turn.ts +166 -0
- package/src/extension/index.ts +438 -90
- package/src/extension/session-events.ts +2 -2
- package/src/extension/step-message.ts +1 -0
- package/src/extension/widget.ts +24 -5
- package/src/herdr/setup.ts +4 -4
- package/src/render/graph-render.ts +1 -2
- package/src/viewer/render.ts +7 -6
- package/src/workflows/catalog.ts +7 -2
- package/src/workflows/command-batch.ts +254 -0
- package/src/workflows/composition.ts +9 -0
- package/src/workflows/decision-presentation.ts +56 -43
- package/src/workflows/engine.ts +25 -20
- package/src/workflows/errors.ts +24 -0
- package/src/workflows/human-decision.ts +218 -101
- package/src/workflows/index.ts +20 -11
- package/src/workflows/progress.ts +18 -3
- package/src/workflows/schema.ts +19 -1
- package/src/workflows/shell.ts +10 -0
- package/src/workflows/store.ts +8 -1
- package/src/workflows/types.ts +43 -59
- package/schemas/human-decision-accepted-v2.schema.json +0 -50
- package/schemas/human-decision-delivery-v2.schema.json +0 -36
- package/schemas/human-decision-receipt-v2.schema.json +0 -39
- package/schemas/human-decision-request-v2.schema.json +0 -69
- package/schemas/human-decision-resolution-v2.schema.json +0 -27
|
@@ -10,7 +10,7 @@ This plan implements the contracts in [WORKFLOW_UPDATES.md](../WORKFLOW_UPDATES.
|
|
|
10
10
|
|
|
11
11
|
## Outcome
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
pi-workflows will let a running agent, function action, shell action, or claimed runner publish durable structured updates without completing a node. Progress will be one optional update type with shared estimation and presentation helpers.
|
|
14
14
|
|
|
15
15
|
The built-in monitor will report every accepted check, support optional progress tracks, show live timing in the widget, and deliver notifications without starting an assistant turn.
|
|
16
16
|
|
|
@@ -18,7 +18,7 @@ Interactive agent steps will keep their full model prompts while appearing as co
|
|
|
18
18
|
|
|
19
19
|
## Scope
|
|
20
20
|
|
|
21
|
-
###
|
|
21
|
+
### pi-workflows engine
|
|
22
22
|
|
|
23
23
|
- Add public update types and the action context that publishes them.
|
|
24
24
|
- Add fenced update publication to the engine and run store.
|
|
@@ -456,7 +456,7 @@ Run package and real-Pi checks again after updating OnurPi. Run the tools skill
|
|
|
456
456
|
- The built-in monitor reports every accepted check and has no quiet path.
|
|
457
457
|
- The monitor discloses its finite safety ceiling.
|
|
458
458
|
- TypeScript and Rust viewers agree on replayed progress.
|
|
459
|
-
- All required checks pass in
|
|
459
|
+
- All required checks pass in pi-workflows and OnurPi.
|
|
460
460
|
- The published package, OnurPi pin, monitor skill source, and installed Pi copy agree.
|
|
461
461
|
|
|
462
462
|
## Risks and controls
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Bundle
|
|
2
|
+
title: Bundle pi-workflows skills with the extension
|
|
3
3
|
author: Onur Solmaz <2453968+osolmaz@users.noreply.github.com>
|
|
4
4
|
date: 2026-08-17
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Bundle
|
|
7
|
+
# Bundle pi-workflows skills with the extension
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
pi-workflows should be the single source of truth for instructions that teach an agent how to use its extension and built-in workflows. Installing the Pi package should discover those skills with the extension, while Pi's normal package filters let users disable either resource type or an individual skill.
|
|
10
10
|
|
|
11
11
|
## Outcome
|
|
12
12
|
|
|
@@ -61,9 +61,9 @@ The `workflow` tool description remains the small always-available call contract
|
|
|
61
61
|
4. Add tests that validate declared paths, required frontmatter, unique skill names, and packed files.
|
|
62
62
|
5. Update README installation and configuration examples, including independent resource filtering.
|
|
63
63
|
6. Pack the package and start the real Pi runtime from that artifact. Verify that `/skill:pi-workflows` and `/skill:monitor` are discovered with the extension, then verify that package filtering can hide the monitor skill without hiding the extension.
|
|
64
|
-
7. Run all repository checks and
|
|
64
|
+
7. Run all repository checks and pi-reviewer, merge, release `0.7.0`, and verify npm contents.
|
|
65
65
|
8. Pin `0.7.0` in OnurPi, forward the dependency's skills, and run OnurPi checks.
|
|
66
|
-
9. Remove `agents/skills/monitor` from Tools, run the sync script, and verify that the installed skill now comes from the
|
|
66
|
+
9. Remove `agents/skills/monitor` from Tools, run the sync script, and verify that the installed skill now comes from the pi-workflows package only.
|
|
67
67
|
|
|
68
68
|
## Acceptance criteria
|
|
69
69
|
|
|
@@ -73,7 +73,7 @@ The `workflow` tool description remains the small always-available call contract
|
|
|
73
73
|
- The model can use the `workflow` tool from the new skill without larger workflow step messages.
|
|
74
74
|
- npm contains the two `SKILL.md` files and their referenced documentation.
|
|
75
75
|
- Tools contains no monitor skill source or synced duplicate.
|
|
76
|
-
- Local checks, real-Pi end-to-end tests,
|
|
76
|
+
- Local checks, real-Pi end-to-end tests, pi-reviewer, and CI pass.
|
|
77
77
|
|
|
78
78
|
## Verification
|
|
79
79
|
|
|
@@ -6,9 +6,9 @@ date: 2026-08-19
|
|
|
6
6
|
|
|
7
7
|
# Add reusable human decision gates
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
pi-workflows must let any workflow stop after a proposal, ask the operator in Pi and Telegram, and continue from a verified human choice. A `replan` choice must collect the operator's exact alternative text, send it back to planning, and present the revised plan for another decision.
|
|
10
10
|
|
|
11
|
-
The canonical behavior and public contracts are in [Human decisions](../HUMAN_DECISIONS.md). This plan covers the practical implementation in
|
|
11
|
+
The canonical behavior and public contracts are in [Human decisions](../HUMAN_DECISIONS.md). This plan covers the practical implementation in pi-workflows without changing Pi core or adding a persistent operating-system service.
|
|
12
12
|
|
|
13
13
|
## Outcome
|
|
14
14
|
|
|
@@ -62,7 +62,7 @@ Pi and Telegram implement one channel interface. Workflows address a named audie
|
|
|
62
62
|
- Add a Telegram channel using the Bot API and private profiles.
|
|
63
63
|
- Add named audience resolution and private channel configuration.
|
|
64
64
|
- Add a setup command that writes private configuration with mode `600`, references an existing mode-`0600` token file, and verifies the Telegram bot without reading the token into a prompt or printing it.
|
|
65
|
-
- Keep Telegram optional.
|
|
65
|
+
- Keep Telegram optional. pi-workflows must start and run normal workflows without Telegram configuration.
|
|
66
66
|
- Use one leased long-poll owner per Telegram profile across active Pi processes.
|
|
67
67
|
|
|
68
68
|
### Documentation and display
|
|
@@ -281,7 +281,7 @@ npx -y @simpledoc/simpledoc check
|
|
|
281
281
|
git diff --check
|
|
282
282
|
```
|
|
283
283
|
|
|
284
|
-
Run
|
|
284
|
+
Run pi-reviewer against the pushed branch. Fix every P0 and P1 finding and rerun it. Address valid P2 findings, but do not rerun review solely because of a P2-only change. Open or update a pull request and leave it unmerged unless merge is separately authorized.
|
|
285
285
|
|
|
286
286
|
## Release
|
|
287
287
|
|
|
@@ -293,4 +293,4 @@ This work adds compatible public APIs and additive persisted records. Release it
|
|
|
293
293
|
- **Other persistent data:** additive decision records, a rebuildable private channel index, and private channel configuration.
|
|
294
294
|
- **Pi internals:** none.
|
|
295
295
|
- **Public Pi API:** documented extension lifecycle plus command and UI methods only.
|
|
296
|
-
- **Public
|
|
296
|
+
- **Public pi-workflows API:** typed human choices, `humanDecision()`, `humanDecisionEdge()`, the channel interface, and the `plan-approval` workflow.
|
|
@@ -6,7 +6,7 @@ date: 2026-08-19
|
|
|
6
6
|
|
|
7
7
|
# Add readable human decision presentations
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
pi-workflows currently sends a structured human decision body to Telegram with
|
|
10
10
|
`JSON.stringify()`. A plan approval therefore reaches the operator as machine
|
|
11
11
|
JSON. Pi also shows only the decision title in its basic selection prompt.
|
|
12
12
|
|
|
@@ -41,5 +41,5 @@ Fix the workflow tool schema so strict OpenAI-compatible providers accept it wit
|
|
|
41
41
|
- The strict local endpoint accepts both workflow tool schemas.
|
|
42
42
|
- Runtime parsing rejects malformed calls before execution.
|
|
43
43
|
- `npm run check`, `npm run test:e2e`, Rust tests, Slophammer checks, and `git diff --check` pass.
|
|
44
|
-
-
|
|
44
|
+
- pi-reviewer reports no P0 or P1 findings.
|
|
45
45
|
- PR #33 CI passes before merge.
|
|
@@ -6,7 +6,7 @@ date: 2026-08-19
|
|
|
6
6
|
|
|
7
7
|
# Add typed workflow composition and automatic repair
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
pi-workflows needs reusable nested workflows with normal TypeScript imports. Monitor must be able to devise and implement a repair when mutation is authorized. Autoimplement must move back to solution design when new evidence invalidates its plan, correct failed reviewer commands, track P0, P1, and P2 findings, and use long CI waits for additional local testing.
|
|
10
10
|
|
|
11
11
|
The canonical behavior is in [Workflow composition](../WORKFLOW_COMPOSITION.md).
|
|
12
12
|
|
|
@@ -56,7 +56,7 @@ The package will ship `autoplan`, `autoimplement`, and `monitor` as compatible b
|
|
|
56
56
|
- Track P0, P1, and P2 review findings by round.
|
|
57
57
|
- Rerun review only after P0 or P1 work.
|
|
58
58
|
- Permit P2 work without another reviewer round.
|
|
59
|
-
- Generate, validate, execute, and correct exact
|
|
59
|
+
- Generate, validate, execute, and correct exact pi-reviewer commands.
|
|
60
60
|
- Track PR comments, CI, merge, and final PR reporting.
|
|
61
61
|
- Bound one CI watch to five minutes.
|
|
62
62
|
- Route a long CI wait to useful local testing before checking CI again.
|
|
@@ -71,7 +71,7 @@ The package will ship `autoplan`, `autoimplement`, and `monitor` as compatible b
|
|
|
71
71
|
- Do not permit recursive include graphs.
|
|
72
72
|
- Do not add unrestricted model-selected node names.
|
|
73
73
|
- Do not let monitor mutate a target without explicit authorization.
|
|
74
|
-
- Do not replace
|
|
74
|
+
- Do not replace pi-reviewer with another reviewer after an invocation failure.
|
|
75
75
|
- Do not merge before required gates pass or an allowed unrelated failure is recorded.
|
|
76
76
|
- Do not rewrite existing terminal run bundles.
|
|
77
77
|
|
|
@@ -214,7 +214,7 @@ CI
|
|
|
214
214
|
|
|
215
215
|
The structured plan input is optional because the plan can already exist in conversation context or canonical documentation. Its absence never authorizes initial autoplan. Autoimplement blocks when no clear plan exists, skips autodoc for current documentation, and records every evidence-driven revision through autodoc before continuing.
|
|
216
216
|
|
|
217
|
-
The workflow will collect all review rounds in its final output. It will never rerun
|
|
217
|
+
The workflow will collect all review rounds in its final output. It will never rerun pi-reviewer solely because P2 work changed files.
|
|
218
218
|
|
|
219
219
|
### 8. Monitor repair
|
|
220
220
|
|
|
@@ -278,7 +278,7 @@ npx -y @simpledoc/simpledoc check
|
|
|
278
278
|
git diff --check
|
|
279
279
|
```
|
|
280
280
|
|
|
281
|
-
Run
|
|
281
|
+
Run pi-reviewer against the pushed branch. Fix every P0 and P1 finding and rerun it. P2-only changes do not require another reviewer run unless they expose a new P0 or P1 concern. Check PR comments and CI after review passes.
|
|
282
282
|
|
|
283
283
|
## Release
|
|
284
284
|
|
|
@@ -305,4 +305,4 @@ The package and Rust viewer version is `0.10.0`.
|
|
|
305
305
|
- **Other persistent data:** additive mount, source, digest, review, and CI evidence in existing run bundles.
|
|
306
306
|
- **Pi internals:** none.
|
|
307
307
|
- **Public Pi API:** existing documented extension APIs only.
|
|
308
|
-
- **Public
|
|
308
|
+
- **Public pi-workflows API:** generic input and exits, direct and dynamic `includeWorkflow()`, and `defineWorkflowRegistry()`.
|
|
@@ -12,7 +12,7 @@ The canonical workflow behavior is in [Workflow authoring reference](../workflow
|
|
|
12
12
|
|
|
13
13
|
## Outcome
|
|
14
14
|
|
|
15
|
-
Add one independent `challengeBlocker` agent node to the built-in autoimplement workflow. Use only existing public
|
|
15
|
+
Add one independent `challengeBlocker` agent node to the built-in autoimplement workflow. Use only existing public pi-workflows primitives. Keep the graph explicit and reuse the existing redesign include and terminal blocked result.
|
|
16
16
|
|
|
17
17
|
The challenge asks these questions in plain terms:
|
|
18
18
|
|
|
@@ -120,7 +120,7 @@ Review the final diff for missing blocker routes, accidental unbounded loops, an
|
|
|
120
120
|
## Boundaries
|
|
121
121
|
|
|
122
122
|
- Preserve current run-bundle schemas unless a schema change is required. Do not add a persistence layer.
|
|
123
|
-
- Use existing public
|
|
123
|
+
- Use existing public pi-workflows primitives only. Do not change Pi core.
|
|
124
124
|
- Keep explicit human and protected authorization boundaries intact.
|
|
125
125
|
- Use a hard cutover. Do not retain a legacy blocker route.
|
|
126
126
|
- Preserve unrelated work and do not modify other repositories.
|
|
@@ -135,4 +135,4 @@ Review the final diff for missing blocker routes, accidental unbounded loops, an
|
|
|
135
135
|
- **Other persistent data:** none beyond the existing run bundle records for normal node outputs.
|
|
136
136
|
- **Pi internals:** none.
|
|
137
137
|
- **Public Pi API:** existing documented extension APIs only.
|
|
138
|
-
- **Public
|
|
138
|
+
- **Public pi-workflows API:** existing agent, compute, edge, and included-workflow primitives only.
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Run independent commands in bounded batches
|
|
3
|
+
author: Onur Solmaz <2453968+osolmaz@users.noreply.github.com>
|
|
4
|
+
date: 2026-08-20
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Run independent commands in bounded batches
|
|
8
|
+
|
|
9
|
+
Autoimplement runs independent commands one after another today. This makes multi-repository review and CI waits take longer than needed.
|
|
10
|
+
|
|
11
|
+
Add one public `runCommandBatch` helper. Use it for independent pi-reviewer commands, pending CI watches, and independent local verification commands. Keep model turns and commands that change repositories or remote systems in their current order.
|
|
12
|
+
|
|
13
|
+
The canonical workflow behavior is in [Workflow authoring reference](../workflows.md#built-in-planning-and-implementation). Command progress follows [Workflow updates](../WORKFLOW_UPDATES.md#command-batch-updates).
|
|
14
|
+
|
|
15
|
+
## Outcome
|
|
16
|
+
|
|
17
|
+
Add one Pi-independent helper under `src/workflows`. The helper runs a validated list of commands with a fixed concurrency limit. It uses the existing `runShellAction` implementation for process creation, output capture, timeout, and process-group cleanup.
|
|
18
|
+
|
|
19
|
+
This is a function called by ordinary action nodes. It is not a workflow node, graph scheduler, fan-out primitive, controller, service, or new persistence system.
|
|
20
|
+
|
|
21
|
+
## Public contract
|
|
22
|
+
|
|
23
|
+
The public request contains a command list and one concurrency limit:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
type CommandBatchItem = {
|
|
27
|
+
id: string;
|
|
28
|
+
command: string;
|
|
29
|
+
args: string[];
|
|
30
|
+
cwd: string;
|
|
31
|
+
timeoutMs: number;
|
|
32
|
+
maxOutputChars: number;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type CommandBatchRequest = {
|
|
36
|
+
items: CommandBatchItem[];
|
|
37
|
+
maxConcurrency: number;
|
|
38
|
+
};
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Each item ID must be unique in the request. `cwd` must be absolute. Timeouts, output limits, item count, and concurrency must stay within package limits. Items cannot set `env`, `stdin`, `shell`, or `allowNonZeroExit`. Commands run without a shell.
|
|
42
|
+
|
|
43
|
+
The result uses the schema `pi-workflows.command-batch-result.v1`. Results stay in input order even when commands finish in a different order. Each item records:
|
|
44
|
+
|
|
45
|
+
- its ID;
|
|
46
|
+
- `succeeded`, `failed`, `timedOut`, or `cancelled`;
|
|
47
|
+
- command, arguments, and working directory;
|
|
48
|
+
- stdout and stderr;
|
|
49
|
+
- exit code and signal;
|
|
50
|
+
- duration;
|
|
51
|
+
- stdout and stderr truncation flags;
|
|
52
|
+
- a bounded error message when one exists.
|
|
53
|
+
|
|
54
|
+
A nonzero exit, spawn failure, or item timeout affects only that item. Invalid batch input is a batch error.
|
|
55
|
+
|
|
56
|
+
## Execution
|
|
57
|
+
|
|
58
|
+
`runCommandBatch` uses a fixed worker pool. It starts no more than `maxConcurrency` commands. Each worker checks the abort signal before it takes an item. `runShellAction` checks again before it starts the process.
|
|
59
|
+
|
|
60
|
+
The helper accepts an optional completion callback. Autoimplement uses the callback for small progress updates. The callback is observational. Its updates cannot complete a node or satisfy review, CI, or verification routing.
|
|
61
|
+
|
|
62
|
+
The helper does not interpret repository, review, CI, or test results. Autoimplement owns that meaning.
|
|
63
|
+
|
|
64
|
+
## Cancellation and interruption
|
|
65
|
+
|
|
66
|
+
The workflow action passes its abort signal to the helper. An abort stops active process groups through the existing `runShellAction` SIGTERM and bounded SIGKILL path. Workers do not start queued items after the abort.
|
|
67
|
+
|
|
68
|
+
Accepted batch outputs use the existing run trace and artifact files. Large strings use normal artifact externalization.
|
|
69
|
+
|
|
70
|
+
If the process stops before the action output is accepted, resume runs that batch again. This is allowed only for read-only reviewer and CI commands or isolated local verification commands. The first implementation does not add partial-item recovery or another store.
|
|
71
|
+
|
|
72
|
+
## Autoimplement use
|
|
73
|
+
|
|
74
|
+
### Review
|
|
75
|
+
|
|
76
|
+
Publication reports every repository with a pushed pull request:
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
type PublishedRepository = {
|
|
80
|
+
repository: string;
|
|
81
|
+
baseBranch: string;
|
|
82
|
+
headRevision: string;
|
|
83
|
+
pr: string;
|
|
84
|
+
dependencyFingerprint?: string;
|
|
85
|
+
};
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Autoimplement derives a stable item ID from the canonical repository path. It builds `pi-reviewer --base <branch>` directly from each published record and runs ready reviewer commands in one bounded batch.
|
|
89
|
+
|
|
90
|
+
Review findings stay grouped by repository ID and reviewed head. A later round runs only for a repository whose pushed head or relevant dependency fingerprint changed. P0 and P1 findings still require another review after fixes. P2-only work keeps the current rule: address proportionate findings, verify and push, then continue without another review only because of that P2 work.
|
|
91
|
+
|
|
92
|
+
### CI watches
|
|
93
|
+
|
|
94
|
+
Autoimplement first inspects every pull request without waiting. It accepts only supported pending `gh pr checks --watch` or `gh run watch` descriptors, then normalizes each one to `gh pr checks <validated PR URL> --watch`. It rejects repository and pull-request overrides, so a watch result cannot satisfy a different pull request. Each watch keeps the current five-minute limit. Results are assessed per pull request. A failed or timed-out watch does not hide results for other pull requests.
|
|
95
|
+
|
|
96
|
+
If checks remain pending, autoimplement runs other useful local tests before it inspects CI again. It does not invent an ETA.
|
|
97
|
+
|
|
98
|
+
### Local verification
|
|
99
|
+
|
|
100
|
+
The verification model step selects commands, but does not run the batch itself. Autoimplement validates the descriptors, runs one command per independent repository with a low concurrency limit, then uses a later model step to assess all results.
|
|
101
|
+
|
|
102
|
+
Verification batches reject shell wrappers, environment overrides, stdin, Git or GitHub mutation commands, package publication commands, duplicate working directories, and paths outside the reported repositories. Fixes and other model work remain outside the batch.
|
|
103
|
+
|
|
104
|
+
### Concurrency settings
|
|
105
|
+
|
|
106
|
+
Autoimplement adds optional reviewer, CI-watch, and verification concurrency settings. Existing input remains valid. One command always runs with concurrency one.
|
|
107
|
+
|
|
108
|
+
Use conservative defaults:
|
|
109
|
+
|
|
110
|
+
- reviewer: 4;
|
|
111
|
+
- CI watch: 4;
|
|
112
|
+
- verification: 2.
|
|
113
|
+
|
|
114
|
+
Cap each value at 8. Repository instructions or explicit input can lower these values.
|
|
115
|
+
|
|
116
|
+
## Progress and reporting
|
|
117
|
+
|
|
118
|
+
Each settled item can publish a metadata-only `pi-workflows.command-batch-item.v1` update. The update contains the batch kind, item ID, outcome, completed count, and total count. It does not contain stdout, stderr, environment data, credentials, or private provider payloads.
|
|
119
|
+
|
|
120
|
+
Only the accepted action output controls routing. Final reports group review, CI, and verification evidence by repository and revision. Single-repository reports keep their current fields and meaning.
|
|
121
|
+
|
|
122
|
+
Reviewer or CI output that reaches its capture limit is incomplete. Autoimplement must not classify truncated output as clean.
|
|
123
|
+
|
|
124
|
+
## Implementation
|
|
125
|
+
|
|
126
|
+
1. Add command-batch types, validation, worker-pool execution, per-item results, truncation flags, cancellation, and the completion callback in `src/workflows/command-batch.ts`.
|
|
127
|
+
2. Export the public helper and types from `src/workflows/index.ts`.
|
|
128
|
+
3. Add an internal truncation check in `src/workflows/shell.ts` without changing `ShellActionResult` or singular shell output.
|
|
129
|
+
4. Add autoimplement-only publication normalization, command validation, stable repository IDs, and concurrency parsing in `src/builtins/autoimplement-command-batches.ts` when separation keeps the main workflow clear.
|
|
130
|
+
5. Refactor `src/builtins/autoimplement.workflow.ts` to use batch actions for review, pending CI watches, and independent verification.
|
|
131
|
+
6. Remove the superseded singular reviewer and CI-watch paths in the same change.
|
|
132
|
+
7. Add `examples/workflows/command-batch.workflow.ts` and update the bundled autoimplement skill.
|
|
133
|
+
8. Bump the built-in autoimplement revision from 4 to 5 in `src/builtins/catalog.ts`.
|
|
134
|
+
|
|
135
|
+
## Tests
|
|
136
|
+
|
|
137
|
+
Add `test/command-batch.test.ts` for:
|
|
138
|
+
|
|
139
|
+
- descriptor validation and bounds;
|
|
140
|
+
- empty and one-item requests;
|
|
141
|
+
- deterministic input-order results;
|
|
142
|
+
- measured concurrency limits;
|
|
143
|
+
- mixed success and failure;
|
|
144
|
+
- spawn failure and nonzero exit;
|
|
145
|
+
- per-item timeout;
|
|
146
|
+
- abort before and during execution;
|
|
147
|
+
- no queued starts after abort;
|
|
148
|
+
- process-group cleanup;
|
|
149
|
+
- output limits, truncation flags, and UTF-8;
|
|
150
|
+
- completion callback behavior.
|
|
151
|
+
|
|
152
|
+
Update autoimplement tests for:
|
|
153
|
+
|
|
154
|
+
- current single-repository input and output;
|
|
155
|
+
- one and several published repositories;
|
|
156
|
+
- parallel reviewer execution and isolated findings;
|
|
157
|
+
- changed-head and dependency-fingerprint reruns;
|
|
158
|
+
- P0, P1, P2, lower, command failure, timeout, and truncation;
|
|
159
|
+
- parallel pending CI watches and per-PR assessment;
|
|
160
|
+
- independent verification and its lower limit;
|
|
161
|
+
- unsafe verification command rejection;
|
|
162
|
+
- accepted-output resume and full replay of an unaccepted batch;
|
|
163
|
+
- metadata-only progress updates;
|
|
164
|
+
- built-in revision 5 and old active-run refusal.
|
|
165
|
+
|
|
166
|
+
Use temporary repositories and fake `pi-reviewer` and `gh` commands in end-to-end tests. Do not call a real model or mutate a remote system.
|
|
167
|
+
|
|
168
|
+
## Verification
|
|
169
|
+
|
|
170
|
+
Run these checks before completion:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
npm run check
|
|
174
|
+
npm run test:e2e
|
|
175
|
+
npx slophammer-ts@latest dry .
|
|
176
|
+
npx slophammer-ts@latest check . --only ts.dependency-boundaries-required
|
|
177
|
+
git diff --check
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Keep coverage at or above 85 percent. Verify discovery through a fresh Pi process and the installed package path.
|
|
181
|
+
|
|
182
|
+
## Rollout
|
|
183
|
+
|
|
184
|
+
Keep the command-batch result and update schemas at v1 during alpha. Use a hard cutover. Do not keep singular reviewer or CI-watch execution beside the batch path. Do not add migration readers, dual paths, aliases, or feature flags.
|
|
185
|
+
|
|
186
|
+
The autoimplement built-in revision changes from 4 to 5. Active runs from revision 4 must start again. Terminal bundles remain readable.
|
|
187
|
+
|
|
188
|
+
Do not publish a package or create a release without separate authorization.
|
|
189
|
+
|
|
190
|
+
## Boundaries
|
|
191
|
+
|
|
192
|
+
- Do not add a workflow-engine primitive.
|
|
193
|
+
- Do not add a controller, child workflow, service, database, queue, webhook receiver, distributed worker, or artifact store.
|
|
194
|
+
- Do not parallelize model turns, code edits, comment fixes, pushes, pull request mutations, merges, releases, or rollbacks.
|
|
195
|
+
- Do not add a full multi-repository campaign or target graph.
|
|
196
|
+
- Do not add partial-item durable recovery until measured replay cost justifies it.
|
|
197
|
+
- Do not infer command independence, dependency relations, resource limits, remote authority, or CI ETA.
|
|
198
|
+
- Do not change Pi core, private Pi APIs, external tools, providers, credentials, or repository policy.
|
|
199
|
+
|
|
200
|
+
## Contract impact
|
|
201
|
+
|
|
202
|
+
- **Session state:** normal workflow messages and tool results only.
|
|
203
|
+
- **Other persistent data:** normal node outputs, updates, trace records, and artifacts in existing run bundles.
|
|
204
|
+
- **Pi internals:** none.
|
|
205
|
+
- **Public Pi API:** existing documented extension APIs only.
|
|
206
|
+
- **Public Pi Workflows API:** new `runCommandBatch` helper and command-batch types; existing action, update, shell, timeout, and cancellation interfaces.
|
|
@@ -6,9 +6,9 @@ date: 2026-08-20
|
|
|
6
6
|
|
|
7
7
|
# Keep the Herdr plugin linked after package updates
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
pi-workflows ships its Herdr plugin inside the npm package. Herdr records the package's absolute path. npm can move an installed package between nested and hoisted `node_modules` directories during an update, which leaves Herdr linked to a path that no longer exists.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
pi-workflows will own one explicit command that finds its own package and repairs this link. OnurPi will call that command after it installs an exact reviewed pi-workflows release. OnurPi will not contain Herdr paths, manifests, or link-repair rules.
|
|
12
12
|
|
|
13
13
|
## Outcome
|
|
14
14
|
|
|
@@ -24,7 +24,7 @@ The command validates the bundled package before it changes Herdr. It then creat
|
|
|
24
24
|
|
|
25
25
|
## Scope
|
|
26
26
|
|
|
27
|
-
###
|
|
27
|
+
### pi-workflows
|
|
28
28
|
|
|
29
29
|
- Resolve the installed package root from the running CLI.
|
|
30
30
|
- Validate `package.json`, `herdr-plugin.toml`, and the bundled viewer before changing Herdr.
|
|
@@ -37,9 +37,9 @@ The command validates the bundled package before it changes Herdr. It then creat
|
|
|
37
37
|
|
|
38
38
|
### OnurPi
|
|
39
39
|
|
|
40
|
-
- Keep the
|
|
40
|
+
- Keep the pi-workflows dependency pinned to an exact reviewed release.
|
|
41
41
|
- Invoke the local `pi-workflows herdr sync --json` command from an explicit TypeScript sync script after dependency installation.
|
|
42
|
-
- Accept the versioned result and keep Herdr-specific behavior in
|
|
42
|
+
- Accept the versioned result and keep Herdr-specific behavior in pi-workflows.
|
|
43
43
|
- Keep package installation free of `postinstall` side effects.
|
|
44
44
|
|
|
45
45
|
## Non-goals
|
|
@@ -66,19 +66,19 @@ The JSON result uses schema `pi-workflows.herdr-sync.v1` and contains:
|
|
|
66
66
|
|
|
67
67
|
A missing Herdr executable returns `unavailable` with exit code zero because Herdr is an optional integration. Every other failure returns a nonzero exit code and does not claim success.
|
|
68
68
|
|
|
69
|
-
The command preflights the new package before unlinking an old registration. Herdr currently exposes separate unlink and link commands, so replacement cannot be atomic. If replacement fails,
|
|
69
|
+
The command preflights the new package before unlinking an old registration. Herdr currently exposes separate unlink and link commands, so replacement cannot be atomic. If replacement fails, pi-workflows makes one restore attempt only when the previous package root still passes the same validation. It then reports the state found by a fresh Herdr query.
|
|
70
70
|
|
|
71
71
|
Concurrent sync commands converge on the same target. After a failed or ambiguous mutation, the command queries Herdr and adopts the result only when another process already reached the exact expected state. It does not repeat the same mutation blindly.
|
|
72
72
|
|
|
73
73
|
## Compatibility
|
|
74
74
|
|
|
75
|
-
Existing `herdr setup` callers use the same implementation. Other
|
|
75
|
+
Existing `herdr setup` callers use the same implementation. Other pi-workflows CLI commands do not change. The npm package remains the only source of the plugin manifest and viewer.
|
|
76
76
|
|
|
77
77
|
OnurPi adds only invocation timing and result handling. It does not parse the Herdr manifest or issue link commands.
|
|
78
78
|
|
|
79
79
|
## Verification
|
|
80
80
|
|
|
81
|
-
###
|
|
81
|
+
### pi-workflows
|
|
82
82
|
|
|
83
83
|
- Test first link, unchanged link, disabled link, moved package path, stale path, and version update.
|
|
84
84
|
- Test missing Herdr, malformed manifests, malformed plugin records, command failures, post-action mismatches, and bounded restore behavior.
|
|
@@ -95,7 +95,7 @@ OnurPi adds only invocation timing and result handling. It does not parse the He
|
|
|
95
95
|
|
|
96
96
|
### Adoption
|
|
97
97
|
|
|
98
|
-
After a separately approved
|
|
98
|
+
After a separately approved pi-workflows release, update OnurPi to that exact version and run:
|
|
99
99
|
|
|
100
100
|
```bash
|
|
101
101
|
npm run workflows:sync
|