claudish 12.2.2 → 12.3.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 +122 -22
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -901,7 +901,7 @@ var init_onepassword_config = __esm(() => {
901
901
  });
902
902
 
903
903
  // src/version.ts
904
- var VERSION = "12.2.2";
904
+ var VERSION = "12.3.1";
905
905
 
906
906
  // src/logger.ts
907
907
  import { appendFile, existsSync as existsSync2, mkdirSync, readdirSync, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
@@ -23769,6 +23769,22 @@ var init_minimax_model_dialect = __esm(() => {
23769
23769
  };
23770
23770
  });
23771
23771
 
23772
+ // src/auth/antigravity-client-version.ts
23773
+ function getAgyClientVersion() {
23774
+ return version2;
23775
+ }
23776
+ function agyClientVersionReadFor(accessToken) {
23777
+ return readForToken === accessToken;
23778
+ }
23779
+ function recordAgyClientVersionRead(read, accessToken) {
23780
+ readForToken = accessToken;
23781
+ if (read === null || read === version2)
23782
+ return false;
23783
+ version2 = read;
23784
+ return true;
23785
+ }
23786
+ var version2 = null, readForToken = null;
23787
+
23772
23788
  // src/auth/credentials/credential-error.ts
23773
23789
  function terminalCredentialError(message, upstreamStatus) {
23774
23790
  return Object.assign(new Error(message), {
@@ -23859,6 +23875,21 @@ function defaultRunAgyRefresh() {
23859
23875
  invalidateReadStoreMemo();
23860
23876
  }
23861
23877
  }
23878
+ function defaultReadAgyVersion() {
23879
+ const agy = locateAgyBinary();
23880
+ if (!agy)
23881
+ return null;
23882
+ try {
23883
+ const out = execFileSync(agy, ["--version"], {
23884
+ encoding: "utf8",
23885
+ stdio: ["ignore", "pipe", "ignore"],
23886
+ timeout: AGY_VERSION_TIMEOUT_MS
23887
+ });
23888
+ return out.match(/\d+(\.\d+)+/)?.[0] ?? null;
23889
+ } catch {
23890
+ return null;
23891
+ }
23892
+ }
23862
23893
  function parseRecord(raw) {
23863
23894
  if (!raw)
23864
23895
  return null;
@@ -23916,6 +23947,18 @@ function needsRefresh(tok, now) {
23916
23947
  return true;
23917
23948
  return now >= expMs - EXPIRY_SKEW_MS;
23918
23949
  }
23950
+ function captureAgyClientVersion(accessToken, deps) {
23951
+ if (!deps.readAgyVersion || agyClientVersionReadFor(accessToken))
23952
+ return;
23953
+ const read = deps.readAgyVersion();
23954
+ recordAgyClientVersionRead(read, accessToken);
23955
+ if (read) {
23956
+ log(`[Antigravity] Client version from agy: ${read}`);
23957
+ } else {
23958
+ const kept = getAgyClientVersion();
23959
+ log("[Antigravity] Could not read the agy version" + (kept ? `; keeping ${kept}.` : "; using the fallback version."));
23960
+ }
23961
+ }
23919
23962
  async function resolveValidToken(deps) {
23920
23963
  if (process.platform !== "darwin") {
23921
23964
  throw terminalCredentialError("[Antigravity] The shared Antigravity token store is macOS-only for now. " + "Use g@<model> with GEMINI_API_KEY on this platform.");
@@ -23925,6 +23968,7 @@ async function resolveValidToken(deps) {
23925
23968
  throw terminalCredentialError("[Antigravity] No Antigravity session found. Sign in with `claudish login antigravity`, " + "or use g@<model> with GEMINI_API_KEY " + "(get one at https://aistudio.google.com/app/apikey).");
23926
23969
  }
23927
23970
  if (!needsRefresh(rec.token, deps.now())) {
23971
+ captureAgyClientVersion(rec.token.access_token, deps);
23928
23972
  return rec.token.access_token;
23929
23973
  }
23930
23974
  log("[Antigravity] Access token expired/near-expiry \u2014 asking the Antigravity CLI to refresh.");
@@ -23932,6 +23976,7 @@ async function resolveValidToken(deps) {
23932
23976
  const refreshedRec = parseRecord(deps.readStore());
23933
23977
  if (refreshedRec && !needsRefresh(refreshedRec.token, deps.now())) {
23934
23978
  log("[Antigravity] Shared token refreshed by the Antigravity CLI.");
23979
+ captureAgyClientVersion(refreshedRec.token.access_token, deps);
23935
23980
  return refreshedRec.token.access_token;
23936
23981
  }
23937
23982
  const message = `[Antigravity] ${describeRefreshFailure(outcome)}`;
@@ -23978,6 +24023,7 @@ async function forceRefreshAntigravityToken(deps = defaultDeps) {
23978
24023
  const token = refreshed?.token;
23979
24024
  if (token && token.access_token !== original.access_token && !needsRefresh(token, deps.now())) {
23980
24025
  log("[Antigravity] Shared token re-minted by the Antigravity CLI.");
24026
+ captureAgyClientVersion(token.access_token, deps);
23981
24027
  return token.access_token;
23982
24028
  }
23983
24029
  if (!refreshed || refreshed.token.access_token === original.access_token) {
@@ -24001,7 +24047,7 @@ function _resetAntigravityTokenState() {
24001
24047
  cachedHasToken = null;
24002
24048
  invalidateReadStoreMemo();
24003
24049
  }
24004
- var KC_SERVICE = "gemini", KC_ACCOUNT = "antigravity", PREFIX = "go-keyring-base64:", EXPIRY_SKEW_MS = 120000, AGY_REFRESH_TIMEOUT_MS = 12000, READ_STORE_TTL_MS = 3000, cachedRawStore = null, defaultDeps, cachedHasToken = null, HAS_TOKEN_TTL_MS = 5000, inFlight = null;
24050
+ var KC_SERVICE = "gemini", KC_ACCOUNT = "antigravity", PREFIX = "go-keyring-base64:", EXPIRY_SKEW_MS = 120000, AGY_REFRESH_TIMEOUT_MS = 12000, AGY_VERSION_TIMEOUT_MS = 5000, READ_STORE_TTL_MS = 3000, cachedRawStore = null, defaultDeps, cachedHasToken = null, HAS_TOKEN_TTL_MS = 5000, inFlight = null;
24005
24051
  var init_antigravity_token = __esm(() => {
24006
24052
  init_logger();
24007
24053
  defaultDeps = {
@@ -24009,6 +24055,7 @@ var init_antigravity_token = __esm(() => {
24009
24055
  writeStore: defaultWriteStore,
24010
24056
  deleteStore: defaultDeleteStore,
24011
24057
  runAgyRefresh: defaultRunAgyRefresh,
24058
+ readAgyVersion: defaultReadAgyVersion,
24012
24059
  now: () => Date.now()
24013
24060
  };
24014
24061
  });
@@ -24026,8 +24073,11 @@ function makeTerminalSetupError(message) {
24026
24073
  err.terminal = true;
24027
24074
  return err;
24028
24075
  }
24076
+ function antigravityClientVersion() {
24077
+ return getAgyClientVersion() ?? AGY_FALLBACK_CLIENT_VERSION;
24078
+ }
24029
24079
  function buildAntigravityUserAgent() {
24030
- return `antigravity/cli/1.1.9 (aidev_client; os_type=${process.platform}; arch=${process.arch}; auth_method=consumer)`;
24080
+ return `antigravity/cli/${antigravityClientVersion()} (aidev_client; os_type=${process.platform}; arch=${process.arch}; auth_method=consumer)`;
24031
24081
  }
24032
24082
  function resetAntigravityUserCache() {
24033
24083
  cachedAgProjectId = null;
@@ -24035,6 +24085,7 @@ function resetAntigravityUserCache() {
24035
24085
  cachedAgTierName = null;
24036
24086
  agServedCache = null;
24037
24087
  agServedCacheAt = 0;
24088
+ agServedCacheVersion = null;
24038
24089
  }
24039
24090
  async function callLoadCodeAssistAntigravity(accessToken) {
24040
24091
  const res = await fetch(`${apiBase()}:loadCodeAssist`, {
@@ -24101,8 +24152,31 @@ async function retrieveUserQuota(accessToken, projectId) {
24101
24152
  return null;
24102
24153
  }
24103
24154
  }
24155
+ function flattenAgentModelSorts(sorts) {
24156
+ if (!Array.isArray(sorts))
24157
+ return;
24158
+ const seen = new Set;
24159
+ const ids = [];
24160
+ for (const sort of sorts) {
24161
+ for (const group of sort?.groups ?? []) {
24162
+ for (const id of group?.modelIds ?? []) {
24163
+ if (typeof id !== "string" || id === "" || seen.has(id))
24164
+ continue;
24165
+ seen.add(id);
24166
+ ids.push(id);
24167
+ }
24168
+ }
24169
+ }
24170
+ return ids.length > 0 ? ids : undefined;
24171
+ }
24104
24172
  async function getServedAntigravityModels(accessToken, projectId, opts) {
24105
24173
  const now = Date.now();
24174
+ const version = antigravityClientVersion();
24175
+ if (agServedCache && agServedCacheVersion !== version) {
24176
+ log(`[Antigravity] Client version changed (${agServedCacheVersion} -> ${version}); ` + "refetching the dynamic models catalog.");
24177
+ agServedCache = null;
24178
+ agServedCacheAt = 0;
24179
+ }
24106
24180
  if (!opts?.force && agServedCache && now - agServedCacheAt < SERVED_MODELS_TTL_MS) {
24107
24181
  return agServedCache;
24108
24182
  }
@@ -24154,8 +24228,17 @@ async function getServedAntigravityModels(accessToken, projectId, opts) {
24154
24228
  if (info?.newModelId)
24155
24229
  deprecatedReplacements[oldId] = info.newModelId;
24156
24230
  }
24157
- agServedCache = { servedIds, defaultId, meta, excludedIds, deprecatedReplacements };
24231
+ const agentModelIds = flattenAgentModelSorts(data.agentModelSorts);
24232
+ agServedCache = {
24233
+ servedIds,
24234
+ defaultId,
24235
+ meta,
24236
+ excludedIds,
24237
+ deprecatedReplacements,
24238
+ ...agentModelIds ? { agentModelIds } : {}
24239
+ };
24158
24240
  agServedCacheAt = now;
24241
+ agServedCacheVersion = version;
24159
24242
  return agServedCache;
24160
24243
  }
24161
24244
  } else {
@@ -24168,7 +24251,7 @@ async function getServedAntigravityModels(accessToken, projectId, opts) {
24168
24251
  return agServedCache;
24169
24252
  return { servedIds: [], defaultId: null, meta: {} };
24170
24253
  }
24171
- var ANTIGRAVITY_DEFAULT_HOST = "https://daily-cloudcode-pa.googleapis.com", SERVED_MODELS_TTL_MS, ANTIGRAVITY_IDE_TYPE = "ANTIGRAVITY", cachedAgProjectId = null, cachedAgTierId = null, cachedAgTierName = null, agServedCache = null, agServedCacheAt = 0;
24254
+ var ANTIGRAVITY_DEFAULT_HOST = "https://daily-cloudcode-pa.googleapis.com", SERVED_MODELS_TTL_MS, ANTIGRAVITY_IDE_TYPE = "ANTIGRAVITY", AGY_FALLBACK_CLIENT_VERSION = "1.1.9", cachedAgProjectId = null, cachedAgTierId = null, cachedAgTierName = null, agServedCache = null, agServedCacheAt = 0, agServedCacheVersion = null;
24172
24255
  var init_antigravity_user = __esm(() => {
24173
24256
  init_logger();
24174
24257
  SERVED_MODELS_TTL_MS = 10 * 60 * 1000;
@@ -33017,20 +33100,26 @@ async function fetchAntigravityModelsCatalog() {
33017
33100
  };
33018
33101
  }
33019
33102
  const { projectId } = await setupAntigravityUser(token);
33020
- const { servedIds, meta, excludedIds } = await getServedAntigravityModels(token, projectId);
33103
+ const { servedIds, meta, excludedIds, agentModelIds } = await getServedAntigravityModels(token, projectId);
33021
33104
  const declaredExcluded = excludedIds ?? new Set;
33022
- const selectable = servedIds.filter((id) => !declaredExcluded.has(id) && !isUndeclaredEditorInternal(id));
33105
+ const served = new Set(servedIds);
33106
+ const agentSelectable = (agentModelIds ?? []).filter((id) => served.has(id) && !declaredExcluded.has(id));
33107
+ const position = new Map(agentSelectable.map((id, index) => [id, index]));
33108
+ const otherSelectable = servedIds.filter((id) => !position.has(id) && !declaredExcluded.has(id) && !isUndeclaredEditorInternal(id));
33023
33109
  return {
33024
33110
  kind: "models",
33025
33111
  endpoint,
33026
- models: selectable.map((id) => {
33112
+ models: [...agentSelectable, ...otherSelectable].map((id) => {
33027
33113
  const m = meta[id];
33114
+ const index = position.get(id);
33115
+ const order = index === undefined ? {} : { providerOrder: index };
33028
33116
  return m?.contextWindow ? {
33029
33117
  id,
33030
33118
  contextWindow: m.contextWindow,
33031
33119
  ignoreCatalogReleaseDate: true,
33032
- reported: "chat"
33033
- } : { id, ignoreCatalogReleaseDate: true, reported: "chat" };
33120
+ reported: "chat",
33121
+ ...order
33122
+ } : { id, ignoreCatalogReleaseDate: true, reported: "chat", ...order };
33034
33123
  })
33035
33124
  };
33036
33125
  } catch (err) {
@@ -52040,7 +52129,8 @@ function ModelPicker({ source, onDone, onDiscoveryFailure }) {
52040
52129
  value: filter,
52041
52130
  matches: shown.length,
52042
52131
  total: list.rows.length,
52043
- width: layout.inner
52132
+ width: layout.inner,
52133
+ idle: discovery.outcome?.kind === "rows" && discovery.outcome.providerOrdered ? "" : undefined
52044
52134
  }),
52045
52135
  /* @__PURE__ */ jsx10(ColumnHeader, {
52046
52136
  layout: rowLayout
@@ -53012,7 +53102,8 @@ async function buildDiscoveredModelOutcome(provider, displayName, catalog) {
53012
53102
  if (head === undefined) {
53013
53103
  return { kind: "collapsed-empty", servedCount, chatCount, fallbackRows };
53014
53104
  }
53015
- return { kind: "rows", rows: [head, ...tail], servedCount, chatCount };
53105
+ const providerOrdered = discovered.some((m) => typeof m.providerOrder === "number");
53106
+ return providerOrdered ? { kind: "rows", rows: [head, ...tail], servedCount, chatCount, providerOrdered: true } : { kind: "rows", rows: [head, ...tail], servedCount, chatCount };
53016
53107
  }
53017
53108
  async function buildDiscoveredModelRows(provider, displayName, catalog) {
53018
53109
  const outcome = await buildDiscoveredModelOutcome(provider, displayName, catalog);
@@ -53050,8 +53141,18 @@ function buildRowsFromDiscovered(provider, displayName, discovered, catalogRows)
53050
53141
  source: displayName
53051
53142
  };
53052
53143
  });
53144
+ const orderById = new Map;
53145
+ for (const m of discovered) {
53146
+ if (typeof m.providerOrder === "number")
53147
+ orderById.set(m.id, m.providerOrder);
53148
+ }
53149
+ if (orderById.size > 0)
53150
+ return inProviderOrder(rows, orderById);
53053
53151
  return sortModelsNewestFirst(rows);
53054
53152
  }
53153
+ function inProviderOrder(rows, orderById) {
53154
+ return rows.filter((row) => orderById.has(row.id)).sort((a, b) => (orderById.get(a.id) ?? 0) - (orderById.get(b.id) ?? 0));
53155
+ }
53055
53156
  async function selectModelFromProvider(provider, tierName, recommendedModels, _forceUpdate, catalog) {
53056
53157
  const prefix = pickerModelPrefix(provider) ?? `${provider}@`;
53057
53158
  const displayName = getPickerDisplayName(provider);
@@ -63914,7 +64015,7 @@ function clampPaneSize(cols, rows) {
63914
64015
  function samePaneSize(a, b) {
63915
64016
  return !!a && !!b && a.cols === b.cols && a.rows === b.rows;
63916
64017
  }
63917
- var DEFAULT_PANE_COLS = 160, DEFAULT_PANE_ROWS = 50, MIN_PANE_COLS = 80, MAX_PANE_COLS = 9999, MIN_PANE_ROWS = 24, MAX_PANE_ROWS = 9999, MAX_PANE_CELLS = 4000000, RESIZE_QUIET_MS = 2000;
64018
+ var DEFAULT_PANE_COLS = 160, DEFAULT_PANE_ROWS = 50, MIN_PANE_COLS = 40, MAX_PANE_COLS = 9999, MIN_PANE_ROWS = 24, MAX_PANE_ROWS = 9999, MAX_PANE_CELLS = 4000000, RESIZE_QUIET_MS = 2000;
63918
64019
 
63919
64020
  // src/pane/process-identity.ts
63920
64021
  import { execFile, execFileSync as execFileSync2 } from "child_process";
@@ -65975,7 +66076,8 @@ function isUnnamedChoice(lines) {
65975
66076
  const yesNo = lines.some((l) => /^\s*(\u276F\s*)?(\d+\.\s+)?(Yes|No)\b|\(esc\)/.test(l));
65976
66077
  if (numbered && yesNo)
65977
66078
  return true;
65978
- return lines.some((l) => /Press Enter to continue/.test(l) || SELECT_FOOTER2.test(l));
66079
+ const flat = flatText(lines);
66080
+ return /Press Enter to continue/.test(flat) || SELECT_FOOTER2.test(flat);
65979
66081
  }
65980
66082
  function nameBootScreen(s) {
65981
66083
  const named = namedDialog(flatText(s.lines));
@@ -73100,7 +73202,7 @@ Use with: run_prompt(model="${suggested}", prompt="your prompt")`;
73100
73202
  },
73101
73203
  cols: {
73102
73204
  type: "integer",
73103
- description: "For 'resize' (required): the terminal width in columns, clamped to 80\u20139999. The " + "answer {run_id, path, slot, cols, rows, changed, seq} reports the size set."
73205
+ description: "For 'resize' (required): the terminal width in columns, clamped to 40\u20139999. The " + "answer {run_id, path, slot, cols, rows, changed, seq} reports the size set."
73104
73206
  },
73105
73207
  rows: {
73106
73208
  type: "integer",
@@ -73704,12 +73806,12 @@ Report manually at https://github.com/anthropics/claudish/issues${autoSendHint}`
73704
73806
  });
73705
73807
  tools.push({
73706
73808
  name: "resize_session",
73707
- description: "Set a session's terminal size: the child gets a real SIGWINCH and Claude Code reflows. " + "Allowed at any time, mid-turn included; the last call wins. The size is clamped to " + "cols 80\u20139999, rows 24\u20139999 and at most 4 000 000 cells (magmux's limits); the answer " + "{session_id, cols, rows, changed, seq, pending?} reports the size set. `seq` is the screen's seq after the resize: the next capture_session " + "shows the new cols/rows. `changed:false` = already that size. `pending:true` = the pane " + "is starting or its socket is reconnecting; the size is applied then. A finished session " + "answers its last size with changed:false. Errors are a JSON ContractError " + "(`resize_unsupported` when the installed magmux has no resize op).",
73809
+ description: "Set a session's terminal size: the child gets a real SIGWINCH and Claude Code reflows. " + "Allowed at any time, mid-turn included; the last call wins. The size is clamped to " + "cols 40\u20139999, rows 24\u20139999 and at most 4 000 000 cells (claudish's floor, magmux's " + "ceiling); the answer " + "{session_id, cols, rows, changed, seq, pending?} reports the size set. `seq` is the screen's seq after the resize: the next capture_session " + "shows the new cols/rows. `changed:false` = already that size. `pending:true` = the pane " + "is starting or its socket is reconnecting; the size is applied then. A finished session " + "answers its last size with changed:false. Errors are a JSON ContractError " + "(`resize_unsupported` when the installed magmux has no resize op).",
73708
73810
  inputSchema: {
73709
73811
  type: "object",
73710
73812
  properties: {
73711
73813
  session_id: { type: "string", description: "Session ID from create_session" },
73712
- cols: { type: "integer", description: "Terminal width in columns (clamped to 80\u20139999)" },
73814
+ cols: { type: "integer", description: "Terminal width in columns (clamped to 40\u20139999)" },
73713
73815
  rows: {
73714
73816
  type: "integer",
73715
73817
  description: "Terminal height in rows (clamped to 24\u20139999 and 4 000 000 cells)"
@@ -75176,11 +75278,9 @@ import { homedir as homedir36 } from "os";
75176
75278
  import { join as join56 } from "path";
75177
75279
  async function defaultSuggestModel() {
75178
75280
  try {
75179
- const tok = readSharedAntigravityToken();
75180
- if (!tok)
75181
- return "<model>";
75182
- const { projectId } = await setupAntigravityUser(tok.access_token);
75183
- const { servedIds, defaultId } = await getServedAntigravityModels(tok.access_token, projectId);
75281
+ const token = await getValidAntigravityAccessToken();
75282
+ const { projectId } = await setupAntigravityUser(token);
75283
+ const { servedIds, defaultId } = await getServedAntigravityModels(token, projectId);
75184
75284
  return defaultId || servedIds[0] || "<model>";
75185
75285
  } catch {
75186
75286
  return "<model>";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "12.2.2",
3
+ "version": "12.3.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",
@@ -60,10 +60,10 @@
60
60
  "ai"
61
61
  ],
62
62
  "optionalDependencies": {
63
- "@claudish/magmux-darwin-arm64": "12.2.2",
64
- "@claudish/magmux-darwin-x64": "12.2.2",
65
- "@claudish/magmux-linux-arm64": "12.2.2",
66
- "@claudish/magmux-linux-x64": "12.2.2"
63
+ "@claudish/magmux-darwin-arm64": "12.3.1",
64
+ "@claudish/magmux-darwin-x64": "12.3.1",
65
+ "@claudish/magmux-linux-arm64": "12.3.1",
66
+ "@claudish/magmux-linux-x64": "12.3.1"
67
67
  },
68
68
  "author": "Jack Rudenko <i@madappgang.com>",
69
69
  "license": "MIT",