@karlorz/codexhost-cli-linux-x64 0.21.0-1 → 0.22.0-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +1 -0
  4. package/app/console-web.js +2 -1
  5. package/app/cpa-live-voice-hook.js +213 -181
  6. package/app/desktop-controller.mjs +4 -1
  7. package/app/host-runtime.mjs +96 -26
  8. package/app/overlay-voice-bootstrap.js +1 -1616
  9. package/app/plugins/antigravity/plugin.mjs +1144 -1254
  10. package/app/plugins/claude-code/plugin.mjs +389 -80
  11. package/app/plugins/codebuddy/plugin.mjs +1 -0
  12. package/app/plugins/codex-usage/plugin.mjs +1 -0
  13. package/app/plugins/copilot/plugin.mjs +1 -0
  14. package/app/plugins/cursor-cli/plugin.mjs +1 -0
  15. package/app/plugins/deepseek-harness/plugin.mjs +1 -0
  16. package/app/plugins/devin/plugin.mjs +1 -0
  17. package/app/plugins/grok/plugin.mjs +232 -217
  18. package/app/plugins/hermes/plugin.mjs +1 -0
  19. package/app/plugins/kimi-code/plugin.mjs +1 -0
  20. package/app/plugins/kiro-cli/plugin.mjs +1 -0
  21. package/app/plugins/omp/plugin.mjs +108 -22
  22. package/app/plugins/opencode/plugin.mjs +1 -0
  23. package/app/plugins/pi/plugin.mjs +119 -23
  24. package/app/plugins/qoder/plugin.mjs +1 -0
  25. package/app/plugins/qoder-cn/plugin.mjs +1 -0
  26. package/app/plugins/qwen-code/plugin.mjs +1 -0
  27. package/app/plugins/workbuddy/plugin.mjs +1 -0
  28. package/app/plugins/zcode/plugin.mjs +1 -0
  29. package/app/renderer-extension.js +764 -477
  30. package/app/voice-qualification.json +10 -10
  31. package/app/web/assets/index-CYo5zTz_.js +201 -0
  32. package/app/web/codexhost-settings.js +2 -1
  33. package/app/web/index.html +1 -1
  34. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  35. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +3 -3
  36. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +9 -9
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +2 -2
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +1 -1
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +1 -1
  40. package/app/web-modules/server.mjs +130 -74
  41. package/bin/codexhost +0 -0
  42. package/libexec/codexhost-shim +0 -0
  43. package/libexec/codexhost-updater +0 -0
  44. package/package.json +1 -1
  45. package/app/web/assets/index-DLXdvkWR.js +0 -201
@@ -15221,6 +15221,11 @@ var harnessModelSchema = external_exports.object({
15221
15221
  fastModel: harnessModelRefSchema.optional(),
15222
15222
  supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
15223
15223
  }).strict();
15224
+ function catalogModelForRef(catalog, ref) {
15225
+ if (!ref)
15226
+ return void 0;
15227
+ return catalog?.models.find((model2) => model2.ref.id === ref.id || model2.fastModel?.id === ref.id);
15228
+ }
15224
15229
  var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
15225
15230
  const ids = /* @__PURE__ */ new Set();
15226
15231
  for (const [index, option2] of options.entries()) {
@@ -16902,6 +16907,19 @@ var updateStatusResultSchema = external_exports.strictObject({
16902
16907
  status: updateStatusSchema.nullable()
16903
16908
  });
16904
16909
 
16910
+ // ../../shared-contracts/dist/desktop-attachments.js
16911
+ var ATTACHED_FILES_HEADING = /^\s*# Files mentioned by the user:[ \t]*(?:\r?\n|$)/u;
16912
+ var REQUEST_HEADING = /(?:^|\n)## My request:[ \t]*(?:\r?\n|$)/u;
16913
+ var IMAGE_ATTACHMENT_PATTERN = /(?:^|\n)## [^\r\n]+: ((?:\/|[A-Za-z]:[\\/]|\\\\)[^\r\n]+)\r?\nImage attachment: true(?=\r?\n|$)/gu;
16914
+ var CONTROL_CHARACTER_PATTERN = /[\u0000-\u001f\u007f]/u;
16915
+ function desktopImageAttachmentPaths(text2) {
16916
+ const end = text2.search(REQUEST_HEADING);
16917
+ const context = end < 0 ? text2 : text2.slice(0, end);
16918
+ if (!ATTACHED_FILES_HEADING.test(context))
16919
+ return [];
16920
+ return [...context.matchAll(IMAGE_ATTACHMENT_PATTERN)].map((match) => match[1] ?? "").filter((path18) => path18.length > 0 && !CONTROL_CHARACTER_PATTERN.test(path18));
16921
+ }
16922
+
16905
16923
  // ../../shared-contracts/dist/thread-watch-notice.js
16906
16924
  var THREAD_WATCH_NOTICE_OUTCOMES = [
16907
16925
  "completed",
@@ -16973,6 +16991,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
16973
16991
  message: "A history continuation requires its connection epoch"
16974
16992
  }).optional()
16975
16993
  }),
