@codexhost/cli-darwin-x64 0.13.0 → 0.13.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
@@ -16903,6 +16910,20 @@ import path5 from "node:path";
16903
16910
  import { createInterface } from "node:readline";
16904
16911
  var MAX_SESSION_ID_LENGTH = 512;
16905
16912
  var MAX_CWD_LENGTH = 4096;
16913
+ var MAX_SESSION_TITLE_LENGTH = 200;
16914
+ function usageSessionTitle(value) {
16915
+ if (typeof value !== "string")
16916
+ return void 0;
16917
+ const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
16918
+ if (!normalized)
16919
+ return void 0;
16920
+ if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
16921
+ return normalized;
16922
+ const characters = [...normalized];
16923
+ if (characters.length <= MAX_SESSION_TITLE_LENGTH)
16924
+ return normalized;
16925
+ return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
16926
+ }
16906
16927
  function sessionIdOk(value) {
16907
16928
  return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
16908
16929
  }
@@ -16912,12 +16933,14 @@ function cwdOk(value) {
16912
16933
  function withUsageSession(entry, session) {
16913
16934
  const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
16914
16935
  const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
16936
+ const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
16915
16937
  if (sessionId === void 0 && cwd === void 0)
16916
16938
  return entry;
16917
16939
  return {
16918
16940
  ...entry,
16919
16941
  ...sessionId !== void 0 ? { sessionId } : {},
16920
- ...cwd !== void 0 ? { cwd } : {}
16942
+ ...cwd !== void 0 ? { cwd } : {},
16943
+ ...sessionTitle !== void 0 ? { sessionTitle } : {}
16921
16944
  };
16922
16945
  }
16923
16946
  function usageEntryFromRequest(request, occurredAtMs) {
@@ -18285,11 +18308,30 @@ function historyUsage(contents) {
18285
18308
  function record3(value) {
18286
18309
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
18287
18310
  }
18311
+ function codeBuddyUserText(row) {
18312
+ if (row.type !== "message" || row.role !== "user")
18313
+ return void 0;
18314
+ const { content } = row;
18315
+ if (typeof content === "string")
18316
+ return content;
18317
+ if (!Array.isArray(content))
18318
+ return void 0;
18319
+ return content.map((part) => record3(part)).filter((part) => typeof part.text === "string").map((part) => String(part.text)).join(" ");
18320
+ }
18288
18321
  async function readCodeBuddyUsage(file2, signal) {
18289
18322
  const messages = /* @__PURE__ */ new Map();
18290
18323
  let sessionId;
18291
18324
  let cwd;
18292
- for await (const row of jsonlRecords(file2, '"rawUsage"', signal)) {
18325
+ let customTitle;
18326
+ let generatedTitle;
18327
+ let firstPrompt;
18328
+ for await (const row of jsonlRecords(file2, '"type"', signal)) {
18329
+ if (row.type === "custom-title")
18330
+ customTitle = usageSessionTitle(row.customTitle);
18331
+ else if (row.type === "ai-title")
18332
+ generatedTitle = usageSessionTitle(row.aiTitle);
18333
+ else if (!firstPrompt)
18334
+ firstPrompt = usageSessionTitle(codeBuddyUserText(row));
18293
18335
  if (typeof row.type !== "string" || !NATIVE_MESSAGE_TYPES.has(row.type))
18294
18336
  continue;
18295
18337
  sessionId ??= row.sessionId;
@@ -18311,7 +18353,8 @@ async function readCodeBuddyUsage(file2, signal) {
18311
18353
  }
18312
18354
  entries.push(withUsageSession(entry, {
18313
18355
  sessionId: typeof sessionId === "string" ? sessionId : void 0,
18314
- cwd: typeof cwd === "string" ? cwd : void 0
18356
+ cwd: typeof cwd === "string" ? cwd : void 0,
18357
+ title: customTitle ?? generatedTitle ?? firstPrompt
18315
18358
  }));
18316
18359
  }
18317
18360
  }