@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,175 @@
|
|
|
1
|
+
import { createSettingsNavigator } from './settings-navigation-controller.mjs';
|
|
2
|
+
|
|
3
|
+
export const SETTINGS_CATEGORIES = Object.freeze([
|
|
4
|
+
['appearance', 'Appearance'], ['resources', 'Models and resources'], ['features', 'Features'],
|
|
5
|
+
['accounts', 'Accounts'], ['voice', 'Voice'], ['connection', 'Connection'], ['system', 'System'], ['help', 'Help'],
|
|
6
|
+
].map(([id, label]) => Object.freeze({ id, label })));
|
|
7
|
+
|
|
8
|
+
const CONTROLS = [
|
|
9
|
+
['desktop-layout', 'appearance', 'Desktop layout', '#desktopShellSelect', 'This browser', 'compact classic preview'],
|
|
10
|
+
['navigation', 'appearance', 'Session navigation', '#focusedNavigationSelect', 'This browser', 'sidebar top bar'],
|
|
11
|
+
['tab-placement', 'appearance', 'Classic thread placement', '#terminalTabsLayoutSelect', 'Shared WebUI layout', 'threads tabs sidebar'],
|
|
12
|
+
['deck-placement', 'appearance', 'Control Deck placement', '#controlDeckPlacementSelect', 'Shared WebUI layout', 'left right'],
|
|
13
|
+
['theme-mode', 'appearance', 'Theme mode', '#themeSchemeToggle button', 'This browser', 'light dark auto'],
|
|
14
|
+
['theme', 'appearance', 'Theme', '#themeSelect', 'This browser', 'colour color appearance'],
|
|
15
|
+
['background', 'appearance', 'Background', '#backgroundChooseButton', 'This browser', 'image wallpaper'],
|
|
16
|
+
['notifications', 'appearance', 'Notifications', '#agentDoneNotificationsToggle', 'This browser', 'permission completion blockers'],
|
|
17
|
+
['thinking-output', 'appearance', 'Thinking output', '#thinkingVisibilityToggle', 'This browser', 'reasoning transcript'],
|
|
18
|
+
['sampling', 'resources', 'Sampling parameters', '.sampling-parameters', 'Current Pi session', 'temperature top-p top-k min-p sampling defaults overrides'],
|
|
19
|
+
['codex-speed', 'resources', 'Codex speed', '#codexFastModeSelect', 'Current session branch', 'normal fast ultrafast service tier'],
|
|
20
|
+
['output-processing', 'system', 'Output processing', '#fastOutputModeSelect', 'Server', 'normal compact-v1 performance'],
|
|
21
|
+
['remote-access', 'connection', 'Remote access', '#openNetworkButton', 'Server network', 'lan qr connection'],
|
|
22
|
+
['remote-pin', 'connection', 'PIN protection', '#remoteAuthToggle', 'Server network', 'security authentication'],
|
|
23
|
+
['voice', 'voice', 'Conversation voice', '#conversationVoiceMenuPanel', 'Shared Pi voice configuration', 'spoken piper download language talk'],
|
|
24
|
+
['server-action', 'system', 'Server actions', '#serverActionSelect', 'Server', 'restart stop update'],
|
|
25
|
+
['webui-version', 'system', 'WebUI version and updates', '#webuiVersionButton', 'Server', 'package maintenance release'],
|
|
26
|
+
['pi-version', 'system', 'Pi version and release notes', '#piVersionButton', 'Server', 'changelog update'],
|
|
27
|
+
['report-issue', 'help', 'Report an issue', '#openIssueButton', 'Explicit submission', 'bug help support'],
|
|
28
|
+
];
|
|
29
|
+
const ACTIONS = [
|
|
30
|
+
['tools', 'resources', 'Tools', 'settings:tools-setup', 'Session / Global / exact Model', 'capabilities allowlist'],
|
|
31
|
+
['skills', 'resources', 'Skills', 'settings:skills-setup', 'Session / Global / exact Model', 'instructions resources'],
|
|
32
|
+
['models', 'resources', 'Model cycling', 'native:scoped-models', 'Pi settings', 'scoped models'],
|
|
33
|
+
['append-system', 'resources', 'Append system prompt', 'native:append-system', 'Global; new or reloaded threads', 'append_system instructions'],
|
|
34
|
+
['runtime', 'resources', 'Runtime settings', 'native:settings', 'Scope shown beside each setting', 'thinking compaction auto-compaction auto-compact images startup safety transport busy prompt steering follow-up density autocomplete double escape tree filter'],
|
|
35
|
+
['summary-setup', 'resources', 'Summary Setup', 'native:summary-setup', 'Global preferences; selected session generation', 'summary model effort cadence prompts privacy context injection automatic titles'],
|
|
36
|
+
['runner-configuration', 'system', 'Runner configuration', 'settings:runner-configuration', 'Current project', 'runners discovery paths custom command args'],
|
|
37
|
+
['git-footer-visibility', 'appearance', 'Git-footer Visibility', 'settings:git-footer-visibility', 'Global; commands run in the selected session', 'git footer hidden show hide webui'],
|
|
38
|
+
['tool-output', 'appearance', 'Tool output expansion', 'conversation:tool-output', 'This browser', 'expand collapse bash results output'],
|
|
39
|
+
['visibility', 'appearance', 'Control visibility', 'settings:visibility', 'Shared WebUI layout', 'hidden controls recovery'],
|
|
40
|
+
['show-controls', 'appearance', 'Show all controls', 'settings:show-controls', 'Shared WebUI layout', 'restore buttons'],
|
|
41
|
+
['reset-controls', 'appearance', 'Reset control visibility', 'settings:reset-controls', 'Shared WebUI layout', 'defaults'],
|
|
42
|
+
['login', 'accounts', 'Provider login', 'native:login', 'Pi account; TUI login guidance', 'authentication credentials account'],
|
|
43
|
+
['logout', 'accounts', 'Provider logout', 'native:logout', 'Stored Pi credentials', 'authentication remove account'],
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
/** Composes canonical settings nodes; navigation, mutations and capability policy stay with the app. */
|
|
47
|
+
export function createSettingsWorkspace({ document, viewHost, onNavigate, onInvoke }) {
|
|
48
|
+
let snapshot = null;
|
|
49
|
+
let mounted = false;
|
|
50
|
+
const cards = new Map();
|
|
51
|
+
const navigator = createSettingsNavigator({ document, onNavigate, onInvoke });
|
|
52
|
+
const element = navigator.element;
|
|
53
|
+
element.classList.add('settings-workspace');
|
|
54
|
+
element.hidden = true;
|
|
55
|
+
const pages = new Map(SETTINGS_CATEGORIES.map(({ id }) => {
|
|
56
|
+
const page = document.createElement('section');
|
|
57
|
+
page.className = 'settings-page';
|
|
58
|
+
page.dataset.settingsCategory = id;
|
|
59
|
+
navigator.slots.content.append(page);
|
|
60
|
+
return [id, page];
|
|
61
|
+
}));
|
|
62
|
+
const groups = [
|
|
63
|
+
['appearance', 'section[aria-labelledby="interfaceControlsTitle"]'],
|
|
64
|
+
['appearance', '.thinking-visibility-control-field'],
|
|
65
|
+
['resources', '.sampling-parameters'],
|
|
66
|
+
['resources', '.codex-fast-mode-control'],
|
|
67
|
+
['features', '#sidePanelSectionOptionalFeatures', true],
|
|
68
|
+
['connection', '#networkControlField'],
|
|
69
|
+
['system', '.output-processing-control-group'],
|
|
70
|
+
['system', '.server-control-group'],
|
|
71
|
+
['system', '.side-panel-version-row'],
|
|
72
|
+
['help', '[data-control-deck-shared-footer]'],
|
|
73
|
+
['help', '.sponsor-link'],
|
|
74
|
+
].map(([category, selector, expand]) => ({ category, node: document.querySelector(selector), expand, hidden: null })).filter(record => record.node);
|
|
75
|
+
const voicePanel = document.getElementById('conversationVoiceMenuPanel');
|
|
76
|
+
for (const [category, text] of [
|
|
77
|
+
['resources', 'Sampling parameters apply to the current Pi session. Codex speed overrides apply to the current session branch. Summary Setup saves global preferences and asks before generating for the selected session.'],
|
|
78
|
+
['system', 'Runner configuration saves discovery paths and custom commands for the current project. Running and stopping runners remain in Project.'],
|
|
79
|
+
['voice', 'Voice selection is saved in the shared Pi voice configuration for future sessions and applied immediately to the current voice conversation. Starting a voice conversation and microphone consent remain explicit actions in Conversation. Voice installation may require /talk setup in Pi.'],
|
|
80
|
+
['connection', 'Network and PIN controls follow this server’s access policy. Unavailable controls remain unavailable here.'],
|
|
81
|
+
['accounts', 'Provider login uses Pi’s terminal sign-in flow. Logout asks before removing stored credentials.'],
|
|
82
|
+
['help', 'Review an issue before submitting it. No support data is sent by opening Settings.'],
|
|
83
|
+
]) {
|
|
84
|
+
const note = document.createElement('p');
|
|
85
|
+
note.className = 'settings-page-note';
|
|
86
|
+
note.textContent = text;
|
|
87
|
+
pages.get(category).append(note);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function entries() {
|
|
91
|
+
const controls = CONTROLS.map(([id, category, label, selector, scopeLabel, aliases]) => {
|
|
92
|
+
const node = document.querySelector(selector);
|
|
93
|
+
const hidden = node?.hidden || node?.closest('.control-row')?.hidden || node?.closest('.control-group')?.hidden;
|
|
94
|
+
const userHidden = !!node?.closest('.webui-user-hidden');
|
|
95
|
+
return { id, category, label, scopeLabel, aliases: [aliases], description: '', node,
|
|
96
|
+
available: !!node && !hidden && !userHidden && !node.disabled,
|
|
97
|
+
reason: userHidden ? 'Hidden by control visibility preferences.' : id === 'codex-speed'
|
|
98
|
+
? document.getElementById('codexFastModeStatus')?.textContent || 'Unavailable for this session.'
|
|
99
|
+
: 'Unavailable for the current server or session.',
|
|
100
|
+
setupActionId: userHidden ? 'settings:visibility' : undefined };
|
|
101
|
+
});
|
|
102
|
+
const actions = ACTIONS.map(([id, category, label, actionId, scopeLabel, aliases]) => {
|
|
103
|
+
const action = snapshot?.actions.find(item => item.id === actionId);
|
|
104
|
+
return { id, category, label, actionId, scopeLabel, aliases: [aliases], description: action?.description || '',
|
|
105
|
+
available: !!action && action.available !== false, reason: action?.unavailableReason || 'Unavailable for this session.' };
|
|
106
|
+
});
|
|
107
|
+
const features = (snapshot?.features || []).map(feature => ({
|
|
108
|
+
...feature, id: `feature:${feature.id}`, category: 'features', scopeLabel: 'Feature availability and Setup',
|
|
109
|
+
aliases: [feature.packageName || ''], available: true, reason: '',
|
|
110
|
+
node: [...document.querySelectorAll('[data-settings-feature]')].find(node => node.dataset.settingsFeature === feature.id),
|
|
111
|
+
}));
|
|
112
|
+
return [...controls, ...actions, ...features];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function update(next) {
|
|
116
|
+
snapshot = next;
|
|
117
|
+
if (next.enabled && !mounted) {
|
|
118
|
+
for (const record of groups) {
|
|
119
|
+
if (record.expand) { record.hidden = record.node.hidden; record.node.hidden = false; }
|
|
120
|
+
viewHost.move(record.node, pages.get(record.category));
|
|
121
|
+
}
|
|
122
|
+
mounted = true;
|
|
123
|
+
} else if (!next.enabled && mounted) {
|
|
124
|
+
if (voicePanel) viewHost.restore(voicePanel);
|
|
125
|
+
for (const record of groups) {
|
|
126
|
+
viewHost.restore(record.node);
|
|
127
|
+
if (record.expand) record.node.hidden = record.hidden;
|
|
128
|
+
}
|
|
129
|
+
mounted = false;
|
|
130
|
+
}
|
|
131
|
+
element.hidden = !next.enabled;
|
|
132
|
+
if (!next.enabled) return;
|
|
133
|
+
for (const record of groups) if (record.expand) record.node.hidden = false;
|
|
134
|
+
if (voicePanel) {
|
|
135
|
+
if (next.category === 'voice' && next.destination === 'settings') viewHost.move(voicePanel, pages.get('voice'));
|
|
136
|
+
else viewHost.restore(voicePanel);
|
|
137
|
+
}
|
|
138
|
+
for (const [id, page] of pages) page.hidden = id !== next.category;
|
|
139
|
+
if (next.destination !== 'settings') return;
|
|
140
|
+
const records = entries();
|
|
141
|
+
for (const entry of records.filter(record => record.actionId)) {
|
|
142
|
+
let card = cards.get(entry.id);
|
|
143
|
+
if (!card) {
|
|
144
|
+
const row = document.createElement('div'); row.className = 'settings-action-row';
|
|
145
|
+
const button = document.createElement('button'); button.type = 'button';
|
|
146
|
+
const detail = document.createElement('p');
|
|
147
|
+
const scope = document.createElement('span'); scope.className = 'settings-navigation-scope';
|
|
148
|
+
row.append(button, scope, detail); pages.get(entry.category).append(row);
|
|
149
|
+
card = { row, button, scope, detail }; cards.set(entry.id, card);
|
|
150
|
+
}
|
|
151
|
+
card.button.textContent = entry.label; card.button.disabled = !entry.available;
|
|
152
|
+
card.scope.textContent = entry.scopeLabel;
|
|
153
|
+
card.detail.textContent = entry.available ? entry.description : entry.reason;
|
|
154
|
+
const target = next.target;
|
|
155
|
+
card.button.onclick = () => { if (mounted && card.button.isConnected && !card.button.closest('[hidden]')) onInvoke(entry.actionId, target); };
|
|
156
|
+
}
|
|
157
|
+
navigator.update({ category: next.category, categories: SETTINGS_CATEGORIES, entries: records, target: next.target });
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function reveal(id) {
|
|
161
|
+
const entry = entries().find(record => record.id === id);
|
|
162
|
+
if (!entry?.available || !mounted) return null;
|
|
163
|
+
navigator.clearSearch();
|
|
164
|
+
if (entry.node) {
|
|
165
|
+
const node = entry.id === 'theme' && entry.node.classList.contains('model-select-expanded')
|
|
166
|
+
? document.getElementById('themeSearchInput') : entry.node;
|
|
167
|
+
if (!node.matches('input,select,button,a,[tabindex]')) node.tabIndex = -1;
|
|
168
|
+
node.scrollIntoView({ block: 'nearest' });
|
|
169
|
+
node.focus({ preventScroll: true });
|
|
170
|
+
}
|
|
171
|
+
return entry;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return { element, update, reveal, clearSearch: navigator.clearSearch, getEntries: entries };
|
|
175
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
function paletteText(value) {
|
|
2
|
+
return String(value || "").toLowerCase();
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
function actionSearchText(item) {
|
|
6
|
+
const aliases = Array.isArray(item.aliases) ? item.aliases.join(" ") : item.aliases;
|
|
7
|
+
return [item.label, item.description, item.kind, item.keywords, aliases].map(paletteText).join(" ");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function actionScore(item, tokens) {
|
|
11
|
+
const label = paletteText(item.label);
|
|
12
|
+
let score = 0;
|
|
13
|
+
for (const token of tokens) {
|
|
14
|
+
if (label.startsWith(token)) score += 40;
|
|
15
|
+
else if (label.replace(/^\//, "").startsWith(token)) score += 36;
|
|
16
|
+
else if (new RegExp(`(^|[\\s/_-])${token.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`).test(label)) score += 24;
|
|
17
|
+
else if (label.includes(token)) score += 12;
|
|
18
|
+
else score += 1;
|
|
19
|
+
}
|
|
20
|
+
return score;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Return matching records in palette order, retaining their identity and availability. */
|
|
24
|
+
export function filterActionItems(items, query, { limit = 80 } = {}) {
|
|
25
|
+
const normalizedQuery = paletteText(query).trim();
|
|
26
|
+
if (!normalizedQuery) return items.slice(0, limit);
|
|
27
|
+
const tokens = normalizedQuery.split(/\s+/).filter(Boolean);
|
|
28
|
+
return items
|
|
29
|
+
.map((item, index) => {
|
|
30
|
+
const text = actionSearchText(item);
|
|
31
|
+
return { item, index, score: tokens.every((token) => text.includes(token)) ? actionScore(item, tokens) : -1 };
|
|
32
|
+
})
|
|
33
|
+
.filter((entry) => entry.score >= 0)
|
|
34
|
+
.sort((a, b) => b.score - a.score || a.index - b.index)
|
|
35
|
+
.slice(0, limit)
|
|
36
|
+
.map((entry) => entry.item);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function nonemptyString(value) {
|
|
40
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Check captured invocation identity only; the caller owns execution and server authorization. */
|
|
44
|
+
export function checkActionTarget(action, currentTarget) {
|
|
45
|
+
if (action?.available === false) {
|
|
46
|
+
return {
|
|
47
|
+
ok: false,
|
|
48
|
+
reason: nonemptyString(action.unavailableReason) ? action.unavailableReason : "This action is currently unavailable.",
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const scope = action?.scope;
|
|
53
|
+
if (scope === "browser" || scope === "server") return { ok: true, reason: "" };
|
|
54
|
+
if (scope !== "session" && scope !== "project" && scope !== "tab") {
|
|
55
|
+
return { ok: false, reason: "This action has a missing or unknown scope." };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const target = action.target;
|
|
59
|
+
if (!nonemptyString(target?.tabId)) return { ok: false, reason: "This action is missing its target thread." };
|
|
60
|
+
|
|
61
|
+
if (scope === "tab") {
|
|
62
|
+
if (!Array.isArray(currentTarget?.liveTabIds) || !currentTarget.liveTabIds.includes(target.tabId)) {
|
|
63
|
+
return { ok: false, reason: "The target thread is no longer available." };
|
|
64
|
+
}
|
|
65
|
+
return { ok: true, reason: "" };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (!Number.isInteger(target.generation) || target.generation < 0) {
|
|
69
|
+
return { ok: false, reason: "This action is missing a valid session generation." };
|
|
70
|
+
}
|
|
71
|
+
if (target.tabId !== currentTarget?.tabId) {
|
|
72
|
+
return { ok: false, reason: "The active thread has changed. Choose the action again." };
|
|
73
|
+
}
|
|
74
|
+
if (target.generation !== currentTarget?.generation) {
|
|
75
|
+
return { ok: false, reason: "The session has changed. Choose the action again." };
|
|
76
|
+
}
|
|
77
|
+
if (!nonemptyString(target.sessionIdentity) || target.sessionIdentity !== currentTarget?.sessionIdentity) {
|
|
78
|
+
return { ok: false, reason: "The session has changed. Choose the action again." };
|
|
79
|
+
}
|
|
80
|
+
if (scope === "project") {
|
|
81
|
+
if (!nonemptyString(target.cwd)) return { ok: false, reason: "This action is missing its target working directory." };
|
|
82
|
+
if (target.cwd !== currentTarget?.cwd) {
|
|
83
|
+
return { ok: false, reason: "The working directory has changed. Choose the action again." };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return { ok: true, reason: "" };
|
|
87
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#shellAttentionInbox {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
width: min(640px, calc(100% - 24px));
|
|
4
|
+
max-width: none;
|
|
5
|
+
max-height: calc(100dvh - 24px);
|
|
6
|
+
padding: 0;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
color: var(--text);
|
|
9
|
+
background: var(--bg);
|
|
10
|
+
border: 1px solid var(--border);
|
|
11
|
+
border-radius: 10px;
|
|
12
|
+
box-shadow: 0 24px 90px var(--shadow, #0008);
|
|
13
|
+
font: inherit;
|
|
14
|
+
font-size: var(--text-sm, 0.875rem);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#shellAttentionInbox[open] { display: flex; flex-direction: column; }
|
|
18
|
+
#shellAttentionInbox::backdrop { background: #080810aa; backdrop-filter: blur(3px); }
|
|
19
|
+
#shellAttentionInbox * { box-sizing: border-box; min-width: 0; }
|
|
20
|
+
#shellAttentionInbox [hidden] { display: none !important; }
|
|
21
|
+
#shellAttentionInbox button { font: inherit; color: inherit; cursor: pointer; border-radius: 5px; }
|
|
22
|
+
#shellAttentionInbox :is(.attention-inbox-close, .attention-inbox-item) { box-shadow: none; transform: none; transition: none; }
|
|
23
|
+
#shellAttentionInbox button:disabled { cursor: default; opacity: 0.65; }
|
|
24
|
+
#shellAttentionInbox button:focus-visible { outline: 2px solid var(--accent-2, var(--accent)); outline-offset: -2px; }
|
|
25
|
+
#shellAttentionInbox .attention-inbox-header {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
gap: 12px;
|
|
30
|
+
padding: 12px 16px 4px;
|
|
31
|
+
flex-shrink: 0;
|
|
32
|
+
}
|
|
33
|
+
#shellAttentionInbox h2 { margin: 0; font-size: 1rem; font-weight: 600; }
|
|
34
|
+
#shellAttentionInbox .attention-inbox-close { flex-shrink: 0; padding: 6px 9px; border: 1px solid var(--border); background: var(--panel); }
|
|
35
|
+
#shellAttentionInbox .attention-inbox-summary { flex-shrink: 0; margin: 0; padding: 4px 16px 12px; color: var(--muted); overflow-wrap: anywhere; }
|
|
36
|
+
#shellAttentionInbox .attention-inbox-run-controls { flex-shrink: 0; max-height: 25dvh; overflow: auto; overflow-wrap: anywhere; }
|
|
37
|
+
#shellAttentionInbox .attention-inbox-run-controls:not(:empty) { padding: 8px 16px; border-top: 1px solid var(--border); }
|
|
38
|
+
#shellAttentionInbox .attention-inbox-body { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 16px; border-top: 1px solid var(--border); }
|
|
39
|
+
#shellAttentionInbox .attention-inbox-section { padding: 14px 0; }
|
|
40
|
+
#shellAttentionInbox .attention-inbox-section + .attention-inbox-section { border-top: 1px solid var(--border); }
|
|
41
|
+
#shellAttentionInbox .attention-inbox-section-title { margin: 0; font-size: var(--text-sm, 0.875rem); font-weight: 600; }
|
|
42
|
+
#shellAttentionInbox .attention-inbox-blocked .attention-inbox-section-title { color: var(--warning); }
|
|
43
|
+
#shellAttentionInbox .attention-inbox-count { margin: 3px 0 8px; color: var(--muted); font-size: var(--text-xs, 0.75rem); }
|
|
44
|
+
#shellAttentionInbox .attention-inbox-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
|
|
45
|
+
#shellAttentionInbox .attention-inbox-item { display: block; width: 100%; text-align: left; padding: 10px; border: 1px solid var(--border); background: var(--panel); overflow-wrap: anywhere; white-space: normal; }
|
|
46
|
+
#shellAttentionInbox .attention-inbox-item:hover:not(:disabled) { background: var(--panel-2); }
|
|
47
|
+
#shellAttentionInbox .attention-inbox-item-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; font-weight: 550; }
|
|
48
|
+
#shellAttentionInbox .attention-inbox-item-detail { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; margin-top: 3px; color: var(--muted); font-size: var(--text-xs, 0.75rem); }
|
|
49
|
+
#shellAttentionInbox .attention-inbox-item-status { display: block; margin-top: 5px; color: var(--accent-2, var(--accent)); font-size: var(--text-xs, 0.75rem); }
|
|
50
|
+
#shellAttentionInbox .attention-inbox-blocked .attention-inbox-item-status { color: var(--warning); }
|
|
51
|
+
#shellAttentionInbox :is(.attention-inbox-empty, .attention-inbox-placeholder) { margin: 8px 0 0; color: var(--muted); overflow-wrap: anywhere; }
|
|
52
|
+
#shellAttentionInbox .attention-inbox-empty { padding-top: 8px; }
|
|
53
|
+
#shellAttentionInbox .attention-inbox-footer { flex-shrink: 0; padding: 10px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: var(--text-xs, 0.75rem); overflow-wrap: anywhere; }
|
|
54
|
+
|
|
55
|
+
@media (max-width: 600px) {
|
|
56
|
+
#shellAttentionInbox { width: calc(100% - 16px); max-height: calc(100dvh - 16px); }
|
|
57
|
+
#shellAttentionInbox .attention-inbox-header { padding: 10px 12px 4px; }
|
|
58
|
+
#shellAttentionInbox :is(.attention-inbox-summary, .attention-inbox-run-controls:not(:empty), .attention-inbox-body, .attention-inbox-footer) { padding-inline: 12px; }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@media (forced-colors: active) {
|
|
62
|
+
#shellAttentionInbox {
|
|
63
|
+
--bg: Canvas;
|
|
64
|
+
--panel: Canvas;
|
|
65
|
+
--panel-2: Canvas;
|
|
66
|
+
--text: CanvasText;
|
|
67
|
+
--muted: CanvasText;
|
|
68
|
+
--accent-2: LinkText;
|
|
69
|
+
--warning: CanvasText;
|
|
70
|
+
--border: CanvasText;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/** Render caller-owned activity; dispatch, target validation and seen state belong to the parent. */
|
|
2
|
+
export function createAttentionInbox({ document, onSelect, onClose }) {
|
|
3
|
+
const node = (tag, className, text) => {
|
|
4
|
+
const element = document.createElement(tag);
|
|
5
|
+
if (className) element.className = className;
|
|
6
|
+
if (text !== undefined) element.textContent = text;
|
|
7
|
+
return element;
|
|
8
|
+
};
|
|
9
|
+
const element = node('dialog');
|
|
10
|
+
element.id = 'shellAttentionInbox';
|
|
11
|
+
element.setAttribute('aria-labelledby', 'shellAttentionInboxTitle');
|
|
12
|
+
const header = node('header', 'attention-inbox-header');
|
|
13
|
+
const heading = node('h2', '', 'Attention');
|
|
14
|
+
heading.id = 'shellAttentionInboxTitle';
|
|
15
|
+
const closeButton = node('button', 'attention-inbox-close', 'Close');
|
|
16
|
+
closeButton.type = 'button';
|
|
17
|
+
closeButton.autofocus = true;
|
|
18
|
+
closeButton.setAttribute('aria-label', 'Close attention inbox');
|
|
19
|
+
header.append(heading, closeButton);
|
|
20
|
+
const summary = node('p', 'attention-inbox-summary');
|
|
21
|
+
summary.setAttribute('role', 'status');
|
|
22
|
+
summary.setAttribute('aria-atomic', 'true');
|
|
23
|
+
const runControls = node('div', 'attention-inbox-run-controls');
|
|
24
|
+
runControls.setAttribute('role', 'group');
|
|
25
|
+
runControls.setAttribute('aria-label', 'Run controls');
|
|
26
|
+
const body = node('div', 'attention-inbox-body');
|
|
27
|
+
const empty = node('p', 'attention-inbox-empty', 'No activity to show. Decisions, running work and finished work will appear here.');
|
|
28
|
+
body.append(empty);
|
|
29
|
+
const sections = new Map();
|
|
30
|
+
for (const [state, label, emptyText] of [
|
|
31
|
+
['blocked', 'Needs your decision', 'No decisions waiting.'],
|
|
32
|
+
['working', 'Running', 'Nothing running.'],
|
|
33
|
+
['done', 'Finished', 'No finished work.'],
|
|
34
|
+
]) {
|
|
35
|
+
const section = node('section', `attention-inbox-section attention-inbox-${state}`);
|
|
36
|
+
const title = node('h3', 'attention-inbox-section-title', label);
|
|
37
|
+
title.id = `shellAttentionInbox-${state}`;
|
|
38
|
+
section.setAttribute('aria-labelledby', title.id);
|
|
39
|
+
const count = node('p', 'attention-inbox-count');
|
|
40
|
+
const list = node('ul', 'attention-inbox-list');
|
|
41
|
+
const placeholder = node('p', 'attention-inbox-placeholder', emptyText);
|
|
42
|
+
section.append(title, count, list, placeholder);
|
|
43
|
+
sections.set(state, { section, count, list, placeholder });
|
|
44
|
+
body.append(section);
|
|
45
|
+
}
|
|
46
|
+
const footer = node('footer', 'attention-inbox-footer', 'Select an item to open it. Esc to close.');
|
|
47
|
+
element.append(header, summary, runControls, body, footer);
|
|
48
|
+
|
|
49
|
+
let disposed = false;
|
|
50
|
+
let closePending = false;
|
|
51
|
+
let opener = null;
|
|
52
|
+
const rows = new Map();
|
|
53
|
+
const plural = (count, word) => `${count} ${word}${count === 1 ? '' : 's'}`;
|
|
54
|
+
const decisionCount = (item) => Number.isSafeInteger(item.decisionCount) && item.decisionCount > 0 ? item.decisionCount : 0;
|
|
55
|
+
const unavailable = (item) => item.disabled === true || item.available === false;
|
|
56
|
+
|
|
57
|
+
function restoreFocus(trigger) {
|
|
58
|
+
if (!trigger?.isConnected || typeof trigger.focus !== 'function' || trigger.matches(':disabled')
|
|
59
|
+
|| trigger.closest('[hidden], [inert]')
|
|
60
|
+
|| !trigger.checkVisibility({ checkOpacity: true, checkVisibilityCSS: true })) return;
|
|
61
|
+
// A still-open nested modal owns focus, even when this inbox is closed underneath it.
|
|
62
|
+
if (document.querySelector('dialog:modal')) {
|
|
63
|
+
const activeModal = document.activeElement?.closest('dialog:modal');
|
|
64
|
+
if (!activeModal?.contains(trigger)) return;
|
|
65
|
+
}
|
|
66
|
+
trigger.focus({ preventScroll: true });
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function finishClose() {
|
|
70
|
+
if (!closePending) return;
|
|
71
|
+
closePending = false;
|
|
72
|
+
const trigger = opener;
|
|
73
|
+
opener = null;
|
|
74
|
+
restoreFocus(trigger);
|
|
75
|
+
onClose?.();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function close() {
|
|
79
|
+
if (disposed) return;
|
|
80
|
+
if (element.open) element.close();
|
|
81
|
+
finishClose();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function handleNativeClose(event) {
|
|
85
|
+
if (event.target === element && !element.open) finishClose();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function handleCancel(event) {
|
|
89
|
+
if (event.target !== element) return;
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
close();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function handleSelect(event) {
|
|
95
|
+
const control = event.target.closest?.('.attention-inbox-item');
|
|
96
|
+
if (disposed || !element.open || !control || control.disabled) return;
|
|
97
|
+
const row = rows.get(control.dataset.itemKey);
|
|
98
|
+
if (!row || row.control !== control || !element.contains(control) || unavailable(row.item)) return;
|
|
99
|
+
onSelect?.(row.item);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function createRow(key) {
|
|
103
|
+
const row = node('li', 'attention-inbox-row');
|
|
104
|
+
const control = node('button', 'attention-inbox-item');
|
|
105
|
+
control.type = 'button';
|
|
106
|
+
control.dataset.itemKey = key;
|
|
107
|
+
const title = node('span', 'attention-inbox-item-title');
|
|
108
|
+
const detail = node('span', 'attention-inbox-item-detail');
|
|
109
|
+
const status = node('span', 'attention-inbox-item-status');
|
|
110
|
+
control.append(title, detail, status);
|
|
111
|
+
row.append(control);
|
|
112
|
+
return { row, control, title, detail, status, item: null };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function update({ items } = {}) {
|
|
116
|
+
if (disposed || items === undefined) return;
|
|
117
|
+
const active = document.activeElement;
|
|
118
|
+
const oldRows = [...rows.values()];
|
|
119
|
+
const focusedRow = oldRows.find((row) => row.control === active);
|
|
120
|
+
const nextRows = new Map();
|
|
121
|
+
const groups = new Map([...sections.keys()].map((state) => [state, []]));
|
|
122
|
+
for (const item of items) {
|
|
123
|
+
if (!groups.has(item.state)) continue;
|
|
124
|
+
// IDs are scoped to their originating tab, not the currently selected tab.
|
|
125
|
+
const key = JSON.stringify([item.tabId, item.id]);
|
|
126
|
+
if (nextRows.has(key)) continue;
|
|
127
|
+
const row = rows.get(key) ?? createRow(key);
|
|
128
|
+
row.item = item;
|
|
129
|
+
row.title.textContent = item.title;
|
|
130
|
+
row.detail.textContent = item.detail ?? '';
|
|
131
|
+
row.detail.hidden = !row.detail.textContent;
|
|
132
|
+
row.status.textContent = item.state === 'blocked' ? plural(decisionCount(item), 'decision')
|
|
133
|
+
: item.state === 'working' ? 'Running' : 'Finished';
|
|
134
|
+
row.control.disabled = unavailable(item);
|
|
135
|
+
nextRows.set(key, row);
|
|
136
|
+
groups.get(item.state).push(row);
|
|
137
|
+
}
|
|
138
|
+
for (const [key, row] of rows) {
|
|
139
|
+
if (!nextRows.has(key)) row.row.remove();
|
|
140
|
+
}
|
|
141
|
+
rows.clear();
|
|
142
|
+
for (const [key, row] of nextRows) rows.set(key, row);
|
|
143
|
+
const decisions = groups.get('blocked').reduce((total, row) => total + decisionCount(row.item), 0);
|
|
144
|
+
summary.textContent = `${plural(decisions, 'decision')} · ${groups.get('working').length} running · ${groups.get('done').length} finished`;
|
|
145
|
+
empty.hidden = rows.size > 0;
|
|
146
|
+
for (const [state, section] of sections) {
|
|
147
|
+
const group = groups.get(state);
|
|
148
|
+
section.count.textContent = state === 'blocked'
|
|
149
|
+
? `${plural(decisions, 'decision')} · ${plural(group.length, 'item')}` : plural(group.length, 'item');
|
|
150
|
+
section.placeholder.hidden = group.length > 0;
|
|
151
|
+
for (const [index, row] of group.entries()) {
|
|
152
|
+
if (section.list.children[index] !== row.row) section.list.insertBefore(row.row, section.list.children[index] ?? null);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (focusedRow && element.open) {
|
|
156
|
+
const ordered = [...groups.values()].flat();
|
|
157
|
+
const retained = ordered.includes(focusedRow) && !focusedRow.control.disabled ? focusedRow : null;
|
|
158
|
+
const fallback = ordered.slice(oldRows.indexOf(focusedRow)).find((row) => !row.control.disabled)
|
|
159
|
+
?? ordered.findLast((row) => !row.control.disabled);
|
|
160
|
+
(retained?.control ?? fallback?.control ?? closeButton).focus({ preventScroll: true });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function open(snapshot = {}, trigger = document.activeElement) {
|
|
165
|
+
if (disposed) return;
|
|
166
|
+
if (element.open) {
|
|
167
|
+
update(snapshot);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
// Native close events are queued; finish the previous lifetime before reopening.
|
|
171
|
+
finishClose();
|
|
172
|
+
if (disposed || element.open) return;
|
|
173
|
+
update(snapshot);
|
|
174
|
+
opener = trigger;
|
|
175
|
+
element.showModal();
|
|
176
|
+
closePending = true;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function dispose() {
|
|
180
|
+
if (disposed) return;
|
|
181
|
+
disposed = true;
|
|
182
|
+
if (element.open) element.close();
|
|
183
|
+
finishClose();
|
|
184
|
+
closeButton.removeEventListener('click', close);
|
|
185
|
+
element.removeEventListener('close', handleNativeClose);
|
|
186
|
+
element.removeEventListener('cancel', handleCancel);
|
|
187
|
+
element.removeEventListener('click', handleSelect);
|
|
188
|
+
element.remove();
|
|
189
|
+
rows.clear();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
closeButton.addEventListener('click', close);
|
|
193
|
+
element.addEventListener('close', handleNativeClose);
|
|
194
|
+
element.addEventListener('cancel', handleCancel);
|
|
195
|
+
element.addEventListener('click', handleSelect);
|
|
196
|
+
update({ items: [] });
|
|
197
|
+
return { element, slots: { runControls }, open, update, close, dispose };
|
|
198
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#shellContextActions {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
width: min(440px, calc(100% - 24px));
|
|
4
|
+
max-width: none;
|
|
5
|
+
max-height: min(620px, calc(100dvh - 24px));
|
|
6
|
+
padding: 0;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
color: var(--text);
|
|
9
|
+
background: var(--bg);
|
|
10
|
+
border: 1px solid var(--border);
|
|
11
|
+
border-radius: 10px;
|
|
12
|
+
box-shadow: 0 24px 90px var(--shadow, #0008);
|
|
13
|
+
font: inherit;
|
|
14
|
+
font-size: var(--text-sm, 0.875rem);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#shellContextActions[open] { display: flex; flex-direction: column; }
|
|
18
|
+
#shellContextActions::backdrop { background: #080810aa; backdrop-filter: blur(3px); }
|
|
19
|
+
#shellContextActions * { box-sizing: border-box; min-width: 0; }
|
|
20
|
+
#shellContextActions [hidden] { display: none !important; }
|
|
21
|
+
#shellContextActions button { font: inherit; color: inherit; cursor: pointer; border-radius: 5px; box-shadow: none; transform: none; transition: none; }
|
|
22
|
+
#shellContextActions button:disabled { cursor: default; opacity: 0.65; }
|
|
23
|
+
#shellContextActions button:focus-visible { outline: 2px solid var(--accent-2, var(--accent)); outline-offset: -2px; }
|
|
24
|
+
#shellContextActions .context-actions-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px 8px; flex-shrink: 0; }
|
|
25
|
+
#shellContextActions h2 { margin: 0; font-size: 1rem; font-weight: 600; overflow-wrap: anywhere; max-height: 18dvh; overflow: auto; }
|
|
26
|
+
#shellContextActions .context-actions-close { flex-shrink: 0; padding: 6px 9px; border: 1px solid var(--border); background: var(--panel); }
|
|
27
|
+
#shellContextActions .context-actions-context { margin: 0; padding: 0 16px 10px; color: var(--muted); overflow-wrap: anywhere; max-height: 16dvh; overflow: auto; flex-shrink: 0; }
|
|
28
|
+
#shellContextActions .context-actions-run-controls { flex-shrink: 0; max-height: 25dvh; overflow: auto; overflow-wrap: anywhere; }
|
|
29
|
+
#shellContextActions .context-actions-run-controls:not(:empty) { padding: 8px 16px; border-top: 1px solid var(--border); }
|
|
30
|
+
#shellContextActions .context-actions-body { min-height: 0; overflow: auto; overscroll-behavior: contain; border-top: 1px solid var(--border); padding: 8px; }
|
|
31
|
+
#shellContextActions .context-actions-list { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; }
|
|
32
|
+
#shellContextActions .context-actions-row { border-radius: 5px; }
|
|
33
|
+
#shellContextActions .context-actions-row:is(:hover, :focus-within) { background: var(--panel-2); }
|
|
34
|
+
#shellContextActions .context-actions-action { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 8px; overflow-wrap: anywhere; }
|
|
35
|
+
#shellContextActions .context-actions-label { display: block; font-weight: 550; }
|
|
36
|
+
#shellContextActions .context-actions-description { display: block; margin-top: 3px; color: var(--muted); font-size: var(--text-xs, 0.75rem); }
|
|
37
|
+
#shellContextActions .context-actions-reason { margin: 0 8px 10px; color: var(--warning); font-size: var(--text-xs, 0.75rem); overflow-wrap: anywhere; }
|
|
38
|
+
#shellContextActions .context-actions-empty { margin: 8px; color: var(--muted); overflow-wrap: anywhere; }
|
|
39
|
+
#shellContextActions .context-actions-footer { padding: 10px 16px; border-top: 1px solid var(--border); flex-shrink: 0; }
|
|
40
|
+
#shellContextActions .context-actions-more { width: 100%; padding: 9px; text-align: left; border: 1px solid var(--border); background: var(--panel); }
|
|
41
|
+
|
|
42
|
+
@media (max-width: 600px) {
|
|
43
|
+
#shellContextActions { width: calc(100% - 16px); max-height: calc(100dvh - 16px); }
|
|
44
|
+
#shellContextActions .context-actions-header { padding: 10px 12px 8px; }
|
|
45
|
+
#shellContextActions .context-actions-context { padding-inline: 12px; }
|
|
46
|
+
#shellContextActions .context-actions-footer { padding: 8px 12px; }
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@media (forced-colors: active) {
|
|
50
|
+
#shellContextActions {
|
|
51
|
+
--bg: Canvas;
|
|
52
|
+
--panel: Canvas;
|
|
53
|
+
--panel-2: Canvas;
|
|
54
|
+
--text: CanvasText;
|
|
55
|
+
--muted: CanvasText;
|
|
56
|
+
--accent: LinkText;
|
|
57
|
+
--accent-2: LinkText;
|
|
58
|
+
--warning: CanvasText;
|
|
59
|
+
--border: CanvasText;
|
|
60
|
+
}
|
|
61
|
+
}
|