@openclaw/opencode-provider 2026.9.4 → 2026.9.6

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.
@@ -0,0 +1,30 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
2
+ <!--
3
+ Adapted from OpenClaw ui/public/provider-icons/ProviderIcon-opencode.svg.
4
+ Source: https://github.com/steipete/CodexBar/blob/215efbd39ad58acb4b0cd637c407d63e6183bc8d/Sources/CodexBar/Resources/ProviderIcon-opencode.svg
5
+
6
+ MIT License
7
+ Copyright (c) 2026 Peter Steinberger
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ Names and marks remain the property of their respective owners.
28
+ -->
29
+ <path clip-rule="evenodd" fill="currentColor" fill-rule="evenodd" stroke="none" d="M80 88H20V12H80V88ZM35 27H65V72H35V27Z" />
30
+ </svg>
Binary file
@@ -1,9 +1,9 @@
1
- import { buildLiveModelProviderConfig, fetchLiveProviderModelIds, getCachedUpstreamProviderCatalog, listProviderCatalogSnapshotEntries, projectProviderCatalogSnapshotRows, projectUpstreamProviderCatalogSnapshot } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
1
+ import { createUpstreamProviderCatalog, fetchLiveProviderModelIds, listProviderCatalogSnapshotEntries } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
2
2
  import { normalizeModelCompat } from "openclaw/plugin-sdk/provider-model-shared";
3
3
  //#region extensions/opencode/openclaw.plugin.json
4
4
  var openclaw_plugin_default = {
5
5
  id: "opencode",
6
- categories: ["models", "media"],
6
+ categories: ["models"],
7
7
  activation: { "onStartup": true },
8
8
  providerCatalogEntry: "./provider-discovery.ts",
9
9
  enabledByDefault: true,
@@ -253,6 +253,12 @@ var openclaw_plugin_default = {
253
253
  "capabilities": ["image"],
254
254
  "defaultModels": { "image": "gpt-5-nano" }
255
255
  } },
256
+ configGroups: [{
257
+ "id": "native-sessions",
258
+ "title": "Native sessions",
259
+ "order": 10,
260
+ "properties": ["sessionCatalog"]
261
+ }],
256
262
  configSchema: {
257
263
  "type": "object",
258
264
  "additionalProperties": false,
@@ -293,37 +299,27 @@ const OPENCODE_ZEN_SEED_CATALOG = new Map(OPENCODE_ZEN_MANIFEST_PROVIDER.models.
293
299
  ..."replacedBy" in row && typeof row.replacedBy === "string" ? { replacedBy: row.replacedBy } : {}
294
300
  }];
295
301
  }));
296
- let opencodeZenCatalog = OPENCODE_ZEN_SEED_CATALOG;
297
- function listStaticOpencodeZenModels() {
298
- return [...OPENCODE_ZEN_SEED_CATALOG.values()].filter(({ model }) => opencodeZenCatalog.get(model.id)?.status !== "deprecated").map(({ model }) => model);
299
- }
300
- function cacheUpstreamOpencodeZenModels(catalog) {
301
- opencodeZenCatalog = projectUpstreamProviderCatalogSnapshot({
302
- providerId: PROVIDER_ID,
303
- provider: catalog,
304
- seed: new Map(Array.from(OPENCODE_ZEN_SEED_CATALOG, ([id, { model }]) => [id, { model }])),
305
- anthropicBaseUrl: OPENCODE_ZEN_ANTHROPIC_BASE_URL,
306
- defaultBaseUrl: OPENCODE_ZEN_OPENAI_BASE_URL
307
- });
308
- }
302
+ const opencodeZenCatalog = createUpstreamProviderCatalog({
303
+ providerId: PROVIDER_ID,
304
+ seed: OPENCODE_ZEN_SEED_CATALOG,
305
+ upstreamSeed: new Map(Array.from(OPENCODE_ZEN_SEED_CATALOG, ([id, { model }]) => [id, { model }])),
306
+ providerConfig: {
307
+ api: "openai-completions",
308
+ baseUrl: OPENCODE_ZEN_OPENAI_BASE_URL
309
+ },
310
+ metadataEndpoint: OPENCODE_UPSTREAM_CATALOG_ENDPOINT,
311
+ modelsEndpoint: OPENCODE_ZEN_MODELS_ENDPOINT,
312
+ anthropicBaseUrl: OPENCODE_ZEN_ANTHROPIC_BASE_URL,
313
+ timeoutMs: OPENCODE_ZEN_MODELS_TIMEOUT_MS,
314
+ ttlMs: OPENCODE_ZEN_MODELS_CACHE_TTL_MS,
315
+ auditContext: "opencode-zen-model-discovery",
316
+ isStaticEntryActive: (entry) => entry?.status !== "deprecated"
317
+ });
309
318
  async function prepareOpencodeZenModel(params) {
310
- const catalog = await getCachedUpstreamProviderCatalog({
311
- endpoint: OPENCODE_UPSTREAM_CATALOG_ENDPOINT,
312
- providerId: PROVIDER_ID,
313
- fetchGuard: params.fetchGuard,
314
- signal: params.signal
315
- });
316
- if (!catalog) return;
317
- cacheUpstreamOpencodeZenModels(catalog);
318
- return resolveOpencodeZenModel(params.modelId);
319
+ return (await opencodeZenCatalog.refreshMetadata(params))?.get(params.modelId.trim().toLowerCase())?.model;
319
320
  }
