@firstpick/pi-package-webui 0.11.1 → 0.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (309) hide show
  1. package/DEVELOPMENT.md +151 -12
  2. package/README.md +34 -6
  3. package/TECHNICAL.md +75 -8
  4. package/bin/pi-webui.mjs +5390 -11423
  5. package/index.ts +10 -3
  6. package/lib/component-update-state.mjs +2 -2
  7. package/lib/git-workflow-preference-values.mjs +122 -0
  8. package/lib/git-workflow-preferences.mjs +35 -563
  9. package/lib/package-updates.mjs +260 -0
  10. package/lib/rpc-supervisor-client.mjs +8 -4
  11. package/lib/server/app-runners.mjs +1667 -0
  12. package/lib/server/codex-fast-mode.mjs +161 -0
  13. package/lib/server/conversation-mode.mjs +218 -0
  14. package/lib/server/conversation-voice.mjs +318 -0
  15. package/lib/server/extension-ui-requests.mjs +114 -0
  16. package/lib/server/git-generation.mjs +459 -0
  17. package/lib/server/git-mutations.mjs +1827 -0
  18. package/lib/server/git-reads.mjs +608 -0
  19. package/lib/server/git-worktree-sessions.mjs +408 -0
  20. package/lib/server/helper-requests.mjs +82 -0
  21. package/lib/server/no-project-workspaces.mjs +103 -0
  22. package/lib/server/rpc-transports.mjs +394 -0
  23. package/lib/server/settings-store.mjs +544 -0
  24. package/lib/server/sse-delivery.mjs +138 -0
  25. package/lib/server/workspace-files.mjs +563 -0
  26. package/lib/update/supervisor.mjs +4 -0
  27. package/lib/webui-workspaces.mjs +2 -0
  28. package/package.json +4 -4
  29. package/public/activity-agents-controller.mjs +269 -0
  30. package/public/activity-events-controller.mjs +236 -0
  31. package/public/activity-intercom-controller.mjs +627 -0
  32. package/public/activity-queue-controller.mjs +534 -0
  33. package/public/activity-todo-view.mjs +89 -0
  34. package/public/activity-usage-controller.mjs +589 -0
  35. package/public/app.js +3761 -3886
  36. package/public/conversation-overview.css +84 -0
  37. package/public/conversation-overview.mjs +193 -0
  38. package/public/draft-conversations.mjs +135 -0
  39. package/public/focused-composer-controls.css +111 -0
  40. package/public/focused-composer-controls.mjs +143 -0
  41. package/public/focused-composer-disclosure.mjs +223 -0
  42. package/public/focused-shell-adapter.css +264 -0
  43. package/public/focused-shell-adapter.mjs +257 -0
  44. package/public/index.html +137 -80
  45. package/public/model-catalog-order.mjs +63 -0
  46. package/public/platform-event-stream.mjs +64 -0
  47. package/public/project-artifact-controller.mjs +218 -0
  48. package/public/project-file-viewer-controller.mjs +383 -0
  49. package/public/project-git-tools-controller.mjs +181 -0
  50. package/public/project-runners-controller.mjs +220 -0
  51. package/public/service-worker.js +52 -1
  52. package/public/session-attention-scheduler.mjs +182 -0
  53. package/public/session-composer-store.mjs +56 -0
  54. package/public/session-context.mjs +51 -0
  55. package/public/session-extension-requests.mjs +63 -0
  56. package/public/session-shelf-state.mjs +151 -0
  57. package/public/session-shelves.css +171 -0
  58. package/public/session-shelves.mjs +95 -0
  59. package/public/settings-navigation-controller.mjs +249 -0
  60. package/public/settings-navigation.css +61 -0
  61. package/public/settings-resource-controller.mjs +232 -0
  62. package/public/settings-workspace.css +19 -0
  63. package/public/settings-workspace.mjs +175 -0
  64. package/public/shell-actions.mjs +87 -0
  65. package/public/shell-attention-inbox.css +72 -0
  66. package/public/shell-attention-inbox.mjs +198 -0
  67. package/public/shell-context-actions.css +61 -0
  68. package/public/shell-context-actions.mjs +168 -0
  69. package/public/shell-inspector-resize.mjs +124 -0
  70. package/public/shell-navigation-resize.mjs +107 -0
  71. package/public/shell-navigation.mjs +127 -0
  72. package/public/shell-preferences.mjs +108 -0
  73. package/public/shell-surfaces.mjs +99 -0
  74. package/public/shell-tools-launcher.css +97 -0
  75. package/public/shell-tools-launcher.mjs +222 -0
  76. package/public/shell-view-host.mjs +115 -0
  77. package/public/shell-workspace.css +266 -0
  78. package/public/shell-workspace.mjs +402 -0
  79. package/public/sidebar-update-menu.css +190 -0
  80. package/public/sidebar-update-menu.mjs +512 -0
  81. package/public/styles.css +320 -169
  82. package/public/subagent-launch-slot-state.mjs +2 -2
  83. package/public/themed-selects.css +156 -0
  84. package/public/workspace-choices.mjs +104 -0
  85. package/tests/activity-agents-controller.test.mjs +652 -0
  86. package/tests/activity-events-controller.test.mjs +511 -0
  87. package/tests/app-runner-terminal-static.test.mjs +3 -3
  88. package/tests/append-system-http.test.mjs +7 -6
  89. package/tests/append-system-selector-static.test.mjs +6 -6
  90. package/tests/aur-review-widget-static.test.mjs +11 -3
  91. package/tests/boot-failure-diagnostics.test.mjs +8 -3
  92. package/tests/browser/activity-intercom-controller.spec.mjs +457 -0
  93. package/tests/browser/activity-navigation-integration.spec.mjs +45 -0
  94. package/tests/browser/activity-owner-integration.spec.mjs +201 -0
  95. package/tests/browser/activity-queue-controller.spec.mjs +405 -0
  96. package/tests/browser/activity-section-picker.spec.mjs +294 -0
  97. package/tests/browser/activity-todo-view.spec.mjs +60 -0
  98. package/tests/browser/activity-usage-controller.spec.mjs +416 -0
  99. package/tests/browser/compact-layout-integration.spec.mjs +58 -0
  100. package/tests/browser/composer-action-grid-reorder.spec.mjs +16 -0
  101. package/tests/browser/composer-disclosure.spec.mjs +389 -0
  102. package/tests/browser/composer-toolbar-polish.spec.mjs +343 -0
  103. package/tests/browser/control-deck-component-updates.spec.mjs +5 -14
  104. package/tests/browser/control-deck-side-panels.spec.mjs +27 -12
  105. package/tests/browser/control-visibility.spec.mjs +5 -0
  106. package/tests/browser/controls-layout.spec.mjs +21 -2
  107. package/tests/browser/conversation-overview.spec.mjs +251 -0
  108. package/tests/browser/draft-conversations.spec.mjs +276 -0
  109. package/tests/browser/empty-startup-fixture.mjs +135 -0
  110. package/tests/browser/empty-startup.spec.mjs +282 -0
  111. package/tests/browser/events-tree-context-menu.spec.mjs +1 -0
  112. package/tests/browser/focused-composer-more.spec.mjs +127 -0
  113. package/tests/browser/focused-model-shortcuts.spec.mjs +120 -0
  114. package/tests/browser/focused-navigation-fixture.mjs +32 -0
  115. package/tests/browser/focused-project-activity.spec.mjs +111 -0
  116. package/tests/browser/focused-shell-integration.spec.mjs +208 -0
  117. package/tests/browser/folder-picker-layout-fixture.mjs +13 -0
  118. package/tests/browser/folder-picker-layout.spec.mjs +302 -0
  119. package/tests/browser/footer-model-advanced-layout.spec.mjs +27 -14
  120. package/tests/browser/git-setup-cancel.spec.mjs +251 -0
  121. package/tests/browser/guided-git-fallback.spec.mjs +40 -21
  122. package/tests/browser/inspector-header.spec.mjs +221 -0
  123. package/tests/browser/inspector-overview-integration.spec.mjs +104 -0
  124. package/tests/browser/inspector-resize.spec.mjs +227 -0
  125. package/tests/browser/inspector-topic-overflow.spec.mjs +56 -0
  126. package/tests/browser/interaction-action-discovery.spec.mjs +332 -0
  127. package/tests/browser/interaction-attention-inbox.spec.mjs +364 -0
  128. package/tests/browser/interaction-attention-integration.spec.mjs +53 -0
  129. package/tests/browser/interaction-composer-controls.spec.mjs +267 -0
  130. package/tests/browser/interaction-composer-integration.spec.mjs +175 -0
  131. package/tests/browser/interaction-continuity.spec.mjs +50 -26
  132. package/tests/browser/interaction-model-picker.spec.mjs +86 -0
  133. package/tests/browser/last-terminal-close.spec.mjs +280 -0
  134. package/tests/browser/mobile-foundation.spec.mjs +172 -20
  135. package/tests/browser/model-catalog-groups.spec.mjs +104 -0
  136. package/tests/browser/more-row-menus.spec.mjs +258 -0
  137. package/tests/browser/new-tab-hit-target.spec.mjs +228 -0
  138. package/tests/browser/no-project-conversation.spec.mjs +113 -0
  139. package/tests/browser/optimistic-prompt.spec.mjs +3 -0
  140. package/tests/browser/overhaul-w7-accessibility.spec.mjs +227 -0
  141. package/tests/browser/overhaul-w7-capabilities.spec.mjs +298 -0
  142. package/tests/browser/overhaul-w7-companions.spec.mjs +290 -0
  143. package/tests/browser/overhaul-w7-focus-repairs.spec.mjs +210 -0
  144. package/tests/browser/overhaul-w7-layout-repairs.spec.mjs +183 -0
  145. package/tests/browser/overhaul-w7-parent-repairs.spec.mjs +97 -0
  146. package/tests/browser/overhaul-w7-pwa.spec.mjs +247 -0
  147. package/tests/browser/overhaul-w7-responsive.spec.mjs +450 -0
  148. package/tests/browser/overhaul-w7-update.spec.mjs +215 -0
  149. package/tests/browser/overhaul-w7-zoom.spec.mjs +243 -0
  150. package/tests/browser/overview-agent-ownership.spec.mjs +45 -0
  151. package/tests/browser/persistent-ui-layout.spec.mjs +3 -0
  152. package/tests/browser/project-artifact-controller.spec.mjs +324 -0
  153. package/tests/browser/project-artifact-integration.spec.mjs +103 -0
  154. package/tests/browser/project-file-buffer-integration.spec.mjs +230 -0
  155. package/tests/browser/project-git-tools-integration.spec.mjs +369 -0
  156. package/tests/browser/session-fixture.mjs +118 -0
  157. package/tests/browser/session-ownership.spec.mjs +175 -0
  158. package/tests/browser/session-shelves-integration.spec.mjs +219 -0
  159. package/tests/browser/session-shelves.spec.mjs +340 -0
  160. package/tests/browser/session-sidebar-resize.spec.mjs +138 -0
  161. package/tests/browser/session-summary.spec.mjs +17 -12
  162. package/tests/browser/settings-complete-home.spec.mjs +463 -0
  163. package/tests/browser/settings-entrypoint.spec.mjs +104 -0
  164. package/tests/browser/settings-navigation-controller.spec.mjs +383 -0
  165. package/tests/browser/settings-navigation-integration.spec.mjs +348 -0
  166. package/tests/browser/settings-resource-lifetime.spec.mjs +349 -0
  167. package/tests/browser/settings-workspace-integration.spec.mjs +132 -0
  168. package/tests/browser/shell-ownership.spec.mjs +398 -0
  169. package/tests/browser/shell-rollout-fixture.mjs +259 -0
  170. package/tests/browser/shell-rollout.spec.mjs +357 -0
  171. package/tests/browser/shell-tools-launcher.spec.mjs +260 -0
  172. package/tests/browser/shell-workspace.spec.mjs +433 -0
  173. package/tests/browser/side-panel-section-reorder.spec.mjs +3 -1
  174. package/tests/browser/sidebar-floating-tooltips.spec.mjs +37 -0
  175. package/tests/browser/sidebar-update-integration.spec.mjs +277 -0
  176. package/tests/browser/sidebar-update-menu.spec.mjs +402 -0
  177. package/tests/browser/sidebar-update-progress.spec.mjs +472 -0
  178. package/tests/browser/stream-output-isolation.spec.mjs +6 -3
  179. package/tests/browser/themed-selects.spec.mjs +297 -0
  180. package/tests/browser/thread-start-flow.spec.mjs +481 -0
  181. package/tests/browser/ui-polish-activity-controls.spec.mjs +177 -0
  182. package/tests/browser/ui-polish-features.spec.mjs +85 -0
  183. package/tests/browser/ui-polish-file-header.spec.mjs +43 -0
  184. package/tests/browser/ui-polish-local-git.spec.mjs +183 -0
  185. package/tests/browser/ui-polish-mobile-recovery.spec.mjs +36 -0
  186. package/tests/browser/ui-polish-navigation.spec.mjs +127 -0
  187. package/tests/browser/ui-polish-session-actions.spec.mjs +282 -0
  188. package/tests/browser/user-noticeable-fixes.spec.mjs +10 -3
  189. package/tests/browser/windows-drive-parent.spec.mjs +4 -2
  190. package/tests/browser/workspace-draft-selection.spec.mjs +266 -0
  191. package/tests/codex-fast-mode-static.test.mjs +16 -11
  192. package/tests/codex-speed-mode-browser-state.test.mjs +6 -3
  193. package/tests/codex-usage-source.test.mjs +4 -3
  194. package/tests/component-update-api-static.test.mjs +2 -2
  195. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  196. package/tests/control-deck-component-updates-static.test.mjs +9 -4
  197. package/tests/control-visibility-static.test.mjs +3 -3
  198. package/tests/controls-layout-static.test.mjs +5 -5
  199. package/tests/conversation-overview-adapter.test.mjs +100 -0
  200. package/tests/document-artifact-static.test.mjs +2 -1
  201. package/tests/draft-conversations.test.mjs +205 -0
  202. package/tests/empty-startup-launcher.test.mjs +197 -0
  203. package/tests/events-tree-context-menu-static.test.mjs +22 -18
  204. package/tests/fake-pi-session-ownership.test.mjs +302 -0
  205. package/tests/fast-mode-client-static.test.mjs +1 -1
  206. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  207. package/tests/feature-system-prompt-optional-feature-static.test.mjs +1 -1
  208. package/tests/file-viewer-image-static.test.mjs +15 -11
  209. package/tests/file-viewer-search-static.test.mjs +5 -5
  210. package/tests/fixtures/fake-pi.mjs +41 -9
  211. package/tests/footer-provider-usage-visual-static.test.mjs +7 -6
  212. package/tests/foreground-transcript-catch-up-static.test.mjs +7 -4
  213. package/tests/git-footer-context-menu-static.test.mjs +1 -1
  214. package/tests/git-panel-file-preview-static.test.mjs +41 -48
  215. package/tests/git-panel-live-updates-static.test.mjs +2 -1
  216. package/tests/git-workflow-dispatch.test.mjs +66 -0
  217. package/tests/git-workflow-preferences.test.mjs +9 -1
  218. package/tests/guided-git-activation-static.test.mjs +14 -11
  219. package/tests/guided-git-fallback-ui-static.test.mjs +8 -5
  220. package/tests/guided-git-message-reliability-static.test.mjs +10 -6
  221. package/tests/guided-git-publication-backend-static.test.mjs +16 -11
  222. package/tests/http-endpoints-harness.test.mjs +21 -9
  223. package/tests/interaction-state-stability-static.test.mjs +4 -3
  224. package/tests/intercom-conversation-viewer-static.test.mjs +29 -17
  225. package/tests/intercom-tag-layout-static.test.mjs +13 -12
  226. package/tests/intercom-tag-overflow-layout.test.mjs +11 -10
  227. package/tests/main-output-loading-static.test.mjs +4 -4
  228. package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
  229. package/tests/mobile-compact-layout.test.mjs +2 -2
  230. package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
  231. package/tests/mobile-foundation-static.test.mjs +10 -7
  232. package/tests/mobile-phone-experience-static.test.mjs +3 -2
  233. package/tests/mobile-static.test.mjs +173 -135
  234. package/tests/model-catalog-order.test.mjs +103 -0
  235. package/tests/native-parity.test.mjs +6 -4
  236. package/tests/native-session-choice-owner.test.mjs +102 -0
  237. package/tests/native-update-lifecycle.test.mjs +10 -5
  238. package/tests/no-project-http-harness.test.mjs +328 -0
  239. package/tests/no-project-navigation.test.mjs +54 -0
  240. package/tests/no-project-workspaces.test.mjs +77 -0
  241. package/tests/open-issue-wizard-static.test.mjs +1 -1
  242. package/tests/optional-feature-migration-frontend.test.mjs +4 -4
  243. package/tests/optional-feature-prompt-impact-static.test.mjs +3 -3
  244. package/tests/package-updates.test.mjs +630 -0
  245. package/tests/persistent-ui-layout-static.test.mjs +3 -3
  246. package/tests/platform-event-stream.test.mjs +253 -0
  247. package/tests/project-file-viewer-controller.test.mjs +652 -0
  248. package/tests/project-git-tools-adapter.test.mjs +103 -0
  249. package/tests/project-git-tools-controller.test.mjs +577 -0
  250. package/tests/project-runners-controller.test.mjs +453 -0
  251. package/tests/prompt-input-vertical-scroll-static.test.mjs +3 -3
  252. package/tests/prompt-routing-input-clear-static.test.mjs +2 -2
  253. package/tests/questionnaire-dialog.test.mjs +6 -6
  254. package/tests/queue-edit-reorder-static.test.mjs +48 -51
  255. package/tests/rpc-supervisor-host.test.mjs +4 -1
  256. package/tests/safety-guard-auto-review-static.test.mjs +1 -1
  257. package/tests/sampling-native-controls-user-flow.test.mjs +7 -1
  258. package/tests/server-app-runners.test.mjs +536 -0
  259. package/tests/server-codex-fast-mode.test.mjs +346 -0
  260. package/tests/server-conversation-mode.test.mjs +386 -0
  261. package/tests/server-conversation-voice.test.mjs +426 -0
  262. package/tests/server-extension-ui-requests.test.mjs +357 -0
  263. package/tests/server-git-generation.test.mjs +558 -0
  264. package/tests/server-git-mutations.test.mjs +729 -0
  265. package/tests/server-git-reads.test.mjs +381 -0
  266. package/tests/server-git-worktree-sessions.test.mjs +502 -0
  267. package/tests/server-helper-requests.test.mjs +364 -0
  268. package/tests/server-rpc-transports.test.mjs +553 -0
  269. package/tests/server-settings-store.test.mjs +132 -0
  270. package/tests/server-shell-rollout.test.mjs +478 -0
  271. package/tests/server-sse-delivery.test.mjs +410 -0
  272. package/tests/server-workspace-files.test.mjs +546 -0
  273. package/tests/session-attention-scheduler.test.mjs +514 -0
  274. package/tests/session-composer-store.test.mjs +153 -0
  275. package/tests/session-context.test.mjs +134 -0
  276. package/tests/session-extension-requests.test.mjs +193 -0
  277. package/tests/session-ownership-adapter.test.mjs +130 -0
  278. package/tests/session-sampling-ui-static.test.mjs +10 -4
  279. package/tests/session-send-lifetime.test.mjs +140 -0
  280. package/tests/session-shelf-state.test.mjs +348 -0
  281. package/tests/session-shelves-adapter.test.mjs +79 -0
  282. package/tests/session-summary-lifetime.test.mjs +54 -0
  283. package/tests/settings-resource-controller.test.mjs +548 -0
  284. package/tests/shell-action-adapter.test.mjs +169 -0
  285. package/tests/shell-actions.test.mjs +182 -0
  286. package/tests/shell-navigation.test.mjs +348 -0
  287. package/tests/shell-preferences.test.mjs +367 -0
  288. package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
  289. package/tests/stream-output-isolation-static.test.mjs +1 -1
  290. package/tests/subagent-gate-visibility.test.mjs +1 -1
  291. package/tests/subagent-launch-slot-state.test.mjs +2 -2
  292. package/tests/subagent-launch-slots-static.test.mjs +1 -1
  293. package/tests/subagent-observability-static.test.mjs +2 -2
  294. package/tests/subagent-reliability-integration.test.mjs +13 -30
  295. package/tests/syntax-highlighting-static.test.mjs +3 -3
  296. package/tests/tab-close-continuity-static.test.mjs +1 -1
  297. package/tests/tab-metadata-ordering.test.mjs +99 -0
  298. package/tests/terminal-cwd-grouping-static.test.mjs +2 -2
  299. package/tests/terminal-tab-prompt-tooltip-static.test.mjs +2 -0
  300. package/tests/terminal-tab-workspace-static.test.mjs +5 -4
  301. package/tests/terminal-tabs-resize-static.test.mjs +1 -1
  302. package/tests/theme-customizer-static.test.mjs +1 -1
  303. package/tests/thread-display-title.test.mjs +44 -0
  304. package/tests/update-api-harness.test.mjs +15 -14
  305. package/tests/update-tab-restore-harness.test.mjs +3 -0
  306. package/tests/webui-settings-locking.test.mjs +2 -2
  307. package/tests/windows-drive-cwd-picker-static.test.mjs +7 -9
  308. package/tests/workspace-choices.test.mjs +114 -0
  309. package/tests/workspace-save-load-static.test.mjs +7 -4
