@zachwill/pi-orchestrate 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/extension/contract.ts +10 -6
- package/extension/tools.ts +5 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,12 +28,12 @@ Pi Orchestrate adds exactly five tools:
|
|
|
28
28
|
|
|
29
29
|
Each `orchestrate` call validates its input, worker definition, and model before allocating IDs or starting a session. Calls are admitted independently: a rejected sibling does not block valid siblings. After admission, a startup or prompt failure settles only that worker as `failed`.
|
|
30
30
|
|
|
31
|
-
Pi executes sibling tool calls concurrently
|
|
31
|
+
Pi executes native sibling tool calls concurrently. There is no extension-level sibling-group cap or hidden throttle. Before dispatching, enumerate the full wave. If an intended asynchronous wave has N workers, the next assistant response must contain exactly N separate, fully briefed `orchestrate` calls; one call is valid only when N=1. Form all N calls before emitting or finalizing the response because a successfully admitted sole async call returns `terminate: true` and ends the parent turn, so omitted siblings cannot be added afterward. To run the wave asynchronously, its tool-call group must contain exactly those N orchestration calls and no other tool calls. Harmless response text does not affect runtime classification. For example, a three-worker wave is one assistant response containing three native sibling `orchestrate({ worker, title, instructions })` calls.
|
|
32
32
|
|
|
33
33
|
Execution mode depends on the complete tool-call group:
|
|
34
34
|
|
|
35
|
-
-
|
|
36
|
-
-
|
|
35
|
+
- Pi Orchestrate treats a successfully admitted sole `orchestrate` call as async.
|
|
36
|
+
- Pi Orchestrate treats a successfully admitted pure group of sibling `orchestrate` calls as async; Pi executes the siblings concurrently.
|
|
37
37
|
- Mixing `orchestrate` with any other tool makes the orchestration calls inline and blocking.
|
|
38
38
|
- `worker_send` is asynchronous only when it is the sole tool call in the message.
|
|
39
39
|
|
|
@@ -65,10 +65,10 @@ Workers, runs, and queued delivery survive extension reloads and session switche
|
|
|
65
65
|
|
|
66
66
|
Pi Orchestrate injects the authoritative orchestration contract and trusted catalog into the parent system prompt. The parent remains responsible for the task end to end:
|
|
67
67
|
|
|
68
|
-
1. Keep trivial or tightly coupled work in the parent.
|
|
69
|
-
2. Give every worker a thorough, self-contained brief with the objective, paths and scope, context, success criteria, and expected output. State forbidden actions explicitly.
|
|
70
|
-
3.
|
|
71
|
-
4. As results expose new independent work, dispatch
|
|
68
|
+
1. Keep trivial or tightly coupled work in the parent. For broad work, spin up as many workers as needed to cover every useful bounded independent scope and distinct validation perspective; never use a small default or the number of roles the user names. Named workers and counts are a floor unless the user explicitly states an exact cap; the same role can be instantiated for multiple scopes.
|
|
69
|
+
2. Give every worker a thorough, self-contained brief with the objective, paths and scope, context, success criteria, and expected output. Distinct validation perspectives can intentionally overlap, but avoid accidental duplicate work. State forbidden actions explicitly.
|
|
70
|
+
3. For an intended asynchronous wave of N workers, make the next assistant response's tool-call group exactly N fully briefed native sibling `orchestrate` calls and no other tool calls. Harmless response text does not affect runtime classification. A single call is valid only for N=1. Form the complete group before emitting it because a successfully admitted sole async call returns `terminate: true` and ends the turn; never wait for one sibling before dispatching the rest.
|
|
71
|
+
4. As results expose new independent work, dispatch each full adaptive wave in parallel and continue until the whole task is complete.
|
|
72
72
|
5. Review evidence and changes, resolve conflicts, integrate deliberately, and verify the result.
|
|
73
73
|
6. Produce the final answer from the parent session.
|
|
74
74
|
|
package/extension/contract.ts
CHANGED
|
@@ -29,15 +29,19 @@ function buildContract(catalog: WorkerCatalog): string {
|
|
|
29
29
|
|
|
30
30
|
You are the parent orchestrator and own the task end to end.
|
|
31
31
|
|
|
32
|
-
- Keep trivial or tightly coupled work in the parent.
|
|
33
|
-
-
|
|
34
|
-
-
|
|
32
|
+
- Keep trivial or tightly coupled work in the parent. For broad work, proactively identify every useful bounded independent scope and every materially distinct evidence, hypothesis, or validation perspective. Spin up as many workers as needed to cover them; never use a small fixed default.
|
|
33
|
+
- Treat worker roles and counts named by the user as minimum requirements, not ceilings. Exceed them when additional useful independent scopes or materially distinct perspectives exist, unless the user explicitly sets an exact cap. A worker role is reusable: dispatch the same catalog worker in many calls when it fits separate scopes or perspectives.
|
|
34
|
+
- Before dispatching, enumerate the full first parallel wave from the work itself.
|
|
35
|
+
- **Mandatory asynchronous-wave cardinality:** If an intended asynchronous wave has N workers, your next assistant response must contain exactly N separate, fully briefed \`orchestrate\` invocations. A single invocation is valid only when N=1. Form all N invocations before emitting or finalizing the response: a successfully admitted sole async invocation returns \`terminate: true\` and ends the parent turn, so omitted siblings cannot be added afterward.
|
|
36
|
+
- **Asynchronous response shape:** To run that wave asynchronously, its tool-call group must contain exactly those N \`orchestrate\` invocations and no other tool calls. Harmless response text does not affect runtime classification. Pi executes native sibling tool calls concurrently. For N=3, emit three native sibling calls in one response: \`orchestrate({ worker, title, instructions })\`, \`orchestrate({ worker, title, instructions })\`, and \`orchestrate({ worker, title, instructions })\`.
|
|
37
|
+
- Delegate each independent scope or distinct perspective with its own fully briefed \`orchestrate\` call. Do not wait for one sibling's acceptance or completion before dispatching the rest.
|
|
38
|
+
- Deliberate overlap is allowed only when calls pursue materially distinct evidence sources, competing hypotheses, or validation perspectives. Encode that distinction in each brief; accidental duplicate assignments are forbidden.
|
|
35
39
|
- Give every worker a thorough, self-contained brief with the objective, paths and scope, context, success criteria, and expected output. State forbidden actions explicitly.
|
|
36
40
|
- Input, catalog, and model preflight is atomic per call before that worker starts. Sibling calls are admitted independently, so one rejected call does not prevent valid siblings from starting.
|
|
37
|
-
-
|
|
41
|
+
- Pi Orchestrate treats a successfully admitted sole \`orchestrate\` call or pure sibling group as async. Pi executes native sibling tools concurrently. A pure group yields the parent turn, delivers each result as it settles, and starts synthesis only after the whole group settles. Mixing \`orchestrate\` with another tool makes it inline and blocking. \`worker_send\` is asynchronous only as the sole tool call in its assistant message.
|
|
38
42
|
- Exact worker instructions remain visible in the tool call and can be expanded; titles are labels, not substitutes for complete messages.
|
|
39
|
-
- After
|
|
40
|
-
- As results expose
|
|
43
|
+
- After the full current wave has been dispatched, yield the parent turn once its admissions have resolved; a rejected sibling does not block yielding. Worker responses arrive individually as each worker settles, and the final response starts parent synthesis. Do not poll \`orchestration_status\` or use it as a normal completion mechanism.
|
|
44
|
+
- As results expose more useful independent scopes or materially distinct perspectives, enumerate and dispatch another full parallel wave before yielding. Continue adaptive full waves until the whole task is complete.
|
|
41
45
|
- The parent synthesizes worker results, reviews their evidence and changes, resolves conflicts, integrates the final result, and runs the relevant verification before declaring completion.
|
|
42
46
|
- Prefer one-shot workers. Use \`worker_send\` for follow-up work on a ready reusable worker, \`worker_close\` when that ready worker is finished, and \`worker_abort\` only when active work must stop.
|
|
43
47
|
- The public tools are \`orchestrate\`, \`orchestration_status\`, \`worker_send\`, \`worker_abort\`, and \`worker_close\`.
|
package/extension/tools.ts
CHANGED
|
@@ -111,11 +111,12 @@ export function registerOrchestrationTools(
|
|
|
111
111
|
name: "orchestrate",
|
|
112
112
|
label: "Orchestrate",
|
|
113
113
|
description:
|
|
114
|
-
"Dispatch
|
|
115
|
-
promptSnippet: "Dispatch
|
|
114
|
+
"Dispatch fully briefed worker scopes. Pi executes native sibling tools concurrently; Pi Orchestrate treats a successfully admitted sole orchestrate call or pure sibling group as async. Mixing orchestrate with another tool makes it inline and blocking.",
|
|
115
|
+
promptSnippet: "Dispatch fully briefed parallel worker scopes",
|
|
116
116
|
promptGuidelines: [
|
|
117
|
-
"
|
|
118
|
-
"
|
|
117
|
+
"Spin up as many workers as needed to cover every useful parallel scope and distinct validation perspective. Treat user-named workers or counts as a floor unless explicitly capped, and reuse the same worker role across multiple calls when useful.",
|
|
118
|
+
"For an intended async wave of N workers, the next assistant response must contain exactly N separate, fully briefed orchestrate calls; one call is valid only when N=1. To run it asynchronously, include no other tool calls; harmless response text does not affect runtime classification.",
|
|
119
|
+
"Form all N native sibling calls before emitting or finalizing the response. A successfully admitted sole async orchestrate call returns terminate=true and ends the turn, so omitted siblings cannot be added afterward; never wait for one sibling's acceptance or completion.",
|
|
119
120
|
],
|
|
120
121
|
executionMode: "parallel",
|
|
121
122
|
parameters: orchestrateSchema,
|