@hellcoder/companion 0.105.1-preview.20260624135426.10d7236 → 0.105.1
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/assets/{AgentsPage-CWeUKtFI.js → AgentsPage-eLLQNxgP.js} +1 -1
- package/dist/assets/{CronManager-BKdouPOe.js → CronManager-DDwptxks.js} +1 -1
- package/dist/assets/{IntegrationsPage-Ccg_HgWi.js → IntegrationsPage-BExX5JOb.js} +1 -1
- package/dist/assets/{LinearOAuthSettingsPage-D9_JUWel.js → LinearOAuthSettingsPage--m6I9icx.js} +1 -1
- package/dist/assets/{LinearSettingsPage-DWkwlh2E.js → LinearSettingsPage-4_3ZJrKS.js} +1 -1
- package/dist/assets/{Playground-DSXKSds_.js → Playground-BBt78cYF.js} +1 -1
- package/dist/assets/{PromptsPage-DogzCF5T.js → PromptsPage-_B61JVQm.js} +1 -1
- package/dist/assets/{RunsPage-BICx5Ywy.js → RunsPage-CgUwAzRE.js} +1 -1
- package/dist/assets/{SandboxManager-Lp__FqMb.js → SandboxManager-CX_Zi6K3.js} +1 -1
- package/dist/assets/{SettingsPage-CrOyTtWR.js → SettingsPage-BLax9147.js} +1 -1
- package/dist/assets/{TailscalePage-DCdh_AMg.js → TailscalePage-Buy9PO3F.js} +1 -1
- package/dist/assets/{index-B9Oa9QD1.js → index-DeUv1epH.js} +14 -14
- package/dist/assets/{sw-register-Ctj8ZoBE.js → sw-register-BPMmALbK.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/server/codex-models.test.ts +247 -0
- package/server/codex-models.ts +196 -0
- package/server/routes.test.ts +39 -8
- package/server/routes.ts +42 -28
package/server/routes.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { getCookie, setCookie } from "hono/cookie";
|
|
|
3
3
|
import { streamSSE } from "hono/streaming";
|
|
4
4
|
import { execSync } from "node:child_process";
|
|
5
5
|
import { resolveBinary } from "./path-resolver.js";
|
|
6
|
+
import { fetchCodexModels } from "./codex-models.js";
|
|
6
7
|
import { join, dirname } from "node:path";
|
|
7
8
|
import { fileURLToPath } from "node:url";
|
|
8
9
|
import { homedir } from "node:os";
|
|
@@ -1203,39 +1204,52 @@ export function createRoutes(
|
|
|
1203
1204
|
return c.json(backends);
|
|
1204
1205
|
});
|
|
1205
1206
|
|
|
1206
|
-
api.get("/backends/:id/models", (c) => {
|
|
1207
|
+
api.get("/backends/:id/models", async (c) => {
|
|
1207
1208
|
const backendId = c.req.param("id");
|
|
1208
1209
|
|
|
1209
1210
|
if (backendId === "codex") {
|
|
1210
|
-
//
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
}
|
|
1211
|
+
// Fetch the live model list from the Codex app-server. Recent Codex
|
|
1212
|
+
// releases no longer write ~/.codex/models_cache.json and instead serve
|
|
1213
|
+
// models over the app-server `model/list` RPC — so we query the CLI
|
|
1214
|
+
// directly. Falls back to the legacy cache file if the RPC yields nothing.
|
|
1215
1215
|
try {
|
|
1216
|
-
const
|
|
1217
|
-
|
|
1218
|
-
models:
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
visibility?: string;
|
|
1223
|
-
priority?: number;
|
|
1224
|
-
}>;
|
|
1225
|
-
};
|
|
1226
|
-
// Only return visible models, sorted by priority
|
|
1227
|
-
const models = cache.models
|
|
1228
|
-
.filter((m) => m.visibility === "list")
|
|
1229
|
-
.sort((a, b) => (a.priority ?? 99) - (b.priority ?? 99))
|
|
1230
|
-
.map((m) => ({
|
|
1231
|
-
value: m.slug,
|
|
1232
|
-
label: m.display_name || m.slug,
|
|
1233
|
-
description: m.description || "",
|
|
1234
|
-
}));
|
|
1235
|
-
return c.json(models);
|
|
1236
|
-
} catch (e) {
|
|
1237
|
-
return c.json({ error: "Failed to parse Codex models cache" }, 500);
|
|
1216
|
+
const models = await fetchCodexModels();
|
|
1217
|
+
if (models.length > 0) {
|
|
1218
|
+
return c.json(models.map((m) => ({ value: m.value, label: m.label, description: m.description })));
|
|
1219
|
+
}
|
|
1220
|
+
} catch {
|
|
1221
|
+
// fall through to legacy cache / 404
|
|
1238
1222
|
}
|
|
1223
|
+
|
|
1224
|
+
const cachePath = join(homedir(), ".codex", "models_cache.json");
|
|
1225
|
+
if (existsSync(cachePath)) {
|
|
1226
|
+
try {
|
|
1227
|
+
const raw = readFileSync(cachePath, "utf-8");
|
|
1228
|
+
const cache = JSON.parse(raw) as {
|
|
1229
|
+
models: Array<{
|
|
1230
|
+
slug: string;
|
|
1231
|
+
display_name?: string;
|
|
1232
|
+
description?: string;
|
|
1233
|
+
visibility?: string;
|
|
1234
|
+
priority?: number;
|
|
1235
|
+
}>;
|
|
1236
|
+
};
|
|
1237
|
+
const models = cache.models
|
|
1238
|
+
.filter((m) => m.visibility === "list")
|
|
1239
|
+
.sort((a, b) => (a.priority ?? 99) - (b.priority ?? 99))
|
|
1240
|
+
.map((m) => ({
|
|
1241
|
+
value: m.slug,
|
|
1242
|
+
label: m.display_name || m.slug,
|
|
1243
|
+
description: m.description || "",
|
|
1244
|
+
}));
|
|
1245
|
+
if (models.length > 0) return c.json(models);
|
|
1246
|
+
} catch {
|
|
1247
|
+
// ignore parse errors and fall through
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
// Nothing available — the frontend falls back to its static CODEX_MODELS list.
|
|
1252
|
+
return c.json({ error: "Codex models unavailable. Ensure the codex CLI is installed and authenticated." }, 404);
|
|
1239
1253
|
}
|
|
1240
1254
|
|
|
1241
1255
|
// Claude models are hardcoded on the frontend
|