claude-code-kanban 7.30.0 → 7.32.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/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 && !logAutoOpened) params.set('messages', '1');
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;
@@ -4177,10 +4151,65 @@ function showNoSession() {
4177
4151
  updateUrl();
4178
4152
  sessionView.classList.remove('visible');
4179
4153
  noSession.style.display = '';
4154
+ renderHomeKeys();
4180
4155
  renderSessions();
4181
4156
  renderActivityChip();
4182
4157
  }
4183
4158
 
4159
+ // The home view: no session open. Each row runs its action on a click too.
4160
+ const HOME_ROWS = [
4161
+ {
4162
+ keys: ['Ctrl', 'Alt', 'N'],
4163
+ combo: true,
4164
+ hubMod: true,
4165
+ label: 'New session',
4166
+ run: openNewSession,
4167
+ when: terminalAvailable,
4168
+ },
4169
+ {
4170
+ keys: ['Ctrl', 'Shift', 'K'],
4171
+ combo: true,
4172
+ label: 'Ask Kanbot',
4173
+ run: () => toggleKanbot(true, 'docked'),
4174
+ when: kanbotAvailable,
4175
+ },
4176
+ { keys: ['Ctrl', '`'], combo: true, label: 'Show / hide terminal', run: toggleTerminal, when: terminalAvailable },
4177
+ { keys: ['Ctrl', 'Shift', 'P'], combo: true, label: 'Find a session', run: openSessionPicker },
4178
+ {
4179
+ keys: ['Ctrl', 'Alt', 'Shift', 'S'],
4180
+ combo: true,
4181
+ hubMod: true,
4182
+ label: 'Next session that needs you',
4183
+ run: nextNeedsYou,
4184
+ },
4185
+ {
4186
+ keys: ['Ctrl', 'Alt', 'S'],
4187
+ combo: true,
4188
+ hubMod: true,
4189
+ label: 'Back to the last session',
4190
+ run: swapToPreviousSession,
4191
+ },
4192
+ { keys: ['?'], label: 'All shortcuts', run: showHelpModal },
4193
+ ];
4194
+
4195
+ function renderHomeKeys() {
4196
+ const list = document.getElementById('home-keys');
4197
+ const rows = HOME_ROWS.filter((r) => (!r.when || r.when()) && helpKeys(r).length);
4198
+ list.innerHTML = rows
4199
+ .map(
4200
+ (row) =>
4201
+ `<button type="button" class="home-key"><span>${escapeHtml(row.label)}</span><span class="home-key-kbd">${keyChipsHtml(row)}</span></button>`,
4202
+ )
4203
+ .join('');
4204
+ list.querySelectorAll('.home-key').forEach((btn, i) => {
4205
+ btn.addEventListener('click', () => rows[i].run());
4206
+ });
4207
+ }
4208
+
4209
+ function goHome() {
4210
+ if (viewMode !== 'none') showNoSession();
4211
+ }
4212
+
4184
4213
  // Filter pipeline: active filter → force-include revealed/current (non-pinned) sessions →
4185
4214
  // project filter → search filter → ensure pinned/sticky sessions are always included.
4186
4215
  // Pure over module state, so the session picker can ask for the same list without a render.
@@ -7115,9 +7144,15 @@ const SHORTCUT_TABS = [
7115
7144
  yields: 'ctrl+alt+1',
7116
7145
  label: 'Go to tab or group N (the board is 1)',
7117
7146
  },
7118
- { keys: ['Alt', '[ / ]'], combo: true, label: 'Change the tab in the focused side of a split' },
7147
+ {
7148
+ keys: ['Alt', '[ / ]'],
7149
+ combo: true,
7150
+ label: 'Change the tab in the focused side of a split, else previous / next tab',
7151
+ },
7119
7152
  { keys: ['|'], label: 'Split with the tab before it / unsplit (or drag a tab onto a side)' },
7153
+ { keys: ['Alt', '|'], combo: true, label: 'Split / unsplit, from a shell too' },
7120
7154
  { keys: ['{', '}'], label: 'Focus left / right side of a split' },
7155
+ { keys: ['Alt', '{ / }'], combo: true, label: 'Focus left / right side of a split, from a shell too' },
7121
7156
  { keys: ['Alt', 'W'], combo: true, label: 'Close the focused pane' },
7122
7157
  { keys: ['Shift', 'F10'], combo: true, label: 'Focused tab menu (or Menu key)' },
7123
7158
  ],
