claude-code-cost 1.6.1 → 1.6.2
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/package.json +1 -1
- package/public/vendor/claude-hub-sdk.js +57 -11
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// claude-hub-sdk 1.
|
|
1
|
+
// claude-hub-sdk 1.12.0 (sha256 6fb679e4d801). Copied by npm run sdk:sync in claude-code-hub. Do not edit.
|
|
2
2
|
// Claude Code Hub SDK: the one rule that names a key press, shared by the hub page, client.js and
|
|
3
3
|
// stub.js. The hub serves it to its page as /sdk/keys.js; mount() and sdk:sync put it in front of
|
|
4
4
|
// client.js and stub.js, so an app still loads one file.
|
|
@@ -10,19 +10,62 @@ var ClaudeHubKeys = (() => {
|
|
|
10
10
|
// Modifiers in ctrl, alt, shift, meta order, joined by '+' to the key. macOS composes
|
|
11
11
|
// Option+<key> into a character (Option+1 is '¡', Option+P is 'π') and holding Control does not
|
|
12
12
|
// undo it, so e.key alone cannot name these presses there. e.code is the physical key, which is
|
|
13
|
-
// wrong for non-US layouts, hence only as a fallback.
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
13
|
+
// wrong for non-US layouts, hence only as a fallback. A letter or punctuation key falls back to its
|
|
14
|
+
// US character only when e.key is not ASCII (a non-Latin layout, or Option on macOS), so AZERTY's
|
|
15
|
+
// ',' on the M key stays ','. The digit row always falls back, so AZERTY's '&' key is 1, as Windows
|
|
16
|
+
// and VS Code treat it. No fallback under AltGraph: Chromium sets it when AltGr types a character, and that
|
|
17
|
+
// press is text. Takes a real KeyboardEvent or a forwarded {key, code} payload; a payload without
|
|
18
|
+
// code degrades to key. A payload needs no AltGraph: the SDK forwards only a press whose key
|
|
19
|
+
// already names a bound combo.
|
|
20
|
+
// Self-contained on purpose, the table too: cck puts its source text into a sandboxed frame.
|
|
21
|
+
// codeOf() lists the same keys the other way round.
|
|
18
22
|
function comboOf(e) {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
23
|
+
const raw = typeof e.key === 'string' ? e.key : '';
|
|
24
|
+
const lower = raw.toLowerCase();
|
|
25
|
+
const code = e.getModifierState?.('AltGraph') ? '' : e.code || '';
|
|
26
|
+
const latin = !/[^\x20-\x7e]/.test(raw);
|
|
27
|
+
const digit = /^Digit([0-9])$/.exec(code)?.[1];
|
|
28
|
+
const us =
|
|
29
|
+
!latin &&
|
|
30
|
+
(/^Key([A-Z])$/.exec(code)?.[1].toLowerCase() ||
|
|
31
|
+
{
|
|
32
|
+
Minus: '-',
|
|
33
|
+
Equal: '=',
|
|
34
|
+
BracketLeft: '[',
|
|
35
|
+
BracketRight: ']',
|
|
36
|
+
Backslash: '\\',
|
|
37
|
+
Semicolon: ';',
|
|
38
|
+
Quote: "'",
|
|
39
|
+
Backquote: '`',
|
|
40
|
+
Comma: ',',
|
|
41
|
+
Period: '.',
|
|
42
|
+
Slash: '/',
|
|
43
|
+
}[code]);
|
|
44
|
+
const key = /^[a-z0-9]$/.test(lower) ? lower : digit || us || (e.key === ' ' ? 'Space' : e.key);
|
|
22
45
|
const mods = [e.ctrlKey && 'ctrl', e.altKey && 'alt', e.shiftKey && 'shift', e.metaKey && 'meta'];
|
|
23
46
|
return [...mods, key].filter(Boolean).join('+');
|
|
24
47
|
}
|
|
25
48
|
|
|
49
|
+
// The physical key (e.code) that types a combo's key on a US layout, or null for a named key.
|
|
50
|
+
function codeOf(key) {
|
|
51
|
+
if (/^[a-z]$/.test(key)) return `Key${key.toUpperCase()}`;
|
|
52
|
+
if (/^[0-9]$/.test(key)) return `Digit${key}`;
|
|
53
|
+
const codes = {
|
|
54
|
+
'-': 'Minus',
|
|
55
|
+
'=': 'Equal',
|
|
56
|
+
'[': 'BracketLeft',
|
|
57
|
+
']': 'BracketRight',
|
|
58
|
+
'\\': 'Backslash',
|
|
59
|
+
';': 'Semicolon',
|
|
60
|
+
"'": 'Quote',
|
|
61
|
+
'`': 'Backquote',
|
|
62
|
+
',': 'Comma',
|
|
63
|
+
'.': 'Period',
|
|
64
|
+
'/': 'Slash',
|
|
65
|
+
};
|
|
66
|
+
return codes[key] ?? null;
|
|
67
|
+
}
|
|
68
|
+
|
|
26
69
|
// The keys of a combo as a help row shows them: ['Ctrl', 'Alt', 'P'], or ['⌃', '⌥', 'P'] on macOS.
|
|
27
70
|
// The {n} of a numbered combo reads 1…9.
|
|
28
71
|
function keyParts(combo, mac) {
|
|
@@ -47,7 +90,7 @@ var ClaudeHubKeys = (() => {
|
|
|
47
90
|
].filter(Boolean);
|
|
48
91
|
}
|
|
49
92
|
|
|
50
|
-
return { comboOf, keyParts, keySigs };
|
|
93
|
+
return { comboOf, codeOf, keyParts, keySigs };
|
|
51
94
|
})();
|
|
52
95
|
|
|
53
96
|
if (typeof module === 'object' && module.exports) module.exports = ClaudeHubKeys;
|
|
@@ -93,7 +136,9 @@ if (typeof module === 'object' && module.exports) module.exports = ClaudeHubKeys
|
|
|
93
136
|
can: (action) => !!standaloneFn(action),
|
|
94
137
|
forwards: () => false,
|
|
95
138
|
forwardCombos: () => [],
|
|
139
|
+
onKeys: () => off,
|
|
96
140
|
keyLabel: () => null,
|
|
141
|
+
voiceCommands: () => [],
|
|
97
142
|
closeGuard() {},
|
|
98
143
|
openExternal(url) {
|
|
99
144
|
win.open(url, '_blank', 'noopener');
|
|
@@ -103,7 +148,8 @@ if (typeof module === 'object' && module.exports) module.exports = ClaudeHubKeys
|
|
|
103
148
|
return hub;
|
|
104
149
|
}
|
|
105
150
|
|
|
106
|
-
|
|
151
|
+
const mod = { list: [], wrap: () => false, on: () => off, emit() {}, send: () => false };
|
|
152
|
+
return { connect, comboOf, mod };
|
|
107
153
|
}
|
|
108
154
|
|
|
109
155
|
if (typeof module === 'object' && module.exports) module.exports = { createClaudeHub, comboOf };
|