@laoyuehanni/dsh-token-usage 0.4.3 → 0.4.5

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 (87) hide show
  1. package/README.md +4 -3
  2. package/README.zh.md +4 -3
  3. package/lib/client/CostDeltaFlyLabel.js +1 -1
  4. package/lib/client/CostDeltaFlyLabel.js.map +1 -1
  5. package/lib/client/CostPill.d.ts +74 -0
  6. package/lib/client/CostPill.d.ts.map +1 -0
  7. package/lib/client/CostPill.js +242 -0
  8. package/lib/client/CostPill.js.map +1 -0
  9. package/lib/client/SessionTable.d.ts.map +1 -1
  10. package/lib/client/SessionTable.js +10 -4
  11. package/lib/client/SessionTable.js.map +1 -1
  12. package/lib/client/TokenUsageCard.d.ts +7 -2
  13. package/lib/client/TokenUsageCard.d.ts.map +1 -1
  14. package/lib/client/TokenUsageCard.js +11 -4
  15. package/lib/client/TokenUsageCard.js.map +1 -1
  16. package/lib/client/TokenUsageSection.d.ts +4 -1
  17. package/lib/client/TokenUsageSection.d.ts.map +1 -1
  18. package/lib/client/TokenUsageSection.js +30 -4
  19. package/lib/client/TokenUsageSection.js.map +1 -1
  20. package/lib/client/TrendChart.d.ts +1 -1
  21. package/lib/client/TrendChart.d.ts.map +1 -1
  22. package/lib/client/TrendChart.js +39 -15
  23. package/lib/client/TrendChart.js.map +1 -1
  24. package/lib/client/UsageView.js +2 -2
  25. package/lib/client/UsageView.js.map +1 -1
  26. package/lib/client/card-form.d.ts +33 -4
  27. package/lib/client/card-form.d.ts.map +1 -1
  28. package/lib/client/card-form.js +20 -8
  29. package/lib/client/card-form.js.map +1 -1
  30. package/lib/client/cost-inflate-motion.d.ts +7 -2
  31. package/lib/client/cost-inflate-motion.d.ts.map +1 -1
  32. package/lib/client/cost-inflate-motion.js +14 -10
  33. package/lib/client/cost-inflate-motion.js.map +1 -1
  34. package/lib/client/format.d.ts +7 -5
  35. package/lib/client/format.d.ts.map +1 -1
  36. package/lib/client/format.js +11 -7
  37. package/lib/client/format.js.map +1 -1
  38. package/lib/client/index.d.ts +18 -3
  39. package/lib/client/index.d.ts.map +1 -1
  40. package/lib/client/index.js +154 -47
  41. package/lib/client/index.js.map +1 -1
  42. package/lib/client/locales.d.ts +13 -3
  43. package/lib/client/locales.d.ts.map +1 -1
  44. package/lib/client/locales.js +26 -6
  45. package/lib/client/locales.js.map +1 -1
  46. package/lib/client/trend-chart/index.d.ts +1 -1
  47. package/lib/client/trend-chart/index.d.ts.map +1 -1
  48. package/lib/client/trend-chart/index.js +1 -1
  49. package/lib/client/trend-chart/index.js.map +1 -1
  50. package/lib/client/trend-chart/path.d.ts +46 -0
  51. package/lib/client/trend-chart/path.d.ts.map +1 -1
  52. package/lib/client/trend-chart/path.js +140 -0
  53. package/lib/client/trend-chart/path.js.map +1 -1
  54. package/lib/client/use-color-scheme.d.ts +6 -0
  55. package/lib/client/use-color-scheme.d.ts.map +1 -1
  56. package/lib/client/use-color-scheme.js +53 -1
  57. package/lib/client/use-color-scheme.js.map +1 -1
  58. package/lib/client/use-cost-inflate.d.ts +4 -4
  59. package/lib/client/use-cost-inflate.js +5 -5
  60. package/lib/client/use-cost-inflate.js.map +1 -1
  61. package/lib/client.js +1913 -1250
  62. package/lib/client.js.map +1 -1
  63. package/lib/index.d.ts +30 -52
  64. package/lib/index.d.ts.map +1 -1
  65. package/lib/index.js +140 -133
  66. package/lib/index.js.map +1 -1
  67. package/lib/stats.d.ts +1 -1
  68. package/lib/stats.d.ts.map +1 -1
  69. package/lib/stats.js +1 -1
  70. package/lib/stats.js.map +1 -1
  71. package/lib/sync-state.d.ts +17 -6
  72. package/lib/sync-state.d.ts.map +1 -1
  73. package/lib/sync-state.js +28 -6
  74. package/lib/sync-state.js.map +1 -1
  75. package/lib/sync.d.ts +25 -0
  76. package/lib/sync.d.ts.map +1 -1
  77. package/lib/sync.js +35 -4
  78. package/lib/sync.js.map +1 -1
  79. package/lib/usage-log.d.ts +14 -0
  80. package/lib/usage-log.d.ts.map +1 -1
  81. package/lib/usage-log.js +128 -1
  82. package/lib/usage-log.js.map +1 -1
  83. package/lib/usage-record.d.ts +20 -2
  84. package/lib/usage-record.d.ts.map +1 -1
  85. package/lib/usage-record.js +74 -3
  86. package/lib/usage-record.js.map +1 -1
  87. package/package.json +42 -36
package/README.md CHANGED
@@ -105,11 +105,12 @@ Data files under `$DSH_HOME/token-usage/` are kept — delete them manually if y
105
105
  Build once, install a symlink, iterate:
106
106
 
107
107
  ```sh
108
- npm install
109
- npm run build && npm run build:client
108
+ pnpm install
109
+ pnpm build:all
110
+ pnpm test # vitest
110
111
  dsh plugin --profile web add link:D:/plugins/dsh-token-usage
111
112
  ```
