claude-code-cost 0.26.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/hub-app.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "manifest": 1,
3
+ "id": "cost",
4
+ "name": "Cost",
5
+ "icon": "dollar-sign",
6
+ "run": { "entry": "server.js", "defaultPort": 3543 },
7
+ "loading": {
8
+ "verbs": [
9
+ "Counting tokens…",
10
+ "Tallying the bill…",
11
+ "Stacking bars…",
12
+ "Crunching numbers…",
13
+ "Checking the cache hits…",
14
+ "Adding up the days…",
15
+ "Balancing the books…",
16
+ "Plotting the trend…",
17
+ "Weighing the models…"
18
+ ]
19
+ },
20
+ "actions": {
21
+ "handles": {
22
+ "session.cost": { "params": { "session": "string?" }, "url": "?view=detail&session={session}", "mode": "message" }
23
+ }
24
+ }
25
+ }
package/lib/net-guard.js CHANGED
@@ -36,6 +36,7 @@ const PORT_RE = /^[0-9]{1,5}$/;
36
36
  // The port is validated but not compared — the listen(0) fallbacks make the real
37
37
  // port dynamic, so only the host is allowlisted.
38
38
  const validPort = (p) => PORT_RE.test(p) && Number(p) >= 1 && Number(p) <= 65535;
39
+ const KEEP_ALIVE_MS = 65000;
39
40
 
