@meetopenbot/claude-code 0.1.11 → 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.
- package/dist/index.js +46 -6
- 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";
|
|
@@ -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 =
|
|
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({
|