@firstpick/pi-package-webui 0.11.1 → 0.11.3
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 +322 -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/action-feedback-gutter.spec.mjs +251 -0
- 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,294 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { expect, test } from '@playwright/test';
|
|
3
|
+
|
|
4
|
+
test.use({ video: 'off' });
|
|
5
|
+
if (process.env.PI_WEBUI_TEST_CHROMIUM) {
|
|
6
|
+
test.use({ launchOptions: { executablePath: process.env.PI_WEBUI_TEST_CHROMIUM } });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const sources = new Map(await Promise.all([
|
|
10
|
+
'shell-workspace.mjs', 'shell-navigation-resize.mjs', 'shell-inspector-resize.mjs', 'shell-workspace.css', 'shell-view-host.mjs', 'styles.css',
|
|
11
|
+
].map(async name => [`/${name}`, await readFile(new URL(`../../public/${name}`, import.meta.url), 'utf8')])));
|
|
12
|
+
|
|
13
|
+
const groups = [
|
|
14
|
+
['Work', ['subagents', 'queue', 'progress']],
|
|
15
|
+
['Conversations', ['conversations', 'extensions']],
|
|
16
|
+
['Usage & diagnostics', ['codex-usage', 'claude-usage', 'events']],
|
|
17
|
+
['Session', ['session', 'sampling', 'commands']],
|
|
18
|
+
];
|
|
19
|
+
const topics = [
|
|
20
|
+
{ id: 'subagents', label: 'Agents' }, { id: 'queue', label: 'Queues' }, { id: 'progress', label: 'Progress' },
|
|
21
|
+
{ id: 'conversations', label: 'Conversations' }, { id: 'extensions', label: 'Extensions' },
|
|
22
|
+
{ id: 'codex-usage', label: 'Codex usage' }, { id: 'claude-usage', label: 'Claude usage' }, { id: 'events', label: 'Events' },
|
|
23
|
+
{ id: 'session', label: 'Session' }, { id: 'sampling', label: 'Sampling' }, { id: 'commands', label: 'Commands' },
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
const fixture = `<!doctype html><html lang="en"><head><title>Activity picker component fixture</title>
|
|
27
|
+
<link rel="stylesheet" href="/styles.css"><link rel="stylesheet" href="/shell-workspace.css">
|
|
28
|
+
<style>
|
|
29
|
+
body { height: 100vh; }
|
|
30
|
+
#original { display: none; }
|
|
31
|
+
.fixture-conversation { padding: 24px; }
|
|
32
|
+
.fixture-conversation h1 { font-size: 20px; }
|
|
33
|
+
#draft { width: 100%; height: 80px; }
|
|
34
|
+
#inspectorView { display: grid; gap: 12px; }
|
|
35
|
+
#inspectorView h2 { font-size: 16px; margin: 0; }
|
|
36
|
+
#inspectorView input { width: 100%; min-width: 0; }
|
|
37
|
+
</style></head><body><div id="original">
|
|
38
|
+
<section id="conversationView" class="fixture-conversation"><h1>Activity navigation</h1>
|
|
39
|
+
<p>Inspect work while your conversation stays mounted.</p><label for="draft">Message Pi</label>
|
|
40
|
+
<textarea id="draft">Keep this unfinished prompt.</textarea></section>
|
|
41
|
+
<div id="inspectorView"><h2 id="sectionHeading">Agents</h2><p>Canonical inspector content</p>
|
|
42
|
+
<label for="inspectorDraft">Retained filter</label><input id="inspectorDraft" value="Unfinished filter">
|
|
43
|
+
<button id="canonicalAction">Inspect work</button></div></div>
|
|
44
|
+
<script type="module">
|
|
45
|
+
import { createFocusedWorkspace } from '/shell-workspace.mjs';
|
|
46
|
+
import { createViewHost } from '/shell-view-host.mjs';
|
|
47
|
+
window.topics = ${JSON.stringify(topics)};
|
|
48
|
+
window.projectTopics = [{ id: 'files', label: 'Files' }, { id: 'git', label: 'Changes' },
|
|
49
|
+
{ id: 'runners', label: 'Runners', available: false, unavailableReason: 'Choose a session first' },
|
|
50
|
+
{ id: 'release', label: 'Release' }];
|
|
51
|
+
window.events = [];
|
|
52
|
+
window.activityId = 'subagents';
|
|
53
|
+
window.projectId = 'files';
|
|
54
|
+
window.shell = createFocusedWorkspace({ document,
|
|
55
|
+
onToggleInspector: () => shell.update({ destination: 'conversation', inspectorOpen: true }),
|
|
56
|
+
onNavigate: destination => shell.update({ destination, inspectorTitle: destination === 'activity' ? 'Activity' : 'Project',
|
|
57
|
+
inspector: destination === 'activity' ? activityId : projectId,
|
|
58
|
+
inspectorTopics: destination === 'activity' ? topics : projectTopics }),
|
|
59
|
+
onInspectorSelect: id => {
|
|
60
|
+
events.push(id);
|
|
61
|
+
if (shell.element.dataset.destination === 'activity') activityId = id;
|
|
62
|
+
else projectId = id;
|
|
63
|
+
document.getElementById('sectionHeading').textContent = [...topics, ...projectTopics].find(topic => topic.id === id)?.label || id;
|
|
64
|
+
shell.update({ inspector: id });
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
window.host = createViewHost({ document });
|
|
68
|
+
document.body.append(shell.element);
|
|
69
|
+
host.move(document.getElementById('conversationView'), shell.slots.conversation);
|
|
70
|
+
host.move(document.getElementById('inspectorView'), shell.slots.inspector);
|
|
71
|
+
window.originalContent = shell.slots.inspector.firstChild;
|
|
72
|
+
window.actionClicks = 0;
|
|
73
|
+
document.getElementById('canonicalAction').addEventListener('click', () => actionClicks++);
|
|
74
|
+
shell.update({ destination: 'activity', inspectorTitle: 'Activity', inspector: activityId, inspectorTopics: topics,
|
|
75
|
+
inspectorWidth: 320, title: 'Activity fixture', context: 'Disposable workspace', navCollapsed: true });
|
|
76
|
+
window.ready = true;
|
|
77
|
+
</script></body></html>`;
|
|
78
|
+
|
|
79
|
+
test.beforeEach(async ({ page }) => {
|
|
80
|
+
await page.route('http://workspace.test/**', async route => {
|
|
81
|
+
const pathname = new URL(route.request().url()).pathname;
|
|
82
|
+
const source = sources.get(pathname);
|
|
83
|
+
await route.fulfill({
|
|
84
|
+
status: source || pathname === '/' ? 200 : 404,
|
|
85
|
+
contentType: pathname.endsWith('.mjs') ? 'text/javascript' : pathname.endsWith('.css') ? 'text/css' : 'text/html',
|
|
86
|
+
body: source ?? (pathname === '/' ? fixture : 'Not found'),
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
await page.goto('http://workspace.test/');
|
|
90
|
+
await page.waitForFunction(() => window.ready);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('all grouped sections stay reachable with one callback per selection and labeled canonical content', async ({ page }) => {
|
|
94
|
+
const picker = page.getByRole('combobox', { name: 'Activity section', exact: true });
|
|
95
|
+
await expect(page.locator('.focused-inspector-header select')).toHaveCount(1);
|
|
96
|
+
await expect(page.locator('.focused-inspector-header')).not.toContainText('View');
|
|
97
|
+
await expect(picker).toHaveValue('subagents');
|
|
98
|
+
await expect(page.getByRole('tablist', { name: 'Inspector topics' })).toHaveCount(0);
|
|
99
|
+
await expect(page.getByRole('tabpanel', { name: 'Activity', exact: true })).toBeVisible();
|
|
100
|
+
expect(await picker.locator('optgroup').evaluateAll(nodes => nodes.map(group => [group.label, [...group.children].map(option => option.value)]))).toEqual(groups);
|
|
101
|
+
const selections = [...topics.slice(1), topics[0]];
|
|
102
|
+
for (const topic of selections) {
|
|
103
|
+
await picker.selectOption(topic.id);
|
|
104
|
+
await expect(picker).toHaveValue(topic.id);
|
|
105
|
+
await expect(picker.locator('option:checked')).toHaveText(topic.label);
|
|
106
|
+
await expect(page.getByRole('region', { name: topic.label, exact: true }).locator('#inspectorView')).toBeVisible();
|
|
107
|
+
}
|
|
108
|
+
expect(await page.evaluate(() => events)).toEqual(selections.map(topic => topic.id));
|
|
109
|
+
await page.locator('#canonicalAction').click();
|
|
110
|
+
expect(await page.evaluate(() => ({ same: shell.slots.inspector.firstChild === originalContent, clicks: actionClicks }))).toEqual({ same: true, clicks: 1 });
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test('disabled reasons, fallback and future sections follow the existing topic catalog contract', async ({ page }) => {
|
|
114
|
+
await page.evaluate(() => shell.update({ inspector: 'queue', inspectorTopics: [
|
|
115
|
+
{ id: 'queue', label: 'Queues', available: false, unavailableReason: 'Choose a session first' },
|
|
116
|
+
{ id: 'future/topic', label: '<Future view>' },
|
|
117
|
+
{ id: 'events', label: 'Events' },
|
|
118
|
+
{ id: 'another', label: 'Another view', available: false },
|
|
119
|
+
] }));
|
|
120
|
+
const picker = page.getByRole('combobox', { name: 'Activity section' });
|
|
121
|
+
await expect(picker).toHaveValue('future/topic');
|
|
122
|
+
await expect(picker.locator('option[value="queue"]')).toHaveJSProperty('disabled', true);
|
|
123
|
+
await expect(picker.locator('option[value="queue"]')).toHaveText('Queues (Choose a session first)');
|
|
124
|
+
await expect(picker.locator('option[value="queue"]')).toHaveAttribute('title', 'Choose a session first');
|
|
125
|
+
await expect(picker.locator('option[value="another"]')).toHaveText('Another view (Unavailable)');
|
|
126
|
+
expect(await picker.locator('optgroup').evaluateAll(nodes => nodes.map(group => [group.label, [...group.children].map(option => option.value)]))).toEqual([
|
|
127
|
+
['Work', ['queue']], ['Usage & diagnostics', ['events']], ['More', ['future/topic', 'another']],
|
|
128
|
+
]);
|
|
129
|
+
await expect(page.getByRole('region', { name: '<Future view>', exact: true })).toBeVisible();
|
|
130
|
+
await expect(picker.locator('img')).toHaveCount(0);
|
|
131
|
+
expect(await page.evaluate(() => events)).toEqual([]);
|
|
132
|
+
await picker.selectOption('events');
|
|
133
|
+
await picker.selectOption('future/topic');
|
|
134
|
+
expect(await page.evaluate(() => events)).toEqual(['events', 'future/topic']);
|
|
135
|
+
await page.evaluate(() => shell.update({ inspector: 'missing' }));
|
|
136
|
+
await expect(picker).toHaveValue('future/topic');
|
|
137
|
+
expect(await page.evaluate(() => events)).toEqual(['events', 'future/topic']);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
test('repeated snapshots retain picker, option identity and focus while applying the latest catalog', async ({ page }) => {
|
|
141
|
+
const picker = page.getByRole('combobox', { name: 'Activity section' });
|
|
142
|
+
await picker.selectOption('queue');
|
|
143
|
+
await picker.focus();
|
|
144
|
+
const result = await page.evaluate(() => {
|
|
145
|
+
const select = document.activeElement;
|
|
146
|
+
const options = [...select.options];
|
|
147
|
+
const groups = [...select.children];
|
|
148
|
+
window.retainedOptions = { queue: options.find(option => option.value === 'queue'), events: options.find(option => option.value === 'events') };
|
|
149
|
+
const focused = [];
|
|
150
|
+
for (let index = 0; index < 12; index++) {
|
|
151
|
+
shell.update({ title: 'Updated status ' + index, inspectorTopics: topics.map(topic => ({ ...topic })) });
|
|
152
|
+
focused.push(document.activeElement === select);
|
|
153
|
+
}
|
|
154
|
+
return { focused, sameSelect: select === document.querySelector('.focused-inspector-section'),
|
|
155
|
+
sameOptions: options.every((option, index) => option === select.options[index]),
|
|
156
|
+
sameGroups: groups.every((group, index) => group === select.children[index]), events };
|
|
157
|
+
});
|
|
158
|
+
expect(result).toEqual({ focused: Array(12).fill(true), sameSelect: true, sameOptions: true, sameGroups: true, events: ['queue'] });
|
|
159
|
+
await page.evaluate(() => shell.update({ inspector: 'events', inspectorTopics: [
|
|
160
|
+
{ id: 'events', label: 'Events (3)' }, { id: 'future', label: 'Future view' },
|
|
161
|
+
{ id: 'queue', label: 'Queues (2)', available: false, unavailableReason: 'Session disconnected' },
|
|
162
|
+
] }));
|
|
163
|
+
await expect(picker).toBeFocused();
|
|
164
|
+
await expect(picker).toHaveValue('events');
|
|
165
|
+
await expect(picker.locator('option:checked')).toHaveText('Events (3)');
|
|
166
|
+
expect(await picker.locator('option[value="events"]').evaluate(option => option === retainedOptions.events)).toBe(true);
|
|
167
|
+
expect(await picker.locator('option[value="queue"]').evaluate(option => option === retainedOptions.queue)).toBe(true);
|
|
168
|
+
await expect(picker.locator('option')).toHaveCount(3);
|
|
169
|
+
await expect(page.getByRole('region', { name: 'Events (3)', exact: true })).toBeVisible();
|
|
170
|
+
expect(await page.evaluate(() => events)).toEqual(['queue']);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
test('native keyboard navigation skips unavailable sections and releases focus with Tab', async ({ page }) => {
|
|
174
|
+
await page.evaluate(() => shell.update({ inspectorTopics: topics.map(topic => topic.id === 'queue'
|
|
175
|
+
? { ...topic, available: false, unavailableReason: 'Choose a session first' } : topic) }));
|
|
176
|
+
const picker = page.getByRole('combobox', { name: 'Activity section' });
|
|
177
|
+
await picker.focus();
|
|
178
|
+
await page.keyboard.press('ArrowDown');
|
|
179
|
+
await expect(picker).toHaveValue('progress');
|
|
180
|
+
await page.keyboard.press('End');
|
|
181
|
+
await expect(picker).toHaveValue('commands');
|
|
182
|
+
await page.keyboard.press('Home');
|
|
183
|
+
await expect(picker).toHaveValue('subagents');
|
|
184
|
+
expect(await page.evaluate(() => events)).toEqual(['progress', 'commands', 'subagents']);
|
|
185
|
+
await page.keyboard.press('Tab');
|
|
186
|
+
await expect(page.locator('#inspectorDraft')).toBeFocused();
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
test('empty and unavailable catalogs do not synthesize a selection or replace content', async ({ page }) => {
|
|
190
|
+
await page.evaluate(() => shell.update({ inspectorTopics: [
|
|
191
|
+
{ id: 'queue', label: 'Queues', available: false, unavailableReason: 'No session' },
|
|
192
|
+
{ id: 'events', label: 'Events', available: false },
|
|
193
|
+
] }));
|
|
194
|
+
const picker = page.getByRole('combobox', { name: 'Activity section' });
|
|
195
|
+
await expect(picker).toBeDisabled();
|
|
196
|
+
await expect(picker).toHaveValue('');
|
|
197
|
+
await expect(page.getByRole('region', { name: 'Activity', exact: true })).toBeVisible();
|
|
198
|
+
await page.evaluate(() => shell.update({ inspectorTopics: [] }));
|
|
199
|
+
await expect(picker).toBeHidden();
|
|
200
|
+
await expect(picker.locator('option')).toHaveCount(0);
|
|
201
|
+
await expect(page.getByRole('tabpanel', { name: 'Activity', exact: true })).toBeVisible();
|
|
202
|
+
await expect(page.getByRole('region', { name: 'Activity', exact: true }).locator('#inspectorDraft')).toHaveValue('Unfinished filter');
|
|
203
|
+
await page.evaluate(() => shell.update({ inspectorTopics: topics, inspector: 'queue' }));
|
|
204
|
+
await expect(picker).toBeEnabled();
|
|
205
|
+
await expect(picker).toHaveValue('queue');
|
|
206
|
+
expect(await page.evaluate(() => events)).toEqual([]);
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
test('destination switches restore Activity selection and Project section keyboard behavior', async ({ page }) => {
|
|
210
|
+
const picker = page.getByRole('combobox', { name: 'Activity section' });
|
|
211
|
+
await picker.selectOption('queue');
|
|
212
|
+
await page.locator('#inspectorDraft').fill('Keep this filter');
|
|
213
|
+
await page.getByRole('tab', { name: 'Project', exact: true }).click();
|
|
214
|
+
await expect(picker).toHaveCount(0);
|
|
215
|
+
await expect(page.getByRole('tablist', { name: 'Inspector destinations' })).toBeVisible();
|
|
216
|
+
const projectPicker = page.getByRole('combobox', { name: 'Project section' });
|
|
217
|
+
await expect(projectPicker).toHaveValue('files');
|
|
218
|
+
await projectPicker.focus();
|
|
219
|
+
await page.keyboard.press('ArrowDown');
|
|
220
|
+
await expect(projectPicker).toHaveValue('git');
|
|
221
|
+
await expect(page.getByRole('region', { name: 'Changes', exact: true })).toBeVisible();
|
|
222
|
+
await page.keyboard.press('ArrowDown');
|
|
223
|
+
await expect(projectPicker).toHaveValue('release');
|
|
224
|
+
await expect(projectPicker.locator('option[value="runners"]')).toBeDisabled();
|
|
225
|
+
await page.getByRole('tab', { name: 'Activity', exact: true }).click();
|
|
226
|
+
await expect(picker).toBeVisible();
|
|
227
|
+
await expect(picker).toHaveValue('queue');
|
|
228
|
+
await expect(page.getByRole('region', { name: 'Queues', exact: true })).toBeVisible();
|
|
229
|
+
await expect(page.getByRole('tabpanel', { name: 'Activity', exact: true })).toBeVisible();
|
|
230
|
+
await expect(page.getByRole('tab')).toHaveCount(2);
|
|
231
|
+
await expect(page.locator('#inspectorDraft')).toHaveValue('Keep this filter');
|
|
232
|
+
await page.evaluate(() => shell.update({ destination: 'settings' }));
|
|
233
|
+
await expect(picker).toBeHidden();
|
|
234
|
+
await page.getByRole('button', { name: 'Inspector', exact: true }).click();
|
|
235
|
+
await page.getByRole('tab', { name: 'Activity', exact: true }).click();
|
|
236
|
+
await expect(picker).toHaveValue('queue');
|
|
237
|
+
expect(await page.evaluate(() => shell.slots.inspector.firstChild === originalContent)).toBe(true);
|
|
238
|
+
expect(await page.evaluate(() => events)).toEqual(['queue', 'git', 'release']);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
test('disposal removes select listeners and stops snapshot updates', async ({ page }) => {
|
|
242
|
+
const result = await page.evaluate(() => {
|
|
243
|
+
const select = document.querySelector('.focused-inspector-section');
|
|
244
|
+
shell.dispose();
|
|
245
|
+
shell.dispose();
|
|
246
|
+
select.value = 'queue';
|
|
247
|
+
select.dispatchEvent(new Event('change', { bubbles: true }));
|
|
248
|
+
shell.update({ inspector: 'events' });
|
|
249
|
+
return { events, selected: select.value, sameContent: shell.slots.inspector.firstChild === originalContent };
|
|
250
|
+
});
|
|
251
|
+
expect(result).toEqual({ events: [], selected: 'queue', sameContent: true });
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
for (const width of [240, 320]) {
|
|
255
|
+
for (const theme of ['dark', 'light']) {
|
|
256
|
+
test(`${width}px inspector in ${theme} keeps the full-width picker visible without horizontal scrolling`, async ({ page }, testInfo) => {
|
|
257
|
+
await page.setViewportSize({ width: 1100, height: 750 });
|
|
258
|
+
await page.evaluate(({ width, theme }) => {
|
|
259
|
+
if (theme === 'light') {
|
|
260
|
+
const tokens = {
|
|
261
|
+
'--theme-color-scheme': 'light', '--bg': '#eff1f5', '--panel': '#eff1f5', '--panel-2': '#ccd0da', '--panel-3': '#e6e9ef',
|
|
262
|
+
'--text': '#4c4f69', '--muted': '#5c5f77', '--accent': '#8839ef', '--border': '#bcc0cc',
|
|
263
|
+
'--ctp-text': '#4c4f69', '--ctp-overlay': '#8c8fa1', '--ctp-base': '#eff1f5', '--ctp-mantle': '#e6e9ef',
|
|
264
|
+
'--ctp-mauve': '#8839ef', '--ctp-teal': '#179299', '--ctp-pink': '#ea76cb',
|
|
265
|
+
'--ctp-crust-rgb': '220, 224, 232', '--ctp-surface-rgb': '204, 208, 218', '--ctp-mantle-rgb': '230, 233, 239',
|
|
266
|
+
};
|
|
267
|
+
for (const [name, value] of Object.entries(tokens)) document.documentElement.style.setProperty(name, value);
|
|
268
|
+
}
|
|
269
|
+
shell.update({ inspectorWidth: width });
|
|
270
|
+
}, { width, theme });
|
|
271
|
+
const picker = page.getByRole('combobox', { name: 'Activity section' });
|
|
272
|
+
await picker.selectOption('claude-usage');
|
|
273
|
+
await picker.focus();
|
|
274
|
+
await expect(picker).toHaveValue('claude-usage');
|
|
275
|
+
await expect(picker.locator('option:checked')).toHaveText('Claude usage');
|
|
276
|
+
const geometry = await picker.evaluate(select => {
|
|
277
|
+
const header = select.parentElement;
|
|
278
|
+
const inspector = header.closest('.focused-inspector');
|
|
279
|
+
return { inspectorWidth: inspector.getBoundingClientRect().width,
|
|
280
|
+
selectWidth: select.getBoundingClientRect().width, availableWidth: header.clientWidth - 16,
|
|
281
|
+
headerOverflow: header.scrollWidth > header.clientWidth,
|
|
282
|
+
selectOverflow: select.scrollWidth > select.clientWidth,
|
|
283
|
+
inspectorOverflow: inspector.scrollWidth > inspector.clientWidth,
|
|
284
|
+
pageOverflow: document.documentElement.scrollWidth > innerWidth,
|
|
285
|
+
outline: getComputedStyle(select).outlineWidth };
|
|
286
|
+
});
|
|
287
|
+
expect(geometry).toEqual({ inspectorWidth: width, selectWidth: width - 17, availableWidth: width - 17,
|
|
288
|
+
headerOverflow: false, selectOverflow: false, inspectorOverflow: false, pageOverflow: false, outline: '2px' });
|
|
289
|
+
const screenshot = testInfo.outputPath(`activity-picker-${width}-${theme}.png`);
|
|
290
|
+
await page.screenshot({ path: screenshot });
|
|
291
|
+
await testInfo.attach(`Activity picker ${width}px ${theme}`, { path: screenshot, contentType: 'image/png' });
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { expect, test } from "@playwright/test";
|
|
3
|
+
|
|
4
|
+
const source = await readFile(new URL("../../public/activity-todo-view.mjs", import.meta.url), "utf8");
|
|
5
|
+
const css = await readFile(new URL("../../public/styles.css", import.meta.url), "utf8");
|
|
6
|
+
test.use({ video: "off", viewport: { width: 600, height: 500 } });
|
|
7
|
+
|
|
8
|
+
test.beforeEach(async ({ page }) => {
|
|
9
|
+
await page.route("http://todo.test/**", route => {
|
|
10
|
+
const path = new URL(route.request().url()).pathname;
|
|
11
|
+
if (path === "/view.mjs") return route.fulfill({ contentType: "text/javascript", body: source });
|
|
12
|
+
if (path === "/styles.css") return route.fulfill({ contentType: "text/css", body: css });
|
|
13
|
+
return route.fulfill({ contentType: "text/html", body: '<!doctype html><html lang="en"><link rel="stylesheet" href="/styles.css"><title>Todo progress</title><main style="max-width:350px;padding:16px"></main></html>' });
|
|
14
|
+
});
|
|
15
|
+
await page.goto("http://todo.test/");
|
|
16
|
+
await page.evaluate(async () => {
|
|
17
|
+
const { createActivityTodoView } = await import("/view.mjs");
|
|
18
|
+
window.view = createActivityTodoView({ document,
|
|
19
|
+
stripAnsi: value => String(value).replace(/\x1b\[[0-9;]*m/g, ""),
|
|
20
|
+
parseItem(line) {
|
|
21
|
+
const match = line.match(/^\[( |x|X|-)\]\s+(.+)$/);
|
|
22
|
+
return match ? { status: match[1].toLowerCase() === "x" ? "done" : match[1] === "-" ? "partial" : "todo", text: match[2] } : null;
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
window.lines = ["\x1b[32mGoal: Ship safely\x1b[0m", "Todo 1/3 done, 1 partial", "[x] Saved", "[-] Verify", "[ ] <img src=x onerror=alert(1)>", "Scroll for more"];
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("derived todo keeps goal, partial state and safe item text without another state owner", async ({ page }, testInfo) => {
|
|
30
|
+
const parsed = await page.evaluate(() => view.parse(lines));
|
|
31
|
+
expect(parsed).toMatchObject({ goal: "Ship safely", done: 1, total: 3, partial: 1, footer: "Scroll for more" });
|
|
32
|
+
expect(parsed.items.map(item => item.status)).toEqual(["done", "partial", "todo"]);
|
|
33
|
+
await page.evaluate(() => {
|
|
34
|
+
window.expansion = [];
|
|
35
|
+
document.querySelector("main").append(view.render(lines, { onExpandedChange: open => expansion.push(open) }));
|
|
36
|
+
});
|
|
37
|
+
const details = page.getByLabel("Todo progress");
|
|
38
|
+
await expect(details).not.toHaveAttribute("open");
|
|
39
|
+
await details.locator("summary").click();
|
|
40
|
+
await expect(details).toHaveAttribute("open");
|
|
41
|
+
await expect(details.locator(".todo-widget-goal")).toHaveText("Goal: Ship safely");
|
|
42
|
+
await expect(details.locator(".todo-widget-item")).toHaveCount(3);
|
|
43
|
+
await expect(details.locator("img, script")).toHaveCount(0);
|
|
44
|
+
await expect(details).toContainText("<img src=x onerror=alert(1)>");
|
|
45
|
+
expect(await page.evaluate(() => expansion.at(-1))).toBe(true);
|
|
46
|
+
await page.screenshot({ path: testInfo.outputPath("progress-todo.png") });
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test("caller-owned expansion survives replacement and invalid headers produce no widget", async ({ page }) => {
|
|
50
|
+
const result = await page.evaluate(() => {
|
|
51
|
+
const firstOwner = { expanded: true };
|
|
52
|
+
const otherOwner = { expanded: false };
|
|
53
|
+
const first = view.render(lines, { expanded: firstOwner.expanded, onExpandedChange: open => { firstOwner.expanded = open; } });
|
|
54
|
+
document.querySelector("main").append(first);
|
|
55
|
+
const second = view.render(lines, { expanded: otherOwner.expanded, onExpandedChange: open => { otherOwner.expanded = open; } });
|
|
56
|
+
first.replaceWith(second);
|
|
57
|
+
return { first: first.open, second: second.open, invalid: view.render(["Goal: no progress header"]), empty: view.parse([]) };
|
|
58
|
+
});
|
|
59
|
+
expect(result).toEqual({ first: true, second: false, invalid: null, empty: null });
|
|
60
|
+
});
|