@liberseek/boft-cli-win32-arm64 0.8.3 → 0.8.4

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 (34) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +58 -5
  4. package/app/console-web.js +436 -67
  5. package/app/desktop-controller.mjs +72 -9
  6. package/app/host-runtime.mjs +772 -218
  7. package/app/plugins/antigravity/plugin.mjs +91 -13
  8. package/app/plugins/claude-code/plugin.mjs +404 -26
  9. package/app/plugins/codebuddy/plugin.mjs +117 -22
  10. package/app/plugins/codex-usage/plugin.mjs +176 -74
  11. package/app/plugins/copilot/assets/icon.png +0 -0
  12. package/app/plugins/copilot/manifest.json +26 -0
  13. package/app/plugins/copilot/plugin.mjs +34601 -0
  14. package/app/plugins/cursor-cli/plugin.mjs +20794 -44912
  15. package/app/plugins/deepseek-harness/plugin.mjs +83 -11
  16. package/app/plugins/enabled.json +1 -0
  17. package/app/plugins/grok/plugin.mjs +214 -24
  18. package/app/plugins/hermes/plugin.mjs +80 -9
  19. package/app/plugins/kimi-code/plugin.mjs +76 -7
  20. package/app/plugins/kiro-cli/plugin.mjs +76 -7
  21. package/app/plugins/muse/plugin.mjs +73 -5
  22. package/app/plugins/omp/plugin.mjs +2155 -2000
  23. package/app/plugins/opencode/plugin.mjs +85 -11
  24. package/app/plugins/pi/plugin.mjs +2515 -2298
  25. package/app/plugins/qoder/plugin.mjs +83 -11
  26. package/app/plugins/qoder-cn/plugin.mjs +83 -11
  27. package/app/plugins/workbuddy/plugin.mjs +378 -46
  28. package/app/plugins/zcode/plugin.mjs +84 -11
  29. package/app/renderer-extension.js +833 -162
  30. package/bin/boft.exe +0 -0
  31. package/libexec/boft-node-repl.exe +0 -0
  32. package/libexec/boft-shim.exe +0 -0
  33. package/libexec/boft-updater.exe +0 -0
  34. package/package.json +1 -1
@@ -14662,10 +14662,19 @@ var model = external_exports.string().min(1).max(512);
14662
14662
  var project = external_exports.string().min(1).max(4096);
14663
14663
  var usageStatisticsParamsSchema = external_exports.strictObject({
14664
14664
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
14665
+ /** Display timezone for ranges, dates and hourly buckets; omitted means the Host's local zone. */
14666
+ timeZone: external_exports.string().min(1).max(128).refine((value) => {
14667
+ try {
14668
+ new Intl.DateTimeFormat("en", { timeZone: value });
14669
+ return true;
14670
+ } catch {
14671
+ return false;
14672
+ }
14673
+ }, "Unsupported usage statistics timezone").optional(),
14665
14674
  harness: harness.optional(),
14666
14675
  model: model.nullable().optional(),
14667
14676
  project: project.nullable().optional(),
14668
- /** One local date inside the range. */
14677
+ /** One date in the query timezone inside the range. */
14669
14678
  date: localDate.optional()
14670
14679
  });
14671
14680
  var usageStatisticsTotalsSchema = external_exports.strictObject({
@@ -14701,7 +14710,7 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
14701
14710
  });
