my-opencode 2.0.0 → 3.0.1
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 +22 -13
- package/bin/cli.js +1 -1
- package/bin/moc +16 -8
- package/bin/moc.js +9 -3
- package/opencode.json +29 -7
- package/package.json +1 -1
- package/plugins/README.md +16 -9
- package/plugins/provider-profile.mjs +69 -34
- package/scripts/validate-role-flow.mjs +3 -3
package/README.md
CHANGED
|
@@ -62,7 +62,6 @@ npm link # 將 bin/moc 註冊到 PATH,讓 moc 指令全域可用
|
|
|
62
62
|
```bash
|
|
63
63
|
moc # 預設 opencode profile
|
|
64
64
|
moc openai # 切到 OpenAI profile
|
|
65
|
-
moc google # 切到 Google profile
|
|
66
65
|
moc copilot # 切到 Copilot profile
|
|
67
66
|
moc --help # 透明轉發到 opencode --help
|
|
68
67
|
```
|
|
@@ -80,17 +79,27 @@ npx my-opencode help # 顯示說明
|
|
|
80
79
|
|
|
81
80
|
內建 `provider-profile` plugin / resolver,主要透過 `moc` 切換整套模型配置。
|
|
82
81
|
|
|
83
|
-
支援值:`opencode`(預設)、`openai`、`
|
|
82
|
+
支援值:`opencode`(預設)、`openai`、`copilot`、`anthropic`
|
|
84
83
|
|
|
85
84
|
| Profile | Primary / heavy | Small / verifier |
|
|
86
85
|
|---------|------------------|------------------|
|
|
87
|
-
| `opencode` |
|
|
88
|
-
| `openai` |
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
|
|
92
|
-
> 💡 `
|
|
93
|
-
>
|
|
86
|
+
| `opencode` | model:`opencode-go/gpt-6-luna#max`;heavy:`opencode-go/claude-haiku-5-5#max` | `opencode-go/deepseek-v4.1-flash#max` |
|
|
87
|
+
| `openai` | heavy:`openai/gpt-6.2-sol#medium`;model:`openai/gpt-6.2-sol#low` | `openai/gpt-6.1-terra#medium` |
|
|
88
|
+
| `copilot` | heavy:`github-copilot/gpt-6.1-sol#medium`;model:`github-copilot/claude-haiku-5.5#xhigh` | `github-copilot/gpt-6-luna#max` |
|
|
89
|
+
| `anthropic` | heavy:`anthropic/claude-sonnet-5-5#high`;default:`anthropic/claude-haiku-5-5#max` | `anthropic/claude-haiku-5-5#high` |
|
|
90
|
+
|
|
91
|
+
> 💡 `anthropic` profile 以 `#variant` 指定 effort(opencode 的 `provider/model#variant` 語法):
|
|
92
|
+
> heavy agents(SA / SD / reviewer / team-lead / architect)用 `sonnet-5-5#high`(最高);
|
|
93
|
+
> 其餘 implementation agents 預設 `haiku-5-5#max`(其次);verifier 與 title 用 `haiku-5-5#high`(最低)。
|
|
94
|
+
>
|
|
95
|
+
> 💡 `opencode` profile 全部使用 `max` effort:預設 implementation agents 用 `gpt-6-luna#max`;heavy agents(SA / SD / reviewer / team-lead / architect)用 `claude-haiku-5-5#max`;verifier 與 title 用 `deepseek-v4.1-flash#max`(最輕量)。
|
|
96
|
+
> `deepseek-v4.1-flash` 的 effort 可在 opencode 內用 `variant_cycle` 快捷鍵循環切換(low / high / max)。
|
|
97
|
+
>
|
|
98
|
+
> 💡 `openai` profile 以 `#variant` 指定 effort:heavy agents(SA / SD / reviewer / team-lead / architect)用 `gpt-6.2-sol#medium`(最高);
|
|
99
|
+
> 其餘 implementation agents 預設 `gpt-6.2-sol#low`(其次);verifier 與 title 用 `gpt-6.1-terra#medium`(最低)。
|
|
100
|
+
>
|
|
101
|
+
> 💡 `copilot` profile 以 `#variant` 指定 effort:heavy agents(SA / SD / reviewer / team-lead / architect)用 `gpt-6.1-sol#medium`(最高);
|
|
102
|
+
> 其餘 implementation agents 預設 `claude-haiku-5.5#xhigh`(其次);verifier 與 title 用 `gpt-6-luna#max`(最低)。
|
|
94
103
|
|
|
95
104
|
```bash
|
|
96
105
|
# 預設 profile(opencode)
|
|
@@ -99,15 +108,15 @@ moc
|
|
|
99
108
|
# 切到 OpenAI
|
|
100
109
|
moc openai
|
|
101
110
|
|
|
102
|
-
# 切到
|
|
103
|
-
moc
|
|
111
|
+
# 切到 Anthropic
|
|
112
|
+
moc anthropic
|
|
104
113
|
|
|
105
114
|
# 轉發額外參數
|
|
106
115
|
moc openai --list-agents
|
|
107
116
|
```
|
|
108
117
|
|
|
109
118
|
`moc` 會在目前工作目錄尋找 `.opencode/plugins/provider-profile.mjs` 與 `.opencode/opencode.json`。
|
|
110
|
-
對 `opencode` / `openai` / `
|
|
119
|
+
對 `opencode` / `openai` / `copilot` / `anthropic` 這四個 profile,會把產生出的 `OPENCODE_CONFIG_CONTENT` 快取到 `.opencode/cache/provider-profile/`;只要 profile、plugin mtime、config mtime 都沒變,就直接重用快取,不再重新跑 Node。若 plugin 缺失,則會警告並回退為 plain `opencode`。
|
|
111
120
|
|
|
112
121
|
若你直接用 repo 內的 `bin/moc`,仍會走既有 POSIX shell launcher;透過 npm 安裝、`npm link`、`npx` 取得的 `moc` 則會走跨平台的 `bin/moc.js`。
|
|
113
122
|
|
|
@@ -124,7 +133,7 @@ opencode
|
|
|
124
133
|
```json
|
|
125
134
|
{
|
|
126
135
|
"plugin": [
|
|
127
|
-
["plugins/provider-profile.mjs", { "profile": "
|
|
136
|
+
["./plugins/provider-profile.mjs", { "profile": "openai" }]
|
|
128
137
|
]
|
|
129
138
|
}
|
|
130
139
|
```
|
package/bin/cli.js
CHANGED
|
@@ -127,7 +127,7 @@ function cmdHelp() {
|
|
|
127
127
|
\x1b[1mLAUNCHER\x1b[0m
|
|
128
128
|
moc 預設使用 opencode profile 啟動 opencode
|
|
129
129
|
moc openai 使用 openai profile 啟動 opencode
|
|
130
|
-
moc
|
|
130
|
+
moc anthropic 使用 anthropic profile 啟動 opencode
|
|
131
131
|
moc --help 透明轉發到 opencode --help
|
|
132
132
|
|
|
133
133
|
\x1b[1mEXAMPLES\x1b[0m
|
package/bin/moc
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
|
|
3
3
|
profile=
|
|
4
|
-
known_profiles="opencode openai
|
|
4
|
+
known_profiles="opencode openai copilot anthropic"
|
|
5
5
|
|
|
6
6
|
print_help() {
|
|
7
7
|
cat <<'EOF'
|
|
@@ -12,14 +12,13 @@ Usage:
|
|
|
12
12
|
moc print-config [profile]
|
|
13
13
|
|
|
14
14
|
Profiles:
|
|
15
|
-
opencode | openai |
|
|
15
|
+
opencode | openai | copilot | anthropic
|
|
16
16
|
|
|
17
17
|
Examples:
|
|
18
18
|
moc
|
|
19
|
-
moc google
|
|
20
19
|
moc openai --list-agents
|
|
21
|
-
moc doctor
|
|
22
|
-
moc print-config
|
|
20
|
+
moc doctor anthropic
|
|
21
|
+
moc print-config anthropic
|
|
23
22
|
|
|
24
23
|
Notes:
|
|
25
24
|
- `moc` without extra args launches interactive opencode.
|
|
@@ -54,7 +53,7 @@ case "${1-}" in
|
|
|
54
53
|
print-config)
|
|
55
54
|
profile=${2-opencode}
|
|
56
55
|
;;
|
|
57
|
-
opencode|openai|
|
|
56
|
+
opencode|openai|copilot|anthropic)
|
|
58
57
|
profile=$1
|
|
59
58
|
shift
|
|
60
59
|
;;
|
|
@@ -65,7 +64,7 @@ if [ -z "$profile" ]; then
|
|
|
65
64
|
fi
|
|
66
65
|
|
|
67
66
|
case "$profile" in
|
|
68
|
-
opencode|openai|
|
|
67
|
+
opencode|openai|copilot|anthropic)
|
|
69
68
|
;;
|
|
70
69
|
*)
|
|
71
70
|
printf '%s\n' "moc: unknown profile '$profile'. Must be one of: $known_profiles" >&2
|
|
@@ -74,10 +73,19 @@ case "$profile" in
|
|
|
74
73
|
esac
|
|
75
74
|
|
|
76
75
|
exec_opencode_with_profile() {
|
|
76
|
+
# Profile launches always use a private server (--standalone). A background
|
|
77
|
+
# service started without this profile env would otherwise ignore it.
|
|
78
|
+
standalone_flag=--standalone
|
|
79
|
+
for arg in "$@"; do
|
|
80
|
+
if [ "$arg" = "--standalone" ]; then
|
|
81
|
+
standalone_flag=
|
|
82
|
+
fi
|
|
83
|
+
done
|
|
84
|
+
|
|
77
85
|
exec env \
|
|
78
86
|
OPENCODE_PROVIDER_PROFILE="$profile" \
|
|
79
87
|
OPENCODE_CONFIG_CONTENT="$config_content" \
|
|
80
|
-
opencode "$@"
|
|
88
|
+
opencode ${standalone_flag:+"$standalone_flag"} "$@"
|
|
81
89
|
}
|
|
82
90
|
|
|
83
91
|
plugin_path=.opencode/plugins/provider-profile.mjs
|
package/bin/moc.js
CHANGED
|
@@ -5,8 +5,8 @@ import fs from 'node:fs';
|
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { spawn, spawnSync } from 'node:child_process';
|
|
7
7
|
|
|
8
|
-
const knownProfiles = new Set(['opencode', 'openai', '
|
|
9
|
-
const knownProfilesText = 'opencode openai
|
|
8
|
+
const knownProfiles = new Set(['opencode', 'openai', 'copilot', 'anthropic']);
|
|
9
|
+
const knownProfilesText = 'opencode openai copilot anthropic';
|
|
10
10
|
const signalExitCodes = {
|
|
11
11
|
SIGHUP: 1,
|
|
12
12
|
SIGINT: 2,
|
|
@@ -341,7 +341,13 @@ function main() {
|
|
|
341
341
|
process.exit(0);
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
|
|
344
|
+
// Profile launches always use a private server (--standalone). A background
|
|
345
|
+
// service started without this profile env would otherwise ignore it.
|
|
346
|
+
const launchArgs = forwardedArgs.includes('--standalone')
|
|
347
|
+
? forwardedArgs
|
|
348
|
+
: ['--standalone', ...forwardedArgs];
|
|
349
|
+
|
|
350
|
+
spawnOpencode(launchArgs, {
|
|
345
351
|
OPENCODE_PROVIDER_PROFILE: profile,
|
|
346
352
|
OPENCODE_CONFIG_CONTENT: configContent,
|
|
347
353
|
});
|
package/opencode.json
CHANGED
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://opencode.ai/config.json",
|
|
3
|
-
"model": "opencode-go/deepseek-v4-
|
|
3
|
+
"model": "opencode-go/deepseek-v4.1-flash",
|
|
4
4
|
"small_model": "opencode-go/deepseek-v4-flash",
|
|
5
|
+
"provider": {
|
|
6
|
+
"opencode-go": {
|
|
7
|
+
"models": {
|
|
8
|
+
"deepseek-v4.1-flash": {
|
|
9
|
+
"options": {
|
|
10
|
+
"reasoningEffort": "max"
|
|
11
|
+
},
|
|
12
|
+
"variants": {
|
|
13
|
+
"low": {
|
|
14
|
+
"reasoningEffort": "low"
|
|
15
|
+
},
|
|
16
|
+
"high": {
|
|
17
|
+
"reasoningEffort": "high"
|
|
18
|
+
},
|
|
19
|
+
"max": {
|
|
20
|
+
"reasoningEffort": "max"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
5
27
|
"default_agent": "team-lead",
|
|
6
28
|
"instructions": [
|
|
7
29
|
"skills/adr/SKILL.md",
|
|
@@ -13,7 +35,7 @@
|
|
|
13
35
|
"skills/design-evidence/SKILL.md"
|
|
14
36
|
],
|
|
15
37
|
"plugin": [
|
|
16
|
-
"plugins/provider-profile.mjs"
|
|
38
|
+
"./plugins/provider-profile.mjs"
|
|
17
39
|
],
|
|
18
40
|
"agent": {
|
|
19
41
|
"team-lead": {
|
|
@@ -33,7 +55,7 @@
|
|
|
33
55
|
"design-evidence": {
|
|
34
56
|
"description": "Extract source-backed Design Evidence Packs from Figma, screenshots, wireframes, and prototypes.",
|
|
35
57
|
"mode": "subagent",
|
|
36
|
-
"model": "opencode-go/deepseek-v4-
|
|
58
|
+
"model": "opencode-go/deepseek-v4.1-flash",
|
|
37
59
|
"prompt": "{file:agents/design-evidence.md}",
|
|
38
60
|
"tools": {
|
|
39
61
|
"read": true,
|
|
@@ -45,7 +67,7 @@
|
|
|
45
67
|
"business-analyst": {
|
|
46
68
|
"description": "SA role: translate evidence into business requirements, rules, states, data meaning, and acceptance intent.",
|
|
47
69
|
"mode": "subagent",
|
|
48
|
-
"model": "opencode-go/deepseek-v4-
|
|
70
|
+
"model": "opencode-go/deepseek-v4.1-flash",
|
|
49
71
|
"prompt": "{file:agents/business-analyst.md}",
|
|
50
72
|
"tools": {
|
|
51
73
|
"read": true,
|
|
@@ -57,7 +79,7 @@
|
|
|
57
79
|
"system-designer": {
|
|
58
80
|
"description": "SD role: translate business requirements into technical, API, data, security, and operational contracts.",
|
|
59
81
|
"mode": "subagent",
|
|
60
|
-
"model": "opencode-go/deepseek-v4-
|
|
82
|
+
"model": "opencode-go/deepseek-v4.1-flash",
|
|
61
83
|
"prompt": "{file:agents/system-designer.md}",
|
|
62
84
|
"tools": {
|
|
63
85
|
"read": true,
|
|
@@ -103,7 +125,7 @@
|
|
|
103
125
|
"code-reviewer": {
|
|
104
126
|
"description": "Systematic code review across correctness, security, quality, testing, and style dimensions.",
|
|
105
127
|
"mode": "subagent",
|
|
106
|
-
"model": "opencode-go/deepseek-v4-
|
|
128
|
+
"model": "opencode-go/deepseek-v4.1-flash",
|
|
107
129
|
"prompt": "{file:agents/code-reviewer.md}",
|
|
108
130
|
"tools": {
|
|
109
131
|
"read": true,
|
|
@@ -137,7 +159,7 @@
|
|
|
137
159
|
"architect": {
|
|
138
160
|
"description": "Capture architecture decisions as ADR documents. Analyzes tradeoffs and records context.",
|
|
139
161
|
"mode": "subagent",
|
|
140
|
-
"model": "opencode-go/deepseek-v4-
|
|
162
|
+
"model": "opencode-go/deepseek-v4.1-flash",
|
|
141
163
|
"prompt": "{file:agents/architect.md}",
|
|
142
164
|
"tools": {
|
|
143
165
|
"read": true,
|
package/package.json
CHANGED
package/plugins/README.md
CHANGED
|
@@ -9,19 +9,26 @@ opencode plugin 是透過 `opencode.json` 的 `plugin` 區塊註冊的 npm 或
|
|
|
9
9
|
零依賴 ESM plugin / resolver,用來切換本 repo 的模型 profile。
|
|
10
10
|
|
|
11
11
|
- 預設 profile:`opencode`
|
|
12
|
-
- 支援:`opencode`、`openai`、`
|
|
12
|
+
- 支援:`opencode`、`openai`、`copilot`、`anthropic`
|
|
13
13
|
- 讀取:`OPENCODE_PROVIDER_PROFILE`
|
|
14
|
-
- 可透過 plugin tuple options 覆寫:`["plugins/provider-profile.mjs", { "profile": "
|
|
14
|
+
- 可透過 plugin tuple options 覆寫:`["./plugins/provider-profile.mjs", { "profile": "openai" }]`
|
|
15
15
|
|
|
16
16
|
| Profile | Primary / heavy | Small / verifier |
|
|
17
17
|
|---------|------------------|------------------|
|
|
18
|
-
| `opencode` |
|
|
19
|
-
| `openai` |
|
|
20
|
-
| `
|
|
21
|
-
| `
|
|
18
|
+
| `opencode` | model:`opencode-go/gpt-6-luna#max`;heavy:`opencode-go/claude-haiku-5-5#max` | `opencode-go/deepseek-v4.1-flash#max` |
|
|
19
|
+
| `openai` | heavy:`openai/gpt-6.2-sol#medium`;model:`openai/gpt-6.2-sol#low` | `openai/gpt-6.1-terra#medium` |
|
|
20
|
+
| `copilot` | heavy:`github-copilot/gpt-6.1-sol#medium`;model:`github-copilot/claude-haiku-5.5#xhigh` | `github-copilot/gpt-6-luna#max` |
|
|
21
|
+
| `anthropic` | heavy:`anthropic/claude-sonnet-5-5#high`;default:`anthropic/claude-haiku-5-5#max` | `anthropic/claude-haiku-5-5#high` |
|
|
22
22
|
|
|
23
|
-
> 💡 `
|
|
24
|
-
>
|
|
23
|
+
> 💡 `anthropic` profile 的 `#<variant>` 後綴為 opencode 的 effort 指定語法(`provider/model#variant`),
|
|
24
|
+
> 同一顆 haiku 可依 agent 使用不同 effort。variant 由 opencode 內建 model catalog 提供,因此此 profile 不產生 `provider` 覆寫區塊。
|
|
25
|
+
|
|
26
|
+
> 💡 `opencode` profile 全部使用 `max` effort(variant 皆由 opencode 內建 catalog 提供):model 用 `gpt-6-luna#max`,heavy 用 `claude-haiku-5-5#max`,small 用 `deepseek-v4.1-flash#max`。
|
|
27
|
+
> `deepseek-v4.1-flash` 另有 low / high / max 可在 opencode 內用 `variant_cycle` 快捷鍵循環切換。
|
|
28
|
+
>
|
|
29
|
+
> 💡 `openai` profile 以 `#variant` 指定 effort(heavy `gpt-6.2-sol#medium`、model `gpt-6.2-sol#low`、small `gpt-6.1-terra#medium`;variant 由 opencode 內建 catalog 提供)。
|
|
30
|
+
|
|
31
|
+
> 💡 `copilot` profile 以 `#variant` 指定 effort(heavy `gpt-6.1-sol#medium`、model `claude-haiku-5.5#xhigh`、small `gpt-6-luna#max`;variant 由 opencode 內建 catalog 提供)。
|
|
25
32
|
|
|
26
33
|
### 用法
|
|
27
34
|
|
|
@@ -30,7 +37,7 @@ opencode plugin 是透過 `opencode.json` 的 `plugin` 區塊註冊的 npm 或
|
|
|
30
37
|
```bash
|
|
31
38
|
moc
|
|
32
39
|
moc openai
|
|
33
|
-
moc
|
|
40
|
+
moc anthropic --list-agents
|
|
34
41
|
```
|
|
35
42
|
|
|
36
43
|
`moc` 會對四個已知 profile 快取 provider-profile 產生出的 JSON override,位置在 `.opencode/cache/provider-profile/`。快取是否有效由以下條件決定:
|
|
@@ -7,37 +7,59 @@ const __dirname = path.dirname(__filename);
|
|
|
7
7
|
const CONFIG_PATH = path.resolve(__dirname, "..", "opencode.json");
|
|
8
8
|
|
|
9
9
|
const PROFILE_MAP = Object.freeze({
|
|
10
|
+
// opencode-go(全部 max effort):
|
|
11
|
+
// model (預設 implementation agents) → gpt-6-luna max
|
|
12
|
+
// heavy (SA/SD/reviewer/team-lead/architect) → claude-haiku-5-5 max
|
|
13
|
+
// small (verifier / title) → deepseek-v4.1-flash max
|
|
10
14
|
opencode: Object.freeze({
|
|
11
|
-
model: "opencode-go/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
small_model: "openai/gpt-5.6-luna",
|
|
18
|
-
heavy_model: "openai/gpt-5.6",
|
|
15
|
+
model: "opencode-go/gpt-6-luna",
|
|
16
|
+
model_variant: "max",
|
|
17
|
+
small_model: "opencode-go/deepseek-v4.1-flash",
|
|
18
|
+
small_variant: "max",
|
|
19
|
+
heavy_model: "opencode-go/claude-haiku-5-5",
|
|
20
|
+
heavy_variant: "max",
|
|
19
21
|
reasoning: Object.freeze({
|
|
20
|
-
"
|
|
21
|
-
default_effort: "
|
|
22
|
-
efforts: ["
|
|
22
|
+
"opencode-go/deepseek-v4.1-flash": Object.freeze({
|
|
23
|
+
default_effort: "max",
|
|
24
|
+
efforts: ["low", "high", "max"],
|
|
23
25
|
}),
|
|
24
26
|
}),
|
|
25
27
|
}),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
// OpenAI 系列:effort 透過 `provider/model#variant` 指定(opencode 內建 variant,不需 provider 覆寫)。
|
|
29
|
+
// heavy (SA/SD/reviewer/team-lead/architect) → gpt-6.2-sol medium (最高)
|
|
30
|
+
// model (預設 implementation agents) → gpt-6.2-sol low (其次)
|
|
31
|
+
// small (verifier / title) → gpt-6.1-terra medium(最低)
|
|
32
|
+
openai: Object.freeze({
|
|
33
|
+
model: "openai/gpt-6.2-sol",
|
|
34
|
+
model_variant: "low",
|
|
35
|
+
small_model: "openai/gpt-6.1-terra",
|
|
36
|
+
small_variant: "medium",
|
|
37
|
+
heavy_model: "openai/gpt-6.2-sol",
|
|
38
|
+
heavy_variant: "medium",
|
|
30
39
|
}),
|
|
40
|
+
// GitHub Copilot:effort 透過 `provider/model#variant` 指定(opencode 內建 variant,不需 provider 覆寫)。
|
|
41
|
+
// heavy (SA/SD/reviewer/team-lead/architect) → gpt-6.1-sol medium (最高)
|
|
42
|
+
// model (預設 implementation agents) → claude-haiku-5.5 xhigh(其次)
|
|
43
|
+
// small (verifier / title) → gpt-6-luna max (最低)
|
|
31
44
|
copilot: Object.freeze({
|
|
32
|
-
model: "github-copilot/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
model: "github-copilot/claude-haiku-5.5",
|
|
46
|
+
model_variant: "xhigh",
|
|
47
|
+
small_model: "github-copilot/gpt-6-luna",
|
|
48
|
+
small_variant: "max",
|
|
49
|
+
heavy_model: "github-copilot/gpt-6.1-sol",
|
|
50
|
+
heavy_variant: "medium",
|
|
51
|
+
}),
|
|
52
|
+
// Anthropic 系列:effort 透過 `provider/model#variant` 指定(opencode 內建 variant,不需 provider 覆寫)。
|
|
53
|
+
// heavy (SA/SD/reviewer/team-lead/architect) → sonnet-5-5 high (最高)
|
|
54
|
+
// model (預設 implementation agents) → haiku-5-5 max (其次)
|
|
55
|
+
// small (verifier / title) → haiku-5-5 high (最低)
|
|
56
|
+
anthropic: Object.freeze({
|
|
57
|
+
model: "anthropic/claude-haiku-5-5",
|
|
58
|
+
model_variant: "max",
|
|
59
|
+
small_model: "anthropic/claude-haiku-5-5",
|
|
60
|
+
small_variant: "high",
|
|
61
|
+
heavy_model: "anthropic/claude-sonnet-5-5",
|
|
62
|
+
heavy_variant: "high",
|
|
41
63
|
}),
|
|
42
64
|
});
|
|
43
65
|
|
|
@@ -74,21 +96,33 @@ function pickProfile(options = {}) {
|
|
|
74
96
|
return activeProfile;
|
|
75
97
|
}
|
|
76
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Append an optional reasoning variant to a model ref using opencode's
|
|
101
|
+
* `provider/model#variant` syntax (e.g. `anthropic/claude-haiku-5-5#max`).
|
|
102
|
+
*/
|
|
103
|
+
function withVariant(modelRef, variant) {
|
|
104
|
+
return variant ? `${modelRef}#${variant}` : modelRef;
|
|
105
|
+
}
|
|
106
|
+
|
|
77
107
|
export default function resolveProfile(options = {}) {
|
|
78
108
|
const activeProfile = pickProfile(options);
|
|
79
109
|
const profile = PROFILE_MAP[activeProfile];
|
|
80
110
|
|
|
111
|
+
const model = withVariant(profile.model, profile.model_variant);
|
|
112
|
+
const smallModel = withVariant(profile.small_model, profile.small_variant);
|
|
113
|
+
const heavyModel = withVariant(profile.heavy_model, profile.heavy_variant);
|
|
114
|
+
|
|
81
115
|
return {
|
|
82
|
-
model
|
|
83
|
-
small_model:
|
|
116
|
+
model,
|
|
117
|
+
small_model: smallModel,
|
|
84
118
|
agent_overrides: {
|
|
85
|
-
"design-evidence":
|
|
86
|
-
"business-analyst":
|
|
87
|
-
"system-designer":
|
|
88
|
-
verifier:
|
|
89
|
-
"code-reviewer":
|
|
90
|
-
"team-lead":
|
|
91
|
-
architect:
|
|
119
|
+
"design-evidence": heavyModel,
|
|
120
|
+
"business-analyst": heavyModel,
|
|
121
|
+
"system-designer": heavyModel,
|
|
122
|
+
verifier: smallModel,
|
|
123
|
+
"code-reviewer": heavyModel,
|
|
124
|
+
"team-lead": heavyModel,
|
|
125
|
+
architect: heavyModel,
|
|
92
126
|
},
|
|
93
127
|
};
|
|
94
128
|
}
|
|
@@ -111,7 +145,8 @@ export function buildProfileConfig(options = {}) {
|
|
|
111
145
|
|
|
112
146
|
/**
|
|
113
147
|
* Build the `provider` config fragment for models that need reasoning-effort
|
|
114
|
-
* variants (e.g. gpt-5.6-luna with high/medium/low effort switching
|
|
148
|
+
* variants (e.g. gpt-5.6-luna with high/medium/low effort switching, or
|
|
149
|
+
* deepseek-v4.1-flash with low/high/max effort switching).
|
|
115
150
|
*
|
|
116
151
|
* Output shape (merged into opencode config via OPENCODE_CONFIG_CONTENT):
|
|
117
152
|
* provider.openai.models["gpt-5.6-luna"] = {
|
|
@@ -74,16 +74,16 @@ for (const term of ["Business Requirements", "Technical Design", "frontend-contr
|
|
|
74
74
|
|
|
75
75
|
const plugin = spawnSync(process.execPath, [path.join(root, "plugins/provider-profile.mjs")], {
|
|
76
76
|
cwd: root,
|
|
77
|
-
env: { ...process.env, OPENCODE_PROVIDER_PROFILE: "
|
|
77
|
+
env: { ...process.env, OPENCODE_PROVIDER_PROFILE: "openai" },
|
|
78
78
|
encoding: "utf8",
|
|
79
79
|
});
|
|
80
80
|
expect(plugin.status === 0, "provider profile plugin failed to execute");
|
|
81
81
|
if (plugin.status === 0) {
|
|
82
82
|
const output = JSON.parse(plugin.stdout);
|
|
83
83
|
for (const agent of ["design-evidence", "business-analyst", "system-designer", "code-reviewer", "team-lead", "architect"]) {
|
|
84
|
-
expect(output.agent?.[agent]?.model === "
|
|
84
|
+
expect(output.agent?.[agent]?.model === "openai/gpt-6.2-sol#medium", `openai heavy model missing for ${agent}`);
|
|
85
85
|
}
|
|
86
|
-
expect(output.agent?.verifier?.model === "
|
|
86
|
+
expect(output.agent?.verifier?.model === "openai/gpt-6.1-terra#medium", "openai verifier model mismatch");
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
if (process.exitCode) process.exit(process.exitCode);
|