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

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.
@@ -15158,6 +15158,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
15158
15158
  harness,
15159
15159
  sessionId: external_exports.string().min(1).max(512),
15160
15160
  project: project.nullable(),
15161
+ /** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
15162
+ title: external_exports.string().min(1).max(200).optional(),
15161
15163
  /** Models the session used, most requests first. */
15162
15164
  models: external_exports.array(model).max(16),
15163
15165
  firstAtMs: count,
@@ -15224,7 +15226,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
15224
15226
  * The sessions that spent the most, by cost and by tokens without cache, all filters applied;
15225
15227
  * requests without a native session are not listed here but count everywhere else.
15226
15228
  */
15227
- sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
15229
+ sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
15230
+ /**
15231
+ * The sessions last active in the range, newest first, all filters applied. Optional for older
15232
+ * Hosts; missing is treated as no list rather than no sessions.
15233
+ */
15234
+ recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
15228
15235
  });
15229
15236
 
15230
15237
  // ../../shared-contracts/dist/ids.js
@@ -16956,6 +16963,20 @@ import path5 from "node:path";
16956
16963
  import { createInterface } from "node:readline";
16957
16964
  var MAX_SESSION_ID_LENGTH = 512;
16958
16965
  var MAX_CWD_LENGTH = 4096;
16966
+ var MAX_SESSION_TITLE_LENGTH = 200;
16967
+ function usageSessionTitle(value) {
16968
+ if (typeof value !== "string")
16969
+ return void 0;
16970
+ const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
16971
+ if (!normalized)
16972
+ return void 0;
16973
+ if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
16974
+ return normalized;
16975
+ const characters = [...normalized];
16976
+ if (characters.length <= MAX_SESSION_TITLE_LENGTH)
16977
+ return normalized;
16978
+ return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
16979
+ }
16959
16980
  function sessionIdOk(value) {
16960
16981
  return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
16961
16982
  }
@@ -16965,12 +16986,14 @@ function cwdOk(value) {
16965
16986
  function withUsageSession(entry, session) {
16966
16987
  const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
16967
16988
  const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
16989
+ const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
16968
16990
  if (sessionId === void 0 && cwd === void 0)
16969
16991
  return entry;
16970
16992
  return {
16971
16993
  ...entry,
16972
16994
  ...sessionId !== void 0 ? { sessionId } : {},
16973
- ...cwd !== void 0 ? { cwd } : {}
16995
+ ...cwd !== void 0 ? { cwd } : {},
16996
+ ...sessionTitle !== void 0 ? { sessionTitle } : {}
16974
16997
  };
16975
16998
  }
16976
16999
  function usageEntryFromRequest(request, occurredAtMs) {
@@ -18338,11 +18361,30 @@ function historyUsage(contents) {
18338
18361
  function record3(value) {
18339
18362
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
18340
18363
  }
18364
+ function codeBuddyUserText(row) {
18365
+ if (row.type !== "message" || row.role !== "user")
18366
+ return void 0;
18367
+ const { content } = row;
18368
+ if (typeof content === "string")
18369
+ return content;
18370
+ if (!Array.isArray(content))
18371
+ return void 0;
18372
+ return content.map((part) => record3(part)).filter((part) => typeof part.text === "string").map((part) => String(part.text)).join(" ");
18373
+ }
18341
18374
  async function readCodeBuddyUsage(file2, signal) {
18342
18375
  const messages = /* @__PURE__ */ new Map();
18343
18376
  let sessionId;
18344
18377
  let cwd;
18345
- for await (const row of jsonlRecords(file2, '"rawUsage"', signal)) {
18378
+ let customTitle;
18379
+ let generatedTitle;
18380
+ let firstPrompt;
18381
+ for await (const row of jsonlRecords(file2, '"type"', signal)) {
18382
+ if (row.type === "custom-title")
18383
+ customTitle = usageSessionTitle(row.customTitle);
18384
+ else if (row.type === "ai-title")
18385
+ generatedTitle = usageSessionTitle(row.aiTitle);
18386
+ else if (!firstPrompt)
18387
+ firstPrompt = usageSessionTitle(codeBuddyUserText(row));
18346
18388
  if (typeof row.type !== "string" || !NATIVE_MESSAGE_TYPES.has(row.type))
18347
18389
  continue;
18348
18390
  sessionId ??= row.sessionId;
@@ -18364,7 +18406,8 @@ async function readCodeBuddyUsage(file2, signal) {
18364
18406
  }
18365
18407
  entries.push(withUsageSession(entry, {
18366
18408
  sessionId: typeof sessionId === "string" ? sessionId : void 0,
18367
- cwd: typeof cwd === "string" ? cwd : void 0
18409
+ cwd: typeof cwd === "string" ? cwd : void 0,
18410
+ title: customTitle ?? generatedTitle ?? firstPrompt
18368
18411
  }));
18369
18412
  }
18370
18413
  }