claudish 14.29.0 → 14.29.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.
Files changed (2) hide show
  1. package/dist/index.js +211 -90
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -5542,7 +5542,7 @@ var init_env_placeholder = __esm(() => {
5542
5542
  });
5543
5543
 
5544
5544
  // src/version.ts
5545
- var VERSION = "14.29.0";
5545
+ var VERSION = "14.29.1";
5546
5546
 
5547
5547
  // src/redact.ts
5548
5548
  function isPlaceholder(value) {
@@ -14123,7 +14123,7 @@ var init_bundled_recommended_list = __esm(() => {
14123
14123
  }
14124
14124
  }
14125
14125
  },
14126
- fetchedAt: "2026-11-24T23:36:46.907Z",
14126
+ fetchedAt: "2026-11-25T12:53:30.764Z",
14127
14127
  format: 1,
14128
14128
  recommendations: {
14129
14129
  contractVersion: 3,
@@ -91070,7 +91070,8 @@ function emptyScreen(cols, rows) {
91070
91070
  spans: Array.from({ length: rows }, () => []),
91071
91071
  alt: false,
91072
91072
  changedAt: 0,
91073
- aboveBoxChangedAt: 0
91073
+ aboveBoxChangedAt: 0,
91074
+ boxChangedAt: 0
91074
91075
  };
91075
91076
  }
