opencode-orchestrator 1.0.31 → 1.0.34
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
CHANGED
|
@@ -66,38 +66,42 @@ MSVP is a structured verification process that decouples implementation from qua
|
|
|
66
66
|
[User Task Input]
|
|
67
67
|
│
|
|
68
68
|
┌─────────▼─────────┐
|
|
69
|
-
│ COMMANDER │
|
|
69
|
+
│ COMMANDER │ (Orchestration & Discovery)
|
|
70
70
|
└─────────┬─────────┘
|
|
71
71
|
│
|
|
72
72
|
┌─────────▼─────────┐
|
|
73
|
-
│ PLANNER │
|
|
73
|
+
│ PLANNER │ (Create TODO.md)
|
|
74
74
|
└─────────┬─────────┘
|
|
75
75
|
│
|
|
76
76
|
┌────────────────▼────────────────┐
|
|
77
|
-
│
|
|
77
|
+
│ COMMANDER: Parallel Workers │
|
|
78
78
|
└──────┬─────────┬─────────┬──────┘
|
|
79
79
|
│ │ │
|
|
80
80
|
┌──────▼──┐ ┌────▼───┐ ┌───▼────┐
|
|
81
|
-
│ WORKER
|
|
82
|
-
└──────┬──┘ └────┬───┘
|
|
83
|
-
│ │
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
│ │
|
|
88
|
-
|
|
89
|
-
│
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
81
|
+
│ WORKER A│ │ WORKER B│ │ WORKER C│ (Implementation)
|
|
82
|
+
└──────┬──┘ └────┬───┘ └────┬────┘
|
|
83
|
+
│ │ │
|
|
84
|
+
╔══════▼═════════▼══════════▼══════╗
|
|
85
|
+
║ COMMANDER: Parallel Reviewers ║
|
|
86
|
+
╚══════╤═════════╤══════════╤══════╝
|
|
87
|
+
│ │ │
|
|
88
|
+
┌──────▼──┐ ┌────▼───┐ ┌────▼────┐
|
|
89
|
+
│REVIEWER │ │REVIEWER │ │REVIEWER │ (Unit Verification)
|
|
90
|
+
└──────┬──┘ └────┬───┘ └────┬────┘
|
|
91
|
+
│ │ │
|
|
92
|
+
═══════▼═════════▼══════════▼══════
|
|
93
|
+
│ SYNC BARRIER │
|
|
94
|
+
════════════════╤══════════════════
|
|
95
|
+
│
|
|
96
|
+
┌─────────▼─────────┐
|
|
97
|
+
│ MASTER REVIEWER │ (E2E Verification)
|
|
98
|
+
└─────────┬─────────┘
|
|
99
|
+
│
|
|
100
|
+
┌─────────▼─────────┐
|
|
101
|
+
│ Mission Sealed? │
|
|
102
|
+
└─────────┬─────────┘
|
|
103
|
+
No ↙ ↘ Yes
|
|
104
|
+
[Loop] [Complete]
|
|
101
105
|
```
|
|
102
106
|
|
|
103
107
|
---
|
package/dist/index.js
CHANGED
|
@@ -334,8 +334,24 @@ var PARALLEL_TASK = {
|
|
|
334
334
|
// Task lifecycle (24 hours for long tasks)
|
|
335
335
|
TTL_MS: 24 * TIME.HOUR,
|
|
336
336
|
CLEANUP_DELAY_MS: 10 * TIME.MINUTE,
|
|
337
|
-
|
|
338
|
-
|
|
337
|
+
/**
|
|
338
|
+
* Maximum recursion depth for parallel task spawning
|
|
339
|
+
*
|
|
340
|
+
* Depth hierarchy:
|
|
341
|
+
* - Depth 0: Commander (can spawn Planner/Worker/Reviewer)
|
|
342
|
+
* - Depth 1: Planner (can spawn Worker)
|
|
343
|
+
* - Depth 2: Worker/Reviewer (TERMINAL - cannot spawn sub-agents)
|
|
344
|
+
* - Depth 3: BLOCKED
|
|
345
|
+
*
|
|
346
|
+
* This prevents infinite recursion and ensures Master Reviewer
|
|
347
|
+
* doesn't wait indefinitely for deeply nested sub-tasks.
|
|
348
|
+
*/
|
|
349
|
+
MAX_DEPTH: 3,
|
|
350
|
+
/**
|
|
351
|
+
* Terminal node depth - agents at this depth cannot spawn sub-agents.
|
|
352
|
+
* Worker and Reviewer are terminal nodes by design.
|
|
353
|
+
*/
|
|
354
|
+
TERMINAL_DEPTH: 2,
|
|
339
355
|
// Concurrency limits (Aggressive for intense processing)
|
|
340
356
|
DEFAULT_CONCURRENCY: 10,
|
|
341
357
|
MAX_CONCURRENCY: 50,
|
|
@@ -935,15 +951,16 @@ var PHASE_1_THINK_ANALYSIS = `### 1.1 ANALYZE & SCOPE (INPUT)
|
|
|
935
951
|
### 1.4 RISK ASSESSMENT
|
|
936
952
|
- Identify high-risk parts and fallback plans.
|
|
937
953
|
- If agent fails \u2192 See RECOVERY section.`;
|
|
938
|
-
var PHASE_5_MSVP = `1. **STAGE 1 (Unit)**: Workers
|
|
939
|
-
2. **STAGE 2 (Integration Master)**:
|
|
940
|
-
3. **E2E VALIDATION**:
|
|
954
|
+
var PHASE_5_MSVP = `1. **STAGE 1 (Unit)**: As Workers complete, Commander spawns ${AGENT_NAMES.REVIEWER} for each to verify.
|
|
955
|
+
2. **STAGE 2 (Integration Master)**: Once all Units pass, Commander spawns Master ${AGENT_NAMES.REVIEWER} for cross-module validation.
|
|
956
|
+
3. **E2E VALIDATION**: Master Reviewer runs full system tests and build pass check.
|
|
941
957
|
4. **SEAL GATE**: No SEALED output until ${PATHS.TODO} is all [x] and zero issues remain.`;
|
|
942
|
-
var HPFA_RULES = `1. **
|
|
943
|
-
2. **
|
|
944
|
-
3. **
|
|
945
|
-
4. **
|
|
946
|
-
5. **
|
|
958
|
+
var HPFA_RULES = `1. **Commander Parallel Workers**: Commander spawns multiple Workers in parallel for independent modules.
|
|
959
|
+
2. **Commander Parallel Reviewers**: As Workers complete, Commander spawns Unit Reviewers for each.
|
|
960
|
+
3. **Speculative Racing**: Launch multiple strategies in parallel (mode: race) for uncertainty.
|
|
961
|
+
4. **Asynchronous Batching**: Group non-dependent tool calls to trigger host-side parallelism.
|
|
962
|
+
5. **Barrier-Sync Pipeline**: Commander waits at sync barrier before launching Master Reviewer.
|
|
963
|
+
6. **Terminal Nodes**: Workers and Reviewers are TERMINAL - they cannot spawn any sub-agents.`;
|
|
947
964
|
|
|
948
965
|
// src/shared/prompt/constants/scouts.ts
|
|
949
966
|
var SCOUT_LABEL = "Scout";
|
|
@@ -14278,12 +14295,15 @@ ${PROMPT_TAGS.ROLE.close}`;
|
|
|
14278
14295
|
var PLANNER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
|
|
14279
14296
|
**PLANNER FORBIDDEN ACTIONS**
|
|
14280
14297
|
|
|
14281
|
-
|
|
14298
|
+
## \u26D4 NEVER Spawn or Delegate (CRITICAL)
|
|
14299
|
+
- NEVER use \`${TOOL_NAMES.DELEGATE_TASK}\` to spawn agents
|
|
14300
|
+
- NEVER use \`${TOOL_NAMES.CALL_AGENT}\` to create sessions
|
|
14301
|
+
- You are a TERMINAL node - create plans, don't execute them
|
|
14302
|
+
- ${AGENT_NAMES.COMMANDER} is the ONLY agent who can spawn Workers/Reviewers
|
|
14282
14303
|
|
|
14283
14304
|
## Never Implement
|
|
14284
14305
|
- NEVER write actual code \u2192 Only plan and research
|
|
14285
14306
|
- NEVER execute build/test commands \u2192 That's ${AGENT_NAMES.WORKER}/${AGENT_NAMES.REVIEWER}'s job
|
|
14286
|
-
|
|
14287
14307
|
- NEVER modify source files \u2192 Only ${PATHS.TODO} and ${PATHS.DOCS}/
|
|
14288
14308
|
|
|
14289
14309
|
## Never Assume
|
|
@@ -14585,7 +14605,12 @@ ${PROMPT_TAGS.ROLE.close}`;
|
|
|
14585
14605
|
var WORKER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
|
|
14586
14606
|
**FORBIDDEN ACTIONS (Adapt to Project Conventions)**
|
|
14587
14607
|
|
|
14588
|
-
|
|
14608
|
+
## \u26D4 NEVER Spawn or Delegate (CRITICAL)
|
|
14609
|
+
- NEVER use \`${TOOL_NAMES.DELEGATE_TASK}\` to spawn sub-workers
|
|
14610
|
+
- NEVER use \`${TOOL_NAMES.CALL_AGENT}\` to create additional sessions
|
|
14611
|
+
- You are a TERMINAL node - complete your assigned file directly
|
|
14612
|
+
- If task is too complex, REPORT BACK to ${AGENT_NAMES.COMMANDER} with specific blockers
|
|
14613
|
+
- Violating this rule causes infinite recursion and system failure
|
|
14589
14614
|
|
|
14590
14615
|
## Never Assume
|
|
14591
14616
|
- NEVER guess API syntax \u2192 CHECK ${PATHS.DOCS}/ or research first
|
|
@@ -14595,7 +14620,6 @@ var WORKER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
|
|
|
14595
14620
|
## Never Skip
|
|
14596
14621
|
- NEVER skip error handling \u2192 Follow project's error handling patterns
|
|
14597
14622
|
- NEVER skip ${TOOL_NAMES.LSP_DIAGNOSTICS} \u2192 Always verify code compiles
|
|
14598
|
-
|
|
14599
14623
|
- NEVER skip verification \u2192 Test before claiming done
|
|
14600
14624
|
|
|
14601
14625
|
## Never Shortcut
|
|
@@ -15009,7 +15033,12 @@ ${PROMPT_TAGS.ROLE.close}`;
|
|
|
15009
15033
|
var REVIEWER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
|
|
15010
15034
|
**FORBIDDEN ACTIONS**
|
|
15011
15035
|
|
|
15012
|
-
|
|
15036
|
+
## \u26D4 NEVER Spawn or Delegate (CRITICAL)
|
|
15037
|
+
- NEVER use \`${TOOL_NAMES.DELEGATE_TASK}\` to spawn additional reviewers
|
|
15038
|
+
- NEVER use \`${TOOL_NAMES.CALL_AGENT}\` to create sub-sessions
|
|
15039
|
+
- You are a TERMINAL node - verify your assigned file directly
|
|
15040
|
+
- If verification scope is too large, REPORT BACK to ${AGENT_NAMES.COMMANDER}
|
|
15041
|
+
- Violating this rule causes infinite recursion and blocks Master Review
|
|
15013
15042
|
|
|
15014
15043
|
## Never Approve Without Verification
|
|
15015
15044
|
- NEVER approve without actually running the project's test command
|
|
@@ -15026,7 +15055,6 @@ var REVIEWER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
|
|
|
15026
15055
|
- NEVER make architecture changes \u2192 Escalate to ${AGENT_NAMES.COMMANDER}
|
|
15027
15056
|
- NEVER implement fixes yourself \u2192 Send back to ${AGENT_NAMES.WORKER} with clear feedback
|
|
15028
15057
|
|
|
15029
|
-
|
|
15030
15058
|
## Adaptive Verification
|
|
15031
15059
|
- READ ${PATHS.CONTEXT} to know the correct build/test commands
|
|
15032
15060
|
- COMPARE with existing code patterns for consistency
|
|
@@ -17997,6 +18025,17 @@ var createDelegateTaskTool = (manager, client) => tool({
|
|
|
17997
18025
|
const parentTask = allTasks.find((t) => t.sessionID === ctx.sessionID);
|
|
17998
18026
|
const parentDepth = parentTask?.depth ?? 0;
|
|
17999
18027
|
log(`${PARALLEL_LOG.DELEGATE_TASK} execute() called`, { agent, description, background, resume, mode, groupID, parentSession: ctx.sessionID, depth: parentDepth });
|
|
18028
|
+
if (parentDepth >= PARALLEL_TASK.TERMINAL_DEPTH) {
|
|
18029
|
+
log(`${PARALLEL_LOG.DELEGATE_TASK} Terminal node guard triggered`, { parentDepth, TERMINAL_DEPTH: PARALLEL_TASK.TERMINAL_DEPTH });
|
|
18030
|
+
return `${OUTPUT_LABEL.ERROR} Delegation blocked: You are a terminal node (depth ${parentDepth}).
|
|
18031
|
+
|
|
18032
|
+
**${AGENT_NAMES.WORKER} and ${AGENT_NAMES.REVIEWER} cannot spawn sub-agents.** This prevents infinite recursion.
|
|
18033
|
+
|
|
18034
|
+
If your task is too complex, please:
|
|
18035
|
+
1. Report back to ${AGENT_NAMES.COMMANDER} with specific blockers
|
|
18036
|
+
2. Request task decomposition at the ${AGENT_NAMES.PLANNER} level
|
|
18037
|
+
3. Complete your assigned file directly without delegation`;
|
|
18038
|
+
}
|
|
18000
18039
|
const sessionClient = client;
|
|
18001
18040
|
if (background === void 0) {
|
|
18002
18041
|
return `${OUTPUT_LABEL.ERROR} 'background' parameter is REQUIRED.`;
|
|
@@ -17,9 +17,15 @@ export declare const PHASE_0_DIRECT_DISCOVERY: string;
|
|
|
17
17
|
export declare const PHASE_1_THINK_ANALYSIS: string;
|
|
18
18
|
/**
|
|
19
19
|
* Phase 5: MSVP (Multi-Stage Verification Pipeline)
|
|
20
|
+
*
|
|
21
|
+
* NOTE: Commander spawns both Workers AND Reviewers.
|
|
22
|
+
* Workers are terminal nodes and do not spawn Reviewers themselves.
|
|
20
23
|
*/
|
|
21
24
|
export declare const PHASE_5_MSVP: string;
|
|
22
25
|
/**
|
|
23
26
|
* HPFA (Hyper-Parallel Fractal Architecture) Rules
|
|
27
|
+
*
|
|
28
|
+
* All spawning happens at Commander level only.
|
|
29
|
+
* Workers and Reviewers are terminal nodes and cannot spawn sub-agents.
|
|
24
30
|
*/
|
|
25
|
-
export declare const HPFA_RULES = "1. **
|
|
31
|
+
export declare const HPFA_RULES = "1. **Commander Parallel Workers**: Commander spawns multiple Workers in parallel for independent modules.\n2. **Commander Parallel Reviewers**: As Workers complete, Commander spawns Unit Reviewers for each.\n3. **Speculative Racing**: Launch multiple strategies in parallel (mode: race) for uncertainty.\n4. **Asynchronous Batching**: Group non-dependent tool calls to trigger host-side parallelism.\n5. **Barrier-Sync Pipeline**: Commander waits at sync barrier before launching Master Reviewer.\n6. **Terminal Nodes**: Workers and Reviewers are TERMINAL - they cannot spawn any sub-agents.";
|
|
@@ -9,7 +9,24 @@ export declare const TASK_MODE: {
|
|
|
9
9
|
export declare const PARALLEL_TASK: {
|
|
10
10
|
readonly TTL_MS: number;
|
|
11
11
|
readonly CLEANUP_DELAY_MS: number;
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Maximum recursion depth for parallel task spawning
|
|
14
|
+
*
|
|
15
|
+
* Depth hierarchy:
|
|
16
|
+
* - Depth 0: Commander (can spawn Planner/Worker/Reviewer)
|
|
17
|
+
* - Depth 1: Planner (can spawn Worker)
|
|
18
|
+
* - Depth 2: Worker/Reviewer (TERMINAL - cannot spawn sub-agents)
|
|
19
|
+
* - Depth 3: BLOCKED
|
|
20
|
+
*
|
|
21
|
+
* This prevents infinite recursion and ensures Master Reviewer
|
|
22
|
+
* doesn't wait indefinitely for deeply nested sub-tasks.
|
|
23
|
+
*/
|
|
24
|
+
readonly MAX_DEPTH: 3;
|
|
25
|
+
/**
|
|
26
|
+
* Terminal node depth - agents at this depth cannot spawn sub-agents.
|
|
27
|
+
* Worker and Reviewer are terminal nodes by design.
|
|
28
|
+
*/
|
|
29
|
+
readonly TERMINAL_DEPTH: 2;
|
|
13
30
|
readonly DEFAULT_CONCURRENCY: 10;
|
|
14
31
|
readonly MAX_CONCURRENCY: 50;
|
|
15
32
|
readonly SYNC_TIMEOUT_MS: number;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "opencode-orchestrator",
|
|
3
3
|
"displayName": "OpenCode Orchestrator",
|
|
4
4
|
"description": "Distributed Cognitive Architecture for OpenCode. Turns simple prompts into specialized multi-agent workflows (Planner, Coder, Reviewer).",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.34",
|
|
6
6
|
"author": "agnusdei1207",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|