@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
|
@@ -4,6 +4,8 @@ import { dirname, join } from "node:path";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import vm from "node:vm";
|
|
6
6
|
|
|
7
|
+
const fileService = await readFile(new URL("../lib/server/workspace-files.mjs", import.meta.url), "utf8");
|
|
8
|
+
const fileOwner = await readFile(new URL("../public/project-file-viewer-controller.mjs", import.meta.url), "utf8");
|
|
7
9
|
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
8
10
|
const [app, css, html, server, readme, technical, development, serviceWorker] = await Promise.all([
|
|
9
11
|
readFile(join(root, "public", "app.js"), "utf8"),
|
|
@@ -23,9 +25,11 @@ function sourceBetween(source, startMarker, endMarker, label) {
|
|
|
23
25
|
return source.slice(start, end);
|
|
24
26
|
}
|
|
25
27
|
|
|
28
|
+
assert.match(server, /createWorkspaceFilesService\(\{/, "the server should bind the Files owner");
|
|
29
|
+
|
|
26
30
|
const imageHelpers = sourceBetween(app, "const FILE_VIEWER_IMAGE_MIME_TYPES", "\n// Changes mode only exists", "image data helper");
|
|
27
|
-
const modeSource = sourceBetween(
|
|
28
|
-
const openSource = sourceBetween(
|
|
31
|
+
const modeSource = sourceBetween(fileOwner, "export function resolveFileViewerMode(", "\n/**", "image-aware mode resolver").replace("export ", "");
|
|
32
|
+
const openSource = sourceBetween(fileOwner, " async function open(", "\n async function openReport(", "file open flow");
|
|
29
33
|
const uiSource = sourceBetween(app, "function updateFileViewerUi(", "\nconst FILE_VIEWER_SEARCH_MATCH_LIMIT", "file viewer UI renderer");
|
|
30
34
|
|
|
31
35
|
const helperResults = JSON.parse(vm.runInNewContext(`${imageHelpers}\nJSON.stringify([
|
|
@@ -43,18 +47,18 @@ const modes = JSON.parse(vm.runInNewContext(`${modeSource}\nJSON.stringify([
|
|
|
43
47
|
])`));
|
|
44
48
|
assert.deepEqual(modes, ["image", "image", "changes", "preview"], "supported images should default back to Image mode while preserving Git Changes mode");
|
|
45
49
|
|
|
46
|
-
assert.match(
|
|
47
|
-
assert.doesNotMatch(
|
|
48
|
-
assert.match(
|
|
49
|
-
assert.match(
|
|
50
|
+
assert.match(fileService, /const FILE_VIEWER_IMAGE_MIME_TYPES_BY_EXTENSION = Object\.freeze\(\{[\s\S]*"\.png": "image\/png"[\s\S]*"\.jpe?g": "image\/jpeg"[\s\S]*"\.gif": "image\/gif"[\s\S]*"\.webp": "image\/webp"[\s\S]*"\.avif": "image\/avif"/, "the server should use an explicit raster extension allowlist");
|
|
51
|
+
assert.doesNotMatch(fileService, /"\.svg": "image\/svg\+xml"/, "active SVG documents should remain outside image-viewer scope");
|
|
52
|
+
assert.match(fileService, /if \(imageMimeType\) \{\s*return \{ \.\.\.shared, kind: "image", mimeType: imageMimeType, data: buffer\.toString\("base64"\) \};\s*\}/, "the bounded content endpoint should return image bytes without UTF-8 reinterpretation");
|
|
53
|
+
assert.match(fileService, /resolved\.info\.size > FILE_VIEWER_MAX_BYTES[\s\S]*const buffer = await readFile\(resolved\.targetPath\);[\s\S]*const imageMimeType = fileViewerImageMimeType/, "image reads should stay behind the existing workspace file size limit");
|
|
50
54
|
|
|
51
55
|
assert.match(html, /id="fileViewerImage"[^>]*role="group"[^>]*aria-label="Image preview"[^>]*hidden>[\s\S]*<img id="fileViewerImageElement" alt="" \/>/, "the viewer should expose a labelled, initially hidden image surface");
|
|
52
56
|
assert.match(app, /fileViewerImage: \$\("#fileViewerImage"\)[\s\S]*fileViewerImageElement: \$\("#fileViewerImageElement"\)/, "the image surface should be registered in the frontend element map");
|
|
53
|
-
assert.match(openSource, /const kind = data\.kind === "image" \? "image" : "text";[\s\S]*const imageUrl = kind === "image" \?
|
|
57
|
+
assert.match(openSource, /const kind = data\.kind === "image" \? "image" : "text";[\s\S]*const imageUrl = kind === "image" \? imageDataUrl\(data\) : "";/, "the standard file-open flow should validate image payloads through the allowlisted data URL helper");
|
|
54
58
|
assert.match(openSource, /readOnly: kind === "image",\s*sourceAvailable: kind === "text"/, "images should be read-only and unavailable to the source editor");
|
|
55
59
|
assert.match(uiSource, /elements\.fileViewerImage\.hidden = mode !== "image"/, "the image surface should render only in image mode");
|
|
56
60
|
assert.match(uiSource, /elements\.fileViewerImageElement\.alt = `Preview of \$\{viewer\.name \|\| fileDisplayName\(viewer\.path\)\}`/, "rendered images should receive a useful filename-based alternative label");
|
|
57
|
-
assert.match(app, /if \(!
|
|
61
|
+
assert.match(app, /if \(!projectFiles\.viewer \|\| projectFiles\.viewer\.kind === "image" \|\| !elements\.fileViewerSearchBar\) return;/, "text search should not open for image previews");
|
|
58
62
|
assert.match(app, /elements\.fileViewerImageElement\.removeAttribute\("src"\);\s*elements\.fileViewerImageElement\.alt = "";/, "closing or replacing a viewer should release stale image source state");
|
|
59
63
|
|
|
60
64
|
assert.match(css, /\.file-viewer-image \{[\s\S]*display: grid;[\s\S]*place-items: center;/, "the image surface should center its preview");
|
|
@@ -62,8 +66,8 @@ assert.match(css, /\.file-viewer-image img \{[\s\S]*max-width: 100%;[\s\S]*max-h
|
|
|
62
66
|
assert.match(readme, /PNG, JPEG, GIF, WebP, and AVIF/i, "the Files panel guide should list supported image formats");
|
|
63
67
|
assert.match(technical, /supported raster images[\s\S]*2 MiB/i, "the advanced reference should document image support and its size limit");
|
|
64
68
|
assert.match(development, /kind: "image"[\s\S]*base64/i, "the contributor guide should document the image response contract");
|
|
65
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
66
|
-
assert.match(html, /styles\.css\?v=
|
|
67
|
-
assert.match(html, /app\.js\?v=
|
|
69
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v200"/, "changed viewer assets should advance the PWA cache identity");
|
|
70
|
+
assert.match(html, /styles\.css\?v=167/, "changed image styles should advance the stylesheet revision");
|
|
71
|
+
assert.match(html, /app\.js\?v=220/, "changed image rendering should advance the app revision");
|
|
68
72
|
|
|
69
73
|
console.log("file viewer image static tests passed");
|
|
@@ -28,19 +28,19 @@ const helperEnd = app.indexOf("\nfunction updateFileViewerSearchCount()", helper
|
|
|
28
28
|
assert.ok(helperStart >= 0 && helperEnd > helperStart, "file viewer search matching should remain independently testable");
|
|
29
29
|
const helperSource = app.slice(helperStart, helperEnd);
|
|
30
30
|
const sourceMatches = JSON.parse(vm.runInNewContext(`${helperSource}\nJSON.stringify(collectFileViewerSearchMatches("alpha"))`, {
|
|
31
|
-
|
|
31
|
+
projectFiles: { viewer: { mode: "source", content: "stale" } },
|
|
32
32
|
elements: { fileViewerEditor: { value: "Alpha beta ALPHA" }, fileViewerPreview: { textContent: "preview" }, fileViewerChanges: { textContent: "changes" } },
|
|
33
33
|
resolveFileViewerMode: (viewer) => viewer.mode,
|
|
34
34
|
}));
|
|
35
35
|
assert.deepEqual(sourceMatches, { matches: [{ start: 0, end: 5 }, { start: 11, end: 16 }], truncated: false }, "source search should use live edited text and match case-insensitively");
|
|
36
36
|
const previewMatches = JSON.parse(vm.runInNewContext(`${helperSource}\nJSON.stringify(collectFileViewerSearchMatches("rendered"))`, {
|
|
37
|
-
|
|
37
|
+
projectFiles: { viewer: { mode: "preview" } },
|
|
38
38
|
elements: { fileViewerEditor: { value: "source" }, fileViewerPreview: { textContent: "Rendered preview" }, fileViewerChanges: { textContent: "changes" } },
|
|
39
39
|
resolveFileViewerMode: (viewer) => viewer.mode,
|
|
40
40
|
}));
|
|
41
41
|
assert.deepEqual(previewMatches, { matches: [{ start: 0, end: 8 }], truncated: false }, "preview search should use the rendered file surface instead of hidden source text");
|
|
42
42
|
const truncatedMatches = JSON.parse(vm.runInNewContext(`${helperSource}\nJSON.stringify(collectFileViewerSearchMatches("a"))`, {
|
|
43
|
-
|
|
43
|
+
projectFiles: { viewer: { mode: "source" } },
|
|
44
44
|
elements: { fileViewerEditor: { value: "a".repeat(10_001) }, fileViewerPreview: { textContent: "" }, fileViewerChanges: { textContent: "" } },
|
|
45
45
|
resolveFileViewerMode: (viewer) => viewer.mode,
|
|
46
46
|
}));
|
|
@@ -52,13 +52,13 @@ assert.match(app, /function renderFileViewerSearchHighlights\(\)[\s\S]*new Highl
|
|
|
52
52
|
assert.match(app, /function focusFileViewerSearchMatch\(\)[\s\S]*setSelectionRange\(match\.start, match\.end\)[\s\S]*syncFileViewerSearchOverlayScroll\(\)[\s\S]*textOffsetPosition\(surface, match\.start\)[\s\S]*scrollIntoView/, "match navigation should select and center source or rendered matches without mutating document selection");
|
|
53
53
|
assert.doesNotMatch(app.slice(app.indexOf("function focusFileViewerSearchMatch("), app.indexOf("\nfunction runFileViewerSearch(", app.indexOf("function focusFileViewerSearchMatch("))), /getSelection|addRange|removeAllRanges/, "rendered file search must not overwrite selections used by the Send to Pi workflow");
|
|
54
54
|
assert.match(app, /function runFileViewerSearch\([\s\S]*setAttribute\("aria-controls", surface\.id\)/, "the search input should identify the active Source, Preview, or Changes surface");
|
|
55
|
-
assert.match(app, /function setFileViewerMode\([\s\S]*
|
|
55
|
+
assert.match(app, /function setFileViewerMode\([\s\S]*projectFiles\.setMode\(mode\);[\s\S]*runFileViewerSearch\(\{ navigate: true \}\)/, "an explicit mode switch should reveal the first match on the new surface");
|
|
56
56
|
assert.match(app, /function updateFileViewerUi\([\s\S]*runFileViewerSearch\(\{ navigate: false \}\)/, "background viewer refreshes should reindex without stealing focus or scrolling to a match");
|
|
57
57
|
assert.match(app, /fileViewerSearchInput\?\.addEventListener\("input"[\s\S]*setTimeout\([\s\S]*runFileViewerSearch\(\{ navigate: true \}\)[\s\S]*150/, "typing should debounce search work for large files");
|
|
58
58
|
assert.match(app, /fileViewerSearchInput\?\.addEventListener\("keydown"[\s\S]*event\.key === "Enter"[\s\S]*stepFileViewerSearch\(event\.shiftKey \? -1 : 1\)[\s\S]*event\.key === "Escape"[\s\S]*closeFileViewerSearch\(\)/, "Enter, Shift+Enter, and Escape should navigate or close in-file search");
|
|
59
59
|
assert.match(
|
|
60
60
|
app,
|
|
61
|
-
/if \(
|
|
61
|
+
/if \(projectFiles\.viewer && elements\.fileViewerPane\?\.contains\(event\.target\)\) openFileViewerSearch\(\);\s*else openChatSearch\(\);/,
|
|
62
62
|
"Ctrl/Cmd+F should route to in-file search only when the event target is inside the open file viewer",
|
|
63
63
|
);
|
|
64
64
|
assert.match(app, /function openChatSearch\(\)[\s\S]*closeFileViewerSearch\(\{ restoreFocus: false \}\)/, "opening transcript search should close any stale in-file search bar");
|
|
@@ -23,9 +23,12 @@
|
|
|
23
23
|
// prompt and emit a generic Intercom tool stream with visible unrelated output.
|
|
24
24
|
// - FAKE_PI_GUIDED_GIT_ACTIVATION=1: advertise the Guided Git extension and
|
|
25
25
|
// prompt companion, then emit its exact transient set/clear activation status.
|
|
26
|
+
// - FAKE_PI_SESSION_OWNERSHIP=1: retain model choices and give each process its
|
|
27
|
+
// own session identity, or a stable identity for a normalized session path.
|
|
26
28
|
import { createHash, randomUUID } from "node:crypto";
|
|
27
29
|
import { createInterface } from "node:readline";
|
|
28
30
|
import { appendFileSync } from "node:fs";
|
|
31
|
+
import { resolve } from "node:path";
|
|
29
32
|
import {
|
|
30
33
|
BUILTIN_SAMPLING_APIS,
|
|
31
34
|
filterSupportedSamplingParameters,
|
|
@@ -38,6 +41,11 @@ const sessionIndex = process.argv.indexOf("--session");
|
|
|
38
41
|
const sessionFile = sessionIndex !== -1
|
|
39
42
|
? process.argv[sessionIndex + 1]
|
|
40
43
|
: process.env.FAKE_PI_CONTINUITY_MODE === "1" ? process.env.FAKE_PI_CONTINUITY_SESSION_FILE || undefined : undefined;
|
|
44
|
+
const sessionOwnershipEnabled = process.env.FAKE_PI_SESSION_OWNERSHIP === "1";
|
|
45
|
+
let ownedSessionId = sessionOwnershipEnabled
|
|
46
|
+
? `fake-session-${sessionFile ? createHash("sha256").update(resolve(sessionFile)).digest("hex") : randomUUID()}`
|
|
47
|
+
: "fake-session";
|
|
48
|
+
let selectedModel = { provider: "fake", id: "fake-model" };
|
|
41
49
|
|
|
42
50
|
let activeBash = 0;
|
|
43
51
|
let peakBash = 0;
|
|
@@ -405,7 +413,7 @@ function handleIntercomLivePrompt(command, base) {
|
|
|
405
413
|
return true;
|
|
406
414
|
}
|
|
407
415
|
|
|
408
|
-
function runContinuityDelayedStream() {
|
|
416
|
+
function runContinuityDelayedStream({ holdOpen = false } = {}) {
|
|
409
417
|
scriptedStreaming = true;
|
|
410
418
|
const text = "continuity stream complete";
|
|
411
419
|
const run = ++continuityRun;
|
|
@@ -421,7 +429,7 @@ function runContinuityDelayedStream() {
|
|
|
421
429
|
appendDynamicMessage(message);
|
|
422
430
|
emitScriptedEvent(tagged({ type: "message_end", continuityStep: "message-end", message }));
|
|
423
431
|
} },
|
|
424
|
-
{ afterMs: 80, run: () => emitScriptedEvent(tagged({ type: "agent_end", continuityStep: "end" })) },
|
|
432
|
+
{ afterMs: holdOpen ? 30_000 : 80, run: () => emitScriptedEvent(tagged({ type: "agent_end", continuityStep: "end" })) },
|
|
425
433
|
{ afterMs: 10, run: () => {
|
|
426
434
|
scriptedStreaming = false;
|
|
427
435
|
emitScriptedEvent(tagged({ type: "agent_settled", continuityStep: "settled" }));
|
|
@@ -594,15 +602,28 @@ function handleMobileBlockerPrompt(command, base) {
|
|
|
594
602
|
return true;
|
|
595
603
|
}
|
|
596
604
|
|
|
605
|
+
function handleActivityDecisionPrompt(command, base) {
|
|
606
|
+
if (String(command.message || "").trim() !== "fixture activity model decision") return false;
|
|
607
|
+
respond({ ...base, data: { output: "activity decision fixture accepted" } });
|
|
608
|
+
emitEvent({
|
|
609
|
+
type: "extension_ui_request",
|
|
610
|
+
id: "fixture-workflow-model-exception",
|
|
611
|
+
method: "select",
|
|
612
|
+
title: "Workflow model exception for fixture run",
|
|
613
|
+
options: ["Approve fixture model", "Reject fixture model"],
|
|
614
|
+
});
|
|
615
|
+
return true;
|
|
616
|
+
}
|
|
617
|
+
|
|
597
618
|
function handleContinuityPrompt(command, base) {
|
|
598
619
|
if (!continuityModeEnabled) return false;
|
|
599
620
|
const message = String(command.message || "").trim();
|
|
600
|
-
if (!["fixture continuity delayed stream", "fixture continuity delayed start", "fixture continuity confirmed before tool"].includes(message)) return false;
|
|
621
|
+
if (!["fixture continuity delayed stream", "fixture continuity held stream", "fixture continuity delayed start", "fixture continuity confirmed before tool"].includes(message)) return false;
|
|
601
622
|
appendDynamicMessage({ role: "user", content: String(command.message), timestamp: Date.now() });
|
|
602
623
|
respond({ ...base, data: { output: "fake continuity stream accepted", pid: process.pid } });
|
|
603
624
|
if (message === "fixture continuity delayed start") runContinuityDelayedStart();
|
|
604
625
|
else if (message === "fixture continuity confirmed before tool") runContinuityConfirmedBeforeTool();
|
|
605
|
-
else runContinuityDelayedStream();
|
|
626
|
+
else runContinuityDelayedStream({ holdOpen: message === "fixture continuity held stream" });
|
|
606
627
|
return true;
|
|
607
628
|
}
|
|
608
629
|
|
|
@@ -1230,7 +1251,7 @@ function emitSubagentFixtureStatus({ legacyOnly = false } = {}) {
|
|
|
1230
1251
|
version: 1,
|
|
1231
1252
|
instanceId: agent.id,
|
|
1232
1253
|
runId: run.id,
|
|
1233
|
-
parentSessionId:
|
|
1254
|
+
parentSessionId: ownedSessionId,
|
|
1234
1255
|
launcher: run.source === "workflow" ? "workflow" : "pi-subagents",
|
|
1235
1256
|
provider: run.source === "workflow" ? "workflow-run" : "pi-subagents",
|
|
1236
1257
|
origin: run.source,
|
|
@@ -1575,14 +1596,14 @@ rl.on("line", (line) => {
|
|
|
1575
1596
|
respond({
|
|
1576
1597
|
...base,
|
|
1577
1598
|
data: {
|
|
1578
|
-
model: codexFixtureModel || { provider: "fake", id: "fake-model" },
|
|
1599
|
+
model: codexFixtureModel || (sessionOwnershipEnabled ? selectedModel : { provider: "fake", id: "fake-model" }),
|
|
1579
1600
|
thinkingLevel,
|
|
1580
1601
|
isStreaming: scriptedStreaming || guidedGitStateMode === "streaming",
|
|
1581
1602
|
isCompacting: guidedGitStateMode === "compacting",
|
|
1582
1603
|
steeringMode: "one-at-a-time",
|
|
1583
1604
|
followUpMode: "one-at-a-time",
|
|
1584
1605
|
sessionFile,
|
|
1585
|
-
sessionId:
|
|
1606
|
+
sessionId: ownedSessionId,
|
|
1586
1607
|
sessionName: "fake",
|
|
1587
1608
|
autoCompactionEnabled: false,
|
|
1588
1609
|
messageCount: 0,
|
|
@@ -1659,6 +1680,7 @@ rl.on("line", (line) => {
|
|
|
1659
1680
|
if (handleCodexFastModePrompt(command, base)) return;
|
|
1660
1681
|
if (handleTalkPrompt(command, base)) return;
|
|
1661
1682
|
if (handleMobileBlockerPrompt(command, base)) return;
|
|
1683
|
+
if (handleActivityDecisionPrompt(command, base)) return;
|
|
1662
1684
|
if (handleTranscriptContinuityPrompt(command, base)) return;
|
|
1663
1685
|
if (handleContinuityPrompt(command, base)) return;
|
|
1664
1686
|
if (handleLargePayloadPrompt(command, base)) return;
|
|
@@ -1688,10 +1710,20 @@ rl.on("line", (line) => {
|
|
|
1688
1710
|
return;
|
|
1689
1711
|
case "set_model":
|
|
1690
1712
|
if (command.modelId === "missing-model") respond({ ...base, success: false, error: "Model not found: fake/missing-model" });
|
|
1691
|
-
else
|
|
1713
|
+
else {
|
|
1714
|
+
if (sessionOwnershipEnabled) selectedModel = { provider: command.provider, id: command.modelId };
|
|
1715
|
+
respond({ ...base, data: { provider: command.provider, id: command.modelId } });
|
|
1716
|
+
}
|
|
1692
1717
|
return;
|
|
1693
1718
|
case "get_available_models":
|
|
1694
|
-
respond({ ...base, data: { models: [
|
|
1719
|
+
respond({ ...base, data: { models: [
|
|
1720
|
+
{ provider: "fake", id: "fake-model", name: "Fake Model" },
|
|
1721
|
+
...(sessionOwnershipEnabled ? [{ provider: "fake", id: "fake-model-alt", name: "Fake Alternate Model" }] : []),
|
|
1722
|
+
] } });
|
|
1723
|
+
return;
|
|
1724
|
+
case "new_session":
|
|
1725
|
+
if (sessionOwnershipEnabled) ownedSessionId = `fake-session-${randomUUID()}`;
|
|
1726
|
+
respond({ ...base, data: {} });
|
|
1695
1727
|
return;
|
|
1696
1728
|
case "get_session_stats":
|
|
1697
1729
|
respond({
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
|
|
4
|
-
const [app, css, producer, parser] = await Promise.all([
|
|
4
|
+
const [app, css, producer, parser, usage] = await Promise.all([
|
|
5
5
|
readFile(new URL("../public/app.js", import.meta.url), "utf8"),
|
|
6
6
|
readFile(new URL("../public/styles.css", import.meta.url), "utf8"),
|
|
7
7
|
readFile(new URL("../../pi-extension-git-footer-status/index.ts", import.meta.url), "utf8"),
|
|
8
8
|
readFile(new URL("../../pi-extension-git-footer-status/provider-usage.ts", import.meta.url), "utf8"),
|
|
9
|
+
readFile(new URL("../public/activity-usage-controller.mjs", import.meta.url), "utf8"),
|
|
9
10
|
]);
|
|
10
11
|
|
|
11
12
|
const between = (source, start, end) => {
|
|
@@ -22,8 +23,8 @@ const applyUsage = between(app, "function applyFooterUsageWindows", "const FOOTE
|
|
|
22
23
|
const shapeKey = between(app, "function gitFooterChipShapeKey", "function footerBranchPickerRenderKey");
|
|
23
24
|
const inPlaceUpdate = between(app, "function updateGitFooterChipNodeValue", "let gitFooterRenderCache");
|
|
24
25
|
const providerUsageNormalization = between(app, "function normalizeFooterProviderUsageWindow", "function currentGitFooterCacheCwd");
|
|
25
|
-
const claudeUsageSync = between(
|
|
26
|
-
const claudeUsageRefresh = between(
|
|
26
|
+
const claudeUsageSync = between(usage, "function claudeUsageWindowFromProvider", "function claudeUsageResetDate");
|
|
27
|
+
const claudeUsageRefresh = between(usage, "async function refreshClaude", "function schedule(provider");
|
|
27
28
|
|
|
28
29
|
assert.match(parser, /x-codex-primary-window-minutes/, "Codex parser should read the primary window duration");
|
|
29
30
|
assert.match(parser, /x-codex-secondary-window-minutes/, "Codex parser should read the secondary window duration");
|
|
@@ -43,10 +44,10 @@ assert.match(providerUsageNormalization, /normalizeFooterProviderUsageWindow\(va
|
|
|
43
44
|
assert.match(app, /const providerUsage = normalizeFooterProviderUsage\(parsed\.providerUsage\);[\s\S]*\{ providerUsage \}/, "footer payload parsing should retain normalized provider usage metadata");
|
|
44
45
|
assert.match(claudeUsageSync, /providerUsage\?\.provider !== "anthropic"[\s\S]*source: "git-footer-status-provider-headers"[\s\S]*windows/, "Claude Usage should consume the same live Anthropic header snapshot as the footer");
|
|
45
46
|
assert.match(claudeUsageSync, /capturedAt \+ resetAfterSeconds \* 1000/, "relative reset times should be anchored to provider capture time instead of drifting on each render");
|
|
46
|
-
assert.match(claudeUsageRefresh, /if \(!forceCli &&
|
|
47
|
-
assert.match(app, /if \(footerPayload\)
|
|
47
|
+
assert.match(claudeUsageRefresh, /if \(!forceCli && syncFooter\(\)\) return;/, "scheduled Claude refreshes should prefer the live footer snapshot");
|
|
48
|
+
assert.match(app, /if \(footerPayload\) activityUsage\.syncFooter\(footerPayload\);/, "incoming footer status should update the Claude Usage panel immediately");
|
|
48
49
|
assert.match(app, /function applyOptimisticGitFooterBranch[\s\S]*payload\.providerUsage \? \{ providerUsage: payload\.providerUsage \}/, "optimistic branch updates should preserve the provider snapshot used by Claude Usage");
|
|
49
|
-
assert.match(app, /
|
|
50
|
+
assert.match(app, /activityUsage\.refreshClaude\(\{ forceCli: true \}\)/, "the explicit Refresh usage button should retain the CLI fallback path");
|
|
50
51
|
|
|
51
52
|
assert.match(usageNormalization, /value\.usageWindows\.primaryPercent/, "consumer should read structured primary metadata");
|
|
52
53
|
assert.match(usageNormalization, /value\.usageWindows\.secondaryPercent/, "consumer should read structured secondary metadata");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createSessionEventStream } from "../public/platform-event-stream.mjs";
|
|
1
2
|
import assert from "node:assert/strict";
|
|
2
3
|
import { readFile } from "node:fs/promises";
|
|
3
4
|
import { dirname, join } from "node:path";
|
|
@@ -34,7 +35,7 @@ assert.match(app, /let foregroundTranscriptCatchUpRequired = document\.visibilit
|
|
|
34
35
|
const beginCatchUp = functionBody(app, "beginForegroundTranscriptCatchUp");
|
|
35
36
|
assert.match(beginCatchUp, /foregroundTranscriptCatchUpRequired = true/);
|
|
36
37
|
assert.match(beginCatchUp, /streamOutputController\.cancel\(\)/, "backgrounding should discard pending frame work rather than replaying it later");
|
|
37
|
-
assert.match(beginCatchUp, /eventStreamPausedForBackground = true[\s\S]*?
|
|
38
|
+
assert.match(beginCatchUp, /eventStreamPausedForBackground = true[\s\S]*?sessionEvents\.close\(\)/, "backgrounding should close the EventSource so Chromium cannot retain and replay an SSE backlog");
|
|
38
39
|
|
|
39
40
|
const dispatch = functionBody(app, "dispatchTranscriptStreamEvent");
|
|
40
41
|
assert.match(dispatch, /classifyTranscriptStreamEvent\(event\)/);
|
|
@@ -68,18 +69,20 @@ assert.match(
|
|
|
68
69
|
assert.match(app, /case "webui_connected":[\s\S]*?resumedWithFreshSnapshot[\s\S]*?if \(!resumedWithFreshSnapshot\) scheduleForegroundReconcile/, "the deliberate reconnect must not immediately trigger a second full refresh");
|
|
69
70
|
assert.match(app, /case "webui_supervisor_reconnected":[\s\S]*?foregroundReconnectSnapshotFreshUntil/, "initial supervisor replay must reuse the fresh foreground snapshot");
|
|
70
71
|
|
|
71
|
-
const executeBeginCatchUp = new Function("
|
|
72
|
+
const executeBeginCatchUp = new Function("sessionEvents", "streamOutputController", "flushNormalStreamRenders", `
|
|
72
73
|
let foregroundTranscriptCatchUpRequired = false;
|
|
73
74
|
let backgroundReconnectSnapshotFresh = true;
|
|
74
75
|
let eventStreamPausedForBackground = false;
|
|
75
76
|
${beginCatchUp}
|
|
76
|
-
return { foregroundTranscriptCatchUpRequired, backgroundReconnectSnapshotFresh, eventStreamPausedForBackground, eventSource };
|
|
77
|
+
return { foregroundTranscriptCatchUpRequired, backgroundReconnectSnapshotFresh, eventStreamPausedForBackground, eventSource: sessionEvents.source };
|
|
77
78
|
`);
|
|
78
79
|
let closeCount = 0;
|
|
79
80
|
let cancelCount = 0;
|
|
80
81
|
let normalRenderFlushCount = 0;
|
|
82
|
+
const stream = createSessionEventStream({ createSource: () => ({ close() { closeCount += 1; } }), isCurrent: () => true });
|
|
83
|
+
stream.connect("/events", {});
|
|
81
84
|
const pausedState = executeBeginCatchUp(
|
|
82
|
-
|
|
85
|
+
stream,
|
|
83
86
|
{ cancel() { cancelCount += 1; } },
|
|
84
87
|
(reason) => {
|
|
85
88
|
assert.equal(reason, "visibility-hidden");
|
|
@@ -37,7 +37,7 @@ assert.match(
|
|
|
37
37
|
);
|
|
38
38
|
assert.match(
|
|
39
39
|
app,
|
|
40
|
-
/async function disableGitFooterContextChip\(key, label\)[\s\S]*runGitFooterVisibilityCommand\("hide", \[key\]\)[\s\S]*requestGitFooterWebuiPayload/,
|
|
40
|
+
/async function disableGitFooterContextChip\(key, label\)[\s\S]*runGitFooterVisibilityCommand\("hide", \[key\], target, \{ dialogOwned: false \}\)[\s\S]*requestGitFooterWebuiPayload/,
|
|
41
41
|
"disabling a box should persist its matching WebUI visibility key and refresh the payload",
|
|
42
42
|
);
|
|
43
43
|
assert.match(
|
|
@@ -4,6 +4,7 @@ import { dirname, join } from "node:path";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import vm from "node:vm";
|
|
6
6
|
|
|
7
|
+
const owner = await readFile(new URL("../public/project-file-viewer-controller.mjs", import.meta.url), "utf8");
|
|
7
8
|
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
8
9
|
const [app, css, html] = await Promise.all([
|
|
9
10
|
readFile(join(root, "public", "app.js"), "utf8"),
|
|
@@ -11,27 +12,27 @@ const [app, css, html] = await Promise.all([
|
|
|
11
12
|
readFile(join(root, "public", "index.html"), "utf8"),
|
|
12
13
|
]);
|
|
13
14
|
|
|
14
|
-
function sourceBetween(startMarker, endMarker, label) {
|
|
15
|
-
const start =
|
|
16
|
-
const end =
|
|
15
|
+
function sourceBetween(startMarker, endMarker, label, source = app) {
|
|
16
|
+
const start = source.indexOf(startMarker);
|
|
17
|
+
const end = source.indexOf(endMarker, start);
|
|
17
18
|
assert.ok(start >= 0 && end > start, `${label} should remain a standalone frontend helper`);
|
|
18
|
-
return
|
|
19
|
+
return source.slice(start, end);
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
const normalizePathSource = sourceBetween("function normalizeFileTreePath(", "\nfunction fileApiPath(", "normalizeFileTreePath");
|
|
22
23
|
const targetSource = sourceBetween("function gitFileViewerTarget(", "\nasync function openGitFileInViewer(", "gitFileViewerTarget");
|
|
23
24
|
const openSource = sourceBetween("async function openGitFileInViewer(", "\nasync function openGitFileFromChanges(", "openGitFileInViewer");
|
|
24
25
|
const renderSource = sourceBetween("function renderGitPanelFile(", "\nfunction renderGitPanelTreeSection(", "renderGitPanelFile");
|
|
25
|
-
const categorySource = sourceBetween("const GIT_FILE_DIFF_CATEGORY_BY_PANEL
|
|
26
|
-
const modeSource = sourceBetween("function resolveFileViewerMode
|
|
26
|
+
const categorySource = sourceBetween("const GIT_FILE_DIFF_CATEGORY_BY_PANEL", "export function resolveFileViewerMode", "categories", owner).replaceAll("export ", "");
|
|
27
|
+
const modeSource = sourceBetween("export function resolveFileViewerMode", "\n/**", "mode", owner).replace("export ", "");
|
|
27
28
|
const setModeSource = sourceBetween("function setFileViewerMode(", "\nfunction setFileViewerDirty(", "setFileViewerMode");
|
|
28
29
|
const viewerUiSource = sourceBetween("function updateFileViewerUi(", "\nfunction fileViewerChangesNotice(", "updateFileViewerUi");
|
|
29
30
|
const changesRenderSource = sourceBetween("function fileViewerChangesNotice(", "\nfunction clearFileViewerSelection(", "file viewer changes rendering");
|
|
30
31
|
const combinedSyntaxSource = sourceBetween("function gitFileDiffUsesCombinedSyntax(", "\nfunction renderFileViewerUntrackedChanges(", "gitFileDiffUsesCombinedSyntax");
|
|
31
|
-
const snapshotSource = sourceBetween("async function
|
|
32
|
-
const applySnapshotSource = sourceBetween("function
|
|
33
|
-
const openFileSource = sourceBetween("async function
|
|
34
|
-
const viewerPersistenceSource = sourceBetween("function cacheActiveFileViewerForTab(", "\
|
|
32
|
+
const snapshotSource = sourceBetween(" async function loadDiff(", "\n async function applyDiff(", "diff request", owner);
|
|
33
|
+
const applySnapshotSource = sourceBetween(" async function applyDiff(", "\n async function open(", "diff ownership", owner);
|
|
34
|
+
const openFileSource = sourceBetween(" async function open(", "\n async function openReport(", "open owner", owner);
|
|
35
|
+
const viewerPersistenceSource = sourceBetween("function cacheActiveFileViewerForTab(", "\nfunction handleProjectFileChange(", "viewer adapter");
|
|
35
36
|
const moveSource = sourceBetween("function updateActiveFileViewerAfterMove(", "\nfunction closeActiveFileViewerIfDeleted(", "updateActiveFileViewerAfterMove");
|
|
36
37
|
const resetActiveTabUiSource = sourceBetween("function resetActiveTabUi(", "\nfunction tabGroupStatusRank(", "resetActiveTabUi");
|
|
37
38
|
const switchTabSource = sourceBetween("async function switchTab(", "\nfunction currentDirectoryForNewTab(", "switchTab");
|
|
@@ -55,7 +56,7 @@ assert.equal(targets[4], null, "Git files outside every available tab cwd should
|
|
|
55
56
|
|
|
56
57
|
assert.match(openSource, /gitFileViewerTarget\(repoRelPath, root, candidates\)/, "Git file opening should use the shared repo-to-workspace path resolver");
|
|
57
58
|
assert.match(openSource, /target\.tabId !== activeTabId[\s\S]*await switchTab\(target\.tabId\)[\s\S]*openFileInViewer\(target\.path/, "Git file opening should activate the owning tab before using the standard WebUI viewer");
|
|
58
|
-
assert.match(openSource, /its
|
|
59
|
+
assert.match(openSource, /its thread is no longer available/, "a stale Git-card tab should produce visible failure feedback");
|
|
59
60
|
assert.match(renderSource, /row\.setAttribute\("role", "button"\)/, "Git file rows should expose button semantics");
|
|
60
61
|
assert.match(renderSource, /row\.addEventListener\("click", open\)/, "clicking a Git file row should open its preview");
|
|
61
62
|
assert.match(renderSource, /event\.repeat \|\| \(event\.key !== "Enter" && event\.key !== " "\)/, "Git file rows should support keyboard activation without key-repeat request bursts");
|
|
@@ -110,8 +111,8 @@ assert.equal(modes[7], "changes", "a deleted tracked file without live source sh
|
|
|
110
111
|
assert.equal(modes[8], "source", "a missing source without any Git snapshot should not invent a Changes view");
|
|
111
112
|
assert.equal(modes[9], "source", "mode resolution should fail closed without a viewer");
|
|
112
113
|
|
|
113
|
-
assert.match(
|
|
114
|
-
assert.match(
|
|
114
|
+
assert.match(owner, /viewer\.mode = resolveFileViewerMode\(\{ \.\.\.viewer, mode \}\)/, "mode switching should route every request through the shared resolver");
|
|
115
|
+
assert.match(owner, /if \(viewer\.mode === "changes" && previousMode !== "changes"\) selection = null/, "entering Changes mode should clear a stale Source or Preview selection bar");
|
|
115
116
|
assert.match(viewerUiSource, /const hasChanges = !!viewer\.gitChanges;/, "the viewer UI should derive Changes availability from the open-time snapshot");
|
|
116
117
|
assert.match(viewerUiSource, /elements\.fileViewerChangesModeButton\.hidden = !hasChanges;\s*elements\.fileViewerChangesModeButton\.disabled = !hasChanges;/, "the Changes control should stay hidden and disabled for non-Git opens");
|
|
117
118
|
assert.match(viewerUiSource, /elements\.fileViewerSourceModeButton\.disabled = !sourceAvailable;/, "Source should be disabled when the live file content is unavailable");
|
|
@@ -145,59 +146,51 @@ assert.deepEqual(
|
|
|
145
146
|
|
|
146
147
|
// --- Backend request contract ---
|
|
147
148
|
|
|
148
|
-
assert.match(snapshotSource, /new URLSearchParams\(\{ path
|
|
149
|
+
assert.match(snapshotSource, /new URLSearchParams\(\{ path, category \}\)/, "the changes request should send the repo-relative path and the mapped category");
|
|
149
150
|
assert.match(snapshotSource, /api\(`\/api\/git-file-diff\?\$\{params\.toString\(\)\}`, \{ tabId \}\)/, "the changes request should call the read-only Git file diff endpoint on the owning tab");
|
|
150
151
|
assert.match(snapshotSource, /if \(!response\.ok\) throw new Error\(response\.error \|\| "Failed to load Git changes for this file"\)/, "an ok:false response should surface a readable error");
|
|
151
152
|
assert.match(snapshotSource, /truncated: data\.truncated === true/, "truncation should be carried into the viewer snapshot");
|
|
152
153
|
assert.match(snapshotSource, /contentError: data\.error \? String\(data\.error\) : ""/, "an untracked read error should stay distinct from a request failure");
|
|
153
154
|
assert.match(snapshotSource, /return \{ \.\.\.snapshot, error: error\.message \|\| String\(error\) \};/, "a failed changes request should resolve to an error snapshot instead of rejecting the open");
|
|
154
|
-
assert.match(
|
|
155
|
-
assert.match(
|
|
156
|
-
assert.match(
|
|
157
|
-
applySnapshotSource,
|
|
158
|
-
/const viewer = tabContext\.tabId === activeTabId \? activeFileViewer : fileViewersByTab\.get\(tabContext\.tabId\);\s*if \(!viewer\?\.gitChanges\?\.loading \|\| viewer\.path !== viewerPath \|\| viewer\.gitChanges\.requestSerial !== requestSerial\) return;/,
|
|
159
|
-
"a late diff response should update the owning terminal's cached viewer while still rejecting stale viewer identities",
|
|
160
|
-
);
|
|
155
|
+
assert.match(owner, /let diffSerial = 0/, "Git changes opens should have a request identity counter");
|
|
156
|
+
assert.match(openFileSource, /loading: true, requestSerial/, "the viewer should show an identified loading snapshot until the bounded diff arrives");
|
|
157
|
+
assert.match(applySnapshotSource, /tabs\.get\(token\.target\.tabId\) !== token\.owner[\s\S]*token\.owner\.viewer !== buffer[\s\S]*buffer\.path !== path[\s\S]*buffer\.gitChanges !== placeholder[\s\S]*!isTargetAlive\(token\.target\)/, "a late diff response should update the owning terminal's cached viewer while still rejecting stale viewer identities");
|
|
161
158
|
|
|
162
159
|
// --- Open flow: Git default, normal-open isolation, deleted files ---
|
|
163
160
|
|
|
164
161
|
assert.match(openSource, /category = "" \} = \{\}/, "Git opens should accept an optional side-panel category");
|
|
165
162
|
assert.match(openSource, /openFileInViewer\(target\.path, \{ gitCategory: category, gitPath: normalizeFileTreePath\(repoRelPath\) \}\)/, "Git opens should hand the category and repo path to the standard viewer");
|
|
166
|
-
assert.match(openFileSource, /async function
|
|
167
|
-
assert.match(
|
|
168
|
-
assert.match(
|
|
169
|
-
assert.match(openFileSource, /
|
|
170
|
-
assert.match(openFileSource, /const
|
|
171
|
-
assert.match(openFileSource, /
|
|
172
|
-
assert.match(openFileSource, /const gitChanges = changesRequest \?
|
|
173
|
-
assert.match(openFileSource, /
|
|
163
|
+
assert.match(openFileSource, /async function open\(path = "", \{ gitCategory = "", gitPath = "" \} = \{\}\)/, "the standard viewer should accept optional Git context without changing its default signature");
|
|
164
|
+
assert.match(owner, /let openSerial = 0/, "file viewer opens should have a shared request identity counter");
|
|
165
|
+
assert.match(owner, /serial: \+\+openSerial/, "every viewer open should capture a unique request identity");
|
|
166
|
+
assert.match(openFileSource, /category = gitFileDiffCategory\(gitCategory\)/, "the viewer should map the side-panel category through the shared allowlist");
|
|
167
|
+
assert.match(openFileSource, /const requestSerial = category \? \+\+diffSerial : 0/, "each Git-originated open should receive a unique changes request identity");
|
|
168
|
+
assert.match(openFileSource, /changesRequest = category \? loadDiff\(changesPath, category, token\.target\.tabId\) : null/, "only category-carrying opens should request a diff");
|
|
169
|
+
assert.match(openFileSource, /const gitChanges = changesRequest \? \{[\s\S]*\} : null/, "normal File-section opens should carry no Git snapshot at all");
|
|
170
|
+
assert.match(openFileSource, /applyDiff\(changesRequest, token, next, gitChanges\)/, "same-path Git requests should apply only through their captured request identity");
|
|
174
171
|
assert.match(openFileSource, /mode: gitChanges \? "changes" : kind === "image" \? "image" : data\.language === "markdown" \? "preview" : "source",/, "Git opens should default to Changes while normal opens keep the Image/Markdown/Source default");
|
|
175
|
-
assert.match(openFileSource, /if \(!
|
|
176
|
-
assert.match(openFileSource, /const gitChanges = changesRequest \? await changesRequest : null;\s*if \(!
|
|
172
|
+
assert.match(openFileSource, /await api\(fileApiPath[\s\S]*if \(!isOpenCurrent\(token\)\) return \{ success: false, reason: "stale" \}/, "the source-success path should reject stale same-tab viewer opens");
|
|
173
|
+
assert.match(openFileSource, /const gitChanges = changesRequest \? await changesRequest : null;\s*if \(!isOpenCurrent\(token\)\) return \{ success: false, reason: "stale" \}/, "the deleted-file fallback should reject stale same-tab viewer opens after awaiting the diff");
|
|
177
174
|
assert.match(openFileSource, /readOnly: kind === "image",\s*sourceAvailable: kind === "text",/, "a live Git-originated text file should stay editable while image previews remain read-only");
|
|
178
|
-
assert.match(
|
|
179
|
-
openFileSource,
|
|
180
|
-
/const gitChanges = changesRequest \? await changesRequest : null;\s*if \(!isCurrentTabContext\(tabContext\) \|\| openRequestSerial !== fileViewerOpenRequestSerial\) return;\s*if \(gitChanges && !gitChanges\.error\) \{/,
|
|
181
|
-
"a current failed source load should fall back to the diff only when that diff actually loaded",
|
|
182
|
-
);
|
|
175
|
+
assert.match(openFileSource, /const gitChanges = changesRequest \? await changesRequest : null;\s*if \(!isOpenCurrent\(token\)\) return \{ success: false, reason: "stale" \};\s*if \(gitChanges && !gitChanges\.error\)/, "a current failed source load should fall back to the diff only when that diff actually loaded");
|
|
183
176
|
assert.match(openFileSource, /mode: "changes",\s*dirty: false,\s*readOnly: true,\s*sourceAvailable: false,/, "a deleted tracked file should open read-only in Changes mode");
|
|
184
|
-
assert.match(openFileSource, /
|
|
185
|
-
assert.match(openFileSource, /
|
|
186
|
-
assert.match(
|
|
177
|
+
assert.match(openFileSource, /onStatus\("File content unavailable; showing Git changes \(read-only\)\.", "warn"\)/, "the deleted-file fallback should explain itself in the viewer status");
|
|
178
|
+
assert.match(openFileSource, /onStatus\(message, "error"\);\s*addEvent\(`file open failed: \$\{message\}`, "error"\)/, "a total failure should still report the original open error");
|
|
179
|
+
assert.match(owner, /function resetActive\(\) \{\s*openSerial \+= 1;\s*viewer = null/, "resetting the visible viewer should invalidate pending source and deleted-file opens");
|
|
187
180
|
assert.match(viewerPersistenceSource, /elements\.fileViewerChanges\.hidden = true;\s*elements\.fileViewerChanges\.replaceChildren\(\);/, "resetting the visible viewer should clear the changes surface");
|
|
188
|
-
assert.match(
|
|
181
|
+
assert.match(owner, /function remapPath[\s\S]*gitChanges: null/, "renaming the open file should drop its stale open-time diff snapshot");
|
|
189
182
|
|
|
190
183
|
// --- Per-terminal viewer persistence ---
|
|
191
184
|
|
|
192
|
-
assert.match(
|
|
193
|
-
assert.match(
|
|
194
|
-
assert.match(
|
|
195
|
-
assert.match(
|
|
196
|
-
assert.match(
|
|
197
|
-
assert.match(
|
|
185
|
+
assert.match(owner, /const tabs = new Map\(\)/, "open file viewers should be stored per terminal tab");
|
|
186
|
+
assert.match(owner, /owner = \{ viewer: null, selection: null \}/, "viewer selections should be stored with their owning terminal tab");
|
|
187
|
+
assert.match(owner, /owner\.viewer = viewer/, "caching a terminal should retain its active viewer object, including dirty edits and mode");
|
|
188
|
+
assert.match(owner, /owner\.selection = selection/, "caching a terminal should retain its active file selection");
|
|
189
|
+
assert.match(owner, /function activate\(tabId\)[\s\S]*viewer = tabs\.get\(activeTabId\)\?\.viewer \|\| null;\s*selection = tabs\.get\(activeTabId\)\?\.selection \|\| null;/, "activating a terminal should restore its own viewer and selection");
|
|
190
|
+
assert.match(owner, /function close\(\) \{\s*if \(activeTabId\) tabs.delete\(activeTabId\)/, "explicitly closing a viewer should remove only the active terminal's cached state");
|
|
198
191
|
assert.match(switchTabSource, /cacheActiveFileViewerForTab\(activeTabId\);[\s\S]*?const tabContext = setActiveTabId\(tabId, \{ remember: true \}\);/, "switching terminals should cache the outgoing viewer before changing the active tab identity");
|
|
199
|
-
assert.match(resetActiveTabUiSource, /resetFileViewerUi\(\);\s*resetFileTreeState\(\);\s*restoreFileViewerForActiveTab\(\);/, "resetting tab UI should restore the incoming terminal's viewer instead of closing it");
|
|
200
|
-
assert.match(closeTabsSource, /
|
|
192
|
+
assert.match(resetActiveTabUiSource, /resetFileViewerUi\(\);\s*if \(!preserveFileTree\) resetFileTreeState\(\);\s*restoreFileViewerForActiveTab\(\);/, "resetting tab UI should restore the incoming terminal's viewer instead of closing it");
|
|
193
|
+
assert.match(closeTabsSource, /projectFiles\.forgetTab\(id\)/, "closing terminal tabs should discard their cached viewers and selections");
|
|
201
194
|
|
|
202
195
|
// --- Changes rendering contracts ---
|
|
203
196
|
|
|
@@ -3,6 +3,7 @@ import { readFile } from "node:fs/promises";
|
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
|
|
6
|
+
const gitReads = await readFile(new URL("../lib/server/git-reads.mjs", import.meta.url), "utf8");
|
|
6
7
|
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
7
8
|
const [app, server, watcher, development] = await Promise.all([
|
|
8
9
|
readFile(join(root, "public", "app.js"), "utf8"),
|
|
@@ -35,7 +36,7 @@ assert.match(watcher, /if \(!record\.tabs\.size\) closeRoot/, "the last tab unsu
|
|
|
35
36
|
assert.match(watcher, /function closeAll\(\)[\s\S]*closeRoot\(root\)/, "server shutdown should release every root watcher");
|
|
36
37
|
|
|
37
38
|
assert.match(server, /createGitLiveWatcher\(\{[\s\S]*type: "webui_git_changed"[\s\S]*broadcastServerEvent/, "watcher changes should use the existing server-wide SSE channel");
|
|
38
|
-
assert.match(
|
|
39
|
+
assert.match(gitReads, /env: \{ GIT_OPTIONAL_LOCKS: "0" \}/, "read-only Git commands should not feed optional index refreshes back into the watcher");
|
|
39
40
|
assert.match(server, /trackGitRepositoryForTab\(tab, await getGitRoot\(tab\.cwd\)\)/, "Git-root discovery should register the tab watcher");
|
|
40
41
|
assert.match(server, /trackGitRepositoryForTab\(tab, data\.root\)/, "Git-panel reads should ensure watcher registration");
|
|
41
42
|
assert.match(server, /async function updateTabCwd[\s\S]*gitLiveWatcher\.unsubscribe\(tab\.id\)/, "cwd changes should release old repository subscriptions");
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import test from "node:test";
|
|
4
|
+
import vm from "node:vm";
|
|
5
|
+
|
|
6
|
+
const server = await readFile(new URL("../bin/pi-webui.mjs", import.meta.url), "utf8");
|
|
7
|
+
const source = server.match(/^async function handleGitWorkflowRequest\([^\n]*\n[\s\S]*?^}/m)?.[0];
|
|
8
|
+
assert.ok(source, "the route adapter must remain inspectable");
|
|
9
|
+
|
|
10
|
+
function dispatcher(dependencies) {
|
|
11
|
+
return vm.runInNewContext(`(${source})`, {
|
|
12
|
+
options: { cwd: "/default" },
|
|
13
|
+
sanitizeError: (error) => error.message,
|
|
14
|
+
...dependencies,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
for (const [route, method, receivesBody] of [
|
|
19
|
+
["init", "initializeGitRepository", false],
|
|
20
|
+
["initial-commit", "initialGitCommit", false],
|
|
21
|
+
["main-branch", "renameGitMainBranch", false],
|
|
22
|
+
["remote", "addGitOrigin", true],
|
|
23
|
+
["init-push", "pushInitialGitMain", false],
|
|
24
|
+
["commit", "commitGitWorkflow", true],
|
|
25
|
+
["push", "pushGitWorkflow", true],
|
|
26
|
+
["publish", "publishGitRepository", true],
|
|
27
|
+
["create-pr", "createGitWorkflowPr", true],
|
|
28
|
+
]) {
|
|
29
|
+
test(`${route} retains the workflow envelope across an asynchronous service boundary`, async () => {
|
|
30
|
+
const body = { confirmed: true, expectedStagedContentHash: "approved" };
|
|
31
|
+
const tab = { id: "origin", cwd: "/origin" };
|
|
32
|
+
const payload = { ok: true, data: { marker: route } };
|
|
33
|
+
let reject = false;
|
|
34
|
+
const dispatch = dispatcher({
|
|
35
|
+
[method]: async (...args) => {
|
|
36
|
+
assert.deepEqual(args, receivesBody ? [tab.cwd, body] : [tab.cwd]);
|
|
37
|
+
await Promise.resolve();
|
|
38
|
+
if (reject) throw Object.assign(new Error("fixture validation refusal"), { status: 409 });
|
|
39
|
+
return payload;
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
assert.equal(await dispatch(`/api/git-workflow/${route}`, body, tab), payload);
|
|
43
|
+
reject = true;
|
|
44
|
+
const failure = await dispatch(`/api/git-workflow/${route}`, body, tab);
|
|
45
|
+
assert.equal(failure.ok, false);
|
|
46
|
+
assert.equal(failure.error, "fixture validation refusal");
|
|
47
|
+
assert.deepEqual(Object.keys(failure).sort(), ["error", "ok"]);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
test("cancel invokes both owners even when generation cancellation succeeds", async () => {
|
|
52
|
+
const tab = { id: "origin", cwd: "/origin" };
|
|
53
|
+
const calls = [];
|
|
54
|
+
const dispatch = dispatcher({
|
|
55
|
+
cancelGitWorkflowGeneration: (target) => {
|
|
56
|
+
assert.equal(target, tab);
|
|
57
|
+
calls.push("generation");
|
|
58
|
+
return true;
|
|
59
|
+
},
|
|
60
|
+
cancelGitWorkflowProcess: () => { calls.push("process"); return false; },
|
|
61
|
+
});
|
|
62
|
+
const result = await dispatch("/api/git-workflow/cancel", {}, tab);
|
|
63
|
+
assert.deepEqual(calls, ["generation", "process"]);
|
|
64
|
+
assert.equal(result.ok, true);
|
|
65
|
+
assert.equal(result.data.cancelled, true);
|
|
66
|
+
});
|