opencode-orchestrator 1.0.31 → 1.0.33

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,38 @@ MSVP is a structured verification process that decouples implementation from qua
66
66
  [User Task Input]
67
67
 
68
68
  ┌─────────▼─────────┐
69
- │ COMMANDER │ (Orchestration context)
69
+ │ COMMANDER │ (Orchestration & Discovery)
70
70
  └─────────┬─────────┘
71
71
 
72
72
  ┌─────────▼─────────┐
73
- │ PLANNER │ (Create Hierarchical Plan)
73
+ │ PLANNER │ (Create TODO.md)
74
74
  └─────────┬─────────┘
75
75
 
76
76
  ┌────────────────▼────────────────┐
77
- Phase 1: Parallel Execution (HPFA Implementation Grid)
77
+ COMMANDER: Parallel Launch
78
78
  └──────┬─────────┬─────────┬──────┘
79
79
  │ │ │
80
80
  ┌──────▼──┐ ┌────▼───┐ ┌───▼────┐
81
- │ WORKER │ │ WORKER │ │ WORKER │ (Fractal Spawning)
82
- └──────┬──┘ └────┬───┘ └───┬────┘
83
-
84
- ┌──────▼──┐ ┌────▼───┐ ┌───▼────┐
85
- REVIEWER│ │ REVIEWER│ │ REVIEWER (Stage 1: Unit Verification)
86
- └──────┬──┘ └────┬───┘ └───┬────┘
87
-
88
- ───────▼─────────▼─────────▼───────
89
- Sync Barrier (Wait for all units)
90
- ─────────────────┬─────────────────
91
-
92
- ┌─────────▼─────────┐
93
- │ MASTER REVIEWER │ (Stage 2: e2e Verification)
94
- └─────────┬─────────┘
95
-
96
- ┌─────────▼─────────┐
97
- │ Mission Sealed? │
98
- └─────────┬─────────┘
99
- No ↙ ↘ Yes
100
- [Loop] [Complete]
81
+ │ WORKER A│ │ WORKER B│ │ WORKER C (Implementation)
82
+ └────┬────┘ └────┬───┘ └────┬────┘
83
+
84
+ ┌────▼────┐ ┌────▼───┐ ┌────▼────┐
85
+ REVIEWER │ │REVIEWER │ │REVIEWER (Unit Verification)
86
+ └────┬────┘ └────┬───┘ └────┬────┘
87
+
88
+ ═════▼═══════════▼══════════▼══════
89
+ SYNC BARRIER
90
+ ════════════════╤══════════════════
91
+
92
+ ┌─────────▼─────────┐
93
+ │ MASTER REVIEWER │ (E2E Verification)
94
+ └─────────┬─────────┘
95
+
96
+ ┌─────────▼─────────┐
97
+ │ Mission Sealed? │
98
+ └─────────┬─────────┘
99
+ No ↙ ↘ Yes
100
+ [Loop] [Complete]
101
101
  ```
102
102
 
103
103
  ---
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
- MAX_DEPTH: 8,
338
- // Titan-Class depth for complex fractal missions
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,
@@ -14585,7 +14601,12 @@ ${PROMPT_TAGS.ROLE.close}`;
14585
14601
  var WORKER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
14586
14602
  **FORBIDDEN ACTIONS (Adapt to Project Conventions)**
14587
14603
 