16994
+ external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
16976
16995
  external_exports.strictObject({
16977
16996
  kind: external_exports.literal("configure"),
16978
16997
  ...thread,
@@ -19103,6 +19122,7 @@ function claudePromptCacheIndicators(accountCreditsSupported, lastResponseAtUnix
19103
19122
  // dist/claude-code-adapter.js
19104
19123
  import { randomUUID as randomUUID5 } from "node:crypto";
19105
19124
  import path15 from "node:path";
19125
+ import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
19106
19126
 
19107
19127
  // ../../../node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs
19108
19128
  import { createRequire as jre } from "node:module";
@@ -56312,7 +56332,8 @@ var ClaudeNativeTurnAccumulator = class {
56312
56332
  if (message.type !== "system")
56313
56333
  return;
56314
56334
  if (message.subtype === "init") {
56315
- events.push({ type: "segment.started" });
56335
+ const mcpServers = Array.isArray(message.mcp_servers) ? message.mcp_servers.flatMap((server) => isRecord7(server) && typeof server.name === "string" ? [server.name] : []) : void 0;
56336
+ events.push({ type: "segment.started", ...mcpServers ? { mcpServers } : {} });
56316
56337
  return;
56317
56338
  }
56318
56339
  if (message.subtype !== "background_tasks_changed" || !Array.isArray(message.tasks))
@@ -56721,6 +56742,31 @@ var ClaudeNativeTurnAccumulator = class {
56721
56742
  }
56722
56743
  };
56723
56744
 
56745
+ // dist/claude-tool-item.js
56746
+ function mcpServerSegment(server) {
56747
+ const segment = server.replace(/[^a-zA-Z0-9_-]/g, "_");
56748
+ return server.startsWith("claude.ai ") ? segment.replace(/_+/g, "_").replace(/^_|_$/g, "") : segment;
56749
+ }
56750
+ function mcpTool(toolName, servers) {
56751
+ if (!toolName.startsWith("mcp__"))
56752
+ return null;
56753
+ const known = servers.map((server2) => `mcp__${mcpServerSegment(server2)}__`).filter((prefix) => toolName.length > prefix.length && toolName.startsWith(prefix)).sort((left, right) => right.length - left.length)[0];
56754
+ if (known)
56755
+ return { server: known.slice(5, -2), tool: toolName.slice(known.length) };
56756
+ const [, server, ...tool] = toolName.split("__");
56757
+ const name = tool.join("__");
56758
+ return server && name ? { server, tool: name } : null;
56759
+ }
56760
+ function claudeToolItem(itemId, toolName, args, mcpServers = []) {
56761
+ const mcp = mcpTool(toolName, mcpServers);
56762
+ if (mcp)
56763
+ return { type: "mcpToolCall", itemId, ...mcp, arguments: args };
56764
+ if (toolName === "WebSearch" && typeof args === "object" && args !== null && !Array.isArray(args) && typeof args.query === "string" && args.query.length > 0) {
56765
+ return { type: "webSearch", itemId, query: args.query };
56766
+ }
56767
+ return { type: "toolExecution", itemId, toolName, arguments: args };
56768
+ }
56769
+
56724
56770
  // dist/item-identity.js
56725
56771
  function claudeTranscriptItemId(nativeTurnKey, kind, ordinal) {
56726
56772
  return hostItemIdSchema.parse(`claude-item-v2-${nativeTurnKey}-${kind}-${ordinal}`);
@@ -56851,10 +56897,18 @@ function readClaudeQueuedCommand(value, sessionId) {
56851
56897
  if (value.type !== "attachment" || !isRecord9(attachment) || attachment.type !== "queued_command" || attachment.commandMode !== "prompt" || !isRecord9(attachment.origin) || attachment.origin.kind !== "human" || attachment.humanTurn === false || attachment.isMeta === true || attachment.isSynthetic === true || value.isMeta === true || value.isSynthetic === true || value.isSidechain === true || isRecord9(value.origin) && value.origin.kind !== "human" || typeof value.parent_tool_use_id === "string" && value.parent_tool_use_id.length > 0 || value.sessionId !== void 0 && value.sessionId !== sessionId || value.session_id !== sessionId) {
56852
56898
  return null;
56853
56899
  }
56854
- if (typeof value.uuid !== "string" || value.uuid.length === 0 || typeof attachment.source_uuid !== "string" || attachment.source_uuid.length === 0 || typeof attachment.prompt !== "string" || attachment.prompt.length === 0) {
56900
+ const prompt = promptText(attachment.prompt);
56901
+ if (typeof value.uuid !== "string" || value.uuid.length === 0 || typeof attachment.source_uuid !== "string" || attachment.source_uuid.length === 0 || prompt.length === 0) {
56855
56902
  throw new Error("Claude queued human input has an invalid identity or text prompt");
56856
56903
  }
56857
- return { uuid: value.uuid, sourceUuid: attachment.source_uuid, prompt: attachment.prompt };
56904
+ return { uuid: value.uuid, sourceUuid: attachment.source_uuid, prompt };
56905
+ }
56906
+ function promptText(prompt) {
56907
+ if (typeof prompt === "string")
56908
+ return prompt;
56909
+ if (!Array.isArray(prompt))
56910
+ return "";
56911
+ return prompt.flatMap((block) => isRecord9(block) && block.type === "text" && typeof block.text === "string" ? [block.text] : []).join("\n");
56858
56912
  }
56859
56913
 
56860
56914
  // dist/claude-history.js
@@ -57126,10 +57180,10 @@ function itemOutcome(outcome) {
57126
57180
  function isCheckpointCandidate(message) {
57127
57181
  return !message.nested && (message.type === "assistant" || message.interrupted || hasRootToolResult(message));
57128
57182
  }
57129
- function mapClaudeSnapshot(values, sessionId) {
57130
- return mapClaudeSnapshotWithCheckpointIds(values, sessionId).snapshot;
57183
+ function mapClaudeSnapshot(values, sessionId, mcpServers) {
57184
+ return mapClaudeSnapshotWithCheckpointIds(values, sessionId, mcpServers).snapshot;
57131
57185
  }
57132
- function mapClaudeSnapshotWithCheckpointIds(values, sessionId) {
57186
+ function mapClaudeSnapshotWithCheckpointIds(values, sessionId, mcpServers) {
57133
57187
  const messages = conversationMessages(values, sessionId);
57134
57188
  const turns = [];
57135
57189
  const turnCheckpointIds = [];
@@ -57279,15 +57333,10 @@ function mapClaudeSnapshotWithCheckpointIds(values, sessionId) {
57279
57333
  });
57280
57334
  continue;
57281
57335
  }
57282
- const argumentsResult = jsonValueSchema.safeParse(block.input);
57283
57336
  const questionRecord = claudeAskUserQuestionRecord(block.name, block.input, output, failed, result.toolUseResult);
57284
57337
  items.push({
57285
57338
  item: {
57286
- type: "toolExecution",
57287
- itemId,
57288
- toolName: block.name,
57289
- arguments: argumentsResult.success ? argumentsResult.data : null,
57290
- ...output ? { output: { content: [{ type: "text", text: output }] } } : {},
57339
+ ...historyToolItem(itemId, block.name, block.input, output, mcpServers),
57291
57340
  ...questionRecord ? { questionRecord } : {}
57292
57341
  },
57293
57342
  outcome: toolOutcome
@@ -57301,6 +57350,11 @@ function mapClaudeSnapshotWithCheckpointIds(values, sessionId) {
57301
57350
  }
57302
57351
  return { snapshot: { turns }, turnCheckpointIds };
57303
57352
  }
57353
+ function historyToolItem(itemId, toolName, input, output, mcpServers) {
57354
+ const argumentsResult = jsonValueSchema.safeParse(input);
57355
+ const item = claudeToolItem(itemId, toolName, argumentsResult.success ? argumentsResult.data : null, mcpServers);
57356
+ return output ? { ...item, output: { content: [{ type: "text", text: output }] } } : item;
57357
+ }
57304
57358
  function toolResultBlocks(messages) {
57305
57359
  const results = /* @__PURE__ */ new Map();
57306
57360
  for (const message of messages) {
@@ -57437,15 +57491,10 @@ function mapClaudeSubagentSnapshot(values, parentSessionId, nativeSubagentId2, p
57437
57491
  });
57438
57492
  continue;
57439
57493
  }
57440
- const argumentsResult = jsonValueSchema.safeParse(block.input);
57441
57494
  const questionRecord = claudeAskUserQuestionRecord(block.name, block.input, output, failed, result.toolUseResult);
57442
57495
  items.push({
57443
57496
  item: {
57444
- type: "toolExecution",
57445
- itemId,
57446
- toolName: block.name,
57447
- arguments: argumentsResult.success ? argumentsResult.data : null,
57448
- ...output ? { output: { content: [{ type: "text", text: output }] } } : {},
57497
+ ...historyToolItem(itemId, block.name, block.input, output),
57449
57498
  ...questionRecord ? { questionRecord } : {}
57450
57499
  },
57451
57500
  outcome: toolOutcome
@@ -57848,6 +57897,37 @@ var CLAUDE_THINKING_OPTIONS = [
57848
57897
  ];
57849
57898
  var CLAUDE_THINKING_OPTION_IDS = CLAUDE_THINKING_OPTIONS.map(({ id: id2 }) => id2);
57850
57899
  var CLAUDE_DEFAULT_THINKING_OPTION_ID = harnessThinkingOptionIdSchema.parse("auto");
57900
+ function claudeSupportedThinkingOptionIds(model2) {
57901
+ if (model2.supportsEffort === void 0 && model2.supportedEffortLevels === void 0 && model2.supportsAdaptiveThinking === void 0 && model2.supportsThinkingOff === void 0) {
57902
+ return [...CLAUDE_THINKING_OPTION_IDS];
57903
+ }
57904
+ const efforts = new Set(model2.supportsEffort === false ? [] : model2.supportedEffortLevels ?? []);
57905
+ return CLAUDE_THINKING_OPTION_IDS.filter((id2) => {
57906
+ if (id2 === "off")
57907
+ return model2.supportsThinkingOff !== false;
57908
+ if (id2 === "auto")
57909
+ return true;
57910
+ if (id2 === "ultracode")
57911
+ return efforts.has("xhigh");
57912
+ return efforts.has(id2);
57913
+ });
57914
+ }
57915
+ var CLAUDE_EFFORT_ORDER = ["low", "medium", "high", "xhigh", "max"];
57916
+ function fitClaudeThinkingOptionId(requested, supported) {
57917
+ if (!supported || supported.includes(requested))
57918
+ return requested;
57919
+ const ceiling = CLAUDE_EFFORT_ORDER.indexOf(requested === "ultracode" ? "xhigh" : requested);
57920
+ let best = CLAUDE_DEFAULT_THINKING_OPTION_ID;
57921
+ let bestRank = -1;
57922
+ for (const id2 of supported) {
57923
+ const rank = CLAUDE_EFFORT_ORDER.indexOf(id2);
57924
+ if (rank > bestRank && rank <= ceiling) {
57925
+ best = id2;
57926
+ bestRank = rank;
57927
+ }
57928
+ }
57929
+ return best;
57930
+ }
57851
57931
  function parseClaudeThinkingOptionId(value) {
57852
57932
  const id2 = harnessThinkingOptionIdSchema.parse(value);
57853
57933
  if (!CLAUDE_THINKING_OPTION_IDS.includes(id2)) {
@@ -57880,7 +57960,13 @@ var modelInfoSchema = external_exports.object({
57880
57960
  value: external_exports.string().trim().min(1).max(CLAUDE_MODEL_VALUE_MAX_LENGTH),
57881
57961
  displayName: external_exports.string().trim().min(1).max(HARNESS_MODEL_LABEL_MAX_LENGTH),
57882
57962
  description: external_exports.string().trim().max(HARNESS_MODEL_LABEL_MAX_LENGTH).optional(),
57883
- resolvedModel: harnessResolvedModelLabelSchema.optional()
57963
+ resolvedModel: harnessResolvedModelLabelSchema.optional(),
57964
+ // Malformed capability fields count as unreported instead of failing the whole catalog;
57965
+ // unknown effort levels are ignored when mapping Thinking options.
57966
+ supportsEffort: external_exports.boolean().optional().catch(void 0),
57967
+ supportedEffortLevels: external_exports.array(external_exports.string()).optional().catch(void 0),
57968
+ supportsAdaptiveThinking: external_exports.boolean().optional().catch(void 0),
57969
+ supportsThinkingOff: external_exports.boolean().optional().catch(void 0)
57884
57970
  });
57885
57971
  var modelPickerOptionSchema = external_exports.object({
57886
57972
  model: external_exports.string().trim().min(1).max(CLAUDE_MODEL_VALUE_MAX_LENGTH),
@@ -58063,12 +58149,17 @@ function uniqueDisplayLabels(rows) {
58063
58149
  }
58064
58150
  return labels;
58065
58151
  }
58152
+ function canonicalRow(row) {
58153
+ if (row.supportedEffortLevels === void 0)
58154
+ return row;
58155
+ return { ...row, supportedEffortLevels: [...new Set(row.supportedEffortLevels)].sort() };
58156
+ }
58066
58157
  function normalizeRows(value) {
58067
58158
  if (!Array.isArray(value))
58068
58159
  throw new Error("Claude Code Model catalog is not an array");
58069
58160
  const byValue = /* @__PURE__ */ new Map();
58070
58161
  for (const nativeRow of value) {
58071
- const row = modelInfoSchema.parse(nativeRow);
58162
+ const row = canonicalRow(modelInfoSchema.parse(nativeRow));
58072
58163
  const existing = byValue.get(row.value);
58073
58164
  if (existing && JSON.stringify(existing) !== JSON.stringify(row)) {
58074
58165
  throw new Error("Claude Code Model catalog contains conflicting selectable values");
@@ -58093,7 +58184,7 @@ function normalizeClaudeModelCatalog(snapshot) {
58093
58184
  ref: encodeClaudeModelRef(row.value),
58094
58185
  label: labels.get(row.value) ?? row.displayName,
58095
58186
  ...row.resolvedModel ? { resolvedModelLabel: row.resolvedModel } : {},
58096
- supportedThinkingOptionIds: [...CLAUDE_THINKING_OPTION_IDS]
58187
+ supportedThinkingOptionIds: claudeSupportedThinkingOptionIds(row)
58097
58188
  };
58098
58189
  });
58099
58190
  models.sort((left, right) => {
@@ -58710,7 +58801,10 @@ var ClaudeSdkTransport = class {
58710
58801
  // Adaptive Thinking is redacted by default: the API streams `thinking_delta`
58711
58802
  // frames carrying only token estimates and empty text, so no Reasoning Item
58712
58803
  // would ever start. Summarized display is the official channel for readable
58713
- // Thinking and is what Claude Code's own TUI renders.
58804
+ // Thinking and is what Claude Code's own TUI renders. The SDK passes this as
58805
+ // `--thinking adaptive`, which only turns Thinking on: Claude Code sends adaptive
58806
+ // Thinking to Models that support it and a token budget to the rest. The caller
58807
+ // fits the effort to the Model's catalog levels.
58714
58808
  thinking: thinking.enabled ? { type: "adaptive", display: "summarized" } : { type: "disabled" },
58715
58809
  ...thinking.effort ? { effort: thinking.effort } : {},
58716
58810
  pathToClaudeCodeExecutable: executable,
@@ -58813,13 +58907,23 @@ var ClaudeSdkTransport = class {
58813
58907
  throw new Error("Claude SDK transport is not started");
58814
58908
  return this.#permissionMode;
58815
58909
  }
58816
- async setModel(model2) {
58910
+ async setModel(model2, thinkingOptionId = this.#thinkingOptionId) {
58817
58911
  const activeQuery = this.#query;
58818
58912
  if (!this.#started || !activeQuery)
58819
58913
  throw new Error("Claude SDK transport is not started");
58820
- const thinking = claudeThinkingConfiguration(this.#thinkingOptionId);
58914
+ const id2 = parseClaudeThinkingOptionId(thinkingOptionId);
58915
+ const previous = claudeThinkingConfiguration(this.#thinkingOptionId);
58916
+ const thinking = claudeThinkingConfiguration(id2);
58821
58917
  const previousModel = this.#currentModel;
58822
58918
  await activeQuery.setModel(model2);
58919
+ if (id2 !== this.#thinkingOptionId && !thinking.ultracode) {
58920
+ try {
58921
+ await activeQuery.applyFlagSettings(claudeThinkingFlagSettings(thinking, previous));
58922
+ } catch (error52) {
58923
+ await this.#restoreOrFault(() => activeQuery.setModel(previousModel));
58924
+ throw error52;
58925
+ }
58926
+ }
58823
58927
  if (thinking.ultracode) {
58824
58928
  try {
58825
58929
  await activeQuery.applyFlagSettings(claudeThinkingFlagSettings(thinking, thinking));
@@ -58827,13 +58931,14 @@ var ClaudeSdkTransport = class {
58827
58931
  } catch (error52) {
58828
58932
  await this.#restoreOrFault(async () => {
58829
58933
  await activeQuery.setModel(previousModel);
58830
- await activeQuery.applyFlagSettings(claudeThinkingFlagSettings(thinking, null));
58831
- await this.#verifyUltracode(activeQuery);
58934
+ await activeQuery.applyFlagSettings(claudeThinkingFlagSettings(previous, thinking));
58935
+ await (previous.ultracode ? this.#verifyUltracode(activeQuery) : this.#verifyUltracodeOff(activeQuery));
58832
58936
  });
58833
58937
  throw error52;
58834
58938
  }
58835
58939
  }
58836
58940
  this.#currentModel = model2;
58941
+ this.#thinkingOptionId = id2;
58837
58942
  }
58838
58943
  async setThinkingOption(thinkingOptionId) {
58839
58944
  const activeQuery = this.#query;
@@ -58905,7 +59010,7 @@ var ClaudeSdkTransport = class {
58905
59010
  recap(userMessageId, onEvent) {
58906
59011
  return this.runTurn("/recap", userMessageId, onEvent);
58907
59012
  }
58908
- runTurn(text2, userMessageId, onEvent) {
59013
+ runTurn(content, userMessageId, onEvent) {
58909
59014
  if (this.#closePromise || !this.#started || !this.#query) {
58910
59015
  return Promise.reject(new Error("Claude SDK transport is not started"));
58911
59016
  }
@@ -58927,7 +59032,7 @@ var ClaudeSdkTransport = class {
58927
59032
  onEvent(event);
58928
59033
  this.#input.push({
58929
59034
  type: "user",
58930
- message: { role: "user", content: text2 },
59035
+ message: { role: "user", content },
58931
59036
  parent_tool_use_id: null,
58932
59037
  session_id: this.sessionId,
58933
59038
  uuid: userMessageId,
@@ -58944,7 +59049,7 @@ var ClaudeSdkTransport = class {
58944
59049
  * The Turn ending first therefore does not reject it, and a missing `queued` receipt resolves
58945
59050
  * after a bounded wait so callers that serialize requests are never held indefinitely.
58946
59051
  */
58947
- steer(text2, messageId, onTakeover) {
59052
+ steer(content, messageId, onTakeover) {
58948
59053
  if (this.#closePromise || !this.#started || !this.#query || !this.canSteerActiveTurn()) {
58949
59054
  return Promise.reject(new ClaudeSteerMissedTurnError());
58950
59055
  }
@@ -58954,7 +59059,7 @@ var ClaudeSdkTransport = class {
58954
59059
  try {
58955
59060
  this.#input.push({
58956
59061
  type: "user",
58957
- message: { role: "user", content: text2 },
59062
+ message: { role: "user", content },
58958
59063
  parent_tool_use_id: null,
58959
59064
  session_id: this.sessionId,
58960
59065
  uuid: messageId,
@@ -60203,6 +60308,7 @@ var ClaudeToolLifecycle = class {
60203
60308
  #onDetached;
60204
60309
  #outputLimit;
60205
60310
  #taskTracker;
60311
+ #mcpServers;
60206
60312
  #nativeTurnKey;
60207
60313
  #tools = /* @__PURE__ */ new Map();
60208
60314
  #toolOrdinal = 0;
@@ -60213,6 +60319,7 @@ var ClaudeToolLifecycle = class {
60213
60319
  this.#onDetached = options.onDetached;
60214
60320
  this.#outputLimit = options.outputLimit;
60215
60321
  this.#taskTracker = options.taskTracker;
60322
+ this.#mcpServers = options.mcpServers ?? (() => []);
60216
60323
  this.#nativeTurnKey = options.nativeTurnKey;
60217
60324
  }
60218
60325
  get size() {
@@ -60228,12 +60335,7 @@ var ClaudeToolLifecycle = class {
60228
60335
  itemId,
60229
60336
  command,
60230
60337
  cwd: this.#cwd
60231
- } : {
60232
- type: "toolExecution",
60233
- itemId,
60234
- toolName: isClaudeTaskTool(event.toolName) ? "Todo" : event.toolName,
60235
- arguments: isClaudeTaskTool(event.toolName) ? {} : event.arguments
60236
- };
60338
+ } : isClaudeTaskTool(event.toolName) ? { type: "toolExecution", itemId, toolName: "Todo", arguments: {} } : claudeToolItem(itemId, event.toolName, event.arguments, this.#mcpServers());
60237
60339
  this.#tools.set(event.callId, {
60238
60340
  item,
60239
60341
  nativeName: event.toolName,
@@ -60278,6 +60380,8 @@ var ClaudeToolLifecycle = class {
60278
60380
  } : {},
60279
60381
  durationMs
60280
60382
  };
60383
+ } else if (tool.item.type === "webSearch") {
60384
+ tool.item = { ...tool.item, ...output ? { output } : {} };
60281
60385
  } else {
60282
60386
  tool.item = { ...tool.item, ...output ? { output } : {}, durationMs };
60283
60387
  }
@@ -60306,7 +60410,7 @@ var ClaudeToolLifecycle = class {
60306
60410
  for (const [callId, tool] of this.#tools) {
60307
60411
  this.#tools.delete(callId);
60308
60412
  const durationMs = Math.max(tool.elapsedMs, Date.now() - tool.startedAtMs, 0);
60309
- this.#completeItem(turnId, { ...tool.item, durationMs }, outcome);
60413
+ this.#completeItem(turnId, tool.item.type === "webSearch" ? tool.item : { ...tool.item, durationMs }, outcome);
60310
60414
  }
60311
60415
  }
60312
60416
  #completeItem(turnId, item, outcome) {
@@ -60358,6 +60462,135 @@ function estimateClaudeRequestCostUsd(usage) {
60358
60462
  return Number.isFinite(cost) && cost >= 0 ? cost : void 0;
60359
60463
  }
60360
60464
 
60465
+ // dist/turn-input.js
60466
+ import { constants as constants3 } from "node:fs";
60467
+ import { open as open6 } from "node:fs/promises";
60468
+ var MAX_IMAGE_FILE_BYTES = 20 * 1024 * 1024;
60469
+ var MAX_STEER_BASE64_BYTES = 5 * 1024 * 1024;
60470
+ var MAX_STEER_IMAGE_SIDE = 2e3;
60471
+ var HEADER_BYTES = 32;
60472
+ function imageMediaType(data) {
60473
+ if (data.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]))) {
60474
+ return "image/png";
60475
+ }
60476
+ if (data.subarray(0, 3).equals(Buffer.from([255, 216, 255])))
60477
+ return "image/jpeg";
60478
+ const head = data.subarray(0, 12).toString("latin1");
60479
+ if (head.startsWith("GIF87a") || head.startsWith("GIF89a"))
60480
+ return "image/gif";
60481
+ if (head.startsWith("RIFF") && head.slice(8) === "WEBP")
60482
+ return "image/webp";
60483
+ return null;
60484
+ }
60485
+ function jpegDimensions(data) {
60486
+ let offset = 2;
60487
+ while (offset + 9 <= data.length) {
60488
+ if (data[offset] !== 255)
60489
+ return null;
60490
+ const marker = data[offset + 1] ?? 0;
60491
+ if (marker === 255) {
60492
+ offset += 1;
60493
+ continue;
60494
+ }
60495
+ if (marker >= 192 && marker <= 207 && marker !== 196 && marker !== 200 && marker !== 204) {
60496
+ return { height: data.readUInt16BE(offset + 5), width: data.readUInt16BE(offset + 7) };
60497
+ }
60498
+ if (marker === 1 || marker >= 208 && marker <= 216) {
60499
+ offset += 2;
60500
+ continue;
60501
+ }
60502
+ offset += 2 + data.readUInt16BE(offset + 2);
60503
+ }
60504
+ return null;
60505
+ }
60506
+ function imageDimensions(data, mediaType) {
60507
+ if (data.length < 30)
60508
+ return null;
60509
+ switch (mediaType) {
60510
+ case "image/png":
60511
+ return { width: data.readUInt32BE(16), height: data.readUInt32BE(20) };
60512
+ case "image/gif":
60513
+ return { width: data.readUInt16LE(6), height: data.readUInt16LE(8) };
60514
+ case "image/webp": {
60515
+ const chunk = data.toString("latin1", 12, 16);
60516
+ if (chunk === "VP8 ") {
60517
+ return { width: data.readUInt16LE(26) & 16383, height: data.readUInt16LE(28) & 16383 };
60518
+ }
60519
+ if (chunk === "VP8L") {
60520
+ const bits = data.readUInt32LE(21);
60521
+ return { width: (bits & 16383) + 1, height: (bits >>> 14 & 16383) + 1 };
60522
+ }
60523
+ if (chunk === "VP8X") {
60524
+ return { width: data.readUIntLE(24, 3) + 1, height: data.readUIntLE(27, 3) + 1 };
60525
+ }
60526
+ return null;
60527
+ }
60528
+ case "image/jpeg":
60529
+ return jpegDimensions(data);
60530
+ }
60531
+ }
60532
+ function fitsSteer(data, mediaType) {
60533
+ if (Math.ceil(data.length / 3) * 4 > MAX_STEER_BASE64_BYTES)
60534
+ return false;
60535
+ const size = imageDimensions(data, mediaType);
60536
+ return size !== null && size.width > 0 && size.height > 0 && size.width <= MAX_STEER_IMAGE_SIDE && size.height <= MAX_STEER_IMAGE_SIDE;
60537
+ }
60538
+ async function imageBlock(file2, steer) {
60539
+ let handle;
60540
+ try {
60541
+ handle = await open6(file2, constants3.O_RDONLY | constants3.O_NONBLOCK);
60542
+ } catch {
60543
+ return null;
60544
+ }
60545
+ try {
60546
+ const stats = await handle.stat();
60547
+ if (!stats.isFile() || stats.size > MAX_IMAGE_FILE_BYTES)
60548
+ return null;
60549
+ if (steer && Math.ceil(stats.size / 3) * 4 > MAX_STEER_BASE64_BYTES)
60550
+ return null;
60551
+ const header = Buffer.alloc(HEADER_BYTES);
60552
+ const { bytesRead } = await handle.read(header, 0, HEADER_BYTES, 0);
60553
+ if (!imageMediaType(header.subarray(0, bytesRead)))
60554
+ return null;
60555
+ const buffer = Buffer.alloc(stats.size + 1);
60556
+ let length = 0;
60557
+ while (length < buffer.length) {
60558
+ const read = await handle.read(buffer, length, buffer.length - length, length);
60559
+ if (read.bytesRead === 0)
60560
+ break;
60561
+ length += read.bytesRead;
60562
+ }
60563
+ if (length > stats.size)
60564
+ return null;
60565
+ const data = buffer.subarray(0, length);
60566
+ const mediaType = imageMediaType(data.subarray(0, HEADER_BYTES));
60567
+ if (!mediaType)
60568
+ return null;
60569
+ if (steer && !fitsSteer(data, mediaType))
60570
+ return null;
60571
+ return {
60572
+ type: "image",
60573
+ source: { type: "base64", media_type: mediaType, data: data.toString("base64") }
60574
+ };
60575
+ } catch {
60576
+ return null;
60577
+ } finally {
60578
+ await handle.close().catch(() => void 0);
60579
+ }
60580
+ }
60581
+ async function claudeUserContent(text2, { steer = false } = {}) {
60582
+ const paths = [...new Set(desktopImageAttachmentPaths(text2))];
60583
+ if (paths.length === 0)
60584
+ return text2;
60585
+ const content = [{ type: "text", text: text2 }];
60586
+ for (const file2 of paths) {
60587
+ const block = await imageBlock(file2, steer);
60588
+ if (block)
60589
+ content.push(block);
60590
+ }
60591
+ return content.length > 1 ? content : text2;
60592
+ }
60593
+
60361
60594
  // dist/claude-code-adapter.js
60362
60595
  var claudeCodeHarnessId2 = harnessIdSchema.parse("claude-code");
60363
60596
  var claudeCommandCatalog = harnessCommandCatalogSchema.parse({
@@ -60649,12 +60882,16 @@ var ClaudeHarnessSession = class {
60649
60882
  #requestedModel;
60650
60883
  #requestedPermissionModeId;
60651
60884
  #requestedThinkingOptionId;
60885
+ /** This Session's folder's inspected catalog, which says what Thinking each Model accepts. */
60886
+ #modelCatalog;
60652
60887
  #readSessionMessages;
60653
60888
  #sessionId;
60654
60889
  #toolOutputLimit;
60655
60890
  #backgroundCommands;
60656
60891
  #continuationQuiescenceMs;
60657
60892
  #taskTracker = new ClaudeTaskTracker();
60893
+ /** MCP server names the latest native Segment reported; they disambiguate MCP Tool names. */
60894
+ #mcpServers = [];
60658
60895
  #acceptingTurn = false;
60659
60896
  #active = null;
60660
60897
  #closePromise = null;
@@ -60706,7 +60943,8 @@ var ClaudeHarnessSession = class {
60706
60943
  this.#openMode = options.openMode;
60707
60944
  this.#requestedModel = options.requestedModel;
60708
60945
  this.#requestedPermissionModeId = options.requestedPermissionModeId;
60709
- this.#requestedThinkingOptionId = options.requestedThinkingOptionId;
60946
+ this.#modelCatalog = options.modelCatalog;
60947
+ this.#requestedThinkingOptionId = fitClaudeThinkingOptionId(options.requestedThinkingOptionId, this.#supportedThinkingOptionIds(options.requestedModel ?? (this.#openMode === "create" ? CLAUDE_DEFAULT_MODEL_REF : void 0)));
60710
60948
  this.#sessionId = options.sessionId;
60711
60949
  this.#toolOutputLimit = options.toolOutputLimit;
60712
60950
  this.#backgroundCommands = new ClaudeBackgroundCommandItems({
@@ -60774,39 +61012,56 @@ var ClaudeHarnessSession = class {
60774
61012
  this.#readingHistory = true;
60775
61013
  try {
60776
61014
  let messages;
60777
- try {
60778
- const deadline = Date.now() + this.#closeTimeoutMs;
60779
- for (; ; ) {
61015
+ const deadline = Date.now() + this.#closeTimeoutMs;
61016
+ for (; ; ) {
61017
+ try {
60780
61018
  messages = await this.#readSessionMessages({
60781
61019
  cwd: this.#cwd,
60782
61020
  sessionId: this.#sessionId
60783
61021
  }) ?? [];
60784
- const ids = new Set(messages.flatMap((message) => isRecord16(message) && typeof message.uuid === "string" ? [message.uuid] : []));
60785
- if (this.#unpersistedMessageIds.every((id2) => isPersistedClaudeMessageId(id2, ids))) {
60786
- this.#unpersistedMessageIds = [];
60787
- break;
60788
- }
60789
- if (Date.now() >= deadline || this.#phase !== "open") {
60790
- return {
60791
- ok: false,
60792
- error: {
60793
- code: "sessionBusy",
60794
- message: "Claude Code history is still being persisted",
60795
- retryable: true
60796
- }
60797
- };
60798
- }
60799
- await delay2(25);
61022
+ } catch {
61023
+ return {
61024
+ ok: false,
61025
+ error: {
61026
+ code: "nativeFailure",
61027
+ message: "Claude Code history could not be read",
61028
+ retryable: true
61029
+ }
61030
+ };
60800
61031
  }
60801
- } catch {
60802
- return {
60803
- ok: false,
60804
- error: {
60805
- code: "nativeFailure",
60806
- message: "Claude Code history could not be read",
60807
- retryable: true
60808
- }
60809
- };
61032
+ let ids;
61033
+ try {
61034
+ ids = new Set(messages.flatMap((message) => {
61035
+ if (!isRecord16(message) || typeof message.uuid !== "string")
61036
+ return [];
61037
+ const queued = readClaudeQueuedCommand(message, this.#sessionId);
61038
+ return queued ? [message.uuid, queued.sourceUuid] : [message.uuid];
61039
+ }));
61040
+ } catch {
61041
+ return {
61042
+ ok: false,
61043
+ error: {
61044
+ code: "protocolError",
61045
+ message: "Claude Code history is invalid",
61046
+ retryable: false
61047
+ }
61048
+ };
61049
+ }
61050
+ if (this.#unpersistedMessageIds.every((id2) => isPersistedClaudeMessageId(id2, ids))) {
61051
+ this.#unpersistedMessageIds = [];
61052
+ break;
61053
+ }
61054
+ if (Date.now() >= deadline || this.#phase !== "open") {
61055
+ return {
61056
+ ok: false,
61057
+ error: {
61058
+ code: "sessionBusy",
61059
+ message: "Claude Code history is still being persisted",
61060
+ retryable: true
61061
+ }
61062
+ };
61063
+ }
61064
+ await delay2(25);
60810
61065
  }
60811
61066
  if (messages.length === 0 && isPendingClaudeSession(this.#nativeRef)) {
60812
61067
  try {
@@ -60837,7 +61092,10 @@ var ClaudeHarnessSession = class {
60837
61092
  try {
60838
61093
  return {
60839
61094
  ok: true,
60840
- value: { ...mapClaudeSnapshot(messages, this.#sessionId), state: this.#state }
61095
+ value: {
61096
+ ...mapClaudeSnapshot(messages, this.#sessionId, this.#mcpServers),
61097
+ state: this.#state
61098
+ }
60841
61099
  };
60842
61100
  } catch {
60843
61101
  return {
@@ -60891,6 +61149,7 @@ var ClaudeHarnessSession = class {
60891
61149
  };
60892
61150
  }
60893
61151
  this.#acceptingTurn = true;
61152
+ const content = await claudeUserContent(text2);
60894
61153
  const startingTransport = this.#transport === null;
60895
61154
  let transport;
60896
61155
  try {
@@ -60949,6 +61208,7 @@ var ClaudeHarnessSession = class {
60949
61208
  cwd: this.#cwd,
60950
61209
  outputLimit: this.#toolOutputLimit,
60951
61210
  taskTracker: this.#taskTracker,
61211
+ mcpServers: () => this.#mcpServers,
60952
61212
  nativeTurnKey,
60953
61213
  newItemId: () => hostItemIdSchema.parse(this.#randomUUID()),
60954
61214
  emit: (event) => this.#event(event),
@@ -60987,7 +61247,7 @@ var ClaudeHarnessSession = class {
60987
61247
  nativeTurnKey,
60988
61248
  formatVersion: 1
60989
61249
  });
60990
- const running = transport.runTurn(text2, nativeTurnRef.nativeTurnKey, (event) => {
61250
+ const running = transport.runTurn(content, nativeTurnRef.nativeTurnKey, (event) => {
60991
61251
  this.#handleTurnEvent(active, event);
60992
61252
  });
60993
61253
  active.userMessageId = nativeTurnRef.nativeTurnKey;
@@ -60999,13 +61259,6 @@ var ClaudeHarnessSession = class {
60999
61259
  return { ok: true, value: { turnId: command.turnId } };
61000
61260
  }
61001
61261
  async #steer(command) {
61002
- const active = this.#active;
61003
- if (!active || active.command.turnId !== command.turnId) {
61004
- return { ok: false, error: invalidState("Claude Code steer target is not the active Turn") };
61005
- }
61006
- if (active.cancellationRequested) {
61007
- return { ok: false, error: invalidState("Claude Code steer target is being cancelled") };
61008
- }
61009
61262
  const text2 = command.input.map((input) => input.text).join("\n");
61010
61263
  if (text2.length === 0) {
61011
61264
  return {
@@ -61017,6 +61270,14 @@ var ClaudeHarnessSession = class {
61017
61270
  }
61018
61271
  };
61019
61272
  }
61273
+ const content = await claudeUserContent(text2, { steer: true });
61274
+ const active = this.#active;
61275
+ if (!active || active.command.turnId !== command.turnId) {
61276
+ return { ok: false, error: invalidState("Claude Code steer target is not the active Turn") };
61277
+ }
61278
+ if (active.cancellationRequested) {
61279
+ return { ok: false, error: invalidState("Claude Code steer target is being cancelled") };
61280
+ }
61020
61281
  const transport = this.#transport;
61021
61282
  if (!transport) {
61022
61283
  return { ok: false, error: invalidState("Claude Code steer missed the active Turn") };
@@ -61034,7 +61295,7 @@ var ClaudeHarnessSession = class {
61034
61295
  const messageId = this.#randomUUID();
61035
61296
  active.steersAwaitingNative.add(messageId);
61036
61297
  try {
61037
- await transport.steer(text2, messageId, (started) => this.#takeOverSteer(active, messageId, started));
61298
+ await transport.steer(content, messageId, (started) => this.#takeOverSteer(active, messageId, started));
61038
61299
  } catch (error52) {
61039
61300
  if (error52 instanceof ClaudeSteerMissedTurnError) {
61040
61301
  this.#takeOverSteer(active, messageId, false);
@@ -61127,6 +61388,7 @@ var ClaudeHarnessSession = class {
61127
61388
  cwd: this.#cwd,
61128
61389
  outputLimit: this.#toolOutputLimit,
61129
61390
  taskTracker: this.#taskTracker,
61391
+ mcpServers: () => this.#mcpServers,
61130
61392
  nativeTurnKey,
61131
61393
  newItemId: () => hostItemIdSchema.parse(this.#randomUUID()),
61132
61394
  emit: (event) => this.#event(event),
@@ -61243,10 +61505,11 @@ var ClaudeHarnessSession = class {
61243
61505
  resolveConfiguration = resolve5;
61244
61506
  });
61245
61507
  try {
61508
+ const thinkingOptionId = fitClaudeThinkingOptionId(this.#requestedThinkingOptionId, this.#supportedThinkingOptionIds(command.model));
61246
61509
  const transport = this.#transport;
61247
61510
  if (transport) {
61248
61511
  try {
61249
- await transport.setModel(model2);
61512
+ await transport.setModel(model2, thinkingOptionId);
61250
61513
  } catch (error52) {
61251
61514
  return {
61252
61515
  ok: false,
@@ -61259,6 +61522,7 @@ var ClaudeHarnessSession = class {
61259
61522
  }
61260
61523
  }
61261
61524
  this.#requestedModel = command.model;
61525
+ this.#requestedThinkingOptionId = thinkingOptionId;
61262
61526
  const persistenceError = await this.#savePendingConfiguration();
61263
61527
  if (persistenceError)
61264
61528
  return { ok: false, error: persistenceError };
@@ -61293,6 +61557,17 @@ var ClaudeHarnessSession = class {
61293
61557
  }
61294
61558
  };
61295
61559
  }
61560
+ const supported = this.#supportedThinkingOptionIds(this.#effectiveModelRef());
61561
+ if (supported && !supported.includes(thinkingOptionId)) {
61562
+ return {
61563
+ ok: false,
61564
+ error: {
61565
+ code: "invalidRequest",
61566
+ message: "Claude Code Thinking option is unavailable for the selected Model",
61567
+ retryable: false
61568
+ }
61569
+ };
61570
+ }
61296
61571
  this.#usageGeneration += 1;
61297
61572
  this.#contextUsageFreshUntilMs = 0;
61298
61573
  this.#contextUsageCooldownUntilMs = 0;
@@ -61759,15 +62034,39 @@ var ClaudeHarnessSession = class {
61759
62034
  }
61760
62035
  }
61761
62036
  #configuredState(nativeReady = this.#state.nativeRef !== void 0) {
61762
- const effectiveModel = this.#requestedModel ?? (this.#openMode === "create" ? CLAUDE_DEFAULT_MODEL_REF : this.#state.effectiveModel);
62037
+ const effectiveModel = this.#effectiveModelRef();
62038
+ const supported = this.#supportedThinkingOptionIds(effectiveModel);
61763
62039
  return {
61764
62040
  ...nativeReady ? { nativeRef: this.#nativeRef } : {},
61765
62041
  ...effectiveModel ? { effectiveModel } : {},
61766
62042
  effectiveThinkingOptionId: this.#requestedThinkingOptionId,
61767
- availableThinkingOptions: [...CLAUDE_THINKING_OPTIONS],
62043
+ // A live Claude Code keeps running a choice made before the catalog arrived; it stays
62044
+ // listed until the next Model switch fits it.
62045
+ availableThinkingOptions: CLAUDE_THINKING_OPTIONS.filter(({ id: id2 }) => !supported || supported.includes(id2) || id2 === this.#requestedThinkingOptionId),
61768
62046
  effectivePermissionModeId: this.#requestedPermissionModeId
61769
62047
  };
61770
62048
  }
62049
+ #effectiveModelRef() {
62050
+ return this.#requestedModel ?? (this.#openMode === "create" ? CLAUDE_DEFAULT_MODEL_REF : this.#state.effectiveModel);
62051
+ }
62052
+ #supportedThinkingOptionIds(model2) {
62053
+ return catalogModelForRef(this.#modelCatalog(), model2)?.supportedThinkingOptionIds;
62054
+ }
62055
+ /**
62056
+ * Fits the requested Thinking to a catalog inspected after this Session opened, so the choice
62057
+ * Claude Code starts with is the one shown. A live Claude Code already runs the earlier choice.
62058
+ */
62059
+ refitThinking(cwd) {
62060
+ if (this.#phase !== "open" || cwd !== this.#cwd || this.#transport)
62061
+ return;
62062
+ this.#requestedThinkingOptionId = fitClaudeThinkingOptionId(this.#requestedThinkingOptionId, this.#supportedThinkingOptionIds(this.#effectiveModelRef()));
62063
+ if (this.#state.effectiveThinkingOptionId === void 0)
62064
+ return;
62065
+ const state = this.#configuredState();
62066
+ if (state.effectiveThinkingOptionId !== this.#state.effectiveThinkingOptionId || !isDeepStrictEqual2(state.availableThinkingOptions, this.#state.availableThinkingOptions)) {
62067
+ this.#publishState(state);
62068
+ }
62069
+ }
61771
62070
  #publishState(state = this.#state) {
61772
62071
  this.#state = state;
61773
62072
  this.#statePublished = true;
@@ -61792,6 +62091,8 @@ var ClaudeHarnessSession = class {
61792
62091
  return;
61793
62092
  switch (event.type) {
61794
62093
  case "segment.started":
62094
+ if (event.mcpServers)
62095
+ this.#mcpServers = event.mcpServers;
61795
62096
  this.#observeRootOutput(active);
61796
62097
  if (active.cancellation && !active.cancellation.interrupting) {
61797
62098
  this.#interruptCancelledSegment(active).catch(() => this.#hardCancel(active));
@@ -62220,6 +62521,7 @@ var ClaudeHarnessSession = class {
62220
62521
  cwd: this.#cwd,
62221
62522
  outputLimit: this.#toolOutputLimit,
62222
62523
  taskTracker: this.#taskTracker,
62524
+ mcpServers: () => this.#mcpServers,
62223
62525
  nativeTurnKey,
62224
62526
  newItemId: () => hostItemIdSchema.parse(this.#randomUUID()),
62225
62527
  emit: (event) => this.#event(event),
@@ -62911,8 +63213,11 @@ var ClaudeCodeAdapter = class {
62911
63213
  if (current)
62912
63214
  return current;
62913
63215
  const inspection = this.#inspectModels(cwd).then((result) => {
62914
- if (result.status === "ready")
63216
+ if (result.status === "ready") {
62915
63217
  this.#inspectionCache.set(cwd, result);
63218
+ for (const session of this.#sessions)
63219
+ session.refitThinking(cwd);
63220
+ }
62916
63221
  return result;
62917
63222
  });
62918
63223
  this.#inspectionInFlight.set(cwd, inspection);
@@ -63204,6 +63509,10 @@ var ClaudeCodeAdapter = class {
63204
63509
  ...requestedModel ? { requestedModel } : {},
63205
63510
  requestedPermissionModeId,
63206
63511
  requestedThinkingOptionId,
63512
+ modelCatalog: () => {
63513
+ const inspection = this.#inspectionCache.get(cwd);
63514
+ return inspection?.status === "ready" ? inspection.catalog : void 0;
63515
+ },
63207
63516
  toolOutputLimit: this.#toolOutputLimit,
63208
63517
  cancelTimeoutMs: this.#cancelTimeoutMs,
63209
63518
  continuationQuiescenceMs: this.#continuationQuiescenceMs