112
113
 
113
- Rebuild and restart `dsh web` to apply changes (`npx tsdown --watch` in the plugin directory hot-reloads the client). No `prepare` script by design — `lib/` never enters the repo; `npm publish` builds it fresh into the tarball.
114
+ Rebuild and restart `dsh web` to apply changes (`pnpm watch:client` in the plugin directory hot-reloads the client). No `prepare` script by design — `lib/` never enters the repo; `pnpm publish` builds it fresh into the tarball.
114
115
 
115
116
  Temporary host-only mount (this launch only, no profile changes): copy `cordis.example.yml` to `cordis.yml`, point `name` at the absolute `file://` URL of your `lib/index.js`, then `dsh web --patch <plugin-dir>/cordis.yml`. Data recording works in this mode; for UI work use the `link:` install above.
package/README.zh.md CHANGED
@@ -105,11 +105,12 @@ dsh plugin --profile web remove @laoyuehanni/dsh-token-usage
105
105
  构建一次、装符号链接、迭代:
106
106
 
107
107
  ```sh
108
- npm install
109
- npm run build && npm run build:client
108
+ pnpm install
109
+ pnpm build:all
110
+ pnpm test # vitest
110
111
  dsh plugin --profile web add link:D:/plugins/dsh-token-usage
111
112
  ```
112
113
 
113
- 重新构建并重启 `dsh web` 即生效(插件目录跑 `npx tsdown --watch` 可热重载客户端)。刻意不设 `prepare` 脚本——`lib/` 从不进仓库,`npm publish` 现场构建打进 tarball。
114
+ 重新构建并重启 `dsh web` 即生效(插件目录跑 `pnpm watch:client` 可热重载客户端)。刻意不设 `prepare` 脚本——`lib/` 从不进仓库,`pnpm publish` 现场构建打进 tarball。
114
115
 
115
116
  临时挂载(仅当次启动生效,不动 profile):复制 `cordis.example.yml` 为 `cordis.yml`,把 `name` 改成你机器上 `lib/index.js` 的绝对 `file://` URL,然后 `dsh web --patch <插件目录>/cordis.yml`。此模式数据记录照常,开发 UI 请用上面的 `link:` 安装。
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useLayoutEffect, useRef } from 'react';
3
3
  import { runDeltaFly } from "./cost-inflate-motion.js";
4
- import styles from './SessionStatsChip.module.css';
4
+ import styles from './CostPill.module.css';
5
5
  /** One +Δ fly label; animation starts on mount via WAAPI. */