14702
14711
  var usageStatisticsResultSchema = external_exports.strictObject({
14703
14712
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
14704
- /** First local date of the range; null for all time. */
14713
+ /** First date in the query timezone (Host local when omitted); null for all time. */
14705
14714
  from: localDate.nullable(),
14706
14715
  to: localDate,
14707
14716
  /** The filters these figures apply, echoed so a late answer to older filters is recognised. */
@@ -14741,7 +14750,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
14741
14750
  totals: usageStatisticsTotalsSchema,
14742
14751
  /** Each date and Harness of the range: every filter except the day. */
14743
14752
  daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
14744
- /** Local weekday (0 = Sunday) and hour, all filters applied. */
14753
+ /** Weekday (0 = Sunday) and hour in the query timezone, all filters applied. */
14745
14754
  hourly: external_exports.array(external_exports.strictObject({
14746
14755
  weekday: external_exports.number().int().min(0).max(6),
14747
14756
  hour: external_exports.number().int().min(0).max(23),
@@ -14883,6 +14892,8 @@ var CONSOLE_HOST_METHODS = Object.freeze([
14883
14892
  "codexhost/harness/display-settings/set",
14884
14893
  "codexhost/harness/inspect",
14885
14894
  "codexhost/harness/installation",
14895
+ "codexhost/harness/installation/start",
14896
+ "codexhost/harness/installation/status",
14886
14897
  "codexhost/harness/launch-settings/get",
14887
14898
  "codexhost/harness/launch-settings/set",
14888
14899
  HARNESS_LONG_CONTEXT_GET_METHOD,
@@ -14960,7 +14971,18 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
14960
14971
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
14961
14972
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
14962
14973
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
14974
+ var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
14975
+ var composerIndicatorsSchema = external_exports.array(external_exports.object({
14976
+ kind: external_exports.literal("countdown"),
14977
+ id: external_exports.string().min(1).max(64),
14978
+ expiresAtUnix: nonNegativeSafeIntegerSchema,
14979
+ label: indicatorTextSchema(256).optional(),
14980
+ tooltip: indicatorTextSchema(1024).optional()
14981
+ }).strict()).max(2).refine((entries) => new Set(entries.map(({ id: id2 }) => id2)).size === entries.length, {
14982
+ message: "Composer indicator IDs must be unique"
14983
+ });
14963
14984
  var threadUsageSnapshotSchema = external_exports.object({
14985
+ composerIndicators: composerIndicatorsSchema.optional(),
14964
14986
  inputTokens: nonNegativeSafeIntegerSchema.optional(),
14965
14987
  cachedInputTokens: nonNegativeSafeIntegerSchema.optional(),
14966
14988
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
@@ -15386,7 +15408,9 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
15386
15408
  }).strict().optional(),
15387
15409
  input: external_exports.object({
15388
15410
  image: external_exports.boolean()
15389
- }).strict().optional()
15411
+ }).strict().optional(),
15412
+ /** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
15413
+ steer: external_exports.boolean().optional()
15390
15414
  }).strict();
15391
15415
  var harnessConfigurationStateSchema = external_exports.object({
15392
15416
  effectiveModel: harnessModelRefSchema.optional(),
@@ -15433,7 +15457,9 @@ var harnessInspectionSchema = external_exports.union([
15433
15457
  var harnessInspectParamsSchema = external_exports.object({
15434
15458
  harnessId: harnessIdSchema,
15435
15459
  cwd: nonBlankTextSchema2.max(16384).optional(),
15436
- refresh: external_exports.boolean().optional()
15460
+ refresh: external_exports.boolean().optional(),
15461
+ /** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
15462
+ purpose: external_exports.literal("availability").optional()
15437
15463
  }).strict();
15438
15464
  var harnessWebUiOpenParamsSchema = external_exports.object({
15439
15465
  harnessId: harnessIdSchema
@@ -15518,6 +15544,15 @@ var threadOwnershipListResultSchema = external_exports.object({
15518
15544
  seen.add(thread.threadId);
15519
15545
  }
15520
15546
  });
15547
+ var threadSteeringInspectParamsSchema = external_exports.object({
15548
+ threadId: hostThreadIdSchema,
15549
+ /** The text about to be steered; a Harness command always stops and restarts. */
15550
+ text: external_exports.string().optional()
15551
+ }).strict();
15552
+ var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
15553
+ var threadSteeringInspectResultSchema = external_exports.object({
15554
+ delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
15555
+ }).strict();
15521
15556
 
15522
15557
  // ../../shared-contracts/dist/harness-route.js
15523
15558
  var harnessPluginRouteSchema = external_exports.object({
@@ -15550,6 +15585,10 @@ var harnessInstallationStateSchema = external_exports.object({
15550
15585
  latestVersion: external_exports.string().min(1).max(128),
15551
15586
  updateAvailable: external_exports.boolean(),
15552
15587
  canUpdate: external_exports.boolean(),
15588
+ /** Defaults to CLI; some Harnesses ship only inside a desktop application. */
15589
+ versionKind: external_exports.enum(["cli", "application"]).optional(),
15590
+ /** Official download opened by the user; does not imply an automatic installation. */
15591
+ manualUpdateUrl: external_exports.url().max(2048).refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Manual updates require a credential-free HTTPS URL").optional(),
15553
15592
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
15554
15593
  message: external_exports.string().max(2048).optional(),
15555
15594
  messageCode: external_exports.string().min(1).max(128).optional(),
@@ -15557,6 +15596,20 @@ var harnessInstallationStateSchema = external_exports.object({
15557
15596
  notice: harnessLocalizedTextSchema.optional(),
15558
15597
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
15559
15598
  }).strict();
15599
+ var harnessInstallationTaskParamsSchema = external_exports.object({ taskId: external_exports.string().uuid() }).strict();
15600
+ var harnessInstallationTaskSchema = external_exports.discriminatedUnion("status", [
15601
+ external_exports.object({ taskId: external_exports.string().uuid(), status: external_exports.literal("running") }).strict(),
15602
+ external_exports.object({
15603
+ taskId: external_exports.string().uuid(),
15604
+ status: external_exports.literal("succeeded"),
15605
+ result: harnessInstallationStateSchema
15606
+ }).strict(),
15607
+ external_exports.object({
15608
+ taskId: external_exports.string().uuid(),
15609
+ status: external_exports.literal("failed"),
15610
+ error: external_exports.object({ code: external_exports.number().int(), message: external_exports.string().min(1).max(2048) }).strict()
15611
+ }).strict()
15612
+ ]);
15560
15613
 
15561
15614
  // ../../shared-contracts/dist/codex-accounts.js
15562
15615
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
@@ -16081,6 +16134,7 @@ var usageFields = /* @__PURE__ */ new Set([
16081
16134
  ...safeIntegerFields,
16082
16135
  ...percentFields,
16083
16136
  "sessionCacheUsage",
16137
+ "composerIndicators",
16084
16138
  "totalCostUsd",
16085
16139
  "totalCredits",
16086
16140
  "contextUsagePercent",
@@ -16103,6 +16157,7 @@ function parseHostUsage(value) {
16103
16157
  throw new Error(`Harness Usage contains unknown field '${key}'`);
16104
16158
  }
16105
16159
  }
16160
+ const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
16106
16161
  for (const field of [
16107
16162
  "totalCredits",
16108
16163
  "contextUsagePercent",
@@ -16179,9 +16234,9 @@ function parseHostUsage(value) {
16179
16234
  if (value.costSource !== "publicPrice") {
16180
16235
  throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
16181
16236
  }
16182
- return { ...value, unpricedModels: [...models] };
16237
+ return { ...value, ...indicators, unpricedModels: [...models] };
16183
16238
  }
16184
- return { ...value };
16239
+ return { ...value, ...indicators };
16185
16240
  }
16186
16241
  var requestTokenFields = [
16187
16242
  "inputTokens",
@@ -16383,6 +16438,7 @@ var harnessBrokerMethodSchema = external_exports.enum([
16383
16438
  "adapter.sessionImport.resolve",
16384
16439
  "adapter.subagent.readSnapshot",
16385
16440
  "session.readSnapshot",
16441
+ "session.readCapabilities",
16386
16442
  "session.refreshUsage",
16387
16443
  "session.execute",
16388
16444
  "session.commands.list",
@@ -16584,6 +16640,11 @@ var turnStartSchema = external_exports.object({
16584
16640
  turnId: hostTurnIdSchema,
16585
16641
  input: external_exports.array(textInputSchema)
16586
16642
  }).strict();
16643
+ var turnSteerSchema = external_exports.object({
16644
+ type: external_exports.literal("turn.steer"),
16645
+ turnId: hostTurnIdSchema,
16646
+ input: external_exports.array(textInputSchema)
16647
+ }).strict();
16587
16648
  var turnCancelSchema = external_exports.object({ type: external_exports.literal("turn.cancel"), turnId: hostTurnIdSchema }).strict();
16588
16649
  var interactionResponseSchema = external_exports.union([
16589
16650
  external_exports.object({
@@ -16609,6 +16670,7 @@ var permissionSelectSchema = external_exports.object({
16609
16670
  }).strict();
16610
16671
  var brokerHostCommandSchema = external_exports.discriminatedUnion("type", [
16611
16672
  turnStartSchema,
16673
+ turnSteerSchema,
16612
16674
  turnCancelSchema,
16613
16675
  interactionRespondSchema,
16614
16676
  modelSelectSchema,
@@ -16801,6 +16863,7 @@ function parseSessionMetadata(value) {
16801
16863
  sessionId: candidate.sessionId,
16802
16864
  sessionGeneration: candidate.sessionGeneration,
16803
16865
  capabilities: harnessSessionCapabilitiesSchema.parse(candidate.capabilities),
16866
+ readCapabilities: candidate.readCapabilities === true,
16804
16867
  initialState: state,
16805
16868
  initialUsage: candidate.initialUsage === null ? null : parseHostUsage(candidate.initialUsage),
16806
16869
  commands: candidate.commands === true
@@ -17152,6 +17215,11 @@ var BrokeredHarnessSession = class {
17152
17215
  event: { type: "session.faulted", error: unavailable(error52.message) }
17153
17216
  });
17154
17217
  }
17218
+ async readCapabilities() {
17219
+ if (!this.#metadata.readCapabilities)
17220
+ return { ...this.capabilities, steer: false };
17221
+ return harnessSessionCapabilitiesSchema.parse(await this.#request("session.readCapabilities", {}));
17222
+ }
17155
17223
  async refreshUsage() {
17156
17224
  await this.#request("session.refreshUsage", {});
17157
17225
  }
@@ -17183,6 +17251,8 @@ var BrokeredHarnessSession = class {
17183
17251
  try {
17184
17252
  return parseHarnessResult(await this.#request("session.execute", { command }));
17185
17253
  } catch (error52) {
17254
+ if (command.type === "turn.steer")
17255
+ throw error52;
17186
17256
  return {
17187
17257
  ok: false,
17188
17258
  error: unavailable(error52 instanceof Error ? error52.message : String(error52))
@@ -17648,10 +17718,13 @@ function usageSessionTitle(value) {
17648
17718
  return void 0;
17649
17719
  if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
17650
17720
  return normalized;
17651
- const characters = [...normalized];
17652
- if (characters.length <= MAX_SESSION_TITLE_LENGTH)
17653
- return normalized;
17654
- return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
17721
+ let title = "";
17722
+ for (const character of normalized) {
17723
+ if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
17724
+ break;
17725
+ title += character;
17726
+ }
17727
+ return `${title.trimEnd()}…`;
17655
17728
  }
17656
17729
  function sessionIdOk(value) {
17657
17730
  return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
@@ -17804,6 +17877,31 @@ function createClaudeUsageStatistics(environment) {
17804
17877
  });
17805
17878
  }
17806
17879
 
17880
+ // dist/claude-prompt-cache.js
17881
+ function lastClaudeAssistantResponseUnix(messages) {
17882
+ let latest;
17883
+ for (const entry of messages) {
17884
+ if (typeof entry !== "object" || entry === null || !("type" in entry) || entry.type !== "assistant" || "isSidechain" in entry && entry.isSidechain === true || "parent_tool_use_id" in entry && entry.parent_tool_use_id != null || !("timestamp" in entry) || typeof entry.timestamp !== "string")
17885
+ continue;
17886
+ const time3 = Math.floor(Date.parse(entry.timestamp) / 1e3);
17887
+ if (Number.isSafeInteger(time3) && time3 >= 0)
17888
+ latest = Math.max(latest ?? 0, time3);
17889
+ }
17890
+ return latest;
17891
+ }
17892
+ function claudePromptCacheIndicators(accountCreditsSupported, lastResponseAtUnix) {
17893
+ if (!accountCreditsSupported || lastResponseAtUnix === void 0)
17894
+ return [];
17895
+ return [
17896
+ {
17897
+ kind: "countdown",
17898
+ id: "prompt-cache",
17899
+ expiresAtUnix: lastResponseAtUnix + 3600,
17900
+ label: { en: "Prompt cache", "zh-CN": "提示词缓存" }
17901
+ }
17902
+ ];
17903
+ }
17904
+
17807
17905
  // dist/claude-code-adapter.js
17808
17906
  import { randomUUID as randomUUID6 } from "node:crypto";
17809
17907
  import path18 from "node:path";
@@ -54724,17 +54822,21 @@ function parseResultModelUsage(value) {
54724
54822
  if (!isRecord6(value))
54725
54823
  return void 0;
54726
54824
  const usage = [];
54727
- for (const entry of Object.values(value)) {
54825
+ for (const [model2, entry] of Object.entries(value)) {
54728
54826
  if (!isRecord6(entry) || !safeNonNegativeInteger(entry.inputTokens) || !safeNonNegativeInteger(entry.outputTokens)) {
54729
54827
  return void 0;
54730
54828
  }
54829
+ const cacheRead = safeNonNegativeInteger(entry.cacheReadInputTokens) ? entry.cacheReadInputTokens : 0;
54830
+ const cacheWrite = safeNonNegativeInteger(entry.cacheCreationInputTokens) ? entry.cacheCreationInputTokens : 0;
54831
+ const promptTokens = entry.inputTokens + cacheRead + cacheWrite;
54731
54832
  usage.push({
54833
+ model: model2,
54732
54834
  inputTokens: entry.inputTokens,
54733
54835
  outputTokens: entry.outputTokens,
54734
- // Cache totals are optional in older payloads; default to zero so the
54735
- // session-cumulative cache hit rate can still be derived per entry.
54736
- cacheReadInputTokens: safeNonNegativeInteger(entry.cacheReadInputTokens) ? entry.cacheReadInputTokens : 0,
54737
- cacheCreationInputTokens: safeNonNegativeInteger(entry.cacheCreationInputTokens) ? entry.cacheCreationInputTokens : 0
54836
+ cacheReadInputTokens: cacheRead,
54837
+ cacheCreationInputTokens: cacheWrite,
54838
+ ...Number.isSafeInteger(promptTokens) ? { promptTokens } : {},
54839
+ ...safeNonNegativeInteger(entry.contextWindow) && entry.contextWindow > 0 ? { contextWindowTokens: entry.contextWindow } : {}
54738
54840
  });
54739
54841
  }
54740
54842
  return usage;
@@ -55086,6 +55188,7 @@ var ClaudeNativeTurnAccumulator = class {
55086
55188
  events.push({
55087
55189
  type: "message.completed",
55088
55190
  messageId,
55191
+ localCommand: true,
55089
55192
  ...checkpointId ? { checkpointId } : {}
55090
55193
  });
55091
55194
  }
@@ -55588,6 +55691,10 @@ function conversationMessages(values, sessionId) {
55588
55691
  const messages = [];
55589
55692
  const ids = /* @__PURE__ */ new Set();
55590
55693
  let promptId = null;
55694
+ const occupancy = new ClaudeBackgroundOccupancy();
55695
+ let accumulator = new ClaudeNativeTurnAccumulator();
55696
+ const sends = /* @__PURE__ */ new Set();
55697
+ let pendingNotification = false;
55591
55698
  for (const value of values) {
55592
55699
  if (!isRecord7(value))
55593
55700
  throw new Error("Claude history contains a malformed message");
@@ -55607,8 +55714,46 @@ function conversationMessages(values, sessionId) {
55607
55714
  timestampMs: isoToMs(value.timestamp),
55608
55715
  nested: typeof value.parent_tool_use_id === "string" && value.parent_tool_use_id.length > 0,
55609
55716
  interrupted,
55717
+ startsTurn: false,
55610
55718
  syntheticUser: value.type === "user" && (interrupted || value.isSynthetic === true || value.isMeta === true || isTaskNotificationOrigin(value) || value.toolUseResult !== void 0 && value.toolUseResult !== null)
55611
55719
  };
55720
+ const notification = message.type === "user" && !message.nested && (isTaskNotificationOrigin(value) || textParts(message.message.content).some(isTaskNotificationRecord));
55721
+ message.startsTurn = isHumanUser(message) || notification && !occupancy.unsettled && !pendingNotification;
55722
+ if (message.startsTurn) {
55723
+ occupancy.clear();
55724
+ sends.clear();
55725
+ accumulator = new ClaudeNativeTurnAccumulator();
55726
+ }
55727
+ for (const event of accumulator.consume(value).events) {
55728
+ if (event.type === "subagent.started") {
55729
+ if (event.operation === "send") {
55730
+ sends.add(event.callId);
55731
+ if (event.nativeSubagentId)
55732
+ occupancy.occupyAgent(event.nativeSubagentId);
55733
+ } else if (event.background)
55734
+ occupancy.occupySpawn(event.callId, event.nativeSubagentId);
55735
+ } else if (event.type === "subagent.completed") {
55736
+ if (!event.isError && (event.continuesInBackground || sends.has(event.callId))) {
55737
+ occupancy.occupySpawn(event.callId, event.nativeSubagentId);
55738
+ } else
55739
+ occupancy.release(event.callId, event.nativeSubagentId);
55740
+ sends.delete(event.callId);
55741
+ } else if (event.type === "workflow.launched" && event.background && !event.isError) {
55742
+ occupancy.occupySpawn(event.callId, event.taskId);
55743
+ } else if (event.type === "subagent.settled") {
55744
+ occupancy.notify(event.callId, event.nativeSubagentId);
55745
+ }
55746
+ }
55747
+ if (notification)
55748
+ pendingNotification = true;
55749
+ if (message.type === "assistant" && !message.nested) {
55750
+ pendingNotification = false;
55751
+ if (["end_turn", "stop_sequence", "max_tokens"].includes(String(message.message.stop_reason))) {
55752
+ occupancy.releaseContinuations();
55753
+ }
55754
+ }
55755
+ if (interrupted)
55756
+ occupancy.clear();
55612
55757
  messages.push(message);
55613
55758
  if (isHumanUser(message)) {
55614
55759
  promptId = typeof value.promptId === "string" && value.promptId.length > 0 ? value.promptId : null;
@@ -55666,17 +55811,17 @@ function mapClaudeSnapshot(values, sessionId) {
55666
55811
  const turns = [];
55667
55812
  for (let index = 0; index < messages.length; ) {
55668
55813
  const user = messages[index];
55669
- if (!user || !isHumanUser(user)) {
55814
+ if (!user || !user.startsTurn) {
55670
55815
  index += 1;
55671
55816
  continue;
55672
55817
  }
55673
55818
  let end = index + 1;
55674
- while (end < messages.length && !isHumanUser(messages[end]))
55819
+ while (end < messages.length && !messages[end]?.startsTurn)
55675
55820
  end += 1;
55676
55821
  const turnMessages = messages.slice(index, end);
55677
55822
  const outcome = turnOutcome(turnMessages);
55678
55823
  const results = toolResultBlocks(turnMessages);
55679
- const checkpointMessage = turnMessages.findLast(({ type, interrupted }) => type === "assistant" || interrupted);
55824
+ const checkpointMessage = turnMessages.findLast(({ type, interrupted, nested }) => !nested && (type === "assistant" || interrupted));
55680
55825
  const startedAtMs = turnMessages[0]?.timestampMs;
55681
55826
  const completedAtMs = turnMessages.at(-1)?.timestampMs;
55682
55827
  let agentMessageOrdinal = 0;
@@ -57234,12 +57379,21 @@ async function closeClaudeProcessGroup(child, timeoutMs) {
57234
57379
  throw new Error("Claude SDK process group did not exit");
57235
57380
  }
57236
57381
 
57382
+ // dist/transport.js
57383
+ var ClaudeSteerMissedTurnError = class extends Error {
57384
+ constructor() {
57385
+ super("Claude Code steer missed the active Turn");
57386
+ this.name = "ClaudeSteerMissedTurnError";
57387
+ }
57388
+ };
57389
+
57237
57390
  // dist/sdk-transport.js
57238
57391
  var CLIENT_APP = "codexhost-claude-code-adapter/0.0.0";
57239
57392
  var SESSION_ENTRYPOINT = "codexhost-sdk";
57240
57393
  var APPROVAL_TITLE_MAX_LENGTH = 120;
57241
57394
  var APPROVAL_DESCRIPTION_MAX_LENGTH = 500;
57242
57395
  var DEFAULT_ABORT_TIMEOUT_MS = 2e3;
57396
+ var DEFAULT_STEER_QUEUED_TIMEOUT_MS = 5e3;
57243
57397
  var WORKFLOW_AGENT_LABEL_LIMIT = 1e3;
57244
57398
  var INTERRUPT_TIMEOUT_MESSAGE = "Claude SDK interrupt timed out";
57245
57399
  var PushableInput = class {
@@ -57524,6 +57678,11 @@ var ClaudeSdkTransport = class {
57524
57678
  #queryFactory;
57525
57679
  #thinkingOptionId;
57526
57680
  #active = null;
57681
+ #steerQueuedTimeoutMs;
57682
+ #nativeSteer = false;
57683
+ /** Root tool calls of the requested Turn that have started and not yet returned a result. */
57684
+ #rootToolCalls = /* @__PURE__ */ new Set();
57685
+ #pendingSteers = /* @__PURE__ */ new Map();
57527
57686
  #autonomous = null;
57528
57687
  #autonomousTurnHandler = null;
57529
57688
  #idleHandler = null;
@@ -57547,6 +57706,7 @@ var ClaudeSdkTransport = class {
57547
57706
  this.sessionId = options.sessionId;
57548
57707
  this.#cwd = options.cwd;
57549
57708
  this.#abortTimeoutMs = options.abortTimeoutMs ?? DEFAULT_ABORT_TIMEOUT_MS;
57709
+ this.#steerQueuedTimeoutMs = options.steerQueuedTimeoutMs ?? DEFAULT_STEER_QUEUED_TIMEOUT_MS;
57550
57710
  this.#closeTimeoutMs = options.closeTimeoutMs;
57551
57711
  this.#command = options.command;
57552
57712
  this.#environment = options.environment ?? process.env;
@@ -57601,7 +57761,8 @@ var ClaudeSdkTransport = class {
57601
57761
  thinking: thinking.enabled ? { type: "adaptive", display: "summarized" } : { type: "disabled" },
57602
57762
  ...thinking.effort ? { effort: thinking.effort } : {},
57603
57763
  pathToClaudeCodeExecutable: executable,
57604
- settingSources: ["user"],
57764
+ // Omitted settingSources loads user, project and local settings like the
57765
+ // Claude Code CLI, so project CLAUDE.md and .claude/skills apply.
57605
57766
  permissionMode: this.#permissionMode,
57606
57767
  ...this.#allowDangerouslySkipPermissions ? { allowDangerouslySkipPermissions: true } : {},
57607
57768
  canUseTool: (toolName, input, options) => this.#canUseTool(toolName, input, options),
@@ -57638,6 +57799,40 @@ var ClaudeSdkTransport = class {
57638
57799
  return null;
57639
57800
  return { commands: this.#slashCommands, skillNames: this.#skillNames };
57640
57801
  }
57802
+ supportsNativeSteer() {
57803
+ return this.#nativeSteer;
57804
+ }
57805
+ /**
57806
+ * `priority: "next"` joins after the current tool call, and a tool result is always followed by
57807
+ * another model request. So a steer written while a root tool call runs folds into this Turn;
57808
+ * one written while Claude streams its final text may instead run as the next Turn.
57809
+ */
57810
+ canSteerActiveTurn() {
57811
+ return this.#nativeSteer && this.#active !== null && this.#rootToolCalls.size > 0;
57812
+ }
57813
+ #observeRootToolCalls(message) {
57814
+ if (!isRecord10(message) || message.parent_tool_use_id != null)
57815
+ return;
57816
+ if (message.type !== "assistant" && message.type !== "user")
57817
+ return;
57818
+ const body = message.message;
57819
+ if (!isRecord10(body) || !Array.isArray(body.content))
57820
+ return;
57821
+ for (const block of body.content) {
57822
+ if (!isRecord10(block))
57823
+ continue;
57824
+ if (message.type === "assistant" && block.type === "tool_use" && typeof block.id === "string") {
57825
+ this.#rootToolCalls.add(block.id);
57826
+ } else if (message.type === "user" && block.type === "tool_result" && typeof block.tool_use_id === "string") {
57827
+ this.#rootToolCalls.delete(block.tool_use_id);
57828
+ }
57829
+ }
57830
+ }
57831
+ #observeNativeCapabilities(message) {
57832
+ if (!isRecord10(message) || message.type !== "system" || message.subtype !== "init")
57833
+ return;
57834
+ this.#nativeSteer = Array.isArray(message.capabilities) && message.capabilities.includes("msg_lifecycle_v1");
57835
+ }
57641
57836
  #observeSlashCommands(message) {
57642
57837
  if (!isRecord10(message) || message.type !== "system")
57643
57838
  return;
@@ -57760,6 +57955,7 @@ var ClaudeSdkTransport = class {
57760
57955
  const unclaimed = this.#autonomous?.events ?? [];
57761
57956
  this.#autonomous = null;
57762
57957
  const promise2 = new Promise((resolve5, reject) => {
57958
+ this.#rootToolCalls.clear();
57763
57959
  this.#active = {
57764
57960
  accumulator: new ClaudeNativeTurnAccumulator(this.#provider ? { provider: this.#provider } : {}),
57765
57961
  onEvent,
@@ -57779,6 +57975,51 @@ var ClaudeSdkTransport = class {
57779
57975
  });
57780
57976
  return promise2;
57781
57977
  }
57978
+ /**
57979
+ * Claude accepts the input with `queued`; Claude Code 2.1.280 then emits `started` after the
57980
+ * current tool call, when `priority: "next"` joins the running Turn. Waiting for `started` would
57981
+ * hold the caller for a whole tool call.
57982
+ *
57983
+ * Once written, the input cannot be recalled: Claude delivers it in this Turn or runs it next.
57984
+ * The Turn ending first therefore does not reject it, and a missing `queued` receipt resolves
57985
+ * after a bounded wait so callers that serialize requests are never held indefinitely.
57986
+ */
57987
+ steer(text2, messageId) {
57988
+ if (this.#closePromise || !this.#started || !this.#query || !this.canSteerActiveTurn()) {
57989
+ return Promise.reject(new ClaudeSteerMissedTurnError());
57990
+ }
57991
+ const promise2 = new Promise((resolve5, reject) => {
57992
+ this.#pendingSteers.set(messageId, { resolve: resolve5, reject, timer: void 0 });
57993
+ });
57994
+ try {
57995
+ this.#input.push({
57996
+ type: "user",
57997
+ message: { role: "user", content: text2 },
57998
+ parent_tool_use_id: null,
57999
+ session_id: this.sessionId,
58000
+ uuid: messageId,
58001
+ origin: { kind: "human" },
58002
+ priority: "next"
58003
+ });
58004
+ } catch {
58005
+ this.#pendingSteers.delete(messageId);
58006
+ return Promise.reject(new ClaudeSteerMissedTurnError());
58007
+ }
58008
+ const pending = this.#pendingSteers.get(messageId);
58009
+ if (pending) {
58010
+ pending.timer = setTimeout(() => this.#acceptSteer(messageId), this.#steerQueuedTimeoutMs);
58011
+ pending.timer.unref?.();
58012
+ }
58013
+ return promise2;
58014
+ }
58015
+ #acceptSteer(messageId) {
58016
+ const pending = this.#pendingSteers.get(messageId);
58017
+ if (!pending)
58018
+ return;
58019
+ this.#pendingSteers.delete(messageId);
58020
+ clearTimeout(pending.timer);
58021
+ pending.resolve();
58022
+ }
57782
58023
  respondToInteraction(response) {
57783
58024
  const pending = this.#interactions.get(response.requestId);
57784
58025
  if (!pending) {
@@ -57950,6 +58191,7 @@ var ClaudeSdkTransport = class {
57950
58191
  }
57951
58192
  }
57952
58193
  async #close() {
58194
+ this.#rejectPendingSteers();
57953
58195
  const failures = [];
57954
58196
  this.#closeInteractions("all", "cancelled");
57955
58197
  try {
@@ -58003,6 +58245,7 @@ var ClaudeSdkTransport = class {
58003
58245
  }
58004
58246
  this.#query = null;
58005
58247
  const active = this.#active;
58248
+ this.#rootToolCalls.clear();
58006
58249
  this.#active = null;
58007
58250
  this.#autonomous = null;
58008
58251
  this.#idleAccumulator = null;
@@ -58057,6 +58300,26 @@ var ClaudeSdkTransport = class {
58057
58300
  await delay(10);
58058
58301
  }
58059
58302
  }
58303
+ #rejectPendingSteers() {
58304
+ const pending = [...this.#pendingSteers.values()];
58305
+ this.#pendingSteers.clear();
58306
+ const error52 = new Error("Claude Code steer receipt was lost after input was written");
58307
+ for (const entry of pending) {
58308
+ clearTimeout(entry.timer);
58309
+ entry.reject(error52);
58310
+ }
58311
+ }
58312
+ /** `queued` is Claude's acceptance of this message into the running Session. */
58313
+ #observeSteer(message) {
58314
+ if (this.#pendingSteers.size === 0 || !isRecord10(message) || message.type !== "command_lifecycle") {
58315
+ return;
58316
+ }
58317
+ if (message.state !== "queued")
58318
+ return;
58319
+ if (typeof message.command_uuid !== "string" || message.command_uuid.length === 0)
58320
+ return;
58321
+ this.#acceptSteer(message.command_uuid);
58322
+ }
58060
58323
  #observeBackgroundTasks(message) {
58061
58324
  if (!isRecord10(message) || message.type !== "system")
58062
58325
  return;
@@ -58097,6 +58360,7 @@ var ClaudeSdkTransport = class {
58097
58360
  this.#observeBackgroundTasks(message);
58098
58361
  this.#observeWorkflowAgents(message);
58099
58362
  this.#observeSlashCommands(message);
58363
+ this.#observeNativeCapabilities(message);
58100
58364
  const permissionMode = permissionModeFromMessage(message);
58101
58365
  if (permissionMode && permissionMode !== this.#permissionMode) {
58102
58366
  this.#permissionMode = permissionMode;
@@ -58105,13 +58369,16 @@ var ClaudeSdkTransport = class {
58105
58369
  const planLimit = parseClaudePlanLimitEvent(message);
58106
58370
  if (planLimit)
58107
58371
  this.#onPlanLimit(planLimit);
58372
+ this.#observeSteer(message);
58108
58373
  const active = this.#active;
58109
58374
  if (active) {
58375
+ this.#observeRootToolCalls(message);
58110
58376
  const interpreted2 = active.accumulator.consume(message);
58111
58377
  for (const event of interpreted2.events)
58112
58378
  active.onEvent(event);
58113
58379
  if (interpreted2.terminal) {
58114
58380
  this.#closeInteractions("root", "superseded");
58381
+ this.#rootToolCalls.clear();
58115
58382
  this.#active = null;
58116
58383
  active.resolve(interpreted2.terminal);
58117
58384
  }
@@ -58165,6 +58432,8 @@ var ClaudeSdkTransport = class {
58165
58432
  } catch (error52) {
58166
58433
  const active = this.#active;
58167
58434
  this.#closeInteractions("all", "cancelled");
58435
+ this.#rejectPendingSteers();
58436
+ this.#rootToolCalls.clear();
58168
58437
  this.#active = null;
58169
58438
  active?.reject(error52);
58170
58439
  if (!this.#closePromise)
@@ -59356,7 +59625,7 @@ function projectClaudePlanLimitToCredits(planLimit) {
59356
59625
  }
59357
59626
  var ClaudeHarnessSession = class {
59358
59627
  harnessId = claudeCodeHarnessId2;
59359
- capabilities = {
59628
+ capabilities = /* @__PURE__ */ ((session) => ({
59360
59629
  configuration: {
59361
59630
  selectModel: true,
59362
59631
  selectThinkingOption: true,
@@ -59365,11 +59634,16 @@ var ClaudeHarnessSession = class {
59365
59634
  },
59366
59635
  input: { image: true },
59367
59636
  history: { fork: true, forkAcrossCwd: false, rollbackLastTurn: true },
59368
- subagents: { observe: true, readTranscript: true }
59369
- };
59637
+ subagents: { observe: true, readTranscript: true },
59638
+ // Read live: native delivery joins this Turn only while a requested Turn runs a root tool call
59639
+ // on a CLI that confirms steers (`msg_lifecycle_v1`). Otherwise the Host stops and restarts.
59640
+ get steer() {
59641
+ return session.#transport?.canSteerActiveTurn?.() === true;
59642
+ }
59643
+ }))(this);
59370
59644
  commands;
59371
59645
  initialState;
59372
- initialUsage = null;
59646
+ initialUsage;
59373
59647
  outputs;
59374
59648
  get nativeSessionId() {
59375
59649
  return this.#sessionId;
@@ -59413,7 +59687,10 @@ var ClaudeHarnessSession = class {
59413
59687
  #hardCancelTask = null;
59414
59688
  #usageGeneration = 0;
59415
59689
  #latestUsage = null;
59690
+ #lastAssistantResponseAtUnix;
59691
+ #accountCreditsSupported;
59416
59692
  #minimumContextUsedTokens = null;
59693
+ #latestRequestModel = null;
59417
59694
  #calibratedInputTokens = 0;
59418
59695
  #calibratedCachedInputTokens = 0;
59419
59696
  #calibratedCacheWriteInputTokens = 0;
@@ -59433,6 +59710,11 @@ var ClaudeHarnessSession = class {
59433
59710
  #continuationQuiescence = null;
59434
59711
  constructor(cwd, dependencies, closeTimeoutMs, onClosed, onPlanLimitObserved, options) {
59435
59712
  this.#cwd = cwd;
59713
+ this.#lastAssistantResponseAtUnix = options.usageHistory.lastResponseAtUnix;
59714
+ this.#accountCreditsSupported = options.accountCreditsSupported;
59715
+ const composerIndicators = claudePromptCacheIndicators(this.#accountCreditsSupported, this.#lastAssistantResponseAtUnix);
59716
+ this.initialUsage = composerIndicators.length ? { composerIndicators } : null;
59717
+ this.#latestUsage = this.initialUsage;
59436
59718
  this.#pendingSessions = options.pendingSessions;
59437
59719
  const environment = options.environment;
59438
59720
  this.#createTransport = environment ? (input) => dependencies.createTransport({ ...input, environment }) : dependencies.createTransport;
@@ -59588,6 +59870,8 @@ var ClaudeHarnessSession = class {
59588
59870
  }
59589
59871
  if (command.type === "turn.cancel")
59590
59872
  return this.#cancel(command);
59873
+ if (command.type === "turn.steer")
59874
+ return this.#steer(command);
59591
59875
  if (command.type === "interaction.respond")
59592
59876
  return this.#respond(command);
59593
59877
  if (command.type === "model.select")
@@ -59738,6 +60022,45 @@ var ClaudeHarnessSession = class {
59738
60022
  }
59739
60023
  return { ok: true, value: { turnId: command.turnId } };
59740
60024
  }
60025
+ async #steer(command) {
60026
+ if (!this.#active || this.#active.command.turnId !== command.turnId) {
60027
+ return { ok: false, error: invalidState("Claude Code steer target is not the active Turn") };
60028
+ }
60029
+ const text2 = command.input.map((input) => input.text).join("\n");
60030
+ if (text2.length === 0) {
60031
+ return {
60032
+ ok: false,
60033
+ error: {
60034
+ code: "invalidRequest",
60035
+ message: "Claude Code steer text must not be empty",
60036
+ retryable: false
60037
+ }
60038
+ };
60039
+ }
60040
+ const transport = this.#transport;
60041
+ if (!transport) {
60042
+ return { ok: false, error: invalidState("Claude Code steer missed the active Turn") };
60043
+ }
60044
+ if (transport.supportsNativeSteer?.() !== true) {
60045
+ return {
60046
+ ok: false,
60047
+ error: {
60048
+ code: "unsupported",
60049
+ message: "This Claude Code version does not confirm native steering",
60050
+ retryable: false
60051
+ }
60052
+ };
60053
+ }
60054
+ try {
60055
+ await transport.steer(text2, this.#randomUUID());
60056
+ } catch (error52) {
60057
+ if (error52 instanceof ClaudeSteerMissedTurnError) {
60058
+ return { ok: false, error: invalidState("Claude Code steer missed the active Turn") };
60059
+ }
60060
+ throw error52;
60061
+ }
60062
+ return { ok: true, value: { accepted: true } };
60063
+ }
59741
60064
  /** Built-ins plus the live commands and skills of the started native Session. */
59742
60065
  #liveCommandCatalog() {
59743
60066
  return claudeLiveCommandCatalog(claudeCommandCatalog, this.#transport?.slashCommands?.() ?? null);
@@ -60538,6 +60861,10 @@ var ClaudeHarnessSession = class {
60538
60861
  this.#completeReasoning(active, event.messageId, { status: "succeeded" });
60539
60862
  return;
60540
60863
  case "message.completed": {
60864
+ if (!event.localCommand) {
60865
+ this.#lastAssistantResponseAtUnix = Math.floor(Date.now() / 1e3);
60866
+ this.publishAccountCreditsSupport(this.#accountCreditsSupported);
60867
+ }
60541
60868
  this.#observeRootOutput(active);
60542
60869
  if (event.lastRequestUsage) {
60543
60870
  this.#requestUsageBoundary += 1;
@@ -61206,6 +61533,8 @@ var ClaudeHarnessSession = class {
61206
61533
  const promptTokens = usage.inputTokens + usage.cacheCreationInputTokens + usage.cacheReadInputTokens;
61207
61534
  if (promptTokens > 0)
61208
61535
  this.#minimumContextUsedTokens = promptTokens;
61536
+ if (usage.model)
61537
+ this.#latestRequestModel = usage.model;
61209
61538
  const cacheHitRatePercent = this.#cacheHitRatePercent(usage);
61210
61539
  const contextWindowTokens = this.#latestUsage?.contextWindowTokens;
61211
61540
  this.#mergeAndPublishUsage({
@@ -61270,8 +61599,24 @@ var ClaudeHarnessSession = class {
61270
61599
  if (cacheHitRatePercent !== void 0)
61271
61600
  delta.cacheHitRatePercent = cacheHitRatePercent;
61272
61601
  }
61602
+ if (this.#latestUsage?.contextWindowTokens === void 0 && this.#minimumContextUsedTokens !== null) {
61603
+ const contextWindowTokens = this.#resultContextWindow(event.modelUsage);
61604
+ if (contextWindowTokens !== void 0) {
61605
+ delta.contextUsedTokens = this.#minimumContextUsedTokens;
61606
+ delta.contextWindowTokens = contextWindowTokens;
61607
+ }
61608
+ }
61273
61609
  this.#mergeAndPublishUsage(delta, active.command.turnId);
61274
61610
  }
61611
+ /** The latest request's Model, else the Model that carried the most prompt tokens. */
61612
+ #resultContextWindow(modelUsage) {
61613
+ if (!modelUsage?.length)
61614
+ return void 0;
61615
+ const latest = this.#latestRequestModel;
61616
+ const matched = latest ? modelUsage.find(({ model: model2 }) => model2 === latest) : void 0;
61617
+ const main = matched ?? modelUsage.reduce((best, entry) => (entry.promptTokens ?? entry.inputTokens) > (best.promptTokens ?? best.inputTokens) ? entry : best);
61618
+ return main.contextWindowTokens;
61619
+ }
61275
61620
  /**
61276
61621
  * Plan usage is account-wide, not Thread-scoped, so every observation is
61277
61622
  * offered to the Adapter's shared cache regardless of this Session's own
@@ -61284,6 +61629,15 @@ var ClaudeHarnessSession = class {
61284
61629
  if (effective)
61285
61630
  this.publishPlanLimit(effective);
61286
61631
  }
61632
+ publishAccountCreditsSupport(supported) {
61633
+ if (this.#phase !== "open")
61634
+ return;
61635
+ this.#accountCreditsSupported = supported;
61636
+ const composerIndicators = claudePromptCacheIndicators(supported, this.#lastAssistantResponseAtUnix);
61637
+ if (composerIndicators[0]?.expiresAtUnix === this.#latestUsage?.composerIndicators?.[0]?.expiresAtUnix)
61638
+ return;
61639
+ this.#mergeAndPublishUsage({ composerIndicators }, this.#active?.command.turnId);
61640
+ }
61287
61641
  publishPlanLimit(planLimit) {
61288
61642
  if (this.#phase !== "open")
61289
61643
  return;
@@ -61560,6 +61914,7 @@ var ClaudeCodeAdapter = class {
61560
61914
  #closePromise = null;
61561
61915
  #latestPlanLimit = null;
61562
61916
  #accountInspection = null;
61917
+ #accountCreditsSupported = false;
61563
61918
  constructor(options = {}, dependencies) {
61564
61919
  const environment = options.environment ?? process.env;
61565
61920
  this.#environment = environment;
@@ -61686,12 +62041,20 @@ var ClaudeCodeAdapter = class {
61686
62041
  return this.#accountInspection;
61687
62042
  }
61688
62043
  async #readAccount() {
62044
+ const planLimitAtStart = this.#latestPlanLimit;
61689
62045
  let inspector;
61690
62046
  try {
61691
62047
  this.#dependencies.inspectInstallation();
61692
62048
  inspector = this.#dependencies.createInspector({ cwd: process.cwd() });
61693
62049
  this.#inspectors.add(inspector);
61694
- return await inspector.inspectAccount?.() ?? null;
62050
+ const account = await inspector.inspectAccount?.() ?? null;
62051
+ if (this.#latestPlanLimit === planLimitAtStart) {
62052
+ this.#accountCreditsSupported = account?.credits !== void 0;
62053
+ for (const session of this.#sessions) {
62054
+ session.publishAccountCreditsSupport(this.#accountCreditsSupported);
62055
+ }
62056
+ }
62057
+ return account;
61695
62058
  } catch {
61696
62059
  return null;
61697
62060
  } finally {
@@ -61935,6 +62298,7 @@ var ClaudeCodeAdapter = class {
61935
62298
  ...durableRef ? { nativeRef: durableRef } : {},
61936
62299
  sessionId,
61937
62300
  usageHistory,
62301
+ accountCreditsSupported: this.#accountCreditsSupported,
61938
62302
  ...requestedModel ? { requestedModel } : {},
61939
62303
  longContextEnabled: () => readClaudeLongContext(this.#environment),
61940
62304
  requestedPermissionModeId,
@@ -61955,7 +62319,13 @@ var ClaudeCodeAdapter = class {
61955
62319
  return { requests: [], complete: true };
61956
62320
  try {
61957
62321
  const messages = await this.#dependencies.readSessionMessages({ cwd, sessionId });
61958
- return messages === null ? { requests: [], complete: false } : claudeUsageHistory(messages);
62322
+ if (messages === null)
62323
+ return { requests: [], complete: false };
62324
+ const lastResponseAtUnix = lastClaudeAssistantResponseUnix(messages);
62325
+ return {
62326
+ ...claudeUsageHistory(messages),
62327
+ ...lastResponseAtUnix !== void 0 ? { lastResponseAtUnix } : {}
62328
+ };
61959
62329
  } catch {
61960
62330
  return { requests: [], complete: false };
61961
62331
  }
@@ -61967,9 +62337,17 @@ var ClaudeCodeAdapter = class {
61967
62337
  next.fiveHour = planLimit.fiveHour;
61968
62338
  if (planLimit.sevenDay)
61969
62339
  next.sevenDay = planLimit.sevenDay;
62340
+ try {
62341
+ if (!accountCreditsSnapshotSchema.safeParse(projectClaudePlanLimitToCredits(next)).success)
62342
+ return null;
62343
+ } catch {
62344
+ return null;
62345
+ }
61970
62346
  this.#latestPlanLimit = next.fiveHour || next.sevenDay ? next : null;
61971
62347
  if (this.#latestPlanLimit) {
62348
+ this.#accountCreditsSupported = true;
61972
62349
  for (const session of this.#sessions) {
62350
+ session.publishAccountCreditsSupport(true);
61973
62351
  if (session !== origin)
61974
62352
  session.publishPlanLimit(this.#latestPlanLimit);
61975
62353
  }