clawmux 0.3.7 → 0.3.9
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/cli.cjs +46 -1
- package/dist/index.cjs +17 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -85,7 +85,7 @@ var import_node_child_process = require("node:child_process");
|
|
|
85
85
|
var import_node_os = require("node:os");
|
|
86
86
|
|
|
87
87
|
// src/proxy/router.ts
|
|
88
|
-
var VERSION = process.env.npm_package_version ?? "0.3.
|
|
88
|
+
var VERSION = process.env.npm_package_version ?? "0.3.9";
|
|
89
89
|
function jsonResponse(body, status = 200) {
|
|
90
90
|
return new Response(JSON.stringify(body), {
|
|
91
91
|
status,
|
|
@@ -109,6 +109,22 @@ var routes = [
|
|
|
109
109
|
handler: async () => jsonResponse({ message: "stats not implemented yet" }),
|
|
110
110
|
key: "/stats"
|
|
111
111
|
},
|
|
112
|
+
{
|
|
113
|
+
method: "GET",
|
|
114
|
+
match: (p) => p === "/v1/models",
|
|
115
|
+
handler: async () => jsonResponse({
|
|
116
|
+
object: "list",
|
|
117
|
+
data: [
|
|
118
|
+
{
|
|
119
|
+
id: "auto",
|
|
120
|
+
object: "model",
|
|
121
|
+
created: 0,
|
|
122
|
+
owned_by: "clawmux"
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}),
|
|
126
|
+
key: "/v1/models"
|
|
127
|
+
},
|
|
112
128
|
{
|
|
113
129
|
method: "POST",
|
|
114
130
|
match: (p) => p === "/v1/messages",
|
|
@@ -4409,6 +4425,34 @@ async function update() {
|
|
|
4409
4425
|
process.exit(1);
|
|
4410
4426
|
}
|
|
4411
4427
|
}
|
|
4428
|
+
async function fixAgentModelsJson(homeDir, providerKey, correctBaseUrl) {
|
|
4429
|
+
const agentsDir = import_node_path5.join(homeDir, ".openclaw", "agents");
|
|
4430
|
+
let agentDirs;
|
|
4431
|
+
try {
|
|
4432
|
+
const entries = await import("node:fs/promises").then((m) => m.readdir(agentsDir, { withFileTypes: true }));
|
|
4433
|
+
agentDirs = entries.filter((d) => d.isDirectory()).map((d) => d.name);
|
|
4434
|
+
} catch {
|
|
4435
|
+
return;
|
|
4436
|
+
}
|
|
4437
|
+
for (const agentId of agentDirs) {
|
|
4438
|
+
const modelsPath = import_node_path5.join(agentsDir, agentId, "agent", "models.json");
|
|
4439
|
+
try {
|
|
4440
|
+
const raw = await import_promises6.readFile(modelsPath, "utf-8");
|
|
4441
|
+
const data = JSON.parse(raw);
|
|
4442
|
+
const agentProviders = data["providers"];
|
|
4443
|
+
if (!agentProviders?.[providerKey])
|
|
4444
|
+
continue;
|
|
4445
|
+
const entry = agentProviders[providerKey];
|
|
4446
|
+
const current = String(entry["baseUrl"] ?? "");
|
|
4447
|
+
if (current === correctBaseUrl)
|
|
4448
|
+
continue;
|
|
4449
|
+
entry["baseUrl"] = correctBaseUrl;
|
|
4450
|
+
await import_promises6.writeFile(modelsPath, JSON.stringify(data, null, 2) + `
|
|
4451
|
+
`);
|
|
4452
|
+
console.log(` fixed agent ${agentId} ${providerKey} baseUrl: ${current} → ${correctBaseUrl}`);
|
|
4453
|
+
} catch {}
|
|
4454
|
+
}
|
|
4455
|
+
}
|
|
4412
4456
|
async function init() {
|
|
4413
4457
|
const args = process.argv.slice(2);
|
|
4414
4458
|
const noService = args.includes("--no-service");
|
|
@@ -4484,6 +4528,7 @@ async function init() {
|
|
|
4484
4528
|
`);
|
|
4485
4529
|
console.log(` added ${PROVIDER_KEY} provider to openclaw.json (api=${providerApi})`);
|
|
4486
4530
|
}
|
|
4531
|
+
await fixAgentModelsJson(homeDir, PROVIDER_KEY, "http://localhost:3456");
|
|
4487
4532
|
const port = process.env.CLAWMUX_PORT ?? "3456";
|
|
4488
4533
|
if (!noService) {
|
|
4489
4534
|
console.log("");
|
package/dist/index.cjs
CHANGED
|
@@ -108,7 +108,7 @@ __export(exports_src, {
|
|
|
108
108
|
module.exports = __toCommonJS(exports_src);
|
|
109
109
|
|
|
110
110
|
// src/proxy/router.ts
|
|
111
|
-
var VERSION = process.env.npm_package_version ?? "0.3.
|
|
111
|
+
var VERSION = process.env.npm_package_version ?? "0.3.9";
|
|
112
112
|
function jsonResponse(body, status = 200) {
|
|
113
113
|
return new Response(JSON.stringify(body), {
|
|
114
114
|
status,
|
|
@@ -132,6 +132,22 @@ var routes = [
|
|
|
132
132
|
handler: async () => jsonResponse({ message: "stats not implemented yet" }),
|
|
133
133
|
key: "/stats"
|
|
134
134
|
},
|
|
135
|
+
{
|
|
136
|
+
method: "GET",
|
|
137
|
+
match: (p) => p === "/v1/models",
|
|
138
|
+
handler: async () => jsonResponse({
|
|
139
|
+
object: "list",
|
|
140
|
+
data: [
|
|
141
|
+
{
|
|
142
|
+
id: "auto",
|
|
143
|
+
object: "model",
|
|
144
|
+
created: 0,
|
|
145
|
+
owned_by: "clawmux"
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}),
|
|
149
|
+
key: "/v1/models"
|
|
150
|
+
},
|
|
135
151
|
{
|
|
136
152
|
method: "POST",
|
|
137
153
|
match: (p) => p === "/v1/messages",
|