opencode-orchestrator 1.0.15 → 1.0.17

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/dist/index.js CHANGED
@@ -907,6 +907,43 @@ var PHILOSOPHY_TAGLINE = "Explore \u2192 Learn \u2192 Adapt \u2192 Act";
907
907
  var PHILOSOPHY_QUOTE = "Like an astronaut landing on unknown planets \u2014 never assume, always discover.";
908
908
  var PHILOSOPHY_LEARN_PRINCIPLE = "LEARN = DOCUMENT: What you discover, you record. Your learnings become the team's knowledge.";
909
909
 
910
+ // src/shared/prompt/constants/mandates.ts
911
+ var PHASE_0_SCOUT_SWARM = `**Mandatory Parallel Initialization**: DO NOT run discovery tools (ls, grep, find) yourself. Your job is to ORCHESTRATE and synthesize results.
912
+
913
+ 1. **LAUNCH Parallel Scouts**: In your VERY FIRST response, you must output ALL of the following \`\${TOOL_NAMES.DELEGATE_TASK}\` calls simultaneously (background: true):
914
+ - **[Scout: Structure]**: Map the project tree and locate src/tests/docs.
915
+ - **[Scout: Stack]**: Identify language, frameworks, and build/test commands.
916
+ - **[Scout: Docs]**: Digest README.md and core system architecture.
917
+ - **[Scout: Infra]**: Detect CI/CD, Docker, and environment configuration.
918
+ 2. **PARALLEL SYNC**: Use \`\${TOOL_NAMES.LIST_TASKS}\` to monitor progress.
919
+ 3. **ONE-PASS INGESTION**: Once all scouts show DONE, use \`\${TOOL_NAMES.GET_TASK_RESULT}\` for ALL scouts in a single turn to consolidate findings into \`\${PATHS.CONTEXT}\`.
920
+
921
+ [CRITICAL]: Sequential execution (running tools yourself) is a mission failure. Launch the swarm NOW.`;
922
+ var PHASE_1_THINK_ANALYSIS = `### 1.1 MISSION SCOPE
923
+ - What is the FULL scope? What are the success criteria?
924
+ - What does the user REALLY want?
925
+
926
+ ### 1.2 DECOMPOSITION
927
+ - Break into INDEPENDENT sub-tasks.
928
+ - Identify sequential dependencies vs parallel opportunities.
929
+
930
+ ### 1.3 DELEGATION
931
+ - Choose best agent for each task (\${AGENT_NAMES.PLANNER}/\${AGENT_NAMES.WORKER}/\${AGENT_NAMES.REVIEWER}).
932
+ - Provide focused context for each.
933
+
934
+ ### 1.4 RISK ASSESSMENT
935
+ - Identify high-risk parts and fallback plans.
936
+ - If agent fails \u2192 See RECOVERY section.`;
937
+ var PHASE_5_MSVP = `1. **STAGE 1 (Unit)**: Workers MUST trigger \${AGENT_NAMES.REVIEWER} for unit verification immediately upon completion.
938
+ 2. **STAGE 2 (Integration)**: \${AGENT_NAMES.REVIEWER} validates cross-module consistency.
939
+ 3. **E2E VALIDATION**: Run full system tests and build pass check.
940
+ 4. **SEAL GATE**: No SEALED output until \${PATHS.TODO} is all [x] and zero issues remain.`;
941
+ var HPFA_RULES = `1. **Fractal Spawning**: Workers spawn sub-workers for complex files/modules.
942
+ 2. **Speculative Racing**: Launch multiple strategies in parallel (mode: race) for uncertainty.
943
+ 3. **Asynchronous Batching**: Group non-dependent tool calls to trigger host-side parallelism.
944
+ 4. **Barrier-Sync Pipeline**: Reviewers start Unit Review (Stage 1) while other workers still run.
945
+ 5. **Real-time Brain Sync**: Parallel sessions share public interfaces via shared task logs.`;
946
+
910
947
  // src/core/agents/consts/task-status.const.ts
