@firstpick/pi-package-webui 0.11.1 → 0.11.2
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/DEVELOPMENT.md +151 -12
- package/README.md +34 -6
- package/TECHNICAL.md +75 -8
- package/bin/pi-webui.mjs +5390 -11423
- package/index.ts +10 -3
- package/lib/component-update-state.mjs +2 -2
- package/lib/git-workflow-preference-values.mjs +122 -0
- package/lib/git-workflow-preferences.mjs +35 -563
- package/lib/package-updates.mjs +260 -0
- package/lib/rpc-supervisor-client.mjs +8 -4
- package/lib/server/app-runners.mjs +1667 -0
- package/lib/server/codex-fast-mode.mjs +161 -0
- package/lib/server/conversation-mode.mjs +218 -0
- package/lib/server/conversation-voice.mjs +318 -0
- package/lib/server/extension-ui-requests.mjs +114 -0
- package/lib/server/git-generation.mjs +459 -0
- package/lib/server/git-mutations.mjs +1827 -0
- package/lib/server/git-reads.mjs +608 -0
- package/lib/server/git-worktree-sessions.mjs +408 -0
- package/lib/server/helper-requests.mjs +82 -0
- package/lib/server/no-project-workspaces.mjs +103 -0
- package/lib/server/rpc-transports.mjs +394 -0
- package/lib/server/settings-store.mjs +544 -0
- package/lib/server/sse-delivery.mjs +138 -0
- package/lib/server/workspace-files.mjs +563 -0
- package/lib/update/supervisor.mjs +4 -0
- package/lib/webui-workspaces.mjs +2 -0
- package/package.json +4 -4
- package/public/activity-agents-controller.mjs +269 -0
- package/public/activity-events-controller.mjs +236 -0
- package/public/activity-intercom-controller.mjs +627 -0
- package/public/activity-queue-controller.mjs +534 -0
- package/public/activity-todo-view.mjs +89 -0
- package/public/activity-usage-controller.mjs +589 -0
- package/public/app.js +3761 -3886
- package/public/conversation-overview.css +84 -0
- package/public/conversation-overview.mjs +193 -0
- package/public/draft-conversations.mjs +135 -0
- package/public/focused-composer-controls.css +111 -0
- package/public/focused-composer-controls.mjs +143 -0
- package/public/focused-composer-disclosure.mjs +223 -0
- package/public/focused-shell-adapter.css +264 -0
- package/public/focused-shell-adapter.mjs +257 -0
- package/public/index.html +137 -80
- package/public/model-catalog-order.mjs +63 -0
- package/public/platform-event-stream.mjs +64 -0
- package/public/project-artifact-controller.mjs +218 -0
- package/public/project-file-viewer-controller.mjs +383 -0
- package/public/project-git-tools-controller.mjs +181 -0
- package/public/project-runners-controller.mjs +220 -0
- package/public/service-worker.js +52 -1
- package/public/session-attention-scheduler.mjs +182 -0
- package/public/session-composer-store.mjs +56 -0
- package/public/session-context.mjs +51 -0
- package/public/session-extension-requests.mjs +63 -0
- package/public/session-shelf-state.mjs +151 -0
- package/public/session-shelves.css +171 -0
- package/public/session-shelves.mjs +95 -0
- package/public/settings-navigation-controller.mjs +249 -0
- package/public/settings-navigation.css +61 -0
- package/public/settings-resource-controller.mjs +232 -0
- package/public/settings-workspace.css +19 -0
- package/public/settings-workspace.mjs +175 -0
- package/public/shell-actions.mjs +87 -0
- package/public/shell-attention-inbox.css +72 -0
- package/public/shell-attention-inbox.mjs +198 -0
- package/public/shell-context-actions.css +61 -0
- package/public/shell-context-actions.mjs +168 -0
- package/public/shell-inspector-resize.mjs +124 -0
- package/public/shell-navigation-resize.mjs +107 -0
- package/public/shell-navigation.mjs +127 -0
- package/public/shell-preferences.mjs +108 -0
- package/public/shell-surfaces.mjs +99 -0
- package/public/shell-tools-launcher.css +97 -0
- package/public/shell-tools-launcher.mjs +222 -0
- package/public/shell-view-host.mjs +115 -0
- package/public/shell-workspace.css +266 -0
- package/public/shell-workspace.mjs +402 -0
- package/public/sidebar-update-menu.css +190 -0
- package/public/sidebar-update-menu.mjs +512 -0
- package/public/styles.css +320 -169
- package/public/subagent-launch-slot-state.mjs +2 -2
- package/public/themed-selects.css +156 -0
- package/public/workspace-choices.mjs +104 -0
- package/tests/activity-agents-controller.test.mjs +652 -0
- package/tests/activity-events-controller.test.mjs +511 -0
- package/tests/app-runner-terminal-static.test.mjs +3 -3
- package/tests/append-system-http.test.mjs +7 -6
- package/tests/append-system-selector-static.test.mjs +6 -6
- package/tests/aur-review-widget-static.test.mjs +11 -3
- package/tests/boot-failure-diagnostics.test.mjs +8 -3
- package/tests/browser/activity-intercom-controller.spec.mjs +457 -0
- package/tests/browser/activity-navigation-integration.spec.mjs +45 -0
- package/tests/browser/activity-owner-integration.spec.mjs +201 -0
- package/tests/browser/activity-queue-controller.spec.mjs +405 -0
- package/tests/browser/activity-section-picker.spec.mjs +294 -0
- package/tests/browser/activity-todo-view.spec.mjs +60 -0
- package/tests/browser/activity-usage-controller.spec.mjs +416 -0
- package/tests/browser/compact-layout-integration.spec.mjs +58 -0
- package/tests/browser/composer-action-grid-reorder.spec.mjs +16 -0
- package/tests/browser/composer-disclosure.spec.mjs +389 -0
- package/tests/browser/composer-toolbar-polish.spec.mjs +343 -0
- package/tests/browser/control-deck-component-updates.spec.mjs +5 -14
- package/tests/browser/control-deck-side-panels.spec.mjs +27 -12
- package/tests/browser/control-visibility.spec.mjs +5 -0
- package/tests/browser/controls-layout.spec.mjs +21 -2
- package/tests/browser/conversation-overview.spec.mjs +251 -0
- package/tests/browser/draft-conversations.spec.mjs +276 -0
- package/tests/browser/empty-startup-fixture.mjs +135 -0
- package/tests/browser/empty-startup.spec.mjs +282 -0
- package/tests/browser/events-tree-context-menu.spec.mjs +1 -0
- package/tests/browser/focused-composer-more.spec.mjs +127 -0
- package/tests/browser/focused-model-shortcuts.spec.mjs +120 -0
- package/tests/browser/focused-navigation-fixture.mjs +32 -0
- package/tests/browser/focused-project-activity.spec.mjs +111 -0
- package/tests/browser/focused-shell-integration.spec.mjs +208 -0
- package/tests/browser/folder-picker-layout-fixture.mjs +13 -0
- package/tests/browser/folder-picker-layout.spec.mjs +302 -0
- package/tests/browser/footer-model-advanced-layout.spec.mjs +27 -14
- package/tests/browser/git-setup-cancel.spec.mjs +251 -0
- package/tests/browser/guided-git-fallback.spec.mjs +40 -21
- package/tests/browser/inspector-header.spec.mjs +221 -0
- package/tests/browser/inspector-overview-integration.spec.mjs +104 -0
- package/tests/browser/inspector-resize.spec.mjs +227 -0
- package/tests/browser/inspector-topic-overflow.spec.mjs +56 -0
- package/tests/browser/interaction-action-discovery.spec.mjs +332 -0
- package/tests/browser/interaction-attention-inbox.spec.mjs +364 -0
- package/tests/browser/interaction-attention-integration.spec.mjs +53 -0
- package/tests/browser/interaction-composer-controls.spec.mjs +267 -0
- package/tests/browser/interaction-composer-integration.spec.mjs +175 -0
- package/tests/browser/interaction-continuity.spec.mjs +50 -26
- package/tests/browser/interaction-model-picker.spec.mjs +86 -0
- package/tests/browser/last-terminal-close.spec.mjs +280 -0
- package/tests/browser/mobile-foundation.spec.mjs +172 -20
- package/tests/browser/model-catalog-groups.spec.mjs +104 -0
- package/tests/browser/more-row-menus.spec.mjs +258 -0
- package/tests/browser/new-tab-hit-target.spec.mjs +228 -0
- package/tests/browser/no-project-conversation.spec.mjs +113 -0
- package/tests/browser/optimistic-prompt.spec.mjs +3 -0
- package/tests/browser/overhaul-w7-accessibility.spec.mjs +227 -0
- package/tests/browser/overhaul-w7-capabilities.spec.mjs +298 -0
- package/tests/browser/overhaul-w7-companions.spec.mjs +290 -0
- package/tests/browser/overhaul-w7-focus-repairs.spec.mjs +210 -0
- package/tests/browser/overhaul-w7-layout-repairs.spec.mjs +183 -0
- package/tests/browser/overhaul-w7-parent-repairs.spec.mjs +97 -0
- package/tests/browser/overhaul-w7-pwa.spec.mjs +247 -0
- package/tests/browser/overhaul-w7-responsive.spec.mjs +450 -0
- package/tests/browser/overhaul-w7-update.spec.mjs +215 -0
- package/tests/browser/overhaul-w7-zoom.spec.mjs +243 -0
- package/tests/browser/overview-agent-ownership.spec.mjs +45 -0
- package/tests/browser/persistent-ui-layout.spec.mjs +3 -0
- package/tests/browser/project-artifact-controller.spec.mjs +324 -0
- package/tests/browser/project-artifact-integration.spec.mjs +103 -0
- package/tests/browser/project-file-buffer-integration.spec.mjs +230 -0
- package/tests/browser/project-git-tools-integration.spec.mjs +369 -0
- package/tests/browser/session-fixture.mjs +118 -0
- package/tests/browser/session-ownership.spec.mjs +175 -0
- package/tests/browser/session-shelves-integration.spec.mjs +219 -0
- package/tests/browser/session-shelves.spec.mjs +340 -0
- package/tests/browser/session-sidebar-resize.spec.mjs +138 -0
- package/tests/browser/session-summary.spec.mjs +17 -12
- package/tests/browser/settings-complete-home.spec.mjs +463 -0
- package/tests/browser/settings-entrypoint.spec.mjs +104 -0
- package/tests/browser/settings-navigation-controller.spec.mjs +383 -0
- package/tests/browser/settings-navigation-integration.spec.mjs +348 -0
- package/tests/browser/settings-resource-lifetime.spec.mjs +349 -0
- package/tests/browser/settings-workspace-integration.spec.mjs +132 -0
- package/tests/browser/shell-ownership.spec.mjs +398 -0
- package/tests/browser/shell-rollout-fixture.mjs +259 -0
- package/tests/browser/shell-rollout.spec.mjs +357 -0
- package/tests/browser/shell-tools-launcher.spec.mjs +260 -0
- package/tests/browser/shell-workspace.spec.mjs +433 -0
- package/tests/browser/side-panel-section-reorder.spec.mjs +3 -1
- package/tests/browser/sidebar-floating-tooltips.spec.mjs +37 -0
- package/tests/browser/sidebar-update-integration.spec.mjs +277 -0
- package/tests/browser/sidebar-update-menu.spec.mjs +402 -0
- package/tests/browser/sidebar-update-progress.spec.mjs +472 -0
- package/tests/browser/stream-output-isolation.spec.mjs +6 -3
- package/tests/browser/themed-selects.spec.mjs +297 -0
- package/tests/browser/thread-start-flow.spec.mjs +481 -0
- package/tests/browser/ui-polish-activity-controls.spec.mjs +177 -0
- package/tests/browser/ui-polish-features.spec.mjs +85 -0
- package/tests/browser/ui-polish-file-header.spec.mjs +43 -0
- package/tests/browser/ui-polish-local-git.spec.mjs +183 -0
- package/tests/browser/ui-polish-mobile-recovery.spec.mjs +36 -0
- package/tests/browser/ui-polish-navigation.spec.mjs +127 -0
- package/tests/browser/ui-polish-session-actions.spec.mjs +282 -0
- package/tests/browser/user-noticeable-fixes.spec.mjs +10 -3
- package/tests/browser/windows-drive-parent.spec.mjs +4 -2
- package/tests/browser/workspace-draft-selection.spec.mjs +266 -0
- package/tests/codex-fast-mode-static.test.mjs +16 -11
- package/tests/codex-speed-mode-browser-state.test.mjs +6 -3
- package/tests/codex-usage-source.test.mjs +4 -3
- package/tests/component-update-api-static.test.mjs +2 -2
- package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
- package/tests/control-deck-component-updates-static.test.mjs +9 -4
- package/tests/control-visibility-static.test.mjs +3 -3
- package/tests/controls-layout-static.test.mjs +5 -5
- package/tests/conversation-overview-adapter.test.mjs +100 -0
- package/tests/document-artifact-static.test.mjs +2 -1
- package/tests/draft-conversations.test.mjs +205 -0
- package/tests/empty-startup-launcher.test.mjs +197 -0
- package/tests/events-tree-context-menu-static.test.mjs +22 -18
- package/tests/fake-pi-session-ownership.test.mjs +302 -0
- package/tests/fast-mode-client-static.test.mjs +1 -1
- package/tests/feature-decision-output-popup-static.test.mjs +2 -2
- package/tests/feature-system-prompt-optional-feature-static.test.mjs +1 -1
- package/tests/file-viewer-image-static.test.mjs +15 -11
- package/tests/file-viewer-search-static.test.mjs +5 -5
- package/tests/fixtures/fake-pi.mjs +41 -9
- package/tests/footer-provider-usage-visual-static.test.mjs +7 -6
- package/tests/foreground-transcript-catch-up-static.test.mjs +7 -4
- package/tests/git-footer-context-menu-static.test.mjs +1 -1
- package/tests/git-panel-file-preview-static.test.mjs +41 -48
- package/tests/git-panel-live-updates-static.test.mjs +2 -1
- package/tests/git-workflow-dispatch.test.mjs +66 -0
- package/tests/git-workflow-preferences.test.mjs +9 -1
- package/tests/guided-git-activation-static.test.mjs +14 -11
- package/tests/guided-git-fallback-ui-static.test.mjs +8 -5
- package/tests/guided-git-message-reliability-static.test.mjs +10 -6
- package/tests/guided-git-publication-backend-static.test.mjs +16 -11
- package/tests/http-endpoints-harness.test.mjs +21 -9
- package/tests/interaction-state-stability-static.test.mjs +4 -3
- package/tests/intercom-conversation-viewer-static.test.mjs +29 -17
- package/tests/intercom-tag-layout-static.test.mjs +13 -12
- package/tests/intercom-tag-overflow-layout.test.mjs +11 -10
- package/tests/main-output-loading-static.test.mjs +4 -4
- package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
- package/tests/mobile-compact-layout.test.mjs +2 -2
- package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
- package/tests/mobile-foundation-static.test.mjs +10 -7
- package/tests/mobile-phone-experience-static.test.mjs +3 -2
- package/tests/mobile-static.test.mjs +173 -135
- package/tests/model-catalog-order.test.mjs +103 -0
- package/tests/native-parity.test.mjs +6 -4
- package/tests/native-session-choice-owner.test.mjs +102 -0
- package/tests/native-update-lifecycle.test.mjs +10 -5
- package/tests/no-project-http-harness.test.mjs +328 -0
- package/tests/no-project-navigation.test.mjs +54 -0
- package/tests/no-project-workspaces.test.mjs +77 -0
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/optional-feature-migration-frontend.test.mjs +4 -4
- package/tests/optional-feature-prompt-impact-static.test.mjs +3 -3
- package/tests/package-updates.test.mjs +630 -0
- package/tests/persistent-ui-layout-static.test.mjs +3 -3
- package/tests/platform-event-stream.test.mjs +253 -0
- package/tests/project-file-viewer-controller.test.mjs +652 -0
- package/tests/project-git-tools-adapter.test.mjs +103 -0
- package/tests/project-git-tools-controller.test.mjs +577 -0
- package/tests/project-runners-controller.test.mjs +453 -0
- package/tests/prompt-input-vertical-scroll-static.test.mjs +3 -3
- package/tests/prompt-routing-input-clear-static.test.mjs +2 -2
- package/tests/questionnaire-dialog.test.mjs +6 -6
- package/tests/queue-edit-reorder-static.test.mjs +48 -51
- package/tests/rpc-supervisor-host.test.mjs +4 -1
- package/tests/safety-guard-auto-review-static.test.mjs +1 -1
- package/tests/sampling-native-controls-user-flow.test.mjs +7 -1
- package/tests/server-app-runners.test.mjs +536 -0
- package/tests/server-codex-fast-mode.test.mjs +346 -0
- package/tests/server-conversation-mode.test.mjs +386 -0
- package/tests/server-conversation-voice.test.mjs +426 -0
- package/tests/server-extension-ui-requests.test.mjs +357 -0
- package/tests/server-git-generation.test.mjs +558 -0
- package/tests/server-git-mutations.test.mjs +729 -0
- package/tests/server-git-reads.test.mjs +381 -0
- package/tests/server-git-worktree-sessions.test.mjs +502 -0
- package/tests/server-helper-requests.test.mjs +364 -0
- package/tests/server-rpc-transports.test.mjs +553 -0
- package/tests/server-settings-store.test.mjs +132 -0
- package/tests/server-shell-rollout.test.mjs +478 -0
- package/tests/server-sse-delivery.test.mjs +410 -0
- package/tests/server-workspace-files.test.mjs +546 -0
- package/tests/session-attention-scheduler.test.mjs +514 -0
- package/tests/session-composer-store.test.mjs +153 -0
- package/tests/session-context.test.mjs +134 -0
- package/tests/session-extension-requests.test.mjs +193 -0
- package/tests/session-ownership-adapter.test.mjs +130 -0
- package/tests/session-sampling-ui-static.test.mjs +10 -4
- package/tests/session-send-lifetime.test.mjs +140 -0
- package/tests/session-shelf-state.test.mjs +348 -0
- package/tests/session-shelves-adapter.test.mjs +79 -0
- package/tests/session-summary-lifetime.test.mjs +54 -0
- package/tests/settings-resource-controller.test.mjs +548 -0
- package/tests/shell-action-adapter.test.mjs +169 -0
- package/tests/shell-actions.test.mjs +182 -0
- package/tests/shell-navigation.test.mjs +348 -0
- package/tests/shell-preferences.test.mjs +367 -0
- package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
- package/tests/stream-output-isolation-static.test.mjs +1 -1
- package/tests/subagent-gate-visibility.test.mjs +1 -1
- package/tests/subagent-launch-slot-state.test.mjs +2 -2
- package/tests/subagent-launch-slots-static.test.mjs +1 -1
- package/tests/subagent-observability-static.test.mjs +2 -2
- package/tests/subagent-reliability-integration.test.mjs +13 -30
- package/tests/syntax-highlighting-static.test.mjs +3 -3
- package/tests/tab-close-continuity-static.test.mjs +1 -1
- package/tests/tab-metadata-ordering.test.mjs +99 -0
- package/tests/terminal-cwd-grouping-static.test.mjs +2 -2
- package/tests/terminal-tab-prompt-tooltip-static.test.mjs +2 -0
- package/tests/terminal-tab-workspace-static.test.mjs +5 -4
- package/tests/terminal-tabs-resize-static.test.mjs +1 -1
- package/tests/theme-customizer-static.test.mjs +1 -1
- package/tests/thread-display-title.test.mjs +44 -0
- package/tests/update-api-harness.test.mjs +15 -14
- package/tests/update-tab-restore-harness.test.mjs +3 -0
- package/tests/webui-settings-locking.test.mjs +2 -2
- package/tests/windows-drive-cwd-picker-static.test.mjs +7 -9
- package/tests/workspace-choices.test.mjs +114 -0
- package/tests/workspace-save-load-static.test.mjs +7 -4
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { createFocusedWorkspace } from './shell-workspace.mjs';
|
|
2
|
+
import { createToolsLauncher } from './shell-tools-launcher.mjs';
|
|
3
|
+
import { createFocusedComposerControls } from './focused-composer-controls.mjs';
|
|
4
|
+
import { createContextActions } from './shell-context-actions.mjs';
|
|
5
|
+
import { createAttentionInbox } from './shell-attention-inbox.mjs';
|
|
6
|
+
import { createConversationOverview } from './conversation-overview.mjs';
|
|
7
|
+
|
|
8
|
+
/** Places existing application views. The caller retains feature state and navigation. */
|
|
9
|
+
export function createFocusedShellAdapter({ document, viewHost, nodes, sections, onNavigate, onPreferences, onInvoke, getTools, getContextActions, onBehaviorChange, onModel, onEffort, onScopedModels, getAttention, onAttentionSelect, onOverviewAction, onHome }) {
|
|
10
|
+
let mounted = false;
|
|
11
|
+
let inspector = null;
|
|
12
|
+
let toolsTrigger = null;
|
|
13
|
+
const modalHosts = new WeakMap();
|
|
14
|
+
let modalStack = [];
|
|
15
|
+
const contentHidden = new Map();
|
|
16
|
+
const settingsIds = ['controls', 'optional-features'];
|
|
17
|
+
const byId = new Map(sections.map(record => [record.id, record]));
|
|
18
|
+
const composer = createFocusedComposerControls({ document, onBehaviorChange, onModel, onEffort, onScopedModels, showSettings: false });
|
|
19
|
+
const composerControls = composer.element;
|
|
20
|
+
composerControls.hidden = true;
|
|
21
|
+
nodes.composer.append(composerControls);
|
|
22
|
+
const sidebarSettings = document.createElement('button');
|
|
23
|
+
sidebarSettings.type = 'button';
|
|
24
|
+
sidebarSettings.className = 'terminal-settings-button';
|
|
25
|
+
sidebarSettings.setAttribute('aria-label', 'Settings');
|
|
26
|
+
sidebarSettings.title = 'Settings';
|
|
27
|
+
sidebarSettings.hidden = true;
|
|
28
|
+
const settingsIcon = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
29
|
+
settingsIcon.setAttribute('viewBox', '0 0 24 24');
|
|
30
|
+
settingsIcon.setAttribute('aria-hidden', 'true');
|
|
31
|
+
settingsIcon.setAttribute('focusable', 'false');
|
|
32
|
+
const settingsPath = document.createElementNS(settingsIcon.namespaceURI, 'path');
|
|
33
|
+
settingsPath.setAttribute('d', 'M9.5 3h5l.6 2.4 1.8 1 2.4-.7 2.5 4.3-1.8 1.7v2.1l1.8 1.7-2.5 4.3-2.4-.7-1.8 1-.6 2.4h-5l-.6-2.4-1.8-1-2.4.7-2.5-4.3L4 13.8v-2.1L2.2 10l2.5-4.3 2.4.7 1.8-1 .6-2.4Z M15 12.75a3 3 0 1 0-6 0 3 3 0 0 0 6 0Z');
|
|
34
|
+
settingsIcon.append(settingsPath);
|
|
35
|
+
sidebarSettings.append(settingsIcon);
|
|
36
|
+
sidebarSettings.addEventListener('click', () => { if (mounted) onNavigate('settings', 'settings:appearance'); });
|
|
37
|
+
const sidebarActions = nodes.navigation.querySelector('.terminal-sidebar-actions');
|
|
38
|
+
sidebarActions?.insertBefore(sidebarSettings, sidebarActions.querySelector('#sidebarUpdateButton'));
|
|
39
|
+
const tools = createToolsLauncher({ document, onInvoke,
|
|
40
|
+
onPinsChange: pinnedActions => {
|
|
41
|
+
if (!onPreferences({ pinnedActions })) tools.update({ pinnedIds: getTools().pinnedIds });
|
|
42
|
+
},
|
|
43
|
+
onClose: () => syncModalRunControls(),
|
|
44
|
+
});
|
|
45
|
+
let contextCategory = null;
|
|
46
|
+
let contextSignature = '';
|
|
47
|
+
const contextActions = createContextActions({ document, onInvoke,
|
|
48
|
+
onMore: category => {
|
|
49
|
+
const trigger = closeTools();
|
|
50
|
+
openTools(category, trigger);
|
|
51
|
+
},
|
|
52
|
+
onClose: () => syncModalRunControls(),
|
|
53
|
+
});
|
|
54
|
+
const inbox = createAttentionInbox({ document, onSelect: onAttentionSelect,
|
|
55
|
+
onClose: () => syncModalRunControls(),
|
|
56
|
+
});
|
|
57
|
+
const overview = createConversationOverview({ document, onAction: onOverviewAction,
|
|
58
|
+
onClose: () => {
|
|
59
|
+
if (!onPreferences({ overviewOpen: false })) overview.update(snapshot.overview);
|
|
60
|
+
workspace.element.querySelector('[aria-controls="focusedWorkspaceOverview"]')?.focus({ preventScroll: true });
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
let lastInspector = { destination: 'project', inspector: 'files' };
|
|
64
|
+
const workspace = createFocusedWorkspace({ document, onNavigate, onHome,
|
|
65
|
+
onToggleOverview: () => {
|
|
66
|
+
const open = !snapshot.overviewOpen;
|
|
67
|
+
if (open && ['home', 'settings'].includes(snapshot.destination) && onNavigate('conversation', null) === false) return;
|
|
68
|
+
onPreferences({ overviewOpen: open });
|
|
69
|
+
},
|
|
70
|
+
onToggleInspector: () => snapshot.inspectorOpen
|
|
71
|
+
? onNavigate('conversation', null)
|
|
72
|
+
: onNavigate(lastInspector.destination, lastInspector.inspector),
|
|
73
|
+
onTools: () => openTools(),
|
|
74
|
+
onAttention: () => {
|
|
75
|
+
inbox.open(getAttention(), document.activeElement);
|
|
76
|
+
if (mounted) moveRunControls(inbox.slots.runControls);
|
|
77
|
+
},
|
|
78
|
+
onToggleNavigation: () => onPreferences({ navCollapsed: !snapshot.navCollapsed }),
|
|
79
|
+
onNavigationResize: navigationWidth => onPreferences({ navigationWidth }),
|
|
80
|
+
onInspectorResize: inspectorWidth => onPreferences({ inspectorWidth }),
|
|
81
|
+
onSessionMenu: () => openContextActions('Session'),
|
|
82
|
+
onProjectMenu: () => openContextActions('Project'),
|
|
83
|
+
onInspectorClose: () => onNavigate('conversation', null),
|
|
84
|
+
onConversation: () => onNavigate('conversation', null),
|
|
85
|
+
onInspectorSelect: id => onNavigate(snapshot.destination, id),
|
|
86
|
+
});
|
|
87
|
+
workspace.slots.overview.append(overview.element);
|
|
88
|
+
function sizeOverview() {
|
|
89
|
+
if (!snapshot.enabled || !snapshot.overviewOpen) return;
|
|
90
|
+
const host = workspace.slots.overview;
|
|
91
|
+
const transcript = nodes.chat?.getBoundingClientRect();
|
|
92
|
+
const available = transcript ? transcript.bottom - host.getBoundingClientRect().top - 8 : workspace.slots.conversation.clientHeight - 24;
|
|
93
|
+
host.style.height = `${Math.max(0, available)}px`;
|
|
94
|
+
const card = overview.element;
|
|
95
|
+
card.style.setProperty('--overview-width', '288px');
|
|
96
|
+
card.classList.remove('conversation-overview-wide');
|
|
97
|
+
const width = Math.min(560, Math.max(0, workspace.slots.conversation.clientWidth - 24));
|
|
98
|
+
if (card.scrollHeight > available && width >= 480) {
|
|
99
|
+
card.style.setProperty('--overview-width', `${width}px`);
|
|
100
|
+
card.classList.add('conversation-overview-wide');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const overviewResize = new document.defaultView.ResizeObserver(sizeOverview);
|
|
104
|
+
for (const node of [workspace.slots.conversation, nodes.composer, nodes.chat]) if (node) overviewResize.observe(node);
|
|
105
|
+
workspace.element.hidden = true;
|
|
106
|
+
document.body.append(workspace.element, tools.element, contextActions.element, inbox.element);
|
|
107
|
+
let snapshot = {};
|
|
108
|
+
|
|
109
|
+
function moveRunControls(host) {
|
|
110
|
+
for (const node of [nodes.abortButton, nodes.conversationModeEndButton]) if (node) viewHost.move(node, host);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function syncModalRunControls() {
|
|
114
|
+
if (!mounted) return;
|
|
115
|
+
modalStack = modalStack.filter(dialog => dialog.isConnected && dialog.open);
|
|
116
|
+
const dialog = modalStack.at(-1);
|
|
117
|
+
let host = workspace.slots.runControls;
|
|
118
|
+
if (dialog === tools.element) host = tools.slots.runControls;
|
|
119
|
+
else if (dialog === contextActions.element) host = contextActions.slots.runControls;
|
|
120
|
+
else if (dialog === inbox.element) host = inbox.slots.runControls;
|
|
121
|
+
else if (dialog) {
|
|
122
|
+
host = modalHosts.get(dialog);
|
|
123
|
+
if (!host) {
|
|
124
|
+
host = document.createElement('div');
|
|
125
|
+
host.className = 'focused-modal-run-controls';
|
|
126
|
+
host.setAttribute('role', 'group');
|
|
127
|
+
dialog.append(host);
|
|
128
|
+
modalHosts.set(dialog, host);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
host.setAttribute('aria-label', `Run controls for ${snapshot.title}`);
|
|
132
|
+
moveRunControls(host);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Native dialogs own focus. Keep the existing run controls in the foremost
|
|
136
|
+
// modal, including feature dialogs created after the initial shell.
|
|
137
|
+
const modalObserver = new document.defaultView.MutationObserver(records => {
|
|
138
|
+
for (const { target } of records) {
|
|
139
|
+
if (target.tagName !== 'DIALOG') continue;
|
|
140
|
+
modalStack = modalStack.filter(dialog => dialog !== target);
|
|
141
|
+
if (target.open) modalStack.push(target);
|
|
142
|
+
}
|
|
143
|
+
syncModalRunControls();
|
|
144
|
+
});
|
|
145
|
+
modalObserver.observe(document.body, { subtree: true, attributes: true, attributeFilter: ['open'] });
|
|
146
|
+
|
|
147
|
+
function mountContent(id, host) {
|
|
148
|
+
const record = byId.get(id);
|
|
149
|
+
if (!record) return;
|
|
150
|
+
if (!contentHidden.has(id)) contentHidden.set(id, record.content.hidden);
|
|
151
|
+
record.content.hidden = false;
|
|
152
|
+
viewHost.move(record.content, host);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function restoreContent(id) {
|
|
156
|
+
const record = byId.get(id);
|
|
157
|
+
if (!record || !contentHidden.has(id)) return;
|
|
158
|
+
record.content.hidden = contentHidden.get(id);
|
|
159
|
+
viewHost.restore(record.content);
|
|
160
|
+
contentHidden.delete(id);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function contextSnapshot(category) {
|
|
164
|
+
const data = getTools();
|
|
165
|
+
return { title: `${category} actions`, category, contextLabel: data.contextLabel,
|
|
166
|
+
actions: getContextActions(category, data.actions) };
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function openContextActions(category) {
|
|
170
|
+
toolsTrigger = document.activeElement;
|
|
171
|
+
contextCategory = category;
|
|
172
|
+
const data = contextSnapshot(category);
|
|
173
|
+
contextSignature = JSON.stringify(data);
|
|
174
|
+
contextActions.open(data, toolsTrigger);
|
|
175
|
+
if (mounted) moveRunControls(contextActions.slots.runControls);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function openTools(category, trigger, initialQuery = '') {
|
|
179
|
+
if (!tools.element.open) toolsTrigger = trigger || document.activeElement;
|
|
180
|
+
tools.open({ ...getTools(), initialCategory: category, initialQuery });
|
|
181
|
+
if (mounted) moveRunControls(tools.slots.runControls);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function closeTools() {
|
|
185
|
+
const trigger = tools.element.open || contextActions.element.open ? toolsTrigger : undefined;
|
|
186
|
+
tools.close();
|
|
187
|
+
contextActions.close();
|
|
188
|
+
toolsTrigger = null;
|
|
189
|
+
return trigger;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function update(next) {
|
|
193
|
+
snapshot = next;
|
|
194
|
+
if (['project', 'activity'].includes(next.destination) && next.inspector) lastInspector = { destination: next.destination, inspector: next.inspector };
|
|
195
|
+
overview.update(next.enabled ? next.overview || { open: false } : { open: false });
|
|
196
|
+
sidebarSettings.hidden = !next.enabled || next.navigation === 'top';
|
|
197
|
+
if (next.destination === 'settings') sidebarSettings.setAttribute('aria-current', 'page');
|
|
198
|
+
else sidebarSettings.removeAttribute('aria-current');
|
|
199
|
+
if (!next.enabled) {
|
|
200
|
+
workspace.cancelNavigationResize();
|
|
201
|
+
workspace.cancelInspectorResize?.();
|
|
202
|
+
if (!mounted) return;
|
|
203
|
+
closeTools();
|
|
204
|
+
inbox.close();
|
|
205
|
+
nodes.layout.hidden = false;
|
|
206
|
+
nodes.layout.inert = false;
|
|
207
|
+
document.documentElement.removeAttribute('data-desktop-shell');
|
|
208
|
+
for (const id of [...contentHidden.keys()]) restoreContent(id);
|
|
209
|
+
for (const node of [nodes.abortButton, nodes.conversationModeEndButton, nodes.navigation, nodes.home, nodes.footer, nodes.versions, nodes.settingsRoot, nodes.conversation]) {
|
|
210
|
+
if (node) viewHost.restore(node);
|
|
211
|
+
}
|
|
212
|
+
nodes.home.hidden = next.homeCollapsed;
|
|
213
|
+
workspace.element.hidden = true;
|
|
214
|
+
composerControls.hidden = true;
|
|
215
|
+
mounted = false;
|
|
216
|
+
inspector = null;
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
workspace.element.hidden = false;
|
|
220
|
+
document.documentElement.dataset.desktopShell = 'focused';
|
|
221
|
+
workspace.update(next);
|
|
222
|
+
composer.update(next.composer || {});
|
|
223
|
+
composerControls.hidden = !next.composer?.runActive;
|
|
224
|
+
if (inbox.element.open) inbox.update(getAttention());
|
|
225
|
+
if (contextActions.element.open) {
|
|
226
|
+
const data = contextSnapshot(contextCategory);
|
|
227
|
+
const signature = JSON.stringify(data);
|
|
228
|
+
if (signature !== contextSignature) { contextSignature = signature; contextActions.update(data); }
|
|
229
|
+
}
|
|
230
|
+
for (const host of [workspace.slots.runControls, tools.slots.runControls, contextActions.slots.runControls, inbox.slots.runControls]) host.setAttribute("aria-label", `Run controls for ${next.title}`);
|
|
231
|
+
if (!mounted) {
|
|
232
|
+
viewHost.move(nodes.conversation, workspace.slots.conversation);
|
|
233
|
+
viewHost.move(nodes.navigation, workspace.slots.navigation);
|
|
234
|
+
viewHost.move(nodes.home, workspace.slots.home);
|
|
235
|
+
if (nodes.settingsRoot) viewHost.move(nodes.settingsRoot, workspace.slots.settings);
|
|
236
|
+
else {
|
|
237
|
+
for (const id of settingsIds) mountContent(id, workspace.slots.settings);
|
|
238
|
+
for (const node of [nodes.footer, nodes.versions]) if (node) viewHost.move(node, workspace.slots.settings);
|
|
239
|
+
}
|
|
240
|
+
moveRunControls(workspace.slots.runControls);
|
|
241
|
+
mounted = true;
|
|
242
|
+
modalStack = [...document.querySelectorAll("dialog:modal")];
|
|
243
|
+
syncModalRunControls();
|
|
244
|
+
}
|
|
245
|
+
nodes.layout.hidden = true;
|
|
246
|
+
nodes.home.hidden = false;
|
|
247
|
+
const nextInspector = byId.has(next.inspector) && !settingsIds.includes(next.inspector) ? next.inspector : null;
|
|
248
|
+
if (inspector !== nextInspector) {
|
|
249
|
+
if (inspector) restoreContent(inspector);
|
|
250
|
+
inspector = nextInspector;
|
|
251
|
+
if (inspector) mountContent(inspector, workspace.slots.inspector);
|
|
252
|
+
}
|
|
253
|
+
sizeOverview();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return { update, openTools, closeTools, closeAttention: () => inbox.close(), get modelTrigger() { return nodes.statusBar?.querySelector('.footer-model.footer-meta-action, .footer-tui-model'); }, get active() { return mounted; }, get inspector() { return mounted ? inspector : null; } };
|
|
257
|
+
}
|