@openclaw/opencode-provider 2026.8.1-beta.3 → 2026.8.2
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/dist/index.js +7 -624
- package/dist/provider-catalog-Dq-y_lMN.js +386 -0
- package/dist/provider-catalog.js +2 -1218
- package/dist/provider-discovery.js +1 -1
- package/dist/provider-policy-api.js +1 -1
- package/dist/session-catalog-plugin.js +3 -3
- package/dist/session-catalog.js +5 -3
- package/dist/session-upstream-activity.js +21 -27
- package/openclaw.plugin.json +47 -503
- package/package.json +4 -4
- package/dist/doctor-contract-api.js +0 -170
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/opencode-provider",
|
|
3
|
-
"version": "2026.8.
|
|
3
|
+
"version": "2026.8.2",
|
|
4
4
|
"description": "OpenClaw OpenCode Zen provider plugin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"minHostVersion": ">=2026.7.2"
|
|
19
19
|
},
|
|
20
20
|
"compat": {
|
|
21
|
-
"pluginApi": ">=2026.8.
|
|
21
|
+
"pluginApi": ">=2026.8.2"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.8.
|
|
24
|
+
"openclawVersion": "2026.8.2",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"README.md"
|
|
39
39
|
],
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"openclaw": ">=2026.8.
|
|
41
|
+
"openclaw": ">=2026.8.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"openclaw": {
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { normalizeProviderId, parseModelRef } from "openclaw/plugin-sdk/model-ref-parse";
|
|
2
|
-
import { asObjectRecord } from "openclaw/plugin-sdk/runtime-doctor-migrations";
|
|
3
|
-
//#region extensions/opencode/doctor-contract-api.ts
|
|
4
|
-
const RETIRED_MODEL = "hy3-free";
|
|
5
|
-
const REPLACEMENT_MODEL = "laguna-s-2.1-free";
|
|
6
|
-
const REPLACEMENT_REF = `opencode/${REPLACEMENT_MODEL}`;
|
|
7
|
-
const AGENT_MODEL_KEYS = [
|
|
8
|
-
"model",
|
|
9
|
-
"utilityModel",
|
|
10
|
-
"imageModel",
|
|
11
|
-
"voiceModel",
|
|
12
|
-
"pdfModel"
|
|
13
|
-
];
|
|
14
|
-
function replacementFor(value) {
|
|
15
|
-
if (typeof value !== "string") return;
|
|
16
|
-
const trimmed = value.trim();
|
|
17
|
-
const slash = trimmed.indexOf("/");
|
|
18
|
-
const suffixAt = trimmed.indexOf("@", slash + 1);
|
|
19
|
-
const suffix = suffixAt >= 0 ? trimmed.slice(suffixAt) : "";
|
|
20
|
-
if (suffix === "@" || suffix.includes("/")) return;
|
|
21
|
-
const parsed = parseModelRef(suffixAt >= 0 ? trimmed.slice(0, suffixAt) : trimmed, "");
|
|
22
|
-
if (parsed?.provider.toLowerCase() !== "opencode" || parsed.model.toLowerCase() !== RETIRED_MODEL) return;
|
|
23
|
-
return `${REPLACEMENT_REF}${suffix}`;
|
|
24
|
-
}
|
|
25
|
-
function rewriteString(owner, key, path, changes) {
|
|
26
|
-
if (!owner) return;
|
|
27
|
-
const replacement = replacementFor(owner[key]);
|
|
28
|
-
if (!replacement) return;
|
|
29
|
-
owner[key] = replacement;
|
|
30
|
-
changes.push(`Updated ${path} from the retired OpenCode Zen model to ${REPLACEMENT_REF}.`);
|
|
31
|
-
}
|
|
32
|
-
function rewriteSelector(owner, key, path, changes) {
|
|
33
|
-
if (!owner) return;
|
|
34
|
-
if (typeof owner[key] === "string") {
|
|
35
|
-
rewriteString(owner, key, path, changes);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const selector = asObjectRecord(owner[key]);
|
|
39
|
-
if (!selector) return;
|
|
40
|
-
rewriteString(selector, "primary", `${path}.primary`, changes);
|
|
41
|
-
if (!Array.isArray(selector.fallbacks)) return;
|
|
42
|
-
rewriteStringList(selector.fallbacks, `${path}.fallbacks`, changes);
|
|
43
|
-
}
|
|
44
|
-
function rewriteStringList(values, path, changes) {
|
|
45
|
-
for (const [index, value] of values.entries()) {
|
|
46
|
-
const replacement = replacementFor(value);
|
|
47
|
-
if (!replacement) continue;
|
|
48
|
-
values[index] = replacement;
|
|
49
|
-
changes.push(`Updated ${path}.${index} from the retired OpenCode Zen model to ${REPLACEMENT_REF}.`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function rewriteModelMap(agent, path, changes) {
|
|
53
|
-
const models = asObjectRecord(agent.models);
|
|
54
|
-
if (!models) return;
|
|
55
|
-
for (const [modelRef, config] of Object.entries(models)) {
|
|
56
|
-
const replacement = replacementFor(modelRef);
|
|
57
|
-
if (!replacement) continue;
|
|
58
|
-
if (!Object.hasOwn(models, replacement)) models[replacement] = config;
|
|
59
|
-
delete models[modelRef];
|
|
60
|
-
changes.push(`Updated a retired OpenCode Zen model key in ${path} to ${REPLACEMENT_REF}.`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function rewriteExecReviewer(owner, path, changes) {
|
|
64
|
-
rewriteSelector(asObjectRecord(asObjectRecord(asObjectRecord(owner.tools)?.exec)?.reviewer), "model", path, changes);
|
|
65
|
-
}
|
|
66
|
-
function rewriteDiscordVoice(value, path, changes) {
|
|
67
|
-
const voice = asObjectRecord(value);
|
|
68
|
-
rewriteString(voice, "model", `${path}.model`, changes);
|
|
69
|
-
rewriteString(asObjectRecord(voice?.tts), "summaryModel", `${path}.tts.summaryModel`, changes);
|
|
70
|
-
}
|
|
71
|
-
function rewriteStructuredMediaModels(root, changes) {
|
|
72
|
-
const models = asObjectRecord(asObjectRecord(root.tools)?.media)?.models;
|
|
73
|
-
if (!Array.isArray(models)) return;
|
|
74
|
-
for (const [index, value] of models.entries()) {
|
|
75
|
-
const entry = asObjectRecord(value);
|
|
76
|
-
if (!entry || entry.type === "cli" || typeof entry.command === "string" && entry.command.trim() || typeof entry.provider !== "string" || normalizeProviderId(entry.provider) !== "opencode" || typeof entry.model !== "string" || entry.model.trim().toLowerCase() !== RETIRED_MODEL) continue;
|
|
77
|
-
entry.provider = "opencode";
|
|
78
|
-
entry.model = REPLACEMENT_MODEL;
|
|
79
|
-
changes.push(`Updated tools.media.models.${index} to the current OpenCode Zen model.`);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function rewriteAgent(value, path, changes, includeEntrySelectors = false) {
|
|
83
|
-
const agent = asObjectRecord(value);
|
|
84
|
-
if (!agent) return;
|
|
85
|
-
for (const key of AGENT_MODEL_KEYS) rewriteSelector(agent, key, `${path}.${key}`, changes);
|
|
86
|
-
const mediaModels = asObjectRecord(agent.mediaModels);
|
|
87
|
-
for (const capability of [
|
|
88
|
-
"image",
|
|
89
|
-
"video",
|
|
90
|
-
"music"
|
|
91
|
-
]) rewriteSelector(mediaModels, capability, `${path}.mediaModels.${capability}`, changes);
|
|
92
|
-
rewriteString(asObjectRecord(agent.heartbeat), "model", `${path}.heartbeat.model`, changes);
|
|
93
|
-
rewriteSelector(asObjectRecord(agent.subagents), "model", `${path}.subagents.model`, changes);
|
|
94
|
-
const compaction = asObjectRecord(agent.compaction);
|
|
95
|
-
rewriteString(compaction, "model", `${path}.compaction.model`, changes);
|
|
96
|
-
rewriteString(asObjectRecord(compaction?.memoryFlush), "model", `${path}.compaction.memoryFlush.model`, changes);
|
|
97
|
-
rewriteModelMap(agent, `${path}.models`, changes);
|
|
98
|
-
const allow = asObjectRecord(agent.modelPolicy)?.allow;
|
|
99
|
-
if (Array.isArray(allow)) rewriteStringList(allow, `${path}.modelPolicy.allow`, changes);
|
|
100
|
-
if (includeEntrySelectors) {
|
|
101
|
-
rewriteExecReviewer(agent, `${path}.tools.exec.reviewer.model`, changes);
|
|
102
|
-
rewriteString(asObjectRecord(agent.tts), "summaryModel", `${path}.tts.summaryModel`, changes);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
function rewriteNonAgentRefs(root, changes) {
|
|
106
|
-
rewriteExecReviewer(root, "tools.exec.reviewer.model", changes);
|
|
107
|
-
rewriteStructuredMediaModels(root, changes);
|
|
108
|
-
const media = asObjectRecord(asObjectRecord(root.tools)?.media);
|
|
109
|
-
for (const capability of [
|
|
110
|
-
"image",
|
|
111
|
-
"audio",
|
|
112
|
-
"video"
|
|
113
|
-
]) rewriteString(asObjectRecord(media?.[capability]), "preferredModel", `tools.media.${capability}.preferredModel`, changes);
|
|
114
|
-
const channels = asObjectRecord(root.channels);
|
|
115
|
-
const modelByChannel = asObjectRecord(channels?.modelByChannel);
|
|
116
|
-
if (modelByChannel) for (const [channelId, targetsValue] of Object.entries(modelByChannel)) {
|
|
117
|
-
const targets = asObjectRecord(targetsValue);
|
|
118
|
-
if (!targets) continue;
|
|
119
|
-
for (const targetId of Object.keys(targets)) rewriteString(targets, targetId, `channels.modelByChannel.${channelId}.${targetId}`, changes);
|
|
120
|
-
}
|
|
121
|
-
const discord = asObjectRecord(channels?.discord);
|
|
122
|
-
rewriteDiscordVoice(discord?.voice, "channels.discord.voice", changes);
|
|
123
|
-
const accounts = asObjectRecord(discord?.accounts);
|
|
124
|
-
if (accounts) for (const [accountId, account] of Object.entries(accounts)) rewriteDiscordVoice(asObjectRecord(account)?.voice, `channels.discord.accounts.${accountId}.voice`, changes);
|
|
125
|
-
const hooks = asObjectRecord(root.hooks);
|
|
126
|
-
if (Array.isArray(hooks?.mappings)) for (const [index, mapping] of hooks.mappings.entries()) rewriteString(asObjectRecord(mapping), "model", `hooks.mappings.${index}.model`, changes);
|
|
127
|
-
rewriteString(asObjectRecord(hooks?.gmail), "model", "hooks.gmail.model", changes);
|
|
128
|
-
rewriteString(asObjectRecord(root.tts), "summaryModel", "tts.summaryModel", changes);
|
|
129
|
-
}
|
|
130
|
-
function removeRetiredCatalogRows(root, changes) {
|
|
131
|
-
const provider = asObjectRecord(asObjectRecord(asObjectRecord(root.models)?.providers)?.opencode);
|
|
132
|
-
if (!provider || !Array.isArray(provider.models)) return;
|
|
133
|
-
const retained = provider.models.filter((row) => {
|
|
134
|
-
const id = asObjectRecord(row)?.id;
|
|
135
|
-
return typeof id !== "string" || id.trim().toLowerCase() !== RETIRED_MODEL;
|
|
136
|
-
});
|
|
137
|
-
const removed = provider.models.length - retained.length;
|
|
138
|
-
if (removed > 0) {
|
|
139
|
-
provider.models = retained;
|
|
140
|
-
changes.push(`Removed ${removed} retired OpenCode Zen model row(s) from models.providers.opencode.models.`);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function normalizeCompatibilityConfig({ cfg }) {
|
|
144
|
-
const next = structuredClone(cfg);
|
|
145
|
-
const root = asObjectRecord(next);
|
|
146
|
-
if (!root) return {
|
|
147
|
-
config: cfg,
|
|
148
|
-
changes: []
|
|
149
|
-
};
|
|
150
|
-
const changes = [];
|
|
151
|
-
const agents = asObjectRecord(root.agents);
|
|
152
|
-
if (agents) {
|
|
153
|
-
rewriteAgent(agents.defaults, "agents.defaults", changes);
|
|
154
|
-
if (Object.hasOwn(agents, "entries")) {
|
|
155
|
-
const entries = asObjectRecord(agents.entries);
|
|
156
|
-
if (entries) for (const [agentId, entry] of Object.entries(entries)) rewriteAgent(entry, `agents.entries.${agentId}`, changes, true);
|
|
157
|
-
} else if (Array.isArray(agents.list)) for (const [index, entry] of agents.list.entries()) rewriteAgent(entry, `agents.list.${index}`, changes, true);
|
|
158
|
-
}
|
|
159
|
-
rewriteNonAgentRefs(root, changes);
|
|
160
|
-
removeRetiredCatalogRows(root, changes);
|
|
161
|
-
return changes.length > 0 ? {
|
|
162
|
-
config: next,
|
|
163
|
-
changes
|
|
164
|
-
} : {
|
|
165
|
-
config: cfg,
|
|
166
|
-
changes
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
//#endregion
|
|
170
|
-
export { normalizeCompatibilityConfig };
|