911
948
  var TASK_STATUS = {
912
949
  PENDING: STATUS_LABEL.PENDING,
@@ -13772,34 +13809,9 @@ var HYPER_PARALLEL_ENFORCEMENT = `${PROMPT_TAGS.QUALITY_CHECKLIST.open}
13772
13809
 
13773
13810
  To achieve maximum velocity, you MUST leverage these advanced parallel execution patterns:
13774
13811
 
13775
- ### 1. Fractal Self-Delegation (Recursive Scaling)
13776
- If you are a Worker and your assigned task is complex (e.g., implementing multiple endpoints, refactoring several files), **do not do it sequentially**.
13777
- - **Spawn Sub-Workers**: Use \`delegate_task\` to launch sub-agents for independent sub-components.
13778
- - **Fractal Depth**: You can scale down to any depth. Each worker acts as a local coordinator for its sub-workers.
13779
- - **Context Sharding**: Give each sub-worker a focused, atomic prompt and relevant file context.
13780
-
13781
- ### 2. Speculative Racing (Competitive Implementation)
13782
- When faced with a high-uncertainty problem (bug fixing, complex refactoring with multiple possible approaches):
13783
- - **Launch a Race**: Spawn multiple Workers (\`mode: "race"\`) with slightly different prompts or strategies.
13784
- - **Winning Criteria**: The first agent to produce a solution that passes unit tests "wins".
13785
- - **Efficiency**: This eliminates the "try-fail-repeat" loop by trying all likely solutions simultaneously.
13786
-
13787
- ### 3. Asynchronous Batching
13788
- When you need to perform many independent reads or metadata checks:
13789
- - **Batch Operations**: Group your tool calls to trigger massive parallel execution host-side.
13790
- - **Avoid Serial Bottlenecks**: Never wait for a tool result if you have other independent tasks you could be launching in parallel.
13791
-
13792
- ### 4. Barrier-Sync Integrated Pipeline (BSIP)
13793
- Don't wait for all workers to finish before starting reviews:
13794
- - **Pipelined Verification**: Immediately spawn a Reviewer task as soon as a Worker finishes its individual sub-task. The review of Module A happens while Module B is still being built.
13795
- - **Synchronization Point**: Use the "Final Sync Barrier" to wait for all parallel implementation AND individual reviews to complete.
13796
- - **Global Integration**: The final master Reviewer only acts once all individual units have been verified by their respective sub-reviewers.
13797
-
13798
- ### 5. Real-time Brain Sync
13799
- As you work in a parallel session, log your critical findings or discovered interface changes to the shared task log.
13800
- Assume that:
13801
- - **Global Awareness**: Other workers are aware of your public findings.
13802
- - **Consistency**: You must check for "Global Context Updates" to ensure your parallel work aligns with the latest state of the system.
13812
+ ${HPFA_RULES}
13813
+
13814
+ [CRITICAL]: Sequential execution when parallel is possible is a mission failure.
13803
13815
  ${PROMPT_TAGS.QUALITY_CHECKLIST.close}`;
13804
13816
 
13805
13817
  // src/agents/prompts/commander/role.ts
@@ -13906,41 +13918,12 @@ ${PROMPT_TAGS.TOOLS.close}`;
13906
13918
  // src/agents/prompts/commander/execution.ts
13907
13919
  var COMMANDER_EXECUTION = `${PROMPT_TAGS.EXECUTION_STRATEGY.open}
13908
13920
  ## ${PHASES.PHASE_0.ID}: ${PHASES.PHASE_0.NAME} (Cognitive Velocity Launch)
13909
- **Mandatory High-Velocity Initialization**: Do not perform discovery sequentially. Launch a swarm of scouts immediately.
13910
-
13911
- 1. **Initialize \`${PATHS.OPENCODE}\` folder**:
13912
- - Immediate setup for CONTEXT SHARING (DELETE existing if fresh start).
13913
- 2. **LAUNCH Parallel Discovery Tasks (background=true)**:
13914
- - **[Scout: Structure]**: Analyze project tree (ls, find) at depth 2-3.
13915
- - **[Scout: Stack]**: Parse package.json, Cargo.toml, or pyproject.toml for identity.
13916
- - **[Scout: Docs]**: Analyze README.md, CONTRIBUTING.md, and core architecture docs.
13917
- - **[Scout: Infra]**: Detect Docker, CI/CD pipelines, and environment variables.
13918
- 3. **BARRIER SYNC & RETRIEVE**: Monitor scouts. Once finished, **READ all scout results** and \`${PATHS.CONTEXT}\` to ingest all findings.
13919
- 4. **SET TARGET**: Use the unified context to proceed to Phase 1.
13921
+ ${PHASE_0_SCOUT_SWARM}
13920
13922
 
13921
13923
  ## ${PHASES.PHASE_1.ID}: ${PHASES.PHASE_1.NAME} (Mandatory - Never Skip!)
13922
13924
  **THINK FIRST**: As ${AGENT_NAMES.COMMANDER}, think about ORCHESTRATION and synthesis before action.
13923
13925
 
13924
- ### 1.1 MISSION SCOPE
13925
- - What is the FULL scope of this mission?
13926
- - What are the deliverables and success criteria?
13927
- - What does the user REALLY want (not just what they said)?
13928
-
13929
- ### 1.2 DECOMPOSITION
13930
- - How can I break this into INDEPENDENT sub-tasks?
13931
- - Which tasks MUST be sequential (dependencies)?
13932
- - What is the MAXIMUM parallelism I can achieve?
13933
-
13934
- ### 1.3 DELEGATION
13935
- - Which agent is BEST for each task? (${AGENT_NAMES.PLANNER}/${AGENT_NAMES.WORKER}/${AGENT_NAMES.REVIEWER})
13936
- - What context does each agent NEED to succeed?
13937
- - What could cause an agent to FAIL or get stuck?
13938
-
13939
- ### 1.4 RISK ASSESSMENT
13940
- - What are the HIGH-RISK parts of this mission?
13941
- - What is my FALLBACK if a task fails?
13942
- - How will I DETECT and RECOVER from issues?
13943
- - If agent fails \u2192 See ${PROMPT_TAGS.RECOVERY.open} section: DECOMPOSE and retry
13926
+ ${PHASE_1_THINK_ANALYSIS}
13944
13927
 
13945
13928
  **ANTI-PATTERNS**: Sequential execution when parallel is possible. Doing work yourself instead of delegating. Starting without clear decomposition or intellectual synthesis.
13946
13929
 
@@ -13962,10 +13945,7 @@ ${AGENT_NAMES.PLANNER} creates ${PATHS.TODO} with parallel groups
13962
13945
  5. REPEAT until all [ ] become [x]
13963
13946
 
13964
13947
  ## ${PHASES.PHASE_5.ID}: ${PHASES.PHASE_5.NAME}
13965
- 1. **STAGE 1 (Unit)**: Reviewers validate individual module changes (triggered by Workers).
13966
- 2. **STAGE 2 (Integration)**: ${AGENT_NAMES.REVIEWER} validates cross-module consistency.
13967
- 3. **E2E VALIDATION**: Run full system tests and build pass check.
13968
- 4. Only proceed to SEAL if all criteria are met with zero regressions.
13948
+ ${PHASE_5_MSVP}
13969
13949
 
13970
13950
  ## ${PHASES.PHASE_6.ID}: ${PHASES.PHASE_6.NAME}
13971
13951
  When ALL conditions met, output ${MISSION_SEAL.PATTERN}
@@ -14637,7 +14617,6 @@ var WORKER_WORKFLOW = `${PROMPT_TAGS.WORKFLOW.open}
14637
14617
  ADAPTIVE IMPLEMENTATION WORKFLOW
14638
14618
 
14639
14619
  ## Phase 1: UNDERSTAND (Before writing ANY code)
14640
-
14641
14620
  1. Read ${PATHS.CONTEXT} \u2192 Get project environment, build/test commands
14642
14621
  2. Read ${PATHS.TODO} \u2192 Understand assigned task and acceptance criteria
14643
14622
  3. Read ${PATHS.DOCS}/ \u2192 Check for cached API docs, syntax references
@@ -14648,7 +14627,6 @@ ADAPTIVE IMPLEMENTATION WORKFLOW
14648
14627
  # Find related files
14649
14628
  find . -name "*.ts" -o -name "*.py" -o -name "*.go" | head -${LIMITS.DEFAULT_SCAN_LIMIT}
14650
14629
  \`\`\`
14651
-
14652
14630
  5. Study existing PATTERNS:
14653
14631
  - How are errors handled?
14654
14632
  - How are tests structured?
@@ -14660,20 +14638,16 @@ ADAPTIVE IMPLEMENTATION WORKFLOW
14660
14638
  - Use **${TOOL_NAMES.WEBSEARCH}** to find official docs
14661
14639
  - Use **${TOOL_NAMES.WEBFETCH}** to read URL content
14662
14640
  - Use **${TOOL_NAMES.CACHE_DOCS}** to save to ${PATHS.DOCS}/
14663
- - Example: \`${TOOL_NAMES.WEBSEARCH}({ query: "[library] [version] API docs" })\`
14664
14641
 
14665
14642
  ## Phase 4: IMPLEMENT (Following discoveries)
14666
14643
  7. Write code following OBSERVED patterns
14667
14644
  8. Handle edge cases like existing code does
14668
14645
  9. Add tests matching project's test style
14669
14646
 
14670
- ## Phase 5: VERIFY & TRIGGER SHADOW REVIEW
14671
- 10. Run ${TOOL_NAMES.LSP_DIAGNOSTICS} \u2192 Must be clean
14672
- 11. Run BUILD & TEST commands from ${PATHS.CONTEXT}
14673
- 12. **TRIGGER STAGE 1 REVIEW**:
14674
- - Before finishing, ${TOOL_NAMES.DELEGATE_TASK} to **${AGENT_NAMES.REVIEWER}** for unit verification.
14675
- - Prompt: "Verify unit changes in [your module] for mission [mission_id]. Run tests and check diagnostics."
14676
- 13. Report completion WITH evidence (test logs, review status).
14647
+ ## Phase 5: VERIFY & MSVP STAGE 1
14648
+ ${PHASE_5_MSVP}
14649
+
14650
+ [ACTION]: Use ${TOOL_NAMES.DELEGATE_TASK} to trigger ${AGENT_NAMES.REVIEWER} for Unit Verification before reporting DONE.
14677
14651
 
14678
14652
  **CRITICAL**: Do NOT mark [x] in ${PATHS.TODO} - that's ${AGENT_NAMES.REVIEWER}'s job after Stage 2!
14679
14653
  ${PROMPT_TAGS.WORKFLOW.close}`;
@@ -4,3 +4,4 @@
4
4
  export { PROMPT_TAGS, wrapTag } from "./tags.js";
5
5
  export { WORK_STATUS } from "./status.js";
6
6
  export { PHILOSOPHY_PHASES, PHILOSOPHY_TAGLINE, PHILOSOPHY_QUOTE, PHILOSOPHY_LEARN_PRINCIPLE, EXECUTION_CYCLE, EXECUTION_CYCLE_STEPS, } from "./philosophy.js";
7
+ export { PHASE_0_SCOUT_SWARM, PHASE_1_THINK_ANALYSIS, PHASE_5_MSVP, HPFA_RULES } from "./mandates.js";
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Architectural Mandates - Immutable Core Logic
3
+ *
4
+ * These constants define the non-negotiable architectural requirements
5
+ * that ensure the orchestrator operates according to the verified diagram.
6
+ */
7
+ /**
8
+ * Phase 0: Discovery Swarm Mandate
9
+ * Force parallel execution of scouts to maximize velocity.
10
+ */
11
+ export declare const PHASE_0_SCOUT_SWARM = "**Mandatory Parallel Initialization**: DO NOT run discovery tools (ls, grep, find) yourself. Your job is to ORCHESTRATE and synthesize results. \n\n1. **LAUNCH Parallel Scouts**: In your VERY FIRST response, you must output ALL of the following `${TOOL_NAMES.DELEGATE_TASK}` calls simultaneously (background: true):\n - **[Scout: Structure]**: Map the project tree and locate src/tests/docs.\n - **[Scout: Stack]**: Identify language, frameworks, and build/test commands.\n - **[Scout: Docs]**: Digest README.md and core system architecture.\n - **[Scout: Infra]**: Detect CI/CD, Docker, and environment configuration.\n2. **PARALLEL SYNC**: Use `${TOOL_NAMES.LIST_TASKS}` to monitor progress. \n3. **ONE-PASS INGESTION**: Once all scouts show DONE, use `${TOOL_NAMES.GET_TASK_RESULT}` for ALL scouts in a single turn to consolidate findings into `${PATHS.CONTEXT}`.\n\n[CRITICAL]: Sequential execution (running tools yourself) is a mission failure. Launch the swarm NOW.";
12
+ /**
13
+ * Phase 1: THINK (Strategic Mandate)
14
+ */
15
+ export declare const PHASE_1_THINK_ANALYSIS = "### 1.1 MISSION SCOPE\n- What is the FULL scope? What are the success criteria?\n- What does the user REALLY want?\n\n### 1.2 DECOMPOSITION\n- Break into INDEPENDENT sub-tasks.\n- Identify sequential dependencies vs parallel opportunities.\n\n### 1.3 DELEGATION\n- Choose best agent for each task (${AGENT_NAMES.PLANNER}/${AGENT_NAMES.WORKER}/${AGENT_NAMES.REVIEWER}).\n- Provide focused context for each.\n\n### 1.4 RISK ASSESSMENT\n- Identify high-risk parts and fallback plans.\n- If agent fails \u2192 See RECOVERY section.";
16
+ /**
17
+ * Phase 5: MSVP (Multi-Stage Verification Pipeline)
18
+ */
19
+ export declare const PHASE_5_MSVP = "1. **STAGE 1 (Unit)**: Workers MUST trigger ${AGENT_NAMES.REVIEWER} for unit verification immediately upon completion.\n2. **STAGE 2 (Integration)**: ${AGENT_NAMES.REVIEWER} validates cross-module consistency.\n3. **E2E VALIDATION**: Run full system tests and build pass check.\n4. **SEAL GATE**: No SEALED output until ${PATHS.TODO} is all [x] and zero issues remain.";
20
+ /**
21
+ * HPFA (Hyper-Parallel Fractal Architecture) Rules
22
+ */
23
+ export declare const HPFA_RULES = "1. **Fractal Spawning**: Workers spawn sub-workers for complex files/modules.\n2. **Speculative Racing**: Launch multiple strategies in parallel (mode: race) for uncertainty.\n3. **Asynchronous Batching**: Group non-dependent tool calls to trigger host-side parallelism.\n4. **Barrier-Sync Pipeline**: Reviewers start Unit Review (Stage 1) while other workers still run.\n5. **Real-time Brain Sync**: Parallel sessions share public interfaces via shared task logs.";
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.15",
5
+ "version": "1.0.17",
6
6
  "author": "agnusdei1207",
7
7
  "license": "MIT",
8
8
  "repository": {