opencode-orchestrator 0.6.21 → 0.6.23
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 +8 -5
- package/dist/core/cache/constants.d.ts +2 -2
- package/dist/index.js +129 -60
- package/dist/shared/constants.d.ts +9 -2
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
| **⚡ 50x Parallel Sessions** | Massive concurrent task execution |
|
|
24
24
|
| **📊 Auto Memory Management** | GC, archiving, zero memory leaks |
|
|
25
25
|
| **🔄 Auto Recovery** | Handles rate limits, errors automatically |
|
|
26
|
-
|
|
|
26
|
+
| **📁 Smart Context (.opencode/)** | Dynamic summarization, adaptive detail |
|
|
27
27
|
|
|
28
28
|
---
|
|
29
29
|
|
|
@@ -81,9 +81,12 @@
|
|
|
81
81
|
│
|
|
82
82
|
▼
|
|
83
83
|
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
84
|
-
│
|
|
84
|
+
│ 📁 SMART CONTEXT (.opencode/) │
|
|
85
85
|
│ │
|
|
86
|
-
│
|
|
86
|
+
│ .opencode/todo.md - Master TODO list (Recorder manages) │
|
|
87
|
+
│ .opencode/context.md - Adaptive size based on project phase │
|
|
88
|
+
│ .opencode/docs/ - Cached documentation (auto-cleanup) │
|
|
89
|
+
│ .opencode/archive/ - Old context for reference │
|
|
87
90
|
└─────────────────────────────────────────────────────────────────────────────┘
|
|
88
91
|
```
|
|
89
92
|
|
|
@@ -98,8 +101,8 @@
|
|
|
98
101
|
| **Parallel Sessions** | Up to 50 concurrent | Single session |
|
|
99
102
|
| **Memory Management** | Auto GC + disk archiving | Memory leaks |
|
|
100
103
|
| **Error Recovery** | Pattern-based auto retry | Crash |
|
|
101
|
-
| **Context Sharing** |
|
|
102
|
-
| **
|
|
104
|
+
| **Context Sharing** | .opencode/ with smart summarization | Isolated |
|
|
105
|
+
| **Smart Context** | Adaptive detail (Early/Building/Finishing) | Static |
|
|
103
106
|
| **Task Decomposition** | 3-level hierarchy | Flat |
|
|
104
107
|
|
|
105
108
|
---
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Document Cache Constants
|
|
3
3
|
*/
|
|
4
|
-
export declare const CACHE_DIR
|
|
5
|
-
export declare const METADATA_FILE
|
|
4
|
+
export declare const CACHE_DIR: ".opencode/docs";
|
|
5
|
+
export declare const METADATA_FILE: ".opencode/docs/_metadata.json";
|
|
6
6
|
export declare const DEFAULT_TTL_MS: number;
|
package/dist/index.js
CHANGED
|
@@ -74,8 +74,18 @@ var MEMORY_LIMITS = {
|
|
|
74
74
|
// Remove errors after 10 min
|
|
75
75
|
};
|
|
76
76
|
var PATHS = {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
// Base directory
|
|
78
|
+
OPENCODE: ".opencode",
|
|
79
|
+
// Subdirectories
|
|
80
|
+
DOCS: ".opencode/docs",
|
|
81
|
+
ARCHIVE: ".opencode/archive",
|
|
82
|
+
TASK_ARCHIVE: ".opencode/archive/tasks",
|
|
83
|
+
DOC_ARCHIVE: ".opencode/archive/docs",
|
|
84
|
+
// Files
|
|
85
|
+
TODO: ".opencode/todo.md",
|
|
86
|
+
CONTEXT: ".opencode/context.md",
|
|
87
|
+
SUMMARY: ".opencode/summary.md",
|
|
88
|
+
DOC_METADATA: ".opencode/docs/_metadata.json"
|
|
79
89
|
};
|
|
80
90
|
var BACKGROUND_TASK = {
|
|
81
91
|
DEFAULT_TIMEOUT_MS: 5 * TIME.MINUTE,
|
|
@@ -431,12 +441,25 @@ Use lsp_diagnostics for syntax checking.
|
|
|
431
441
|
Use background for long commands.
|
|
432
442
|
</verification>
|
|
433
443
|
|
|
444
|
+
<context_contribution>
|
|
445
|
+
AFTER COMPLETING TASK:
|
|
446
|
+
- Report what you did briefly
|
|
447
|
+
- If research/docs are no longer needed \u2192 mention for cleanup
|
|
448
|
+
- If you found a better pattern \u2192 note it for team
|
|
449
|
+
|
|
450
|
+
KEEP CONTEXT LEAN:
|
|
451
|
+
- Don't repeat what's in code
|
|
452
|
+
- Point to files: "See src/X.ts:10-50"
|
|
453
|
+
- Remove your debugging notes after fix
|
|
454
|
+
</context_contribution>
|
|
455
|
+
|
|
434
456
|
<output>
|
|
435
457
|
TASK: T[N] from .opencode/todo.md
|
|
436
458
|
CHANGED: [file] [lines]
|
|
437
459
|
ACTION: [what]
|
|
438
460
|
VERIFY: [result]
|
|
439
461
|
DOCS_USED: .opencode/docs/[file]
|
|
462
|
+
CLEANUP: [docs/notes that can be deleted now]
|
|
440
463
|
\u2192 ${AGENT_NAMES.RECORDER} please update TODO
|
|
441
464
|
</output>`,
|
|
442
465
|
canWrite: true,
|
|
@@ -497,77 +520,104 @@ Fix: [suggestion]
|
|
|
497
520
|
// src/agents/subagents/recorder.ts
|
|
498
521
|
var recorder = {
|
|
499
522
|
id: AGENT_NAMES.RECORDER,
|
|
500
|
-
description: "Recorder - TODO tracking and context
|
|
523
|
+
description: "Recorder - TODO tracking and smart context management",
|
|
501
524
|
systemPrompt: `<role>
|
|
502
|
-
You are ${AGENT_NAMES.RECORDER}.
|
|
503
|
-
|
|
504
|
-
Maintain context for team.
|
|
525
|
+
You are ${AGENT_NAMES.RECORDER}. Smart context manager.
|
|
526
|
+
Maintain .opencode/ with DYNAMIC detail levels.
|
|
505
527
|
</role>
|
|
506
528
|
|
|
507
529
|
<todo_management>
|
|
508
|
-
|
|
530
|
+
FILE: .opencode/todo.md
|
|
509
531
|
|
|
510
|
-
When task completes:
|
|
511
532
|
\`\`\`markdown
|
|
512
533
|
- [x] T1: [task] | \u2705 DONE by ${AGENT_NAMES.BUILDER}
|
|
513
534
|
- [ ] T2: [task] | in progress
|
|
535
|
+
- [ ] T3: [task] | blocked: [reason]
|
|
514
536
|
\`\`\`
|
|
515
|
-
|
|
516
|
-
Track:
|
|
517
|
-
- Which tasks are done
|
|
518
|
-
- Which are in progress
|
|
519
|
-
- Which are blocked
|
|
520
537
|
</todo_management>
|
|
521
538
|
|
|
522
|
-
<
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
-
|
|
526
|
-
-
|
|
527
|
-
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
539
|
+
<smart_context_rules>
|
|
540
|
+
DYNAMIC DETAIL LEVEL - Adapt based on project state:
|
|
541
|
+
|
|
542
|
+
PHASE 1 - EARLY (0-30% done, no code yet):
|
|
543
|
+
- BE DETAILED: Full explanations, decisions, reasoning
|
|
544
|
+
- Include: research findings, API references, examples
|
|
545
|
+
- Files may be long - that's OK for now
|
|
546
|
+
|
|
547
|
+
PHASE 2 - BUILDING (30-70% done, code exists):
|
|
548
|
+
- MODERATE: Key decisions + file references
|
|
549
|
+
- Remove: old research that's now in code
|
|
550
|
+
- Reference: "See src/module.ts for implementation"
|
|
551
|
+
|
|
552
|
+
PHASE 3 - FINISHING (70-100% done):
|
|
553
|
+
- BRIEF: Just status, blockers, todos
|
|
554
|
+
- Heavy summarization - codebase IS the context
|
|
555
|
+
- Delete: debugging notes, iteration logs
|
|
556
|
+
|
|
557
|
+
ADAPTIVE RULES:
|
|
558
|
+
| Condition | Action |
|
|
559
|
+
|-----------|--------|
|
|
560
|
+
| No code yet | Keep detailed docs |
|
|
561
|
+
| Code exists for feature | Summarize, point to code |
|
|
562
|
+
| > 200 lines context.md | Compress to 50 lines |
|
|
563
|
+
| > 500 lines total .opencode/ | Archive old, keep current |
|
|
564
|
+
| Feature complete | Delete related verbose docs |
|
|
565
|
+
</smart_context_rules>
|
|
566
|
+
|
|
567
|
+
<workspace>
|
|
568
|
+
.opencode/
|
|
569
|
+
\u251C\u2500\u2500 todo.md - Master TODO list
|
|
570
|
+
\u251C\u2500\u2500 context.md - Current state (adaptive size)
|
|
571
|
+
\u251C\u2500\u2500 summary.md - Ultra-brief when needed
|
|
572
|
+
\u251C\u2500\u2500 docs/ - Cached documentation
|
|
573
|
+
\u2514\u2500\u2500 archive/ - Old context (auto-cleanup)
|
|
574
|
+
</workspace>
|
|
575
|
+
|
|
576
|
+
<context_template>
|
|
577
|
+
.opencode/context.md (adapt size dynamically):
|
|
537
578
|
\`\`\`markdown
|
|
538
|
-
#
|
|
579
|
+
# Context [Phase: EARLY/BUILDING/FINISHING]
|
|
580
|
+
|
|
581
|
+
## Status
|
|
539
582
|
Mission: [goal]
|
|
540
|
-
Progress: [X/Y
|
|
541
|
-
Last: [recent action]
|
|
542
|
-
Next: [from todo.md]
|
|
543
|
-
Blocked: [if any]
|
|
544
|
-
\`\`\`
|
|
545
|
-
</context_format>
|
|
583
|
+
Progress: [X/Y] ([percent]%)
|
|
546
584
|
|
|
547
|
-
|
|
548
|
-
|
|
585
|
+
## Current
|
|
586
|
+
Working on: [task]
|
|
587
|
+
Blockers: [if any]
|
|
549
588
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
2. If context.md > 200 lines \u2192 SUMMARIZE NOW
|
|
589
|
+
## Key Decisions (keep only important ones)
|
|
590
|
+
- [decision]: [brief reason]
|
|
553
591
|
|
|
554
|
-
|
|
555
|
-
-
|
|
556
|
-
- Keep: key decisions, file changes, blockers
|
|
557
|
-
- Remove: verbose logs, old iterations
|
|
558
|
-
- Team reads summary, not full history
|
|
592
|
+
## Files Changed (keep recent only)
|
|
593
|
+
- [file]: [change]
|
|
559
594
|
|
|
560
|
-
|
|
561
|
-
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
595
|
+
## Next Steps
|
|
596
|
+
- [from todo.md]
|
|
597
|
+
\`\`\`
|
|
598
|
+
</context_template>
|
|
599
|
+
|
|
600
|
+
<cleanup_triggers>
|
|
601
|
+
AFTER EACH UPDATE, CHECK:
|
|
602
|
+
1. Is this info still needed for FUTURE tasks? No \u2192 DELETE
|
|
603
|
+
2. Is this now implemented in code? Yes \u2192 SUMMARIZE to reference
|
|
604
|
+
3. Is context.md > 150 lines? Yes \u2192 COMPRESS
|
|
605
|
+
4. Is any doc > 7 days old and unused? Yes \u2192 ARCHIVE
|
|
606
|
+
|
|
607
|
+
DELETE IMMEDIATELY:
|
|
608
|
+
- Debugging logs after fix
|
|
609
|
+
- Old iteration attempts
|
|
610
|
+
- Research for completed features
|
|
611
|
+
- Temporary notes
|
|
612
|
+
</cleanup_triggers>
|
|
565
613
|
|
|
566
614
|
<output>
|
|
567
|
-
UPDATED:
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
615
|
+
CONTEXT UPDATED:
|
|
616
|
+
Phase: [EARLY/BUILDING/FINISHING]
|
|
617
|
+
todo.md: [X/Y done]
|
|
618
|
+
context.md: [before \u2192 after lines]
|
|
619
|
+
Action: [summarized/archived/kept]
|
|
620
|
+
Next: [task for team]
|
|
571
621
|
</output>`,
|
|
572
622
|
canWrite: true,
|
|
573
623
|
canBash: true
|
|
@@ -623,10 +673,29 @@ Retrieved: [date]
|
|
|
623
673
|
\`\`\`
|
|
624
674
|
</doc_format>
|
|
625
675
|
|
|
676
|
+
<doc_lifecycle>
|
|
677
|
+
DOCS HAVE EXPIRY:
|
|
678
|
+
|
|
679
|
+
WHEN SAVING:
|
|
680
|
+
- Include "Expires: [when this is no longer needed]"
|
|
681
|
+
- Example: "Expires: after T3 complete"
|
|
682
|
+
|
|
683
|
+
WHEN FEATURE IS DONE:
|
|
684
|
+
- Docs can be SUMMARIZED to 5-10 lines
|
|
685
|
+
- Or DELETED if fully implemented in code
|
|
686
|
+
- Team references code, not old docs
|
|
687
|
+
|
|
688
|
+
KEEP DOCS LEAN:
|
|
689
|
+
- Only current, needed documentation
|
|
690
|
+
- Archive old: mv to .opencode/archive/docs/
|
|
691
|
+
- Delete: outdated versions
|
|
692
|
+
</doc_lifecycle>
|
|
693
|
+
|
|
626
694
|
<output>
|
|
627
695
|
QUERY: [question]
|
|
628
696
|
SEARCHED: [official sources]
|
|
629
697
|
SAVED: .opencode/docs/[file].md
|
|
698
|
+
EXPIRES: [when no longer needed]
|
|
630
699
|
SUMMARY: [key findings]
|
|
631
700
|
|
|
632
701
|
Team can now reference .opencode/docs/[file].md
|
|
@@ -14138,7 +14207,7 @@ var presets = {
|
|
|
14138
14207
|
}),
|
|
14139
14208
|
documentCached: (filename) => show({
|
|
14140
14209
|
title: "\u{1F4C4} Document Cached",
|
|
14141
|
-
message:
|
|
14210
|
+
message: `${PATHS.DOCS}/${filename}`,
|
|
14142
14211
|
variant: "info",
|
|
14143
14212
|
duration: 2e3
|
|
14144
14213
|
}),
|
|
@@ -15078,8 +15147,8 @@ Request a fresh plan from Architect with reduced scope.
|
|
|
15078
15147
|
</critical_anomaly>`;
|
|
15079
15148
|
|
|
15080
15149
|
// src/core/cache/constants.ts
|
|
15081
|
-
var CACHE_DIR =
|
|
15082
|
-
var METADATA_FILE =
|
|
15150
|
+
var CACHE_DIR = PATHS.DOCS;
|
|
15151
|
+
var METADATA_FILE = PATHS.DOC_METADATA;
|
|
15083
15152
|
var DEFAULT_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
15084
15153
|
|
|
15085
15154
|
// src/core/cache/operations.ts
|
|
@@ -15303,7 +15372,7 @@ ${cached2.content}`;
|
|
|
15303
15372
|
const content = JSON.stringify(JSON.parse(html), null, 2);
|
|
15304
15373
|
if (cache) {
|
|
15305
15374
|
const filename = await set2(url2, content, "JSON Response");
|
|
15306
|
-
return `\u{1F4C4} **JSON fetched** (cached: .
|
|
15375
|
+
return `\u{1F4C4} **JSON fetched** (cached: ${PATHS.DOCS}/${filename})
|
|
15307
15376
|
|
|
15308
15377
|
\`\`\`json
|
|
15309
15378
|
${content.slice(0, 5e3)}
|
|
@@ -15318,7 +15387,7 @@ ${content.slice(0, 5e3)}
|
|
|
15318
15387
|
if (contentType.includes("text/plain")) {
|
|
15319
15388
|
if (cache) {
|
|
15320
15389
|
const filename = await set2(url2, html, "Plain Text");
|
|
15321
|
-
return `\u{1F4C4} **Text fetched** (cached: .
|
|
15390
|
+
return `\u{1F4C4} **Text fetched** (cached: ${PATHS.DOCS}/${filename})
|
|
15322
15391
|
|
|
15323
15392
|
${html.slice(0, 1e4)}`;
|
|
15324
15393
|
}
|
|
@@ -15334,7 +15403,7 @@ ${html.slice(0, 1e4)}`;
|
|
|
15334
15403
|
const filename = await set2(url2, truncated, title);
|
|
15335
15404
|
return `\u{1F4DA} **${title}**
|
|
15336
15405
|
Source: ${url2}
|
|
15337
|
-
Cached: .
|
|
15406
|
+
Cached: ${PATHS.DOCS}/${filename}
|
|
15338
15407
|
|
|
15339
15408
|
---
|
|
15340
15409
|
|
|
@@ -36,8 +36,15 @@ export declare const MEMORY_LIMITS: {
|
|
|
36
36
|
readonly ERROR_CLEANUP_AGE_MS: number;
|
|
37
37
|
};
|
|
38
38
|
export declare const PATHS: {
|
|
39
|
-
readonly
|
|
40
|
-
readonly
|
|
39
|
+
readonly OPENCODE: ".opencode";
|
|
40
|
+
readonly DOCS: ".opencode/docs";
|
|
41
|
+
readonly ARCHIVE: ".opencode/archive";
|
|
42
|
+
readonly TASK_ARCHIVE: ".opencode/archive/tasks";
|
|
43
|
+
readonly DOC_ARCHIVE: ".opencode/archive/docs";
|
|
44
|
+
readonly TODO: ".opencode/todo.md";
|
|
45
|
+
readonly CONTEXT: ".opencode/context.md";
|
|
46
|
+
readonly SUMMARY: ".opencode/summary.md";
|
|
47
|
+
readonly DOC_METADATA: ".opencode/docs/_metadata.json";
|
|
41
48
|
};
|
|
42
49
|
export declare const BACKGROUND_TASK: {
|
|
43
50
|
readonly DEFAULT_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": "0.6.
|
|
5
|
+
"version": "0.6.23",
|
|
6
6
|
"author": "agnusdei1207",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"dev:unlink": "npm unlink -g opencode-orchestrator 2>/dev/null; /opt/homebrew/bin/npm unlink -g opencode-orchestrator 2>/dev/null; npm run dev:clean && echo 'SUCCESS: Unlinked from all'",
|
|
57
57
|
"dev:status": "echo '=== NVM ===' && ls -la $(npm root -g)/opencode-orchestrator 2>/dev/null || echo 'Not linked'; echo '=== Homebrew ===' && ls -la /opt/homebrew/lib/node_modules/opencode-orchestrator 2>/dev/null || echo 'Not linked'",
|
|
58
58
|
"dev:test": "node dist/scripts/postinstall.js && echo '---' && node dist/scripts/preuninstall.js",
|
|
59
|
-
"dev:cache": "npm run build && rm -rf ~/.cache/opencode/node_modules/opencode-orchestrator && cp -r . ~/.cache/opencode/node_modules/opencode-orchestrator && echo 'SUCCESS: Copied to OpenCode cache. Restart OpenCode.'",
|
|
60
59
|
"reset:local": "brew uninstall opencode 2>/dev/null; rm -rf ~/.config/opencode ~/.opencode ~/.local/share/opencode ~/.cache/opencode/node_modules/opencode-orchestrator && echo '=== Clean done ===' && brew install opencode && echo '{\"plugin\": [\"opencode-orchestrator\"], \"$schema\": \"https://opencode.ai/config.json\"}' > ~/.config/opencode/opencode.json && echo '=== Reset (Dev) complete. Run: opencode ==='",
|
|
61
60
|
"reset:prod": "brew uninstall opencode 2>/dev/null; rm -rf ~/.config/opencode ~/.opencode ~/.local/share/opencode ~/.cache/opencode/node_modules/opencode-orchestrator && echo '=== Clean done ===' && brew install opencode && echo '{\"plugin\": [\"opencode-orchestrator\"], \"$schema\": \"https://opencode.ai/config.json\"}' > ~/.config/opencode/opencode.json && npm install -g opencode-orchestrator && echo '=== Reset (Prod) complete. Run: opencode ==='",
|
|
62
61
|
"ginstall": "npm install -g opencode-orchestrator",
|