40
41
  function isLoopbackAddress(host) {
41
42
  if (!host) return false;
@@ -249,6 +250,10 @@ function createNetGuard(config = {}) {
249
250
  const serverOpts = opts.maxHeaderSize ? { maxHeaderSize: opts.maxHeaderSize } : {};
250
251
  const makeServer = (handler) => {
251
252
  const s = http.createServer(serverOpts, handler);
253
+ // Node's 5 s default closes idle sockets that the hub proxy and the browser would reuse, and a
254
+ // fresh loopback connect is the one that some Windows network filters drop. The hub's agent
255
+ // drops its idle sockets before this, so it never reuses one the server is closing.
256
+ s.keepAliveTimeout = KEEP_ALIVE_MS;
252
257
  if (opts.onUpgrade) s.on('upgrade', opts.onUpgrade);
253
258
  return s;
254
259
  };
@@ -281,4 +286,4 @@ function createNetGuard(config = {}) {
281
286
  return { BIND_HOST, ALLOWED_HOSTS, EXPOSED, hostGuard, originGuard, upgradeVerdict, frameGuard, listenLoopback, exposureWarning };
282
287
  }
283
288
 
284
- module.exports = { createNetGuard, parseHostHeader, isLoopbackAddress };
289
+ module.exports = { createNetGuard, parseHostHeader, isLoopbackAddress, KEEP_ALIVE_MS };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-cost",
3
- "version": "0.26.0",
3
+ "version": "1.0.0",
4
4
  "description": "Cost dashboard for Claude Code usage",
5
5
  "main": "server.js",
6
6
  "type": "commonjs",
@@ -45,6 +45,7 @@
45
45
  "license": "MIT",
46
46
  "files": [
47
47
  "server.js",
48
+ "hub-app.json",
48
49
  "lib/",
49
50
  "public/",
50
51
  "README.md",
package/public/app.js CHANGED
@@ -2118,15 +2118,17 @@ function loadTheme() {
2118
2118
  syncColorThemeSelect(colorTheme || 'ember');
2119
2119
  }
2120
2120
 
2121
- function buildThemeMenu() {
2121
+ function buildThemeMenu(themes = COLOR_THEMES) {
2122
2122
  const menu = document.getElementById('themeMenu');
2123
- menu.innerHTML = COLOR_THEMES.map(
2124
- ([id, label]) =>
2125
- `<button type="button" class="theme-menu-item theme-swatch-${id}" data-theme-id="${id}"
2123
+ menu.innerHTML = themes
2124
+ .map(
2125
+ ([id, label]) =>
2126
+ `<button type="button" class="theme-menu-item theme-swatch-${id}" data-theme-id="${id}"
2126
2127
  onclick="event.stopPropagation(); setColorTheme('${id}'); toggleThemeMenu()">
2127
- <span class="theme-swatch theme-swatch-${id}"><i class="sw-bg"></i><i class="sw-accent"></i><i class="sw-ink"></i></span>${label}
2128
+ <span class="theme-swatch theme-swatch-${id}"><i class="sw-bg"></i><i class="sw-accent"></i><i class="sw-ink"></i></span>${esc(label)}
2128
2129
  </button>`,
2129
- ).join('');
2130
+ )
2131
+ .join('');
2130
2132
  }
2131
2133
 
2132
2134
  // biome-ignore lint/correctness/noUnusedVariables: called from topbar markup
@@ -2526,7 +2528,6 @@ async function navigateToSessions(encodedPath, name) {
2526
2528
  await navigate('sessions', { project: encodedPath, projectName: name });
2527
2529
  }
2528
2530
 
2529
- // biome-ignore lint/correctness/noUnusedVariables: called from HTML onclick
2530
2531
  async function navigateToDetail(sessionId) {
2531
2532
  lastSelectedSession = sessionId;
2532
2533
  currentSessionId = sessionId;
@@ -2882,6 +2883,8 @@ const SHORTCUT_PAIRS = [
2882
2883
  { keys: ['Ctrl', 'Alt', '←/→'], combo: true, label: 'Previous / next hub app' },
2883
2884
  { keys: ['Alt', '1…9'], combo: true, label: 'Jump to hub app by number' },
2884
2885
  { keys: ['Ctrl', 'Alt', 'P'], combo: true, label: 'Project picker' },
2886
+ { keys: ['Ctrl', 'Alt', 'W'], combo: true, label: 'Config dir picker' },
2887
+ { keys: ['Ctrl', 'Alt', 'A'], combo: true, label: 'App launcher' },
2885
2888
  ],
2886
2889
  },
2887
2890
  ],
@@ -3148,7 +3151,7 @@ function renderLimits() {
3148
3151
  function toggleHelpModal() {
3149
3152
  const list = document.getElementById('helpShortcuts');
3150
3153
  if (!list.childElementCount) list.innerHTML = buildHelpShortcuts();
3151
- list.classList.toggle('sc-standalone', !window.__HUB__?.enabled);
3154
+ list.classList.toggle('sc-standalone', hub.status === 'standalone');
3152
3155
  document.getElementById('helpModal').classList.toggle('visible');
3153
3156
  }
3154
3157
 
@@ -3369,123 +3372,45 @@ async function refreshIfStale() {
3369
3372
 
3370
3373
  // #region HUB_INTEGRATION
3371
3374
 
3372
- (async function initHub() {
3373
- const cfg = await fetch('/hub-config')
3374
- .then((r) => r.json())
3375
- .catch(() => ({}));
3376
- if (!cfg.enabled) return;
3377
-
3378
- window.__HUB__ = cfg;
3379
-
3380
- // e.code travels with e.key because macOS composes Option+<key> into a character (Option+P is
3381
- // 'π'), so the key alone cannot identify the binding. The hub owns the keymap and normalizes;
3382
- // these tests only decide whether a press is the hub's to handle.
3383
- document.addEventListener('keydown', (e) => {
3384
- if (!isHubKey(e)) return;
3385
- e.preventDefault();
3386
- hubPost({ type: 'hub:keydown', key: e.key, code: e.code, ctrl: e.ctrlKey, alt: e.altKey, shift: e.shiftKey });
3387
- });
3388
- })();
3389
-
3390
- // The combos the hub binds, from its hub:keys message. Null until one arrives: a hub from before
3391
- // hub:keys sends none, and the fallback filter below is what such a hub expects.
3392
- let hubKeys = null;
3393
-
3394
- // A copy of the hub's comboOf(): its names must match the hub:keys list.
3395
- function hubCombo(e) {
3396
- const lower = (e.key || '').toLowerCase();
3397
- const m = /^(?:Key|Digit)([A-Z1-9])$/.exec(e.code || '');
3398
- const key = /^[a-z1-9]$/.test(lower) ? lower : m ? m[1].toLowerCase() : e.key;
3399
- const mods = [e.ctrlKey && 'ctrl', e.altKey && 'alt', e.shiftKey && 'shift', e.metaKey && 'meta'];
3400
- return [...mods, key].filter(Boolean).join('+');
3401
- }
3375
+ const hub = ClaudeHub.connect();
3402
3376
 
3403
- function isHubKey(e) {
3404
- if (hubKeys) return hubKeys.has(hubCombo(e));
3405
- if (e.ctrlKey && e.altKey && (e.key === 'ArrowLeft' || e.key === 'ArrowRight')) return true;
3406
- // Own branch: the Alt+digit case below requires !ctrlKey. The hub owns the Ctrl+Alt+letter
3407
- // keymap and ignores unbound letters.
3408
- if (e.ctrlKey && e.altKey && !e.shiftKey && !e.metaKey && (/^[a-z]$/i.test(e.key) || /^Key[A-Z]$/.test(e.code))) {
3409
- return true;
3410
- }
3411
- return e.altKey && !e.ctrlKey && !e.shiftKey && !e.metaKey && (/^[1-9]$/.test(e.key) || /^Digit[1-9]$/.test(e.code));
3412
- }
3377
+ document.getElementById('helpDocs')?.addEventListener('click', (e) => {
3378
+ e.preventDefault();
3379
+ hub.openExternal(e.currentTarget.href);
3380
+ });
3413
3381
 
3414
- // Hoisted out of initHubTheme so initHubProject can share it.
3415
- const hubOrigin = () => (window.__HUB__?.url ? new URL(window.__HUB__.url).origin : null);
3382
+ hub.onActive((active) => {
3383
+ hubActive = active;
3384
+ // Becoming active is the main refresh trigger — the interval only covers staying active.
3385
+ if (hubActive) refreshIfStale();
3386
+ });
3416
3387
 
3417
- // Every send is addressed to the hub explicitly. With targetOrigin '*' any page that
3418
- // framed this app also received the forwarded keystrokes and navigation intents.
3419
- function hubPost(message) {
3420
- const origin = hubOrigin();
3421
- if (origin) window.parent?.postMessage(message, origin);
3422
- }
3388
+ // The hub owns the abs->encoded transform, so cost never converts anything itself.
3389
+ hub.subscribe('project.changed', (p) => applyScope(p?.encoded ?? null, p?.name));
3423
3390
 
3424
- window.hubNavigate = function hubNavigate(app, url) {
3425
- if (!window.__HUB__?.enabled) return;
3426
- hubPost({ type: 'hub:navigate', app, url });
3427
- };
3391
+ hub.handle('session.cost', (p) => p.session && navigateToDetail(p.session));
3428
3392
 
3429
3393
  (function initHubTheme() {
3430
3394
  const getTheme = () => (document.body.classList.contains('light') ? 'light' : 'dark');
3431
3395
  const getColorTheme = () => document.body.dataset.colorTheme || 'ember';
3432
- // lastTheme/lastColorTheme are updated synchronously when applying a hub
3433
- // message, so the (async) observer sees no diff and doesn't echo it back.
3434
- let lastTheme = getTheme();
3435
- let lastColorTheme = getColorTheme();
3436
- window.addEventListener('message', (e) => {
3437
- if (e.source !== window.parent || e.origin !== hubOrigin()) return;
3438
- if (e.data?.type !== 'hub:theme') return;
3439
- if (typeof e.data.colorTheme === 'string' && e.data.colorTheme !== getColorTheme()) {
3440
- setColorTheme(e.data.colorTheme);
3441
- lastColorTheme = getColorTheme();
3442
- }
3443
- if (getTheme() !== e.data.theme) {
3444
- window.toggleTheme();
3445
- lastTheme = getTheme();
3446
- }
3396
+ const report = hub.bindTheme({
3397
+ get: () => ({ theme: getTheme(), colorTheme: getColorTheme() }),
3398
+ set: ({ theme, colorTheme }) => {
3399
+ if (colorTheme !== getColorTheme()) setColorTheme(colorTheme);
3400
+ if (theme !== getTheme()) toggleTheme();
3401
+ },
3447
3402
  });
3448
- new MutationObserver(() => {
3449
- const t = getTheme();
3450
- const ct = getColorTheme();
3451
- if (t === lastTheme && ct === lastColorTheme) return;
3452
- lastTheme = t;
3453
- lastColorTheme = ct;
3454
- hubPost({ type: 'hub:theme', theme: t, colorTheme: ct });
3455
- }).observe(document.body, {
3403
+ new MutationObserver(report).observe(document.body, {
3456
3404
  attributes: true,
3457
3405
  attributeFilter: ['class', 'data-color-theme'],
3458
3406
  });
3459
3407
  })();
3460
3408
 
3461
- (function initHubKeys() {
3462
- window.addEventListener('message', (e) => {
3463
- if (e.source !== window.parent || e.origin !== hubOrigin()) return;
3464
- if (e.data?.type !== 'hub:keys' || !Array.isArray(e.data.keys)) return;
3465
- hubKeys = new Set(e.data.keys.filter((k) => typeof k === 'string'));
3466
- });
3467
- })();
3468
-
3469
- (function initHubActive() {
3470
- window.addEventListener('message', (e) => {
3471
- if (e.source !== window.parent || e.origin !== hubOrigin()) return;
3472
- if (e.data?.type !== 'hub:active') return;
3473
- hubActive = !!e.data.active;
3474
- // Becoming active is the main refresh trigger — the interval only covers staying active.
3475
- if (hubActive) refreshIfStale();
3476
- });
3477
- })();
3478
-
3479
- (function initHubProject() {
3480
- window.addEventListener('message', (e) => {
3481
- if (e.source !== window.parent || e.origin !== hubOrigin()) return;
3482
- if (e.data?.type !== 'hub:project') return;
3483
- // The hub owns the abs->encoded transform, so cost never converts anything itself.
3484
- const encoded = e.data.encoded;
3485
- if (typeof encoded !== 'string' || !encoded) return;
3486
- applyScope(encoded, e.data.name);
3487
- });
3488
- })();
3409
+ // Under the hub the picker lists the hub's themes, which include the user's own (protocol section 6, rule 5).
3410
+ hub.onThemes((themes) => {
3411
+ buildThemeMenu(themes.map((t) => [t.id, t.label]));
3412
+ syncColorThemeSelect(document.body.dataset.colorTheme);
3413
+ });
3489
3414
 
3490
3415
  // #endregion
3491
3416
 
package/public/index.html CHANGED
@@ -20,6 +20,7 @@
20
20
  <script defer src="/app.js"></script>
21
21
  </head>
22
22
  <body>
23
+ <script src="/vendor/claude-hub-sdk.js"></script>
23
24
  <div class="topbar">
24
25
  <div class="topbar-logo">
25
26
  <div class="logo-mark">
@@ -102,6 +103,7 @@
102
103
  <div class="modal-box modal-help">
103
104
  <div class="modal-header">
104
105
  <div class="modal-title">Cost Dashboard</div>
106
+ <a class="help-docs" id="helpDocs" href="https://nikiforovall.blog/claude-code-cost/" target="_blank" rel="noopener">Docs ↗</a>
105
107
  <button class="modal-close" aria-label="Close dialog" onclick="toggleHelpModal()">&#10005;</button>
106
108
  </div>
107
109
  <div class="modal-body">
package/public/style.css CHANGED
@@ -14,7 +14,6 @@
14
14
  --accent-text: #f0a070;
15
15
  --accent-dim: rgba(232, 111, 51, 0.25);
16
16
  --accent-glow: rgba(232, 111, 51, 0.55);
17
- --chart-fill: rgba(232, 111, 51, 0.32);
18
17
  --success: #3ecf8e;
19
18
  --success-dim: rgba(62, 207, 142, 0.18);
20
19
  --warning: #f0b429;
@@ -33,6 +32,11 @@
33
32
  --workflow: var(--chart-2);
34
33
  }
35
34
 
35
+ /* On body, not :root: the hub SDK writes theme vars on body, and var() resolves where the property is declared. */
36
+ body {
37
+ --chart-fill: color-mix(in srgb, var(--accent) 32%, transparent);
38
+ }
39
+
36
40
  /* #endregion */
37
41
 
38
42
  /* #region RESET */
@@ -1906,6 +1910,25 @@ body.light .rb-window {
1906
1910
  font-weight: 600;
1907
1911
  }
1908
1912
 
1913
+ .help-docs {
1914
+ margin: 0 12px 0 auto;
1915
+ padding: 4px 10px;
1916
+ border: 1px solid var(--border);
1917
+ border-radius: 6px;
1918
+ color: var(--text-secondary);
1919
+ font-size: 12px;
1920
+ text-decoration: none;
1921
+ white-space: nowrap;
1922
+ transition:
1923
+ color 0.15s ease,
1924
+ border-color 0.15s ease;
1925
+ }
1926
+
1927
+ .help-docs:hover {
1928
+ color: var(--accent);
1929
+ border-color: var(--accent);
1930
+ }
1931
+
1909
1932
  /* One shared grid for both halves (key | label | spacer | key | label): each key
1910
1933
  gutter is sized by its column's widest combo, and left/right rows share row
1911
1934
  tracks, so paired groups line up — a shorter group just leaves empty rows.
@@ -2195,7 +2218,6 @@ body.light {
2195
2218
  --accent-text: #a0501c;
2196
2219
  --accent-dim: rgba(184, 90, 32, 0.18);
2197
2220
  --accent-glow: rgba(232, 111, 51, 0.5);
2198
- --chart-fill: rgba(232, 111, 51, 0.32);
2199
2221
  --success: #1a8a5a;
2200
2222
  --success-dim: rgba(26, 138, 90, 0.15);
2201
2223
  --warning: #b07d0a;
package/public/themes.css CHANGED
@@ -53,7 +53,6 @@ body:not([data-color-theme]):not(.light) {
53
53
  --text-secondary: #c2c4c9;
54
54
  --text-tertiary: #9a9da5;
55
55
  --text-muted: #7d808a;
56
- --chart-fill: rgba(232, 111, 51, 0.32);
57
56
  }
58
57
  body.light:not([data-color-theme]) {
59
58
  --accent: #e86f33;
@@ -69,7 +68,6 @@ body.light:not([data-color-theme]) {
69
68
  --text-secondary: #2c2c2c;
70
69
  --text-tertiary: #565656;
71
70
  --text-muted: #767676;
72
- --chart-fill: rgba(232, 111, 51, 0.32);
73
71
  }
74
72
 
75
73
  /* Gruvbox */
@@ -87,7 +85,6 @@ body[data-color-theme="gruvbox"]:not(.light) {
87
85
  --text-secondary: #d5c4a1;
88
86
  --text-tertiary: #bdae93;
89
87
  --text-muted: #928374;
90
- --chart-fill: rgba(254, 128, 25, 0.32);
91
88
  }
92
89
  body.light[data-color-theme="gruvbox"] {
93
90
  --accent: #d65d0e;
@@ -103,7 +100,6 @@ body.light[data-color-theme="gruvbox"] {
103
100
  --text-secondary: #504945;
104
101
  --text-tertiary: #665c54;
105
102
  --text-muted: #7c6f64;
106
- --chart-fill: rgba(214, 93, 14, 0.32);
107
103
  }
108
104
 
109
105
  /* Catppuccin */
@@ -121,7 +117,6 @@ body[data-color-theme="catppuccin"]:not(.light) {
121
117
  --text-secondary: #bac2de;
122
118
  --text-tertiary: #a6adc8;
123
119
  --text-muted: #7f849c;
124
- --chart-fill: rgba(203, 166, 247, 0.32);
125
120
  }
126
121
  body.light[data-color-theme="catppuccin"] {
127
122
  --accent: #8839ef;
@@ -137,7 +132,6 @@ body.light[data-color-theme="catppuccin"] {
137
132
  --text-secondary: #5c5f77;
138
133
  --text-tertiary: #6c6f85;
139
134
  --text-muted: #8c8fa1;
140
- --chart-fill: rgba(136, 57, 239, 0.32);
141
135
  }
142
136
 
143
137
  /* Tokyo Night */
@@ -155,7 +149,6 @@ body[data-color-theme="tokyo-night"]:not(.light) {
155
149
  --text-secondary: #a9b1d6;
156
150
  --text-tertiary: #787c99;
157
151
  --text-muted: #565f89;
158
- --chart-fill: rgba(122, 162, 247, 0.32);
159
152
  }
160
153
  body.light[data-color-theme="tokyo-night"] {
161
154
  --accent: #2e7de9;
@@ -171,7 +164,6 @@ body.light[data-color-theme="tokyo-night"] {
171
164
  --text-secondary: #565a6e;
172
165
  --text-tertiary: #6c6e75;
173
166
  --text-muted: #848cb5;
174
- --chart-fill: rgba(46, 125, 233, 0.32);
175
167
  }
176
168
 
177
169
  /* Solarized */
@@ -189,7 +181,6 @@ body[data-color-theme="solarized"]:not(.light) {
189
181
  --text-secondary: #b7c0bf;
190
182
  --text-tertiary: #93a1a1;
191
183
  --text-muted: #839496;
192
- --chart-fill: rgba(201, 111, 71, 0.32);
193
184
  }
194
185
  body.light[data-color-theme="solarized"] {
195
186
  --accent: #2280c2;
@@ -207,7 +198,6 @@ body.light[data-color-theme="solarized"] {
207
198
  --text-muted: #728589;
208
199
  --sidebar-bg: #e6dfc7;
209
200
  --sidebar-item-bg: #f3ecd6;
210
- --chart-fill: rgba(34, 128, 194, 0.32);
211
201
  }
212
202
 
213
203
  /* Dracula */
@@ -225,7 +215,6 @@ body[data-color-theme="dracula"]:not(.light) {
225
215
  --text-secondary: #d8d8d2;
226
216
  --text-tertiary: #b0b3c5;
227
217
  --text-muted: #6272a4;
228
- --chart-fill: rgba(189, 147, 249, 0.32);
229
218
  }
230
219
  body.light[data-color-theme="dracula"] {
231
220
  --accent: #7c3aed;
@@ -241,7 +230,6 @@ body.light[data-color-theme="dracula"] {
241
230
  --text-secondary: #34343f;
242
231
  --text-tertiary: #5a5a68;
243
232
  --text-muted: #787885;
244
- --chart-fill: rgba(124, 58, 237, 0.32);
245
233
  }
246
234
 
247
235
  /* Nord */
@@ -259,7 +247,6 @@ body[data-color-theme="nord"]:not(.light) {
259
247
  --text-secondary: #d8dee9;
260
248
  --text-tertiary: #aeb6c5;
261
249
  --text-muted: #7b88a1;
262
- --chart-fill: rgba(136, 192, 208, 0.32);
263
250
  }
264
251
  body.light[data-color-theme="nord"] {
265
252
  --accent: #5e81ac;
@@ -275,7 +262,6 @@ body.light[data-color-theme="nord"] {
275
262
  --text-secondary: #3b4252;
276
263
  --text-tertiary: #4c566a;
277
264
  --text-muted: #6b7589;
278
- --chart-fill: rgba(94, 129, 172, 0.32);
279
265
  }
280
266
 
281
267
  /* Rosé Pine */
@@ -293,7 +279,6 @@ body[data-color-theme="rose-pine"]:not(.light) {
293
279
  --text-secondary: #c5c2dd;
294
280
  --text-tertiary: #908caa;
295
281
  --text-muted: #6e6a86;
296
- --chart-fill: rgba(196, 167, 231, 0.32);
297
282
  }
298
283
  body.light[data-color-theme="rose-pine"] {
299
284
  --accent: #907aa9;
@@ -309,7 +294,6 @@ body.light[data-color-theme="rose-pine"] {
309
294
  --text-secondary: #635e87;
310
295
  --text-tertiary: #6e6a88;
311
296
  --text-muted: #857f96;
312
- --chart-fill: rgba(144, 122, 169, 0.32);
313
297
  }
314
298
 
315
299
  /* Everforest */
@@ -327,7 +311,6 @@ body[data-color-theme="everforest"]:not(.light) {
327
311
  --text-secondary: #bfb6a3;
328
312
  --text-tertiary: #9da9a0;
329
313
  --text-muted: #859289;
330
- --chart-fill: rgba(167, 192, 128, 0.32);
331
314
  }
332
315
  body.light[data-color-theme="everforest"] {
333
316
  --accent: #6f8352;
@@ -343,7 +326,6 @@ body.light[data-color-theme="everforest"] {
343
326
  --text-secondary: #55636b;
344
327
  --text-tertiary: #66705f;
345
328
  --text-muted: #7a8577;
346
- --chart-fill: rgba(111, 131, 82, 0.32);
347
329
  }
348
330
 
349
331
  /* Kanagawa */
@@ -361,7 +343,6 @@ body[data-color-theme="kanagawa"]:not(.light) {
361
343
  --text-secondary: #c8c093;
362
344
  --text-tertiary: #a6a69c;
363
345
  --text-muted: #727169;
364
- --chart-fill: rgba(126, 156, 216, 0.32);
365
346
  }
366
347
  body.light[data-color-theme="kanagawa"] {
367
348
  --accent: #4d699b;
@@ -377,7 +358,6 @@ body.light[data-color-theme="kanagawa"] {
377
358
  --text-secondary: #66667a;
378
359
  --text-tertiary: #716e61;
379
360
  --text-muted: #8a8775;
380
- --chart-fill: rgba(77, 105, 155, 0.32);
381
361
  }
382
362
 
383
363
  /* One Dark */
@@ -395,7 +375,6 @@ body[data-color-theme="one-dark"]:not(.light) {
395
375
  --text-secondary: #abb2bf;
396
376
  --text-tertiary: #8b919e;
397
377
  --text-muted: #5c6370;
398
- --chart-fill: rgba(97, 175, 239, 0.32);
399
378
  }
400
379
  body.light[data-color-theme="one-dark"] {
401
380
  --accent: #4078f2;
@@ -411,7 +390,6 @@ body.light[data-color-theme="one-dark"] {
411
390
  --text-secondary: #50525a;
412
391
  --text-tertiary: #696c77;
413
392
  --text-muted: #a0a1a7;
414
- --chart-fill: rgba(64, 120, 242, 0.32);
415
393
  }
416
394
 
417
395
  /* Night Owl */
@@ -429,7 +407,6 @@ body[data-color-theme="night-owl"]:not(.light) {
429
407
  --text-secondary: #b8c5d6;
430
408
  --text-tertiary: #8ba3b8;
431
409
  --text-muted: #637777;
432
- --chart-fill: rgba(130, 170, 255, 0.32);
433
410
  }
434
411
  body.light[data-color-theme="night-owl"] {
435
412
  --accent: #0c969b;
@@ -445,7 +422,6 @@ body.light[data-color-theme="night-owl"] {
445
422
  --text-secondary: #545167;
446
423
  --text-tertiary: #6f6e85;
447
424
  --text-muted: #989fb1;
448
- --chart-fill: rgba(12, 150, 155, 0.32);
449
425
  }
450
426
 
451
427
  /* Monokai Pro */
@@ -463,7 +439,6 @@ body[data-color-theme="monokai"]:not(.light) {
463
439
  --text-secondary: #d9d8d6;
464
440
  --text-tertiary: #939293;
465
441
  --text-muted: #727072;
466
- --chart-fill: rgba(255, 216, 102, 0.32);
467
442
  }
468
443
  body.light[data-color-theme="monokai"] {
469
444
  --accent: #c08a00;
@@ -479,7 +454,6 @@ body.light[data-color-theme="monokai"] {
479
454
  --text-secondary: #46434a;
480
455
  --text-tertiary: #6b686d;
481
456
  --text-muted: #8d8a8d;
482
- --chart-fill: rgba(192, 138, 0, 0.32);
483
457
  }
484
458
 
485
459
  /* GitHub */
@@ -497,7 +471,6 @@ body[data-color-theme="github"]:not(.light) {
497
471
  --text-secondary: #d1d5da;
498
472
  --text-tertiary: #959da5;
499
473
  --text-muted: #6a737d;
500
- --chart-fill: rgba(88, 166, 255, 0.32);
501
474
  }
502
475
  body.light[data-color-theme="github"] {
503
476
  --accent: #0366d6;
@@ -513,7 +486,6 @@ body.light[data-color-theme="github"] {
513
486
  --text-secondary: #444d56;
514
487
  --text-tertiary: #586069;
515
488
  --text-muted: #6a737d;
516
- --chart-fill: rgba(3, 102, 214, 0.32);
517
489
  }
518
490
 
519
491
  /* Ayu */
@@ -531,7 +503,6 @@ body[data-color-theme="ayu"]:not(.light) {
531
503
  --text-secondary: #a8a6a0;
532
504
  --text-tertiary: #8a9199;
533
505
  --text-muted: #6c7380;
534
- --chart-fill: rgba(230, 180, 80, 0.32);
535
506
  }
536
507
  body.light[data-color-theme="ayu"] {
537
508
  --accent: #c97612;
@@ -547,7 +518,6 @@ body.light[data-color-theme="ayu"] {
547
518
  --text-secondary: #5c6166;
548
519
  --text-tertiary: #787b80;
549
520
  --text-muted: #8a9199;
550
- --chart-fill: rgba(201, 118, 18, 0.32);
551
521
  }
552
522
 
553
523
  /* Vitesse */
@@ -565,7 +535,6 @@ body[data-color-theme="vitesse"]:not(.light) {
565
535
  --text-secondary: #bfbaaa;
566
536
  --text-tertiary: #8f8f85;
567
537
  --text-muted: #758575;
568
- --chart-fill: rgba(77, 147, 117, 0.32);
569
538
  }
570
539
  body.light[data-color-theme="vitesse"] {
571
540
  --accent: #1c6b48;
@@ -581,7 +550,6 @@ body.light[data-color-theme="vitesse"] {
581
550
  --text-secondary: #4e4f47;
582
551
  --text-tertiary: #6b6d63;
583
552
  --text-muted: #a0ada0;
584
- --chart-fill: rgba(28, 107, 72, 0.32);
585
553
  }
586
554
 
587
555
  /* Synthwave '84 */
@@ -599,7 +567,6 @@ body[data-color-theme="synthwave"]:not(.light) {
599
567
  --text-secondary: #d8d6e8;
600
568
  --text-tertiary: #b6b1d8;
601
569
  --text-muted: #848bbd;
602
- --chart-fill: rgba(255, 126, 219, 0.32);
603
570
  }
604
571
  body.light[data-color-theme="synthwave"] {
605
572
  --accent: #c936a6;
@@ -615,5 +582,4 @@ body.light[data-color-theme="synthwave"] {
615
582
  --text-secondary: #3d3455;
616
583
  --text-tertiary: #5c5380;
617
584
  --text-muted: #7d76a3;
618
- --chart-fill: rgba(201, 54, 166, 0.32);
619
585
  }
@@ -0,0 +1,50 @@
1
+ // claude-hub-sdk 1.1.0 (sha256 0fed14faa670). Copied by npm run sdk:sync in claude-code-hub. Do not edit.
2
+ // Claude Code Hub SDK stub: what an app serves when no hub runs it. Under a hub, the hub hands the
3
+ // app its real SDK (client.js) in place of this file. The API must match client.js; a test checks it.
4
+ ((root) => {
5
+ 'use strict';
6
+
7
+ function createClaudeHub(win) {
8
+ let hub = null;
9
+ const off = () => {};
10
+
11
+ function connect({ standalone = {} } = {}) {
12
+ if (hub) return hub;
13
+ const standaloneFn = (action) => {
14
+ const fn = (typeof standalone === 'function' ? standalone() : standalone)[action];
15
+ return typeof fn === 'function' ? fn : null;
16
+ };
17
+ hub = {
18
+ status: 'standalone',
19
+ themes: [],
20
+ inHub: false,
21
+ onStatus: () => off,
22
+ onActive: () => off,
23
+ onThemes: () => off,
24
+ subscribe: () => off,
25
+ bindTheme: () => off,
26
+ handle() {},
27
+ publish() {},
28
+ invoke(action, params = {}) {
29
+ const target = standaloneFn(action)?.(params);
30
+ if (!target) return Promise.resolve({ ok: false, reason: 'unhandled' });
31
+ win.open(target, '_blank', 'noopener');
32
+ return Promise.resolve({ ok: true, handledBy: 'standalone' });
33
+ },
34
+ can: (action) => !!standaloneFn(action),
35
+ forwards: () => false,
36
+ closeGuard() {},
37
+ openExternal(url) {
38
+ win.open(url, '_blank', 'noopener');
39
+ },
40
+ terminalToken: () => Promise.resolve(null),
41
+ };
42
+ return hub;
43
+ }
44
+
45
+ return { connect };
46
+ }
47
+
48
+ if (typeof module === 'object' && module.exports) module.exports = { createClaudeHub };
49
+ else root.ClaudeHub = createClaudeHub(root);
50
+ })(typeof window !== 'undefined' ? window : globalThis);
package/server.js CHANGED
@@ -1401,11 +1401,10 @@ app.use(net.frameGuard);
1401
1401
  app.use(net.originGuard);
1402
1402
 
1403
1403
  app.use(express.json());
1404
- app.use(express.static(path.join(__dirname, 'public')));
1404
+ // Under a hub, the hub hands over its SDK. Alone, public/vendor/claude-hub-sdk.js is a stub.
1405
+ if (process.env.HUB_SDK_SERVER) require(process.env.HUB_SDK_SERVER).mount(app);
1405
1406
 
1406
- app.get('/hub-config', (_req, res) => {
1407
- res.json({ enabled: !!process.env.CLAUDE_HUB, url: process.env.HUB_URL || null });
1408
- });
1407
+ app.use(express.static(path.join(__dirname, 'public')));
1409
1408
 
1410
1409
  function parseRange(raw, fallback = null) {
1411
1410
  if (raw === 'today') return 'today';