@laoyuehanni/dsh-token-usage 0.4.15 → 0.4.16

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.
Files changed (117) hide show
  1. package/README.md +2 -2
  2. package/README.zh.md +2 -2
  3. package/docs/DETAIL.md +18 -0
  4. package/docs/DETAIL.zh.md +18 -0
  5. package/lib/aux-request.d.ts +18 -13
  6. package/lib/aux-request.d.ts.map +1 -1
  7. package/lib/aux-request.js +32 -19
  8. package/lib/aux-request.js.map +1 -1
  9. package/lib/backup.d.ts +32 -0
  10. package/lib/backup.d.ts.map +1 -0
  11. package/lib/backup.js +114 -0
  12. package/lib/backup.js.map +1 -0
  13. package/lib/client/CostPill.d.ts.map +1 -1
  14. package/lib/client/CostPill.js +45 -30
  15. package/lib/client/CostPill.js.map +1 -1
  16. package/lib/client/DashboardCards.d.ts +4 -2
  17. package/lib/client/DashboardCards.d.ts.map +1 -1
  18. package/lib/client/DashboardCards.js +2 -2
  19. package/lib/client/DashboardCards.js.map +1 -1
  20. package/lib/client/OverheadRows.d.ts +17 -12
  21. package/lib/client/OverheadRows.d.ts.map +1 -1
  22. package/lib/client/OverheadRows.js +32 -20
  23. package/lib/client/OverheadRows.js.map +1 -1
  24. package/lib/client/OverviewBoard.js +3 -3
  25. package/lib/client/OverviewBoard.js.map +1 -1
  26. package/lib/client/TokenUsageCard.d.ts.map +1 -1
  27. package/lib/client/TokenUsageCard.js +6 -0
  28. package/lib/client/TokenUsageCard.js.map +1 -1
  29. package/lib/client/TokenUsageSection.d.ts.map +1 -1
  30. package/lib/client/TokenUsageSection.js +11 -9
  31. package/lib/client/TokenUsageSection.js.map +1 -1
  32. package/lib/client/UsageRows.js +2 -2
  33. package/lib/client/UsageRows.js.map +1 -1
  34. package/lib/client/UsageView.d.ts +7 -6
  35. package/lib/client/UsageView.d.ts.map +1 -1
  36. package/lib/client/UsageView.js +100 -51
  37. package/lib/client/UsageView.js.map +1 -1
  38. package/lib/client/async-resource.d.ts +5 -2
  39. package/lib/client/async-resource.d.ts.map +1 -1
  40. package/lib/client/async-resource.js +14 -6
  41. package/lib/client/async-resource.js.map +1 -1
  42. package/lib/client/format.d.ts +11 -0
  43. package/lib/client/format.d.ts.map +1 -1
  44. package/lib/client/format.js +32 -3
  45. package/lib/client/format.js.map +1 -1
  46. package/lib/client/index.d.ts.map +1 -1
  47. package/lib/client/index.js.map +1 -1
  48. package/lib/client/locales.d.ts +25 -1
  49. package/lib/client/locales.d.ts.map +1 -1
  50. package/lib/client/locales.js +50 -2
  51. package/lib/client/locales.js.map +1 -1
  52. package/lib/client/project-rows.d.ts +3 -2
  53. package/lib/client/project-rows.d.ts.map +1 -1
  54. package/lib/client/project-rows.js +3 -2
  55. package/lib/client/project-rows.js.map +1 -1
  56. package/lib/client/session-stats.d.ts +52 -10
  57. package/lib/client/session-stats.d.ts.map +1 -1
  58. package/lib/client/session-stats.js +88 -11
  59. package/lib/client/session-stats.js.map +1 -1
  60. package/lib/client.js +449 -143
  61. package/lib/client.js.map +1 -1
  62. package/lib/field-completion.d.ts.map +1 -1
  63. package/lib/field-completion.js +4 -1
  64. package/lib/field-completion.js.map +1 -1
  65. package/lib/index.d.ts +4 -4
  66. package/lib/index.d.ts.map +1 -1
  67. package/lib/index.js +134 -22
  68. package/lib/index.js.map +1 -1
  69. package/lib/migrate.d.ts +7 -1
  70. package/lib/migrate.d.ts.map +1 -1
  71. package/lib/migrate.js +116 -9
  72. package/lib/migrate.js.map +1 -1
  73. package/lib/project-rows.d.ts +20 -4
  74. package/lib/project-rows.d.ts.map +1 -1
  75. package/lib/project-rows.js +33 -8
  76. package/lib/project-rows.js.map +1 -1
  77. package/lib/request-observe.d.ts +7 -5
  78. package/lib/request-observe.d.ts.map +1 -1
  79. package/lib/request-observe.js +19 -16
  80. package/lib/request-observe.js.map +1 -1
  81. package/lib/rollup.d.ts +6 -1
  82. package/lib/rollup.d.ts.map +1 -1
  83. package/lib/rollup.js +15 -1
  84. package/lib/rollup.js.map +1 -1
  85. package/lib/session-request-details.d.ts.map +1 -1
  86. package/lib/session-request-details.js +5 -1
  87. package/lib/session-request-details.js.map +1 -1
  88. package/lib/stats-route.d.ts.map +1 -1
  89. package/lib/stats-route.js +65 -8
  90. package/lib/stats-route.js.map +1 -1
  91. package/lib/stats.d.ts +42 -1
  92. package/lib/stats.d.ts.map +1 -1
  93. package/lib/stats.js +240 -16
  94. package/lib/stats.js.map +1 -1
  95. package/lib/sync.d.ts +32 -0
  96. package/lib/sync.d.ts.map +1 -1
  97. package/lib/sync.js +286 -30
  98. package/lib/sync.js.map +1 -1
  99. package/lib/usage-log.d.ts +14 -9
  100. package/lib/usage-log.d.ts.map +1 -1
  101. package/lib/usage-log.js +190 -144
  102. package/lib/usage-log.js.map +1 -1
  103. package/lib/usage-record.d.ts +150 -27
  104. package/lib/usage-record.d.ts.map +1 -1
  105. package/lib/usage-record.js +221 -34
  106. package/lib/usage-record.js.map +1 -1
  107. package/lib/web-call.d.ts +55 -0
  108. package/lib/web-call.d.ts.map +1 -0
  109. package/lib/web-call.js +222 -0
  110. package/lib/web-call.js.map +1 -0
  111. package/lib/wire.d.ts +122 -11
  112. package/lib/wire.d.ts.map +1 -1
  113. package/lib/wire.js +40 -7
  114. package/lib/wire.js.map +1 -1
  115. package/locale/en.json +5 -1
  116. package/locale/zh.json +2 -1
  117. package/package.json +3 -3
