claudish 14.27.1 → 14.27.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 +208 -56
  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.27.1";
5545
+ var VERSION = "14.27.2";
5546
5546
 
5547
5547
  // src/redact.ts
5548
5548
  function isPlaceholder(value) {
@@ -14145,7 +14145,7 @@ var init_bundled_recommended_list = __esm(() => {
14145
14145
  }
14146
14146
  }
14147
14147
  },
14148
- fetchedAt: "2026-11-16T12:10:44.345Z",
14148
+ fetchedAt: "2026-11-16T12:55:50.416Z",
14149
14149
  format: 1,
14150
14150
  recommendations: {
14151
14151
  contractVersion: 3,
@@ -21107,6 +21107,21 @@ function readModelIdEffort(raw) {
21107
21107
  map.baseServed = record.baseServed;
21108
21108
  return map;
21109
21109
  }
21110
+ function publishedEffortWireId(connection, requested) {
21111
+ const map = readModelIdEffort(connection.modelIdEffort);
21112
+ if (!map)
21113
+ return;
21114
+ const ids = [...Object.values(map.values), ...map.off ? [map.off] : []];
21115
+ if (ids.includes(requested))
21116
+ return requested;
21117
+ const lowered = requested.toLowerCase();
21118
+ const spellings = new Set(ids.filter((id) => id.toLowerCase() === lowered));
21119
+ return spellings.size === 1 ? [...spellings][0] : undefined;
21120
+ }
21121
+ function implicitEffortWireId(connection, requested) {
21122
+ const id = publishedEffortWireId(connection, requested);
21123
+ return id !== undefined && !isOptInWireId(id) ? id : undefined;
21124
+ }
21110
21125
  function asRecord(value) {
21111
21126
  return value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
21112
21127
  }
@@ -21129,10 +21144,10 @@ function mapIdForEffort(map, effort) {
21129
21144
  return map.values[chosen];
21130
21145
  }
21131
21146
  function chooseModelIdForEffort(map, effort, provider) {
21132
- if (effort === "none")
21133
- return map.off ? provider.sendable(map.off) : undefined;
21134
- const id = mapIdForEffort(map, effort);
21135
- return id ? provider.sendable(id) : undefined;
21147
+ const id = effort === "none" ? map.off : mapIdForEffort(map, effort);
21148
+ if (!id || isOptInWireId(id))
21149
+ return;
21150
+ return provider.sendable(id);
21136
21151
  }
21137
21152
  var SPEED_PREMIUM_SUFFIXES;
21138
21153
  var init_model_id_effort = __esm(() => {
@@ -21336,7 +21351,12 @@ function resolveSubscriptionRouting(modelId, provider, cachePath) {
21336
21351
  if (included.length !== plans.length)
21337
21352
  return { kind: "unknown" };
21338
21353
  const connection = entry.aggregators?.find((candidate) => candidate.routeStatus === "mapped" && catalogRouteMatchesProvider(candidate.route, provider));
21339
- return connection?.externalModelId ? { kind: "serves", externalId: connection.externalModelId } : { kind: "unknown" };
21354
+ if (!connection?.externalModelId)
21355
+ return { kind: "unknown" };
21356
+ return {
21357
+ kind: "serves",
21358
+ externalId: implicitEffortWireId(connection, modelId) ?? connection.externalModelId
21359
+ };
21340
21360
  }
21341
21361
  if (plans.some((plan) => plan.modelDiscovery !== "catalog"))
21342
21362
  return { kind: "unknown" };
@@ -34044,7 +34064,7 @@ function resolveProbeModel() {
34044
34064
  const cache = JSON.parse(readFileSync15(cachePath, "utf-8"));
34045
34065
  for (const m of cache.models ?? []) {
34046
34066
  const slug = m?.slug ?? m?.id;
34047
- if (typeof slug === "string" && slug.length > 0)
34067
+ if (typeof slug === "string" && slug.length > 0 && !isOptInWireId(slug))
34048
34068
  return slug;
34049
34069
  }
34050
34070
  } catch {}
@@ -44677,7 +44697,7 @@ async function resolveObserverModel(config) {
44677
44697
  return cachedModel;
44678
44698
  try {
44679
44699
  const models = await fetchOllamaModels({ enrichCapabilities: false });
44680
- const usable = models.filter((m) => !m.isEmbeddingModel && isGenuinelyLocal(m));
44700
+ const usable = models.filter((m) => !m.isEmbeddingModel && isGenuinelyLocal(m) && !isOptInWireId(m.name));
44681
44701
  if (usable.length === 0) {
44682
44702
  log("[hooks:observer] No local Ollama models found \u2014 observer disabled for this run");
44683
44703
  cachedModel = null;
@@ -50491,13 +50511,13 @@ function getCatalogEntries() {
50491
50511
  function catalogOrigin() {
50492
50512
  return getCatalogSnapshot()?.origin ?? "none";
50493
50513
  }
50494
- function latestAnthropicTierModelId(tier) {
50514
+ function latestAnthropicTierModelId(tier, accept = () => true) {
50495
50515
  const snapshot = getCatalogSnapshot();
50496
50516
  if (snapshot?.origin !== "disk")
50497
50517
  return null;
50498
50518
  const { entries } = snapshot;
50499
50519
  const family = new RegExp(`^claude-${tier}-`, "i");
50500
- const matches = entries.filter((entry) => family.test(entry.modelId));
50520
+ const matches = entries.filter((entry) => family.test(entry.modelId) && accept(entry.modelId));
50501
50521
  if (matches.length === 0)
50502
50522
  return null;
50503
50523
  matches.sort((a, b) => {
@@ -50531,9 +50551,49 @@ function externalIdFor(entry, provider) {
50531
50551
  return wireIds.find((wireId) => !isMovingPointer(wireId)) ?? null;
50532
50552
  }
50533
50553
  function publishesWireIdFor(entry, provider, wireId) {
50534
- return allConnections(entry).some((connection) => connection.routeStatus === "mapped" && connection.externalModelId === wireId && catalogRouteMatchesProvider(connection.route, provider));
50554
+ return allConnections(entry).some((connection) => connection.routeStatus === "mapped" && catalogRouteMatchesProvider(connection.route, provider) && (connection.externalModelId === wireId || effortMapListsWireId(connection, wireId)));
50555
+ }
50556
+ function effortMapListsWireId(connection, wireId) {
50557
+ return publishedEffortWireId(connection, wireId) === wireId;
50558
+ }
50559
+ function publishesImplicitWireIdFor(entry, provider, wireId) {
50560
+ return (entry.aggregators ?? []).some((connection) => connection.routeStatus === "mapped" && catalogRouteMatchesProvider(connection.route, provider) && (connection.externalModelId === wireId || implicitEffortWireId(connection, wireId) === wireId));
50535
50561
  }
50536
50562
  function resolveExternalId(userInput, provider, cachePath) {
50563
+ return resolveWireId(userInput, provider, cachePath, "explicit");
50564
+ }
50565
+ function resolveImplicitExternalId(userInput, provider, cachePath) {
50566
+ return resolveWireId(userInput, provider, cachePath, "implicit");
50567
+ }
50568
+ function effortMapOwnerFor(entries, provider, wireId) {
50569
+ const baseIds = new Set;
50570
+ for (const entry of entries) {
50571
+ const owns = allConnections(entry).some((connection) => connection.routeStatus === "mapped" && catalogRouteMatchesProvider(connection.route, provider) && effortMapListsWireId(connection, wireId));
50572
+ if (!owns)
50573
+ continue;
50574
+ const baseId = externalIdFor(entry, provider);
50575
+ if (baseId)
50576
+ baseIds.add(baseId);
50577
+ }
50578
+ const [first, ...rest] = baseIds;
50579
+ if (first === undefined)
50580
+ return { kind: "none" };
50581
+ if (rest.length > 0)
50582
+ return { kind: "ambiguous" };
50583
+ return { kind: "one", wireId: first };
50584
+ }
50585
+ function answerBeforeLookup(entries, provider, userInput, resolution) {
50586
+ const publishesExactly = resolution === "explicit" ? publishesWireIdFor : publishesImplicitWireIdFor;
50587
+ if (entries.some((entry) => publishesExactly(entry, provider, userInput)))
50588
+ return userInput;
50589
+ if (resolution === "explicit")
50590
+ return isOptInWireId(userInput) ? userInput : undefined;
50591
+ const owner = effortMapOwnerFor(entries, provider, userInput);
50592
+ if (owner.kind === "one")
50593
+ return owner.wireId;
50594
+ return owner.kind === "ambiguous" ? null : undefined;
50595
+ }
50596
+ function resolveWireId(userInput, provider, cachePath, resolution) {
50537
50597
  const entries = cachePath ? readAllModelsCache(cachePath)?.entries : getCatalogEntries();
50538
50598
  if (userInput.includes("/")) {
50539
50599
  if (entries?.some((entry) => allExternalIds(entry).includes(userInput)))
@@ -50542,8 +50602,9 @@ function resolveExternalId(userInput, provider, cachePath) {
50542
50602
  }
50543
50603
  if (!entries)
50544
50604
  return null;
50545
- if (entries.some((entry) => publishesWireIdFor(entry, provider, userInput)))
50546
- return userInput;
50605
+ const answered = answerBeforeLookup(entries, provider, userInput, resolution);
50606
+ if (answered !== undefined)
50607
+ return answered;
50547
50608
  const byModelId = entries.find((entry) => entry.modelId === userInput);
50548
50609
  if (byModelId)
50549
50610
  return externalIdFor(byModelId, provider);
@@ -50594,10 +50655,13 @@ function resolveTargetForCatalog(target, isExplicitProvider, model, provider, re
50594
50655
  };
50595
50656
  }
50596
50657
  function logResolution(userInput, result, quiet = false) {
50597
- if (result.wasResolved && !quiet) {
50598
- process.stderr.write(`[Model] Resolved "${userInput}" \u2192 "${result.resolvedId}" (${result.sourceLabel})
50658
+ if (!result.wasResolved)
50659
+ return;
50660
+ const line = `[Model] Resolved "${userInput}" \u2192 "${result.resolvedId}" (${result.sourceLabel})`;
50661
+ log(line);
50662
+ if (!quiet)
50663
+ process.stderr.write(`${line}
50599
50664
  `);
50600
- }
50601
50665
  }
50602
50666
  function catalogWarmDisabled() {
50603
50667
  return catalogWarmDisabledFor(process.env.CLAUDISH_DISABLE_CATALOG_WARM);
@@ -50947,6 +51011,7 @@ var init_catalog_client = __esm(() => {
50947
51011
  init_catalog_reachability();
50948
51012
  init_catalog_route_bindings();
50949
51013
  init_connection_wire();
51014
+ init_model_id_effort();
50950
51015
  init_probe_discovery();
50951
51016
  });
50952
51017
 
@@ -51303,6 +51368,8 @@ function resolveAntigravityServedModel(requested, served, effort) {
51303
51368
  }
51304
51369
  function chooseAntigravityServedModel(requested, served, effort) {
51305
51370
  const req = requested.trim();
51371
+ if (isOptInWireId(req))
51372
+ return { id: req, effort, source: "exact id" };
51306
51373
  const isMappedBase = findModelIdEffortConnection(req, "antigravity") !== undefined;
51307
51374
  if (!isMappedBase && served.servedIds.includes(req)) {
51308
51375
  return { id: req, effort, source: "exact id" };
@@ -51315,7 +51382,7 @@ function chooseAntigravityServedModel(requested, served, effort) {
51315
51382
  return decision.choice;
51316
51383
  if (servesSelectable(served, req))
51317
51384
  return existingResolutionChoice(req, effort, decision);
51318
- const selectable = served.servedIds.filter((id) => !isExcluded2(served, id));
51385
+ const selectable = served.servedIds.filter((id) => !isExcluded2(served, id) && !isOptInWireId(id));
51319
51386
  const defaultId = served.defaultId && selectable.includes(served.defaultId) ? served.defaultId : null;
51320
51387
  const id = resolveAntigravityModelId(requested, selectable, defaultId, lookupFamilyDefaultVariant(requested, "antigravity"));
51321
51388
  return existingResolutionChoice(id, effort, decision);
@@ -51928,7 +51995,7 @@ class AntigravityProviderTransport {
51928
51995
  }
51929
51996
  async handleCapacityExhausted(originalResponse, queue, request, sentId, signal) {
51930
51997
  const excluded = this.served.excludedIds;
51931
- const candidates = this.servedModels.filter((m) => m !== sentId && !excluded?.has(m));
51998
+ const candidates = this.servedModels.filter((m) => m !== sentId && !excluded?.has(m) && !isOptInWireId(m));
51932
51999
  if (candidates.length === 0) {
51933
52000
  log(`[Antigravity] ${sentId} capacity exhausted, no fallback models available`);
51934
52001
  return originalResponse;
@@ -60231,7 +60298,8 @@ function formatWindow(tokens) {
60231
60298
 
60232
60299
  class DevinModelResolver {
60233
60300
  provider = "devin";
60234
- collapse(modelsCatalog) {
60301
+ collapse(listed) {
60302
+ const modelsCatalog = withoutOptIn(listed);
60235
60303
  const groups = new Map;
60236
60304
  for (const entry of modelsCatalog) {
60237
60305
  const key = keyOf(entry);
@@ -60284,9 +60352,14 @@ class DevinModelResolver {
60284
60352
  logModelIdChoice("Devin", selection.trim() || selection, choice);
60285
60353
  return choice.id;
60286
60354
  }
60287
- choose(selection, modelsCatalog, effort) {
60355
+ choose(selection, listed, effort) {
60288
60356
  const requested = selection.trim();
60289
60357
  const lower = requested.toLowerCase();
60358
+ if (isOptInWireId(requested)) {
60359
+ const listedId = listed.find((entry) => entry.wireId.toLowerCase() === lower)?.wireId;
60360
+ return { id: listedId ?? requested, effort, source: "exact id" };
60361
+ }
60362
+ const modelsCatalog = withoutOptIn(listed);
60290
60363
  const exact = modelsCatalog.find((entry) => entry.wireId.toLowerCase() === lower);
60291
60364
  const isMappedBase = requested !== "" && findModelIdEffortConnection(requested, "devin") !== undefined;
60292
60365
  if (exact && !effort && isMappedBase) {
@@ -60327,6 +60400,9 @@ class DevinModelResolver {
60327
60400
  return unmapped(pickForEffort(groups.get(keyOf(chosen)), effort).wireId);
60328
60401
  }
60329
60402
  }
60403
+ function withoutOptIn(modelsCatalog) {
60404
+ return modelsCatalog.filter((entry) => !isOptInWireId(entry.wireId));
60405
+ }
60330
60406
  function mappedWireId(requested, modelsCatalog, effort) {
60331
60407
  const byId = new Map;
60332
60408
  for (const entry of modelsCatalog) {
@@ -61380,12 +61456,12 @@ function getCachedEntries() {
61380
61456
  _memoMtimeMs = mtimeMs;
61381
61457
  return _memoEntries;
61382
61458
  }
61383
- function findEntryByAlias(alias) {
61459
+ function findEntryByAlias(alias, accept = () => true) {
61384
61460
  const entries = getCachedEntries();
61385
61461
  if (!entries || entries.length === 0)
61386
61462
  return null;
61387
61463
  for (const entry of entries) {
61388
- if (entry.aliases.includes(alias)) {
61464
+ if (entry.aliases.includes(alias) && accept(entry.modelId)) {
61389
61465
  return project(entry);
61390
61466
  }
61391
61467
  }
@@ -61407,7 +61483,7 @@ function findVisionAlias(alias) {
61407
61483
  if (!entries || entries.length === 0)
61408
61484
  return null;
61409
61485
  for (const entry of entries) {
61410
- if (entry.supportsVision === true && entry.aliases.includes(alias)) {
61486
+ if (entry.supportsVision === true && entry.aliases.includes(alias) && !isOptInWireId(entry.modelId)) {
61411
61487
  return project(entry);
61412
61488
  }
61413
61489
  }
@@ -64058,6 +64134,25 @@ function toolReferencesAsText(messages, wording = {}) {
64058
64134
  }
64059
64135
  var identity2 = (name) => name, always = () => true, loadedText = (name) => `Loaded: ${name}. It is in your tool list now.`, notLoadedText = (name) => `Not loaded: ${name}. It is not in your tool list.`, isReference = (item) => item?.type === "tool_reference";
64060
64136
 
64137
+ // src/handlers/shared/repeat-window.ts
64138
+ function firstInWindow(line, now = Date.now()) {
64139
+ const at = lastPrinted.get(line);
64140
+ if (at !== undefined && now - at < REPEAT_WINDOW_MS)
64141
+ return false;
64142
+ lastPrinted.set(line, now);
64143
+ if (lastPrinted.size > 256) {
64144
+ for (const [key, t] of lastPrinted) {
64145
+ if (now - t >= REPEAT_WINDOW_MS)
64146
+ lastPrinted.delete(key);
64147
+ }
64148
+ }
64149
+ return true;
64150
+ }
64151
+ var REPEAT_WINDOW_MS = 30000, lastPrinted;
64152
+ var init_repeat_window = __esm(() => {
64153
+ lastPrinted = new Map;
64154
+ });
64155
+
64061
64156
  // src/handlers/shared/responses-leg-issuer.ts
64062
64157
  function isSameCredentialSilo(turn, next) {
64063
64158
  return (turn.auth?.arm ?? undefined) === (next.auth?.arm ?? undefined) && turn.accountKey === next.accountKey;
@@ -70029,7 +70124,11 @@ class ComposedHandler {
70029
70124
  const providerMsg = extractProviderMessage(parsedErrorBody ?? errorText);
70030
70125
  const oneLineMsg = providerMsg.replace(/\s+/g, " ").trim();
70031
70126
  const msgTail = oneLineMsg ? ` (${oneLineMsg.length > 200 ? `${oneLineMsg.slice(0, 200)}\u2026` : oneLineMsg})` : "";
70032
- logStderr(`Error [${this.provider.displayName}]: HTTP ${response.status}. ${hint}${msgTail}`);
70127
+ const errorLine = `Error [${this.provider.displayName}]: HTTP ${response.status}. ${hint}${msgTail}`;
70128
+ if (firstInWindow(errorLine))
70129
+ logStderr(errorLine);
70130
+ else
70131
+ log(errorLine);
70033
70132
  let providerErrorType;
70034
70133
  try {
70035
70134
  const parsed = JSON.parse(errorText);
@@ -70083,7 +70182,7 @@ class ComposedHandler {
70083
70182
  providerMessage: providerMsg,
70084
70183
  leadPhrase: isContextOverflowError(response.status, errorText) ? CONTEXT_OVERFLOW_PHRASE : undefined
70085
70184
  });
70086
- const verdictHeaders = this.signedBilling(binding).subscription && isCredentialRejection(response.status, errorText) ? authVerdictHeaders("terminal") : undefined;
70185
+ const verdictHeaders = isCredentialRejection(response.status, errorText) ? authVerdictHeaders("terminal") : undefined;
70087
70186
  return c.json(wrapAnthropicError(400, surfaced, "invalid_request_error", response.status, providerMsg), 400, verdictHeaders);
70088
70187
  }
70089
70188
  return c.json(ensureAnthropicErrorFormat(response.status, errorBody), response.status);
@@ -70808,6 +70907,7 @@ var init_composed_handler = __esm(() => {
70808
70907
  init_model_unsupported();
70809
70908
  init_quota_exhaustion();
70810
70909
  init_remote_provider_types();
70910
+ init_repeat_window();
70811
70911
  init_responses_leg_issuer();
70812
70912
  init_stream_head_sniffer();
70813
70913
  init_anthropic_sse();
@@ -71298,7 +71398,14 @@ class DevinProviderTransport {
71298
71398
  if (served.length === 0) {
71299
71399
  return { model: null, reason: "Devin reported no models for this subscription" };
71300
71400
  }
71301
- const ranked = [...served].sort((a, b) => {
71401
+ const ordinary = served.filter((model) => !isOptInWireId(model.uid));
71402
+ if (ordinary.length === 0) {
71403
+ return {
71404
+ model: null,
71405
+ reason: "Devin lists only content-use opt-in models for this subscription"
71406
+ };
71407
+ }
71408
+ const ranked = [...ordinary].sort((a, b) => {
71302
71409
  const diff = b.contextWindow - a.contextWindow;
71303
71410
  return diff !== 0 ? diff : a.uid.localeCompare(b.uid);
71304
71411
  });
@@ -71846,9 +71953,10 @@ async function discoverVertexProbeModel(exclude) {
71846
71953
  } catch (e) {
71847
71954
  return fail(`Vertex AI model list failed: ${e instanceof Error ? e.message : String(e)}`);
71848
71955
  }
71849
- const ranked = rankDiscoveredModels(listing.models).map((m) => m.id).filter(isChatCapable);
71956
+ const chatCapable = rankDiscoveredModels(listing.models).map((m) => m.id).filter(isChatCapable);
71957
+ const ranked = chatCapable.filter((id) => !isOptInWireId(id));
71850
71958
  if (ranked.length === 0) {
71851
- return fail(listing.listed === 0 ? `${listing.endpoint} listed no models for this project` : `no chat-capable model among the ${listing.listed} that ${listing.endpoint} listed for this project`);
71959
+ return fail(noCandidateReason(listing, chatCapable.length));
71852
71960
  }
71853
71961
  if (!config) {
71854
71962
  return fail("no Google Cloud project resolved");
@@ -71864,6 +71972,14 @@ async function discoverVertexProbeModel(exclude) {
71864
71972
  _cache3.set(cacheKey, { ranked: served, expiresAt: Date.now() + CACHE_TTL_MS3 });
71865
71973
  return pickFrom(served, undefined, exclude);
71866
71974
  }
71975
+ function noCandidateReason(listing, chatCapableCount) {
71976
+ if (listing.listed === 0)
71977
+ return `${listing.endpoint} listed no models for this project`;
71978
+ if (chatCapableCount > 0) {
71979
+ return `no chat-capable model that is not a content-use opt-in id among the ${listing.listed} that ${listing.endpoint} listed for this project`;
71980
+ }
71981
+ return `no chat-capable model among the ${listing.listed} that ${listing.endpoint} listed for this project`;
71982
+ }
71867
71983
  function pickFrom(ranked, reason, exclude) {
71868
71984
  if (ranked.length === 0)
71869
71985
  return { model: null, reason };
@@ -84547,44 +84663,42 @@ var init_native_route = __esm(() => {
84547
84663
  function decideHopFailure(input) {
84548
84664
  if (input.kind === "thrown")
84549
84665
  return { action: "advance", reason: "thrown" };
84550
- const { status, headers, body, provider, name } = input;
84666
+ const { status, headers, body, name } = input;
84551
84667
  if (hasRecoveryMarker(headers))
84552
84668
  return { action: "stop", reason: "recovery-hold" };
84553
84669
  if (hasStreamFailureMarker(headers))
84554
84670
  return { action: "stop", reason: "stream-failure" };
84555
84671
  const connectionFault = isClaudishConnectionVerdict(headers);
84556
84672
  const verdict = authVerdict(headers);
84557
- const subscriptionRejected = !connectionFault && verdict === "terminal" && !!provider && isSubscriptionProvider(provider);
84558
- if (verdict && !subscriptionRejected)
84673
+ const terminalRejection = !connectionFault && verdict === "terminal";
84674
+ if (verdict && !terminalRejection)
84559
84675
  return { action: "stop", reason: "credential-hold" };
84560
- if (subscriptionRejected || !connectionFault && isSubscriptionCredentialRejection(status, body, provider)) {
84561
- return { action: "advance", reason: "subscription-credential-rejected" };
84676
+ if (terminalRejection || !connectionFault && isRejectedCredentialAnswer(status, body)) {
84677
+ return { action: "advance", reason: "credential-rejected" };
84562
84678
  }
84563
- if (!isRetryableError(status, body, name, headers, provider)) {
84679
+ if (!isRetryableError(status, body, name, headers)) {
84564
84680
  return { action: "stop", reason: "non-retryable" };
84565
84681
  }
84566
84682
  return { action: "advance", reason: "retryable" };
84567
84683
  }
84568
- function isSubscriptionCredentialRejection(status, errorBody, providerId) {
84569
- if (!providerId || !isSubscriptionProvider(providerId))
84570
- return false;
84684
+ function isRejectedCredentialAnswer(status, errorBody) {
84571
84685
  const recovered = status === 400 ? extractUpstreamStatus(errorBody) : undefined;
84572
84686
  if ((status === 401 || recovered === 401) && isCredentialRejection(401, errorBody)) {
84573
84687
  return true;
84574
84688
  }
84575
84689
  return status === 403 && isCredentialRejection(403, errorBody);
84576
84690
  }
84577
- function isRetryableError(status, errorBody, provider, headers, providerId) {
84691
+ function isRetryableError(status, errorBody, provider, headers) {
84578
84692
  if (isClaudishConnectionVerdict(headers))
84579
84693
  return false;
84580
84694
  if (hasStreamFailureMarker(headers))
84581
84695
  return false;
84582
84696
  const verdict = authVerdict(headers);
84583
84697
  if (verdict)
84584
- return verdict === "terminal" && !!providerId && isSubscriptionProvider(providerId);
84698
+ return verdict === "terminal";
84585
84699
  if (hasQuotaExhaustionWording(errorBody))
84586
84700
  return true;
84587
- if (isSubscriptionCredentialRejection(status, errorBody, providerId))
84701
+ if (isRejectedCredentialAnswer(status, errorBody))
84588
84702
  return true;
84589
84703
  const upstream = status === 400 ? extractUpstreamStatus(errorBody) : undefined;
84590
84704
  if (upstream === 401 || upstream === 403 || upstream === 402 || upstream === 429) {
@@ -84634,7 +84748,6 @@ var init_hop_decision = __esm(() => {
84634
84748
  init_anthropic_error();
84635
84749
  init_auth_failure();
84636
84750
  init_quota_exhaustion();
84637
- init_remote_provider_types();
84638
84751
  });
84639
84752
 
84640
84753
  // src/providers/probe-hop-origin.ts
@@ -84780,7 +84893,6 @@ function chainDecisionOf(response, body, provider) {
84780
84893
  status: response.status,
84781
84894
  headers: response.headers,
84782
84895
  body,
84783
- provider,
84784
84896
  name: provider
84785
84897
  });
84786
84898
  return { chainAction: decision.action, chainReason: decision.reason };
@@ -86012,7 +86124,7 @@ function catalogModelId(model, cachePath) {
86012
86124
  const entries = cachePath ? readAllModelsCache(cachePath)?.entries : getCatalogEntries();
86013
86125
  return entries ? findCatalogEntry(entries, model)?.modelId : undefined;
86014
86126
  }
86015
- function gatherFromConnections(entry, candidates, excluded, unmappedRoutes, cachePath) {
86127
+ function gatherFromConnections(model, entry, candidates, excluded, unmappedRoutes, cachePath) {
86016
86128
  for (const connection of entry.aggregators ?? []) {
86017
86129
  if (connection.routeStatus !== "mapped")
86018
86130
  continue;
@@ -86021,9 +86133,10 @@ function gatherFromConnections(entry, candidates, excluded, unmappedRoutes, cach
86021
86133
  const tier = getProviderByName(provider)?.tier;
86022
86134
  if (!tier)
86023
86135
  continue;
86024
- const wireId = externalIdFor(entry, provider);
86025
- if (!wireId || wireId !== connection.externalModelId)
86136
+ const baseWireId = externalIdFor(entry, provider);
86137
+ if (!baseWireId || baseWireId !== connection.externalModelId)
86026
86138
  continue;
86139
+ const wireId = implicitEffortWireId(connection, model) ?? baseWireId;
86027
86140
  const candidate = connectionCandidate(entry, connection, provider, tier, wireId);
86028
86141
  if (tier === "subscription" && resolveSubscriptionRouting(entry.modelId, provider, cachePath).kind === "not-served") {
86029
86142
  excluded.push({ candidate, outcome: "excluded-by-membership" });
@@ -86097,6 +86210,8 @@ function catalogConnects(entry, provider) {
86097
86210
  function gatherVendorClaims(model, entry, candidates) {
86098
86211
  if (!entry || !isChatModelEntry(entry))
86099
86212
  return;
86213
+ if (isOptInWireId(model))
86214
+ return;
86100
86215
  for (const def of getAllProviders()) {
86101
86216
  if (def.tier !== "dynamic-subscription")
86102
86217
  continue;
@@ -86121,6 +86236,8 @@ function listedRow(provider, model, models, excludedIds) {
86121
86236
  return row && !isOptInWireId(row.id) ? row : undefined;
86122
86237
  }
86123
86238
  function gatherAccountListed(model, entry, lists, candidates, excluded, cachePath) {
86239
+ if (isOptInWireId(model))
86240
+ return;
86124
86241
  for (const [provider, list] of lists) {
86125
86242
  const tier = getProviderByName(provider)?.tier;
86126
86243
  if (!tier)
@@ -86174,7 +86291,7 @@ function gatherRouteCandidates(model, cachePath, lists = new Map) {
86174
86291
  const setAside = [];
86175
86292
  const unmappedRoutes = new Set;
86176
86293
  if (entry)
86177
- gatherFromConnections(entry, gathered, setAside, unmappedRoutes, cachePath);
86294
+ gatherFromConnections(model, entry, gathered, setAside, unmappedRoutes, cachePath);
86178
86295
  gatherVendorClaims(model, entry, gathered);
86179
86296
  gatherAccountListed(model, entry, lists, gathered, setAside, cachePath);
86180
86297
  const keyOf = (candidate) => JSON.stringify([candidate.provider, candidate.wireId]);
@@ -86227,6 +86344,12 @@ function catalogMapsOnlyOptIn(provider, model, cachePath) {
86227
86344
  const mapsHere = (connection) => connection.routeStatus === "mapped" && catalogRouteMatchesProvider(connection.route, provider);
86228
86345
  return !(entry.aggregators ?? []).some(mapsHere) && (entry.optInConnections ?? []).some(mapsHere);
86229
86346
  }
86347
+ function isUnvouchedOptInWireId(provider, wireId, cachePath) {
86348
+ if (!isOptInWireId(wireId))
86349
+ return false;
86350
+ const entries = cachePath ? readAllModelsCache(cachePath)?.entries : getCatalogEntries();
86351
+ return !(entries ?? []).some((entry) => (entry.aggregators ?? []).some((connection) => connection.routeStatus === "mapped" && catalogRouteMatchesProvider(connection.route, provider) && connection.externalModelId === wireId));
86352
+ }
86230
86353
  function routeOwnership(provider) {
86231
86354
  const probe = readProbeModelsCache();
86232
86355
  if (!probe)
@@ -86245,6 +86368,7 @@ var init_route_candidates = __esm(() => {
86245
86368
  init_antigravity_model_id();
86246
86369
  init_catalog_client();
86247
86370
  init_catalog_route_bindings();
86371
+ init_model_id_effort();
86248
86372
  init_registry4();
86249
86373
  init_probe_catalog();
86250
86374
  init_provider_definitions();
@@ -86512,7 +86636,7 @@ function resolveRoutingEntries(entries, originalModelName, cachePath, opts = {})
86512
86636
  }
86513
86637
  }
86514
86638
  if (!wireIdResolved) {
86515
- const externalId = resolveExternalId(modelName, provider, cachePath);
86639
+ const externalId = atIdx === -1 ? resolveImplicitExternalId(modelName, provider, cachePath) : resolveExternalId(modelName, provider, cachePath);
86516
86640
  if (externalId === null && atIdx === -1 && readsGatewayList(provider, cachePath)) {
86517
86641
  const answer = gatewayListAnswer(provider, modelName, opts.gatewayLists);
86518
86642
  if (answer.wireId === undefined) {
@@ -86529,6 +86653,13 @@ function resolveRoutingEntries(entries, originalModelName, cachePath, opts = {})
86529
86653
  modelName = externalId ?? modelName;
86530
86654
  }
86531
86655
  }
86656
+ if (atIdx === -1 && isUnvouchedOptInWireId(provider, modelName, cachePath)) {
86657
+ resolved.push({
86658
+ route: routeFor(provider, modelName),
86659
+ exclusion: "excluded-by-content-use"
86660
+ });
86661
+ continue;
86662
+ }
86532
86663
  resolved.push({ route: routeFor(provider, modelName) });
86533
86664
  }
86534
86665
  return resolved;
@@ -86550,7 +86681,7 @@ function gatewayListAnswer(provider, model, gatewayLists) {
86550
86681
  return { wireId: gatewayWireIdFor(entry?.modelId ?? model, entry?.provider, list) };
86551
86682
  }
86552
86683
  function gatewayListsNeeded(entries, model, cachePath) {
86553
- const providers = entries.filter((entry) => !entry.includes("@")).map(ruleEntryProvider).filter((provider) => readsGatewayList(provider, cachePath) && resolveExternalId(model, provider, cachePath) === null);
86684
+ const providers = entries.filter((entry) => !entry.includes("@")).map(ruleEntryProvider).filter((provider) => readsGatewayList(provider, cachePath) && resolveImplicitExternalId(model, provider, cachePath) === null);
86554
86685
  return [...new Set(providers)];
86555
86686
  }
86556
86687
  function routeFor(provider, wireId) {
@@ -87238,6 +87369,18 @@ function describeCatalogOrigin(explanation) {
87238
87369
  }
87239
87370
  return `catalog \xB7 ${firstHopPhrase(explanation)}`;
87240
87371
  }
87372
+ function droppedHopPhrase(candidate) {
87373
+ if (candidate.outcome === "kept")
87374
+ return "";
87375
+ if (candidate.outcome !== "excluded-by-content-use") {
87376
+ return DROPPED_FALLBACK_PHRASE[candidate.outcome];
87377
+ }
87378
+ if (isOptInWireId(candidate.wireId)) {
87379
+ const prefix = PROVIDER_TO_PREFIX[candidate.provider] ?? candidate.provider;
87380
+ return `would send a contributor (content-use opt-in) id, which claudish never chooses; type ${prefix}@${candidate.wireId} to opt in`;
87381
+ }
87382
+ return "maps it only through a contributor (content-use opt-in) id";
87383
+ }
87241
87384
  function describeAbsentEntry(explanation) {
87242
87385
  const head = `catalog has no entry for "${explanation.routedModel}"`;
87243
87386
  const withheld = explanation.fallbackWithheld;
@@ -87250,7 +87393,7 @@ function describeAbsentEntry(explanation) {
87250
87393
  const fallback = explanation.candidates.find((candidate) => candidate.position === "fallback");
87251
87394
  if (!fallback)
87252
87395
  return `${head} \xB7 ${firstHopPhrase(explanation)}`;
87253
- return fallback.outcome === "kept" ? `${head} \xB7 fallback only` : `${head} \xB7 fallback ${fallback.displayName} ${DROPPED_FALLBACK_PHRASE[fallback.outcome]}`;
87396
+ return fallback.outcome === "kept" ? `${head} \xB7 fallback only` : `${head} \xB7 fallback ${fallback.displayName} ${droppedHopPhrase(fallback)}`;
87254
87397
  }
87255
87398
  function firstHopPhrase(explanation) {
87256
87399
  if (explanation.outcome.kind === "no-route")
@@ -87307,7 +87450,6 @@ var init_routing_rules = __esm(() => {
87307
87450
  "credential-unreadable": "has a credential that could not be read",
87308
87451
  "not-served": "does not serve it",
87309
87452
  "excluded-by-membership": "is outside its plan's membership",
87310
- "excluded-by-content-use": "maps it only through a contributor (content-use opt-in) id",
87311
87453
  "unknown-provider": "is not a known provider shortcut",
87312
87454
  "gateway-id-unknown": "has no exact id for it in its models list"
87313
87455
  };
@@ -102817,7 +102959,8 @@ function claudeAdvisorModelFor(model) {
102817
102959
  }
102818
102960
  const tier = claudeCodeTierAlias(normalized);
102819
102961
  if (tier) {
102820
- const resolved = findEntryByAlias(tier)?.modelId ?? latestAnthropicTierModelId(tier);
102962
+ const notOptIn = (modelId) => !isOptInWireId(modelId);
102963
+ const resolved = findEntryByAlias(tier, notOptIn)?.modelId ?? latestAnthropicTierModelId(tier, notOptIn);
102821
102964
  if (resolved)
102822
102965
  return { refused: false, id: resolved };
102823
102966
  return {
@@ -102889,7 +103032,6 @@ class FallbackHandler {
102889
103032
  status: response.status,
102890
103033
  headers: response.headers,
102891
103034
  body: errorBody,
102892
- provider,
102893
103035
  name
102894
103036
  });
102895
103037
  switch (decision.reason) {
@@ -102904,7 +103046,7 @@ class FallbackHandler {
102904
103046
  logStderr(`[Fallback] ${name}: credential ${verdict === "terminal" ? "rejected" : "temporarily unavailable"} \u2014 stopping the chain here.`);
102905
103047
  }
102906
103048
  return response;
102907
- case "subscription-credential-rejected": {
103049
+ case "credential-rejected": {
102908
103050
  errors.push({ provider: name, status: response.status, message: errorBody });
102909
103051
  if (!firstRejection)
102910
103052
  firstRejection = { name, response, body: errorBody };
@@ -102924,7 +103066,8 @@ class FallbackHandler {
102924
103066
  errors.push({ provider: name, status: response.status, message: errorBody });
102925
103067
  if (!isLast) {
102926
103068
  if (hasQuotaExhaustionWording(errorBody)) {
102927
- logStderr(`[Fallback] ${name} subscription allowance is spent \u2014 falling through to the next provider, which is billed PER TOKEN. Use a provider prefix (e.g. \`zgo@model\`) to fail instead of switching.`);
103069
+ const next = this.candidates[(idx + 1) % this.candidates.length];
103070
+ announceSpentAllowance({ name, provider }, response.status, errorBody, next);
102928
103071
  } else {
102929
103072
  logStderr(`[Fallback] ${name} failed (HTTP ${response.status}), trying next provider...`);
102930
103073
  }
@@ -102991,6 +103134,14 @@ function announceCredentialRejection(rejected, status, errorBody, next) {
102991
103134
  announcedRejections.add(key);
102992
103135
  logStderr(line);
102993
103136
  }
103137
+ function announceSpentAllowance(spent, status, errorBody, next) {
103138
+ const upstreamStatus = (status === 400 ? extractUpstreamStatus(errorBody) : undefined) ?? status;
103139
+ const providerMessage = truncate3(parseProviderMessage(redactForClient(errorBody)).replace(/\s+/g, " ").trim(), 200);
103140
+ const shortcut = spent.provider ? getShortestPrefix(spent.provider) : "";
103141
+ const pin = shortcut ? ` Name the provider (${shortcut}@\u2026) to stop here instead of switching.` : "";
103142
+ const spentBilling = spent.provider && isSubscriptionProvider(spent.provider) ? "subscription" : "metered";
103143
+ logStderr(`[Fallback] ${spent.name} (${spentBilling}) has no allowance or balance left ` + `(${upstreamStatus}: ${providerMessage}) \u2014 moving to ${next.name} (${hopBillingWords(next.provider)}).${pin}`);
103144
+ }
102994
103145
  function exhaustedChainStatus(errors) {
102995
103146
  if (errors.length === 0)
102996
103147
  return 400;
@@ -103032,6 +103183,7 @@ function truncate3(s, max) {
103032
103183
  var announcedRejections;
103033
103184
  var init_fallback_handler = __esm(() => {
103034
103185
  init_logger();
103186
+ init_provider_definitions();
103035
103187
  init_redact();
103036
103188
  init_composed_handler();
103037
103189
  init_anthropic_error();
@@ -103351,7 +103503,7 @@ async function classifyHandler(handler, hop) {
103351
103503
  kind: "refused",
103352
103504
  handler,
103353
103505
  message: refusalMessageOf(body),
103354
- chainContinues: isRetryableError(response.status, body, hop.displayName, response.headers, hop.provider)
103506
+ chainContinues: isRetryableError(response.status, body, hop.displayName, response.headers)
103355
103507
  };
103356
103508
  }
103357
103509
  if (handler instanceof ComposedHandler) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "14.27.1",
3
+ "version": "14.27.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",
@@ -74,10 +74,10 @@
74
74
  "ai"
75
75
  ],
76
76
  "optionalDependencies": {
77
- "@claudish/magmux-darwin-arm64": "14.27.1",
78
- "@claudish/magmux-darwin-x64": "14.27.1",
79
- "@claudish/magmux-linux-arm64": "14.27.1",
80
- "@claudish/magmux-linux-x64": "14.27.1"
77
+ "@claudish/magmux-darwin-arm64": "14.27.2",
78
+ "@claudish/magmux-darwin-x64": "14.27.2",
79
+ "@claudish/magmux-linux-arm64": "14.27.2",
80
+ "@claudish/magmux-linux-x64": "14.27.2"
81
81
  },
82
82
  "author": "Jack Rudenko <i@madappgang.com>",
83
83
  "license": "MIT",