claudish 14.16.0 → 14.16.2

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 +140 -64
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -5491,7 +5491,7 @@ var init_onepassword_config = __esm(() => {
5491
5491
  });
5492
5492
 
5493
5493
  // src/version.ts
5494
- var VERSION = "14.16.0";
5494
+ var VERSION = "14.16.2";
5495
5495
 
5496
5496
  // src/redact.ts
5497
5497
  function isPlaceholder(value) {
@@ -12187,6 +12187,8 @@ function stripVendorPrefix(lowerId) {
12187
12187
  return lowerId.includes("/") ? lowerId.substring(lowerId.lastIndexOf("/") + 1) : lowerId;
12188
12188
  }
12189
12189
  function findCacheEntry(modelId, cachePath) {
12190
+ if (modelId.startsWith("@"))
12191
+ return;
12190
12192
  if (modelId.includes("@")) {
12191
12193
  throw new Error(`model-catalog lookup received provider-routed ID "${modelId}" \u2014 callers must strip the "@" prefix before calling`);
12192
12194
  }
@@ -53111,10 +53113,18 @@ function createAnthropicPassthroughStream(c, response, opts) {
53111
53113
  let pendingEventLine = null;
53112
53114
  let inputTokens = 0;
53113
53115
  let outputTokens = 0;
53116
+ let cacheReadTokens = 0;
53117
+ let cacheCreationTokens = 0;
53114
53118
  let stopReason = null;
53115
53119
  let sawMessageStart = false;
53116
53120
  let sawMessageStop = false;
53117
53121
  let openBlockIndex = null;
53122
+ const reportUsage = () => {
53123
+ opts.onTokenUpdate?.(inputTokens + cacheReadTokens + cacheCreationTokens, outputTokens, {
53124
+ cacheReadTokens,
53125
+ cacheCreationTokens
53126
+ });
53127
+ };
53118
53128
  const noteLifecycle = (data, emittedIndex) => {
53119
53129
  switch (data?.type) {
53120
53130
  case "message_start":
@@ -53191,10 +53201,10 @@ data: ${JSON.stringify(data)}
53191
53201
  } catch {}
53192
53202
  };
53193
53203
  const endCancelled = () => {
53194
- const sawUsage = inputTokens > 0 || outputTokens > 0;
53204
+ const sawUsage = inputTokens > 0 || outputTokens > 0 || cacheReadTokens > 0 || cacheCreationTokens > 0;
53195
53205
  log(`[AnthropicSSE] Client cancelled the stream for ${opts.modelName}; usage ${sawUsage ? "reported" : "not received, not recorded"}`);
53196
53206
  if (sawUsage)
53197
- opts.onTokenUpdate?.(inputTokens, outputTokens);
53207
+ reportUsage();
53198
53208
  if (pingInterval) {
53199
53209
  clearInterval(pingInterval);
53200
53210
  pingInterval = null;
@@ -53356,10 +53366,14 @@ data: ${JSON.stringify({
53356
53366
  if (data.message?.usage) {
53357
53367
  inputTokens = data.message.usage.input_tokens || inputTokens;
53358
53368
  outputTokens = data.message.usage.output_tokens || outputTokens;
53369
+ cacheReadTokens = data.message.usage.cache_read_input_tokens || cacheReadTokens;
53370
+ cacheCreationTokens = data.message.usage.cache_creation_input_tokens || cacheCreationTokens;
53359
53371
  }
53360
53372
  if (data.usage) {
53361
53373
  inputTokens = data.usage.input_tokens || inputTokens;
53362
53374
  outputTokens = data.usage.output_tokens || outputTokens;
53375
+ cacheReadTokens = data.usage.cache_read_input_tokens || cacheReadTokens;
53376
+ cacheCreationTokens = data.usage.cache_creation_input_tokens || cacheCreationTokens;
53363
53377
  }
53364
53378
  if (data.type === "content_block_delta" && data.delta?.type === "text_delta") {
53365
53379
  const txt = data.delta.text || "";
@@ -53398,10 +53412,14 @@ data: ${JSON.stringify({
53398
53412
  if (data.message?.usage) {
53399
53413
  inputTokens = data.message.usage.input_tokens || inputTokens;
53400
53414
  outputTokens = data.message.usage.output_tokens || outputTokens;
53415
+ cacheReadTokens = data.message.usage.cache_read_input_tokens || cacheReadTokens;
53416
+ cacheCreationTokens = data.message.usage.cache_creation_input_tokens || cacheCreationTokens;
53401
53417
  }
53402
53418
  if (data.usage) {
53403
53419
  inputTokens = data.usage.input_tokens || inputTokens;
53404
53420
  outputTokens = data.usage.output_tokens || outputTokens;
53421
+ cacheReadTokens = data.usage.cache_read_input_tokens || cacheReadTokens;
53422
+ cacheCreationTokens = data.usage.cache_creation_input_tokens || cacheCreationTokens;
53405
53423
  }
53406
53424
  if (data.type === "content_block_delta" && data.delta?.type === "text_delta") {
53407
53425
  textChunks++;
@@ -53423,9 +53441,7 @@ data: ${JSON.stringify({
53423
53441
  return;
53424
53442
  }
53425
53443
  log(`[AnthropicSSE] Stream complete for ${opts.modelName}: ${totalLines} lines, ${textChunks} text chunks, ${toolUseBlocks} tool_use blocks, stop_reason=${stopReason}${filterThinking ? `, filtered ${thinkingBlocksSuppressed} thinking blocks` : ""}`);
53426
- if (opts.onTokenUpdate) {
53427
- opts.onTokenUpdate(inputTokens, outputTokens);
53428
- }
53444
+ reportUsage();
53429
53445
  if (!isClosed) {
53430
53446
  isClosed = true;
53431
53447
  if (pingInterval) {
@@ -53442,7 +53458,7 @@ data: ${JSON.stringify({
53442
53458
  log(`[AnthropicSSE] Stream error: ${e}`);
53443
53459
  finalizeAbandonedStream(controller);
53444
53460
  try {
53445
- opts.onTokenUpdate?.(inputTokens, outputTokens);
53461
+ reportUsage();
53446
53462
  } catch {}
53447
53463
  if (!isClosed) {
53448
53464
  isClosed = true;
@@ -54617,6 +54633,13 @@ var init_stall_guard = __esm(() => {
54617
54633
  });
54618
54634
 
54619
54635
  // src/handlers/shared/stream-parsers/responses/responses-leg.ts
54636
+ function hasReplayableReasoning(item) {
54637
+ if (item?.type !== "reasoning")
54638
+ return false;
54639
+ if (item.encrypted_content)
54640
+ return true;
54641
+ return Array.isArray(item.content) && item.content.length > 0;
54642
+ }
54620
54643
  function readUsage(raw, prior, keepPrior = false) {
54621
54644
  if (!raw || typeof raw !== "object")
54622
54645
  return;
@@ -54945,7 +54968,7 @@ class ResponsesLeg {
54945
54968
  if (typeof item.phase === "string")
54946
54969
  message.phase = item.phase;
54947
54970
  this.items.push(message);
54948
- } else if (item?.type === "reasoning" && item.encrypted_content) {
54971
+ } else if (hasReplayableReasoning(item)) {
54949
54972
  this.items.push({
54950
54973
  type: "reasoning",
54951
54974
  content: item.content ?? [],
@@ -55040,7 +55063,7 @@ class ResponsesLeg {
55040
55063
  }
55041
55064
  onItemDone(event) {
55042
55065
  const item = event.item;
55043
- if (item?.type === "reasoning" && item.encrypted_content) {
55066
+ if (hasReplayableReasoning(item)) {
55044
55067
  this.pendingReasoning.push({
55045
55068
  type: "reasoning",
55046
55069
  content: item.content ?? [],
@@ -55655,8 +55678,9 @@ var init_token_file = __esm(() => {
55655
55678
  import { mkdirSync as mkdirSync16, writeFileSync as writeFileSync12 } from "fs";
55656
55679
  import { dirname as dirname13 } from "path";
55657
55680
  function stripProviderPrefix(name) {
55658
- const at = name.indexOf("@");
55659
- return at === -1 ? name : name.slice(at + 1);
55681
+ if (!hasProviderPrefix(name))
55682
+ return name;
55683
+ return name.slice(name.indexOf("@") + 1);
55660
55684
  }
55661
55685
  function computeCacheReadDiscount(pricing, billedInputTokens, detail) {
55662
55686
  const cacheReadTokens = detail?.cacheReadTokens ?? 0;
@@ -55905,6 +55929,7 @@ var init_token_tracker = __esm(() => {
55905
55929
  init_tool_name_utils();
55906
55930
  init_types2();
55907
55931
  init_logger();
55932
+ init_model_parser();
55908
55933
  init_token_file();
55909
55934
  init_remote_provider_types();
55910
55935
  ALLOWANCE_LABEL_STALE_MS = 10 * 60 * 1000;
@@ -55948,6 +55973,27 @@ function startAllowanceFlight() {
55948
55973
  return () => {};
55949
55974
  }
55950
55975
  }
55976
+ function replaceUnsupportedParts(messages, types) {
55977
+ const replacePart = (part) => {
55978
+ if (part?.type === "tool_result" && Array.isArray(part.content)) {
55979
+ return { ...part, content: part.content.map(replacePart) };
55980
+ }
55981
+ if (!types.includes(part?.type))
55982
+ return part;
55983
+ const kind = part.type === "document" ? "document" : "image";
55984
+ return { type: "text", text: `[${kind} omitted: this model does not accept ${kind} input]` };
55985
+ };
55986
+ for (const msg of messages) {
55987
+ if (!Array.isArray(msg.content))
55988
+ continue;
55989
+ msg.content = msg.content.map(replacePart);
55990
+ if (msg.content.length === 1 && msg.content[0].type === "text") {
55991
+ msg.content = msg.content[0].text;
55992
+ } else if (msg.content.length === 0) {
55993
+ msg.content = "";
55994
+ }
55995
+ }
55996
+ }
55951
55997
  function extractAuthHeaders(c) {
55952
55998
  const headers = c.req.header();
55953
55999
  const auth = {};
@@ -55969,8 +56015,8 @@ class ComposedHandler {
55969
56015
  pendingFallbackMeta;
55970
56016
  lastPlanPollAt = 0;
55971
56017
  constructor(provider, targetModel, modelName, port, options = {}) {
55972
- if (modelName.includes("@")) {
55973
- throw new Error(`ComposedHandler: modelName must not contain '@' (got "${modelName}"). Strip the provider routing prefix before passing modelName. If you need the full routed form, pass it as targetModel.`);
56018
+ if (hasProviderPrefix(modelName)) {
56019
+ throw new Error(`ComposedHandler: modelName must not contain a provider prefix (got "${modelName}"). Strip the provider routing prefix before passing modelName. If you need the full routed form, pass it as targetModel.`);
55974
56020
  }
55975
56021
  this.provider = provider;
55976
56022
  this.targetModel = targetModel;
@@ -56457,20 +56503,24 @@ class ComposedHandler {
56457
56503
  tools = tools.slice(0, maxToolCount);
56458
56504
  }
56459
56505
  if (!this.getModelSupportsVision()) {
56506
+ const isUnsupportedPart = (part) => part?.type === "image_url" || part?.type === "image" || part?.type === "document";
56460
56507
  const imageBlocks = [];
56508
+ let nestedImageCount = 0;
56461
56509
  for (let msgIdx = 0;msgIdx < messages.length; msgIdx++) {
56462
56510
  const msg = messages[msgIdx];
56463
56511
  if (Array.isArray(msg.content)) {
56464
56512
  for (let partIdx = 0;partIdx < msg.content.length; partIdx++) {
56465
56513
  const part = msg.content[partIdx];
56466
- if (part.type === "image_url" || part.type === "image" || part.type === "document") {
56514
+ if (isUnsupportedPart(part)) {
56467
56515
  imageBlocks.push({ msgIdx, partIdx, block: part });
56516
+ } else if (part?.type === "tool_result" && Array.isArray(part.content)) {
56517
+ nestedImageCount += part.content.filter(isUnsupportedPart).length;
56468
56518
  }
56469
56519
  }
56470
56520
  }
56471
56521
  }
56472
- if (imageBlocks.length > 0) {
56473
- log(`[ComposedHandler] Non-vision model received ${imageBlocks.length} image(s), calling vision proxy`);
56522
+ if (imageBlocks.length + nestedImageCount > 0) {
56523
+ log(`[ComposedHandler] Non-vision model received ${imageBlocks.length + nestedImageCount} image(s), calling vision proxy`);
56474
56524
  const openAIImageBlocks = imageBlocks.filter((b) => b.block.type === "image_url");
56475
56525
  let descriptions = null;
56476
56526
  if (openAIImageBlocks.length > 0) {
@@ -56486,28 +56536,10 @@ class ComposedHandler {
56486
56536
  };
56487
56537
  }
56488
56538
  log(`[ComposedHandler] Vision proxy described ${descriptions.length} image(s)`);
56489
- for (const msg of messages) {
56490
- if (Array.isArray(msg.content)) {
56491
- msg.content = msg.content.filter((part) => part.type !== "image" && part.type !== "document");
56492
- if (msg.content.length === 1 && msg.content[0].type === "text") {
56493
- msg.content = msg.content[0].text;
56494
- } else if (msg.content.length === 0) {
56495
- msg.content = "";
56496
- }
56497
- }
56498
- }
56539
+ replaceUnsupportedParts(messages, ["image", "document"]);
56499
56540
  } else {
56500
56541
  log("[ComposedHandler] Stripping image/document blocks (vision not supported)");
56501
- for (const msg of messages) {
56502
- if (Array.isArray(msg.content)) {
56503
- msg.content = msg.content.filter((part) => part.type !== "image_url" && part.type !== "image" && part.type !== "document");
56504
- if (msg.content.length === 1 && msg.content[0].type === "text") {
56505
- msg.content = msg.content[0].text;
56506
- } else if (msg.content.length === 0) {
56507
- msg.content = "";
56508
- }
56509
- }
56510
- }
56542
+ replaceUnsupportedParts(messages, ["image_url", "image", "document"]);
56511
56543
  }
56512
56544
  }
56513
56545
  }
@@ -56540,7 +56572,7 @@ class ComposedHandler {
56540
56572
  }));
56541
56573
  }
56542
56574
  let requestPayload = adapter.buildPayload(claudeRequest, messages, tools);
56543
- const extraFields = this.provider.getExtraPayloadFields?.();
56575
+ const extraFields = await this.provider.getExtraPayloadFields?.();
56544
56576
  if (extraFields) {
56545
56577
  Object.assign(requestPayload, extraFields);
56546
56578
  }
@@ -58044,6 +58076,7 @@ var init_composed_handler = __esm(() => {
58044
58076
  init_raw();
58045
58077
  init_request_stage();
58046
58078
  init_logger();
58079
+ init_model_parser();
58047
58080
  init_provider_definitions();
58048
58081
  init_openai();
58049
58082
  init_wire_markers();
@@ -58631,7 +58664,7 @@ class LiteLLMProviderTransport {
58631
58664
  exclude
58632
58665
  });
58633
58666
  }
58634
- getExtraPayloadFields() {
58667
+ async getExtraPayloadFields() {
58635
58668
  const fields = {};
58636
58669
  const extraHeaders = this.getExtraHeaders();
58637
58670
  if (extraHeaders) {
@@ -61223,6 +61256,9 @@ var init_provider_definitions = __esm(() => {
61223
61256
  });
61224
61257
 
61225
61258
  // src/providers/model-parser.ts
61259
+ function hasProviderPrefix(spec) {
61260
+ return PROVIDER_PREFIX.test(spec);
61261
+ }
61226
61262
  function parseModelChain(modelSpec) {
61227
61263
  const parts = modelSpec.split(MODEL_CHAIN_SEPARATOR).map((s) => s.trim()).filter(Boolean);
61228
61264
  const merged = [];
@@ -61356,12 +61392,13 @@ function getLegacySyntaxWarning(parsed) {
61356
61392
  return `Deprecation warning: "${parsed.original}" uses legacy prefix syntax.
61357
61393
  ` + ` Consider using: ${newSyntax}`;
61358
61394
  }
61359
- var AUTO_ROUTE_PROVIDER = "auto-route", PROVIDER_SHORTCUTS, LOCAL_PROVIDERS, NATIVE_MODEL_PATTERNS, LEGACY_PREFIX_PATTERNS, MODEL_CHAIN_SEPARATOR = "+", MODE_MARKER_SEGMENT;
61395
+ var AUTO_ROUTE_PROVIDER = "auto-route", PROVIDER_SHORTCUTS, PROVIDER_PREFIX, LOCAL_PROVIDERS, NATIVE_MODEL_PATTERNS, LEGACY_PREFIX_PATTERNS, MODEL_CHAIN_SEPARATOR = "+", MODE_MARKER_SEGMENT;
61360
61396
  var init_model_parser = __esm(() => {
61361
61397
  init_claude_code_aliases();
61362
61398
  init_provider_definitions();
61363
61399
  init_wire_markers();
61364
61400
  PROVIDER_SHORTCUTS = getShortcuts();
61401
+ PROVIDER_PREFIX = /^[^@]+@/;
61365
61402
  LOCAL_PROVIDERS = {
61366
61403
  has(name) {
61367
61404
  return isLocalTransport(name);
@@ -72827,6 +72864,8 @@ async function applyCandidateFilters(explanation, candidates) {
72827
72864
  }
72828
72865
  }
72829
72866
  function wireIdOf(route) {
72867
+ if (route.provider === "openrouter")
72868
+ return route.modelSpec;
72830
72869
  const at = route.modelSpec.indexOf("@");
72831
72870
  return at === -1 ? route.modelSpec : route.modelSpec.slice(at + 1);
72832
72871
  }
@@ -73413,7 +73452,7 @@ function normalizePinnedSpec(r) {
73413
73452
  const spec = r.modelSpec?.trim();
73414
73453
  if (!spec)
73415
73454
  return null;
73416
- if (spec.includes("@"))
73455
+ if (hasProviderPrefix(spec))
73417
73456
  return spec;
73418
73457
  if (spec.startsWith("http://") || spec.startsWith("https://"))
73419
73458
  return spec;
@@ -83292,7 +83331,7 @@ var init_probe_live = __esm(() => {
83292
83331
  function pinProbeModelSpec(link) {
83293
83332
  if (link.provider === "native-anthropic")
83294
83333
  return link.modelSpec;
83295
- return link.modelSpec.includes("@") ? link.modelSpec : `${link.provider}@${link.modelSpec}`;
83334
+ return hasProviderPrefix(link.modelSpec) ? link.modelSpec : `${link.provider}@${link.modelSpec}`;
83296
83335
  }
83297
83336
  function droppedRemedy(credentialHint) {
83298
83337
  if (!credentialHint)
@@ -83317,6 +83356,7 @@ function probeProviderRoute(proxyUrl, link, timeoutMs) {
83317
83356
  }
83318
83357
  var INTERACTIVE_PROBE_TIMEOUT_MS = 60000, DROPPED_LABEL;
83319
83358
  var init_probe_runner = __esm(() => {
83359
+ init_model_parser();
83320
83360
  init_probe_live();
83321
83361
  DROPPED_LABEL = {
83322
83362
  "no-credential": "no credential",
@@ -90944,6 +90984,16 @@ var init_local_queue = __esm(() => {
90944
90984
 
90945
90985
  // src/providers/transport/local.ts
90946
90986
  import { Agent } from "undici";
90987
+ async function hasOllamaTagsShape(response) {
90988
+ if (!response.ok)
90989
+ return false;
90990
+ try {
90991
+ const data = await response.json();
90992
+ return Array.isArray(data?.models);
90993
+ } catch {
90994
+ return false;
90995
+ }
90996
+ }
90947
90997
 
90948
90998
  class LocalTransport {
90949
90999
  name;
@@ -90957,6 +91007,7 @@ class LocalTransport {
90957
91007
  lastProbeError;
90958
91008
  lastProbeUrl;
90959
91009
  _contextWindow = 32768;
91010
+ _isOllamaBackend;
90960
91011
  constructor(config, modelName, options) {
90961
91012
  this.config = config;
90962
91013
  this.modelName = modelName;
@@ -90998,7 +91049,7 @@ class LocalTransport {
90998
91049
  exclude,
90999
91050
  hasApiKey: Boolean(this.config.apiKey)
91000
91051
  };
91001
- if (this.config.name === "ollama") {
91052
+ if (await this.isOllamaBackend()) {
91002
91053
  return discoverViaOllama(this.config.baseUrl, {
91003
91054
  ...cacheKey,
91004
91055
  key: `ollama:${this.config.baseUrl}`
@@ -91015,8 +91066,8 @@ class LocalTransport {
91015
91066
  signal: AbortSignal.timeout(600000)
91016
91067
  };
91017
91068
  }
91018
- getExtraPayloadFields() {
91019
- if (this.config.name === "ollama") {
91069
+ async getExtraPayloadFields() {
91070
+ if (await this.isOllamaBackend()) {
91020
91071
  const numCtx = Math.max(this._contextWindow, 32768);
91021
91072
  log(`[${this.displayName}] Setting num_ctx: ${numCtx} (detected: ${this._contextWindow})`);
91022
91073
  return { options: { num_ctx: numCtx } };
@@ -91045,6 +91096,25 @@ class LocalTransport {
91045
91096
  getConfig() {
91046
91097
  return this.config;
91047
91098
  }
91099
+ async isOllamaBackend() {
91100
+ if (this.config.name === "ollama")
91101
+ return true;
91102
+ if (this.config.name !== "custom" && this.config.name in DISPLAY_NAMES2)
91103
+ return false;
91104
+ if (this._isOllamaBackend !== undefined)
91105
+ return this._isOllamaBackend;
91106
+ try {
91107
+ const response = await fetch(`${this.config.baseUrl}/api/tags`, {
91108
+ method: "GET",
91109
+ signal: AbortSignal.timeout(5000)
91110
+ });
91111
+ this._isOllamaBackend = await hasOllamaTagsShape(response);
91112
+ } catch {
91113
+ this._isOllamaBackend = false;
91114
+ }
91115
+ log(`[${this.displayName}] Ollama backend probe (${this.config.baseUrl}): ${this._isOllamaBackend}`);
91116
+ return this._isOllamaBackend;
91117
+ }
91048
91118
  async checkHealth() {
91049
91119
  if (this.healthChecked)
91050
91120
  return this.isHealthy;
@@ -91057,6 +91127,7 @@ class LocalTransport {
91057
91127
  method: "GET",
91058
91128
  signal: AbortSignal.timeout(5000)
91059
91129
  });
91130
+ this._isOllamaBackend ??= await hasOllamaTagsShape(response);
91060
91131
  if (response.ok) {
91061
91132
  this.isHealthy = true;
91062
91133
  this.healthChecked = true;
@@ -91096,7 +91167,7 @@ class LocalTransport {
91096
91167
  if (process.env.CLAUDISH_CONTEXT_WINDOW)
91097
91168
  return;
91098
91169
  log(`[${this.displayName}] Fetching context window...`);
91099
- if (this.config.name === "ollama") {
91170
+ if (await this.isOllamaBackend()) {
91100
91171
  await this.fetchOllamaContextWindow();
91101
91172
  } else if (this.config.name === "lmstudio") {
91102
91173
  await this.fetchLMStudioContextWindow();
@@ -96103,6 +96174,14 @@ var init_magmux_ui = __esm(() => {
96103
96174
  };
96104
96175
  });
96105
96176
 
96177
+ // src/signal-exit-code.ts
96178
+ import { constants as constants3 } from "os";
96179
+ function signalExitCode(signal) {
96180
+ const signum = constants3.signals[signal];
96181
+ return typeof signum === "number" ? 128 + signum : 128;
96182
+ }
96183
+ var init_signal_exit_code = () => {};
96184
+
96106
96185
  // src/terminal-isolation.ts
96107
96186
  import { format as format2 } from "util";
96108
96187
  function beginTerminalIsolation(onSuppressed) {
@@ -97191,7 +97270,7 @@ Or set CLAUDE_PATH to your custom installation:`);
97191
97270
  setClaudeCodeRunning(false);
97192
97271
  const paneExit = wrap?.paneExitCode() ?? null;
97193
97272
  resolve({
97194
- exitCode: paneExit !== null ? paneExit : signal ? 128 + (SIGNAL_EXIT_NUMBERS[signal] ?? 0) : code ?? 1,
97273
+ exitCode: paneExit !== null ? paneExit : signal ? signalExitCode(signal) : code ?? 1,
97195
97274
  exitSignal: signal
97196
97275
  });
97197
97276
  });
@@ -97219,6 +97298,7 @@ function sessionOutcomeOf(exitCode) {
97219
97298
  }
97220
97299
  function setupSignalHandlers(proc, tempSettingsPath, quiet, onCleanup) {
97221
97300
  const signals = isWindows2() ? ["SIGINT", "SIGTERM"] : ["SIGINT", "SIGTERM", "SIGHUP"];
97301
+ claimSignalExit();
97222
97302
  for (const signal of signals) {
97223
97303
  process.on(signal, () => {
97224
97304
  releaseTerminalIsolation();
@@ -97235,7 +97315,7 @@ function setupSignalHandlers(proc, tempSettingsPath, quiet, onCleanup) {
97235
97315
  try {
97236
97316
  unlinkSync11(tempSettingsPath);
97237
97317
  } catch {}
97238
- process.exit(128 + (SIGNAL_EXIT_NUMBERS[signal] ?? 0));
97318
+ process.exit(signalExitCode(signal));
97239
97319
  });
97240
97320
  }
97241
97321
  }
@@ -97338,7 +97418,7 @@ var restoreTerminal = null, macosKeychainAnthropicMemo, defaultKeychainAnthropic
97338
97418
  }
97339
97419
  macosKeychainAnthropicMemo.set(memoKey, found);
97340
97420
  return found;
97341
- }, CLAUDISH_PLACEHOLDER_API_KEY = "sk-ant-api03-placeholder-not-used-proxy-handles-auth-with-openrouter-key-xxxxxxxxxxxxxxxxxxxxx", CLAUDISH_PLACEHOLDER_AUTH_TOKEN = "placeholder-token-not-used-proxy-handles-auth", STALE_TOKEN_FILE_MS, MAX_TOKEN_FILES_SCANNED = 4000, CLAUDE_CODE_DEFAULT_MAX_CONTEXT = 200000, USER_STATUS_LINE_TIMEOUT_SECONDS = 3, MIN_AUTO_COMPACT_WINDOW = 200000, MAX_AUTO_COMPACT_WINDOW = 1e6, ADVISOR_TOOL_ENV_VAR = "CLAUDE_CODE_ENABLE_EXPERIMENTAL_ADVISOR_TOOL", CLAUDISH_CHILD_ADVISOR_MODEL = "sonnet", CHILD_STDERR_NOISE, SIGNAL_EXIT_NUMBERS;
97421
+ }, CLAUDISH_PLACEHOLDER_API_KEY = "sk-ant-api03-placeholder-not-used-proxy-handles-auth-with-openrouter-key-xxxxxxxxxxxxxxxxxxxxx", CLAUDISH_PLACEHOLDER_AUTH_TOKEN = "placeholder-token-not-used-proxy-handles-auth", STALE_TOKEN_FILE_MS, MAX_TOKEN_FILES_SCANNED = 4000, CLAUDE_CODE_DEFAULT_MAX_CONTEXT = 200000, USER_STATUS_LINE_TIMEOUT_SECONDS = 3, MIN_AUTO_COMPACT_WINDOW = 200000, MAX_AUTO_COMPACT_WINDOW = 1e6, ADVISOR_TOOL_ENV_VAR = "CLAUDE_CODE_ENABLE_EXPERIMENTAL_ADVISOR_TOOL", CLAUDISH_CHILD_ADVISOR_MODEL = "sonnet", CHILD_STDERR_NOISE;
97342
97422
  var init_claude_runner = __esm(() => {
97343
97423
  init_model_catalog();
97344
97424
  init_claude_code_facts();
@@ -97362,18 +97442,13 @@ var init_claude_runner = __esm(() => {
97362
97442
  init_settings();
97363
97443
  init_session_discovery();
97364
97444
  init_token_file();
97445
+ init_signal_exit_code();
97365
97446
  init_telemetry();
97366
97447
  init_terminal_isolation();
97367
97448
  init_theme_mode();
97368
97449
  macosKeychainAnthropicMemo = new Map;
97369
97450
  STALE_TOKEN_FILE_MS = 7 * 24 * 60 * 60 * 1000;
97370
97451
  CHILD_STDERR_NOISE = [/^\[claude-code:unrecognized_model\]/];
97371
- SIGNAL_EXIT_NUMBERS = {
97372
- SIGHUP: 1,
97373
- SIGINT: 2,
97374
- SIGQUIT: 3,
97375
- SIGTERM: 15
97376
- };
97377
97452
  });
97378
97453
 
97379
97454
  // src/pane/contract.ts
@@ -97853,7 +97928,7 @@ var init_accounting = __esm(() => {
97853
97928
 
97854
97929
  // src/pane/pane-registry.ts
97855
97930
  import {
97856
- constants as constants3,
97931
+ constants as constants4,
97857
97932
  accessSync as accessSync2,
97858
97933
  existsSync as existsSync38,
97859
97934
  lstatSync as lstatSync7,
@@ -98226,7 +98301,7 @@ function dialErrno(reported, sockPath) {
98226
98301
  if (!isSocket)
98227
98302
  return "ENOTSOCK";
98228
98303
  try {
98229
- accessSync2(sockPath, constants3.W_OK);
98304
+ accessSync2(sockPath, constants4.W_OK);
98230
98305
  } catch {
98231
98306
  return "EACCES";
98232
98307
  }
@@ -102483,7 +102558,7 @@ var init_transcript_redaction = __esm(() => {
102483
102558
 
102484
102559
  // src/pane/transcript-page.ts
102485
102560
  import {
102486
- constants as constants4,
102561
+ constants as constants5,
102487
102562
  closeSync as closeSync14,
102488
102563
  fstatSync as fstatSync5,
102489
102564
  lstatSync as lstatSync8,
@@ -102849,7 +102924,7 @@ var init_transcript_page = __esm(() => {
102849
102924
  maxEntryBytes: 32 * 1024 * 1024
102850
102925
  };
102851
102926
  READ_CHUNK = 1024 * 1024;
102852
- OPEN_FLAGS = constants4.O_RDONLY | (constants4.O_NOFOLLOW ?? 0) | (constants4.O_NONBLOCK ?? 0);
102927
+ OPEN_FLAGS = constants5.O_RDONLY | (constants5.O_NOFOLLOW ?? 0) | (constants5.O_NONBLOCK ?? 0);
102853
102928
  loggedRejections = new Set;
102854
102929
  HEAD_CWD_MAX_BYTES = 256 * 1024;
102855
102930
  });
@@ -102880,7 +102955,7 @@ var init_pane = __esm(() => {
102880
102955
 
102881
102956
  // src/mcp-session/replay-manager.ts
102882
102957
  import { randomBytes as randomBytes13, randomUUID as randomUUID9 } from "crypto";
102883
- import { constants as constants5, accessSync as accessSync3, closeSync as closeSync15, existsSync as existsSync39, realpathSync as realpathSync9, statSync as statSync21 } from "fs";
102958
+ import { constants as constants6, accessSync as accessSync3, closeSync as closeSync15, existsSync as existsSync39, realpathSync as realpathSync9, statSync as statSync21 } from "fs";
102884
102959
  import { dirname as dirname23, resolve as resolve7 } from "path";
102885
102960
  function unavailable2(reason, message) {
102886
102961
  return new ContractErrorException("replay_unavailable", message, reason);
@@ -102903,7 +102978,7 @@ async function replayClaudeBinary(env) {
102903
102978
  try {
102904
102979
  if (!statSync21(named).isFile())
102905
102980
  throw new Error("not a file");
102906
- accessSync3(named, constants5.X_OK);
102981
+ accessSync3(named, constants6.X_OK);
102907
102982
  } catch {
102908
102983
  throw new Error(`CLAUDE_PATH ${named} is not an executable file`);
102909
102984
  }
@@ -120334,6 +120409,9 @@ function shouldWarmCatalog(args) {
120334
120409
  if (m.startsWith(prefix))
120335
120410
  return false;
120336
120411
  }
120412
+ const routesOnlyNative = !args.forceUpdate && !args.advisor && !args.modelChain?.length && !args.modelOpus && !args.modelSonnet && !args.modelHaiku && !args.modelSubagent;
120413
+ if (args.model && routesOnlyNative && nativeRouteFor(args.model))
120414
+ return false;
120337
120415
  return true;
120338
120416
  }
120339
120417
  function classifyCatalogState(cache, ttlHours, now) {
@@ -120389,10 +120467,7 @@ function startSpinner(label, quiet = false) {
120389
120467
  };
120390
120468
  }
120391
120469
  async function warmCatalogIfNeeded(config, opts) {
120392
- if (!shouldWarmCatalog({
120393
- model: config.model,
120394
- skipModelsUpdate: config.skipModelsUpdate
120395
- })) {
120470
+ if (!shouldWarmCatalog(config)) {
120396
120471
  return "skipped";
120397
120472
  }
120398
120473
  if (!config.quiet) {
@@ -120460,6 +120535,7 @@ var HARD_FAIL_MESSAGE, LOCAL_MODEL_PREFIXES;
120460
120535
  var init_catalog_warm = __esm(() => {
120461
120536
  init_all_models_cache();
120462
120537
  init_catalog_client();
120538
+ init_native_route();
120463
120539
  HARD_FAIL_MESSAGE = `Error: cannot reach model catalog and no cached copy found.
120464
120540
  ` + `
120465
120541
  ` + `To proceed:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "14.16.0",
3
+ "version": "14.16.2",
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",
@@ -71,10 +71,10 @@
71
71
  "ai"
72
72
  ],
73
73
  "optionalDependencies": {
74
- "@claudish/magmux-darwin-arm64": "14.16.0",
75
- "@claudish/magmux-darwin-x64": "14.16.0",
76
- "@claudish/magmux-linux-arm64": "14.16.0",
77
- "@claudish/magmux-linux-x64": "14.16.0"
74
+ "@claudish/magmux-darwin-arm64": "14.16.2",
75
+ "@claudish/magmux-darwin-x64": "14.16.2",
76
+ "@claudish/magmux-linux-arm64": "14.16.2",
77
+ "@claudish/magmux-linux-x64": "14.16.2"
78
78
  },
79
79
  "author": "Jack Rudenko <i@madappgang.com>",
80
80
  "license": "MIT",