package/lib/client.js CHANGED
@@ -15,6 +15,10 @@ window.__ModuleLoader__.load({
15
15
  const PRICING_PATH = "/token-usage/pricing";
16
16
  const PRICING_SYNC_PATH = "/token-usage/pricing-sync";
17
17
  const ASSOCIATIONS_PATH = "/token-usage/pricing-associations";
18
+ /** Query key carrying the scope's root session id. */
19
+ const ROOT_PARAM = "root";
20
+ /** Query key carrying the scope kind; omitted means `self`. */
21
+ const SCOPE_PARAM = "scope";
18
22
  /** Encode one repeated query key (`sessionId=a&sessionId=b`). Empty list yields ''. */
19
23
  function encodeRepeatedParam(key, values) {
20
24
  return values.map((value) => `${key}=${encodeURIComponent(value)}`).join("&");
@@ -25,14 +29,27 @@ window.__ModuleLoader__.load({
25
29
  }
26
30
  /**
27
31
  * Build the stats query string (including the leading `?`, or '' when
28
- * unconstrained). `fields: 'full'` is omitted — that is the default the
29
- * settings page already hits.
32
+ * unconstrained). A `root` request describes a RANGE RULE: the host expands
33
+ * `scope` from its session-metadata lineage index, so the URL never grows
34
+ * with the number of subagents — a subtree of 150+ sessions used to push the
35
+ * request line past Node's 16 KiB header limit (HTTP 431). `scope=self` is
36
+ * the default and is omitted from the wire.
37
+ *
38
+ * The explicit `sessionIds` / `childGroups` form is retained for legacy
39
+ * callers (older browser bundles, hand-written URLs and tests); new client
40
+ * code must use `root`, and the two forms are mutually exclusive.
41
+ * `fields: 'full'` is omitted — that is the default the settings page hits.
30
42
  */
31
43
  function encodeStatsQuery(options) {
32
44
  const parts = [];
33
- if (options.sessionIds !== void 0 && options.sessionIds.length > 0) parts.push(encodeRepeatedParam("sessionId", options.sessionIds));
34
- const children = options.childGroups !== void 0 ? encodeChildGroups(options.childGroups) : "";
35
- if (children !== "") parts.push(children);
45
+ if (options.root !== void 0 && options.root !== "") {
46
+ parts.push(`${ROOT_PARAM}=${encodeURIComponent(options.root)}`);
47
+ if (options.scope === "subtree") parts.push(`${SCOPE_PARAM}=subtree`);
48
+ } else {
49
+ if (options.sessionIds !== void 0 && options.sessionIds.length > 0) parts.push(encodeRepeatedParam("sessionId", options.sessionIds));
50
+ const children = options.childGroups !== void 0 ? encodeChildGroups(options.childGroups) : "";
51
+ if (children !== "") parts.push(children);
52
+ }
36
53
  if (options.fields !== void 0 && options.fields !== "full") parts.push(`fields=${options.fields}`);
37
54
  return parts.length === 0 ? "" : `?${parts.join("&")}`;
38
55
  }
@@ -415,23 +432,45 @@ window.__ModuleLoader__.load({
415
432
  * Return a value that lags behind its source by `delayMs` — a debounced
416
433
  * snapshot. The initial render already holds `value` (no null sentinel), so
417
434
  * a consumer can fetch immediately on mount without a second shot when the
418
- * first debounce window closes on the same value.
435
+ * first debounce window closes on the same value. When `resetKey` changes,
436
+ * the snapshot snaps to the current `value` immediately so a scope switch
437
+ * fires one fetch instead of a second delayed one when the old timer lands.
419
438
  *
420
439
  * @param value - the source value to debounce.
421
440
  * @param delayMs - the lag window in milliseconds.
441
+ * @param resetKey - optional identity whose change bypasses the debounce lag.
422
442
  * @returns the debounced value.
423
443
  */
424
- function useDebouncedValue(value, delayMs) {
425
- const [debounced, setDebounced] = (0, react.useState)(value);
444
+ function useDebouncedValue(value, delayMs, resetKey) {
445
+ const [state, setState] = (0, react.useState)({
446
+ value,
447
+ resetKey
448
+ });
449
+ const effective = Object.is(state.resetKey, resetKey) ? state.value : value;
426
450
  (0, react.useEffect)(() => {
451
+ if (!Object.is(state.resetKey, resetKey)) {
452
+ setState({
453
+ value,
454
+ resetKey
455
+ });
456
+ return;
457
+ }
427
458
  const timer = setTimeout(() => {
428
- setDebounced(value);
459
+ setState({
460
+ value,
461
+ resetKey
462
+ });
429
463
  }, delayMs);
430
464
  return () => {
431
465
  clearTimeout(timer);
432
466
  };
433
- }, [value, delayMs]);
434
- return debounced;
467
+ }, [
468
+ value,
469
+ delayMs,
470
+ resetKey,
471
+ state.resetKey
472
+ ]);
473
+ return effective;
435
474
  }
436
475
  // src/client/day.ts
437
476
  /** Total tokens across the four buckets (billed input = input + cacheRead + cacheWrite). */
@@ -566,22 +605,38 @@ window.__ModuleLoader__.load({
566
605
  * future code is not in this map and the tooltip renders it verbatim. */
567
606
  const FAILURE_CODE_LABEL_KEYS = {
568
607
  ABORTED: "fail.ABORTED",
608
+ ACCOUNT_QUOTA: "fail.ACCOUNT_QUOTA",
609
+ ACCOUNT_SIGN_IN_REQUIRED: "fail.ACCOUNT_SIGN_IN_REQUIRED",
610
+ ACCOUNT_TOKEN_INVALID: "fail.ACCOUNT_TOKEN_INVALID",
569
611
  AUTH: "fail.AUTH",
612
+ CLIENT_UPGRADE_REQUIRED: "fail.CLIENT_UPGRADE_REQUIRED",
613
+ CONTENT_REFUSED: "fail.CONTENT_REFUSED",
570
614
  CONTEXT_WINDOW_EXCEEDED: "fail.CONTEXT_WINDOW_EXCEEDED",
571
615
  EMPTY_RESPONSE: "fail.EMPTY_RESPONSE",
572
616
  FILES_API: "fail.FILES_API",
617
+ IMAGE_OFFLOAD_REQUIRED: "fail.IMAGE_OFFLOAD_REQUIRED",
573
618
  INVALID_CREDENTIAL: "fail.INVALID_CREDENTIAL",
574
619
  INVALID_REQUEST: "fail.INVALID_REQUEST",
620
+ INVALID_RESPONSE: "fail.INVALID_RESPONSE",
575
621
  MALFORMED_RESPONSE: "fail.MALFORMED_RESPONSE",
576
622
  MISSING_CREDENTIAL: "fail.MISSING_CREDENTIAL",
623
+ MODEL_SWITCH_COMPACTION_FAILED: "fail.MODEL_SWITCH_COMPACTION_FAILED",
624
+ MODEL_UNSUPPORTED: "fail.MODEL_UNSUPPORTED",
625
+ NO_ADAPTER: "fail.NO_ADAPTER",
626
+ PI_AI_ERROR: "fail.PI_AI_ERROR",
577
627
  QUOTA: "fail.QUOTA",
578
628
  RATE_LIMIT: "fail.RATE_LIMIT",
579
629
  REQUEST_EXTENSION: "fail.REQUEST_EXTENSION",
630
+ REQUEST_HEADERS: "fail.REQUEST_HEADERS",
580
631
  SERVER: "fail.SERVER",
581
632
  STREAM_CLOSED: "fail.STREAM_CLOSED",
582
633
  TIMEOUT: "fail.TIMEOUT",
583
634
  TRANSPORT: "fail.TRANSPORT",
584
- UNKNOWN: "fail.UNKNOWN"
635
+ UNKNOWN: "fail.UNKNOWN",
636
+ UNKNOWN_MODEL: "fail.UNKNOWN_MODEL",
637
+ UNSUPPORTED_CONTENT: "fail.UNSUPPORTED_CONTENT",
638
+ UNSUPPORTED_OPTION: "fail.UNSUPPORTED_OPTION",
639
+ UNSUPPORTED_REASONING_EFFORT: "fail.UNSUPPORTED_REASONING_EFFORT"
585
640
  };
586
641
  /** One decimal below 10, integer otherwise, trailing `.0` stripped. */
587
642
  function scale(value) {
@@ -779,6 +834,19 @@ window.__ModuleLoader__.load({
779
834
  }
780
835
  /**
781
836
  * The overhead pill's hover tooltip text: one `label ×count` line per
837
+ /**
838
+ * Total auxiliary (bypass) call count: completed requests plus recorded
839
+ * failures (for example `CONTENT_REFUSED` aux calls that billed before
840
+ * refusal). Kept shared so the overhead pill, card rows, tooltip and detail
841
+ * tab gate stay aligned.
842
+ * @param totals - the totals bucket (usually `aux.total` or a kind row's totals).
843
+ * @returns completed requests plus failures (treating absent failures as 0).
844
+ */
845
+ function auxCallCount(totals) {
846
+ return totals.requests + (totals.failures ?? 0);
847
+ }
848
+ /**
849
+ * Multi-line tooltip text for the overview card's `OverheadPill`: one line per
782
850
  * auxiliary kind, count descending, newline-joined — the same shape as
783
851
  * {@link failuresTooltip}. An absent breakdown yields '' and the caller
784
852
  * suppresses the tooltip (the pill itself still shows its count).
@@ -789,7 +857,7 @@ window.__ModuleLoader__.load({
789
857
  */
790
858
  function overheadTooltip(byKind, t) {
791
859
  if (byKind === void 0) return "";
792
- return byKind.filter((row) => row.totals.requests > 0).sort((left, right) => right.totals.requests - left.totals.requests).map((row) => `${t(`aux.kind.${row.auxKind}`)} ×${row.totals.requests.toLocaleString()}`).join("\n");
860
+ return byKind.filter((row) => auxCallCount(row.totals) > 0).sort((left, right) => auxCallCount(right.totals) - auxCallCount(left.totals)).map((row) => `${t(`aux.kind.${row.auxKind}`)} ×${auxCallCount(row.totals).toLocaleString()}`).join("\n");
793
861
  }
794
862
  // src/client/PricingStatus.tsx
795
863
  function costsAvailable(state) {
@@ -1766,17 +1834,19 @@ window.__ModuleLoader__.load({
1766
1834
  return out;
1767
1835
  }
1768
1836
  /**
1769
- * The immediate subagent parent of one session, when the record names one.
1770
- * The check is on `parentId` rather than `origin` so a mirrored summary that
1771
- * lost its origin tag still answers its lineage — the index is built once
1772
- * per render and shared across all three helpers via {@link ChildIndex}.
1837
+ * The immediate subagent parent of one session, when the record is tagged
1838
+ * `origin === 'subagent'` and names a parent. Ordinary forks — including
1839
+ * historical forks that retained `parentId` without `origin: 'subagent'` —
1840
+ * answer `undefined`, matching {@link buildChildIndex}.
1773
1841
  * @param rows - the retained session-summary mirror.
1774
1842
  * @param id - the current focus session id.
1775
- * @returns the parent session id, or undefined when the record has no
1776
- * parent link (a top-level session or an ordinary fork).
1843
+ * @returns the parent session id, or undefined when the record is not a
1844
+ * subagent child.
1777
1845
  */
1778
1846
  function subagentParentOf(rows, id) {
1779
- const parent = rows[id]?.parentId;
1847
+ const row = rows[id];
1848
+ if (row?.origin !== "subagent") return void 0;
1849
+ const parent = row.parentId;
1780
1850
  return parent === void 0 || parent === id ? void 0 : parent;
1781
1851
  }
1782
1852
  /**
@@ -1826,17 +1896,79 @@ window.__ModuleLoader__.load({
1826
1896
  ].join(".");
1827
1897
  }
1828
1898
  /**
1829
- * Build a debounce key from mirror `updatedAt` plus `sessionStats` churn.
1830
- * The active session reads live projection values from `useProjection`; every
1831
- * other scoped id reads the mirror copy.
1899
+ * Compact fingerprint of one session's summary `tokenUsage` projection —
1900
+ * retained on `session.list` rows in DSH 0.2.2+ after `sessionStats` was
1901
+ * excluded from summaries, so subagent token progress still bumps freshness.
1902
+ */
1903
+ function tokenUsageFingerprint(usage) {
1904
+ if (usage === void 0) return "-";
1905
+ return [
1906
+ usage.uncachedInputTokens,
1907
+ usage.outputTokens,
1908
+ usage.cacheReadTokens,
1909
+ usage.cacheWriteTokens
1910
+ ].join(".");
1911
+ }
1912
+ /**
1913
+ * Build a debounce key from mirror `updatedAt`, summary `tokenUsage` churn
1914
+ * (for subagents in DSH 0.2.2+), and `sessionStats` churn (active session and
1915
+ * legacy hosts).
1832
1916
  */
1833
1917
  function buildStatsFreshnessKey(ids, options) {
1834
1918
  return ids.map((id) => {
1835
1919
  const row = options.rows[id];
1920
+ const tokenUsage = id === options.activeSessionId ? options.liveTokenUsage ?? row?.projectionValues?.tokenUsage : row?.projectionValues?.tokenUsage;
1836
1921
  const stats = id === options.activeSessionId ? options.liveSessionStats ?? row?.projectionValues?.sessionStats : row?.projectionValues?.sessionStats;
1837
- return `${id}:${String(row?.updatedAt ?? 0)}:${sessionStatsFingerprint(stats)}`;
1922
+ return `${id}:${String(row?.updatedAt ?? 0)}:${tokenUsageFingerprint(tokenUsage)}:${sessionStatsFingerprint(stats)}`;
1838
1923
  }).join(",");
1839
1924
  }
1925
+ /** Aggregate retained `sessionStats` projections across `ids`, preferring the
1926
+ * live hook for `activeSessionId` and reading mirror rows for legacy hosts. */
1927
+ function aggregateScopedProjections(ids, rows, activeSessionId, liveSessionStats) {
1928
+ return aggregateProjections(ids.map((id) => {
1929
+ if (id === activeSessionId) return liveSessionStats ?? rows[id]?.projectionValues?.sessionStats;
1930
+ return rows[id]?.projectionValues?.sessionStats;
1931
+ }));
1932
+ }
1933
+ function timingFromBuckets(bucket) {
1934
+ if (bucket === void 0) return {};
1935
+ return {
1936
+ ...bucket.ttftSteps > 0 ? { ttftMs: bucket.ttftMs / bucket.ttftSteps } : {},
1937
+ ...bucket.decodeMs > 0 ? { tokensPerSec: bucket.decodeTokens / (bucket.decodeMs / 1e3) } : {}
1938
+ };
1939
+ }
1940
+ function timingFromPerfTotals(totals) {
1941
+ const samples = totals?.perfStreamCount ?? 0;
1942
+ if (samples <= 0) return {};
1943
+ return {
1944
+ ...totals?.perfStreamFirstMsSum !== void 0 ? { ttftMs: totals.perfStreamFirstMsSum / samples } : {},
1945
+ ...totals?.perfStreamTpsSum !== void 0 ? { tokensPerSec: totals.perfStreamTpsSum / samples } : {}
1946
+ };
1947
+ }
1948
+ /**
1949
+ * Resolve header TTFT and decode throughput while keeping DSH's weighted
1950
+ * projection formula (`ttftMs / ttftSteps`, `decodeTokens / (decodeMs / 1_000)`):
1951
+ * - Solo active session: prefer live `sessionStats` projection (covers
1952
+ * unlogged pre-install history and per-step retries), then host `summary.timing`.
1953
+ * - Subtree or drilled subagent: prefer host-aggregated `summary.timing` (which
1954
+ * covers finished subagents even when `sessionStats` is excluded from
1955
+ * summaries in DSH 0.2.2+), then legacy mirror projections, then `perfStream*`
1956
+ * on `history-incomplete` rollup fallbacks.
1957
+ */
1958
+ function resolveHeaderTiming(input) {
1959
+ const candidates = input.isSoloActive ? [
1960
+ timingFromBuckets(input.liveStats),
1961
+ timingFromBuckets(input.serverTiming),
1962
+ timingFromBuckets(input.mirrorAggregate),
1963
+ timingFromPerfTotals(input.totalPerf)
1964
+ ] : [
1965
+ timingFromBuckets(input.serverTiming),
1966
+ timingFromBuckets(input.mirrorAggregate),
1967
+ timingFromPerfTotals(input.totalPerf)
1968
+ ];
1969
+ for (const candidate of candidates) if (candidate.ttftMs !== void 0 || candidate.tokensPerSec !== void 0) return candidate;
1970
+ return {};
1971
+ }
1840
1972
  // src/client/use-color-scheme.ts
1841
1973
  /**
1842
1974
  * Shared browser-half hook: mirror the shell's root `color-scheme` onto a
@@ -2170,19 +2302,41 @@ window.__ModuleLoader__.load({
2170
2302
  childIndex
2171
2303
  ]);
2172
2304
  const hasSubs = scopeIds.length > 1;
2173
- const freshnessKey = buildStatsFreshnessKey(scopeIds, {
2305
+ const liveStats = useProjection("sessionStats");
2306
+ const scopeIdsKey = scopeIds.join(",");
2307
+ const debouncedFreshnessKey = useDebouncedValue(buildStatsFreshnessKey(scopeIds, {
2174
2308
  activeSessionId: sessionId,
2175
2309
  rows: byId,
2176
- liveSessionStats: useProjection("sessionStats")
2177
- });
2178
- const debouncedKey = useDebouncedValue(`${scopeIds.join("\n")}\n\t${freshnessKey}`, REFRESH_DEBOUNCE_MS$1);
2179
- const { onSummary } = useCostInflate(scopeIds.join("\n"), costRef);
2310
+ liveSessionStats: liveStats
2311
+ }), REFRESH_DEBOUNCE_MS$1, sessionId);
2312
+ const { onSummary } = useCostInflate(`${sessionId}:${scopeIds.length}`, costRef);
2313
+ const recentRef = (0, react.useRef)(void 0);
2180
2314
  const [treeRes, retryTree] = useAsyncResource((signal) => {
2181
- const [idsPart] = debouncedKey.split("\n ");
2182
- return fetchSummary$1((idsPart ?? "").split("\n").filter((id) => id !== ""), "chip", signal);
2183
- }, [debouncedKey, associationTick], {
2315
+ const recent = recentRef.current;
2316
+ if (recent !== void 0 && !recent.coalesced && recent.sessionId === sessionId && recent.scopeIdsKey !== scopeIdsKey && recent.associationTick === associationTick && Date.now() - recent.at < 500 && recent !== void 0) {
2317
+ recentRef.current = {
2318
+ ...recent,
2319
+ scopeIdsKey,
2320
+ at: Date.now(),
2321
+ coalesced: true
2322
+ };
2323
+ return Promise.resolve(recent.value);
2324
+ }
2325
+ return fetchSummary$1(sessionId, "subtree", "chip", signal).then((value) => {
2326
+ if (value !== null) recentRef.current = {
2327
+ sessionId,
2328
+ scopeIdsKey,
2329
+ associationTick,
2330
+ at: Date.now(),
2331
+ value,
2332
+ coalesced: false
2333
+ };
2334
+ return value;
2335
+ });
2336
+ }, [debouncedFreshnessKey, associationTick], {
2184
2337
  silentAfterFirst: true,
2185
- retryToken: 0
2338
+ retryToken: 0,
2339
+ scopeKey: sessionId
2186
2340
  });
2187
2341
  const summary = treeRes.status === "ready" ? treeRes.value : null;
2188
2342
  (0, react.useEffect)(() => {
@@ -2195,29 +2349,24 @@ window.__ModuleLoader__.load({
2195
2349
  window.clearTimeout(timer);
2196
2350
  };
2197
2351
  }, [treeRes, retryTree]);
2198
- const [detailRes] = useAsyncResource((signal) => {
2199
- if (!open) return Promise.resolve(null);
2200
- const [idsPart] = debouncedKey.split("\n ");
2201
- return fetchSummary$1((idsPart ?? "").split("\n").filter((id) => id !== ""), "session", signal);
2202
- }, [
2352
+ const [detailRes] = useAsyncResource((signal) => open ? fetchSummary$1(sessionId, "subtree", "session", signal) : Promise.resolve(null), [
2203
2353
  open,
2204
- debouncedKey,
2354
+ debouncedFreshnessKey,
2205
2355
  associationTick
2206
2356
  ], {
2207
2357
  silentAfterFirst: true,
2208
- retryToken: 0
2358
+ retryToken: 0,
2359
+ scopeKey: sessionId
2209
2360
  });
2210
- const [selfRes] = useAsyncResource((signal) => {
2211
- if (!open || sessionId === "") return Promise.resolve(null);
2212
- return fetchSummary$1([sessionId], "chip", signal);
2213
- }, [
2361
+ const [selfRes] = useAsyncResource((signal) => open && sessionId !== "" ? fetchSummary$1(sessionId, "self", "chip", signal) : Promise.resolve(null), [
2214
2362
  open,
2215
2363
  sessionId,
2216
- debouncedKey,
2364
+ debouncedFreshnessKey,
2217
2365
  associationTick
2218
2366
  ], {
2219
2367
  silentAfterFirst: true,
2220
- retryToken: 0
2368
+ retryToken: 0,
2369
+ scopeKey: sessionId
2221
2370
  });
2222
2371
  (0, react.useEffect)(() => {
2223
2372
  setOpen(false);
@@ -2451,20 +2600,22 @@ window.__ModuleLoader__.load({
2451
2600
  return typeof value === "object" && value !== null && typeof value.total === "object" && value.total !== null;
2452
2601
  }
2453
2602
  /**
2454
- * Fetch one stats summary. Throws on transport failure (network, abort,
2455
- * non-2xx response, or a payload that doesn't look like a stats summary) so
2456
- * the hook can keep the previous render in place.
2457
- * @param sessionIds - the scope's session ids; an empty list skips the
2458
- * fetch (returning null rather than throwing, so the hook's first-load
2459
- * gate stays at "loading").
2460
- * @param fields - `chip` for totals-only reads, `session` when byModel is
2461
- * needed (the detail panel's per-model block).
2603
+ * Fetch one stats summary. The request carries a RANGE RULE (root + scope),
2604
+ * never an enumerated subtree — the host expands it from its lineage index,
2605
+ * so the pill's chip/detail reads stay short even for hundreds of subagents.
2606
+ * Throws on transport failure (network, abort, non-2xx response, or a payload
2607
+ * that doesn't look like a stats summary) so the hook can keep the previous
2608
+ * render in place.
2609
+ * @param root - the scope's root session id; empty skips the fetch.
2610
+ * @param scope - `subtree` for the folded total, `self` for the split.
2611
+ * @param fields - `chip` for totals-only reads, `session` for byModel.
2462
2612
  * @param signal - the cancellation signal from the hook.
2463
2613
  */
2464
- async function fetchSummary$1(sessionIds, fields, signal) {
2465
- if (sessionIds.length === 0) return null;
2614
+ async function fetchSummary$1(root, scope, fields, signal) {
2615
+ if (root === "") return null;
2466
2616
  const response = await fetch(STATS_PATH + encodeStatsQuery({
2467
- sessionIds,
2617
+ root,
2618
+ scope,
2468
2619
  fields
2469
2620
  }), {
2470
2621
  headers: { accept: "application/json" },
@@ -3311,7 +3462,8 @@ window.__ModuleLoader__.load({
3311
3462
  added: body.added,
3312
3463
  skipped: body.skipped,
3313
3464
  removed: typeof body.removed === "number" ? body.removed : 0,
3314
- failedSessions: typeof body.failedSessions === "number" ? body.failedSessions : 0
3465
+ failedSessions: typeof body.failedSessions === "number" ? body.failedSessions : 0,
3466
+ ...typeof body.ignoredImported === "number" && body.ignoredImported > 0 ? { ignoredImported: body.ignoredImported } : {}
3315
3467
  };
3316
3468
  return null;
3317
3469
  }
@@ -3541,13 +3693,17 @@ window.__ModuleLoader__.load({
3541
3693
  role: "status",
3542
3694
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3543
3695
  className: TokenUsageCard_module_css_default.fullSyncProgressLabel,
3544
- children: [t("card.fullSync.progress", {
3545
- processed: String(fullSync.processed),
3546
- total: String(fullSync.total),
3547
- added: String(fullSync.added),
3548
- skipped: String(fullSync.skipped),
3549
- removed: String(fullSync.removed)
3550
- }), fullSync.failedSessions > 0 ? t("card.fullSync.failuresNote", { count: String(fullSync.failedSessions) }) : ""]
3696
+ children: [
3697
+ t("card.fullSync.progress", {
3698
+ processed: String(fullSync.processed),
3699
+ total: String(fullSync.total),
3700
+ added: String(fullSync.added),
3701
+ skipped: String(fullSync.skipped),
3702
+ removed: String(fullSync.removed)
3703
+ }),
3704
+ fullSync.failedSessions > 0 ? t("card.fullSync.failuresNote", { count: String(fullSync.failedSessions) }) : "",
3705
+ fullSync.ignoredImported !== void 0 ? t("card.fullSync.importedNote", { count: String(fullSync.ignoredImported) }) : ""
3706
+ ]
3551
3707
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3552
3708
  className: TokenUsageCard_module_css_default.fullSyncBar,
3553
3709
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -3559,11 +3715,15 @@ window.__ModuleLoader__.load({
3559
3715
  fullSync.status === "done" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
3560
3716
  className: TokenUsageCard_module_css_default.fullSyncResult,
3561
3717
  role: "status",
3562
- children: [t("card.fullSync.done", {
3563
- added: String(fullSync.added),
3564
- skipped: String(fullSync.skipped),
3565
- removed: String(fullSync.removed)
3566
- }), fullSync.failedSessions > 0 ? t("card.fullSync.failuresNote", { count: String(fullSync.failedSessions) }) : ""]
3718
+ children: [
3719
+ t("card.fullSync.done", {
3720
+ added: String(fullSync.added),
3721
+ skipped: String(fullSync.skipped),
3722
+ removed: String(fullSync.removed)
3723
+ }),
3724
+ fullSync.failedSessions > 0 ? t("card.fullSync.failuresNote", { count: String(fullSync.failedSessions) }) : "",
3725
+ fullSync.ignoredImported !== void 0 ? t("card.fullSync.importedNote", { count: String(fullSync.ignoredImported) }) : ""
3726
+ ]
3567
3727
  }) : null,
3568
3728
  fullSync.status === "failed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3569
3729
  className: TokenUsageCard_module_css_default.fullSyncError,
@@ -4139,23 +4299,28 @@ window.__ModuleLoader__.load({
4139
4299
  /**
4140
4300
  * The runtime-overhead card's row shape (browser half): one expanded-by-
4141
4301
  * default row per auxiliary kind — the row carries the kind's aggregate
4142
- * (calls · cost · tokens) and discloses its per-model lines on toggle; the
4143
- * total line sits beneath the list. The semantics are the retired table's
4144
- * (same fold, same empty hints, same defensive read of a payload without
4145
- * `aux`); only the shape moved from columns to rows.
4302
+ * (calls · cost · tokens) and discloses its per-model lines on toggle — plus
4303
+ * one expanded-by-default web-tools row that carries the total call count and
4304
+ * discloses its per-tool lines (`web_search`, `web_fetch`) on toggle. The
4305
+ * total line beneath the list covers the auxiliary kinds only: web tools
4306
+ * never join it, and any tokens a search reported are billed with the
4307
+ * ordinary request totals.
4146
4308
  *
4147
4309
  * @module token-usage/client/OverheadRows
4148
4310
  */
4149
4311
  /**
4150
- * Render the overhead rows: one disclosure row per kind, then the total
4151
- * line. A summary without auxiliary requests — including an older host
4152
- * payload with no `aux` field at all — renders the empty hint instead, so
4153
- * the card keeps a stable body.
4154
- * @param props - the aux layer of the summary (possibly absent), the cost
4155
- * state, the display currency view, and the locale translator.
4312
+ * Render the overhead rows: one disclosure row per auxiliary kind, the
4313
+ * web-search row, then the auxiliary total line. A summary without auxiliary
4314
+ * requests — including an older host payload with no `aux` field at all —
4315
+ * renders the empty hint instead, unless the web-search layer has calls.
4316
+ * A web row renders one line: its call count.
4317
+ * @param props - the aux layer (possibly absent), the web-search layer
4318
+ * (absent on legacy payloads), the cost state, the display currency view,
4319
+ * and the locale translator.
4156
4320
  */
4157
- function OverheadRows({ aux, costState, view, t }) {
4321
+ function OverheadRows({ aux, web, costState, view, t }) {
4158
4322
  const [collapsedKinds, setCollapsedKinds] = (0, react.useState)(() => /* @__PURE__ */ new Set());
4323
+ const [webCollapsed, setWebCollapsed] = (0, react.useState)(false);
4159
4324
  const toggleKind = (auxKind) => {
4160
4325
  setCollapsedKinds((previous) => {
4161
4326
  const next = new Set(previous);
@@ -4164,7 +4329,9 @@ window.__ModuleLoader__.load({
4164
4329
  return next;
4165
4330
  });
4166
4331
  };
4167
- if (aux === void 0 || aux.total.requests === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4332
+ const hasAux = aux !== void 0 && auxCallCount(aux.total) > 0;
4333
+ const hasWeb = web !== void 0 && web.calls > 0;
4334
+ if (!hasAux && !hasWeb) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4168
4335
  className: OverheadRows_module_css_default["muted"],
4169
4336
  children: t("aux.empty")
4170
4337
  });
@@ -4183,11 +4350,11 @@ window.__ModuleLoader__.load({
4183
4350
  formatTokens(tokens)
4184
4351
  ] })]
4185
4352
  });
4186
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4353
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4187
4354
  className: UsageRows_module_css_default["rows"],
4188
4355
  role: "list",
4189
4356
  "aria-label": t("aux.tab"),
4190
- children: (aux.byKind ?? []).map((kindRow) => {
4357
+ children: [(aux?.byKind ?? []).map((kindRow) => {
4191
4358
  const expanded = !collapsedKinds.has(kindRow.auxKind);
4192
4359
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4193
4360
  className: OverheadRows_module_css_default["orow"],
@@ -4207,7 +4374,7 @@ window.__ModuleLoader__.load({
4207
4374
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4208
4375
  className: OverheadRows_module_css_default["onums"],
4209
4376
  children: [
4210
- t("aux.requestCount", { count: kindRow.totals.requests.toLocaleString() }),
4377
+ t("aux.requestCount", { count: auxCallCount(kindRow.totals).toLocaleString() }),
4211
4378
  " · ",
4212
4379
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4213
4380
  className: OverheadRows_module_css_default["onumsCost"],
@@ -4219,13 +4386,42 @@ window.__ModuleLoader__.load({
4219
4386
  })]
4220
4387
  }), expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4221
4388
  className: OverheadRows_module_css_default["adetail"],
4222
- children: (kindRow.byModel ?? []).map((modelRow) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: modelLine(modelRow.model, modelRow.totals.requests, modelRow.cost, totalTokens$1(modelRow.totals)) }, `${kindRow.auxKind}:${modelRow.model}`))
4389
+ children: (kindRow.byModel ?? []).map((modelRow) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: modelLine(modelRow.model, auxCallCount(modelRow.totals), modelRow.cost, totalTokens$1(modelRow.totals)) }, `${kindRow.auxKind}:${modelRow.model}`))
4223
4390
  }) : null]
4224
4391
  }, kindRow.auxKind);
4225
- })
4226
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4392
+ }), hasWeb ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4393
+ className: OverheadRows_module_css_default["orow"],
4394
+ role: "listitem",
4395
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4396
+ className: OverheadRows_module_css_default["orowTop"],
4397
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
4398
+ type: "button",
4399
+ className: OverheadRows_module_css_default["kindToggle"],
4400
+ "aria-expanded": !webCollapsed,
4401
+ onClick: () => setWebCollapsed((previous) => !previous),
4402
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4403
+ className: OverheadRows_module_css_default["chevron"],
4404
+ "aria-hidden": "true",
4405
+ children: "▸"
4406
+ }), t("web.title")]
4407
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4408
+ className: OverheadRows_module_css_default["onums"],
4409
+ children: t("web.calls", { count: web.calls.toLocaleString() })
4410
+ })]
4411
+ }), !webCollapsed && (web.byTool?.length ?? 0) > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4412
+ className: OverheadRows_module_css_default["adetail"],
4413
+ children: (web.byTool ?? []).map((toolRow) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4414
+ className: OverheadRows_module_css_default["dline"],
4415
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4416
+ className: OverheadRows_module_css_default["dmodelName"],
4417
+ children: t(`web.tool.${toolRow.tool}`)
4418
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("web.calls", { count: toolRow.calls.toLocaleString() }) })]
4419
+ }, `web:${toolRow.tool}`))
4420
+ }) : null]
4421
+ }, "web-tools") : null]
4422
+ }), hasAux ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4227
4423
  className: OverheadRows_module_css_default["asum"],