14588
-
14604
+ ## \u26D4 NEVER Spawn or Delegate (CRITICAL)
14605
+ - NEVER use \`${TOOL_NAMES.DELEGATE_TASK}\` to spawn sub-workers
14606
+ - NEVER use \`${TOOL_NAMES.CALL_AGENT}\` to create additional sessions
14607
+ - You are a TERMINAL node - complete your assigned file directly
14608
+ - If task is too complex, REPORT BACK to ${AGENT_NAMES.COMMANDER} with specific blockers
14609
+ - Violating this rule causes infinite recursion and system failure
14589
14610
 
14590
14611
  ## Never Assume
14591
14612
  - NEVER guess API syntax \u2192 CHECK ${PATHS.DOCS}/ or research first
@@ -14595,7 +14616,6 @@ var WORKER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
14595
14616
  ## Never Skip
14596
14617
  - NEVER skip error handling \u2192 Follow project's error handling patterns
14597
14618
  - NEVER skip ${TOOL_NAMES.LSP_DIAGNOSTICS} \u2192 Always verify code compiles
14598
-
14599
14619
  - NEVER skip verification \u2192 Test before claiming done
14600
14620
 
14601
14621
  ## Never Shortcut
@@ -15009,7 +15029,12 @@ ${PROMPT_TAGS.ROLE.close}`;
15009
15029
  var REVIEWER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
15010
15030
  **FORBIDDEN ACTIONS**
15011
15031
 
15012
-
15032
+ ## \u26D4 NEVER Spawn or Delegate (CRITICAL)
15033
+ - NEVER use \`${TOOL_NAMES.DELEGATE_TASK}\` to spawn additional reviewers
15034
+ - NEVER use \`${TOOL_NAMES.CALL_AGENT}\` to create sub-sessions
15035
+ - You are a TERMINAL node - verify your assigned file directly
15036
+ - If verification scope is too large, REPORT BACK to ${AGENT_NAMES.COMMANDER}
15037
+ - Violating this rule causes infinite recursion and blocks Master Review
15013
15038
 
15014
15039
  ## Never Approve Without Verification
15015
15040
  - NEVER approve without actually running the project's test command
@@ -15026,7 +15051,6 @@ var REVIEWER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
15026
15051
  - NEVER make architecture changes \u2192 Escalate to ${AGENT_NAMES.COMMANDER}
15027
15052
  - NEVER implement fixes yourself \u2192 Send back to ${AGENT_NAMES.WORKER} with clear feedback
15028
15053
 
15029
-
15030
15054
  ## Adaptive Verification
15031
15055
  - READ ${PATHS.CONTEXT} to know the correct build/test commands
15032
15056
  - COMPARE with existing code patterns for consistency
@@ -17997,6 +18021,17 @@ var createDelegateTaskTool = (manager, client) => tool({
17997
18021
  const parentTask = allTasks.find((t) => t.sessionID === ctx.sessionID);
17998
18022
  const parentDepth = parentTask?.depth ?? 0;
17999
18023
  log(`${PARALLEL_LOG.DELEGATE_TASK} execute() called`, { agent, description, background, resume, mode, groupID, parentSession: ctx.sessionID, depth: parentDepth });
18024
+ if (parentDepth >= PARALLEL_TASK.TERMINAL_DEPTH) {
18025
+ log(`${PARALLEL_LOG.DELEGATE_TASK} Terminal node guard triggered`, { parentDepth, TERMINAL_DEPTH: PARALLEL_TASK.TERMINAL_DEPTH });
18026
+ return `${OUTPUT_LABEL.ERROR} Delegation blocked: You are a terminal node (depth ${parentDepth}).
18027
+
18028
+ **${AGENT_NAMES.WORKER} and ${AGENT_NAMES.REVIEWER} cannot spawn sub-agents.** This prevents infinite recursion.
18029
+
18030
+ If your task is too complex, please:
18031
+ 1. Report back to ${AGENT_NAMES.COMMANDER} with specific blockers
18032
+ 2. Request task decomposition at the ${AGENT_NAMES.PLANNER} level
18033
+ 3. Complete your assigned file directly without delegation`;
18034
+ }
18000
18035
  const sessionClient = client;
18001
18036
  if (background === void 0) {
18002
18037
  return `${OUTPUT_LABEL.ERROR} 'background' parameter is REQUIRED.`;
@@ -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
- readonly MAX_DEPTH: 8;
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.31",
5
+ "version": "1.0.33",
6
6
  "author": "agnusdei1207",
7
7
  "license": "MIT",
8
8
  "repository": {