dsh-claude-style 0.21.0-dev.61 → 0.21.1-dev.62

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.
package/lib/host/usage.js CHANGED
@@ -4,6 +4,12 @@ var PACKAGE_NAME = "dsh-claude-style";
4
4
  // packages/contracts/src/services.ts
5
5
  var OFFICIAL_MODEL_GROUP = "deepseek-official";
6
6
 
7
+ // packages/contracts/src/palette-schemes.ts
8
+ var PALETTE_SCHEME_LIMIT = 16;
9
+ var PALETTE_SCHEME_ENTRY_MAX = 400;
10
+ var PALETTE_SCHEME_ID_MAX = 24;
11
+ var PALETTE_SCHEME_FOLLOW = "brand";
12
+
7
13
  // packages/contracts/src/prices.ts
8
14
  var CURRENCY_CNY = "CNY";
9
15
  var CURRENCY_USD = "USD";
@@ -31,9 +37,8 @@ var BRAND_CLAUDE = "claude";
31
37
  var BRAND_DEEPSEEK = "deepseek";
32
38
  var BRAND_DEEPSEEK_LEGACY = "off";
33
39
  var BRANDS = [BRAND_CLAUDE, BRAND_DEEPSEEK];
34
- var PALETTE_COLORING_BRAND = "brand";
35
- var PALETTE_COLORING_CUSTOM = "custom";
36
- var PALETTE_COLORINGS = [PALETTE_COLORING_BRAND, ...BRANDS, PALETTE_COLORING_CUSTOM];
40
+ var BRAND_DEFAULT_PRESETS = { [BRAND_CLAUDE]: "claude", [BRAND_DEEPSEEK]: "deepseek" };
41
+ var PALETTE_COLORING_BRAND = PALETTE_SCHEME_FOLLOW;
37
42
  var INLINE_CODE_COLOR_PALETTE = "palette";
38
43
  var INLINE_CODE_COLOR_CLASSIC = "classic";
39
44
  var INLINE_CODE_COLORS = [INLINE_CODE_COLOR_PALETTE, INLINE_CODE_COLOR_CLASSIC];
