@yycholla/pi-dynamic-workflows 3.3.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/LICENSE +22 -0
- package/README.md +325 -0
- package/assets/readme/hero.png +0 -0
- package/assets/readme/hero.svg +70 -0
- package/assets/readme/package-cover.png +0 -0
- package/assets/readme/package-cover.svg +66 -0
- package/assets/readme/workflow.png +0 -0
- package/assets/readme/workflow.svg +77 -0
- package/dist/accept-workflow-guidance.d.ts +14 -0
- package/dist/accept-workflow-guidance.js +53 -0
- package/dist/adversarial-review.d.ts +30 -0
- package/dist/adversarial-review.js +107 -0
- package/dist/agent-history.d.ts +20 -0
- package/dist/agent-history.js +122 -0
- package/dist/agent-registry.d.ts +83 -0
- package/dist/agent-registry.js +190 -0
- package/dist/agent.d.ts +364 -0
- package/dist/agent.js +714 -0
- package/dist/builtin-commands.d.ts +19 -0
- package/dist/builtin-commands.js +251 -0
- package/dist/builtin-workflows.d.ts +45 -0
- package/dist/builtin-workflows.js +121 -0
- package/dist/code-review.d.ts +26 -0
- package/dist/code-review.js +181 -0
- package/dist/config.d.ts +37 -0
- package/dist/config.js +44 -0
- package/dist/deep-research.d.ts +30 -0
- package/dist/deep-research.js +124 -0
- package/dist/display.d.ts +134 -0
- package/dist/display.js +248 -0
- package/dist/effort-command.d.ts +28 -0
- package/dist/effort-command.js +68 -0
- package/dist/enums.d.ts +69 -0
- package/dist/enums.js +78 -0
- package/dist/errors.d.ts +113 -0
- package/dist/errors.js +140 -0
- package/dist/extension-reload.d.ts +37 -0
- package/dist/extension-reload.js +78 -0
- package/dist/fs-persistence.d.ts +63 -0
- package/dist/fs-persistence.js +102 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.js +35 -0
- package/dist/logger.d.ts +21 -0
- package/dist/logger.js +66 -0
- package/dist/model-routing.d.ts +30 -0
- package/dist/model-routing.js +50 -0
- package/dist/model-spec.d.ts +29 -0
- package/dist/model-spec.js +252 -0
- package/dist/model-tier-config.d.ts +133 -0
- package/dist/model-tier-config.js +249 -0
- package/dist/run-persistence.d.ts +180 -0
- package/dist/run-persistence.js +294 -0
- package/dist/saved-commands.d.ts +28 -0
- package/dist/saved-commands.js +100 -0
- package/dist/shared-store.d.ts +98 -0
- package/dist/shared-store.js +212 -0
- package/dist/structured-output.d.ts +19 -0
- package/dist/structured-output.js +30 -0
- package/dist/task-panel.d.ts +61 -0
- package/dist/task-panel.js +422 -0
- package/dist/usage-limit-scheduler.d.ts +145 -0
- package/dist/usage-limit-scheduler.js +368 -0
- package/dist/web-tools.d.ts +20 -0
- package/dist/web-tools.js +120 -0
- package/dist/workflow-authoring-coverage.d.ts +70 -0
- package/dist/workflow-authoring-coverage.js +421 -0
- package/dist/workflow-authoring-reference.d.ts +20 -0
- package/dist/workflow-authoring-reference.js +156 -0
- package/dist/workflow-capability-contract.d.ts +131 -0
- package/dist/workflow-capability-contract.js +604 -0
- package/dist/workflow-commands.d.ts +18 -0
- package/dist/workflow-commands.js +260 -0
- package/dist/workflow-comprehension.d.ts +133 -0
- package/dist/workflow-comprehension.js +1321 -0
- package/dist/workflow-context-measurement.d.ts +72 -0
- package/dist/workflow-context-measurement.js +213 -0
- package/dist/workflow-control-tool.d.ts +30 -0
- package/dist/workflow-control-tool.js +176 -0
- package/dist/workflow-delivery-choice.d.ts +20 -0
- package/dist/workflow-delivery-choice.js +48 -0
- package/dist/workflow-editor.d.ts +93 -0
- package/dist/workflow-editor.js +363 -0
- package/dist/workflow-manager.d.ts +492 -0
- package/dist/workflow-manager.js +1124 -0
- package/dist/workflow-paths.d.ts +22 -0
- package/dist/workflow-paths.js +46 -0
- package/dist/workflow-release-gate.d.ts +39 -0
- package/dist/workflow-release-gate.js +309 -0
- package/dist/workflow-saved.d.ts +38 -0
- package/dist/workflow-saved.js +126 -0
- package/dist/workflow-settings.d.ts +70 -0
- package/dist/workflow-settings.js +131 -0
- package/dist/workflow-tool.d.ts +71 -0
- package/dist/workflow-tool.js +367 -0
- package/dist/workflow-ui.d.ts +182 -0
- package/dist/workflow-ui.js +1587 -0
- package/dist/workflow.d.ts +333 -0
- package/dist/workflow.js +1151 -0
- package/dist/workflows-models-command.d.ts +31 -0
- package/dist/workflows-models-command.js +156 -0
- package/dist/worktree.d.ts +25 -0
- package/dist/worktree.js +61 -0
- package/extensions/workflow.ts +151 -0
- package/package.json +104 -0
- package/skills/workflow-authoring/SKILL.md +30 -0
- package/skills/workflow-authoring/examples/adversarial-verification.js +63 -0
- package/skills/workflow-authoring/examples/bounded-semantic-retry.js +56 -0
- package/skills/workflow-authoring/examples/classify-and-act.js +67 -0
- package/skills/workflow-authoring/examples/fan-out-and-synthesize.js +47 -0
- package/skills/workflow-authoring/examples/generate-and-filter.js +68 -0
- package/skills/workflow-authoring/examples/loop-until-done.js +68 -0
- package/skills/workflow-authoring/examples/phased-budgets.js +75 -0
- package/skills/workflow-authoring/examples/saved-nested-workflows.js +44 -0
- package/skills/workflow-authoring/examples/structured-output.js +37 -0
- package/skills/workflow-authoring/examples/tournament.js +81 -0
- package/skills/workflow-authoring/examples/validated-gate.js +63 -0
- package/skills/workflow-authoring/references/capabilities.md +41 -0
- package/skills/workflow-authoring/references/capability-details.md +357 -0
- package/skills/workflow-authoring/references/common-helpers.md +4 -0
- package/skills/workflow-authoring/references/debugging.md +27 -0
- package/skills/workflow-authoring/references/focused-recipes.md +11 -0
- package/skills/workflow-authoring/references/helpers.md +9 -0
- package/skills/workflow-authoring/references/lifecycle.md +33 -0
- package/skills/workflow-authoring/references/pattern-selection.md +15 -0
- package/skills/workflow-authoring/references/quality-helpers.md +8 -0
- package/skills/workflow-authoring/references/registry-ownership.md +15 -0
- package/skills/workflow-authoring/references/retry-helper.md +5 -0
- package/skills/workflow-authoring/references/review.md +43 -0
- package/skills/workflow-authoring/references/runtime.md +27 -0
- package/skills/workflow-authoring/references/specialized-helpers.md +19 -0
- package/skills/workflow-authoring/references/versions.md +13 -0
- package/skills/workflow-patterns/SKILL.md +51 -0
- package/src/accept-workflow-guidance.ts +71 -0
- package/src/adversarial-review.ts +120 -0
- package/src/agent-history.ts +157 -0
- package/src/agent-registry.ts +221 -0
- package/src/agent.ts +929 -0
- package/src/builtin-commands.ts +286 -0
- package/src/builtin-workflows.ts +155 -0
- package/src/code-review.ts +183 -0
- package/src/config.ts +55 -0
- package/src/deep-research.ts +135 -0
- package/src/display.ts +367 -0
- package/src/effort-command.ts +87 -0
- package/src/enums.ts +77 -0
- package/src/errors.ts +199 -0
- package/src/extension-reload.ts +100 -0
- package/src/fs-persistence.ts +124 -0
- package/src/index.ts +176 -0
- package/src/logger.ts +88 -0
- package/src/model-routing.ts +73 -0
- package/src/model-spec.ts +309 -0
- package/src/model-tier-config.ts +296 -0
- package/src/run-persistence.ts +484 -0
- package/src/saved-commands.ts +115 -0
- package/src/shared-store.ts +228 -0
- package/src/structured-output.ts +47 -0
- package/src/task-panel.ts +490 -0
- package/src/usage-limit-scheduler.ts +432 -0
- package/src/web-tools.ts +124 -0
- package/src/workflow-authoring-coverage.ts +486 -0
- package/src/workflow-authoring-reference.ts +186 -0
- package/src/workflow-capability-contract.ts +806 -0
- package/src/workflow-commands.ts +287 -0
- package/src/workflow-comprehension.ts +1673 -0
- package/src/workflow-context-measurement.ts +262 -0
- package/src/workflow-control-tool.ts +238 -0
- package/src/workflow-delivery-choice.ts +69 -0
- package/src/workflow-editor.ts +444 -0
- package/src/workflow-manager.ts +1405 -0
- package/src/workflow-paths.ts +63 -0
- package/src/workflow-release-gate.ts +529 -0
- package/src/workflow-saved.ts +180 -0
- package/src/workflow-settings.ts +194 -0
- package/src/workflow-tool.ts +464 -0
- package/src/workflow-ui.ts +1789 -0
- package/src/workflow.ts +1615 -0
- package/src/workflows-models-command.ts +211 -0
- package/src/worktree.ts +76 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 QuintinShaw
|
|
4
|
+
Copyright (c) Michael Livs (original pi-dynamic-workflows)
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/QuintinShaw/pi-dynamic-workflows/main/assets/readme/hero.png" width="100%" alt="pi-dynamic-workflows turns one prompt into a routed, resumable, cross-checked fleet of Pi subagents">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://www.npmjs.com/package/@quintinshaw/pi-dynamic-workflows"><img src="https://img.shields.io/npm/v/@quintinshaw/pi-dynamic-workflows?color=cb3837&logo=npm" alt="npm version"></a>
|
|
7
|
+
<a href="#license"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT license"></a>
|
|
8
|
+
<a href="https://pi.dev"><img src="https://img.shields.io/badge/for-Pi-7c3aed" alt="Built for Pi"></a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://quintinshaw.github.io/pi-dynamic-workflows/">Documentation</a> ·
|
|
13
|
+
<a href="https://www.npmjs.com/package/@quintinshaw/pi-dynamic-workflows">npm</a> ·
|
|
14
|
+
<a href="https://pi.dev/packages/@quintinshaw/pi-dynamic-workflows">Pi package</a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
Turn one request into a JavaScript orchestration script that fans work out across isolated subagents, routes each task to the right model, cross-checks the results, and returns one synthesized answer. Intermediate work stays in script variables instead of filling your chat context.
|
|
18
|
+
|
|
19
|
+
Built for **codebase-wide audits, multi-perspective review, large refactors, and source-checked research**—the jobs that are too broad for one agent and one context window.
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+
|
|
23
|
+
## Start in 30 seconds
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pi install npm:@quintinshaw/pi-dynamic-workflows
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Run `/reload` in Pi, then ask naturally:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
Run a workflow to audit every route under src/routes/ for missing auth checks.
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Pi writes and starts the workflow in the background. A live panel tracks progress while you keep working, and the final result is delivered back into the conversation automatically.
|
|
36
|
+
|
|
37
|
+
Keyword triggering is on by default: use the bounded word **workflow** or **workflows** in a message to arm workflow mode — the assistant then handles a request by fanning it out across agents, but still answers plainly if you're only asking *about* workflows (the trigger authorizes the tool, it doesn't force it). Or run `/workflows run <prompt>` explicitly. Identifier-like text and paths such as `myworkflow`, `workflow_name`, and `src/workflow-editor.ts` do not trigger. You can change the keyword with `/workflows-trigger set pi-workflow` or disable it with `/workflows-trigger off`.
|
|
38
|
+
|
|
39
|
+
## How it works
|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
1. **Orchestrate** — Pi writes a deterministic JavaScript workflow with `agent()`, `parallel()`, `pipeline()`, and `phase()`.
|
|
44
|
+
2. **Fan out** — fresh subagent sessions run concurrently, optionally on different models or isolated git worktrees.
|
|
45
|
+
3. **Verify and return** — the workflow cross-checks findings, journals completed work for resume, and delivers one result.
|
|
46
|
+
|
|
47
|
+
The orchestration itself is plain JavaScript:
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
export const meta = {
|
|
51
|
+
name: 'auth_audit',
|
|
52
|
+
description: 'Find routes missing auth checks and verify the findings',
|
|
53
|
+
phases: [{ title: 'Scan' }, { title: 'Review' }, { title: 'Verify' }],
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
phase('Scan')
|
|
57
|
+
const files = await agent('List every route file under src/routes/.', { tier: 'small' })
|
|
58
|
+
|
|
59
|
+
phase('Review')
|
|
60
|
+
const findings = await parallel(
|
|
61
|
+
files.split('\n').filter(Boolean).map((file) =>
|
|
62
|
+
() => agent(`Audit ${file} for missing auth checks.`, {
|
|
63
|
+
tier: 'medium',
|
|
64
|
+
isolation: 'worktree',
|
|
65
|
+
}),
|
|
66
|
+
),
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
phase('Verify')
|
|
70
|
+
return await agent(
|
|
71
|
+
'Synthesize and double-check these findings:\n' + findings.join('\n\n'),
|
|
72
|
+
{ tier: 'big' },
|
|
73
|
+
)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Why use it
|
|
77
|
+
|
|
78
|
+
- **Real parallel orchestration** — fan out up to 16 concurrent and 1000 total subagents from one orchestration script.
|
|
79
|
+
- **Per-agent model routing** — use `small`, `medium`, or `big` tiers, or choose an exact provider/model and thinking level.
|
|
80
|
+
- **Journaled resume** — replay completed agents after interruption without rerunning them or spending their tokens again. The orchestrator can also resume with an **edited script** (`resumeFromRunId`): unchanged `agent()` calls replay from cache and only edited/new ones re-run — so a single bad prompt no longer means paying to re-run the whole workflow.
|
|
81
|
+
- **Git worktree isolation** — let parallel agents edit safely on throwaway branches with `isolation: "worktree"`.
|
|
82
|
+
- **Measured usage** — report real tokens and cost from each subagent session; add run, phase, or agent budgets only when you want them.
|
|
83
|
+
- **Visible background runs** — track phases, agents, models, fresh/cache tokens, cost, and live tok/s from the progress panel or `/workflows` navigator.
|
|
84
|
+
- **Quality patterns** — compose `verify()`, `judgePanel()`, `loopUntilDry()`, and `completenessCheck()` instead of rebuilding review loops.
|
|
85
|
+
- **Reusable workflows** — save any run as a command and call saved workflows from other workflows.
|
|
86
|
+
|
|
87
|
+
## Supported workflow capabilities
|
|
88
|
+
|
|
89
|
+
The installed extension generates this compact index from its executable capability contract. Read the [workflow authoring guide](docs/workflow-authoring.md) or use the packaged `workflow-authoring` skill for constraints, lifecycle guidance, and adaptable examples; configured route and agent-type values remain environment-specific.
|
|
90
|
+
|
|
91
|
+
<!-- BEGIN GENERATED SUPPORTED WORKFLOW CAPABILITIES -->
|
|
92
|
+
| Name | Classification | Signature | Options and defaults |
|
|
93
|
+
| --- | --- | --- | --- |
|
|
94
|
+
| agent | runtime-global | `agent(prompt, options?) => Promise<string \| structured value \| null>` | `label`: string (optional; default: derived from phase and call count)<br>`phase`: string (optional; default: current phase)<br>`schema`: plain JSON Schema (optional)<br>`model`: string (optional)<br>`tier`: string (optional)<br>`isolation`: "worktree" (optional)<br>`agentType`: string (optional)<br>`timeoutMs`: number \| null (optional; default: run timeout; null disables)<br>`retries`: number (optional; default: run retry count) |
|
|
95
|
+
| parallel | runtime-global | `parallel(thunks) => Promise<Array<unknown \| null>>` | — |
|
|
96
|
+
| pipeline | runtime-global | `pipeline(items, ...stages) => Promise<Array<unknown \| null>>` | — |
|
|
97
|
+
| workflow | runtime-global | `workflow(savedName, childArgs?) => Promise<unknown>` | — |
|
|
98
|
+
| verify | runtime-global | `verify(item: unknown, options?: { reviewers?: number; threshold?: number; lens?: string \| string[] }) => Promise<{ real: boolean; realCount: number; total: number; votes: Array<{ real: boolean; reason?: string }> }>` | `reviewers`: number (optional; default: 2)<br>`threshold`: number (optional; default: 0.5)<br>`lens`: string \| string[] (optional) |
|
|
99
|
+
| judgePanel | runtime-global | `judgePanel(attempts: unknown[], options?: { judges?: number; rubric?: string }) => Promise<{ index: number; attempt: unknown; score: number; judgments: Array<{ score: number; reason?: string }> } \| undefined>` | `judges`: number (optional; default: 3)<br>`rubric`: string (optional; default: "overall quality and correctness") |
|
|
100
|
+
| loopUntilDry | runtime-global | `loopUntilDry(options: { round: (roundIndex: number) => unknown[] \| Promise<unknown[]>; key?: (item: unknown) => string; consecutiveEmpty?: number; maxRounds?: number }) => Promise<unknown[]>` | `round`: (roundIndex: number) => unknown[] \| Promise<unknown[]> (required)<br>`key`: (item: unknown) => string (optional; default: JSON.stringify)<br>`consecutiveEmpty`: number (optional; default: 2)<br>`maxRounds`: number (optional; default: 50) |
|
|
101
|
+
| completenessCheck | runtime-global | `completenessCheck(taskArgs: unknown, results: unknown) => Promise<{ complete: boolean; missing?: string[] } \| null>` | — |
|
|
102
|
+
| retry | runtime-global | `retry(thunk: (attempt: number) => unknown \| Promise<unknown>, options?: { attempts?: number; until?: (result: unknown) => boolean }) => Promise<unknown>` | `attempts`: number (optional; default: 3)<br>`until`: (result: unknown) => boolean (optional; default: accept first result when omitted) |
|
|
103
|
+
| gate | runtime-global | `gate(thunk: (feedback: string \| undefined, attempt: number) => unknown \| Promise<unknown>, validator: (value: unknown) => { ok: boolean; feedback?: string } \| Promise<{ ok: boolean; feedback?: string }>, options?: { attempts?: number }) => Promise<{ ok: boolean; value: unknown; attempts: number }>` | `attempts`: number (optional; default: 3) |
|
|
104
|
+
| checkpoint | runtime-global | `checkpoint(prompt, options?) => Promise<unknown>` | `default`: unknown (optional; default: true when no UI and omitted)<br>`headless`: "default" \| "abort" (optional; default: "default")<br>`kind`: "confirm" \| "input" \| "select" (optional; default: "confirm")<br>`choices`: string[] (optional)<br>`timeoutMs`: number (optional) |
|
|
105
|
+
| log | runtime-global | `log(message) => void` | — |
|
|
106
|
+
| phase | runtime-global | `phase(title, options?) => void` | `budget`: number (optional) |
|
|
107
|
+
| args | runtime-global | `args: unknown` | — |
|
|
108
|
+
| cwd | runtime-global | `cwd: string` | — |
|
|
109
|
+
| process | runtime-global | `process: { cwd(): string }` | — |
|
|
110
|
+
| budget | runtime-global | `budget: { total, spent(), remaining() }` | — |
|
|
111
|
+
| script | workflow-tool-input | `script?: string` | — |
|
|
112
|
+
| name | workflow-tool-input | `name?: string` | — |
|
|
113
|
+
| args | workflow-tool-input | `args?: unknown` | — |
|
|
114
|
+
| background | workflow-tool-input | `background?: boolean = true` | — |
|
|
115
|
+
| maxAgents | workflow-tool-input | `maxAgents?: number = 1000` | — |
|
|
116
|
+
| concurrency | workflow-tool-input | `concurrency?: number` | — |
|
|
117
|
+
| agentRetries | workflow-tool-input | `agentRetries?: number = configured value or 0` | — |
|
|
118
|
+
| agentTimeoutMs | workflow-tool-input | `agentTimeoutMs?: number = configured default or unbounded` | — |
|
|
119
|
+
| tokenBudget | workflow-tool-input | `tokenBudget?: number = configured default or unlimited` | — |
|
|
120
|
+
| resumeFromRunId | workflow-tool-input | `resumeFromRunId?: string` | — |
|
|
121
|
+
<!-- END GENERATED SUPPORTED WORKFLOW CAPABILITIES -->
|
|
122
|
+
|
|
123
|
+
## Built-in workflows
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
/deep-research <question> source-checked web research with citations
|
|
127
|
+
/adversarial-review <task> findings challenged by skeptical reviewers
|
|
128
|
+
/multi-perspective "<topic>" [angle …]
|
|
129
|
+
independent angles followed by synthesis
|
|
130
|
+
/code-review [target] 7 parallel review angles plus verification
|
|
131
|
+
/codebase-audit <scope> "<check>" …
|
|
132
|
+
parallel checks followed by cross-validation
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
`/code-review` defaults to the current working diff. It also accepts a git range, a file, or a GitHub PR number:
|
|
136
|
+
|
|
137
|
+
```text
|
|
138
|
+
/code-review
|
|
139
|
+
/code-review HEAD~3..HEAD
|
|
140
|
+
/code-review src/foo.ts
|
|
141
|
+
/code-review 42
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
For an always-on exhaustive mode, use `/ultracode`; `/effort high` is the lighter standing option.
|
|
145
|
+
|
|
146
|
+
These same 5 patterns are also reachable by name without a slash command — Pi can recognize a decomposable request and run the matching curated pattern directly:
|
|
147
|
+
|
|
148
|
+
```text
|
|
149
|
+
Do a deep-research on whether Bun's test runner is production-ready.
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
is equivalent to `/deep-research "..."`. A saved workflow always wins over a built-in of the same name, on both the slash-command and natural-language paths — so saving your own `code-review` shadows the built-in one everywhere.
|
|
153
|
+
|
|
154
|
+
## Commands and run control
|
|
155
|
+
|
|
156
|
+
Pi can manage background runs directly with the `workflow_control` tool instead of asking you to type a command. It supports `list`, `status`, `pause`, `resume`, and `stop`; run-specific actions use the canonical run ID returned when the workflow starts. Status output includes the run state, current phase, agent counts, active labels, and recorded token total.
|
|
157
|
+
|
|
158
|
+
| Command | Purpose |
|
|
159
|
+
| --- | --- |
|
|
160
|
+
| `/workflows` | Open the interactive run navigator |
|
|
161
|
+
| `/workflows run <prompt>` | Arm workflow mode for a prompt even when keyword triggering is off |
|
|
162
|
+
| `/workflows status <id>` | Watch a run and print its result when complete |
|
|
163
|
+
| `/workflows pause\|resume\|stop\|rm <id>` | Control a run |
|
|
164
|
+
| `/workflows save <name>` | Save the latest script as a reusable command |
|
|
165
|
+
| `/workflows-trigger off\|on\|status` | Control automatic keyword triggering |
|
|
166
|
+
| `/workflows-trigger set <word>\|reset` | Set or reset the trigger word |
|
|
167
|
+
| `/workflows-progress compact\|detailed\|status\|max <N>` | Live-panel detail level (and max agents shown per phase in detailed mode) |
|
|
168
|
+
| `/workflows-models` | Map model tiers and thinking levels |
|
|
169
|
+
| `/ultracode [off]` | Toggle exhaustive automatic workflows |
|
|
170
|
+
| `/effort off\|high\|ultra` | Set the standing orchestration effort |
|
|
171
|
+
|
|
172
|
+
In the navigator: `↑/↓` select · `enter/→` open · `esc/←` back · `p` pause · `x` stop · `r` restart · `s` save · `q` quit.
|
|
173
|
+
|
|
174
|
+
Agent details use a compact summary by default: completed agents show their final result, while active agents show the prompt and two latest history events. Press `enter` to open the full syntax-highlighted pager. In the pager, use `j/k` or `↑/↓` for lines, `PgUp/PgDn` for pages, `g/G` for the ends, and `t` to toggle live tail mode.
|
|
175
|
+
|
|
176
|
+
## Runtime reference
|
|
177
|
+
|
|
178
|
+
| Global | What it does |
|
|
179
|
+
| --- | --- |
|
|
180
|
+
| `agent(prompt, opts)` | Spawn an isolated subagent; optionally validate its result with JSON Schema |
|
|
181
|
+
| `parallel(thunks)` | Run `() => agent(...)` thunks concurrently and preserve input order |
|
|
182
|
+
| `pipeline(items, ...stages)` | Fan items through sequential stages |
|
|
183
|
+
| `phase(title, { budget? })` | Group work in the live view and optionally set a phase budget |
|
|
184
|
+
| `verify` / `judgePanel` | Cross-check a result or choose the best candidate |
|
|
185
|
+
| `loopUntilDry` / `completenessCheck` | Repeat discovery until no new findings remain |
|
|
186
|
+
| `workflow(name, args)` | Run a saved workflow inline |
|
|
187
|
+
| `checkpoint(prompt, opts)` | Add a journaled human-approval gate |
|
|
188
|
+
| `budget` | Inspect real tokens spent and remaining |
|
|
189
|
+
|
|
190
|
+
| Agent option | Description |
|
|
191
|
+
| --- | --- |
|
|
192
|
+
| `tier` | `small`, `medium`, or `big` model routing |
|
|
193
|
+
| `model` | Exact `provider/modelId` or `provider/modelId:thinking`; overrides `tier` |
|
|
194
|
+
| `agentType` | Named role, tool, and model definition |
|
|
195
|
+
| `isolation` | Use `"worktree"` for conflict-free parallel edits |
|
|
196
|
+
| `schema` | JSON Schema for a validated structured result |
|
|
197
|
+
| `label` / `phase` | Display label and phase override |
|
|
198
|
+
| `timeoutMs` / `retries` | Optional per-agent timeout and recoverable-failure retries |
|
|
199
|
+
|
|
200
|
+
The [full documentation](https://quintinshaw.github.io/pi-dynamic-workflows/) covers every option, structured output, determinism, saved workflows, and operational control.
|
|
201
|
+
|
|
202
|
+
<details>
|
|
203
|
+
<summary><strong>Model tiers and run controls</strong></summary>
|
|
204
|
+
|
|
205
|
+
Model tiers live at `~/.pi/workflows/model-tiers.json` and accept Pi CLI-style thinking suffixes:
|
|
206
|
+
|
|
207
|
+
```json
|
|
208
|
+
{
|
|
209
|
+
"tiers": {
|
|
210
|
+
"small": "openai-codex/gpt-5.4-mini:low",
|
|
211
|
+
"medium": "openai-codex/gpt-5.4:medium",
|
|
212
|
+
"big": "openai-codex/gpt-5.5:xhigh"
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Use `/workflows-models` to edit them interactively. Without a config, the extension ranks authenticated models by capability hints and assigns distinct models when possible.
|
|
218
|
+
|
|
219
|
+
Omitted `tokenBudget` and `agentTimeoutMs` values use configured `defaultTokenBudget` and `defaultAgentTimeoutMs` settings; without them, runs are unlimited and have no hard per-agent timeout. Add per-run or per-agent values when you need explicit gates. `concurrency` is clamped to 16; `agentRetries` retries only recoverable failures. Defaults live in `~/.pi/workflows/settings.json`; `defaultTokenBudget` is a soft pre-call gate, and a project-level override of `null` cancels a global budget.
|
|
220
|
+
|
|
221
|
+
Pausing and resuming a run keeps the limits it started with — `maxAgents`, `agentTimeoutMs`, `concurrency`, and `agentRetries` carry over instead of falling back to defaults, and `tokenBudget` tracking is cumulative across the pause, so a run can't reset its spend by pausing and resuming.
|
|
222
|
+
|
|
223
|
+
</details>
|
|
224
|
+
|
|
225
|
+
<details>
|
|
226
|
+
<summary><strong>Storage, resume, and persisted sessions</strong></summary>
|
|
227
|
+
|
|
228
|
+
Extension state lives outside the repository under `~/.pi/workflows`:
|
|
229
|
+
|
|
230
|
+
- global settings and tiers: `~/.pi/workflows/settings.json` and `model-tiers.json`
|
|
231
|
+
- project runs, journals, locks, and saved overrides: `~/.pi/workflows/projects/<project>/`
|
|
232
|
+
- older project-local `.pi/workflows/runs` and `.pi/workflows/saved` remain readable as fallbacks
|
|
233
|
+
|
|
234
|
+
Subagents are in-memory by default. Set `persistAgentSessions: true` to retain full transcripts in Pi's standard session directory. This creates one file per agent and may store sensitive material that an agent read, so enable it deliberately.
|
|
235
|
+
|
|
236
|
+
Completed background runs persist their full result in the project run JSON. The conversation delivery includes a pointer to that file when the visible summary is shortened.
|
|
237
|
+
|
|
238
|
+
Pi's `/reload` keeps the live workflow manager in-process when the installed extension version has not changed. Active background runs therefore continue streaming progress, remain controllable, and deliver their result through the freshly loaded extension; session-local `/effort` also survives the reload. If the package version changes, active runs are paused and a fresh manager loads, leaving them safely resumable through the journal instead of mixing extension versions. This handoff applies only to `/reload`. A process restart still uses the same durable journal path, recovering an interrupted running workflow as paused so it can be resumed safely.
|
|
239
|
+
|
|
240
|
+
Finished runs (completed, failed, or aborted) are retained in full on disk, capped at the 300 most recent per project — older ones are evicted first, and a running or paused run is never touched. Only a smaller number (20 by default) also stay fully loaded in memory for instant access right after they finish; older finished runs still show up in `/workflows` and `workflow_control list`, just read back from disk instead of memory. Library embedders can tune both caps — `maxTerminalRunsInMemory` on `WorkflowManager` and `maxTerminalRunsOnDisk` on the run-persistence layer.
|
|
241
|
+
|
|
242
|
+
</details>
|
|
243
|
+
|
|
244
|
+
<details>
|
|
245
|
+
<summary><strong>Keyword trigger</strong></summary>
|
|
246
|
+
|
|
247
|
+
Set a literal, case-insensitive custom trigger in `~/.pi/workflows/settings.json`:
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{
|
|
251
|
+
"keywordTriggerWord": "pi-workflow"
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
The default `workflow` also matches `workflows`; a custom word matches exactly. Trigger words are case-insensitive and Unicode identifier-bounded, and do not activate inside paths, slash commands, or identifier-like text. Detection is purely textual, applied at submit time to the message you send — it does not depend on, or own, Pi's editor component, so it works the same regardless of what else is installed.
|
|
256
|
+
|
|
257
|
+
</details>
|
|
258
|
+
|
|
259
|
+
<details>
|
|
260
|
+
<summary><strong>How it maps to Claude Code dynamic workflows</strong></summary>
|
|
261
|
+
|
|
262
|
+
| Claude Code dynamic workflows | pi-dynamic-workflows on Pi |
|
|
263
|
+
| --- | --- |
|
|
264
|
+
| Code-mode orchestration | JavaScript `agent()` / `parallel()` / `pipeline()` / `phase()` in a VM realm (for determinism, not a security boundary) |
|
|
265
|
+
| Isolated subagent contexts | Fresh in-memory Pi sessions; results remain in variables |
|
|
266
|
+
| Structured outputs | JSON Schema validation with bounded repair |
|
|
267
|
+
| Background runs | Non-blocking run, live panel, and automatic result delivery |
|
|
268
|
+
| Resume | Journaled replay of the unchanged completed prefix, including edit-and-resume with a revised script (`resumeFromRunId`) |
|
|
269
|
+
| Model selection | Per-agent and per-phase routing across authenticated providers |
|
|
270
|
+
| Ultracode | `/ultracode` or `/effort ultra` |
|
|
271
|
+
| Additional Pi features | Worktree isolation, real cost accounting, deep research, and quality-pattern helpers |
|
|
272
|
+
|
|
273
|
+
</details>
|
|
274
|
+
|
|
275
|
+
## Determinism and limits
|
|
276
|
+
|
|
277
|
+
Workflow scripts run in a Node `vm` sandbox. `Date.now()`, `Math.random()`, `new Date()`, `require`, `import`, filesystem access, and network access are unavailable inside the orchestration script. Subagents use their assigned tools; keeping the orchestrator deterministic is what makes journal replay reliable.
|
|
278
|
+
|
|
279
|
+
Journal replay — including edit-and-resume via `resumeFromRunId` — matches cached agent results by **positional call index** (the order in which `agent()` calls execute), the same contract Claude Code uses. Editing an `agent()` prompt in place reuses the cache up to that call and re-runs it and everything after. Inserting, removing, or reordering an `agent()` call before others shifts their positions and invalidates the cache from that point on (mismatched calls simply re-run — no crash). To preserve the cached prefix, keep the earlier still-good `agent()` calls unchanged and in the same order.
|
|
280
|
+
|
|
281
|
+
## Upgrading to 3.0
|
|
282
|
+
|
|
283
|
+
3.0 is a milestone release. The one behavior change to know about:
|
|
284
|
+
|
|
285
|
+
- **Keyword triggering now _authorizes_ the workflow tool instead of _forcing_ it.** In 2.x, typing the trigger word (default `workflow`) rewrote your message into a directive that forced a background workflow. In 3.0 it _arms_ the tool and the model decides: a real, decomposable request is fanned out across agents, but a message that only mentions workflows — a question, a filename, a passing reference — is answered normally. Nothing to configure. If you relied on the word always kicking off a run, use `/workflows run <prompt>` for the explicit path. Keyword triggering stays on by default; `/workflows-trigger off` disables it and `/workflows-trigger set <word>` changes the word.
|
|
286
|
+
|
|
287
|
+
Everything else is additive or a fix: the `workflow_control` tool (list/status/pause/resume/stop), edited-script resume, auto-resume on provider usage limits, and persistence/perf hardening. Requires pi ≥ 0.80.8.
|
|
288
|
+
|
|
289
|
+
Library API note: the unused `createSharedStoreTools` export was removed — use `createAgentStoreTools`.
|
|
290
|
+
|
|
291
|
+
## Upgrading past 3.2
|
|
292
|
+
|
|
293
|
+
Two behavior changes to know about:
|
|
294
|
+
|
|
295
|
+
- **Subagents no longer load host extensions by default.** Each run now builds one shared, extension-free resource loader for all of its subagents (a memory-leak mitigation). Skills, prompts, and `AGENTS.md` context still load, and the coding tools and any toolset (e.g. `web-research`) you hand a subagent are unaffected. What subagents lose is **host-extension-registered tools** — MCP bridges, browser tools, or anything else another installed extension adds. If an `agentType` names one of those tools in its allowlist, that entry now matches nothing. This also means a subagent can no longer recurse into another orchestration extension, even one not covered by the existing tool denylist.
|
|
296
|
+
- **Checkpoints persisted before this release re-run once.** `checkpoint()`'s resume-identity hash now also covers `default`, `headless`, and `timeoutMs`, so changing any of them between runs correctly invalidates a stale cached answer. This is a one-time effect: any checkpoint cached under the old hash simply re-prompts once and then caches normally again.
|
|
297
|
+
|
|
298
|
+
## Development
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
npm install
|
|
302
|
+
npm test # Biome, TypeScript, unit tests, and release checks
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Optional model-comprehension evidence
|
|
306
|
+
|
|
307
|
+
The comprehension harness is manual and never runs in normal CI, `npm test`, or the release gate. Select an available model explicitly; the harness never embeds or chooses from a static model or agent-type catalogue.
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
npm run comprehension -- --model provider/model # quick writing scenario
|
|
311
|
+
npm run comprehension -- --model provider/model --suite full # write, edit, review, and debug
|
|
312
|
+
npm run comprehension -- --model provider/model --output runs/a.json
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
By default, evidence is written under ignored `.pi/model-comprehension/`. Each JSON run records the exact prompts and versions, generated workflows, skill reads, provider token usage, deterministic runtime calls/topology/results, assertions, and failure details. Scenario failures are retained as non-blocking evidence and do not produce a failing exit status; argument, model-selection, and setup errors do.
|
|
316
|
+
|
|
317
|
+
Features are also verified end-to-end against real Pi subagent sessions before release. See [CONTRIBUTING.md](./CONTRIBUTING.md) to contribute.
|
|
318
|
+
|
|
319
|
+
## Credits
|
|
320
|
+
|
|
321
|
+
The code-mode orchestration idea comes from [Michael Livs' original pi-dynamic-workflows](https://github.com/Michaelliv/pi-dynamic-workflows) and Anthropic's [dynamic workflows in Claude Code](https://claude.com/blog/introducing-dynamic-workflows-in-claude-code). This project adds model routing, journaled resume, worktree isolation, measured usage, an interactive TUI, and built-in research and review workflows.
|
|
322
|
+
|
|
323
|
+
## License
|
|
324
|
+
|
|
325
|
+
MIT — see [LICENSE](./LICENSE).
|
|
Binary file
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="420" viewBox="0 0 1200 420" role="img" aria-labelledby="title desc">
|
|
2
|
+
<title id="title">pi-dynamic-workflows</title>
|
|
3
|
+
<desc id="desc">One prompt fans out to small, medium, and big Pi agents before returning one verified result.</desc>
|
|
4
|
+
|
|
5
|
+
<defs>
|
|
6
|
+
<pattern id="grid" width="44" height="44" patternUnits="userSpaceOnUse">
|
|
7
|
+
<path d="M44 0H0V44" fill="none" stroke="#273045" stroke-width="1"/>
|
|
8
|
+
</pattern>
|
|
9
|
+
<linearGradient id="title-accent" x1="0" y1="0" x2="1" y2="0">
|
|
10
|
+
<stop offset="0" stop-color="#61D2B4"/>
|
|
11
|
+
<stop offset="1" stop-color="#85E3CA"/>
|
|
12
|
+
</linearGradient>
|
|
13
|
+
</defs>
|
|
14
|
+
|
|
15
|
+
<rect width="1200" height="420" rx="28" fill="#111827"/>
|
|
16
|
+
<rect width="1200" height="420" rx="28" fill="url(#grid)" opacity=".58"/>
|
|
17
|
+
<circle cx="1160" cy="16" r="116" fill="#FF725E" opacity=".10"/>
|
|
18
|
+
<circle cx="1080" cy="420" r="126" fill="#61D2B4" opacity=".08"/>
|
|
19
|
+
|
|
20
|
+
<g id="title-block" transform="translate(62 58)">
|
|
21
|
+
<text x="0" y="0" fill="#AAB3C6" font-size="15" font-weight="700" letter-spacing="3" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, sans-serif">ONE PROMPT · MANY AGENTS</text>
|
|
22
|
+
<rect x="0" y="20" width="56" height="6" rx="3" fill="#FF725E"/>
|
|
23
|
+
<text x="0" y="103" fill="#F6F0E5" font-size="64" font-weight="800" letter-spacing="-2" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, sans-serif">pi-dynamic-</text>
|
|
24
|
+
<text x="0" y="168" fill="#F6F0E5" font-size="64" font-weight="800" letter-spacing="-2" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, sans-serif">workflows</text>
|
|
25
|
+
<rect x="0" y="184" width="400" height="10" rx="5" fill="url(#title-accent)"/>
|
|
26
|
+
<text x="0" y="235" fill="#D7DCE7" font-size="22" font-weight="600" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, sans-serif">Fan out. Route models. Cross-check.</text>
|
|
27
|
+
<text x="0" y="267" fill="#D7DCE7" font-size="22" font-weight="600" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, sans-serif">Return one result.</text>
|
|
28
|
+
<text x="0" y="316" fill="#8F9AAF" font-size="14" font-weight="700" letter-spacing="2" font-family="ui-monospace, SFMono-Regular, Menlo, monospace">JOURNALED RESUME · WORKTREE ISOLATION · REAL USAGE</text>
|
|
29
|
+
</g>
|
|
30
|
+
|
|
31
|
+
<g id="agent-cards">
|
|
32
|
+
<g transform="translate(745 55) rotate(5 160 64)">
|
|
33
|
+
<rect x="9" y="10" width="320" height="128" rx="20" fill="#05070B" opacity=".30"/>
|
|
34
|
+
<rect width="320" height="128" rx="20" fill="#F6F0E5"/>
|
|
35
|
+
<rect x="22" y="20" width="48" height="6" rx="3" fill="#FF725E"/>
|
|
36
|
+
<text x="22" y="52" fill="#111827" font-size="14" font-weight="800" font-family="ui-monospace, SFMono-Regular, Menlo, monospace">SMALL / SCAN</text>
|
|
37
|
+
<rect x="22" y="69" width="276" height="38" rx="9" fill="#172133"/>
|
|
38
|
+
<path d="M40 81l8 7-8 7" fill="none" stroke="#61D2B4" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
|
|
39
|
+
<path d="M58 94h86" stroke="#9FABC0" stroke-width="6" stroke-linecap="round"/>
|
|
40
|
+
<circle cx="279" cy="88" r="5" fill="#61D2B4"/>
|
|
41
|
+
</g>
|
|
42
|
+
|
|
43
|
+
<g transform="translate(678 181) rotate(-5 170 68)">
|
|
44
|
+
<rect x="9" y="10" width="340" height="136" rx="20" fill="#05070B" opacity=".26"/>
|
|
45
|
+
<rect width="340" height="136" rx="20" fill="#61D2B4"/>
|
|
46
|
+
<text x="24" y="39" fill="#12322D" font-size="14" font-weight="800" font-family="ui-monospace, SFMono-Regular, Menlo, monospace">MEDIUM / REVIEW</text>
|
|
47
|
+
<text x="24" y="76" fill="#10231F" font-size="24" font-weight="800" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, sans-serif">Parallel specialists</text>
|
|
48
|
+
<g transform="translate(24 93)">
|
|
49
|
+
<rect width="72" height="24" rx="7" fill="#F6F0E5"/>
|
|
50
|
+
<rect x="82" width="72" height="24" rx="7" fill="#111827"/>
|
|
51
|
+
<rect x="164" width="72" height="24" rx="7" fill="#6C5CE7"/>
|
|
52
|
+
<circle cx="18" cy="12" r="5" fill="#FF725E"/>
|
|
53
|
+
<circle cx="100" cy="12" r="5" fill="#61D2B4"/>
|
|
54
|
+
<circle cx="182" cy="12" r="5" fill="#F6F0E5"/>
|
|
55
|
+
</g>
|
|
56
|
+
</g>
|
|
57
|
+
|
|
58
|
+
<g transform="translate(908 264) rotate(5 128 64)">
|
|
59
|
+
<rect x="9" y="10" width="256" height="128" rx="20" fill="#05070B" opacity=".30"/>
|
|
60
|
+
<rect width="256" height="128" rx="20" fill="#6C5CE7"/>
|
|
61
|
+
<text x="22" y="35" fill="#E6E0FF" font-size="13" font-weight="800" font-family="ui-monospace, SFMono-Regular, Menlo, monospace">BIG / SYNTHESIZE</text>
|
|
62
|
+
<path d="M32 86H73L94 66 126 94 157 61 202 86" fill="none" stroke="#F6F0E5" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
|
63
|
+
<circle cx="32" cy="86" r="9" fill="#61D2B4"/>
|
|
64
|
+
<circle cx="94" cy="66" r="9" fill="#FF725E"/>
|
|
65
|
+
<circle cx="126" cy="94" r="9" fill="#FFD166"/>
|
|
66
|
+
<circle cx="157" cy="61" r="9" fill="#F6F0E5"/>
|
|
67
|
+
<circle cx="202" cy="86" r="11" fill="#111827" stroke="#F6F0E5" stroke-width="3"/>
|
|
68
|
+
</g>
|
|
69
|
+
</g>
|
|
70
|
+
</svg>
|
|
Binary file
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="750" viewBox="0 0 1200 750" role="img" aria-labelledby="title desc">
|
|
2
|
+
<title id="title">pi-dynamic-workflows package cover</title>
|
|
3
|
+
<desc id="desc">A Pi extension that routes one prompt through parallel small, medium, and big agents and returns a verified result.</desc>
|
|
4
|
+
<defs>
|
|
5
|
+
<pattern id="grid" width="48" height="48" patternUnits="userSpaceOnUse">
|
|
6
|
+
<path d="M48 0H0V48" fill="none" stroke="#273045" stroke-width="1"/>
|
|
7
|
+
</pattern>
|
|
8
|
+
<linearGradient id="accent" x1="0" y1="0" x2="1" y2="0">
|
|
9
|
+
<stop offset="0" stop-color="#61D2B4"/>
|
|
10
|
+
<stop offset="1" stop-color="#85E3CA"/>
|
|
11
|
+
</linearGradient>
|
|
12
|
+
</defs>
|
|
13
|
+
|
|
14
|
+
<rect width="1200" height="750" rx="32" fill="#111827"/>
|
|
15
|
+
<rect width="1200" height="750" rx="32" fill="url(#grid)" opacity=".58"/>
|
|
16
|
+
<circle cx="1164" cy="16" r="150" fill="#FF725E" opacity=".11"/>
|
|
17
|
+
<circle cx="44" cy="742" r="170" fill="#61D2B4" opacity=".08"/>
|
|
18
|
+
|
|
19
|
+
<g transform="translate(68 62)" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, sans-serif">
|
|
20
|
+
<text x="0" y="16" fill="#AAB3C6" font-size="16" font-weight="800" letter-spacing="3">PI EXTENSION · MULTI-AGENT ORCHESTRATION</text>
|
|
21
|
+
<rect x="0" y="37" width="60" height="7" rx="3.5" fill="#FF725E"/>
|
|
22
|
+
<text x="0" y="126" fill="#F6F0E5" font-size="68" font-weight="800" letter-spacing="-2">pi-dynamic-workflows</text>
|
|
23
|
+
<rect x="0" y="149" width="510" height="10" rx="5" fill="url(#accent)"/>
|
|
24
|
+
<text x="0" y="207" fill="#D7DCE7" font-size="27" font-weight="650">One prompt. Routed agents. One checked result.</text>
|
|
25
|
+
</g>
|
|
26
|
+
|
|
27
|
+
<g transform="translate(68 340)" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, sans-serif">
|
|
28
|
+
<path d="M310 103H370 M680 103H740" stroke="#78849A" stroke-width="4"/>
|
|
29
|
+
<path d="M352 93l18 10-18 10M722 93l18 10-18 10" fill="none" stroke="#78849A" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
|
30
|
+
|
|
31
|
+
<g>
|
|
32
|
+
<rect x="10" y="12" width="300" height="206" rx="22" fill="#05070B" opacity=".34"/>
|
|
33
|
+
<rect width="300" height="206" rx="22" fill="#F6F0E5"/>
|
|
34
|
+
<text x="26" y="39" fill="#111827" font-size="15" font-weight="800" letter-spacing="1.5">01 / ORCHESTRATE</text>
|
|
35
|
+
<text x="26" y="84" fill="#111827" font-size="30" font-weight="800">Write the workflow</text>
|
|
36
|
+
<rect x="26" y="111" width="248" height="62" rx="10" fill="#172133"/>
|
|
37
|
+
<text x="43" y="137" fill="#61D2B4" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, monospace">parallel(agents)</text>
|
|
38
|
+
<text x="43" y="160" fill="#AAB3C6" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, monospace">verify(findings)</text>
|
|
39
|
+
</g>
|
|
40
|
+
|
|
41
|
+
<g transform="translate(370)">
|
|
42
|
+
<rect x="10" y="12" width="310" height="206" rx="22" fill="#05070B" opacity=".30"/>
|
|
43
|
+
<rect width="310" height="206" rx="22" fill="#61D2B4"/>
|
|
44
|
+
<text x="26" y="39" fill="#15463D" font-size="15" font-weight="800" letter-spacing="1.5">02 / FAN OUT</text>
|
|
45
|
+
<text x="26" y="84" fill="#102D28" font-size="30" font-weight="800">Route by model</text>
|
|
46
|
+
<g transform="translate(26 108)" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" font-size="13" font-weight="700">
|
|
47
|
+
<rect width="258" height="25" rx="7" fill="#F6F0E5"/><text x="13" y="17" fill="#16342F">small · scan</text>
|
|
48
|
+
<rect y="32" width="258" height="25" rx="7" fill="#111827"/><text x="13" y="49" fill="#F6F0E5">medium · review</text>
|
|
49
|
+
<rect y="64" width="258" height="25" rx="7" fill="#6C5CE7"/><text x="13" y="81" fill="#F6F0E5">big · synthesize</text>
|
|
50
|
+
</g>
|
|
51
|
+
</g>
|
|
52
|
+
|
|
53
|
+
<g transform="translate(740)">
|
|
54
|
+
<rect x="10" y="12" width="320" height="206" rx="22" fill="#05070B" opacity=".30"/>
|
|
55
|
+
<rect width="320" height="206" rx="22" fill="#6C5CE7"/>
|
|
56
|
+
<text x="26" y="39" fill="#E6E0FF" font-size="15" font-weight="800" letter-spacing="1.5">03 / RETURN</text>
|
|
57
|
+
<text x="26" y="84" fill="#F6F0E5" font-size="30" font-weight="800">Verified result</text>
|
|
58
|
+
<circle cx="67" cy="143" r="28" fill="#111827"/>
|
|
59
|
+
<path d="M53 143l9 9 20-22" fill="none" stroke="#61D2B4" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
60
|
+
<text x="110" y="137" fill="#F6F0E5" font-size="15" font-weight="800">JOURNALED</text>
|
|
61
|
+
<text x="110" y="161" fill="#DCD5FF" font-size="14">resumable without reruns</text>
|
|
62
|
+
</g>
|
|
63
|
+
</g>
|
|
64
|
+
|
|
65
|
+
<text x="68" y="699" fill="#8F9AAF" font-size="15" font-weight="700" letter-spacing="2.2" font-family="ui-monospace, SFMono-Regular, Menlo, monospace">MODEL ROUTING · WORKTREE ISOLATION · REAL TOKEN & COST ACCOUNTING</text>
|
|
66
|
+
</svg>
|
|
Binary file
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="460" viewBox="0 0 1200 460" role="img" aria-labelledby="title desc">
|
|
2
|
+
<title id="title">How pi-dynamic-workflows orchestrates a task</title>
|
|
3
|
+
<desc id="desc">A task becomes deterministic orchestration, runs through parallel routed agents, then passes a verification gate before one result is returned.</desc>
|
|
4
|
+
|
|
5
|
+
<defs>
|
|
6
|
+
<pattern id="grid" width="46" height="46" patternUnits="userSpaceOnUse">
|
|
7
|
+
<path d="M46 0H0V46" fill="none" stroke="#D9D3C8" stroke-width="1"/>
|
|
8
|
+
</pattern>
|
|
9
|
+
<marker id="arrow" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6" markerHeight="6" orient="auto">
|
|
10
|
+
<path d="M0 0l10 5-10 5z" fill="#495266"/>
|
|
11
|
+
</marker>
|
|
12
|
+
</defs>
|
|
13
|
+
|
|
14
|
+
<rect width="1200" height="460" rx="28" fill="#F6F0E5"/>
|
|
15
|
+
<rect width="1200" height="460" rx="28" fill="url(#grid)" opacity=".52"/>
|
|
16
|
+
|
|
17
|
+
<g id="heading" transform="translate(54 44)" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, sans-serif">
|
|
18
|
+
<text x="0" y="15" fill="#687286" font-size="14" font-weight="800" letter-spacing="3">A DETERMINISTIC PATH THROUGH PARALLEL WORK</text>
|
|
19
|
+
<rect x="0" y="33" width="54" height="6" rx="3" fill="#FF725E"/>
|
|
20
|
+
<text x="0" y="89" fill="#111827" font-size="36" font-weight="800" letter-spacing="-1">One task. Coordinated agents. One checked result.</text>
|
|
21
|
+
</g>
|
|
22
|
+
|
|
23
|
+
<g id="flow" transform="translate(48 172)" font-family="-apple-system, BlinkMacSystemFont, Segoe UI, sans-serif">
|
|
24
|
+
<path d="M250 126H278 M536 126H564 M822 126H850" fill="none" stroke="#495266" stroke-width="3" marker-end="url(#arrow)"/>
|
|
25
|
+
|
|
26
|
+
<g id="prompt-card">
|
|
27
|
+
<rect x="7" y="8" width="246" height="252" rx="18" fill="#AAA49B" opacity=".28"/>
|
|
28
|
+
<rect width="246" height="252" rx="18" fill="#111827"/>
|
|
29
|
+
<text x="22" y="33" fill="#61D2B4" font-size="13" font-weight="800" letter-spacing="1.4">01 / PROMPT</text>
|
|
30
|
+
<text x="22" y="75" fill="#F6F0E5" font-size="24" font-weight="800">Describe</text>
|
|
31
|
+
<text x="22" y="104" fill="#F6F0E5" font-size="24" font-weight="800">the task</text>
|
|
32
|
+
<rect x="22" y="130" width="202" height="76" rx="10" fill="#1E293B"/>
|
|
33
|
+
<text x="36" y="159" fill="#AAB3C6" font-size="13" font-family="ui-monospace, SFMono-Regular, Menlo, monospace">audit every route</text>
|
|
34
|
+
<text x="36" y="183" fill="#AAB3C6" font-size="13" font-family="ui-monospace, SFMono-Regular, Menlo, monospace">for missing auth</text>
|
|
35
|
+
<circle cx="216" cy="226" r="5" fill="#61D2B4"/>
|
|
36
|
+
</g>
|
|
37
|
+
|
|
38
|
+
<g id="orchestrate-card" transform="translate(286)">
|
|
39
|
+
<rect x="7" y="8" width="246" height="252" rx="18" fill="#AAA49B" opacity=".28"/>
|
|
40
|
+
<rect width="246" height="252" rx="18" fill="#DCD5FF"/>
|
|
41
|
+
<text x="22" y="33" fill="#5A49CB" font-size="13" font-weight="800" letter-spacing="1.4">02 / ORCHESTRATE</text>
|
|
42
|
+
<text x="22" y="75" fill="#171431" font-size="24" font-weight="800">Write the</text>
|
|
43
|
+
<text x="22" y="104" fill="#171431" font-size="24" font-weight="800">workflow</text>
|
|
44
|
+
<g transform="translate(22 139)" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" font-size="13">
|
|
45
|
+
<text x="0" y="0" fill="#5A49CB">phase</text><text x="46" y="0" fill="#4A4560">('Review')</text>
|
|
46
|
+
<text x="0" y="30" fill="#5A49CB">parallel</text><text x="65" y="30" fill="#4A4560">(agents)</text>
|
|
47
|
+
<text x="0" y="60" fill="#5A49CB">verify</text><text x="49" y="60" fill="#4A4560">(findings)</text>
|
|
48
|
+
</g>
|
|
49
|
+
</g>
|
|
50
|
+
|
|
51
|
+
<g id="fanout-card" transform="translate(572)">
|
|
52
|
+
<rect x="7" y="8" width="246" height="252" rx="18" fill="#AAA49B" opacity=".28"/>
|
|
53
|
+
<rect width="246" height="252" rx="18" fill="#61D2B4"/>
|
|
54
|
+
<text x="22" y="33" fill="#15463D" font-size="13" font-weight="800" letter-spacing="1.4">03 / FAN OUT</text>
|
|
55
|
+
<text x="22" y="75" fill="#102D28" font-size="24" font-weight="800">Route parallel</text>
|
|
56
|
+
<text x="22" y="104" fill="#102D28" font-size="24" font-weight="800">agents</text>
|
|
57
|
+
<g transform="translate(22 130)" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" font-size="12" font-weight="700">
|
|
58
|
+
<rect width="202" height="28" rx="7" fill="#F6F0E5"/><text x="12" y="19" fill="#16342F">small · scan</text>
|
|
59
|
+
<rect y="36" width="202" height="28" rx="7" fill="#111827"/><text x="12" y="55" fill="#F6F0E5">medium · review</text>
|
|
60
|
+
<rect y="72" width="202" height="28" rx="7" fill="#6C5CE7"/><text x="12" y="91" fill="#F6F0E5">big · synthesize</text>
|
|
61
|
+
</g>
|
|
62
|
+
</g>
|
|
63
|
+
|
|
64
|
+
<g id="result-card" transform="translate(858)">
|
|
65
|
+
<rect x="7" y="8" width="246" height="252" rx="18" fill="#AAA49B" opacity=".28"/>
|
|
66
|
+
<rect width="246" height="252" rx="18" fill="#FFD166"/>
|
|
67
|
+
<text x="22" y="33" fill="#6A4B00" font-size="13" font-weight="800" letter-spacing="1.4">04 / RETURN</text>
|
|
68
|
+
<text x="22" y="75" fill="#2C240D" font-size="24" font-weight="800">Deliver one</text>
|
|
69
|
+
<text x="22" y="104" fill="#2C240D" font-size="24" font-weight="800">result</text>
|
|
70
|
+
<rect x="22" y="130" width="202" height="92" rx="12" fill="#F6F0E5" opacity=".72"/>
|
|
71
|
+
<circle cx="61" cy="176" r="25" fill="#111827"/>
|
|
72
|
+
<path d="M48 176l8 8 18-20" fill="none" stroke="#61D2B4" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
|
73
|
+
<text x="96" y="169" fill="#46370C" font-size="14" font-weight="800">VERIFIED</text>
|
|
74
|
+
<text x="96" y="192" fill="#6A5518" font-size="11">journaled + resumable</text>
|
|
75
|
+
</g>
|
|
76
|
+
</g>
|
|
77
|
+
</svg>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** A reviewed frozen-guidance hash transition recorded in the coverage manifest. */
|
|
2
|
+
export interface WorkflowGuidanceAcceptance {
|
|
3
|
+
path: string;
|
|
4
|
+
previousSha256: string;
|
|
5
|
+
sha256: string;
|
|
6
|
+
changed: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Accepts reviewed changes to explicitly named frozen workflow-authoring files.
|
|
10
|
+
*
|
|
11
|
+
* Throws before writing when no path is supplied, a path is not frozen, a file
|
|
12
|
+
* is missing, or the coverage manifest no longer contains the expected entry.
|
|
13
|
+
*/
|
|
14
|
+
export declare function acceptWorkflowGuidance(root: string, requestedPaths: readonly string[]): WorkflowGuidanceAcceptance[];
|