claude-code-kanban 7.33.0 → 7.35.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
@@ -6,6 +6,7 @@ const THEME_KEY = 'theme';
6
6
  const COLOR_THEME_KEY = 'color-theme';
7
7
  // Shared too, so after a config-dir switch the cursor goes where it was on the board just left.
8
8
  const FOCUS_ZONE_KEY = 'focus-zone';
9
+ const SILENT_STATUS_HINT_KEY = 'silent-status-hint';
9
10
  const GLOBAL_KEYS = new Set([THEME_KEY, COLOR_THEME_KEY, FOCUS_ZONE_KEY]);
10
11
  // localStorage names are kept as they are: renaming one drops what users saved under it.
11
12
  const MESSAGE_PANEL_OPEN_KEY = 'message-panel-open';
@@ -150,6 +151,9 @@ let appConfig = { marketplaceUrl: null, costUrl: null, memoryUrl: null, scratchA
150
151
  let runningTerminals = new Set();
151
152
  // Embedded sessions stuck on Claude Code's folder-trust dialog. No hook runs before it, so the server reads it off the screen.
152
153
  let trustWaiting = new Set();
154
+ // What a program in an embedded terminal says it is doing (OSC 7501), by session id. It wins over the hook and transcript signals.
155
+ let reportedStatus = new Map();
156
+ let cardStatus = true;
153
157
  let selectedSessionIdx = -1;
154
158
  let selectedSessionKbId = null;
155
159
  let sessionJustSelected = false;
@@ -340,9 +344,12 @@ async function fetchSessions(includeTasks = true, focusId = currentSessionId) {
340
344
  // session members come back through `include`, as they may be past the page limit.
341
345
  const zenScope = !!(zenGroup || zenProject);
342
346
  const zenIds = zenGroup && sessionFilter !== 'active' ? sgSubtreeIds(zenGroup) : new Set();
343
- const zenMembers = sessionGroups
344
- .filter((g) => zenIds.has(g.id))
345
- .flatMap((g) => g.members.filter((m) => m.type === 'session').map((m) => m.ref));
347
+ // A project's zen also holds the sessions of other projects placed `under` it in its group,
348
+ // which its project filter would drop. The client's Active rule still applies to them.
349
+ const inZen = (g, m) => zenIds.has(g.id) || (zenProject && m.under === zenProject);
350
+ const zenMembers = sessionGroups.flatMap((g) =>
351
+ g.members.filter((m) => m.type === 'session' && inZen(g, m)).map((m) => m.ref),
352
+ );
346
353
  const include = [
347
354
  focusId,
348
355
  revealedPlanSessionId,
@@ -359,6 +366,7 @@ async function fetchSessions(includeTasks = true, focusId = currentSessionId) {
359
366
  include: include.length ? include.join(',') : null,
360
367
  recentHours: recent ? RECENT_PROJECT_HOURS : null,
361
368
  project,
369
+ nest: zenProject ? 1 : null,
362
370
  filter: sessionFilter === 'active' ? 'active' : null,
363
371
  },
364
372
  });
@@ -387,17 +395,27 @@ async function fetchSessions(includeTasks = true, focusId = currentSessionId) {
387
395
  }
388
396
  }
389
397
 
390
- // The Stop hook leaves _stop.json when a session ends its turn; deleting it marks the session read.
398
+ // The Stop hook leaves _stop.json when a session ends its turn; the read route deletes it and
399
+ // marks the terminal's reported done or error seen.
391
400
  function markSessionRead(sessionId) {
392
401
  const session = sessions.find((s) => s.id === sessionId);
393
- if (!session?.unread) return;
394
- session.unread = false;
395
- document.querySelector(`.session-item[data-session-id="${CSS.escape(sessionId)}"]`)?.classList.remove('unread');
402
+ const unread = session?.unread;
403
+ const report = reportedFinish(sessionId) && reportedStatus.get(sessionId);
404
+ if (!unread && !report) return;
405
+ if (unread) {
406
+ session.unread = false;
407
+ document.querySelector(`.session-item[data-session-id="${CSS.escape(sessionId)}"]`)?.classList.remove('unread');
408
+ }
409
+ if (report) {
410
+ report.seen = true;
411
+ renderSessionViews();
412
+ }
396
413
  api(apiPath`/api/sessions/${sessionId}/read`, { method: 'POST' }).catch((e) => console.error('[markSessionRead]', e));
397
414
  }
398
415
 
399
416
  function markOpenSessionRead() {
400
- if (currentSessionId && viewMode === 'session' && isOnScreen()) markSessionRead(currentSessionId);
417
+ if (!currentSessionId || viewMode !== 'session' || !isOnScreen()) return;
418
+ markSessionRead(currentSessionId);
401
419
  }
402
420
 
