@openclaw/opencode-provider 2026.11.10-beta.1 → 2026.11.10-beta.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/.setup/{provider-catalog-_k2e5jtl.mjs → provider-catalog-7CVtc4r7.mjs} +13 -1
- package/dist/.source-module-urls/4fab01fc8357cc34b51f840d7cd1389006ecebd15090942a6f672f57cc041ac8.json +1 -0
- package/dist/console-oauth.js +167 -0
- package/dist/index.js +55 -2
- package/dist/provider-catalog.js +1 -1
- package/dist/provider-discovery.js +1 -1
- package/openclaw.plugin.json +14 -1
- package/package.json +4 -4
- package/dist/.source-module-urls/3b7df88655ff2787ef518d120c60d4afd18bf7cf481b07e16d0733705e9918e3.json +0 -1
|
@@ -217,6 +217,18 @@ var openclaw_plugin_default = {
|
|
|
217
217
|
"envVars": ["OPENCODE_API_KEY", "OPENCODE_ZEN_API_KEY"]
|
|
218
218
|
}] },
|
|
219
219
|
providerAuthChoices: [{
|
|
220
|
+
"provider": "opencode",
|
|
221
|
+
"method": "oauth",
|
|
222
|
+
"choiceId": "opencode-console",
|
|
223
|
+
"appGuidedAuth": "oauth",
|
|
224
|
+
"credentialOnly": true,
|
|
225
|
+
"channelLogin": {},
|
|
226
|
+
"choiceLabel": "OpenCode Console (browser sign-in)",
|
|
227
|
+
"choiceHint": "Sign in in your browser and pick an OpenCode Console workspace",
|
|
228
|
+
"groupId": "opencode",
|
|
229
|
+
"groupLabel": "OpenCode",
|
|
230
|
+
"groupHint": "Browser sign-in or shared Zen + Go API key"
|
|
231
|
+
}, {
|
|
220
232
|
"provider": "opencode",
|
|
221
233
|
"method": "api-key",
|
|
222
234
|
"choiceId": "opencode-zen",
|
|
@@ -224,7 +236,7 @@ var openclaw_plugin_default = {
|
|
|
224
236
|
"choiceLabel": "OpenCode Zen catalog",
|
|
225
237
|
"groupId": "opencode",
|
|
226
238
|
"groupLabel": "OpenCode",
|
|
227
|
-
"groupHint": "
|
|
239
|
+
"groupHint": "Browser sign-in or shared Zen + Go API key",
|
|
228
240
|
"optionKey": "opencodeZenApiKey",
|
|
229
241
|
"cliFlag": "--opencode-zen-api-key",
|
|
230
242
|
"cliOption": "--opencode-zen-api-key <key>",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"entries":[{"output":"console-oauth.js","source":"extensions/opencode/console-oauth.ts"},{"output":"index.js","source":"extensions/opencode/index.ts"},{"output":"onboard.js","source":"extensions/opencode/onboard.ts"},{"output":"provider-catalog.js","source":"extensions/opencode/provider-catalog.ts"},{"output":"provider-discovery.js","source":"extensions/opencode/provider-discovery.ts"},{"output":"provider-policy-api.js","source":"extensions/opencode/provider-policy-api.ts"},{"output":"session-catalog-plugin.js","source":"extensions/opencode/session-catalog-plugin.ts"},{"output":"session-catalog-shared.js","source":"extensions/opencode/session-catalog-shared.ts"},{"output":"session-catalog.js","source":"extensions/opencode/session-catalog.ts"},{"output":"session-upstream-activity.js","source":"extensions/opencode/session-upstream-activity.ts"},{"output":"stream.js","source":"extensions/opencode/stream.ts"}],"chunks":[{"output":".setup/provider-catalog-7CVtc4r7.mjs","sha256":"f44aab49364f1f9dd5cf6909baa9c8c19e36f3681747889a63d493a447b6c812","facadeSource":null,"sources":["extensions/opencode/openclaw.plugin.json","extensions/opencode/provider-catalog.ts"]},{"output":"console-oauth.js","sha256":"dae23934e471aadf6d1a1da8fad96e79cf12c7c5d11538a2f1af6149b23fe636","facadeSource":"extensions/opencode/console-oauth.ts","sources":["extensions/opencode/console-oauth.ts"]},{"output":"index.js","sha256":"866d98cf686770fd164e5f208c6ddbbed328a43f9bb3ead137ecfd8f0f1d7c71","facadeSource":"extensions/opencode/index.ts","sources":["extensions/opencode/index.ts"]},{"output":"onboard.js","sha256":"3bfe04c0dce12f07a8cd592db1d5221ab9261c4856ea19cca83b54299c90ff97","facadeSource":"extensions/opencode/onboard.ts","sources":["extensions/opencode/onboard.ts"]},{"output":"provider-catalog.js","sha256":"a2dd8bffbcd937b0b37d1612cedd75142f810c9f5f6657ba927caa53a60cb0e6","facadeSource":"extensions/opencode/provider-catalog.ts","sources":[]},{"output":"provider-discovery.js","sha256":"d781e0dc4848b6fa16e324d8ea510c59d55d006e507cca014f65aac1037510fa","facadeSource":"extensions/opencode/provider-discovery.ts","sources":["extensions/opencode/provider-discovery.ts"]},{"output":"provider-policy-api.js","sha256":"0e5b00dd9fab91c249fa1b749a94fee38e71dfaec3701ba61c67cd43c4f950cf","facadeSource":"extensions/opencode/provider-policy-api.ts","sources":["extensions/opencode/provider-policy-api.ts"]},{"output":"session-catalog-plugin.js","sha256":"1e6eaa7d48ac7fe43b4534e7a7510ffe7aa1fe5325f987339b3abac444228101","facadeSource":"extensions/opencode/session-catalog-plugin.ts","sources":["extensions/opencode/session-catalog-plugin.ts"]},{"output":"session-catalog-shared.js","sha256":"c8ce63680da100917b81727184a04e23d43d116cfab38dca592172b01413536a","facadeSource":"extensions/opencode/session-catalog-shared.ts","sources":["extensions/opencode/session-catalog-shared.ts"]},{"output":"session-catalog.js","sha256":"4d27d2cb194f950c82c9433b714058bc1d328710332616aea443c3827eeb99c3","facadeSource":"extensions/opencode/session-catalog.ts","sources":["extensions/opencode/session-catalog.ts"]},{"output":"session-upstream-activity.js","sha256":"9d68c600e368b2713754444343ce529f0be789c9748c85bb6bd5c9d771436818","facadeSource":"extensions/opencode/session-upstream-activity.ts","sources":["extensions/opencode/session-upstream-activity.ts"]},{"output":"stream.js","sha256":"d364ba2cabcc9644d28a9307dbf3169f675b63daa8abcaddc4d0bb2640a9825f","facadeSource":"extensions/opencode/stream.ts","sources":["extensions/opencode/stream.ts"]}],"unrenderedSources":[]}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { asFiniteNumberInRange } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
+
import { readProviderJsonObjectResponse } from "openclaw/plugin-sdk/provider-http";
|
|
3
|
+
import { sleep } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
4
|
+
import { MAX_TIMER_TIMEOUT_MS, positiveSecondsToSafeMilliseconds, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
5
|
+
import { createOAuthRefreshError, createOAuthRefreshResponseError, throwIfOAuthLoginAborted } from "openclaw/plugin-sdk/provider-oauth-runtime";
|
|
6
|
+
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
7
|
+
// extensions/opencode/console-oauth.ts
|
|
8
|
+
/**
|
|
9
|
+
* OpenCode Console browser sign-in (device authorization) for the `opencode` provider.
|
|
10
|
+
* OpenClaw signs in as its own Console client, `openclaw`, so it never shares or impersonates
|
|
11
|
+
* the OpenCode Console CLI's sign-in. Console refresh tokens are single-use: reusing one revokes
|
|
12
|
+
* the whole sign-in, so each credential owns exactly one refresh chain. The `opencode-go` plugin
|
|
13
|
+
* signs in separately for that reason, with its own copy of this file.
|
|
14
|
+
*/
|
|
15
|
+
const CONSOLE_ORIGIN = "https://opencode.ai";
|
|
16
|
+
const CONSOLE_URL = `${CONSOLE_ORIGIN}/console`;
|
|
17
|
+
const CLIENT_ID = "openclaw";
|
|
18
|
+
const REQUEST_TIMEOUT_MS = 3e4;
|
|
19
|
+
var OpencodeConsoleOAuthError = class extends Error {
|
|
20
|
+
constructor(code, status) {
|
|
21
|
+
super(`OpenCode Console sign-in request failed (HTTP ${status}). Retry sign-in.`);
|
|
22
|
+
this.code = typeof code === "string" && [
|
|
23
|
+
"authorization_pending",
|
|
24
|
+
"slow_down",
|
|
25
|
+
"access_denied",
|
|
26
|
+
"expired_token"
|
|
27
|
+
].includes(code) ? code : void 0;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
async function postConsoleJson(endpoint, fields, signal, beforeRequest) {
|
|
31
|
+
const { response, release } = await fetchWithSsrFGuard({
|
|
32
|
+
url: `${CONSOLE_URL}/auth/device/${endpoint}`,
|
|
33
|
+
init: {
|
|
34
|
+
method: "POST",
|
|
35
|
+
headers: {
|
|
36
|
+
Accept: "application/json",
|
|
37
|
+
"Content-Type": "application/json"
|
|
38
|
+
},
|
|
39
|
+
body: JSON.stringify({
|
|
40
|
+
client_id: CLIENT_ID,
|
|
41
|
+
...fields
|
|
42
|
+
})
|
|
43
|
+
},
|
|
44
|
+
signal,
|
|
45
|
+
beforeRequest,
|
|
46
|
+
timeoutMs: REQUEST_TIMEOUT_MS,
|
|
47
|
+
requireHttps: true,
|
|
48
|
+
policy: { hostnameAllowlist: ["opencode.ai"] },
|
|
49
|
+
auditContext: `opencode.console-oauth.${endpoint}`
|
|
50
|
+
});
|
|
51
|
+
try {
|
|
52
|
+
const payload = await readProviderJsonObjectResponse(response, "OpenCode Console sign-in", {
|
|
53
|
+
maxBytes: 65536,
|
|
54
|
+
requestHeaders: {}
|
|
55
|
+
});
|
|
56
|
+
if (!response.ok || payload.error !== void 0) {
|
|
57
|
+
if (fields.grant_type === "refresh_token") throw createOAuthRefreshResponseError("OpenCode Console sign-in refresh", response.status, payload);
|
|
58
|
+
throw new OpencodeConsoleOAuthError(payload.error, response.status);
|
|
59
|
+
}
|
|
60
|
+
return payload;
|
|
61
|
+
} finally {
|
|
62
|
+
await release();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** Console rotates the refresh token on every refresh; the previous one is never reusable. */
|
|
66
|
+
function parseToken(payload) {
|
|
67
|
+
const lifetimeMs = positiveSecondsToSafeMilliseconds(payload.expires_in);
|
|
68
|
+
const expires = lifetimeMs === void 0 ? void 0 : resolveExpiresAtMsFromDurationMs(lifetimeMs, { bufferMs: Math.min(3e5, Math.floor(lifetimeMs / 2)) });
|
|
69
|
+
if (typeof payload.access_token !== "string" || !payload.access_token.trim() || typeof payload.refresh_token !== "string" || !payload.refresh_token.trim() || expires === void 0) throw new Error("OpenCode Console returned invalid credentials. Retry sign-in.");
|
|
70
|
+
return {
|
|
71
|
+
access: payload.access_token,
|
|
72
|
+
refresh: payload.refresh_token,
|
|
73
|
+
expires
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
async function loginOpencodeConsole(ctx) {
|
|
77
|
+
const assertCurrent = () => {
|
|
78
|
+
throwIfOAuthLoginAborted(ctx.signal);
|
|
79
|
+
ctx.assertCurrent?.();
|
|
80
|
+
};
|
|
81
|
+
assertCurrent();
|
|
82
|
+
const payload = await postConsoleJson("code", { supports_org_scope: true }, ctx.signal, assertCurrent);
|
|
83
|
+
assertCurrent();
|
|
84
|
+
const lifetimeMs = positiveSecondsToSafeMilliseconds(payload.expires_in);
|
|
85
|
+
const expiresAt = lifetimeMs === void 0 ? void 0 : resolveExpiresAtMsFromDurationMs(lifetimeMs);
|
|
86
|
+
const intervalSeconds = payload.interval === void 0 ? 5 : asFiniteNumberInRange(payload.interval, {
|
|
87
|
+
min: Number.MIN_VALUE,
|
|
88
|
+
max: MAX_TIMER_TIMEOUT_MS / 1e3
|
|
89
|
+
});
|
|
90
|
+
const pollMs = intervalSeconds === void 0 ? void 0 : Math.ceil(intervalSeconds * 1e3);
|
|
91
|
+
const link = typeof payload.verification_uri_complete === "string" ? payload.verification_uri_complete : payload.verification_uri;
|
|
92
|
+
if (typeof payload.device_code !== "string" || !payload.device_code.trim() || typeof payload.user_code !== "string" || !payload.user_code.trim() || typeof link !== "string" || expiresAt === void 0 || pollMs === void 0 || pollMs > MAX_TIMER_TIMEOUT_MS) throw new Error("OpenCode Console returned an invalid device authorization response.");
|
|
93
|
+
const url = URL.parse(link, `${CONSOLE_URL}/`);
|
|
94
|
+
if (!url || url.origin !== CONSOLE_ORIGIN || url.username || url.password) throw new Error("OpenCode Console returned an invalid verification URL.");
|
|
95
|
+
const { device_code: deviceCode, user_code: userCode } = payload;
|
|
96
|
+
if (ctx.prompter.deviceCode) {
|
|
97
|
+
await ctx.openUrl(url.href);
|
|
98
|
+
await ctx.prompter.deviceCode({
|
|
99
|
+
title: "OpenCode Console sign-in",
|
|
100
|
+
code: userCode,
|
|
101
|
+
expiresInMinutes: Math.ceil((expiresAt - Date.now()) / 6e4),
|
|
102
|
+
message: "Confirm this code, then pick the workspace OpenClaw should use."
|
|
103
|
+
});
|
|
104
|
+
} else await ctx.prompter.note(`Open ${url.href}, confirm code ${userCode}, and pick a workspace.`, "OpenCode Console sign-in");
|
|
105
|
+
assertCurrent();
|
|
106
|
+
if (!ctx.isRemote && !ctx.prompter.deviceCode) {
|
|
107
|
+
try {
|
|
108
|
+
await ctx.openUrl(url.href);
|
|
109
|
+
} catch {}
|
|
110
|
+
assertCurrent();
|
|
111
|
+
}
|
|
112
|
+
const progress = ctx.prompter.progress("Waiting for OpenCode Console approval…");
|
|
113
|
+
let completed = false;
|
|
114
|
+
try {
|
|
115
|
+
let intervalMs = pollMs;
|
|
116
|
+
while (Date.now() < expiresAt) {
|
|
117
|
+
await sleep(Math.min(intervalMs, expiresAt - Date.now()), ctx.signal);
|
|
118
|
+
assertCurrent();
|
|
119
|
+
if (Date.now() >= expiresAt) break;
|
|
120
|
+
try {
|
|
121
|
+
const token = await postConsoleJson("token", {
|
|
122
|
+
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
123
|
+
device_code: deviceCode
|
|
124
|
+
}, ctx.signal, assertCurrent);
|
|
125
|
+
assertCurrent();
|
|
126
|
+
const credentials = parseToken(token);
|
|
127
|
+
completed = true;
|
|
128
|
+
return credentials;
|
|
129
|
+
} catch (error) {
|
|
130
|
+
assertCurrent();
|
|
131
|
+
if (!(error instanceof OpencodeConsoleOAuthError)) throw error;
|
|
132
|
+
switch (error.code) {
|
|
133
|
+
case "authorization_pending": break;
|
|
134
|
+
case "slow_down":
|
|
135
|
+
intervalMs = Math.min(intervalMs + 5e3, MAX_TIMER_TIMEOUT_MS);
|
|
136
|
+
break;
|
|
137
|
+
case "access_denied": throw new Error("OpenCode Console sign-in was denied. Retry sign-in when ready.", { cause: error });
|
|
138
|
+
case "expired_token": throw new Error("OpenCode Console sign-in code expired. Start sign-in again.", { cause: error });
|
|
139
|
+
default: throw error;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
throw new Error("OpenCode Console sign-in code expired. Start sign-in again.");
|
|
144
|
+
} finally {
|
|
145
|
+
progress.stop(completed ? "OpenCode Console sign-in complete" : "OpenCode Console sign-in stopped");
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
async function refreshOpencodeConsoleCredential(credential) {
|
|
149
|
+
if (!credential.refresh.trim()) throw new Error("OpenCode Console refresh token is missing. Sign in again.");
|
|
150
|
+
const payload = await postConsoleJson("token", {
|
|
151
|
+
grant_type: "refresh_token",
|
|
152
|
+
refresh_token: credential.refresh
|
|
153
|
+
});
|
|
154
|
+
try {
|
|
155
|
+
return {
|
|
156
|
+
...credential,
|
|
157
|
+
...parseToken(payload)
|
|
158
|
+
};
|
|
159
|
+
} catch (cause) {
|
|
160
|
+
throw createOAuthRefreshError("OpenCode Console refresh returned invalid credentials. Sign in again.", {
|
|
161
|
+
version: 1,
|
|
162
|
+
phase: "after-token-response",
|
|
163
|
+
outcome: "unknown"
|
|
164
|
+
}, { cause });
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
export { loginOpencodeConsole, refreshOpencodeConsoleCredential };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { OPENCODE_ZEN_DEFAULT_MODEL_REF, applyOpencodeZenProviderConfig } from "./onboard.js";
|
|
2
|
-
import { a as prepareOpencodeZenModel, c as openclaw_plugin_default, i as normalizeOpencodeZenBaseUrl, n as buildStaticOpencodeZenProviderConfig, o as resolveOpencodeZenModel, r as listOpencodeZenModelCatalogEntries, s as resolveOpencodeZenStarterModel, t as buildOpencodeZenLiveProviderConfig } from "./.setup/provider-catalog-
|
|
2
|
+
import { a as prepareOpencodeZenModel, c as openclaw_plugin_default, i as normalizeOpencodeZenBaseUrl, n as buildStaticOpencodeZenProviderConfig, o as resolveOpencodeZenModel, r as listOpencodeZenModelCatalogEntries, s as resolveOpencodeZenStarterModel, t as buildOpencodeZenLiveProviderConfig } from "./.setup/provider-catalog-7CVtc4r7.mjs";
|
|
3
3
|
import { resolveThinkingProfile } from "./provider-policy-api.js";
|
|
4
4
|
import { registerOpenCodeSessionCatalog } from "./session-catalog-plugin.js";
|
|
5
5
|
import { wrapOpencodeProviderStream } from "./stream.js";
|
|
6
|
+
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
6
7
|
import { describeImageWithModelPayloadTransform, describeImagesWithModelPayloadTransform } from "openclaw/plugin-sdk/media-understanding";
|
|
8
|
+
import { buildOauthProviderAuthResult, resolveOAuthApiKeyMarker } from "openclaw/plugin-sdk/provider-auth";
|
|
7
9
|
import { runLiveProviderCatalog } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
|
|
8
10
|
import { resolveFirstProviderCatalogAuth } from "openclaw/plugin-sdk/provider-catalog-shared";
|
|
9
11
|
import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
|
|
@@ -11,6 +13,40 @@ import { buildProviderReplayFamilyHooks, matchesExactOrPrefix } from "openclaw/p
|
|
|
11
13
|
import { isRecord, normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
14
|
// extensions/opencode/index.ts
|
|
13
15
|
const PROVIDER_ID = "opencode";
|
|
16
|
+
const loadConsoleOAuth = createLazyRuntimeModule(() => import("./console-oauth.js"));
|
|
17
|
+
async function signInWithOpencodeConsole(ctx) {
|
|
18
|
+
const credentials = await (await loadConsoleOAuth()).loginOpencodeConsole(ctx);
|
|
19
|
+
const notes = ["OpenClaw is signed in to the OpenCode Console workspace you picked. Tokens refresh automatically."];
|
|
20
|
+
ctx.assertCurrent?.();
|
|
21
|
+
const credentialOnly = {
|
|
22
|
+
profiles: [{
|
|
23
|
+
profileId: `${PROVIDER_ID}:default`,
|
|
24
|
+
credential: {
|
|
25
|
+
type: "oauth",
|
|
26
|
+
provider: PROVIDER_ID,
|
|
27
|
+
...credentials
|
|
28
|
+
}
|
|
29
|
+
}],
|
|
30
|
+
notes
|
|
31
|
+
};
|
|
32
|
+
if (ctx.credentialOnly) return credentialOnly;
|
|
33
|
+
const defaultModel = await resolveOpencodeZenStarterModel({
|
|
34
|
+
apiKey: credentials.access,
|
|
35
|
+
preferredModelRef: OPENCODE_ZEN_DEFAULT_MODEL_REF,
|
|
36
|
+
...ctx.signal ? { signal: ctx.signal } : {}
|
|
37
|
+
});
|
|
38
|
+
ctx.assertCurrent?.();
|
|
39
|
+
if (!defaultModel) return credentialOnly;
|
|
40
|
+
return buildOauthProviderAuthResult({
|
|
41
|
+
providerId: PROVIDER_ID,
|
|
42
|
+
defaultModel,
|
|
43
|
+
access: credentials.access,
|
|
44
|
+
refresh: credentials.refresh,
|
|
45
|
+
expires: credentials.expires,
|
|
46
|
+
profileName: "default",
|
|
47
|
+
notes
|
|
48
|
+
});
|
|
49
|
+
}
|
|
14
50
|
const MINIMAX_MODERN_MODEL_MATCHERS = ["minimax-m2.7"];
|
|
15
51
|
const stripDisabledResponsesReasoning = (payload) => {
|
|
16
52
|
if (!isRecord(payload)) return;
|
|
@@ -65,6 +101,22 @@ var opencode_default = defineSingleProviderPluginEntry({
|
|
|
65
101
|
].join("\n"),
|
|
66
102
|
noteTitle: "OpenCode"
|
|
67
103
|
},
|
|
104
|
+
extraAuth: [{
|
|
105
|
+
id: "oauth",
|
|
106
|
+
label: "OpenCode Console browser sign-in",
|
|
107
|
+
hint: "Sign in with your browser and pick a Console workspace",
|
|
108
|
+
kind: "device_code",
|
|
109
|
+
wizard: {
|
|
110
|
+
choiceId: "opencode-console",
|
|
111
|
+
choiceLabel: "OpenCode Console (browser sign-in)",
|
|
112
|
+
choiceHint: "Sign in in your browser and pick an OpenCode Console workspace",
|
|
113
|
+
groupId: "opencode",
|
|
114
|
+
groupLabel: "OpenCode",
|
|
115
|
+
groupHint: "Browser sign-in or shared Zen + Go API key"
|
|
116
|
+
},
|
|
117
|
+
run: signInWithOpencodeConsole
|
|
118
|
+
}],
|
|
119
|
+
refreshOAuth: async (credential) => (await loadConsoleOAuth()).refreshOpencodeConsoleCredential(credential),
|
|
68
120
|
normalizeConfig: ({ providerConfig }) => normalizeZenBaseUrl(providerConfig),
|
|
69
121
|
normalizeResolvedModel: ({ model }) => normalizeZenBaseUrl(model),
|
|
70
122
|
normalizeTransport: ({ api, baseUrl }) => normalizeZenBaseUrl({
|
|
@@ -81,7 +133,8 @@ var opencode_default = defineSingleProviderPluginEntry({
|
|
|
81
133
|
order: "simple",
|
|
82
134
|
run: async (ctx) => {
|
|
83
135
|
if (ctx.providerIds !== void 0 && !ctx.providerIds.includes(PROVIDER_ID)) return null;
|
|
84
|
-
const
|
|
136
|
+
const oauth = ctx.resolveProviderAuth(PROVIDER_ID, { oauthMarker: resolveOAuthApiKeyMarker(PROVIDER_ID) });
|
|
137
|
+
const auth = oauth.mode === "oauth" && oauth.discoveryApiKey ? oauth : resolveFirstProviderCatalogAuth(ctx.resolveProviderApiKey, [PROVIDER_ID, "opencode-go"]);
|
|
85
138
|
if (!auth) return null;
|
|
86
139
|
if (!auth.discoveryApiKey) return { provider: buildStaticOpencodeZenProviderConfig(auth.apiKey) };
|
|
87
140
|
return await runLiveProviderCatalog({
|
package/dist/provider-catalog.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as buildOpencodeZenLiveProviderConfig, n as buildStaticOpencodeZenProviderConfig, r as listOpencodeZenModelCatalogEntries, i as normalizeOpencodeZenBaseUrl, a as prepareOpencodeZenModel, o as resolveOpencodeZenModel, s as resolveOpencodeZenStarterModel } from "./.setup/provider-catalog-
|
|
1
|
+
export { t as buildOpencodeZenLiveProviderConfig, n as buildStaticOpencodeZenProviderConfig, r as listOpencodeZenModelCatalogEntries, i as normalizeOpencodeZenBaseUrl, a as prepareOpencodeZenModel, o as resolveOpencodeZenModel, s as resolveOpencodeZenStarterModel } from "./.setup/provider-catalog-7CVtc4r7.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as buildStaticOpencodeZenProviderConfig } from "./.setup/provider-catalog-
|
|
1
|
+
import { n as buildStaticOpencodeZenProviderConfig } from "./.setup/provider-catalog-7CVtc4r7.mjs";
|
|
2
2
|
// extensions/opencode/provider-discovery.ts
|
|
3
3
|
const opencodeProviderDiscovery = {
|
|
4
4
|
id: "opencode",
|
package/openclaw.plugin.json
CHANGED
|
@@ -271,6 +271,19 @@
|
|
|
271
271
|
]
|
|
272
272
|
},
|
|
273
273
|
"providerAuthChoices": [
|
|
274
|
+
{
|
|
275
|
+
"provider": "opencode",
|
|
276
|
+
"method": "oauth",
|
|
277
|
+
"choiceId": "opencode-console",
|
|
278
|
+
"appGuidedAuth": "oauth",
|
|
279
|
+
"credentialOnly": true,
|
|
280
|
+
"channelLogin": {},
|
|
281
|
+
"choiceLabel": "OpenCode Console (browser sign-in)",
|
|
282
|
+
"choiceHint": "Sign in in your browser and pick an OpenCode Console workspace",
|
|
283
|
+
"groupId": "opencode",
|
|
284
|
+
"groupLabel": "OpenCode",
|
|
285
|
+
"groupHint": "Browser sign-in or shared Zen + Go API key"
|
|
286
|
+
},
|
|
274
287
|
{
|
|
275
288
|
"provider": "opencode",
|
|
276
289
|
"method": "api-key",
|
|
@@ -279,7 +292,7 @@
|
|
|
279
292
|
"choiceLabel": "OpenCode Zen catalog",
|
|
280
293
|
"groupId": "opencode",
|
|
281
294
|
"groupLabel": "OpenCode",
|
|
282
|
-
"groupHint": "
|
|
295
|
+
"groupHint": "Browser sign-in or shared Zen + Go API key",
|
|
283
296
|
"optionKey": "opencodeZenApiKey",
|
|
284
297
|
"cliFlag": "--opencode-zen-api-key",
|
|
285
298
|
"cliOption": "--opencode-zen-api-key <key>",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/opencode-provider",
|
|
3
|
-
"version": "2026.11.10-beta.
|
|
3
|
+
"version": "2026.11.10-beta.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.11.10-beta.
|
|
21
|
+
"pluginApi": ">=2026.11.10-beta.2"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.11.10-beta.
|
|
24
|
+
"openclawVersion": "2026.11.10-beta.2",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"assets/activity.svg"
|
|
41
41
|
],
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"openclaw": ">=2026.11.10-beta.
|
|
43
|
+
"openclaw": ">=2026.11.10-beta.2"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"openclaw": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"entries":[{"output":"index.js","source":"extensions/opencode/index.ts"},{"output":"onboard.js","source":"extensions/opencode/onboard.ts"},{"output":"provider-catalog.js","source":"extensions/opencode/provider-catalog.ts"},{"output":"provider-discovery.js","source":"extensions/opencode/provider-discovery.ts"},{"output":"provider-policy-api.js","source":"extensions/opencode/provider-policy-api.ts"},{"output":"session-catalog-plugin.js","source":"extensions/opencode/session-catalog-plugin.ts"},{"output":"session-catalog-shared.js","source":"extensions/opencode/session-catalog-shared.ts"},{"output":"session-catalog.js","source":"extensions/opencode/session-catalog.ts"},{"output":"session-upstream-activity.js","source":"extensions/opencode/session-upstream-activity.ts"},{"output":"stream.js","source":"extensions/opencode/stream.ts"}],"chunks":[{"output":".setup/provider-catalog-_k2e5jtl.mjs","sha256":"4e7f21343a95023cdadcbf27d033d7733966a3abf9e34eee9a2fd612acab45c9","facadeSource":null,"sources":["extensions/opencode/openclaw.plugin.json","extensions/opencode/provider-catalog.ts"]},{"output":"index.js","sha256":"4fd7436eb4eacdc72851e88db28239a471897dbf6f78ed8e11adf7d36a5cbe61","facadeSource":"extensions/opencode/index.ts","sources":["extensions/opencode/index.ts"]},{"output":"onboard.js","sha256":"3bfe04c0dce12f07a8cd592db1d5221ab9261c4856ea19cca83b54299c90ff97","facadeSource":"extensions/opencode/onboard.ts","sources":["extensions/opencode/onboard.ts"]},{"output":"provider-catalog.js","sha256":"e26832ec4df7af2e8ab0377e0b6528fac2ea4fa0b7f9c02c15b9e28c48bf51a1","facadeSource":"extensions/opencode/provider-catalog.ts","sources":[]},{"output":"provider-discovery.js","sha256":"cc09bf92dd34df30d6de643e68d90e7ea0837b39b291f4283b636919ab8fcc11","facadeSource":"extensions/opencode/provider-discovery.ts","sources":["extensions/opencode/provider-discovery.ts"]},{"output":"provider-policy-api.js","sha256":"0e5b00dd9fab91c249fa1b749a94fee38e71dfaec3701ba61c67cd43c4f950cf","facadeSource":"extensions/opencode/provider-policy-api.ts","sources":["extensions/opencode/provider-policy-api.ts"]},{"output":"session-catalog-plugin.js","sha256":"1e6eaa7d48ac7fe43b4534e7a7510ffe7aa1fe5325f987339b3abac444228101","facadeSource":"extensions/opencode/session-catalog-plugin.ts","sources":["extensions/opencode/session-catalog-plugin.ts"]},{"output":"session-catalog-shared.js","sha256":"c8ce63680da100917b81727184a04e23d43d116cfab38dca592172b01413536a","facadeSource":"extensions/opencode/session-catalog-shared.ts","sources":["extensions/opencode/session-catalog-shared.ts"]},{"output":"session-catalog.js","sha256":"4d27d2cb194f950c82c9433b714058bc1d328710332616aea443c3827eeb99c3","facadeSource":"extensions/opencode/session-catalog.ts","sources":["extensions/opencode/session-catalog.ts"]},{"output":"session-upstream-activity.js","sha256":"9d68c600e368b2713754444343ce529f0be789c9748c85bb6bd5c9d771436818","facadeSource":"extensions/opencode/session-upstream-activity.ts","sources":["extensions/opencode/session-upstream-activity.ts"]},{"output":"stream.js","sha256":"d364ba2cabcc9644d28a9307dbf3169f675b63daa8abcaddc4d0bb2640a9825f","facadeSource":"extensions/opencode/stream.ts","sources":["extensions/opencode/stream.ts"]}],"unrenderedSources":[]}
|