@@ -156,13 +161,16 @@ var PREFS = {
156
161
  /** Whether the sidebar draws its brand area; off collapses that area and leaves the sidebar toggle in place. */
157
162
  sidebarBrand: { type: "boolean", default: true },
158
163
  brandAccent: { type: "color", default: "" },
159
- /** One brand's card, `brand` to follow the theme style, or the reader's four. */
160
- paletteColors: { type: "choice", values: PALETTE_COLORINGS, default: PALETTE_COLORING_BRAND },
161
- /** The reader's four colours, empty until picked; each falls back to the card's own. */
164
+ /** The selected scheme's id, or `brand` to follow the theme style; an id no scheme carries reads as `brand`. */
165
+ paletteColors: { type: "text", default: PALETTE_COLORING_BRAND, max: PALETTE_SCHEME_ID_MAX },
166
+ /** The schemes' records (palette-schemes.ts): the reader's own and the presets' overrides. */
167
+ paletteSchemes: { type: "list", default: [], max: PALETTE_SCHEME_LIMIT, entryMax: PALETTE_SCHEME_ENTRY_MAX, drop: [] },
168
+ /** The earlier single custom card's four colours; read once into the scheme `custom` and then left empty. */
162
169
  customAccent: { type: "color", default: "" },
163
170
  customCanvasLight: { type: "color", default: "" },
164
171
  customCanvasDark: { type: "color", default: "" },
165
172
  customCode: { type: "color", default: "" },
173
+ /** Read once and left at the default: the choice now lives in the Claude preset's override record. */
166
174
  inlineCodeColor: { type: "choice", values: INLINE_CODE_COLORS, default: INLINE_CODE_COLOR_PALETTE },
167
175
  motion: { type: "choice", values: MOTION_MODES, default: MOTION_SYSTEM },
168
176
  statusMotion: { type: "choice", values: STATUS_MOTIONS, default: STATUS_MOTION_SWEEP },
@@ -213,6 +221,13 @@ var PREFS = {
213
221
  /** Whether the percentage stands beside that face. */
214
222
  contextNumbers: { type: "boolean", default: true },
215
223
  statsFooterAlign: { type: "choice", values: STATS_FOOTER_ALIGNS, default: "center" },
224
+ /** Compact-footer figures; speed and TTFT join the existing figures only when asked for. */
225
+ statsFooterSpeed: { type: "boolean", default: false },
226
+ statsFooterTtft: { type: "boolean", default: false },
227
+ statsFooterCache: { type: "boolean", default: true },
228
+ statsFooterCost: { type: "boolean", default: true },
229
+ statsFooterTotal: { type: "boolean", default: true },
230
+ statsFooterContext: { type: "boolean", default: true },
216
231
  /** Which official price table the session's cost follows, or off for no figure at all. */
217
232
  billingCurrency: { type: "choice", values: BILLING_CHOICES, default: CURRENCY_CNY },
218
233
  /** Custom `model|input|cacheRead|output` rows per million tokens; blank buckets inherit official rates. */
@@ -243,7 +258,7 @@ var PREFS = {
243
258
  chatAnimations: { type: "boolean", default: true, legacy: { [CHAT_ANIMATIONS_OFF]: false, enhanced: true, redraw: true } },
244
259
  chatWait: { type: "boolean", default: true },
245
260
  chatSend: { type: "boolean", default: true },
246
- chatReveal: { type: "choice", values: CHAT_REVEAL_MODES, default: CHAT_REVEAL_OFF },
261
+ chatReveal: { type: "choice", values: CHAT_REVEAL_MODES, default: CHAT_REVEAL_ON },
247
262
  reasoningDisplay: { type: "choice", values: REASONING_DISPLAYS, default: REASONING_DISPLAY_STEPPED },
248
263
  /** Moves the reading position when an answer starts; default off because this is unsolicited movement. */
249
264
  answerAnchor: { type: "boolean", default: false },
@@ -341,6 +356,13 @@ function recordChanged(stored, sessions, read) {
341
356
  }
342
357
  return false;
343
358
  }
359
+ function filterSessionIds(days, excluded) {
360
+ return new Map([...days].map(([date, buckets]) => {
361
+ if (buckets.sessionIds === void 0) return [date, buckets];
362
+ const sessionIds = buckets.sessionIds.filter((id) => !excluded.has(id));
363
+ return [date, { ...buckets, sessions: sessionIds.length, sessionIds }];
364
+ }));
365
+ }
344
366
  function createUsage(ctx) {
345
367
  const home = () => harnessPath(ctx);
346
368
  const slots = /* @__PURE__ */ new Map();
@@ -354,7 +376,7 @@ function createUsage(ctx) {
354
376
  }
355
377
  return slot;
356
378
  }
357
- async function computeLocal(logs, ledgerDays, allowed, scope) {
379
+ async function computeLocal(logs, ledgerDays, allowed, excluded, scope) {
358
380
  const record = readRecord(ctx);
359
381
  const sessions = /* @__PURE__ */ new Map();
360
382
  let read = 0;
@@ -395,34 +417,41 @@ function createUsage(ctx) {
395
417
  const scopedLedger = scope === HOME_SESSION_SCOPE_ALL ? ledgerDays : null;
396
418
  const merge = mergeLedgerFold(scopedLedger, account);
397
419
  const source = scopedLedger === null ? LOCAL_SOURCE : merge.folded ? `${LEDGER_SOURCE}+${LOCAL_SOURCE}` : LEDGER_SOURCE;
420
+ const scopedIds = new Set([...merge.sessionIds].filter((id) => !excluded.has(id)));
421
+ const scopedDays = filterSessionIds(merge.days, excluded);
398
422
  const summary = summarize(
399
- merge.days,
400
- merge.sessionIds.size,
423
+ scopedDays,
424
+ scopedIds.size,
401
425
  source,
402
- merge.days.size === 0 ? void 0 : hoursOf(merge.days),
403
- { sessionIds: merge.sessionIds }
426
+ scopedDays.size === 0 ? void 0 : hoursOf(scopedDays),
427
+ { sessionIds: scopedIds }
404
428
  );
405
429
  const shaped = allowed === null ? summary : { ...summary, totals: { ...summary.totals, sessions: allowed.size } };
406
- const allIds = /* @__PURE__ */ new Set();
407
- for (const [id, entry] of recorded) if (entry.days.size > 0) allIds.add(id);
408
- for (const buckets of ledgerDays?.values() ?? []) for (const id of buckets.sessionIds ?? []) allIds.add(id);
430
+ const totalSessions = Number(shaped.totals.sessions) || 0;
409
431
  if (sessions.size === 0 && failed > 0) {
410
- return { ...shaped, scope, totalSessions: allIds.size, unavailable: true, reason: "session-query-unavailable" };
432
+ return { ...shaped, scope, totalSessions, unavailable: true, reason: "session-query-unavailable" };
411
433
  }
412
- return { ...shaped, scope, totalSessions: allIds.size, read, failed, sessions: logs.length };
434
+ return { ...shaped, scope, totalSessions, read, failed, sessions: logs.length };
413
435
  }
414
436
  async function compute(publish, scope, workspaceId) {
415
437
  const root = resolve(join2(home(), "sessions"));
416
438
  const logs = await listSessionLogs(root);
417
439
  const ledgerDays = readLedger(home(), ctx.logger);
440
+ const persistence = ctx.get("sessionPersistence");
441
+ const stored = persistence === null || persistence === void 0 ? [] : await persistence.list();
442
+ const originById = new Map(stored.map((entry) => [entry.header.id, entry.header.origin]));
443
+ const excluded = /* @__PURE__ */ new Set();
444
+ for (const entry of stored) if (entry.header.origin === "subagent") excluded.add(entry.header.id);
445
+ const mainLogs = logs.filter((log) => {
446
+ if (originById.get(log.id) !== "subagent") return true;
447
+ excluded.add(log.storedName);
448
+ return false;
449
+ });
418
450
  let allowed = null;
419
451
  if (scope !== HOME_SESSION_SCOPE_ALL) {
420
- const persistence = ctx.get("sessionPersistence");
421
- const stored = persistence === null || persistence === void 0 ? [] : await persistence.list();
422
- const originById = new Map(stored.map((entry) => [entry.header.id, entry.header.origin]));
423
452
  const registry = ctx.get("workspaceRegistry");
424
453
  const archived = new Set(registry?.archivedSessionIds ?? []);
425
- let selected = logs.filter((log) => log.storedName !== "" && originById.get(log.id) !== "subagent" && !archived.has(log.id));
454
+ let selected = mainLogs.filter((log) => log.storedName !== "" && !archived.has(log.id));
426
455
  if (scope === HOME_SESSION_SCOPE_WORKSPACE) {
427
456
  const workspace = registry?.list().find((entry) => entry.id === workspaceId);
428
457
  const members = new Set(workspace?.sessionIds ?? []);
@@ -433,11 +462,11 @@ function createUsage(ctx) {
433
462
  if (scope === HOME_SESSION_SCOPE_ALL && ledgerDays !== null && ledgerDays.size > 0) {
434
463
  const sessionIds = /* @__PURE__ */ new Set();
435
464
  for (const buckets of ledgerDays.values()) {
436
- for (const id of buckets.sessionIds ?? []) sessionIds.add(id);
465
+ for (const id of buckets.sessionIds ?? []) if (!excluded.has(id)) sessionIds.add(id);
437
466
  }
438
- publish({ ...summarize(ledgerDays, sessionIds.size, LEDGER_SOURCE), scope, totalSessions: sessionIds.size, sessions: logs.length });
467
+ publish({ ...summarize(filterSessionIds(ledgerDays, excluded), sessionIds.size, LEDGER_SOURCE), scope, totalSessions: sessionIds.size, sessions: mainLogs.length });
439
468
  }
440
- return await computeLocal(logs, ledgerDays, allowed, scope);
469
+ return await computeLocal(mainLogs, ledgerDays, allowed, excluded, scope);
441
470
  }
442
471
  function refresh(scope = HOME_SESSION_SCOPE_ALL, workspaceId = "") {
443
472
  const slot = slotFor(scope, workspaceId);