opencode-dux 1.0.0
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/LICENSE +21 -0
- package/README.md +452 -0
- package/dist/agents/descriptions.d.ts +6 -0
- package/dist/agents/designer.d.ts +2 -0
- package/dist/agents/explorer.d.ts +2 -0
- package/dist/agents/fixer.d.ts +2 -0
- package/dist/agents/index.d.ts +22 -0
- package/dist/agents/interpreter.d.ts +2 -0
- package/dist/agents/librarian.d.ts +2 -0
- package/dist/agents/oracle.d.ts +2 -0
- package/dist/agents/orchestrator.d.ts +27 -0
- package/dist/agents/overrides.d.ts +18 -0
- package/dist/agents/prompt-blocks.d.ts +97 -0
- package/dist/agents/steward.d.ts +3 -0
- package/dist/cli/config-io.d.ts +24 -0
- package/dist/cli/config-manager.d.ts +4 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +1006 -0
- package/dist/cli/install.d.ts +2 -0
- package/dist/cli/mcps.d.ts +13 -0
- package/dist/cli/model-key-normalization.d.ts +1 -0
- package/dist/cli/paths.d.ts +35 -0
- package/dist/cli/providers.d.ts +137 -0
- package/dist/cli/skills.d.ts +22 -0
- package/dist/cli/system.d.ts +5 -0
- package/dist/cli/types.d.ts +38 -0
- package/dist/config/constants.d.ts +12 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/loader.d.ts +40 -0
- package/dist/config/runtime-preset.d.ts +12 -0
- package/dist/config/schema.d.ts +281 -0
- package/dist/config/utils.d.ts +10 -0
- package/dist/discovery/local/types.d.ts +79 -0
- package/dist/discovery/local.d.ts +73 -0
- package/dist/discovery/mcp-servers.d.ts +88 -0
- package/dist/discovery/skills.d.ts +94 -0
- package/dist/hooks/apply-patch/codec.d.ts +7 -0
- package/dist/hooks/apply-patch/errors.d.ts +25 -0
- package/dist/hooks/apply-patch/execution-context.d.ts +27 -0
- package/dist/hooks/apply-patch/index.d.ts +15 -0
- package/dist/hooks/apply-patch/matching.d.ts +26 -0
- package/dist/hooks/apply-patch/operations.d.ts +3 -0
- package/dist/hooks/apply-patch/patch.d.ts +2 -0
- package/dist/hooks/apply-patch/prepared-changes.d.ts +17 -0
- package/dist/hooks/apply-patch/resolution.d.ts +19 -0
- package/dist/hooks/apply-patch/rewrite.d.ts +7 -0
- package/dist/hooks/apply-patch/test-helpers.d.ts +6 -0
- package/dist/hooks/apply-patch/types.d.ts +80 -0
- package/dist/hooks/auto-update-checker/cache.d.ts +11 -0
- package/dist/hooks/auto-update-checker/checker.d.ts +32 -0
- package/dist/hooks/auto-update-checker/constants.d.ts +11 -0
- package/dist/hooks/auto-update-checker/index.d.ts +18 -0
- package/dist/hooks/auto-update-checker/types.d.ts +22 -0
- package/dist/hooks/chat-headers.d.ts +16 -0
- package/dist/hooks/context-pressure-reminder/index.d.ts +33 -0
- package/dist/hooks/delegate-task-retry/guidance.d.ts +2 -0
- package/dist/hooks/delegate-task-retry/hook.d.ts +8 -0
- package/dist/hooks/delegate-task-retry/index.d.ts +4 -0
- package/dist/hooks/delegate-task-retry/patterns.d.ts +11 -0
- package/dist/hooks/filter-available-skills/index.d.ts +32 -0
- package/dist/hooks/foreground-fallback/index.d.ts +72 -0
- package/dist/hooks/image-hook.d.ts +5 -0
- package/dist/hooks/index.d.ts +14 -0
- package/dist/hooks/json-error-recovery/hook.d.ts +18 -0
- package/dist/hooks/json-error-recovery/index.d.ts +1 -0
- package/dist/hooks/phase-reminder/index.d.ts +26 -0
- package/dist/hooks/post-file-tool-nudge/index.d.ts +19 -0
- package/dist/hooks/task-session-manager/index.d.ts +52 -0
- package/dist/hooks/todo-continuation/index.d.ts +53 -0
- package/dist/hooks/todo-continuation/todo-hygiene.d.ts +35 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +31782 -0
- package/dist/mcp/context7.d.ts +6 -0
- package/dist/mcp/grep-app.d.ts +6 -0
- package/dist/mcp/index.d.ts +13 -0
- package/dist/mcp/types.d.ts +12 -0
- package/dist/mcp/websearch.d.ts +9 -0
- package/dist/skills/registry.d.ts +29 -0
- package/dist/subscriptions/accounts-store.d.ts +57 -0
- package/dist/subscriptions/index.d.ts +13 -0
- package/dist/subscriptions/neuralwatt-scraper.d.ts +14 -0
- package/dist/subscriptions/opencode-go-scraper.d.ts +27 -0
- package/dist/subscriptions/types.d.ts +115 -0
- package/dist/subscriptions/usage-service.d.ts +74 -0
- package/dist/tools/ast-grep/cli.d.ts +15 -0
- package/dist/tools/ast-grep/constants.d.ts +25 -0
- package/dist/tools/ast-grep/downloader.d.ts +5 -0
- package/dist/tools/ast-grep/index.d.ts +10 -0
- package/dist/tools/ast-grep/tools.d.ts +3 -0
- package/dist/tools/ast-grep/types.d.ts +30 -0
- package/dist/tools/ast-grep/utils.d.ts +4 -0
- package/dist/tools/delegate.d.ts +14 -0
- package/dist/tools/index.d.ts +5 -0
- package/dist/tools/preset-manager.d.ts +27 -0
- package/dist/tools/smartfetch/binary.d.ts +3 -0
- package/dist/tools/smartfetch/cache.d.ts +6 -0
- package/dist/tools/smartfetch/constants.d.ts +12 -0
- package/dist/tools/smartfetch/index.d.ts +3 -0
- package/dist/tools/smartfetch/network.d.ts +38 -0
- package/dist/tools/smartfetch/secondary-model.d.ts +28 -0
- package/dist/tools/smartfetch/tool.d.ts +3 -0
- package/dist/tools/smartfetch/types.d.ts +122 -0
- package/dist/tools/smartfetch/utils.d.ts +18 -0
- package/dist/tui-state.d.ts +168 -0
- package/dist/tui.d.ts +37 -0
- package/dist/tui.js +1896 -0
- package/dist/utils/agent-variant.d.ts +63 -0
- package/dist/utils/compat.d.ts +30 -0
- package/dist/utils/env.d.ts +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/internal-initiator.d.ts +6 -0
- package/dist/utils/logger.d.ts +8 -0
- package/dist/utils/polling.d.ts +21 -0
- package/dist/utils/session-manager.d.ts +55 -0
- package/dist/utils/session.d.ts +90 -0
- package/dist/utils/subagent-depth.d.ts +35 -0
- package/dist/utils/system-collapse.d.ts +6 -0
- package/dist/utils/task.d.ts +4 -0
- package/dist/utils/zip-extractor.d.ts +1 -0
- package/index.ts +1 -0
- package/opencode-dux.schema.json +634 -0
- package/package.json +103 -0
- package/src/agents/descriptions.ts +55 -0
- package/src/agents/designer.test.ts +86 -0
- package/src/agents/designer.ts +154 -0
- package/src/agents/display-name.test.ts +186 -0
- package/src/agents/explorer.test.ts +79 -0
- package/src/agents/explorer.ts +144 -0
- package/src/agents/fixer.test.ts +79 -0
- package/src/agents/fixer.ts +145 -0
- package/src/agents/index.test.ts +472 -0
- package/src/agents/index.ts +248 -0
- package/src/agents/interpreter.ts +136 -0
- package/src/agents/librarian.test.ts +80 -0
- package/src/agents/librarian.ts +145 -0
- package/src/agents/oracle.test.ts +89 -0
- package/src/agents/oracle.ts +184 -0
- package/src/agents/orchestrator.test.ts +116 -0
- package/src/agents/orchestrator.ts +574 -0
- package/src/agents/overrides.ts +95 -0
- package/src/agents/prompt-blocks.test.ts +114 -0
- package/src/agents/prompt-blocks.ts +640 -0
- package/src/agents/steward.ts +146 -0
- package/src/cli/config-io.test.ts +536 -0
- package/src/cli/config-io.ts +473 -0
- package/src/cli/config-manager.test.ts +141 -0
- package/src/cli/config-manager.ts +4 -0
- package/src/cli/index.ts +88 -0
- package/src/cli/install.ts +282 -0
- package/src/cli/mcps.test.ts +62 -0
- package/src/cli/mcps.ts +39 -0
- package/src/cli/model-key-normalization.test.ts +21 -0
- package/src/cli/model-key-normalization.ts +60 -0
- package/src/cli/paths.test.ts +167 -0
- package/src/cli/paths.ts +144 -0
- package/src/cli/providers.test.ts +118 -0
- package/src/cli/providers.ts +141 -0
- package/src/cli/skills.test.ts +111 -0
- package/src/cli/skills.ts +103 -0
- package/src/cli/system.test.ts +91 -0
- package/src/cli/system.ts +180 -0
- package/src/cli/types.ts +43 -0
- package/src/config/constants.ts +58 -0
- package/src/config/index.ts +4 -0
- package/src/config/loader.test.ts +1194 -0
- package/src/config/loader.ts +269 -0
- package/src/config/model-resolution.test.ts +176 -0
- package/src/config/runtime-preset.test.ts +61 -0
- package/src/config/runtime-preset.ts +37 -0
- package/src/config/schema.ts +248 -0
- package/src/config/utils.test.ts +41 -0
- package/src/config/utils.ts +23 -0
- package/src/discovery/local/types.ts +85 -0
- package/src/discovery/local.ts +322 -0
- package/src/discovery/mcp-servers.ts +804 -0
- package/src/discovery/skills.ts +959 -0
- package/src/hooks/apply-patch/codec.test.ts +184 -0
- package/src/hooks/apply-patch/codec.ts +352 -0
- package/src/hooks/apply-patch/errors.ts +117 -0
- package/src/hooks/apply-patch/execution-context.ts +432 -0
- package/src/hooks/apply-patch/hook.test.ts +768 -0
- package/src/hooks/apply-patch/index.ts +126 -0
- package/src/hooks/apply-patch/matching.test.ts +215 -0
- package/src/hooks/apply-patch/matching.ts +586 -0
- package/src/hooks/apply-patch/operations.test.ts +1535 -0
- package/src/hooks/apply-patch/operations.ts +3 -0
- package/src/hooks/apply-patch/patch.ts +9 -0
- package/src/hooks/apply-patch/prepared-changes.ts +400 -0
- package/src/hooks/apply-patch/resolution.test.ts +420 -0
- package/src/hooks/apply-patch/resolution.ts +437 -0
- package/src/hooks/apply-patch/rewrite.ts +496 -0
- package/src/hooks/apply-patch/test-helpers.ts +52 -0
- package/src/hooks/apply-patch/types.ts +111 -0
- package/src/hooks/auto-update-checker/cache.test.ts +179 -0
- package/src/hooks/auto-update-checker/cache.ts +188 -0
- package/src/hooks/auto-update-checker/checker.test.ts +159 -0
- package/src/hooks/auto-update-checker/checker.ts +308 -0
- package/src/hooks/auto-update-checker/constants.ts +33 -0
- package/src/hooks/auto-update-checker/index.test.ts +282 -0
- package/src/hooks/auto-update-checker/index.ts +225 -0
- package/src/hooks/auto-update-checker/types.ts +26 -0
- package/src/hooks/chat-headers.test.ts +236 -0
- package/src/hooks/chat-headers.ts +97 -0
- package/src/hooks/context-pressure-reminder/index.test.ts +179 -0
- package/src/hooks/context-pressure-reminder/index.ts +137 -0
- package/src/hooks/delegate-task-retry/guidance.ts +41 -0
- package/src/hooks/delegate-task-retry/hook.ts +23 -0
- package/src/hooks/delegate-task-retry/index.test.ts +38 -0
- package/src/hooks/delegate-task-retry/index.ts +7 -0
- package/src/hooks/delegate-task-retry/patterns.ts +79 -0
- package/src/hooks/filter-available-skills/index.test.ts +297 -0
- package/src/hooks/filter-available-skills/index.ts +160 -0
- package/src/hooks/foreground-fallback/index.test.ts +624 -0
- package/src/hooks/foreground-fallback/index.ts +374 -0
- package/src/hooks/image-hook.ts +6 -0
- package/src/hooks/index.ts +17 -0
- package/src/hooks/json-error-recovery/hook.ts +73 -0
- package/src/hooks/json-error-recovery/index.test.ts +111 -0
- package/src/hooks/json-error-recovery/index.ts +6 -0
- package/src/hooks/phase-reminder/index.test.ts +74 -0
- package/src/hooks/phase-reminder/index.ts +85 -0
- package/src/hooks/post-file-tool-nudge/index.test.ts +94 -0
- package/src/hooks/post-file-tool-nudge/index.ts +63 -0
- package/src/hooks/task-session-manager/index.test.ts +833 -0
- package/src/hooks/task-session-manager/index.ts +434 -0
- package/src/hooks/todo-continuation/index.test.ts +3026 -0
- package/src/hooks/todo-continuation/index.ts +878 -0
- package/src/hooks/todo-continuation/todo-hygiene.test.ts +204 -0
- package/src/hooks/todo-continuation/todo-hygiene.ts +207 -0
- package/src/index.ts +1672 -0
- package/src/mcp/context7.ts +14 -0
- package/src/mcp/grep-app.ts +11 -0
- package/src/mcp/index.test.ts +96 -0
- package/src/mcp/index.ts +66 -0
- package/src/mcp/types.ts +16 -0
- package/src/mcp/websearch.ts +47 -0
- package/src/skills/codemap/README.md +60 -0
- package/src/skills/codemap/SKILL.md +174 -0
- package/src/skills/codemap/scripts/codemap.mjs +483 -0
- package/src/skills/codemap/scripts/codemap.test.ts +129 -0
- package/src/skills/registry.ts +218 -0
- package/src/skills/simplify/README.md +19 -0
- package/src/skills/simplify/SKILL.md +138 -0
- package/src/subscriptions/accounts-store.test.ts +236 -0
- package/src/subscriptions/accounts-store.ts +184 -0
- package/src/subscriptions/index.ts +30 -0
- package/src/subscriptions/neuralwatt-scraper.ts +108 -0
- package/src/subscriptions/opencode-go-scraper.ts +301 -0
- package/src/subscriptions/types.ts +145 -0
- package/src/subscriptions/usage-service.test.ts +202 -0
- package/src/subscriptions/usage-service.ts +651 -0
- package/src/tools/ast-grep/cli.ts +257 -0
- package/src/tools/ast-grep/constants.ts +214 -0
- package/src/tools/ast-grep/downloader.ts +131 -0
- package/src/tools/ast-grep/index.ts +24 -0
- package/src/tools/ast-grep/tools.ts +117 -0
- package/src/tools/ast-grep/types.ts +51 -0
- package/src/tools/ast-grep/utils.ts +126 -0
- package/src/tools/delegate-handoff.test.ts +18 -0
- package/src/tools/delegate.ts +508 -0
- package/src/tools/index.ts +8 -0
- package/src/tools/preset-manager.test.ts +795 -0
- package/src/tools/preset-manager.ts +332 -0
- package/src/tools/smartfetch/binary.ts +58 -0
- package/src/tools/smartfetch/cache.test.ts +34 -0
- package/src/tools/smartfetch/cache.ts +112 -0
- package/src/tools/smartfetch/constants.ts +29 -0
- package/src/tools/smartfetch/index.ts +8 -0
- package/src/tools/smartfetch/network.test.ts +178 -0
- package/src/tools/smartfetch/network.ts +614 -0
- package/src/tools/smartfetch/secondary-model.test.ts +85 -0
- package/src/tools/smartfetch/secondary-model.ts +276 -0
- package/src/tools/smartfetch/tool.test.ts +60 -0
- package/src/tools/smartfetch/tool.ts +832 -0
- package/src/tools/smartfetch/types.ts +135 -0
- package/src/tools/smartfetch/utils.test.ts +24 -0
- package/src/tools/smartfetch/utils.ts +456 -0
- package/src/tui-state.test.ts +867 -0
- package/src/tui-state.ts +1255 -0
- package/src/tui.test.ts +336 -0
- package/src/tui.ts +1539 -0
- package/src/utils/agent-variant.test.ts +244 -0
- package/src/utils/agent-variant.ts +187 -0
- package/src/utils/compat.ts +91 -0
- package/src/utils/env.ts +12 -0
- package/src/utils/index.ts +9 -0
- package/src/utils/internal-initiator.ts +28 -0
- package/src/utils/logger.test.ts +220 -0
- package/src/utils/logger.ts +136 -0
- package/src/utils/polling.test.ts +191 -0
- package/src/utils/polling.ts +67 -0
- package/src/utils/session-manager.test.ts +173 -0
- package/src/utils/session-manager.ts +356 -0
- package/src/utils/session.test.ts +110 -0
- package/src/utils/session.ts +389 -0
- package/src/utils/subagent-depth.test.ts +170 -0
- package/src/utils/subagent-depth.ts +75 -0
- package/src/utils/system-collapse.test.ts +86 -0
- package/src/utils/system-collapse.ts +24 -0
- package/src/utils/task.test.ts +24 -0
- package/src/utils/task.ts +20 -0
- package/src/utils/zip-extractor.ts +102 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
# opencode-dux
|
|
2
|
+
|
|
3
|
+
Agent orchestration, management, and operations plugin for OpenCode. Routes tasks to specialized agents automatically.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
1. Add to `~/.config/opencode/opencode.json` and `~/.config/opencode/tui.json`:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"plugin": ["opencode-dux"]
|
|
12
|
+
}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
2. Create `~/.config/opencode/opencode-dux.jsonc`:
|
|
16
|
+
|
|
17
|
+
```jsonc
|
|
18
|
+
{
|
|
19
|
+
"$schema": "https://raw.githubusercontent.com/bakhtiar-personal-work/opencode-dux/master/opencode-dux.schema.json",
|
|
20
|
+
"preset": "my-preset",
|
|
21
|
+
"presets": {
|
|
22
|
+
"my-preset": {
|
|
23
|
+
"orchestrator": { "model": "opencode-go/deepseek-v4-flash" },
|
|
24
|
+
"oracle": { "model": "opencode-go/deepseek-v4-flash" },
|
|
25
|
+
"explorer": { "model": "opencode-go/deepseek-v4-flash" },
|
|
26
|
+
"librarian": { "model": "opencode-go/deepseek-v4-flash" },
|
|
27
|
+
"designer": { "model": "opencode-go/mimo-v2.5-pro" },
|
|
28
|
+
"fixer": { "model": "opencode-go/deepseek-v4-flash" }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
3. Authenticate: `opencode auth login`
|
|
35
|
+
|
|
36
|
+
Or run the automated installer:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
bunx opencode-dux install
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Agents
|
|
43
|
+
|
|
44
|
+
| Agent | Role | When Used |
|
|
45
|
+
| ---------------- | -------------------- | ----------------------------------------------------- |
|
|
46
|
+
| **Orchestrator** | Master delegator | Routes tasks, strategic coordination |
|
|
47
|
+
| **Explorer** | Codebase search | File discovery, pattern matching |
|
|
48
|
+
| **Oracle** | Architecture & debug | Trade-offs, root cause analysis |
|
|
49
|
+
| **Librarian** | External research | Documentation lookup, web search |
|
|
50
|
+
| **Designer** | UI/UX | Frontend, styling, accessibility |
|
|
51
|
+
| **Fixer** | Implementation | Scoped code changes, tests |
|
|
52
|
+
| **Steward** | Repository rules | Manages `.docs/`, `.opencode/`, `.cursor/rules`, etc. |
|
|
53
|
+
| **Interpreter** | Image analysis | Vision-capable model for attached screenshots |
|
|
54
|
+
|
|
55
|
+
## Configuration
|
|
56
|
+
|
|
57
|
+
Config file: `~/.config/opencode/opencode-dux.jsonc` (preferred) or `.json`
|
|
58
|
+
|
|
59
|
+
Configs are merged from two locations (project overrides user):
|
|
60
|
+
|
|
61
|
+
1. **User**: `~/.config/opencode/opencode-dux.jsonc`
|
|
62
|
+
2. **Project**: `<project>/.opencode/opencode-dux.jsonc`
|
|
63
|
+
|
|
64
|
+
### `preset`
|
|
65
|
+
|
|
66
|
+
Active preset name. Selects an entry from `presets` to apply as the default agent configuration. Can also be set via the `OH_MY_OPENCODE_SLIM_PRESET` environment variable.
|
|
67
|
+
|
|
68
|
+
```jsonc
|
|
69
|
+
{ "preset": "opencode-go" }
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### `presets`
|
|
73
|
+
|
|
74
|
+
Named model configurations. Each preset maps agent names to their overrides. The active preset is selected by `preset`.
|
|
75
|
+
|
|
76
|
+
```jsonc
|
|
77
|
+
{
|
|
78
|
+
"preset": "fast",
|
|
79
|
+
"presets": {
|
|
80
|
+
"fast": {
|
|
81
|
+
"orchestrator": { "model": "opencode-go/deepseek-v4-flash" },
|
|
82
|
+
"oracle": { "model": "opencode-go/deepseek-v4-flash" }
|
|
83
|
+
},
|
|
84
|
+
"pro": {
|
|
85
|
+
"orchestrator": { "model": "neuralwatt/moonshotai/Kimi-K2.6" },
|
|
86
|
+
"oracle": { "model": "opencode-go/deepseek-v4-pro" }
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### `agents`
|
|
93
|
+
|
|
94
|
+
Per-agent overrides that apply on top of the active preset. Accepts the same per-agent options as preset entries. Useful for agent-specific settings that should apply regardless of which preset is active.
|
|
95
|
+
|
|
96
|
+
```jsonc
|
|
97
|
+
{
|
|
98
|
+
"agents": {
|
|
99
|
+
"orchestrator": {
|
|
100
|
+
"skills": { "always-load": ["find-skills"], "wildcard": false },
|
|
101
|
+
"mcps": { "always-load": [], "wildcard": false }
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Per-agent options
|
|
108
|
+
|
|
109
|
+
Each agent entry (in `presets.<name>.<agent>` or `agents.<agent>`) accepts:
|
|
110
|
+
|
|
111
|
+
| Field | Type | Description |
|
|
112
|
+
| ------------- | ---------------------- | ----------------------------------------------------------------------- |
|
|
113
|
+
| `model` | `string` or `array` | Model ID (`provider/model`) or array of models for runtime fallback |
|
|
114
|
+
| `temperature` | `number` (0–2) | Model temperature |
|
|
115
|
+
| `variant` | `string` | Variant hint (e.g. `"medium"`, `"pro"`, `"flash"`) |
|
|
116
|
+
| `options` | `object` | Provider-specific model options (e.g. `textVerbosity`, thinking budget) |
|
|
117
|
+
| `displayName` | `string` | Custom display name for the agent |
|
|
118
|
+
| `skills` | `object` or `string[]` | Skill access configuration |
|
|
119
|
+
| `mcps` | `object` or `string[]` | MCP access configuration |
|
|
120
|
+
|
|
121
|
+
**Model as array** — When `model` is an array, the first available model is used at startup. Runtime fallback on API errors uses the full chain:
|
|
122
|
+
|
|
123
|
+
```jsonc
|
|
124
|
+
{
|
|
125
|
+
"orchestrator": {
|
|
126
|
+
"model": [
|
|
127
|
+
"neuralwatt/moonshotai/Kimi-K2.6",
|
|
128
|
+
{ "id": "opencode-go/deepseek-v4-flash", "variant": "high" },
|
|
129
|
+
"opencode-go/deepseek-v4-pro"
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Skills/MCPs syntax**:
|
|
136
|
+
|
|
137
|
+
```jsonc
|
|
138
|
+
{
|
|
139
|
+
"oracle": {
|
|
140
|
+
"skills": {
|
|
141
|
+
"always-load": ["simplify"], // always available
|
|
142
|
+
"wildcard": true // allow all other skills too
|
|
143
|
+
},
|
|
144
|
+
"mcps": ["websearch", "context7"] // shorthand: just array of names
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### `fallback`
|
|
150
|
+
|
|
151
|
+
Runtime model fallback when the primary model returns an API error (rate limit, timeout, etc.).
|
|
152
|
+
|
|
153
|
+
```jsonc
|
|
154
|
+
{
|
|
155
|
+
"fallback": {
|
|
156
|
+
"enabled": true,
|
|
157
|
+
"timeoutMs": 15000,
|
|
158
|
+
"retryDelayMs": 500,
|
|
159
|
+
"retry_on_empty": true,
|
|
160
|
+
"chains": {
|
|
161
|
+
"orchestrator": [
|
|
162
|
+
"opencode-go/deepseek-v4-pro",
|
|
163
|
+
"opencode-go/mimo-v2.5-pro"
|
|
164
|
+
],
|
|
165
|
+
"oracle": ["opencode-go/deepseek-v4-pro"]
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
| Field | Default | Description |
|
|
172
|
+
| ---------------- | ------- | ------------------------------------------- |
|
|
173
|
+
| `enabled` | `true` | Enable fallback chains |
|
|
174
|
+
| `timeoutMs` | `15000` | Per-request timeout before trigger fallback |
|
|
175
|
+
| `retryDelayMs` | `500` | Delay between retry attempts |
|
|
176
|
+
| `retry_on_empty` | `true` | Treat empty responses as failures |
|
|
177
|
+
| `chains` | `{}` | Ordered fallback model arrays per agent |
|
|
178
|
+
|
|
179
|
+
### `sessionManager`
|
|
180
|
+
|
|
181
|
+
Controls how the orchestrator manages parallel subagent sessions.
|
|
182
|
+
|
|
183
|
+
```jsonc
|
|
184
|
+
{
|
|
185
|
+
"sessionManager": {
|
|
186
|
+
"maxSessionsPerAgent": 2,
|
|
187
|
+
"readContextMinLines": 10,
|
|
188
|
+
"readContextMaxFiles": 8
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
| Field | Default | Description |
|
|
194
|
+
| --------------------- | ------- | -------------------------------------------------- |
|
|
195
|
+
| `maxSessionsPerAgent` | `2` | Max concurrent sessions per agent type (1–10) |
|
|
196
|
+
| `readContextMinLines` | `10` | Min lines threshold for read context tool (0–1000) |
|
|
197
|
+
| `readContextMaxFiles` | `8` | Max files per read context batch (0–50) |
|
|
198
|
+
|
|
199
|
+
### `todoContinuation`
|
|
200
|
+
|
|
201
|
+
Auto-continue the orchestrator when todos remain incomplete.
|
|
202
|
+
|
|
203
|
+
```jsonc
|
|
204
|
+
{
|
|
205
|
+
"todoContinuation": {
|
|
206
|
+
"maxContinuations": 5,
|
|
207
|
+
"cooldownMs": 3000,
|
|
208
|
+
"autoEnable": false,
|
|
209
|
+
"autoEnableThreshold": 4
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
| Field | Default | Description |
|
|
215
|
+
| --------------------- | ------- | ------------------------------------------------------------ |
|
|
216
|
+
| `maxContinuations` | `5` | Max consecutive auto-continuations before asking user (1–50) |
|
|
217
|
+
| `cooldownMs` | `3000` | Delay before auto-continuing (0–30000ms) |
|
|
218
|
+
| `autoEnable` | `false` | Automatically enable when enough todos exist |
|
|
219
|
+
| `autoEnableThreshold` | `4` | Number of todos that triggers auto-enable (1–50) |
|
|
220
|
+
|
|
221
|
+
### `contextPressure`
|
|
222
|
+
|
|
223
|
+
Warns the orchestrator when context usage is high, prompting `/compact` before the model fails.
|
|
224
|
+
|
|
225
|
+
```jsonc
|
|
226
|
+
{
|
|
227
|
+
"contextPressure": {
|
|
228
|
+
"enabled": true,
|
|
229
|
+
"warnThresholdPct": 75
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
| Field | Default | Description |
|
|
235
|
+
| ------------------ | ------- | -------------------------------------- |
|
|
236
|
+
| `enabled` | `true` | Enable context pressure warnings |
|
|
237
|
+
| `warnThresholdPct` | `75` | Trigger at this context usage % (1–99) |
|
|
238
|
+
|
|
239
|
+
### `websearch`
|
|
240
|
+
|
|
241
|
+
Configure the built-in websearch MCP provider.
|
|
242
|
+
|
|
243
|
+
```jsonc
|
|
244
|
+
{
|
|
245
|
+
"websearch": { "provider": "exa" }
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
| Field | Default | Description |
|
|
250
|
+
| ---------- | ------- | --------------------- |
|
|
251
|
+
| `provider` | `"exa"` | `"exa"` or `"tavily"` |
|
|
252
|
+
|
|
253
|
+
### `setDefaultAgent`
|
|
254
|
+
|
|
255
|
+
When `true` (default), sets the OpenCode `default_agent` to `"orchestrator"` on startup. Set to `false` to keep your existing default agent.
|
|
256
|
+
|
|
257
|
+
```jsonc
|
|
258
|
+
{ "setDefaultAgent": false }
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### `autoUpdate`
|
|
262
|
+
|
|
263
|
+
Enable automatic updates when the plugin is loaded via npm package name.
|
|
264
|
+
|
|
265
|
+
```jsonc
|
|
266
|
+
{ "autoUpdate": true }
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### `scoringEngineVersion`
|
|
270
|
+
|
|
271
|
+
Experimental scoring engine version selection.
|
|
272
|
+
|
|
273
|
+
```jsonc
|
|
274
|
+
{ "scoringEngineVersion": "v2" }
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### `balanceProviderUsage`
|
|
278
|
+
|
|
279
|
+
Spread requests across providers for cost/rate-limit balancing.
|
|
280
|
+
|
|
281
|
+
```jsonc
|
|
282
|
+
{ "balanceProviderUsage": true }
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### `manualPlan`
|
|
286
|
+
|
|
287
|
+
Legacy explicit 4-tier fallback plan for each agent. Superseded by `fallback.chains` — both can coexist; `fallback.chains` appends to `_modelArray`.
|
|
288
|
+
|
|
289
|
+
```jsonc
|
|
290
|
+
{
|
|
291
|
+
"manualPlan": {
|
|
292
|
+
"orchestrator": {
|
|
293
|
+
"primary": "neuralwatt/moonshotai/Kimi-K2.6",
|
|
294
|
+
"fallback1": "opencode-go/deepseek-v4-flash",
|
|
295
|
+
"fallback2": "opencode-go/deepseek-v4-pro",
|
|
296
|
+
"fallback3": "opencode-go/mimo-v2.5-pro"
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Full example config
|
|
303
|
+
|
|
304
|
+
```jsonc
|
|
305
|
+
{
|
|
306
|
+
"$schema": "https://raw.githubusercontent.com/bakhtiar-personal-work/opencode-dux/master/opencode-dux.schema.json",
|
|
307
|
+
"preset": "opencode-go",
|
|
308
|
+
"setDefaultAgent": true,
|
|
309
|
+
"autoUpdate": true,
|
|
310
|
+
"contextPressure": {
|
|
311
|
+
"enabled": true,
|
|
312
|
+
"warnThresholdPct": 75
|
|
313
|
+
},
|
|
314
|
+
"websearch": {
|
|
315
|
+
"provider": "exa"
|
|
316
|
+
},
|
|
317
|
+
"sessionManager": {
|
|
318
|
+
"maxSessionsPerAgent": 2,
|
|
319
|
+
"readContextMinLines": 10,
|
|
320
|
+
"readContextMaxFiles": 8
|
|
321
|
+
},
|
|
322
|
+
"todoContinuation": {
|
|
323
|
+
"maxContinuations": 5,
|
|
324
|
+
"cooldownMs": 3000,
|
|
325
|
+
"autoEnable": false,
|
|
326
|
+
"autoEnableThreshold": 4
|
|
327
|
+
},
|
|
328
|
+
"fallback": {
|
|
329
|
+
"enabled": true,
|
|
330
|
+
"timeoutMs": 15000,
|
|
331
|
+
"retryDelayMs": 500,
|
|
332
|
+
"retry_on_empty": true,
|
|
333
|
+
"chains": {
|
|
334
|
+
"orchestrator": ["opencode-go/deepseek-v4-pro"],
|
|
335
|
+
"oracle": ["opencode-go/deepseek-v4-pro"]
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
"presets": {
|
|
339
|
+
"opencode-go": {
|
|
340
|
+
"orchestrator": {
|
|
341
|
+
"model": "neuralwatt/Qwen/Qwen3.5-397B-A17B-FP8",
|
|
342
|
+
"variant": "medium",
|
|
343
|
+
"skills": { "always-load": ["find-skills"], "wildcard": false },
|
|
344
|
+
"mcps": { "always-load": [], "wildcard": false }
|
|
345
|
+
},
|
|
346
|
+
"oracle": {
|
|
347
|
+
"model": "opencode-go/deepseek-v4-flash",
|
|
348
|
+
"skills": { "always-load": ["simplify"], "wildcard": true },
|
|
349
|
+
"options": { "smart": "opencode-go/deepseek-v4-pro" }
|
|
350
|
+
},
|
|
351
|
+
"explorer": {
|
|
352
|
+
"model": "neuralwatt/qwen3.5-397b-fast",
|
|
353
|
+
"skills": { "always-load": ["codemap"], "wildcard": true }
|
|
354
|
+
},
|
|
355
|
+
"librarian": {
|
|
356
|
+
"model": "opencode-go/deepseek-v4-flash",
|
|
357
|
+
"skills": { "always-load": [], "wildcard": true },
|
|
358
|
+
"mcps": {
|
|
359
|
+
"always-load": ["websearch", "context7", "github"],
|
|
360
|
+
"wildcard": true
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
"designer": {
|
|
364
|
+
"model": "neuralwatt/moonshotai/Kimi-K2.6",
|
|
365
|
+
"temperature": 0.3,
|
|
366
|
+
"skills": { "always-load": [], "wildcard": true },
|
|
367
|
+
"mcps": { "always-load": [], "wildcard": true }
|
|
368
|
+
},
|
|
369
|
+
"fixer": {
|
|
370
|
+
"model": "opencode-go/deepseek-v4-flash",
|
|
371
|
+
"skills": { "always-load": ["codemap"], "wildcard": true },
|
|
372
|
+
"mcps": { "always-load": [], "wildcard": true }
|
|
373
|
+
},
|
|
374
|
+
"steward": {
|
|
375
|
+
"model": "opencode-go/deepseek-v4-flash",
|
|
376
|
+
"skills": { "always-load": [], "wildcard": false }
|
|
377
|
+
},
|
|
378
|
+
"interpreter": {
|
|
379
|
+
"model": "neuralwatt/moonshotai/Kimi-K2.6",
|
|
380
|
+
"skills": { "always-load": [], "wildcard": false }
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
"agents": {
|
|
385
|
+
"librarian": {
|
|
386
|
+
"mcps": { "always-load": ["websearch", "context7"], "wildcard": true }
|
|
387
|
+
},
|
|
388
|
+
"oracle": {
|
|
389
|
+
"skills": { "always-load": ["simplify"], "wildcard": true }
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
## Prompt overrides
|
|
396
|
+
|
|
397
|
+
Customize agent system prompts by placing Markdown files in the prompts directory:
|
|
398
|
+
|
|
399
|
+
- **Replace** the default prompt: `~/.config/opencode/opencode-dux/<agent>.md`
|
|
400
|
+
- **Append** to the default prompt: `~/.config/opencode/opencode-dux/<agent>_append.md`
|
|
401
|
+
|
|
402
|
+
Preset-scoped prompts are also supported — place them in a subdirectory named after the preset:
|
|
403
|
+
|
|
404
|
+
- `~/.config/opencode/opencode-dux/<preset>/<agent>.md`
|
|
405
|
+
|
|
406
|
+
## Built-in MCPs
|
|
407
|
+
|
|
408
|
+
Plugin provides 3 MCP servers (auto-loaded):
|
|
409
|
+
|
|
410
|
+
| MCP | Description |
|
|
411
|
+
| ----------- | ---------------------------- |
|
|
412
|
+
| `websearch` | Web search (Exa or Tavily) |
|
|
413
|
+
| `context7` | Library documentation lookup |
|
|
414
|
+
| `grep_app` | GitHub code search |
|
|
415
|
+
|
|
416
|
+
Disable any MCP in config:
|
|
417
|
+
|
|
418
|
+
```jsonc
|
|
419
|
+
{
|
|
420
|
+
"disabledMcps": ["grep_app"]
|
|
421
|
+
}
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
## Built-in Skills
|
|
425
|
+
|
|
426
|
+
Plugin includes 2 bundled skills (auto-installed):
|
|
427
|
+
|
|
428
|
+
- **simplify** — Code simplification and clarity improvements
|
|
429
|
+
- **codemap** — Codebase mapping and structure analysis
|
|
430
|
+
|
|
431
|
+
## Skill Discovery
|
|
432
|
+
|
|
433
|
+
Agents can recommend additional skills via `discover_skills_online` tool. When a skill is recommended:
|
|
434
|
+
|
|
435
|
+
1. Agent presents: "I recommend installing X for this task"
|
|
436
|
+
2. You run: `npx skills add <repo>`
|
|
437
|
+
3. Next session: skill appears in `<available_skills>`
|
|
438
|
+
|
|
439
|
+
## Commands
|
|
440
|
+
|
|
441
|
+
```bash
|
|
442
|
+
bun run build # Build TypeScript to dist/
|
|
443
|
+
bun run typecheck # Type checking
|
|
444
|
+
bun test # Run tests
|
|
445
|
+
bun run check:ci # Lint + format (CI mode)
|
|
446
|
+
bun run generate-schema # Regenerate JSON schema from Zod
|
|
447
|
+
bun run verify:release # Verify release artifact
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
## License
|
|
451
|
+
|
|
452
|
+
MIT
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AgentConfig as SDKAgentConfig } from '@opencode-ai/sdk/v2';
|
|
2
|
+
import { type PluginConfig, SUBAGENT_NAMES } from '../config';
|
|
3
|
+
import { type AgentDefinition } from './orchestrator';
|
|
4
|
+
export type { AgentDefinition } from './orchestrator';
|
|
5
|
+
export type SubagentName = (typeof SUBAGENT_NAMES)[number];
|
|
6
|
+
export declare function isSubagent(name: string): name is SubagentName;
|
|
7
|
+
/**
|
|
8
|
+
* Create all agent definitions with optional configuration overrides.
|
|
9
|
+
* Instantiates the orchestrator and all subagents, applying user config and defaults.
|
|
10
|
+
*
|
|
11
|
+
* @param config - Optional plugin configuration with agent overrides
|
|
12
|
+
* @returns Array of agent definitions (orchestrator first, then subagents)
|
|
13
|
+
*/
|
|
14
|
+
export declare function createAgents(config?: PluginConfig): Promise<AgentDefinition[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Get agent configurations formatted for the OpenCode SDK.
|
|
17
|
+
* Converts agent definitions to SDK config format and applies classification metadata.
|
|
18
|
+
*
|
|
19
|
+
* @param config - Optional plugin configuration with agent overrides
|
|
20
|
+
* @returns Record mapping agent names to their SDK configurations
|
|
21
|
+
*/
|
|
22
|
+
export declare function getAgentConfigs(config?: PluginConfig): Promise<Record<string, SDKAgentConfig>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AgentConfig } from '@opencode-ai/sdk/v2';
|
|
2
|
+
export interface AgentDefinition {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
config: AgentConfig;
|
|
7
|
+
/** Priority-ordered model entries for runtime fallback resolution. */
|
|
8
|
+
_modelArray?: Array<{
|
|
9
|
+
id: string;
|
|
10
|
+
variant?: string;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Resolve agent prompt from base/custom/append inputs.
|
|
15
|
+
* If customPrompt is provided, it replaces the base entirely.
|
|
16
|
+
* Otherwise, customAppendPrompt is appended to the base.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolvePrompt(base: string, customPrompt?: string, customAppendPrompt?: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Build the orchestrator prompt.
|
|
21
|
+
* @returns The complete orchestrator prompt string
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildOrchestratorPrompt(oracleDefaultModel?: string, oracleSmartModel?: string): string;
|
|
24
|
+
export declare function createOrchestratorAgent(model?: string | Array<string | {
|
|
25
|
+
id: string;
|
|
26
|
+
variant?: string;
|
|
27
|
+
}>, customPrompt?: string, customAppendPrompt?: string, oracleDefaultModel?: string, oracleSmartModel?: string): AgentDefinition;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AgentOverrideConfig, SkillOrMcpConfig } from '../config';
|
|
2
|
+
import type { AgentDefinition } from './orchestrator';
|
|
3
|
+
/**
|
|
4
|
+
* Apply user-provided overrides to an agent's configuration.
|
|
5
|
+
* Supports overriding model (string or priority array), variant, and temperature.
|
|
6
|
+
* When model is an array, stores it as _modelArray for runtime fallback resolution
|
|
7
|
+
* and clears config.model so OpenCode does not pre-resolve a stale value.
|
|
8
|
+
*/
|
|
9
|
+
export declare function applyOverrides(agent: AgentDefinition, override: AgentOverrideConfig): void;
|
|
10
|
+
/**
|
|
11
|
+
* Apply default permissions to an agent.
|
|
12
|
+
* Sets 'question' permission to 'allow' and includes skill permission presets.
|
|
13
|
+
* If configuredSkills is provided, it honors that list instead of defaults.
|
|
14
|
+
*
|
|
15
|
+
* Note: If the agent already explicitly sets question to 'deny', that is
|
|
16
|
+
* respected (e.g., an agent may explicitly deny question permission).
|
|
17
|
+
*/
|
|
18
|
+
export declare function applyDefaultPermissions(agent: AgentDefinition, configuredSkills?: SkillOrMcpConfig, configuredMcps?: SkillOrMcpConfig): Promise<void>;
|