@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.
@@ -13,6 +13,20 @@ import { lstat } from "node:fs/promises";
13
13
  // ../../harness-adapter/dist/usage-statistics.js
14
14
  var MAX_SESSION_ID_LENGTH = 512;
15
15
  var MAX_CWD_LENGTH = 4096;
16
+ var MAX_SESSION_TITLE_LENGTH = 200;
17
+ function usageSessionTitle(value) {
18
+ if (typeof value !== "string")
19
+ return void 0;
20
+ const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
21
+ if (!normalized)
22
+ return void 0;
23
+ if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
24
+ return normalized;
25
+ const characters = [...normalized];
26
+ if (characters.length <= MAX_SESSION_TITLE_LENGTH)
27
+ return normalized;
28
+ return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
29
+ }
16
30
  function sessionIdOk(value) {
17
31
  return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
18
32
  }
@@ -22,12 +36,14 @@ function cwdOk(value) {
22
36
  function withUsageSession(entry, session) {
23
37
  const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
24
38
  const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
39
+ const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
25
40
  if (sessionId === void 0 && cwd === void 0)
26
41
  return entry;
27
42
  return {
28
43
  ...entry,
29
44
  ...sessionId !== void 0 ? { sessionId } : {},
30
- ...cwd !== void 0 ? { cwd } : {}
45
+ ...cwd !== void 0 ? { cwd } : {},
46
+ ...sessionTitle !== void 0 ? { sessionTitle } : {}
31
47
  };
32
48
  }
33
49
  function usageEntryFromRequest(request, occurredAtMs) {
@@ -14771,6 +14787,15 @@ var harnessDisplaySetSchema = external_exports.strictObject({
14771
14787
  initializeOnly: external_exports.boolean().optional()
14772
14788
  });
14773
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
+
14774
14799
  // ../../shared-contracts/dist/model-price-overrides.js
14775
14800
  var usdPerMillionTokens = external_exports.number().finite().nonnegative();
14776
14801
  var modelPriceOverrideSchema = external_exports.strictObject({
@@ -14849,6 +14874,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
14849
14874
  harness,
14850
14875
  sessionId: external_exports.string().min(1).max(512),
14851
14876
  project: project.nullable(),
14877
+ /** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
14878
+ title: external_exports.string().min(1).max(200).optional(),
14852
14879
  /** Models the session used, most requests first. */
14853
14880
  models: external_exports.array(model).max(16),
14854
14881
  firstAtMs: count,
@@ -14915,7 +14942,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
14915
14942
  * The sessions that spent the most, by cost and by tokens without cache, all filters applied;
14916
14943
  * requests without a native session are not listed here but count everywhere else.
14917
14944
  */
14918
- sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
14945
+ sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
14946
+ /**
14947
+ * The sessions last active in the range, newest first, all filters applied. Optional for older
14948
+ * Hosts; missing is treated as no list rather than no sessions.
14949
+ */
14950
+ recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
14919
14951
  });
14920
14952
 
14921
14953
  // ../../shared-contracts/dist/ids.js
@@ -15184,8 +15216,24 @@ var threadUsageSnapshotSchema = external_exports.object({
15184
15216
  }
15185
15217
  });
15186
15218
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
15219
+ var accountCreditsPeriodSchema = external_exports.enum([
15220
+ "weekly",
15221
+ "monthly",
15222
+ "five_hour",
15223
+ "seven_day",
15224
+ "unknown"
15225
+ ]);
15226
+ var accountCreditsScopeSchema = external_exports.object({
15227
+ id: external_exports.string().min(1).max(256),
15228
+ label: external_exports.string().min(1).max(256),
15229
+ localizations: harnessLocalizationsSchema.optional()
15230
+ }).strict();
15187
15231
  var accountCreditsProductUsageSchema = external_exports.object({
15188
15232
  product: external_exports.string().min(1),
15233
+ /** Native period and scope, never inferred from the display name. */
15234
+ periodType: accountCreditsPeriodSchema.optional(),
15235
+ scope: accountCreditsScopeSchema.optional(),
15236
+ localizations: harnessLocalizationsSchema.optional(),
15189
15237
  used: external_exports.number().finite().nonnegative().optional(),
15190
15238
  // Zero is a real empty cap, not an absent field.
15191
15239
  limit: external_exports.number().finite().nonnegative().optional(),
@@ -15207,8 +15255,10 @@ var accountCreditsSnapshotSchema = external_exports.object({
15207
15255
  label: external_exports.string().min(1).optional(),
15208
15256
  usedPercent: usagePercentSchema.optional(),
15209
15257
  remaining: external_exports.number().finite().optional(),
15258
+ scope: accountCreditsScopeSchema.optional(),
15259
+ localizations: harnessLocalizationsSchema.optional(),
15210
15260
  resetsAt: external_exports.string().min(1).optional(),
15211
- periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
15261
+ periodType: accountCreditsPeriodSchema,
15212
15262
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
15213
15263
  resetCredits: accountResetCreditsSchema.optional()
15214
15264
  }).strict().superRefine((credits, context) => {
@@ -15233,7 +15283,9 @@ var threadUsageInspectionParamsSchema = external_exports.object({
15233
15283
  var threadUsageInspectionSchema = external_exports.object({
15234
15284
  threadId: hostThreadIdSchema,
15235
15285
  usage: threadUsageSnapshotSchema.nullable(),
15236
- accountCredits: accountCreditsSnapshotSchema.optional()
15286
+ accountCredits: accountCreditsSnapshotSchema.optional(),
15287
+ /** Whether this source can provide cached account quota independently of usage. */
15288
+ accountCreditsSupported: external_exports.boolean().optional()
15237
15289
  }).strict();
15238
15290
 
15239
15291
  // ../../shared-contracts/dist/harness-accounts.js
@@ -15360,7 +15412,8 @@ var harnessPermissionModeSchema = external_exports.object({
15360
15412
  id: harnessPermissionModeIdSchema,
15361
15413
  label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
15362
15414
  description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
15363
- dangerous: external_exports.boolean().optional()
15415
+ dangerous: external_exports.boolean().optional(),
15416
+ localizations: harnessLocalizationsSchema.optional()
15364
15417
  }).strict();
15365
15418
  var harnessPermissionModeCatalogSchema = external_exports.object({
15366
15419
  modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
@@ -15683,6 +15736,8 @@ var harnessInstallationStateSchema = external_exports.object({
15683
15736
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
15684
15737
  message: external_exports.string().max(2048).optional(),
15685
15738
  messageCode: external_exports.string().min(1).max(128).optional(),
15739
+ /** Safe plugin-owned explanation, distinct from raw diagnostic message. */
15740
+ notice: harnessLocalizedTextSchema.optional(),
15686
15741
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
15687
15742
  }).strict();
15688
15743
 
@@ -15821,6 +15876,7 @@ var harnessCommandDescriptorSchema = external_exports.object({
15821
15876
  invocation: commandInvocationSchema,
15822
15877
  label: commandLabelSchema,
15823
15878
  description: commandDescriptionSchema.optional(),
15879
+ localizations: harnessLocalizationsSchema.optional(),
15824
15880
  argumentMode: external_exports.enum(["none", "text"]),
15825
15881
  /**
15826
15882
  * Native distinction reported by the Harness. Omitted when the Harness does
@@ -16539,11 +16595,17 @@ async function readZcodeUsage(file2) {
16539
16595
  try {
16540
16596
  const entries = [];
16541
16597
  const directories = /* @__PURE__ */ new Map();
16598
+ const titles = /* @__PURE__ */ new Map();
16542
16599
  const hasSessions = database.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'session'").get();
16543
16600
  if (hasSessions) {
16544
- for (const row of database.prepare("SELECT id, directory FROM session").iterate()) {
16601
+ const columns = new Set(database.prepare("PRAGMA table_info(session)").all().map((row) => String(row.name)));
16602
+ const titleColumn = columns.has("title") ? ", title" : "";
16603
+ for (const row of database.prepare(`SELECT id, directory${titleColumn} FROM session`).iterate()) {
16545
16604
  if (typeof row.directory === "string")
16546
16605
  directories.set(String(row.id), row.directory);
16606
+ const title = usageSessionTitle(row.title);
16607
+ if (title)
16608
+ titles.set(String(row.id), title);
16547
16609
  }
16548
16610
  }
16549
16611
  for (const row of database.prepare("SELECT id, session_id, data FROM message").iterate()) {
@@ -16573,7 +16635,11 @@ async function readZcodeUsage(file2) {
16573
16635
  const entry = usage.kind === "request" && at !== null && usageEntryFromRequest(usage.request, at);
16574
16636
  if (entry) {
16575
16637
  const sessionId = String(row.session_id);
16576
- entries.push(withUsageSession(entry, { sessionId, cwd: directories.get(sessionId) }));
16638
+ entries.push(withUsageSession(entry, {
16639
+ sessionId,
16640
+ cwd: directories.get(sessionId),
16641
+ title: titles.get(sessionId)
16642
+ }));
16577
16643
  }
16578
16644
  }
16579
16645
  return entries;
@@ -16736,6 +16802,10 @@ function createZcodeInstallation(environment, app) {
16736
16802
  updateAvailable: false,
16737
16803
  canUpdate: false,
16738
16804
  messageCode: "zcode-desktop-updater",
16805
+ notice: {
16806
+ en: "The CLI ships inside ZCode Desktop. Update ZCode Desktop itself to update it.",
16807
+ "zh-CN": "CLI 随 ZCode Desktop 一起发布,请直接更新 ZCode Desktop。"
16808
+ },
16739
16809
  message: "The CLI ships inside ZCode Desktop. Update ZCode Desktop itself to update it."
16740
16810
  };
16741
16811
  };
@@ -18200,11 +18270,19 @@ var modeLabels = {
18200
18270
  yolo: "Full access",
18201
18271
  auto: "Auto"
18202
18272
  };
18273
+ var chineseModeLabels = {
18274
+ build: "确认变更",
18275
+ edit: "自动编辑",
18276
+ plan: "规划模式",
18277
+ yolo: "完全访问",
18278
+ auto: "自动"
18279
+ };
18203
18280
  function permissionModes(current = "build") {
18204
18281
  return harnessPermissionModeCatalogSchema.parse({
18205
18282
  modes: Object.entries(modeLabels).map(([id, label]) => ({
18206
18283
  id,
18207
18284
  label,
18285
+ localizations: { "zh-CN": { label: chineseModeLabels[id] } },
18208
18286
  ...id === "yolo" ? { dangerous: true } : {}
18209
18287
  })),
18210
18288
  defaultModeId: current
@@ -19244,6 +19322,7 @@ var COMMAND_CATALOG = harnessCommandCatalogSchema.parse({
19244
19322
  {
19245
19323
  id: "compact",
19246
19324
  invocation: "/compact",
19325
+ localizations: { "zh-CN": { label: "压缩上下文", description: "压缩当前对话上下文" } },
19247
19326
  label: "Compact",
19248
19327
  description: "Compact the native ZCode conversation.",
19249
19328
  argumentMode: "text"