opencode-orchestrator 1.0.14 → 1.0.16
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,54 @@ 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 MANDATES = {
|
|
912
|
+
/**
|
|
913
|
+
* Phase 0: Discovery Swarm Mandate
|
|
914
|
+
*/
|
|
915
|
+
PHASE_0_SCOUT_SWARM: `**Mandatory Parallel Initialization**: DO NOT run discovery tools (ls, grep, find) yourself. Your job is to ORCHESTRATE.
|
|
916
|
+
|
|
917
|
+
1. **LAUNCH Parallel Scouts**: In your VERY FIRST response, output ALL '${TOOL_NAMES.DELEGATE_TASK}' calls (background: true) for:
|
|
918
|
+
- [Scout: Structure]: Map project tree via ${AGENT_NAMES.PLANNER}.
|
|
919
|
+
- [Scout: Stack]: Identify tech stack via ${AGENT_NAMES.PLANNER}.
|
|
920
|
+
- [Scout: Docs]: Digest README and architecture via ${AGENT_NAMES.PLANNER}.
|
|
921
|
+
- [Scout: Infra]: Detect CI/CD and Docker via ${AGENT_NAMES.PLANNER}.
|
|
922
|
+
2. **BARRIER SYNC**: READ consolidated results from ${PATHS.CONTEXT} and scout sessions only AFTER all show'DONE'.`,
|
|
923
|
+
/**
|
|
924
|
+
* Phase 1: THINK (Strategic Mandate)
|
|
925
|
+
*/
|
|
926
|
+
PHASE_1_THINK_ANALYSIS: `### 1.1 MISSION SCOPE
|
|
927
|
+
- What is the FULL scope? What are the success criteria?
|
|
928
|
+
- What does the user REALLY want?
|
|
929
|
+
|
|
930
|
+
### 1.2 DECOMPOSITION
|
|
931
|
+
- Break into INDEPENDENT sub-tasks.
|
|
932
|
+
- Identify sequential dependencies vs parallel opportunities.
|
|
933
|
+
|
|
934
|
+
### 1.3 DELEGATION
|
|
935
|
+
- Choose best agent for each task (${AGENT_NAMES.PLANNER}/${AGENT_NAMES.WORKER}/${AGENT_NAMES.REVIEWER}).
|
|
936
|
+
- Provide focused context for each.
|
|
937
|
+
|
|
938
|
+
### 1.4 RISK ASSESSMENT
|
|
939
|
+
- Identify high-risk parts and fallback plans.
|
|
940
|
+
- If agent fails \u2192 See RECOVERY section.`,
|
|
941
|
+
/**
|
|
942
|
+
* Phase 5: MSVP (Multi-Stage Verification Pipeline)
|
|
943
|
+
*/
|
|
944
|
+
PHASE_5_MSVP: `1. **STAGE 1 (Unit)**: Workers MUST trigger ${AGENT_NAMES.REVIEWER} for unit verification immediately upon completion.
|
|
945
|
+
2. **STAGE 2 (Integration)**: ${AGENT_NAMES.REVIEWER} validates cross-module consistency.
|
|
946
|
+
3. **E2E VALIDATION**: Run full system tests and build pass check.
|
|
947
|
+
4. **SEAL GATE**: No SEALED output until ${PATHS.TODO} is all [x] and zero issues remain.`,
|
|
948
|
+
/**
|
|
949
|
+
* HPFA (Hyper-Parallel Fractal Architecture) Rules
|
|
950
|
+
*/
|
|
951
|
+
HPFA_RULES: `1. **Fractal Spawning**: Workers spawn sub-workers for complex files/modules.
|
|
952
|
+
2. **Speculative Racing**: Launch multiple strategies in parallel (mode: race) for uncertainty.
|
|
953
|
+
3. **Asynchronous Batching**: Group non-dependent tool calls to trigger host-side parallelism.
|
|
954
|
+
4. **Barrier-Sync Pipeline**: Reviewers start Unit Review (Stage 1) while other workers still run.
|
|
955
|
+
5. **Real-time Brain Sync**: Parallel sessions share public interfaces via shared task logs.`
|
|
956
|
+
};
|
|
957
|
+
|
|
910
958
|
// src/core/agents/consts/task-status.const.ts
|
|
911
959
|
var TASK_STATUS = {
|
|
912
960
|
PENDING: STATUS_LABEL.PENDING,
|
|
@@ -13772,34 +13820,9 @@ var HYPER_PARALLEL_ENFORCEMENT = `${PROMPT_TAGS.QUALITY_CHECKLIST.open}
|
|
|
13772
13820
|
|
|
13773
13821
|
To achieve maximum velocity, you MUST leverage these advanced parallel execution patterns:
|
|
13774
13822
|
|
|
13775
|
-
|
|
13776
|
-
|
|
13777
|
-
|
|
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.
|
|
13823
|
+
${MANDATES.HPFA_RULES}
|
|
13824
|
+
|
|
13825
|
+
[CRITICAL]: Sequential execution when parallel is possible is a mission failure.
|
|
13803
13826
|
${PROMPT_TAGS.QUALITY_CHECKLIST.close}`;
|
|
13804
13827
|
|
|
13805
13828
|
// src/agents/prompts/commander/role.ts
|
|
@@ -13906,41 +13929,12 @@ ${PROMPT_TAGS.TOOLS.close}`;
|
|
|
13906
13929
|
// src/agents/prompts/commander/execution.ts
|
|
13907
13930
|
var COMMANDER_EXECUTION = `${PROMPT_TAGS.EXECUTION_STRATEGY.open}
|
|
13908
13931
|
## ${PHASES.PHASE_0.ID}: ${PHASES.PHASE_0.NAME} (Cognitive Velocity Launch)
|
|
13909
|
-
|
|
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.
|
|
13932
|
+
${MANDATES.PHASE_0_SCOUT_SWARM}
|
|
13920
13933
|
|
|
13921
13934
|
## ${PHASES.PHASE_1.ID}: ${PHASES.PHASE_1.NAME} (Mandatory - Never Skip!)
|
|
13922
13935
|
**THINK FIRST**: As ${AGENT_NAMES.COMMANDER}, think about ORCHESTRATION and synthesis before action.
|
|
13923
13936
|
|
|
13924
|
-
|
|
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
|
|
13937
|
+
${MANDATES.PHASE_1_THINK_ANALYSIS}
|
|
13944
13938
|
|
|
13945
13939
|
**ANTI-PATTERNS**: Sequential execution when parallel is possible. Doing work yourself instead of delegating. Starting without clear decomposition or intellectual synthesis.
|
|
13946
13940
|
|
|
@@ -13962,10 +13956,7 @@ ${AGENT_NAMES.PLANNER} creates ${PATHS.TODO} with parallel groups
|
|
|
13962
13956
|
5. REPEAT until all [ ] become [x]
|
|
13963
13957
|
|
|
13964
13958
|
## ${PHASES.PHASE_5.ID}: ${PHASES.PHASE_5.NAME}
|
|
13965
|
-
|
|
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.
|
|
13959
|
+
${MANDATES.PHASE_5_MSVP}
|
|
13969
13960
|
|
|
13970
13961
|
## ${PHASES.PHASE_6.ID}: ${PHASES.PHASE_6.NAME}
|
|
13971
13962
|
When ALL conditions met, output ${MISSION_SEAL.PATTERN}
|
|
@@ -14637,7 +14628,6 @@ var WORKER_WORKFLOW = `${PROMPT_TAGS.WORKFLOW.open}
|
|
|
14637
14628
|
ADAPTIVE IMPLEMENTATION WORKFLOW
|
|
14638
14629
|
|
|
14639
14630
|
## Phase 1: UNDERSTAND (Before writing ANY code)
|
|
14640
|
-
|
|
14641
14631
|
1. Read ${PATHS.CONTEXT} \u2192 Get project environment, build/test commands
|
|
14642
14632
|
2. Read ${PATHS.TODO} \u2192 Understand assigned task and acceptance criteria
|
|
14643
14633
|
3. Read ${PATHS.DOCS}/ \u2192 Check for cached API docs, syntax references
|
|
@@ -14648,7 +14638,6 @@ ADAPTIVE IMPLEMENTATION WORKFLOW
|
|
|
14648
14638
|
# Find related files
|
|
14649
14639
|
find . -name "*.ts" -o -name "*.py" -o -name "*.go" | head -${LIMITS.DEFAULT_SCAN_LIMIT}
|
|
14650
14640
|
\`\`\`
|
|
14651
|
-
|
|
14652
14641
|
5. Study existing PATTERNS:
|
|
14653
14642
|
- How are errors handled?
|
|
14654
14643
|
- How are tests structured?
|
|
@@ -14660,20 +14649,16 @@ ADAPTIVE IMPLEMENTATION WORKFLOW
|
|
|
14660
14649
|
- Use **${TOOL_NAMES.WEBSEARCH}** to find official docs
|
|
14661
14650
|
- Use **${TOOL_NAMES.WEBFETCH}** to read URL content
|
|
14662
14651
|
- Use **${TOOL_NAMES.CACHE_DOCS}** to save to ${PATHS.DOCS}/
|
|
14663
|
-
- Example: \`${TOOL_NAMES.WEBSEARCH}({ query: "[library] [version] API docs" })\`
|
|
14664
14652
|
|
|
14665
14653
|
## Phase 4: IMPLEMENT (Following discoveries)
|
|
14666
14654
|
7. Write code following OBSERVED patterns
|
|
14667
14655
|
8. Handle edge cases like existing code does
|
|
14668
14656
|
9. Add tests matching project's test style
|
|
14669
14657
|
|
|
14670
|
-
## Phase 5: VERIFY &
|
|
14671
|
-
|
|
14672
|
-
|
|
14673
|
-
|
|
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).
|
|
14658
|
+
## Phase 5: VERIFY & MSVP STAGE 1
|
|
14659
|
+
${MANDATES.PHASE_5_MSVP}
|
|
14660
|
+
|
|
14661
|
+
[ACTION]: Use ${TOOL_NAMES.DELEGATE_TASK} to trigger ${AGENT_NAMES.REVIEWER} for Unit Verification before reporting DONE.
|
|
14677
14662
|
|
|
14678
14663
|
**CRITICAL**: Do NOT mark [x] in ${PATHS.TODO} - that's ${AGENT_NAMES.REVIEWER}'s job after Stage 2!
|
|
14679
14664
|
${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 { MANDATES } from "./mandates.js";
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
export declare const MANDATES: {
|
|
8
|
+
/**
|
|
9
|
+
* Phase 0: Discovery Swarm Mandate
|
|
10
|
+
*/
|
|
11
|
+
readonly PHASE_0_SCOUT_SWARM: "**Mandatory Parallel Initialization**: DO NOT run discovery tools (ls, grep, find) yourself. Your job is to ORCHESTRATE. \n\n1. **LAUNCH Parallel Scouts**: In your VERY FIRST response, output ALL 'delegate_task' calls (background: true) for:\n - [Scout: Structure]: Map project tree via Planner.\n - [Scout: Stack]: Identify tech stack via Planner.\n - [Scout: Docs]: Digest README and architecture via Planner.\n - [Scout: Infra]: Detect CI/CD and Docker via Planner.\n2. **BARRIER SYNC**: READ consolidated results from .opencode/context.md and scout sessions only AFTER all show'DONE'.";
|
|
12
|
+
/**
|
|
13
|
+
* Phase 1: THINK (Strategic Mandate)
|
|
14
|
+
*/
|
|
15
|
+
readonly 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 (Planner/Worker/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 → See RECOVERY section.";
|
|
16
|
+
/**
|
|
17
|
+
* Phase 5: MSVP (Multi-Stage Verification Pipeline)
|
|
18
|
+
*/
|
|
19
|
+
readonly PHASE_5_MSVP: "1. **STAGE 1 (Unit)**: Workers MUST trigger Reviewer for unit verification immediately upon completion.\n2. **STAGE 2 (Integration)**: Reviewer validates cross-module consistency.\n3. **E2E VALIDATION**: Run full system tests and build pass check.\n4. **SEAL GATE**: No SEALED output until .opencode/todo.md is all [x] and zero issues remain.";
|
|
20
|
+
/**
|
|
21
|
+
* HPFA (Hyper-Parallel Fractal Architecture) Rules
|
|
22
|
+
*/
|
|
23
|
+
readonly 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.";
|
|
24
|
+
};
|
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.16",
|
|
6
6
|
"author": "agnusdei1207",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|