@ordewell/web 0.14.9 → 0.14.11
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/server/main.js +20 -9
- package/dist/server/main.js.map +1 -1
- package/package.json +2 -2
package/dist/server/main.js
CHANGED
|
@@ -1266,20 +1266,21 @@ var OrchestratorPool = class {
|
|
|
1266
1266
|
* The catalog as `workspace`'s runners see it: Claude Code's picker lineup
|
|
1267
1267
|
* follows the `CLAUDE_CONFIG_DIR` that workspace's environment sets.
|
|
1268
1268
|
* Without a workspace the daemon's cwd stands in.
|
|
1269
|
+
*
|
|
1270
|
+
* `cached` answers from what discovery already holds, spawning no runner's
|
|
1271
|
+
* CLI and fetching no catalog: a runner never discovered lists nothing. A
|
|
1272
|
+
* read that only flags assignments asks this way, since one cold or broken
|
|
1273
|
+
* CLI (an `opencode` that cannot start its service fails only after tens of
|
|
1274
|
+
* seconds) would otherwise hold it up, as `SessionCatalog.scope()` is never
|
|
1275
|
+
* held up either.
|
|
1269
1276
|
*/
|
|
1270
|
-
async getProviderModels(workspace) {
|
|
1277
|
+
async getProviderModels(workspace, { cached: cached2 = false } = {}) {
|
|
1271
1278
|
const config = new WebConfig();
|
|
1272
1279
|
const resolver = this.resolverFor(workspace);
|
|
1273
1280
|
const runnerIds = this.registry.list().map((p) => p.manifest.name);
|
|
1274
|
-
const
|
|
1275
|
-
sandbox.catch(() => {
|
|
1276
|
-
});
|
|
1277
|
-
const providerLists = await resolver.refresh();
|
|
1278
|
-
const [runnerModels] = await Promise.all([resolver.modelsForRunners(runnerIds), sandbox]);
|
|
1279
|
-
const orchestratorModels = await resolver.pickerOptions();
|
|
1281
|
+
const { runnerModels, orchestratorModels } = cached2 ? { runnerModels: Object.fromEntries(runnerIds.map((id) => [id, resolver.getCachedRunnerModels(id)])), orchestratorModels: resolver.getCachedPickerOptions() } : await this.discoverProviderModels(resolver, runnerIds);
|
|
1280
1282
|
const providerErrors = resolver.getDiscoveryErrors();
|
|
1281
1283
|
const runnerErrors = resolver.getRunnerDiscoveryErrors();
|
|
1282
|
-
this.cachedProviderLists = providerLists;
|
|
1283
1284
|
const allModels = [];
|
|
1284
1285
|
const seen = /* @__PURE__ */ new Set();
|
|
1285
1286
|
const modelsByRunner = {};
|
|
@@ -1304,6 +1305,16 @@ var OrchestratorPool = class {
|
|
|
1304
1305
|
runnerErrors
|
|
1305
1306
|
};
|
|
1306
1307
|
}
|
|
1308
|
+
async discoverProviderModels(resolver, runnerIds) {
|
|
1309
|
+
const sandbox = this.codexSandbox.ensure();
|
|
1310
|
+
sandbox.catch(() => {
|
|
1311
|
+
});
|
|
1312
|
+
const providerLists = await resolver.refresh();
|
|
1313
|
+
const [runnerModels] = await Promise.all([resolver.modelsForRunners(runnerIds), sandbox]);
|
|
1314
|
+
const orchestratorModels = await resolver.pickerOptions();
|
|
1315
|
+
this.cachedProviderLists = providerLists;
|
|
1316
|
+
return { runnerModels, orchestratorModels };
|
|
1317
|
+
}
|
|
1307
1318
|
getRunnerState(workspace) {
|
|
1308
1319
|
const config = this.plannerConfig(void 0, workspace);
|
|
1309
1320
|
return { enabledRunners: config.enabledRunners, orchestratorModel: config.orchestratorModel };
|
|
@@ -2295,7 +2306,7 @@ function modelsRoute(pool) {
|
|
|
2295
2306
|
const router = new hono.Hono();
|
|
2296
2307
|
router.get("/", async (c) => {
|
|
2297
2308
|
try {
|
|
2298
|
-
const result = await pool.getProviderModels(c.req.query("workspace"));
|
|
2309
|
+
const result = await pool.getProviderModels(c.req.query("workspace"), { cached: c.req.query("cached") === "1" });
|
|
2299
2310
|
return c.json(result);
|
|
2300
2311
|
} catch (err) {
|
|
2301
2312
|
return failure(c, err, "list models");
|