@marcoscale98/pi-extensible-workflows 5.17.0-fork.1 → 6.2.1-fork.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/CHANGELOG.md +145 -0
- package/README.md +2 -2
- package/dist/src/agent-execution.d.ts +43 -10
- package/dist/src/agent-execution.js +442 -162
- package/dist/src/background-widget.d.ts +5 -1
- package/dist/src/background-widget.js +5 -10
- package/dist/src/decoders.d.ts +2 -3
- package/dist/src/decoders.js +59 -37
- package/dist/src/execution.d.ts +6 -2
- package/dist/src/execution.js +48 -7
- package/dist/src/host-delivery.js +5 -8
- package/dist/src/host-navigator.js +5 -2
- package/dist/src/host-phases.d.ts +1 -0
- package/dist/src/host-recovery.d.ts +11 -8
- package/dist/src/host-recovery.js +14 -22
- package/dist/src/host-runtime.js +56 -5
- package/dist/src/host-view.d.ts +6 -1
- package/dist/src/host-view.js +46 -20
- package/dist/src/host.d.ts +2 -2
- package/dist/src/host.js +246 -118
- package/dist/src/index.d.ts +1 -2
- package/dist/src/index.js +1985 -1690
- package/dist/src/index.js.map +3 -3
- package/dist/src/paths.d.ts +8 -5
- package/dist/src/paths.js +24 -13
- package/dist/src/persistence.d.ts +1 -0
- package/dist/src/persistence.js +1 -0
- package/dist/src/pi-runtime-runner.js +4 -1
- package/dist/src/registry.d.ts +9 -7
- package/dist/src/registry.js +29 -71
- package/dist/src/runtime/agent-runner.d.ts +2 -0
- package/dist/src/script-tools.d.ts +27 -0
- package/dist/src/script-tools.js +87 -0
- package/dist/src/session-lease.d.ts +1 -1
- package/dist/src/session-lease.js +45 -11
- package/dist/src/settings.d.ts +19 -3
- package/dist/src/settings.js +63 -50
- package/dist/src/store.d.ts +3 -1
- package/dist/src/store.js +17 -1
- package/dist/src/trajectory.d.ts +12 -3
- package/dist/src/trajectory.js +32 -11
- package/dist/src/types.d.ts +129 -45
- package/dist/src/types.js +5 -8
- package/dist/src/utils.d.ts +21 -1
- package/dist/src/utils.js +46 -6
- package/dist/src/validation.d.ts +14 -3
- package/dist/src/validation.js +143 -87
- package/dist/starter/index.js +8 -11
- package/dist/starter/index.js.map +1 -1
- package/dist/starter/review-loop.d.ts +0 -13
- package/dist/starter/review-loop.js +8 -9
- package/dist/subagents/index.js +904 -956
- package/dist/subagents/index.js.map +3 -3
- package/dist/subagents/src/contracts.d.ts +48 -31
- package/dist/subagents/src/contracts.js +20 -9
- package/dist/subagents/src/index.d.ts +1 -1
- package/dist/subagents/src/index.js +14 -8
- package/dist/subagents/src/manager.js +52 -73
- package/dist/subagents/src/navigator.js +3 -14
- package/dist/subagents/src/view.d.ts +1 -1
- package/dist/subagents/src/view.js +15 -68
- package/dist/subagents/src/worktree.js +1 -1
- package/dist/trajectory/assets/index.html +35 -13
- package/dist/trajectory/index.js +576 -932
- package/dist/trajectory/index.js.map +3 -3
- package/dist/trajectory/src/assets/index.html +35 -13
- package/dist/trajectory/src/index.js +134 -104
- package/dist/trajectory/src/server.js +268 -27
- package/dist/trajectory/src/server.js.map +3 -3
- package/dist/trajectory/src/startup-mutex.d.ts +17 -0
- package/dist/trajectory/src/startup-mutex.js +172 -0
- package/examples/workflow-extension-template/README.md +4 -7
- package/examples/workflow-extension-template/extension.test.mjs +4 -8
- package/examples/workflow-extension-template/index.js +0 -3
- package/package.json +10 -10
- package/skills/pi-extensible-workflows/SKILL.md +12 -8
- package/src/agent-execution.ts +412 -164
- package/src/background-widget.ts +5 -11
- package/src/decoders.ts +51 -37
- package/src/execution.ts +46 -9
- package/src/host-delivery.ts +5 -8
- package/src/host-navigator.ts +4 -2
- package/src/host-phases.ts +1 -1
- package/src/host-recovery.ts +23 -28
- package/src/host-runtime.ts +44 -6
- package/src/host-view.ts +41 -16
- package/src/host.ts +229 -142
- package/src/index.ts +1 -2
- package/src/paths.ts +18 -9
- package/src/persistence.ts +1 -0
- package/src/pi-runtime-runner.ts +3 -1
- package/src/registry.ts +28 -64
- package/src/runtime/agent-runner.ts +2 -0
- package/src/script-tools.ts +76 -0
- package/src/session-lease.ts +34 -6
- package/src/settings.ts +56 -50
- package/src/store.ts +18 -2
- package/src/trajectory.ts +32 -15
- package/src/types.ts +82 -34
- package/src/utils.ts +42 -5
- package/src/validation.ts +121 -80
- package/starter/index.ts +0 -1
- package/starter/review-loop.ts +8 -9
- package/starter/roles/developer.md +0 -1
- package/starter/roles/oracle.md +0 -1
- package/starter/roles/researcher.md +0 -1
- package/starter/roles/reviewer.md +0 -1
- package/starter/roles/scout.md +0 -1
- package/subagents/README.md +10 -16
- package/subagents/src/contracts.ts +21 -11
- package/subagents/src/index.ts +17 -8
- package/subagents/src/manager.ts +48 -128
- package/subagents/src/navigator.ts +4 -13
- package/subagents/src/view.ts +16 -63
- package/subagents/src/worktree.ts +1 -1
- package/trajectory/src/assets/index.html +35 -13
- package/trajectory/src/index.ts +112 -91
- package/trajectory/src/server.ts +46 -10
- package/trajectory/src/startup-mutex.ts +127 -0
- package/dist/src/roles.d.ts +0 -70
- package/dist/src/roles.js +0 -325
- package/dist/starter/roles/developer.md +0 -6
- package/dist/starter/roles/oracle.md +0 -18
- package/dist/starter/roles/researcher.md +0 -20
- package/dist/starter/roles/reviewer.md +0 -19
- package/dist/starter/roles/scout.md +0 -18
- package/examples/workflow-extension-template/roles/reviewer.md +0 -4
- package/src/roles.ts +0 -326
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marcoscale98/pi-extensible-workflows",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Deterministic multi-agent workflow orchestration for Pi",
|
|
3
|
+
"version": "6.2.1-fork.1",
|
|
4
|
+
"description": "Deterministic multi-agent workflow orchestration and codemode scripts for Pi",
|
|
5
5
|
"homepage": "https://vekexasia.github.io/pi-extensible-workflows/",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"workflow",
|
|
16
16
|
"multi-agent",
|
|
17
17
|
"orchestration",
|
|
18
|
-
"automation"
|
|
18
|
+
"automation",
|
|
19
|
+
"codemode"
|
|
19
20
|
],
|
|
20
21
|
"exports": {
|
|
21
22
|
".": "./dist/src/index.js",
|
|
@@ -24,7 +25,6 @@
|
|
|
24
25
|
"./utils": "./dist/src/utils.js",
|
|
25
26
|
"./budget": "./dist/src/budget.js",
|
|
26
27
|
"./validation": "./dist/src/validation.js",
|
|
27
|
-
"./roles": "./dist/src/roles.js",
|
|
28
28
|
"./registry": "./dist/src/registry.js",
|
|
29
29
|
"./runtime": "./dist/src/runtime/index.js",
|
|
30
30
|
"./trajectory": "./dist/trajectory/index.js"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"CHANGELOG.md"
|
|
49
49
|
],
|
|
50
50
|
"scripts": {
|
|
51
|
-
"build": "rm -rf dist && tsc -p tsconfig.json && cp -R
|
|
51
|
+
"build": "rm -rf dist && tsc -p tsconfig.json && cp -R trajectory/src/assets dist/trajectory/src/assets && cp -R trajectory/src/assets dist/trajectory/assets && esbuild src/index.ts starter/index.ts subagents/index.ts trajectory/index.ts --bundle --format=esm --platform=node --packages=external --sourcemap --sources-content=false --outbase=. --outdir=dist && esbuild trajectory/src/server.ts --bundle --format=esm --platform=node --sourcemap --sources-content=false --outfile=dist/trajectory/src/server.js",
|
|
52
52
|
"lint": "eslint .",
|
|
53
53
|
"test": "npm run test:layout && npm run build && npm run test:widget && npm run test:run && npm run test:herdr && npm run test:subagents",
|
|
54
54
|
"test:layout": "node --test --test-timeout=10000 --test-force-exit test/workspace-layout.test.mjs",
|
|
@@ -76,15 +76,15 @@
|
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@earendil-works/pi-ai": "*",
|
|
79
|
-
"@earendil-works/pi-coding-agent": "
|
|
79
|
+
"@earendil-works/pi-coding-agent": ">=0.99.0",
|
|
80
80
|
"@earendil-works/pi-tui": "*",
|
|
81
81
|
"typebox": "*"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@earendil-works/pi-ai": "0.
|
|
85
|
-
"@earendil-works/pi-coding-agent": "0.
|
|
86
|
-
"@earendil-works/pi-server": "0.
|
|
87
|
-
"@earendil-works/pi-tui": "0.
|
|
84
|
+
"@earendil-works/pi-ai": "1.0.0",
|
|
85
|
+
"@earendil-works/pi-coding-agent": "1.0.0",
|
|
86
|
+
"@earendil-works/pi-server": "1.0.0",
|
|
87
|
+
"@earendil-works/pi-tui": "1.0.0",
|
|
88
88
|
"@eslint/js": "10.0.1",
|
|
89
89
|
"@types/node": "24.12.4",
|
|
90
90
|
"esbuild": "^0.28.2",
|
|
@@ -38,6 +38,8 @@ Call `workflow_catalog` once to list functions and model aliases before the firs
|
|
|
38
38
|
|
|
39
39
|
Workflow JavaScript has no imports, filesystem, network, process, or timers. Delegate that work to agents. `shell(command, options)` is the trusted host RPC for deterministic gates: it inherits the workflow or active-worktree cwd, merges string `env` overrides, and returns `{ exitCode, stdout, stderr }`; nonzero exits are results, but launch failures and timeouts fail with `SHELL_FAILED`.
|
|
40
40
|
|
|
41
|
+
`await tools.<name>(args)` calls a tool of the launching Pi session directly, without an agent, with the same names and results as Pi `codemode`: an object when the tool declares an output schema, otherwise its text; other failures reject with `TOOL_FAILED`. Do not probe with `"name" in tools`; the launch checks the names a script calls. Prefer it over an agent for mechanical reads and tool calls. Workflow and subagent tools are not callable, and calls inside `withWorktree` fail.
|
|
42
|
+
|
|
41
43
|
Example use of `shell`:
|
|
42
44
|
|
|
43
45
|
```js
|
|
@@ -72,11 +74,11 @@ For a failed run, call `workflow_status({ runId })` first: a compact authoritati
|
|
|
72
74
|
export interface AgentOptions {
|
|
73
75
|
label?: string; // display name
|
|
74
76
|
model?: string; // provider/model:thinking, or alias[:thinking]
|
|
75
|
-
role?: string; // role file name
|
|
76
77
|
contextFiles?: Array<"global" | "project" | "cwd">; // which Pi context files to load
|
|
77
|
-
skills?: string[]; // minimatch
|
|
78
|
-
extensions?: string[]; // minimatch
|
|
79
|
-
tools?: string[]; // minimatch
|
|
78
|
+
skills?: string[]; // minimatch selector, ordered defaults then call options
|
|
79
|
+
extensions?: string[]; // minimatch selector, ordered defaults then call options
|
|
80
|
+
tools?: string[]; // minimatch selector, ordered defaults then call options
|
|
81
|
+
excludeTools?: string[]; // exact tool names removed after preparation; no patterns or workflow_result; never widens the parent ceiling
|
|
80
82
|
outputSchema?: JsonSchema; // structured result for a later phase
|
|
81
83
|
retries?: number; // extra same-run retries for this agent
|
|
82
84
|
timeoutMs?: number | null; // attempt timeout; null = none
|
|
@@ -84,9 +86,9 @@ export interface AgentOptions {
|
|
|
84
86
|
}
|
|
85
87
|
```
|
|
86
88
|
|
|
87
|
-
|
|
89
|
+
Restrict resource selectors with `["!*", "read", "grep"]`; `["*"]` selects every resource allowed by the parent ceiling.
|
|
88
90
|
|
|
89
|
-
Extensions may add JSON-compatible agent options such as `advisor: true`; core keys retain validation and
|
|
91
|
+
Extensions may add JSON-compatible agent options such as `advisor: true`; core keys retain validation and parent ceilings. Extension options go to setup hooks/native setup and are not inherited by child agents.
|
|
90
92
|
|
|
91
93
|
Agent calls are unnamed. Direct calls receive hidden source call-site identity; aliases are unsupported, and calls from one source site must not race outside `parallel` or `pipeline`, whose structural keys make replay deterministic.
|
|
92
94
|
|
|
@@ -95,7 +97,7 @@ Agent calls are unnamed. Direct calls receive hidden source call-site identity;
|
|
|
95
97
|
Use `agent.create(...)` when one agent must keep its transcript across several turns; use plain `agent(...)` calls for independent work.
|
|
96
98
|
|
|
97
99
|
```js
|
|
98
|
-
const author = agent.create({ name: "author"
|
|
100
|
+
const author = agent.create({ name: "author" });
|
|
99
101
|
const draft = await author.send("Create the first draft");
|
|
100
102
|
const revised = await author.send(
|
|
101
103
|
prompt("Apply these findings:\n\n{findings}", { findings }),
|
|
@@ -143,12 +145,14 @@ const results = await parallel("implementation", {
|
|
|
143
145
|
});
|
|
144
146
|
```
|
|
145
147
|
|
|
148
|
+
Registered extension functions also get `context.agent.create({ name, ... })` with the same handle rules as scripts. Handle journal identity is scoped by function invocation, branch, worktree, and name, so repeated or nested invocations and script handles never share a transcript; the prefix `function-handle/` is reserved in script names. Each turn is a separate agent node, with no automatic grouping.
|
|
149
|
+
|
|
146
150
|
Registered extension functions receive `withWorktree` in context and can compose other registered functions with `context.invoke("reviewRepository", { focus: "security" }, "security-review")`. The optional label is presentation-only; journal identity remains the function name and occurrence. Their public inputs and outputs remain JSON; callbacks cannot cross the extension boundary.
|
|
147
151
|
|
|
148
152
|
## Rules
|
|
149
153
|
|
|
150
154
|
- Workflow run does not inherit any of the main agent context. Keep that in mind when creating agent's prompts.
|
|
151
|
-
- `model` must be a configured alias or the canonical `provider/model:thinking` form. Aliases are listed by `workflow_catalog`; prefer a suitable alias over a hardcoded model. Never guess a model identifier: verify unknown names with `pi --list-models "search term"` first, then use the fully qualified identifier it returns.
|
|
155
|
+
- If `model` is specified, it must be a configured alias or the canonical `provider/model:thinking` form. Aliases are listed by `workflow_catalog`; prefer a suitable alias over a hardcoded model. Never guess a model identifier: verify unknown names with `pi --list-models "search term"` first, then use the fully qualified identifier it returns.
|
|
152
156
|
- Use `log(messageString)` for brief operator status and `phase(phaseName)` to signal the start of another phase.
|
|
153
157
|
- Use `parallel()` for independent tasks with different flows and `pipeline()` when every keyed item follows the same ordered stages; do not duplicate identical chains in `parallel()`. Signatures are `parallel(operationName, tasksRecord)` and `pipeline(operationName, itemsRecord, stagesRecord)`; keys are stable task, item, and stage names.
|
|
154
158
|
- Use a JavaScript loop for repeated work; each direct `agent(...)` call gets deterministic call-site and occurrence identity.
|