@@ -7125,6 +7160,7 @@ const SHORTCUT_TABS = [
7125
7160
  {
7126
7161
  title: 'View',
7127
7162
  rows: [
7163
+ { keys: ['H'], label: 'Home: close the session' },
7128
7164
  { keys: ['\\'], label: 'Toggle sidebar' },
7129
7165
  { keys: ['T'], label: 'Toggle theme' },
7130
7166
  { keys: ['Shift', 'S'], combo: true, label: 'Storage manager' },
@@ -7167,11 +7203,11 @@ const SHORTCUT_TABS = [
7167
7203
  {
7168
7204
  title: 'Sessions',
7169
7205
  rows: [
7170
- { keys: ['Ctrl', 'Alt', 'N'], combo: true, hubMod: true, label: 'New session' },
7206
+ { keys: ['Ctrl', 'Alt', 'N'], combo: true, hubMod: true, label: 'New session', cmd: 'session.new' },
7171
7207
  { keys: ['Ctrl', 'Alt', 'R'], combo: true, hubMod: true, label: 'Resume session (claude -r)' },
7172
7208
  { keys: ['Ctrl', 'Alt', 'S'], combo: true, hubMod: true, label: 'Swap to previous session' },
7173
7209
  { keys: ['Ctrl', 'Alt', 'Shift', 'S'], combo: true, hubMod: true, label: 'Next session that needs you' },
7174
- { keys: ['Shift', 'C'], combo: true, label: 'Copy session id' },
7210
+ { keys: ['Shift', 'C'], combo: true, label: 'Copy session id', cmd: 'session.copyId' },
7175
7211
  { keys: ['Ctrl', 'Shift', 'C'], combo: true, label: 'Copy session name (SendMessage address)' },
7176
7212
  ],
7177
7213
  },
@@ -7184,10 +7220,10 @@ const SHORTCUT_TABS = [
7184
7220
  title: 'Terminal',
7185
7221
  rows: [
7186
7222
  { keys: ['Ctrl', '`'], combo: true, label: 'Show / hide terminal' },
7187
- { keys: ['Alt', '`'], combo: true, label: 'Focus terminal / page' },
7223
+ { keys: ['Alt', '`'], combo: true, label: 'Focus terminal / page; from a shell pane, sidebar and back' },
7188
7224
  { keys: ['Ctrl', 'Alt', '`'], combo: true, hubMod: true, label: 'Focus terminal / show card' },
7189
7225
  { keys: ['Alt', 'Shift', '`'], combo: true, label: 'End terminal' },
7190
- { keys: ['Ctrl', 'Shift', '`'], combo: true, label: 'All terminals' },
7226
+ { keys: ['Ctrl', 'Shift', '`'], combo: true, label: 'All terminals', cmd: 'terminal.manager' },
7191
7227
  { keys: ['Ctrl', '+/−/0'], combo: true, label: 'Terminal text size' },
7192
7228
  ],
7193
7229
  },
@@ -7266,6 +7302,12 @@ function termKbd() {
7266
7302
  // The keys of a help row as they read on this system. The hub's modifier is Ctrl+Alt, and on
7267
7303
  // macOS Control+Option for the tab numbers too (Windows and Linux use bare Alt for those). A hub
7268
7304
  // row shows the keys the hub reports, which the user can change; row.keys until it answers.
7305
+ function keyChipsHtml(row, parts) {
7306
+ parts ??= helpKeys(row);
7307
+ const sep = row.combo ? '<span class="sc-plus">+</span>' : '<span class="sc-or">/</span>';
7308
+ return parts.map((k) => `<kbd>${escapeHtml(k)}</kbd>`).join(sep);
7309
+ }
7310
+
7269
7311
  function helpKeys(row, mac = IS_MAC, keyLabel = hub.keyLabel) {
7270
7312
  const live = row.action && keyLabel(row.action);
7271
7313
  if (live) return live;
@@ -7299,8 +7341,7 @@ function buildHelpShortcuts(groups) {
7299
7341
  }
7300
7342
  const parts = row && helpKeys(row);
7301
7343
  if (!parts?.length) continue;
7302
- const sep = row.combo ? '<span class="sc-plus">+</span>' : '<span class="sc-or">/</span>';
7303
- const keys = parts.map((k) => `<kbd>${escapeHtml(k)}</kbd>`).join(sep);
7344
+ const keys = keyChipsHtml(row, parts);
7304
7345
  const label = escapeHtml(row.label);
7305
7346
  cells.push(`<dt class="${escapeHtml(side)}">${keys}</dt><dd class="${escapeHtml(side)}">${label}</dd>`);
7306
7347
  }
@@ -8309,6 +8350,12 @@ function shiftOnly(e, code) {
8309
8350
  return e.code === code && e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey;
8310
8351
  }
8311
8352
 
8353
+ // The combo of a press as the hub names it: the character on a Latin layout, the US key in the same
8354
+ // place on any other, so a letter key works whatever the input language.
8355
+ function comboIs(e, ...combos) {
8356
+ return combos.includes(ClaudeHub.comboOf(e));
8357
+ }
8358
+
8312
8359
  // xterm runs in another process, so blur() in the board leaves it focused and the modal's arrow keys go
8313
8360
  // to it. Focusing a board element takes the focus.
8314
8361
  function toggleLastMessage() {
@@ -8588,8 +8635,10 @@ document.addEventListener('keydown', (e) => {
8588
8635
  return;
8589
8636
  }
8590
8637
  const altOnly = e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey;
8591
- if (altOnly && (e.code === 'BracketLeft' || e.code === 'BracketRight')) {
8592
- if (cyclePane(e.code === 'BracketRight' ? 1 : -1)) {
8638
+ // The Alt forms work from a shell pane, which types the plain [ ] { }.
8639
+ const bracket = e.code === 'BracketLeft' ? -1 : e.code === 'BracketRight' ? 1 : 0;
8640
+ if (altOnly && bracket) {
8641
+ if (cyclePane(bracket) || cyclePaneStrip(bracket)) {
8593
8642
  e.preventDefault();
8594
8643
  focusActivePane();
8595
8644
  }
@@ -8610,11 +8659,13 @@ document.addEventListener('keydown', (e) => {
8610
8659
  return;
8611
8660
  }
8612
8661
  const plainShift = !e.ctrlKey && !e.altKey && !e.metaKey;
8613
- if (plainShift && e.key === '|' && togglePaneSplit()) {
8662
+ const altShift = e.altKey && e.shiftKey && !e.ctrlKey && !e.metaKey;
8663
+ if (((plainShift && e.key === '|') || (altShift && e.code === 'Backslash')) && togglePaneSplit()) {
8614
8664
  e.preventDefault();
8615
8665
  return;
8616
8666
  }
8617
- if (plainShift && (e.key === '{' || e.key === '}') && focusPaneSide(e.key === '{' ? 'l' : 'r')) {
8667
+ const toSide = plainShift && e.key === '{' ? -1 : plainShift && e.key === '}' ? 1 : altShift ? bracket : 0;
8668
+ if (toSide && focusPaneSide(toSide < 0 ? 'l' : 'r')) {
8618
8669
  e.preventDefault();
8619
8670
  focusActivePane();
8620
8671
  return;
@@ -8839,6 +8890,11 @@ document.addEventListener('keydown', (e) => {
8839
8890
  });
8840
8891
  return;
8841
8892
  }
8893
+ if (matchKey(e, 'KeyH')) {
8894
+ e.preventDefault();
8895
+ goHome();
8896
+ return;
8897
+ }
8842
8898
  if (matchKey(e, 'KeyT')) {
8843
8899
  e.preventDefault();
8844
8900
  toggleTheme();
@@ -9409,6 +9465,12 @@ const PANE_CLAIMS = [
9409
9465
  { key: 'Unidentified', code: 'KeyM' },
9410
9466
  { ctrlKey: true, key: 'm', code: '' },
9411
9467
  ...['BracketLeft', 'BracketRight', 'KeyW'].map((code) => ({ altKey: true, key: 'Unidentified', code })),
9468
+ ...['BracketLeft', 'BracketRight', 'Backslash'].map((code) => ({
9469
+ altKey: true,
9470
+ shiftKey: true,
9471
+ key: 'Unidentified',
9472
+ code,
9473
+ })),
9412
9474
  ...['KeyL', 'KeyM', 'KeyP', 'KeyS', 'KeyZ'].map((code) => ({ shiftKey: true, key: 'Unidentified', code })),
9413
9475
  ...'123456789'.split('').map((n) => ({ ctrlKey: true, altKey: true, key: 'Unidentified', code: `Digit${n}` })),
9414
9476
  ];
@@ -9499,7 +9561,7 @@ function onReviewOfferKey(e) {
9499
9561
  sendReview();
9500
9562
  return;
9501
9563
  }
9502
- if (reviewPopMode !== 'offer' || !matchKey(e, 'c', 'C')) return;
9564
+ if (reviewPopMode !== 'offer' || !comboIs(e, 'c')) return;
9503
9565
  e.preventDefault();
9504
9566
  e.stopImmediatePropagation();
9505
9567
  reviewPopEl().querySelector('.review-offer-btn').click();
@@ -12428,10 +12490,27 @@ function leaveZenScopeFor(sessionId) {
12428
12490
  if (!session || !inZenScope(session)) toggleZenMode();
12429
12491
  }
12430
12492
 
12493
+ let terminalHost = null;
12494
+ let sentTerminalHost = null;
12495
+
12431
12496
  function applyHubSettings(s) {
12432
12497
  sessionsList.classList.toggle('zen-centered', s.zenCentered === true);
12433
12498
  if (s.zenPattern) sessionsList.dataset.zenPattern = s.zenPattern;
12434
12499
  else delete sessionsList.dataset.zenPattern;
12500
+ terminalHost = s.terminalHost || null;
12501
+ syncTerminalHost();
12502
+ }
12503
+
12504
+ // The settings can land before /api/config says whether this board has a terminal.
12505
+ function syncTerminalHost() {
12506
+ if (!terminalHost || terminalHost === sentTerminalHost || !terminalAvailable()) return;
12507
+ const host = terminalHost;
12508
+ sentTerminalHost = host;
12509
+ terminalFetch('/api/terminal/options', 'POST', { conptyDll: host === 'bundled' })
12510
+ .then((res) => res.ok || Promise.reject())
12511
+ .catch(() => {
12512
+ if (sentTerminalHost === host) sentTerminalHost = null;
12513
+ });
12435
12514
  }
12436
12515
 
12437
12516
  function renderZenState() {
@@ -13189,6 +13268,56 @@ const spPeekCache = new Map();
13189
13268
  let spScope = 'board';
13190
13269
  let spRecent = { rows: [], limit: 0, hasMore: true, loading: false };
13191
13270
  let spRowEls = [];
13271
+ // A query that starts with '>' lists commands in place of sessions. A command runs on the session
13272
+ // that was current when the picker opened; `when` hides it when that session cannot run it.
13273
+ // A command's key comes from the shortcut help row whose `opens` or `cmd` is the command's id.
13274
+ let spCommandMode = false;
13275
+ let spTarget = null;
13276
+ const SP_COMMANDS = [
13277
+ {
13278
+ id: 'session.openInEditor',
13279
+ title: 'Open project in editor',
13280
+ when: (s) => !!s?.project,
13281
+ run: (s) => openFolderInEditor(s.project),
13282
+ },
13283
+ {
13284
+ id: 'session.copyId',
13285
+ title: 'Copy session ID',
13286
+ when: (s) => !!s,
13287
+ run: (s) => copyText(s.id, 'session id', `Copied session id: ${s.id.slice(0, 8)}`),
13288
+ },
13289
+ {
13290
+ id: 'session.cost',
13291
+ title: 'Show session cost',
13292
+ when: (s) => !!s && hub.can('session.cost'),
13293
+ run: (s) => openCost(s.id),
13294
+ },
13295
+ {
13296
+ id: 'project.plugins',
13297
+ title: 'Show project plugins',
13298
+ when: (s) => !!s?.project && hub.can('project.plugins'),
13299
+ run: (s) => openMarketplace(s.id),
13300
+ },
13301
+ {
13302
+ id: 'project.memory',
13303
+ title: 'Show project memory',
13304
+ when: (s) => !!s?.project && hub.can('project.memory'),
13305
+ run: (s) => openMemory(s.id),
13306
+ },
13307
+ { id: 'session.new', title: 'New session', when: terminalAvailable, run: (s) => openNewSession(s?.project ?? null) },
13308
+ {
13309
+ id: 'session.shell',
13310
+ title: 'New terminal shell',
13311
+ when: (s) => !!s && terminalAvailable() && !!getSessionBaseDir(s.id),
13312
+ run: (s) => openShellForSession(s.id),
13313
+ },
13314
+ { id: 'terminal.manager', title: 'Open terminal manager', when: terminalAvailable, run: openTerminalManager },
13315
+ ];
13316
+ const SP_COMMAND_KEYS = new Map(
13317
+ SHORTCUT_TABS.flatMap((t) => t.groups.flatMap((g) => g.rows))
13318
+ .filter((r) => r.opens || r.cmd)
13319
+ .map((r) => [r.opens || r.cmd, r]),
13320
+ );
13192
13321
  const SP_RECENT_PAGE = 50;
13193
13322
  const SP_RECENT_TAIL = 5;
13194
13323
 
@@ -13228,7 +13357,8 @@ function spSetScope(scope) {
13228
13357
 
13229
13358
  // Also run after each load: a page too short to scroll gives no scroll event.
13230
13359
  function spLoadMoreNearEnd() {
13231
- if (spScope === 'all') loadMoreIfNearEnd(document.getElementById('session-picker-list'), spLoadRecent);
13360
+ if (!spCommandMode && spScope === 'all')
13361
+ loadMoreIfNearEnd(document.getElementById('session-picker-list'), spLoadRecent);
13232
13362
  }
13233
13363
 
13234
13364
  const spSearch = sessionSearch(() => {
@@ -13241,6 +13371,7 @@ function openSessionPicker({ query = '', ranked = null } = {}) {
13241
13371
  input.value = query;
13242
13372
  spRanked = ranked;
13243
13373
  spSource = getFilteredSessions().sort((a, b) => Date.parse(b.modifiedAt) - Date.parse(a.modifiedAt));
13374
+ spTarget = sessions.find((s) => s.id === currentSessionId) ?? null;
13244
13375
  spPeekCache.clear();
13245
13376
  spRenderedQuery = null;
13246
13377
  spRecent = { rows: [], limit: 0, hasMore: true, loading: false };
@@ -13360,9 +13491,45 @@ function spPinHtml(session) {
13360
13491
  return '<span class="sp-pin"></span>';
13361
13492
  }
13362
13493
 
13494
+ function renderPickerCommands(list, query) {
13495
+ const selectedId = spRows[spIdx]?.id;
13496
+ spRows = SP_COMMANDS.filter((c) => c.when(spTarget) && fuzzyMatch(c.title, query));
13497
+ const target = spTarget
13498
+ ? `<div class="sp-target">Session: <b>${escapeHtml(sessionDisplayName(spTarget))}</b>${spTarget.project ? ` · ${escapeHtml(pathBasename(spTarget.project))}` : ''}</div>`
13499
+ : '<div class="sp-target">No current session</div>';
13500
+ const rows = spRows
13501
+ .map((c, i) => {
13502
+ const keyRow = SP_COMMAND_KEYS.get(c.id);
13503
+ const keys = keyRow ? `<span class="sp-keys">${keyChipsHtml(keyRow)}</span>` : '';
13504
+ return `<button class="sp-row" data-idx="${i}"><span class="sp-name">${escapeHtml(c.title)}</span>${keys}</button>`;
13505
+ })
13506
+ .join('');
13507
+ list.innerHTML = target + (rows || '<div class="sp-empty">No command matches</div>');
13508
+ spRowEls = list.querySelectorAll('.sp-row');
13509
+ spIdx = -1;
13510
+ spSelect(
13511
+ Math.max(
13512
+ 0,
13513
+ spRows.findIndex((c) => c.id === selectedId),
13514
+ ),
13515
+ );
13516
+ }
13517
+
13363
13518
  function renderSessionPicker() {
13364
13519
  const list = document.getElementById('session-picker-list');
13365
- const query = document.getElementById('session-picker-input').value.trim();
13520
+ const raw = document.getElementById('session-picker-input').value.trimStart();
13521
+ const commandMode = raw.startsWith('>');
13522
+ if (commandMode !== spCommandMode) {
13523
+ spCommandMode = commandMode;
13524
+ if (commandMode) spSetPeeking(false);
13525
+ _modalEl('session-picker-modal').classList.toggle('commands', commandMode);
13526
+ }
13527
+ if (commandMode) {
13528
+ spRenderedQuery = null;
13529
+ renderPickerCommands(list, raw.slice(1).trim());
13530
+ return;
13531
+ }
13532
+ const query = raw.trim();
13366
13533
  // Rows that arrive for the same query and scope append below, so the cursor stays on its row.
13367
13534
  const renderKey = `${spScope}\n${query}`;
13368
13535
  const selectedId = renderKey === spRenderedQuery ? spRows[spIdx]?.id : null;
@@ -13420,10 +13587,17 @@ function spSelect(idx) {
13420
13587
  row?.classList.add('selected');
13421
13588
  row?.scrollIntoView({ block: 'nearest' });
13422
13589
  spSchedulePeek();
13423
- if (spScope === 'all' && spIdx >= spRows.length - 5) spLoadRecent();
13590
+ if (!spCommandMode && spScope === 'all' && spIdx >= spRows.length - 5) spLoadRecent();
13424
13591
  }
13425
13592
 
13426
13593
  async function spOpen(idx) {
13594
+ if (spCommandMode) {
13595
+ const command = spRows[idx];
13596
+ if (!command) return;
13597
+ closeSessionPicker();
13598
+ command.run(spTarget);
13599
+ return;
13600
+ }
13427
13601
  const session = spRows[idx];
13428
13602
  if (!session) return;
13429
13603
  closeSessionPicker({ refocus: false });
@@ -13440,12 +13614,14 @@ function initSessionPicker() {
13440
13614
  // Bound on the input: the global handler returns early on INPUT targets.
13441
13615
  input.addEventListener('keydown', (e) => {
13442
13616
  if (e.key === 'Escape') closeSessionPicker();
13443
- else if (matchKey(e, 'ArrowDown') || (e.ctrlKey && e.key === 'n')) spSelect(spIdx + 1);
13444
- else if (matchKey(e, 'ArrowUp') || (e.ctrlKey && !e.shiftKey && e.key === 'p')) spSelect(spIdx - 1);
13617
+ else if (matchKey(e, 'ArrowDown') || comboIs(e, 'ctrl+n', 'ctrl+shift+n')) spSelect(spIdx + 1);
13618
+ else if (matchKey(e, 'ArrowUp') || comboIs(e, 'ctrl+p')) spSelect(spIdx - 1);
13445
13619
  else if (e.key === 'Enter') spOpen(spIdx);
13446
- else if (e.ctrlKey && e.code === 'Space') spSetPeeking(!spIsPeeking());
13447
- else if (e.key === 'Tab' && !e.ctrlKey && !e.altKey && !e.metaKey) spSetScope(spScope === 'all' ? 'board' : 'all');
13448
- else return;
13620
+ else if (e.ctrlKey && e.code === 'Space') {
13621
+ if (!spCommandMode) spSetPeeking(!spIsPeeking());
13622
+ } else if (e.key === 'Tab' && !e.ctrlKey && !e.altKey && !e.metaKey) {
13623
+ if (!spCommandMode) spSetScope(spScope === 'all' ? 'board' : 'all');
13624
+ } else return;
13449
13625
  e.preventDefault();
13450
13626
  e.stopPropagation();
13451
13627
  });
@@ -13562,8 +13738,8 @@ function initProjectPicker() {
13562
13738
  input.addEventListener('input', renderProjectPicker);
13563
13739
  input.addEventListener('keydown', (e) => {
13564
13740
  if (e.key === 'Escape') closeProjectPicker();
13565
- else if (matchKey(e, 'ArrowDown') || (e.ctrlKey && e.key === 'n')) ppSelect(ppIdx + 1);
13566
- else if (matchKey(e, 'ArrowUp') || (e.ctrlKey && !e.shiftKey && e.key === 'p')) ppSelect(ppIdx - 1);
13741
+ else if (matchKey(e, 'ArrowDown') || comboIs(e, 'ctrl+n', 'ctrl+shift+n')) ppSelect(ppIdx + 1);
13742
+ else if (matchKey(e, 'ArrowUp') || comboIs(e, 'ctrl+p')) ppSelect(ppIdx - 1);
13567
13743
  else if (e.key === 'Enter') ppApply(ppIdx);
13568
13744
  else if (e.altKey && !e.ctrlKey && !e.metaKey && e.code === 'KeyR') {
13569
13745
  if (!e.repeat) ppToggleRecentOnly();
@@ -13962,7 +14138,6 @@ function openPlanInEditor() {
13962
14138
  postAndToast(apiPath`/api/sessions/${_planSessionId}/plan/open`, {}, 'in editor');
13963
14139
  }
13964
14140
 
13965
- // biome-ignore lint/correctness/noUnusedVariables: used in HTML
13966
14141
  function openFolderInEditor(folder, file) {
13967
14142
  const body = {};
13968
14143
  if (folder) body.folder = folder;
@@ -14209,7 +14384,6 @@ function applyPaneLayout(sid, layout) {
14209
14384
  if (sid === dockSid) renderDockRail();
14210
14385
  if (sid !== paneSessionId()) return;
14211
14386
  syncPanes();
14212
- autoRevealLog(sid);
14213
14387
  }
14214
14388
 
14215
14389
  async function fetchPaneLayout(sid) {
@@ -14720,16 +14894,18 @@ function paneUrlFrame(pane, className) {
14720
14894
  frame.setAttribute('referrerpolicy', 'no-referrer');
14721
14895
  frame.title = pane.title;
14722
14896
  frame.src = pane.target;
14897
+ // Each load is a new page: it needs the theme and the host keys again.
14898
+ frame.addEventListener('load', () => {
14899
+ postToShowFrames(() => ({ type: `${SHOW_MSG}tokens`, tokens: showTokens() }), [frame]);
14900
+ frame.hostKeysSig = null;
14901
+ pushTerminalClaims();
14902
+ });
14723
14903
  return frame;
14724
14904
  }
14725
14905
 
14726
14906
  function mountPaneUrlFrame(pane, view) {
14727
14907
  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
- });
14908
+ frame.addEventListener('load', () => view.classList.remove('keys-bridged'));
14733
14909
  view.appendChild(frame);
14734
14910
  view.insertAdjacentHTML('beforeend', paneUrlBarHtml());
14735
14911
  return frame;
@@ -15047,7 +15223,7 @@ function selectPane(id) {
15047
15223
  }
15048
15224
 
15049
15225
  // 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.
15226
+ // screen or no other free tab, so the key keeps its other meaning.
15051
15227
  function cyclePane(step) {
15052
15228
  const sid = paneSessionId();
15053
15229
  const split = sid && !wantsTerminal() && getPaneSplit(sid);
@@ -15055,7 +15231,7 @@ function cyclePane(step) {
15055
15231
  const active = getActivePaneId(sid);
15056
15232
  const pairs = getPanePairs(sid);
15057
15233
  const ids = freePaneTabs(sid, active, pairs);
15058
- if (ids.length < 2) return true;
15234
+ if (ids.length < 2) return false;
15059
15235
  const next = ids[(ids.indexOf(active) + step + ids.length) % ids.length];
15060
15236
  const side = splitSideOf(split, active);
15061
15237
  setPanePairs(
@@ -16211,8 +16387,23 @@ async function swapToPreviousSession() {
16211
16387
  await revealSession(target);
16212
16388
  }
16213
16389
 
16390
+ // A shell types the keys that reach the sidebar, so Alt+` takes a shell pane there and back.
16391
+ let shellLeftForSidebar = null;
16392
+
16214
16393
  // Esc belongs to Claude, so leaving the terminal without hiding it needs its own key.
16215
16394
  function toggleTerminalFocus() {
16395
+ const active = document.activeElement;
16396
+ if (shellFrames.has(active)) {
16397
+ leaveTerminalPane();
16398
+ shellLeftForSidebar = active;
16399
+ return;
16400
+ }
16401
+ const shell = shellLeftForSidebar;
16402
+ shellLeftForSidebar = null;
16403
+ if (shell && focusZone === 'sidebar' && paneFocusTarget(activePaneView()) === shell) {
16404
+ focusActivePane();
16405
+ return;
16406
+ }
16216
16407
  if (!wantsTerminal()) {
16217
16408
  toggleTerminal();
16218
16409
  return;
@@ -16262,10 +16453,7 @@ function syncTerminal() {
16262
16453
  if (view !== termState.syncedView) {
16263
16454
  termState.syncedView = view;
16264
16455
  // The terminal shows the same conversation, so the log panel only takes width; it comes back when the terminal goes.
16265
- if (on && logAutoOpened) {
16266
- setMessagePanelVisible(false);
16267
- logAutoOpened = false;
16268
- } else if (on && messagePanelOpen) {
16456
+ if (on && messagePanelOpen) {
16269
16457
  toggleMessagePanel();
16270
16458
  termState.panelHidden = true;
16271
16459
  } else if (!on && arrived && termState.panelHidden) toggleMessagePanel();
@@ -16857,11 +17045,13 @@ function restoreTerminalFocus(zone, sessionId) {
16857
17045
 
16858
17046
  // The terminal stands in for the board, so it takes the board zone however focus arrives
16859
17047
  // (Tab, Alt+`, a click); leaveTerminalPane hands it back to the sidebar.
16860
- document.getElementById('terminal-pane').addEventListener('focusin', () => {
17048
+ function takeBoardZone() {
16861
17049
  if (focusZone !== 'sidebar') return;
16862
17050
  clearKbSelection();
16863
17051
  focusZone = 'board';
16864
- });
17052
+ }
17053
+ document.getElementById('terminal-pane').addEventListener('focusin', takeBoardZone);
17054
+ paneViews.addEventListener('focusin', takeBoardZone);
16865
17055
 
16866
17056
  function detachTerminal() {
16867
17057
  const had = termState.socket;
@@ -17281,7 +17471,7 @@ function ensureKanbotPopover() {
17281
17471
  return el;
17282
17472
  }
17283
17473
 
17284
- function setKanbotLayout(layout) {
17474
+ function setKanbotLayout(layout, save = true) {
17285
17475
  const el = kanbotState.el;
17286
17476
  const docked = layout === 'docked';
17287
17477
  const expanded = layout === 'expanded';
@@ -17296,7 +17486,7 @@ function setKanbotLayout(layout) {
17296
17486
  expand.innerHTML = showIcon(expanded ? 'restore' : 'expand');
17297
17487
  expand.title = expanded ? 'Restore' : 'Expand';
17298
17488
  expand.setAttribute('aria-label', expand.title);
17299
- store.setItem(KANBOT_LAYOUT_KEY, layout);
17489
+ if (save) store.setItem(KANBOT_LAYOUT_KEY, layout);
17300
17490
  postToKanbotFrame('focus');
17301
17491
  }
17302
17492
 
@@ -17324,8 +17514,10 @@ function setKanbotAttached(on) {
17324
17514
  syncCloseGuard();
17325
17515
  }
17326
17516
 
17327
- function toggleKanbot(force) {
17517
+ // `layout` applies for this page only; the saved layout comes back on reload.
17518
+ function toggleKanbot(force, layout) {
17328
17519
  const el = ensureKanbotPopover();
17520
+ if (layout) setKanbotLayout(layout, false);
17329
17521
  const show = typeof force === 'boolean' ? force : !el.classList.contains('visible');
17330
17522
  const wasShown = el.classList.contains('visible');
17331
17523
  el.classList.toggle('visible', show);
@@ -17430,6 +17622,12 @@ window.addEventListener('message', (e) => {
17430
17622
  // Only keys a shell does not type: the pane switch and close keys and the session tab keys.
17431
17623
  const SHELL_PANE_CLAIMS = [
17432
17624
  ...['BracketLeft', 'BracketRight', 'KeyW'].map((code) => ({ altKey: true, key: 'Unidentified', code })),
17625
+ ...['BracketLeft', 'BracketRight', 'Backslash'].map((code) => ({
17626
+ altKey: true,
17627
+ shiftKey: true,
17628
+ key: 'Unidentified',
17629
+ code,
17630
+ })),
17433
17631
  ...'123456789'.split('').map((n) => ({ ctrlKey: true, altKey: true, key: 'Unidentified', code: `Digit${n}` })),
17434
17632
  ];
17435
17633
  const SHELL_RETRY_MS = 1000;
@@ -17804,6 +18002,8 @@ const SHOW_ICONS = {
17804
18002
  dock: '<path d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM15 3v18"/>',
17805
18003
  clear: '<path d="M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/>',
17806
18004
  close: '<path d="M18 6L6 18M6 6l12 12"/>',
18005
+ alert: '<circle cx="12" cy="12" r="9"/><path d="M12 8v5M12 16h.01"/>',
18006
+ upgrade: '<circle cx="12" cy="12" r="9"/><path d="M12 16V8M8.5 11.5 12 8l3.5 3.5"/>',
17807
18007
  pane: '<use href="#icon-pane"/>',
17808
18008
  card: '<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M13 4v7h8"/>',
17809
18009
  external: '<path d="M15 3h6v6M10 14L21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',
@@ -18361,7 +18561,7 @@ new MutationObserver(() => {
18361
18561
  });
18362
18562
  }).observe(document.body, { attributes: true, attributeFilter: ['class', 'data-color-theme', 'style'] });
18363
18563
 
18364
- const PANE_SHOW_FRAMES = '.show-pane-frame, .themed-frame, .ask-frame, .dock-addon-frame';
18564
+ const PANE_SHOW_FRAMES = '.show-pane-frame, .themed-frame, .ask-frame, .dock-addon-frame, .pane-url-frame';
18365
18565
 
18366
18566
  // Builds the message only when a frame is there, because showTokens forces a style recalc.
18367
18567
  function postToShowFrames(makeMsg, frames = [showState.frame, ...document.querySelectorAll(PANE_SHOW_FRAMES)]) {
@@ -18592,7 +18792,8 @@ function renderDockAddon(pane) {
18592
18792
  if (pane) {
18593
18793
  if (!panel.firstChild) {
18594
18794
  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', 'open', 'external', 'Open in a new tab')}
18795
+ <span class="show-actions">${showBtnHtml('dock', 'pane', 'pane', 'Open as a pane of the session')}
18796
+ ${showBtnHtml('dock', 'open', 'external', 'Open in a new tab')}
18596
18797
  ${showBtnHtml('dock', 'expand', 'expand', 'Fill the terminal · Alt+Enter')}
18597
18798
  ${showBtnHtml('dock', 'reload', 'reload', 'Reload')}
18598
18799
  ${showBtnHtml('dock', 'remove', 'clear', 'Remove from the rail')}
@@ -18605,6 +18806,7 @@ function renderDockAddon(pane) {
18605
18806
  const open = panel.querySelector('[data-dock="open"]');
18606
18807
  open.title = `Open ${pane.target} in a new tab`;
18607
18808
  open.setAttribute('aria-label', open.title);
18809
+ panel.querySelector('[data-dock="pane"]').hidden = !pane.addon;
18608
18810
  panel.classList.toggle('expanded', dockExpanded);
18609
18811
  panel.style.setProperty('--show-term-font', `${currentTerminalFontSize()}px`);
18610
18812
  const expand = panel.querySelector('[data-dock="expand"]');
@@ -18648,11 +18850,6 @@ function createDockView(pane) {
18648
18850
  if (pane.run && !dockAddonUp.has(pane.id)) return startDockAddon(pane);
18649
18851
  const frame = paneUrlFrame(pane, 'dock-addon-frame');
18650
18852
  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
18853
  if (pane.addon || paneFraming.get(pane.target)) return frame;
18657
18854
  const sid = dockSid;
18658
18855
  probePaneFraming(sid, pane).then((frameable) => {
@@ -18855,6 +19052,7 @@ function initDockRail() {
18855
19052
  if (e.target.closest('[data-dock="close"]')) dockRailCommand(pane.id);
18856
19053
  else if (e.target.closest('[data-dock="expand"]')) setDockExpanded(!dockExpanded);
18857
19054
  else if (e.target.closest('[data-dock="remove"]')) removeDockItem(pane);
19055
+ else if (e.target.closest('[data-dock="pane"]')) addPaneToSession(dockSid, pane.target, pane.title);
18858
19056
  else if (e.target.closest('[data-dock="reload"]')) {
18859
19057
  dockAddonUp.delete(pane.id);
18860
19058
  dropDockView(pane.id);
@@ -19388,15 +19586,14 @@ function renderFolderList() {
19388
19586
  const query = input.value.trim();
19389
19587
  const all = knownFolders();
19390
19588
  ns.matches = (query && query !== ns.folder ? rankFolders(all, query) : all).slice(0, NS_MAX_MATCHES);
19589
+ if (!ns.matches.length) return closeFolderList();
19391
19590
  if (ns.idx >= ns.matches.length) ns.idx = ns.matches.length - 1;
19392
- list.innerHTML = ns.matches.length
19393
- ? ns.matches
19394
- .map(
19395
- (p, i) =>
19396
- `<div class="ns-option${i === ns.idx ? ' active' : ''}" role="option" data-idx="${i}" aria-selected="${i === ns.idx}"><span class="ns-option-name">${escapeHtml(pathBasename(p))}</span><span class="ns-option-path">${escapeHtml(p)}</span></div>`,
19397
- )
19398
- .join('')
19399
- : '<div class="ns-empty"><span>No project matches</span><button type="button" class="btn btn-secondary ns-browse" data-browse>Browse…</button></div>';
19591
+ list.innerHTML = ns.matches
19592
+ .map(
19593
+ (p, i) =>
19594
+ `<div class="ns-option${i === ns.idx ? ' active' : ''}" role="option" data-idx="${i}" aria-selected="${i === ns.idx}"><span class="ns-option-name">${escapeHtml(pathBasename(p))}</span><span class="ns-option-path">${escapeHtml(p)}</span></div>`,
19595
+ )
19596
+ .join('');
19400
19597
  list.hidden = false;
19401
19598
  input.setAttribute('aria-expanded', 'true');
19402
19599
  }
@@ -19493,6 +19690,7 @@ function setNewSessionBusy(on) {
19493
19690
  renderNewSessionForm();
19494
19691
  }
19495
19692
 
19693
+ // biome-ignore lint/correctness/noUnusedVariables: used in HTML
19496
19694
  async function browseNewSessionFolder() {
19497
19695
  if (ns.busy) return;
19498
19696
  closeFolderList();
@@ -19691,7 +19889,6 @@ function initNewSession() {
19691
19889
  // mousedown, not click: the input's blur would close the list before a click lands.
19692
19890
  list.addEventListener('mousedown', (e) => {
19693
19891
  e.preventDefault();
19694
- if (e.target.closest('[data-browse]')) return browseNewSessionFolder();
19695
19892
  const row = e.target.closest('.ns-option');
19696
19893
  if (row) pickFolderOption(Number(row.dataset.idx));
19697
19894
  });
@@ -19969,18 +20166,25 @@ function pluginWarning(plugin) {
19969
20166
  mismatch: `Plugin ${plugin.installed} is installed, this board ships ${plugin.bundled}`,
19970
20167
  }[plugin.state];
19971
20168
  if (!problem) return null;
19972
- const fix =
19973
- plugin.state === 'disabled'
19974
- ? 'Enable it with /plugin in Claude Code.'
20169
+ let fix = 'Enable it with /plugin in Claude Code.';
20170
+ if (plugin.state !== 'disabled')
20171
+ fix = hub.can('hub.updates')
20172
+ ? 'Click to update the plugins.'
19975
20173
  : `Click to copy: ${plugin.installCommand}\nThen restart open sessions, they keep the old hooks.`;
19976
20174
  const btn = document.createElement('button');
19977
20175
  btn.type = 'button';
19978
20176
  btn.className = 'footer-plugin-warning';
19979
- btn.textContent = '⚠';
20177
+ btn.dataset.state = plugin.state;
20178
+ const [icon, word] = { missing: ['upgrade', 'install'], disabled: ['alert', 'off'], mismatch: ['upgrade', 'update'] }[
20179
+ plugin.state
20180
+ ];
20181
+ btn.innerHTML = showIcon(icon) + word;
19980
20182
  btn.title = `${problem} (${plugin.configDir}).\n${fix}`;
19981
20183
  btn.setAttribute('aria-label', problem);
19982
20184
  if (plugin.state !== 'disabled') {
19983
- btn.addEventListener('click', () => copyText(plugin.installCommand, 'install command'));
20185
+ btn.addEventListener('click', () =>
20186
+ hub.can('hub.updates') ? hub.invoke('hub.updates') : copyText(plugin.installCommand, 'install command'),
20187
+ );
19984
20188
  }
19985
20189
  return btn;
19986
20190
  }
@@ -20048,6 +20252,8 @@ if (urlState.search) {
20048
20252
  getJson('/api/config')
20049
20253
  .then((c) => {
20050
20254
  if (c) appConfig = c;
20255
+ syncTerminalHost();
20256
+ renderHomeKeys();
20051
20257
  if (appConfig.kanbot && footerState.version) renderSidebarFooter(footerState.rl);
20052
20258
  })
20053
20259
  .then(restorePendingSessions)
@@ -20085,7 +20291,6 @@ getJson('/api/config')
20085
20291
  }
20086
20292
  if (focusZoneBeforeReload === 'sidebar') setFocusZone('sidebar');
20087
20293
  if (urlState.messages && currentSessionId) {
20088
- if (logAutoOpened) setMessagePanelVisible(false);
20089
20294
  toggleMessagePanel();
20090
20295
  // Re-render after panel layout settles so scroll dimensions are correct
20091
20296
  requestAnimationFrame(() => {
@@ -20144,6 +20349,8 @@ hub.onActive((active) => {
20144
20349
  pushTerminalClaims();
20145
20350
  });
20146
20351
  hub.onStatus(pushTerminalClaims);
20352
+ // A hub before SDK 1.12 has no onKeys.
20353
+ hub.onKeys?.(pushTerminalClaims);
20147
20354
  hub.onSettings(applyHubSettings);
20148
20355
  hub.handle('session.open', (p) => p.session && openSessionFromOutside(p.session));
20149
20356
  hub.handle('session.find', (p) => findSessionFromHub(p));