pitroom 0.6.4 → 0.6.5

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/lib.mjs CHANGED
@@ -223,7 +223,9 @@ function invocation(req) {
223
223
  "stream-json",
224
224
  "--verbose"
225
225
  );
226
- if (req.model) args.push("--model", req.model);
226
+ const [model, effort] = (req.model ?? "").split("#");
227
+ if (model) args.push("--model", model);
228
+ if (effort) args.push("--effort", effort);
227
229
  if (req.sessionId) args.push("--resume", req.sessionId);
228
230
  args.push("--", req.prompt);
229
231
  const { command, prefix } = resolveCommand(binary());
@@ -276,11 +278,19 @@ function doctor({ models, hasFallback }) {
276
278
  if (!hasFallback) checks.push({ level: "warn", message: "no fallback workers configured for Claude Code runs" });
277
279
  return checks;
278
280
  }
281
+ var CLAUDE_EFFORTS = ["low", "medium", "high", "xhigh", "max"];
282
+ function catalog() {
283
+ const def = defaultModel();
284
+ const models = ["haiku", "sonnet", "opus"].map((id) => ({ id, efforts: CLAUDE_EFFORTS }));
285
+ if (def && !models.some((m) => m.id === def)) models.push({ id: def, efforts: CLAUDE_EFFORTS });
286
+ return { models, source: "Claude Code aliases (latest of each size) and --effort levels from `claude --help`" };
287
+ }
279
288
  var claude = {
280
289
  id: "claude",
281
290
  name: "Claude Code",
282
291
  capabilities: { readOnly: "tool-allowlist", resume: "by-id", reportsCost: true, attachFiles: false },
283
292
  binary,
293
+ catalog,
284
294
  invocation,
285
295
  parse: parseEvents,
286
296
  failure,
@@ -474,17 +484,35 @@ function doctor2({ models, hasFallback }) {
474
484
  login.ok && /logged in/i.test(login.out) ? { level: "ok", message: `Codex: ${login.out.trim().split("\n")[0]}` } : { level: "fail", message: "Codex is not logged in: run `codex login`" }
475
485
  );
476
486
  for (const m of models) {
487
+ const pinned = m?.replace(/#.*$/, "");
477
488
  checks.push({
478
- level: "ok",
479
- message: m ? `Codex model: ${m} (checked on first use; unsupported models fail over)` : "Codex model: Codex's built-in default (your ~/.codex/config.toml is ignored for workers; pick one with -W codex:<model>)"
489
+ level: pinned ? "ok" : "warn",
490
+ message: pinned ? `Codex model: ${pinned} (checked on first use; unsupported models fail over)` : 'Codex model: none pinned, so Codex runs its own default (it can change and cost more); set "models": {"codex": "<model>"} or use -W codex:<model>'
480
491
  });
481
492
  }
482
493
  if (!hasFallback) checks.push({ level: "warn", message: "no fallback workers configured for Codex runs" });
483
494
  return checks;
484
495
  }
496
+ function catalog2() {
497
+ const file = path3.join(codexHome(), "models_cache.json");
498
+ try {
499
+ const raw = JSON.parse(fs3.readFileSync(file, "utf8"));
500
+ const models = (raw.models ?? []).filter((m) => m.visibility !== "hide" && typeof m.slug === "string").map((m) => ({
501
+ id: m.slug,
502
+ efforts: (m.supported_reasoning_levels ?? []).map(
503
+ (l) => typeof l === "string" ? l : l.effort ?? ""
504
+ ).filter(Boolean),
505
+ defaultEffort: typeof m.default_reasoning_level === "string" ? m.default_reasoning_level : void 0
506
+ }));
507
+ return { models, source: `Codex model cache${raw.fetched_at ? `, fetched ${raw.fetched_at.slice(0, 10)}` : ""}` };
508
+ } catch {
509
+ return { models: [], source: "no Codex model cache found (run codex once)" };
510
+ }
511
+ }
485
512
  var codex = {
486
513
  id: "codex",
487
514
  name: "Codex",
515
+ catalog: catalog2,
488
516
  capabilities: { readOnly: "os-sandbox", resume: "by-id", reportsCost: false, attachFiles: false },
489
517
  binary: binary2,
490
518
  invocation: invocation2,
@@ -889,6 +917,13 @@ function resolveModel2(sessionId) {
889
917
  return void 0;
890
918
  }
891
919
  }
920
+ function catalog3() {
921
+ const ids = listModels();
922
+ return {
923
+ models: (ids.length ? ids : listModels()).map((id) => ({ id })),
924
+ source: "`opencode models` (reasoning variants are provider-specific: provider/model#variant)"
925
+ };
926
+ }
892
927
  function listModels() {
893
928
  return oc(["models"]).out.split("\n").map((s) => s.trim()).filter(Boolean);
894
929
  }
@@ -938,6 +973,7 @@ var opencode = {
938
973
  defaultModel: defaultModel2,
939
974
  resolveModel: resolveModel2,
940
975
  listModels,
976
+ catalog: catalog3,
941
977
  doctor: doctor3
942
978
  };
943
979