@meetopenbot/claude-code 0.1.10 → 0.1.12

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.
Files changed (2) hide show
  1. package/dist/index.js +47 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2,6 +2,43 @@
2
2
  var isCloudMode = () => process.env.OPENBOT_CLOUD_MODE === "1";
3
3
  var defaultAuthMode = () => isCloudMode() ? "credits" : "byok";
4
4
 
5
+ // model-registry.ts
6
+ var REGISTRY_URL = "https://raw.githubusercontent.com/meetopenbot/openbot-registry/main/registry.json";
7
+ var ANTHROPIC_PROVIDER = "anthropic";
8
+ var freeInputModelField = () => ({
9
+ type: "string",
10
+ override: true,
11
+ description: "Claude model alias or full id (e.g. sonnet, opus, claude-opus-4-5).",
12
+ default: "sonnet"
13
+ });
14
+ async function resolveModelConfigField() {
15
+ try {
16
+ const res = await fetch(REGISTRY_URL, {
17
+ headers: { Accept: "application/json" },
18
+ signal: AbortSignal.timeout(15e3)
19
+ });
20
+ if (!res.ok) return freeInputModelField();
21
+ const registry = await res.json();
22
+ const models = registry.providers?.[ANTHROPIC_PROVIDER]?.models ?? [];
23
+ if (models.length === 0) return freeInputModelField();
24
+ const defaultModel = models.find((model) => /sonnet/i.test(model.id))?.id ?? models[0].id;
25
+ return {
26
+ type: "string",
27
+ override: true,
28
+ description: "Claude model from the OpenBot registry (Anthropic).",
29
+ default: defaultModel,
30
+ enum: models.map((model) => model.id),
31
+ options: models.map((model) => ({
32
+ label: model.label,
33
+ value: model.id,
34
+ description: model.description
35
+ }))
36
+ };
37
+ } catch {
38
+ return freeInputModelField();
39
+ }
40
+ }
41
+
5
42
  // runtime.ts
6
43
  import { execSync } from "node:child_process";
7
44
  import { existsSync as existsSync2, readlinkSync as readlinkSync2, statSync as statSync2 } from "node:fs";
@@ -19383,7 +19420,7 @@ var buildCreditsAnthropicEnv = () => {
19383
19420
  if (!config) return void 0;
19384
19421
  const apiKey = config.token || CREDITS_API_KEY_PLACEHOLDER;
19385
19422
  return {
19386
- ANTHROPIC_BASE_URL: `${config.baseUrl}/anthropic/v1`,
19423
+ ANTHROPIC_BASE_URL: `${config.baseUrl}/anthropic`,
19387
19424
  ANTHROPIC_CUSTOM_HEADERS: `${INTEGRATIONS_TOKEN_HEADER}: ${config.token}`,
19388
19425
  ANTHROPIC_API_KEY: apiKey,
19389
19426
  // Prevent the CLI from preferring stored OAuth over gateway routing.
@@ -19999,6 +20036,13 @@ var resolveAuthMode = (config) => {
19999
20036
  }
20000
20037
  return defaultAuthMode();
20001
20038
  };
20039
+ var resolveModel = (config) => {
20040
+ const raw = config.model;
20041
+ if (typeof raw !== "string" || !raw) return "sonnet";
20042
+ if (raw.startsWith("anthropic/")) return raw.slice("anthropic/".length);
20043
+ return raw;
20044
+ };
20045
+ var modelField = await resolveModelConfigField();
20002
20046
  var claudeCodePlugin = {
20003
20047
  id: "claude-code",
20004
20048
  name: "Claude Code",
@@ -20014,11 +20058,7 @@ var claudeCodePlugin = {
20014
20058
  default: "credits"
20015
20059
  }
20016
20060
  } : {},
20017
- model: {
20018
- type: "string",
20019
- description: "Claude model alias or full id (e.g. sonnet, opus, claude-opus-4-5).",
20020
- default: "sonnet"
20021
- },
20061
+ model: modelField,
20022
20062
  permissionMode: {
20023
20063
  type: "string",
20024
20064
  description: "How the SDK handles tool permission prompts: default | acceptEdits | bypassPermissions | plan | dontAsk | auto.",
@@ -20032,7 +20072,7 @@ var claudeCodePlugin = {
20032
20072
  }
20033
20073
  },
20034
20074
  factory: ({ agentDetails, config, storage }) => {
20035
- const model = typeof config.model === "string" && config.model ? config.model : "sonnet";
20075
+ const model = resolveModel(config);
20036
20076
  const permissionMode = typeof config.permissionMode === "string" && config.permissionMode ? config.permissionMode : "bypassPermissions";
20037
20077
  const executablePath = typeof config.executablePath === "string" && config.executablePath ? config.executablePath : void 0;
20038
20078
  return claudeCodeRuntime({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetopenbot/claude-code",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "type": "module",
5
5
  "description": "Claude Code plugin for OpenBot",
6
6
  "main": "./dist/index.js",