@@ -13,8 +13,8 @@ assert.equal(shouldRenderTerminalTabGroup({ custom: false, cwd: "", tabs: [{}, {
13
13
  assert.equal(shouldRenderTerminalTabGroup({ custom: true, cwd: "", tabs: [{}] }, 2), false, "a one-tab custom group should remain ungrouped");
14
14
  assert.equal(shouldRenderTerminalTabGroup({ custom: true, cwd: "", tabs: [{}, {}] }, 1), true, "multi-tab custom groups should retain their existing behavior");
15
15
 
16
- assert.match(app, /function createTerminalTabCwdAddMenu\(tab\)[\s\S]*make\("div", "terminal-tab-cwd-add-menu"\)[\s\S]*make\("button", "terminal-tab-group-add terminal-tab-cwd-add", "\+ Tab"\)[\s\S]*createTerminalTab\(tab\.cwd \|\| currentDirectoryForNewTab\(\)/, "a singleton CWD should receive a below-tab + Tab menu using its directory");
17
- assert.match(app, /const showCwdAdd = groups\.length > 1 && group\.tabs\.length === 1 && Boolean\(group\.cwd\);[\s\S]*renderTerminalTab\(tab, \{ showCwdAdd \}\)/, "the direct + Tab action should appear only for singleton CWDs when multiple CWD groups are open");
16
+ assert.match(app, /function createTerminalTabCwdAddMenu\(tab\)[\s\S]*make\("div", "terminal-tab-cwd-add-menu"\)[\s\S]*make\("button", "terminal-tab-group-add terminal-tab-cwd-add", "\+ Thread"\)[\s\S]*createTerminalTab\(tab\.cwd \|\| currentDirectoryForNewTab\(\)/, "a singleton CWD should receive a below-tab + Thread menu using its directory");
17
+ assert.match(app, /const showCwdAdd = groups\.length > 1 && group\.tabs\.length === 1 && Boolean\(group\.cwd\);[\s\S]*renderTerminalTab\(tab, \{ showCwdAdd \}\)/, "the direct + Thread action should appear only for singleton CWDs when multiple CWD groups are open");
18
18
  assert.match(app, /function renderTerminalTab\(tab, \{ showCwdAdd = false \} = \{\}\)[\s\S]*terminal-tab-cwd-add-host[\s\S]*if \(showCwdAdd\) wrapper\.append\(createTerminalTabCwdAddMenu\(tab\)\)/, "singleton CWDs should stay on the regular tab rendering path with a separate add-only menu");
19
19
  assert.match(styles, /\.terminal-tab-cwd-add-menu \{[\s\S]*position:\s*absolute;[\s\S]*inset:\s*100% 0 auto 0;[\s\S]*display:\s*none;/, "the singleton + Tab menu should sit hidden directly below its tab");
20
20
  assert.match(styles, /\.terminal-tab-cwd-add-host:hover \.terminal-tab-cwd-add-menu,\n\.terminal-tab-cwd-add-host:focus-within \.terminal-tab-cwd-add-menu \{\n\s+display:\s*flex;/, "hover or keyboard focus should reveal the singleton + Tab menu");
@@ -24,6 +24,7 @@ function appFunctionToMarker(name, marker) {
24
24
  const promptSource = appFunctionSource("terminalTabPromptTooltip", "terminalTabGroupRepresentedTab");
25
25
  const representedTabSource = appFunctionSource("terminalTabGroupRepresentedTab", "terminalTabTooltip");
26
26
  const tabTooltipSource = appFunctionSource("terminalTabTooltip", "terminalTabGroupStatusTooltip");
27
+ const threadDisplayTitleSource = appFunctionSource("threadDisplayTitle", "tabIndicator");
27
28
  const groupTooltipSource = appFunctionSource("terminalTabGroupTooltip", "appendTerminalTabContent");
28
29
  const regularRendererSource = appFunctionSource("renderTerminalTab", "renderTerminalTabGroupItem");
29
30
  const groupedItemRendererSource = appFunctionSource("renderTerminalTabGroupItem", "shouldRenderTerminalTabGroup");
@@ -59,6 +60,7 @@ for (const [name, result] of Object.entries(promptResults).filter(([name]) => ![
59
60
 
60
61
  const tooltipResults = vm.runInNewContext(`
61
62
  ${promptSource}
63
+ ${threadDisplayTitleSource}
62
64
  ${representedTabSource}
63
65
  ${tabTooltipSource}
64
66
  ${groupTooltipSource}
@@ -23,6 +23,7 @@ function appFunctionToMarker(name, marker) {
23
23
  }
24
24
 
25
25
  const sources = [
26
+ appFunctionSource("threadDisplayTitle", "tabIndicator"),
26
27
  appFunctionSource("tabGroupTitle", "terminalDisplayGroupTitle"),
27
28
  appFunctionSource("normalizeGitWorkspaceInfo", "gitWorkspaceBadgeLabel"),
28
29
  appFunctionSource("terminalTabWorkspaceName", "terminalTabMeta"),
@@ -86,8 +87,8 @@ assert.match(results.running, /Active: app runner: npm test · voice: listening
86
87
  assert.equal((results.stopped.match(/Stopped/g) || []).length, 1, "stopped status should appear exactly once");
87
88
  assert.match(results.stopped, /Working folder: \/tmp\/other\/pi-package-webui/, "same-basename workspaces should remain distinguishable by full path");
88
89
  assert.doesNotMatch(`${results.running}\n${results.stopped}`, /4242|secret-command|session\.jsonl|\bpid\b/i, "tooltips should exclude diagnostic and private session details");
89
- assert.match(results.group, /^Tooltip group · 2 tabs\nWorkspaces: projects\/pi-package-webui, other\/pi-package-webui\nStatus: 1 working · 1 stopped/m, "group hover summary should distinguish same-basename workspaces and aggregate status");
90
- assert.match(results.group, /Click to switch · Drop tabs here to add$/, "group hover summary should preserve the drop-target affordance");
90
+ assert.match(results.group, /^Tooltip group · 2 threads\nWorkspaces: projects\/pi-package-webui, other\/pi-package-webui\nStatus: 1 working · 1 stopped/m, "group hover summary should distinguish same-basename workspaces and aggregate status");
91
+ assert.match(results.group, /Click to switch · Drop threads here to add$/, "group hover summary should preserve the drop-target affordance");
91
92
  assert.doesNotMatch(terminalTabMetaSource, /\bpid\b/i, "compact tab metadata should not expose the process PID");
92
93
  assert.equal(app.match(/applyStyledTooltip\(button, terminalTabTooltip\(tab\)/g)?.length, 2, "single and grouped-item tabs should share one tooltip formatter");
93
94
  assert.match(renderTerminalTabGroupSource, /applyStyledTooltip\(button, terminalTabGroupTooltip\(group, groupTitle\), \{ ariaLabel: false, description: true, placement: "right", preserveInternalSpaces: true, variant: "workspace", targetKey: `terminal-group:\$\{group\.key\}:switch` \}\)/, "group hover disclosure should use the shared floating tooltip layer with stable semantic identity to the right of its trigger while preserving valid prompt-path spaces");
@@ -100,10 +101,10 @@ assert.match(renderSubagentTerminalTabGroupSource, /menu\.id = `terminalTabGroup
100
101
  assert.match(styles, /\.terminal-tab-group-dropdown-indicator \{[\s\S]*display:\s*none;[\s\S]*\.terminal-tab-group-button\[aria-expanded="true"\] \.terminal-tab-group-dropdown-indicator[\s\S]*rotate\(180deg\)/, "group buttons should expose a stateful dropdown indicator");
101
102
  assert.match(styles, /\.terminal-tab-group-button \{\n\s+width:\s*100%;\n\s+min-width:\s*0;[\s\S]*\.terminal-tab-group-dropdown-indicator \{ display:\s*inline-grid; \}/, "mobile terminal groups should show the dropdown indicator and retain a full-width trigger");
102
103
  assert.match(styles, /\.terminal-tab-group:hover:not\(\.menu-open\) \.terminal-tab-group-menu,[\s\S]*\.terminal-tab-group:focus-within:not\(\.menu-open\) \.terminal-tab-group-menu \{\n\s+display:\s*none;/, "mobile focus and latched hover should not keep a toggled-closed group visible");
103
- assert.match(app, /if \(activeDrawerModal\.surface === elements\.terminalTabsShell && openTerminalTabGroupKey\)[\s\S]*event\.stopPropagation\(\)[\s\S]*clearOpenTerminalTabGroup\(openTerminalTabGroupKey, \{ force: true \}\)[\s\S]*terminal-tab-group-button/, "Escape should close a mobile group dropdown before closing the terminal drawer");
104
+ assert.match(app, /if \(surface !== elements\.terminalTabsShell \|\| !openTerminalTabGroupKey\) return false;[\s\S]*event\.stopPropagation\(\)[\s\S]*clearOpenTerminalTabGroup\(openTerminalTabGroupKey, \{ force: true \}\)[\s\S]*terminal-tab-group-button/, "Escape should close a mobile group dropdown before closing the terminal drawer");
104
105
  assert.match(app, /if \(tabId === activeTabId\) \{\n\s+clearOpenTerminalTabGroup\(null, \{ force: true \}\);\n\s+setMobileTabsExpanded\(false\);/, "selecting the already-active regular group member should close the mobile group and drawer");
105
106
  assert.match(app, /async function activateSubagentTerminalView\(viewId\)[\s\S]*clearOpenTerminalTabGroup\(null, \{ force: true \}\);\n\s+setMobileTabsExpanded\(false\);/, "selecting a subagent group member should close the mobile group and drawer");
106
- assert.match(app, /lines\.push\(isMobileView\(\) \? "Tap to open group terminals" : "Click to switch · Drop tabs here to add"\)/, "group accessible descriptions should match mobile dropdown and desktop switch behavior");
107
+ assert.match(app, /lines\.push\(isMobileView\(\) \? "Tap to open group threads" : "Click to switch · Drop threads here to add"\)/, "group accessible descriptions should match mobile dropdown and desktop switch behavior");
107
108
  assert.match(app, /footerTooltipNode\.setAttribute\("role", "tooltip"\)/, "the shared visual tooltip should expose tooltip semantics");
108
109
  assert.match(app, /document\.addEventListener\("keydown", \(event\) => \{[\s\S]*event\.key === "Escape" && footerTooltipTarget[\s\S]*hideFooterTooltip\(footerTooltipTarget\)[\s\S]*\}, true\)/, "Escape should dismiss both hover- and focus-triggered tooltips from the document capture phase");
109
110
  assert.match(app, /node\.addEventListener\("focus", \(\) => \{[\s\S]*?!node\.matches\(":focus-visible"\)[\s\S]*?showFooterTooltip\(node\)/, "touch focus should not flash styled tooltips while keyboard focus remains supported");
@@ -10,7 +10,7 @@ const css = fs.readFileSync(path.join(root, "public/styles.css"), "utf8");
10
10
  const app = fs.readFileSync(path.join(root, "public/app.js"), "utf8");
11
11
 
12
12
  test("active desktop terminal rail exposes an accessible resize separator", () => {
13
- assert.match(html, /id="terminalTabsResizeHandle"[^>]*role="separator"[^>]*aria-orientation="vertical"[^>]*aria-label="Resize terminal sidebar width"[^>]*tabindex="0"/);
13
+ assert.match(html, /id="terminalTabsResizeHandle"[^>]*role="separator"[^>]*aria-orientation="vertical"[^>]*aria-label="Resize thread sidebar width"[^>]*tabindex="0"/);
14
14
  assert.match(css, /--terminal-tabs-sidebar-width:\s*clamp\(13rem, 18vw, 19rem\)/);
15
15
  assert.match(css, /body\.terminal-tabs-left \.chat-panel \{[\s\S]*grid-template-columns:\s*minmax\(0, 1fr\) minmax\(13rem, var\(--terminal-tabs-sidebar-width\)\)/);
16
16
  assert.match(css, /\.terminal-tabs-resize-handle \{[\s\S]*left:\s*-0\.78rem/);
@@ -34,7 +34,7 @@ assert.match(html, /role="alert" hidden>[\s\S]*Replace this exact target\?/, "ov
34
34
 
35
35
  assert.match(app, /from "\.\/theme-contract\.mjs"/, "frontend should consume the shared browser-safe theme contract");
36
36
  assert.match(serviceWorker, /"\/theme-contract\.mjs"/, "the PWA app shell should cache the startup-critical theme contract");
37
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v156"/, "adding the theme contract to the startup graph should advance the PWA cache identity");
37
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v200"/, "adding the theme contract to the startup graph should advance the PWA cache identity");
38
38
  assert.match(pkg, /node --check public\/theme-contract\.mjs/, "the package check should syntax-check the startup-critical theme contract");
39
39
  assert.match(app, /function themeDraftFromCatalog\(theme, name = theme\?\.name\)[\s\S]*colors: cloneThemeDraft\(theme\?\.colors \|\| \{\}\)/, "catalog metadata should be projected into a schema-only editable draft");
40
40
  assert.match(app, /for \(const \{ name, label \} of group\.tokens\)/, "visual controls should render from the exact shared token inventory");
@@ -0,0 +1,44 @@
1
+ import assert from "node:assert/strict";
2
+ import { readFile } from "node:fs/promises";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import vm from "node:vm";
6
+
7
+ const root = join(dirname(fileURLToPath(import.meta.url)), "..");
8
+ const [app, server] = await Promise.all([
9
+ readFile(join(root, "public", "app.js"), "utf8"),
10
+ readFile(join(root, "bin", "pi-webui.mjs"), "utf8"),
11
+ ]);
12
+
13
+ const start = app.indexOf("function threadDisplayTitle(");
14
+ const end = app.indexOf("\nfunction tabIndicator(", start);
15
+ assert.ok(start >= 0 && end > start, "threadDisplayTitle should remain a standalone frontend helper");
16
+ const threadDisplayTitle = vm.runInNewContext(`${app.slice(start, end)}\nthreadDisplayTitle;`);
17
+
18
+ assert.equal(threadDisplayTitle("Terminal 1"), "Thread 1", "legacy default titles should display as threads");
19
+ assert.equal(threadDisplayTitle("Terminal 42"), "Thread 42", "multi-digit legacy default titles should keep their number");
20
+ assert.equal(threadDisplayTitle("Thread 3"), "Thread 3", "current default titles should pass through");
21
+ assert.equal(threadDisplayTitle("Terminal 1 fork"), "Terminal 1 fork", "custom titles that only start like a default should stay unchanged");
22
+ assert.equal(threadDisplayTitle("My Terminal 2"), "My Terminal 2", "custom titles that end like a default should stay unchanged");
23
+ assert.equal(threadDisplayTitle("terminal 2"), "terminal 2", "only the exact legacy default spelling should be relabelled");
24
+ assert.equal(threadDisplayTitle("Terminal "), "Terminal ", "a legacy prefix without a number should stay unchanged");
25
+ assert.equal(threadDisplayTitle(""), "", "empty titles should stay empty so callers can apply their fallback");
26
+ assert.equal(threadDisplayTitle(undefined), "", "missing titles should produce an empty label");
27
+ assert.equal(threadDisplayTitle(7), "", "non-string titles should produce an empty label");
28
+
29
+ assert.match(server, /function defaultTabTitle\(tabIndex\) \{\n\s+if \(options\.name\) return tabIndex === 1 \? options\.name : `\$\{options\.name\} \$\{tabIndex\}`;\n\s+return `Thread \$\{tabIndex\}`;\n\}/, "new default conversation titles should be Thread N while the --name override stays unchanged");
30
+
31
+ for (const [label, pattern] of [
32
+ ["sidebar tab button", /appendTerminalTabContent\(button, \{ title: threadDisplayTitle\(tab\.title\),/],
33
+ ["document title", /document\.title = tab \? `Pi Web UI · \$\{threadDisplayTitle\(tab\.title\)\}`/],
34
+ ["command palette thread rows", /`Current thread: \$\{threadDisplayTitle\(tab\.title\)\}` : `Switch to thread: \$\{threadDisplayTitle\(tab\.title\)\}`/],
35
+ ["focused shell header", /title: threadDisplayTitle\(active\?\.title\) \|\| "Start a conversation"/],
36
+ ["All tools context label", /contextLabel: threadDisplayTitle\(activeTab\(\)\?\.title\) \|\| "No active session"/],
37
+ ["subagent view parent meta", /parent \$\{threadDisplayTitle\(parent\?\.title \|\| view\.parentTitle\) \|\| "thread"\}/],
38
+ ["subagent parent group", /make\("strong", undefined, threadDisplayTitle\(tab\.tabTitle\) \|\| `Thread \$\{tab\.tabIndex \|\| "\?"\}`\)/],
39
+ ]) {
40
+ assert.match(app, pattern, `${label} should display legacy default titles through threadDisplayTitle`);
41
+ }
42
+ assert.doesNotMatch(app, /\btab\.title = threadDisplayTitle/, "display relabelling must not rewrite stored tab titles");
43
+
44
+ console.log("thread display title tests passed");
@@ -13,7 +13,8 @@ import { validateUpdateApplyRequest, validateUpdatePlanRequest } from "../lib/co
13
13
 
14
14
  assert.deepEqual(validateUpdatePlanRequest({ targets: ["pi"] }), { ok: true, targets: ["pi"] });
15
15
  assert.deepEqual(validateUpdatePlanRequest({ targets: ["webui"] }), { ok: true, targets: ["webui"] });
16
- for (const invalid of [{}, { targets: [] }, { targets: ["all"] }, { targets: ["pi", "pi"] }, { targets: ["pi", "webui"] }, { targets: ["pi"], registry: "https://evil.test" }]) {
16
+ assert.deepEqual(validateUpdatePlanRequest({ targets: ["all"] }), { ok: true, targets: ["all"] });
17
+ for (const invalid of [{}, { targets: [] }, { targets: ["bogus"] }, { targets: ["pi", "pi"] }, { targets: ["pi", "webui"] }, { targets: ["pi"], registry: "https://evil.test" }]) {
17
18
  assert.equal(validateUpdatePlanRequest(invalid).ok, false);
18
19
  }
19
20
  const digest = "a".repeat(64);
@@ -24,8 +25,8 @@ for (const invalid of [{ transactionId: "tx-1" }, { transactionId: "../x", planD
24
25
 
25
26
  const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
26
27
  const server = await readFile(path.join(root, "bin", "pi-webui.mjs"), "utf8");
27
- assert.match(server, /\/api\/update\/plan[\s\S]*validateUpdatePlanRequest[\s\S]*createNativeServerPlan/);
28
- assert.match(server, /\/api\/update\/apply[\s\S]*validateUpdateApplyRequest[\s\S]*applyNativeServerPlan/);
28
+ assert.match(server, /\/api\/update\/plan[\s\S]*validateUpdatePlanRequest[\s\S]*packageUpdates\.plan/);
29
+ assert.match(server, /\/api\/update\/apply[\s\S]*validateUpdateApplyRequest[\s\S]*packageUpdates\.apply/);
29
30
  assert.match(server, /Legacy update mutation is disabled/);
30
31
  assert.match(server, /validateNativePlan\(job\.plan, digest\)/);
31
32
  assert.match(server, /bootIdentity/);
@@ -83,12 +84,13 @@ try {
83
84
  assert.equal(combined.status, 400, "combined actions must be rejected without shell execution");
84
85
  const piPlan = await request(["pi"]);
85
86
  const piData = await piPlan.json();
86
- assert.equal(piPlan.status, 409, JSON.stringify(piData));
87
- assert.match(piData.error || "", /PATH Pi|npm-global|manual/i, "explicit fake Pi is not the verified PATH Pi");
87
+ assert.equal(piPlan.status, 201, JSON.stringify(piData));
88
+ assert.deepEqual(piData.data.plan.targets[0].command, { command: "pi", args: ["update"] });
89
+ assert.equal(piData.data.plan.pathPi, undefined, "no PATH provenance or version probe");
88
90
  const webuiPlan = await request(["webui"]);
89
91
  const webuiData = await webuiPlan.json();
90
92
  assert.equal(webuiPlan.status, 409, JSON.stringify(webuiData));
91
- assert.match(webuiData.error || "", /manual|unproven|missing/i);
93
+ assert.match(webuiData.error || "", /not installed|not.*found|not.*detected/i);
92
94
 
93
95
  const refusedApply = await fetch(`http://127.0.0.1:${webuiPort}/api/update/apply`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ transactionId: "legacy-refused-only", planDigest: digest }) });
94
96
  assert.equal(refusedApply.status, 404, "legacy per-agent journals must never authorize a native update");
@@ -100,7 +102,7 @@ try {
100
102
  assert.equal(legacy.status, 410);
101
103
 
102
104
  const getStatus = async () => (await (await fetch(`http://127.0.0.1:${webuiPort}/api/update-status`)).json()).data;
103
- assert.deepEqual((await getStatus()).nativeJobs, { pi: null, webui: null });
105
+ assert.deepEqual((await getStatus()).nativeJobs, { all: null, webui: null, pi: null });
104
106
  const stateRoot = path.join(temp, process.platform === "win32" ? "AppData/Local/PiWebUI/updates" : ".local/state/pi-webui-updates");
105
107
  const transactionId = randomUUID();
106
108
  const jobDir = path.join(stateRoot, "jobs", transactionId);
@@ -112,16 +114,15 @@ try {
112
114
  plan: { schemaVersion: 2, transactionId, requested: "webui", createdAt: new Date().toISOString(), targets: [{ id: receipt.id }],
113
115
  context: { agentDir: await realpath(path.join(temp, "agent")), ownerPackageRoot: await realpath(root), ownerBootIdentity: health.bootIdentity } } });
114
116
  const discovered = await getStatus();
115
- assert.equal(discovered.nativeJobs.webui.transactionId, transactionId, "a new browser can discover the durable job without local storage");
116
- assert.equal(discovered.nativeJobs.webui.phase, "partial");
117
- assert.equal(discovered.nativeJobs.webui.receipts[0].stderr, "fixture failure");
117
+ assert.deepEqual(discovered.nativeJobs, { all: null, webui: null, pi: null }, "new jobs do not rediscover or replay legacy journals");
118
+ assert.equal(discovered.canRunUpdate, true);
118
119
  assert.equal(JSON.stringify(discovered).includes("fixture-private-lock-token"), false);
119
- assert.equal((await getStatus()).nativeJobs.webui.transactionId, transactionId, "reconnection retains the same partial result");
120
120
  await writeFile(path.join(stateRoot, "jobs", `${randomUUID()}.json`), "invalid private record");
121
121
  const unverified = await getStatus();
122
- assert.ok(unverified.nativeJobDiscoveryError);
123
- assert.equal(unverified.canRunUpdate, false, "discovery failure cannot authorize another update");
124
- assert.equal(unverified.nativeJobDiscoveryError.includes("invalid private record"), false, "corrupt record contents must not leak in the error");
122
+ assert.equal(unverified.nativeJobDiscoveryError, "");
123
+ assert.equal(unverified.canRunUpdate, true, "historical journal validation is not a new-command preflight");
124
+ assert.equal(JSON.stringify(unverified).includes("invalid private record"), false);
125
+
125
126
  } finally {
126
127
  child.kill("SIGTERM");
127
128
  if (child.exitCode === null) await new Promise((resolve) => child.once("exit", resolve));
@@ -8,10 +8,13 @@ import { createRestoreFile, probeStartupRestore, readRestoreFileOnce } from "../
8
8
  const root = await mkdtemp(path.join(tmpdir(), "pi-webui-restore-"));
9
9
  try {
10
10
  const tabs = Array.from({ length: 130 }, (_, index) => ({ id: `tab-${index + 1}`, index: index + 1, title: `Tab ${index + 1}`, cwd: root, sessionFile: path.join(root, `${index + 1}.jsonl`) }));
11
+ Object.assign(tabs[0], { workspaceKind: "no-project", noProjectId: "bdd91e2a-1902-4b85-8c48-59b50592565d" });
11
12
  const handoff = await createRestoreFile(root, tabs);
12
13
  assert.equal(handoff.count, 130, "private restore handoff must support at least 125 tabs");
13
14
  const restored = await readRestoreFileOnce(handoff.file, root);
14
15
  assert.equal(restored.length, 130);
16
+ assert.equal(restored[0].workspaceKind, "no-project");
17
+ assert.equal(restored[0].noProjectId, tabs[0].noProjectId);
15
18
  assert.equal(restored[124].id, "tab-125");
16
19
  await assert.rejects(() => access(handoff.file), /ENOENT/, "restore handoff must be deleted after its first read");
17
20
 
@@ -14,11 +14,11 @@ import {
14
14
  webuiSettingsFile,
15
15
  withWebuiSettingsLock,
16
16
  writeWebuiSettings,
17
- } from "../lib/git-workflow-preferences.mjs";
17
+ } from "../lib/server/settings-store.mjs";
18
18
 
19
19
  const execFileAsync = promisify(execFile);
20
20
  const root = await mkdtemp(path.join(tmpdir(), "pi-webui-settings-locking-"));
21
- const moduleUrl = pathToFileURL(path.join(import.meta.dirname, "..", "lib", "git-workflow-preferences.mjs")).href;
21
+ const moduleUrl = pathToFileURL(path.join(import.meta.dirname, "..", "lib", "server", "settings-store.mjs")).href;
22
22
 
23
23
  try {
24
24
  assert.equal(webuiSettingsFile({}), path.join(homedir(), ".pi", "webui", "settings.json"));
@@ -25,7 +25,7 @@ function sourceBetween(source, start, end) {
25
25
  }
26
26
 
27
27
  assert.equal(win32.resolve("C:\\repo", "D:/"), "D:\\", "Node should treat a slash-form drive root as an absolute Windows cwd");
28
- assert.match(html, /id="pathPickerPathInput"[^>]*placeholder="Path, e\.g\. C:\/ or D:\/project"[^>]*aria-label="Directory path"/, "the cwd picker should expose an accessible direct-path field with Windows drive examples");
28
+ assert.match(html, /for="pathPickerPathInput"[^>]*>Go to a folder<\/label>[\s\S]*id="pathPickerPathInput"[^>]*type="text"[^>]*placeholder="Enter a path, e\.g\. \/home\/me or C:\/Projects"/, "the folder picker should expose a labeled direct-path field with Windows examples");
29
29
  assert.match(html, /id="pathPickerPathButton"[^>]*>Go<\/button>/, "the direct-path field should have an explicit Go action");
30
30
  assert.match(app, /pathPickerPathInput: \$\("#pathPickerPathInput"\)[\s\S]*pathPickerPathButton: \$\("#pathPickerPathButton"\)/, "the browser should bind both direct-path controls");
31
31
 
@@ -59,23 +59,21 @@ assert.match(server, /platform\(\) === "win32" && isWindowsDriveRoot\(cwd\)[\s\S
59
59
  assert.match(server, /platform\(\) === "win32" && viewPath === WINDOWS_DRIVES_PICKER_PATH[\s\S]*getWindowsDrivesPickerData\(activeCwd\)/, "the virtual Parent destination should be intercepted only on Windows");
60
60
 
61
61
  const splitFlow = sourceBetween(app, "async function splitTerminalTab", "async function createTerminalTabFromChosenDirectory");
62
- assert.match(splitFlow, /pickCwd\([\s\S]*body: \{ cwd: resolvedCwd \}/, "split terminals without a cwd should use the shared drive-aware picker");
63
- const newTabFlow = sourceBetween(app, "async function createTerminalTabFromChosenDirectory", "async function createFirstTerminalTabFromChosenDirectory");
62
+ assert.match(splitFlow, /pickCwd\([\s\S]*body: sourceTab\.workspaceKind === "no-project" \? \{ workspaceKind: "no-project" \} : \{ cwd: resolvedCwd \}/, "split terminals without a cwd should use the shared drive-aware picker");
63
+ const newTabFlow = sourceBetween(app, "async function createTerminalTabFromChosenDirectory", "function tabHasActiveAgent");
64
64
  assert.match(newTabFlow, /pickCwd\([\s\S]*createTerminalTab\(cwd/, "new terminal tabs should use the shared drive-aware picker");
65
- const firstTabFlow = sourceBetween(app, "async function createFirstTerminalTabFromChosenDirectory", "function tabHasActiveAgent");
66
- assert.match(firstTabFlow, /pickCwd\([\s\S]*createTerminalTab\(cwd/, "the first terminal should use the shared drive-aware picker");
67
65
  const cwdChangeFlow = sourceBetween(app, "async function changeActiveTabCwd()", "function footerControlKey(node)");
68
66
  assert.match(cwdChangeFlow, /await pickCwd\([\s\S]*method: "PATCH", body: \{ cwd \}/, "cwd changes should use the shared picker and pass its selected drive-qualified path to the existing tab route");
69
67
 
70
68
  assert.match(styles, /\.path-picker-path-row[\s\S]*grid-template-columns: minmax\(0, 1fr\) auto/, "the direct-path controls should use the picker row layout");
71
- assert.match(styles, /\.path-picker-current-row,[\s\S]*\.path-picker-path-row,[\s\S]*grid-template-columns: 1fr/, "the direct-path controls should stack on narrow screens");
69
+ assert.match(styles, /\.path-picker-search-row \{ grid-template-columns: minmax\(0, 1fr\) auto; \}[\s\S]*\.path-picker-create-row \{ grid-template-columns: 1fr; \}/, "narrow search retains its action beside the input while folder creation stacks");
72
70
  assert.match(readme, /Windows[\s\S]*`C:\/`[\s\S]*`D:\/project`[\s\S]*\*\*Parent\*\*[\s\S]*\*\*This PC\*\*/, "the README should explain both typed paths and Parent-based Windows drive switching");
73
71
  assert.match(technical, /working-directory picker accepts a direct path[\s\S]*\*\*Parent\*\* opens a \*\*This PC\*\*[\s\S]*navigation-only/i, "the technical reference should document the virtual drive view and its control limits");
74
72
  assert.match(development, /virtual \*\*This PC\*\* response with an empty cwd and `selectable: false`/i, "the contributor guide should record the server/browser virtual-view contract");
75
73
  assert.ok(packageJson.files.includes("TECHNICAL.md"), "the published package should include its advanced user reference");
76
74
  assert.ok(packageJson.files.includes("DEVELOPMENT.md"), "the published package should include its contributor guide");
77
- assert.match(html, /styles\.css\?v=154/, "the existing picker layout should retain its stylesheet revision");
78
- assert.match(html, /app\.js\?v=185/, "the changed picker behavior should advance the app revision");
79
- assert.match(serviceWorker, /pi-webui-pwa-v156/, "the changed browser assets should advance the PWA cache identity");
75
+ assert.match(html, /styles\.css\?v=167/, "the existing picker layout should retain its stylesheet revision");
76
+ assert.match(html, /app\.js\?v=220/, "the changed picker behavior should advance the app revision");
77
+ assert.match(serviceWorker, /pi-webui-pwa-v200/, "the changed browser assets should advance the PWA cache identity");
80
78
 
81
79
  console.log("windows-drive-cwd-picker-static.test.mjs passed");
@@ -0,0 +1,114 @@
1
+ import assert from "node:assert/strict";
2
+ import { test } from "node:test";
3
+ import {
4
+ buildWorkspaceChoices,
5
+ filterWorkspaceChoices,
6
+ WORKSPACE_CHOICE_FOLDER_LIMIT,
7
+ workspaceFolderName,
8
+ workspacePathKey,
9
+ } from "../public/workspace-choices.mjs";
10
+
11
+ const ids = choices => choices.map(choice => choice.id);
12
+
13
+ test("path keys normalize slashes and trailing separators; Windows drives ignore case", () => {
14
+ assert.equal(workspacePathKey(" /home/me/project/ "), "/home/me/project");
15
+ assert.equal(workspacePathKey("/"), "/");
16
+ assert.equal(workspacePathKey("///"), "/");
17
+ assert.equal(workspacePathKey("C:\\Users\\Me\\"), "c:/users/me");
18
+ assert.equal(workspacePathKey("D:"), "d:/");
19
+ assert.equal(workspacePathKey("/Home/Me"), "/Home/Me", "POSIX paths stay case-sensitive");
20
+ assert.equal(workspacePathKey(""), "");
21
+ assert.equal(workspacePathKey(null), "");
22
+ assert.equal(workspaceFolderName("/home/me/project/"), "project");
23
+ assert.equal(workspaceFolderName("C:\\work\\api"), "api");
24
+ assert.equal(workspaceFolderName("/"), "/");
25
+ });
26
+
27
+ test("palette order is Current, No project, pinned, recent, Browse, Branch worktree", () => {
28
+ const choices = buildWorkspaceChoices({
29
+ currentCwd: "/work/current",
30
+ pinned: [{ cwd: "/work/pinned", displayCwd: "~/pinned" }, "/work/pinned-two"],
31
+ recent: ["/work/recent"],
32
+ includeWorktree: true,
33
+ });
34
+ assert.deepEqual(ids(choices), [
35
+ "folder:/work/current", "no-project", "folder:/work/pinned", "folder:/work/pinned-two", "folder:/work/recent", "browse", "worktree",
36
+ ]);
37
+ assert.deepEqual(choices.map(choice => choice.tag), ["Current", "Isolated", "Pinned", "Pinned", "Recent", "Action", "Git"]);
38
+ assert.deepEqual(choices[2], { id: "folder:/work/pinned", kind: "folder", cwd: "/work/pinned", label: "pinned", path: "~/pinned", tag: "Pinned", selected: false });
39
+ assert.equal(choices[1].label, "No project");
40
+ assert.equal(choices.at(-2).label, "Browse…");
41
+ assert.equal(choices.at(-1).label, "Branch worktree…");
42
+ });
43
+
44
+ test("the card dropdown omits Branch worktree and works without a current folder", () => {
45
+ const choices = buildWorkspaceChoices({ pinned: ["/a"], recent: [] });
46
+ assert.deepEqual(ids(choices), ["no-project", "folder:/a", "browse"]);
47
+ });
48
+
49
+ test("duplicates collapse onto their first position while keeping the stronger tag", () => {
50
+ const choices = buildWorkspaceChoices({
51
+ currentCwd: "/work/app/",
52
+ pinned: ["/work/app", "/work/lib", " /work/lib/ "],
53
+ recent: ["/work/lib", "/work/app", "/work/other"],
54
+ });
55
+ assert.deepEqual(ids(choices), ["folder:/work/app", "no-project", "folder:/work/lib", "folder:/work/other", "browse"]);
56
+ assert.equal(choices[0].tag, "Current", "a pinned current folder is still tagged Current");
57
+ assert.equal(choices[0].cwd, "/work/app/", "the first source keeps its exact cwd");
58
+ assert.equal(choices[2].tag, "Pinned");
59
+ });
60
+
61
+ test("Windows paths dedupe regardless of separator and drive case", () => {
62
+ const choices = buildWorkspaceChoices({ currentCwd: "C:\\Repo", pinned: ["c:/repo/"], recent: ["C:/Repo"] });
63
+ assert.deepEqual(ids(choices), ["folder:c:/repo", "no-project", "browse"]);
64
+ assert.equal(choices[0].path, "C:/Repo");
65
+ });
66
+
67
+ test("invalid and empty sources are ignored", () => {
68
+ const choices = buildWorkspaceChoices({ currentCwd: " ", pinned: [null, {}, { cwd: 7 }, ""], recent: "not-a-list" });
69
+ assert.deepEqual(ids(choices), ["no-project", "browse"]);
70
+ });
71
+
72
+ test("folders are capped at the limit, counting Current", () => {
73
+ const pinned = Array.from({ length: 20 }, (_, index) => `/pinned/${index}`);
74
+ const choices = buildWorkspaceChoices({ currentCwd: "/current", pinned, recent: ["/recent"] });
75
+ const folders = choices.filter(choice => choice.kind === "folder");
76
+ assert.equal(WORKSPACE_CHOICE_FOLDER_LIMIT, 12);
77
+ assert.equal(folders.length, 12);
78
+ assert.equal(folders[0].cwd, "/current");
79
+ assert.equal(folders.at(-1).cwd, "/pinned/10");
80
+ assert.equal(buildWorkspaceChoices({ pinned, limit: 3 }).filter(choice => choice.kind === "folder").length, 3);
81
+ });
82
+
83
+ test("selection marks the draft folder, or No project for an empty cwd, and keeps an unlisted folder visible", () => {
84
+ const listed = buildWorkspaceChoices({ currentCwd: "/a", pinned: ["/b"], selectedCwd: "/b/" });
85
+ assert.deepEqual(listed.filter(choice => choice.selected).map(choice => choice.id), ["folder:/b"]);
86
+
87
+ const noProject = buildWorkspaceChoices({ currentCwd: "/a", selectedCwd: "" });
88
+ assert.deepEqual(noProject.filter(choice => choice.selected).map(choice => choice.id), ["no-project"]);
89
+
90
+ const unmarked = buildWorkspaceChoices({ currentCwd: "/a", selectedCwd: null });
91
+ assert.deepEqual(unmarked.filter(choice => choice.selected), []);
92
+
93
+ const pinned = Array.from({ length: 12 }, (_, index) => `/pinned/${index}`);
94
+ const browsed = buildWorkspaceChoices({ currentCwd: "/a", pinned, selectedCwd: "/browsed/folder" });
95
+ assert.deepEqual(ids(browsed).slice(0, 4), ["folder:/a", "no-project", "folder:/browsed/folder", "folder:/pinned/0"]);
96
+ assert.equal(browsed[2].tag, "Folder");
97
+ assert.equal(browsed[2].selected, true);
98
+ });
99
+
100
+ test("filter matches folder name or path case-insensitively and always keeps the actions", () => {
101
+ const choices = buildWorkspaceChoices({
102
+ currentCwd: "/home/me/Alpha",
103
+ pinned: [{ cwd: "/srv/beta", displayCwd: "/srv/Beta" }],
104
+ recent: ["/opt/gamma"],
105
+ includeWorktree: true,
106
+ });
107
+ assert.deepEqual(ids(filterWorkspaceChoices(choices, "ALPHA")), ["folder:/home/me/Alpha", "browse", "worktree"]);
108
+ assert.deepEqual(ids(filterWorkspaceChoices(choices, "srv/")), ["folder:/srv/beta", "browse", "worktree"]);
109
+ assert.deepEqual(ids(filterWorkspaceChoices(choices, "no proj")), ["no-project", "browse", "worktree"]);
110
+ assert.deepEqual(ids(filterWorkspaceChoices(choices, "own folder")), ["browse", "worktree"], "the No project description is not searchable path text");
111
+ assert.deepEqual(ids(filterWorkspaceChoices(choices, "zzz")), ["browse", "worktree"]);
112
+ assert.deepEqual(ids(filterWorkspaceChoices(choices, " ")), ids(choices));
113
+ assert.notEqual(filterWorkspaceChoices(choices, ""), choices, "filtering returns a new array");
114
+ });
@@ -16,7 +16,10 @@ const actionEnd = html.indexOf("</div>", actionStart);
16
16
  const saveButton = html.indexOf('id="workspaceSaveButton"', actionStart);
17
17
  assert.ok(actionStart >= 0 && saveButton > actionStart && saveButton < actionEnd, "Save workspace must be a header action");
18
18
  assert.match(html, /workspaceSaveButton[\s\S]*?aria-label="Save workspace"/, "Save workspace must be labelled");
19
- assert.match(app, /applyStyledTooltip\(elements\.workspaceSaveButton,[\s\S]*?floating: false/, "Save workspace must keep only its dedicated styled tooltip instead of also binding the shared floating tooltip");
19
+ const saveTooltip = app.match(/applyStyledTooltip\(elements\.workspaceSaveButton,[\s\S]*?\);/)?.[0];
20
+ assert.ok(saveTooltip, "Save workspace must use the shared styled tooltip owner");
21
+ assert.doesNotMatch(saveTooltip, /floating: false/, "Save workspace must escape clipped sidebar ancestors");
22
+ assert.match(css, /\[data-tooltip-floating="true"\]::after[^}]*display: none !important/, "Shared tooltips must suppress duplicate pseudo tooltips");
20
23
 
21
24
  assert.match(app, /function saveWebuiWorkspace[\s\S]*?api\("\/api\/workspaces", \{ method: "POST", body, scoped: false \}\)/, "Save must use an unscoped workspace API call");
22
25
  assert.match(app, /function refreshSavedWorkspaces[\s\S]*?api\("\/api\/workspaces", \{ scoped: false \}\)/, "Workspace list must use an unscoped API call");
@@ -42,10 +45,10 @@ assert.match(app, /label: "Workspace: Save"/, "The command palette must offer wo
42
45
  assert.match(app, /label: "Workspace: Load…"/, "The command palette must offer workspace load when no tabs exist");
43
46
  assert.match(app, /function closeAllTerminalTabs[\s\S]*?allowEmpty: true/, "Close all must permit the planned zero-tab workspace-load state");
44
47
  assert.match(app, /function closeTerminalTabs[\s\S]*?if \(!tabs\.length\) setWorkspaceDashboardCollapsed\(false, \{ persist: false \}\)/, "Closing all tabs must reveal the workspace picker dashboard");
45
- assert.match(app, /function initializeTabs[\s\S]*?if \(!saved\.length\) await createFirstTerminalTabFromChosenDirectory\(\)/, "Fresh installs without saved workspaces must retain the first-terminal cwd prompt");
48
+ assert.match(app, /async function initializeTabs\(\)[\s\S]*?if \(!loadedTabs\.length\)[\s\S]*?refreshSavedWorkspaces\(\)/, "Empty startup must retain saved workspace discovery without requiring a folder choice");
46
49
 
47
50
  const emptyStart = app.slice(app.indexOf("function renderEmptyStartState"), app.indexOf("function userPromptTargets"));
48
- assert.match(emptyStart, /title: "Load workspace"[\s\S]*?description: "Restore a saved tab constellation"[\s\S]*?openWorkspaceLoadPicker/, "The empty-start card must offer a labelled saved-workspace picker action");
51
+ assert.match(emptyStart, /title: "Load workspace"[\s\S]*?description: "Restore a saved thread constellation"[\s\S]*?openWorkspaceLoadPicker/, "The empty-start card must offer a labelled saved-workspace picker action");
49
52
  assert.match(html, /id="workspaceLoadDialog"[\s\S]*?aria-labelledby="workspaceLoadDialogTitle"/, "The saved-workspace picker must use a labelled dialog");
50
53
  assert.match(html, /id="workspaceReplaceDialog"[\s\S]*?workspaceReplaceCurrentTabsList[\s\S]*?workspaceReplaceSaveName[\s\S]*?Load without saving[\s\S]*?Save &amp; load/, "The replacement dialog must expose current tabs, a save name, and explicit discard/save choices");
51
54
  assert.match(app, /function renderWorkspaceLoadDialog[\s\S]*?Loading saved workspaces…[\s\S]*?workspace-load-dialog-retry[\s\S]*?No saved workspaces yet[\s\S]*?loadWebuiWorkspace[\s\S]*?workspace-load-dialog-item-delete danger[\s\S]*?deleteWebuiWorkspace[\s\S]*?workspaceLoadDialogCloseButton\?\.focus/, "The dialog picker must render loading, retry/error, empty, load, and destructive delete states while preserving focus after deletion");
@@ -56,7 +59,7 @@ assert.match(app, /workspaceReplaceDiscardButton[\s\S]*?replaceOpenTabs: true, d
56
59
  assert.match(loadFlow, /const decision = await chooseWorkspaceReplacement[\s\S]*?Object\.keys\(decision\)\.length[\s\S]*?body: decision/, "Open-tab loading must send the WS1 decision body while zero-tab loading keeps an empty body");
57
60
  assert.match(loadFlow, /workspace with that name already exists[\s\S]*?confirmLabel: "Overwrite & load"[\s\S]*?overwrite: true/, "Duplicate save-and-load names must confirm overwrite before retrying");
58
61
  assert.match(loadFlow, /data\.closedIds[\s\S]*?retireClosedWorkspaceTabContexts\(closedIds\)[\s\S]*?data\.savedCurrent\?\.workspaces/, "The client must reconcile closed tabs and optional saved-current workspace metadata");
59
- assert.match(app, /function retireClosedWorkspaceTabContexts[\s\S]*?tabDrafts\.delete[\s\S]*?clearAttachments[\s\S]*?fileViewersByTab\.delete[\s\S]*?removeSubagentTerminalViewsForParent/, "Workspace replacement must retire per-tab client state along with closed tabs");
62
+ assert.match(app, /function retireClosedWorkspaceTabContexts[\s\S]*?clearAttachments[\s\S]*?composerStore\.clearTab[\s\S]*?projectFiles\.forgetTab[\s\S]*?removeSubagentTerminalViewsForParent/, "Workspace replacement must retire per-tab client state along with closed tabs");
60
63
 
61
64
  assert.match(css, /body\.terminal-tabs-left \.terminal-sidebar-actions \{[\s\S]*?grid-template-columns: repeat\(4, minmax\(0, 1fr\)\)/, "The left tab layout must provide four action slots");
62
65
  assert.match(css, /\.workspace-saved-workspaces/, "Saved-workspace picker styles must be scoped");