@hiai-gg/hiai-opencode 0.1.4 → 0.1.5

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/AGENTS.md CHANGED
@@ -213,6 +213,8 @@ The runtime loader is:
213
213
 
214
214
  - [src/config/defaults.ts](src/config/defaults.ts)
215
215
 
216
+ Users configure only the 10 primary agent model slots under `models`: `bob`, `coder`, `strategist`, `guard`, `critic`, `designer`, `researcher`, `manager`, `brainstormer`, and `vision`.
217
+ Hidden agents and task categories are derived internally in `src/config/defaults.ts`.
216
218
  Use fully qualified model IDs. Do not introduce local aliases like `hiai-fast`, `sonnet`, `fast`, or `high`.
217
219
 
218
220
  ## Change Map
@@ -221,9 +223,9 @@ Use this table when you need to change something and want the right file immedia
221
223
 
222
224
  | Goal | Edit this first | Why |
223
225
  |---|---|---|
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 |
226
+ | Change a user-facing default model slot | [hiai-opencode.json](hiai-opencode.json) | This is the canonical model source |
227
+ | Change how categories inherit the 10 model slots | [src/config/defaults.ts](src/config/defaults.ts) | Category routing is internal |
228
+ | Change MCP/LSP user-facing switches | [hiai-opencode.json](hiai-opencode.json) | Users only toggle enabled state there |
227
229
  | Change Bob behavior or prompt text | [src/agents/bob.ts](src/agents/bob.ts), `src/agents/bob/*` | Bob prompt authoring lives there |
228
230
  | Change Coder behavior or prompt text | `src/agents/coder/*` | Coder prompt authoring lives there |
229
231
  | Change Strategist behavior or prompt text | `src/agents/strategist/*` | Strategist prompt authoring lives there |
package/ARCHITECTURE.md CHANGED
@@ -62,20 +62,20 @@ Runtime naming, visibility, and compatibility are normalized through:
62
62
 
63
63
  ### Presets
64
64
 
65
- Agent and category model IDs live in one place:
65
+ User-facing model IDs live in one place:
66
66
 
67
67
  - [hiai-opencode.json](hiai-opencode.json)
68
68
 
69
69
  ### Runtime Defaults
70
70
 
71
- The TypeScript defaults loader only reads the bundled canonical config:
71
+ The TypeScript defaults loader derives hidden agents and categories from the 10 user-facing model slots:
72
72
 
73
73
  - [src/config/defaults.ts](src/config/defaults.ts)
74
74
 
75
- This is the runtime source of truth for:
75
+ This is the internal routing source for:
76
76
 
77
- - agent models
78
- - category models
77
+ - hidden agent model inheritance
78
+ - category model inheritance
79
79
  - MCP defaults
80
80
  - LSP defaults
81
81
  - permissions
@@ -158,7 +158,8 @@ If a prompt change looks correct in source but does not show up correctly in Ope
158
158
 
159
159
  Use these rules when editing the prompt layer:
160
160
 
161
- - change `hiai-opencode.json` when any default model assignment should change
161
+ - change `hiai-opencode.json` when any primary agent model slot should change
162
+ - change `src/config/defaults.ts` when internal category-to-agent-slot routing should change
162
163
  - change `src/agents/*` when the prompt content or behavior should change
163
164
  - change shared prompt/injection files when the prompt is being appended or normalized after agent construction
164
165
  - change `src/plugin-handlers/agent-config-handler.ts` when runtime name, visibility, mode, or final description should change
package/README.md CHANGED
@@ -116,10 +116,22 @@ New-Item -ItemType Directory -Force .opencode
116
116
  Copy-Item .\hiai-opencode.json .\.opencode\hiai-opencode.json
117
117
  ```
118
118
 
119
- If you installed only from npm/OpenCode and do not have this repository checked out, create `.opencode/hiai-opencode.json` with the service block below and adjust it later.
119
+ If you installed only from npm/OpenCode and do not have this repository checked out, create `.opencode/hiai-opencode.json` with the shape below and adjust it later.
120
120
 
121
121
  ```json