91076
91077
  function isBoxRule(line, cols) {
@@ -91105,6 +91106,20 @@ function aboveBoxText(s) {
91105
91106
  return box ? s.lines.slice(0, box.top).join(`
91106
91107
  `) : null;
91107
91108
  }
91109
+ function boxKey(s) {
91110
+ const box = locateBox(s);
91111
+ if (!box)
91112
+ return null;
91113
+ return JSON.stringify([
91114
+ s.cols,
91115
+ box.top,
91116
+ box.bottom,
91117
+ s.cursor.x,
91118
+ s.cursor.y,
91119
+ s.lines.slice(box.top, box.bottom + 1),
91120
+ s.spans.slice(box.top, box.bottom + 1)
91121
+ ]);
91122
+ }
91108
91123
  function finish(prev, next, now) {
91109
91124
  const visible = prev.seq === 0 || prev.cols !== next.cols || prev.rows !== next.rows || prev.alt !== next.alt || prev.cursor.x !== next.cursor.x || prev.cursor.y !== next.cursor.y || next.lines.some((l, i) => l !== prev.lines[i]) || next.spans.some((r, i) => !sameSpans(r, prev.spans[i]));
91110
91125
  if (!visible)
@@ -91113,12 +91128,17 @@ function finish(prev, next, now) {
91113
91128
  ...next,
91114
91129
  seq: prev.seq + 1,
91115
91130
  changedAt: now,
91116
- aboveBoxChangedAt: prev.aboveBoxChangedAt
91131
+ aboveBoxChangedAt: prev.aboveBoxChangedAt,
91132
+ boxChangedAt: prev.boxChangedAt
91117
91133
  };
91118
91134
  const before = prev.seq === 0 ? null : aboveBoxText(prev);
91119
91135
  const after = aboveBoxText(out);
91120
91136
  if (before === null || after === null || before !== after)
91121
91137
  out.aboveBoxChangedAt = now;
91138
+ const boxBefore = prev.seq === 0 ? null : boxKey(prev);
91139
+ const boxAfter = boxKey(out);
91140
+ if (boxBefore === null || boxAfter === null || boxBefore !== boxAfter)
91141
+ out.boxChangedAt = now;
91122
91142
  return out;
91123
91143
  }
91124
91144
  function applyFrame(s, frame, now = Date.now()) {
@@ -94286,11 +94306,36 @@ var init_host_routing_env = __esm(() => {
94286
94306
  });
94287
94307
 
94288
94308
  // src/launcher/magmux-binary.ts
94289
- import { execSync } from "child_process";
94290
- import { existsSync as existsSync30 } from "fs";
94291
- import { dirname as dirname16, join as join44 } from "path";
94309
+ import { constants as constants3, accessSync as accessSync2, existsSync as existsSync30, statSync as statSync16 } from "fs";
94310
+ import { delimiter, dirname as dirname16, join as join44 } from "path";
94292
94311
  import { fileURLToPath } from "url";
94293
- function findMagmuxCandidates() {
94312
+ function lookupOnPath(name, pathValue, fs = NODE_FS) {
94313
+ let failure = null;
94314
+ for (const dir of pathValue.split(delimiter)) {
94315
+ if (dir === "")
94316
+ continue;
94317
+ const at = checkCandidate(join44(dir, name), fs);
94318
+ if (at.kind === "found")
94319
+ return at;
94320
+ if (at.kind === "error")
94321
+ failure ??= at;
94322
+ }
94323
+ return failure ?? { kind: "not-found" };
94324
+ }
94325
+ function checkCandidate(candidate, fs) {
94326
+ try {
94327
+ if (!fs.statSync(candidate).isFile())
94328
+ return { kind: "not-found" };
94329
+ fs.accessSync(candidate, constants3.X_OK);
94330
+ return { kind: "found", path: candidate };
94331
+ } catch (e) {
94332
+ const code = e?.code;
94333
+ if (code && NOT_HERE.has(code))
94334
+ return { kind: "not-found" };
94335
+ return { kind: "error", code: code ?? String(e), path: candidate };
94336
+ }
94337
+ }
94338
+ function findMagmuxCandidates(env = process.env, fs = NODE_FS) {
94294
94339
  const thisFile = fileURLToPath(import.meta.url);
94295
94340
  const thisDir = dirname16(thisFile);
94296
94341
  const pkgRoots = [join44(thisDir, ".."), join44(thisDir, "..", "..")];
@@ -94321,24 +94366,31 @@ function findMagmuxCandidates() {
94321
94366
  searchDir = parent;
94322
94367
  }
94323
94368
  } catch {}
94324
- try {
94325
- const result = execSync("which magmux", { encoding: "utf-8" }).trim();
94326
- if (result)
94327
- add(result);
94328
- } catch {}
94329
- return found;
94369
+ const onPath = lookupOnPath("magmux", env.PATH ?? "", fs);
94370
+ if (onPath.kind === "found")
94371
+ add(onPath.path);
94372
+ return {
94373
+ paths: found,
94374
+ lookupError: onPath.kind === "error" ? `${onPath.code} on ${onPath.path}` : null
94375
+ };
94330
94376
  }
94331
- function findMagmuxBinaryOrNull() {
94332
- return findMagmuxCandidates()[0] ?? null;
94377
+ function findMagmuxBinaryOrNull(env = process.env, fs = NODE_FS) {
94378
+ return findMagmuxCandidates(env, fs).paths[0] ?? null;
94333
94379
  }
94334
- function findMagmuxBinary() {
94335
- const found = findMagmuxBinaryOrNull();
94336
- if (found)
94337
- return found;
94380
+ function findMagmuxBinary(env = process.env, fs = NODE_FS) {
94381
+ const { paths, lookupError } = findMagmuxCandidates(env, fs);
94382
+ if (paths[0])
94383
+ return paths[0];
94384
+ if (lookupError)
94385
+ throw new Error(`magmux lookup failed: ${lookupError}`);
94338
94386
  throw new Error(`magmux not found. Install it:
94339
94387
  brew install MadAppGang/tap/magmux`);
94340
94388
  }
94341
- var init_magmux_binary = () => {};
94389
+ var NODE_FS, NOT_HERE;
94390
+ var init_magmux_binary = __esm(() => {
94391
+ NODE_FS = { statSync: statSync16, accessSync: accessSync2 };
94392
+ NOT_HERE = new Set(["ENOENT", "ENOTDIR", "EACCES"]);
94393
+ });
94342
94394
 
94343
94395
  // src/launcher/magmux-wrapper.ts
94344
94396
  import {
@@ -107373,7 +107425,7 @@ var init_bundled_tagged_cache = __esm(() => {
107373
107425
  });
107374
107426
 
107375
107427
  // src/services/pricing-cache.ts
107376
- import { existsSync as existsSync35, readFileSync as readFileSync40, statSync as statSync16 } from "fs";
107428
+ import { existsSync as existsSync35, readFileSync as readFileSync40, statSync as statSync17 } from "fs";
107377
107429
  import { homedir as homedir39 } from "os";
107378
107430
  import { join as join49 } from "path";
107379
107431
  function prefixMatch(modelName) {
@@ -107427,7 +107479,7 @@ function loadDiskCache() {
107427
107479
  try {
107428
107480
  if (!existsSync35(CACHE_FILE))
107429
107481
  return false;
107430
- const stat = statSync16(CACHE_FILE);
107482
+ const stat = statSync17(CACHE_FILE);
107431
107483
  const age = Date.now() - stat.mtimeMs;
107432
107484
  const isFresh = age < CACHE_TTL_MS5;
107433
107485
  const raw = readFileSync40(CACHE_FILE, "utf-8");
@@ -112816,7 +112868,7 @@ import {
112816
112868
  mkdirSync as mkdirSync24,
112817
112869
  mkdtempSync as mkdtempSync2,
112818
112870
  readFileSync as readFileSync42,
112819
- statSync as statSync17,
112871
+ statSync as statSync18,
112820
112872
  writeFileSync as writeFileSync18
112821
112873
  } from "fs";
112822
112874
  import { join as join53, resolve as resolve5 } from "path";
@@ -112965,7 +113017,7 @@ function replaySettingsJson(statusLine) {
112965
113017
  function readUserStatusLine(configDir) {
112966
113018
  try {
112967
113019
  const path = join53(configDir, "settings.json");
112968
- if (statSync17(path).size > MAX_USER_SETTINGS_BYTES)
113020
+ if (statSync18(path).size > MAX_USER_SETTINGS_BYTES)
112969
113021
  return null;
112970
113022
  const v = JSON.parse(readFileSync42(path, "utf8"))?.statusLine;
112971
113023
  return v && typeof v === "object" && !Array.isArray(v) ? v : null;
@@ -113113,7 +113165,8 @@ async function assertMagmuxAvailable(binary) {
113113
113165
  async function probeMagmux(binary) {
113114
113166
  if (binary !== undefined)
113115
113167
  return probeOneMagmux(binary);
113116
- return selectMagmux(findMagmuxCandidates());
113168
+ const found = findMagmuxCandidates();
113169
+ return selectMagmux(found.paths, found.lookupError);
113117
113170
  }
113118
113171
  function isUsableMagmuxVersion(version) {
113119
113172
  return /^0\./.test(version) && versionAtLeast(version, MIN_MAGMUX_VERSION);
@@ -113128,9 +113181,9 @@ async function probeOneMagmux(found) {
113128
113181
  throw new MagmuxUnavailableError(`magmux_unavailable: ${found} is version ${version || "unknown"}${version && !/^0\./.test(version) ? " (not a 0.x release)" : ""}; panes need >= ${MIN_MAGMUX_VERSION} (${MAGMUX_NEEDS}); upgrade: brew upgrade MadAppGang/tap/magmux`);
113129
113182
  return { binary: found, version };
113130
113183
  }
113131
- async function selectMagmux(candidates) {
113184
+ async function selectMagmux(candidates, lookupError = null) {
113132
113185
  if (candidates.length === 0)
113133
- throw new MagmuxUnavailableError("magmux_unavailable: magmux not found (bundled package or PATH); install it: brew install MadAppGang/tap/magmux");
113186
+ throw noMagmuxFound(lookupError);
113134
113187
  const refused = [];
113135
113188
  for (const found of candidates) {
113136
113189
  let version;
@@ -113151,7 +113204,13 @@ async function selectMagmux(candidates) {
113151
113204
  else
113152
113205
  refused.push(`${found} reports ${version}`);
113153
113206
  }
113154
- throw new MagmuxUnavailableError(`magmux_unavailable: no usable magmux; panes need a 0.x release >= ${MIN_MAGMUX_VERSION} (${MAGMUX_NEEDS}): ${refused.join(", ")}; upgrade: brew upgrade MadAppGang/tap/magmux`);
113207
+ throw new MagmuxUnavailableError(`magmux_unavailable: no usable magmux; panes need a 0.x release >= ${MIN_MAGMUX_VERSION} (${MAGMUX_NEEDS}): ${refused.join(", ")}${lookupNote(lookupError)}; upgrade: brew upgrade MadAppGang/tap/magmux`);
113208
+ }
113209
+ function lookupNote(lookupError) {
113210
+ return lookupError ? `; magmux lookup failed: ${lookupError}` : "";
113211
+ }
113212
+ function noMagmuxFound(lookupError) {
113213
+ return new MagmuxUnavailableError(lookupError ? `magmux_unavailable: magmux lookup failed: ${lookupError}` : "magmux_unavailable: magmux not found (bundled package or PATH); install it: brew install MadAppGang/tap/magmux");
113155
113214
  }
113156
113215
  async function readMagmuxVersion(found) {
113157
113216
  const out = await runMagmuxVersion(found, MAGMUX_VERSION_TIMEOUT_MS);
@@ -113980,9 +114039,9 @@ var init_magmux_ui = __esm(() => {
113980
114039
  });
113981
114040
 
113982
114041
  // src/signal-exit-code.ts
113983
- import { constants as constants3 } from "os";
114042
+ import { constants as constants4 } from "os";
113984
114043
  function signalExitCode(signal) {
113985
- const signum = constants3.signals[signal];
114044
+ const signum = constants4.signals[signal];
113986
114045
  return typeof signum === "number" ? 128 + signum : 128;
113987
114046
  }
113988
114047
  var init_signal_exit_code = () => {};
@@ -114050,7 +114109,7 @@ import {
114050
114109
  readFileSync as readFileSync43,
114051
114110
  readdirSync as readdirSync9,
114052
114111
  rmSync as rmSync12,
114053
- statSync as statSync18,
114112
+ statSync as statSync19,
114054
114113
  unlinkSync as unlinkSync11,
114055
114114
  writeFileSync as writeFileSync19
114056
114115
  } from "fs";
@@ -114418,7 +114477,7 @@ function gitDirOfFile(entry, readFile) {
114418
114477
  }
114419
114478
  function statPathKind(path) {
114420
114479
  try {
114421
- const stat = statSync18(path);
114480
+ const stat = statSync19(path);
114422
114481
  return stat.isDirectory() ? "dir" : "file";
114423
114482
  } catch {
114424
114483
  return;
@@ -114774,7 +114833,7 @@ function cleanupStaleTokenFiles(dir, now = Date.now(), maxAgeMs = STALE_TOKEN_FI
114774
114833
  scanned++;
114775
114834
  const full = join54(dir, name);
114776
114835
  try {
114777
- if (statSync18(full).mtimeMs >= cutoff)
114836
+ if (statSync19(full).mtimeMs >= cutoff)
114778
114837
  continue;
114779
114838
  unlinkSync11(full);
114780
114839
  removed++;
@@ -116158,11 +116217,11 @@ var init_team_stats = __esm(() => {
116158
116217
  });
116159
116218
 
116160
116219
  // src/pane/accounting.ts
116161
- import { statSync as statSync19 } from "fs";
116220
+ import { statSync as statSync20 } from "fs";
116162
116221
  function readTokenFileCached(path) {
116163
116222
  let st;
116164
116223
  try {
116165
- const s = statSync19(path);
116224
+ const s = statSync20(path);
116166
116225
  st = { mtimeMs: s.mtimeMs, size: s.size };
116167
116226
  } catch {
116168
116227
  cache2.delete(path);
@@ -116342,7 +116401,7 @@ var init_endpoints = __esm(() => {
116342
116401
  });
116343
116402
 
116344
116403
  // src/view/endpoint-watch.ts
116345
- import { statSync as statSync20, watch } from "fs";
116404
+ import { statSync as statSync21, watch } from "fs";
116346
116405
 
116347
116406
  class EndpointWatch {
116348
116407
  o;
@@ -116389,7 +116448,7 @@ class EndpointWatch {
116389
116448
  }
116390
116449
  dirIno() {
116391
116450
  try {
116392
- return statSync20(endpointsDirOf(this.o.root)).ino;
116451
+ return statSync21(endpointsDirOf(this.o.root)).ino;
116393
116452
  } catch {
116394
116453
  return null;
116395
116454
  }
@@ -116680,7 +116739,7 @@ import {
116680
116739
  readdirSync as readdirSync11,
116681
116740
  realpathSync as realpathSync7,
116682
116741
  rmSync as rmSync14,
116683
- statSync as statSync21,
116742
+ statSync as statSync22,
116684
116743
  writeFileSync as writeFileSync21
116685
116744
  } from "fs";
116686
116745
  import { basename as basename7, dirname as dirname22, join as join57, resolve as resolve7, sep } from "path";
@@ -116916,7 +116975,7 @@ function teamRunRowFromDisk(path, status) {
116916
116975
  }
116917
116976
  function statusMtimeMs(path) {
116918
116977
  try {
116919
- return statSync21(join57(path, "status.json")).mtimeMs;
116978
+ return statSync22(join57(path, "status.json")).mtimeMs;
116920
116979
  } catch {
116921
116980
  return null;
116922
116981
  }
@@ -117249,7 +117308,7 @@ function readWrittenFile(path, root) {
117249
117308
  if (real !== realRoot && !real.startsWith(realRoot + sep))
117250
117309
  return { skip: "outside the working directory" };
117251
117310
  try {
117252
- const st = statSync21(real);
117311
+ const st = statSync22(real);
117253
117312
  if (!st.isFile())
117254
117313
  return { skip: "not a regular file" };
117255
117314
  if (st.size > MAX_FILE_ANSWER_BYTES)
@@ -118360,7 +118419,7 @@ var init_team_orchestrator = __esm(() => {
118360
118419
  });
118361
118420
 
118362
118421
  // src/mcp-session/inherited-settings.ts
118363
- import { existsSync as existsSync41, readFileSync as readFileSync46, statSync as statSync22 } from "fs";
118422
+ import { existsSync as existsSync41, readFileSync as readFileSync46, statSync as statSync23 } from "fs";
118364
118423
  import { join as join58, resolve as resolve8 } from "path";
118365
118424
  function isPlainObject7(value) {
118366
118425
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -118448,7 +118507,7 @@ function resolveSetupFrom(arg, workDir, serverCwd) {
118448
118507
  let setupFrom = serverCwd;
118449
118508
  if (typeof arg === "string") {
118450
118509
  setupFrom = resolve8(arg);
118451
- if (!statSync22(setupFrom, { throwIfNoEntry: false })?.isDirectory()) {
118510
+ if (!statSync23(setupFrom, { throwIfNoEntry: false })?.isDirectory()) {
118452
118511
  throw new Error(`invalid_args: setup_from ${setupFrom} is not an existing directory`);
118453
118512
  }
118454
118513
  } else if (arg !== undefined) {
@@ -118582,7 +118641,7 @@ import {
118582
118641
  readSync as readSync7,
118583
118642
  renameSync as renameSync10,
118584
118643
  rmSync as rmSync15,
118585
- statSync as statSync23,
118644
+ statSync as statSync24,
118586
118645
  writeFileSync as writeFileSync22
118587
118646
  } from "fs";
118588
118647
  import { join as join60, resolve as resolve9, sep as sep2 } from "path";
@@ -118692,7 +118751,7 @@ function anomalyKey(a) {
118692
118751
  function readTailText(path, maxBytes) {
118693
118752
  let fd = null;
118694
118753
  try {
118695
- const size = statSync23(path).size;
118754
+ const size = statSync24(path).size;
118696
118755
  if (size === 0)
118697
118756
  return { text: "", truncated: false };
118698
118757
  const start = Math.max(0, size - maxBytes);
@@ -118723,7 +118782,7 @@ function readTailLines2(path, maxBytes) {
118723
118782
  }
118724
118783
  function fileSize2(path) {
118725
118784
  try {
118726
- return statSync23(path).size;
118785
+ return statSync24(path).size;
118727
118786
  } catch {
118728
118787
  return 0;
118729
118788
  }
@@ -119557,7 +119616,7 @@ class SessionManager {
119557
119616
  if (sessionDir === null)
119558
119617
  return null;
119559
119618
  try {
119560
- if (!statSync23(sessionDir).isDirectory())
119619
+ if (!statSync24(sessionDir).isDirectory())
119561
119620
  return null;
119562
119621
  } catch {
119563
119622
  return null;
@@ -119697,7 +119756,7 @@ class SessionManager {
119697
119756
  return null;
119698
119757
  let dirMtimeMs;
119699
119758
  try {
119700
- const stat = statSync23(sessionDir);
119759
+ const stat = statSync24(sessionDir);
119701
119760
  if (!stat.isDirectory())
119702
119761
  return null;
119703
119762
  dirMtimeMs = stat.mtimeMs;
@@ -120059,7 +120118,7 @@ var init_session_manager = __esm(() => {
120059
120118
  });
120060
120119
 
120061
120120
  // src/view/history.ts
120062
- import { closeSync as closeSync17, openSync as openSync17, readSync as readSync8, readdirSync as readdirSync12, statSync as statSync24 } from "fs";
120121
+ import { closeSync as closeSync17, openSync as openSync17, readSync as readSync8, readdirSync as readdirSync12, statSync as statSync25 } from "fs";
120063
120122
  import { join as join61 } from "path";
120064
120123
  function finishedDetail(promptSummary) {
120065
120124
  return {
@@ -120102,7 +120161,7 @@ function runDirs(sessionsDir) {
120102
120161
  const dated = [];
120103
120162
  for (const name of names) {
120104
120163
  try {
120105
- const st = statSync24(join61(sessionsDir, name));
120164
+ const st = statSync25(join61(sessionsDir, name));
120106
120165
  if (st.isDirectory())
120107
120166
  dated.push({ name, mtimeMs: st.mtimeMs });
120108
120167
  } catch {}
@@ -120763,8 +120822,8 @@ var init_feed_relay = __esm(() => {
120763
120822
 
120764
120823
  // src/pane/pane-registry.ts
120765
120824
  import {
120766
- constants as constants4,
120767
- accessSync as accessSync2,
120825
+ constants as constants5,
120826
+ accessSync as accessSync3,
120768
120827
  existsSync as existsSync43,
120769
120828
  lstatSync as lstatSync9,
120770
120829
  readFileSync as readFileSync49,
@@ -121142,7 +121201,7 @@ function dialErrno(reported, sockPath) {
121142
121201
  if (!isSocket)
121143
121202
  return "ENOTSOCK";
121144
121203
  try {
121145
- accessSync2(sockPath, constants4.W_OK);
121204
+ accessSync3(sockPath, constants5.W_OK);
121146
121205
  } catch {
121147
121206
  return "EACCES";
121148
121207
  }
@@ -121820,7 +121879,7 @@ var init_view_socket = __esm(() => {
121820
121879
  });
121821
121880
 
121822
121881
  // src/pane/pane-session.ts
121823
- import { readFileSync as readFileSync51, realpathSync as realpathSync9, rmSync as rmSync18, statSync as statSync25, writeFileSync as writeFileSync25 } from "fs";
121882
+ import { readFileSync as readFileSync51, realpathSync as realpathSync9, rmSync as rmSync18, statSync as statSync26, writeFileSync as writeFileSync25 } from "fs";
121824
121883
  import { join as join66 } from "path";
121825
121884
  function clearKeyCount(line, attempts, cols) {
121826
121885
  const cells = 2 * Math.max(1, attempts) * Bun.stringWidth(line);
@@ -121922,6 +121981,12 @@ class PaneSessionImpl {
121922
121981
  trustedGen = 0;
121923
121982
  trustEpoch = 0;
121924
121983
  lastFrameGen = 0;
121984
+ trustedFramesFrom = 0;
121985
+ lastInputAt = 0;
121986
+ inputsInFlight = 0;
121987
+ inputSeq = 0;
121988
+ lostInputs = new Map;
121989
+ answeredInputs = new WeakMap;
121925
121990
  gateInFlight = false;
121926
121991
  gateTimer = null;
121927
121992
  gateDeadSince = 0;
@@ -122121,10 +122186,14 @@ class PaneSessionImpl {
122121
122186
  const bound = await this.awaitBoundPane(client, reconnect, magmuxVersion);
122122
122187
  if (!bound)
122123
122188
  return;
122189
+ this.noteTrusted(gen);
122190
+ this.onGateList(client, bound);
122191
+ }
122192
+ noteTrusted(gen) {
122124
122193
  this.trustedGen = gen;
122125
122194
  this.trustEpoch++;
122195
+ this.trustedFramesFrom = this.lastFrameGen === gen ? Date.now() : null;
122126
122196
  this.gateTrusted = true;
122127
- this.onGateList(client, bound);
122128
122197
  }
122129
122198
  async awaitBoundPane(client, reconnect, magmuxVersion) {
122130
122199
  let list = await client.request({ type: "list" });
@@ -122284,6 +122353,8 @@ class PaneSessionImpl {
122284
122353
  if (f.pane !== undefined && f.pane !== 0)
122285
122354
  return;
122286
122355
  this.lastFrameGen = gen;
122356
+ if (this.trustedFramesFrom === null && gen === this.trustedGen && this.gateTrusted)
122357
+ this.trustedFramesFrom = Date.now();
122287
122358
  const seq = this.screen.seq;
122288
122359
  this.screen = applyFrame(this.screen, f);
122289
122360
  if (this.screen.seq !== seq && !this.inResizeQuiet(this.screen.changedAt))
@@ -122870,8 +122941,10 @@ ${gate}`
122870
122941
  const step = adm.step;
122871
122942
  const shape = sendShape(step, adm.line);
122872
122943
  const rt = readyTimeoutFor(step, adm.line, adm.deadline - Date.now());
122873
- if (rt === null)
122944
+ if (rt === null) {
122945
+ this.anomaly(`send_no_room:${step}`);
122874
122946
  return false;
122947
+ }
122875
122948
  const timeout = sendBudgetMs({ ...shape.budget, readyTimeoutMs: rt }) + SEND_CLIENT_SLACK_MS2;
122876
122949
  this.follower.holdTurn(false);
122877
122950
  const sentAt = Date.now();
@@ -122879,7 +122952,7 @@ ${gate}`
122879
122952
  adm.attempts++;
122880
122953
  let reply;
122881
122954
  try {
122882
- reply = await c.request({ ...shape.msg, readyTimeoutMs: rt }, timeout);
122955
+ reply = await this.writeInput(c, { ...shape.msg, readyTimeoutMs: rt }, timeout);
122883
122956
  } finally {
122884
122957
  adm.inFlight = false;
122885
122958
  }
@@ -123100,26 +123173,32 @@ ${gate}`
123100
123173
  }
123101
123174
  async waitDrawn(o) {
123102
123175
  let epoch = this.trustEpoch;
123176
+ let epochSeenAt = 0;
123103
123177
  let last;
123104
- let changedAt = Date.now();
123178
+ const waitStartedAt = Date.now();
123179
+ let changedAt = waitStartedAt;
123105
123180
  let wholeShown = false;
123106
123181
  let ended = null;
123182
+ const floor = () => this.inputReplyLost() ? waitStartedAt : 0;
123107
123183
  const settle = () => {
123108
123184
  const at = Date.now();
123109
123185
  if (this.trustEpoch !== epoch) {
123110
123186
  epoch = this.trustEpoch;
123187
+ epochSeenAt = at;
123111
123188
  last = undefined;
123112
123189
  wholeShown = false;
123113
123190
  }
123114
123191
  const now = this.drawnBox(o.against);
123115
123192
  if (now === undefined || last === undefined || !sameDrawnBox(now, last)) {
123116
123193
  last = now;
123117
- changedAt = at;
123194
+ changedAt = now === undefined ? at : Math.max(this.boxUnchangedSince(at), epochSeenAt, floor());
123118
123195
  if (now !== undefined)
123119
123196
  o.onRead?.(now);
123120
123197
  if (now?.match === "line")
123121
123198
  wholeShown = true;
123122
123199
  }
123200
+ if (now !== undefined)
123201
+ changedAt = Math.max(changedAt, this.boxUnchangedSince(at), epochSeenAt, floor());
123123
123202
  ended = drawEnded(now, wholeShown && o.earlier || o.emptyEnds?.() === true, at - changedAt, o.partOnly ?? null);
123124
123203
  if (ended === "settled" && o.shownEnds?.() === false)
123125
123204
  ended = null;
@@ -123398,7 +123477,7 @@ ${screenTailOf(this.screen)}` });
123398
123477
  const shape = sendShape("submit", line);
123399
123478
  this.rememberCopy(line, { kind: "command", name: line.slice(1), line }, mark);
123400
123479
  const gen = this.unreadCopyGen;
123401
- const r = await c.request({ ...shape.msg, readyTimeoutMs: rt }, sendBudgetMs({ ...shape.budget, readyTimeoutMs: rt }) + SEND_CLIENT_SLACK_MS2);
123480
+ const r = await this.writeInput(c, { ...shape.msg, readyTimeoutMs: rt }, sendBudgetMs({ ...shape.budget, readyTimeoutMs: rt }) + SEND_CLIENT_SLACK_MS2);
123402
123481
  const out = classifySendReply(r);
123403
123482
  const s = this.noteLastSend(out, 1);
123404
123483
  const own = this.unreadCopy !== null && this.unreadCopyGen === gen;
@@ -123463,11 +123542,47 @@ ${screenTailOf(this.screen)}` });
123463
123542
  keysWithheld() {
123464
123543
  return this.unreadCopy !== null && !this.unreadCopyReadWhole;
123465
123544
  }
123545
+ async writeInput(c, msg, ms) {
123546
+ const seq = ++this.inputSeq;
123547
+ this.inputsInFlight++;
123548
+ let reply;
123549
+ try {
123550
+ reply = await c.request(msg, ms);
123551
+ return reply;
123552
+ } finally {
123553
+ this.inputsInFlight--;
123554
+ this.lastInputAt = Date.now();
123555
+ if (reply)
123556
+ this.noteInputReply(c, seq, reply);
123557
+ }
123558
+ }
123559
+ noteInputReply(c, seq, r) {
123560
+ if (!r.ok && LOST_REPLY_CODES.has(r.code)) {
123561
+ if ((this.answeredInputs.get(c) ?? 0) > seq)
123562
+ return;
123563
+ this.lostInputs.set(c, Math.max(this.lostInputs.get(c) ?? 0, seq));
123564
+ return;
123565
+ }
123566
+ if (!r.ok && UNANSWERED_CODES.has(r.code))
123567
+ return;
123568
+ this.answeredInputs.set(c, Math.max(this.answeredInputs.get(c) ?? 0, seq));
123569
+ const lost = this.lostInputs.get(c);
123570
+ if (lost !== undefined && lost < seq)
123571
+ this.lostInputs.delete(c);
123572
+ }
123573
+ inputReplyLost() {
123574
+ return this.lostInputs.size > 0;
123575
+ }
123576
+ boxUnchangedSince(at) {
123577
+ if (this.inputsInFlight > 0 || this.trustedFramesFrom === null)
123578
+ return at;
123579
+ return Math.min(at, Math.max(this.screen.boxChangedAt, this.trustedFramesFrom, this.lastInputAt));
123580
+ }
123466
123581
  async keys(ks) {
123467
123582
  const c = this.client;
123468
123583
  if (!c)
123469
123584
  return false;
123470
- const r = await c.request({ type: "send", pane: 0, keys: ks, enter: false, noGate: true }, 1e4);
123585
+ const r = await this.writeInput(c, { type: "send", pane: 0, keys: ks, enter: false, noGate: true }, 1e4);
123471
123586
  return r.ok;
123472
123587
  }
123473
123588
  nextFrame(ms) {
@@ -124297,7 +124412,7 @@ ${screenTailOf(this.screen)}`
124297
124412
  if (!p)
124298
124413
  return 0;
124299
124414
  try {
124300
- return statSync25(p).size;
124415
+ return statSync26(p).size;
124301
124416
  } catch {
124302
124417
  return 0;
124303
124418
  }
@@ -124621,7 +124736,7 @@ ${screenTailOf(this.screen)}`
124621
124736
  this.scrollPos = plan.next;
124622
124737
  const seq0 = this.screen.seq;
124623
124738
  this.extendResizeQuiet();
124624
- const r = await c.request({ type: "send", pane: 0, text: plan.bytes, enter: false, noGate: true }, SCROLL_REPLY_MS);
124739
+ const r = await this.writeInput(c, { type: "send", pane: 0, text: plan.bytes, enter: false, noGate: true }, SCROLL_REPLY_MS);
124625
124740
  if (!r.ok) {
124626
124741
  this.scrollPos = UNKNOWN_POSITION;
124627
124742
  if (r.code === "client_lost" || r.code === "client_timeout")
@@ -124664,7 +124779,7 @@ ${screenTailOf(this.screen)}`
124664
124779
  this.extendResizeQuiet();
124665
124780
  this.scrollEndsInFlight++;
124666
124781
  try {
124667
- const r = await c.request({ type: "send", pane: 0, text: CTRL_END, enter: false, noGate: true }, Math.min(SCROLL_REPLY_MS, ms));
124782
+ const r = await this.writeInput(c, { type: "send", pane: 0, text: CTRL_END, enter: false, noGate: true }, Math.min(SCROLL_REPLY_MS, ms));
124668
124783
  if (r.ok) {
124669
124784
  this.scrollEndConfirmedAt = Date.now();
124670
124785
  } else {
@@ -125147,7 +125262,7 @@ async function startPaneSession(o) {
125147
125262
  await session.start({ magmuxBinary: magmux.binary, env: p.magmuxEnv, cwd: p.cwd });
125148
125263
  return session;
125149
125264
  }
125150
- var BOOT_TIMEOUT_MS = 90000, ADMIT_TIMEOUT_MS = 30000, UNPROVEN_RECORD_WAIT_MS = 120000, DEGRADED_ENTRY_MS = 1e4, SCREEN_SETTLE_QUIET_MS = 3000, PANEL_SETTLE_MS = 500, SEND_CLIENT_SLACK_MS2 = 2000, MIN_READY_TIMEOUT_MS = 1000, ENTER_MIN_READY_TIMEOUT_MS = 250, BUSY_RETRY_MS = 250, CLEAR_WAIT_MS = 1000, DRAW_SETTLE_MS = 2000, BOOT_STATIC_MS = 5000, TICK_MS2 = 250, WATCH_FPS2 = 4, POLL_BACKSTOP_MS = 1000, TURN_END_MISSING_FACTOR = 3, RESIZE_REPLY_MS = 1e4, RESIZE_SCREEN_MS = 1000, SCROLL_REPLY_MS = 5000, SCROLL_SCREEN_MS = 1000, GATE_POLL_MS = 250, GATE_REPLY_MS = 1000, GATE_STALE_MS2 = 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_CONSECUTIVE2 = 3, EVENT_REASON, VERDICT_EVENT, EARLIER_COPY_SEEN, PaneStartError;
125265
+ var BOOT_TIMEOUT_MS = 90000, ADMIT_TIMEOUT_MS = 30000, UNPROVEN_RECORD_WAIT_MS = 120000, DEGRADED_ENTRY_MS = 1e4, SCREEN_SETTLE_QUIET_MS = 3000, PANEL_SETTLE_MS = 500, SEND_CLIENT_SLACK_MS2 = 2000, LOST_REPLY_CODES, UNANSWERED_CODES, MIN_READY_TIMEOUT_MS = 1000, ENTER_MIN_READY_TIMEOUT_MS = 250, BUSY_RETRY_MS = 250, CLEAR_WAIT_MS = 1000, DRAW_SETTLE_MS = 2000, BOOT_STATIC_MS = 5000, TICK_MS2 = 250, WATCH_FPS2 = 4, POLL_BACKSTOP_MS = 1000, TURN_END_MISSING_FACTOR = 3, RESIZE_REPLY_MS = 1e4, RESIZE_SCREEN_MS = 1000, SCROLL_REPLY_MS = 5000, SCROLL_SCREEN_MS = 1000, GATE_POLL_MS = 250, GATE_REPLY_MS = 1000, GATE_STALE_MS2 = 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_CONSECUTIVE2 = 3, EVENT_REASON, VERDICT_EVENT, EARLIER_COPY_SEEN, PaneStartError;
125151
125266
  var init_pane_session = __esm(() => {
125152
125267
  init_claude_code_facts();
125153
125268
  init_queue();
@@ -125173,6 +125288,12 @@ var init_pane_session = __esm(() => {
125173
125288
  init_slot_state();
125174
125289
  init_transcript_follower();
125175
125290
  init_view_socket();
125291
+ LOST_REPLY_CODES = new Set(["client_timeout", "client_lost", "timeout"]);
125292
+ UNANSWERED_CODES = new Set([
125293
+ "client_closed",
125294
+ "no_client",
125295
+ "bad_request"
125296
+ ]);
125176
125297
  GATE_GRACE_MS = SECONDARY_QUIET_MS;
125177
125298
  GATE_KINDLESS_REASONS = new Set([
125178
125299
  "starting",
@@ -126245,7 +126366,7 @@ var init_transcript_redaction = __esm(() => {
126245
126366
 
126246
126367
  // src/pane/transcript-page.ts
126247
126368
  import {
126248
- constants as constants5,
126369
+ constants as constants6,
126249
126370
  closeSync as closeSync18,
126250
126371
  fstatSync as fstatSync5,
126251
126372
  lstatSync as lstatSync10,
@@ -126254,7 +126375,7 @@ import {
126254
126375
  readdirSync as readdirSync15,
126255
126376
  readlinkSync,
126256
126377
  realpathSync as realpathSync10,
126257
- statSync as statSync26
126378
+ statSync as statSync27
126258
126379
  } from "fs";
126259
126380
  import { basename as basename10, dirname as dirname26, join as join68, sep as sep3 } from "path";
126260
126381
  function isUuid(v) {
@@ -126408,7 +126529,7 @@ function locateTranscriptByUuid(projectsRoot, uuid) {
126408
126529
  for (const d of dirs) {
126409
126530
  const p = join68(projectsRoot, d, `${uuid}.jsonl`);
126410
126531
  try {
126411
- if (!statSync26(p).isFile())
126532
+ if (!statSync27(p).isFile())
126412
126533
  continue;
126413
126534
  } catch {
126414
126535
  continue;
@@ -126436,7 +126557,7 @@ function writerLiveness(pid) {
126436
126557
  }
126437
126558
  function fileAgeMs(path, now = Date.now()) {
126438
126559
  try {
126439
- return now - statSync26(path).mtimeMs;
126560
+ return now - statSync27(path).mtimeMs;
126440
126561
  } catch {
126441
126562
  return null;
126442
126563
  }
@@ -126611,7 +126732,7 @@ var init_transcript_page = __esm(() => {
126611
126732
  maxEntryBytes: 32 * 1024 * 1024
126612
126733
  };
126613
126734
  READ_CHUNK = 1024 * 1024;
126614
- OPEN_FLAGS = constants5.O_RDONLY | (constants5.O_NOFOLLOW ?? 0) | (constants5.O_NONBLOCK ?? 0);
126735
+ OPEN_FLAGS = constants6.O_RDONLY | (constants6.O_NOFOLLOW ?? 0) | (constants6.O_NONBLOCK ?? 0);
126615
126736
  loggedRejections = new Set;
126616
126737
  HEAD_CWD_MAX_BYTES = 256 * 1024;
126617
126738
  });
@@ -126641,7 +126762,7 @@ var init_pane = __esm(() => {
126641
126762
  });
126642
126763
 
126643
126764
  // src/view/kernel-lock.ts
126644
- import { constants as constants6, closeSync as closeSync19, fstatSync as fstatSync6, openSync as openSync19, statSync as statSync27, unlinkSync as unlinkSync13 } from "fs";
126765
+ import { constants as constants7, closeSync as closeSync19, fstatSync as fstatSync6, openSync as openSync19, statSync as statSync28, unlinkSync as unlinkSync13 } from "fs";
126645
126766
  function bindFlock() {
126646
126767
  const library = process.platform === "darwin" ? "libSystem.B.dylib" : process.platform === "linux" ? "libc.so.6" : null;
126647
126768
  if (!library)
@@ -126694,7 +126815,7 @@ function tryAcquire(path) {
126694
126815
  if (!lib)
126695
126816
  throw new KernelLockUnavailable("flock is not available in this process");
126696
126817
  for (let attempt = 0;attempt < 5; attempt++) {
126697
- const fd = openSync19(path, constants6.O_RDWR | constants6.O_CREAT | O_CLOEXEC, 384);
126818
+ const fd = openSync19(path, constants7.O_RDWR | constants7.O_CREAT | O_CLOEXEC, 384);
126698
126819
  if (lib.flock(fd, LOCK_EX | LOCK_NB) !== 0) {
126699
126820
  const errno = lib.errno();
126700
126821
  closeSync19(fd);
@@ -126704,7 +126825,7 @@ function tryAcquire(path) {
126704
126825
  }
126705
126826
  let same = false;
126706
126827
  try {
126707
- same = fstatSync6(fd).ino === statSync27(path).ino;
126828
+ same = fstatSync6(fd).ino === statSync28(path).ino;
126708
126829
  } catch {
126709
126830
  same = false;
126710
126831
  }
@@ -127065,7 +127186,7 @@ var init_replay_registry = __esm(() => {
127065
127186
 
127066
127187
  // src/mcp-session/replay-manager.ts
127067
127188
  import { randomBytes as randomBytes19, randomUUID as randomUUID10 } from "crypto";
127068
- import { constants as constants7, accessSync as accessSync3, closeSync as closeSync20, existsSync as existsSync44, realpathSync as realpathSync11, statSync as statSync28 } from "fs";
127189
+ import { constants as constants8, accessSync as accessSync4, closeSync as closeSync20, existsSync as existsSync44, realpathSync as realpathSync11, statSync as statSync29 } from "fs";
127069
127190
  import { dirname as dirname27, resolve as resolve11 } from "path";
127070
127191
  function unavailable2(reason, message) {
127071
127192
  return new ContractErrorException("replay_unavailable", message, reason);
@@ -127079,7 +127200,7 @@ function elsewhere(endpoint, replayId) {
127079
127200
  function replayCwd(own) {
127080
127201
  if (own) {
127081
127202
  try {
127082
- if (statSync28(own).isDirectory())
127203
+ if (statSync29(own).isDirectory())
127083
127204
  return realpathSync11(own);
127084
127205
  } catch {}
127085
127206
  }
@@ -127089,9 +127210,9 @@ async function replayClaudeBinary(env) {
127089
127210
  const named = env.CLAUDE_PATH ? resolve11(env.CLAUDE_PATH) : "";
127090
127211
  if (named) {
127091
127212
  try {
127092
- if (!statSync28(named).isFile())
127213
+ if (!statSync29(named).isFile())
127093
127214
  throw new Error("not a file");
127094
- accessSync3(named, constants7.X_OK);
127215
+ accessSync4(named, constants8.X_OK);
127095
127216
  } catch {
127096
127217
  throw new Error(`CLAUDE_PATH ${named} is not an executable file`);
127097
127218
  }
@@ -127107,7 +127228,7 @@ function callerOf(opener) {
127107
127228
  }
127108
127229
  function isRecordGone(path) {
127109
127230
  try {
127110
- statSync28(path);
127231
+ statSync29(path);
127111
127232
  return false;
127112
127233
  } catch (e) {
127113
127234
  return e.code === "ENOENT";
@@ -132138,7 +132259,7 @@ var init_serve_command = __esm(() => {
132138
132259
  var HOOKS_AMBIENT_DTS = '// claudish hook types \u2014 written by `claudish hooks init`. Do not edit: run\n// `claudish hooks init` from a newer claudish to refresh it.\n// With this file beside your hook, `import type { HookDefinition } from\n// "claudish/hooks"` type-checks with nothing installed.\ndeclare module "claudish/hooks" {\n /**\n * claudish/hooks \u2014 the public hook contract.\n *\n * Everything a hook author can import lives here, and nothing else does. This\n * file imports nothing from the rest of claudish and has no side effects, so it\n * can be built on its own into `dist/hooks.js` + `dist/hooks.d.ts` and served to\n * user modules as the `claudish/hooks` virtual module (see `loader.ts`).\n *\n * Every internal hooks module takes its types from here, so the contract has a\n * single source.\n *\n * ## Process isolation\n *\n * A hook module\'s top-level state is PER PROCESS. In the interactive launcher,\n * proxy events (`request` \u2026 `responseEnd`, raw) and session events\n * (`sessionStart` \u2026 `sessionEnd`) run in one process. In `create_session` and\n * team children they do not: proxy events run in the pane child, and session\n * events run in the MCP server or the CLI process that drives the pane. Pass\n * per-turn data from a proxy event to `sessionIdle` with `annotateTurn`, never\n * with module variables.\n *\n * ## Execution: a hook chain\n *\n * The hooks of one event run one after another, in effective order. Each hook\'s\n * actions are applied before the next hook is called, so `ctx.request`,\n * `ctx.tool.args` and `ctx.response` show what the earlier hooks did, and\n * `ctx.prior` lists it. A warn-severity or failing hook changes nothing for the\n * next one. Each event has a budget for all its hooks together; a hook\'s timeout\n * is cut to what is left of it.\n *\n * ## Output\n *\n * Log with `ctx.log`. `console.*` and `process.stdout`/`stderr` writes made by a\n * hook are routed to claudish\'s debug log, never to the terminal or the MCP\n * protocol stream.\n */\n export const HOOK_API_VERSION = 1;\n export type Severity = "off" | "warn" | "fix";\n export type HookOrder = "pre" | "normal" | "post";\n /** native = RouteInfo.native true; foreign = RouteInfo.native false; all = both */\n export type RouteScope = "foreign" | "native" | "all";\n export type HostMode = "interactive" | "pane-child" | "serve" | "mcp" | "other";\n export type JsonValue = string | number | boolean | null | ReadonlyArray<JsonValue> | {\n readonly [k: string]: JsonValue;\n };\n export interface HarnessFacts {\n readonly planModeActive: boolean;\n readonly planFilePath?: string;\n readonly planDir?: string;\n /** Claude Code session id from request metadata */\n readonly sessionId?: string;\n /** empty = no listing found, not "no skills" */\n readonly skills?: ReadonlyArray<{\n name: string;\n description: string;\n }>;\n }\n export interface RouteInfo {\n /** bare model name the handler serves, e.g. "glm-5" */\n readonly modelId: string;\n /** claudish provider name, e.g. "openrouter"; "anthropic" for native */\n readonly provider: string;\n /**\n * true when the request is served by the native Anthropic handler, OR when\n * !forceForeignModel && (/^claude[-.]/i.test(modelId) || provider === "anthropic")\n * where forceForeignModel is the provider profile\'s opt-in override. This is the exact\n * rule the plan-mode built-in has always used (a claude-* uid on an aggregator that sets\n * forceForeignModel is foreign).\n */\n readonly native: boolean;\n }\n export interface ClaudeTool {\n name: string;\n description?: string;\n input_schema?: unknown;\n }\n /** A Claude-format content block. Only `text` blocks are editable by closed actions. */\n export type ClaudeContentBlock = {\n type: "text";\n text: string;\n } | {\n type: "tool_use";\n id: string;\n name: string;\n input: unknown;\n } | {\n type: "tool_result";\n tool_use_id: string;\n content?: unknown;\n is_error?: boolean;\n } | {\n type: "thinking";\n thinking: string;\n signature?: string;\n } | {\n type: string;\n [k: string]: unknown;\n };\n export interface ClaudeMessage {\n role: "user" | "assistant";\n content: string | ReadonlyArray<ClaudeContentBlock>;\n }\n /**\n * In `request`, the request as the earlier steps of the hook chain left it. On\n * the response side and in `claims()`, the request chain\'s final view.\n */\n export interface RequestFacts {\n /** as Claude Code asked for it; frozen */\n readonly model: string;\n /** frozen */\n readonly stream: boolean;\n /** system prompt flattened to text, after earlier steps */\n readonly systemText: string;\n /** read-only view after earlier steps; change it through actions */\n readonly messages: ReadonlyArray<ClaudeMessage>;\n /**\n * read-only view after earlier steps; `description` includes earlier description actions as\n * stage B will apply them to the Claude-format tool (the provider copy may be summarised)\n */\n readonly tools: ReadonlyArray<ClaudeTool>;\n }\n /** Which session a proxy event belongs to, when claudish knows. */\n export interface ProxySessionRef {\n readonly kind: SessionKind;\n readonly id: string;\n readonly role: "slot" | "judge" | null;\n }\n /** One action an earlier step of this hook chain applied or handed on. */\n export interface PriorAction {\n readonly hookId: string;\n readonly action: HookAction;\n }\n interface BaseContext {\n readonly hookId: string;\n /** "warn" or "fix" (an "off" hook is never called) */\n readonly severity: Severity;\n /** writes to claudish\'s debug log; never to the terminal */\n log(message: string): void;\n /**\n * this step\'s own signal: aborted when its step timeout elapses (its own timeout, or the\n * event budget left, whichever is shorter) or when the dispatch is aborted. Never shared\n * with another hook\'s step.\n */\n readonly signal: AbortSignal;\n /**\n * actions earlier steps of this hook chain applied (or, for responseEnd/sessionStart/\n * sessionIdle, handed on), in order. Empty for the first step and in claims()/the toolCall\n * predicate. Never lists warn actions or anything a warn-severity hook returned.\n */\n readonly prior: ReadonlyArray<PriorAction>;\n }\n export interface ProxyContext extends BaseContext {\n readonly host: {\n mode: HostMode;\n };\n readonly route: RouteInfo;\n readonly request: RequestFacts;\n readonly harness: HarnessFacts;\n readonly session: ProxySessionRef | null;\n }\n export interface RequestContext extends ProxyContext {\n readonly event: "request";\n }\n export interface ToolCallContext extends ProxyContext {\n readonly event: "toolCall";\n readonly tool: {\n id: string;\n name: string;\n /** the arguments after every repair earlier hooks in the chain applied */\n args: Readonly<Record<string, unknown>>;\n /** the argument JSON exactly as the model produced it; never rewritten */\n rawArgs: string;\n };\n }\n export type ResponseBlock = {\n type: "text";\n text: string;\n } | {\n type: "thinking";\n thinking: string;\n } | {\n type: "tool_use";\n id: string;\n name: string;\n input: unknown;\n } | {\n type: "other";\n blockType: string;\n };\n export interface ResponseView {\n blocks: ReadonlyArray<ResponseBlock>;\n /** every text block, joined with "\\n\\n" */\n text: string;\n /** every thinking block, joined with "\\n\\n" */\n reasoning: string;\n toolNames: ReadonlyArray<string>;\n /** "tool_use" = an intermediate step of a tool loop; the turn continues after the tool runs */\n stopReason: string | null;\n }\n /** response = the held response after every text action earlier hooks in the chain applied */\n export interface ResponseRewriteContext extends ProxyContext {\n readonly event: "responseRewrite";\n readonly response: ResponseView;\n }\n /** response = the final bytes the client received: after any rewrite AND any raw `response` replacement */\n export interface ResponseEndContext extends ProxyContext {\n readonly event: "responseEnd";\n readonly response: ResponseView;\n }\n export type SessionKind = "interactive" | "channel" | "team";\n export interface SessionInfo {\n kind: SessionKind;\n /** team only; null otherwise */\n role: "slot" | "judge" | null;\n /** channel: the 8-hex session_id \xB7 team: "<run_id>:<slot id>" \xB7 interactive: the Claude Code session id */\n id: string;\n claudeSessionId: string | null;\n /** as the caller asked for it */\n model: string;\n cwd: string;\n /** a one-shot session stays "one-shot" through a hook-extended turn chain */\n shape: "interactive" | "one-shot";\n injection: "available" | "unavailable";\n }\n export interface SessionStartContext extends BaseContext {\n readonly event: "sessionStart";\n readonly session: SessionInfo;\n }\n export interface TurnAnnotation {\n hookId: string;\n key: string;\n value: JsonValue;\n }\n export interface SessionIdleContext extends BaseContext {\n readonly event: "sessionIdle";\n readonly session: SessionInfo;\n readonly turn: {\n /** 1-based within the session; a re-woken turn keeps its index */\n index: number;\n /** this turn\'s assistant text */\n answer: string;\n stopReason: string | null;\n apiError: boolean;\n /** this turn was started by an injection */\n hookCaused: boolean;\n /** annotateTurn actions from this turn\'s responses, in arrival order */\n annotations: ReadonlyArray<TurnAnnotation>;\n };\n readonly consecutiveHookTurns: number;\n /** caller/human input is queued; an injection returned now will be dropped as stale */\n readonly callerInputPending: boolean;\n }\n export interface SessionBlockedContext extends BaseContext {\n readonly event: "sessionBlocked";\n readonly session: SessionInfo;\n readonly block: {\n kind: "question" | "permission";\n text: string;\n };\n }\n export interface SessionEndContext extends BaseContext {\n readonly event: "sessionEnd";\n readonly session: SessionInfo;\n readonly outcome: {\n state: string;\n reason: string | null;\n exitCode: number | null;\n };\n }\n type TextMatch = {\n find: string;\n regex?: boolean;\n flags?: string;\n };\n /** default ["user"] */\n type MessageRoles = {\n roles?: ReadonlyArray<"user" | "assistant">;\n };\n export type InjectSystemNote = {\n type: "injectSystemNote";\n text: string;\n };\n export type AppendUserText = {\n type: "appendUserText";\n text: string;\n };\n export type ReplaceMessageText = {\n type: "replaceMessageText";\n replace: string;\n } & TextMatch & MessageRoles;\n export type RemoveMessageText = {\n type: "removeMessageText";\n } & TextMatch & MessageRoles;\n export type RewriteToolDescription = {\n type: "rewriteToolDescription";\n tool: string;\n append: string;\n };\n export type ReplaceToolDescription = {\n type: "replaceToolDescription";\n tool: string;\n description: string;\n };\n export type ReplaceToolSchema = {\n type: "replaceToolSchema";\n tool: string;\n inputSchema: {\n type: "object";\n [k: string]: unknown;\n };\n };\n export type RemoveTool = {\n type: "removeTool";\n tool: string;\n };\n export type RepairToolArgs = {\n type: "repairToolArgs";\n args: Record<string, unknown>;\n reason: string;\n };\n export type AppendText = {\n type: "appendText";\n text: string;\n };\n export type PrependText = {\n type: "prependText";\n text: string;\n };\n export type ReplaceText = {\n type: "replaceText";\n replace: string;\n } & TextMatch;\n export type RemoveText = {\n type: "removeText";\n } & TextMatch;\n export type InjectUserTurn = {\n type: "injectUserTurn";\n text: string;\n };\n export type AnnotateTurn = {\n type: "annotateTurn";\n key: string;\n value: JsonValue;\n };\n export type Warn = {\n type: "warn";\n message: string;\n };\n export type RequestAction = InjectSystemNote | AppendUserText | ReplaceMessageText | RemoveMessageText | RewriteToolDescription | ReplaceToolDescription | ReplaceToolSchema | RemoveTool | Warn;\n export type ToolCallAction = RepairToolArgs | Warn;\n export type RewriteAction = AppendText | PrependText | ReplaceText | RemoveText | Warn;\n export type ResponseEndAction = InjectSystemNote | InjectUserTurn | AnnotateTurn | Warn;\n export type SessionAction = InjectUserTurn | Warn;\n export type ObserveAction = Warn;\n export type HookAction = RequestAction | ToolCallAction | RewriteAction | ResponseEndAction | SessionAction;\n export type HookResult<A> = A[] | void | Promise<A[] | void>;\n export interface HookHandlers {\n request?(ctx: RequestContext): HookResult<RequestAction>;\n toolCall?: {\n /** tool names whose completed arguments this hook sees; "*" = every tool (costs streaming of all tool input) */\n tools: ReadonlyArray<string>;\n /** synchronous, per request; default true. false = not armed for this request */\n armed?(ctx: RequestContext): boolean;\n /** true = see the call after it was forwarded; can only warn; never holds the stream */\n observe?: boolean;\n handle(ctx: ToolCallContext): HookResult<ToolCallAction>;\n };\n responseRewrite?: {\n /** synchronous, per request, evaluated before the response starts; default true */\n claims?(ctx: RequestContext): boolean;\n handle(ctx: ResponseRewriteContext): HookResult<RewriteAction>;\n };\n responseEnd?(ctx: ResponseEndContext): HookResult<ResponseEndAction>;\n sessionStart?(ctx: SessionStartContext): HookResult<SessionAction>;\n sessionIdle?(ctx: SessionIdleContext): HookResult<SessionAction>;\n sessionBlocked?(ctx: SessionBlockedContext): HookResult<ObserveAction>;\n sessionEnd?(ctx: SessionEndContext): HookResult<ObserveAction>;\n }\n export interface RawProviderRequestContext {\n readonly hookId: string;\n readonly route: RouteInfo;\n claudeRequest: any;\n messages: any[];\n tools: any[];\n }\n export interface RawProviderChunkContext {\n readonly hookId: string;\n readonly route: RouteInfo;\n /** A clone of the parsed provider event. Whatever this field holds when the call returns is\n * what the parser reads from then on, so it may be edited in place or replaced. */\n chunk: any;\n /** The delta object inside `chunk` at call time (Responses wire: `chunk` itself). Edit it in\n * place; assigning a new object to this field has no effect. */\n delta: any;\n /** per-stream, shared across this hook\'s chunk calls; never cloned */\n metadata: Map<string, unknown>;\n }\n export interface RawProviderStreamEndContext {\n readonly hookId: string;\n readonly route: RouteInfo;\n metadata: Map<string, unknown>;\n }\n export interface RawResponseContext {\n readonly hookId: string;\n readonly route: RouteInfo;\n readonly request: RequestFacts;\n /** A replay of the current Claude-format response (SSE, or JSON for stream:false), read at the\n * hook\'s own pace. claudish drains the original itself, so leaving this unread delays nothing. */\n response: Response;\n }\n export interface RawMiddleware {\n /**\n * Receives clones. They replace the live request only when this call returns (or its promise\n * resolves) within its timeout. A throw, a rejection or a timeout discards every change.\n */\n providerRequest?(ctx: RawProviderRequestContext): void | Promise<void>;\n /**\n * MUST be synchronous. Called on the parser\'s loop, on a clone of the chunk. On a normal return\n * of anything but a thenable, the clone (whatever `ctx.chunk` holds then) is committed: it\n * becomes the object the parser reads, deletions included. On a throw nothing is committed.\n * A declared `async` function is rejected at load. Any other thenable return is an invalid\n * invocation: the clone is discarded even if the hook mutated it before returning, the call is\n * journaled `invalid` (`async_return`) and counts toward the circuit breaker, and a rejection\n * handler is attached, so a rejection is journaled `error` and never becomes an\n * unhandledRejection.\n */\n providerChunk?(ctx: RawProviderChunkContext): void;\n providerStreamEnd?(ctx: RawProviderStreamEndContext): void | Promise<void>;\n /**\n * Return a replacement Response, or nothing to keep the current one. A replacement is read\n * whole and forwarded only when it completes cleanly; on any failure the original is forwarded.\n * The client never sees a partial replacement. A replacement must close within this hook\'s\n * timeout after the later of this call\'s return and the end of the original; the original\'s end\n * never depends on whether `ctx.response` is read.\n */\n response?(ctx: RawResponseContext): Response | void | Promise<Response | void>;\n }\n interface HookBase {\n apiVersion: 1;\n id: string;\n description?: string;\n /** default "fix" for user hooks */\n defaultSeverity?: Severity;\n /** default "normal" */\n order?: HookOrder;\n /** globs on RouteInfo.modelId; default "*"; proxy events only */\n models?: string | ReadonlyArray<string>;\n /** default "all"; proxy events only */\n routes?: RouteScope;\n /** per call; clamped to the event\'s maximum and to the event budget left when the hook\'s turn comes */\n timeoutMs?: number;\n on?: HookHandlers;\n }\n export interface SafeHook extends HookBase {\n unsafe?: never;\n raw?: never;\n }\n export interface UnsafeHook extends HookBase {\n unsafe: true;\n raw: RawMiddleware;\n }\n /**\n * One hook. Module-level state is per process: in `create_session` and team\n * children, proxy events run in the pane child and session events in the MCP\n * server or CLI process. Pass per-turn data from proxy events to `sessionIdle`\n * with `annotateTurn`, never with module variables.\n */\n export type HookDefinition = SafeHook | UnsafeHook;\n /** Identity function: gives editor type-checking and inference. */\n export function defineHook<const H extends HookDefinition>(hook: H): H;\n /** Action constructors (plain data; equivalent to writing the object literal). */\n export const act: {\n injectSystemNote(text: string): InjectSystemNote;\n appendUserText(text: string): AppendUserText;\n replaceMessageText(find: string, replace: string, opts?: {\n regex?: boolean;\n flags?: string;\n roles?: ReadonlyArray<"user" | "assistant">;\n }): ReplaceMessageText;\n removeMessageText(find: string, opts?: {\n regex?: boolean;\n flags?: string;\n roles?: ReadonlyArray<"user" | "assistant">;\n }): RemoveMessageText;\n rewriteToolDescription(tool: string, append: string): RewriteToolDescription;\n replaceToolDescription(tool: string, description: string): ReplaceToolDescription;\n replaceToolSchema(tool: string, inputSchema: {\n type: "object";\n [k: string]: unknown;\n }): ReplaceToolSchema;\n removeTool(tool: string): RemoveTool;\n repairToolArgs(args: Record<string, unknown>, reason: string): RepairToolArgs;\n appendText(text: string): AppendText;\n prependText(text: string): PrependText;\n replaceText(find: string, replace: string, opts?: {\n regex?: boolean;\n flags?: string;\n }): ReplaceText;\n removeText(find: string, opts?: {\n regex?: boolean;\n flags?: string;\n }): RemoveText;\n injectUserTurn(text: string): InjectUserTurn;\n annotateTurn(key: string, value: JsonValue): AnnotateTurn;\n warn(message: string): Warn;\n };\n}\n';
132139
132260
 
132140
132261
  // src/hooks/observer/corpus.ts
132141
- import { appendFileSync as appendFileSync8, readFileSync as readFileSync55, readdirSync as readdirSync18, statSync as statSync29 } from "fs";
132262
+ import { appendFileSync as appendFileSync8, readFileSync as readFileSync55, readdirSync as readdirSync18, statSync as statSync30 } from "fs";
132142
132263
  import { homedir as homedir43 } from "os";
132143
132264
  import { join as join72 } from "path";
132144
132265
  function directoryOf2(filePath) {
@@ -132221,7 +132342,7 @@ function listTranscripts(root) {
132221
132342
  for (const project of projects) {
132222
132343
  const dir = join72(root, project);
132223
132344
  try {
132224
- if (!statSync29(dir).isDirectory())
132345
+ if (!statSync30(dir).isDirectory())
132225
132346
  continue;
132226
132347
  for (const f of readdirSync18(dir)) {
132227
132348
  if (f.endsWith(".jsonl"))
@@ -134635,7 +134756,7 @@ var init_view_cli = __esm(() => {
134635
134756
 
134636
134757
  // src/herdr/herdr-cli.ts
134637
134758
  import { spawnSync as spawnSync3 } from "child_process";
134638
- import { copyFileSync as copyFileSync3, existsSync as existsSync49, mkdirSync as mkdirSync30, readdirSync as readdirSync19, renameSync as renameSync14, statSync as statSync30 } from "fs";
134759
+ import { copyFileSync as copyFileSync3, existsSync as existsSync49, mkdirSync as mkdirSync30, readdirSync as readdirSync19, renameSync as renameSync14, statSync as statSync31 } from "fs";
134639
134760
  import { homedir as homedir45 } from "os";
134640
134761
  import { dirname as dirname29, join as join76, resolve as resolve14 } from "path";
134641
134762
  function spawnHerdrApp(args) {
@@ -134701,11 +134822,11 @@ function isModFile(name) {
134701
134822
  function installAppMod(source, appHome) {
134702
134823
  if (!existsSync49(join76(source, "main.js")) || !existsSync49(join76(source, "mod.json")))
134703
134824
  throw new Error(`${source} holds no built mod (main.js and mod.json); run \`bun run build\``);
134704
- if (!existsSync49(appHome) || !statSync30(appHome).isDirectory())
134825
+ if (!existsSync49(appHome) || !statSync31(appHome).isDirectory())
134705
134826
  throw new Error(`${appHome} does not exist: start Herdr.app once so it creates its home, then run this again`);
134706
134827
  const dest = join76(appHome, "mods", APP_MOD_NAME);
134707
134828
  mkdirSync30(dest, { recursive: true });
134708
- const files = readdirSync19(source).filter((f) => isModFile(f) && statSync30(join76(source, f)).isFile());
134829
+ const files = readdirSync19(source).filter((f) => isModFile(f) && statSync31(join76(source, f)).isFile());
134709
134830
  files.sort((a, b) => a === "mod.json" ? -1 : b === "mod.json" ? 1 : a.localeCompare(b));
134710
134831
  for (const f of files) {
134711
134832
  const hidden = join76(dest, `.${f}.installing`);
@@ -137668,7 +137789,7 @@ var init_quota_command = __esm(() => {
137668
137789
  });
137669
137790
 
137670
137791
  // src/update-command.ts
137671
- import { execSync as execSync2 } from "child_process";
137792
+ import { execSync } from "child_process";
137672
137793
  function refreshAnsi2() {
137673
137794
  ({ RESET, BOLD: BOLD2, GREEN, YELLOW, CYAN, RED: RED2, MAGENTA, DIM } = cliAnsi());
137674
137795
  }
@@ -137699,7 +137820,7 @@ function getUpdateCommand(method) {
137699
137820
  }
137700
137821
  async function executeUpdate(command) {
137701
137822
  try {
137702
- execSync2(command, {
137823
+ execSync(command, {
137703
137824
  stdio: "inherit",
137704
137825
  shell: process.platform === "win32" ? "cmd.exe" : "/bin/sh"
137705
137826
  });
@@ -137836,7 +137957,7 @@ ${BOLD2}Unable to detect installation method.${RESET}`);
137836
137957
  }
137837
137958
  function fetchLatestVersionViaNpm() {
137838
137959
  try {
137839
- const output = execSync2("npm view claudish version", {
137960
+ const output = execSync("npm view claudish version", {
137840
137961
  encoding: "utf-8",
137841
137962
  timeout: 20000,
137842
137963
  stdio: ["ignore", "pipe", "ignore"]
@@ -146469,7 +146590,7 @@ var init_advisor_startup = __esm(() => {
146469
146590
  });
146470
146591
 
146471
146592
  // src/session/conversation.ts
146472
- import { closeSync as closeSync21, openSync as openSync20, readSync as readSync10, statSync as statSync31 } from "fs";
146593
+ import { closeSync as closeSync21, openSync as openSync20, readSync as readSync10, statSync as statSync32 } from "fs";
146473
146594
  import { StringDecoder } from "string_decoder";
146474
146595
  function looksLikeTurn(line) {
146475
146596
  const assistant = line.includes('"type":"assistant"');
@@ -146524,7 +146645,7 @@ function readConversation(file, opts = {}) {
146524
146645
  };
146525
146646
  let fd = null;
146526
146647
  try {
146527
- const size = statSync31(file).size;
146648
+ const size = statSync32(file).size;
146528
146649
  fd = openSync20(file, "r");
146529
146650
  const buf = Buffer.allocUnsafe(chunkBytes);
146530
146651
  const decoder = new StringDecoder("utf-8");
@@ -148170,7 +148291,7 @@ import {
148170
148291
  realpathSync as realpathSync12,
148171
148292
  renameSync as renameSync15,
148172
148293
  rmSync as rmSync22,
148173
- statSync as statSync32,
148294
+ statSync as statSync33,
148174
148295
  unlinkSync as unlinkSync16,
148175
148296
  writeSync as writeSync8
148176
148297
  } from "fs";
@@ -148729,7 +148850,7 @@ var init_model_setting_restore = __esm(() => {
148729
148850
  realRestoreFs = {
148730
148851
  realpath: (path) => realpathSync12.native(path),
148731
148852
  readFile: (path) => readFileSync59(path),
148732
- stat: (path) => toFileStat(statSync32(path)),
148853
+ stat: (path) => toFileStat(statSync33(path)),
148733
148854
  writeNew: (path, data, mode) => {
148734
148855
  const fd = openSync21(path, "wx", mode);
148735
148856
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "14.29.0",
3
+ "version": "14.29.1",
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",
@@ -74,10 +74,10 @@
74
74
  "ai"
75
75
  ],
76
76
  "optionalDependencies": {
77
- "@claudish/magmux-darwin-arm64": "14.29.0",
78
- "@claudish/magmux-darwin-x64": "14.29.0",
79
- "@claudish/magmux-linux-arm64": "14.29.0",
80
- "@claudish/magmux-linux-x64": "14.29.0"
77
+ "@claudish/magmux-darwin-arm64": "14.29.1",
78
+ "@claudish/magmux-darwin-x64": "14.29.1",
79
+ "@claudish/magmux-linux-arm64": "14.29.1",
80
+ "@claudish/magmux-linux-x64": "14.29.1"
81
81
  },
82
82
  "author": "Jack Rudenko <i@madappgang.com>",
83
83
  "license": "MIT",