claude-code-cost 0.25.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 +25 -0
- package/lib/net-guard.js +6 -1
- package/package.json +2 -1
- package/public/app.js +56 -115
- package/public/index.html +2 -0
- package/public/style.css +30 -8
- package/public/themes.css +32 -32
- package/public/vendor/claude-hub-sdk.js +50 -0
- package/server.js +3 -4
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.
|
|
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
|
@@ -488,11 +488,28 @@ function purgeLegacyLocalCache() {
|
|
|
488
488
|
keys.forEach((k) => localStorage.removeItem(k));
|
|
489
489
|
}
|
|
490
490
|
|
|
491
|
+
// A re-render can ask for a URL whose first request is still in flight (the hub's theme message
|
|
492
|
+
// arrives during the first load and re-renders the view), so it joins that request.
|
|
493
|
+
const pendingFetches = new Map();
|
|
494
|
+
|
|
491
495
|
async function fetchJSON(url, skipCache) {
|
|
492
|
-
if (
|
|
493
|
-
|
|
494
|
-
|
|
496
|
+
if (skipCache) return requestJSON(url);
|
|
497
|
+
const cached = getCached(url);
|
|
498
|
+
if (cached) return cached;
|
|
499
|
+
const pending = pendingFetches.get(url);
|
|
500
|
+
if (pending) return pending;
|
|
501
|
+
const request = requestJSON(url);
|
|
502
|
+
pendingFetches.set(url, request);
|
|
503
|
+
try {
|
|
504
|
+
const data = await request;
|
|
505
|
+
cacheData(url, data);
|
|
506
|
+
return data;
|
|
507
|
+
} finally {
|
|
508
|
+
pendingFetches.delete(url);
|
|
495
509
|
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
async function requestJSON(url) {
|
|
496
513
|
const res = await fetch(url);
|
|
497
514
|
if (!res.ok) {
|
|
498
515
|
const err = new Error(`HTTP ${res.status}`);
|
|
@@ -501,7 +518,6 @@ async function fetchJSON(url, skipCache) {
|
|
|
501
518
|
}
|
|
502
519
|
const data = await res.json();
|
|
503
520
|
dataFetchedAt = Date.now();
|
|
504
|
-
if (!skipCache) cacheData(url, data);
|
|
505
521
|
return data;
|
|
506
522
|
}
|
|
507
523
|
|
|
@@ -2102,15 +2118,17 @@ function loadTheme() {
|
|
|
2102
2118
|
syncColorThemeSelect(colorTheme || 'ember');
|
|
2103
2119
|
}
|
|
2104
2120
|
|
|
2105
|
-
function buildThemeMenu() {
|
|
2121
|
+
function buildThemeMenu(themes = COLOR_THEMES) {
|
|
2106
2122
|
const menu = document.getElementById('themeMenu');
|
|
2107
|
-
menu.innerHTML =
|
|
2108
|
-
(
|
|
2109
|
-
|
|
2123
|
+
menu.innerHTML = themes
|
|
2124
|
+
.map(
|
|
2125
|
+
([id, label]) =>
|
|
2126
|
+
`<button type="button" class="theme-menu-item theme-swatch-${id}" data-theme-id="${id}"
|
|
2110
2127
|
onclick="event.stopPropagation(); setColorTheme('${id}'); toggleThemeMenu()">
|
|
2111
|
-
<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)}
|
|
2112
2129
|
</button>`,
|
|
2113
|
-
|
|
2130
|
+
)
|
|
2131
|
+
.join('');
|
|
2114
2132
|
}
|
|
2115
2133
|
|
|
2116
2134
|
// biome-ignore lint/correctness/noUnusedVariables: called from topbar markup
|
|
@@ -2510,7 +2528,6 @@ async function navigateToSessions(encodedPath, name) {
|
|
|
2510
2528
|
await navigate('sessions', { project: encodedPath, projectName: name });
|
|
2511
2529
|
}
|
|
2512
2530
|
|
|
2513
|
-
// biome-ignore lint/correctness/noUnusedVariables: called from HTML onclick
|
|
2514
2531
|
async function navigateToDetail(sessionId) {
|
|
2515
2532
|
lastSelectedSession = sessionId;
|
|
2516
2533
|
currentSessionId = sessionId;
|
|
@@ -2866,6 +2883,8 @@ const SHORTCUT_PAIRS = [
|
|
|
2866
2883
|
{ keys: ['Ctrl', 'Alt', '←/→'], combo: true, label: 'Previous / next hub app' },
|
|
2867
2884
|
{ keys: ['Alt', '1…9'], combo: true, label: 'Jump to hub app by number' },
|
|
2868
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' },
|
|
2869
2888
|
],
|
|
2870
2889
|
},
|
|
2871
2890
|
],
|
|
@@ -3132,7 +3151,7 @@ function renderLimits() {
|
|
|
3132
3151
|
function toggleHelpModal() {
|
|
3133
3152
|
const list = document.getElementById('helpShortcuts');
|
|
3134
3153
|
if (!list.childElementCount) list.innerHTML = buildHelpShortcuts();
|
|
3135
|
-
list.classList.toggle('sc-standalone',
|
|
3154
|
+
list.classList.toggle('sc-standalone', hub.status === 'standalone');
|
|
3136
3155
|
document.getElementById('helpModal').classList.toggle('visible');
|
|
3137
3156
|
}
|
|
3138
3157
|
|
|
@@ -3353,123 +3372,45 @@ async function refreshIfStale() {
|
|
|
3353
3372
|
|
|
3354
3373
|
// #region HUB_INTEGRATION
|
|
3355
3374
|
|
|
3356
|
-
|
|
3357
|
-
const cfg = await fetch('/hub-config')
|
|
3358
|
-
.then((r) => r.json())
|
|
3359
|
-
.catch(() => ({}));
|
|
3360
|
-
if (!cfg.enabled) return;
|
|
3375
|
+
const hub = ClaudeHub.connect();
|
|
3361
3376
|
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
// these tests only decide whether a press is the hub's to handle.
|
|
3367
|
-
document.addEventListener('keydown', (e) => {
|
|
3368
|
-
if (!isHubKey(e)) return;
|
|
3369
|
-
e.preventDefault();
|
|
3370
|
-
hubPost({ type: 'hub:keydown', key: e.key, code: e.code, ctrl: e.ctrlKey, alt: e.altKey, shift: e.shiftKey });
|
|
3371
|
-
});
|
|
3372
|
-
})();
|
|
3373
|
-
|
|
3374
|
-
// The combos the hub binds, from its hub:keys message. Null until one arrives: a hub from before
|
|
3375
|
-
// hub:keys sends none, and the fallback filter below is what such a hub expects.
|
|
3376
|
-
let hubKeys = null;
|
|
3377
|
-
|
|
3378
|
-
// A copy of the hub's comboOf(): its names must match the hub:keys list.
|
|
3379
|
-
function hubCombo(e) {
|
|
3380
|
-
const lower = (e.key || '').toLowerCase();
|
|
3381
|
-
const m = /^(?:Key|Digit)([A-Z1-9])$/.exec(e.code || '');
|
|
3382
|
-
const key = /^[a-z1-9]$/.test(lower) ? lower : m ? m[1].toLowerCase() : e.key;
|
|
3383
|
-
const mods = [e.ctrlKey && 'ctrl', e.altKey && 'alt', e.shiftKey && 'shift', e.metaKey && 'meta'];
|
|
3384
|
-
return [...mods, key].filter(Boolean).join('+');
|
|
3385
|
-
}
|
|
3386
|
-
|
|
3387
|
-
function isHubKey(e) {
|
|
3388
|
-
if (hubKeys) return hubKeys.has(hubCombo(e));
|
|
3389
|
-
if (e.ctrlKey && e.altKey && (e.key === 'ArrowLeft' || e.key === 'ArrowRight')) return true;
|
|
3390
|
-
// Own branch: the Alt+digit case below requires !ctrlKey. The hub owns the Ctrl+Alt+letter
|
|
3391
|
-
// keymap and ignores unbound letters.
|
|
3392
|
-
if (e.ctrlKey && e.altKey && !e.shiftKey && !e.metaKey && (/^[a-z]$/i.test(e.key) || /^Key[A-Z]$/.test(e.code))) {
|
|
3393
|
-
return true;
|
|
3394
|
-
}
|
|
3395
|
-
return e.altKey && !e.ctrlKey && !e.shiftKey && !e.metaKey && (/^[1-9]$/.test(e.key) || /^Digit[1-9]$/.test(e.code));
|
|
3396
|
-
}
|
|
3377
|
+
document.getElementById('helpDocs')?.addEventListener('click', (e) => {
|
|
3378
|
+
e.preventDefault();
|
|
3379
|
+
hub.openExternal(e.currentTarget.href);
|
|
3380
|
+
});
|
|
3397
3381
|
|
|
3398
|
-
|
|
3399
|
-
|
|
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
|
+
});
|
|
3400
3387
|
|
|
3401
|
-
//
|
|
3402
|
-
|
|
3403
|
-
function hubPost(message) {
|
|
3404
|
-
const origin = hubOrigin();
|
|
3405
|
-
if (origin) window.parent?.postMessage(message, origin);
|
|
3406
|
-
}
|
|
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));
|
|
3407
3390
|
|
|
3408
|
-
|
|
3409
|
-
if (!window.__HUB__?.enabled) return;
|
|
3410
|
-
hubPost({ type: 'hub:navigate', app, url });
|
|
3411
|
-
};
|
|
3391
|
+
hub.handle('session.cost', (p) => p.session && navigateToDetail(p.session));
|
|
3412
3392
|
|
|
3413
3393
|
(function initHubTheme() {
|
|
3414
3394
|
const getTheme = () => (document.body.classList.contains('light') ? 'light' : 'dark');
|
|
3415
3395
|
const getColorTheme = () => document.body.dataset.colorTheme || 'ember';
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
if (e.data?.type !== 'hub:theme') return;
|
|
3423
|
-
if (typeof e.data.colorTheme === 'string' && e.data.colorTheme !== getColorTheme()) {
|
|
3424
|
-
setColorTheme(e.data.colorTheme);
|
|
3425
|
-
lastColorTheme = getColorTheme();
|
|
3426
|
-
}
|
|
3427
|
-
if (getTheme() !== e.data.theme) {
|
|
3428
|
-
window.toggleTheme();
|
|
3429
|
-
lastTheme = getTheme();
|
|
3430
|
-
}
|
|
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
|
+
},
|
|
3431
3402
|
});
|
|
3432
|
-
new MutationObserver((
|
|
3433
|
-
const t = getTheme();
|
|
3434
|
-
const ct = getColorTheme();
|
|
3435
|
-
if (t === lastTheme && ct === lastColorTheme) return;
|
|
3436
|
-
lastTheme = t;
|
|
3437
|
-
lastColorTheme = ct;
|
|
3438
|
-
hubPost({ type: 'hub:theme', theme: t, colorTheme: ct });
|
|
3439
|
-
}).observe(document.body, {
|
|
3403
|
+
new MutationObserver(report).observe(document.body, {
|
|
3440
3404
|
attributes: true,
|
|
3441
3405
|
attributeFilter: ['class', 'data-color-theme'],
|
|
3442
3406
|
});
|
|
3443
3407
|
})();
|
|
3444
3408
|
|
|
3445
|
-
(
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
});
|
|
3451
|
-
})();
|
|
3452
|
-
|
|
3453
|
-
(function initHubActive() {
|
|
3454
|
-
window.addEventListener('message', (e) => {
|
|
3455
|
-
if (e.source !== window.parent || e.origin !== hubOrigin()) return;
|
|
3456
|
-
if (e.data?.type !== 'hub:active') return;
|
|
3457
|
-
hubActive = !!e.data.active;
|
|
3458
|
-
// Becoming active is the main refresh trigger — the interval only covers staying active.
|
|
3459
|
-
if (hubActive) refreshIfStale();
|
|
3460
|
-
});
|
|
3461
|
-
})();
|
|
3462
|
-
|
|
3463
|
-
(function initHubProject() {
|
|
3464
|
-
window.addEventListener('message', (e) => {
|
|
3465
|
-
if (e.source !== window.parent || e.origin !== hubOrigin()) return;
|
|
3466
|
-
if (e.data?.type !== 'hub:project') return;
|
|
3467
|
-
// The hub owns the abs->encoded transform, so cost never converts anything itself.
|
|
3468
|
-
const encoded = e.data.encoded;
|
|
3469
|
-
if (typeof encoded !== 'string' || !encoded) return;
|
|
3470
|
-
applyScope(encoded, e.data.name);
|
|
3471
|
-
});
|
|
3472
|
-
})();
|
|
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
|
+
});
|
|
3473
3414
|
|
|
3474
3415
|
// #endregion
|
|
3475
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()">✕</button>
|
|
106
108
|
</div>
|
|
107
109
|
<div class="modal-body">
|
package/public/style.css
CHANGED
|
@@ -12,9 +12,8 @@
|
|
|
12
12
|
--text-muted: #7d808a;
|
|
13
13
|
--accent: #e86f33;
|
|
14
14
|
--accent-text: #f0a070;
|
|
15
|
-
--accent-dim: rgba(232, 111, 51, 0.
|
|
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.
|
|
@@ -2185,17 +2208,16 @@ kbd {
|
|
|
2185
2208
|
body.light {
|
|
2186
2209
|
--bg-deep: #e8e6e3;
|
|
2187
2210
|
--bg-surface: #efede9;
|
|
2188
|
-
--bg-elevated: #
|
|
2211
|
+
--bg-elevated: #fbfaf9;
|
|
2189
2212
|
--bg-hover: #d2d0cc;
|
|
2190
2213
|
--border: #cfcbc4;
|
|
2191
2214
|
--text-primary: #0a0a0a;
|
|
2192
|
-
--text-secondary: #
|
|
2193
|
-
--text-tertiary: #
|
|
2194
|
-
--text-muted: #
|
|
2215
|
+
--text-secondary: #2c2c2c;
|
|
2216
|
+
--text-tertiary: #565656;
|
|
2217
|
+
--text-muted: #767676;
|
|
2195
2218
|
--accent-text: #a0501c;
|
|
2196
|
-
--accent-dim: rgba(
|
|
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.28);
|
|
2199
2221
|
--success: #1a8a5a;
|
|
2200
2222
|
--success-dim: rgba(26, 138, 90, 0.15);
|
|
2201
2223
|
--warning: #b07d0a;
|
package/public/themes.css
CHANGED
|
@@ -38,6 +38,38 @@ body.light .theme-swatch-vitesse { --sw-bg: #f7f7f7; --sw-accent: #1c6b48; --sw-
|
|
|
38
38
|
.theme-swatch-synthwave { --sw-bg: #262335; --sw-accent: #ff7edb; --sw-ink: #ffffff; --sw-border: #495495; }
|
|
39
39
|
body.light .theme-swatch-synthwave { --sw-bg: #efecf6; --sw-accent: #c936a6; --sw-ink: #241b2f; --sw-border: #c5bcdd; }
|
|
40
40
|
|
|
41
|
+
/* Ember */
|
|
42
|
+
body:not([data-color-theme]):not(.light) {
|
|
43
|
+
--accent: #e86f33;
|
|
44
|
+
--accent-text: #f0a070;
|
|
45
|
+
--accent-dim: rgba(232,111,51,0.25);
|
|
46
|
+
--accent-glow: rgba(232, 111, 51, 0.55);
|
|
47
|
+
--bg-deep: #101114;
|
|
48
|
+
--bg-surface: #16181c;
|
|
49
|
+
--bg-elevated: #1e2025;
|
|
50
|
+
--bg-hover: #282a30;
|
|
51
|
+
--border: #363840;
|
|
52
|
+
--text-primary: #f0f1f3;
|
|
53
|
+
--text-secondary: #c2c4c9;
|
|
54
|
+
--text-tertiary: #9a9da5;
|
|
55
|
+
--text-muted: #7d808a;
|
|
56
|
+
}
|
|
57
|
+
body.light:not([data-color-theme]) {
|
|
58
|
+
--accent: #e86f33;
|
|
59
|
+
--accent-text: #a0501c;
|
|
60
|
+
--accent-dim: rgba(184,90,32,0.18);
|
|
61
|
+
--accent-glow: rgba(232, 111, 51, 0.5);
|
|
62
|
+
--bg-deep: #e8e6e3;
|
|
63
|
+
--bg-surface: #efede9;
|
|
64
|
+
--bg-elevated: #fbfaf9;
|
|
65
|
+
--bg-hover: #d2d0cc;
|
|
66
|
+
--border: #cfcbc4;
|
|
67
|
+
--text-primary: #0a0a0a;
|
|
68
|
+
--text-secondary: #2c2c2c;
|
|
69
|
+
--text-tertiary: #565656;
|
|
70
|
+
--text-muted: #767676;
|
|
71
|
+
}
|
|
72
|
+
|
|
41
73
|
/* Gruvbox */
|
|
42
74
|
body[data-color-theme="gruvbox"]:not(.light) {
|
|
43
75
|
--accent: #fe8019;
|
|
@@ -53,7 +85,6 @@ body[data-color-theme="gruvbox"]:not(.light) {
|
|
|
53
85
|
--text-secondary: #d5c4a1;
|
|
54
86
|
--text-tertiary: #bdae93;
|
|
55
87
|
--text-muted: #928374;
|
|
56
|
-
--chart-fill: rgba(254, 128, 25, 0.32);
|
|
57
88
|
}
|
|
58
89
|
body.light[data-color-theme="gruvbox"] {
|
|
59
90
|
--accent: #d65d0e;
|
|
@@ -69,7 +100,6 @@ body.light[data-color-theme="gruvbox"] {
|
|
|
69
100
|
--text-secondary: #504945;
|
|
70
101
|
--text-tertiary: #665c54;
|
|
71
102
|
--text-muted: #7c6f64;
|
|
72
|
-
--chart-fill: rgba(214, 93, 14, 0.32);
|
|
73
103
|
}
|
|
74
104
|
|
|
75
105
|
/* Catppuccin */
|
|
@@ -87,7 +117,6 @@ body[data-color-theme="catppuccin"]:not(.light) {
|
|
|
87
117
|
--text-secondary: #bac2de;
|
|
88
118
|
--text-tertiary: #a6adc8;
|
|
89
119
|
--text-muted: #7f849c;
|
|
90
|
-
--chart-fill: rgba(203, 166, 247, 0.32);
|
|
91
120
|
}
|
|
92
121
|
body.light[data-color-theme="catppuccin"] {
|
|
93
122
|
--accent: #8839ef;
|
|
@@ -103,7 +132,6 @@ body.light[data-color-theme="catppuccin"] {
|
|
|
103
132
|
--text-secondary: #5c5f77;
|
|
104
133
|
--text-tertiary: #6c6f85;
|
|
105
134
|
--text-muted: #8c8fa1;
|
|
106
|
-
--chart-fill: rgba(136, 57, 239, 0.32);
|
|
107
135
|
}
|
|
108
136
|
|
|
109
137
|
/* Tokyo Night */
|
|
@@ -121,7 +149,6 @@ body[data-color-theme="tokyo-night"]:not(.light) {
|
|
|
121
149
|
--text-secondary: #a9b1d6;
|
|
122
150
|
--text-tertiary: #787c99;
|
|
123
151
|
--text-muted: #565f89;
|
|
124
|
-
--chart-fill: rgba(122, 162, 247, 0.32);
|
|
125
152
|
}
|
|
126
153
|
body.light[data-color-theme="tokyo-night"] {
|
|
127
154
|
--accent: #2e7de9;
|
|
@@ -137,7 +164,6 @@ body.light[data-color-theme="tokyo-night"] {
|
|
|
137
164
|
--text-secondary: #565a6e;
|
|
138
165
|
--text-tertiary: #6c6e75;
|
|
139
166
|
--text-muted: #848cb5;
|
|
140
|
-
--chart-fill: rgba(46, 125, 233, 0.32);
|
|
141
167
|
}
|
|
142
168
|
|
|
143
169
|
/* Solarized */
|
|
@@ -155,7 +181,6 @@ body[data-color-theme="solarized"]:not(.light) {
|
|
|
155
181
|
--text-secondary: #b7c0bf;
|
|
156
182
|
--text-tertiary: #93a1a1;
|
|
157
183
|
--text-muted: #839496;
|
|
158
|
-
--chart-fill: rgba(201, 111, 71, 0.32);
|
|
159
184
|
}
|
|
160
185
|
body.light[data-color-theme="solarized"] {
|
|
161
186
|
--accent: #2280c2;
|
|
@@ -173,7 +198,6 @@ body.light[data-color-theme="solarized"] {
|
|
|
173
198
|
--text-muted: #728589;
|
|
174
199
|
--sidebar-bg: #e6dfc7;
|
|
175
200
|
--sidebar-item-bg: #f3ecd6;
|
|
176
|
-
--chart-fill: rgba(34, 128, 194, 0.32);
|
|
177
201
|
}
|
|
178
202
|
|
|
179
203
|
/* Dracula */
|
|
@@ -191,7 +215,6 @@ body[data-color-theme="dracula"]:not(.light) {
|
|
|
191
215
|
--text-secondary: #d8d8d2;
|
|
192
216
|
--text-tertiary: #b0b3c5;
|
|
193
217
|
--text-muted: #6272a4;
|
|
194
|
-
--chart-fill: rgba(189, 147, 249, 0.32);
|
|
195
218
|
}
|
|
196
219
|
body.light[data-color-theme="dracula"] {
|
|
197
220
|
--accent: #7c3aed;
|
|
@@ -207,7 +230,6 @@ body.light[data-color-theme="dracula"] {
|
|
|
207
230
|
--text-secondary: #34343f;
|
|
208
231
|
--text-tertiary: #5a5a68;
|
|
209
232
|
--text-muted: #787885;
|
|
210
|
-
--chart-fill: rgba(124, 58, 237, 0.32);
|
|
211
233
|
}
|
|
212
234
|
|
|
213
235
|
/* Nord */
|
|
@@ -225,7 +247,6 @@ body[data-color-theme="nord"]:not(.light) {
|
|
|
225
247
|
--text-secondary: #d8dee9;
|
|
226
248
|
--text-tertiary: #aeb6c5;
|
|
227
249
|
--text-muted: #7b88a1;
|
|
228
|
-
--chart-fill: rgba(136, 192, 208, 0.32);
|
|
229
250
|
}
|
|
230
251
|
body.light[data-color-theme="nord"] {
|
|
231
252
|
--accent: #5e81ac;
|
|
@@ -241,7 +262,6 @@ body.light[data-color-theme="nord"] {
|
|
|
241
262
|
--text-secondary: #3b4252;
|
|
242
263
|
--text-tertiary: #4c566a;
|
|
243
264
|
--text-muted: #6b7589;
|
|
244
|
-
--chart-fill: rgba(94, 129, 172, 0.32);
|
|
245
265
|
}
|
|
246
266
|
|
|
247
267
|
/* Rosé Pine */
|
|
@@ -259,7 +279,6 @@ body[data-color-theme="rose-pine"]:not(.light) {
|
|
|
259
279
|
--text-secondary: #c5c2dd;
|
|
260
280
|
--text-tertiary: #908caa;
|
|
261
281
|
--text-muted: #6e6a86;
|
|
262
|
-
--chart-fill: rgba(196, 167, 231, 0.32);
|
|
263
282
|
}
|
|
264
283
|
body.light[data-color-theme="rose-pine"] {
|
|
265
284
|
--accent: #907aa9;
|
|
@@ -275,7 +294,6 @@ body.light[data-color-theme="rose-pine"] {
|
|
|
275
294
|
--text-secondary: #635e87;
|
|
276
295
|
--text-tertiary: #6e6a88;
|
|
277
296
|
--text-muted: #857f96;
|
|
278
|
-
--chart-fill: rgba(144, 122, 169, 0.32);
|
|
279
297
|
}
|
|
280
298
|
|
|
281
299
|
/* Everforest */
|
|
@@ -293,7 +311,6 @@ body[data-color-theme="everforest"]:not(.light) {
|
|
|
293
311
|
--text-secondary: #bfb6a3;
|
|
294
312
|
--text-tertiary: #9da9a0;
|
|
295
313
|
--text-muted: #859289;
|
|
296
|
-
--chart-fill: rgba(167, 192, 128, 0.32);
|
|
297
314
|
}
|
|
298
315
|
body.light[data-color-theme="everforest"] {
|
|
299
316
|
--accent: #6f8352;
|
|
@@ -309,7 +326,6 @@ body.light[data-color-theme="everforest"] {
|
|
|
309
326
|
--text-secondary: #55636b;
|
|
310
327
|
--text-tertiary: #66705f;
|
|
311
328
|
--text-muted: #7a8577;
|
|
312
|
-
--chart-fill: rgba(111, 131, 82, 0.32);
|
|
313
329
|
}
|
|
314
330
|
|
|
315
331
|
/* Kanagawa */
|
|
@@ -327,7 +343,6 @@ body[data-color-theme="kanagawa"]:not(.light) {
|
|
|
327
343
|
--text-secondary: #c8c093;
|
|
328
344
|
--text-tertiary: #a6a69c;
|
|
329
345
|
--text-muted: #727169;
|
|
330
|
-
--chart-fill: rgba(126, 156, 216, 0.32);
|
|
331
346
|
}
|
|
332
347
|
body.light[data-color-theme="kanagawa"] {
|
|
333
348
|
--accent: #4d699b;
|
|
@@ -343,7 +358,6 @@ body.light[data-color-theme="kanagawa"] {
|
|
|
343
358
|
--text-secondary: #66667a;
|
|
344
359
|
--text-tertiary: #716e61;
|
|
345
360
|
--text-muted: #8a8775;
|
|
346
|
-
--chart-fill: rgba(77, 105, 155, 0.32);
|
|
347
361
|
}
|
|
348
362
|
|
|
349
363
|
/* One Dark */
|
|
@@ -361,7 +375,6 @@ body[data-color-theme="one-dark"]:not(.light) {
|
|
|
361
375
|
--text-secondary: #abb2bf;
|
|
362
376
|
--text-tertiary: #8b919e;
|
|
363
377
|
--text-muted: #5c6370;
|
|
364
|
-
--chart-fill: rgba(97, 175, 239, 0.32);
|
|
365
378
|
}
|
|
366
379
|
body.light[data-color-theme="one-dark"] {
|
|
367
380
|
--accent: #4078f2;
|
|
@@ -377,7 +390,6 @@ body.light[data-color-theme="one-dark"] {
|
|
|
377
390
|
--text-secondary: #50525a;
|
|
378
391
|
--text-tertiary: #696c77;
|
|
379
392
|
--text-muted: #a0a1a7;
|
|
380
|
-
--chart-fill: rgba(64, 120, 242, 0.32);
|
|
381
393
|
}
|
|
382
394
|
|
|
383
395
|
/* Night Owl */
|
|
@@ -395,7 +407,6 @@ body[data-color-theme="night-owl"]:not(.light) {
|
|
|
395
407
|
--text-secondary: #b8c5d6;
|
|
396
408
|
--text-tertiary: #8ba3b8;
|
|
397
409
|
--text-muted: #637777;
|
|
398
|
-
--chart-fill: rgba(130, 170, 255, 0.32);
|
|
399
410
|
}
|
|
400
411
|
body.light[data-color-theme="night-owl"] {
|
|
401
412
|
--accent: #0c969b;
|
|
@@ -411,7 +422,6 @@ body.light[data-color-theme="night-owl"] {
|
|
|
411
422
|
--text-secondary: #545167;
|
|
412
423
|
--text-tertiary: #6f6e85;
|
|
413
424
|
--text-muted: #989fb1;
|
|
414
|
-
--chart-fill: rgba(12, 150, 155, 0.32);
|
|
415
425
|
}
|
|
416
426
|
|
|
417
427
|
/* Monokai Pro */
|
|
@@ -429,7 +439,6 @@ body[data-color-theme="monokai"]:not(.light) {
|
|
|
429
439
|
--text-secondary: #d9d8d6;
|
|
430
440
|
--text-tertiary: #939293;
|
|
431
441
|
--text-muted: #727072;
|
|
432
|
-
--chart-fill: rgba(255, 216, 102, 0.32);
|
|
433
442
|
}
|
|
434
443
|
body.light[data-color-theme="monokai"] {
|
|
435
444
|
--accent: #c08a00;
|
|
@@ -445,7 +454,6 @@ body.light[data-color-theme="monokai"] {
|
|
|
445
454
|
--text-secondary: #46434a;
|
|
446
455
|
--text-tertiary: #6b686d;
|
|
447
456
|
--text-muted: #8d8a8d;
|
|
448
|
-
--chart-fill: rgba(192, 138, 0, 0.32);
|
|
449
457
|
}
|
|
450
458
|
|
|
451
459
|
/* GitHub */
|
|
@@ -463,7 +471,6 @@ body[data-color-theme="github"]:not(.light) {
|
|
|
463
471
|
--text-secondary: #d1d5da;
|
|
464
472
|
--text-tertiary: #959da5;
|
|
465
473
|
--text-muted: #6a737d;
|
|
466
|
-
--chart-fill: rgba(88, 166, 255, 0.32);
|
|
467
474
|
}
|
|
468
475
|
body.light[data-color-theme="github"] {
|
|
469
476
|
--accent: #0366d6;
|
|
@@ -479,7 +486,6 @@ body.light[data-color-theme="github"] {
|
|
|
479
486
|
--text-secondary: #444d56;
|
|
480
487
|
--text-tertiary: #586069;
|
|
481
488
|
--text-muted: #6a737d;
|
|
482
|
-
--chart-fill: rgba(3, 102, 214, 0.32);
|
|
483
489
|
}
|
|
484
490
|
|
|
485
491
|
/* Ayu */
|
|
@@ -497,7 +503,6 @@ body[data-color-theme="ayu"]:not(.light) {
|
|
|
497
503
|
--text-secondary: #a8a6a0;
|
|
498
504
|
--text-tertiary: #8a9199;
|
|
499
505
|
--text-muted: #6c7380;
|
|
500
|
-
--chart-fill: rgba(230, 180, 80, 0.32);
|
|
501
506
|
}
|
|
502
507
|
body.light[data-color-theme="ayu"] {
|
|
503
508
|
--accent: #c97612;
|
|
@@ -513,7 +518,6 @@ body.light[data-color-theme="ayu"] {
|
|
|
513
518
|
--text-secondary: #5c6166;
|
|
514
519
|
--text-tertiary: #787b80;
|
|
515
520
|
--text-muted: #8a9199;
|
|
516
|
-
--chart-fill: rgba(201, 118, 18, 0.32);
|
|
517
521
|
}
|
|
518
522
|
|
|
519
523
|
/* Vitesse */
|
|
@@ -531,7 +535,6 @@ body[data-color-theme="vitesse"]:not(.light) {
|
|
|
531
535
|
--text-secondary: #bfbaaa;
|
|
532
536
|
--text-tertiary: #8f8f85;
|
|
533
537
|
--text-muted: #758575;
|
|
534
|
-
--chart-fill: rgba(77, 147, 117, 0.32);
|
|
535
538
|
}
|
|
536
539
|
body.light[data-color-theme="vitesse"] {
|
|
537
540
|
--accent: #1c6b48;
|
|
@@ -547,7 +550,6 @@ body.light[data-color-theme="vitesse"] {
|
|
|
547
550
|
--text-secondary: #4e4f47;
|
|
548
551
|
--text-tertiary: #6b6d63;
|
|
549
552
|
--text-muted: #a0ada0;
|
|
550
|
-
--chart-fill: rgba(28, 107, 72, 0.32);
|
|
551
553
|
}
|
|
552
554
|
|
|
553
555
|
/* Synthwave '84 */
|
|
@@ -565,7 +567,6 @@ body[data-color-theme="synthwave"]:not(.light) {
|
|
|
565
567
|
--text-secondary: #d8d6e8;
|
|
566
568
|
--text-tertiary: #b6b1d8;
|
|
567
569
|
--text-muted: #848bbd;
|
|
568
|
-
--chart-fill: rgba(255, 126, 219, 0.32);
|
|
569
570
|
}
|
|
570
571
|
body.light[data-color-theme="synthwave"] {
|
|
571
572
|
--accent: #c936a6;
|
|
@@ -581,5 +582,4 @@ body.light[data-color-theme="synthwave"] {
|
|
|
581
582
|
--text-secondary: #3d3455;
|
|
582
583
|
--text-tertiary: #5c5380;
|
|
583
584
|
--text-muted: #7d76a3;
|
|
584
|
-
--chart-fill: rgba(201, 54, 166, 0.32);
|
|
585
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
|
-
|
|
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.
|
|
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';
|