claude-code-kanban 7.30.0 → 7.31.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 +11 -0
- package/lib/terminal-client.js +7 -1
- package/lib/terminal-host.js +4 -1
- package/lib/terminal.js +15 -7
- package/package.json +1 -1
- package/plugin/plugins/claude-code-kanban/.claude-plugin/plugin.json +1 -1
- package/plugin/plugins/claude-code-kanban/skills/addon/references/build.md +15 -3
- package/plugin/plugins/claude-code-kanban/skills/addon/scripts/theme-check.mjs +94 -0
- package/public/app.js +61 -52
- package/public/style.css +1 -1
- package/server.js +8 -0
package/hub-app.json
CHANGED
|
@@ -53,6 +53,17 @@
|
|
|
53
53
|
{ "value": "grid", "label": "Grid" }
|
|
54
54
|
],
|
|
55
55
|
"default": "dots"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"key": "terminalHost",
|
|
59
|
+
"type": "choice",
|
|
60
|
+
"label": "Terminal host (Windows)",
|
|
61
|
+
"help": "Bundled passes color queries through, so apps such as hunk and vim follow the board's theme. Applies to terminals started after the change.",
|
|
62
|
+
"options": [
|
|
63
|
+
{ "value": "system", "label": "System" },
|
|
64
|
+
{ "value": "bundled", "label": "Bundled" }
|
|
65
|
+
],
|
|
66
|
+
"default": "system"
|
|
56
67
|
}
|
|
57
68
|
],
|
|
58
69
|
"keys": { "keeps": ["ctrl+alt+1", "ctrl+alt+2", "ctrl+alt+3", "ctrl+alt+4", "ctrl+alt+5", "ctrl+alt+6", "ctrl+alt+7", "ctrl+alt+8", "ctrl+alt+9", "ctrl+alt+n", "ctrl+alt+r", "ctrl+alt+s", "ctrl+alt+shift+s","ctrl+shift+d", "ctrl+shift+k", "ctrl+shift+l", "ctrl+shift+m", "ctrl+shift+p", "ctrl+shift+z"] },
|
package/lib/terminal-client.js
CHANGED
|
@@ -215,6 +215,12 @@ function createTerminalClient(o) {
|
|
|
215
215
|
if (child?.connected) child.send({ t: 'port', url });
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
// Terminals started after the change use it; a restarted host gets it with its config.
|
|
219
|
+
function setConptyDll(on) {
|
|
220
|
+
config.conptyDll = !!on;
|
|
221
|
+
if (child?.connected) child.send({ t: 'conptyDll', on: config.conptyDll });
|
|
222
|
+
}
|
|
223
|
+
|
|
218
224
|
// With no host there are no terminals, which the hub's eviction check must still read.
|
|
219
225
|
async function sessions() {
|
|
220
226
|
return child?.connected ? call('sessions') : [];
|
|
@@ -240,7 +246,7 @@ function createTerminalClient(o) {
|
|
|
240
246
|
|
|
241
247
|
return {
|
|
242
248
|
token, handleUpgrade, clientConfig, unavailableReason, authorized, isRunning, hasTerminal, sessionOfTerminal, startNew, end, paste, type, restore,
|
|
243
|
-
setServerUrl, sessions, stats, shutdown, started,
|
|
249
|
+
setServerUrl, setConptyDll, sessions, stats, shutdown, started,
|
|
244
250
|
ids: () => [...ids],
|
|
245
251
|
awaitingTrust: () => [...awaitingTrust],
|
|
246
252
|
};
|
package/lib/terminal-host.js
CHANGED
|
@@ -9,6 +9,7 @@ const { whichSync } = require('./open-editor');
|
|
|
9
9
|
|
|
10
10
|
let service = null;
|
|
11
11
|
let serverUrl = null;
|
|
12
|
+
let config = null;
|
|
12
13
|
let lastState = null;
|
|
13
14
|
let nextAsk = 0;
|
|
14
15
|
const asks = new Map();
|
|
@@ -43,9 +44,10 @@ function pushState() {
|
|
|
43
44
|
|
|
44
45
|
function init(msg) {
|
|
45
46
|
serverUrl = msg.serverUrl;
|
|
47
|
+
config = msg.config;
|
|
46
48
|
const liveSessions = () => readLiveSessions(msg.sessionsDir);
|
|
47
49
|
service = createTerminalService({
|
|
48
|
-
config
|
|
50
|
+
config,
|
|
49
51
|
// cck checked Host, Origin and exposure before it handed the socket over.
|
|
50
52
|
net: { EXPOSED: false, upgradeVerdict: () => null },
|
|
51
53
|
claudeDir: msg.claudeDir,
|
|
@@ -89,6 +91,7 @@ async function call(msg) {
|
|
|
89
91
|
process.on('message', (msg, socket) => {
|
|
90
92
|
if (msg.t === 'init') init(msg);
|
|
91
93
|
else if (msg.t === 'port') serverUrl = msg.url;
|
|
94
|
+
else if (msg.t === 'conptyDll' && config) config.conptyDll = msg.on;
|
|
92
95
|
else if (msg.t === 'upgrade') {
|
|
93
96
|
if (!socket) return;
|
|
94
97
|
service.handleUpgrade({ method: msg.method, url: msg.url, headers: msg.headers }, socket, Buffer.from(msg.head, 'base64'));
|
package/lib/terminal.js
CHANGED
|
@@ -114,6 +114,7 @@ function readTerminalConfig({ argv = process.argv, env = process.env, getArgValu
|
|
|
114
114
|
scrollback: posInt(cfg.scrollback, 5000),
|
|
115
115
|
noFlicker: cfg.noFlicker !== false,
|
|
116
116
|
restore: cfg.restore !== false,
|
|
117
|
+
conptyDll: cfg.conptyDll === true,
|
|
117
118
|
};
|
|
118
119
|
}
|
|
119
120
|
|
|
@@ -652,6 +653,19 @@ function createTerminalService(o) {
|
|
|
652
653
|
}
|
|
653
654
|
}
|
|
654
655
|
|
|
656
|
+
// Windows' own ConPTY swallows OSC 10/11 color queries and drops OSC replies on input, so apps such as
|
|
657
|
+
// hunk cannot read the theme. The ConPTY that node-pty ships passes both; a spawn it fails falls back.
|
|
658
|
+
function spawnPty(args, opts) {
|
|
659
|
+
if (process.platform === 'win32' && config.conptyDll) {
|
|
660
|
+
try {
|
|
661
|
+
return pty.spawn(shell, args, { ...opts, useConptyDll: true });
|
|
662
|
+
} catch (e) {
|
|
663
|
+
console.log(`Bundled ConPTY failed, using the system one: ${e.message}`);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
return pty.spawn(shell, args, opts);
|
|
667
|
+
}
|
|
668
|
+
|
|
655
669
|
function spawnSession(id, mode, cwdCandidate, cols, rows, spec, extraEnv) {
|
|
656
670
|
const cwd = cwdCandidate && fs.existsSync(cwdCandidate) ? cwdCandidate : os.homedir();
|
|
657
671
|
const terminalId = savedTerminalIds[id] || crypto.randomUUID();
|
|
@@ -661,13 +675,7 @@ function createTerminalService(o) {
|
|
|
661
675
|
// Git Bash's login profile cds to $HOME unless this is set.
|
|
662
676
|
if (shellFamily(shell) === 'gitbash') env.CHERE_INVOKING = '1';
|
|
663
677
|
const claudeArgs = claudeArgsFor(mode, id, spec);
|
|
664
|
-
const proc =
|
|
665
|
-
name: 'xterm-256color',
|
|
666
|
-
cols,
|
|
667
|
-
rows,
|
|
668
|
-
cwd,
|
|
669
|
-
env,
|
|
670
|
-
});
|
|
678
|
+
const proc = spawnPty(shellArgs(shell, spec?.edit ? null : claudeArgs), { name: 'xterm-256color', cols, rows, cwd, env });
|
|
671
679
|
const term = new Headless({ cols, rows, scrollback: config.scrollback, allowProposedApi: true });
|
|
672
680
|
const serializer = new Serialize();
|
|
673
681
|
term.loadAddon(serializer);
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-kanban",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.0",
|
|
4
4
|
"description": "claude-code-kanban dashboard integration: agent activity tracking, context and cost tracking, board moves and reviews delivered to the session, and skills to drive the board from a session"
|
|
5
5
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Build an add-on
|
|
2
2
|
|
|
3
|
-
An add-on is one HTML page and a small server that serves it. The board frames the page by its URL, so any stack works; this guide uses Node with no dependencies. The build is done when the server answers 200 and `addon add` printed an id.
|
|
3
|
+
An add-on is one HTML page and a small server that serves it. The board frames the page by its URL, so any stack works; this guide uses Node with no dependencies. The build is done when the theme check passes, the server answers 200 and `addon add` printed an id.
|
|
4
4
|
|
|
5
5
|
## 1. Write the server and the page
|
|
6
6
|
|
|
@@ -28,7 +28,7 @@ The URL is the page's only input from the board. The page reads the values the b
|
|
|
28
28
|
|
|
29
29
|
## 3. Take the board's theme
|
|
30
30
|
|
|
31
|
-
Style the page with the variables of the HTML contract in [the show skill](../../show/SKILL.md#html-contract), in its flat style. Set fallback values for them in `:where(:root)`, and
|
|
31
|
+
Style the page with the variables of the HTML contract in [the show skill](../../show/SKILL.md#html-contract), in its flat style. Set fallback values for them in `:where(:root)`, and set `:root { color-scheme: var(--color-scheme, light dark); }` so scrollbars and form controls follow the board, not the OS. Apply the board's values from its message, which it sends on each load and each theme change:
|
|
32
32
|
|
|
33
33
|
```js
|
|
34
34
|
addEventListener('message', (e) => {
|
|
@@ -69,7 +69,19 @@ When the content follows files, the server watches them (`fs.watch`) and pushes
|
|
|
69
69
|
|
|
70
70
|
The dock is 360 to 900 px wide and the full height of the terminal. Lay the page out in normal flow that wraps at 360 px, and let the body scroll.
|
|
71
71
|
|
|
72
|
-
## 7.
|
|
72
|
+
## 7. Verify the theme
|
|
73
|
+
|
|
74
|
+
Run the static check, `scripts/theme-check.mjs` in this skill's base directory, on the page, and fix every error before you register it:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
node <skill base dir>/scripts/theme-check.mjs <folder>/index.html
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
It fails on a literal color (hex, `rgb()`, `hsl()`, `oklch()`, a named color) in CSS, a `style` attribute, an SVG `fill` or `stroke`, or a JS string, and on a page with no `cck-show:tokens` listener. It warns on a variable that is not a board token, a token with no fallback, a literal font, and a missing `color-scheme`. A literal color is allowed only as a token's fallback in `:where(:root)`. For a shade, mix a token: `color-mix(in srgb, var(--color-accent) 14%, transparent)`.
|
|
81
|
+
|
|
82
|
+
A pass does not prove the page follows the theme. The check reads one file, so it does not see colors built at runtime (`'#' + hex`, colors from the server), linked stylesheets, library CSS, canvas or images. Keep those on tokens too, and when the page has any of them, open it on the rail and switch the board between light and dark.
|
|
83
|
+
|
|
84
|
+
## 8. Run and register
|
|
73
85
|
|
|
74
86
|
1. Start the server where the user can see and stop it, such as a tmux window, or ask the user to start it.
|
|
75
87
|
2. Check that it answers 200: `curl -s -o /dev/null -w '%{http_code}' http://localhost:4100/`.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Static theme check for an add-on page: node theme-check.mjs <page.html>. Exits 1 on an error.
|
|
2
|
+
// The token list mirrors the HTML contract in skills/show/SKILL.md.
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
|
|
5
|
+
const CONTRACT = new Set([
|
|
6
|
+
'--color-bg', '--color-bg-subtle', '--color-text', '--color-text-muted', '--color-border', '--color-accent',
|
|
7
|
+
'--color-info', '--color-success', '--color-warning', '--color-danger', '--font-sans', '--font-mono', '--color-scheme',
|
|
8
|
+
...Array.from({ length: 8 }, (_, i) => `--color-series-${i + 1}`),
|
|
9
|
+
...Array.from({ length: 5 }, (_, i) => `--color-ramp-${i + 1}`),
|
|
10
|
+
]);
|
|
11
|
+
const NAMED = 'white|black|red|green|blue|gray|grey|silver|orange|yellow|purple|pink|navy|teal|maroon|olive|lime|aqua|fuchsia|gold|crimson|tomato|coral|salmon|indigo|violet|brown|beige|ivory|khaki|lavender|tan|cyan|magenta|whitesmoke|gainsboro|lightgray|lightgrey|darkgray|darkgrey|dimgray|dimgrey';
|
|
12
|
+
const RAW_FN = '#[0-9a-f]{3,8}\\b|\\b(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch)\\(';
|
|
13
|
+
const RAW = new RegExp(`${RAW_FN}|\\b(?:${NAMED})\\b`, 'i');
|
|
14
|
+
// In JS a named color is too likely an ordinary word, so only hex and color functions count.
|
|
15
|
+
const RAW_JS = new RegExp(RAW_FN, 'i');
|
|
16
|
+
const COLOR_PROPS = /^(?:color|background(?:-color|-image)?|border(?:-[a-z]+)*|outline(?:-color)?|fill|stroke|box-shadow|text-shadow|caret-color|accent-color|text-decoration(?:-color)?|column-rule(?:-color)?|stop-color|flood-color|lighting-color|--[\w-]+)$/i;
|
|
17
|
+
|
|
18
|
+
const file = process.argv[2];
|
|
19
|
+
const src = readFileSync(file, 'utf8');
|
|
20
|
+
const lineOf = (i) => src.slice(0, i).split('\n').length;
|
|
21
|
+
const findings = [];
|
|
22
|
+
const report = (level, i, rule, text) =>
|
|
23
|
+
findings.push({ level, line: i == null ? 0 : lineOf(i), rule, text: text.trim().slice(0, 110) });
|
|
24
|
+
|
|
25
|
+
const usedVars = new Set();
|
|
26
|
+
const definedVars = new Set();
|
|
27
|
+
const fallbackVars = new Set();
|
|
28
|
+
const collectVars = (s) => {
|
|
29
|
+
for (const v of s.matchAll(/var\(\s*(--[\w-]+)/g)) usedVars.add(v[1]);
|
|
30
|
+
};
|
|
31
|
+
const stripVars = (s) => s.replace(/var\([^)]*\)/g, '');
|
|
32
|
+
|
|
33
|
+
// CSS: every declaration inside <style> blocks and style="" attributes.
|
|
34
|
+
function checkCss(css, base, inline) {
|
|
35
|
+
const bodies = inline
|
|
36
|
+
? [{ sel: '[style]', body: css, at: 0 }]
|
|
37
|
+
: [...css.matchAll(/([^{}]*)\{([^{}]*)\}/g)].map((m) => ({ sel: m[1].trim(), body: m[2], at: m.index + m[1].length + 1 }));
|
|
38
|
+
for (const { sel, body, at } of bodies) {
|
|
39
|
+
const isRoot = /(^|,)\s*(:where\(\s*:root\s*\)|:root|html)\s*$/.test(sel);
|
|
40
|
+
for (const d of body.matchAll(/([-\w]+)\s*:\s*([^;]+)/g)) {
|
|
41
|
+
const [, prop, value] = d;
|
|
42
|
+
const i = base + at + d.index;
|
|
43
|
+
collectVars(value);
|
|
44
|
+
if (prop.startsWith('--')) {
|
|
45
|
+
definedVars.add(prop);
|
|
46
|
+
if (isRoot && CONTRACT.has(prop)) fallbackVars.add(prop);
|
|
47
|
+
}
|
|
48
|
+
if (/^font(-family)?$/.test(prop) && !/var\(--font-/.test(value) && !/^(inherit|initial|unset)$/.test(value.trim()))
|
|
49
|
+
report('warn', i, 'font-literal', `${prop}: ${value}`);
|
|
50
|
+
if (!COLOR_PROPS.test(prop) || !RAW.test(stripVars(value))) continue;
|
|
51
|
+
if (isRoot && CONTRACT.has(prop)) continue; // fallback value for a board token
|
|
52
|
+
if (/^(?:transparent|currentcolor|inherit|none)$/i.test(value.trim())) continue;
|
|
53
|
+
report('error', i, prop.startsWith('--') ? 'raw-color-in-custom-prop' : 'raw-color', `${sel ? `${sel.split('\n').pop().trim()} { ` : ''}${prop}: ${value}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
for (const m of src.matchAll(/<style[^>]*>([\s\S]*?)<\/style>/gi)) checkCss(m[1], m.index + m[0].indexOf(m[1]), false);
|
|
59
|
+
for (const m of src.matchAll(/\sstyle\s*=\s*"([^"]*)"/gi)) checkCss(m[1], m.index, true);
|
|
60
|
+
for (const m of src.matchAll(/\s(fill|stroke|color|bgcolor|stop-color)\s*=\s*"([^"]*)"/gi)) {
|
|
61
|
+
collectVars(m[2]);
|
|
62
|
+
if (RAW.test(stripVars(m[2]))) report('error', m.index, 'raw-color-attr', `${m[1]}="${m[2]}"`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// JS: string literals and template parts that carry a color.
|
|
66
|
+
let hasListener = false;
|
|
67
|
+
for (const m of src.matchAll(/<script[^>]*>([\s\S]*?)<\/script>/gi)) {
|
|
68
|
+
const js = m[1];
|
|
69
|
+
const base = m.index + m[0].indexOf(js);
|
|
70
|
+
if (/cck-show:tokens/.test(js)) hasListener = true;
|
|
71
|
+
for (const s of js.matchAll(/(['"`])((?:\\.|(?!\1)[^\\])*)\1/g)) {
|
|
72
|
+
const str = s[2];
|
|
73
|
+
collectVars(str);
|
|
74
|
+
const selectorArg = /(?:querySelector(?:All)?|closest|matches|getElementById)\(\s*$/.test(js.slice(Math.max(0, s.index - 30), s.index));
|
|
75
|
+
if (!selectorArg && RAW_JS.test(stripVars(str)))
|
|
76
|
+
report('error', base + s.index, 'raw-color-js', s[0]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!/color-scheme\s*:\s*var\(\s*--color-scheme/.test(src))
|
|
81
|
+
report('warn', null, 'no-color-scheme', 'color-scheme does not follow var(--color-scheme): scrollbars and native controls follow the OS');
|
|
82
|
+
if (!hasListener) report('error', null, 'no-token-listener', "no 'cck-show:tokens' message listener");
|
|
83
|
+
for (const v of usedVars) {
|
|
84
|
+
if (!CONTRACT.has(v) && !definedVars.has(v)) report('warn', null, 'unknown-var', `${v} is not a board token and is not defined`);
|
|
85
|
+
if (CONTRACT.has(v) && v !== '--color-scheme' && !fallbackVars.has(v)) report('warn', null, 'no-fallback', `${v} has no fallback in :where(:root)`);
|
|
86
|
+
}
|
|
87
|
+
const unused = [...CONTRACT].filter((t) => !usedVars.has(t) && !t.startsWith('--color-series') && !t.startsWith('--color-ramp') && t !== '--color-scheme');
|
|
88
|
+
if (unused.length) report('info', null, 'unused-tokens', unused.join(', '));
|
|
89
|
+
|
|
90
|
+
findings.sort((a, b) => a.line - b.line);
|
|
91
|
+
for (const f of findings) console.log(`${f.level.padEnd(5)} ${String(f.line || '-').padStart(4)} ${f.rule.padEnd(24)} ${f.text}`);
|
|
92
|
+
const errors = findings.filter((f) => f.level === 'error').length;
|
|
93
|
+
console.log(`\n${errors} error(s), ${findings.filter((f) => f.level === 'warn').length} warning(s)`);
|
|
94
|
+
process.exit(errors ? 1 : 0);
|
package/public/app.js
CHANGED
|
@@ -124,8 +124,6 @@ let currentWaiting = null;
|
|
|
124
124
|
let lastWaitingHash = '';
|
|
125
125
|
let lastAgentsHash = '';
|
|
126
126
|
let messagePanelOpen = false;
|
|
127
|
-
let logAutoOpened = false;
|
|
128
|
-
const logDismissed = new Set();
|
|
129
127
|
let lastMessagesHash = '';
|
|
130
128
|
let currentMessages = [];
|
|
131
129
|
let agentDurationInterval = null;
|
|
@@ -233,7 +231,7 @@ function updateUrl() {
|
|
|
233
231
|
if (filterProject && filterProject !== FILTER_DEFAULTS.project) params.set('project', filterProject);
|
|
234
232
|
if (ownerFilter) params.set('owner', ownerFilter);
|
|
235
233
|
if (searchQuery) params.set('search', searchQuery);
|
|
236
|
-
if (messagePanelOpen
|
|
234
|
+
if (messagePanelOpen) params.set('messages', '1');
|
|
237
235
|
const qs = params.toString();
|
|
238
236
|
const url = qs ? `?${qs}` : window.location.pathname;
|
|
239
237
|
history.replaceState(null, '', url);
|
|
@@ -805,7 +803,6 @@ async function fetchTasks(sessionId) {
|
|
|
805
803
|
if (switched) leaveZenScopeFor(sessionId);
|
|
806
804
|
currentSessionId = sessionId;
|
|
807
805
|
markOpenSessionRead();
|
|
808
|
-
if (switched) autoRevealLog(sessionId);
|
|
809
806
|
// A task change in the open session must not reset the messages, the agents or the owner
|
|
810
807
|
// filter: that reset rebuilds the panels and reads as a reload after each card move.
|
|
811
808
|
if (!refresh) {
|
|
@@ -962,30 +959,7 @@ async function refreshProjectAgents() {
|
|
|
962
959
|
//#endregion
|
|
963
960
|
|
|
964
961
|
//#region MESSAGE_PANEL
|
|
965
|
-
function setMessagePanelVisible(open) {
|
|
966
|
-
messagePanelOpen = open;
|
|
967
|
-
document.getElementById('message-panel').classList.toggle('visible', open);
|
|
968
|
-
document.getElementById('message-toggle')?.classList.toggle('active', open);
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
// An empty board has nothing to show, so the log opens in its place. It is not the user's choice,
|
|
972
|
-
// so it is not stored, it closes again on a session with tasks or panes, and a manual close sticks for that session.
|
|
973
|
-
// The pane layout loads after the switch, and applyPaneLayout asks again once it is in.
|
|
974
|
-
function autoRevealLog(sessionId) {
|
|
975
|
-
if (!paneLayouts.has(sessionId)) return;
|
|
976
|
-
const empty = !currentTasks.length && !paneLayout(sessionId).panes.length;
|
|
977
|
-
if (empty && !messagePanelOpen && !logDismissed.has(sessionId) && !wantsTerminal()) {
|
|
978
|
-
setMessagePanelVisible(true);
|
|
979
|
-
logAutoOpened = true;
|
|
980
|
-
} else if (!empty && logAutoOpened) {
|
|
981
|
-
setMessagePanelVisible(false);
|
|
982
|
-
logAutoOpened = false;
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
|
|
986
962
|
function toggleMessagePanel() {
|
|
987
|
-
if (logAutoOpened && messagePanelOpen && currentSessionId) logDismissed.add(currentSessionId);
|
|
988
|
-
logAutoOpened = false;
|
|
989
963
|
const panel = document.getElementById('message-panel');
|
|
990
964
|
messagePanelOpen = !messagePanelOpen;
|
|
991
965
|
termState.panelHidden = false;
|
|
@@ -7115,9 +7089,15 @@ const SHORTCUT_TABS = [
|
|
|
7115
7089
|
yields: 'ctrl+alt+1',
|
|
7116
7090
|
label: 'Go to tab or group N (the board is 1)',
|
|
7117
7091
|
},
|
|
7118
|
-
{
|
|
7092
|
+
{
|
|
7093
|
+
keys: ['Alt', '[ / ]'],
|
|
7094
|
+
combo: true,
|
|
7095
|
+
label: 'Change the tab in the focused side of a split, else previous / next tab',
|
|
7096
|
+
},
|
|
7119
7097
|
{ keys: ['|'], label: 'Split with the tab before it / unsplit (or drag a tab onto a side)' },
|
|
7098
|
+
{ keys: ['Alt', '|'], combo: true, label: 'Split / unsplit, from a shell too' },
|
|
7120
7099
|
{ keys: ['{', '}'], label: 'Focus left / right side of a split' },
|
|
7100
|
+
{ keys: ['Alt', '{ / }'], combo: true, label: 'Focus left / right side of a split, from a shell too' },
|
|
7121
7101
|
{ keys: ['Alt', 'W'], combo: true, label: 'Close the focused pane' },
|
|
7122
7102
|
{ keys: ['Shift', 'F10'], combo: true, label: 'Focused tab menu (or Menu key)' },
|
|
7123
7103
|
],
|
|
@@ -8588,8 +8568,10 @@ document.addEventListener('keydown', (e) => {
|
|
|
8588
8568
|
return;
|
|
8589
8569
|
}
|
|
8590
8570
|
const altOnly = e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey;
|
|
8591
|
-
|
|
8592
|
-
|
|
8571
|
+
// The Alt forms work from a shell pane, which types the plain [ ] { }.
|
|
8572
|
+
const bracket = e.code === 'BracketLeft' ? -1 : e.code === 'BracketRight' ? 1 : 0;
|
|
8573
|
+
if (altOnly && bracket) {
|
|
8574
|
+
if (cyclePane(bracket) || cyclePaneStrip(bracket)) {
|
|
8593
8575
|
e.preventDefault();
|
|
8594
8576
|
focusActivePane();
|
|
8595
8577
|
}
|
|
@@ -8610,11 +8592,13 @@ document.addEventListener('keydown', (e) => {
|
|
|
8610
8592
|
return;
|
|
8611
8593
|
}
|
|
8612
8594
|
const plainShift = !e.ctrlKey && !e.altKey && !e.metaKey;
|
|
8613
|
-
|
|
8595
|
+
const altShift = e.altKey && e.shiftKey && !e.ctrlKey && !e.metaKey;
|
|
8596
|
+
if (((plainShift && e.key === '|') || (altShift && e.code === 'Backslash')) && togglePaneSplit()) {
|
|
8614
8597
|
e.preventDefault();
|
|
8615
8598
|
return;
|
|
8616
8599
|
}
|
|
8617
|
-
|
|
8600
|
+
const toSide = plainShift && e.key === '{' ? -1 : plainShift && e.key === '}' ? 1 : altShift ? bracket : 0;
|
|
8601
|
+
if (toSide && focusPaneSide(toSide < 0 ? 'l' : 'r')) {
|
|
8618
8602
|
e.preventDefault();
|
|
8619
8603
|
focusActivePane();
|
|
8620
8604
|
return;
|
|
@@ -9409,6 +9393,12 @@ const PANE_CLAIMS = [
|
|
|
9409
9393
|
{ key: 'Unidentified', code: 'KeyM' },
|
|
9410
9394
|
{ ctrlKey: true, key: 'm', code: '' },
|
|
9411
9395
|
...['BracketLeft', 'BracketRight', 'KeyW'].map((code) => ({ altKey: true, key: 'Unidentified', code })),
|
|
9396
|
+
...['BracketLeft', 'BracketRight', 'Backslash'].map((code) => ({
|
|
9397
|
+
altKey: true,
|
|
9398
|
+
shiftKey: true,
|
|
9399
|
+
key: 'Unidentified',
|
|
9400
|
+
code,
|
|
9401
|
+
})),
|
|
9412
9402
|
...['KeyL', 'KeyM', 'KeyP', 'KeyS', 'KeyZ'].map((code) => ({ shiftKey: true, key: 'Unidentified', code })),
|
|
9413
9403
|
...'123456789'.split('').map((n) => ({ ctrlKey: true, altKey: true, key: 'Unidentified', code: `Digit${n}` })),
|
|
9414
9404
|
];
|
|
@@ -12428,10 +12418,27 @@ function leaveZenScopeFor(sessionId) {
|
|
|
12428
12418
|
if (!session || !inZenScope(session)) toggleZenMode();
|
|
12429
12419
|
}
|
|
12430
12420
|
|
|
12421
|
+
let terminalHost = null;
|
|
12422
|
+
let sentTerminalHost = null;
|
|
12423
|
+
|
|
12431
12424
|
function applyHubSettings(s) {
|
|
12432
12425
|
sessionsList.classList.toggle('zen-centered', s.zenCentered === true);
|
|
12433
12426
|
if (s.zenPattern) sessionsList.dataset.zenPattern = s.zenPattern;
|
|
12434
12427
|
else delete sessionsList.dataset.zenPattern;
|
|
12428
|
+
terminalHost = s.terminalHost || null;
|
|
12429
|
+
syncTerminalHost();
|
|
12430
|
+
}
|
|
12431
|
+
|
|
12432
|
+
// The settings can land before /api/config says whether this board has a terminal.
|
|
12433
|
+
function syncTerminalHost() {
|
|
12434
|
+
if (!terminalHost || terminalHost === sentTerminalHost || !terminalAvailable()) return;
|
|
12435
|
+
const host = terminalHost;
|
|
12436
|
+
sentTerminalHost = host;
|
|
12437
|
+
terminalFetch('/api/terminal/options', 'POST', { conptyDll: host === 'bundled' })
|
|
12438
|
+
.then((res) => res.ok || Promise.reject())
|
|
12439
|
+
.catch(() => {
|
|
12440
|
+
if (sentTerminalHost === host) sentTerminalHost = null;
|
|
12441
|
+
});
|
|
12435
12442
|
}
|
|
12436
12443
|
|
|
12437
12444
|
function renderZenState() {
|
|
@@ -14209,7 +14216,6 @@ function applyPaneLayout(sid, layout) {
|
|
|
14209
14216
|
if (sid === dockSid) renderDockRail();
|
|
14210
14217
|
if (sid !== paneSessionId()) return;
|
|
14211
14218
|
syncPanes();
|
|
14212
|
-
autoRevealLog(sid);
|
|
14213
14219
|
}
|
|
14214
14220
|
|
|
14215
14221
|
async function fetchPaneLayout(sid) {
|
|
@@ -14720,16 +14726,18 @@ function paneUrlFrame(pane, className) {
|
|
|
14720
14726
|
frame.setAttribute('referrerpolicy', 'no-referrer');
|
|
14721
14727
|
frame.title = pane.title;
|
|
14722
14728
|
frame.src = pane.target;
|
|
14729
|
+
// Each load is a new page: it needs the theme and the host keys again.
|
|
14730
|
+
frame.addEventListener('load', () => {
|
|
14731
|
+
postToShowFrames(() => ({ type: `${SHOW_MSG}tokens`, tokens: showTokens() }), [frame]);
|
|
14732
|
+
frame.hostKeysSig = null;
|
|
14733
|
+
pushTerminalClaims();
|
|
14734
|
+
});
|
|
14723
14735
|
return frame;
|
|
14724
14736
|
}
|
|
14725
14737
|
|
|
14726
14738
|
function mountPaneUrlFrame(pane, view) {
|
|
14727
14739
|
const frame = paneUrlFrame(pane, 'pane-frame pane-url-frame modal-zoomable');
|
|
14728
|
-
frame.addEventListener('load', () =>
|
|
14729
|
-
view.classList.remove('keys-bridged');
|
|
14730
|
-
frame.hostKeysSig = null;
|
|
14731
|
-
pushTerminalClaims();
|
|
14732
|
-
});
|
|
14740
|
+
frame.addEventListener('load', () => view.classList.remove('keys-bridged'));
|
|
14733
14741
|
view.appendChild(frame);
|
|
14734
14742
|
view.insertAdjacentHTML('beforeend', paneUrlBarHtml());
|
|
14735
14743
|
return frame;
|
|
@@ -15047,7 +15055,7 @@ function selectPane(id) {
|
|
|
15047
15055
|
}
|
|
15048
15056
|
|
|
15049
15057
|
// Flips the focused side of the split through the free tabs. Returns false with no split on
|
|
15050
|
-
// screen, so the key keeps its other meaning.
|
|
15058
|
+
// screen or no other free tab, so the key keeps its other meaning.
|
|
15051
15059
|
function cyclePane(step) {
|
|
15052
15060
|
const sid = paneSessionId();
|
|
15053
15061
|
const split = sid && !wantsTerminal() && getPaneSplit(sid);
|
|
@@ -15055,7 +15063,7 @@ function cyclePane(step) {
|
|
|
15055
15063
|
const active = getActivePaneId(sid);
|
|
15056
15064
|
const pairs = getPanePairs(sid);
|
|
15057
15065
|
const ids = freePaneTabs(sid, active, pairs);
|
|
15058
|
-
if (ids.length < 2) return
|
|
15066
|
+
if (ids.length < 2) return false;
|
|
15059
15067
|
const next = ids[(ids.indexOf(active) + step + ids.length) % ids.length];
|
|
15060
15068
|
const side = splitSideOf(split, active);
|
|
15061
15069
|
setPanePairs(
|
|
@@ -16262,10 +16270,7 @@ function syncTerminal() {
|
|
|
16262
16270
|
if (view !== termState.syncedView) {
|
|
16263
16271
|
termState.syncedView = view;
|
|
16264
16272
|
// The terminal shows the same conversation, so the log panel only takes width; it comes back when the terminal goes.
|
|
16265
|
-
if (on &&
|
|
16266
|
-
setMessagePanelVisible(false);
|
|
16267
|
-
logAutoOpened = false;
|
|
16268
|
-
} else if (on && messagePanelOpen) {
|
|
16273
|
+
if (on && messagePanelOpen) {
|
|
16269
16274
|
toggleMessagePanel();
|
|
16270
16275
|
termState.panelHidden = true;
|
|
16271
16276
|
} else if (!on && arrived && termState.panelHidden) toggleMessagePanel();
|
|
@@ -17430,6 +17435,12 @@ window.addEventListener('message', (e) => {
|
|
|
17430
17435
|
// Only keys a shell does not type: the pane switch and close keys and the session tab keys.
|
|
17431
17436
|
const SHELL_PANE_CLAIMS = [
|
|
17432
17437
|
...['BracketLeft', 'BracketRight', 'KeyW'].map((code) => ({ altKey: true, key: 'Unidentified', code })),
|
|
17438
|
+
...['BracketLeft', 'BracketRight', 'Backslash'].map((code) => ({
|
|
17439
|
+
altKey: true,
|
|
17440
|
+
shiftKey: true,
|
|
17441
|
+
key: 'Unidentified',
|
|
17442
|
+
code,
|
|
17443
|
+
})),
|
|
17433
17444
|
...'123456789'.split('').map((n) => ({ ctrlKey: true, altKey: true, key: 'Unidentified', code: `Digit${n}` })),
|
|
17434
17445
|
];
|
|
17435
17446
|
const SHELL_RETRY_MS = 1000;
|
|
@@ -18361,7 +18372,7 @@ new MutationObserver(() => {
|
|
|
18361
18372
|
});
|
|
18362
18373
|
}).observe(document.body, { attributes: true, attributeFilter: ['class', 'data-color-theme', 'style'] });
|
|
18363
18374
|
|
|
18364
|
-
const PANE_SHOW_FRAMES = '.show-pane-frame, .themed-frame, .ask-frame, .dock-addon-frame';
|
|
18375
|
+
const PANE_SHOW_FRAMES = '.show-pane-frame, .themed-frame, .ask-frame, .dock-addon-frame, .pane-url-frame';
|
|
18365
18376
|
|
|
18366
18377
|
// Builds the message only when a frame is there, because showTokens forces a style recalc.
|
|
18367
18378
|
function postToShowFrames(makeMsg, frames = [showState.frame, ...document.querySelectorAll(PANE_SHOW_FRAMES)]) {
|
|
@@ -18592,7 +18603,8 @@ function renderDockAddon(pane) {
|
|
|
18592
18603
|
if (pane) {
|
|
18593
18604
|
if (!panel.firstChild) {
|
|
18594
18605
|
panel.innerHTML = `<header class="show-head dock-addon-head" tabindex="-1"><span class="show-nav"><span class="show-title"></span></span>
|
|
18595
|
-
<span class="show-actions">${showBtnHtml('dock', '
|
|
18606
|
+
<span class="show-actions">${showBtnHtml('dock', 'pane', 'pane', 'Open as a pane of the session')}
|
|
18607
|
+
${showBtnHtml('dock', 'open', 'external', 'Open in a new tab')}
|
|
18596
18608
|
${showBtnHtml('dock', 'expand', 'expand', 'Fill the terminal · Alt+Enter')}
|
|
18597
18609
|
${showBtnHtml('dock', 'reload', 'reload', 'Reload')}
|
|
18598
18610
|
${showBtnHtml('dock', 'remove', 'clear', 'Remove from the rail')}
|
|
@@ -18605,6 +18617,7 @@ function renderDockAddon(pane) {
|
|
|
18605
18617
|
const open = panel.querySelector('[data-dock="open"]');
|
|
18606
18618
|
open.title = `Open ${pane.target} in a new tab`;
|
|
18607
18619
|
open.setAttribute('aria-label', open.title);
|
|
18620
|
+
panel.querySelector('[data-dock="pane"]').hidden = !pane.addon;
|
|
18608
18621
|
panel.classList.toggle('expanded', dockExpanded);
|
|
18609
18622
|
panel.style.setProperty('--show-term-font', `${currentTerminalFontSize()}px`);
|
|
18610
18623
|
const expand = panel.querySelector('[data-dock="expand"]');
|
|
@@ -18648,11 +18661,6 @@ function createDockView(pane) {
|
|
|
18648
18661
|
if (pane.run && !dockAddonUp.has(pane.id)) return startDockAddon(pane);
|
|
18649
18662
|
const frame = paneUrlFrame(pane, 'dock-addon-frame');
|
|
18650
18663
|
frame.dataset.target = pane.target;
|
|
18651
|
-
frame.addEventListener('load', () => {
|
|
18652
|
-
postToShowFrames(() => ({ type: `${SHOW_MSG}tokens`, tokens: showTokens() }), [frame]);
|
|
18653
|
-
frame.hostKeysSig = null;
|
|
18654
|
-
pushTerminalClaims();
|
|
18655
|
-
});
|
|
18656
18664
|
if (pane.addon || paneFraming.get(pane.target)) return frame;
|
|
18657
18665
|
const sid = dockSid;
|
|
18658
18666
|
probePaneFraming(sid, pane).then((frameable) => {
|
|
@@ -18855,6 +18863,7 @@ function initDockRail() {
|
|
|
18855
18863
|
if (e.target.closest('[data-dock="close"]')) dockRailCommand(pane.id);
|
|
18856
18864
|
else if (e.target.closest('[data-dock="expand"]')) setDockExpanded(!dockExpanded);
|
|
18857
18865
|
else if (e.target.closest('[data-dock="remove"]')) removeDockItem(pane);
|
|
18866
|
+
else if (e.target.closest('[data-dock="pane"]')) addPaneToSession(dockSid, pane.target, pane.title);
|
|
18858
18867
|
else if (e.target.closest('[data-dock="reload"]')) {
|
|
18859
18868
|
dockAddonUp.delete(pane.id);
|
|
18860
18869
|
dropDockView(pane.id);
|
|
@@ -20048,6 +20057,7 @@ if (urlState.search) {
|
|
|
20048
20057
|
getJson('/api/config')
|
|
20049
20058
|
.then((c) => {
|
|
20050
20059
|
if (c) appConfig = c;
|
|
20060
|
+
syncTerminalHost();
|
|
20051
20061
|
if (appConfig.kanbot && footerState.version) renderSidebarFooter(footerState.rl);
|
|
20052
20062
|
})
|
|
20053
20063
|
.then(restorePendingSessions)
|
|
@@ -20085,7 +20095,6 @@ getJson('/api/config')
|
|
|
20085
20095
|
}
|
|
20086
20096
|
if (focusZoneBeforeReload === 'sidebar') setFocusZone('sidebar');
|
|
20087
20097
|
if (urlState.messages && currentSessionId) {
|
|
20088
|
-
if (logAutoOpened) setMessagePanelVisible(false);
|
|
20089
20098
|
toggleMessagePanel();
|
|
20090
20099
|
// Re-render after panel layout settles so scroll dimensions are correct
|
|
20091
20100
|
requestAnimationFrame(() => {
|
package/public/style.css
CHANGED
package/server.js
CHANGED
|
@@ -3430,6 +3430,14 @@ app.post('/api/terminal/pick-folder', async (req, res) => {
|
|
|
3430
3430
|
}
|
|
3431
3431
|
});
|
|
3432
3432
|
|
|
3433
|
+
// The hub's terminalHost setting reaches only the board page, which relays it here.
|
|
3434
|
+
app.post('/api/terminal/options', (req, res) => {
|
|
3435
|
+
if (!terminal.authorized(req.get('x-terminal-token'))) return res.status(401).json({ error: 'invalid terminal token' });
|
|
3436
|
+
if (typeof req.body?.conptyDll !== 'boolean') return res.status(400).json({ error: 'conptyDll must be a boolean' });
|
|
3437
|
+
terminal.setConptyDll(req.body.conptyDll);
|
|
3438
|
+
res.status(204).end();
|
|
3439
|
+
});
|
|
3440
|
+
|
|
3433
3441
|
// A tab whose terminal is off, or whose token died with an earlier server, ignores
|
|
3434
3442
|
// `session:launched`, so only a tab that claims the session counts as showing it.
|
|
3435
3443
|
const LAUNCH_CLAIM_MS = 3000;
|