@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.
@@ -495,6 +495,20 @@ import { lstat } from "node:fs/promises";
495
495
  // ../../harness-adapter/dist/usage-statistics.js
496
496
  var MAX_SESSION_ID_LENGTH = 512;
497
497
  var MAX_CWD_LENGTH = 4096;
498
+ var MAX_SESSION_TITLE_LENGTH = 200;
499
+ function usageSessionTitle(value) {
500
+ if (typeof value !== "string")
501
+ return void 0;
502
+ const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
503
+ if (!normalized)
504
+ return void 0;
505
+ if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
506
+ return normalized;
507
+ const characters = [...normalized];
508
+ if (characters.length <= MAX_SESSION_TITLE_LENGTH)
509
+ return normalized;
510
+ return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
511
+ }
498
512
  function sessionIdOk(value) {
499
513
  return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
500
514
  }
@@ -504,12 +518,14 @@ function cwdOk(value) {
504
518
  function withUsageSession(entry, session) {
505
519
  const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
506
520
  const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
521
+ const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
507
522
  if (sessionId === void 0 && cwd === void 0)
508
523
  return entry;
509
524
  return {
510
525
  ...entry,
511
526
  ...sessionId !== void 0 ? { sessionId } : {},
512
- ...cwd !== void 0 ? { cwd } : {}
527
+ ...cwd !== void 0 ? { cwd } : {},
528
+ ...sessionTitle !== void 0 ? { sessionTitle } : {}
513
529
  };
514
530
  }
515
531
  function usageEntryFromRequest(request, occurredAtMs) {
@@ -15125,6 +15141,15 @@ var harnessDisplaySetSchema = external_exports.strictObject({
15125
15141
  initializeOnly: external_exports.boolean().optional()
15126
15142
  });
15127
15143
 
15144
+ // ../../shared-contracts/dist/harness-presentation.js
15145
+ var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
15146
+ var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text) => text.trim().length > 0);
15147
+ var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
15148
+ label: displayText(256).optional(),
15149
+ description: displayText(1024).optional()
15150
+ }).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
15151
+ 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");
15152
+
15128
15153
  // ../../shared-contracts/dist/model-price-overrides.js
15129
15154
  var usdPerMillionTokens = external_exports.number().finite().nonnegative();
15130
15155
  var modelPriceOverrideSchema = external_exports.strictObject({
@@ -15203,6 +15228,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
15203
15228
  harness,
15204
15229
  sessionId: external_exports.string().min(1).max(512),
15205
15230
  project: project.nullable(),
15231
+ /** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
15232
+ title: external_exports.string().min(1).max(200).optional(),
15206
15233
  /** Models the session used, most requests first. */
15207
15234
  models: external_exports.array(model).max(16),
15208
15235
  firstAtMs: count,
@@ -15269,7 +15296,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
15269
15296
  * The sessions that spent the most, by cost and by tokens without cache, all filters applied;
15270
15297
  * requests without a native session are not listed here but count everywhere else.
15271
15298
  */
15272
- sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
15299
+ sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
15300
+ /**
15301
+ * The sessions last active in the range, newest first, all filters applied. Optional for older
15302
+ * Hosts; missing is treated as no list rather than no sessions.
15303
+ */
15304
+ recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
15273
15305
  });
15274
15306
 
15275
15307
  // ../../shared-contracts/dist/ids.js
@@ -15538,8 +15570,24 @@ var threadUsageSnapshotSchema = external_exports.object({
15538
15570
  }
15539
15571
  });