403
421
  async function loadSearchTasks() {
@@ -571,14 +589,46 @@ function toggleSection(containerId, chevronId) {
571
589
  }
572
590
 
573
591
  function isWaitingSession(s) {
574
- return !!s.hasWaitingForUser || trustWaiting.has(s.id);
592
+ if (trustWaiting.has(s.id)) return true;
593
+ const reported = reportedStatus.get(s.id);
594
+ return reported ? reported.state === 'blocked' : !!s.hasWaitingForUser;
595
+ }
596
+ const REPORT_KIND_LABELS = { permission: 'Permission', question: 'Question', auth: 'Sign-in' };
597
+ const reportKindLabel = (r) => REPORT_KIND_LABELS[r.kind] || 'Needs you';
598
+ const isFinishState = (state) => state === 'done' || state === 'error';
599
+
600
+ function reportedBlocked(id) {
601
+ return reportedStatus.get(id)?.state === 'blocked' && !trustWaiting.has(id);
602
+ }
603
+ // A reported done or error stays on the card until the user opens the session (done until seen).
604
+ function reportedFinish(id) {
605
+ const r = reportedStatus.get(id);
606
+ return isFinishState(r?.state) && !r.seen ? r.state : null;
575
607
  }
576
608
  function sessionBarClass(s) {
577
609
  if (isWaitingSession(s)) return 'permission-pending';
578
- return s.unread ? 'unread' : '';
610
+ const finish = reportedFinish(s.id);
611
+ if (finish === 'error') return 'reported-error';
612
+ return s.unread || finish === 'done' ? 'unread' : '';
613
+ }
614
+ function reportedStatusHtml(s, timeText) {
615
+ const r = reportedStatus.get(s.id);
616
+ if (!r || !cardStatus || trustWaiting.has(s.id)) return '';
617
+ const finish = reportedFinish(s.id);
618
+ const chip = r.state === 'blocked' ? reportKindLabel(r) : finish === 'error' ? 'Error' : null;
619
+ const showMsg = r.msg && (r.state === 'blocked' || r.state === 'working' || finish);
620
+ if (!chip && !showMsg) return '';
621
+ const app = r.app && r.app !== 'claude-code' ? `<span class="report-app">${escapeHtml(r.app)}</span>` : '';
622
+ const msg = showMsg
623
+ ? `<span class="report-msg" title="${escapeHtml(r.msg)}">${escapeHtml(r.msg)}</span>`
624
+ : `<span class="report-msg">${timeText}</span>`;
625
+ return `<span class="session-report report-${escapeHtml(r.state)}">${chip ? `<span class="report-chip">${chip}</span>` : ''}${app}${msg}</span>`;
579
626
  }
580
627
  function isActiveSession(s) {
581
- return !isWaitingSession(s) && (s.inProgress > 0 || s.hasRecentLog || s.hasRunningAgents);
628
+ if (isWaitingSession(s)) return false;
629
+ const reported = reportedStatus.get(s.id);
630
+ if (reported) return reported.state === 'working';
631
+ return s.inProgress > 0 || s.hasRecentLog || s.hasRunningAgents;
582
632
  }
583
633
  function sessionState(s) {
584
634
  return isWaitingSession(s) ? 'waiting' : isActiveSession(s) ? 'working' : 'idle';
@@ -586,6 +636,8 @@ function sessionState(s) {
586
636
  // hasRecentLog carries the server's registry-idle correction: an open-but-idle
587
637
  // terminal keeps touching its JSONL, so mtime alone is not proof of activity.
588
638
  function isSessionLive(s) {
639
+ const reported = reportedStatus.get(s.id);
640
+ if (reported && reported.state !== 'working') return false;
589
641
  return !!s.hasRecentLog && Date.now() - Date.parse(s.modifiedAt) <= LIVE_INDICATOR_MS;
590
642
  }
591
643
  function isJustFinished(s) {
@@ -2865,14 +2917,14 @@ function showToast(msg, type, action, hint) {
2865
2917
  el.replaceChildren(text);
2866
2918
  } else el.textContent = msg;
2867
2919
  const hide = () => el.classList.remove('visible', 'has-action');
2868
- if (action) {
2920
+ for (const a of action ? [].concat(action) : []) {
2869
2921
  const btn = document.createElement('button');
2870
2922
  btn.type = 'button';
2871
2923
  btn.className = 'toast-action';
2872
- btn.textContent = action.label;
2924
+ btn.textContent = a.label;
2873
2925
  btn.addEventListener('click', () => {
2874
2926
  hide();
2875
- action.onClick();
2927
+ a.onClick();
2876
2928
  });
2877
2929
  el.append(btn);
2878
2930
  el.classList.add('has-action');
@@ -4192,9 +4244,17 @@ const HOME_ROWS = [
4192
4244
  { keys: ['?'], label: 'All shortcuts', run: showHelpModal },
4193
4245
  ];
4194
4246
 
4247
+ const ZEN_EMPTY_ROWS = [
4248
+ HOME_ROWS.find((r) => r.run === openSessionPicker),
4249
+ { keys: ['Ctrl', 'Shift', 'Z'], combo: true, label: 'Leave zen mode', run: toggleZenMode },
4250
+ ];
4251
+
4195
4252
  function renderHomeKeys() {
4196
- const list = document.getElementById('home-keys');
4197
- const rows = HOME_ROWS.filter((r) => (!r.when || r.when()) && helpKeys(r).length);
4253
+ renderKeyRows(document.getElementById('home-keys'), HOME_ROWS);
4254
+ }
4255
+
4256
+ function renderKeyRows(list, allRows) {
4257
+ const rows = allRows.filter((r) => (!r.when || r.when()) && helpKeys(r).length);
4198
4258
  list.innerHTML = rows
4199
4259
  .map(
4200
4260
  (row) =>
@@ -4371,11 +4431,13 @@ function renderSessions() {
4371
4431
  // and still offers everything, or there would be no way to switch sessions without leaving zen.
4372
4432
  const zenSession = zenMode && currentSessionId ? sessions.find((s) => s.id === currentSessionId) : null;
4373
4433
  const zenScope = !!(zenGroup || zenProject);
4374
- sessionsList.classList.toggle('zen', !!zenSession || zenScope);
4434
+ sessionsList.classList.toggle('zen', zenMode || zenScope);
4375
4435
  sessionsList.dataset.zenState = zenSession ? sessionState(zenSession) : '';
4376
4436
  let filteredSessions;
4377
4437
  if (zenScope) {
4378
4438
  const scoped = getFilteredSessions({ zen: true });
4439
+ // inZenScope places a nested child with its parent, so the anchors come from the unscoped list.
4440
+ if (zenProject) childAnchors = computeChildAnchors(scoped);
4379
4441
  filteredSessions = applyStableSessionOrder(zenProject ? scoped.filter(inZenScope) : scoped);
4380
4442
  } else if (zenMode) filteredSessions = zenSession ? [zenSession] : [];
4381
4443
  else filteredSessions = applyStableSessionOrder(getFilteredSessions());
@@ -4385,7 +4447,9 @@ function renderSessions() {
4385
4447
  const childDepth = new Map();
4386
4448
  const parentOf = new Map();
4387
4449
  for (const g of sessionGroups) for (const m of g.members) if (m.parent) parentOf.set(m.ref, m.parent);
4388
- childAnchors = computeChildAnchors(filteredSessions);
4450
+ // Project zen keeps the anchors of the unscoped list: leaveZenScopeFor must see that a hidden
4451
+ // child sits with a parent outside the scope.
4452
+ if (!zenProject) childAnchors = computeChildAnchors(filteredSessions);
4389
4453
  for (const s of filteredSessions) {
4390
4454
  if (childAnchors.has(s.id) && !parentOf.has(s.id)) parentOf.set(s.id, s.nest.parent);
4391
4455
  }
@@ -4454,6 +4518,8 @@ function renderSessions() {
4454
4518
  ? `<div class="session-progress" title="${escapeHtml(`${session.pending} pending, ${session.inProgress} in progress, ${session.completed} completed`)}"><div class="progress-bar"><div class="progress-fill done" style="width: ${pct(session.completed)}%"></div>${session.inProgress > 0 ? `<div class="progress-fill wip" style="width: ${pct(session.inProgress)}%"></div>` : ''}</div><span class="progress-text">${session.completed + session.inProgress}/${total}</span></div>`
4455
4519
  : '';
4456
4520
  const metricsHtml = progressHtml + (showCtx ? renderContextBar(session) : '');
4521
+ const timeText = formatDate(session.modifiedAt);
4522
+ const reportHtml = reportedStatusHtml(session, timeText);
4457
4523
  return `
4458
4524
  <button onclick="openSession('${sid}')" draggable="true" data-hub-part="session-card" data-session-id="${escapeHtml(session.id)}" class="session-item ${isActive ? 'active' : ''} ${sessionBarClass(session)} ${tempClass} ${idleClass} ${justFinishedClass}${childDepthClass(childDepth.get(session.id))}">
4459
4525
  <span class="session-pin-btn${pinClass}" onclick="event.stopPropagation();toggleSessionPin('${sid}')" title="${pinTitle} session">${pinState === 'sticky' ? SESSION_STAR_SVG : SESSION_PIN_SVG}</span>
@@ -4461,7 +4527,7 @@ function renderSessions() {
4461
4527
  ${renderSessionIdentity(projectHtml, session.gitBranch)}
4462
4528
  ${metricsHtml ? `<div class="session-metrics">${metricsHtml}</div>` : ''}
4463
4529
  <div class="session-footer">
4464
- <div class="session-time">${formatDate(session.modifiedAt)}</div>
4530
+ <div class="session-time${reportHtml ? ' has-report' : ''}"${reportHtml ? ` title="${escapeHtml(timeText)}"` : ''}>${reportHtml || timeText}</div>
4465
4531
  <span class="session-indicators">
4466
4532
  ${isTeam ? `<span class="team-badge" title="${memberCount} team members"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>${memberCount}</span>` : ''}
4467
4533
  ${isTeam || session.project || showCtx ? `<span class="team-info-btn" onclick="event.stopPropagation(); showSessionInfoModal('${sid}')" title="View session info"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg></span>` : ''}
@@ -4509,14 +4575,48 @@ function renderSessions() {
4509
4575
  )
4510
4576
  : '';
4511
4577
 
4578
+ // Zen draws one card and its panel, so it returns before the grouping below — leaving it in
4579
+ // that chain would build the whole list only to discard it.
4580
+ if (zenMode) {
4581
+ if (!zenSession) {
4582
+ const picks = applyStableSessionOrder(getFilteredSessions()).slice(0, 5);
4583
+ sessionsList.innerHTML = `
4584
+ <div class="zen-empty">
4585
+ <div class="zen-empty-head">
4586
+ <p class="zen-empty-title">No session open</p>
4587
+ <p class="zen-empty-hint">Zen mode shows one session.${picks.length ? ' Pick one to continue.' : ''}</p>
4588
+ </div>
4589
+ ${picks.length ? `<div class="zen-empty-list">${picks.map((s) => renderSessionCard(s)).join('')}</div>` : ''}
4590
+ <div class="home-keys"></div>
4591
+ </div>`;
4592
+ renderKeyRows(sessionsList.querySelector('.home-keys'), ZEN_EMPTY_ROWS);
4593
+ restoreSessionCursor();
4594
+ return;
4595
+ }
4596
+ sessionsList.innerHTML = `${renderSessionCard(zenSession)}
4597
+ <div class="zen-panel">
4598
+ ${renderContextDetail(zenSession, { tokens: false }) || '<div class="zen-panel-empty">No context data for this session</div>'}
4599
+ ${renderScratchpadRow(zenSession)}
4600
+ ${renderLinkedDocsHtml(zenSession.id)}
4601
+ ${renderArtifactsHtml(zenSession.id)}
4602
+ ${renderZenBookmarksHtml(zenSession.id)}
4603
+ </div>
4604
+ ${zenSession.hasWorkflow ? renderWorkflowLiveHtml(zenSession.id) : ''}
4605
+ <div class="zen-agents"></div>`;
4606
+ renderZenAgents(visibleAgents());
4607
+ bindLinkedDocsHandlers(sessionsList.querySelector('.linked-docs-section'), zenSession.id);
4608
+ artifactsSection.load(zenSession.id);
4609
+ scratchFilesSection.load(zenSession.id);
4610
+ if (zenSession.hasWorkflow) pollWorkflowLive(zenSession.id);
4611
+ restoreSessionCursor();
4612
+ return;
4613
+ }
4614
+
4512
4615
  if (filteredSessions.length === 0 && !zenScope) {
4513
4616
  let emptyMsg = 'No sessions found';
4514
4617
  let emptyHint = 'Tasks appear when you use Claude Code';
4515
4618
 
4516
- if (zenMode) {
4517
- emptyMsg = 'Zen mode: no session open';
4518
- emptyHint = 'Press Ctrl+Shift+Z to leave zen mode, then open a session';
4519
- } else if (searchQuery) {
4619
+ if (searchQuery) {
4520
4620
  emptyMsg = `No results for "${escapeHtml(searchQuery)}"`;
4521
4621
  emptyHint = outside.rows.length
4522
4622
  ? 'Matches outside the current filters are below'
@@ -4542,28 +4642,6 @@ function renderSessions() {
4542
4642
  return;
4543
4643
  }
4544
4644
 
4545
- // Zen draws one card and its panel, so it returns before the grouping below — leaving it in
4546
- // that chain would build the whole list only to discard it.
4547
- if (zenMode) {
4548
- sessionsList.innerHTML = `${renderSessionCard(zenSession)}
4549
- <div class="zen-panel">
4550
- ${renderContextDetail(zenSession, { tokens: false }) || '<div class="zen-panel-empty">No context data for this session</div>'}
4551
- ${renderScratchpadRow(zenSession)}
4552
- ${renderLinkedDocsHtml(zenSession.id)}
4553
- ${renderArtifactsHtml(zenSession.id)}
4554
- ${renderZenBookmarksHtml(zenSession.id)}
4555
- </div>
4556
- ${zenSession.hasWorkflow ? renderWorkflowLiveHtml(zenSession.id) : ''}
4557
- <div class="zen-agents"></div>`;
4558
- renderZenAgents(visibleAgents());
4559
- bindLinkedDocsHandlers(sessionsList.querySelector('.linked-docs-section'), zenSession.id);
4560
- artifactsSection.load(zenSession.id);
4561
- scratchFilesSection.load(zenSession.id);
4562
- if (zenSession.hasWorkflow) pollWorkflowLive(zenSession.id);
4563
- restoreSessionCursor();
4564
- return;
4565
- }
4566
-
4567
4645
  const nestedCards = (list) =>
4568
4646
  nestChildren(list)
4569
4647
  .map((s) => renderSessionCard(s))
@@ -8376,13 +8454,16 @@ function dismissSessionFromList(sid) {
8376
8454
  return;
8377
8455
  }
8378
8456
  // Ctrl+Alt+S would reveal the dismissed session, and revealing restores it.
8379
- const fallback = currentSessionId === sid && swapHistory[0] === sid ? swapHistory[1] : null;
8380
8457
  forgetSwapHistory(sid);
8458
+ const fallback =
8459
+ currentSessionId === sid
8460
+ ? swapHistory.find((id) => !dismissedSessionIds.has(id) && sessions.some((s) => s.id === id))
8461
+ : null;
8381
8462
  const targetIdx = newItems.length > 0 ? Math.max(0, prevIdx - 1) : -1;
8382
8463
  // If the dismissed session is currently open, navigate to the previous one
8383
8464
  if (currentSessionId === sid || selectedSessionId === sid) {
8384
8465
  selectedSessionId = null;
8385
- if (fallback && !dismissedSessionIds.has(fallback) && sessions.some((s) => s.id === fallback)) {
8466
+ if (fallback) {
8386
8467
  revealSession(fallback).then(() => {
8387
8468
  const items = getNavigableItems();
8388
8469
  const idx = items.findIndex((el) => el.dataset?.sessionId === fallback);
@@ -10199,7 +10280,13 @@ function openPreviewInEditor() {
10199
10280
  // answer to "not previewable" rather than a failure: callers that have a fallback
10200
10281
  // destination pass `onUnsupported` instead of keeping a copy of the extension list here.
10201
10282
  // A link followed inside an open preview keeps the preview's session.
10202
- async function openPreviewByPath(filePath, base, onUnsupported, sessionId = previewSessionId || currentSessionId) {
10283
+ async function openPreviewByPath(
10284
+ filePath,
10285
+ base,
10286
+ onUnsupported,
10287
+ sessionId = previewSessionId || currentSessionId,
10288
+ folderDirect = false,
10289
+ ) {
10203
10290
  if (!filePath) return;
10204
10291
  try {
10205
10292
  const r = await api('/api/preview', { query: { path: filePath, base: base || null } });
@@ -10212,6 +10299,10 @@ async function openPreviewByPath(filePath, base, onUnsupported, sessionId = prev
10212
10299
  showToast('File not found', 'error');
10213
10300
  return;
10214
10301
  }
10302
+ if (data.dir) {
10303
+ openFolder(data.path, folderDirect);
10304
+ return;
10305
+ }
10215
10306
  if (data.kind === null) {
10216
10307
  if (onUnsupported) onUnsupported(data.path);
10217
10308
  else showToast('Nothing to preview in this file');
@@ -10223,6 +10314,66 @@ async function openPreviewByPath(filePath, base, onUnsupported, sessionId = prev
10223
10314
  }
10224
10315
  }
10225
10316
 
10317
+ const FILE_MANAGER = /^Win/i.test(navigator.userAgentData?.platform || navigator.platform || '')
10318
+ ? 'Explorer'
10319
+ : IS_MAC
10320
+ ? 'Finder'
10321
+ : 'file manager';
10322
+
10323
+ function revealPath(target) {
10324
+ postAndToast('/api/reveal', { path: target }, `in ${FILE_MANAGER}`);
10325
+ }
10326
+
10327
+ // The global add-on with this key (the id in its addon.json) takes folders: the board shows it
10328
+ // in the dock and sends it the folder (`cck-addon:path`).
10329
+ const FOLDER_ADDON_KEY = 'file-explorer';
10330
+ const folderWaiting = new Map();
10331
+
10332
+ function folderAddon() {
10333
+ const a = showState.terminalId && dockAddonList?.global.find((x) => x.key === FOLDER_ADDON_KEY);
10334
+ return (a && dockItems().find((p) => p.id === a.id)) || null;
10335
+ }
10336
+
10337
+ // Sends the waiting folder to the add-on's page and gives the frame focus: this add-on hands the
10338
+ // board's keys back, so its frame can take it.
10339
+ function flushFolder(id, frame) {
10340
+ const dir = folderWaiting.get(id);
10341
+ if (!folderWaiting.delete(id)) return;
10342
+ const origin = URL.parse(frame.src)?.origin;
10343
+ if (origin) frame.contentWindow?.postMessage({ type: 'cck-addon:path', path: dir }, origin);
10344
+ frame.focus({ preventScroll: true });
10345
+ frame.contentWindow?.focus();
10346
+ }
10347
+
10348
+ // Runs on each load of a dock frame: a folder asked for before the page was there goes to it now.
10349
+ function onDockFrameLoad(id, frame) {
10350
+ frame.pageLoaded = true;
10351
+ flushFolder(id, frame);
10352
+ }
10353
+
10354
+ function openFolderInAddon(dir, addon) {
10355
+ if (dockActivePane()?.id !== addon.id) {
10356
+ setDockAddon(addon.id);
10357
+ renderShow();
10358
+ }
10359
+ const frame = dockFrames.get(addon.id);
10360
+ folderWaiting.set(addon.id, dir);
10361
+ if (frame?.pageLoaded) flushFolder(addon.id, frame);
10362
+ }
10363
+
10364
+ // A folder has no preview. The toast offers the file explorer add-on when the dock has it, else
10365
+ // the OS file manager; `direct` (Ctrl+click in the terminal) goes to the add-on at once.
10366
+ function openFolder(dir, direct) {
10367
+ const explorer = folderAddon();
10368
+ if (explorer && direct) return openFolderInAddon(dir, explorer);
10369
+ showToast(`Folder: ${pathBasename(dir)}`, 'info', [
10370
+ explorer
10371
+ ? { label: `Open in ${explorer.title}`, onClick: () => openFolderInAddon(dir, explorer) }
10372
+ : { label: `Open in ${FILE_MANAGER}`, onClick: () => revealPath(dir) },
10373
+ { label: 'Copy path', onClick: () => copyText(dir, 'path') },
10374
+ ]);
10375
+ }
10376
+
10226
10377
  function handleSessionOpenEvent(data) {
10227
10378
  const { id } = data;
10228
10379
  if (!id) return;
@@ -11000,8 +11151,10 @@ function setupEventSource() {
11000
11151
  if (!skipOffScreen()) refreshOpenPlan();
11001
11152
  }
11002
11153
 
11003
- if (data.type === 'terminals-update' && Array.isArray(data.ids))
11004
- setRunningTerminals(data.ids, data.awaitingTrust);
11154
+ if (data.type === 'terminals-update' && Array.isArray(data.ids)) {
11155
+ setRunningTerminals(data.ids, data.awaitingTrust, data.programStatus);
11156
+ hintSilentStatus(data.statusSilent);
11157
+ }
11005
11158
 
11006
11159
  if (data.type === 'terminal:ended' && typeof data.id === 'string') onTerminalEnded(data.id);
11007
11160
 
@@ -12447,9 +12600,12 @@ function setZenScope(group, project) {
12447
12600
  else store.removeItem(ZEN_SCOPE_KEY);
12448
12601
  }
12449
12602
 
12603
+ // A project's zen holds what its block holds in the full list.
12450
12604
  function inZenScope(session) {
12451
- if (zenGroup) return sgSubtreeIds(zenGroup).has(sgGroupForSession(session)?.id);
12452
- return sessionProjectKey(session) === zenProject;
12605
+ const group = sgGroupForSession(session);
12606
+ if (zenGroup) return sgSubtreeIds(zenGroup).has(group?.id);
12607
+ if (!group) return sessionProjectKey(placementOf(session)) === zenProject;
12608
+ return sgHostOf(group, session) === zenProject;
12453
12609
  }
12454
12610
 
12455
12611
  // Opening a session the scope hides would leave it off screen, so the scope gives way.
@@ -12469,6 +12625,11 @@ function applyHubSettings(s) {
12469
12625
  else delete sessionsList.dataset.zenPattern;
12470
12626
  terminalHost = s.terminalHost || null;
12471
12627
  syncTerminalHost();
12628
+ const showCardStatus = s.cardStatus !== false;
12629
+ if (showCardStatus !== cardStatus) {
12630
+ cardStatus = showCardStatus;
12631
+ renderSessionViews();
12632
+ }
12472
12633
  }
12473
12634
 
12474
12635
  // The settings can land before /api/config says whether this board has a terminal.
@@ -13268,14 +13429,39 @@ const SP_COMMANDS = [
13268
13429
  when: (s) => !!s?.project && hub.can('project.memory'),
13269
13430
  run: (s) => openMemory(s.id),
13270
13431
  },
13271
- { id: 'session.new', title: 'New session', when: terminalAvailable, run: (s) => openNewSession(s?.project ?? null) },
13432
+ {
13433
+ id: 'session.new',
13434
+ title: 'New session',
13435
+ general: true,
13436
+ when: terminalAvailable,
13437
+ run: (s) => openNewSession(s?.project ?? null),
13438
+ },
13272
13439
  {
13273
13440
  id: 'session.shell',
13274
13441
  title: 'New terminal shell',
13275
13442
  when: (s) => !!s && terminalAvailable() && !!getSessionBaseDir(s.id),
13276
13443
  run: (s) => openShellForSession(s.id),
13277
13444
  },
13278
- { id: 'terminal.manager', title: 'Open terminal manager', when: terminalAvailable, run: openTerminalManager },
13445
+ {
13446
+ id: 'session.fork',
13447
+ title: 'Fork session',
13448
+ when: (s) => !!s && !!forkableSession(s.id),
13449
+ run: (s) => forkSession(s.id),
13450
+ },
13451
+ {
13452
+ id: 'terminal.manager',
13453
+ title: 'Open terminal manager',
13454
+ general: true,
13455
+ when: terminalAvailable,
13456
+ run: openTerminalManager,
13457
+ },
13458
+ {
13459
+ id: 'hub.restart',
13460
+ title: 'Restart Hub',
13461
+ general: true,
13462
+ when: () => hub.can('hub.restart'),
13463
+ run: () => hub.invoke('hub.restart'),
13464
+ },
13279
13465
  ];
13280
13466
  const SP_COMMAND_KEYS = new Map(
13281
13467
  SHORTCUT_TABS.flatMap((t) => t.groups.flatMap((g) => g.rows))
@@ -13448,6 +13634,15 @@ function spDotHtml(session) {
13448
13634
  return `${SP_STATES[spState(session)]}${runningTerminals.has(session.id) ? SP_TERMINAL : SP_DOT}</span>`;
13449
13635
  }
13450
13636
 
13637
+ function spReportHtml(session) {
13638
+ if (reportedBlocked(session.id)) {
13639
+ const r = reportedStatus.get(session.id);
13640
+ const label = reportKindLabel(r);
13641
+ return `<span class="report-chip sp-report" title="${escapeHtml(r.msg || label)}">${label}</span>`;
13642
+ }
13643
+ return reportedFinish(session.id) === 'error' ? '<span class="report-chip sp-report report-error">Error</span>' : '';
13644
+ }
13645
+
13451
13646
  function spPinHtml(session) {
13452
13647
  const state = getSessionPinState(session.id);
13453
13648
  if (state === 'sticky') return `<span class="sp-pin sticky" title="Sticky">${SESSION_STAR_SVG}</span>`;
@@ -13457,7 +13652,9 @@ function spPinHtml(session) {
13457
13652
 
13458
13653
  function renderPickerCommands(list, query) {
13459
13654
  const selectedId = spRows[spIdx]?.id;
13460
- spRows = SP_COMMANDS.filter((c) => c.when(spTarget) && fuzzyMatch(c.title, query));
13655
+ const shown = SP_COMMANDS.filter((c) => c.when(spTarget) && fuzzyMatch(c.title, query));
13656
+ spRows = [...shown.filter((c) => !c.general), ...shown.filter((c) => c.general)];
13657
+ const firstGeneral = spRows.findIndex((c) => c.general);
13461
13658
  const target = spTarget
13462
13659
  ? `<div class="sp-target">Session: <b>${escapeHtml(sessionDisplayName(spTarget))}</b>${spTarget.project ? ` · ${escapeHtml(pathBasename(spTarget.project))}` : ''}</div>`
13463
13660
  : '<div class="sp-target">No current session</div>';
@@ -13465,7 +13662,8 @@ function renderPickerCommands(list, query) {
13465
13662
  .map((c, i) => {
13466
13663
  const keyRow = SP_COMMAND_KEYS.get(c.id);
13467
13664
  const keys = keyRow ? `<span class="sp-keys">${keyChipsHtml(keyRow)}</span>` : '';
13468
- return `<button class="sp-row" data-idx="${i}"><span class="sp-name">${escapeHtml(c.title)}</span>${keys}</button>`;
13665
+ const section = i > 0 && i === firstGeneral ? '<div class="sp-section">General</div>' : '';
13666
+ return `${section}<button class="sp-row" data-idx="${i}"><span class="sp-name">${escapeHtml(c.title)}</span>${keys}</button>`;
13469
13667
  })
13470
13668
  .join('');
13471
13669
  list.innerHTML = target + (rows || '<div class="sp-empty">No command matches</div>');
@@ -13529,6 +13727,7 @@ function renderSessionPicker() {
13529
13727
  return `${below && i === local.length ? section : ''}<button class="sp-row${s.id === currentSessionId ? ' current' : ''}${below ? ' outside' : ''} ${sessionBarClass(s)}" data-idx="${i}" title="${escapeHtml(s.project ? `${s.id}\n${s.project}` : s.id)}">
13530
13728
  ${spDotHtml(s)}
13531
13729
  <span class="sp-name">${escapeHtml(sessionDisplayName(s))}</span>
13730
+ ${spReportHtml(s)}
13532
13731
  <span class="sp-project">${escapeHtml(project)}</span>
13533
13732
  ${s.gitBranch ? `<span class="sp-branch">${escapeHtml(s.gitBranch)}</span>` : ''}
13534
13733
  <span class="sp-count">${s.completed}/${s.taskCount}</span>
@@ -15659,17 +15858,24 @@ function paneTargetFrom(raw) {
15659
15858
  }
15660
15859
 
15661
15860
  // The same target again answers the existing pane, so this also switches to it.
15662
- async function addPane(raw) {
15663
- const sid = paneSessionId();
15861
+ // `show` also leaves the terminal view when it covers the pane, and moves focus into the pane.
15862
+ async function addPane(raw, { sid = paneSessionId(), show = false, label } = {}) {
15664
15863
  const t = sid && paneTargetFrom(raw);
15665
15864
  if (!t) return;
15666
15865
  if (t.error) {
15667
15866
  showToast(t.error, 'error');
15668
15867
  return;
15669
15868
  }
15670
- if (!(await postPane(sid, { target: t.target, base: getSessionBaseDir(sid) || undefined }))) return;
15869
+ const onScreen = await postPane(sid, { target: t.target, base: getSessionBaseDir(sid) || undefined });
15870
+ if (onScreen === null) return;
15871
+ if (!show && !onScreen) {
15872
+ if (label) toastPaneAdded(sid, onScreen, label);
15873
+ return;
15874
+ }
15671
15875
  closePanePop();
15672
- syncPanes();
15876
+ if (!show) return syncPanes();
15877
+ revealPane(sid, onScreen);
15878
+ if (sid === paneSessionId() && !wantsTerminal()) focusActivePane();
15673
15879
  }
15674
15880
 
15675
15881
  // Shows the added pane. True when its session is still on screen, null when the add failed.
@@ -15739,7 +15945,7 @@ function openPreviewInPane() {
15739
15945
  const sid = previewSessionId;
15740
15946
  const target = currentPreviewPath;
15741
15947
  closePreviewModal();
15742
- addPaneToSession(sid, target, pathBasename(target));
15948
+ addPane(target, { sid, label: pathBasename(target) });
15743
15949
  }
15744
15950
 
15745
15951
  // The plan modal also opens other sessions' plans; the pane goes to the plan's session, wherever it is.
@@ -15755,17 +15961,7 @@ function openPlanInPane() {
15755
15961
  const sid = _planSessionId;
15756
15962
  const target = _pendingPlanPath;
15757
15963
  closePlanModal();
15758
- addPaneToSession(sid, target, 'Plan');
15759
- }
15760
-
15761
- async function addPaneToSession(sid, target, label) {
15762
- if (sid === paneSessionId()) return addPane(target);
15763
- if ((await postPane(sid, { target, base: getSessionBaseDir(sid) || undefined })) !== false) return;
15764
- const s = sessions.find((x) => x.id === sid);
15765
- showToast(`${label} added to ${s ? sessionDisplayName(s) : 'its session'}`, 'success', {
15766
- label: 'Open',
15767
- onClick: () => openSession(sid),
15768
- });
15964
+ addPane(target, { sid, label: 'Plan' });
15769
15965
  }
15770
15966
 
15771
15967
  function msgDetailPaneSource() {
@@ -16626,8 +16822,8 @@ function terminalInitOptions(themeOptions) {
16626
16822
  };
16627
16823
  }
16628
16824
 
16629
- function openTerminalLink(href) {
16630
- if (typeof href === 'string' && isLocalHref(href)) return openLocalHref(href);
16825
+ function openTerminalLink({ href, ctrl }) {
16826
+ if (typeof href === 'string' && isLocalHref(href)) return openLocalHref(href, ctrl === true);
16631
16827
  const url = linkUrl(href);
16632
16828
  if (url) hub.openExternal(url);
16633
16829
  }
@@ -16651,7 +16847,7 @@ function onTerminalFrameMessage(t, m) {
16651
16847
  reconnectTerminal();
16652
16848
  }
16653
16849
  } else if (t === 'key') replayKey(m, document.getElementById('terminal-key-proxy'));
16654
- else if (t === 'link') openTerminalLink(m.href);
16850
+ else if (t === 'link') openTerminalLink(m);
16655
16851
  // Chrome does not always fire focusin on the iframe element when its content takes focus.
16656
16852
  else if (t === 'focused') terminalHadFocus = terminalPaneFocused();
16657
16853
  else if (t === 'opening') {
@@ -16757,12 +16953,36 @@ function sendHostKeys(frames, bridged) {
16757
16953
 
16758
16954
  const urlPaneFrames = () => [...paneViews.querySelectorAll('.pane-url-frame')];
16759
16955
 
16956
+ function isAddonOrigin(origin) {
16957
+ const list = dockAddonList;
16958
+ return !!list && [...list.global, ...list.session].some((a) => URL.parse(a.url)?.origin === origin);
16959
+ }
16960
+
16961
+ // The dock or URL pane frame a message came from, when the message's origin is that frame's page.
16962
+ function pageFrameOf(e) {
16963
+ const dock = dockFrameEls().find((f) => f.contentWindow === e.source);
16964
+ const frame = dock || urlPaneFrames().find((f) => f.contentWindow === e.source);
16965
+ return frame && URL.parse(frame.src)?.origin === e.origin ? { dock, frame } : {};
16966
+ }
16967
+
16968
+ // An add-on page asks the board to open a local path (`cck-addon:open` {path, pane?, reveal?}):
16969
+ // the preview modal, with `pane` a pane of the session, with `reveal` the file manager.
16970
+ window.addEventListener('message', (e) => {
16971
+ const { type, path: target, reveal, pane } = e.data || {};
16972
+ if (type !== 'cck-addon:open' || typeof target !== 'string' || !isLocalHref(target)) return;
16973
+ const { dock, frame } = pageFrameOf(e);
16974
+ if (!frame || !isAddonOrigin(e.origin)) return;
16975
+ const sid = dock ? dockSid : paneSessionId();
16976
+ if (reveal === true) revealPath(target);
16977
+ else if (pane === true) addPane(target, { sid, show: true });
16978
+ else openPreviewByPath(target, undefined, undefined, sid);
16979
+ });
16980
+
16760
16981
  window.addEventListener('message', (e) => {
16761
16982
  const type = e.data?.type;
16762
16983
  if (type !== 'hub:hostKey' && type !== 'hub:hostReady') return;
16763
- const dock = dockFrameEls().find((f) => f.contentWindow === e.source);
16764
- const frame = dock || urlPaneFrames().find((f) => f.contentWindow === e.source);
16765
- if (!frame || URL.parse(frame.src)?.origin !== e.origin) return;
16984
+ const { dock, frame } = pageFrameOf(e);
16985
+ if (!frame) return;
16766
16986
  if (type === 'hub:hostReady') {
16767
16987
  if (!dock) frame.parentElement.classList.add('keys-bridged');
16768
16988
  const plain = Array.isArray(e.data.plainKeys) ? e.data.plainKeys.filter((k) => typeof k === 'string') : [];
@@ -17692,7 +17912,7 @@ window.addEventListener('message', (e) => {
17692
17912
  return;
17693
17913
  }
17694
17914
  if (t === 'link') {
17695
- openTerminalLink(m.href);
17915
+ openTerminalLink(m);
17696
17916
  return;
17697
17917
  }
17698
17918
  if (t === 'focused') {
@@ -18829,6 +19049,7 @@ function createDockView(pane) {
18829
19049
  if (pane.run && !dockAddonUp.has(pane.id)) return startDockAddon(pane);
18830
19050
  const frame = paneUrlFrame(pane, 'dock-addon-frame');
18831
19051
  frame.dataset.target = pane.target;
19052
+ frame.addEventListener('load', () => onDockFrameLoad(pane.id, frame));
18832
19053
  if (pane.addon || paneFraming.get(pane.target)) return frame;
18833
19054
  const sid = dockSid;
18834
19055
  probePaneFraming(sid, pane).then((frameable) => {
@@ -19031,7 +19252,7 @@ function initDockRail() {
19031
19252
  if (e.target.closest('[data-dock="close"]')) dockRailCommand(pane.id);
19032
19253
  else if (e.target.closest('[data-dock="expand"]')) setDockExpanded(!dockExpanded);
19033
19254
  else if (e.target.closest('[data-dock="remove"]')) removeDockItem(pane);
19034
- else if (e.target.closest('[data-dock="pane"]')) addPaneToSession(dockSid, pane.target, pane.title);
19255
+ else if (e.target.closest('[data-dock="pane"]')) addPane(pane.target, { sid: dockSid, show: true });
19035
19256
  else if (e.target.closest('[data-dock="reload"]')) {
19036
19257
  dockAddonUp.delete(pane.id);
19037
19258
  dropDockView(pane.id);
@@ -19378,6 +19599,9 @@ async function loadTerminals() {
19378
19599
  const list = data.sessions || [];
19379
19600
  runningTerminals = new Set(list.map((t) => t.id));
19380
19601
  setTrustWaiting(list.filter((t) => t.awaitingTrust).map((t) => t.id));
19602
+ reportedStatus = new Map(list.filter((t) => t.programStatus).map((t) => [t.id, t.programStatus]));
19603
+ markOpenSessionRead();
19604
+ hintSilentStatus(list.filter((t) => t.statusSilent).map((t) => t.id));
19381
19605
  rememberTerminalIds(list);
19382
19606
  syncShowCard();
19383
19607
  pushTerminalClaims();
@@ -19402,8 +19626,10 @@ function setTrustWaiting(ids) {
19402
19626
  }
19403
19627
  }
19404
19628
 
19405
- function setRunningTerminals(ids, awaitingTrust = []) {
19629
+ function setRunningTerminals(ids, awaitingTrust = [], programStatus = {}) {
19406
19630
  runningTerminals = new Set(ids);
19631
+ reportedStatus = new Map(Object.entries(programStatus));
19632
+ markOpenSessionRead();
19407
19633
  setTrustWaiting(awaitingTrust);
19408
19634
  forgetEndedTerminals();
19409
19635
  syncShowCard();
@@ -19413,6 +19639,19 @@ function setRunningTerminals(ids, awaitingTrust = []) {
19413
19639
  renderActivityChip();
19414
19640
  }
19415
19641
 
19642
+ // Once per page: a program asked for status reports and none came, so the reply was lost.
19643
+ let silentStatusHinted = false;
19644
+ function hintSilentStatus(ids) {
19645
+ if (silentStatusHinted || !ids?.length || store.getItem(SILENT_STATUS_HINT_KEY) === 'off') return;
19646
+ silentStatusHinted = true;
19647
+ showToast(
19648
+ 'Claude Code cannot report its status in this terminal',
19649
+ 'info',
19650
+ { label: "Don't show again", onClick: () => store.setItem(SILENT_STATUS_HINT_KEY, 'off') },
19651
+ 'Set Terminal host (Windows) to Bundled in the Kanban settings, then start a new terminal.',
19652
+ );
19653
+ }
19654
+
19416
19655
  function showSessionTerminal(sessionId) {
19417
19656
  setTerminalMode(sessionId, true);
19418
19657
  if (currentSessionId === sessionId && viewMode === 'session') syncTerminal();
@@ -20450,13 +20689,25 @@ function answerWaitingFromHub(behavior, message) {
20450
20689
 
20451
20690
  function needsYouQueue() {
20452
20691
  const live = sessions.filter((s) => (!s.placeholder || trustWaiting.has(s.id)) && !dismissedSessionIds.has(s.id));
20453
- return [...live.filter(isWaitingSession), ...live.filter((s) => !isWaitingSession(s) && s.unread)];
20692
+ return [...live.filter(isWaitingSession), ...live.filter((s) => !isWaitingSession(s) && sessionBarClass(s))];
20454
20693
  }
20455
20694
 
20695
+ // Opening a session marks it read or answered, which drops it from the queue, so the next press
20696
+ // goes on in the order the queue had when this one was opened, not back to the start.
20697
+ let needsYouLast = { id: null, after: [] };
20698
+
20456
20699
  function nextNeedsYou() {
20457
20700
  const queue = needsYouQueue();
20458
- const next = queue[(queue.findIndex((s) => s.id === currentSessionId) + 1) % queue.length];
20701
+ const at = queue.findIndex((s) => s.id === currentSessionId);
20702
+ let i = (at + 1) % queue.length;
20703
+ if (at < 0 && needsYouLast.id === currentSessionId) {
20704
+ const ahead = needsYouLast.after.find((id) => queue.some((s) => s.id === id));
20705
+ if (ahead) i = queue.findIndex((s) => s.id === ahead);
20706
+ }
20707
+ const next = queue[i];
20459
20708
  if (!next || next.id === currentSessionId) return showToast('No other session needs you', 'info');
20709
+ const ids = queue.map((s) => s.id);
20710
+ needsYouLast = { id: next.id, after: [...ids.slice(i + 1), ...ids.slice(0, i)] };
20460
20711
  if (terminalPaneFocused() || isShowCardFocused()) termState.focusNext = true;
20461
20712
  return revealSession(next.id);
20462
20713
  }
@@ -20594,9 +20845,29 @@ function schedulePublish() {
20594
20845
  publishTimer = setTimeout(() => {
20595
20846
  publishSession();
20596
20847
  publishVoiceContext();
20848
+ publishAttention();
20597
20849
  }, 150);
20598
20850
  }
20599
20851
 
20852
+ // attention.changed lists the sessions whose terminal reports blocked, for the hub's title,
20853
+ // taskbar badge and toast. Only the id, name and kind cross: the program's msg stays on the board.
20854
+ let publishedAttention = '[]';
20855
+ const ATTENTION_MAX = 20;
20856
+
20857
+ function publishAttention() {
20858
+ const blocked = [];
20859
+ for (const [id, r] of reportedStatus) {
20860
+ if (!reportedBlocked(id)) continue;
20861
+ const s = sessions.find((x) => x.id === id);
20862
+ blocked.push({ id, name: s ? sessionDisplayName(s) : id.slice(0, 8), kind: r.kind });
20863
+ if (blocked.length === ATTENTION_MAX) break;
20864
+ }
20865
+ const key = JSON.stringify(blocked);
20866
+ if (key === publishedAttention) return;
20867
+ publishedAttention = key;
20868
+ hub.publish('attention.changed', { blocked });
20869
+ }
20870
+
20600
20871
  function publishSession() {
20601
20872
  if (currentSessionId === publishedSessionId) return;
20602
20873
  const s = currentSessionId ? sessions.find((x) => x.id === currentSessionId) : null;
@@ -20632,8 +20903,8 @@ function isLocalHref(href) {
20632
20903
  return /^file:/i.test(href) || (isAbsolutePath(href) && !href.startsWith('//'));
20633
20904
  }
20634
20905
 
20635
- function openLocalHref(href) {
20636
- openPreviewByPath(href.replace(/#.*$/, ''), undefined, openFileInEditor);
20906
+ function openLocalHref(href, folderDirect) {
20907
+ openPreviewByPath(href.replace(/#.*$/, ''), undefined, openFileInEditor, undefined, folderDirect);
20637
20908
  }
20638
20909
 
20639
20910
  // Capture, because the modals stop a click's propagation, and stopped here so a link in a message
@@ -20655,7 +20926,7 @@ document.addEventListener(
20655
20926
  if (!local && (!external || hub.inHub)) return;
20656
20927
  e.preventDefault();
20657
20928
  e.stopPropagation();
20658
- if (local) openLocalHref(href);
20929
+ if (local) openLocalHref(href, e.ctrlKey || e.metaKey);
20659
20930
  else hub.openExternal(url.href);
20660
20931
  },
20661
20932
  true,