122
122
  {
123
+ "models": {
124
+ "bob": { "model": "openrouter/anthropic/claude-3.5-opus", "recommended": "xhigh" },
125
+ "coder": { "model": "openrouter/anthropic/claude-3.5-sonnet", "recommended": "high" },
126
+ "strategist": { "model": "openrouter/z-ai/glm-5.1", "recommended": "high" },
127
+ "guard": { "model": "openrouter/openai/gpt-4o", "recommended": "middle" },
128
+ "critic": { "model": "openrouter/qwen/qwen2.5-72b-instruct", "recommended": "high" },
129
+ "designer": { "model": "openrouter/google/gemini-3.1-pro", "recommended": "design" },
130
+ "researcher": { "model": "openrouter/google/gemini-2.0-flash", "recommended": "fast" },
131
+ "manager": { "model": "openrouter/google/gemini-2.0-flash", "recommended": "fast" },
132
+ "brainstormer": { "model": "openrouter/kimi/kimi-latest", "recommended": "writing" },
133
+ "vision": { "model": "openrouter/google/gemini-3.1-pro", "recommended": "vision" }
134
+ },
123
135
  "mcp": {
124
136
  "playwright": { "enabled": true },
125
137
  "sequential-thinking": { "enabled": true },
@@ -137,7 +149,7 @@ By default, skill discovery is deterministic: `hiai-opencode` skills plus projec
137
149
  ### 3. Connect models and add service keys
138
150
 
139
151
  Model provider credentials belong to OpenCode Connect, not to `hiai-opencode`.
140
- This plugin only writes model IDs such as `openrouter/anthropic/claude-3.5-sonnet` into agent and category config.
152
+ This plugin only reads the 10 model IDs in `models`. Internal routing derives hidden agents and task categories from those 10 choices.
141
153
 
142
154
  Use OpenCode Connect to authorize the providers behind your configured model IDs. Then add only the service keys for MCP or search integrations you actually use:
143
155
 
@@ -216,7 +228,7 @@ If a dependency is missing, install only user-level or project-local dependencie
216
228
 
217
229
  ### Models
218
230
 
219
- Canonical runtime defaults for agents, categories, MCP, LSP, and model IDs:
231
+ Canonical user-facing config for 10 primary agent models, MCP/LSP switches, service auth placeholders, and skill discovery:
220
232
 
221
233
  - [hiai-opencode.json](hiai-opencode.json)
222
234
 
@@ -224,7 +236,7 @@ Runtime loader for the bundled canonical config:
224
236
 
225
237
  - [src/config/defaults.ts](src/config/defaults.ts)
226
238
 
227
- If you want to change which model a specific agent or category uses by default, edit `hiai-opencode.json`.
239
+ If you want to change model selection, edit the 10 entries in `models`. Do not add category-specific model choices unless you are intentionally developing the plugin internals.
228
240
 
229
241
  Use fully qualified model IDs. Do not introduce local aliases like `hiai-fast`, `sonnet`, `fast`, or `high`.
230
242
 
@@ -1,131 +1,75 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "title": "hiai-opencode Configuration",
4
- "description": "Unified configuration for hiai-opencode plugin",
4
+ "description": "User-facing hiai-opencode config. Users choose 10 primary agent models, service auth placeholders, and enable/disable MCP/LSP integrations. Internal routing derives hidden agents and task categories from these model slots.",
5
5
  "type": "object",
6
6
  "properties": {
7
7
  "$schema": { "type": "string" },
8
- "agents": {
8
+ "models": {
9
9
  "type": "object",
10
- "additionalProperties": {
11
- "type": "object",
12
- "properties": {
13
- "model": { "type": "string" },
14
- "description": { "type": "string" }
15
- },
16
- "required": ["model"]
17
- }
18
- },
19
- "agentRequirements": {
20
- "type": "object",
21
- "additionalProperties": {
22
- "type": "object",
23
- "properties": {
24
- "fallbackChain": {
25
- "type": "array",
26
- "items": { "$ref": "#/definitions/fallbackEntry" }
27
- },
28
- "variant": { "type": "string" },
29
- "requiresModel": { "type": "string" },
30
- "requiresAnyModel": { "type": "boolean" },
31
- "requiresProvider": { "type": "array", "items": { "type": "string" } }
32
- },
33
- "required": ["fallbackChain"]
34
- }
35
- },
36
- "categories": {
37
- "type": "object",
38
- "additionalProperties": {
39
- "type": "object",
40
- "properties": {
41
- "model": { "type": "string" },
42
- "variant": { "type": "string" },
43
- "description": { "type": "string" },
44
- "fallbackChain": {
45
- "type": "array",
46
- "items": { "$ref": "#/definitions/fallbackEntry" }
47
- }
48
- },
49
- "required": ["model"]
50
- }
10
+ "description": "The only user-facing model source of truth. Use fully qualified OpenCode model IDs.",
11
+ "properties": {
12
+ "bob": { "$ref": "#/definitions/modelSlot" },
13
+ "coder": { "$ref": "#/definitions/modelSlot" },
14
+ "strategist": { "$ref": "#/definitions/modelSlot" },
15
+ "guard": { "$ref": "#/definitions/modelSlot" },
16
+ "critic": { "$ref": "#/definitions/modelSlot" },
17
+ "designer": { "$ref": "#/definitions/modelSlot" },
18
+ "researcher": { "$ref": "#/definitions/modelSlot" },
19
+ "manager": { "$ref": "#/definitions/modelSlot" },
20
+ "brainstormer": { "$ref": "#/definitions/modelSlot" },
21
+ "vision": { "$ref": "#/definitions/modelSlot" }
22
+ },
23
+ "required": [
24
+ "bob",
25
+ "coder",
26
+ "strategist",
27
+ "guard",
28
+ "critic",
29
+ "designer",
30
+ "researcher",
31
+ "manager",
32
+ "brainstormer",
33
+ "vision"
34
+ ]
51
35
  },
52
- "categoryRequirements": {
36
+ "auth": {
53
37
  "type": "object",
54
- "additionalProperties": {
55
- "type": "object",
56
- "properties": {
57
- "fallbackChain": {
58
- "type": "array",
59
- "items": { "$ref": "#/definitions/fallbackEntry" }
60
- },
61
- "variant": { "type": "string" },
62
- "requiresModel": { "type": "string" },
63
- "requiresAnyModel": { "type": "boolean" },
64
- "requiresProvider": { "type": "array", "items": { "type": "string" } }
65
- },
66
- "required": ["fallbackChain"]
67
- }
68
- },
69
- "modelFamilies": {
70
- "type": "array",
71
- "items": {
72
- "type": "object",
73
- "properties": {
74
- "family": { "type": "string" },
75
- "includes": { "type": "array", "items": { "type": "string" } },
76
- "pattern": { "type": "string" },
77
- "variants": { "type": "array", "items": { "type": "string" } },
78
- "reasoningEfforts": { "type": "array", "items": { "type": "string" } },
79
- "supportsThinking": { "type": "boolean" }
80
- },
81
- "required": ["family"]
38
+ "additionalProperties": { "type": "string" },
39
+ "properties": {
40
+ "googleSearch": { "type": "string" },
41
+ "stitch": { "type": "string" },
42
+ "firecrawl": { "type": "string" },
43
+ "context7": { "type": "string" }
82
44
  }
83
45
  },
84
46
  "mcp": {
85
47
  "type": "object",
86
- "additionalProperties": {
87
- "type": "object",
88
- "properties": {
89
- "enabled": { "type": "boolean", "default": true },
90
- "type": { "enum": ["remote", "local"] },
91
- "url": { "type": "string" },
92
- "headers": { "type": "object", "additionalProperties": { "type": "string" } },
93
- "command": { "type": "array", "items": { "type": "string" } },
94
- "timeout": { "type": "number" },
95
- "environment": { "type": "object", "additionalProperties": { "type": "string" } }
96
- },
97
- "required": ["enabled"]
98
- }
99
- },
100
- "lsp": {
101
- "type": "object",
102
- "additionalProperties": {
103
- "type": "object",
104
- "properties": {
105
- "command": { "type": "array", "items": { "type": "string" } },
106
- "extensions": { "type": "array", "items": { "type": "string" } },
107
- "initialization": { "type": "object" }
108
- },
109
- "required": ["command", "extensions"]
110
- }
111
- },
112
- "subtask2": {
113
- "type": "object",
48
+ "additionalProperties": false,
114
49
  "properties": {
115
- "replace_generic": { "type": "boolean" },
116
- "generic_return": { "type": ["string", "null"] }
50
+ "playwright": { "$ref": "#/definitions/toggle" },
51
+ "stitch": { "$ref": "#/definitions/toggle" },
52
+ "sequential-thinking": { "$ref": "#/definitions/toggle" },
53
+ "firecrawl": { "$ref": "#/definitions/toggle" },
54
+ "rag": { "$ref": "#/definitions/toggle" },
55
+ "mempalace": { "$ref": "#/definitions/toggle" },
56
+ "context7": { "$ref": "#/definitions/toggle" }
117
57
  }
118
58
  },
119
- "skills": {
59
+ "lsp": {
120
60
  "type": "object",
61
+ "additionalProperties": false,
121
62
  "properties": {
122
- "enabled": { "type": "boolean", "default": true },
123
- "disabled": { "type": "array", "items": { "type": "string" } }
63
+ "typescript": { "$ref": "#/definitions/toggle" },
64
+ "svelte": { "$ref": "#/definitions/toggle" },
65
+ "eslint": { "$ref": "#/definitions/toggle" },
66
+ "bash": { "$ref": "#/definitions/toggle" },
67
+ "pyright": { "$ref": "#/definitions/toggle" }
124
68
  }
125
69
  },
126
70
  "skill_discovery": {
127
71
  "type": "object",
128
- "description": "Controls which external skill directories are scanned. Defaults keep installs deterministic: hiai-opencode skills plus project .opencode/skills only.",
72
+ "description": "Controls external skill folder scanning. Defaults keep installs deterministic.",
129
73
  "properties": {
130
74
  "config_sources": { "type": "boolean", "default": true },
131
75
  "project_opencode": { "type": "boolean", "default": true },
@@ -136,59 +80,38 @@
136
80
  "global_agents": { "type": "boolean", "default": false }
137
81
  }
138
82
  },
139
- "permissions": {
140
- "type": "object",
141
- "properties": {
142
- "read": { "type": "object", "additionalProperties": { "type": "string" } },
143
- "edit": { "type": "object", "additionalProperties": { "type": "string" } },
144
- "bash": { "type": "object", "additionalProperties": { "type": "string" } },
145
- "deny_paths": { "type": "array", "items": { "type": "string" } }
146
- }
147
- },
148
- "auth": {
149
- "type": "object",
150
- "additionalProperties": { "type": "string" }
151
- },
152
- "ollama": {
153
- "type": "object",
154
- "properties": {
155
- "enabled": { "type": "boolean", "default": false },
156
- "model": { "type": "string" },
157
- "baseUrl": { "type": "string" },
158
- "purpose": { "enum": ["verification", "helper", "fallback"] }
159
- }
160
- },
161
- "fast_apply": {
83
+ "subtask2": {
162
84
  "type": "object",
163
85
  "properties": {
164
- "enabled": { "type": "boolean", "default": false },
165
- "ollama_url": { "type": "string" },
166
- "model": { "type": "string" },
167
- "timeout": { "type": "number" }
86
+ "replace_generic": { "type": "boolean" }
168
87
  }
169
88
  }
170
89
  },
90
+ "required": ["models"],
171
91
  "definitions": {
172
- "fallbackEntry": {
173
- "type": "object",
174
- "properties": {
175
- "providers": { "type": "array", "items": { "type": "string" } },
176
- "model": { "type": "string" },
177
- "variant": { "type": "string" },
178
- "reasoningEffort": { "type": "string" },
179
- "temperature": { "type": "number" },
180
- "top_p": { "type": "number" },
181
- "maxTokens": { "type": "number" },
182
- "thinking": {
92
+ "modelSlot": {
93
+ "oneOf": [
94
+ { "type": "string" },
95
+ {
183
96
  "type": "object",
184
97
  "properties": {
185
- "type": { "enum": ["enabled", "disabled"] },
186
- "budgetTokens": { "type": "number" }
98
+ "model": { "type": "string" },
99
+ "recommended": {
100
+ "enum": ["xhigh", "high", "middle", "fast", "vision", "writing", "design"]
101
+ }
187
102
  },
188
- "required": ["type"]
103
+ "required": ["model"],
104
+ "additionalProperties": false
189
105
  }
106
+ ]
107
+ },
108
+ "toggle": {
109
+ "type": "object",
110
+ "properties": {
111
+ "enabled": { "type": "boolean", "default": true }
190
112
  },
191
- "required": ["providers", "model"]
113
+ "required": ["enabled"],
114
+ "additionalProperties": false
192
115
  }
193
116
  }
194
117
  }
@@ -1,2 +1,3 @@
1
1
  import type { HiaiOpencodeConfig } from "./types.js";
2
+ export declare function applyModelSlots(config: HiaiOpencodeConfig): HiaiOpencodeConfig;
2
3
  export declare const defaultConfig: HiaiOpencodeConfig;