15540
15572
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
15573
+ var accountCreditsPeriodSchema = external_exports.enum([
15574
+ "weekly",
15575
+ "monthly",
15576
+ "five_hour",
15577
+ "seven_day",
15578
+ "unknown"
15579
+ ]);
15580
+ var accountCreditsScopeSchema = external_exports.object({
15581
+ id: external_exports.string().min(1).max(256),
15582
+ label: external_exports.string().min(1).max(256),
15583
+ localizations: harnessLocalizationsSchema.optional()
15584
+ }).strict();
15541
15585
  var accountCreditsProductUsageSchema = external_exports.object({
15542
15586
  product: external_exports.string().min(1),
15587
+ /** Native period and scope, never inferred from the display name. */
15588
+ periodType: accountCreditsPeriodSchema.optional(),
15589
+ scope: accountCreditsScopeSchema.optional(),
15590
+ localizations: harnessLocalizationsSchema.optional(),
15543
15591
  used: external_exports.number().finite().nonnegative().optional(),
15544
15592
  // Zero is a real empty cap, not an absent field.
15545
15593
  limit: external_exports.number().finite().nonnegative().optional(),
@@ -15561,8 +15609,10 @@ var accountCreditsSnapshotSchema = external_exports.object({
15561
15609
  label: external_exports.string().min(1).optional(),
15562
15610
  usedPercent: usagePercentSchema.optional(),
15563
15611
  remaining: external_exports.number().finite().optional(),
15612
+ scope: accountCreditsScopeSchema.optional(),
15613
+ localizations: harnessLocalizationsSchema.optional(),
15564
15614
  resetsAt: external_exports.string().min(1).optional(),
15565
- periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
15615
+ periodType: accountCreditsPeriodSchema,
15566
15616
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
15567
15617
  resetCredits: accountResetCreditsSchema.optional()
15568
15618
  }).strict().superRefine((credits, context) => {
@@ -15587,7 +15637,9 @@ var threadUsageInspectionParamsSchema = external_exports.object({
15587
15637
  var threadUsageInspectionSchema = external_exports.object({
15588
15638
  threadId: hostThreadIdSchema,
15589
15639
  usage: threadUsageSnapshotSchema.nullable(),
15590
- accountCredits: accountCreditsSnapshotSchema.optional()
15640
+ accountCredits: accountCreditsSnapshotSchema.optional(),
15641
+ /** Whether this source can provide cached account quota independently of usage. */
15642
+ accountCreditsSupported: external_exports.boolean().optional()
15591
15643
  }).strict();
15592
15644
 
15593
15645
  // ../../shared-contracts/dist/harness-accounts.js
@@ -15714,7 +15766,8 @@ var harnessPermissionModeSchema = external_exports.object({
15714
15766
  id: harnessPermissionModeIdSchema,
15715
15767
  label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
15716
15768
  description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
15717
- dangerous: external_exports.boolean().optional()
15769
+ dangerous: external_exports.boolean().optional(),
15770
+ localizations: harnessLocalizationsSchema.optional()
15718
15771
  }).strict();
15719
15772
  var harnessPermissionModeCatalogSchema = external_exports.object({
15720
15773
  modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
@@ -16037,6 +16090,8 @@ var harnessInstallationStateSchema = external_exports.object({
16037
16090
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
16038
16091
  message: external_exports.string().max(2048).optional(),
16039
16092
  messageCode: external_exports.string().min(1).max(128).optional(),
16093
+ /** Safe plugin-owned explanation, distinct from raw diagnostic message. */
16094
+ notice: harnessLocalizedTextSchema.optional(),
16040
16095
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
16041
16096
  }).strict();
16042
16097
 
@@ -16175,6 +16230,7 @@ var harnessCommandDescriptorSchema = external_exports.object({
16175
16230
  invocation: commandInvocationSchema,
16176
16231
  label: commandLabelSchema,
16177
16232
  description: commandDescriptionSchema.optional(),
16233
+ localizations: harnessLocalizationsSchema.optional(),
16178
16234
  argumentMode: external_exports.enum(["none", "text"]),
16179
16235
  /**
16180
16236
  * Native distinction reported by the Harness. Omitted when the Harness does
@@ -16785,12 +16841,18 @@ async function readOpenCodeUsage(file2) {
16785
16841
  try {
16786
16842
  const tables = new Set(database.prepare("SELECT name FROM sqlite_master WHERE type = 'table'").all().map((row) => String(row.name)));
16787
16843
  const directories = /* @__PURE__ */ new Map();
16844
+ const titles = /* @__PURE__ */ new Map();
16788
16845
  for (const table of ["session", "session_v2"]) {
16789
16846
  if (!tables.has(table))
16790
16847
  continue;
16791
- for (const row of database.prepare(`SELECT id, directory FROM ${table}`).iterate()) {
16848
+ const columns = new Set(database.prepare(`PRAGMA table_info(${table})`).all().map((row) => String(row.name)));
16849
+ const titleColumn = columns.has("title") ? ", title" : "";
16850
+ for (const row of database.prepare(`SELECT id, directory${titleColumn} FROM ${table}`).iterate()) {
16792
16851
  if (typeof row.directory === "string")
16793
16852
  directories.set(String(row.id), row.directory);
16853
+ const title = usageSessionTitle(row.title);
16854
+ if (title)
16855
+ titles.set(String(row.id), title);
16794
16856
  }
16795
16857
  }
16796
16858
  const entries = /* @__PURE__ */ new Map();
@@ -16807,7 +16869,8 @@ async function readOpenCodeUsage(file2) {
16807
16869
  const sessionId = typeof session === "string" ? session : void 0;
16808
16870
  entries.set(entry.id, withUsageSession(entry, {
16809
16871
  sessionId,
16810
- cwd: sessionId === void 0 ? void 0 : directories.get(sessionId)
16872
+ cwd: sessionId === void 0 ? void 0 : directories.get(sessionId),
16873
+ title: sessionId === void 0 ? void 0 : titles.get(sessionId)
16811
16874
  }));
16812
16875
  }
16813
16876
  };
@@ -17220,16 +17283,25 @@ var OPENCODE_PERMISSION_MODE_CATALOG = harnessPermissionModeCatalogSchema.parse(
17220
17283
  {
17221
17284
  id: "default",
17222
17285
  label: "Default",
17286
+ localizations: {
17287
+ "zh-CN": { label: "默认", description: "使用 OpenCode 已配置的权限规则。" }
17288
+ },
17223
17289
  description: "Use OpenCode's configured permission rules."
17224
17290
  },
17225
17291
  {
17226
17292
  id: "ask",
17227
17293
  label: "Ask",
17294
+ localizations: {
17295
+ "zh-CN": { label: "询问", description: "执行受保护的 OpenCode 操作前询问。" }
17296
+ },
17228
17297
  description: "Ask before protected OpenCode actions."
17229
17298
  },
17230
17299
  {
17231
17300
  id: "allow",
17232
17301
  label: "Allow all",
17302
+ localizations: {
17303
+ "zh-CN": { label: "全部允许", description: "允许 OpenCode 操作,无需批准提示。" }
17304
+ },
17233
17305
  description: "Allow OpenCode actions without approval prompts.",
17234
17306
  dangerous: true
17235
17307
  }
@@ -23635,6 +23707,7 @@ var openCodeCommandCatalog = harnessCommandCatalogSchema.parse({
23635
23707
  {
23636
23708
  id: COMPACT_COMMAND_ID,
23637
23709
  invocation: "/compact",
23710
+ localizations: { "zh-CN": { label: "压缩上下文", description: "压缩当前对话上下文" } },
23638
23711
  label: "Compact context",
23639
23712
  description: "Compact the current OpenCode Session context",
23640
23713
  argumentMode: "none"
@@ -24202,7 +24275,7 @@ var OpenCodeHarnessSession = class {
24202
24275
  }
24203
24276
  #projectPart(active, part) {
24204
24277
  if (part.type === "text" || part.type === "reasoning") {
24205
- if (part.type === "text" && part.ignored || !part.text)
24278
+ if (part.type === "text" && part.ignored)
24206
24279
  return;
24207
24280
  const existing = active.items.get(part.id);
24208
24281
  if (!existing) {
@@ -25076,11 +25149,15 @@ function v2State(session, catalog, policy) {
25076
25149
  ...entry ? {
25077
25150
  resolvedModelLabel: entry.resolvedModelLabel ?? entry.label,
25078
25151
  availableThinkingOptions: catalog.thinkingOptions.filter((v) => entry.supportedThinkingOptionIds?.includes(v.id)),
25079
- effectiveThinkingOptionId: encodeOpenCodeVariant(session.model?.variant)
25152
+ effectiveThinkingOptionId: effectiveVariant(session.model?.variant, entry)
25080
25153
  } : {},
25081
25154
  effectivePermissionModeId: decodeMode(mode?.effect)
25082
25155
  };
25083
25156
  }
25157
+ function effectiveVariant(variant, entry) {
25158
+ const id = encodeOpenCodeVariant(variant);
25159
+ return variant === "default" && !entry.supportedThinkingOptionIds?.includes(id) ? encodeOpenCodeVariant(void 0) : id;
25160
+ }
25084
25161
  function decodeMode(effect) {
25085
25162
  return effect === "allow" || effect === "ask" ? harnessPermissionModeIdSchema.parse(effect) : harnessPermissionModeIdSchema.parse("default");
25086
25163
  }