@codexhost/cli-win32-arm64 0.13.2 → 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.
@@ -14604,6 +14604,15 @@ var harnessDisplaySetSchema = external_exports.strictObject({
14604
14604
  initializeOnly: external_exports.boolean().optional()
14605
14605
  });
14606
14606
 
14607
+ // ../../shared-contracts/dist/harness-presentation.js
14608
+ var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
14609
+ var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
14610
+ var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
14611
+ label: displayText(256).optional(),
14612
+ description: displayText(1024).optional()
14613
+ }).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
14614
+ 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");
14615
+
14607
14616
  // ../../shared-contracts/dist/model-price-overrides.js
14608
14617
  var usdPerMillionTokens = external_exports.number().finite().nonnegative();
14609
14618
  var modelPriceOverrideSchema = external_exports.strictObject({
@@ -14940,8 +14949,24 @@ var threadUsageSnapshotSchema = external_exports.object({
14940
14949
  }
14941
14950
  });
14942
14951
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
14952
+ var accountCreditsPeriodSchema = external_exports.enum([
14953
+ "weekly",
14954
+ "monthly",
14955
+ "five_hour",
14956
+ "seven_day",
14957
+ "unknown"
14958
+ ]);
14959
+ var accountCreditsScopeSchema = external_exports.object({
14960
+ id: external_exports.string().min(1).max(256),
14961
+ label: external_exports.string().min(1).max(256),
14962
+ localizations: harnessLocalizationsSchema.optional()
14963
+ }).strict();
14943
14964
  var accountCreditsProductUsageSchema = external_exports.object({
14944
14965
  product: external_exports.string().min(1),
14966
+ /** Native period and scope, never inferred from the display name. */
14967
+ periodType: accountCreditsPeriodSchema.optional(),
14968
+ scope: accountCreditsScopeSchema.optional(),
14969
+ localizations: harnessLocalizationsSchema.optional(),
14945
14970
  used: external_exports.number().finite().nonnegative().optional(),
14946
14971
  // Zero is a real empty cap, not an absent field.
14947
14972
  limit: external_exports.number().finite().nonnegative().optional(),
@@ -14961,9 +14986,11 @@ var accountCreditsSnapshotSchema = external_exports.object({
14961
14986
  unit: external_exports.string().min(1).max(32).optional(),
14962
14987
  /** Native label when the primary limit is scoped to a model or product group. */
14963
14988
  label: external_exports.string().min(1).optional(),
14989
+ scope: accountCreditsScopeSchema.optional(),
14990
+ localizations: harnessLocalizationsSchema.optional(),
14964
14991
  usedPercent: usagePercentSchema,
14965
14992
  resetsAt: external_exports.string().min(1).optional(),
14966
- periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
14993
+ periodType: accountCreditsPeriodSchema,
14967
14994
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
14968
14995
  resetCredits: accountResetCreditsSchema.optional()
14969
14996
  }).strict();
@@ -14974,7 +15001,9 @@ var threadUsageInspectionParamsSchema = external_exports.object({
14974
15001
  var threadUsageInspectionSchema = external_exports.object({
14975
15002
  threadId: hostThreadIdSchema,
14976
15003
  usage: threadUsageSnapshotSchema.nullable(),
14977
- accountCredits: accountCreditsSnapshotSchema.optional()
15004
+ accountCredits: accountCreditsSnapshotSchema.optional(),
15005
+ /** Whether this source can provide cached account quota independently of usage. */
15006
+ accountCreditsSupported: external_exports.boolean().optional()
14978
15007
  }).strict();
14979
15008
 
14980
15009
  // ../../shared-contracts/dist/harness-accounts.js
@@ -15101,7 +15130,8 @@ var harnessPermissionModeSchema = external_exports.object({
15101
15130
  id: harnessPermissionModeIdSchema,
15102
15131
  label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
15103
15132
  description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
15104
- dangerous: external_exports.boolean().optional()
15133
+ dangerous: external_exports.boolean().optional(),
15134
+ localizations: harnessLocalizationsSchema.optional()
15105
15135
  }).strict();
15106
15136
  var harnessPermissionModeCatalogSchema = external_exports.object({
15107
15137
  modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
@@ -15488,6 +15518,8 @@ var harnessInstallationStateSchema = external_exports.object({
15488
15518
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
15489
15519
  message: external_exports.string().max(2048).optional(),
15490
15520
  messageCode: external_exports.string().min(1).max(128).optional(),
15521
+ /** Safe plugin-owned explanation, distinct from raw diagnostic message. */
15522
+ notice: harnessLocalizedTextSchema.optional(),
15491
15523
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
15492
15524
  }).strict();
15493
15525
 
@@ -15614,6 +15646,7 @@ var harnessCommandDescriptorSchema = external_exports.object({
15614
15646
  invocation: commandInvocationSchema,
15615
15647
  label: commandLabelSchema,
15616
15648
  description: commandDescriptionSchema.optional(),
15649
+ localizations: harnessLocalizationsSchema.optional(),
15617
15650
  argumentMode: external_exports.enum(["none", "text"]),
15618
15651
  /**
15619
15652
  * Native distinction reported by the Harness. Omitted when the Harness does
@@ -17135,6 +17168,8 @@ var BrokeredHarnessAdapter = class {
17135
17168
  commandCatalog;
17136
17169
  liveCommandCatalog;
17137
17170
  harnessId;
17171
+ credits;
17172
+ refreshCredits;
17138
17173
  #descriptorPath;
17139
17174
  #forwardEnvironment;
17140
17175
  #isInstalled;
@@ -17155,6 +17190,10 @@ var BrokeredHarnessAdapter = class {
17155
17190
  };
17156
17191
  constructor(input = {}) {
17157
17192
  this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
17193
+ if (input.accountCredits !== false) {
17194
+ this.credits = () => this.#credits;
17195
+ this.refreshCredits = () => this.#refreshAccountCredits();
17196
+ }
17158
17197
  this.#forwardEnvironment = input.forwardDelegationEnvironment === true;
17159
17198
  if (input.commandCatalog)
17160
17199
  this.commandCatalog = input.commandCatalog;
@@ -17166,10 +17205,7 @@ var BrokeredHarnessAdapter = class {
17166
17205
  this.#startBroker = input.startBroker === false ? void 0 : input.startBroker ?? (process.platform === "darwin" && !input.descriptorPath ? () => startBrokerLaunchAgent(this.harnessId, environment) : void 0);
17167
17206
  this.#startTimeoutMs = input.startTimeoutMs ?? BROKER_START_TIMEOUT_MS;
17168
17207
  }
17169
- credits() {
17170
- return this.#credits;
17171
- }
17172
- refreshCredits() {
17208
+ #refreshAccountCredits() {
17173
17209
  if (this.#closed)
17174
17210
  return Promise.resolve(null);
17175
17211
  if (this.#creditsRefresh)
@@ -17487,6 +17523,27 @@ function nativeError(error51, profile = CODEBUDDY_RUNTIME_PROFILE) {
17487
17523
  function failure(code, message, profile = CODEBUDDY_RUNTIME_PROFILE) {
17488
17524
  return { ok: false, error: nativeError(new CodeBuddyError(code, message), profile) };
17489
17525
  }
17526
+ function nativeTurnError(stopReason, meta3, profile) {
17527
+ const fallback = `Native Turn stopped: ${text(stopReason) || "unknown"} (${text(meta3["codebuddy.ai/outcome"]) || "no native outcome"})`;
17528
+ const raw = text(meta3["codebuddy.ai/errorMessage"]).trim();
17529
+ let diagnostic = "";
17530
+ let category;
17531
+ if (raw) {
17532
+ try {
17533
+ const error51 = record2(JSON.parse(raw));
17534
+ const data = record2(error51.data);
17535
+ diagnostic = text(data.details).trim() || text(error51.message).trim();
17536
+ category = data.category;
17537
+ } catch {
17538
+ diagnostic = raw;
17539
+ }
17540
+ }
17541
+ return nativeError(new CodeBuddyError(
17542
+ // -32000 is shared by native refusals; the category identifies authentication failures.
17543
+ category === "auth" ? "authenticationRequired" : "nativeFailure",
17544
+ diagnostic ? `${fallback}: ${diagnostic}` : fallback
17545
+ ), profile);
17546
+ }
17490
17547
  async function bounded(operation, milliseconds, label, onTimeout) {
17491
17548
  let timer;
17492
17549
  try {
@@ -17508,6 +17565,40 @@ async function bounded(operation, milliseconds, label, onTimeout) {
17508
17565
  }
17509
17566
  }
17510
17567
 
17568
+ // ../codebuddy/dist/permission-presentation.js
17569
+ var labels = {
17570
+ "Always Ask": "始终询问",
17571
+ "Accept Edits": "接受编辑",
17572
+ Plan: "规划模式",
17573
+ Auto: "自动",
17574
+ "Auto mode": "自动模式",
17575
+ "Don't Ask": "不询问",
17576
+ "Bypass Permissions": "绕过权限",
17577
+ "Full Access": "完全访问",
17578
+ Delegate: "由父会话管理",
17579
+ Default: "默认"
17580
+ };
17581
+ var descriptions = {
17582
+ "Prompts for permission on first use of each tool": "首次使用每种工具时请求权限。",
17583
+ "Automatically accepts file edit permissions for the session": "自动接受本会话中的文件编辑权限。",
17584
+ "Agent can analyze but not modify files or execute commands": "Agent 可以分析,但不能修改文件或执行命令。",
17585
+ "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 分类器评估原本需要询问的操作:安全操作自动批准,风险操作拒绝。分类器不可用时改为询问;无法显示询问时拒绝。",
17586
+ "Does not show permission prompts; pre-approved and safe read-only actions run, everything else that would prompt is denied": "不显示权限询问;已获批准和安全的只读操作可以执行,其余原本需要询问的操作会被拒绝。",
17587
+ "Skips all permission prompts": "跳过常规权限询问。",
17588
+ "Skips ALL permission checks including dangerous commands for all agents": "为所有 Agent 跳过全部权限检查,包括危险命令。",
17589
+ "Permissions managed by parent session": "由父会话管理权限。"
17590
+ };
17591
+ function permissionLocalizations(label, description) {
17592
+ const localizedLabel = Object.hasOwn(labels, label) ? labels[label] : void 0;
17593
+ const localizedDescription = Object.hasOwn(descriptions, description) ? descriptions[description] : void 0;
17594
+ return {
17595
+ "zh-CN": {
17596
+ ...localizedLabel ? { label: localizedLabel } : {},
17597
+ ...localizedDescription ? { description: localizedDescription } : {}
17598
+ }
17599
+ };
17600
+ }
17601
+
17511
17602
  // ../codebuddy/dist/configuration.js
17512
17603
  var CODEBUDDY_CAPABILITIES = {
17513
17604
  configuration: {
@@ -17565,6 +17656,7 @@ function configuration(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
17565
17656
  modes: rows(mode.options).map((option) => ({
17566
17657
  id: option.value,
17567
17658
  label: option.name,
17659
+ localizations: permissionLocalizations(text(option.name), text(option.description)),
17568
17660
  ...option.description ? { description: option.description } : {},
17569
17661
  ...["bypassPermissions", "fullAccess"].includes(text(option.value)) ? { dangerous: true } : {}
17570
17662
  })),
@@ -18051,6 +18143,11 @@ function commandCatalog(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
18051
18143
  id: `${profile.harnessId}.${name}`,
18052
18144
  invocation: `/${name}`,
18053
18145
  label: name,
18146
+ ...name === "compact" && !skill ? {
18147
+ localizations: {
18148
+ "zh-CN": { label: "压缩上下文", description: "压缩当前对话上下文" }
18149
+ }
18150
+ } : {},
18054
18151
  ...text(entry.description).trim() ? { description: text(entry.description).trim().slice(0, 512) } : {},
18055
18152
  argumentMode: name === "compact" || record2(entry.input).hint || record2(entry._meta).type === "skill" ? "text" : "none",
18056
18153
  ...record2(entry._meta).type === "skill" ? { kind: "skill" } : {}
@@ -25606,7 +25703,7 @@ var CodeBuddySession = class {
25606
25703
  // Those remain visible on individual Items; they do not fail the completed Turn.
25607
25704
  (!meta3["codebuddy.ai/outcome"] || meta3["codebuddy.ai/outcome"] === "SUCCESS" || meta3["codebuddy.ai/outcome"] === "PARTIAL_SUCCESS") ? { status: "succeeded" } : {
25608
25705
  status: "failed",
25609
- error: nativeError(new CodeBuddyError("nativeFailure", `Native Turn stopped: ${text(stop) || "unknown"} (${text(meta3["codebuddy.ai/outcome"]) || "no native outcome"})`), this.profile)
25706
+ error: nativeTurnError(stop, meta3, this.profile)
25610
25707
  };
25611
25708
  const snapshot = await this.#snapshot();
25612
25709
  const added = snapshot.turns.filter((turn) => !active.before.has(turn.nativeTurnRef.nativeTurnKey));
@@ -25913,6 +26010,121 @@ function workBuddyDelegationArguments(environment, ephemeral) {
25913
26010
  return ["--append-system-prompt", WORKBUDDY_DELEGATION_INSTRUCTIONS];
25914
26011
  }
25915
26012
 
26013
+ // dist/credential-bootstrap.js
26014
+ var WORKBUDDY_CREDENTIAL_PRELOAD = String.raw`
26015
+ (() => {
26016
+ const env = process.env;
26017
+ const bootstrapEnvironment = [
26018
+ "CODEBUDDY_SIDECAR_CREDENTIAL_BOOTSTRAP_SOCKET",
26019
+ "CODEBUDDY_SIDECAR_READY_SOCKET",
26020
+ "CODEBUDDY_SIDECAR_READY_TOKEN",
26021
+ "CODEBUDDY_SIDECAR_READY_SESSION_ID",
26022
+ ];
26023
+ if (bootstrapEnvironment.some(name => env[name] !== undefined)) {
26024
+ if (!["WORKBUDDY_AT_REST_ENCRYPTION", ...bootstrapEnvironment].every(name => env[name]?.trim())) {
26025
+ throw Error("WorkBuddy credential bootstrap environment is incomplete");
26026
+ }
26027
+ return;
26028
+ }
26029
+ const policy = env.WORKBUDDY_AT_REST_ENCRYPTION?.trim();
26030
+ // Other explicit policies remain owned by the native CLI.
26031
+ if (policy && policy !== "fields") return;
26032
+
26033
+ let provider;
26034
+ try {
26035
+ provider = process._linkedBinding("electron_browser_workbuddy_storage");
26036
+ } catch {
26037
+ // Older app runtimes predate encrypted credential fields.
26038
+ return;
26039
+ }
26040
+ const crypto = require("node:crypto");
26041
+ const net = require("node:net");
26042
+ const fs = require("node:fs");
26043
+ const path = require("node:path");
26044
+ let payload;
26045
+ try { payload = JSON.parse(provider.loggerGet()); }
26046
+ catch { throw Error("WorkBuddy credential key provider is unavailable"); }
26047
+ let secret = payload && payload.atRestSecretKey;
26048
+ const decoded = typeof secret === "string" ? Buffer.from(secret, "base64") : Buffer.alloc(0);
26049
+ const valid = payload && payload.version === 1 && decoded.length === 32 &&
26050
+ decoded.toString("base64") === secret && !decoded.every(byte => byte === 0);
26051
+ decoded.fill(0);
26052
+ if (!valid) throw Error("WorkBuddy credential key payload is unsupported");
26053
+ // Match the native normalizeAtRestKeyPayload; the base64 text is hashed, not its decoded bytes.
26054
+ const key = crypto.createHash("sha256").update(secret, "utf8").digest();
26055
+ secret = undefined;
26056
+ payload = undefined;
26057
+ const token = crypto.randomBytes(24).toString("hex");
26058
+ const sessionId = crypto.randomUUID();
26059
+ let directory;
26060
+ let socketPath;
26061
+ if (process.platform === "win32") {
26062
+ socketPath = "\\\\.\\pipe\\codexhost-wb-" + process.pid + "-" + token;
26063
+ } else {
26064
+ let root = require("node:os").tmpdir();
26065
+ if (Buffer.byteLength(root) > 65) root = "/tmp";
26066
+ directory = fs.mkdtempSync(path.join(root, "ch-wb-"));
26067
+ fs.chmodSync(directory, 0o700);
26068
+ socketPath = path.join(directory, "c");
26069
+ }
26070
+ const cleanup = () => {
26071
+ if (directory) try { fs.rmSync(directory, {recursive:true,force:true}); } catch {}
26072
+ };
26073
+ process.once("exit", cleanup);
26074
+ Object.assign(env, {
26075
+ WORKBUDDY_AT_REST_ENCRYPTION: "fields",
26076
+ CODEBUDDY_SIDECAR_CREDENTIAL_BOOTSTRAP_SOCKET: socketPath,
26077
+ CODEBUDDY_SIDECAR_READY_SOCKET: socketPath + "-ready",
26078
+ CODEBUDDY_SIDECAR_READY_TOKEN: token,
26079
+ CODEBUDDY_SIDECAR_READY_SESSION_ID: sessionId,
26080
+ });
26081
+ let message = JSON.stringify({version:1,sessionId,token,pid:process.pid,bootstrap:{
26082
+ version:1,policy:"fields",
26083
+ symmetricKey:{keyId:crypto.createHash("sha256").update(key).digest("hex").slice(0,16),keyBase64:key.toString("base64")},
26084
+ asymmetricUnavailable:"missing-key",
26085
+ }}) + "\n";
26086
+ key.fill(0);
26087
+ let done = false;
26088
+ let socket;
26089
+ const finish = success => {
26090
+ if (done) return;
26091
+ done = true;
26092
+ clearTimeout(timer);
26093
+ socket && socket.destroy();
26094
+ message = "";
26095
+ cleanup();
26096
+ process.removeListener("exit", cleanup);
26097
+ if (!success) {
26098
+ process.stderr.write("WorkBuddy credential bootstrap failed\n");
26099
+ process.exit(1);
26100
+ }
26101
+ };
26102
+ const timer = setTimeout(() => finish(false), 4500);
26103
+ const connect = () => {
26104
+ if (done) return;
26105
+ socket = net.createConnection(socketPath);
26106
+ let reply = "";
26107
+ socket.once("connect", () => socket.end(message, () => { message = ""; }));
26108
+ socket.on("data", chunk => {
26109
+ reply += chunk;
26110
+ if (reply.length > 1024) return finish(false);
26111
+ if (!reply.includes("\n")) return;
26112
+ try {
26113
+ const result = JSON.parse(reply.slice(0, reply.indexOf("\n")));
26114
+ finish(result.ok === true && result.policy === "fields");
26115
+ } catch { finish(false); }
26116
+ });
26117
+ socket.once("end", () => { if (!done) finish(false); });
26118
+ socket.once("error", error => {
26119
+ socket.destroy();
26120
+ if (error.code === "ENOENT" || error.code === "ECONNREFUSED") setTimeout(connect, 20);
26121
+ else finish(false);
26122
+ });
26123
+ };
26124
+ setImmediate(connect);
26125
+ })();
26126
+ `;
26127
+
25916
26128
  // dist/discovery.js
25917
26129
  var WORKBUDDY_MACOS_ELECTRON = "/Applications/WorkBuddy AI.app/Contents/MacOS/Electron";
25918
26130
  var windowsRoots = [
@@ -26057,7 +26269,8 @@ function workBuddyInvocation(environment, ephemeral, dependenciesOrArguments = {
26057
26269
  } : configuredEnvironment;
26058
26270
  return {
26059
26271
  ...commandInvocation(executable, [
26060
- ...bundle ? [bundle.cli] : [],
26272
+ ...bundle ? ["--eval", `${WORKBUDDY_CREDENTIAL_PRELOAD}
26273
+ require(process.argv[1]);`, bundle.cli] : [],
26061
26274
  ...nativeArguments ?? [
26062
26275
  "--acp",
26063
26276
  ...ephemeral ? ["--no-session-persistence"] : [],
@@ -26075,6 +26288,7 @@ var WORKBUDDY_COMMAND_CATALOG = harnessCommandCatalogSchema.parse({
26075
26288
  {
26076
26289
  id: "workbuddy.compact",
26077
26290
  invocation: "/compact",
26291
+ localizations: { "zh-CN": { label: "压缩上下文", description: "压缩当前对话上下文" } },
26078
26292
  label: "Compact context",
26079
26293
  description: "Compact the current WorkBuddy Session context",
26080
26294
  argumentMode: "text"
@@ -26202,15 +26416,15 @@ function normalizedLabel(value) {
26202
26416
  }
26203
26417
  function mergeWorkBuddyProductModels(catalog, productModels) {
26204
26418
  const refs = new Set(catalog.models.map((model2) => model2.ref.id));
26205
- const labels = new Set(catalog.models.map((model2) => normalizedLabel(model2.label)));
26419
+ const labels2 = new Set(catalog.models.map((model2) => normalizedLabel(model2.label)));
26206
26420
  const models = [...catalog.models];
26207
26421
  for (const productModel of productModels) {
26208
26422
  const ref = modelRef(productModel.id);
26209
26423
  const labelKey = normalizedLabel(productModel.name);
26210
- if (refs.has(ref.id) || labels.has(labelKey))
26424
+ if (refs.has(ref.id) || labels2.has(labelKey))
26211
26425
  continue;
26212
26426
  refs.add(ref.id);
26213
- labels.add(labelKey);
26427
+ labels2.add(labelKey);
26214
26428
  const creditLabel = productModel.credits?.replace(/^x/iu, "").replace(/\s*credits$/iu, "x");
26215
26429
  const annotatedLabel = creditLabel ? `${productModel.name} · ${creditLabel}` : productModel.name;
26216
26430
  models.push({
@@ -26274,6 +26488,7 @@ function createHarnessAdapter(context) {
26274
26488
  ...context.launchCommand ? { CODEXHOST_WORKBUDDY_COMMAND: context.launchCommand } : {}
26275
26489
  };
26276
26490
  return new BrokeredHarnessAdapter({
26491
+ accountCredits: false,
26277
26492
  harnessId: "workbuddy",
26278
26493
  commandCatalog: WORKBUDDY_COMMAND_CATALOG,
26279
26494
  forwardDelegationEnvironment: true,
@@ -14787,6 +14787,15 @@ var harnessDisplaySetSchema = external_exports.strictObject({
14787
14787
  initializeOnly: external_exports.boolean().optional()
14788
14788
  });
14789
14789
 
14790
+ // ../../shared-contracts/dist/harness-presentation.js
14791
+ var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
14792
+ var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
14793
+ var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
14794
+ label: displayText(256).optional(),
14795
+ description: displayText(1024).optional()
14796
+ }).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
14797
+ 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");
14798
+
14790
14799
  // ../../shared-contracts/dist/model-price-overrides.js
14791
14800
  var usdPerMillionTokens = external_exports.number().finite().nonnegative();
14792
14801
  var modelPriceOverrideSchema = external_exports.strictObject({
@@ -15123,8 +15132,24 @@ var threadUsageSnapshotSchema = external_exports.object({
15123
15132
  }
15124
15133
  });
15125
15134
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
15135
+ var accountCreditsPeriodSchema = external_exports.enum([
15136
+ "weekly",
15137
+ "monthly",
15138
+ "five_hour",
15139
+ "seven_day",
15140
+ "unknown"
15141
+ ]);
15142
+ var accountCreditsScopeSchema = external_exports.object({
15143
+ id: external_exports.string().min(1).max(256),
15144
+ label: external_exports.string().min(1).max(256),
15145
+ localizations: harnessLocalizationsSchema.optional()
15146
+ }).strict();
15126
15147
  var accountCreditsProductUsageSchema = external_exports.object({
15127
15148
  product: external_exports.string().min(1),
15149
+ /** Native period and scope, never inferred from the display name. */
15150
+ periodType: accountCreditsPeriodSchema.optional(),
15151
+ scope: accountCreditsScopeSchema.optional(),
15152
+ localizations: harnessLocalizationsSchema.optional(),
15128
15153
  used: external_exports.number().finite().nonnegative().optional(),
15129
15154
  // Zero is a real empty cap, not an absent field.
15130
15155
  limit: external_exports.number().finite().nonnegative().optional(),
@@ -15144,9 +15169,11 @@ var accountCreditsSnapshotSchema = external_exports.object({
15144
15169
  unit: external_exports.string().min(1).max(32).optional(),
15145
15170
  /** Native label when the primary limit is scoped to a model or product group. */
15146
15171
  label: external_exports.string().min(1).optional(),
15172
+ scope: accountCreditsScopeSchema.optional(),
15173
+ localizations: harnessLocalizationsSchema.optional(),
15147
15174
  usedPercent: usagePercentSchema,
15148
15175
  resetsAt: external_exports.string().min(1).optional(),
15149
- periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
15176
+ periodType: accountCreditsPeriodSchema,
15150
15177
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
15151
15178
  resetCredits: accountResetCreditsSchema.optional()
15152
15179
  }).strict();
@@ -15157,7 +15184,9 @@ var threadUsageInspectionParamsSchema = external_exports.object({
15157
15184
  var threadUsageInspectionSchema = external_exports.object({
15158
15185
  threadId: hostThreadIdSchema,
15159
15186
  usage: threadUsageSnapshotSchema.nullable(),
15160
- accountCredits: accountCreditsSnapshotSchema.optional()
15187
+ accountCredits: accountCreditsSnapshotSchema.optional(),
15188
+ /** Whether this source can provide cached account quota independently of usage. */
15189
+ accountCreditsSupported: external_exports.boolean().optional()
15161
15190
  }).strict();
15162
15191
 
15163
15192
  // ../../shared-contracts/dist/harness-accounts.js
@@ -15284,7 +15313,8 @@ var harnessPermissionModeSchema = external_exports.object({
15284
15313
  id: harnessPermissionModeIdSchema,
15285
15314
  label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
15286
15315
  description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
15287
- dangerous: external_exports.boolean().optional()
15316
+ dangerous: external_exports.boolean().optional(),
15317
+ localizations: harnessLocalizationsSchema.optional()
15288
15318
  }).strict();
15289
15319
  var harnessPermissionModeCatalogSchema = external_exports.object({
15290
15320
  modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
@@ -15671,6 +15701,8 @@ var harnessInstallationStateSchema = external_exports.object({
15671
15701
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
15672
15702
  message: external_exports.string().max(2048).optional(),
15673
15703
  messageCode: external_exports.string().min(1).max(128).optional(),
15704
+ /** Safe plugin-owned explanation, distinct from raw diagnostic message. */
15705
+ notice: harnessLocalizedTextSchema.optional(),
15674
15706
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
15675
15707
  }).strict();
15676
15708
 
@@ -15797,6 +15829,7 @@ var harnessCommandDescriptorSchema = external_exports.object({
15797
15829
  invocation: commandInvocationSchema,
15798
15830
  label: commandLabelSchema,
15799
15831
  description: commandDescriptionSchema.optional(),
15832
+ localizations: harnessLocalizationsSchema.optional(),
15800
15833
  argumentMode: external_exports.enum(["none", "text"]),
15801
15834
  /**
15802
15835
  * Native distinction reported by the Harness. Omitted when the Harness does
@@ -16716,6 +16749,10 @@ function createZcodeInstallation(environment, app) {
16716
16749
  updateAvailable: false,
16717
16750
  canUpdate: false,
16718
16751
  messageCode: "zcode-desktop-updater",
16752
+ notice: {
16753
+ en: "The CLI ships inside ZCode Desktop. Update ZCode Desktop itself to update it.",
16754
+ "zh-CN": "CLI 随 ZCode Desktop 一起发布,请直接更新 ZCode Desktop。"
16755
+ },
16719
16756
  message: "The CLI ships inside ZCode Desktop. Update ZCode Desktop itself to update it."
16720
16757
  };
16721
16758
  };
@@ -18180,11 +18217,19 @@ var modeLabels = {
18180
18217
  yolo: "Full access",
18181
18218
  auto: "Auto"
18182
18219
  };
18220
+ var chineseModeLabels = {
18221
+ build: "确认变更",
18222
+ edit: "自动编辑",
18223
+ plan: "规划模式",
18224
+ yolo: "完全访问",
18225
+ auto: "自动"
18226
+ };
18183
18227
  function permissionModes(current = "build") {
18184
18228
  return harnessPermissionModeCatalogSchema.parse({
18185
18229
  modes: Object.entries(modeLabels).map(([id, label]) => ({
18186
18230
  id,
18187
18231
  label,
18232
+ localizations: { "zh-CN": { label: chineseModeLabels[id] } },
18188
18233
  ...id === "yolo" ? { dangerous: true } : {}
18189
18234
  })),
18190
18235
  defaultModeId: current
@@ -19224,6 +19269,7 @@ var COMMAND_CATALOG = harnessCommandCatalogSchema.parse({
19224
19269
  {
19225
19270
  id: "compact",
19226
19271
  invocation: "/compact",
19272
+ localizations: { "zh-CN": { label: "压缩上下文", description: "压缩当前对话上下文" } },
19227
19273
  label: "Compact",
19228
19274
  description: "Compact the native ZCode conversation.",
19229
19275
  argumentMode: "text"