@liberseek/boft-cli-linux-x64 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.
@@ -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({
@@ -15158,6 +15167,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
15158
15167
  harness,
15159
15168
  sessionId: external_exports.string().min(1).max(512),
15160
15169
  project: project.nullable(),
15170
+ /** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
15171
+ title: external_exports.string().min(1).max(200).optional(),
15161
15172
  /** Models the session used, most requests first. */
15162
15173
  models: external_exports.array(model).max(16),
15163
15174
  firstAtMs: count,
@@ -15224,7 +15235,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
15224
15235
  * The sessions that spent the most, by cost and by tokens without cache, all filters applied;
15225
15236
  * requests without a native session are not listed here but count everywhere else.
15226
15237
  */
15227
- sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
15238
+ sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
15239
+ /**
15240
+ * The sessions last active in the range, newest first, all filters applied. Optional for older
15241
+ * Hosts; missing is treated as no list rather than no sessions.
15242
+ */
15243
+ recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
15228
15244
  });
15229
15245
 
15230
15246
  // ../../shared-contracts/dist/ids.js
@@ -15493,8 +15509,24 @@ var threadUsageSnapshotSchema = external_exports.object({
15493
15509
  }
15494
15510
  });
15495
15511
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
15512
+ var accountCreditsPeriodSchema = external_exports.enum([
15513
+ "weekly",
15514
+ "monthly",
15515
+ "five_hour",
15516
+ "seven_day",
15517
+ "unknown"
15518
+ ]);
15519
+ var accountCreditsScopeSchema = external_exports.object({
15520
+ id: external_exports.string().min(1).max(256),
15521
+ label: external_exports.string().min(1).max(256),
15522
+ localizations: harnessLocalizationsSchema.optional()
15523
+ }).strict();
15496
15524
  var accountCreditsProductUsageSchema = external_exports.object({
15497
15525
  product: external_exports.string().min(1),
15526
+ /** Native period and scope, never inferred from the display name. */
15527
+ periodType: accountCreditsPeriodSchema.optional(),
15528
+ scope: accountCreditsScopeSchema.optional(),
15529
+ localizations: harnessLocalizationsSchema.optional(),
15498
15530
  used: external_exports.number().finite().nonnegative().optional(),
15499
15531
  // Zero is a real empty cap, not an absent field.
15500
15532
  limit: external_exports.number().finite().nonnegative().optional(),
@@ -15516,8 +15548,10 @@ var accountCreditsSnapshotSchema = external_exports.object({
15516
15548
  label: external_exports.string().min(1).optional(),
15517
15549
  usedPercent: usagePercentSchema.optional(),
15518
15550
  remaining: external_exports.number().finite().optional(),
15551
+ scope: accountCreditsScopeSchema.optional(),
15552
+ localizations: harnessLocalizationsSchema.optional(),
15519
15553
  resetsAt: external_exports.string().min(1).optional(),
15520
- periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
15554
+ periodType: accountCreditsPeriodSchema,
15521
15555
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
15522
15556
  resetCredits: accountResetCreditsSchema.optional()
15523
15557
  }).strict().superRefine((credits, context) => {
@@ -15542,7 +15576,9 @@ var threadUsageInspectionParamsSchema = external_exports.object({
15542
15576
  var threadUsageInspectionSchema = external_exports.object({
15543
15577
  threadId: hostThreadIdSchema,
15544
15578
  usage: threadUsageSnapshotSchema.nullable(),
15545
- accountCredits: accountCreditsSnapshotSchema.optional()
15579
+ accountCredits: accountCreditsSnapshotSchema.optional(),
15580
+ /** Whether this source can provide cached account quota independently of usage. */
15581
+ accountCreditsSupported: external_exports.boolean().optional()
15546
15582
  }).strict();
15547
15583
 
15548
15584
  // ../../shared-contracts/dist/harness-accounts.js
@@ -15669,7 +15705,8 @@ var harnessPermissionModeSchema = external_exports.object({
15669
15705
  id: harnessPermissionModeIdSchema,
15670
15706
  label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
15671
15707
  description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
15672
- dangerous: external_exports.boolean().optional()
15708
+ dangerous: external_exports.boolean().optional(),
15709
+ localizations: harnessLocalizationsSchema.optional()
15673
15710
  }).strict();
15674
15711
  var harnessPermissionModeCatalogSchema = external_exports.object({
15675
15712
  modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
@@ -15992,6 +16029,8 @@ var harnessInstallationStateSchema = external_exports.object({
15992
16029
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
15993
16030
  message: external_exports.string().max(2048).optional(),
15994
16031
  messageCode: external_exports.string().min(1).max(128).optional(),
16032
+ /** Safe plugin-owned explanation, distinct from raw diagnostic message. */
16033
+ notice: harnessLocalizedTextSchema.optional(),
15995
16034
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
15996
16035
  }).strict();
15997
16036
 
@@ -16130,6 +16169,7 @@ var harnessCommandDescriptorSchema = external_exports.object({
16130
16169
  invocation: commandInvocationSchema,
16131
16170
  label: commandLabelSchema,
16132
16171
  description: commandDescriptionSchema.optional(),
16172
+ localizations: harnessLocalizationsSchema.optional(),
16133
16173
  argumentMode: external_exports.enum(["none", "text"]),
16134
16174
  /**
16135
16175
  * Native distinction reported by the Harness. Omitted when the Harness does
@@ -16810,6 +16850,27 @@ function nativeError(error51, profile = CODEBUDDY_RUNTIME_PROFILE) {
16810
16850
  function failure(code, message, profile = CODEBUDDY_RUNTIME_PROFILE) {
16811
16851
  return { ok: false, error: nativeError(new CodeBuddyError(code, message), profile) };
16812
16852
  }
16853
+ function nativeTurnError(stopReason, meta3, profile) {
16854
+ const fallback = `Native Turn stopped: ${text(stopReason) || "unknown"} (${text(meta3["codebuddy.ai/outcome"]) || "no native outcome"})`;
16855
+ const raw = text(meta3["codebuddy.ai/errorMessage"]).trim();
16856
+ let diagnostic = "";
16857
+ let category;
16858
+ if (raw) {
16859
+ try {
16860
+ const error51 = record2(JSON.parse(raw));
16861
+ const data = record2(error51.data);
16862
+ diagnostic = text(data.details).trim() || text(error51.message).trim();
16863
+ category = data.category;
16864
+ } catch {
16865
+ diagnostic = raw;
16866
+ }
16867
+ }
16868
+ return nativeError(new CodeBuddyError(
16869
+ // -32000 is shared by native refusals; the category identifies authentication failures.
16870
+ category === "auth" ? "authenticationRequired" : "nativeFailure",
16871
+ diagnostic ? `${fallback}: ${diagnostic}` : fallback
16872
+ ), profile);
16873
+ }
16813
16874
  async function bounded(operation, milliseconds, label, onTimeout) {
16814
16875
  let timer;
16815
16876
  try {
@@ -16915,6 +16976,11 @@ function commandCatalog(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
16915
16976
  id: `${profile.harnessId}.${name}`,
16916
16977
  invocation: `/${name}`,
16917
16978
  label: name,
16979
+ ...name === "compact" && !skill ? {
16980
+ localizations: {
16981
+ "zh-CN": { label: "压缩上下文", description: "压缩当前对话上下文" }
16982
+ }
16983
+ } : {},
16918
16984
  ...text(entry.description).trim() ? { description: text(entry.description).trim().slice(0, 512) } : {},
16919
16985
  argumentMode: name === "compact" || record2(entry.input).hint || record2(entry._meta).type === "skill" ? "text" : "none",
16920
16986
  ...record2(entry._meta).type === "skill" ? { kind: "skill" } : {}
@@ -16956,6 +17022,20 @@ import path5 from "node:path";
16956
17022
  import { createInterface } from "node:readline";
16957
17023
  var MAX_SESSION_ID_LENGTH = 512;
16958
17024
  var MAX_CWD_LENGTH = 4096;
17025
+ var MAX_SESSION_TITLE_LENGTH = 200;
17026
+ function usageSessionTitle(value) {
17027
+ if (typeof value !== "string")
17028
+ return void 0;
17029
+ const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
17030
+ if (!normalized)
17031
+ return void 0;
17032
+ if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
17033
+ return normalized;
17034
+ const characters = [...normalized];
17035
+ if (characters.length <= MAX_SESSION_TITLE_LENGTH)
17036
+ return normalized;
17037
+ return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
17038
+ }
16959
17039
  function sessionIdOk(value) {
16960
17040
  return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
16961
17041
  }
@@ -16965,12 +17045,14 @@ function cwdOk(value) {
16965
17045
  function withUsageSession(entry, session) {
16966
17046
  const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
16967
17047
  const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
17048
+ const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
16968
17049
  if (sessionId === void 0 && cwd === void 0)
16969
17050
  return entry;
16970
17051
  return {
16971
17052
  ...entry,
16972
17053
  ...sessionId !== void 0 ? { sessionId } : {},
16973
- ...cwd !== void 0 ? { cwd } : {}
17054
+ ...cwd !== void 0 ? { cwd } : {},
17055
+ ...sessionTitle !== void 0 ? { sessionTitle } : {}
16974
17056
  };
16975
17057
  }
16976
17058
  function usageEntryFromRequest(request, occurredAtMs) {
@@ -17048,6 +17130,40 @@ import { homedir as homedir2 } from "node:os";
17048
17130
  import path6 from "node:path";
17049
17131
  import { isDeepStrictEqual } from "node:util";
17050
17132
 
17133
+ // dist/permission-presentation.js
17134
+ var labels = {
17135
+ "Always Ask": "始终询问",
17136
+ "Accept Edits": "接受编辑",
17137
+ Plan: "规划模式",
17138
+ Auto: "自动",
17139
+ "Auto mode": "自动模式",
17140
+ "Don't Ask": "不询问",
17141
+ "Bypass Permissions": "绕过权限",
17142
+ "Full Access": "完全访问",
17143
+ Delegate: "由父会话管理",
17144
+ Default: "默认"
17145
+ };
17146
+ var descriptions = {
17147
+ "Prompts for permission on first use of each tool": "首次使用每种工具时请求权限。",
17148
+ "Automatically accepts file edit permissions for the session": "自动接受本会话中的文件编辑权限。",
17149
+ "Agent can analyze but not modify files or execute commands": "Agent 可以分析,但不能修改文件或执行命令。",
17150
+ "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 分类器评估原本需要询问的操作:安全操作自动批准,风险操作拒绝。分类器不可用时改为询问;无法显示询问时拒绝。",
17151
+ "Does not show permission prompts; pre-approved and safe read-only actions run, everything else that would prompt is denied": "不显示权限询问;已获批准和安全的只读操作可以执行,其余原本需要询问的操作会被拒绝。",
17152
+ "Skips all permission prompts": "跳过常规权限询问。",
17153
+ "Skips ALL permission checks including dangerous commands for all agents": "为所有 Agent 跳过全部权限检查,包括危险命令。",
17154
+ "Permissions managed by parent session": "由父会话管理权限。"
17155
+ };
17156
+ function permissionLocalizations(label, description) {
17157
+ const localizedLabel = Object.hasOwn(labels, label) ? labels[label] : void 0;
17158
+ const localizedDescription = Object.hasOwn(descriptions, description) ? descriptions[description] : void 0;
17159
+ return {
17160
+ "zh-CN": {
17161
+ ...localizedLabel ? { label: localizedLabel } : {},
17162
+ ...localizedDescription ? { description: localizedDescription } : {}
17163
+ }
17164
+ };
17165
+ }
17166
+
17051
17167
  // dist/configuration.js
17052
17168
  var CODEBUDDY_CAPABILITIES = {
17053
17169
  configuration: {
@@ -17105,6 +17221,7 @@ function configuration(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
17105
17221
  modes: rows(mode.options).map((option) => ({
17106
17222
  id: option.value,
17107
17223
  label: option.name,
17224
+ localizations: permissionLocalizations(text(option.name), text(option.description)),
17108
17225
  ...option.description ? { description: option.description } : {},
17109
17226
  ...["bypassPermissions", "fullAccess"].includes(text(option.value)) ? { dangerous: true } : {}
17110
17227
  })),
@@ -18338,11 +18455,30 @@ function historyUsage(contents) {
18338
18455
  function record3(value) {
18339
18456
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
18340
18457
  }
18458
+ function codeBuddyUserText(row) {
18459
+ if (row.type !== "message" || row.role !== "user")
18460
+ return void 0;
18461
+ const { content } = row;
18462
+ if (typeof content === "string")
18463
+ return content;
18464
+ if (!Array.isArray(content))
18465
+ return void 0;
18466
+ return content.map((part) => record3(part)).filter((part) => typeof part.text === "string").map((part) => String(part.text)).join(" ");
18467
+ }
18341
18468
  async function readCodeBuddyUsage(file2, signal) {
18342
18469
  const messages = /* @__PURE__ */ new Map();
18343
18470
  let sessionId;
18344
18471
  let cwd;
18345
- for await (const row of jsonlRecords(file2, '"rawUsage"', signal)) {
18472
+ let customTitle;
18473
+ let generatedTitle;
18474
+ let firstPrompt;
18475
+ for await (const row of jsonlRecords(file2, '"type"', signal)) {
18476
+ if (row.type === "custom-title")
18477
+ customTitle = usageSessionTitle(row.customTitle);
18478
+ else if (row.type === "ai-title")
18479
+ generatedTitle = usageSessionTitle(row.aiTitle);
18480
+ else if (!firstPrompt)
18481
+ firstPrompt = usageSessionTitle(codeBuddyUserText(row));
18346
18482
  if (typeof row.type !== "string" || !NATIVE_MESSAGE_TYPES.has(row.type))
18347
18483
  continue;
18348
18484
  sessionId ??= row.sessionId;
@@ -18364,7 +18500,8 @@ async function readCodeBuddyUsage(file2, signal) {
18364
18500
  }
18365
18501
  entries.push(withUsageSession(entry, {
18366
18502
  sessionId: typeof sessionId === "string" ? sessionId : void 0,
18367
- cwd: typeof cwd === "string" ? cwd : void 0
18503
+ cwd: typeof cwd === "string" ? cwd : void 0,
18504
+ title: customTitle ?? generatedTitle ?? firstPrompt
18368
18505
  }));
18369
18506
  }
18370
18507
  }
@@ -24766,7 +24903,7 @@ var CodeBuddySession = class {
24766
24903
  // Those remain visible on individual Items; they do not fail the completed Turn.
24767
24904
  (!meta3["codebuddy.ai/outcome"] || meta3["codebuddy.ai/outcome"] === "SUCCESS" || meta3["codebuddy.ai/outcome"] === "PARTIAL_SUCCESS") ? { status: "succeeded" } : {
24768
24905
  status: "failed",
24769
- error: nativeError(new CodeBuddyError("nativeFailure", `Native Turn stopped: ${text(stop) || "unknown"} (${text(meta3["codebuddy.ai/outcome"]) || "no native outcome"})`), this.profile)
24906
+ error: nativeTurnError(stop, meta3, this.profile)
24770
24907
  };
24771
24908
  const snapshot = await this.#snapshot();
24772
24909
  const added = snapshot.turns.filter((turn) => !active.before.has(turn.nativeTurnRef.nativeTurnKey));
@@ -25074,6 +25211,10 @@ function createCodeBuddyInstallation(environment) {
25074
25211
  canUpdate,
25075
25212
  ...!canUpdate ? {
25076
25213
  messageCode: "codebuddy-npm-required",
25214
+ notice: {
25215
+ en: "Use CodeBuddy's native updater or original package manager. Latest-version checks here require an identified npm installation.",
25216
+ "zh-CN": "请使用 CodeBuddy 原生更新器或原包管理器更新。此处仅能查询已识别的 npm 安装的最新版本。"
25217
+ },
25077
25218
  message: "Use CodeBuddy's native updater or original package manager for this installation. Latest-version checks here require an identified npm installation."
25078
25219
  } : {}
25079
25220
  };
@@ -25996,6 +26137,8 @@ var BrokeredHarnessAdapter = class {
25996
26137
  commandCatalog;
25997
26138
  liveCommandCatalog;
25998
26139
  harnessId;
26140
+ credits;
26141
+ refreshCredits;
25999
26142
  #descriptorPath;
26000
26143
  #forwardEnvironment;
26001
26144
  #isInstalled;
@@ -26095,6 +26238,10 @@ var BrokeredHarnessAdapter = class {
26095
26238
  }
26096
26239
  constructor(input = {}) {
26097
26240
  this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
26241
+ if (input.accountCredits !== false) {
26242
+ this.credits = () => this.#credits;
26243
+ this.refreshCredits = () => this.#refreshAccountCredits();
26244
+ }
26098
26245
  this.#forwardEnvironment = input.forwardDelegationEnvironment === true;
26099
26246
  if (input.commandCatalog)
26100
26247
  this.commandCatalog = input.commandCatalog;
@@ -26106,10 +26253,7 @@ var BrokeredHarnessAdapter = class {
26106
26253
  this.#startBroker = input.startBroker === false ? void 0 : input.startBroker ?? (process.platform === "darwin" && !input.descriptorPath ? () => startBrokerLaunchAgent(this.harnessId, environment) : void 0);
26107
26254
  this.#startTimeoutMs = input.startTimeoutMs ?? BROKER_START_TIMEOUT_MS;
26108
26255
  }
26109
- credits() {
26110
- return this.#credits;
26111
- }
26112
- refreshCredits() {
26256
+ #refreshAccountCredits() {
26113
26257
  if (this.#closed)
26114
26258
  return Promise.resolve(null);
26115
26259
  if (this.#creditsRefresh)
@@ -26281,6 +26425,7 @@ function createHarnessAdapter(context) {
26281
26425
  if (context.platform === "darwin" && context.managedRemoteHost) {
26282
26426
  const environment2 = { ...context.environment };
26283
26427
  return new BrokeredHarnessAdapter({
26428
+ accountCredits: false,
26284
26429
  harnessId: "codebuddy",
26285
26430
  forwardDelegationEnvironment: true,
26286
26431
  commandCatalog: CODEBUDDY_COMMAND_CATALOG,