4228
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("aux.totalCount", { count: aux.total.requests.toLocaleString() }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
4424
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("aux.totalCount", { count: auxCallCount(aux.total).toLocaleString() }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
4229
4425
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4230
4426
  className: OverheadRows_module_css_default["onumsCost"],
4231
4427
  children: costText(aux.cost)
@@ -4233,7 +4429,7 @@ window.__ModuleLoader__.load({
4233
4429
  " · ",
4234
4430
  formatTokens(totalTokens$1(aux.total))
4235
4431
  ] })]
4236
- })] });
4432
+ }) : null] });
4237
4433
  }
4238
4434
  // src/project-rows.ts
4239
4435
  function totalTokens(totals) {
@@ -4244,6 +4440,25 @@ window.__ModuleLoader__.load({
4244
4440
  const parts = cwd.split(/[\\/]/u).filter((part) => part !== "");
4245
4441
  return parts[parts.length - 1] ?? cwd;
4246
4442
  }
4443
+ /** The dsh-worktree plugin's project-internal layout marker: a checkout
4444
+ * at `<repo>/.dsh/gitworktree/<branch>` belongs to `<repo>`. Matches the
4445
+ * branch segment (never the bare layout root) and everything under it,
4446
+ * on either separator. */
4447
+ const WORKTREE_LAYOUT = /[/\\]\.dsh[/\\]gitworktree[/\\][^/\\]+/u;
4448
+ /**
4449
+ * Map a session cwd onto the repository it belongs to for project
4450
+ * aggregation: a `<repo>/.dsh/gitworktree/<branch>` checkout (the
4451
+ * dsh-worktree plugin's project layout, deeper subdirectories included)
4452
+ * folds onto its repository root, so worktree sessions join the
4453
+ * repository's own project row instead of surfacing as a project of
4454
+ * their own. Any other path returns unchanged. Pure string work — the
4455
+ * host fold and the browser's older-host fallback must share one rule,
4456
+ * and neither can probe the disk.
4457
+ */
4458
+ function belongedCwdOf(cwd) {
4459
+ const match = WORKTREE_LAYOUT.exec(cwd);
4460
+ return match === null ? cwd : cwd.slice(0, match.index);
4461
+ }
4247
4462
  /** Element-wise totals sum: the counted fields add, the optional ones
4248
4463
  * treat absence as 0 and stay absent only while both sides lack them. */
4249
4464
  function addTotals(left, right) {
@@ -4277,28 +4492,32 @@ window.__ModuleLoader__.load({
4277
4492
  * Fold session rows into one row per directory tail, token-descending (the
4278
4493
  * dashboard's relative bars take the first row as their 100%). The tail is
4279
4494
  * the bucket key — two different full paths ending in the same segment read
4280
- * as one project here, matching the demo's semantics. Within a bucket the
4281
- * first-seen cwd rides along as the representative full path. The input
4282
- * order is preserved inside a bucket (the served rows arrive cost-sorted).
4495
+ * as one project here, matching the demo's semantics — and a worktree
4496
+ * checkout (`<repo>/.dsh/gitworktree/<branch>`, see {@link belongedCwdOf})
4497
+ * folds onto its repository before the tail is taken, so its sessions join
4498
+ * the repository's project. Within a bucket the first-seen (belonged) cwd
4499
+ * rides along as the representative full path. The input order is preserved
4500
+ * inside a bucket (the served rows arrive cost-sorted).
4283
4501
  * @param rows - subtree-folded root sessions; the host supplies the full
4284
4502
  * set, not the truncated session list.
4285
4503
  */
4286
4504
  function projectRowsOf(rows) {
4287
4505
  const buckets = /* @__PURE__ */ new Map();
4288
4506
  for (const row of rows) {
4289
- const name = row.cwd === void 0 ? "" : dirTailOf(row.cwd);
4507
+ const owned = row.cwd === void 0 ? void 0 : belongedCwdOf(row.cwd);
4508
+ const name = owned === void 0 ? "" : dirTailOf(owned);
4290
4509
  const bucket = buckets.get(name);
4291
4510
  if (bucket === void 0) {
4292
4511
  buckets.set(name, {
4293
4512
  name,
4294
- ...row.cwd === void 0 ? {} : { cwd: row.cwd },
4513
+ ...owned === void 0 ? {} : { cwd: owned },
4295
4514
  sessionCount: 1,
4296
4515
  totals: { ...row.totals },
4297
4516
  cost: row.cost
4298
4517
  });
4299
4518
  continue;
4300
4519
  }
4301
- if (bucket.cwd === void 0 && row.cwd !== void 0) bucket.cwd = row.cwd;
4520
+ if (bucket.cwd === void 0 && owned !== void 0) bucket.cwd = owned;
4302
4521
  bucket.sessionCount += 1;
4303
4522
  bucket.totals = addTotals(bucket.totals, row.totals);
4304
4523
  bucket.cost += row.cost;
@@ -4742,7 +4961,7 @@ window.__ModuleLoader__.load({
4742
4961
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4743
4962
  className: UsageRows_module_css_default["rowSub"],
4744
4963
  children: [
4745
- session.cwd === void 0 ? t("session.untitledDir") : dirTailOf(session.cwd),
4964
+ session.cwd === void 0 ? t("session.untitledDir") : dirTailOf(belongedCwdOf(session.cwd)),
4746
4965
  " · ",
4747
4966
  relativeTimeOf(session.lastTime, t)
4748
4967
  ]
@@ -4789,7 +5008,7 @@ window.__ModuleLoader__.load({
4789
5008
  * providers on the second, runtime overhead on the last. The lists cap
4790
5009
  * their own height and scroll inside the cards.
4791
5010
  */
4792
- function DashboardCards({ projectRows, modelRows, sessionRows, projectSort, onProjectSortChange, modelSort, onModelSortChange, modelPerfView, onModelPerfToggle, providerRows, providerNames, providerSort, onProviderSortChange, sessionSort, onSessionSortChange, aux, pricing, costState, view, t, sessionListed, onSessionOpen, onToggleModel, onModelName, overheadCardRef, overheadFlash }) {
5011
+ function DashboardCards({ projectRows, modelRows, sessionRows, projectSort, onProjectSortChange, modelSort, onModelSortChange, modelPerfView, onModelPerfToggle, providerRows, providerNames, providerSort, onProviderSortChange, sessionSort, onSessionSortChange, aux, web, pricing, costState, view, t, sessionListed, onSessionOpen, onToggleModel, onModelName, overheadCardRef, overheadFlash }) {
4793
5012
  const namedProviderCount = providerRows.filter((row) => row.provider !== "").length;
4794
5013
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4795
5014
  className: DashboardCards_module_css_default["grid2"],
@@ -4933,6 +5152,7 @@ window.__ModuleLoader__.load({
4933
5152
  })
4934
5153
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OverheadRows, {
4935
5154
  aux,
5155
+ web,
4936
5156
  costState,
4937
5157
  view,
4938
5158
  t
@@ -5961,14 +6181,14 @@ window.__ModuleLoader__.load({
5961
6181
  failuresByCode: total.failuresByCode,
5962
6182
  ...compact ? {
5963
6183
  labelExtra: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OverheadPill, {
5964
- requests: aux?.total.requests,
6184
+ requests: aux !== void 0 ? auxCallCount(aux.total) : void 0,
5965
6185
  byKind: aux?.byKind,
5966
6186
  onActivate: onOverheadActivate,
5967
6187
  t
5968
6188
  }),
5969
6189
  failureBare: true
5970
6190
  } : {
5971
- overheadRequests: aux?.total.requests,
6191
+ overheadRequests: aux !== void 0 ? auxCallCount(aux.total) : void 0,
5972
6192
  overheadByKind: aux?.byKind,
5973
6193
  onOverheadActivate
5974
6194
  },
@@ -7082,7 +7302,8 @@ window.__ModuleLoader__.load({
7082
7302
  const { total } = state.value;
7083
7303
  const view = currencyViewOf(state.value);
7084
7304
  const projectRows = state.value.projectRows ?? projectRowsOf(state.value.sessionRows ?? []);
7085
- const auxRequests = state.value.aux?.total.requests ?? 0;
7305
+ const auxRequests = state.value.aux !== void 0 ? auxCallCount(state.value.aux.total) : 0;
7306
+ const webCalls = state.value.web?.calls ?? 0;
7086
7307
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7087
7308
  ref: rootRef,
7088
7309
  className: rootClass,
@@ -7148,6 +7369,7 @@ window.__ModuleLoader__.load({
7148
7369
  sessionSort,
7149
7370
  onSessionSortChange: setSessionSort,
7150
7371
  aux: state.value.aux,
7372
+ web: state.value.web,
7151
7373
  pricing: state.value.pricing,
7152
7374
  costState: state.value.costState,
7153
7375
  view,
@@ -7160,7 +7382,7 @@ window.__ModuleLoader__.load({
7160
7382
  onModelName: setDetailModel,
7161
7383
  overheadCardRef,
7162
7384
  overheadFlash
7163
- }) : state.value.byModel.length > 0 || (state.value.sessionRows?.length ?? 0) > 0 || auxRequests > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
7385
+ }) : state.value.byModel.length > 0 || (state.value.sessionRows?.length ?? 0) > 0 || auxRequests > 0 || webCalls > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
7164
7386
  className: TokenUsageSection_module_css_default["detailPanel"],
7165
7387
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7166
7388
  className: TokenUsageSection_module_css_default["detailToolbar"],
@@ -7198,6 +7420,7 @@ window.__ModuleLoader__.load({
7198
7420
  className: TokenUsageSection_module_css_default["detailBody"],
7199
7421
  children: detailMode === "aux" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OverheadRows, {
7200
7422
  aux: state.value.aux,
7423
+ web: state.value.web,
7201
7424
  costState: state.value.costState,
7202
7425
  view,
7203
7426
  t
@@ -7284,7 +7507,7 @@ window.__ModuleLoader__.load({
7284
7507
  });
7285
7508
  }
7286
7509
  // \0dsh-css:/home/runner/work/dsh-token-usage/dsh-token-usage/src/client/UsageView.module.css.mjs
7287
- const css = ".PR9kTG_root{color:var(--dsw-alias-label-primary);box-sizing:border-box;width:100%;padding:12px calc(var(--dsh-composer-side-clearance,16px) + 16px);padding-bottom:calc(var(--dsh-composer-height,152px) + 16px);flex-direction:column;gap:12px;max-width:1400px;height:100%;min-height:0;margin:0 auto;display:flex;overflow-y:auto;container:PR9kTG_usage/inline-size}.PR9kTG_root>*{flex-shrink:0}.PR9kTG_head{flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:12px;display:flex}.PR9kTG_headRight{align-items:center;gap:10px;display:flex}.PR9kTG_back{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border-radius:6px;padding:3px 10px;font-size:12px}.PR9kTG_back:hover{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-border-l2)}.PR9kTG_segmented{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-fill-container,transparent);border-radius:8px;align-items:stretch;gap:2px;padding:2px;display:inline-flex}.PR9kTG_segBtn{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));cursor:pointer;background:0 0;border:none;border-radius:6px;padding:4px 12px;font-size:12px;font-weight:500}.PR9kTG_segBtn:hover:not(.PR9kTG_segActive){color:var(--dsw-alias-label-secondary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}.PR9kTG_segBtn:focus-visible{outline:2px solid var(--dsw-alias-border-l2);outline-offset:1px}.PR9kTG_segActive{background:color-mix(in srgb, var(--dsw-alias-label-primary) 16%, transparent);color:var(--dsw-alias-label-primary);font-weight:600}.PR9kTG_muted{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px}.PR9kTG_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:13px}.PR9kTG_empty{color:var(--dsw-alias-label-secondary);text-align:center;margin:24px 0 0;font-size:13px}.PR9kTG_button{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border-radius:6px;align-self:flex-start;padding:3px 10px;font-size:12px}.PR9kTG_warning{color:var(--dsw-alias-state-warning-primary,var(--dsw-alias-label-secondary));margin:0;font-size:12px}.PR9kTG_note{color:var(--dsw-alias-label-tertiary);margin:0;font-size:11px}.PR9kTG_cards{grid-template-columns:repeat(6,minmax(0,1fr));gap:10px;display:grid}.PR9kTG_tokenStrip{color:var(--dsw-alias-label-secondary);flex-wrap:wrap;gap:18px;padding:6px 2px 0;font-size:12px;display:flex}.PR9kTG_tokenStrip b{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums}.PR9kTG_mid{grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);align-items:start;gap:24px;display:grid}.PR9kTG_chartCol,.PR9kTG_modelCol,.PR9kTG_subagents{flex-direction:column;gap:6px;min-width:0;display:flex}.PR9kTG_subagentsHead,.PR9kTG_chartHead{align-items:center;gap:8px;display:flex}.PR9kTG_subtitle{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;font-weight:600}.PR9kTG_tableWrap{overflow-x:auto}.PR9kTG_table{border-collapse:collapse;font-variant-numeric:tabular-nums;width:100%;min-width:480px;font-size:12px}.PR9kTG_table th,.PR9kTG_table td{text-align:right;border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap;padding:4px 6px}.PR9kTG_table tbody tr{transition:background-color .12s}.PR9kTG_table tbody tr:hover{background-color:var(--dsw-interactive-bg-hover)}.PR9kTG_table th{border-bottom:1.5px solid var(--dsw-alias-border-l2);font-weight:600}.PR9kTG_costCol{font-weight:600}.PR9kTG_zeroDim{color:var(--dsw-alias-label-tertiary);opacity:.55}.PR9kTG_table th:first-child,.PR9kTG_table td:first-child,.PR9kTG_modelHead{text-align:left}.PR9kTG_modelCell{font-variant-numeric:normal;text-overflow:ellipsis;max-width:180px;overflow:hidden}.PR9kTG_modelIdentity{align-items:center;gap:4px;max-width:180px;display:inline-flex}.PR9kTG_modelName{text-overflow:ellipsis;min-width:0;overflow:hidden}.PR9kTG_childLink{color:var(--dsw-alias-link-primary,var(--dsw-alias-label-primary));cursor:pointer;text-align:left;text-overflow:ellipsis;white-space:nowrap;background:0 0;border:none;max-width:220px;padding:0;font-size:12px;overflow:hidden}.PR9kTG_childLink:hover{text-decoration:underline}.PR9kTG_nestedBadge{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;margin-left:6px;font-size:11px}.PR9kTG_poolSection{flex-direction:column;gap:6px;min-width:0;margin-top:4px;display:flex}.PR9kTG_poolHead{flex-wrap:wrap;justify-content:space-between;align-items:baseline;gap:8px 12px;display:flex}.PR9kTG_poolContext{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:11px}.PR9kTG_poolEmpty{color:var(--dsw-alias-label-secondary);padding:12px 0;font-size:12px}.PR9kTG_latestPanel{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-fill-container,transparent);border-radius:9px;min-width:0;padding:14px 16px}.PR9kTG_requestIdentity{flex-wrap:wrap;align-items:center;gap:6px 10px;min-width:0;display:flex}.PR9kTG_poolBadge{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);white-space:nowrap;border-radius:5px;flex:none;padding:1px 7px;font-size:11px}.PR9kTG_poolState{white-space:nowrap;font-size:11px}.PR9kTG_requestIdentity .PR9kTG_poolState{align-items:center;gap:5px;display:inline-flex}.PR9kTG_statusDot{background:currentColor;border-radius:50%;flex:none;width:5px;height:5px}.PR9kTG_latestPanel .PR9kTG_modelName{font-size:13px;font-weight:500}.PR9kTG_stateDone{color:var(--dsw-alias-state-success-primary,#16a34a)}.PR9kTG_stateFailed{color:var(--dsw-alias-state-error-primary,#dc2626)}.PR9kTG_statePending{color:light-dark(#b45309,#d9ac64)}.PR9kTG_stateStreaming{color:var(--dsw-alias-link-primary,var(--dsw-alias-label-primary))}.PR9kTG_modelInline{white-space:nowrap;align-items:center;gap:6px;min-width:0;max-width:100%;display:inline-flex}.PR9kTG_cacheLoss{color:light-dark(#b45309,#d9ac64);white-space:nowrap;background:light-dark(#fff1d8,#352b1d);border-radius:4px;flex:none;align-items:center;gap:4px;padding:2px 6px;font-size:11px;display:inline-flex}.PR9kTG_cacheLoss svg{flex:none;width:12px;height:12px}.PR9kTG_auxKind{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);white-space:nowrap;border-radius:4px;flex:none;padding:2px 5px;font-size:10px}.PR9kTG_requestMetrics{grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;padding:13px 0;display:grid}.PR9kTG_metricValue{letter-spacing:-.25px;white-space:nowrap;font-variant-numeric:tabular-nums;font-size:23px;font-weight:500}.PR9kTG_metricUnit{color:var(--dsw-alias-label-tertiary);letter-spacing:0;margin-left:4px;font-size:11px}.PR9kTG_metricLabel{color:var(--dsw-alias-label-tertiary);margin-top:2px;font-size:11px}.PR9kTG_requestFooter{border-top:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);flex-wrap:nowrap;justify-content:space-between;align-items:baseline;gap:8px 18px;padding-top:8px;font-size:11px;display:flex}.PR9kTG_requestBuckets{flex-wrap:wrap;flex:none;gap:8px 15px;display:flex}.PR9kTG_requestNote{white-space:nowrap;text-overflow:ellipsis;color:light-dark(#b45309,#d9ac64);flex:0 auto;min-width:0;margin:0;font-size:11px;overflow:hidden}.PR9kTG_requestNoteError{color:var(--dsw-alias-state-error-primary)}.PR9kTG_requestNoteNeutral{color:var(--dsw-alias-label-tertiary)}.PR9kTG_requestFooter b{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:400}.PR9kTG_poolNotice{color:light-dark(#b45309,#d9ac64);margin:4px 0 0;font-size:11px}.PR9kTG_poolTableWrap{overscroll-behavior:contain;max-height:196px;overflow:auto}.PR9kTG_poolTableWrap::-webkit-scrollbar{width:8px;height:8px}.PR9kTG_poolTableWrap::-webkit-scrollbar-track,.PR9kTG_poolTableWrap::-webkit-scrollbar-corner{background:0 0}.PR9kTG_poolTableWrap::-webkit-scrollbar-button{display:none}.PR9kTG_poolTableWrap::-webkit-scrollbar-thumb{background:0 0;border-radius:4px}.PR9kTG_poolTableWrap.PR9kTG_scrolling::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent)}.PR9kTG_poolTableWrap:focus-visible{outline:2px solid var(--dsw-alias-border-l2);outline-offset:2px}.PR9kTG_poolTable{table-layout:fixed;border-collapse:collapse;font-variant-numeric:tabular-nums;width:100%;font-size:11px}.PR9kTG_poolTable th,.PR9kTG_poolTable td{text-align:right;border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap;padding:8px 6px;overflow:hidden}.PR9kTG_poolTable th{z-index:1;background:var(--dsw-alias-bg-base,var(--dsw-alias-bg-layer-1));color:var(--dsw-alias-label-secondary);border-bottom:1.5px solid var(--dsw-alias-border-l2);padding:6px;font-weight:400;position:sticky;top:0}.PR9kTG_poolTable th:nth-child(-n+4),.PR9kTG_poolTable td:nth-child(-n+4){text-align:left}.PR9kTG_poolOrigin,.PR9kTG_poolTime{color:var(--dsw-alias-label-secondary)}.PR9kTG_poolModel,.PR9kTG_poolModel .PR9kTG_modelInline{max-width:200px}.PR9kTG_poolModel .PR9kTG_modelName{text-overflow:ellipsis;min-width:0;overflow:hidden}.PR9kTG_poolModelHead{text-align:left}.PR9kTG_poolTable tbody tr:hover{background-color:var(--dsw-interactive-bg-hover)}@media (prefers-reduced-motion:no-preference){.PR9kTG_latestPanel{animation:.25s ease-out PR9kTG_pool-arrive}@keyframes PR9kTG_pool-arrive{0%{opacity:.4}to{opacity:1}}}@container PR9kTG_usage (width<=900px){.PR9kTG_requestMetrics{grid-template-columns:repeat(3,minmax(0,1fr))}.PR9kTG_poolTableWrap{max-height:230px}}@container PR9kTG_usage (width<=480px){.PR9kTG_poolTableWrap{max-height:240px}.PR9kTG_poolTable thead{display:none}.PR9kTG_poolTable,.PR9kTG_poolTable tbody{min-width:0;display:block}.PR9kTG_poolTable tbody tr{border-bottom:1px solid var(--dsw-alias-border-l1);grid-template-columns:repeat(3,minmax(0,1fr));gap:4px 9px;padding:9px 0;display:grid}.PR9kTG_poolTable td{border-bottom:none;text-align:left!important;padding:0!important}.PR9kTG_poolTable td:nth-child(4){grid-column:1/-1}.PR9kTG_poolTable td:before{content:attr(data-label) \" \";color:var(--dsw-alias-label-tertiary)}.PR9kTG_poolModel,.PR9kTG_poolModel .PR9kTG_modelInline{max-width:100%}.PR9kTG_metricValue{font-size:21px}}@container PR9kTG_usage (width<=900px){.PR9kTG_cards{grid-template-columns:repeat(3,minmax(0,1fr))}.PR9kTG_mid{grid-template-columns:1fr}}@media (width<=600px){.PR9kTG_root{padding-left:12px;padding-right:12px}}";
7510
+ const css = ".PR9kTG_root{color:var(--dsw-alias-label-primary);box-sizing:border-box;width:100%;padding:12px calc(var(--dsh-composer-side-clearance,16px) + 16px);padding-bottom:calc(var(--dsh-composer-height,152px) + 16px);flex-direction:column;gap:12px;max-width:1400px;height:100%;min-height:0;margin:0 auto;display:flex;overflow-y:auto;container:PR9kTG_usage/inline-size}.PR9kTG_root>*{flex-shrink:0}.PR9kTG_head{flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:12px;display:flex}.PR9kTG_headRight{align-items:center;gap:10px;display:flex}.PR9kTG_back{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border-radius:6px;padding:3px 10px;font-size:12px}.PR9kTG_back:hover{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-border-l2)}.PR9kTG_segmented{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-fill-container,transparent);border-radius:8px;align-items:stretch;gap:2px;padding:2px;display:inline-flex}.PR9kTG_segBtn{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));cursor:pointer;background:0 0;border:none;border-radius:6px;padding:4px 12px;font-size:12px;font-weight:500}.PR9kTG_segBtn:hover:not(.PR9kTG_segActive){color:var(--dsw-alias-label-secondary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}.PR9kTG_segBtn:focus-visible{outline:2px solid var(--dsw-alias-border-l2);outline-offset:1px}.PR9kTG_segActive{background:color-mix(in srgb, var(--dsw-alias-label-primary) 16%, transparent);color:var(--dsw-alias-label-primary);font-weight:600}.PR9kTG_muted{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px}.PR9kTG_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:13px}.PR9kTG_empty{color:var(--dsw-alias-label-secondary);text-align:center;margin:24px 0 0;font-size:13px}.PR9kTG_button{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border-radius:6px;align-self:flex-start;padding:3px 10px;font-size:12px}.PR9kTG_warning{color:var(--dsw-alias-state-warning-primary,var(--dsw-alias-label-secondary));margin:0;font-size:12px}.PR9kTG_note{color:var(--dsw-alias-label-tertiary);margin:0;font-size:11px}.PR9kTG_cards{grid-template-columns:repeat(6,minmax(0,1fr));gap:10px;display:grid}.PR9kTG_tokenStrip{color:var(--dsw-alias-label-secondary);flex-wrap:wrap;gap:18px;padding:6px 2px 0;font-size:12px;display:flex}.PR9kTG_tokenStrip b{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums}.PR9kTG_mid{grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);align-items:start;gap:24px;display:grid}.PR9kTG_chartCol,.PR9kTG_modelCol,.PR9kTG_subagents{flex-direction:column;gap:6px;min-width:0;display:flex}.PR9kTG_subagentsHead,.PR9kTG_chartHead{align-items:center;gap:8px;display:flex}.PR9kTG_subtitle{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;font-weight:600}.PR9kTG_tableWrap{overflow-x:auto}.PR9kTG_table{border-collapse:collapse;font-variant-numeric:tabular-nums;width:100%;min-width:480px;font-size:12px}.PR9kTG_table th,.PR9kTG_table td{text-align:right;border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap;padding:4px 6px}.PR9kTG_table tbody tr{transition:background-color .12s}.PR9kTG_table tbody tr:hover{background-color:var(--dsw-interactive-bg-hover)}.PR9kTG_table th{border-bottom:1.5px solid var(--dsw-alias-border-l2);font-weight:600}.PR9kTG_subagentsWrap{--subagents-row-height:26px;max-height:calc(var(--subagents-row-height) * 16);overflow:hidden}.PR9kTG_subagentsWrap:focus-within{overflow:auto}.PR9kTG_subagentsWrap::-webkit-scrollbar{width:8px;height:8px}.PR9kTG_subagentsWrap::-webkit-scrollbar-track,.PR9kTG_subagentsWrap::-webkit-scrollbar-corner{background:0 0}.PR9kTG_subagentsWrap::-webkit-scrollbar-button{display:none}.PR9kTG_subagentsWrap::-webkit-scrollbar-thumb{background:0 0;border-radius:4px}.PR9kTG_subagentsWrap:focus-within::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent)}.PR9kTG_subagentsWrap:focus-within.PR9kTG_scrolling::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--dsw-alias-label-primary) 22%, transparent)}.PR9kTG_subagentsWrap:focus-visible{outline:2px solid var(--dsw-alias-border-l2);outline-offset:2px}.PR9kTG_subagentsWrap .PR9kTG_table thead tr,.PR9kTG_subagentsWrap .PR9kTG_table tbody tr{height:var(--subagents-row-height)}.PR9kTG_subagentsWrap .PR9kTG_table th{z-index:1;background:var(--dsw-alias-bg-base,var(--dsw-alias-bg-layer-1));position:sticky;top:0}.PR9kTG_costCol{font-weight:600}.PR9kTG_zeroDim{color:var(--dsw-alias-label-tertiary);opacity:.55}.PR9kTG_table th:first-child,.PR9kTG_table td:first-child,.PR9kTG_modelHead{text-align:left}.PR9kTG_modelCell{font-variant-numeric:normal;text-overflow:ellipsis;max-width:180px;overflow:hidden}.PR9kTG_modelIdentity{align-items:center;gap:4px;max-width:180px;display:inline-flex}.PR9kTG_modelName{text-overflow:ellipsis;min-width:0;overflow:hidden}.PR9kTG_childLink{color:var(--dsw-alias-link-primary,var(--dsw-alias-label-primary));cursor:pointer;text-align:left;text-overflow:ellipsis;white-space:nowrap;background:0 0;border:none;max-width:220px;padding:0;font-size:12px;overflow:hidden}.PR9kTG_childLink:hover{text-decoration:underline}.PR9kTG_nestedBadge{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;margin-left:6px;font-size:11px}.PR9kTG_poolSection{flex-direction:column;gap:6px;min-width:0;margin-top:4px;display:flex}.PR9kTG_poolHead{flex-wrap:wrap;justify-content:space-between;align-items:baseline;gap:8px 12px;display:flex}.PR9kTG_poolContext{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:11px}.PR9kTG_poolEmpty{color:var(--dsw-alias-label-secondary);padding:12px 0;font-size:12px}.PR9kTG_latestPanel{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-fill-container,transparent);border-radius:9px;min-width:0;padding:14px 16px}.PR9kTG_requestIdentity{flex-wrap:wrap;align-items:center;gap:6px 10px;min-width:0;display:flex}.PR9kTG_poolBadge{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);white-space:nowrap;border-radius:5px;flex:none;padding:1px 7px;font-size:11px}.PR9kTG_poolState{white-space:nowrap;font-size:11px}.PR9kTG_requestIdentity .PR9kTG_poolState{align-items:center;gap:5px;display:inline-flex}.PR9kTG_statusDot{background:currentColor;border-radius:50%;flex:none;width:5px;height:5px}.PR9kTG_latestPanel .PR9kTG_modelName{font-size:13px;font-weight:500}.PR9kTG_stateDone{color:var(--dsw-alias-state-success-primary,#16a34a)}.PR9kTG_stateFailed{color:var(--dsw-alias-state-error-primary,#dc2626)}.PR9kTG_statePending{color:light-dark(#b45309,#d9ac64)}.PR9kTG_stateStreaming{color:var(--dsw-alias-link-primary,var(--dsw-alias-label-primary))}.PR9kTG_modelInline{white-space:nowrap;align-items:center;gap:6px;min-width:0;max-width:100%;display:inline-flex}.PR9kTG_cacheLoss{color:light-dark(#b45309,#d9ac64);white-space:nowrap;background:light-dark(#fff1d8,#352b1d);border-radius:4px;flex:none;align-items:center;gap:4px;padding:2px 6px;font-size:11px;display:inline-flex}.PR9kTG_cacheLoss svg{flex:none;width:12px;height:12px}.PR9kTG_auxKind{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);white-space:nowrap;border-radius:4px;flex:none;padding:2px 5px;font-size:10px}.PR9kTG_requestMetrics{grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;padding:13px 0;display:grid}.PR9kTG_metricValue{letter-spacing:-.25px;white-space:nowrap;font-variant-numeric:tabular-nums;font-size:23px;font-weight:500}.PR9kTG_metricUnit{color:var(--dsw-alias-label-tertiary);letter-spacing:0;margin-left:4px;font-size:11px}.PR9kTG_metricLabel{color:var(--dsw-alias-label-tertiary);margin-top:2px;font-size:11px}.PR9kTG_requestFooter{border-top:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);flex-wrap:nowrap;justify-content:space-between;align-items:baseline;gap:8px 18px;padding-top:8px;font-size:11px;display:flex}.PR9kTG_requestBuckets{flex-wrap:wrap;flex:none;gap:8px 15px;display:flex}.PR9kTG_requestNote{white-space:nowrap;text-overflow:ellipsis;color:light-dark(#b45309,#d9ac64);flex:0 auto;min-width:0;margin:0;font-size:11px;overflow:hidden}.PR9kTG_requestNoteError{color:var(--dsw-alias-state-error-primary)}.PR9kTG_requestNoteNeutral{color:var(--dsw-alias-label-tertiary)}.PR9kTG_requestFooter b{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:400}.PR9kTG_poolNotice{color:light-dark(#b45309,#d9ac64);margin:4px 0 0;font-size:11px}.PR9kTG_poolTableWrap{overscroll-behavior:contain;max-height:196px;overflow:auto}.PR9kTG_poolTableWrap::-webkit-scrollbar{width:8px;height:8px}.PR9kTG_poolTableWrap::-webkit-scrollbar-track,.PR9kTG_poolTableWrap::-webkit-scrollbar-corner{background:0 0}.PR9kTG_poolTableWrap::-webkit-scrollbar-button{display:none}.PR9kTG_poolTableWrap::-webkit-scrollbar-thumb{background:0 0;border-radius:4px}.PR9kTG_poolTableWrap.PR9kTG_scrolling::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent)}.PR9kTG_poolTableWrap:focus-visible{outline:2px solid var(--dsw-alias-border-l2);outline-offset:2px}.PR9kTG_poolTable{table-layout:fixed;border-collapse:collapse;font-variant-numeric:tabular-nums;width:100%;font-size:11px}.PR9kTG_poolTable th,.PR9kTG_poolTable td{text-align:right;border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap;padding:8px 6px;overflow:hidden}.PR9kTG_poolTable th{z-index:1;background:var(--dsw-alias-bg-base,var(--dsw-alias-bg-layer-1));color:var(--dsw-alias-label-secondary);border-bottom:1.5px solid var(--dsw-alias-border-l2);padding:6px;font-weight:400;position:sticky;top:0}.PR9kTG_poolTable th:nth-child(-n+4),.PR9kTG_poolTable td:nth-child(-n+4){text-align:left}.PR9kTG_poolOrigin,.PR9kTG_poolTime{color:var(--dsw-alias-label-secondary)}.PR9kTG_poolModel,.PR9kTG_poolModel .PR9kTG_modelInline{max-width:200px}.PR9kTG_poolModel .PR9kTG_modelName{text-overflow:ellipsis;min-width:0;overflow:hidden}.PR9kTG_poolModelHead{text-align:left}.PR9kTG_poolTable tbody tr:hover{background-color:var(--dsw-interactive-bg-hover)}@media (prefers-reduced-motion:no-preference){.PR9kTG_latestPanel{animation:.25s ease-out PR9kTG_pool-arrive}@keyframes PR9kTG_pool-arrive{0%{opacity:.4}to{opacity:1}}}@container PR9kTG_usage (width<=900px){.PR9kTG_requestMetrics{grid-template-columns:repeat(3,minmax(0,1fr))}.PR9kTG_poolTableWrap{max-height:230px}}@container PR9kTG_usage (width<=480px){.PR9kTG_poolTableWrap{max-height:240px}.PR9kTG_poolTable thead{display:none}.PR9kTG_poolTable,.PR9kTG_poolTable tbody{min-width:0;display:block}.PR9kTG_poolTable tbody tr{border-bottom:1px solid var(--dsw-alias-border-l1);grid-template-columns:repeat(3,minmax(0,1fr));gap:4px 9px;padding:9px 0;display:grid}.PR9kTG_poolTable td{border-bottom:none;text-align:left!important;padding:0!important}.PR9kTG_poolTable td:nth-child(4){grid-column:1/-1}.PR9kTG_poolTable td:before{content:attr(data-label) \" \";color:var(--dsw-alias-label-tertiary)}.PR9kTG_poolModel,.PR9kTG_poolModel .PR9kTG_modelInline{max-width:100%}.PR9kTG_metricValue{font-size:21px}}@container PR9kTG_usage (width<=900px){.PR9kTG_cards{grid-template-columns:repeat(3,minmax(0,1fr))}.PR9kTG_mid{grid-template-columns:1fr}}@media (width<=600px){.PR9kTG_root{padding-left:12px;padding-right:12px}}";
7288
7511
  const tagId = "@laoyuehanni/dsh-token-usage/UsageView.module.css";
7289
7512
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
7290
7513
  const tag = document.createElement("style");
@@ -7354,6 +7577,7 @@ window.__ModuleLoader__.load({
7354
7577
  "statusDot": "PR9kTG_statusDot",
7355
7578
  "subagents": "PR9kTG_subagents",
7356
7579
  "subagentsHead": "PR9kTG_subagentsHead",
7580
+ "subagentsWrap": "PR9kTG_subagentsWrap",
7357
7581
  "subtitle": "PR9kTG_subtitle",
7358
7582
  "table": "PR9kTG_table",
7359
7583
  "tableWrap": "PR9kTG_tableWrap",
@@ -7973,15 +8197,16 @@ window.__ModuleLoader__.load({
7973
8197
  * pill, 4 token buckets, cost, hit rate, TTFT average, decode throughput) with a
7974
8198
  * scope switch between the session alone and its whole subagent subtree, a
7975
8199
  * per-hour trend chart and the per-model table from the host stats route
7976
- * (`sessionId`-scoped), and a subagent table below — each row drill-in
8200
+ * (`root` + `scope` scoped), and a subagent table below — each row drill-in
7977
8201
  * switches the focus to that child.
7978
8202
  *
7979
8203
  * Data sources: token/cost figures come from the host route (the pricing
7980
- * rule chain's authority); TTFT and throughput come from the framework's
7981
- * retained `sessionStats` projection values (`useProjection` for the current
7982
- * session, `byId[].projectionValues` for every other session), which cover
7983
- * the whole log including history written before this plugin was installed.
7984
- * A footnote states the two scopes so the difference is not a surprise.
8204
+ * rule chain's authority). The header's TTFT and throughput come from the
8205
+ * framework's retained `sessionStats` projection (`useProjection`), which
8206
+ * covers history written before this plugin was installed; the SUBAGENT
8207
+ * table's two timing columns instead read `children[].timing`, folded by the
8208
+ * host from recorded requests (post-install, timed requests only). A
8209
+ * footnote states both scopes so the difference is not a surprise.
7985
8210
  *
7986
8211
  * The root declares `data-conversation-composer-overlay` — the same host
7987
8212
  * opt-in Trajectory uses. ConversationRoot hides the chat-column width
@@ -7998,12 +8223,14 @@ window.__ModuleLoader__.load({
7998
8223
  * full-bleed scroller set this so the chat-column width handles hide and
7999
8224
  * the composer seat overlays instead of stealing clicks over the dashboard. */
8000
8225
  const COMPOSER_OVERLAY = { "data-conversation-composer-overlay": "" };
8001
- /** One fetch of the session-scoped summary from the host stats route,
8002
- * including the direct-child breakdown for the subagent table. */
8003
- function fetchSessionSummary(sessionIds, childGroups, signal) {
8226
+ /** One fetch of the session-scoped summary from the host stats route.
8227
+ * The request carries a RANGE RULE (root + scope), never the enumerated
8228
+ * subtree: the host expands it from its session-metadata lineage, so the URL
8229
+ * stays O(1) however many subagents the conversation has. */
8230
+ function fetchSessionSummary(root, scope, signal) {
8004
8231
  return fetch(STATS_PATH + encodeStatsQuery({
8005
- sessionIds,
8006
- childGroups,
8232
+ root,
8233
+ scope: scope === "tree" ? "subtree" : "self",
8007
8234
  fields: "session"
8008
8235
  }), { signal }).then((response) => {
8009
8236
  if (!response.ok) throw new Error(`HTTP ${String(response.status)}`);
@@ -8034,6 +8261,19 @@ window.__ModuleLoader__.load({
8034
8261
  setRetryToken((token) => token + 1);
8035
8262
  };
8036
8263
  usePricingAssociationRefresh(retry);
8264
+ const subagentsRef = (0, react.useRef)(null);
8265
+ const subagentsTimer = (0, react.useRef)(void 0);
8266
+ (0, react.useEffect)(() => () => window.clearTimeout(subagentsTimer.current), []);
8267
+ const handleSubagentsScroll = () => {
8268
+ const box = subagentsRef.current;
8269
+ const cls = UsageView_module_css_default["scrolling"];
8270
+ if (box === null || cls === void 0) return;
8271
+ box.classList.add(cls);
8272
+ window.clearTimeout(subagentsTimer.current);
8273
+ subagentsTimer.current = window.setTimeout(() => {
8274
+ box.classList.remove(cls);
8275
+ }, 800);
8276
+ };
8037
8277
  const byId = useSessions((state) => state.byId);
8038
8278
  const childIndex = (0, react.useMemo)(() => buildChildIndex(byId), [byId]);
8039
8279
  const scopeIds = (0, react.useMemo)(() => scope === "tree" ? subtreeIds(byId, focusId, childIndex) : [focusId], [
@@ -8047,20 +8287,17 @@ window.__ModuleLoader__.load({
8047
8287
  focusId,
8048
8288
  childIndex
8049
8289
  ]);
8050
- const childGroups = (0, react.useMemo)(() => children.map((id) => scope === "tree" ? subtreeIds(byId, id, childIndex) : [id]), [
8051
- children,
8052
- scope,
8053
- byId,
8054
- childIndex
8055
- ]);
8056
8290
  const backParent = subagentParentOf(byId, focusId);
8057
8291
  const liveStats = useProjection("sessionStats");
8058
- const freshnessKey = buildStatsFreshnessKey([.../* @__PURE__ */ new Set([...scopeIds, ...children])], {
8292
+ const scopedIds = [.../* @__PURE__ */ new Set([...scopeIds, ...children])];
8293
+ const scopeIdsKey = scopedIds.join(",");
8294
+ const freshnessKey = buildStatsFreshnessKey(scopedIds, {
8059
8295
  activeSessionId: sessionId,
8060
8296
  rows: byId,
8061
8297
  liveSessionStats: liveStats
8062
8298
  });
8063
- const debouncedKey = useDebouncedValue(`${scopeIds.join("\n")}\n\t${childGroups.map((group) => group.join(",")).join(";")}\n\t${freshnessKey}`, REFRESH_DEBOUNCE_MS);
8299
+ const scopeKey = `${focusId}\t${scope}`;
8300
+ const debouncedFreshnessKey = useDebouncedValue(freshnessKey, REFRESH_DEBOUNCE_MS, scopeKey);
8064
8301
  const [pollTick, setPollTick] = (0, react.useState)(0);
8065
8302
  const [pollSettle, setPollSettle] = (0, react.useState)(0);
8066
8303
  const [staleAt, setStaleAt] = (0, react.useState)(void 0);
@@ -8068,19 +8305,33 @@ window.__ModuleLoader__.load({
8068
8305
  const pollTimerRef = (0, react.useRef)(void 0);
8069
8306
  const fetchingRef = (0, react.useRef)(false);
8070
8307
  const fetchVersionRef = (0, react.useRef)(0);
8071
- const scopeKey = `${scopeIds.join("\n")}\n\t${childGroups.map((group) => group.join(",")).join(";")}`;
8308
+ /** The last successful read. A late session-mirror / sessionStats delivery
8309
+ * bumps the freshness key inside the first debounce window and reruns the
8310
+ * effect; coalescing that run avoids two identical GETs on opening the tab. */
8311
+ const recentRef = (0, react.useRef)(void 0);
8072
8312
  const [summaryState] = useAsyncResource((signal) => {
8073
8313
  clearTimeout(pollTimerRef.current);
8074
8314
  fetchingRef.current = true;
8075
8315
  const version = ++fetchVersionRef.current;
8076
- const [idsPart, groupsPart] = scopeKey.split("\n ");
8077
- return fetchSessionSummary((idsPart ?? "").split("\n").filter((id) => id !== ""), (groupsPart ?? "").split(";").filter((group) => group !== "").map((group) => group.split(",")), signal).then((value) => {
8316
+ const recent = recentRef.current;
8317
+ const canReuse = recent !== void 0 && !recent.coalesced && recent.idsKey !== scopeIdsKey && recent.scopeKey === scopeKey && recent.retryToken === retryToken && recent.pollTick === pollTick && Date.now() - recent.at < 500;
8318
+ const settle = (value) => {
8319
+ recentRef.current = {
8320
+ scopeKey,
8321
+ idsKey: scopeIdsKey,
8322
+ retryToken,
8323
+ pollTick,
8324
+ at: Date.now(),
8325
+ value,
8326
+ coalesced: canReuse
8327
+ };
8078
8328
  if (!signal.aborted) {
8079
8329
  lastOkAtRef.current = Date.now();
8080
8330
  setStaleAt(void 0);
8081
8331
  }
8082
8332
  return value;
8083
- }).catch((error) => {
8333
+ };
8334
+ return (canReuse && recent !== void 0 ? Promise.resolve(recent.value) : fetchSessionSummary(focusId, scope, signal)).then(settle).catch((error) => {
8084
8335
  if (!signal.aborted && lastOkAtRef.current !== void 0) setStaleAt(lastOkAtRef.current);
8085
8336
  throw error;
8086
8337
  }).finally(() => {
@@ -8090,7 +8341,7 @@ window.__ModuleLoader__.load({
8090
8341
  }
8091
8342
  });
8092
8343
  }, [
8093
- debouncedKey.split("\n ")[2],
8344
+ debouncedFreshnessKey,
8094
8345
  retryToken,
8095
8346
  pollTick
8096
8347
  ], {
@@ -8122,19 +8373,12 @@ window.__ModuleLoader__.load({
8122
8373
  document.removeEventListener("visibilitychange", onVisibility);
8123
8374
  };
8124
8375
  }, []);
8125
- const stats = (0, react.useMemo)(() => {
8126
- return aggregateProjections(scopeIds.map((id) => {
8127
- if (id === sessionId) return liveStats;
8128
- return byId[id]?.projectionValues?.sessionStats;
8129
- }));
8130
- }, [
8376
+ const mirrorStats = (0, react.useMemo)(() => aggregateScopedProjections(scopeIds, byId, sessionId, liveStats), [
8131
8377
  scopeIds,
8378
+ byId,
8132
8379
  sessionId,
8133
- liveStats,
8134
- byId
8380
+ liveStats
8135
8381
  ]);
8136
- const ttftText = stats !== void 0 && stats.ttftSteps > 0 ? formatTtft(stats.ttftMs / stats.ttftSteps) : "—";
8137
- const speedText = stats !== void 0 && stats.decodeMs > 0 ? formatSpeed(stats.decodeTokens / (stats.decodeMs / 1e3)) : "—";
8138
8382
  const header = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
8139
8383
  className: UsageView_module_css_default["head"],
8140
8384
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -8201,6 +8445,15 @@ window.__ModuleLoader__.load({
8201
8445
  })
8202
8446
  });
8203
8447
  const summary = summaryState.value;
8448
+ const headerTiming = resolveHeaderTiming({
8449
+ isSoloActive: scope === "session" && focusId === sessionId,
8450
+ liveStats,
8451
+ mirrorAggregate: mirrorStats,
8452
+ serverTiming: summary.timing,
8453
+ totalPerf: summary.total
8454
+ });
8455
+ const ttftText = headerTiming.ttftMs !== void 0 ? formatTtft(headerTiming.ttftMs) : "—";
8456
+ const speedText = headerTiming.tokensPerSec !== void 0 ? formatSpeed(headerTiming.tokensPerSec) : "—";
8204
8457
  const view = currencyViewOf(summary);
8205
8458
  const { total } = summary;
8206
8459
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -8436,7 +8689,12 @@ window.__ModuleLoader__.load({
8436
8689
  className: UsageView_module_css_default["muted"],
8437
8690
  children: t("view.subagents.none")
8438
8691
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8439
- className: UsageView_module_css_default["tableWrap"],
8692
+ ref: subagentsRef,
8693
+ onScroll: handleSubagentsScroll,
8694
+ className: UsageView_module_css_default["subagentsWrap"],
8695
+ tabIndex: 0,
8696
+ role: "region",
8697
+ "aria-label": t("view.subagents.scroll"),
8440
8698
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
8441
8699
  className: UsageView_module_css_default["table"],
8442
8700
  "aria-label": t("view.subagents.title", { count: String(children.length) }),
@@ -8454,7 +8712,7 @@ window.__ModuleLoader__.load({
8454
8712
  ] }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: children.map((id) => {
8455
8713
  const child = byId[id];
8456
8714
  const row = summary.children?.[id];
8457
- const childStats = aggregateProjections([byId[id]?.projectionValues?.sessionStats]);
8715
+ const timing = row?.timing;
8458
8716
  const nestedCount = directSubagentIds(byId, id, childIndex).length;
8459
8717
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
8460
8718
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("td", {
@@ -8481,8 +8739,8 @@ window.__ModuleLoader__.load({
8481
8739
  children: row !== void 0 && costsAvailable(summary.costState) && costsAvailable(row.costState) ? formatCost(row.totalCost, view) : "—"
8482
8740
  }),
8483
8741
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: row !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HitRateText, { totals: row.total }) : "—" }),
8484
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: childStats !== void 0 && childStats.ttftSteps > 0 ? formatTtft(childStats.ttftMs / childStats.ttftSteps) : "—" }),
8485
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: childStats !== void 0 && childStats.decodeMs > 0 ? `${formatSpeed(childStats.decodeTokens / (childStats.decodeMs / 1e3))} tok/s` : "—" })
8742
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: timing !== void 0 && timing.ttftSteps > 0 ? formatTtft(timing.ttftMs / timing.ttftSteps) : "—" }),
8743
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: timing !== void 0 && timing.decodeMs > 0 ? `${formatSpeed(timing.decodeTokens / (timing.decodeMs / 1e3))} tok/s` : "—" })
8486
8744
  ] }, id);
8487
8745
  }) })]
8488
8746
  })
@@ -8588,15 +8846,31 @@ window.__ModuleLoader__.load({
8588
8846
  "fail.TIMEOUT": "超时",
8589
8847
  "fail.TRANSPORT": "网络异常",
8590
8848
  "fail.EMPTY_RESPONSE": "空响应",
8849
+ "fail.CONTENT_REFUSED": "内容安全拒绝",
8591
8850
  "fail.QUOTA": "配额耗尽",
8851
+ "fail.ACCOUNT_QUOTA": "账号余额不足",
8852
+ "fail.ACCOUNT_SIGN_IN_REQUIRED": "需要登录账号",
8853
+ "fail.ACCOUNT_TOKEN_INVALID": "账号凭证无效",
8854
+ "fail.CLIENT_UPGRADE_REQUIRED": "需要升级客户端",
8592
8855
  "fail.CONTEXT_WINDOW_EXCEEDED": "上下文超限",
8593
8856
  "fail.INVALID_CREDENTIAL": "凭证无效",
8594
8857
  "fail.AUTH": "鉴权失败",
8595
8858
  "fail.INVALID_REQUEST": "请求无效",
8859
+ "fail.INVALID_RESPONSE": "响应无效",
8596
8860
  "fail.MISSING_CREDENTIAL": "缺少凭证",
8597
8861
  "fail.ABORTED": "已中止",
8598
8862
  "fail.REQUEST_EXTENSION": "请求扩展失败",
8863
+ "fail.REQUEST_HEADERS": "请求头异常",
8599
8864
  "fail.FILES_API": "文件接口异常",
8865
+ "fail.IMAGE_OFFLOAD_REQUIRED": "图片需转存",
8866
+ "fail.MODEL_SWITCH_COMPACTION_FAILED": "切模型压缩失败",
8867
+ "fail.MODEL_UNSUPPORTED": "模型不支持",
8868
+ "fail.UNKNOWN_MODEL": "未知模型",
8869
+ "fail.NO_ADAPTER": "未注册适配器",
8870
+ "fail.PI_AI_ERROR": "适配器异常",
8871
+ "fail.UNSUPPORTED_CONTENT": "不支持的内容",
8872
+ "fail.UNSUPPORTED_OPTION": "不支持的参数",
8873
+ "fail.UNSUPPORTED_REASONING_EFFORT": "不支持的推理强度",
8600
8874
  "fail.STREAM_CLOSED": "流中断",
8601
8875
  "fail.MALFORMED_RESPONSE": "响应异常",
8602
8876
  "fail.UNKNOWN": "未知错误",
@@ -8628,6 +8902,7 @@ window.__ModuleLoader__.load({
8628
8902
  "aux.kind": "类别",
8629
8903
  "aux.kind.auto-review": "自动审查",
8630
8904
  "aux.kind.session-title": "标题生成",
8905
+ "aux.kind.timeline-report": "时间线报告",
8631
8906
  "aux.kind.translation": "推理翻译",
8632
8907
  "aux.kind.other": "其他",
8633
8908
  "aux.requests": "次数",
@@ -8637,6 +8912,10 @@ window.__ModuleLoader__.load({
8637
8912
  "aux.totalCount": "合计 · {count} 次",
8638
8913
  "aux.requestCount": "{count} 次",
8639
8914
  "aux.tooltipTotal": "运行开销 · 合计",
8915
+ "web.title": "联网工具",
8916
+ "web.tool.web_search": "联网搜索",
8917
+ "web.tool.web_fetch": "网页抓取",
8918
+ "web.calls": "{count} 次",
8640
8919
  "board.projects": "项目",
8641
8920
  "board.sessions": "会话",
8642
8921
  "board.models": "模型",
@@ -8732,6 +9011,7 @@ window.__ModuleLoader__.load({
8732
9011
  "card.fullSync.running": "扫描中…",
8733
9012
  "card.fullSync.progress": "已处理 {processed}/{total} 个 session,新增 {added} 条,跳过 {skipped} 条,删除 {removed} 条",
8734
9013
  "card.fullSync.failuresNote": ",无法读取 {count} 个 session 已跳过",
9014
+ "card.fullSync.importedNote": ",忽略 {count} 条 DeepSeek chat 导入记录",
8735
9015
  "card.fullSync.done": "扫描完成:新增 {added} 条,跳过 {skipped} 条,删除 {removed} 条",
8736
9016
  "card.fullSync.failed": "扫描失败:{error}",
8737
9017
  "loadFailed": "统计加载失败:{message}",
@@ -8761,7 +9041,8 @@ window.__ModuleLoader__.load({
8761
9041
  "view.subagents.none": "无子会话",
8762
9042
  "view.subagents.titleCol": "会话",
8763
9043
  "view.subagents.nested": "含 {count} 个子会话",
8764
- "view.note": "注:token 与费用来自本插件的请求记录(安装后);平均首token 与 token速度来自 DSH 会话投影(含安装前历史)。",
9044
+ "view.subagents.scroll": "子会话列表,点击后可在此滚动",
9045
+ "view.note": "注:token 与费用来自本插件请求记录;当前单会话顶部平均首token 与 token速度优先来自 DSH 会话投影(含无日志历史),含子会话、子会话详情及子会话表来自本插件有计时的请求记录。",
8765
9046
  "pool.latest.title": "最新请求",
8766
9047
  "pool.latest.context": "单次请求 · 非会话均值",
8767
9048
  "pool.title": "实时请求",
@@ -8783,6 +9064,7 @@ window.__ModuleLoader__.load({
8783
9064
  "pool.kind.compaction": "压缩",
8784
9065
  "pool.kind.auto-review": "审查",
8785
9066
  "pool.kind.session-title": "标题",
9067
+ "pool.kind.timeline-report": "时间线",
8786
9068
  "pool.kind.translation": "翻译",
8787
9069
  "pool.kind.other": "辅助",
8788
9070
  "pool.attribution.prefix": "此请求发出前,宿主的压缩操作改写了上下文前缀,缓存表现可能受影响:",
@@ -8954,15 +9236,31 @@ window.__ModuleLoader__.load({
8954
9236
  "fail.TIMEOUT": "Timed out",
8955
9237
  "fail.TRANSPORT": "Network error",
8956
9238
  "fail.EMPTY_RESPONSE": "Empty response",
9239
+ "fail.CONTENT_REFUSED": "Content refused",
8957
9240
  "fail.QUOTA": "Quota exceeded",
9241
+ "fail.ACCOUNT_QUOTA": "Account quota exceeded",
9242
+ "fail.ACCOUNT_SIGN_IN_REQUIRED": "Sign-in required",
9243
+ "fail.ACCOUNT_TOKEN_INVALID": "Account token invalid",
9244
+ "fail.CLIENT_UPGRADE_REQUIRED": "Client upgrade required",
8958
9245
  "fail.CONTEXT_WINDOW_EXCEEDED": "Context exceeded",
8959
9246
  "fail.INVALID_CREDENTIAL": "Invalid credential",
8960
9247
  "fail.AUTH": "Auth failed",
8961
9248
  "fail.INVALID_REQUEST": "Invalid request",
9249
+ "fail.INVALID_RESPONSE": "Invalid response",
8962
9250
  "fail.MISSING_CREDENTIAL": "Missing credential",
8963
9251
  "fail.ABORTED": "Aborted",
8964
9252
  "fail.REQUEST_EXTENSION": "Request extension failed",
9253
+ "fail.REQUEST_HEADERS": "Request headers error",
8965
9254
  "fail.FILES_API": "Files API error",
9255
+ "fail.IMAGE_OFFLOAD_REQUIRED": "Image offload required",
9256
+ "fail.MODEL_SWITCH_COMPACTION_FAILED": "Model switch compaction failed",
9257
+ "fail.MODEL_UNSUPPORTED": "Model unsupported",
9258
+ "fail.UNKNOWN_MODEL": "Unknown model",
9259
+ "fail.NO_ADAPTER": "No adapter",
9260
+ "fail.PI_AI_ERROR": "Adapter error",
9261
+ "fail.UNSUPPORTED_CONTENT": "Unsupported content",
9262
+ "fail.UNSUPPORTED_OPTION": "Unsupported option",
9263
+ "fail.UNSUPPORTED_REASONING_EFFORT": "Unsupported reasoning effort",
8966
9264
  "fail.STREAM_CLOSED": "Stream closed",
8967
9265
  "fail.MALFORMED_RESPONSE": "Malformed response",
8968
9266
  "fail.UNKNOWN": "Unknown error",
@@ -8994,6 +9292,7 @@ window.__ModuleLoader__.load({
8994
9292
  "aux.kind": "Category",
8995
9293
  "aux.kind.auto-review": "Auto review",
8996
9294
  "aux.kind.session-title": "Session titles",
9295
+ "aux.kind.timeline-report": "Timeline reports",
8997
9296
  "aux.kind.translation": "Translation",
8998
9297
  "aux.kind.other": "Other",
8999
9298
  "aux.requests": "Calls",
@@ -9003,6 +9302,10 @@ window.__ModuleLoader__.load({
9003
9302
  "aux.totalCount": "Total · {count}",
9004
9303
  "aux.requestCount": "{count} calls",
9005
9304
  "aux.tooltipTotal": "Overhead · total",
9305
+ "web.title": "Web tools",
9306
+ "web.tool.web_search": "Web search",
9307
+ "web.tool.web_fetch": "Web fetch",
9308
+ "web.calls": "{count} calls",
9006
9309
  "board.projects": "Projects",
9007
9310
  "board.sessions": "Sessions",
9008
9311
  "board.models": "Models",
@@ -9098,6 +9401,7 @@ window.__ModuleLoader__.load({
9098
9401
  "card.fullSync.running": "Scanning…",
9099
9402
  "card.fullSync.progress": "Processed {processed}/{total} sessions, added {added}, skipped {skipped}, removed {removed}",
9100
9403
  "card.fullSync.failuresNote": ", {count} unreadable sessions skipped",
9404
+ "card.fullSync.importedNote": ", {count} DeepSeek chat imported records ignored",
9101
9405
  "card.fullSync.done": "Scan complete: added {added}, skipped {skipped}, removed {removed}",
9102
9406
  "card.fullSync.failed": "Scan failed: {error}",
9103
9407
  "loadFailed": "Failed to load stats: {message}",
@@ -9127,7 +9431,8 @@ window.__ModuleLoader__.load({
9127
9431
  "view.subagents.none": "No subagents",
9128
9432
  "view.subagents.titleCol": "Session",
9129
9433
  "view.subagents.nested": "With {count} subagents",
9130
- "view.note": "Note: tokens and cost come from this plugin's request log (post-install); average TTFT and token speed come from the DSH session projection (includes pre-install history).",
9434
+ "view.subagents.scroll": "Subagent list — click it to scroll inside",
9435
+ "view.note": "Note: tokens and cost come from this plugin's request log; solo-session header TTFT and token speed prefer the DSH session projection (covers history without logs), while subtree, subagent, and subagent-table timing come from this plugin's timed request records.",
9131
9436
  "pool.latest.title": "Latest request",
9132
9437
  "pool.latest.context": "single request · not a session mean",
9133
9438
  "pool.title": "Live requests",
@@ -9149,6 +9454,7 @@ window.__ModuleLoader__.load({
9149
9454
  "pool.kind.compaction": "Compaction",
9150
9455
  "pool.kind.auto-review": "Review",
9151
9456
  "pool.kind.session-title": "Title",
9457
+ "pool.kind.timeline-report": "Timeline",
9152
9458
  "pool.kind.translation": "Translation",
9153
9459
  "pool.kind.other": "Auxiliary",
9154
9460
  "pool.attribution.prefix": "Before this request, host compaction rewrote the context prefix; cache behaviour may be affected:",