@ordewell/web 0.14.8 → 0.14.10

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.
@@ -1040,6 +1040,7 @@ var OrchestratorPool = class {
1040
1040
  const config = this.plannerConfig(void 0, this.settingsWorkspace(sessionId, workspace));
1041
1041
  const userSettings = this.settingsService.getAll();
1042
1042
  const live = sessionId ? this.live(sessionId, workspace) : void 0;
1043
+ const unusedPlanningKey = config.unusedPlanningKey();
1043
1044
  return {
1044
1045
  orchestratorModel: config.orchestratorModel,
1045
1046
  // Who plans (ADR-0009) — a vendor id, or one of the three harness
@@ -1050,6 +1051,7 @@ var OrchestratorPool = class {
1050
1051
  // to render the current level; without it the picker shows "default"
1051
1052
  // for a planner that is running at "high".
1052
1053
  plannerThinkingEffort: config.plannerThinkingEffort ?? "",
1054
+ ...unusedPlanningKey ? { unusedPlanningKey } : {},
1053
1055
  // The saved level, read through the service so an environment override
1054
1056
  // is reported the way the next plan will read it (ADR-0001, ADR-0030).
1055
1057
  autonomousMode: this.settingsService.autonomousMode(),
@@ -1184,6 +1186,8 @@ var OrchestratorPool = class {
1184
1186
  const envChanges = admission ? admission.accepted : void 0;
1185
1187
  const plannerChange = plannerChangeOf(changes2, envChanges);
1186
1188
  const selection = changesPlanner(plannerChange) ? core.selectPlanner(current, plannerChange, this.plannerModelMemory, this.plannerCatalogFor(plannerChange.provider ?? current.provider, workspace)) : void 0;
1189
+ const agentPick = selection?.remember && selection.remember.provider === current.provider && core.isAgentPick(current.provider, selection.remember.model) ? selection.remember : void 0;
1190
+ if (agentPick) this.plannerModelMemory.remember(agentPick.provider, agentPick.model, agentPick.effort);
1187
1191
  let unsavedEnvKeys = [];
1188
1192
  if (envChanges) {
1189
1193
  let touched = false;
@@ -1228,7 +1232,7 @@ var OrchestratorPool = class {
1228
1232
  this.settingsService.setAutonomousMode(changes2.autonomousMode);
1229
1233
  }
1230
1234
  if (envChanges) for (const monitor of this.accountLimits.values()) monitor.refresh();
1231
- if (selection?.remember) {
1235
+ if (selection?.remember && !agentPick) {
1232
1236
  const { provider, model, effort } = selection.remember;
1233
1237
  const switched = provider !== current.provider;
1234
1238
  this.plannerModelMemory.remember(switched ? provider : this.plannerProviderInEffect(workspace), model, effort);
@@ -1262,20 +1266,21 @@ var OrchestratorPool = class {
1262
1266
  * The catalog as `workspace`'s runners see it: Claude Code's picker lineup
1263
1267
  * follows the `CLAUDE_CONFIG_DIR` that workspace's environment sets.
1264
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.
1265
1276
  */
1266
- async getProviderModels(workspace) {
1277
+ async getProviderModels(workspace, { cached: cached2 = false } = {}) {
1267
1278
  const config = new WebConfig();
1268
1279
  const resolver = this.resolverFor(workspace);
1269
1280
  const runnerIds = this.registry.list().map((p) => p.manifest.name);
1270
- const sandbox = this.codexSandbox.ensure();
1271
- sandbox.catch(() => {
1272
- });
1273
- const providerLists = await resolver.refresh();
1274
- const [runnerModels] = await Promise.all([resolver.modelsForRunners(runnerIds), sandbox]);
1275
- 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);
1276
1282
  const providerErrors = resolver.getDiscoveryErrors();
1277
1283
  const runnerErrors = resolver.getRunnerDiscoveryErrors();
1278
- this.cachedProviderLists = providerLists;
1279
1284
  const allModels = [];
1280
1285
  const seen = /* @__PURE__ */ new Set();
1281
1286
  const modelsByRunner = {};
@@ -1300,6 +1305,16 @@ var OrchestratorPool = class {
1300
1305
  runnerErrors
1301
1306
  };
1302
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
+ }
1303
1318
  getRunnerState(workspace) {
1304
1319
  const config = this.plannerConfig(void 0, workspace);
1305
1320
  return { enabledRunners: config.enabledRunners, orchestratorModel: config.orchestratorModel };
@@ -1344,7 +1359,7 @@ var OrchestratorPool = class {
1344
1359
  async getInstalledRunners(workspace) {
1345
1360
  await this.codexSandbox.refresh();
1346
1361
  const installation = this.installationFor(workspace);
1347
- installation.refresh?.();
1362
+ for (const probe of /* @__PURE__ */ new Set([installation, this.runnerInstallation])) probe.refresh?.();
1348
1363
  await this.detectInstalledPlanner();
1349
1364
  const config = new WebConfig({ enabledRunners: this.enabledRunnerOverride() });
1350
1365
  const enabled = new Set(config.enabledRunners);
@@ -2291,7 +2306,7 @@ function modelsRoute(pool) {
2291
2306
  const router = new hono.Hono();
2292
2307
  router.get("/", async (c) => {
2293
2308
  try {
2294
- 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" });
2295
2310
  return c.json(result);
2296
2311
  } catch (err) {
2297
2312
  return failure(c, err, "list models");