@liberseek/boft-cli-win32-arm64 0.8.0 → 0.8.2

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({
@@ -14682,6 +14691,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
14682
14691
  harness,
14683
14692
  sessionId: external_exports.string().min(1).max(512),
14684
14693
  project: project.nullable(),
14694
+ /** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
14695
+ title: external_exports.string().min(1).max(200).optional(),
14685
14696
  /** Models the session used, most requests first. */
14686
14697
  models: external_exports.array(model).max(16),
14687
14698
  firstAtMs: count,
@@ -14748,7 +14759,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
14748
14759
  * The sessions that spent the most, by cost and by tokens without cache, all filters applied;
14749
14760
  * requests without a native session are not listed here but count everywhere else.
14750
14761
  */
14751
- sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
14762
+ sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
14763
+ /**
14764
+ * The sessions last active in the range, newest first, all filters applied. Optional for older
14765
+ * Hosts; missing is treated as no list rather than no sessions.
14766
+ */
14767
+ recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
14752
14768
  });
14753
14769
 
14754
14770
  // ../../shared-contracts/dist/ids.js
@@ -15017,8 +15033,24 @@ var threadUsageSnapshotSchema = external_exports.object({
15017
15033
  }
15018
15034
  });
15019
15035
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
15036
+ var accountCreditsPeriodSchema = external_exports.enum([
15037
+ "weekly",
15038
+ "monthly",
15039
+ "five_hour",
15040
+ "seven_day",
15041
+ "unknown"
15042
+ ]);
15043
+ var accountCreditsScopeSchema = external_exports.object({
15044
+ id: external_exports.string().min(1).max(256),
15045
+ label: external_exports.string().min(1).max(256),
15046
+ localizations: harnessLocalizationsSchema.optional()
15047
+ }).strict();
15020
15048
  var accountCreditsProductUsageSchema = external_exports.object({
15021
15049
  product: external_exports.string().min(1),
15050
+ /** Native period and scope, never inferred from the display name. */
15051
+ periodType: accountCreditsPeriodSchema.optional(),
15052
+ scope: accountCreditsScopeSchema.optional(),
15053
+ localizations: harnessLocalizationsSchema.optional(),
15022
15054
  used: external_exports.number().finite().nonnegative().optional(),
15023
15055
  // Zero is a real empty cap, not an absent field.
15024
15056
  limit: external_exports.number().finite().nonnegative().optional(),
@@ -15040,8 +15072,10 @@ var accountCreditsSnapshotSchema = external_exports.object({
15040
15072
  label: external_exports.string().min(1).optional(),
15041
15073
  usedPercent: usagePercentSchema.optional(),
15042
15074
  remaining: external_exports.number().finite().optional(),
15075
+ scope: accountCreditsScopeSchema.optional(),
15076
+ localizations: harnessLocalizationsSchema.optional(),
15043
15077
  resetsAt: external_exports.string().min(1).optional(),
15044
- periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
15078
+ periodType: accountCreditsPeriodSchema,
15045
15079
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
15046
15080
  resetCredits: accountResetCreditsSchema.optional()
15047
15081
  }).strict().superRefine((credits, context) => {
@@ -15066,7 +15100,9 @@ var threadUsageInspectionParamsSchema = external_exports.object({
15066
15100
  var threadUsageInspectionSchema = external_exports.object({
15067
15101
  threadId: hostThreadIdSchema,
15068
15102
  usage: threadUsageSnapshotSchema.nullable(),
15069
- accountCredits: accountCreditsSnapshotSchema.optional()
15103
+ accountCredits: accountCreditsSnapshotSchema.optional(),
15104
+ /** Whether this source can provide cached account quota independently of usage. */
15105
+ accountCreditsSupported: external_exports.boolean().optional()
15070
15106
  }).strict();
15071
15107
 
15072
15108
  // ../../shared-contracts/dist/harness-accounts.js
@@ -15193,7 +15229,8 @@ var harnessPermissionModeSchema = external_exports.object({
15193
15229
  id: harnessPermissionModeIdSchema,
15194
15230
  label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
15195
15231
  description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
15196
- dangerous: external_exports.boolean().optional()
15232
+ dangerous: external_exports.boolean().optional(),
15233
+ localizations: harnessLocalizationsSchema.optional()
15197
15234
  }).strict();
15198
15235
  var harnessPermissionModeCatalogSchema = external_exports.object({
15199
15236
  modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
@@ -15516,6 +15553,8 @@ var harnessInstallationStateSchema = external_exports.object({
15516
15553
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
15517
15554
  message: external_exports.string().max(2048).optional(),
15518
15555
  messageCode: external_exports.string().min(1).max(128).optional(),
15556
+ /** Safe plugin-owned explanation, distinct from raw diagnostic message. */
15557
+ notice: harnessLocalizedTextSchema.optional(),
15519
15558
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
15520
15559
  }).strict();
15521
15560
 
@@ -15654,6 +15693,7 @@ var harnessCommandDescriptorSchema = external_exports.object({
15654
15693
  invocation: commandInvocationSchema,
15655
15694
  label: commandLabelSchema,
15656
15695
  description: commandDescriptionSchema.optional(),
15696
+ localizations: harnessLocalizationsSchema.optional(),
15657
15697
  argumentMode: external_exports.enum(["none", "text"]),
15658
15698
  /**
15659
15699
  * Native distinction reported by the Harness. Omitted when the Harness does
@@ -17205,6 +17245,8 @@ var BrokeredHarnessAdapter = class {
17205
17245
  commandCatalog;
17206
17246
  liveCommandCatalog;
17207
17247
  harnessId;
17248
+ credits;
17249
+ refreshCredits;
17208
17250
  #descriptorPath;
17209
17251
  #forwardEnvironment;
17210
17252
  #isInstalled;
@@ -17304,6 +17346,10 @@ var BrokeredHarnessAdapter = class {
17304
17346
  }
17305
17347
  constructor(input = {}) {
17306
17348
  this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
17349
+ if (input.accountCredits !== false) {
17350
+ this.credits = () => this.#credits;
17351
+ this.refreshCredits = () => this.#refreshAccountCredits();
17352
+ }
17307
17353
  this.#forwardEnvironment = input.forwardDelegationEnvironment === true;
17308
17354
  if (input.commandCatalog)
17309
17355
  this.commandCatalog = input.commandCatalog;
@@ -17315,10 +17361,7 @@ var BrokeredHarnessAdapter = class {
17315
17361
  this.#startBroker = input.startBroker === false ? void 0 : input.startBroker ?? (process.platform === "darwin" && !input.descriptorPath ? () => startBrokerLaunchAgent(this.harnessId, environment) : void 0);
17316
17362
  this.#startTimeoutMs = input.startTimeoutMs ?? BROKER_START_TIMEOUT_MS;
17317
17363
  }
17318
- credits() {
17319
- return this.#credits;
17320
- }
17321
- refreshCredits() {
17364
+ #refreshAccountCredits() {
17322
17365
  if (this.#closed)
17323
17366
  return Promise.resolve(null);
17324
17367
  if (this.#creditsRefresh)
@@ -17495,6 +17538,20 @@ import path2 from "node:path";
17495
17538
  import { createInterface } from "node:readline";
17496
17539
  var MAX_SESSION_ID_LENGTH = 512;
17497
17540
  var MAX_CWD_LENGTH = 4096;
17541
+ var MAX_SESSION_TITLE_LENGTH = 200;
17542
+ function usageSessionTitle(value) {
17543
+ if (typeof value !== "string")
17544
+ return void 0;
17545
+ const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
17546
+ if (!normalized)
17547
+ return void 0;
17548
+ if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
17549
+ return normalized;
17550
+ const characters = [...normalized];
17551
+ if (characters.length <= MAX_SESSION_TITLE_LENGTH)
17552
+ return normalized;
17553
+ return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
17554
+ }
17498
17555
  function sessionIdOk(value) {
17499
17556
  return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
17500
17557
  }
@@ -17504,12 +17561,14 @@ function cwdOk(value) {
17504
17561
  function withUsageSession(entry, session) {
17505
17562
  const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
17506
17563
  const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
17564
+ const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
17507
17565
  if (sessionId === void 0 && cwd === void 0)
17508
17566
  return entry;
17509
17567
  return {
17510
17568
  ...entry,
17511
17569
  ...sessionId !== void 0 ? { sessionId } : {},
17512
- ...cwd !== void 0 ? { cwd } : {}
17570
+ ...cwd !== void 0 ? { cwd } : {},
17571
+ ...sessionTitle !== void 0 ? { sessionTitle } : {}
17513
17572
  };
17514
17573
  }
17515
17574
  function usageEntryFromRequest(request, occurredAtMs) {
@@ -17620,6 +17679,27 @@ function nativeError(error51, profile = CODEBUDDY_RUNTIME_PROFILE) {
17620
17679
  function failure(code, message, profile = CODEBUDDY_RUNTIME_PROFILE) {
17621
17680
  return { ok: false, error: nativeError(new CodeBuddyError(code, message), profile) };
17622
17681
  }
17682
+ function nativeTurnError(stopReason, meta3, profile) {
17683
+ const fallback = `Native Turn stopped: ${text(stopReason) || "unknown"} (${text(meta3["codebuddy.ai/outcome"]) || "no native outcome"})`;
17684
+ const raw = text(meta3["codebuddy.ai/errorMessage"]).trim();
17685
+ let diagnostic = "";
17686
+ let category;
17687
+ if (raw) {
17688
+ try {
17689
+ const error51 = record2(JSON.parse(raw));
17690
+ const data = record2(error51.data);
17691
+ diagnostic = text(data.details).trim() || text(error51.message).trim();
17692
+ category = data.category;
17693
+ } catch {
17694
+ diagnostic = raw;
17695
+ }
17696
+ }
17697
+ return nativeError(new CodeBuddyError(
17698
+ // -32000 is shared by native refusals; the category identifies authentication failures.
17699
+ category === "auth" ? "authenticationRequired" : "nativeFailure",
17700
+ diagnostic ? `${fallback}: ${diagnostic}` : fallback
17701
+ ), profile);
17702
+ }
17623
17703
  async function bounded(operation, milliseconds, label, onTimeout) {
17624
17704
  let timer;
17625
17705
  try {
@@ -17641,6 +17721,40 @@ async function bounded(operation, milliseconds, label, onTimeout) {
17641
17721
  }
17642
17722
  }
17643
17723
 
17724
+ // ../codebuddy/dist/permission-presentation.js
17725
+ var labels = {
17726
+ "Always Ask": "始终询问",
17727
+ "Accept Edits": "接受编辑",
17728
+ Plan: "规划模式",
17729
+ Auto: "自动",
17730
+ "Auto mode": "自动模式",
17731
+ "Don't Ask": "不询问",
17732
+ "Bypass Permissions": "绕过权限",
17733
+ "Full Access": "完全访问",
17734
+ Delegate: "由父会话管理",
17735
+ Default: "默认"
17736
+ };
17737
+ var descriptions = {
17738
+ "Prompts for permission on first use of each tool": "首次使用每种工具时请求权限。",
17739
+ "Automatically accepts file edit permissions for the session": "自动接受本会话中的文件编辑权限。",
17740
+ "Agent can analyze but not modify files or execute commands": "Agent 可以分析,但不能修改文件或执行命令。",
17741
+ "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 分类器评估原本需要询问的操作:安全操作自动批准,风险操作拒绝。分类器不可用时改为询问;无法显示询问时拒绝。",
17742
+ "Does not show permission prompts; pre-approved and safe read-only actions run, everything else that would prompt is denied": "不显示权限询问;已获批准和安全的只读操作可以执行,其余原本需要询问的操作会被拒绝。",
17743
+ "Skips all permission prompts": "跳过常规权限询问。",
17744
+ "Skips ALL permission checks including dangerous commands for all agents": "为所有 Agent 跳过全部权限检查,包括危险命令。",
17745
+ "Permissions managed by parent session": "由父会话管理权限。"
17746
+ };
17747
+ function permissionLocalizations(label, description) {
17748
+ const localizedLabel = Object.hasOwn(labels, label) ? labels[label] : void 0;
17749
+ const localizedDescription = Object.hasOwn(descriptions, description) ? descriptions[description] : void 0;
17750
+ return {
17751
+ "zh-CN": {
17752
+ ...localizedLabel ? { label: localizedLabel } : {},
17753
+ ...localizedDescription ? { description: localizedDescription } : {}
17754
+ }
17755
+ };
17756
+ }
17757
+
17644
17758
  // ../codebuddy/dist/configuration.js
17645
17759
  var CODEBUDDY_CAPABILITIES = {
17646
17760
  configuration: {
@@ -17698,6 +17812,7 @@ function configuration(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
17698
17812
  modes: rows(mode.options).map((option) => ({
17699
17813
  id: option.value,
17700
17814
  label: option.name,
17815
+ localizations: permissionLocalizations(text(option.name), text(option.description)),
17701
17816
  ...option.description ? { description: option.description } : {},
17702
17817
  ...["bypassPermissions", "fullAccess"].includes(text(option.value)) ? { dangerous: true } : {}
17703
17818
  })),
@@ -18184,6 +18299,11 @@ function commandCatalog(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
18184
18299
  id: `${profile.harnessId}.${name}`,
18185
18300
  invocation: `/${name}`,
18186
18301
  label: name,
18302
+ ...name === "compact" && !skill ? {
18303
+ localizations: {
18304
+ "zh-CN": { label: "压缩上下文", description: "压缩当前对话上下文" }
18305
+ }
18306
+ } : {},
18187
18307
  ...text(entry.description).trim() ? { description: text(entry.description).trim().slice(0, 512) } : {},
18188
18308
  argumentMode: name === "compact" || record2(entry.input).hint || record2(entry._meta).type === "skill" ? "text" : "none",
18189
18309
  ...record2(entry._meta).type === "skill" ? { kind: "skill" } : {}
@@ -19008,11 +19128,30 @@ function historyUsage(contents) {
19008
19128
  function record3(value) {
19009
19129
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
19010
19130
  }
19131
+ function codeBuddyUserText(row) {
19132
+ if (row.type !== "message" || row.role !== "user")
19133
+ return void 0;
19134
+ const { content } = row;
19135
+ if (typeof content === "string")
19136
+ return content;
19137
+ if (!Array.isArray(content))
19138
+ return void 0;
19139
+ return content.map((part) => record3(part)).filter((part) => typeof part.text === "string").map((part) => String(part.text)).join(" ");
19140
+ }
19011
19141
  async function readCodeBuddyUsage(file2, signal) {
19012
19142
  const messages = /* @__PURE__ */ new Map();
19013
19143
  let sessionId;
19014
19144
  let cwd;
19015
- for await (const row of jsonlRecords(file2, '"rawUsage"', signal)) {
19145
+ let customTitle;
19146
+ let generatedTitle;
19147
+ let firstPrompt;
19148
+ for await (const row of jsonlRecords(file2, '"type"', signal)) {
19149
+ if (row.type === "custom-title")
19150
+ customTitle = usageSessionTitle(row.customTitle);
19151
+ else if (row.type === "ai-title")
19152
+ generatedTitle = usageSessionTitle(row.aiTitle);
19153
+ else if (!firstPrompt)
19154
+ firstPrompt = usageSessionTitle(codeBuddyUserText(row));
19016
19155
  if (typeof row.type !== "string" || !NATIVE_MESSAGE_TYPES.has(row.type))
19017
19156
  continue;
19018
19157
  sessionId ??= row.sessionId;
@@ -19034,7 +19173,8 @@ async function readCodeBuddyUsage(file2, signal) {
19034
19173
  }
19035
19174
  entries.push(withUsageSession(entry, {
19036
19175
  sessionId: typeof sessionId === "string" ? sessionId : void 0,
19037
- cwd: typeof cwd === "string" ? cwd : void 0
19176
+ cwd: typeof cwd === "string" ? cwd : void 0,
19177
+ title: customTitle ?? generatedTitle ?? firstPrompt
19038
19178
  }));
19039
19179
  }
19040
19180
  }
@@ -25720,7 +25860,7 @@ var CodeBuddySession = class {
25720
25860
  // Those remain visible on individual Items; they do not fail the completed Turn.
25721
25861
  (!meta3["codebuddy.ai/outcome"] || meta3["codebuddy.ai/outcome"] === "SUCCESS" || meta3["codebuddy.ai/outcome"] === "PARTIAL_SUCCESS") ? { status: "succeeded" } : {
25722
25862
  status: "failed",
25723
- error: nativeError(new CodeBuddyError("nativeFailure", `Native Turn stopped: ${text(stop) || "unknown"} (${text(meta3["codebuddy.ai/outcome"]) || "no native outcome"})`), this.profile)
25863
+ error: nativeTurnError(stop, meta3, this.profile)
25724
25864
  };
25725
25865
  const snapshot = await this.#snapshot();
25726
25866
  const added = snapshot.turns.filter((turn) => !active.before.has(turn.nativeTurnRef.nativeTurnKey));
@@ -26027,6 +26167,121 @@ function workBuddyDelegationArguments(environment, ephemeral) {
26027
26167
  return ["--append-system-prompt", WORKBUDDY_DELEGATION_INSTRUCTIONS];
26028
26168
  }
26029
26169
 
26170
+ // dist/credential-bootstrap.js
26171
+ var WORKBUDDY_CREDENTIAL_PRELOAD = String.raw`
26172
+ (() => {
26173
+ const env = process.env;
26174
+ const bootstrapEnvironment = [
26175
+ "CODEBUDDY_SIDECAR_CREDENTIAL_BOOTSTRAP_SOCKET",
26176
+ "CODEBUDDY_SIDECAR_READY_SOCKET",
26177
+ "CODEBUDDY_SIDECAR_READY_TOKEN",
26178
+ "CODEBUDDY_SIDECAR_READY_SESSION_ID",
26179
+ ];
26180
+ if (bootstrapEnvironment.some(name => env[name] !== undefined)) {
26181
+ if (!["WORKBUDDY_AT_REST_ENCRYPTION", ...bootstrapEnvironment].every(name => env[name]?.trim())) {
26182
+ throw Error("WorkBuddy credential bootstrap environment is incomplete");
26183
+ }
26184
+ return;
26185
+ }
26186
+ const policy = env.WORKBUDDY_AT_REST_ENCRYPTION?.trim();
26187
+ // Other explicit policies remain owned by the native CLI.
26188
+ if (policy && policy !== "fields") return;
26189
+
26190
+ let provider;
26191
+ try {
26192
+ provider = process._linkedBinding("electron_browser_workbuddy_storage");
26193
+ } catch {
26194
+ // Older app runtimes predate encrypted credential fields.
26195
+ return;
26196
+ }
26197
+ const crypto = require("node:crypto");
26198
+ const net = require("node:net");
26199
+ const fs = require("node:fs");
26200
+ const path = require("node:path");
26201
+ let payload;
26202
+ try { payload = JSON.parse(provider.loggerGet()); }
26203
+ catch { throw Error("WorkBuddy credential key provider is unavailable"); }
26204
+ let secret = payload && payload.atRestSecretKey;
26205
+ const decoded = typeof secret === "string" ? Buffer.from(secret, "base64") : Buffer.alloc(0);
26206
+ const valid = payload && payload.version === 1 && decoded.length === 32 &&
26207
+ decoded.toString("base64") === secret && !decoded.every(byte => byte === 0);
26208
+ decoded.fill(0);
26209
+ if (!valid) throw Error("WorkBuddy credential key payload is unsupported");
26210
+ // Match the native normalizeAtRestKeyPayload; the base64 text is hashed, not its decoded bytes.
26211
+ const key = crypto.createHash("sha256").update(secret, "utf8").digest();
26212
+ secret = undefined;
26213
+ payload = undefined;
26214
+ const token = crypto.randomBytes(24).toString("hex");
26215
+ const sessionId = crypto.randomUUID();
26216
+ let directory;
26217
+ let socketPath;
26218
+ if (process.platform === "win32") {
26219
+ socketPath = "\\\\.\\pipe\\codexhost-wb-" + process.pid + "-" + token;
26220
+ } else {
26221
+ let root = require("node:os").tmpdir();
26222
+ if (Buffer.byteLength(root) > 65) root = "/tmp";
26223
+ directory = fs.mkdtempSync(path.join(root, "ch-wb-"));
26224
+ fs.chmodSync(directory, 0o700);
26225
+ socketPath = path.join(directory, "c");
26226
+ }
26227
+ const cleanup = () => {
26228
+ if (directory) try { fs.rmSync(directory, {recursive:true,force:true}); } catch {}
26229
+ };
26230
+ process.once("exit", cleanup);
26231
+ Object.assign(env, {
26232
+ WORKBUDDY_AT_REST_ENCRYPTION: "fields",
26233
+ CODEBUDDY_SIDECAR_CREDENTIAL_BOOTSTRAP_SOCKET: socketPath,
26234
+ CODEBUDDY_SIDECAR_READY_SOCKET: socketPath + "-ready",
26235
+ CODEBUDDY_SIDECAR_READY_TOKEN: token,
26236
+ CODEBUDDY_SIDECAR_READY_SESSION_ID: sessionId,
26237
+ });
26238
+ let message = JSON.stringify({version:1,sessionId,token,pid:process.pid,bootstrap:{
26239
+ version:1,policy:"fields",
26240
+ symmetricKey:{keyId:crypto.createHash("sha256").update(key).digest("hex").slice(0,16),keyBase64:key.toString("base64")},
26241
+ asymmetricUnavailable:"missing-key",
26242
+ }}) + "\n";
26243
+ key.fill(0);
26244
+ let done = false;
26245
+ let socket;
26246
+ const finish = success => {
26247
+ if (done) return;
26248
+ done = true;
26249
+ clearTimeout(timer);
26250
+ socket && socket.destroy();
26251
+ message = "";
26252
+ cleanup();
26253
+ process.removeListener("exit", cleanup);
26254
+ if (!success) {
26255
+ process.stderr.write("WorkBuddy credential bootstrap failed\n");
26256
+ process.exit(1);
26257
+ }
26258
+ };
26259
+ const timer = setTimeout(() => finish(false), 4500);
26260
+ const connect = () => {
26261
+ if (done) return;
26262
+ socket = net.createConnection(socketPath);
26263
+ let reply = "";
26264
+ socket.once("connect", () => socket.end(message, () => { message = ""; }));
26265
+ socket.on("data", chunk => {
26266
+ reply += chunk;
26267
+ if (reply.length > 1024) return finish(false);
26268
+ if (!reply.includes("\n")) return;
26269
+ try {
26270
+ const result = JSON.parse(reply.slice(0, reply.indexOf("\n")));
26271
+ finish(result.ok === true && result.policy === "fields");
26272
+ } catch { finish(false); }
26273
+ });
26274
+ socket.once("end", () => { if (!done) finish(false); });
26275
+ socket.once("error", error => {
26276
+ socket.destroy();
26277
+ if (error.code === "ENOENT" || error.code === "ECONNREFUSED") setTimeout(connect, 20);
26278
+ else finish(false);
26279
+ });
26280
+ };
26281
+ setImmediate(connect);
26282
+ })();
26283
+ `;
26284
+
26030
26285
  // dist/discovery.js
26031
26286
  var WORKBUDDY_MACOS_ELECTRON = "/Applications/WorkBuddy AI.app/Contents/MacOS/Electron";
26032
26287
  var windowsRoots = [
@@ -26171,7 +26426,8 @@ function workBuddyInvocation(environment, ephemeral, dependenciesOrArguments = {
26171
26426
  } : configuredEnvironment;
26172
26427
  return {
26173
26428
  ...commandInvocation(executable, [
26174
- ...bundle ? [bundle.cli] : [],
26429
+ ...bundle ? ["--eval", `${WORKBUDDY_CREDENTIAL_PRELOAD}
26430
+ require(process.argv[1]);`, bundle.cli] : [],
26175
26431
  ...nativeArguments ?? [
26176
26432
  "--acp",
26177
26433
  ...ephemeral ? ["--no-session-persistence"] : [],
@@ -26189,6 +26445,7 @@ var WORKBUDDY_COMMAND_CATALOG = harnessCommandCatalogSchema.parse({
26189
26445
  {
26190
26446
  id: "workbuddy.compact",
26191
26447
  invocation: "/compact",
26448
+ localizations: { "zh-CN": { label: "压缩上下文", description: "压缩当前对话上下文" } },
26192
26449
  label: "Compact context",
26193
26450
  description: "Compact the current WorkBuddy Session context",
26194
26451
  argumentMode: "text"
@@ -26316,15 +26573,15 @@ function normalizedLabel(value) {
26316
26573
  }
26317
26574
  function mergeWorkBuddyProductModels(catalog, productModels) {
26318
26575
  const refs = new Set(catalog.models.map((model2) => model2.ref.id));
26319
- const labels = new Set(catalog.models.map((model2) => normalizedLabel(model2.label)));
26576
+ const labels2 = new Set(catalog.models.map((model2) => normalizedLabel(model2.label)));
26320
26577
  const models = [...catalog.models];
26321
26578
  for (const productModel of productModels) {
26322
26579
  const ref = modelRef(productModel.id);
26323
26580
  const labelKey = normalizedLabel(productModel.name);
26324
- if (refs.has(ref.id) || labels.has(labelKey))
26581
+ if (refs.has(ref.id) || labels2.has(labelKey))
26325
26582
  continue;
26326
26583
  refs.add(ref.id);
26327
- labels.add(labelKey);
26584
+ labels2.add(labelKey);
26328
26585
  const creditLabel = productModel.credits?.replace(/^x/iu, "").replace(/\s*credits$/iu, "x");
26329
26586
  const annotatedLabel = creditLabel ? `${productModel.name} · ${creditLabel}` : productModel.name;
26330
26587
  models.push({
@@ -26388,6 +26645,7 @@ function createHarnessAdapter(context) {
26388
26645
  ...context.launchCommand ? { CODEXHOST_WORKBUDDY_COMMAND: context.launchCommand } : {}
26389
26646
  };
26390
26647
  return new BrokeredHarnessAdapter({
26648
+ accountCredits: false,
26391
26649
  harnessId: "workbuddy",
26392
26650
  commandCatalog: WORKBUDDY_COMMAND_CATALOG,
26393
26651
  forwardDelegationEnvironment: true,