@hiai-gg/hiai-opencode 0.1.2 → 0.1.4
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/.env.example +28 -21
- package/AGENTS.md +183 -28
- package/ARCHITECTURE.md +17 -20
- package/LICENSE.md +1 -0
- package/README.md +269 -66
- package/assets/cli/hiai-opencode.mjs +276 -0
- package/assets/mcp/mempalace.mjs +47 -4
- package/assets/mcp/playwright.mjs +83 -0
- package/config/hiai-opencode.schema.json +113 -1
- package/dist/config/index.d.ts +0 -1
- package/dist/config/platform-schema.d.ts +72 -0
- package/dist/config/schema/agent-overrides.d.ts +256 -0
- package/dist/config/schema/categories.d.ts +2 -2
- package/dist/config/schema/commands.d.ts +1 -0
- package/dist/config/schema/index.d.ts +2 -0
- package/dist/config/schema/oh-my-opencode-config.d.ts +267 -0
- package/dist/config/schema/skill-discovery.d.ts +11 -0
- package/dist/config/types.d.ts +12 -1
- package/dist/features/builtin-commands/templates/mcp-status.d.ts +1 -0
- package/dist/features/builtin-commands/types.d.ts +1 -1
- package/dist/features/opencode-skill-loader/loader.d.ts +2 -0
- package/dist/index.js +617 -421
- package/dist/mcp/registry.d.ts +14 -0
- package/dist/mcp/types.d.ts +6 -0
- package/dist/plugin/skill-discovery-config.d.ts +4 -0
- package/dist/shared/startup-diagnostics.d.ts +6 -0
- package/hiai-opencode.json +192 -36
- package/package.json +4 -1
- package/src/agents/AGENTS.md +3 -4
- package/src/config/defaults.ts +55 -133
- package/src/config/index.ts +0 -1
- package/src/config/loader.ts +4 -1
- package/src/config/platform-schema.ts +18 -2
- package/src/config/schema/agent-overrides.ts +2 -0
- package/src/config/schema/commands.ts +1 -0
- package/src/config/schema/fast-apply.ts +4 -4
- package/src/config/schema/index.ts +2 -0
- package/src/config/schema/oh-my-opencode-config.ts +3 -0
- package/src/config/schema/skill-discovery.ts +25 -0
- package/src/config/types.ts +16 -0
- package/src/features/builtin-commands/commands.ts +7 -0
- package/src/features/builtin-commands/templates/mcp-status.ts +36 -0
- package/src/features/builtin-commands/types.ts +1 -1
- package/src/features/builtin-skills/skills/playwright.ts +24 -2
- package/src/features/opencode-skill-loader/loader.ts +11 -0
- package/src/index.ts +15 -13
- package/src/mcp/index.ts +0 -33
- package/src/mcp/omo-mcp-index.ts +0 -5
- package/src/mcp/registry.ts +132 -0
- package/src/mcp/types.ts +11 -1
- package/src/plugin/hooks/create-tool-guard-hooks.ts +1 -1
- package/src/plugin/skill-context.ts +31 -13
- package/src/plugin/skill-discovery-config.ts +32 -0
- package/src/plugin-handlers/agent-config-handler.ts +20 -13
- package/src/plugin-handlers/command-config-handler.ts +22 -12
- package/src/shared/migration/agent-names.ts +5 -5
- package/src/shared/startup-diagnostics.ts +77 -0
- package/src/config/models.ts +0 -32
package/.env.example
CHANGED
|
@@ -2,29 +2,22 @@
|
|
|
2
2
|
# Copy this file to .env and fill in your values.
|
|
3
3
|
# All keys are optional unless noted.
|
|
4
4
|
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
#
|
|
5
|
+
# Model Provider Credentials
|
|
6
|
+
#
|
|
7
|
+
# Configure model provider credentials with OpenCode Connect.
|
|
8
|
+
# hiai-opencode only stores model IDs such as:
|
|
9
|
+
# - openrouter/anthropic/claude-3.5-sonnet
|
|
10
|
+
# - openai/gpt-4.1
|
|
11
|
+
# - anthropic/claude-3-5-sonnet-latest
|
|
12
|
+
#
|
|
13
|
+
# Do not put model provider keys here for normal OpenCode usage.
|
|
14
|
+
# Optional fallback only for headless/non-Connect workflows:
|
|
15
|
+
# OPENROUTER_API_KEY=your_openrouter_api_key_here
|
|
13
16
|
# OPENAI_API_KEY=your_openai_api_key_here
|
|
14
|
-
|
|
15
|
-
# Optional - needed only if using Anthropic models directly (not via OpenRouter)
|
|
16
17
|
# ANTHROPIC_API_KEY=your_anthropic_api_key_here
|
|
17
|
-
|
|
18
|
-
# Optional - DeepSeek models
|
|
19
18
|
# DEEPSEEK_API_KEY=your_deepseek_api_key_here
|
|
20
|
-
|
|
21
|
-
# Optional - GLM models via OpenRouter
|
|
22
19
|
# GLM_API_KEY=your_glm_api_key_here
|
|
23
|
-
|
|
24
|
-
# Optional - MiniMax models via OpenRouter
|
|
25
20
|
# MINIMAX_API_KEY=your_minimax_api_key_here
|
|
26
|
-
|
|
27
|
-
# Optional - Qwen models via OpenRouter
|
|
28
21
|
# QWEN_API_KEY=your_qwen_api_key_here
|
|
29
22
|
|
|
30
23
|
# MCP Service Keys
|
|
@@ -32,7 +25,7 @@ OPENROUTER_API_KEY=your_openrouter_api_key_here
|
|
|
32
25
|
# Optional - Stitch AI remote MCP service
|
|
33
26
|
# STITCH_AI_API_KEY=your_stitch_api_key_here
|
|
34
27
|
|
|
35
|
-
# Optional - Firecrawl web scraping MCP
|
|
28
|
+
# Optional - Firecrawl web scraping MCP
|
|
36
29
|
# FIRECRAWL_API_KEY=your_firecrawl_api_key_here
|
|
37
30
|
|
|
38
31
|
# Optional - Context7 code search MCP
|
|
@@ -51,7 +44,21 @@ OPENROUTER_API_KEY=your_openrouter_api_key_here
|
|
|
51
44
|
# Optional - Python command for MemPalace MCP (python3, python, or full path)
|
|
52
45
|
# MEMPALACE_PYTHON=python3
|
|
53
46
|
|
|
47
|
+
# Optional - custom MemPalace data directory
|
|
48
|
+
# MEMPALACE_PALACE_PATH=./.opencode/palace
|
|
49
|
+
|
|
50
|
+
# Optional - set to 0, false, or no to prevent first-run Python package install
|
|
51
|
+
# HIAI_MCP_AUTO_INSTALL=1
|
|
52
|
+
|
|
53
|
+
# Playwright MCP
|
|
54
|
+
|
|
55
|
+
# Optional - set to 1, true, or yes to install Chromium during launcher startup
|
|
56
|
+
# HIAI_PLAYWRIGHT_INSTALL_BROWSERS=0
|
|
57
|
+
|
|
58
|
+
# Optional - if Linux system browser deps cannot be installed, edit hiai-opencode.json
|
|
59
|
+
# and add Playwright MCP args such as "--browser", "chrome" to use an existing browser.
|
|
60
|
+
|
|
54
61
|
# RAG MCP
|
|
55
62
|
|
|
56
|
-
# Optional - RAG
|
|
57
|
-
#
|
|
63
|
+
# Optional - RAG search tool endpoint
|
|
64
|
+
# OPENCODE_RAG_URL=http://localhost:9002/tools/search
|
package/AGENTS.md
CHANGED
|
@@ -4,7 +4,9 @@ This file is for autonomous agents or tooling that need to install, configure, v
|
|
|
4
4
|
|
|
5
5
|
## Purpose
|
|
6
6
|
|
|
7
|
-
`hiai-opencode` is an OpenCode plugin repository published as `@hiai-gg/hiai-opencode`. It is not a standalone app.
|
|
7
|
+
`hiai-opencode` is an OpenCode plugin repository published as `@hiai-gg/hiai-opencode`. It is not a standalone app. It wires OpenCode agents, prompts, skills, MCP server launch commands, LSP defaults, and compatibility behavior around external upstream tools. Do not describe MCP servers, skills, model providers, or auxiliary OpenCode plugins as owned by this repository.
|
|
8
|
+
|
|
9
|
+
The normal workflow is:
|
|
8
10
|
|
|
9
11
|
1. install it through OpenCode or build it locally
|
|
10
12
|
2. register `@hiai-gg/hiai-opencode` in OpenCode
|
|
@@ -15,7 +17,19 @@ This file is for autonomous agents or tooling that need to install, configure, v
|
|
|
15
17
|
|
|
16
18
|
### Native OpenCode Install
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
Use the OpenCode plugin CLI:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
opencode plugin @hiai-gg/hiai-opencode@latest --global
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Optional Dynamic Context Pruning plugin:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
opencode plugin @tarquinen/opencode-dcp@latest --global
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Manual alternative:
|
|
19
33
|
|
|
20
34
|
```json
|
|
21
35
|
{
|
|
@@ -33,7 +47,13 @@ bun run build
|
|
|
33
47
|
|
|
34
48
|
### Register In OpenCode
|
|
35
49
|
|
|
36
|
-
|
|
50
|
+
Use the plugin CLI:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
opencode plugin @hiai-gg/hiai-opencode@latest --global
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Manual alternative:
|
|
37
57
|
|
|
38
58
|
```json
|
|
39
59
|
{
|
|
@@ -49,6 +69,102 @@ opencode debug config
|
|
|
49
69
|
opencode mcp list --print-logs --log-level INFO
|
|
50
70
|
```
|
|
51
71
|
|
|
72
|
+
## Post-Install Bootstrap Instructions
|
|
73
|
+
|
|
74
|
+
When a user asks OpenCode or another agent to finish installing this plugin, follow this procedure.
|
|
75
|
+
|
|
76
|
+
### Operating Rules
|
|
77
|
+
|
|
78
|
+
- Keep OpenCode plugins separate from MCP servers.
|
|
79
|
+
- Register `@hiai-gg/hiai-opencode` as an OpenCode plugin.
|
|
80
|
+
- Register `@tarquinen/opencode-dcp` only when the user wants Dynamic Context Pruning; it is a separate OpenCode plugin.
|
|
81
|
+
- Do not add MCP server npm packages to the OpenCode `plugin` array.
|
|
82
|
+
- Use `hiai-opencode.json` as the project-level service switchboard.
|
|
83
|
+
- Use `src/mcp/registry.ts` as the source of truth for default MCP launch wiring.
|
|
84
|
+
- Keep skill discovery deterministic by default: packaged plugin skills, generated builtin skills, explicit config sources, and project `.opencode/skills`.
|
|
85
|
+
- Do not enable global OpenCode, Claude, or Agents skill folders unless the user explicitly asks.
|
|
86
|
+
- Use `.env.example` as the key template, but never print, invent, commit, or hardcode secret values.
|
|
87
|
+
- Prefer user-level or project-local installs. Do not use sudo/admin rights unless the user explicitly asks.
|
|
88
|
+
|
|
89
|
+
### Bootstrap Checklist
|
|
90
|
+
|
|
91
|
+
1. Check tool availability:
|
|
92
|
+
- `opencode --version`
|
|
93
|
+
- `node --version`
|
|
94
|
+
- `npx --version`
|
|
95
|
+
- `bun --version`
|
|
96
|
+
- `python --version` or `python3 --version`
|
|
97
|
+
- `uv --version` when available
|
|
98
|
+
2. Check plugin registration with `opencode debug config`.
|
|
99
|
+
3. Find or create `hiai-opencode.json` in the project root or `.opencode/`.
|
|
100
|
+
4. Configure the `mcp` object there. Disable services that cannot run on the host.
|
|
101
|
+
5. Keep `skill_discovery` clean unless the user opts into external folders:
|
|
102
|
+
- `config_sources: true`
|
|
103
|
+
- `project_opencode: true`
|
|
104
|
+
- `global_opencode: false`
|
|
105
|
+
- `project_claude: false`
|
|
106
|
+
- `global_claude: false`
|
|
107
|
+
- `project_agents: false`
|
|
108
|
+
- `global_agents: false`
|
|
109
|
+
6. Check environment variables without printing values:
|
|
110
|
+
- `FIRECRAWL_API_KEY`
|
|
111
|
+
- `STITCH_AI_API_KEY`
|
|
112
|
+
- `CONTEXT7_API_KEY`
|
|
113
|
+
- `GOOGLE_SEARCH_API_KEY`
|
|
114
|
+
- `MEMPALACE_PYTHON`
|
|
115
|
+
- `OPENCODE_RAG_URL`
|
|
116
|
+
- `HIAI_PLAYWRIGHT_INSTALL_BROWSERS`
|
|
117
|
+
- `HIAI_MCP_AUTO_INSTALL`
|
|
118
|
+
7. Verify with:
|
|
119
|
+
- `opencode debug config`
|
|
120
|
+
- `opencode mcp list --print-logs --log-level INFO`
|
|
121
|
+
|
|
122
|
+
### MCP Setup Matrix
|
|
123
|
+
|
|
124
|
+
| Service | Enable when | Dependency behavior |
|
|
125
|
+
|---|---|---|
|
|
126
|
+
| `playwright` | Node and npx are available | Helper launcher runs `@playwright/mcp@latest`; set `HIAI_PLAYWRIGHT_INSTALL_BROWSERS=1` to install Chromium on first start |
|
|
127
|
+
| `sequential-thinking` | Node and npx are available | Helper launcher runs `@modelcontextprotocol/server-sequential-thinking` |
|
|
128
|
+
| `firecrawl` | `FIRECRAWL_API_KEY` is set | Helper launcher runs `firecrawl-mcp` |
|
|
129
|
+
| `mempalace` | `uv` is available, or Python 3.9+ with pip is available | Launcher prefers `uv`; otherwise uses Python and can run `python -m pip install --user mempalace` when `HIAI_MCP_AUTO_INSTALL` is not disabled |
|
|
130
|
+
| `rag` | User has a local or remote RAG endpoint | Uses `OPENCODE_RAG_URL`, defaulting to `http://localhost:9002/tools/search` |
|
|
131
|
+
| `stitch` | `STITCH_AI_API_KEY` is set | Remote MCP endpoint |
|
|
132
|
+
| `context7` | User wants Context7 docs/search | Remote MCP endpoint; use `CONTEXT7_API_KEY` if available |
|
|
133
|
+
|
|
134
|
+
Playwright troubleshooting rules:
|
|
135
|
+
|
|
136
|
+
- If `skill_mcp` says `MCP server "playwright" not found`, first load the `playwright` skill and check `hiai-opencode mcp-status`; do not report this as a browser dependency failure.
|
|
137
|
+
- If Chromium reports missing Linux libraries (`libnspr4`, `libnss3`, `libatk-bridge`, `libgtk-3`, etc.), explain that MCP is present but the host lacks browser system dependencies.
|
|
138
|
+
- Without sudo, try a system browser override in `hiai-opencode.json`, such as `--browser chrome` or `--browser msedge`.
|
|
139
|
+
- If no browser path works, use `curl` only as degraded HTTP verification and explicitly say it is not a replacement for browser testing.
|
|
140
|
+
|
|
141
|
+
### Prompt For OpenCode Users
|
|
142
|
+
|
|
143
|
+
Users can paste this into OpenCode after installing the plugin:
|
|
144
|
+
|
|
145
|
+
```text
|
|
146
|
+
Finish hiai-opencode setup in this workspace.
|
|
147
|
+
|
|
148
|
+
Keep OpenCode plugins separate from MCP servers. Do not add MCP server packages to the OpenCode plugin list.
|
|
149
|
+
|
|
150
|
+
Verify @hiai-gg/hiai-opencode is registered. If I ask for Dynamic Context Pruning, install @tarquinen/opencode-dcp as a separate OpenCode plugin.
|
|
151
|
+
|
|
152
|
+
Find or create hiai-opencode.json in the project root or .opencode/. Use its mcp object as the only switchboard for MCP enable/disable.
|
|
153
|
+
|
|
154
|
+
Check which services can run here:
|
|
155
|
+
- playwright: node/npx; optionally HIAI_PLAYWRIGHT_INSTALL_BROWSERS=1.
|
|
156
|
+
- sequential-thinking: node/npx.
|
|
157
|
+
- firecrawl: FIRECRAWL_API_KEY.
|
|
158
|
+
- mempalace: uv or Python 3.9+ with pip; MEMPALACE_PYTHON if needed; HIAI_MCP_AUTO_INSTALL controls first-run pip install.
|
|
159
|
+
- rag: OPENCODE_RAG_URL or http://localhost:9002/tools/search.
|
|
160
|
+
- stitch: STITCH_AI_API_KEY.
|
|
161
|
+
- context7: optional CONTEXT7_API_KEY.
|
|
162
|
+
|
|
163
|
+
Report missing keys without printing secret values. Never invent or hardcode API keys.
|
|
164
|
+
|
|
165
|
+
Run opencode debug config and opencode mcp list --print-logs --log-level INFO if available. If something is missing, propose or run only user-level/project-local install commands.
|
|
166
|
+
```
|
|
167
|
+
|
|
52
168
|
## Expected Agent State
|
|
53
169
|
|
|
54
170
|
Visible primary agents:
|
|
@@ -89,18 +205,15 @@ If runtime output differs from that set, inspect:
|
|
|
89
205
|
|
|
90
206
|
## Model Configuration
|
|
91
207
|
|
|
92
|
-
There
|
|
208
|
+
There is one source of truth for model IDs:
|
|
93
209
|
|
|
94
|
-
|
|
95
|
-
- [src/config/models.ts](src/config/models.ts)
|
|
96
|
-
2. actual runtime defaults:
|
|
97
|
-
- [src/config/defaults.ts](src/config/defaults.ts)
|
|
210
|
+
- [hiai-opencode.json](hiai-opencode.json)
|
|
98
211
|
|
|
99
|
-
The
|
|
212
|
+
The runtime loader is:
|
|
100
213
|
|
|
101
|
-
- [
|
|
214
|
+
- [src/config/defaults.ts](src/config/defaults.ts)
|
|
102
215
|
|
|
103
|
-
Use fully qualified model IDs. Do not introduce local aliases like `hiai-fast` or `
|
|
216
|
+
Use fully qualified model IDs. Do not introduce local aliases like `hiai-fast`, `sonnet`, `fast`, or `high`.
|
|
104
217
|
|
|
105
218
|
## Change Map
|
|
106
219
|
|
|
@@ -108,10 +221,9 @@ Use this table when you need to change something and want the right file immedia
|
|
|
108
221
|
|
|
109
222
|
| Goal | Edit this first | Why |
|
|
110
223
|
|---|---|---|
|
|
111
|
-
| Change
|
|
112
|
-
| Change which default model
|
|
113
|
-
| Change
|
|
114
|
-
| Change provider/model guidance shown to maintainers | [src/config/models.ts](src/config/models.ts) | That file holds provider rules and role guidance |
|
|
224
|
+
| Change which default model an agent uses | [hiai-opencode.json](hiai-opencode.json) | This is the canonical model source |
|
|
225
|
+
| Change which default model a category uses | [hiai-opencode.json](hiai-opencode.json) | Categories are assigned there |
|
|
226
|
+
| Change MCP/LSP/user-facing defaults | [hiai-opencode.json](hiai-opencode.json) | The runtime loader reads this file |
|
|
115
227
|
| Change Bob behavior or prompt text | [src/agents/bob.ts](src/agents/bob.ts), `src/agents/bob/*` | Bob prompt authoring lives there |
|
|
116
228
|
| Change Coder behavior or prompt text | `src/agents/coder/*` | Coder prompt authoring lives there |
|
|
117
229
|
| Change Strategist behavior or prompt text | `src/agents/strategist/*` | Strategist prompt authoring lives there |
|
|
@@ -129,8 +241,10 @@ Use this table when you need to change something and want the right file immedia
|
|
|
129
241
|
| Change closure protocol appended to prompts | [src/shared/closure-protocol.ts](src/shared/closure-protocol.ts) | It is injected after prompt construction |
|
|
130
242
|
| Change prompt override / prompt_append behavior | `src/agents/builtin-agents/agent-overrides.ts` | Override merge logic lives there |
|
|
131
243
|
| Change environment context appended to prompts | `src/agents/builtin-agents/environment-context.ts` | Runtime environment prompt injection lives there |
|
|
132
|
-
| Change
|
|
133
|
-
| Change
|
|
244
|
+
| Change skill discovery source defaults | [src/config/schema/skill-discovery.ts](src/config/schema/skill-discovery.ts), [src/plugin/skill-discovery-config.ts](src/plugin/skill-discovery-config.ts) | Controls opt-in external skill folders |
|
|
245
|
+
| Change skill source loading behavior | [src/plugin/skill-context.ts](src/plugin/skill-context.ts), [src/plugin-handlers/command-config-handler.ts](src/plugin-handlers/command-config-handler.ts) | Skills and skill-backed commands must stay aligned |
|
|
246
|
+
| Change MCP defaults | [src/mcp/registry.ts](src/mcp/registry.ts) | Default MCP wiring lives there |
|
|
247
|
+
| Change OpenCode MCP assembly | [src/mcp/index.ts](src/mcp/index.ts) | Final MCP config assembly lives there |
|
|
134
248
|
| Change local MCP helper launcher logic | `assets/mcp/*` | Runtime launcher scripts live there |
|
|
135
249
|
| Change npm bootstrap behavior for MCP/LSP tools | [assets/runtime/npm-package-runner.mjs](assets/runtime/npm-package-runner.mjs) | Shared npm bootstrap logic lives there |
|
|
136
250
|
| Change LSP defaults | [src/config/defaults.ts](src/config/defaults.ts) | LSP defaults live there |
|
|
@@ -204,11 +318,11 @@ So:
|
|
|
204
318
|
|
|
205
319
|
## MCP Rules
|
|
206
320
|
|
|
207
|
-
Default MCP
|
|
321
|
+
Default MCP wiring lives in:
|
|
208
322
|
|
|
209
|
-
- [src/
|
|
323
|
+
- [src/mcp/registry.ts](src/mcp/registry.ts)
|
|
210
324
|
|
|
211
|
-
|
|
325
|
+
OpenCode MCP config assembly lives in:
|
|
212
326
|
|
|
213
327
|
- [src/mcp/index.ts](src/mcp/index.ts)
|
|
214
328
|
|
|
@@ -229,25 +343,66 @@ Current MCP set:
|
|
|
229
343
|
- `websearch`
|
|
230
344
|
- `grep_app`
|
|
231
345
|
|
|
346
|
+
## Skill Discovery Rules
|
|
347
|
+
|
|
348
|
+
Default behavior is intentionally deterministic.
|
|
349
|
+
|
|
350
|
+
Enabled by default:
|
|
351
|
+
|
|
352
|
+
- packaged `hiai-opencode` skill definitions mirrored into OpenCode's skill view
|
|
353
|
+
- generated builtin helper skills
|
|
354
|
+
- explicit `skills.sources` entries
|
|
355
|
+
- project-local `.opencode/skills` and `.opencode/skill`
|
|
356
|
+
|
|
357
|
+
Disabled by default:
|
|
358
|
+
|
|
359
|
+
- global OpenCode skills
|
|
360
|
+
- project and global Claude skills
|
|
361
|
+
- project and global Agents skills
|
|
362
|
+
|
|
363
|
+
Opt-in example:
|
|
364
|
+
|
|
365
|
+
```json
|
|
366
|
+
{
|
|
367
|
+
"skill_discovery": {
|
|
368
|
+
"global_opencode": true,
|
|
369
|
+
"project_claude": true,
|
|
370
|
+
"global_claude": false,
|
|
371
|
+
"project_agents": false,
|
|
372
|
+
"global_agents": false
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Use `skills.disable` for noisy individual skills:
|
|
378
|
+
|
|
379
|
+
```json
|
|
380
|
+
{
|
|
381
|
+
"skills": {
|
|
382
|
+
"disable": ["claude-md-management"]
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
```
|
|
386
|
+
|
|
232
387
|
## Environment Variables
|
|
233
388
|
|
|
234
389
|
Use [.env.example](.env.example) as the canonical key template for local setup and release checks.
|
|
235
390
|
|
|
236
|
-
|
|
391
|
+
Model provider credentials are configured through OpenCode Connect. Do not ask users to put `OPENROUTER_API_KEY`, `OPENAI_API_KEY`, or `ANTHROPIC_API_KEY` into `hiai-opencode.json` for normal model usage. The plugin stores model IDs only.
|
|
392
|
+
|
|
393
|
+
Common service keys:
|
|
237
394
|
|
|
238
|
-
- `OPENROUTER_API_KEY`
|
|
239
|
-
- `OPENAI_API_KEY`
|
|
240
|
-
- `ANTHROPIC_API_KEY`
|
|
241
|
-
- `DEEPSEEK_API_KEY`
|
|
242
|
-
- `GLM_API_KEY`
|
|
243
|
-
- `MINIMAX_API_KEY`
|
|
244
|
-
- `QWEN_API_KEY`
|
|
245
395
|
- `STITCH_AI_API_KEY`
|
|
246
396
|
- `FIRECRAWL_API_KEY`
|
|
247
397
|
- `CONTEXT7_API_KEY`
|
|
398
|
+
- `GOOGLE_SEARCH_API_KEY`
|
|
248
399
|
- `OLLAMA_BASE_URL`
|
|
249
400
|
- `OLLAMA_MODEL`
|
|
250
401
|
- `MEMPALACE_PYTHON`
|
|
402
|
+
- `MEMPALACE_PALACE_PATH`
|
|
403
|
+
- `OPENCODE_RAG_URL`
|
|
404
|
+
- `HIAI_PLAYWRIGHT_INSTALL_BROWSERS`
|
|
405
|
+
- `HIAI_MCP_AUTO_INSTALL`
|
|
251
406
|
|
|
252
407
|
## Known Runtime Caveats
|
|
253
408
|
|
package/ARCHITECTURE.md
CHANGED
|
@@ -14,7 +14,7 @@ The plugin has five main layers:
|
|
|
14
14
|
|
|
15
15
|
## Repository Layout
|
|
16
16
|
|
|
17
|
-
- [src/config](src/config): schemas, types,
|
|
17
|
+
- [src/config](src/config): schemas, types, and bundled config loading
|
|
18
18
|
- [src/agents](src/agents): agent factories, prompts, and prompt helpers
|
|
19
19
|
- [src/plugin-handlers](src/plugin-handlers): runtime config assembly into OpenCode shape
|
|
20
20
|
- [src/features](src/features): loaders, materializers, bridges, and supporting runtime features
|
|
@@ -62,19 +62,13 @@ Runtime naming, visibility, and compatibility are normalized through:
|
|
|
62
62
|
|
|
63
63
|
### Presets
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
Agent and category model IDs live in one place:
|
|
66
66
|
|
|
67
|
-
- [
|
|
68
|
-
|
|
69
|
-
This file defines:
|
|
70
|
-
|
|
71
|
-
- `MODEL_PRESETS`
|
|
72
|
-
- `MODEL_ROLE_GUIDE`
|
|
73
|
-
- `PROVIDER_MODEL_RULES`
|
|
67
|
+
- [hiai-opencode.json](hiai-opencode.json)
|
|
74
68
|
|
|
75
69
|
### Runtime Defaults
|
|
76
70
|
|
|
77
|
-
|
|
71
|
+
The TypeScript defaults loader only reads the bundled canonical config:
|
|
78
72
|
|
|
79
73
|
- [src/config/defaults.ts](src/config/defaults.ts)
|
|
80
74
|
|
|
@@ -164,8 +158,7 @@ If a prompt change looks correct in source but does not show up correctly in Ope
|
|
|
164
158
|
|
|
165
159
|
Use these rules when editing the prompt layer:
|
|
166
160
|
|
|
167
|
-
- change `
|
|
168
|
-
- change `src/config/defaults.ts` when default model assignment should change
|
|
161
|
+
- change `hiai-opencode.json` when any default model assignment should change
|
|
169
162
|
- change `src/agents/*` when the prompt content or behavior should change
|
|
170
163
|
- change shared prompt/injection files when the prompt is being appended or normalized after agent construction
|
|
171
164
|
- change `src/plugin-handlers/agent-config-handler.ts` when runtime name, visibility, mode, or final description should change
|
|
@@ -187,25 +180,29 @@ The final runtime prompt can also be affected by:
|
|
|
187
180
|
|
|
188
181
|
## Skills
|
|
189
182
|
|
|
190
|
-
Two skill sources are
|
|
183
|
+
Two skill sources are wired into OpenCode:
|
|
191
184
|
|
|
192
|
-
- project
|
|
193
|
-
-
|
|
185
|
+
- project skill definitions in [skills](skills)
|
|
186
|
+
- skill materialization into the OpenCode-visible skill tree
|
|
194
187
|
|
|
195
188
|
Relevant files:
|
|
196
189
|
|
|
197
190
|
- [src/features/builtin-skills/materialize.ts](src/features/builtin-skills/materialize.ts)
|
|
198
191
|
- [src/features/opencode-skill-loader](src/features/opencode-skill-loader)
|
|
192
|
+
- [src/config/schema/skill-discovery.ts](src/config/schema/skill-discovery.ts)
|
|
193
|
+
- [src/plugin/skill-discovery-config.ts](src/plugin/skill-discovery-config.ts)
|
|
194
|
+
|
|
195
|
+
Default discovery is deterministic: packaged plugin skills, generated builtin skills, explicit config sources, and project `.opencode/skills`. Global OpenCode, Claude, and Agents skill folders are opt-in.
|
|
199
196
|
|
|
200
197
|
## MCP
|
|
201
198
|
|
|
202
199
|
### Definitions
|
|
203
200
|
|
|
204
|
-
Default MCP
|
|
201
|
+
Default MCP wiring is in:
|
|
205
202
|
|
|
206
|
-
- [src/
|
|
203
|
+
- [src/mcp/registry.ts](src/mcp/registry.ts)
|
|
207
204
|
|
|
208
|
-
|
|
205
|
+
OpenCode MCP config assembly is in:
|
|
209
206
|
|
|
210
207
|
- [src/mcp/index.ts](src/mcp/index.ts)
|
|
211
208
|
|
|
@@ -273,8 +270,8 @@ Avoid adding more root docs unless they serve a genuinely new role.
|
|
|
273
270
|
|
|
274
271
|
When changing the plugin, keep these invariants:
|
|
275
272
|
|
|
276
|
-
- `
|
|
277
|
-
- `src/config/
|
|
273
|
+
- `hiai-opencode.json` is the source of truth for user-facing runtime defaults and model IDs
|
|
274
|
+
- `src/config/defaults.ts` must remain a loader, not a second model map
|
|
278
275
|
- root docs should use canonical runtime names, not stale internal aliases
|
|
279
276
|
- user-facing docs should describe visible agents first and hidden/system agents second
|
|
280
277
|
- third-party MCPs should follow upstream install/launch conventions whenever possible
|
package/LICENSE.md
CHANGED
|
@@ -20,6 +20,7 @@ Some are:
|
|
|
20
20
|
|
|
21
21
|
| Component | Upstream | Notes |
|
|
22
22
|
|---|---|---|
|
|
23
|
+
| OpenCode host/runtime | [anomalyco/opencode](https://github.com/anomalyco/opencode) | plugin host and runtime target |
|
|
23
24
|
| Core orchestration influences | [code-yeongyu/oh-my-openagent](https://github.com/code-yeongyu/oh-my-openagent) | important architectural influence |
|
|
24
25
|
| Planning / workflow influences | [obra/superpowers](https://github.com/obra/superpowers) | planning, review, and debugging ideas |
|
|
25
26
|
| Specialist / platform influences | [vtemian/micode](https://github.com/vtemian/micode) | platform-style specialist behavior |
|