@codexhost/cli-darwin-x64 0.13.1 → 0.13.3

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.
@@ -15080,6 +15080,15 @@ var harnessDisplaySetSchema = external_exports.strictObject({
15080
15080
  initializeOnly: external_exports.boolean().optional()
15081
15081
  });
15082
15082
 
15083
+ // ../../shared-contracts/dist/harness-presentation.js
15084
+ var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
15085
+ var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
15086
+ var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
15087
+ label: displayText(256).optional(),
15088
+ description: displayText(1024).optional()
15089
+ }).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
15090
+ var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
15091
+
15083
15092
  // ../../shared-contracts/dist/model-price-overrides.js
15084
15093
  var usdPerMillionTokens = external_exports.number().finite().nonnegative();
15085
15094
  var modelPriceOverrideSchema = external_exports.strictObject({
@@ -15416,8 +15425,24 @@ var threadUsageSnapshotSchema = external_exports.object({
15416
15425
  }
15417
15426
  });
15418
15427
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
15428
+ var accountCreditsPeriodSchema = external_exports.enum([
15429
+ "weekly",
15430
+ "monthly",
15431
+ "five_hour",
15432
+ "seven_day",
15433
+ "unknown"
15434
+ ]);
15435
+ var accountCreditsScopeSchema = external_exports.object({
15436
+ id: external_exports.string().min(1).max(256),
15437
+ label: external_exports.string().min(1).max(256),
15438
+ localizations: harnessLocalizationsSchema.optional()
15439
+ }).strict();
15419
15440
  var accountCreditsProductUsageSchema = external_exports.object({
15420
15441
  product: external_exports.string().min(1),
15442
+ /** Native period and scope, never inferred from the display name. */
15443
+ periodType: accountCreditsPeriodSchema.optional(),
15444
+ scope: accountCreditsScopeSchema.optional(),
15445
+ localizations: harnessLocalizationsSchema.optional(),
15421
15446
  used: external_exports.number().finite().nonnegative().optional(),
15422
15447
  // Zero is a real empty cap, not an absent field.
15423
15448
  limit: external_exports.number().finite().nonnegative().optional(),
@@ -15437,9 +15462,11 @@ var accountCreditsSnapshotSchema = external_exports.object({
15437
15462
  unit: external_exports.string().min(1).max(32).optional(),
15438
15463
  /** Native label when the primary limit is scoped to a model or product group. */
15439
15464
  label: external_exports.string().min(1).optional(),
15465
+ scope: accountCreditsScopeSchema.optional(),
15466
+ localizations: harnessLocalizationsSchema.optional(),
15440
15467
  usedPercent: usagePercentSchema,
15441
15468
  resetsAt: external_exports.string().min(1).optional(),
15442
- periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
15469
+ periodType: accountCreditsPeriodSchema,
15443
15470
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
15444
15471
  resetCredits: accountResetCreditsSchema.optional()
15445
15472
  }).strict();
@@ -15450,7 +15477,9 @@ var threadUsageInspectionParamsSchema = external_exports.object({
15450
15477
  var threadUsageInspectionSchema = external_exports.object({
15451
15478
  threadId: hostThreadIdSchema,
15452
15479
  usage: threadUsageSnapshotSchema.nullable(),
15453
- accountCredits: accountCreditsSnapshotSchema.optional()
15480
+ accountCredits: accountCreditsSnapshotSchema.optional(),
15481
+ /** Whether this source can provide cached account quota independently of usage. */
15482
+ accountCreditsSupported: external_exports.boolean().optional()
15454
15483
  }).strict();
15455
15484
 
15456
15485
  // ../../shared-contracts/dist/harness-accounts.js
@@ -15577,7 +15606,8 @@ var harnessPermissionModeSchema = external_exports.object({
15577
15606
  id: harnessPermissionModeIdSchema,
15578
15607
  label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
15579
15608
  description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
15580
- dangerous: external_exports.boolean().optional()
15609
+ dangerous: external_exports.boolean().optional(),
15610
+ localizations: harnessLocalizationsSchema.optional()
15581
15611
  }).strict();
15582
15612
  var harnessPermissionModeCatalogSchema = external_exports.object({
15583
15613
  modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
@@ -15964,6 +15994,8 @@ var harnessInstallationStateSchema = external_exports.object({
15964
15994
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
15965
15995
  message: external_exports.string().max(2048).optional(),
15966
15996
  messageCode: external_exports.string().min(1).max(128).optional(),
15997
+ /** Safe plugin-owned explanation, distinct from raw diagnostic message. */
15998
+ notice: harnessLocalizedTextSchema.optional(),
15967
15999
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
15968
16000
  }).strict();
15969
16001
 
@@ -16090,6 +16122,7 @@ var harnessCommandDescriptorSchema = external_exports.object({
16090
16122
  invocation: commandInvocationSchema,
16091
16123
  label: commandLabelSchema,
16092
16124
  description: commandDescriptionSchema.optional(),
16125
+ localizations: harnessLocalizationsSchema.optional(),
16093
16126
  argumentMode: external_exports.enum(["none", "text"]),
16094
16127
  /**
16095
16128
  * Native distinction reported by the Harness. Omitted when the Harness does
@@ -16764,6 +16797,27 @@ function nativeError(error51, profile = CODEBUDDY_RUNTIME_PROFILE) {
16764
16797
  function failure(code, message, profile = CODEBUDDY_RUNTIME_PROFILE) {
16765
16798
  return { ok: false, error: nativeError(new CodeBuddyError(code, message), profile) };
16766
16799
  }
16800
+ function nativeTurnError(stopReason, meta3, profile) {
16801
+ const fallback = `Native Turn stopped: ${text(stopReason) || "unknown"} (${text(meta3["codebuddy.ai/outcome"]) || "no native outcome"})`;
16802
+ const raw = text(meta3["codebuddy.ai/errorMessage"]).trim();
16803
+ let diagnostic = "";
16804
+ let category;
16805
+ if (raw) {
16806
+ try {
16807
+ const error51 = record2(JSON.parse(raw));
16808
+ const data = record2(error51.data);
16809
+ diagnostic = text(data.details).trim() || text(error51.message).trim();
16810
+ category = data.category;
16811
+ } catch {
16812
+ diagnostic = raw;
16813
+ }
16814
+ }
16815
+ return nativeError(new CodeBuddyError(
16816
+ // -32000 is shared by native refusals; the category identifies authentication failures.
16817
+ category === "auth" ? "authenticationRequired" : "nativeFailure",
16818
+ diagnostic ? `${fallback}: ${diagnostic}` : fallback
16819
+ ), profile);
16820
+ }
16767
16821
  async function bounded(operation, milliseconds, label, onTimeout) {
16768
16822
  let timer;
16769
16823
  try {
@@ -16869,6 +16923,11 @@ function commandCatalog(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
16869
16923
  id: `${profile.harnessId}.${name}`,
16870
16924
  invocation: `/${name}`,
16871
16925
  label: name,
16926
+ ...name === "compact" && !skill ? {
16927
+ localizations: {
16928
+ "zh-CN": { label: "压缩上下文", description: "压缩当前对话上下文" }
16929
+ }
16930
+ } : {},
16872
16931
  ...text(entry.description).trim() ? { description: text(entry.description).trim().slice(0, 512) } : {},
16873
16932
  argumentMode: name === "compact" || record2(entry.input).hint || record2(entry._meta).type === "skill" ? "text" : "none",
16874
16933
  ...record2(entry._meta).type === "skill" ? { kind: "skill" } : {}
@@ -17018,6 +17077,40 @@ import { homedir as homedir2 } from "node:os";
17018
17077
  import path6 from "node:path";
17019
17078
  import { isDeepStrictEqual } from "node:util";
17020
17079
 
17080
+ // dist/permission-presentation.js
17081
+ var labels = {
17082
+ "Always Ask": "始终询问",
17083
+ "Accept Edits": "接受编辑",
17084
+ Plan: "规划模式",
17085
+ Auto: "自动",
17086
+ "Auto mode": "自动模式",
17087
+ "Don't Ask": "不询问",
17088
+ "Bypass Permissions": "绕过权限",
17089
+ "Full Access": "完全访问",
17090
+ Delegate: "由父会话管理",
17091
+ Default: "默认"
17092
+ };
17093
+ var descriptions = {
17094
+ "Prompts for permission on first use of each tool": "首次使用每种工具时请求权限。",
17095
+ "Automatically accepts file edit permissions for the session": "自动接受本会话中的文件编辑权限。",
17096
+ "Agent can analyze but not modify files or execute commands": "Agent 可以分析,但不能修改文件或执行命令。",
17097
+ "An AI classifier reviews actions that would normally prompt: safe ones are auto-approved, risky ones are denied. If the classifier is unavailable, the action falls back to a prompt (or is denied when prompts cannot be shown)": "由 AI 分类器评估原本需要询问的操作:安全操作自动批准,风险操作拒绝。分类器不可用时改为询问;无法显示询问时拒绝。",
17098
+ "Does not show permission prompts; pre-approved and safe read-only actions run, everything else that would prompt is denied": "不显示权限询问;已获批准和安全的只读操作可以执行,其余原本需要询问的操作会被拒绝。",
17099
+ "Skips all permission prompts": "跳过常规权限询问。",
17100
+ "Skips ALL permission checks including dangerous commands for all agents": "为所有 Agent 跳过全部权限检查,包括危险命令。",
17101
+ "Permissions managed by parent session": "由父会话管理权限。"
17102
+ };
17103
+ function permissionLocalizations(label, description) {
17104
+ const localizedLabel = Object.hasOwn(labels, label) ? labels[label] : void 0;
17105
+ const localizedDescription = Object.hasOwn(descriptions, description) ? descriptions[description] : void 0;
17106
+ return {
17107
+ "zh-CN": {
17108
+ ...localizedLabel ? { label: localizedLabel } : {},
17109
+ ...localizedDescription ? { description: localizedDescription } : {}
17110
+ }
17111
+ };
17112
+ }
17113
+
17021
17114
  // dist/configuration.js
17022
17115
  var CODEBUDDY_CAPABILITIES = {
17023
17116
  configuration: {
@@ -17075,6 +17168,7 @@ function configuration(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
17075
17168
  modes: rows(mode.options).map((option) => ({
17076
17169
  id: option.value,
17077
17170
  label: option.name,
17171
+ localizations: permissionLocalizations(text(option.name), text(option.description)),
17078
17172
  ...option.description ? { description: option.description } : {},
17079
17173
  ...["bypassPermissions", "fullAccess"].includes(text(option.value)) ? { dangerous: true } : {}
17080
17174
  })),
@@ -24755,7 +24849,7 @@ var CodeBuddySession = class {
24755
24849
  // Those remain visible on individual Items; they do not fail the completed Turn.
24756
24850
  (!meta3["codebuddy.ai/outcome"] || meta3["codebuddy.ai/outcome"] === "SUCCESS" || meta3["codebuddy.ai/outcome"] === "PARTIAL_SUCCESS") ? { status: "succeeded" } : {
24757
24851
  status: "failed",
24758
- error: nativeError(new CodeBuddyError("nativeFailure", `Native Turn stopped: ${text(stop) || "unknown"} (${text(meta3["codebuddy.ai/outcome"]) || "no native outcome"})`), this.profile)
24852
+ error: nativeTurnError(stop, meta3, this.profile)
24759
24853
  };
24760
24854
  const snapshot = await this.#snapshot();
24761
24855
  const added = snapshot.turns.filter((turn) => !active.before.has(turn.nativeTurnRef.nativeTurnKey));
@@ -25063,6 +25157,10 @@ function createCodeBuddyInstallation(environment) {
25063
25157
  canUpdate,
25064
25158
  ...!canUpdate ? {
25065
25159
  messageCode: "codebuddy-npm-required",
25160
+ notice: {
25161
+ en: "Use CodeBuddy's native updater or original package manager. Latest-version checks here require an identified npm installation.",
25162
+ "zh-CN": "请使用 CodeBuddy 原生更新器或原包管理器更新。此处仅能查询已识别的 npm 安装的最新版本。"
25163
+ },
25066
25164
  message: "Use CodeBuddy's native updater or original package manager for this installation. Latest-version checks here require an identified npm installation."
25067
25165
  } : {}
25068
25166
  };
@@ -25961,6 +26059,8 @@ var BrokeredHarnessAdapter = class {
25961
26059
  commandCatalog;
25962
26060
  liveCommandCatalog;
25963
26061
  harnessId;
26062
+ credits;
26063
+ refreshCredits;
25964
26064
  #descriptorPath;
25965
26065
  #forwardEnvironment;
25966
26066
  #isInstalled;
@@ -25981,6 +26081,10 @@ var BrokeredHarnessAdapter = class {
25981
26081
  };
25982
26082
  constructor(input = {}) {
25983
26083
  this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
26084
+ if (input.accountCredits !== false) {
26085
+ this.credits = () => this.#credits;
26086
+ this.refreshCredits = () => this.#refreshAccountCredits();
26087
+ }
25984
26088
  this.#forwardEnvironment = input.forwardDelegationEnvironment === true;
25985
26089
  if (input.commandCatalog)
25986
26090
  this.commandCatalog = input.commandCatalog;
@@ -25992,10 +26096,7 @@ var BrokeredHarnessAdapter = class {
25992
26096
  this.#startBroker = input.startBroker === false ? void 0 : input.startBroker ?? (process.platform === "darwin" && !input.descriptorPath ? () => startBrokerLaunchAgent(this.harnessId, environment) : void 0);
25993
26097
  this.#startTimeoutMs = input.startTimeoutMs ?? BROKER_START_TIMEOUT_MS;
25994
26098
  }
25995
- credits() {
25996
- return this.#credits;
25997
- }
25998
- refreshCredits() {
26099
+ #refreshAccountCredits() {
25999
26100
  if (this.#closed)
26000
26101
  return Promise.resolve(null);
26001
26102
  if (this.#creditsRefresh)
@@ -26167,6 +26268,7 @@ function createHarnessAdapter(context) {
26167
26268
  if (context.platform === "darwin" && context.managedRemoteHost) {
26168
26269
  const environment2 = { ...context.environment };
26169
26270
  return new BrokeredHarnessAdapter({
26271
+ accountCredits: false,
26170
26272
  harnessId: "codebuddy",
26171
26273
  forwardDelegationEnvironment: true,
26172
26274
  commandCatalog: CODEBUDDY_COMMAND_CATALOG,
@@ -14598,6 +14598,15 @@ var harnessDisplaySetSchema = external_exports.strictObject({
14598
14598
  initializeOnly: external_exports.boolean().optional()
14599
14599
  });
14600
14600
 
14601
+ // ../../shared-contracts/dist/harness-presentation.js
14602
+ var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
14603
+ var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
14604
+ var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
14605
+ label: displayText(256).optional(),
14606
+ description: displayText(1024).optional()
14607
+ }).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
14608
+ var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
14609
+
14601
14610
  // ../../shared-contracts/dist/model-price-overrides.js
14602
14611
  var usdPerMillionTokens = external_exports.number().finite().nonnegative();
14603
14612
  var modelPriceOverrideSchema = external_exports.strictObject({
@@ -14934,8 +14943,24 @@ var threadUsageSnapshotSchema = external_exports.object({
14934
14943
  }
14935
14944
  });
14936
14945
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
14946
+ var accountCreditsPeriodSchema = external_exports.enum([
14947
+ "weekly",
14948
+ "monthly",
14949
+ "five_hour",
14950
+ "seven_day",
14951
+ "unknown"
14952
+ ]);
14953
+ var accountCreditsScopeSchema = external_exports.object({
14954
+ id: external_exports.string().min(1).max(256),
14955
+ label: external_exports.string().min(1).max(256),
14956
+ localizations: harnessLocalizationsSchema.optional()
14957
+ }).strict();
14937
14958
  var accountCreditsProductUsageSchema = external_exports.object({
14938
14959
  product: external_exports.string().min(1),
14960
+ /** Native period and scope, never inferred from the display name. */
14961
+ periodType: accountCreditsPeriodSchema.optional(),
14962
+ scope: accountCreditsScopeSchema.optional(),
14963
+ localizations: harnessLocalizationsSchema.optional(),
14939
14964
  used: external_exports.number().finite().nonnegative().optional(),
14940
14965
  // Zero is a real empty cap, not an absent field.
14941
14966
  limit: external_exports.number().finite().nonnegative().optional(),
@@ -14955,9 +14980,11 @@ var accountCreditsSnapshotSchema = external_exports.object({
14955
14980
  unit: external_exports.string().min(1).max(32).optional(),
14956
14981
  /** Native label when the primary limit is scoped to a model or product group. */
14957
14982
  label: external_exports.string().min(1).optional(),
14983
+ scope: accountCreditsScopeSchema.optional(),
14984
+ localizations: harnessLocalizationsSchema.optional(),
14958
14985
  usedPercent: usagePercentSchema,
14959
14986
  resetsAt: external_exports.string().min(1).optional(),
14960
- periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
14987
+ periodType: accountCreditsPeriodSchema,
14961
14988
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
14962
14989
  resetCredits: accountResetCreditsSchema.optional()
14963
14990
  }).strict();
@@ -14968,7 +14995,9 @@ var threadUsageInspectionParamsSchema = external_exports.object({
14968
14995
  var threadUsageInspectionSchema = external_exports.object({
14969
14996
  threadId: hostThreadIdSchema,
14970
14997
  usage: threadUsageSnapshotSchema.nullable(),
14971
- accountCredits: accountCreditsSnapshotSchema.optional()
14998
+ accountCredits: accountCreditsSnapshotSchema.optional(),
14999
+ /** Whether this source can provide cached account quota independently of usage. */
15000
+ accountCreditsSupported: external_exports.boolean().optional()
14972
15001
  }).strict();
14973
15002
 
14974
15003
  // ../../shared-contracts/dist/harness-accounts.js
@@ -15095,7 +15124,8 @@ var harnessPermissionModeSchema = external_exports.object({
15095
15124
  id: harnessPermissionModeIdSchema,
15096
15125
  label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
15097
15126
  description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
15098
- dangerous: external_exports.boolean().optional()
15127
+ dangerous: external_exports.boolean().optional(),
15128
+ localizations: harnessLocalizationsSchema.optional()
15099
15129
  }).strict();
15100
15130
  var harnessPermissionModeCatalogSchema = external_exports.object({
15101
15131
  modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
@@ -15482,6 +15512,8 @@ var harnessInstallationStateSchema = external_exports.object({
15482
15512
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
15483
15513
  message: external_exports.string().max(2048).optional(),
15484
15514
  messageCode: external_exports.string().min(1).max(128).optional(),
15515
+ /** Safe plugin-owned explanation, distinct from raw diagnostic message. */
15516
+ notice: harnessLocalizedTextSchema.optional(),
15485
15517
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
15486
15518
  }).strict();
15487
15519
 
@@ -15608,6 +15640,7 @@ var harnessCommandDescriptorSchema = external_exports.object({
15608
15640
  invocation: commandInvocationSchema,
15609
15641
  label: commandLabelSchema,
15610
15642
  description: commandDescriptionSchema.optional(),
15643
+ localizations: harnessLocalizationsSchema.optional(),
15611
15644
  argumentMode: external_exports.enum(["none", "text"]),
15612
15645
  /**
15613
15646
  * Native distinction reported by the Harness. Omitted when the Harness does
@@ -16543,6 +16576,22 @@ async function copyRelation(a, b, signal) {
16543
16576
  // dist/usage-statistics.js
16544
16577
  var ROLLOUT = /^rollout-.*?([0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})(?:[_-][0-9a-f-]+)?\.jsonl(?:\.zst)?$/iu;
16545
16578
  var text = (value) => typeof value === "string" ? value : "";
16579
+ var ROW_KINDS = /* @__PURE__ */ new Set([
16580
+ "session_meta",
16581
+ "turn_context",
16582
+ "token_usage_record",
16583
+ "compacted",
16584
+ "event_msg",
16585
+ "response_item"
16586
+ ]);
16587
+ var HEAD_TYPE = /"type"\s*:\s*"([^"]+)"/u;
16588
+ var TAIL_TYPE = /"type"\s*:\s*"([^"]+)"\s*\}\s*$/u;
16589
+ function rowKind(line) {
16590
+ const head = HEAD_TYPE.exec(line.slice(0, 1024))?.[1];
16591
+ if (head && ROW_KINDS.has(head))
16592
+ return head;
16593
+ return TAIL_TYPE.exec(line.slice(-1024))?.[1] ?? head;
16594
+ }
16546
16595
  async function stamp(file2) {
16547
16596
  const s = await lstat(file2, { bigint: true });
16548
16597
  if (!s.isFile())
@@ -16601,17 +16650,10 @@ async function readCodexRollouts(files, thread, signal, options = {}) {
16601
16650
  signal.throwIfAborted();
16602
16651
  if (++seen % 128 === 0)
16603
16652
  await yieldToEventLoop(void 0, { signal });
16604
- const kind = /"type"\s*:\s*"([^"]+)"/u.exec(line.slice(0, 1024))?.[1];
16653
+ const kind = rowKind(line);
16605
16654
  if (!kind && line.trim())
16606
16655
  options.onIncomplete?.();
16607
- if (!kind || ![
16608
- "session_meta",
16609
- "turn_context",
16610
- "token_usage_record",
16611
- "compacted",
16612
- "event_msg",
16613
- "response_item"
16614
- ].includes(kind))
16656
+ if (!kind || !ROW_KINDS.has(kind))
16615
16657
  continue;
16616
16658
  if (kind === "response_item" && !/"role"\s*:\s*"user"/u.test(line.slice(0, 1024)))
16617
16659
  continue;
@@ -27659,6 +27659,15 @@ var harnessDisplaySetSchema = external_exports.strictObject({
27659
27659
  initializeOnly: external_exports.boolean().optional()
27660
27660
  });
27661
27661
 
27662
+ // ../../shared-contracts/dist/harness-presentation.js
27663
+ var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
27664
+ var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
27665
+ var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
27666
+ label: displayText(256).optional(),
27667
+ description: displayText(1024).optional()
27668
+ }).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
27669
+ var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
27670
+
27662
27671
  // ../../shared-contracts/dist/model-price-overrides.js
27663
27672
  var usdPerMillionTokens = external_exports.number().finite().nonnegative();
27664
27673
  var modelPriceOverrideSchema = external_exports.strictObject({
@@ -27995,8 +28004,24 @@ var threadUsageSnapshotSchema = external_exports.object({
27995
28004
  }
27996
28005
  });
27997
28006
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
28007
+ var accountCreditsPeriodSchema = external_exports.enum([
28008
+ "weekly",
28009
+ "monthly",
28010
+ "five_hour",
28011
+ "seven_day",
28012
+ "unknown"
28013
+ ]);
28014
+ var accountCreditsScopeSchema = external_exports.object({
28015
+ id: external_exports.string().min(1).max(256),
28016
+ label: external_exports.string().min(1).max(256),
28017
+ localizations: harnessLocalizationsSchema.optional()
28018
+ }).strict();
27998
28019
  var accountCreditsProductUsageSchema = external_exports.object({
27999
28020
  product: external_exports.string().min(1),
28021
+ /** Native period and scope, never inferred from the display name. */
28022
+ periodType: accountCreditsPeriodSchema.optional(),
28023
+ scope: accountCreditsScopeSchema.optional(),
28024
+ localizations: harnessLocalizationsSchema.optional(),
28000
28025
  used: external_exports.number().finite().nonnegative().optional(),
28001
28026
  // Zero is a real empty cap, not an absent field.
28002
28027
  limit: external_exports.number().finite().nonnegative().optional(),
@@ -28016,9 +28041,11 @@ var accountCreditsSnapshotSchema = external_exports.object({
28016
28041
  unit: external_exports.string().min(1).max(32).optional(),
28017
28042
  /** Native label when the primary limit is scoped to a model or product group. */
28018
28043
  label: external_exports.string().min(1).optional(),
28044
+ scope: accountCreditsScopeSchema.optional(),
28045
+ localizations: harnessLocalizationsSchema.optional(),
28019
28046
  usedPercent: usagePercentSchema,
28020
28047
  resetsAt: external_exports.string().min(1).optional(),
28021
- periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
28048
+ periodType: accountCreditsPeriodSchema,
28022
28049
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
28023
28050
  resetCredits: accountResetCreditsSchema.optional()
28024
28051
  }).strict();
@@ -28029,7 +28056,9 @@ var threadUsageInspectionParamsSchema = external_exports.object({
28029
28056
  var threadUsageInspectionSchema = external_exports.object({
28030
28057
  threadId: hostThreadIdSchema,
28031
28058
  usage: threadUsageSnapshotSchema.nullable(),
28032
- accountCredits: accountCreditsSnapshotSchema.optional()
28059
+ accountCredits: accountCreditsSnapshotSchema.optional(),
28060
+ /** Whether this source can provide cached account quota independently of usage. */
28061
+ accountCreditsSupported: external_exports.boolean().optional()
28033
28062
  }).strict();
28034
28063
 
28035
28064
  // ../../shared-contracts/dist/harness-accounts.js
@@ -28156,7 +28185,8 @@ var harnessPermissionModeSchema = external_exports.object({
28156
28185
  id: harnessPermissionModeIdSchema,
28157
28186
  label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
28158
28187
  description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
28159
- dangerous: external_exports.boolean().optional()
28188
+ dangerous: external_exports.boolean().optional(),
28189
+ localizations: harnessLocalizationsSchema.optional()
28160
28190
  }).strict();
28161
28191
  var harnessPermissionModeCatalogSchema = external_exports.object({
28162
28192
  modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
@@ -28543,6 +28573,8 @@ var harnessInstallationStateSchema = external_exports.object({
28543
28573
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
28544
28574
  message: external_exports.string().max(2048).optional(),
28545
28575
  messageCode: external_exports.string().min(1).max(128).optional(),
28576
+ /** Safe plugin-owned explanation, distinct from raw diagnostic message. */
28577
+ notice: harnessLocalizedTextSchema.optional(),
28546
28578
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
28547
28579
  }).strict();
28548
28580
 
@@ -28669,6 +28701,7 @@ var harnessCommandDescriptorSchema = external_exports.object({
28669
28701
  invocation: commandInvocationSchema,
28670
28702
  label: commandLabelSchema,
28671
28703
  description: commandDescriptionSchema.optional(),
28704
+ localizations: harnessLocalizationsSchema.optional(),
28672
28705
  argumentMode: external_exports.enum(["none", "text"]),
28673
28706
  /**
28674
28707
  * Native distinction reported by the Harness. Omitted when the Harness does
@@ -29417,12 +29450,15 @@ function projectCursorAccountUsage(usage, identity, plan) {
29417
29450
  credits: {
29418
29451
  usedPercent,
29419
29452
  label: "Auto · monthly",
29453
+ scope: { id: "auto", label: "Auto" },
29420
29454
  periodType: "monthly",
29421
29455
  ...resetsAt ? { resetsAt } : {},
29422
29456
  ...apiPercent === void 0 ? {} : {
29423
29457
  productUsage: [
29424
29458
  {
29425
29459
  product: "API · monthly",
29460
+ periodType: "monthly",
29461
+ scope: { id: "api", label: "API" },
29426
29462
  usagePercent: apiPercent,
29427
29463
  ...resetsAt ? { resetsAt } : {}
29428
29464
  }
@@ -29911,9 +29947,30 @@ var CURSOR_CAPABILITIES = {
29911
29947
  var CURSOR_MODES = harnessPermissionModeCatalogSchema.parse({
29912
29948
  defaultModeId: "agent",
29913
29949
  modes: [
29914
- { id: "agent", label: "Agent", description: "Native agent mode with Cursor tool approvals" },
29915
- { id: "plan", label: "Plan", description: "Native read-only planning mode" },
29916
- { id: "ask", label: "Ask", description: "Native read-only question mode" }
29950
+ {
29951
+ id: "agent",
29952
+ label: "Agent",
29953
+ description: "Native agent mode with Cursor tool approvals",
29954
+ localizations: {
29955
+ "zh-CN": { description: "执行任务,可修改文件和运行命令;需要审批的操作仍会请求确认。" }
29956
+ }
29957
+ },
29958
+ {
29959
+ id: "plan",
29960
+ label: "Plan",
29961
+ description: "Native read-only planning mode",
29962
+ localizations: {
29963
+ "zh-CN": { label: "规划模式", description: "只读分析代码并制定实施计划,不修改项目文件。" }
29964
+ }
29965
+ },
29966
+ {
29967
+ id: "ask",
29968
+ label: "Ask",
29969
+ description: "Native read-only question mode",
29970
+ localizations: {
29971
+ "zh-CN": { label: "询问", description: "只读查看代码并回答问题,不修改项目文件。" }
29972
+ }
29973
+ }
29917
29974
  ]
29918
29975
  });
29919
29976
  var cursorModelRef = (nativeId) => harnessModelRefSchema.parse({ id: `cursor.${Buffer.from(nativeId).toString("base64url")}` });
@@ -48770,6 +48827,8 @@ var BrokeredHarnessAdapter = class {
48770
48827
  commandCatalog;
48771
48828
  liveCommandCatalog;
48772
48829
  harnessId;
48830
+ credits;
48831
+ refreshCredits;
48773
48832
  #descriptorPath;
48774
48833
  #forwardEnvironment;
48775
48834
  #isInstalled;
@@ -48790,6 +48849,10 @@ var BrokeredHarnessAdapter = class {
48790
48849
  };
48791
48850
  constructor(input = {}) {
48792
48851
  this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
48852
+ if (input.accountCredits !== false) {
48853
+ this.credits = () => this.#credits;
48854
+ this.refreshCredits = () => this.#refreshAccountCredits();
48855
+ }
48793
48856
  this.#forwardEnvironment = input.forwardDelegationEnvironment === true;
48794
48857
  if (input.commandCatalog)
48795
48858
  this.commandCatalog = input.commandCatalog;
@@ -48801,10 +48864,7 @@ var BrokeredHarnessAdapter = class {
48801
48864
  this.#startBroker = input.startBroker === false ? void 0 : input.startBroker ?? (process.platform === "darwin" && !input.descriptorPath ? () => startBrokerLaunchAgent(this.harnessId, environment) : void 0);
48802
48865
  this.#startTimeoutMs = input.startTimeoutMs ?? BROKER_START_TIMEOUT_MS;
48803
48866
  }
48804
- credits() {
48805
- return this.#credits;
48806
- }
48807
- refreshCredits() {
48867
+ #refreshAccountCredits() {
48808
48868
  if (this.#closed)
48809
48869
  return Promise.resolve(null);
48810
48870
  if (this.#creditsRefresh)
@@ -48976,6 +49036,7 @@ function createHarnessAdapter(context) {
48976
49036
  if (context.platform === "darwin" && context.managedRemoteHost) {
48977
49037
  const environment2 = { ...context.environment };
48978
49038
  return new BrokeredHarnessAdapter({
49039
+ accountCredits: false,
48979
49040
  harnessId: "cursor-cli",
48980
49041
  forwardDelegationEnvironment: true,
48981
49042
  commandCatalog: CURSOR_COMMAND_CATALOG,
@@ -31,8 +31,8 @@
31
31
  }
32
32
  },
33
33
  "notice": {
34
- "en": "Requires DSH 0.1.7-rc.1 or later and the V4 protocol. Verified with 0.1.7-rc.1, 0.1.7-rc.2, 0.2.0-rc.1 and 0.2.0-rc.2; other versions require native protocol validation.",
35
- "zh-CN": "需要 DSH 0.1.7-rc.1 或更高版本及 V4 协议。已验证 0.1.7-rc.1、0.1.7-rc.2、0.2.0-rc.1 和 0.2.0-rc.2;其他版本仍需通过原生协议校验。"
34
+ "en": "Requires DSH 0.1.7-rc.1 or later and the V4 protocol. Verified with 0.1.7-rc.1, 0.1.7-rc.2, 0.2.0-rc.1, 0.2.0-rc.2, 0.2.1-rc.1 and 0.2.1-rc.2; other versions require native protocol validation.",
35
+ "zh-CN": "需要 DSH 0.1.7-rc.1 或更高版本及 V4 协议。已验证 0.1.7-rc.1、0.1.7-rc.2、0.2.0-rc.1、0.2.0-rc.2、0.2.1-rc.1 和 0.2.1-rc.2;其他版本仍需通过原生协议校验。"
36
36
  },
37
37
  "links": {
38
38
  "website": "https://github.com/deepseek-ai/deepseek-harness",