@firstpick/pi-package-webui 0.8.8 → 0.9.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/README.md +12 -0
- package/bin/pi-webui-rpc-supervisor.mjs +4 -1
- package/bin/pi-webui.mjs +15 -3
- package/lib/rpc-supervisor-protocol.mjs +6 -1
- package/package.json +1 -1
- package/public/app.js +659 -150
- package/public/index.html +28 -13
- package/public/service-worker.js +1 -1
- package/public/styles.css +789 -23
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/interaction-continuity.spec.mjs +120 -0
- package/tests/browser/mobile-foundation.spec.mjs +363 -5
- package/tests/browser/optimistic-prompt.spec.mjs +24 -10
- package/tests/browser/persistent-ui-layout.spec.mjs +2 -0
- package/tests/browser/search-match-highlighting.spec.mjs +104 -0
- package/tests/browser/side-panel-section-reorder.spec.mjs +16 -1
- package/tests/codex-fast-mode-static.test.mjs +2 -2
- package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
- package/tests/fast-mode-client-static.test.mjs +1 -1
- package/tests/feature-decision-output-popup-static.test.mjs +2 -2
- package/tests/file-tree-search-layout-static.test.mjs +261 -0
- package/tests/file-viewer-search-static.test.mjs +7 -2
- package/tests/fixtures/fake-pi.mjs +4 -1
- package/tests/foreground-transcript-catch-up-static.test.mjs +91 -0
- package/tests/http-endpoints-harness.test.mjs +35 -2
- package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
- package/tests/mobile-compact-layout.test.mjs +60 -0
- package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
- package/tests/mobile-foundation-static.test.mjs +12 -12
- package/tests/mobile-phone-experience-static.test.mjs +2 -2
- package/tests/mobile-static.test.mjs +39 -20
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/persistent-ui-layout-static.test.mjs +3 -3
- package/tests/questionnaire-dialog.test.mjs +3 -3
- package/tests/rpc-supervisor-host.test.mjs +18 -1
- package/tests/rpc-supervisor-protocol.test.mjs +5 -0
- package/tests/search-match-highlighting-static.test.mjs +27 -0
- package/tests/session-sampling-ui-static.test.mjs +3 -3
- package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
- package/tests/side-panel-section-reorder-static.test.mjs +23 -10
- package/tests/stream-output-isolation-static.test.mjs +1 -1
- package/tests/streaming-ui-coupling.test.mjs +8 -0
- package/tests/terminal-tab-workspace-static.test.mjs +15 -1
- package/tests/theme-customizer-static.test.mjs +1 -1
package/public/app.js
CHANGED
|
@@ -9,7 +9,7 @@ import { buildIssuePayload, createIssueWizardCatalog, createIssueWizardState, ge
|
|
|
9
9
|
import { createIssueBotClient, readIssueBotRuntimeConfig } from "./issue-bot-client.mjs";
|
|
10
10
|
import { MOBILE_SHELL_STORAGE_KEY, TABLET_SHELL_STORAGE_KEY, createMobileShellState, isMobileShellV2Enabled, mobileNavigationTargetFromSearch, normalizeMobileNavigationTarget, reduceMobileShellState, resolveMobileShellFeatureMode, resolveTabletShellFeatureMode } from "./mobile-shell-state.mjs";
|
|
11
11
|
import { createTranscriptRenderer } from "./transcript-renderer.mjs";
|
|
12
|
-
import { createStreamOutputController } from "./stream-output-controller.mjs";
|
|
12
|
+
import { classifyTranscriptStreamEvent, createStreamOutputController } from "./stream-output-controller.mjs";
|
|
13
13
|
import { installMiddleButtonDragScroll } from "./middle-button-drag-scroll.mjs";
|
|
14
14
|
import { PI_THEME_EXPORT_FIELDS, THEME_TOKEN_GROUPS, canonicalizeTheme, serializeTheme, themeColorToRgb, validateTheme } from "./theme-contract.mjs";
|
|
15
15
|
import {
|
|
@@ -32,6 +32,9 @@ const elements = {
|
|
|
32
32
|
webuiDevBadge: $("#webuiDevBadge"),
|
|
33
33
|
tabBar: $("#tabBar"),
|
|
34
34
|
terminalTabsToggleButton: $("#terminalTabsToggleButton"),
|
|
35
|
+
terminalTabsShell: $(".terminal-tabs-shell"),
|
|
36
|
+
terminalTabsDrawerContent: $("#terminalTabsDrawerContent"),
|
|
37
|
+
terminalTabsBackdrop: $("#terminalTabsBackdrop"),
|
|
35
38
|
workspaceSaveButton: $("#workspaceSaveButton"),
|
|
36
39
|
newTabMenu: $("#newTabMenu"),
|
|
37
40
|
newTabButton: $("#newTabButton"),
|
|
@@ -90,6 +93,7 @@ const elements = {
|
|
|
90
93
|
subagentCancelSubmitButton: $("#subagentCancelSubmitButton"),
|
|
91
94
|
stickyUserPromptButton: $("#stickyUserPromptButton"),
|
|
92
95
|
chat: $("#chat"),
|
|
96
|
+
runIndicatorHost: $("#runIndicatorHost"),
|
|
93
97
|
chatSearchBar: $("#chatSearchBar"),
|
|
94
98
|
chatSearchInput: $("#chatSearchInput"),
|
|
95
99
|
chatSearchCount: $("#chatSearchCount"),
|
|
@@ -101,6 +105,8 @@ const elements = {
|
|
|
101
105
|
sendFeedbackButton: $("#sendFeedbackButton"),
|
|
102
106
|
jumpToLatestButton: $("#jumpToLatestButton"),
|
|
103
107
|
composer: $("#composer"),
|
|
108
|
+
composerInputRow: $(".composer-input-row"),
|
|
109
|
+
composerContextTags: $(".composer-context-tags"),
|
|
104
110
|
composerRow: $(".composer-row"),
|
|
105
111
|
composerActionsButton: $("#composerActionsButton"),
|
|
106
112
|
composerActionsPanel: $("#composerActionsPanel"),
|
|
@@ -312,6 +318,7 @@ const elements = {
|
|
|
312
318
|
fileViewerSourceModeButton: $("#fileViewerSourceModeButton"),
|
|
313
319
|
fileViewerPreviewModeButton: $("#fileViewerPreviewModeButton"),
|
|
314
320
|
fileViewerEditor: $("#fileViewerEditor"),
|
|
321
|
+
fileViewerSearchOverlay: $("#fileViewerSearchOverlay"),
|
|
315
322
|
fileViewerPreview: $("#fileViewerPreview"),
|
|
316
323
|
fileViewerChanges: $("#fileViewerChanges"),
|
|
317
324
|
fileViewerStatus: $("#fileViewerStatus"),
|
|
@@ -329,6 +336,8 @@ const elements = {
|
|
|
329
336
|
sidePanelContextMenu: $("#sidePanelContextMenu"),
|
|
330
337
|
gitFooterContextMenu: $("#gitFooterContextMenu"),
|
|
331
338
|
sidePanelResizeHandle: $("#sidePanelResizeHandle"),
|
|
339
|
+
sidePanelEditButton: $("#sidePanelEditButton"),
|
|
340
|
+
sidePanelEditHint: $("#sidePanelEditHint"),
|
|
332
341
|
toggleSidePanelButton: $("#toggleSidePanelButton"),
|
|
333
342
|
sidePanelExpandButton: $("#sidePanelExpandButton"),
|
|
334
343
|
sidePanelBackdrop: $("#sidePanelBackdrop"),
|
|
@@ -566,10 +575,10 @@ let fileViewerSearchMatches = [];
|
|
|
566
575
|
let fileViewerSearchIndex = -1;
|
|
567
576
|
let fileViewerSearchTruncated = false;
|
|
568
577
|
let fileViewerSearchTimer = null;
|
|
569
|
-
let fileViewerSearchHighlightElement = null;
|
|
570
578
|
let fileContextMenuState = null;
|
|
571
579
|
let sidePanelContextMenuState = null;
|
|
572
580
|
let gitFooterContextMenuState = null;
|
|
581
|
+
let sidePanelSectionEditMode = false;
|
|
573
582
|
let sidePanelSectionPointerDrag = null;
|
|
574
583
|
let sidePanelSectionLastDragOverKey = "";
|
|
575
584
|
let sidePanelSectionSuppressClickUntil = 0;
|
|
@@ -718,9 +727,9 @@ let runIndicatorRenderFrame = null;
|
|
|
718
727
|
let runIndicatorRenderScroll = false;
|
|
719
728
|
let runIndicatorGraceCheckTimer = null;
|
|
720
729
|
let runIndicatorLastStateCheckAt = 0;
|
|
721
|
-
// Lifecycle ownership is deliberately separate from the
|
|
722
|
-
// activity label: the
|
|
723
|
-
//
|
|
730
|
+
// Lifecycle ownership is deliberately separate from the status-host-owned
|
|
731
|
+
// activity label: the status ticker only repaints its own elapsed-time node,
|
|
732
|
+
// while this watchdog owns the low-frequency canonical state recheck.
|
|
724
733
|
let lifecycleStateWatchdogTimer = null;
|
|
725
734
|
let lifecycleComposerSignature = null;
|
|
726
735
|
// Bounded dedupe of semantic tool-boundary records (skill tags, event log),
|
|
@@ -751,6 +760,12 @@ let refreshFooterTimer = null;
|
|
|
751
760
|
let refreshTabsTimer = null;
|
|
752
761
|
let tabsRenderFrame = null;
|
|
753
762
|
let foregroundReconcileTimer = null;
|
|
763
|
+
let foregroundSupplementalRefreshCancel = null;
|
|
764
|
+
let foregroundTranscriptCatchUpRequired = document.visibilityState === "hidden";
|
|
765
|
+
let foregroundTranscriptSuppressedEvents = 0;
|
|
766
|
+
let eventStreamPausedForBackground = false;
|
|
767
|
+
let backgroundReconnectSnapshotFresh = false;
|
|
768
|
+
let foregroundReconnectSnapshotFreshUntil = 0;
|
|
754
769
|
let eventSource = null;
|
|
755
770
|
const supervisorEventCursors = new Map();
|
|
756
771
|
const supervisorRetiredEpochs = new Map();
|
|
@@ -796,9 +811,13 @@ let pathFastPicks = [];
|
|
|
796
811
|
let pathFastPicksReady = false;
|
|
797
812
|
let pathFastPicksLoadPromise = null;
|
|
798
813
|
let mobileTabsExpanded = false;
|
|
814
|
+
let mobileTabsFocusReturn = null;
|
|
815
|
+
let composerActionsFocusReturn = null;
|
|
816
|
+
const mobileComposerOriginalPositions = new Map();
|
|
799
817
|
let openTerminalTabGroupKey = null;
|
|
800
818
|
let terminalCustomGroups = new Map();
|
|
801
819
|
let terminalCustomGroupSerial = 1;
|
|
820
|
+
let terminalTabGroupMenuSerial = 0;
|
|
802
821
|
let savedWorkspaces = [];
|
|
803
822
|
let savedWorkspacesLoaded = false;
|
|
804
823
|
let savedWorkspacesLoading = false;
|
|
@@ -2307,6 +2326,9 @@ function applyMobileShellViewport() {
|
|
|
2307
2326
|
const wasActive = isMobileShellV2Active();
|
|
2308
2327
|
applyMobileShellEvent({ type: "viewport", viewport: mobileShellViewport() });
|
|
2309
2328
|
if (wasActive !== isMobileShellV2Active() && isMobileShellV2Active()) {
|
|
2329
|
+
mobileFooterExpanded = false;
|
|
2330
|
+
elements.statusBar.removeAttribute("aria-label");
|
|
2331
|
+
deactivateDrawerModal(elements.statusBar, { restoreFocus: false });
|
|
2310
2332
|
document.body.classList.remove("composer-actions-open", "footer-details-expanded", "mobile-tabs-expanded", "mobile-keyboard-open");
|
|
2311
2333
|
}
|
|
2312
2334
|
}
|
|
@@ -3726,7 +3748,55 @@ function clearSidePanelSectionDragMarkers() {
|
|
|
3726
3748
|
}
|
|
3727
3749
|
}
|
|
3728
3750
|
|
|
3751
|
+
function isSidePanelSectionReorderingEnabled() {
|
|
3752
|
+
return !isMobileView() || sidePanelSectionEditMode;
|
|
3753
|
+
}
|
|
3754
|
+
|
|
3755
|
+
function updateSidePanelSectionEditAffordance(record) {
|
|
3756
|
+
const collapsed = record.section.classList.contains("collapsed");
|
|
3757
|
+
const label = record.button.querySelector(".side-panel-section-label")?.textContent?.trim() || "side panel";
|
|
3758
|
+
const action = `${collapsed ? "Expand" : "Collapse"} ${label} section`;
|
|
3759
|
+
const reorderingEnabled = isSidePanelSectionReorderingEnabled();
|
|
3760
|
+
record.button.setAttribute("aria-label", action);
|
|
3761
|
+
record.button.setAttribute("title", reorderingEnabled
|
|
3762
|
+
? `${action} · drag to reorder · Alt+↑/↓ moves`
|
|
3763
|
+
: action);
|
|
3764
|
+
if (reorderingEnabled) record.button.setAttribute("aria-keyshortcuts", "Alt+ArrowUp Alt+ArrowDown");
|
|
3765
|
+
else record.button.removeAttribute("aria-keyshortcuts");
|
|
3766
|
+
}
|
|
3767
|
+
|
|
3768
|
+
function cancelSidePanelSectionPointerDrag() {
|
|
3769
|
+
const drag = sidePanelSectionPointerDrag;
|
|
3770
|
+
if (!drag) return;
|
|
3771
|
+
window.removeEventListener("pointermove", updateSidePanelSectionPointerDrag, { capture: true });
|
|
3772
|
+
window.removeEventListener("pointerup", endSidePanelSectionPointerDrag, { capture: true });
|
|
3773
|
+
window.removeEventListener("pointercancel", endSidePanelSectionPointerDrag, { capture: true });
|
|
3774
|
+
sidePanelSectionRecords().find(({ id }) => id === drag.sectionId)?.section.classList.remove("dragging");
|
|
3775
|
+
sidePanelSectionPointerDrag = null;
|
|
3776
|
+
sidePanelSectionLastDragOverKey = "";
|
|
3777
|
+
clearSidePanelSectionDragMarkers();
|
|
3778
|
+
}
|
|
3779
|
+
|
|
3780
|
+
function setSidePanelSectionEditMode(enabled) {
|
|
3781
|
+
if (!enabled) cancelSidePanelSectionPointerDrag();
|
|
3782
|
+
const next = isMobileView() && !!enabled;
|
|
3783
|
+
const reorderingEnabled = !isMobileView() || next;
|
|
3784
|
+
if (sidePanelSectionEditMode === next && elements.sidePanel?.classList.contains("section-edit-mode") === reorderingEnabled) return;
|
|
3785
|
+
sidePanelSectionEditMode = next;
|
|
3786
|
+
elements.sidePanel?.classList.toggle("section-edit-mode", reorderingEnabled);
|
|
3787
|
+
if (elements.sidePanelEditButton) {
|
|
3788
|
+
elements.sidePanelEditButton.setAttribute("aria-pressed", next ? "true" : "false");
|
|
3789
|
+
elements.sidePanelEditButton.setAttribute("aria-label", next ? "Finish editing Control Deck section order" : "Edit Control Deck section order");
|
|
3790
|
+
elements.sidePanelEditButton.setAttribute("title", next ? "Finish editing Control Deck section order" : "Edit Control Deck section order");
|
|
3791
|
+
const label = elements.sidePanelEditButton.querySelector(".side-panel-edit-button-label");
|
|
3792
|
+
if (label) label.textContent = next ? "Done" : "Edit";
|
|
3793
|
+
}
|
|
3794
|
+
if (elements.sidePanelEditHint) elements.sidePanelEditHint.hidden = !next;
|
|
3795
|
+
for (const record of sidePanelSectionRecords()) updateSidePanelSectionEditAffordance(record);
|
|
3796
|
+
}
|
|
3797
|
+
|
|
3729
3798
|
function moveSidePanelSectionRelative(fromId, targetRecord, insertBefore) {
|
|
3799
|
+
if (!isSidePanelSectionReorderingEnabled()) return false;
|
|
3730
3800
|
const sourceRecord = sidePanelSectionRecords().find(({ id }) => id === fromId);
|
|
3731
3801
|
if (!sourceRecord || !targetRecord || sourceRecord.section === targetRecord.section) return false;
|
|
3732
3802
|
const parent = sourceRecord.section.parentElement;
|
|
@@ -3741,6 +3811,7 @@ function moveSidePanelSectionRelative(fromId, targetRecord, insertBefore) {
|
|
|
3741
3811
|
}
|
|
3742
3812
|
|
|
3743
3813
|
function moveSidePanelSectionByOffset(sectionId, offset) {
|
|
3814
|
+
if (!isSidePanelSectionReorderingEnabled()) return false;
|
|
3744
3815
|
const records = visibleSidePanelSectionRecords();
|
|
3745
3816
|
const fromIndex = records.findIndex(({ id }) => id === sectionId);
|
|
3746
3817
|
const toIndex = fromIndex + offset;
|
|
@@ -3757,7 +3828,7 @@ function sidePanelSectionToggleFromPoint(clientX, clientY) {
|
|
|
3757
3828
|
}
|
|
3758
3829
|
|
|
3759
3830
|
function beginSidePanelSectionPointerDrag(event, sectionId) {
|
|
3760
|
-
if (event.button !== 0 || !sectionId || sidePanelSectionPointerDrag) return;
|
|
3831
|
+
if (!isSidePanelSectionReorderingEnabled() || event.button !== 0 || !sectionId || sidePanelSectionPointerDrag) return;
|
|
3761
3832
|
sidePanelSectionPointerDrag = { sectionId, pointerId: event.pointerId, startX: event.clientX, startY: event.clientY, active: false };
|
|
3762
3833
|
window.addEventListener("pointermove", updateSidePanelSectionPointerDrag, { capture: true });
|
|
3763
3834
|
window.addEventListener("pointerup", endSidePanelSectionPointerDrag, { capture: true });
|
|
@@ -3878,12 +3949,10 @@ function restoreSidePanelSectionVisibility() {
|
|
|
3878
3949
|
}
|
|
3879
3950
|
|
|
3880
3951
|
function setSidePanelSectionCollapsed(record, collapsed, { persist = true } = {}) {
|
|
3881
|
-
const label = record.button.querySelector(".side-panel-section-label")?.textContent?.trim() || "side panel";
|
|
3882
3952
|
record.section.classList.toggle("collapsed", collapsed);
|
|
3883
3953
|
record.content.hidden = collapsed;
|
|
3884
3954
|
record.button.setAttribute("aria-expanded", collapsed ? "false" : "true");
|
|
3885
|
-
record
|
|
3886
|
-
record.button.setAttribute("title", `${collapsed ? "Expand" : "Collapse"} ${label} section · drag to reorder · Alt+↑/↓ moves`);
|
|
3955
|
+
updateSidePanelSectionEditAffordance(record);
|
|
3887
3956
|
if (!collapsed && record.id === "git" && !record.section.hidden) {
|
|
3888
3957
|
queueMicrotask(() => {
|
|
3889
3958
|
renderGitPanel();
|
|
@@ -3980,7 +4049,7 @@ function bindSidePanelSectionToggles() {
|
|
|
3980
4049
|
}
|
|
3981
4050
|
});
|
|
3982
4051
|
record.button.addEventListener("keydown", (event) => {
|
|
3983
|
-
if (!event.altKey || (event.key !== "ArrowUp" && event.key !== "ArrowDown")) return;
|
|
4052
|
+
if (!isSidePanelSectionReorderingEnabled() || !event.altKey || (event.key !== "ArrowUp" && event.key !== "ArrowDown")) return;
|
|
3984
4053
|
event.preventDefault();
|
|
3985
4054
|
moveSidePanelSectionByOffset(record.id, event.key === "ArrowUp" ? -1 : 1);
|
|
3986
4055
|
});
|
|
@@ -6114,18 +6183,70 @@ async function refreshNativeSettings(tabContext = activeTabContext()) {
|
|
|
6114
6183
|
applyNativeSettingsForBrowser(response.data?.settings || {});
|
|
6115
6184
|
}
|
|
6116
6185
|
|
|
6117
|
-
function
|
|
6186
|
+
function mobileComposerSecondaryNodes() {
|
|
6187
|
+
return [
|
|
6188
|
+
elements.workflowModeControls,
|
|
6189
|
+
elements.composerContextTags,
|
|
6190
|
+
elements.busyPromptBehaviorMenu,
|
|
6191
|
+
elements.followUpQueueTrigger,
|
|
6192
|
+
elements.btwButton,
|
|
6193
|
+
elements.conversationVoiceMenu,
|
|
6194
|
+
elements.conversationModeEndButton,
|
|
6195
|
+
].filter(Boolean);
|
|
6196
|
+
}
|
|
6197
|
+
|
|
6198
|
+
function rememberMobileComposerOriginalPositions() {
|
|
6199
|
+
for (const node of mobileComposerSecondaryNodes()) {
|
|
6200
|
+
if (!mobileComposerOriginalPositions.has(node)) {
|
|
6201
|
+
mobileComposerOriginalPositions.set(node, { parent: node.parentNode, nextSibling: node.nextSibling });
|
|
6202
|
+
}
|
|
6203
|
+
}
|
|
6204
|
+
}
|
|
6205
|
+
|
|
6206
|
+
function restoreMobileComposerOriginalPositions() {
|
|
6207
|
+
for (const [node, { parent, nextSibling }] of mobileComposerOriginalPositions) {
|
|
6208
|
+
if (!parent) continue;
|
|
6209
|
+
if (nextSibling?.parentNode === parent) parent.insertBefore(node, nextSibling);
|
|
6210
|
+
else parent.append(node);
|
|
6211
|
+
}
|
|
6212
|
+
}
|
|
6213
|
+
|
|
6214
|
+
function syncMobileComposerDisclosureLayout() {
|
|
6215
|
+
rememberMobileComposerOriginalPositions();
|
|
6216
|
+
const useMobileDisclosure = isMobileView() && !isMobileShellV2Active();
|
|
6217
|
+
document.body.classList.toggle("mobile-composer-disclosure", useMobileDisclosure);
|
|
6218
|
+
if (!useMobileDisclosure) {
|
|
6219
|
+
restoreMobileComposerOriginalPositions();
|
|
6220
|
+
return;
|
|
6221
|
+
}
|
|
6222
|
+
for (const node of mobileComposerSecondaryNodes()) elements.composerActionsPanel.append(node);
|
|
6223
|
+
}
|
|
6224
|
+
|
|
6225
|
+
function setComposerActionsOpen(open, { restoreFocus = false } = {}) {
|
|
6118
6226
|
if (isMobileShellV2Active()) return;
|
|
6227
|
+
syncMobileComposerDisclosureLayout();
|
|
6119
6228
|
const shouldOpen = open && isMobileView();
|
|
6120
|
-
if (shouldOpen
|
|
6229
|
+
if (shouldOpen) {
|
|
6230
|
+
composerActionsFocusReturn = document.activeElement instanceof HTMLElement ? document.activeElement : elements.composerActionsButton;
|
|
6231
|
+
if (followUpQueueOpen) setFollowUpQueueOpen(false);
|
|
6232
|
+
setMobileTabsExpanded(false);
|
|
6233
|
+
setMobileFooterExpanded(false);
|
|
6234
|
+
}
|
|
6121
6235
|
document.body.classList.toggle("composer-actions-open", shouldOpen);
|
|
6122
6236
|
elements.composerActionsButton.setAttribute("aria-expanded", shouldOpen ? "true" : "false");
|
|
6237
|
+
elements.composerActionsButton.textContent = shouldOpen ? "−" : "More";
|
|
6238
|
+
elements.composerActionsButton.setAttribute("aria-label", shouldOpen ? "Minimize more composer actions" : "Show more composer actions");
|
|
6239
|
+
elements.composerActionsButton.title = shouldOpen ? "Minimize more composer actions" : "Show more composer actions";
|
|
6240
|
+
elements.composerActionsPanel.setAttribute("aria-hidden", shouldOpen || !isMobileView() ? "false" : "true");
|
|
6123
6241
|
if (!shouldOpen) {
|
|
6124
6242
|
setPublishMenuOpen(false);
|
|
6125
6243
|
setNativeCommandMenuOpen(false);
|
|
6126
6244
|
setAppRunnerMenuOpen(false);
|
|
6127
6245
|
setOptionsMenuOpen(false);
|
|
6128
6246
|
setBusyPromptBehaviorMenuOpen(false);
|
|
6247
|
+
const focusReturn = restoreFocus ? composerActionsFocusReturn : null;
|
|
6248
|
+
composerActionsFocusReturn = null;
|
|
6249
|
+
if (focusReturn?.isConnected) requestAnimationFrame(() => focusReturn.focus({ preventScroll: true }));
|
|
6129
6250
|
}
|
|
6130
6251
|
scheduleMobileDropdownScrollBoundsUpdate();
|
|
6131
6252
|
if (!shouldOpen) scheduleDeferredUiFlushAfterDropdownClose();
|
|
@@ -6275,30 +6396,71 @@ function updateFooterModelPickerPosition() {
|
|
|
6275
6396
|
document.documentElement.style.setProperty("--footer-model-picker-right", "auto");
|
|
6276
6397
|
}
|
|
6277
6398
|
|
|
6278
|
-
function setMobileFooterExpanded(expanded) {
|
|
6399
|
+
function setMobileFooterExpanded(expanded, { restoreFocus = false } = {}) {
|
|
6279
6400
|
if (isMobileShellV2Active()) return;
|
|
6280
6401
|
mobileFooterExpanded = expanded && isMobileView();
|
|
6281
|
-
if (mobileFooterExpanded
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6402
|
+
if (mobileFooterExpanded) {
|
|
6403
|
+
setComposerActionsOpen(false);
|
|
6404
|
+
setMobileTabsExpanded(false);
|
|
6405
|
+
if (isFooterPickerOpen()) {
|
|
6406
|
+
footerModelPickerOpen = false;
|
|
6407
|
+
footerThinkingPickerOpen = false;
|
|
6408
|
+
footerBranchPickerOpen = false;
|
|
6409
|
+
document.body.classList.remove("footer-model-picker-open");
|
|
6410
|
+
elements.statusBar.querySelectorAll(".footer-model-picker").forEach((node) => node.remove());
|
|
6411
|
+
}
|
|
6287
6412
|
}
|
|
6288
6413
|
document.body.classList.toggle("footer-details-expanded", mobileFooterExpanded);
|
|
6289
6414
|
const button = elements.statusBar.querySelector(".footer-details-toggle");
|
|
6290
6415
|
if (button) {
|
|
6291
|
-
button.textContent = mobileFooterExpanded ? "
|
|
6416
|
+
button.textContent = mobileFooterExpanded ? "−" : "Details";
|
|
6417
|
+
button.setAttribute("aria-label", mobileFooterExpanded ? "Minimize Git footer details" : "Show Git footer details");
|
|
6418
|
+
button.setAttribute("title", mobileFooterExpanded ? "Minimize Git footer details" : "Show Git footer details");
|
|
6292
6419
|
button.setAttribute("aria-expanded", mobileFooterExpanded ? "true" : "false");
|
|
6293
6420
|
}
|
|
6421
|
+
if (mobileFooterExpanded && button) {
|
|
6422
|
+
elements.statusBar.setAttribute("aria-label", "Git footer details");
|
|
6423
|
+
activateDrawerModal(elements.statusBar, button, {
|
|
6424
|
+
close: () => setMobileFooterExpanded(false, { restoreFocus: true }),
|
|
6425
|
+
});
|
|
6426
|
+
} else {
|
|
6427
|
+
elements.statusBar.removeAttribute("aria-label");
|
|
6428
|
+
deactivateDrawerModal(elements.statusBar, { restoreFocus });
|
|
6429
|
+
}
|
|
6294
6430
|
updateFooterModelPickerPosition();
|
|
6295
6431
|
}
|
|
6296
6432
|
|
|
6297
|
-
function setMobileTabsExpanded(expanded) {
|
|
6433
|
+
function setMobileTabsExpanded(expanded, { restoreFocus = false } = {}) {
|
|
6298
6434
|
if (isMobileShellV2Active()) return;
|
|
6299
|
-
|
|
6435
|
+
const shouldExpand = expanded && isMobileView();
|
|
6436
|
+
if (shouldExpand) {
|
|
6437
|
+
mobileTabsFocusReturn = elements.terminalTabsToggleButton;
|
|
6438
|
+
setComposerActionsOpen(false);
|
|
6439
|
+
setMobileFooterExpanded(false);
|
|
6440
|
+
}
|
|
6441
|
+
mobileTabsExpanded = shouldExpand;
|
|
6300
6442
|
document.body.classList.toggle("mobile-tabs-expanded", mobileTabsExpanded);
|
|
6301
6443
|
elements.terminalTabsToggleButton.setAttribute("aria-expanded", mobileTabsExpanded ? "true" : "false");
|
|
6444
|
+
if (mobileTabsExpanded) {
|
|
6445
|
+
activateDrawerModal(elements.terminalTabsShell, elements.terminalTabsToggleButton, {
|
|
6446
|
+
close: () => {
|
|
6447
|
+
setNewTabMenuOpen(false);
|
|
6448
|
+
setMobileTabsExpanded(false, { restoreFocus: true });
|
|
6449
|
+
},
|
|
6450
|
+
});
|
|
6451
|
+
} else {
|
|
6452
|
+
deactivateDrawerModal(elements.terminalTabsShell, { restoreFocus: false });
|
|
6453
|
+
}
|
|
6454
|
+
if (elements.terminalTabsBackdrop) elements.terminalTabsBackdrop.hidden = !mobileTabsExpanded;
|
|
6455
|
+
if (elements.terminalTabsDrawerContent) {
|
|
6456
|
+
if (isMobileView()) elements.terminalTabsDrawerContent.setAttribute("aria-hidden", mobileTabsExpanded ? "false" : "true");
|
|
6457
|
+
else elements.terminalTabsDrawerContent.removeAttribute("aria-hidden");
|
|
6458
|
+
}
|
|
6459
|
+
if (!mobileTabsExpanded) {
|
|
6460
|
+
const focusReturn = restoreFocus ? mobileTabsFocusReturn : null;
|
|
6461
|
+
mobileTabsFocusReturn = null;
|
|
6462
|
+
if (focusReturn?.isConnected) requestAnimationFrame(() => focusReturn.focus({ preventScroll: true }));
|
|
6463
|
+
}
|
|
6302
6464
|
}
|
|
6303
6465
|
|
|
6304
6466
|
function modalFocusableElements(surface) {
|
|
@@ -6463,8 +6625,17 @@ function chooseGitWorktreeBase(branch) {
|
|
|
6463
6625
|
function handleDrawerModalKeydown(event) {
|
|
6464
6626
|
if (!activeDrawerModal || event.defaultPrevented) return;
|
|
6465
6627
|
if (event.key === "Escape") {
|
|
6628
|
+
if (activeDrawerModal.surface === elements.terminalTabsShell && openTerminalTabGroupKey) {
|
|
6629
|
+
event.preventDefault();
|
|
6630
|
+
event.stopPropagation();
|
|
6631
|
+
const openGroup = [...elements.tabBar.querySelectorAll(".terminal-tab-group")]
|
|
6632
|
+
.find((group) => group.dataset.groupKey === openTerminalTabGroupKey);
|
|
6633
|
+
clearOpenTerminalTabGroup(openTerminalTabGroupKey, { force: true });
|
|
6634
|
+
openGroup?.querySelector(".terminal-tab-group-button")?.focus({ preventScroll: true });
|
|
6635
|
+
return;
|
|
6636
|
+
}
|
|
6466
6637
|
event.preventDefault();
|
|
6467
|
-
|
|
6638
|
+
activeDrawerModal.close?.();
|
|
6468
6639
|
return;
|
|
6469
6640
|
}
|
|
6470
6641
|
if (event.key !== "Tab") return;
|
|
@@ -6476,7 +6647,10 @@ function handleDrawerModalKeydown(event) {
|
|
|
6476
6647
|
}
|
|
6477
6648
|
const first = focusable[0];
|
|
6478
6649
|
const last = focusable[focusable.length - 1];
|
|
6479
|
-
if (
|
|
6650
|
+
if (!activeDrawerModal.surface.contains(document.activeElement)) {
|
|
6651
|
+
event.preventDefault();
|
|
6652
|
+
(event.shiftKey ? last : first).focus({ preventScroll: true });
|
|
6653
|
+
} else if (event.shiftKey && document.activeElement === first) {
|
|
6480
6654
|
event.preventDefault();
|
|
6481
6655
|
last.focus({ preventScroll: true });
|
|
6482
6656
|
} else if (!event.shiftKey && document.activeElement === last) {
|
|
@@ -6485,34 +6659,55 @@ function handleDrawerModalKeydown(event) {
|
|
|
6485
6659
|
}
|
|
6486
6660
|
}
|
|
6487
6661
|
|
|
6488
|
-
function activateDrawerModal(surface, trigger) {
|
|
6489
|
-
if (activeDrawerModal?.surface === surface)
|
|
6490
|
-
|
|
6662
|
+
function activateDrawerModal(surface, trigger, { close } = {}) {
|
|
6663
|
+
if (activeDrawerModal?.surface === surface) {
|
|
6664
|
+
activeDrawerModal.trigger = trigger;
|
|
6665
|
+
activeDrawerModal.close = close;
|
|
6666
|
+
return;
|
|
6667
|
+
}
|
|
6668
|
+
activeDrawerModal = {
|
|
6669
|
+
surface,
|
|
6670
|
+
trigger,
|
|
6671
|
+
close,
|
|
6672
|
+
previousRole: surface.getAttribute("role"),
|
|
6673
|
+
previousTabindex: surface.getAttribute("tabindex"),
|
|
6674
|
+
};
|
|
6675
|
+
surface.setAttribute("role", "dialog");
|
|
6491
6676
|
surface.setAttribute("aria-modal", "true");
|
|
6492
6677
|
surface.setAttribute("tabindex", "-1");
|
|
6493
6678
|
document.addEventListener("keydown", handleDrawerModalKeydown, true);
|
|
6494
6679
|
}
|
|
6495
6680
|
|
|
6496
|
-
function deactivateDrawerModal(surface) {
|
|
6681
|
+
function deactivateDrawerModal(surface, { restoreFocus = true } = {}) {
|
|
6497
6682
|
if (activeDrawerModal?.surface !== surface) {
|
|
6498
6683
|
surface?.removeAttribute("aria-modal");
|
|
6499
6684
|
return;
|
|
6500
6685
|
}
|
|
6501
|
-
const trigger = activeDrawerModal
|
|
6686
|
+
const { trigger, previousRole, previousTabindex } = activeDrawerModal;
|
|
6502
6687
|
activeDrawerModal = null;
|
|
6503
6688
|
surface.removeAttribute("aria-modal");
|
|
6689
|
+
if (previousRole === null) surface.removeAttribute("role");
|
|
6690
|
+
else surface.setAttribute("role", previousRole);
|
|
6691
|
+
if (previousTabindex === null) surface.removeAttribute("tabindex");
|
|
6692
|
+
else surface.setAttribute("tabindex", previousTabindex);
|
|
6504
6693
|
document.removeEventListener("keydown", handleDrawerModalKeydown, true);
|
|
6505
|
-
if (trigger?.isConnected) queueMicrotask(() => trigger.focus({ preventScroll: true }));
|
|
6694
|
+
if (restoreFocus && trigger?.isConnected) queueMicrotask(() => trigger.focus({ preventScroll: true }));
|
|
6506
6695
|
}
|
|
6507
6696
|
|
|
6508
6697
|
function syncMobileSidePanelState(collapsed) {
|
|
6509
6698
|
const showBackdrop = !collapsed && isSidePanelOverlayView();
|
|
6510
6699
|
elements.sidePanelBackdrop.hidden = !showBackdrop;
|
|
6511
|
-
if (showBackdrop)
|
|
6512
|
-
|
|
6700
|
+
if (showBackdrop) {
|
|
6701
|
+
activateDrawerModal(elements.sidePanel, elements.sidePanelExpandButton, {
|
|
6702
|
+
close: () => setSidePanelCollapsed(true, { persist: false }),
|
|
6703
|
+
});
|
|
6704
|
+
} else {
|
|
6705
|
+
deactivateDrawerModal(elements.sidePanel);
|
|
6706
|
+
}
|
|
6513
6707
|
}
|
|
6514
6708
|
|
|
6515
6709
|
function setSidePanelCollapsed(collapsed, { persist = true, focusPanel = false } = {}) {
|
|
6710
|
+
if (collapsed) setSidePanelSectionEditMode(false);
|
|
6516
6711
|
document.body.classList.toggle("side-panel-collapsed", collapsed);
|
|
6517
6712
|
elements.toggleSidePanelButton.setAttribute("aria-expanded", collapsed ? "false" : "true");
|
|
6518
6713
|
elements.toggleSidePanelButton.setAttribute("title", collapsed ? "Expand side panel" : "Collapse side panel");
|
|
@@ -6612,6 +6807,8 @@ function bindMobileViewChanges() {
|
|
|
6612
6807
|
const syncForViewport = (event) => {
|
|
6613
6808
|
applyMobileShellViewport();
|
|
6614
6809
|
syncComposerActionGridAvailability();
|
|
6810
|
+
syncMobileComposerDisclosureLayout();
|
|
6811
|
+
setSidePanelSectionEditMode(false);
|
|
6615
6812
|
if (isMobileShellV2Active()) return;
|
|
6616
6813
|
setComposerActionsOpen(false);
|
|
6617
6814
|
setMobileFooterExpanded(false);
|
|
@@ -10833,9 +11030,11 @@ function fileTreeExpander(expanded = false) {
|
|
|
10833
11030
|
function appendFileSearchEntry(parent, entry) {
|
|
10834
11031
|
const path = normalizeFileTreePath(entry.path);
|
|
10835
11032
|
const isDirectory = entry.type === "directory" || entry.directory === true;
|
|
11033
|
+
const expanded = isDirectory && fileTreeState.expanded.has(path);
|
|
11034
|
+
const loading = isDirectory && fileTreeState.loading.has(path);
|
|
10836
11035
|
const gitStatus = fileTreeGitStatusForEntry(entry);
|
|
10837
11036
|
const gitStatusClasses = fileTreeGitStatusClasses(gitStatus);
|
|
10838
|
-
const item = make("li", `file-tree-node file-tree-search-node ${entry.type || "file"}${gitStatusClasses ? ` ${gitStatusClasses}` : ""}${fileTreeState.selectedPath === path ? " selected" : ""}`);
|
|
11037
|
+
const item = make("li", `file-tree-node file-tree-search-node ${entry.type || "file"}${gitStatusClasses ? ` ${gitStatusClasses}` : ""}${expanded ? " expanded" : ""}${fileTreeState.selectedPath === path ? " selected" : ""}`);
|
|
10839
11038
|
item.setAttribute("role", "none");
|
|
10840
11039
|
const button = make("button", "file-tree-item file-tree-search-item");
|
|
10841
11040
|
button.type = "button";
|
|
@@ -10845,18 +11044,19 @@ function appendFileSearchEntry(parent, entry) {
|
|
|
10845
11044
|
button.setAttribute("role", "treeitem");
|
|
10846
11045
|
button.setAttribute("aria-selected", fileTreeState.selectedPath === path ? "true" : "false");
|
|
10847
11046
|
if (isDirectory) {
|
|
10848
|
-
button.setAttribute("aria-expanded", "false");
|
|
10849
|
-
button.setAttribute("aria-label",
|
|
11047
|
+
button.setAttribute("aria-expanded", expanded ? "true" : "false");
|
|
11048
|
+
button.setAttribute("aria-label", `${expanded ? "Collapse" : "Expand"} ${entry.name || fileDisplayName(path)}`);
|
|
10850
11049
|
}
|
|
10851
11050
|
button.title = [path || ".", fileTreeGitStatusTitle(gitStatus), entry.error || ""].filter(Boolean).join("\n");
|
|
11051
|
+
const contextPath = fileParentPath(path) || ".";
|
|
10852
11052
|
const label = make("span", "file-tree-search-label");
|
|
10853
11053
|
label.append(
|
|
10854
11054
|
make("span", "file-tree-name", entry.name || fileDisplayName(path)),
|
|
10855
|
-
make("span", "file-tree-search-path",
|
|
11055
|
+
make("span", "file-tree-search-path", contextPath),
|
|
10856
11056
|
);
|
|
10857
11057
|
button.append(
|
|
10858
|
-
isDirectory ? fileTreeExpander(
|
|
10859
|
-
make("span", "file-tree-icon", fileEntryIcon(entry)),
|
|
11058
|
+
isDirectory ? fileTreeExpander(expanded) : make("span", "file-tree-expander-spacer"),
|
|
11059
|
+
make("span", "file-tree-icon", loading ? "…" : fileEntryIcon(entry)),
|
|
10860
11060
|
label,
|
|
10861
11061
|
);
|
|
10862
11062
|
const gitBadge = fileTreeGitStatusBadge(gitStatus);
|
|
@@ -10867,20 +11067,28 @@ function appendFileSearchEntry(parent, entry) {
|
|
|
10867
11067
|
button.addEventListener("click", () => {
|
|
10868
11068
|
fileTreeState.selectedPath = path;
|
|
10869
11069
|
if (entry.type === "file") openFileInViewer(path);
|
|
10870
|
-
else
|
|
11070
|
+
else toggleFileTreeDirectory(path).catch((error) => addEvent(error.message || String(error), "error"));
|
|
10871
11071
|
});
|
|
10872
11072
|
button.addEventListener("contextmenu", (event) => showFileContextMenu(event, entry));
|
|
10873
11073
|
bindFileTreeDragAndDrop(button, item, entry);
|
|
10874
11074
|
item.append(button, fileTreeOverflowButton(entry));
|
|
11075
|
+
if (isDirectory && expanded) {
|
|
11076
|
+
const children = fileTreeState.entriesByPath.get(path) || [];
|
|
11077
|
+
const childList = make("ul", "file-tree-list");
|
|
11078
|
+
childList.setAttribute("role", "group");
|
|
11079
|
+
if (loading) childList.append(make("li", "file-tree-loading muted", "Loading…"));
|
|
11080
|
+
else if (!children.length) childList.append(make("li", "file-tree-empty muted", "Empty"));
|
|
11081
|
+
else for (const child of children) appendFileTreeEntry(childList, child, 1);
|
|
11082
|
+
item.append(childList);
|
|
11083
|
+
}
|
|
10875
11084
|
parent.append(item);
|
|
10876
11085
|
}
|
|
10877
11086
|
|
|
10878
|
-
async function revealFileTreeEntry(entry = {}) {
|
|
11087
|
+
async function revealFileTreeEntry(entry = {}, { expandTarget = true } = {}) {
|
|
10879
11088
|
const targetPath = normalizeFileTreePath(entry.path || "");
|
|
10880
11089
|
if (!targetPath && targetPath !== FILE_TREE_ROOT_PATH) return;
|
|
10881
11090
|
const isDirectory = entry.type === "directory" || entry.directory === true;
|
|
10882
|
-
const parentPath =
|
|
10883
|
-
clearFileTreeSearch();
|
|
11091
|
+
const parentPath = fileParentPath(targetPath);
|
|
10884
11092
|
fileTreeState.selectedPath = targetPath;
|
|
10885
11093
|
await loadFileTreeDirectory(FILE_TREE_ROOT_PATH);
|
|
10886
11094
|
let currentPath = "";
|
|
@@ -10890,7 +11098,7 @@ async function revealFileTreeEntry(entry = {}) {
|
|
|
10890
11098
|
renderFileTree();
|
|
10891
11099
|
await loadFileTreeDirectory(currentPath);
|
|
10892
11100
|
}
|
|
10893
|
-
if (isDirectory) {
|
|
11101
|
+
if (isDirectory && expandTarget) {
|
|
10894
11102
|
fileTreeState.expanded.add(targetPath);
|
|
10895
11103
|
await loadFileTreeDirectory(targetPath);
|
|
10896
11104
|
}
|
|
@@ -10988,21 +11196,49 @@ async function loadFileTreeDirectory(path = FILE_TREE_ROOT_PATH, { force = false
|
|
|
10988
11196
|
}
|
|
10989
11197
|
}
|
|
10990
11198
|
|
|
11199
|
+
function focusVisibleFileTreeSelection(path = fileTreeState.selectedPath) {
|
|
11200
|
+
const normalized = normalizeFileTreePath(path);
|
|
11201
|
+
if (!normalized) return false;
|
|
11202
|
+
const selected = visibleFileTreeItems().find((item) => normalizeFileTreePath(item.dataset.path) === normalized);
|
|
11203
|
+
if (!selected) return false;
|
|
11204
|
+
selected.focus({ preventScroll: true });
|
|
11205
|
+
selected.scrollIntoView?.({ block: "nearest" });
|
|
11206
|
+
return true;
|
|
11207
|
+
}
|
|
11208
|
+
|
|
10991
11209
|
function clearFileTreeSearch({ focus = false } = {}) {
|
|
10992
11210
|
clearTimeout(fileTreeSearchTimer);
|
|
10993
11211
|
fileTreeSearchTimer = null;
|
|
10994
11212
|
fileTreeSearchRequestSerial += 1;
|
|
11213
|
+
const serial = fileTreeSearchRequestSerial;
|
|
11214
|
+
const selectedPath = normalizeFileTreePath(fileTreeState.selectedPath || "");
|
|
11215
|
+
const selectedEntry = fileTreeState.searchEntries.find((entry) => normalizeFileTreePath(entry.path) === selectedPath) || fileEntryByPath(selectedPath);
|
|
11216
|
+
const selectedDirectoryExpanded = fileTreeState.expanded.has(selectedPath);
|
|
10995
11217
|
if (elements.fileTreeSearchInput) elements.fileTreeSearchInput.value = "";
|
|
10996
|
-
fileTreeState.searchQuery = "";
|
|
10997
|
-
fileTreeState.searchEntries = [];
|
|
10998
|
-
fileTreeState.searchLoading = false;
|
|
10999
|
-
fileTreeState.searchTruncated = false;
|
|
11000
|
-
fileTreeState.searchTotal = 0;
|
|
11001
11218
|
updateFileTreeSearchControls();
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11219
|
+
|
|
11220
|
+
const commitClear = () => {
|
|
11221
|
+
if (serial !== fileTreeSearchRequestSerial || fileTreeSearchQueryText()) return;
|
|
11222
|
+
fileTreeState.searchQuery = "";
|
|
11223
|
+
fileTreeState.searchEntries = [];
|
|
11224
|
+
fileTreeState.searchLoading = false;
|
|
11225
|
+
fileTreeState.searchTruncated = false;
|
|
11226
|
+
fileTreeState.searchTotal = 0;
|
|
11227
|
+
const rootEntries = fileTreeState.entriesByPath.get(FILE_TREE_ROOT_PATH) || [];
|
|
11228
|
+
setFileTreeStatus(rootEntries.length ? fileTreeEntriesStatus(rootEntries) : "");
|
|
11229
|
+
renderFileTree();
|
|
11230
|
+
if (selectedPath && focusVisibleFileTreeSelection(selectedPath)) return;
|
|
11231
|
+
if (focus) elements.fileTreeSearchInput?.focus();
|
|
11232
|
+
};
|
|
11233
|
+
|
|
11234
|
+
if (!selectedPath || !selectedEntry) {
|
|
11235
|
+
commitClear();
|
|
11236
|
+
return;
|
|
11237
|
+
}
|
|
11238
|
+
revealFileTreeEntry(selectedEntry, { expandTarget: selectedDirectoryExpanded }).then(commitClear).catch((error) => {
|
|
11239
|
+
addEvent(error.message || String(error), "error");
|
|
11240
|
+
commitClear();
|
|
11241
|
+
});
|
|
11006
11242
|
}
|
|
11007
11243
|
|
|
11008
11244
|
async function runFileTreeSearch({ background = false } = {}) {
|
|
@@ -12696,16 +12932,84 @@ function textOffsetPosition(root, offset) {
|
|
|
12696
12932
|
return null;
|
|
12697
12933
|
}
|
|
12698
12934
|
|
|
12935
|
+
function textOffsetRange(root, match) {
|
|
12936
|
+
const start = textOffsetPosition(root, match.start);
|
|
12937
|
+
const end = textOffsetPosition(root, match.end);
|
|
12938
|
+
if (!start || !end) return null;
|
|
12939
|
+
const range = document.createRange();
|
|
12940
|
+
range.setStart(start.node, start.offset);
|
|
12941
|
+
range.setEnd(end.node, end.offset);
|
|
12942
|
+
return range;
|
|
12943
|
+
}
|
|
12944
|
+
|
|
12945
|
+
function syncFileViewerSearchOverlayScroll() {
|
|
12946
|
+
const editor = elements.fileViewerEditor;
|
|
12947
|
+
const overlay = elements.fileViewerSearchOverlay;
|
|
12948
|
+
if (!editor || !overlay || overlay.hidden) return;
|
|
12949
|
+
overlay.scrollTop = editor.scrollTop;
|
|
12950
|
+
overlay.scrollLeft = editor.scrollLeft;
|
|
12951
|
+
}
|
|
12952
|
+
|
|
12699
12953
|
function clearFileViewerSearchHighlight() {
|
|
12954
|
+
globalThis.CSS?.highlights?.delete("file-viewer-search-match");
|
|
12700
12955
|
globalThis.CSS?.highlights?.delete("file-viewer-search-current");
|
|
12701
|
-
|
|
12702
|
-
|
|
12956
|
+
for (const surface of [elements.fileViewerPreview, elements.fileViewerChanges]) {
|
|
12957
|
+
for (const node of surface?.querySelectorAll(".file-viewer-search-match-fallback, .file-viewer-search-current-fallback") || []) {
|
|
12958
|
+
node.classList.remove("file-viewer-search-match-fallback", "file-viewer-search-current-fallback");
|
|
12959
|
+
}
|
|
12960
|
+
}
|
|
12961
|
+
const overlay = elements.fileViewerSearchOverlay;
|
|
12962
|
+
if (overlay) {
|
|
12963
|
+
overlay.hidden = true;
|
|
12964
|
+
overlay.replaceChildren();
|
|
12965
|
+
}
|
|
12966
|
+
elements.fileViewerEditor?.closest(".file-viewer-content")?.classList.remove("search-highlights-source");
|
|
12967
|
+
}
|
|
12968
|
+
|
|
12969
|
+
function renderFileViewerSourceSearchHighlights() {
|
|
12970
|
+
const editor = elements.fileViewerEditor;
|
|
12971
|
+
const overlay = elements.fileViewerSearchOverlay;
|
|
12972
|
+
if (!editor || !overlay || !fileViewerSearchMatches.length) return;
|
|
12973
|
+
const text = fileViewerSearchText();
|
|
12974
|
+
const fragment = document.createDocumentFragment();
|
|
12975
|
+
let offset = 0;
|
|
12976
|
+
fileViewerSearchMatches.forEach((match, index) => {
|
|
12977
|
+
if (match.start > offset) fragment.append(document.createTextNode(text.slice(offset, match.start)));
|
|
12978
|
+
const mark = make("mark", `file-viewer-search-match${index === fileViewerSearchIndex ? " current" : ""}`, text.slice(match.start, match.end));
|
|
12979
|
+
fragment.append(mark);
|
|
12980
|
+
offset = match.end;
|
|
12981
|
+
});
|
|
12982
|
+
if (offset < text.length) fragment.append(document.createTextNode(text.slice(offset)));
|
|
12983
|
+
overlay.replaceChildren(fragment);
|
|
12984
|
+
overlay.hidden = false;
|
|
12985
|
+
editor.closest(".file-viewer-content")?.classList.add("search-highlights-source");
|
|
12986
|
+
syncFileViewerSearchOverlayScroll();
|
|
12987
|
+
}
|
|
12988
|
+
|
|
12989
|
+
function renderFileViewerSearchHighlights() {
|
|
12990
|
+
clearFileViewerSearchHighlight();
|
|
12991
|
+
const surface = fileViewerSearchSurface();
|
|
12992
|
+
if (!surface || !fileViewerSearchMatches.length) return;
|
|
12993
|
+
if (surface === elements.fileViewerEditor) {
|
|
12994
|
+
renderFileViewerSourceSearchHighlights();
|
|
12995
|
+
return;
|
|
12996
|
+
}
|
|
12997
|
+
const ranges = fileViewerSearchMatches.map((match) => textOffsetRange(surface, match)).filter(Boolean);
|
|
12998
|
+
const currentRange = textOffsetRange(surface, fileViewerSearchMatches[fileViewerSearchIndex]);
|
|
12999
|
+
const HighlightConstructor = globalThis.Highlight;
|
|
13000
|
+
if (globalThis.CSS?.highlights && typeof HighlightConstructor === "function") {
|
|
13001
|
+
if (ranges.length) globalThis.CSS.highlights.set("file-viewer-search-match", new HighlightConstructor(...ranges));
|
|
13002
|
+
if (currentRange) globalThis.CSS.highlights.set("file-viewer-search-current", new HighlightConstructor(currentRange));
|
|
13003
|
+
return;
|
|
13004
|
+
}
|
|
13005
|
+
for (const match of fileViewerSearchMatches) textOffsetPosition(surface, match.start)?.node.parentElement?.classList.add("file-viewer-search-match-fallback");
|
|
13006
|
+
textOffsetPosition(surface, fileViewerSearchMatches[fileViewerSearchIndex]?.start)?.node.parentElement?.classList.add("file-viewer-search-current-fallback");
|
|
12703
13007
|
}
|
|
12704
13008
|
|
|
12705
13009
|
function focusFileViewerSearchMatch() {
|
|
12706
13010
|
const match = fileViewerSearchMatches[fileViewerSearchIndex];
|
|
12707
13011
|
const surface = fileViewerSearchSurface();
|
|
12708
|
-
|
|
13012
|
+
renderFileViewerSearchHighlights();
|
|
12709
13013
|
if (!match || !surface) return;
|
|
12710
13014
|
if (surface === elements.fileViewerEditor) {
|
|
12711
13015
|
surface.setSelectionRange(match.start, match.end);
|
|
@@ -12715,22 +13019,9 @@ function focusFileViewerSearchMatch() {
|
|
|
12715
13019
|
const fontSize = Number.parseFloat(computedStyle.fontSize) || 14;
|
|
12716
13020
|
const lineHeight = !parsedLineHeight ? fontSize * 1.45 : parsedLineHeight < 8 ? parsedLineHeight * fontSize : parsedLineHeight;
|
|
12717
13021
|
surface.scrollTop = Math.max(0, (lineIndex * lineHeight) - (surface.clientHeight / 2));
|
|
13022
|
+
syncFileViewerSearchOverlayScroll();
|
|
12718
13023
|
} else {
|
|
12719
|
-
|
|
12720
|
-
const end = textOffsetPosition(surface, match.end);
|
|
12721
|
-
if (start && end) {
|
|
12722
|
-
const range = document.createRange();
|
|
12723
|
-
range.setStart(start.node, start.offset);
|
|
12724
|
-
range.setEnd(end.node, end.offset);
|
|
12725
|
-
const HighlightConstructor = globalThis.Highlight;
|
|
12726
|
-
if (globalThis.CSS?.highlights && typeof HighlightConstructor === "function") {
|
|
12727
|
-
globalThis.CSS.highlights.set("file-viewer-search-current", new HighlightConstructor(range));
|
|
12728
|
-
} else {
|
|
12729
|
-
fileViewerSearchHighlightElement = start.node.parentElement;
|
|
12730
|
-
fileViewerSearchHighlightElement?.classList.add("file-viewer-search-current-fallback");
|
|
12731
|
-
}
|
|
12732
|
-
start.node.parentElement?.scrollIntoView({ block: "center", behavior: "instant" });
|
|
12733
|
-
}
|
|
13024
|
+
textOffsetPosition(surface, match.start)?.node.parentElement?.scrollIntoView({ block: "center", behavior: "instant" });
|
|
12734
13025
|
}
|
|
12735
13026
|
elements.fileViewerSearchInput?.focus({ preventScroll: true });
|
|
12736
13027
|
updateFileViewerSearchCount();
|
|
@@ -12746,6 +13037,7 @@ function runFileViewerSearch({ navigate = false } = {}) {
|
|
|
12746
13037
|
else if (fileViewerSearchIndex < 0 || fileViewerSearchIndex >= fileViewerSearchMatches.length) fileViewerSearchIndex = 0;
|
|
12747
13038
|
updateFileViewerSearchCount();
|
|
12748
13039
|
if (navigate) focusFileViewerSearchMatch();
|
|
13040
|
+
else renderFileViewerSearchHighlights();
|
|
12749
13041
|
}
|
|
12750
13042
|
|
|
12751
13043
|
function stepFileViewerSearch(step) {
|
|
@@ -14680,11 +14972,11 @@ function terminalTabGroupTooltip(group, groupTitle = terminalDisplayGroupTitle(g
|
|
|
14680
14972
|
];
|
|
14681
14973
|
const active = terminalTabGroupActiveTooltip(groupTabs);
|
|
14682
14974
|
if (active) lines.push(`Active: ${active}`);
|
|
14683
|
-
lines.push("Click to switch · Drop tabs here to add");
|
|
14975
|
+
lines.push(isMobileView() ? "Tap to open group terminals" : "Click to switch · Drop tabs here to add");
|
|
14684
14976
|
return lines.join("\n");
|
|
14685
14977
|
}
|
|
14686
14978
|
|
|
14687
|
-
function appendTerminalTabContent(button, { title, indicator, meta, count = null, appRunnerRun = null, conversationModeActive = false, workflowModeActive = false, workflowCount = 0, subagent = false }) {
|
|
14979
|
+
function appendTerminalTabContent(button, { title, indicator, meta, count = null, appRunnerRun = null, conversationModeActive = false, workflowModeActive = false, workflowCount = 0, subagent = false, dropdown = false }) {
|
|
14688
14980
|
const titleRow = make("span", "terminal-tab-title-row");
|
|
14689
14981
|
const indicatorDot = make("span", "terminal-tab-activity-indicator");
|
|
14690
14982
|
indicatorDot.setAttribute("aria-hidden", "true");
|
|
@@ -14694,6 +14986,11 @@ function appendTerminalTabContent(button, { title, indicator, meta, count = null
|
|
|
14694
14986
|
if (conversationModeActive) titleRow.append(make("span", "terminal-tab-conversation-indicator", "voice"));
|
|
14695
14987
|
if (workflowModeActive || workflowCount) titleRow.append(make("span", "terminal-tab-workflow-indicator", workflowCount ? `wf ${workflowCount}` : "wf"));
|
|
14696
14988
|
if (count !== null) titleRow.append(make("span", "terminal-tab-group-count", String(count)));
|
|
14989
|
+
if (dropdown) {
|
|
14990
|
+
const disclosure = make("span", "terminal-tab-group-dropdown-indicator", "⌄");
|
|
14991
|
+
disclosure.setAttribute("aria-hidden", "true");
|
|
14992
|
+
titleRow.append(disclosure);
|
|
14993
|
+
}
|
|
14697
14994
|
button.append(titleRow, make("span", "terminal-tab-meta", meta));
|
|
14698
14995
|
}
|
|
14699
14996
|
|
|
@@ -14801,10 +15098,19 @@ function renderTerminalTabGroup(group, groupCount = 1) {
|
|
|
14801
15098
|
wrapper.dataset.groupKey = group.key;
|
|
14802
15099
|
if (group.customGroupId) wrapper.dataset.customGroupId = group.customGroupId;
|
|
14803
15100
|
bindTerminalTabDragAndDrop(wrapper, { sourceTabId: activeGroupTab?.id || "", target: { type: "group", group } });
|
|
14804
|
-
wrapper.addEventListener("pointerenter", () =>
|
|
14805
|
-
|
|
14806
|
-
|
|
15101
|
+
wrapper.addEventListener("pointerenter", (event) => {
|
|
15102
|
+
if (event.pointerType === "touch") return;
|
|
15103
|
+
setOpenTerminalTabGroup(group.key);
|
|
15104
|
+
});
|
|
15105
|
+
wrapper.addEventListener("pointerleave", (event) => {
|
|
15106
|
+
if (event.pointerType === "touch") return;
|
|
15107
|
+
clearOpenTerminalTabGroup(group.key);
|
|
15108
|
+
});
|
|
15109
|
+
wrapper.addEventListener("focusin", () => {
|
|
15110
|
+
if (!isMobileView()) setOpenTerminalTabGroup(group.key);
|
|
15111
|
+
});
|
|
14807
15112
|
wrapper.addEventListener("focusout", () => {
|
|
15113
|
+
if (isMobileView()) return;
|
|
14808
15114
|
setTimeout(() => {
|
|
14809
15115
|
if (!wrapper.contains(document.activeElement)) clearOpenTerminalTabGroup(group.key);
|
|
14810
15116
|
}, 0);
|
|
@@ -14816,10 +15122,16 @@ function renderTerminalTabGroup(group, groupCount = 1) {
|
|
|
14816
15122
|
button.setAttribute("aria-selected", isActive ? "true" : "false");
|
|
14817
15123
|
button.setAttribute("aria-haspopup", "true");
|
|
14818
15124
|
button.setAttribute("aria-expanded", group.key === openTerminalTabGroupKey ? "true" : "false");
|
|
14819
|
-
button.setAttribute("aria-label", `${groupTitle} ${group.custom ? "custom" : "cwd"} group: ${groupTabs.length} tabs, ${indicator.label}${appRunnerSummary ? `, ${appRunnerSummary}` : ""}${workflowModeActive ? ", workflow mode active" : ""}${workflowCount ? `, ${workflowCount} workflow runs active` : ""}. Active ${activeTitle}`);
|
|
15125
|
+
button.setAttribute("aria-label", `${groupTitle} ${group.custom ? "custom" : "cwd"} group: ${groupTabs.length} tabs, ${indicator.label}${appRunnerSummary ? `, ${appRunnerSummary}` : ""}${workflowModeActive ? ", workflow mode active" : ""}${workflowCount ? `, ${workflowCount} workflow runs active` : ""}. Active ${activeTitle}. ${isMobileView() ? "Toggle group terminal list" : "Switch to the active group terminal"}`);
|
|
14820
15126
|
applyStyledTooltip(button, terminalTabGroupTooltip(group, groupTitle), { ariaLabel: false, description: true, placement: "right", variant: "workspace", targetKey: `terminal-group:${group.key}:switch` });
|
|
14821
|
-
appendTerminalTabContent(button, { title: activeTitle, indicator, meta: `${groupTitle} · ${indicator.meta}${groupAppRunnerMeta ? ` · ${groupAppRunnerMeta}` : ""}${workflowModeActive ? " · workflow mode" : ""}${workflowCount ? ` · ${workflowCount} workflows` : ""}`, appRunnerRun, count: groupTabs.length, workflowModeActive, workflowCount });
|
|
14822
|
-
button.addEventListener("click", () =>
|
|
15127
|
+
appendTerminalTabContent(button, { title: activeTitle, indicator, meta: `${groupTitle} · ${indicator.meta}${groupAppRunnerMeta ? ` · ${groupAppRunnerMeta}` : ""}${workflowModeActive ? " · workflow mode" : ""}${workflowCount ? ` · ${workflowCount} workflows` : ""}`, appRunnerRun, count: groupTabs.length, workflowModeActive, workflowCount, dropdown: true });
|
|
15128
|
+
button.addEventListener("click", () => {
|
|
15129
|
+
if (isMobileView()) {
|
|
15130
|
+
toggleOpenTerminalTabGroup(group.key);
|
|
15131
|
+
return;
|
|
15132
|
+
}
|
|
15133
|
+
switchTab(activeGroupTab.id);
|
|
15134
|
+
});
|
|
14823
15135
|
wrapper.append(button);
|
|
14824
15136
|
|
|
14825
15137
|
if (groupCount > 1 || group.custom) {
|
|
@@ -14836,8 +15148,10 @@ function renderTerminalTabGroup(group, groupCount = 1) {
|
|
|
14836
15148
|
}
|
|
14837
15149
|
|
|
14838
15150
|
const menu = make("div", "terminal-tab-group-menu");
|
|
15151
|
+
menu.id = `terminalTabGroupMenu${++terminalTabGroupMenuSerial}`;
|
|
14839
15152
|
menu.setAttribute("role", "group");
|
|
14840
15153
|
menu.setAttribute("aria-label", `${groupTitle} tabs`);
|
|
15154
|
+
button.setAttribute("aria-controls", menu.id);
|
|
14841
15155
|
for (const tab of groupTabs) menu.append(renderTerminalTabGroupItem(tab, group));
|
|
14842
15156
|
|
|
14843
15157
|
const add = make("button", "terminal-tab-group-add", "+ Tab");
|
|
@@ -14868,6 +15182,12 @@ function setOpenTerminalTabGroup(groupKey) {
|
|
|
14868
15182
|
updateTerminalTabGroupOpenState();
|
|
14869
15183
|
}
|
|
14870
15184
|
|
|
15185
|
+
function toggleOpenTerminalTabGroup(groupKey) {
|
|
15186
|
+
if (!groupKey) return;
|
|
15187
|
+
if (openTerminalTabGroupKey === groupKey) clearOpenTerminalTabGroup(groupKey);
|
|
15188
|
+
else setOpenTerminalTabGroup(groupKey);
|
|
15189
|
+
}
|
|
15190
|
+
|
|
14871
15191
|
function clearOpenTerminalTabGroup(groupKey, { force = false } = {}) {
|
|
14872
15192
|
if (!openTerminalTabGroupKey || (!force && openTerminalTabGroupKey !== groupKey)) return;
|
|
14873
15193
|
openTerminalTabGroupKey = null;
|
|
@@ -15043,6 +15363,8 @@ async function refreshTabs({ selectStored = false } = {}) {
|
|
|
15043
15363
|
async function switchTab(tabId) {
|
|
15044
15364
|
if (!tabId || !tabs.some((tab) => tab.id === tabId)) return;
|
|
15045
15365
|
if (tabId === activeTabId) {
|
|
15366
|
+
clearOpenTerminalTabGroup(null, { force: true });
|
|
15367
|
+
setMobileTabsExpanded(false);
|
|
15046
15368
|
if (activeSubagentTerminalId) deactivateSubagentTerminalView({ focusParent: true });
|
|
15047
15369
|
return;
|
|
15048
15370
|
}
|
|
@@ -16292,10 +16614,13 @@ function hideFooterTooltip(target) {
|
|
|
16292
16614
|
function bindStyledTooltipEvents(node) {
|
|
16293
16615
|
if (!node || node._styledTooltipBound) return;
|
|
16294
16616
|
node._styledTooltipBound = true;
|
|
16295
|
-
node.addEventListener("
|
|
16296
|
-
|
|
16617
|
+
node.addEventListener("pointerenter", (event) => {
|
|
16618
|
+
if (event.pointerType === "touch") return;
|
|
16619
|
+
scheduleFooterTooltip(node);
|
|
16620
|
+
});
|
|
16621
|
+
node.addEventListener("pointerleave", () => hideFooterTooltip(node));
|
|
16297
16622
|
node.addEventListener("focus", () => {
|
|
16298
|
-
if (
|
|
16623
|
+
if (!node.matches(":focus-visible")) return;
|
|
16299
16624
|
showFooterTooltip(node);
|
|
16300
16625
|
});
|
|
16301
16626
|
node.addEventListener("blur", () => hideFooterTooltip(node));
|
|
@@ -16334,12 +16659,17 @@ function applyFooterTooltip(node, tooltip, options = {}) {
|
|
|
16334
16659
|
return applyStyledTooltip(node, tooltip, options);
|
|
16335
16660
|
}
|
|
16336
16661
|
|
|
16662
|
+
function runFooterControlAction(action, event) {
|
|
16663
|
+
if (mobileFooterExpanded) setMobileFooterExpanded(false, { restoreFocus: false });
|
|
16664
|
+
return action(event);
|
|
16665
|
+
}
|
|
16666
|
+
|
|
16337
16667
|
function footerMetric(icon, label, value, tone = "", options = {}) {
|
|
16338
16668
|
const isAction = typeof options.onClick === "function";
|
|
16339
16669
|
const node = make(isAction ? "button" : "span", ["footer-metric", tone, isAction ? "footer-metric-action" : ""].filter(Boolean).join(" "));
|
|
16340
16670
|
if (isAction) {
|
|
16341
16671
|
node.type = "button";
|
|
16342
|
-
node.addEventListener("click", options.onClick);
|
|
16672
|
+
node.addEventListener("click", (event) => runFooterControlAction(options.onClick, event));
|
|
16343
16673
|
if (options.ariaPressed !== undefined) node.setAttribute("aria-pressed", options.ariaPressed ? "true" : "false");
|
|
16344
16674
|
if (options.ariaBusy) node.setAttribute("aria-busy", "true");
|
|
16345
16675
|
}
|
|
@@ -16445,7 +16775,7 @@ function footerMeta(label, value, className = "", options = {}) {
|
|
|
16445
16775
|
const node = make(isAction ? "button" : "span", ["footer-meta", className, isAction ? "footer-meta-action" : ""].filter(Boolean).join(" "));
|
|
16446
16776
|
if (isAction) {
|
|
16447
16777
|
node.type = "button";
|
|
16448
|
-
node.addEventListener("click", options.onClick);
|
|
16778
|
+
node.addEventListener("click", (event) => runFooterControlAction(options.onClick, event));
|
|
16449
16779
|
if (options.ariaPressed !== undefined) node.setAttribute("aria-pressed", options.ariaPressed ? "true" : "false");
|
|
16450
16780
|
if (options.ariaBusy) node.setAttribute("aria-busy", "true");
|
|
16451
16781
|
if (options.disabled) {
|
|
@@ -17738,10 +18068,12 @@ function renderGitFooterPayload(payload) {
|
|
|
17738
18068
|
const row2 = make("div", "footer-line footer-line-meta");
|
|
17739
18069
|
const row2Children = [...metaNodes];
|
|
17740
18070
|
if (gitFooterPayloadVisible(payload, "webui-details-button")) {
|
|
17741
|
-
const footerToggle = make("button", "footer-details-toggle", mobileFooterExpanded ? "
|
|
18071
|
+
const footerToggle = make("button", "footer-details-toggle", mobileFooterExpanded ? "−" : "Details");
|
|
17742
18072
|
footerToggle.type = "button";
|
|
18073
|
+
footerToggle.setAttribute("aria-label", mobileFooterExpanded ? "Minimize Git footer details" : "Show Git footer details");
|
|
18074
|
+
footerToggle.setAttribute("title", mobileFooterExpanded ? "Minimize Git footer details" : "Show Git footer details");
|
|
17743
18075
|
footerToggle.setAttribute("aria-expanded", mobileFooterExpanded ? "true" : "false");
|
|
17744
|
-
footerToggle.addEventListener("click", () => setMobileFooterExpanded(!mobileFooterExpanded));
|
|
18076
|
+
footerToggle.addEventListener("click", () => setMobileFooterExpanded(!mobileFooterExpanded, { restoreFocus: true }));
|
|
17745
18077
|
row2Children.push(footerToggle);
|
|
17746
18078
|
}
|
|
17747
18079
|
row2.append(...row2Children);
|
|
@@ -20160,7 +20492,8 @@ async function confirmFooterGitWorktreeAction(branch, { path = "", create = fals
|
|
|
20160
20492
|
...(trackedRemoteRef ? [`Remote ref: ${trackedRemoteRef}`, `Creates local branch ${branchName} tracking ${trackedRemoteRef}.`] : []),
|
|
20161
20493
|
targetPath ? `Worktree: ${targetPath}` : `Default location: ${footerBranchPickerState.defaultWorktreesRoot || "repo sibling .worktrees directory"}`,
|
|
20162
20494
|
"",
|
|
20163
|
-
"This
|
|
20495
|
+
"This creates a separate checkout without changing this tab's branch.",
|
|
20496
|
+
"After creation, you can choose whether to open it in a separate Pi tab and switch to it.",
|
|
20164
20497
|
"Ignored dependencies such as node_modules or .venv are not copied; bootstrap them manually if needed.",
|
|
20165
20498
|
"",
|
|
20166
20499
|
"Continue?",
|
|
@@ -20242,7 +20575,7 @@ function footerBranchCreateTooltip(branchName = footerBranchCreateName(), state
|
|
|
20242
20575
|
"",
|
|
20243
20576
|
"What happens:",
|
|
20244
20577
|
"• asks whether to base the new branch on origin/main (default) or this workspace's current HEAD",
|
|
20245
|
-
"•
|
|
20578
|
+
"• creates the worktree, then asks whether to open and switch to it in a separate Pi tab",
|
|
20246
20579
|
"• does not switch this tab's branch, commit, push, or delete anything",
|
|
20247
20580
|
"",
|
|
20248
20581
|
"Tip: ignored dependencies such as node_modules or .venv are not copied.",
|
|
@@ -20260,7 +20593,7 @@ async function createFooterGitBranch(branch = footerBranchCreateName()) {
|
|
|
20260
20593
|
await applyFooterGitBranch(branchName, { create: true, tabContext, skipConfirm: true });
|
|
20261
20594
|
}
|
|
20262
20595
|
|
|
20263
|
-
async function openWorktreeResponseTab(response, { branchName = "", action = "open" } = {}) {
|
|
20596
|
+
async function openWorktreeResponseTab(response, { branchName = "", action = "open", announce = true } = {}) {
|
|
20264
20597
|
if (!response.ok) throw new Error(response.error || `Failed to ${action} branch worktree`);
|
|
20265
20598
|
const payload = response.data || {};
|
|
20266
20599
|
if (Array.isArray(payload.tabs)) {
|
|
@@ -20277,12 +20610,27 @@ async function openWorktreeResponseTab(response, { branchName = "", action = "op
|
|
|
20277
20610
|
const branch = cleanStatusText(payload.worktree?.branch || payload.branch || branchName || targetTab?.gitWorkspace?.branch || "");
|
|
20278
20611
|
const where = payload.worktree?.path || payload.path || targetTab?.cwd || "worktree";
|
|
20279
20612
|
const prefix = payload.created ? "Created" : payload.openedExisting || payload.openedExistingTab ? "Opened existing" : "Opened";
|
|
20280
|
-
addEvent(`${prefix} branch worktree${branch ? ` ${branch}` : ""} at ${normalizeDisplayPath(where)}.`, "success");
|
|
20613
|
+
if (announce) addEvent(`${prefix} branch worktree${branch ? ` ${branch}` : ""} at ${normalizeDisplayPath(where)}.`, "success");
|
|
20281
20614
|
if (payload.session?.warning) addEvent(payload.session.warning, "warn");
|
|
20282
20615
|
if (payload.dependencyHint) addEvent(payload.dependencyHint, "info");
|
|
20283
20616
|
requestGitFooterWebuiPayload(activeTabContext(), { force: true });
|
|
20284
20617
|
}
|
|
20285
20618
|
|
|
20619
|
+
async function confirmSwitchToCreatedFooterGitWorktree(payload = {}, branchName = "") {
|
|
20620
|
+
if (payload.created !== true) return false;
|
|
20621
|
+
const branch = cleanStatusText(payload.worktree?.branch || payload.branch || branchName);
|
|
20622
|
+
const worktreePath = cleanFooterPayloadText(payload.worktree?.path || payload.path, "", 4000);
|
|
20623
|
+
if (!worktreePath) return false;
|
|
20624
|
+
return appConfirm({
|
|
20625
|
+
title: "Switch to new worktree?",
|
|
20626
|
+
summary: `The${branch ? ` ${branch}` : ""} worktree was created. Open it in a separate Pi tab and switch to it now? The worktree remains available if you stay here.`,
|
|
20627
|
+
affected: normalizeDisplayPath(worktreePath),
|
|
20628
|
+
undoable: true,
|
|
20629
|
+
confirmLabel: "Switch to worktree",
|
|
20630
|
+
danger: false,
|
|
20631
|
+
});
|
|
20632
|
+
}
|
|
20633
|
+
|
|
20286
20634
|
async function createFooterGitBranchWorktree(branch = footerBranchCreateName(), { tabContext = activeTabContext(), skipConfirm = false, chooseBase = true, remoteRef = "", switchingLabel = "", switchingKey = "" } = {}) {
|
|
20287
20635
|
const branchName = cleanStatusText(branch);
|
|
20288
20636
|
if (!branchName) {
|
|
@@ -20300,9 +20648,20 @@ async function createFooterGitBranchWorktree(branch = footerBranchCreateName(),
|
|
|
20300
20648
|
// Remote-only creation submits the exact advertised remote ref instead of a
|
|
20301
20649
|
// base ref; the server re-verifies it and creates a local tracking branch.
|
|
20302
20650
|
const response = trackedRemoteRef
|
|
20303
|
-
? await api("/api/git-worktrees", { method: "POST", body: { branchName, remoteRef: trackedRemoteRef, sessionMode: "fork-current", openTab:
|
|
20304
|
-
: await api("/api/git-worktrees", { method: "POST", body: { branchName, baseRef, sessionMode: "fork-current", openTab:
|
|
20305
|
-
|
|
20651
|
+
? await api("/api/git-worktrees", { method: "POST", body: { branchName, remoteRef: trackedRemoteRef, sessionMode: "fork-current", openTab: false }, tabId })
|
|
20652
|
+
: await api("/api/git-worktrees", { method: "POST", body: { branchName, baseRef, sessionMode: "fork-current", openTab: false }, tabId });
|
|
20653
|
+
if (!response.ok) throw new Error(response.error || "Failed to create branch worktree");
|
|
20654
|
+
const payload = response.data || {};
|
|
20655
|
+
const worktreePath = cleanFooterPayloadText(payload.worktree?.path || payload.path, "", 4000);
|
|
20656
|
+
if (!worktreePath) throw new Error("Git worktree creation did not return a path");
|
|
20657
|
+
if (payload.created) {
|
|
20658
|
+
await openWorktreeResponseTab(response, { branchName, action: "create" });
|
|
20659
|
+
if (await confirmSwitchToCreatedFooterGitWorktree(payload, branchName)) {
|
|
20660
|
+
await openFooterGitWorktree(worktreePath, { branchName, tabContext, skipConfirm: true, announce: false });
|
|
20661
|
+
}
|
|
20662
|
+
} else {
|
|
20663
|
+
await openFooterGitWorktree(worktreePath, { branchName, tabContext, skipConfirm: true });
|
|
20664
|
+
}
|
|
20306
20665
|
} catch (error) {
|
|
20307
20666
|
if (isCurrentTabContext(tabContext)) {
|
|
20308
20667
|
footerBranchPickerState = { ...footerBranchPickerState, loading: false, switching: "", switchingKey: "", error: error.message || String(error) };
|
|
@@ -20313,7 +20672,7 @@ async function createFooterGitBranchWorktree(branch = footerBranchCreateName(),
|
|
|
20313
20672
|
}
|
|
20314
20673
|
}
|
|
20315
20674
|
|
|
20316
|
-
async function openFooterGitWorktree(path, { branchName = "", tabContext = activeTabContext(), skipConfirm = false, switchingKey = "" } = {}) {
|
|
20675
|
+
async function openFooterGitWorktree(path, { branchName = "", tabContext = activeTabContext(), skipConfirm = false, switchingKey = "", announce = true } = {}) {
|
|
20317
20676
|
const worktreePath = cleanFooterPayloadText(path, "", 4000);
|
|
20318
20677
|
if (!worktreePath) return;
|
|
20319
20678
|
if (!skipConfirm && !(await confirmFooterGitWorktreeAction(branchName, { path: worktreePath, requireConfirm: false }))) return;
|
|
@@ -20322,7 +20681,7 @@ async function openFooterGitWorktree(path, { branchName = "", tabContext = activ
|
|
|
20322
20681
|
footerBranchPickerState = { ...footerBranchPickerState, loading: true, error: "", switching: branchName || worktreePath, switchingKey, tabId };
|
|
20323
20682
|
renderFooter();
|
|
20324
20683
|
const response = await api("/api/git-worktrees/open", { method: "POST", body: { path: worktreePath, sessionMode: "fork-current", openTab: true }, tabId });
|
|
20325
|
-
await openWorktreeResponseTab(response, { branchName, action: "open" });
|
|
20684
|
+
await openWorktreeResponseTab(response, { branchName, action: "open", announce });
|
|
20326
20685
|
} catch (error) {
|
|
20327
20686
|
if (isCurrentTabContext(tabContext)) {
|
|
20328
20687
|
footerBranchPickerState = { ...footerBranchPickerState, loading: false, switching: "", switchingKey: "", error: error.message || String(error) };
|
|
@@ -22847,6 +23206,8 @@ function deactivateSubagentTerminalView({ render = true, focusParent = false } =
|
|
|
22847
23206
|
async function activateSubagentTerminalView(viewId) {
|
|
22848
23207
|
const view = subagentTerminalViews.get(viewId);
|
|
22849
23208
|
if (!view) return;
|
|
23209
|
+
clearOpenTerminalTabGroup(null, { force: true });
|
|
23210
|
+
setMobileTabsExpanded(false);
|
|
22850
23211
|
if (activeTabId !== view.parentTabId) await switchTab(view.parentTabId);
|
|
22851
23212
|
closeSubagentOverlay();
|
|
22852
23213
|
activeSubagentTerminalId = view.id;
|
|
@@ -23077,10 +23438,19 @@ function renderSubagentTerminalTabGroup(group) {
|
|
|
23077
23438
|
const groupTitle = group.parentTitle || "workspace";
|
|
23078
23439
|
const wrapper = make("div", `terminal-tab terminal-tab-group terminal-tab-subagent terminal-tab-subagent-group ${stateClass}${active ? " active" : ""}`);
|
|
23079
23440
|
wrapper.dataset.groupKey = group.key;
|
|
23080
|
-
wrapper.addEventListener("pointerenter", () =>
|
|
23081
|
-
|
|
23082
|
-
|
|
23441
|
+
wrapper.addEventListener("pointerenter", (event) => {
|
|
23442
|
+
if (event.pointerType === "touch") return;
|
|
23443
|
+
setOpenTerminalTabGroup(group.key);
|
|
23444
|
+
});
|
|
23445
|
+
wrapper.addEventListener("pointerleave", (event) => {
|
|
23446
|
+
if (event.pointerType === "touch") return;
|
|
23447
|
+
clearOpenTerminalTabGroup(group.key);
|
|
23448
|
+
});
|
|
23449
|
+
wrapper.addEventListener("focusin", () => {
|
|
23450
|
+
if (!isMobileView()) setOpenTerminalTabGroup(group.key);
|
|
23451
|
+
});
|
|
23083
23452
|
wrapper.addEventListener("focusout", () => {
|
|
23453
|
+
if (isMobileView()) return;
|
|
23084
23454
|
setTimeout(() => {
|
|
23085
23455
|
if (!wrapper.contains(document.activeElement)) clearOpenTerminalTabGroup(group.key);
|
|
23086
23456
|
}, 0);
|
|
@@ -23092,7 +23462,7 @@ function renderSubagentTerminalTabGroup(group) {
|
|
|
23092
23462
|
button.setAttribute("aria-selected", active ? "true" : "false");
|
|
23093
23463
|
button.setAttribute("aria-haspopup", "true");
|
|
23094
23464
|
button.setAttribute("aria-expanded", group.key === openTerminalTabGroupKey ? "true" : "false");
|
|
23095
|
-
button.setAttribute("aria-label", `${groupTitle} workspace subagents: ${groupViews.length} views, ${runningCount} running. Active ${subagentTerminalViewTitle(activeView)}`);
|
|
23465
|
+
button.setAttribute("aria-label", `${groupTitle} workspace subagents: ${groupViews.length} views, ${runningCount} running. Active ${subagentTerminalViewTitle(activeView)}. ${isMobileView() ? "Toggle subagent view list" : "Switch to the active subagent view"}`);
|
|
23096
23466
|
applyStyledTooltip(button, `${groupTitle} · ${groupViews.length} subagent views\n${runningCount ? `${runningCount} running` : "All finished"}\nActive: ${subagentTerminalViewTitle(activeView)}`, { ariaLabel: false, description: true, placement: "right", variant: "workspace" });
|
|
23097
23467
|
appendTerminalTabContent(button, {
|
|
23098
23468
|
title: groupTitle,
|
|
@@ -23100,8 +23470,15 @@ function renderSubagentTerminalTabGroup(group) {
|
|
|
23100
23470
|
meta: `${groupViews.length} subagents · ${runningCount ? `${runningCount} running` : "finished"}`,
|
|
23101
23471
|
count: groupViews.length,
|
|
23102
23472
|
subagent: true,
|
|
23473
|
+
dropdown: true,
|
|
23474
|
+
});
|
|
23475
|
+
button.addEventListener("click", () => {
|
|
23476
|
+
if (isMobileView()) {
|
|
23477
|
+
toggleOpenTerminalTabGroup(group.key);
|
|
23478
|
+
return;
|
|
23479
|
+
}
|
|
23480
|
+
activateSubagentTerminalView(activeView.id);
|
|
23103
23481
|
});
|
|
23104
|
-
button.addEventListener("click", () => activateSubagentTerminalView(activeView.id));
|
|
23105
23482
|
wrapper.append(button);
|
|
23106
23483
|
|
|
23107
23484
|
const close = make("button", "terminal-tab-close terminal-tab-group-close", "×");
|
|
@@ -23114,8 +23491,10 @@ function renderSubagentTerminalTabGroup(group) {
|
|
|
23114
23491
|
wrapper.append(close);
|
|
23115
23492
|
|
|
23116
23493
|
const menu = make("div", "terminal-tab-group-menu");
|
|
23494
|
+
menu.id = `terminalTabGroupMenu${++terminalTabGroupMenuSerial}`;
|
|
23117
23495
|
menu.setAttribute("role", "group");
|
|
23118
23496
|
menu.setAttribute("aria-label", `${groupTitle} subagent views`);
|
|
23497
|
+
button.setAttribute("aria-controls", menu.id);
|
|
23119
23498
|
for (const view of groupViews) menu.append(renderSubagentTerminalTab(view, { groupItem: true }));
|
|
23120
23499
|
wrapper.append(menu);
|
|
23121
23500
|
return wrapper;
|
|
@@ -30573,7 +30952,7 @@ async function pushGitWorkflow(tabId = gitWorkflowActionTabId()) {
|
|
|
30573
30952
|
const tabContext = activeTabContext(tabId);
|
|
30574
30953
|
const workflow = gitWorkflowForTab(tabId, { create: false });
|
|
30575
30954
|
if (!workflow) return;
|
|
30576
|
-
if (!(await appConfirmText("Push the committed changes to the
|
|
30955
|
+
if (!(await appConfirmText("Push the committed changes from the current checked-out branch to the same-named remote branch and track it as the upstream?\n\nGuided Git never force-pushes automatically.", { affected: "The same-named remote Git branch and local upstream tracking", confirmLabel: "Push commits" }))) return;
|
|
30577
30956
|
const runId = workflow.runId;
|
|
30578
30957
|
setGitWorkflow({ step: "pushing", busy: true, error: "", output: "Running git push…" }, { tabId });
|
|
30579
30958
|
try {
|
|
@@ -33038,14 +33417,14 @@ function resetChatOutput() {
|
|
|
33038
33417
|
renderedTranscriptState = { epoch: "", entries: [] };
|
|
33039
33418
|
const liveBubbles = standaloneLiveTranscriptBubbles();
|
|
33040
33419
|
const preservedNodes = [...elements.chat.children]
|
|
33041
|
-
.filter((child) => child === elements.stickyUserPromptButton ||
|
|
33420
|
+
.filter((child) => child === elements.stickyUserPromptButton || liveBubbles.has(child));
|
|
33042
33421
|
transcriptRenderer.replaceChildren(elements.chat, ...preservedNodes);
|
|
33043
33422
|
}
|
|
33044
33423
|
|
|
33045
33424
|
function appendChatMessageBubble(bubble, { liveTail = false } = {}) {
|
|
33046
33425
|
const liveBubbles = standaloneLiveTranscriptBubbles();
|
|
33047
33426
|
const tailAnchor = [...elements.chat.children]
|
|
33048
|
-
.find((child) => child !== bubble &&
|
|
33427
|
+
.find((child) => child !== bubble && !liveTail && liveBubbles.has(child));
|
|
33049
33428
|
if (tailAnchor) elements.chat.insertBefore(bubble, tailAnchor);
|
|
33050
33429
|
else elements.chat.append(bubble);
|
|
33051
33430
|
}
|
|
@@ -34289,7 +34668,9 @@ function appendOptimisticUserPrompt(message, attachmentCount = 0) {
|
|
|
34289
34668
|
});
|
|
34290
34669
|
if (transientMessages.length > 80) transientMessages.splice(0, transientMessages.length - 80);
|
|
34291
34670
|
renderAllMessages();
|
|
34292
|
-
|
|
34671
|
+
// Sending a prompt is an explicit request to follow the new turn, even when
|
|
34672
|
+
// the reader had previously paused auto-follow higher in the transcript.
|
|
34673
|
+
scrollChatToBottom({ force: true });
|
|
34293
34674
|
return optimisticPromptId;
|
|
34294
34675
|
}
|
|
34295
34676
|
|
|
@@ -34402,9 +34783,9 @@ function runIndicatorDetail() {
|
|
|
34402
34783
|
return "Waiting for output or action…";
|
|
34403
34784
|
}
|
|
34404
34785
|
|
|
34405
|
-
//
|
|
34786
|
+
// Status-host-owned ticker: it may only repaint the run-indicator bubble's own
|
|
34406
34787
|
// stable text nodes. Canonical state reconciliation belongs to the separate
|
|
34407
|
-
// lifecycle watchdog below, so
|
|
34788
|
+
// lifecycle watchdog below, so status rendering never issues network work.
|
|
34408
34789
|
function startRunIndicatorTicker() {
|
|
34409
34790
|
startLifecycleStateWatchdog();
|
|
34410
34791
|
if (runIndicatorTimer) return;
|
|
@@ -34444,8 +34825,8 @@ function stopLifecycleStateWatchdog() {
|
|
|
34444
34825
|
|
|
34445
34826
|
function createRunIndicatorBubble() {
|
|
34446
34827
|
runIndicatorBubble = make("article", "message runIndicator run-indicator-message streaming");
|
|
34447
|
-
// Stable
|
|
34448
|
-
//
|
|
34828
|
+
// Stable status-host activity root: streaming activity updates rewrite only
|
|
34829
|
+
// this bubble's own text nodes, never transcript, composer, or chrome surfaces.
|
|
34449
34830
|
runIndicatorBubble.dataset.streamOwned = "run-indicator";
|
|
34450
34831
|
runIndicatorBubble.setAttribute("aria-live", "polite");
|
|
34451
34832
|
runIndicatorBubble.setAttribute("aria-label", "Agent is running:");
|
|
@@ -34463,7 +34844,7 @@ function createRunIndicatorBubble() {
|
|
|
34463
34844
|
|
|
34464
34845
|
function ensureRunIndicatorBubble() {
|
|
34465
34846
|
if (!runIndicatorBubble || !runIndicatorText || !runIndicatorMeta) createRunIndicatorBubble();
|
|
34466
|
-
if (
|
|
34847
|
+
if (runIndicatorBubble.parentElement !== elements.runIndicatorHost) elements.runIndicatorHost.replaceChildren(runIndicatorBubble);
|
|
34467
34848
|
}
|
|
34468
34849
|
|
|
34469
34850
|
function updateRunIndicatorBubble() {
|
|
@@ -34487,7 +34868,7 @@ function removeRunIndicatorBubble() {
|
|
|
34487
34868
|
|
|
34488
34869
|
function renderRunIndicator({ scroll = false } = {}) {
|
|
34489
34870
|
if (!runIndicatorIsActive()) {
|
|
34490
|
-
if (runIndicatorRemovalDeferred && runIndicatorBubble?.parentElement === elements.
|
|
34871
|
+
if (runIndicatorRemovalDeferred && runIndicatorBubble?.parentElement === elements.runIndicatorHost) return;
|
|
34491
34872
|
removeRunIndicatorBubble();
|
|
34492
34873
|
return;
|
|
34493
34874
|
}
|
|
@@ -34513,7 +34894,7 @@ function scheduleRunIndicatorRender({ scroll = false } = {}) {
|
|
|
34513
34894
|
function setRunIndicatorActivity(activity, { active = true, scroll = true } = {}) {
|
|
34514
34895
|
const wasLocallyActive = runIndicatorLocallyActive;
|
|
34515
34896
|
const previousActivity = runIndicatorActivity;
|
|
34516
|
-
const hadRunIndicatorBubble = runIndicatorBubble?.parentElement === elements.
|
|
34897
|
+
const hadRunIndicatorBubble = runIndicatorBubble?.parentElement === elements.runIndicatorHost;
|
|
34517
34898
|
if (active) {
|
|
34518
34899
|
runIndicatorLocallyActive = true;
|
|
34519
34900
|
runIndicatorRemovalDeferred = false;
|
|
@@ -34523,7 +34904,7 @@ function setRunIndicatorActivity(activity, { active = true, scroll = true } = {}
|
|
|
34523
34904
|
const needsRender = scroll || !hadRunIndicatorBubble || wasLocallyActive !== runIndicatorLocallyActive || previousActivity !== runIndicatorActivity;
|
|
34524
34905
|
if (needsRender) scheduleRunIndicatorRender({ scroll });
|
|
34525
34906
|
else if (runIndicatorIsActive()) startRunIndicatorTicker();
|
|
34526
|
-
// Activity wording is
|
|
34907
|
+
// Activity wording is status-host-owned. Composer/Stop chrome is reconciled
|
|
34527
34908
|
// only when the lifecycle enum itself changes, so wording updates can never
|
|
34528
34909
|
// reparent Steer/Follow-up controls or rewrite the run-active body class.
|
|
34529
34910
|
syncLifecycleComposerState();
|
|
@@ -34554,7 +34935,7 @@ function clearRunIndicatorActivity({ render = true, deferRemoval = false } = {})
|
|
|
34554
34935
|
runIndicatorLocallyActive = false;
|
|
34555
34936
|
runIndicatorStartedAt = null;
|
|
34556
34937
|
runIndicatorActivity = "Waiting for output or action…";
|
|
34557
|
-
runIndicatorRemovalDeferred = deferRemoval && runIndicatorBubble?.parentElement === elements.
|
|
34938
|
+
runIndicatorRemovalDeferred = deferRemoval && runIndicatorBubble?.parentElement === elements.runIndicatorHost;
|
|
34558
34939
|
if (runIndicatorRemovalDeferred) stopRunIndicatorTicker();
|
|
34559
34940
|
else if (render) renderRunIndicator();
|
|
34560
34941
|
stopLifecycleStateWatchdog();
|
|
@@ -35089,7 +35470,7 @@ function restoreChatTextSelection(snapshot) {
|
|
|
35089
35470
|
function removeChatBubblesAfterPrefix(keptKeys) {
|
|
35090
35471
|
const liveBubbles = standaloneLiveTranscriptBubbles();
|
|
35091
35472
|
for (const child of [...elements.chat.children]) {
|
|
35092
|
-
if (child === elements.stickyUserPromptButton ||
|
|
35473
|
+
if (child === elements.stickyUserPromptButton || liveBubbles.has(child)) continue;
|
|
35093
35474
|
const key = child.dataset?.itemKey || child.dataset?.transcriptMessageKey;
|
|
35094
35475
|
if (key && keptKeys.has(key)) continue;
|
|
35095
35476
|
child.remove();
|
|
@@ -35129,7 +35510,7 @@ function renderAllMessages({ preserveScroll = false, forceRebuild = false } = {}
|
|
|
35129
35510
|
const affectedSurfaces = prefixLength === 0 && adoptedKeys.size === 0
|
|
35130
35511
|
? [elements.chat]
|
|
35131
35512
|
: [...elements.chat.children].filter((child) => {
|
|
35132
|
-
if (child === elements.stickyUserPromptButton ||
|
|
35513
|
+
if (child === elements.stickyUserPromptButton || liveBubbles.has(child)) return false;
|
|
35133
35514
|
const key = child.dataset?.itemKey || child.dataset?.transcriptMessageKey;
|
|
35134
35515
|
return !prefixKeys.has(key) && !adoptedKeys.has(key);
|
|
35135
35516
|
});
|
|
@@ -40822,7 +41203,7 @@ function renderNetworkStatus() {
|
|
|
40822
41203
|
if (elements.showRemoteQrButton) {
|
|
40823
41204
|
elements.showRemoteQrButton.hidden = !open;
|
|
40824
41205
|
elements.showRemoteQrButton.disabled = rebinding || !open;
|
|
40825
|
-
elements.showRemoteQrButton.textContent = "
|
|
41206
|
+
elements.showRemoteQrButton.textContent = "Open QR-Code";
|
|
40826
41207
|
}
|
|
40827
41208
|
}
|
|
40828
41209
|
|
|
@@ -41950,11 +42331,8 @@ async function executeCommandPaletteItem(item = commandPaletteItems[commandPalet
|
|
|
41950
42331
|
}
|
|
41951
42332
|
}
|
|
41952
42333
|
|
|
41953
|
-
|
|
41954
|
-
|
|
41955
|
-
const results = await Promise.allSettled([
|
|
41956
|
-
refreshState(tabContext),
|
|
41957
|
-
refreshMessages(tabContext),
|
|
42334
|
+
function supplementalRefreshRequests(tabContext) {
|
|
42335
|
+
return [
|
|
41958
42336
|
refreshModels(tabContext),
|
|
41959
42337
|
refreshCommands(tabContext),
|
|
41960
42338
|
refreshNaturalConversationMode(tabContext),
|
|
@@ -41966,14 +42344,47 @@ async function refreshAll(tabContext = activeTabContext()) {
|
|
|
41966
42344
|
refreshNativeSettings(tabContext),
|
|
41967
42345
|
refreshNetworkStatus(),
|
|
41968
42346
|
refreshWebuiVersion(),
|
|
41969
|
-
]
|
|
41970
|
-
|
|
42347
|
+
];
|
|
42348
|
+
}
|
|
42349
|
+
|
|
42350
|
+
function reportRefreshFailures(results, prefix = "") {
|
|
41971
42351
|
for (const result of results) {
|
|
41972
|
-
if (result.status
|
|
42352
|
+
if (result.status !== "rejected") continue;
|
|
42353
|
+
addEvent(`${prefix}${result.reason?.message || String(result.reason)}`, "error");
|
|
41973
42354
|
}
|
|
42355
|
+
}
|
|
42356
|
+
|
|
42357
|
+
async function refreshAll(tabContext = activeTabContext()) {
|
|
42358
|
+
if (!tabContext.tabId) return;
|
|
42359
|
+
const results = await Promise.allSettled([
|
|
42360
|
+
refreshState(tabContext),
|
|
42361
|
+
refreshMessages(tabContext),
|
|
42362
|
+
...supplementalRefreshRequests(tabContext),
|
|
42363
|
+
]);
|
|
42364
|
+
if (!isCurrentTabContext(tabContext)) return;
|
|
42365
|
+
reportRefreshFailures(results);
|
|
41974
42366
|
resumeGitWorkflowForActiveTab(tabContext);
|
|
41975
42367
|
}
|
|
41976
42368
|
|
|
42369
|
+
function scheduleForegroundSupplementalRefresh(tabContext) {
|
|
42370
|
+
foregroundSupplementalRefreshCancel?.();
|
|
42371
|
+
const run = async () => {
|
|
42372
|
+
foregroundSupplementalRefreshCancel = null;
|
|
42373
|
+
if (document.visibilityState === "hidden" || !isCurrentTabContext(tabContext)) return;
|
|
42374
|
+
const results = await Promise.allSettled(supplementalRefreshRequests(tabContext));
|
|
42375
|
+
if (!isCurrentTabContext(tabContext)) return;
|
|
42376
|
+
reportRefreshFailures(results, "foreground refresh failed: ");
|
|
42377
|
+
resumeGitWorkflowForActiveTab(tabContext);
|
|
42378
|
+
};
|
|
42379
|
+
if (typeof globalThis.requestIdleCallback === "function") {
|
|
42380
|
+
const handle = globalThis.requestIdleCallback(run, { timeout: 1_200 });
|
|
42381
|
+
foregroundSupplementalRefreshCancel = () => globalThis.cancelIdleCallback?.(handle);
|
|
42382
|
+
} else {
|
|
42383
|
+
const handle = setTimeout(run, 250);
|
|
42384
|
+
foregroundSupplementalRefreshCancel = () => clearTimeout(handle);
|
|
42385
|
+
}
|
|
42386
|
+
}
|
|
42387
|
+
|
|
41977
42388
|
function ensureActiveEventStream(tabContext = activeTabContext()) {
|
|
41978
42389
|
if (!tabContext.tabId || !isCurrentTabContext(tabContext)) return;
|
|
41979
42390
|
if (!eventSource || eventSource.readyState === EventSource.CLOSED) connectEvents(tabContext);
|
|
@@ -41983,16 +42394,35 @@ async function reconcileForegroundState(reason = "resume") {
|
|
|
41983
42394
|
if (document.visibilityState === "hidden") return;
|
|
41984
42395
|
|
|
41985
42396
|
const wasAway = mobileConnectionState === "away";
|
|
42397
|
+
const transcriptCatchUpRequired = foregroundTranscriptCatchUpRequired;
|
|
41986
42398
|
mobileConnectionState = navigator.onLine === false ? "offline" : "reconnecting";
|
|
41987
42399
|
mobileConnectionLabel = mobileConnectionState === "offline" ? "Paused/offline" : "Reconnecting";
|
|
41988
42400
|
recordMobileDiagnostic("foreground reconcile", reason);
|
|
41989
42401
|
renderMobilePhoneExperience();
|
|
41990
42402
|
const tabResult = await Promise.allSettled([refreshTabs()]);
|
|
41991
42403
|
const tabContext = activeTabContext();
|
|
41992
|
-
ensureActiveEventStream(tabContext);
|
|
41993
42404
|
|
|
41994
42405
|
const results = [...tabResult];
|
|
41995
|
-
if (tabContext.tabId
|
|
42406
|
+
if (tabContext.tabId && transcriptCatchUpRequired) {
|
|
42407
|
+
const criticalResults = await Promise.allSettled([
|
|
42408
|
+
refreshState(tabContext),
|
|
42409
|
+
refreshMessages(tabContext, { authoritative: true }),
|
|
42410
|
+
]);
|
|
42411
|
+
results.push(...criticalResults);
|
|
42412
|
+
if (isCurrentTabContext(tabContext)) {
|
|
42413
|
+
if (foregroundTranscriptSuppressedEvents > 0) {
|
|
42414
|
+
recordMobileDiagnostic("foreground output coalesced", `${foregroundTranscriptSuppressedEvents} raw transcript updates replaced by one authoritative snapshot`);
|
|
42415
|
+
}
|
|
42416
|
+
backgroundReconnectSnapshotFresh = ![...tabResult, ...criticalResults].some((result) => result.status === "rejected");
|
|
42417
|
+
foregroundTranscriptCatchUpRequired = false;
|
|
42418
|
+
foregroundTranscriptSuppressedEvents = 0;
|
|
42419
|
+
ensureActiveEventStream(tabContext);
|
|
42420
|
+
scheduleForegroundSupplementalRefresh(tabContext);
|
|
42421
|
+
}
|
|
42422
|
+
} else if (tabContext.tabId) {
|
|
42423
|
+
ensureActiveEventStream(tabContext);
|
|
42424
|
+
results.push(...(await Promise.allSettled([refreshAll(tabContext)])));
|
|
42425
|
+
}
|
|
41996
42426
|
if (!isCurrentTabContext(tabContext)) return;
|
|
41997
42427
|
|
|
41998
42428
|
const failed = results.some((result) => result.status === "rejected");
|
|
@@ -43228,7 +43658,25 @@ const TRANSCRIPT_STREAM_BARRIER_EVENT_TYPES = new Set([
|
|
|
43228
43658
|
"pi_process_error",
|
|
43229
43659
|
]);
|
|
43230
43660
|
|
|
43661
|
+
function beginForegroundTranscriptCatchUp() {
|
|
43662
|
+
foregroundTranscriptCatchUpRequired = true;
|
|
43663
|
+
backgroundReconnectSnapshotFresh = false;
|
|
43664
|
+
streamOutputController.cancel();
|
|
43665
|
+
if (!eventSource) return;
|
|
43666
|
+
eventStreamPausedForBackground = true;
|
|
43667
|
+
const source = eventSource;
|
|
43668
|
+
eventSource = null;
|
|
43669
|
+
source.close();
|
|
43670
|
+
}
|
|
43671
|
+
|
|
43231
43672
|
function dispatchTranscriptStreamEvent(event) {
|
|
43673
|
+
const classification = classifyTranscriptStreamEvent(event);
|
|
43674
|
+
if (classification && (document.visibilityState === "hidden" || foregroundTranscriptCatchUpRequired)) {
|
|
43675
|
+
foregroundTranscriptCatchUpRequired = true;
|
|
43676
|
+
foregroundTranscriptSuppressedEvents += 1;
|
|
43677
|
+
streamOutputController.cancel();
|
|
43678
|
+
return true;
|
|
43679
|
+
}
|
|
43232
43680
|
return streamOutputController.dispatch(event, {
|
|
43233
43681
|
owner: transcriptStreamOwner(event?.tabId || activeTabId),
|
|
43234
43682
|
});
|
|
@@ -43279,6 +43727,10 @@ function handleEvent(event) {
|
|
|
43279
43727
|
switch (event.type) {
|
|
43280
43728
|
case "webui_connected": {
|
|
43281
43729
|
const connectedTabId = event.tabId || activeTabId;
|
|
43730
|
+
const resumedWithFreshSnapshot = eventStreamPausedForBackground && backgroundReconnectSnapshotFresh;
|
|
43731
|
+
eventStreamPausedForBackground = false;
|
|
43732
|
+
backgroundReconnectSnapshotFresh = false;
|
|
43733
|
+
if (resumedWithFreshSnapshot) foregroundReconnectSnapshotFreshUntil = performance.now() + 2_000;
|
|
43282
43734
|
clearFeatureDecisionStateForTab(connectedTabId, { render: true });
|
|
43283
43735
|
acceptOutputModeAcknowledgement(event);
|
|
43284
43736
|
setWebuiVersion(event.version);
|
|
@@ -43290,16 +43742,16 @@ function handleEvent(event) {
|
|
|
43290
43742
|
renderWidgets();
|
|
43291
43743
|
}
|
|
43292
43744
|
addEvent(`connected to ${event.tabTitle || "terminal"} for ${event.cwd}`);
|
|
43293
|
-
if (event.supervisorReplayGap === true) scheduleSupervisorContinuityRefresh(event, { gap: true });
|
|
43294
|
-
scheduleForegroundReconcile("event stream reconnect", 0);
|
|
43745
|
+
if (event.supervisorReplayGap === true && !resumedWithFreshSnapshot) scheduleSupervisorContinuityRefresh(event, { gap: true });
|
|
43746
|
+
if (!resumedWithFreshSnapshot) scheduleForegroundReconcile("event stream reconnect", 0);
|
|
43295
43747
|
break;
|
|
43296
43748
|
}
|
|
43297
43749
|
case "webui_supervisor_reconnected":
|
|
43298
43750
|
addEvent("reconnected to the running Pi session");
|
|
43299
|
-
scheduleSupervisorContinuityRefresh(event);
|
|
43751
|
+
if (performance.now() > foregroundReconnectSnapshotFreshUntil) scheduleSupervisorContinuityRefresh(event);
|
|
43300
43752
|
break;
|
|
43301
43753
|
case "webui_supervisor_replay_gap":
|
|
43302
|
-
scheduleSupervisorContinuityRefresh(event, { gap: true });
|
|
43754
|
+
if (performance.now() > foregroundReconnectSnapshotFreshUntil) scheduleSupervisorContinuityRefresh(event, { gap: true });
|
|
43303
43755
|
break;
|
|
43304
43756
|
case "webui_output_mode":
|
|
43305
43757
|
applyOutputModeControl(event, tabContext);
|
|
@@ -43645,7 +44097,7 @@ function connectEvents(tabContext = activeTabContext(), { requestedMode = "auto"
|
|
|
43645
44097
|
eventSource = source;
|
|
43646
44098
|
source.onopen = () => {
|
|
43647
44099
|
if (eventSource !== source || !isCurrentTabContext(tabContext)) return;
|
|
43648
|
-
refreshOptionalFeaturePackageStatuses().catch(() => {});
|
|
44100
|
+
if (!eventStreamPausedForBackground) refreshOptionalFeaturePackageStatuses().catch(() => {});
|
|
43649
44101
|
};
|
|
43650
44102
|
source.onmessage = (message) => {
|
|
43651
44103
|
if (eventSource !== source || !isCurrentTabContext(tabContext)) return;
|
|
@@ -43737,7 +44189,7 @@ elements.followUpQueueTrigger?.addEventListener("click", () => {
|
|
|
43737
44189
|
});
|
|
43738
44190
|
elements.followUpQueueCloseButton?.addEventListener("click", () => setFollowUpQueueOpen(false, { restoreFocus: true }));
|
|
43739
44191
|
elements.composerActionsButton.addEventListener("click", () => {
|
|
43740
|
-
setComposerActionsOpen(!document.body.classList.contains("composer-actions-open"));
|
|
44192
|
+
setComposerActionsOpen(!document.body.classList.contains("composer-actions-open"), { restoreFocus: true });
|
|
43741
44193
|
});
|
|
43742
44194
|
elements.busyPromptBehaviorTag?.addEventListener("click", (event) => {
|
|
43743
44195
|
event.preventDefault();
|
|
@@ -43746,7 +44198,7 @@ elements.busyPromptBehaviorTag?.addEventListener("click", (event) => {
|
|
|
43746
44198
|
setNativeCommandMenuOpen(false);
|
|
43747
44199
|
setAppRunnerMenuOpen(false);
|
|
43748
44200
|
setOptionsMenuOpen(false);
|
|
43749
|
-
setComposerActionsOpen(false);
|
|
44201
|
+
if (!document.body.classList.contains("mobile-composer-disclosure")) setComposerActionsOpen(false);
|
|
43750
44202
|
setBusyPromptBehaviorMenuOpen(nextOpen);
|
|
43751
44203
|
});
|
|
43752
44204
|
elements.busyPromptBehaviorTag?.addEventListener("keydown", (event) => {
|
|
@@ -43793,7 +44245,7 @@ elements.steerButton.addEventListener("click", () => sendPromptFromModeButton("s
|
|
|
43793
44245
|
elements.followUpButton.addEventListener("click", () => sendPromptFromModeButton("follow-up", elements.followUpButton));
|
|
43794
44246
|
elements.btwButton?.addEventListener("click", () => sendBtwPromptFromButton());
|
|
43795
44247
|
elements.terminalTabsToggleButton.addEventListener("click", () => {
|
|
43796
|
-
setMobileTabsExpanded(!document.body.classList.contains("mobile-tabs-expanded"));
|
|
44248
|
+
setMobileTabsExpanded(!document.body.classList.contains("mobile-tabs-expanded"), { restoreFocus: true });
|
|
43797
44249
|
});
|
|
43798
44250
|
elements.newTabButton.addEventListener("click", (event) => {
|
|
43799
44251
|
event.stopPropagation();
|
|
@@ -44721,6 +45173,10 @@ elements.webuiPackageNpmButton?.addEventListener("click", () => {
|
|
|
44721
45173
|
});
|
|
44722
45174
|
elements.webuiPackageCloseButton?.addEventListener("click", () => elements.webuiPackageDialog?.close());
|
|
44723
45175
|
elements.piReleaseNotesCloseButton?.addEventListener("click", () => elements.piReleaseNotesDialog?.close());
|
|
45176
|
+
elements.sidePanelEditButton?.addEventListener("click", () => {
|
|
45177
|
+
if (!isMobileView()) return;
|
|
45178
|
+
setSidePanelSectionEditMode(!sidePanelSectionEditMode);
|
|
45179
|
+
});
|
|
44724
45180
|
elements.toggleSidePanelButton.addEventListener("click", () => {
|
|
44725
45181
|
setSidePanelCollapsed(true);
|
|
44726
45182
|
});
|
|
@@ -44781,9 +45237,9 @@ document.addEventListener("pointerdown", (event) => {
|
|
|
44781
45237
|
if (busyPromptBehaviorMenuOpen && !event.target?.closest?.(".composer-context-tags, .composer-busy-mode-menu")) {
|
|
44782
45238
|
setBusyPromptBehaviorMenuOpen(false);
|
|
44783
45239
|
}
|
|
44784
|
-
if (document.body.classList.contains("mobile-tabs-expanded") && !elements.
|
|
45240
|
+
if (document.body.classList.contains("mobile-tabs-expanded") && !elements.terminalTabsDrawerContent?.contains(event.target) && !elements.terminalTabsToggleButton.contains(event.target)) {
|
|
44785
45241
|
setNewTabMenuOpen(false);
|
|
44786
|
-
setMobileTabsExpanded(false);
|
|
45242
|
+
setMobileTabsExpanded(false, { restoreFocus: true });
|
|
44787
45243
|
}
|
|
44788
45244
|
if (isFooterPickerOpen() && !elements.statusBar.contains(event.target)) {
|
|
44789
45245
|
setFooterModelPickerOpen(false);
|
|
@@ -44873,27 +45329,60 @@ function handleNativeAppShortcut(event) {
|
|
|
44873
45329
|
}
|
|
44874
45330
|
}
|
|
44875
45331
|
|
|
44876
|
-
// --- Transcript search (Ctrl/Cmd+F) ---
|
|
45332
|
+
// --- Transcript and live agent-output search (Ctrl/Cmd+F) ---
|
|
45333
|
+
const CHAT_SEARCH_MATCH_LIMIT = 10_000;
|
|
44877
45334
|
let chatSearchMatches = [];
|
|
44878
45335
|
let chatSearchIndex = -1;
|
|
44879
45336
|
let chatSearchTimer = null;
|
|
45337
|
+
let chatSearchRefreshTimer = null;
|
|
44880
45338
|
|
|
44881
45339
|
function chatSearchQueryText() {
|
|
44882
45340
|
return (elements.chatSearchInput?.value || "").trim().toLowerCase();
|
|
44883
45341
|
}
|
|
44884
45342
|
|
|
45343
|
+
function chatSearchRoot() {
|
|
45344
|
+
return elements.subagentTerminalView?.hidden === false ? elements.subagentTerminalTranscript : elements.chat;
|
|
45345
|
+
}
|
|
45346
|
+
|
|
44885
45347
|
function collectChatSearchMatches(query) {
|
|
44886
45348
|
if (!query) return [];
|
|
44887
45349
|
const matches = [];
|
|
44888
|
-
for (const bubble of
|
|
45350
|
+
for (const bubble of chatSearchRoot()?.querySelectorAll(".message") || []) {
|
|
44889
45351
|
if (bubble === runIndicatorBubble || bubble.classList.contains("runIndicator")) continue;
|
|
44890
|
-
|
|
45352
|
+
const text = (bubble.textContent || "").toLowerCase();
|
|
45353
|
+
let offset = 0;
|
|
45354
|
+
while (matches.length < CHAT_SEARCH_MATCH_LIMIT) {
|
|
45355
|
+
const start = text.indexOf(query, offset);
|
|
45356
|
+
if (start < 0) break;
|
|
45357
|
+
matches.push({ bubble, start, end: start + query.length });
|
|
45358
|
+
offset = start + query.length;
|
|
45359
|
+
}
|
|
45360
|
+
if (matches.length >= CHAT_SEARCH_MATCH_LIMIT) break;
|
|
44891
45361
|
}
|
|
44892
45362
|
return matches;
|
|
44893
45363
|
}
|
|
44894
45364
|
|
|
44895
45365
|
function clearChatSearchHighlights() {
|
|
44896
|
-
|
|
45366
|
+
globalThis.CSS?.highlights?.delete("chat-search-match");
|
|
45367
|
+
globalThis.CSS?.highlights?.delete("chat-search-current");
|
|
45368
|
+
for (const root of [elements.chat, elements.subagentTerminalTranscript]) {
|
|
45369
|
+
for (const bubble of root?.querySelectorAll(".message.search-match, .message.search-current") || []) bubble.classList.remove("search-match", "search-current");
|
|
45370
|
+
}
|
|
45371
|
+
}
|
|
45372
|
+
|
|
45373
|
+
function renderChatSearchHighlights() {
|
|
45374
|
+
clearChatSearchHighlights();
|
|
45375
|
+
const ranges = chatSearchMatches.map((match) => textOffsetRange(match.bubble, match)).filter(Boolean);
|
|
45376
|
+
const current = chatSearchMatches[chatSearchIndex];
|
|
45377
|
+
const currentRange = current ? textOffsetRange(current.bubble, current) : null;
|
|
45378
|
+
const HighlightConstructor = globalThis.Highlight;
|
|
45379
|
+
if (globalThis.CSS?.highlights && typeof HighlightConstructor === "function") {
|
|
45380
|
+
if (ranges.length) globalThis.CSS.highlights.set("chat-search-match", new HighlightConstructor(...ranges));
|
|
45381
|
+
if (currentRange) globalThis.CSS.highlights.set("chat-search-current", new HighlightConstructor(currentRange));
|
|
45382
|
+
return;
|
|
45383
|
+
}
|
|
45384
|
+
for (const match of chatSearchMatches) match.bubble.classList.add("search-match");
|
|
45385
|
+
current?.bubble.classList.add("search-current");
|
|
44897
45386
|
}
|
|
44898
45387
|
|
|
44899
45388
|
function updateChatSearchCount() {
|
|
@@ -44903,36 +45392,39 @@ function updateChatSearchCount() {
|
|
|
44903
45392
|
}
|
|
44904
45393
|
|
|
44905
45394
|
function focusChatSearchMatch() {
|
|
44906
|
-
const
|
|
45395
|
+
const match = chatSearchMatches[chatSearchIndex];
|
|
45396
|
+
const bubble = match?.bubble;
|
|
44907
45397
|
if (!bubble) return;
|
|
44908
45398
|
if (!bubble.isConnected) {
|
|
44909
45399
|
runChatSearch({ navigate: false });
|
|
44910
45400
|
return;
|
|
44911
45401
|
}
|
|
44912
|
-
clearChatSearchHighlights();
|
|
44913
|
-
bubble.classList.add("search-current");
|
|
44914
45402
|
const query = chatSearchQueryText();
|
|
44915
45403
|
for (const details of bubble.querySelectorAll("details")) {
|
|
44916
45404
|
if (!details.open && (details.textContent || "").toLowerCase().includes(query)) details.open = true;
|
|
44917
45405
|
}
|
|
44918
|
-
|
|
44919
|
-
|
|
45406
|
+
renderChatSearchHighlights();
|
|
45407
|
+
if (chatSearchRoot() === elements.chat) {
|
|
45408
|
+
autoFollowChat = false;
|
|
45409
|
+
lastChatProgrammaticScrollAt = performance.now();
|
|
45410
|
+
updateJumpToLatestButton();
|
|
45411
|
+
}
|
|
44920
45412
|
bubble.scrollIntoView({ block: "center", behavior: "instant" });
|
|
44921
|
-
updateJumpToLatestButton();
|
|
44922
45413
|
updateChatSearchCount();
|
|
44923
45414
|
}
|
|
44924
45415
|
|
|
44925
45416
|
function runChatSearch({ navigate = false } = {}) {
|
|
44926
45417
|
const query = chatSearchQueryText();
|
|
44927
|
-
clearChatSearchHighlights();
|
|
44928
45418
|
chatSearchMatches = collectChatSearchMatches(query);
|
|
44929
|
-
if (
|
|
45419
|
+
if (!chatSearchMatches.length) chatSearchIndex = -1;
|
|
45420
|
+
else if (chatSearchIndex >= chatSearchMatches.length || chatSearchIndex < 0) chatSearchIndex = chatSearchMatches.length - 1;
|
|
44930
45421
|
updateChatSearchCount();
|
|
44931
45422
|
if (navigate) focusChatSearchMatch();
|
|
45423
|
+
else renderChatSearchHighlights();
|
|
44932
45424
|
}
|
|
44933
45425
|
|
|
44934
45426
|
function stepChatSearch(step) {
|
|
44935
|
-
if (chatSearchMatches.some((
|
|
45427
|
+
if (chatSearchMatches.some((match) => !match.bubble.isConnected)) runChatSearch();
|
|
44936
45428
|
if (!chatSearchMatches.length) {
|
|
44937
45429
|
runChatSearch();
|
|
44938
45430
|
if (!chatSearchMatches.length) return;
|
|
@@ -44944,6 +45436,10 @@ function stepChatSearch(step) {
|
|
|
44944
45436
|
function openChatSearch() {
|
|
44945
45437
|
if (!elements.chatSearchBar) return;
|
|
44946
45438
|
closeFileViewerSearch({ restoreFocus: false });
|
|
45439
|
+
const searchesAgentOutput = chatSearchRoot() === elements.subagentTerminalTranscript;
|
|
45440
|
+
elements.chatSearchInput.placeholder = searchesAgentOutput ? "Search agent output…" : "Search transcript…";
|
|
45441
|
+
elements.chatSearchInput.setAttribute("aria-label", searchesAgentOutput ? "Search agent output" : "Search transcript");
|
|
45442
|
+
if (chatSearchRoot()?.id) elements.chatSearchInput.setAttribute("aria-controls", chatSearchRoot().id);
|
|
44947
45443
|
elements.chatSearchBar.hidden = false;
|
|
44948
45444
|
elements.chatSearchInput?.focus();
|
|
44949
45445
|
elements.chatSearchInput?.select();
|
|
@@ -44959,6 +45455,15 @@ function closeChatSearch() {
|
|
|
44959
45455
|
updateChatSearchCount();
|
|
44960
45456
|
}
|
|
44961
45457
|
|
|
45458
|
+
const chatSearchObserver = typeof MutationObserver === "function" ? new MutationObserver(() => {
|
|
45459
|
+
if (elements.chatSearchBar?.hidden || !chatSearchQueryText()) return;
|
|
45460
|
+
clearTimeout(chatSearchRefreshTimer);
|
|
45461
|
+
chatSearchRefreshTimer = setTimeout(() => runChatSearch({ navigate: false }), 50);
|
|
45462
|
+
}) : null;
|
|
45463
|
+
for (const root of [elements.chat, elements.subagentTerminalTranscript]) {
|
|
45464
|
+
if (root && chatSearchObserver) chatSearchObserver.observe(root, { childList: true, subtree: true, characterData: true });
|
|
45465
|
+
}
|
|
45466
|
+
|
|
44962
45467
|
elements.chatSearchInput?.addEventListener("input", () => {
|
|
44963
45468
|
clearTimeout(chatSearchTimer);
|
|
44964
45469
|
chatSearchTimer = setTimeout(() => {
|
|
@@ -44993,6 +45498,7 @@ document.addEventListener("visibilitychange", () => {
|
|
|
44993
45498
|
scheduleForegroundReconcile("visibility resume", 0);
|
|
44994
45499
|
refreshSubagents().finally(() => scheduleRefreshSubagents());
|
|
44995
45500
|
} else {
|
|
45501
|
+
beginForegroundTranscriptCatchUp();
|
|
44996
45502
|
mobileConnectionState = "away";
|
|
44997
45503
|
mobileConnectionLabel = "Backgrounded · run state unverified";
|
|
44998
45504
|
persistMobileContinuityState();
|
|
@@ -45090,12 +45596,12 @@ window.addEventListener("keydown", (event) => {
|
|
|
45090
45596
|
return;
|
|
45091
45597
|
}
|
|
45092
45598
|
if (document.body.classList.contains("composer-actions-open")) {
|
|
45093
|
-
setComposerActionsOpen(false);
|
|
45599
|
+
setComposerActionsOpen(false, { restoreFocus: true });
|
|
45094
45600
|
return;
|
|
45095
45601
|
}
|
|
45096
45602
|
if (document.body.classList.contains("mobile-tabs-expanded")) {
|
|
45097
45603
|
setNewTabMenuOpen(false);
|
|
45098
|
-
setMobileTabsExpanded(false);
|
|
45604
|
+
setMobileTabsExpanded(false, { restoreFocus: true });
|
|
45099
45605
|
return;
|
|
45100
45606
|
}
|
|
45101
45607
|
if (isFooterPickerOpen()) {
|
|
@@ -45314,6 +45820,7 @@ elements.fileViewerSearchInput?.addEventListener("keydown", (event) => {
|
|
|
45314
45820
|
elements.fileViewerSearchPrevButton?.addEventListener("click", () => stepFileViewerSearch(-1));
|
|
45315
45821
|
elements.fileViewerSearchNextButton?.addEventListener("click", () => stepFileViewerSearch(1));
|
|
45316
45822
|
elements.fileViewerSearchCloseButton?.addEventListener("click", () => closeFileViewerSearch());
|
|
45823
|
+
elements.fileViewerEditor?.addEventListener("scroll", syncFileViewerSearchOverlayScroll);
|
|
45317
45824
|
elements.fileViewerEditor?.addEventListener("input", () => {
|
|
45318
45825
|
if (!activeFileViewer) return;
|
|
45319
45826
|
activeFileViewer.content = elements.fileViewerEditor.value || "";
|
|
@@ -45481,6 +45988,7 @@ restoreFileViewerWidthPreference();
|
|
|
45481
45988
|
focusPromptInput({ defer: true });
|
|
45482
45989
|
restoreStoredSkillUsage();
|
|
45483
45990
|
restoreBusyPromptBehaviorSetting();
|
|
45991
|
+
syncMobileComposerDisclosureLayout();
|
|
45484
45992
|
updateComposerModeButtons();
|
|
45485
45993
|
installSessionSkillTagResizeHandling();
|
|
45486
45994
|
updateOptionalFeatureAvailability();
|
|
@@ -45512,6 +46020,7 @@ initializeComposerActionOrdering();
|
|
|
45512
46020
|
restoreSidePanelSectionOrder();
|
|
45513
46021
|
restoreSidePanelSectionVisibility();
|
|
45514
46022
|
restoreSidePanelSectionState();
|
|
46023
|
+
setSidePanelSectionEditMode(false);
|
|
45515
46024
|
bindSidePanelSectionToggles();
|
|
45516
46025
|
restoreSidePanelState();
|
|
45517
46026
|
initializeCodexUsage();
|