claudish 13.0.3 → 13.1.0

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.
Files changed (2) hide show
  1. package/dist/index.js +85 -10
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -575,7 +575,7 @@ var init_onepassword_config = __esm(() => {
575
575
  });
576
576
 
577
577
  // src/version.ts
578
- var VERSION = "13.0.3";
578
+ var VERSION = "13.1.0";
579
579
 
580
580
  // src/logger.ts
581
581
  import { appendFile, existsSync as existsSync2, mkdirSync, readdirSync, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
@@ -13269,7 +13269,7 @@ function createGeminiThoughtSignatureHook() {
13269
13269
  description: "Sends Gemini's reasoning_details back with the assistant tool calls they were produced for",
13270
13270
  order: "pre",
13271
13271
  models: ["*gemini*", "*google/*"],
13272
- selectByUpstream: (upstream) => upstream.wireApi === "gemini" || upstream.vendor === "google",
13272
+ selectByUpstream: { wireApis: ["gemini"], vendors: ["google"] },
13273
13273
  routes: "all",
13274
13274
  defaultSeverity: "fix",
13275
13275
  statsName: GEMINI_THOUGHT_SIGNATURE_STATS_NAME,
@@ -18426,7 +18426,17 @@ async function prune(path) {
18426
18426
  await rename(tmp, path);
18427
18427
  log(`[behavior:journal] pruned ${lines.length - survivors.length} of ${lines.length} entries ` + `to stay under ${Math.round(MAX_JOURNAL_BYTES / 1e6)}MB`);
18428
18428
  }
18429
- async function recordDecision(entry, path = journalPath()) {
18429
+ function recordDecision(entry, path = journalPath()) {
18430
+ const previous = pendingAppends.get(path) ?? Promise.resolve();
18431
+ const next = previous.then(() => appendDecision(entry, path));
18432
+ pendingAppends.set(path, next);
18433
+ next.then(() => {
18434
+ if (pendingAppends.get(path) === next)
18435
+ pendingAppends.delete(path);
18436
+ });
18437
+ return next;
18438
+ }
18439
+ async function appendDecision(entry, path) {
18430
18440
  try {
18431
18441
  const size = await stat(path).then((s) => s.size, () => 0);
18432
18442
  if (size === 0)
@@ -18440,7 +18450,7 @@ async function recordDecision(entry, path = journalPath()) {
18440
18450
  log(`[behavior:journal] could not record: ${err}`);
18441
18451
  }
18442
18452
  }
18443
- var JOURNAL_SCHEMA_VERSION = 2, UPLOAD_SURFACES, UPLOAD_DECISIONS, MAX_DETAIL_CHARS = 200, MAX_JOURNAL_BYTES, PRUNE_TO_BYTES;
18453
+ var JOURNAL_SCHEMA_VERSION = 2, UPLOAD_SURFACES, UPLOAD_DECISIONS, MAX_DETAIL_CHARS = 200, MAX_JOURNAL_BYTES, PRUNE_TO_BYTES, pendingAppends;
18444
18454
  var init_journal = __esm(() => {
18445
18455
  init_logger();
18446
18456
  UPLOAD_SURFACES = new Set([
@@ -18458,6 +18468,7 @@ var init_journal = __esm(() => {
18458
18468
  ]);
18459
18469
  MAX_JOURNAL_BYTES = 32 * 1024 * 1024;
18460
18470
  PRUNE_TO_BYTES = Math.floor(MAX_JOURNAL_BYTES * 0.6);
18471
+ pendingAppends = new Map;
18461
18472
  });
18462
18473
 
18463
18474
  // src/hooks/output-capture.ts
@@ -19650,6 +19661,9 @@ var init_loader = __esm(() => {
19650
19661
  function isProxyEvent(event) {
19651
19662
  return PROXY_EVENTS.has(event);
19652
19663
  }
19664
+ function upstreamSelected(selector, upstream) {
19665
+ return upstream.wireApi !== null && selector.wireApis.includes(upstream.wireApi) || upstream.vendor !== null && selector.vendors.includes(upstream.vendor);
19666
+ }
19653
19667
  function eventsOf(def) {
19654
19668
  const events = [];
19655
19669
  const on = def.on ?? {};
@@ -19744,7 +19758,7 @@ function routeMatches(hook, route, upstream) {
19744
19758
  if (hook.routes === "foreign" && route.native)
19745
19759
  return false;
19746
19760
  if (upstream && hook.selectByUpstream)
19747
- return hook.selectByUpstream(upstream);
19761
+ return upstreamSelected(hook.selectByUpstream, upstream);
19748
19762
  return hook.models.some((glob) => globMatches(glob, route.modelId));
19749
19763
  }
19750
19764
  var CLOSED_HANDLER_KEYS, RAW_KEYS2, PROXY_EVENTS, ORDER_RANK;
@@ -72085,6 +72099,7 @@ class PaneSessionImpl {
72085
72099
  stderrHead = "";
72086
72100
  paneClosed = false;
72087
72101
  paneExited = false;
72102
+ exitCodeQuery = false;
72088
72103
  reaping = false;
72089
72104
  fastReap = false;
72090
72105
  reapPromise = null;
@@ -72595,7 +72610,7 @@ class PaneSessionImpl {
72595
72610
  }
72596
72611
  }
72597
72612
  checkLiveness() {
72598
- if (this.client || !this.panePidValue || this.paneExited)
72613
+ if (this.client || !this.panePidValue || this.paneExited || this.exitCodeQuery)
72599
72614
  return;
72600
72615
  const now = Date.now();
72601
72616
  if (now - this.lastLivenessAt < 1000)
@@ -72605,11 +72620,55 @@ class PaneSessionImpl {
72605
72620
  process.kill(this.panePidValue, 0);
72606
72621
  } catch (e) {
72607
72622
  if (e.code === "ESRCH") {
72608
- this.paneExited = true;
72609
- this.applyExitPath(null);
72623
+ this.exitCodeQuery = true;
72624
+ this.exitCodeFromMagmux().then((code) => {
72625
+ this.exitCodeQuery = false;
72626
+ if (this.paneExited || isTerminalPhase(this.phase))
72627
+ return;
72628
+ this.paneExited = true;
72629
+ this.exitCode = code;
72630
+ this.step(() => this.applyExitPath(code));
72631
+ });
72610
72632
  }
72611
72633
  }
72612
72634
  }
72635
+ async exitCodeFromMagmux() {
72636
+ const deadline = Date.now() + EXIT_CODE_QUERY_MS;
72637
+ const left = () => deadline - Date.now();
72638
+ const client = await this.dialWithin(left);
72639
+ if (!client)
72640
+ return null;
72641
+ try {
72642
+ while (left() > 0) {
72643
+ const r = await client.request({ type: "list" }, Math.max(1, left()));
72644
+ if (!r.ok)
72645
+ return null;
72646
+ const p0 = r.result.panes?.find((p) => p.pane === 0);
72647
+ if (!p0)
72648
+ return null;
72649
+ if (p0.dead === true)
72650
+ return typeof p0.exitCode === "number" ? p0.exitCode : null;
72651
+ await Bun.sleep(Math.min(EXIT_CODE_RETRY_MS, Math.max(0, left())));
72652
+ }
72653
+ return null;
72654
+ } finally {
72655
+ client.close();
72656
+ }
72657
+ }
72658
+ async dialWithin(left) {
72659
+ while (left() > 0 && !this.reaping && !isTerminalPhase(this.phase)) {
72660
+ try {
72661
+ const dial = MagmuxClient.dial(this.sockPath);
72662
+ const client = await Promise.race([dial, Bun.sleep(Math.max(0, left())).then(() => null)]);
72663
+ if (!client)
72664
+ dial.then((late) => late.close()).catch(() => {});
72665
+ return client;
72666
+ } catch {
72667
+ await Bun.sleep(Math.min(EXIT_CODE_RETRY_MS, Math.max(0, left())));
72668
+ }
72669
+ }
72670
+ return null;
72671
+ }
72613
72672
  t(key, dflt) {
72614
72673
  return this.o.timings?.[key] ?? dflt;
72615
72674
  }
@@ -74558,7 +74617,7 @@ async function startPaneSession(o) {
74558
74617
  await session.start({ magmuxBinary: magmux.binary, env: p.magmuxEnv, cwd: p.cwd });
74559
74618
  return session;
74560
74619
  }
74561
- var BOOT_TIMEOUT_MS = 90000, ADMIT_TIMEOUT_MS = 30000, DEGRADED_ENTRY_MS = 1e4, SCREEN_SETTLE_QUIET_MS = 3000, PANEL_SETTLE_MS = 500, SEND_CLIENT_SLACK_MS = 2000, MIN_READY_TIMEOUT_MS = 1000, BUSY_RETRY_MS = 250, MISMATCH_SETTLE_MS = 1000, CLEAR_WAIT_MS = 1000, BOOT_STATIC_MS = 5000, TICK_MS = 250, WATCH_FPS = 4, POLL_BACKSTOP_MS = 1000, TURN_END_MISSING_FACTOR = 3, RESIZE_REPLY_MS = 1e4, RESIZE_SCREEN_MS = 1000, GATE_POLL_MS = 250, GATE_REPLY_MS = 1000, GATE_STALE_MS = 1000, GATE_GRACE_MS, GATE_DEAD_BACKSTOP_MS = 1000, GATE_KINDLESS_REASONS, RUNTIME_DIALOG_KINDS, REGISTRY_READ_MS = 250, REGISTRY_DISAGREE_MS = 2000, REGISTRY_GATE_BOOT_DISAGREE_MS = 5000, REGISTRY_MISSING_MS = 5000, MAX_ANOMALY_KEYS = 64, KEPT_ANSWERS = 4, DEFAULT_MAX_CONSECUTIVE = 3, EVENT_REASON, VERDICT_EVENT, PaneStartError;
74620
+ var BOOT_TIMEOUT_MS = 90000, ADMIT_TIMEOUT_MS = 30000, DEGRADED_ENTRY_MS = 1e4, SCREEN_SETTLE_QUIET_MS = 3000, PANEL_SETTLE_MS = 500, SEND_CLIENT_SLACK_MS = 2000, MIN_READY_TIMEOUT_MS = 1000, BUSY_RETRY_MS = 250, MISMATCH_SETTLE_MS = 1000, CLEAR_WAIT_MS = 1000, BOOT_STATIC_MS = 5000, TICK_MS = 250, WATCH_FPS = 4, POLL_BACKSTOP_MS = 1000, TURN_END_MISSING_FACTOR = 3, RESIZE_REPLY_MS = 1e4, RESIZE_SCREEN_MS = 1000, GATE_POLL_MS = 250, GATE_REPLY_MS = 1000, GATE_STALE_MS = 1000, GATE_GRACE_MS, GATE_DEAD_BACKSTOP_MS = 1000, EXIT_CODE_QUERY_MS = 2000, EXIT_CODE_RETRY_MS = 50, GATE_KINDLESS_REASONS, RUNTIME_DIALOG_KINDS, REGISTRY_READ_MS = 250, REGISTRY_DISAGREE_MS = 2000, REGISTRY_GATE_BOOT_DISAGREE_MS = 5000, REGISTRY_MISSING_MS = 5000, MAX_ANOMALY_KEYS = 64, KEPT_ANSWERS = 4, DEFAULT_MAX_CONSECUTIVE = 3, EVENT_REASON, VERDICT_EVENT, PaneStartError;
74562
74621
  var init_pane_session = __esm(() => {
74563
74622
  init_queue();
74564
74623
  init_parent_session();
@@ -79759,10 +79818,26 @@ function hookRow(hook, severity) {
79759
79818
  severity,
79760
79819
  routes: hook.routes,
79761
79820
  models: [...hook.models],
79821
+ ...hook.selectByUpstream && {
79822
+ catalogSelection: {
79823
+ wireApis: [...hook.selectByUpstream.wireApis],
79824
+ vendors: [...hook.selectByUpstream.vendors]
79825
+ }
79826
+ },
79762
79827
  order: hook.order,
79763
79828
  unsafe: hook.unsafe
79764
79829
  };
79765
79830
  }
79831
+ function selectionOf(r) {
79832
+ const globs = r.models.join(", ");
79833
+ if (!r.catalogSelection)
79834
+ return r.models.join(",") !== "*" ? `models ${globs}` : null;
79835
+ const facts = [
79836
+ ...r.catalogSelection.wireApis.map((w) => `wire ${w}`),
79837
+ ...r.catalogSelection.vendors.map((v) => `vendor ${v}`)
79838
+ ].join(" or ");
79839
+ return `catalog ${facts}; without a catalog connection, models ${globs}`;
79840
+ }
79766
79841
  async function list(json) {
79767
79842
  const set = await loadHookSet({ hostMode: "other", moduleWarn: () => {} });
79768
79843
  const rows = set.registry.hooks.map((h) => hookRow(h, set.registry.severityOf(h)));
@@ -79789,7 +79864,7 @@ Hooks, in effective order
79789
79864
  `${r.source}`,
79790
79865
  `events ${r.events.join(", ")}`,
79791
79866
  `routes ${r.routes}`,
79792
- r.models.join(",") !== "*" ? `models ${r.models.join(", ")}` : null,
79867
+ selectionOf(r),
79793
79868
  r.order !== "normal" ? `order ${r.order}` : null
79794
79869
  ].filter(Boolean);
79795
79870
  console.log(` ${dim2(scope.join(" \xB7 "))}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "13.0.3",
3
+ "version": "13.1.0",
4
4
  "description": "Run Claude Code with any model - OpenRouter, Ollama, LM Studio & local models",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -69,10 +69,10 @@
69
69
  "ai"
70
70
  ],
71
71
  "optionalDependencies": {
72
- "@claudish/magmux-darwin-arm64": "13.0.3",
73
- "@claudish/magmux-darwin-x64": "13.0.3",
74
- "@claudish/magmux-linux-arm64": "13.0.3",
75
- "@claudish/magmux-linux-x64": "13.0.3"
72
+ "@claudish/magmux-darwin-arm64": "13.1.0",
73
+ "@claudish/magmux-darwin-x64": "13.1.0",
74
+ "@claudish/magmux-linux-arm64": "13.1.0",
75
+ "@claudish/magmux-linux-x64": "13.1.0"
76
76
  },
77
77
  "author": "Jack Rudenko <i@madappgang.com>",
78
78
  "license": "MIT",