claude-code-kanban 7.33.0 → 7.34.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 +8 -1
- package/lib/program-status.js +194 -0
- package/lib/reveal.js +30 -0
- package/lib/terminal-client.js +13 -1
- package/lib/terminal-host.js +3 -0
- package/lib/terminal.js +80 -10
- package/package.json +1 -1
- package/public/app.js +325 -82
- package/public/index.html +4 -2
- package/public/style.css +101 -5
- package/public/terminal-frame.js +8 -3
- package/server.js +74 -7
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
|
-
|
|
344
|
-
|
|
345
|
-
|
|
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;
|
|
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
|
-
|
|
394
|
-
|
|
395
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
2924
|
+
btn.textContent = a.label;
|
|
2873
2925
|
btn.addEventListener('click', () => {
|
|
2874
2926
|
hide();
|
|
2875
|
-
|
|
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
|
-
|
|
4197
|
-
|
|
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',
|
|
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
|
-
|
|
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"
|
|
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 (
|
|
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
|
|
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(
|
|
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
|
-
|
|
12452
|
-
|
|
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.
|
|
@@ -13448,6 +13609,15 @@ function spDotHtml(session) {
|
|
|
13448
13609
|
return `${SP_STATES[spState(session)]}${runningTerminals.has(session.id) ? SP_TERMINAL : SP_DOT}</span>`;
|
|
13449
13610
|
}
|
|
13450
13611
|
|
|
13612
|
+
function spReportHtml(session) {
|
|
13613
|
+
if (reportedBlocked(session.id)) {
|
|
13614
|
+
const r = reportedStatus.get(session.id);
|
|
13615
|
+
const label = reportKindLabel(r);
|
|
13616
|
+
return `<span class="report-chip sp-report" title="${escapeHtml(r.msg || label)}">${label}</span>`;
|
|
13617
|
+
}
|
|
13618
|
+
return reportedFinish(session.id) === 'error' ? '<span class="report-chip sp-report report-error">Error</span>' : '';
|
|
13619
|
+
}
|
|
13620
|
+
|
|
13451
13621
|
function spPinHtml(session) {
|
|
13452
13622
|
const state = getSessionPinState(session.id);
|
|
13453
13623
|
if (state === 'sticky') return `<span class="sp-pin sticky" title="Sticky">${SESSION_STAR_SVG}</span>`;
|
|
@@ -13529,6 +13699,7 @@ function renderSessionPicker() {
|
|
|
13529
13699
|
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
13700
|
${spDotHtml(s)}
|
|
13531
13701
|
<span class="sp-name">${escapeHtml(sessionDisplayName(s))}</span>
|
|
13702
|
+
${spReportHtml(s)}
|
|
13532
13703
|
<span class="sp-project">${escapeHtml(project)}</span>
|
|
13533
13704
|
${s.gitBranch ? `<span class="sp-branch">${escapeHtml(s.gitBranch)}</span>` : ''}
|
|
13534
13705
|
<span class="sp-count">${s.completed}/${s.taskCount}</span>
|
|
@@ -15659,17 +15830,24 @@ function paneTargetFrom(raw) {
|
|
|
15659
15830
|
}
|
|
15660
15831
|
|
|
15661
15832
|
// The same target again answers the existing pane, so this also switches to it.
|
|
15662
|
-
|
|
15663
|
-
|
|
15833
|
+
// `show` also leaves the terminal view when it covers the pane, and moves focus into the pane.
|
|
15834
|
+
async function addPane(raw, { sid = paneSessionId(), show = false, label } = {}) {
|
|
15664
15835
|
const t = sid && paneTargetFrom(raw);
|
|
15665
15836
|
if (!t) return;
|
|
15666
15837
|
if (t.error) {
|
|
15667
15838
|
showToast(t.error, 'error');
|
|
15668
15839
|
return;
|
|
15669
15840
|
}
|
|
15670
|
-
|
|
15841
|
+
const onScreen = await postPane(sid, { target: t.target, base: getSessionBaseDir(sid) || undefined });
|
|
15842
|
+
if (onScreen === null) return;
|
|
15843
|
+
if (!show && !onScreen) {
|
|
15844
|
+
if (label) toastPaneAdded(sid, onScreen, label);
|
|
15845
|
+
return;
|
|
15846
|
+
}
|
|
15671
15847
|
closePanePop();
|
|
15672
|
-
syncPanes();
|
|
15848
|
+
if (!show) return syncPanes();
|
|
15849
|
+
revealPane(sid, onScreen);
|
|
15850
|
+
if (sid === paneSessionId() && !wantsTerminal()) focusActivePane();
|
|
15673
15851
|
}
|
|
15674
15852
|
|
|
15675
15853
|
// Shows the added pane. True when its session is still on screen, null when the add failed.
|
|
@@ -15739,7 +15917,7 @@ function openPreviewInPane() {
|
|
|
15739
15917
|
const sid = previewSessionId;
|
|
15740
15918
|
const target = currentPreviewPath;
|
|
15741
15919
|
closePreviewModal();
|
|
15742
|
-
|
|
15920
|
+
addPane(target, { sid, label: pathBasename(target) });
|
|
15743
15921
|
}
|
|
15744
15922
|
|
|
15745
15923
|
// The plan modal also opens other sessions' plans; the pane goes to the plan's session, wherever it is.
|
|
@@ -15755,17 +15933,7 @@ function openPlanInPane() {
|
|
|
15755
15933
|
const sid = _planSessionId;
|
|
15756
15934
|
const target = _pendingPlanPath;
|
|
15757
15935
|
closePlanModal();
|
|
15758
|
-
|
|
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
|
-
});
|
|
15936
|
+
addPane(target, { sid, label: 'Plan' });
|
|
15769
15937
|
}
|
|
15770
15938
|
|
|
15771
15939
|
function msgDetailPaneSource() {
|
|
@@ -16626,8 +16794,8 @@ function terminalInitOptions(themeOptions) {
|
|
|
16626
16794
|
};
|
|
16627
16795
|
}
|
|
16628
16796
|
|
|
16629
|
-
function openTerminalLink(href) {
|
|
16630
|
-
if (typeof href === 'string' && isLocalHref(href)) return openLocalHref(href);
|
|
16797
|
+
function openTerminalLink({ href, ctrl }) {
|
|
16798
|
+
if (typeof href === 'string' && isLocalHref(href)) return openLocalHref(href, ctrl === true);
|
|
16631
16799
|
const url = linkUrl(href);
|
|
16632
16800
|
if (url) hub.openExternal(url);
|
|
16633
16801
|
}
|
|
@@ -16651,7 +16819,7 @@ function onTerminalFrameMessage(t, m) {
|
|
|
16651
16819
|
reconnectTerminal();
|
|
16652
16820
|
}
|
|
16653
16821
|
} else if (t === 'key') replayKey(m, document.getElementById('terminal-key-proxy'));
|
|
16654
|
-
else if (t === 'link') openTerminalLink(m
|
|
16822
|
+
else if (t === 'link') openTerminalLink(m);
|
|
16655
16823
|
// Chrome does not always fire focusin on the iframe element when its content takes focus.
|
|
16656
16824
|
else if (t === 'focused') terminalHadFocus = terminalPaneFocused();
|
|
16657
16825
|
else if (t === 'opening') {
|
|
@@ -16757,12 +16925,36 @@ function sendHostKeys(frames, bridged) {
|
|
|
16757
16925
|
|
|
16758
16926
|
const urlPaneFrames = () => [...paneViews.querySelectorAll('.pane-url-frame')];
|
|
16759
16927
|
|
|
16928
|
+
function isAddonOrigin(origin) {
|
|
16929
|
+
const list = dockAddonList;
|
|
16930
|
+
return !!list && [...list.global, ...list.session].some((a) => URL.parse(a.url)?.origin === origin);
|
|
16931
|
+
}
|
|
16932
|
+
|
|
16933
|
+
// The dock or URL pane frame a message came from, when the message's origin is that frame's page.
|
|
16934
|
+
function pageFrameOf(e) {
|
|
16935
|
+
const dock = dockFrameEls().find((f) => f.contentWindow === e.source);
|
|
16936
|
+
const frame = dock || urlPaneFrames().find((f) => f.contentWindow === e.source);
|
|
16937
|
+
return frame && URL.parse(frame.src)?.origin === e.origin ? { dock, frame } : {};
|
|
16938
|
+
}
|
|
16939
|
+
|
|
16940
|
+
// An add-on page asks the board to open a local path (`cck-addon:open` {path, pane?, reveal?}):
|
|
16941
|
+
// the preview modal, with `pane` a pane of the session, with `reveal` the file manager.
|
|
16942
|
+
window.addEventListener('message', (e) => {
|
|
16943
|
+
const { type, path: target, reveal, pane } = e.data || {};
|
|
16944
|
+
if (type !== 'cck-addon:open' || typeof target !== 'string' || !isLocalHref(target)) return;
|
|
16945
|
+
const { dock, frame } = pageFrameOf(e);
|
|
16946
|
+
if (!frame || !isAddonOrigin(e.origin)) return;
|
|
16947
|
+
const sid = dock ? dockSid : paneSessionId();
|
|
16948
|
+
if (reveal === true) revealPath(target);
|
|
16949
|
+
else if (pane === true) addPane(target, { sid, show: true });
|
|
16950
|
+
else openPreviewByPath(target, undefined, undefined, sid);
|
|
16951
|
+
});
|
|
16952
|
+
|
|
16760
16953
|
window.addEventListener('message', (e) => {
|
|
16761
16954
|
const type = e.data?.type;
|
|
16762
16955
|
if (type !== 'hub:hostKey' && type !== 'hub:hostReady') return;
|
|
16763
|
-
const dock =
|
|
16764
|
-
|
|
16765
|
-
if (!frame || URL.parse(frame.src)?.origin !== e.origin) return;
|
|
16956
|
+
const { dock, frame } = pageFrameOf(e);
|
|
16957
|
+
if (!frame) return;
|
|
16766
16958
|
if (type === 'hub:hostReady') {
|
|
16767
16959
|
if (!dock) frame.parentElement.classList.add('keys-bridged');
|
|
16768
16960
|
const plain = Array.isArray(e.data.plainKeys) ? e.data.plainKeys.filter((k) => typeof k === 'string') : [];
|
|
@@ -17692,7 +17884,7 @@ window.addEventListener('message', (e) => {
|
|
|
17692
17884
|
return;
|
|
17693
17885
|
}
|
|
17694
17886
|
if (t === 'link') {
|
|
17695
|
-
openTerminalLink(m
|
|
17887
|
+
openTerminalLink(m);
|
|
17696
17888
|
return;
|
|
17697
17889
|
}
|
|
17698
17890
|
if (t === 'focused') {
|
|
@@ -18829,6 +19021,7 @@ function createDockView(pane) {
|
|
|
18829
19021
|
if (pane.run && !dockAddonUp.has(pane.id)) return startDockAddon(pane);
|
|
18830
19022
|
const frame = paneUrlFrame(pane, 'dock-addon-frame');
|
|
18831
19023
|
frame.dataset.target = pane.target;
|
|
19024
|
+
frame.addEventListener('load', () => onDockFrameLoad(pane.id, frame));
|
|
18832
19025
|
if (pane.addon || paneFraming.get(pane.target)) return frame;
|
|
18833
19026
|
const sid = dockSid;
|
|
18834
19027
|
probePaneFraming(sid, pane).then((frameable) => {
|
|
@@ -19031,7 +19224,7 @@ function initDockRail() {
|
|
|
19031
19224
|
if (e.target.closest('[data-dock="close"]')) dockRailCommand(pane.id);
|
|
19032
19225
|
else if (e.target.closest('[data-dock="expand"]')) setDockExpanded(!dockExpanded);
|
|
19033
19226
|
else if (e.target.closest('[data-dock="remove"]')) removeDockItem(pane);
|
|
19034
|
-
else if (e.target.closest('[data-dock="pane"]'))
|
|
19227
|
+
else if (e.target.closest('[data-dock="pane"]')) addPane(pane.target, { sid: dockSid, show: true });
|
|
19035
19228
|
else if (e.target.closest('[data-dock="reload"]')) {
|
|
19036
19229
|
dockAddonUp.delete(pane.id);
|
|
19037
19230
|
dropDockView(pane.id);
|
|
@@ -19378,6 +19571,9 @@ async function loadTerminals() {
|
|
|
19378
19571
|
const list = data.sessions || [];
|
|
19379
19572
|
runningTerminals = new Set(list.map((t) => t.id));
|
|
19380
19573
|
setTrustWaiting(list.filter((t) => t.awaitingTrust).map((t) => t.id));
|
|
19574
|
+
reportedStatus = new Map(list.filter((t) => t.programStatus).map((t) => [t.id, t.programStatus]));
|
|
19575
|
+
markOpenSessionRead();
|
|
19576
|
+
hintSilentStatus(list.filter((t) => t.statusSilent).map((t) => t.id));
|
|
19381
19577
|
rememberTerminalIds(list);
|
|
19382
19578
|
syncShowCard();
|
|
19383
19579
|
pushTerminalClaims();
|
|
@@ -19402,8 +19598,10 @@ function setTrustWaiting(ids) {
|
|
|
19402
19598
|
}
|
|
19403
19599
|
}
|
|
19404
19600
|
|
|
19405
|
-
function setRunningTerminals(ids, awaitingTrust = []) {
|
|
19601
|
+
function setRunningTerminals(ids, awaitingTrust = [], programStatus = {}) {
|
|
19406
19602
|
runningTerminals = new Set(ids);
|
|
19603
|
+
reportedStatus = new Map(Object.entries(programStatus));
|
|
19604
|
+
markOpenSessionRead();
|
|
19407
19605
|
setTrustWaiting(awaitingTrust);
|
|
19408
19606
|
forgetEndedTerminals();
|
|
19409
19607
|
syncShowCard();
|
|
@@ -19413,6 +19611,19 @@ function setRunningTerminals(ids, awaitingTrust = []) {
|
|
|
19413
19611
|
renderActivityChip();
|
|
19414
19612
|
}
|
|
19415
19613
|
|
|
19614
|
+
// Once per page: a program asked for status reports and none came, so the reply was lost.
|
|
19615
|
+
let silentStatusHinted = false;
|
|
19616
|
+
function hintSilentStatus(ids) {
|
|
19617
|
+
if (silentStatusHinted || !ids?.length || store.getItem(SILENT_STATUS_HINT_KEY) === 'off') return;
|
|
19618
|
+
silentStatusHinted = true;
|
|
19619
|
+
showToast(
|
|
19620
|
+
'Claude Code cannot report its status in this terminal',
|
|
19621
|
+
'info',
|
|
19622
|
+
{ label: "Don't show again", onClick: () => store.setItem(SILENT_STATUS_HINT_KEY, 'off') },
|
|
19623
|
+
'Set Terminal host (Windows) to Bundled in the Kanban settings, then start a new terminal.',
|
|
19624
|
+
);
|
|
19625
|
+
}
|
|
19626
|
+
|
|
19416
19627
|
function showSessionTerminal(sessionId) {
|
|
19417
19628
|
setTerminalMode(sessionId, true);
|
|
19418
19629
|
if (currentSessionId === sessionId && viewMode === 'session') syncTerminal();
|
|
@@ -20450,13 +20661,25 @@ function answerWaitingFromHub(behavior, message) {
|
|
|
20450
20661
|
|
|
20451
20662
|
function needsYouQueue() {
|
|
20452
20663
|
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
|
|
20664
|
+
return [...live.filter(isWaitingSession), ...live.filter((s) => !isWaitingSession(s) && sessionBarClass(s))];
|
|
20454
20665
|
}
|
|
20455
20666
|
|
|
20667
|
+
// Opening a session marks it read or answered, which drops it from the queue, so the next press
|
|
20668
|
+
// goes on in the order the queue had when this one was opened, not back to the start.
|
|
20669
|
+
let needsYouLast = { id: null, after: [] };
|
|
20670
|
+
|
|
20456
20671
|
function nextNeedsYou() {
|
|
20457
20672
|
const queue = needsYouQueue();
|
|
20458
|
-
const
|
|
20673
|
+
const at = queue.findIndex((s) => s.id === currentSessionId);
|
|
20674
|
+
let i = (at + 1) % queue.length;
|
|
20675
|
+
if (at < 0 && needsYouLast.id === currentSessionId) {
|
|
20676
|
+
const ahead = needsYouLast.after.find((id) => queue.some((s) => s.id === id));
|
|
20677
|
+
if (ahead) i = queue.findIndex((s) => s.id === ahead);
|
|
20678
|
+
}
|
|
20679
|
+
const next = queue[i];
|
|
20459
20680
|
if (!next || next.id === currentSessionId) return showToast('No other session needs you', 'info');
|
|
20681
|
+
const ids = queue.map((s) => s.id);
|
|
20682
|
+
needsYouLast = { id: next.id, after: [...ids.slice(i + 1), ...ids.slice(0, i)] };
|
|
20460
20683
|
if (terminalPaneFocused() || isShowCardFocused()) termState.focusNext = true;
|
|
20461
20684
|
return revealSession(next.id);
|
|
20462
20685
|
}
|
|
@@ -20594,9 +20817,29 @@ function schedulePublish() {
|
|
|
20594
20817
|
publishTimer = setTimeout(() => {
|
|
20595
20818
|
publishSession();
|
|
20596
20819
|
publishVoiceContext();
|
|
20820
|
+
publishAttention();
|
|
20597
20821
|
}, 150);
|
|
20598
20822
|
}
|
|
20599
20823
|
|
|
20824
|
+
// attention.changed lists the sessions whose terminal reports blocked, for the hub's title,
|
|
20825
|
+
// taskbar badge and toast. Only the id, name and kind cross: the program's msg stays on the board.
|
|
20826
|
+
let publishedAttention = '[]';
|
|
20827
|
+
const ATTENTION_MAX = 20;
|
|
20828
|
+
|
|
20829
|
+
function publishAttention() {
|
|
20830
|
+
const blocked = [];
|
|
20831
|
+
for (const [id, r] of reportedStatus) {
|
|
20832
|
+
if (!reportedBlocked(id)) continue;
|
|
20833
|
+
const s = sessions.find((x) => x.id === id);
|
|
20834
|
+
blocked.push({ id, name: s ? sessionDisplayName(s) : id.slice(0, 8), kind: r.kind });
|
|
20835
|
+
if (blocked.length === ATTENTION_MAX) break;
|
|
20836
|
+
}
|
|
20837
|
+
const key = JSON.stringify(blocked);
|
|
20838
|
+
if (key === publishedAttention) return;
|
|
20839
|
+
publishedAttention = key;
|
|
20840
|
+
hub.publish('attention.changed', { blocked });
|
|
20841
|
+
}
|
|
20842
|
+
|
|
20600
20843
|
function publishSession() {
|
|
20601
20844
|
if (currentSessionId === publishedSessionId) return;
|
|
20602
20845
|
const s = currentSessionId ? sessions.find((x) => x.id === currentSessionId) : null;
|
|
@@ -20632,8 +20875,8 @@ function isLocalHref(href) {
|
|
|
20632
20875
|
return /^file:/i.test(href) || (isAbsolutePath(href) && !href.startsWith('//'));
|
|
20633
20876
|
}
|
|
20634
20877
|
|
|
20635
|
-
function openLocalHref(href) {
|
|
20636
|
-
openPreviewByPath(href.replace(/#.*$/, ''), undefined, openFileInEditor);
|
|
20878
|
+
function openLocalHref(href, folderDirect) {
|
|
20879
|
+
openPreviewByPath(href.replace(/#.*$/, ''), undefined, openFileInEditor, undefined, folderDirect);
|
|
20637
20880
|
}
|
|
20638
20881
|
|
|
20639
20882
|
// Capture, because the modals stop a click's propagation, and stopped here so a link in a message
|
|
@@ -20655,7 +20898,7 @@ document.addEventListener(
|
|
|
20655
20898
|
if (!local && (!external || hub.inHub)) return;
|
|
20656
20899
|
e.preventDefault();
|
|
20657
20900
|
e.stopPropagation();
|
|
20658
|
-
if (local) openLocalHref(href);
|
|
20901
|
+
if (local) openLocalHref(href, e.ctrlKey || e.metaKey);
|
|
20659
20902
|
else hub.openExternal(url.href);
|
|
20660
20903
|
},
|
|
20661
20904
|
true,
|