320
321
  function buildStaticOpencodeZenProviderConfig(apiKey) {
321
- return {
322
- api: "openai-completions",
323
- baseUrl: OPENCODE_ZEN_OPENAI_BASE_URL,
324
- ...apiKey ? { apiKey } : {},
325
- models: listStaticOpencodeZenModels()
326
- };
322
+ return opencodeZenCatalog.buildStaticProvider(apiKey);
327
323
  }
328
324
  async function resolveOpencodeZenStarterModel(params) {
329
325
  const liveModelIds = await fetchLiveProviderModelIds({
@@ -339,40 +335,13 @@ async function resolveOpencodeZenStarterModel(params) {
339
335
  return liveModelIds.includes(preferredModelId) ? params.preferredModelRef : void 0;
340
336
  }
341
337
  async function buildOpencodeZenLiveProviderConfig(params = {}) {
342
- if (!params.apiKey && !params.discoveryApiKey) return buildStaticOpencodeZenProviderConfig();
343
- try {
344
- const upstream = await getCachedUpstreamProviderCatalog({
345
- endpoint: OPENCODE_UPSTREAM_CATALOG_ENDPOINT,
346
- providerId: PROVIDER_ID,
347
- fetchGuard: params.fetchGuard,
348
- signal: params.signal
349
- });
350
- if (upstream) cacheUpstreamOpencodeZenModels(upstream);
351
- } catch {}
352
- return await buildLiveModelProviderConfig({
353
- discoveryMode: "strict",
354
- providerId: PROVIDER_ID,
355
- endpoint: OPENCODE_ZEN_MODELS_ENDPOINT,
356
- providerConfig: {
357
- api: "openai-completions",
358
- baseUrl: OPENCODE_ZEN_OPENAI_BASE_URL
359
- },
360
- models: listStaticOpencodeZenModels(),
361
- apiKey: params.apiKey,
362
- discoveryApiKey: params.discoveryApiKey,
363
- fetchGuard: params.fetchGuard,
364
- signal: params.signal,
365
- timeoutMs: OPENCODE_ZEN_MODELS_TIMEOUT_MS,
366
- ttlMs: OPENCODE_ZEN_MODELS_CACHE_TTL_MS,
367
- auditContext: "opencode-zen-model-discovery",
368
- projectRows: (rows) => projectProviderCatalogSnapshotRows(rows, opencodeZenCatalog)
369
- });
338
+ return await opencodeZenCatalog.buildLiveProvider(params);
370
339
  }
371
340
  function listOpencodeZenModelCatalogEntries() {
372
- return listProviderCatalogSnapshotEntries(opencodeZenCatalog);
341
+ return listProviderCatalogSnapshotEntries(opencodeZenCatalog.getSnapshot());
373
342
  }
374
343
  function resolveOpencodeZenModel(modelId) {
375
- return opencodeZenCatalog.get(modelId.trim().toLowerCase())?.model;
344
+ return opencodeZenCatalog.getSnapshot().get(modelId.trim().toLowerCase())?.model;
376
345
  }
377
346
  function normalizeBaseUrl(baseUrl) {
378
347
  return (baseUrl ?? "").trim().replace(/\/+$/, "");
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { opencodeMediaUnderstandingProvider } from "./media-understanding-provider.js";
2
2
  import { OPENCODE_ZEN_DEFAULT_MODEL_REF, applyOpencodeZenProviderConfig } from "./onboard.js";
3
- 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 "./provider-catalog-Cm1_0m0u.js";
3
+ 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-CfBqTHcl.mjs";
4
4
  import { resolveThinkingProfile } from "./provider-policy-api.js";
5
5
  import { registerOpenCodeSessionCatalog } from "./session-catalog-plugin.js";
6
6
  import { wrapOpencodeProviderStream } from "./stream.js";
@@ -1,2 +1,2 @@
1
- import { a as prepareOpencodeZenModel, i as normalizeOpencodeZenBaseUrl, n as buildStaticOpencodeZenProviderConfig, o as resolveOpencodeZenModel, r as listOpencodeZenModelCatalogEntries, s as resolveOpencodeZenStarterModel, t as buildOpencodeZenLiveProviderConfig } from "./provider-catalog-Cm1_0m0u.js";
1
+ import { a as prepareOpencodeZenModel, i as normalizeOpencodeZenBaseUrl, n as buildStaticOpencodeZenProviderConfig, o as resolveOpencodeZenModel, r as listOpencodeZenModelCatalogEntries, s as resolveOpencodeZenStarterModel, t as buildOpencodeZenLiveProviderConfig } from "./.setup/provider-catalog-CfBqTHcl.mjs";
2
2
  export { buildOpencodeZenLiveProviderConfig, buildStaticOpencodeZenProviderConfig, listOpencodeZenModelCatalogEntries, normalizeOpencodeZenBaseUrl, prepareOpencodeZenModel, resolveOpencodeZenModel, resolveOpencodeZenStarterModel };
@@ -1,4 +1,4 @@
1
- import { n as buildStaticOpencodeZenProviderConfig } from "./provider-catalog-Cm1_0m0u.js";
1
+ import { n as buildStaticOpencodeZenProviderConfig } from "./.setup/provider-catalog-CfBqTHcl.mjs";
2
2
  //#region extensions/opencode/provider-discovery.ts
3
3
  const opencodeProviderDiscovery = {
4
4
  id: "opencode",
@@ -129,6 +129,7 @@ function createOpenCodeNodeHostBindings(api) {
129
129
  terminalCommand: OPENCODE_TERMINAL_RESUME_COMMAND,
130
130
  sessionIdPattern: OPENCODE_SESSION_ID_PATTERN,
131
131
  executable: "opencode",
132
+ hasActiveWork: () => false,
132
133
  args: (threadId) => ["--session", threadId],
133
134
  listAvailable: available,
134
135
  terminalAvailable: available,
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "id": "opencode",
3
3
  "categories": [
4
- "models",
5
- "media"
4
+ "models"
6
5
  ],
7
6
  "activation": {
8
7
  "onStartup": true
@@ -331,6 +330,16 @@
331
330
  }
332
331
  }
333
332
  },
333
+ "configGroups": [
334
+ {
335
+ "id": "native-sessions",
336
+ "title": "Native sessions",
337
+ "order": 10,
338
+ "properties": [
339
+ "sessionCatalog"
340
+ ]
341
+ }
342
+ ],
334
343
  "configSchema": {
335
344
  "type": "object",
336
345
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/opencode-provider",
3
- "version": "2026.9.4",
3
+ "version": "2026.9.6",
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.9.4"
21
+ "pluginApi": ">=2026.9.6"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.9.4",
24
+ "openclawVersion": "2026.9.6",
25
25
  "bundledDist": false
26
26
  },
27
27
  "release": {
@@ -35,10 +35,12 @@
35
35
  "files": [
36
36
  "dist/**",
37
37
  "openclaw.plugin.json",
38
- "README.md"
38
+ "README.md",
39
+ "assets/icon.png",
40
+ "assets/activity.svg"
39
41
  ],
40
42
  "peerDependencies": {
41
- "openclaw": ">=2026.9.4"
43
+ "openclaw": ">=2026.9.6"
42
44
  },
43
45
  "peerDependenciesMeta": {
44
46
  "openclaw": {