6
6
  export function CostDeltaFlyLabel({ text, vars }) {
7
7
  const ref = useRef(null);
@@ -1 +1 @@
1
- {"version":3,"file":"CostDeltaFlyLabel.js","sourceRoot":"","sources":["../../src/client/CostDeltaFlyLabel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,MAAM,MAAM,+BAA+B,CAAA;AAElD,6DAA6D;AAC7D,MAAM,UAAU,iBAAiB,CAAC,EAAE,IAAI,EAAE,IAAI,EAA2C;IACvF,MAAM,GAAG,GAAG,MAAM,CAAkB,IAAI,CAAC,CAAA;IAEzC,eAAe,CAAC,GAAG,EAAE;QACnB,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAA;QACtB,IAAI,EAAE,KAAK,IAAI;YAAE,OAAM;QACvB,MAAM,IAAI,GAAG,WAAW,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;QAClC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,sEAAsE;YACtE,qEAAqE;YACrE,mDAAmD;YACnD,EAAE,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAA;YAC9B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CAAA;AACH,CAAC"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Composer-dock usage pill (browser half): a cost trigger registered into
3
+ * the `conversation.composer.dock` slot (`order: 10`, after the official
4
+ * stats pills at `order: 0`), rendered as one capsule in the official
5
+ * StatsPills skin. The figure is the WITH-SUBAGENTS fold — the one number
6
+ * no official surface carries — suffixed with a quiet "with subagents"
7
+ * badge only when the scope actually spans a subtree; a solo session's
8
+ * cost renders bare, same scope as the official pills beside it.
9
+ *
10
+ * Clicking opens a detail panel (harness menu chrome, upward of the dock)
11
+ * that explains the total: the folded token figure and cache-hit rate next
12
+ * to it (official pills carry only the single-session token count, so the
13
+ * subtree share has no home but here), the session / subagents split, and
14
+ * a per-model breakdown with the unpriced-models footnote. Panel data is
15
+ * LAZY: the trigger polls `fields=chip` (totals only, subtree scope); the
16
+ * two richer reads (`fields=session` for byModel, a solo-session `chip`
17
+ * read for the split) fire when the panel first opens and again whenever
18
+ * request churn debounces through.
19
+ *
20
+ * The pill refreshes at REQUEST granularity (the header chip's former
21
+ * cadence, inherited whole): `sessionStats` projection churn plus mirror
22
+ * `updatedAt` is debounced 250 ms into one fetch, a failed FIRST fetch
23
+ * retries itself on a 3 s cadence, and later failures keep the prior
24
+ * figures. When cost rises on a new request the figure plays `costPop`
25
+ * and a +Δ label FALLS below the pill (the dock sits under the composer;
26
+ * the header chip's upward rise would climb into the message scrollport).
27
+ * Reduced-motion users get silent figure updates.
28
+ *
29
+ * Visibility contract: a session with no recorded requests renders
30
+ * nothing; a transient fetch miss keeps the previous render.
31
+ *
32
+ * @module token-usage/client/CostPill
33
+ */
34
+ import type { ReactNode } from 'react';
35
+ import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
36
+ import type { UsageSummary } from '../wire.ts';
37
+ /** Self-heal cadence after a failed first fetch: refresh failures after the
38
+ * first land keep the prior figures (silent mode) and self-heal on the next
39
+ * request churn, so they never reach the error state. */
40
+ export declare const FETCH_FAILURE_RETRY_MS = 3000;
41
+ /** Props the pill binds for the composer-dock slot: the framework's session
42
+ * kit (`sessionId` + the global `useSessions` mirror used to walk the
43
+ * subagent tree) plus the locale seat from the registration's `locale:`
44
+ * declaration. The dock slot declares no owner share. */
45
+ export type CostPillProps = PropsRuntime<'conversation.composer.dock'> & PropsLocale<'token-usage'>;
46
+ /**
47
+ * The session / subagents split of one folded summary. Subagent figures are
48
+ * derived by subtraction (folded minus solo) and clamped at zero — a stale
49
+ * solo read against a fresher fold must never paint a negative share.
50
+ */
51
+ export interface UsageSplit {
52
+ selfCost: number;
53
+ subsCost: number;
54
+ selfTokens: number;
55
+ subsTokens: number;
56
+ }
57
+ /**
58
+ * Subtract a solo-session summary from its subtree fold.
59
+ * @param tree - the subtree-scoped folded summary.
60
+ * @param self - the solo-session summary (same session, no children).
61
+ * @returns the two shares; costs and tokens are additive so subtraction is
62
+ * exact, and the hit rate is NEVER split (a ratio is not subtractable — the
63
+ * panel recomputes the folded rate from the tree totals instead).
64
+ */
65
+ export declare function splitUsage(tree: UsageSummary, self: UsageSummary): UsageSplit;
66
+ /**
67
+ * Render the composer-dock usage pill for the active session. Renders
68
+ * nothing when the session has no recorded usage or while the first fetch
69
+ * is in flight — the "data has no value, the block does not render" rule.
70
+ * @param props - framework session id, the session-list mirror, and the locale seat.
71
+ * @returns the pill (plus its open detail panel), or null when empty/unavailable.
72
+ */
73
+ export declare function CostPill({ sessionId, useSessions, useProjection, t }: CostPillProps): ReactNode | null;
74
+ //# sourceMappingURL=CostPill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CostPill.d.ts","sourceRoot":"","sources":["../../src/client/CostPill.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAQjF,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,YAAY,CAAA;AAe9D;;yDAEyD;AACzD,eAAO,MAAM,sBAAsB,OAAQ,CAAA;AAM3C;;;yDAGyD;AACzD,MAAM,MAAM,aAAa,GACvB,YAAY,CAAC,4BAA4B,CAAC,GACxC,WAAW,CAAC,aAAa,CAAC,CAAA;AAE9B;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,GAAG,UAAU,CAQ7E;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,EAAE,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI,CA8NtG"}
@@ -0,0 +1,242 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /**
3
+ * Composer-dock usage pill (browser half): a cost trigger registered into
4
+ * the `conversation.composer.dock` slot (`order: 10`, after the official
5
+ * stats pills at `order: 0`), rendered as one capsule in the official
6
+ * StatsPills skin. The figure is the WITH-SUBAGENTS fold — the one number
7
+ * no official surface carries — suffixed with a quiet "with subagents"
8
+ * badge only when the scope actually spans a subtree; a solo session's
9
+ * cost renders bare, same scope as the official pills beside it.
10
+ *
11
+ * Clicking opens a detail panel (harness menu chrome, upward of the dock)
12
+ * that explains the total: the folded token figure and cache-hit rate next
13
+ * to it (official pills carry only the single-session token count, so the
14
+ * subtree share has no home but here), the session / subagents split, and
15
+ * a per-model breakdown with the unpriced-models footnote. Panel data is
16
+ * LAZY: the trigger polls `fields=chip` (totals only, subtree scope); the
17
+ * two richer reads (`fields=session` for byModel, a solo-session `chip`
18
+ * read for the split) fire when the panel first opens and again whenever
19
+ * request churn debounces through.
20
+ *
21
+ * The pill refreshes at REQUEST granularity (the header chip's former
22
+ * cadence, inherited whole): `sessionStats` projection churn plus mirror
23
+ * `updatedAt` is debounced 250 ms into one fetch, a failed FIRST fetch
24
+ * retries itself on a 3 s cadence, and later failures keep the prior
25
+ * figures. When cost rises on a new request the figure plays `costPop`
26
+ * and a +Δ label FALLS below the pill (the dock sits under the composer;
27
+ * the header chip's upward rise would climb into the message scrollport).
28
+ * Reduced-motion users get silent figure updates.
29
+ *
30
+ * Visibility contract: a session with no recorded requests renders
31
+ * nothing; a transient fetch miss keeps the previous render.
32
+ *
33
+ * @module token-usage/client/CostPill
34
+ */
35
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
36
+ import { STATS_PATH, encodeStatsQuery } from "../wire.js";
37
+ import { useAsyncResource, useDebouncedValue } from "./async-resource.js";
38
+ import { totalTokens } from "./day.js";
39
+ import { currencyViewOf, formatCost, formatTokens, hitRateDisplay } from "./format.js";
40
+ import { buildChildIndex, buildStatsFreshnessKey, subtreeIds } from "./session-stats.js";
41
+ import { useColorSchemeMirror } from "./use-color-scheme.js";
42
+ import { CostDeltaFlyLabel } from "./CostDeltaFlyLabel.js";
43
+ import { useCostInflate } from "./use-cost-inflate.js";
44
+ import styles from './CostPill.module.css';
45
+ /** Refresh debounce: bursts of session-mirror updates (one request's events)
46
+ * collapse into a single fetch — the header chip's request-scale cadence. */
47
+ const REFRESH_DEBOUNCE_MS = 250;
48
+ /** Self-heal cadence after a failed first fetch: refresh failures after the
49
+ * first land keep the prior figures (silent mode) and self-heal on the next
50
+ * request churn, so they never reach the error state. */
51
+ export const FETCH_FAILURE_RETRY_MS = 3_000;
52
+ /** Detail panel width (px); the viewport-clamped centering uses it. */
53
+ const PANEL_WIDTH = 300;
54
+ const PANEL_VIEWPORT_MARGIN = 16;
55
+ /**
56
+ * Subtract a solo-session summary from its subtree fold.
57
+ * @param tree - the subtree-scoped folded summary.
58
+ * @param self - the solo-session summary (same session, no children).
59
+ * @returns the two shares; costs and tokens are additive so subtraction is
60
+ * exact, and the hit rate is NEVER split (a ratio is not subtractable — the
61
+ * panel recomputes the folded rate from the tree totals instead).
62
+ */
63
+ export function splitUsage(tree, self) {
64
+ const sub = (whole, part) => (whole - part > 0 ? whole - part : 0);
65
+ return {
66
+ selfCost: self.totalCost,
67
+ subsCost: sub(tree.totalCost, self.totalCost),
68
+ selfTokens: totalTokens(self.total),
69
+ subsTokens: sub(totalTokens(tree.total), totalTokens(self.total)),
70
+ };
71
+ }
72
+ /**
73
+ * Render the composer-dock usage pill for the active session. Renders
74
+ * nothing when the session has no recorded usage or while the first fetch
75
+ * is in flight — the "data has no value, the block does not render" rule.
76
+ * @param props - framework session id, the session-list mirror, and the locale seat.
77
+ * @returns the pill (plus its open detail panel), or null when empty/unavailable.
78
+ */
79
+ export function CostPill({ sessionId, useSessions, useProjection, t }) {
80
+ const rootRef = useRef(null);
81
+ const costRef = useRef(null);
82
+ useColorSchemeMirror(rootRef);
83
+ const [open, setOpen] = useState(false);
84
+ // Same membership as the Usage tab's "with subagents" scope: the active
85
+ // session plus every origin=subagent descendant. An ordinary fork is not
86
+ // a subagent and does not join the fold.
87
+ const byId = useSessions(state => state.byId);
88
+ const childIndex = useMemo(() => buildChildIndex(byId), [byId]);
89
+ const scopeIds = useMemo(() => (sessionId === '' ? [] : subtreeIds(byId, sessionId, childIndex)), [byId, sessionId, childIndex]);
90
+ const hasSubs = scopeIds.length > 1;
91
+ const liveStats = useProjection('sessionStats');
92
+ const freshnessKey = buildStatsFreshnessKey(scopeIds, {
93
+ activeSessionId: sessionId,
94
+ rows: byId,
95
+ liveSessionStats: liveStats,
96
+ });
97
+ const requestKey = `${scopeIds.join('\n')}\n\t${freshnessKey}`;
98
+ const debouncedKey = useDebouncedValue(requestKey, REFRESH_DEBOUNCE_MS);
99
+ const scopeResetKey = scopeIds.join('\n');
100
+ const { flies, onSummary } = useCostInflate(scopeResetKey, costRef);
101
+ // The trigger's poll: subtree totals only (`fields=chip`), the lightest
102
+ // read that feeds cost / tokens / hit rate.
103
+ const [treeRes, retryTree] = useAsyncResource(signal => {
104
+ const [idsPart] = debouncedKey.split('\n\t');
105
+ const ids = (idsPart ?? '').split('\n').filter(id => id !== '');
106
+ return fetchSummary(ids, 'chip', signal);
107
+ }, [debouncedKey], { silentAfterFirst: true, retryToken: 0 });
108
+ const summary = treeRes.status === 'ready' ? treeRes.value : null;
109
+ useEffect(() => {
110
+ if (summary !== null)
111
+ onSummary(summary);
112
+ }, [summary, onSummary]);
113
+ // A failed first fetch renders nothing and self-heals on the retry
114
+ // cadence; later failures keep the prior render (silent mode).
115
+ useEffect(() => {
116
+ if (treeRes.status !== 'error')
117
+ return;
118
+ const timer = window.setTimeout(retryTree, FETCH_FAILURE_RETRY_MS);
119
+ return () => { window.clearTimeout(timer); };
120
+ }, [treeRes, retryTree]);
121
+ // Panel reads, LAZY: nothing flies while the panel is closed. The detail
122
+ // read (`fields=session`) carries byModel; the solo read splits the fold.
123
+ // Both re-fire when request churn debounces through while open.
124
+ const [detailRes] = useAsyncResource(signal => {
125
+ if (!open)
126
+ return Promise.resolve(null);
127
+ const [idsPart] = debouncedKey.split('\n\t');
128
+ const ids = (idsPart ?? '').split('\n').filter(id => id !== '');
129
+ return fetchSummary(ids, 'session', signal);
130
+ }, [open, debouncedKey], { silentAfterFirst: true, retryToken: 0 });
131
+ const [selfRes] = useAsyncResource(signal => {
132
+ if (!open || sessionId === '')
133
+ return Promise.resolve(null);
134
+ return fetchSummary([sessionId], 'chip', signal);
135
+ }, [open, sessionId, debouncedKey], { silentAfterFirst: true, retryToken: 0 });
136
+ // Session switches close the panel — the split it explains no longer holds.
137
+ useEffect(() => {
138
+ setOpen(false);
139
+ }, [sessionId]);
140
+ // Outside pointer / Escape close — the harness popup pattern (ContextMeter
141
+ // and the quota button share it), anchored while open.
142
+ useEffect(() => {
143
+ if (!open)
144
+ return;
145
+ const onPointerDown = (event) => {
146
+ if (event.target instanceof Node && rootRef.current?.contains(event.target) === true)
147
+ return;
148
+ setOpen(false);
149
+ };
150
+ const onKeyDown = (event) => {
151
+ if (event.key === 'Escape')
152
+ setOpen(false);
153
+ };
154
+ document.addEventListener('pointerdown', onPointerDown);
155
+ document.addEventListener('keydown', onKeyDown);
156
+ return () => {
157
+ document.removeEventListener('pointerdown', onPointerDown);
158
+ document.removeEventListener('keydown', onKeyDown);
159
+ };
160
+ }, [open]);
161
+ // Center the panel on the pill, clamped to the viewport's margins (the
162
+ // dock row is full-width, but a bare left:0 could still skew off-screen
163
+ // on narrow windows). Measured at open, refreshed on resize while open.
164
+ const [panelLeft, setPanelLeft] = useState(undefined);
165
+ const measurePanelLeft = useCallback(() => {
166
+ const wrapper = rootRef.current;
167
+ if (wrapper === null)
168
+ return;
169
+ const { left: wrapperLeft, width: wrapperWidth } = wrapper.getBoundingClientRect();
170
+ const panelWidth = Math.min(PANEL_WIDTH, window.innerWidth - 2 * PANEL_VIEWPORT_MARGIN);
171
+ const desired = (wrapperWidth - panelWidth) / 2;
172
+ const minLeft = PANEL_VIEWPORT_MARGIN - wrapperLeft;
173
+ const maxLeft = window.innerWidth - PANEL_VIEWPORT_MARGIN - panelWidth - wrapperLeft;
174
+ setPanelLeft(Math.min(Math.max(desired, minLeft), Math.max(minLeft, maxLeft)));
175
+ }, []);
176
+ useEffect(() => {
177
+ if (!open)
178
+ return;
179
+ measurePanelLeft();
180
+ window.addEventListener('resize', measurePanelLeft);
181
+ return () => { window.removeEventListener('resize', measurePanelLeft); };
182
+ }, [open, measurePanelLeft]);
183
+ if (summary === null || summary.total.requests === 0)
184
+ return null;
185
+ const view = currencyViewOf(summary);
186
+ const costText = formatCost(summary.totalCost, view);
187
+ const tokensValue = formatTokens(totalTokens(summary.total));
188
+ const hit = hitRateDisplay(summary.total);
189
+ const ariaLabel = hasSubs
190
+ ? t('pill.costWithSubs', { value: costText })
191
+ : t('pill.cost', { value: costText });
192
+ // Panel shares: the split waits on the solo read; per-model waits on the
193
+ // detail read. While either is in flight its block shows a quiet ellipsis.
194
+ const selfSummary = selfRes.status === 'ready' ? selfRes.value : null;
195
+ const detail = detailRes.status === 'ready' ? detailRes.value : null;
196
+ const split = selfSummary !== null ? splitUsage(summary, selfSummary) : null;
197
+ const subCount = scopeIds.length - 1;
198
+ return (_jsxs("span", { ref: rootRef, className: styles.root, children: [_jsxs("button", { type: "button", className: styles.pill, "aria-haspopup": "dialog", "aria-expanded": open, "aria-label": `${ariaLabel},${t('panel.openHint')}`, onClick: () => { setOpen(!open); }, children: [_jsxs("svg", { className: styles.glyph, viewBox: "0 0 14 14", width: "14", height: "14", "aria-hidden": true, children: [_jsx("circle", { cx: "7", cy: "7", r: "5.5", fill: "none", stroke: "currentColor", strokeWidth: "1.2" }), _jsx("path", { d: "M4.8 4.5 L7 7.2 L9.2 4.5 M7 7.2 V10 M5.2 8 H8.8 M5.2 9.4 H8.8", fill: "none", stroke: "currentColor", strokeWidth: "1.2" })] }), _jsx("span", { ref: costRef, className: styles.cost, children: costText }), _jsx("span", { className: styles.deltaLayer, "aria-hidden": "true", children: flies.map(fly => (_jsx(CostDeltaFlyLabel, { text: fly.text, vars: fly.vars }, fly.id))) })] }), open && (_jsxs("span", { className: styles.panel, role: "dialog", "aria-label": t('panel.title'), style: { left: panelLeft }, children: [_jsxs("span", { className: styles.panelHead, children: [_jsxs("span", { className: styles.panelTitle, children: [t('panel.title'), hasSubs && _jsx("span", { className: styles.scopeTag, children: t('pill.scopeTag') })] }), _jsx("span", { className: styles.panelTotal, children: costText })] }), _jsxs("span", { className: styles.usageLine, children: [_jsx("span", { children: t('panel.tokens', { value: tokensValue }) }), _jsx("span", { className: styles.dot, children: "\u00B7" }), _jsx("span", { children: t('panel.hitRate', { value: hit.text }) })] }), _jsxs("span", { className: styles.rows, children: [_jsxs("span", { className: styles.row, children: [_jsx("span", { className: styles.rowLabel, children: t('panel.self') }), _jsx("span", { className: styles.rowValue, children: split === null
199
+ ? _jsx("span", { className: styles.pending, children: "\u2026" })
200
+ : _jsxs(_Fragment, { children: [formatCost(split.selfCost, view), _jsx("span", { className: styles.tok, children: t('panel.tokens', { value: formatTokens(split.selfTokens) }) })] }) })] }), hasSubs && (_jsxs("span", { className: `${styles.row} ${styles.rowSub}`, children: [_jsx("span", { className: styles.rowLabel, children: t('panel.subs', { count: subCount }) }), _jsx("span", { className: styles.rowValue, children: split === null
201
+ ? _jsx("span", { className: styles.pending, children: "\u2026" })
202
+ : _jsxs(_Fragment, { children: [formatCost(split.subsCost, view), _jsx("span", { className: styles.tok, children: t('panel.tokens', { value: formatTokens(split.subsTokens) }) })] }) })] }))] }), _jsx("span", { className: styles.groupLabel, children: t('panel.byModel') }), _jsx("span", { className: styles.rows, children: detail === null
203
+ ? (_jsx("span", { className: styles.row, children: _jsx("span", { className: styles.pending, children: "\u2026" }) }))
204
+ : (_jsxs(_Fragment, { children: [detail.byModel.map(row => (_jsx(ModelRow, { row: row, view: view }, row.model))), detail.unpricedModels.length > 0 && (_jsxs("span", { className: `${styles.row} ${styles.unpriced}`, children: [_jsx("span", { className: styles.rowLabel, children: t('panel.unpriced', { count: detail.unpricedModels.length }) }), _jsx("span", { className: styles.rowValue, children: t('panel.unpricedNote') })] }))] })) })] }))] }));
205
+ }
206
+ /** One per-model breakdown row: model id + request count, billed cost, tokens. */
207
+ function ModelRow({ row, view }) {
208
+ return (_jsxs("span", { className: styles.row, children: [_jsxs("span", { className: styles.rowLabel, children: [row.model, _jsxs("span", { className: styles.requests, children: ["\u00D7 ", row.totals.requests] })] }), _jsxs("span", { className: styles.rowValue, children: [formatCost(row.cost, view), _jsx("span", { className: styles.tok, children: formatTokens(totalTokens(row.totals)) })] })] }));
209
+ }
210
+ /** Defensive shape check: an older host build or a misrouted response
211
+ * would otherwise paint the pill with garbage. */
212
+ function looksLikeUsageSummary(value) {
213
+ return typeof value === 'object' && value !== null
214
+ && typeof value.total === 'object'
215
+ && value.total !== null;
216
+ }
217
+ /**
218
+ * Fetch one stats summary. Throws on transport failure (network, abort,
219
+ * non-2xx response, or a payload that doesn't look like a stats summary) so
220
+ * the hook can keep the previous render in place.
221
+ * @param sessionIds - the scope's session ids; an empty list skips the
222
+ * fetch (returning null rather than throwing, so the hook's first-load
223
+ * gate stays at "loading").
224
+ * @param fields - `chip` for totals-only reads, `session` when byModel is
225
+ * needed (the detail panel's per-model block).
226
+ * @param signal - the cancellation signal from the hook.
227
+ */
228
+ async function fetchSummary(sessionIds, fields, signal) {
229
+ if (sessionIds.length === 0)
230
+ return null;
231
+ const response = await fetch(STATS_PATH + encodeStatsQuery({ sessionIds, fields }), {
232
+ headers: { accept: 'application/json' },
233
+ signal,
234
+ });
235
+ if (!response.ok)
236
+ throw new Error(`HTTP ${String(response.status)}`);
237
+ const value = await response.json();
238
+ if (!looksLikeUsageSummary(value))
239
+ throw new Error('unexpected stats response');
240
+ return value;
241
+ }
242
+ //# sourceMappingURL=CostPill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CostPill.js","sourceRoot":"","sources":["../../src/client/CostPill.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAWzE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACtF,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAA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EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC,GAAG,SAAS,CAkLZ"}
1
+ {"version":3,"file":"SessionTable.d.ts","sourceRoot":"","sources":["../../src/client/SessionTable.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AA8D/C;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,aAAa,EAAE,WAAW,EAAE,EAAE;IAC1E,IAAI,EAAE,SAAS,eAAe,EAAE,CAAA;IAChC,IAAI,EAAE,YAAY,CAAA;IAClB,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAA;IAC7B,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAA;IACvC,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC,GAAG,SAAS,CAwLZ"}
@@ -97,17 +97,23 @@ export function SessionTable({ rows, view, t, sessionListed, openSession }) {
97
97
  // a focus loss can swallow the keyup and strand the state on.
98
98
  const [ctrlHeld, setCtrlHeld] = useState(false);
99
99
  useEffect(() => {
100
- const down = (event) => { if (event.key === 'Control')
100
+ const down = (event) => { if (event.key === 'Control' || event.key === 'Meta')
101
101
  setCtrlHeld(true); };
102
- const up = (event) => { if (event.key === 'Control')
102
+ const up = (event) => { if (event.key === 'Control' || event.key === 'Meta')
103
103
  setCtrlHeld(false); };
104
+ const move = (event) => {
105
+ const active = event.ctrlKey || event.metaKey;
106
+ setCtrlHeld(previous => (previous === active ? previous : active));
107
+ };
104
108
  const blur = () => setCtrlHeld(false);
105
109
  window.addEventListener('keydown', down);
106
110
  window.addEventListener('keyup', up);
111
+ window.addEventListener('mousemove', move);
107
112
  window.addEventListener('blur', blur);
108
113
  return () => {
109
114
  window.removeEventListener('keydown', down);
110
115
  window.removeEventListener('keyup', up);
116
+ window.removeEventListener('mousemove', move);
111
117
  window.removeEventListener('blur', blur);
112
118
  };
113
119
  }, []);
@@ -159,7 +165,7 @@ export function SessionTable({ rows, view, t, sessionListed, openSession }) {
159
165
  // the identity becomes a jump affordance: dashed underline, click
160
166
  // opens the session (the parent closes the settings panel).
161
167
  const jump = jumpable(row.sessionId);
162
- return (_jsxs("tr", { children: [_jsxs("td", { className: indented ? `${styles['sessionCol']} ${styles['sessionIndent']}` : styles['sessionCol'], children: [_jsxs("span", { className: styles['sessionCell'], children: [_jsx("button", { type: "button", className: jump ? `${styles['sessionName']} ${styles['jumpable']}` : styles['sessionName'], title: jump ? t('session.openHint') : undefined, onClick: jump
168
+ return (_jsxs("tr", { children: [_jsxs("td", { className: indented ? `${styles['sessionCol']} ${styles['sessionIndent']}` : styles['sessionCol'], children: [_jsxs("span", { className: styles['sessionCell'], children: [_jsx("button", { type: "button", className: jump ? `${styles['sessionName']} ${styles['jumpable']}` : styles['sessionName'], title: jump ? t('session.openHint') : undefined, onClick: jump || ctrlHeld
163
169
  ? event => {
164
170
  event.preventDefault();
165
171
  openSession?.(row.sessionId);
@@ -170,7 +176,7 @@ export function SessionTable({ rows, view, t, sessionListed, openSession }) {
170
176
  ? (_jsx("span", { className: styles['badge'], "aria-label": t('view.subagents.nested', { count: String(row.childCount) }), children: t('view.subagents.nested', { count: String(row.childCount) }) }))
171
177
  : null] }), !indented && row.cwd !== undefined
172
178
  ? _jsx("span", { className: styles['dirTail'], children: dirTailOf(row.cwd) })
173
- : null] }), _jsx("td", { children: _jsx(RequestsCell, { requests: row.totals.requests, failures: row.totals.failures ?? 0, failuresByCode: row.totals.failuresByCode, t: t }) }), _jsx("td", { children: formatTokens(totalTokens(row.totals)) }), _jsx("td", { children: formatCost(row.cost, view) }), _jsx("td", { children: dayKeyOf(new Date(row.lastTime)) })] }, row.sessionId));
179
+ : null] }), _jsx("td", { children: _jsx(RequestsCell, { requests: row.totals.requests, failures: row.totals.failures ?? 0, failuresByCode: row.totals.failuresByCode, t: t }) }), _jsx("td", { children: formatTokens(totalTokens(row.totals)) }), _jsx("td", { className: styles['costCol'], children: formatCost(row.cost, view) }), _jsx("td", { children: dayKeyOf(new Date(row.lastTime)) })] }, row.sessionId));
174
180
  }
175
181
  }
176
182
  /** One directory group: a full-width head row with the directory tail, then
@@ -1 +1 @@
1
- {"version":3,"file":"SessionTable.js","sourceRoot":"","sources":["../../src/client/SessionTable.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAIpD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEhD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAgB,CAAA;AAChE,OAAO,MAAM,MAAM,2BAA2B,CAAA;AAE9C,iEAAiE;AACjE,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAA;IAC7D,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,GAAG,CAAA;AACvC,CAAC;AAED;oDACoD;AACpD,SAAS,SAAS,CAAC,SAAiB;IAClC,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,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AQ,EAAE,GAAG,CAAC,MAAM,CAAC,QAAQ,EAC7B,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,EAClC,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,cAAc,EACzC,CAAC,EAAE,CAAC,GACJ,GACC,EACL,uBAAK,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAM,EAChD,aAAI,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,YAAG,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,GAAM,EACnE,uBAAK,QAAQ,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAM,KA3CpC,GAAG,CAAC,SAAS,CA4CjB,CACN,CAAA;IACH,CAAC;AACH,CAAC;AAED;oEACoE;AACpE,SAAS,aAAa,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAK/C;IACC,OAAO,CACL,8BACE,aAAI,SAAS,EAAE,MAAM,CAAC,UAAU,CAAC,YAC/B,cAAI,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,aAC3C,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,EACvD,eAAM,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,YAAG,MAAM,CAAC,KAAK,CAAC,GAAQ,IAC1D,GACF,EACJ,QAAQ,IACR,CACJ,CAAA;AACH,CAAC"}
@@ -15,10 +15,15 @@
15
15
  *
16
16
  * @module token-usage/client/TokenUsageCard
17
17
  */
18
- import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
18
+ import type { InjectFace, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
19
19
  import type { CardActions, CardStore } from './card-form.ts';
20
+ /** The view the Plugins page asks for under `plugins.bundle.config`. */
21
+ export interface PluginConfigViewProps {
22
+ /** `summary` renders the one-liner; `page` renders the form. */
23
+ readonly view?: 'summary' | 'page';
24
+ }
20
25
  /** Props the renderer binds for the token-usage settings card. */
21
- export type TokenUsageCardProps = PropsRuntime<'settings.plugin.item'> & PropsLocale<'token-usage'> & InjectFace<TokenUsageCardFace>;
26
+ export type TokenUsageCardProps = PluginConfigViewProps & PropsLocale<'token-usage'> & InjectFace<TokenUsageCardFace>;
22
27
  /** The registration-side face this card's slot entry injects. */
23
28
  export interface TokenUsageCardFace extends CardActions {
24
29
  hooks: {
@@ -1 +1 @@
1
- {"version":3,"file":"TokenUsageCard.d.ts","sourceRoot":"","sources":["../../src/client/TokenUsageCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAC7F,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAI5D,kEAAkE;AAClE,MAAM,MAAM,mBAAmB,GAC7B,YAAY,CAAC,sBAAsB,CAAC,GAClC,WAAW,CAAC,aAAa,CAAC,GAC1B,UAAU,CAAC,kBAAkB,CAAC,CAAA;AAElC,iEAAiE;AACjE,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,KAAK,EAAE;QACL,gEAAgE;QAChE,cAAc,EAAE,SAAS,CAAA;KAC1B,CAAA;IACD;;;;OAIG;IACH,aAAa,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;CAC5C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,sCAyRxD"}
1
+ {"version":3,"file":"TokenUsageCard.d.ts","sourceRoot":"","sources":["../../src/client/TokenUsageCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAI5D,wEAAwE;AACxE,MAAM,WAAW,qBAAqB;IACpC,gEAAgE;IAChE,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,CAAA;CACnC;AAED,kEAAkE;AAClE,MAAM,MAAM,mBAAmB,GAC7B,qBAAqB,GACnB,WAAW,CAAC,aAAa,CAAC,GAC1B,UAAU,CAAC,kBAAkB,CAAC,CAAA;AAElC,iEAAiE;AACjE,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,KAAK,EAAE;QACL,gEAAgE;QAChE,cAAc,EAAE,SAAS,CAAA;KAC1B,CAAA;IACD;;;;OAIG;IACH,aAAa,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;CAC5C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,sCAkSxD"}
@@ -16,8 +16,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
16
  *
17
17
  * @module token-usage/client/TokenUsageCard
18
18
  */
19
- import { useCallback, useEffect, useState } from 'react';
20
- import { IconChevronDownOutline14 } from '@deepseek-ai/dsh-client-ui-primitives';
19
+ import { useCallback, useEffect, useRef, useState } from 'react';
20
+ import { IconChevronDownOutlineMedium } from '@deepseek-ai/dsh-client-ui-primitives';
21
21
  import { FULL_SYNC_PATH } from "../wire.js";
22
22
  import css from './TokenUsageCard.module.css';
23
23
  /**
@@ -26,12 +26,19 @@ import css from './TokenUsageCard.module.css';
26
26
  * @returns the card, or nothing when the namespace is unavailable.
27
27
  */
28
28
  export function TokenUsageCard(props) {
29
- const [open, setOpen] = useState(false);
29
+ const [open, setOpen] = useState(props.view === 'page');
30
30
  const [picking, setPicking] = useState(false);
31
31
  const { t } = props;
32
32
  const state = props.useTokenUsageCard(snapshot => snapshot);
33
+ // Discard unstaged changes when navigating away from the page.
34
+ const discardRef = useRef(props.discard);
35
+ discardRef.current = props.discard;
36
+ useEffect(() => () => { discardRef.current(); }, []);
33
37
  if (!state.available)
34
38
  return null;
39
+ if (props.view === 'summary') {
40
+ return _jsx("span", { className: css.description, children: t('card.description') });
41
+ }
35
42
  const migrating = state.migration !== undefined;
36
43
  const lockInput = !state.writable || migrating;
37
44
  const lockActions = !state.dirty || state.saving || migrating;
@@ -143,7 +150,7 @@ export function TokenUsageCard(props) {
143
150
  // does not need its own error line.
144
151
  }
145
152
  }, [fetchFullSync]);
146
- return (_jsxs("li", { className: open ? `${css.card} ${css.cardOpen}` : css.card, children: [_jsxs("button", { type: "button", className: css.header, "aria-expanded": open, "aria-label": `${t(open ? 'card.collapse' : 'card.expand')}: ${t('card.title')}`, onClick: () => { setOpen(!open); }, children: [_jsxs("span", { className: css.headText, children: [_jsx("span", { className: css.name, children: t('card.title') }), _jsx("span", { className: css.description, children: t('card.description') })] }), state.dirty ? _jsx("span", { className: css.pending, children: t('card.unsaved') }) : null, _jsx(IconChevronDownOutline14, { className: open ? `${css.chevron} ${css.chevronOpen}` : css.chevron })] }), open
153
+ return (_jsxs("li", { className: open ? `${css.card} ${css.cardOpen}` : css.card, children: [_jsxs("button", { type: "button", className: css.header, "aria-expanded": open, "aria-label": `${t(open ? 'card.collapse' : 'card.expand')}: ${t('card.title')}`, onClick: () => { setOpen(!open); }, children: [_jsxs("span", { className: css.headText, children: [_jsx("span", { className: css.name, children: t('card.title') }), _jsx("span", { className: css.description, children: t('card.description') })] }), state.dirty ? _jsx("span", { className: css.pending, children: t('card.unsaved') }) : null, _jsx(IconChevronDownOutlineMedium, { className: open ? `${css.chevron} ${css.chevronOpen}` : css.chevron })] }), open
147
154
  ? (_jsxs("div", { className: css.body, children: [!state.writable ? _jsx("p", { className: css.note, role: "status", children: t('card.readOnly') }) : null, _jsxs("label", { className: css.field, htmlFor: "token-usage-card-path", children: [_jsx("span", { className: css.fieldLabel, children: t('card.pathLabel') }), _jsxs("span", { className: css.inputRow, children: [_jsx("input", { id: "token-usage-card-path", className: css.input, type: "text", spellCheck: false, value: state.fields.path, disabled: lockInput, onChange: event => { props.editField('path', event.target.value); } }), _jsx("button", { type: "button", className: css.browse, disabled: lockInput || picking, onClick: () => { void browse(); }, children: t(picking ? 'card.picking' : 'card.browse') })] })] }), _jsx("p", { className: css.hint, children: t('card.pathHint') }), _jsxs("label", { className: css.field, htmlFor: "token-usage-card-region", children: [_jsx("span", { className: css.fieldLabel, children: t('card.regionLabel') }), _jsxs("select", { id: "token-usage-card-region", className: css.input, value: state.fields.pricingRegion, disabled: lockInput, onChange: event => { props.editField('pricingRegion', event.target.value); }, children: [_jsx("option", { value: "", children: t('card.regionDefault') }), _jsx("option", { value: "domestic", children: t('card.region.domestic') }), _jsx("option", { value: "overseas", children: t('card.region.overseas') })] })] }), _jsxs("p", { className: css.hint, children: [t('card.hint'), state.overridden.pricingRegion ? ` ${t('card.overridden')}` : ''] }), state.migration !== undefined
148
155
  ? (_jsxs("div", { className: css.migration, role: "status", children: [_jsx("span", { className: css.migrationLabel, children: t(state.migration.phase === 'copying' ? 'card.migratingCopy' : 'card.migratingClean')
149
156
  .replace('{done}', String(state.migration.done))