@firstpick/pi-package-webui 0.11.0 → 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 (318) hide show
  1. package/DEVELOPMENT.md +181 -12
  2. package/README.md +41 -9
  3. package/TECHNICAL.md +91 -8
  4. package/bin/pi-webui.mjs +5432 -11428
  5. package/index.ts +10 -3
  6. package/lib/codex-cli-usage.mjs +232 -0
  7. package/lib/codex-usage-auth.mjs +39 -3
  8. package/lib/codex-usage-source.mjs +36 -0
  9. package/lib/component-update-state.mjs +2 -2
  10. package/lib/git-workflow-preference-values.mjs +122 -0
  11. package/lib/git-workflow-preferences.mjs +35 -563
  12. package/lib/package-updates.mjs +260 -0
  13. package/lib/rpc-supervisor-client.mjs +8 -4
  14. package/lib/server/app-runners.mjs +1667 -0
  15. package/lib/server/codex-fast-mode.mjs +161 -0
  16. package/lib/server/conversation-mode.mjs +218 -0
  17. package/lib/server/conversation-voice.mjs +318 -0
  18. package/lib/server/extension-ui-requests.mjs +114 -0
  19. package/lib/server/git-generation.mjs +459 -0
  20. package/lib/server/git-mutations.mjs +1827 -0
  21. package/lib/server/git-reads.mjs +608 -0
  22. package/lib/server/git-worktree-sessions.mjs +408 -0
  23. package/lib/server/helper-requests.mjs +82 -0
  24. package/lib/server/no-project-workspaces.mjs +103 -0
  25. package/lib/server/rpc-transports.mjs +394 -0
  26. package/lib/server/settings-store.mjs +544 -0
  27. package/lib/server/sse-delivery.mjs +138 -0
  28. package/lib/server/workspace-files.mjs +563 -0
  29. package/lib/update/supervisor.mjs +4 -0
  30. package/lib/webui-workspaces.mjs +2 -0
  31. package/package.json +5 -5
  32. package/public/activity-agents-controller.mjs +269 -0
  33. package/public/activity-events-controller.mjs +236 -0
  34. package/public/activity-intercom-controller.mjs +627 -0
  35. package/public/activity-queue-controller.mjs +534 -0
  36. package/public/activity-todo-view.mjs +89 -0
  37. package/public/activity-usage-controller.mjs +589 -0
  38. package/public/app.js +3761 -3878
  39. package/public/conversation-overview.css +84 -0
  40. package/public/conversation-overview.mjs +193 -0
  41. package/public/draft-conversations.mjs +135 -0
  42. package/public/focused-composer-controls.css +111 -0
  43. package/public/focused-composer-controls.mjs +143 -0
  44. package/public/focused-composer-disclosure.mjs +223 -0
  45. package/public/focused-shell-adapter.css +264 -0
  46. package/public/focused-shell-adapter.mjs +257 -0
  47. package/public/index.html +137 -80
  48. package/public/model-catalog-order.mjs +63 -0
  49. package/public/platform-event-stream.mjs +64 -0
  50. package/public/project-artifact-controller.mjs +218 -0
  51. package/public/project-file-viewer-controller.mjs +383 -0
  52. package/public/project-git-tools-controller.mjs +181 -0
  53. package/public/project-runners-controller.mjs +220 -0
  54. package/public/service-worker.js +52 -1
  55. package/public/session-attention-scheduler.mjs +182 -0
  56. package/public/session-composer-store.mjs +56 -0
  57. package/public/session-context.mjs +51 -0
  58. package/public/session-extension-requests.mjs +63 -0
  59. package/public/session-shelf-state.mjs +151 -0
  60. package/public/session-shelves.css +171 -0
  61. package/public/session-shelves.mjs +95 -0
  62. package/public/settings-navigation-controller.mjs +249 -0
  63. package/public/settings-navigation.css +61 -0
  64. package/public/settings-resource-controller.mjs +232 -0
  65. package/public/settings-workspace.css +19 -0
  66. package/public/settings-workspace.mjs +175 -0
  67. package/public/shell-actions.mjs +87 -0
  68. package/public/shell-attention-inbox.css +72 -0
  69. package/public/shell-attention-inbox.mjs +198 -0
  70. package/public/shell-context-actions.css +61 -0
  71. package/public/shell-context-actions.mjs +168 -0
  72. package/public/shell-inspector-resize.mjs +124 -0
  73. package/public/shell-navigation-resize.mjs +107 -0
  74. package/public/shell-navigation.mjs +127 -0
  75. package/public/shell-preferences.mjs +108 -0
  76. package/public/shell-surfaces.mjs +99 -0
  77. package/public/shell-tools-launcher.css +97 -0
  78. package/public/shell-tools-launcher.mjs +222 -0
  79. package/public/shell-view-host.mjs +115 -0
  80. package/public/shell-workspace.css +266 -0
  81. package/public/shell-workspace.mjs +402 -0
  82. package/public/sidebar-update-menu.css +190 -0
  83. package/public/sidebar-update-menu.mjs +512 -0
  84. package/public/styles.css +320 -169
  85. package/public/subagent-launch-slot-state.mjs +2 -2
  86. package/public/theme-contract.mjs +1 -1
  87. package/public/themed-selects.css +156 -0
  88. package/public/workspace-choices.mjs +104 -0
  89. package/tests/activity-agents-controller.test.mjs +652 -0
  90. package/tests/activity-events-controller.test.mjs +511 -0
  91. package/tests/app-runner-terminal-static.test.mjs +3 -3
  92. package/tests/append-system-http.test.mjs +7 -6
  93. package/tests/append-system-selector-static.test.mjs +6 -6
  94. package/tests/aur-review-widget-static.test.mjs +11 -3
  95. package/tests/boot-failure-diagnostics.test.mjs +8 -3
  96. package/tests/browser/activity-intercom-controller.spec.mjs +457 -0
  97. package/tests/browser/activity-navigation-integration.spec.mjs +45 -0
  98. package/tests/browser/activity-owner-integration.spec.mjs +201 -0
  99. package/tests/browser/activity-queue-controller.spec.mjs +405 -0
  100. package/tests/browser/activity-section-picker.spec.mjs +294 -0
  101. package/tests/browser/activity-todo-view.spec.mjs +60 -0
  102. package/tests/browser/activity-usage-controller.spec.mjs +416 -0
  103. package/tests/browser/compact-layout-integration.spec.mjs +58 -0
  104. package/tests/browser/composer-action-grid-reorder.spec.mjs +16 -0
  105. package/tests/browser/composer-disclosure.spec.mjs +389 -0
  106. package/tests/browser/composer-toolbar-polish.spec.mjs +343 -0
  107. package/tests/browser/control-deck-component-updates.spec.mjs +5 -14
  108. package/tests/browser/control-deck-side-panels.spec.mjs +27 -12
  109. package/tests/browser/control-visibility.spec.mjs +5 -0
  110. package/tests/browser/controls-layout.spec.mjs +21 -2
  111. package/tests/browser/conversation-overview.spec.mjs +251 -0
  112. package/tests/browser/draft-conversations.spec.mjs +276 -0
  113. package/tests/browser/empty-startup-fixture.mjs +135 -0
  114. package/tests/browser/empty-startup.spec.mjs +282 -0
  115. package/tests/browser/events-tree-context-menu.spec.mjs +1 -0
  116. package/tests/browser/focused-composer-more.spec.mjs +127 -0
  117. package/tests/browser/focused-model-shortcuts.spec.mjs +120 -0
  118. package/tests/browser/focused-navigation-fixture.mjs +32 -0
  119. package/tests/browser/focused-project-activity.spec.mjs +111 -0
  120. package/tests/browser/focused-shell-integration.spec.mjs +208 -0
  121. package/tests/browser/folder-picker-layout-fixture.mjs +13 -0
  122. package/tests/browser/folder-picker-layout.spec.mjs +302 -0
  123. package/tests/browser/footer-model-advanced-layout.spec.mjs +27 -14
  124. package/tests/browser/git-setup-cancel.spec.mjs +251 -0
  125. package/tests/browser/guided-git-fallback.spec.mjs +40 -21
  126. package/tests/browser/inspector-header.spec.mjs +221 -0
  127. package/tests/browser/inspector-overview-integration.spec.mjs +104 -0
  128. package/tests/browser/inspector-resize.spec.mjs +227 -0
  129. package/tests/browser/inspector-topic-overflow.spec.mjs +56 -0
  130. package/tests/browser/interaction-action-discovery.spec.mjs +332 -0
  131. package/tests/browser/interaction-attention-inbox.spec.mjs +364 -0
  132. package/tests/browser/interaction-attention-integration.spec.mjs +53 -0
  133. package/tests/browser/interaction-composer-controls.spec.mjs +267 -0
  134. package/tests/browser/interaction-composer-integration.spec.mjs +175 -0
  135. package/tests/browser/interaction-continuity.spec.mjs +50 -26
  136. package/tests/browser/interaction-model-picker.spec.mjs +86 -0
  137. package/tests/browser/last-terminal-close.spec.mjs +280 -0
  138. package/tests/browser/mobile-foundation.spec.mjs +172 -20
  139. package/tests/browser/model-catalog-groups.spec.mjs +104 -0
  140. package/tests/browser/more-row-menus.spec.mjs +258 -0
  141. package/tests/browser/new-tab-hit-target.spec.mjs +228 -0
  142. package/tests/browser/no-project-conversation.spec.mjs +113 -0
  143. package/tests/browser/optimistic-prompt.spec.mjs +3 -0
  144. package/tests/browser/overhaul-w7-accessibility.spec.mjs +227 -0
  145. package/tests/browser/overhaul-w7-capabilities.spec.mjs +298 -0
  146. package/tests/browser/overhaul-w7-companions.spec.mjs +290 -0
  147. package/tests/browser/overhaul-w7-focus-repairs.spec.mjs +210 -0
  148. package/tests/browser/overhaul-w7-layout-repairs.spec.mjs +183 -0
  149. package/tests/browser/overhaul-w7-parent-repairs.spec.mjs +97 -0
  150. package/tests/browser/overhaul-w7-pwa.spec.mjs +247 -0
  151. package/tests/browser/overhaul-w7-responsive.spec.mjs +450 -0
  152. package/tests/browser/overhaul-w7-update.spec.mjs +215 -0
  153. package/tests/browser/overhaul-w7-zoom.spec.mjs +243 -0
  154. package/tests/browser/overview-agent-ownership.spec.mjs +45 -0
  155. package/tests/browser/persistent-ui-layout.spec.mjs +3 -0
  156. package/tests/browser/project-artifact-controller.spec.mjs +324 -0
  157. package/tests/browser/project-artifact-integration.spec.mjs +103 -0
  158. package/tests/browser/project-file-buffer-integration.spec.mjs +230 -0
  159. package/tests/browser/project-git-tools-integration.spec.mjs +369 -0
  160. package/tests/browser/session-fixture.mjs +118 -0
  161. package/tests/browser/session-ownership.spec.mjs +175 -0
  162. package/tests/browser/session-shelves-integration.spec.mjs +219 -0
  163. package/tests/browser/session-shelves.spec.mjs +340 -0
  164. package/tests/browser/session-sidebar-resize.spec.mjs +138 -0
  165. package/tests/browser/session-summary.spec.mjs +17 -12
  166. package/tests/browser/settings-complete-home.spec.mjs +463 -0
  167. package/tests/browser/settings-entrypoint.spec.mjs +104 -0
  168. package/tests/browser/settings-navigation-controller.spec.mjs +383 -0
  169. package/tests/browser/settings-navigation-integration.spec.mjs +348 -0
  170. package/tests/browser/settings-resource-lifetime.spec.mjs +349 -0
  171. package/tests/browser/settings-workspace-integration.spec.mjs +132 -0
  172. package/tests/browser/shell-ownership.spec.mjs +398 -0
  173. package/tests/browser/shell-rollout-fixture.mjs +259 -0
  174. package/tests/browser/shell-rollout.spec.mjs +357 -0
  175. package/tests/browser/shell-tools-launcher.spec.mjs +260 -0
  176. package/tests/browser/shell-workspace.spec.mjs +433 -0
  177. package/tests/browser/side-panel-section-reorder.spec.mjs +3 -1
  178. package/tests/browser/sidebar-floating-tooltips.spec.mjs +37 -0
  179. package/tests/browser/sidebar-update-integration.spec.mjs +277 -0
  180. package/tests/browser/sidebar-update-menu.spec.mjs +402 -0
  181. package/tests/browser/sidebar-update-progress.spec.mjs +472 -0
  182. package/tests/browser/stream-output-isolation.spec.mjs +6 -3
  183. package/tests/browser/themed-selects.spec.mjs +297 -0
  184. package/tests/browser/thread-start-flow.spec.mjs +481 -0
  185. package/tests/browser/ui-polish-activity-controls.spec.mjs +177 -0
  186. package/tests/browser/ui-polish-features.spec.mjs +85 -0
  187. package/tests/browser/ui-polish-file-header.spec.mjs +43 -0
  188. package/tests/browser/ui-polish-local-git.spec.mjs +183 -0
  189. package/tests/browser/ui-polish-mobile-recovery.spec.mjs +36 -0
  190. package/tests/browser/ui-polish-navigation.spec.mjs +127 -0
  191. package/tests/browser/ui-polish-session-actions.spec.mjs +282 -0
  192. package/tests/browser/user-noticeable-fixes.spec.mjs +10 -3
  193. package/tests/browser/windows-drive-parent.spec.mjs +4 -2
  194. package/tests/browser/workspace-draft-selection.spec.mjs +266 -0
  195. package/tests/codex-cli-usage.test.mjs +189 -0
  196. package/tests/codex-fast-mode-static.test.mjs +16 -11
  197. package/tests/codex-speed-mode-browser-state.test.mjs +6 -3
  198. package/tests/codex-usage-auth.test.mjs +168 -9
  199. package/tests/codex-usage-http.test.mjs +124 -0
  200. package/tests/codex-usage-source.test.mjs +146 -0
  201. package/tests/component-update-api-static.test.mjs +2 -2
  202. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  203. package/tests/control-deck-component-updates-static.test.mjs +9 -4
  204. package/tests/control-visibility-static.test.mjs +3 -3
  205. package/tests/controls-layout-static.test.mjs +5 -5
  206. package/tests/conversation-overview-adapter.test.mjs +100 -0
  207. package/tests/document-artifact-static.test.mjs +2 -1
  208. package/tests/draft-conversations.test.mjs +205 -0
  209. package/tests/empty-startup-launcher.test.mjs +197 -0
  210. package/tests/events-tree-context-menu-static.test.mjs +22 -18
  211. package/tests/fake-pi-session-ownership.test.mjs +302 -0
  212. package/tests/fast-mode-client-static.test.mjs +1 -1
  213. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  214. package/tests/feature-system-prompt-optional-feature-static.test.mjs +1 -1
  215. package/tests/file-viewer-image-static.test.mjs +15 -11
  216. package/tests/file-viewer-search-static.test.mjs +5 -5
  217. package/tests/fixtures/fake-codex-app-server.mjs +61 -0
  218. package/tests/fixtures/fake-pi.mjs +41 -9
  219. package/tests/footer-provider-usage-visual-static.test.mjs +7 -6
  220. package/tests/foreground-transcript-catch-up-static.test.mjs +7 -4
  221. package/tests/git-footer-context-menu-static.test.mjs +1 -1
  222. package/tests/git-panel-file-preview-static.test.mjs +41 -48
  223. package/tests/git-panel-live-updates-static.test.mjs +2 -1
  224. package/tests/git-workflow-dispatch.test.mjs +66 -0
  225. package/tests/git-workflow-preferences.test.mjs +9 -1
  226. package/tests/guided-git-activation-static.test.mjs +14 -11
  227. package/tests/guided-git-fallback-ui-static.test.mjs +8 -5
  228. package/tests/guided-git-message-reliability-static.test.mjs +10 -6
  229. package/tests/guided-git-publication-backend-static.test.mjs +16 -11
  230. package/tests/http-endpoints-harness.test.mjs +29 -9
  231. package/tests/interaction-state-stability-static.test.mjs +4 -3
  232. package/tests/intercom-conversation-viewer-static.test.mjs +29 -17
  233. package/tests/intercom-tag-layout-static.test.mjs +13 -12
  234. package/tests/intercom-tag-overflow-layout.test.mjs +11 -10
  235. package/tests/main-output-loading-static.test.mjs +4 -4
  236. package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
  237. package/tests/mobile-compact-layout.test.mjs +2 -2
  238. package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
  239. package/tests/mobile-foundation-static.test.mjs +10 -7
  240. package/tests/mobile-phone-experience-static.test.mjs +3 -2
  241. package/tests/mobile-static.test.mjs +173 -135
  242. package/tests/model-catalog-order.test.mjs +103 -0
  243. package/tests/native-parity.test.mjs +6 -4
  244. package/tests/native-session-choice-owner.test.mjs +102 -0
  245. package/tests/native-update-lifecycle.test.mjs +10 -5
  246. package/tests/no-project-http-harness.test.mjs +328 -0
  247. package/tests/no-project-navigation.test.mjs +54 -0
  248. package/tests/no-project-workspaces.test.mjs +77 -0
  249. package/tests/open-issue-wizard-static.test.mjs +1 -1
  250. package/tests/optional-feature-migration-frontend.test.mjs +4 -4
  251. package/tests/optional-feature-prompt-impact-static.test.mjs +3 -3
  252. package/tests/package-updates.test.mjs +630 -0
  253. package/tests/persistent-ui-layout-static.test.mjs +3 -3
  254. package/tests/platform-event-stream.test.mjs +253 -0
  255. package/tests/project-file-viewer-controller.test.mjs +652 -0
  256. package/tests/project-git-tools-adapter.test.mjs +103 -0
  257. package/tests/project-git-tools-controller.test.mjs +577 -0
  258. package/tests/project-runners-controller.test.mjs +453 -0
  259. package/tests/prompt-input-vertical-scroll-static.test.mjs +3 -3
  260. package/tests/prompt-routing-input-clear-static.test.mjs +2 -2
  261. package/tests/questionnaire-dialog.test.mjs +6 -6
  262. package/tests/queue-edit-reorder-static.test.mjs +48 -51
  263. package/tests/rpc-supervisor-host.test.mjs +4 -1
  264. package/tests/safety-guard-auto-review-static.test.mjs +1 -1
  265. package/tests/sampling-native-controls-user-flow.test.mjs +7 -1
  266. package/tests/server-app-runners.test.mjs +536 -0
  267. package/tests/server-codex-fast-mode.test.mjs +346 -0
  268. package/tests/server-conversation-mode.test.mjs +386 -0
  269. package/tests/server-conversation-voice.test.mjs +426 -0
  270. package/tests/server-extension-ui-requests.test.mjs +357 -0
  271. package/tests/server-git-generation.test.mjs +558 -0
  272. package/tests/server-git-mutations.test.mjs +729 -0
  273. package/tests/server-git-reads.test.mjs +381 -0
  274. package/tests/server-git-worktree-sessions.test.mjs +502 -0
  275. package/tests/server-helper-requests.test.mjs +364 -0
  276. package/tests/server-rpc-transports.test.mjs +553 -0
  277. package/tests/server-settings-store.test.mjs +132 -0
  278. package/tests/server-shell-rollout.test.mjs +478 -0
  279. package/tests/server-sse-delivery.test.mjs +410 -0
  280. package/tests/server-workspace-files.test.mjs +546 -0
  281. package/tests/session-attention-scheduler.test.mjs +514 -0
  282. package/tests/session-composer-store.test.mjs +153 -0
  283. package/tests/session-context.test.mjs +134 -0
  284. package/tests/session-extension-requests.test.mjs +193 -0
  285. package/tests/session-ownership-adapter.test.mjs +130 -0
  286. package/tests/session-sampling-ui-static.test.mjs +10 -4
  287. package/tests/session-send-lifetime.test.mjs +140 -0
  288. package/tests/session-shelf-state.test.mjs +348 -0
  289. package/tests/session-shelves-adapter.test.mjs +79 -0
  290. package/tests/session-summary-lifetime.test.mjs +54 -0
  291. package/tests/settings-resource-controller.test.mjs +548 -0
  292. package/tests/shell-action-adapter.test.mjs +169 -0
  293. package/tests/shell-actions.test.mjs +182 -0
  294. package/tests/shell-navigation.test.mjs +348 -0
  295. package/tests/shell-preferences.test.mjs +367 -0
  296. package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
  297. package/tests/stream-output-isolation-static.test.mjs +1 -1
  298. package/tests/subagent-gate-visibility.test.mjs +1 -1
  299. package/tests/subagent-launch-slot-state.test.mjs +2 -2
  300. package/tests/subagent-launch-slots-static.test.mjs +1 -1
  301. package/tests/subagent-observability-static.test.mjs +2 -2
  302. package/tests/subagent-reliability-integration.test.mjs +13 -30
  303. package/tests/syntax-highlighting-static.test.mjs +3 -3
  304. package/tests/tab-close-continuity-static.test.mjs +1 -1
  305. package/tests/tab-metadata-ordering.test.mjs +99 -0
  306. package/tests/terminal-cwd-grouping-static.test.mjs +2 -2
  307. package/tests/terminal-tab-prompt-tooltip-static.test.mjs +2 -0
  308. package/tests/terminal-tab-workspace-static.test.mjs +5 -4
  309. package/tests/terminal-tabs-resize-static.test.mjs +1 -1
  310. package/tests/theme-contract.test.mjs +10 -3
  311. package/tests/theme-customizer-static.test.mjs +1 -1
  312. package/tests/thread-display-title.test.mjs +44 -0
  313. package/tests/update-api-harness.test.mjs +15 -14
  314. package/tests/update-tab-restore-harness.test.mjs +3 -0
  315. package/tests/webui-settings-locking.test.mjs +2 -2
  316. package/tests/windows-drive-cwd-picker-static.test.mjs +7 -9
  317. package/tests/workspace-choices.test.mjs +114 -0
  318. package/tests/workspace-save-load-static.test.mjs +7 -4
@@ -0,0 +1,548 @@
1
+ import assert from "node:assert/strict";
2
+ import { test } from "node:test";
3
+ import { createSettingsResourceController } from "../public/settings-resource-controller.mjs";
4
+
5
+ const MODELS = [{ provider: "z", id: "shared" }, { provider: "a", id: "shared", name: "First" }];
6
+ const A = { provider: "a", modelId: "shared" };
7
+ const Z = { provider: "z", modelId: "shared" };
8
+ const resources = () => [
9
+ { name: "read", description: "Read a file", sourceInfo: { source: "builtin" } },
10
+ { name: "write", enabled: true },
11
+ { name: "shell", enabled: false },
12
+ ];
13
+ const data = (kind = "tools", overrides = {}) => ({ [kind]: resources(), configured: false, ...overrides });
14
+ const tick = async () => { await Promise.resolve(); await Promise.resolve(); };
15
+
16
+ function fixture() {
17
+ const calls = [];
18
+ const changes = [];
19
+ const mutations = [];
20
+ let target = Object.freeze({ tabId: "a", lifetime: 1, generation: 1, dialog: 1 });
21
+ const f = { calls, changes, mutations, onChange: null, onMutation: null };
22
+ function pending(type, kind, selection, change, captured) {
23
+ return new Promise((resolve, reject) => calls.push({ type, kind, selection, change, target: captured, resolve, reject }));
24
+ }
25
+ const c = createSettingsResourceController({
26
+ read: (kind, selected, captured) => pending("read", kind, selected, null, captured),
27
+ write: (kind, selected, change, captured) => pending("write", kind, selected, change, captured),
28
+ listModels: (captured) => pending("models", null, null, null, captured),
29
+ isCurrent: (captured) => captured === target,
30
+ onChange(snapshot) { changes.push(snapshot); f.onChange?.(snapshot); },
31
+ onMutation(mutation) { mutations.push(mutation); f.onMutation?.(mutation); },
32
+ });
33
+ Object.assign(f, {
34
+ c,
35
+ target: () => target,
36
+ replace(fields = {}) { target = Object.freeze({ ...target, ...fields }); return target; },
37
+ async open(kind = "tools", result = data(kind)) {
38
+ const opened = c.open(kind, target);
39
+ calls.at(-1).resolve(result);
40
+ assert.equal(await opened, true);
41
+ },
42
+ async model(kind = "tools", result = data(kind, { models: MODELS })) {
43
+ const selected = c.setScope("model");
44
+ assert.equal(calls.at(-1).type, "models");
45
+ calls.at(-1).resolve(MODELS);
46
+ await tick();
47
+ assert.equal(calls.at(-1).type, "read");
48
+ calls.at(-1).resolve(result);
49
+ assert.equal(await selected, true);
50
+ },
51
+ });
52
+ return f;
53
+ }
54
+
55
+ test("open reads the exact target, starts Session/All, and resets a prior presentation", async () => {
56
+ const f = fixture();
57
+ assert.deepEqual(Object.keys(f.c).sort(), ["open", "setScope", "setModel", "setFilter", "toggle", "inherit", "close", "getSnapshot", "dispose"].sort());
58
+ const opened = f.c.open("tools", f.target());
59
+ assert.equal(f.calls[0].target, f.target());
60
+ assert.deepEqual(f.calls[0].selection, { scope: "session", provider: null, modelId: null });
61
+ assert.ok(Object.isFrozen(f.calls[0].selection));
62
+ assert.deepEqual(f.c.getSnapshot(), {
63
+ kind: "tools", target: f.target(), selection: f.calls[0].selection, resources: [], models: [],
64
+ configured: false, filter: "all", loading: true, savingName: "", error: "",
65
+ });
66
+ f.calls[0].resolve(data());
67
+ assert.equal(await opened, true);
68
+ assert.equal(f.changes.length, 2);
69
+ assert.deepEqual(f.c.getSnapshot().resources, resources());
70
+ f.c.setFilter("disabled");
71
+ const global = f.c.setScope("global");
72
+ f.calls.at(-1).resolve(data("tools", { configured: true }));
73
+ await global;
74
+ const skills = f.c.open("skills", f.target());
75
+ assert.equal(f.c.getSnapshot().filter, "all");
76
+ assert.equal(f.c.getSnapshot().selection.scope, "session");
77
+ assert.equal(f.c.getSnapshot().configured, false);
78
+ f.calls.at(-1).resolve(data("skills"));
79
+ await skills;
80
+ const before = f.c.getSnapshot();
81
+ assert.equal(await f.c.open("extensions", f.target()), false);
82
+ assert.deepEqual(f.c.getSnapshot(), before);
83
+ });
84
+
85
+ test("filters stay local and full resource lists survive filtering", async () => {
86
+ const f = fixture();
87
+ await f.open();
88
+ const before = f.c.getSnapshot().resources;
89
+ for (const filter of ["enabled", "disabled", "all"]) {
90
+ const count = f.changes.length;
91
+ assert.equal(f.c.setFilter(filter), true);
92
+ assert.equal(f.changes.length, count + 1);
93
+ assert.equal(f.c.getSnapshot().filter, filter);
94
+ assert.equal(f.c.getSnapshot().resources, before);
95
+ assert.equal(f.c.setFilter(filter), false);
96
+ }
97
+ assert.equal(f.c.setFilter("other"), false);
98
+ assert.equal(f.calls.length, 1);
99
+ });
100
+
101
+ test("tools and skills submit full enabled sets, preserve metadata and notify captured mutations", async (t) => {
102
+ for (const kind of ["tools", "skills"]) {
103
+ await t.test(kind, async () => {
104
+ const f = fixture();
105
+ await f.open(kind);
106
+ f.c.setFilter("disabled");
107
+ const saved = f.c.toggle("shell");
108
+ const call = f.calls.at(-1);
109
+ assert.equal(call.type, "write");
110
+ assert.equal(call.kind, kind);
111
+ assert.equal(call.target, f.target());
112
+ assert.deepEqual(call.change, { enabled: ["read", "write", "shell"] });
113
+ assert.equal(f.c.getSnapshot().savingName, "shell");
114
+ assert.equal(await f.c.toggle("write"), false);
115
+ assert.equal(await f.c.inherit(), false);
116
+ assert.equal(await f.c.setScope("global"), false);
117
+ assert.equal(await f.c.setModel(A), false);
118
+ assert.equal(f.calls.length, 2);
119
+ assert.equal(f.c.setFilter("enabled"), true);
120
+ call.resolve(data(kind, { configured: true, [kind]: resources().map((item) => ({ ...item, enabled: true })) }));
121
+ assert.equal(await saved, true);
122
+ assert.equal(f.c.getSnapshot().savingName, "");
123
+ assert.equal(f.c.getSnapshot().configured, true);
124
+ assert.deepEqual(f.mutations, [{ kind, target: call.target, selection: call.selection, name: "shell", enabled: true, inherit: false }]);
125
+ assert.equal(f.mutations[0].selection, call.selection);
126
+ assert.equal(f.c.getSnapshot().resources[0].sourceInfo.source, "builtin");
127
+ });
128
+ }
129
+ });
130
+
131
+ test("explicit empty selection is distinct from inheritance in every scope", async (t) => {
132
+ for (const scope of ["session", "global", "model"]) {
133
+ await t.test(scope, async () => {
134
+ const f = fixture();
135
+ await f.open("skills", data("skills", { skills: [{ name: "one" }] }));
136
+ if (scope === "model") await f.model("skills", data("skills", { skills: [{ name: "one" }], models: MODELS }));
137
+ if (scope === "global") {
138
+ const selection = f.c.setScope("global");
139
+ f.calls.at(-1).resolve(data("skills", { skills: [{ name: "one" }] }));
140
+ await selection;
141
+ }
142
+ const selected = f.c.getSnapshot().selection;
143
+ const empty = f.c.toggle("one");
144
+ assert.deepEqual(f.calls.at(-1).change, { enabled: [] });
145
+ assert.equal(f.calls.at(-1).selection, selected);
146
+ f.calls.at(-1).resolve(data("skills", { skills: [{ name: "one", enabled: false }], configured: true }));
147
+ await empty;
148
+ assert.equal(f.c.getSnapshot().configured, true);
149
+ const inherited = f.c.inherit();
150
+ assert.deepEqual(f.calls.at(-1).change, { inherit: true });
151
+ assert.equal(f.calls.at(-1).selection, selected);
152
+ f.calls.at(-1).resolve(data("skills"));
153
+ await inherited;
154
+ assert.equal(f.c.getSnapshot().configured, false);
155
+ assert.deepEqual(f.mutations.at(-1), { kind: "skills", target: f.target(), selection: selected, name: null, enabled: null, inherit: true });
156
+ });
157
+ }
158
+ });
159
+
160
+ test("model discovery is lazy, authenticated, sorted, and retains exact identity across reordering/scopes", async () => {
161
+ const f = fixture();
162
+ await f.open();
163
+ assert.equal(f.calls.length, 1);
164
+ const model = f.c.setScope("model");
165
+ assert.equal(f.calls.at(-1).type, "models");
166
+ assert.equal(f.calls.at(-1).target, f.target());
167
+ assert.equal(f.c.getSnapshot().selection.scope, "session");
168
+ f.calls.at(-1).resolve([null, { id: "bad" }, ...MODELS, { provider: "bad", id: "" }]);
169
+ await tick();
170
+ assert.deepEqual(f.calls.at(-1).selection, { scope: "model", ...A });
171
+ assert.equal(f.calls.at(-1).target, f.target());
172
+ f.calls.at(-1).resolve(data("tools", { models: MODELS }));
173
+ await model;
174
+ assert.deepEqual(f.c.getSnapshot().selection, { scope: "model", ...A });
175
+ assert.equal(await f.c.setModel(A), false);
176
+ assert.equal(await f.c.setModel({ provider: "missing", modelId: "shared" }), false);
177
+ const exactZ = f.c.setModel(Z);
178
+ f.calls.at(-1).resolve(data("tools", { models: [...MODELS].reverse() }));
179
+ await exactZ;
180
+ assert.deepEqual(f.c.getSnapshot().selection, { scope: "model", ...Z });
181
+ const global = f.c.setScope("global");
182
+ assert.deepEqual(f.calls.at(-1).selection, { scope: "global", provider: null, modelId: null });
183
+ f.calls.at(-1).resolve(data());
184
+ await global;
185
+ const back = f.c.setScope("model");
186
+ assert.equal(f.calls.at(-1).type, "read");
187
+ assert.deepEqual(f.calls.at(-1).selection, { scope: "model", ...Z });
188
+ f.calls.at(-1).resolve(data("tools", { models: MODELS }));
189
+ await back;
190
+ const write = f.c.toggle("read");
191
+ assert.deepEqual(f.calls.at(-1).selection, { scope: "model", ...Z });
192
+ f.calls.at(-1).resolve(data("tools", { models: [...MODELS].reverse() }));
193
+ await write;
194
+ assert.deepEqual(f.mutations.at(-1).selection, { scope: "model", ...Z });
195
+ assert.equal(f.calls.filter((call) => call.type === "models").length, 1);
196
+ });
197
+
198
+ test("empty or failed model discovery preserves the previous scope and accepted resources", async (t) => {
199
+ for (const failure of ["empty", "reject"]) {
200
+ await t.test(failure, async () => {
201
+ const f = fixture();
202
+ await f.open();
203
+ const global = f.c.setScope("global");
204
+ f.calls.at(-1).resolve(data("tools", { configured: true }));
205
+ await global;
206
+ const before = f.c.getSnapshot();
207
+ const model = f.c.setScope("model");
208
+ if (failure === "empty") f.calls.at(-1).resolve([{ provider: "bad" }]);
209
+ else f.calls.at(-1).reject(new Error("Authenticated discovery failed"));
210
+ assert.equal(await model, false);
211
+ const after = f.c.getSnapshot();
212
+ assert.equal(after.selection, before.selection);
213
+ assert.equal(after.resources, before.resources);
214
+ assert.equal(after.configured, true);
215
+ assert.equal(after.loading, false);
216
+ assert.match(after.error, failure === "empty" ? /No authenticated Pi models/ : /Authenticated discovery failed/);
217
+ assert.equal(f.calls.filter((call) => call.type === "read").length, 2);
218
+ const retry = f.c.setScope("model");
219
+ f.calls.at(-1).resolve(MODELS);
220
+ await tick();
221
+ f.calls.at(-1).resolve(data("tools", { models: MODELS }));
222
+ assert.equal(await retry, true);
223
+ assert.equal(f.c.getSnapshot().error, "");
224
+ });
225
+ }
226
+ });
227
+
228
+ test("missing exact models block both kinds of write until explicitly selected again", async (t) => {
229
+ for (const responseType of ["read", "write"]) {
230
+ await t.test(responseType, async () => {
231
+ const f = fixture();
232
+ await f.open();
233
+ if (responseType === "read") await f.model("tools", data("tools", { models: [MODELS[0]] }));
234
+ else {
235
+ await f.model();
236
+ const save = f.c.toggle("read");
237
+ f.calls.at(-1).resolve(data("tools", { models: [MODELS[0]] }));
238
+ await save;
239
+ assert.deepEqual(f.mutations.at(-1).selection, { scope: "model", ...A });
240
+ }
241
+ assert.deepEqual(f.c.getSnapshot().selection, { scope: "model", ...A });
242
+ assert.match(f.c.getSnapshot().error, /a\/shared is unavailable/);
243
+ const count = f.calls.length;
244
+ assert.equal(await f.c.toggle("write"), false);
245
+ assert.equal(await f.c.inherit(), false);
246
+ assert.equal(await f.c.setModel(A), false);
247
+ assert.equal(f.calls.length, count);
248
+ const global = f.c.setScope("global");
249
+ f.calls.at(-1).resolve(data());
250
+ await global;
251
+ assert.equal(await f.c.setScope("model"), false);
252
+ assert.deepEqual(f.c.getSnapshot().selection, { scope: "model", ...A });
253
+ assert.equal(f.calls.length, count + 1);
254
+ const recover = f.c.setModel(Z);
255
+ assert.deepEqual(f.calls.at(-1).selection, { scope: "model", ...Z });
256
+ f.calls.at(-1).resolve(data("tools", { models: [MODELS[0]] }));
257
+ assert.equal(await recover, true);
258
+ assert.equal(f.c.getSnapshot().error, "");
259
+ });
260
+ }
261
+ });
262
+
263
+ test("reverse scope completions and failures never replace a newer accepted read", async (t) => {
264
+ for (const reject of [false, true]) {
265
+ await t.test(`old read rejects: ${reject}`, async () => {
266
+ const f = fixture();
267
+ const first = f.c.open("tools", f.target());
268
+ const old = f.calls.at(-1);
269
+ const latest = f.c.setScope("global");
270
+ assert.equal(await f.c.toggle("read"), false);
271
+ assert.equal(await f.c.inherit(), false);
272
+ f.calls.at(-1).resolve(data("tools", { tools: [{ name: "new" }], configured: true }));
273
+ await latest;
274
+ const snapshot = f.c.getSnapshot();
275
+ const count = f.changes.length;
276
+ if (reject) old.reject(new Error("Old read failed"));
277
+ else old.resolve(data("tools", { tools: [{ name: "old" }] }));
278
+ assert.equal(await first, false);
279
+ assert.deepEqual(f.c.getSnapshot(), snapshot);
280
+ assert.equal(f.changes.length, count);
281
+ });
282
+ }
283
+ });
284
+
285
+ test("newer Model reads retain their identity despite reverse completions", async () => {
286
+ const f = fixture();
287
+ await f.open();
288
+ await f.model();
289
+ const old = f.c.setModel(Z);
290
+ const call = f.calls.at(-1);
291
+ const latest = f.c.setModel(A);
292
+ f.calls.at(-1).resolve(data("tools", { tools: [{ name: "a-only" }], models: [...MODELS].reverse() }));
293
+ await latest;
294
+ const count = f.changes.length;
295
+ call.resolve(data("tools", { tools: [{ name: "z-only" }], models: [MODELS[0]] }));
296
+ assert.equal(await old, false);
297
+ assert.deepEqual(f.c.getSnapshot().selection, { scope: "model", ...A });
298
+ assert.deepEqual(f.c.getSnapshot().resources, [{ name: "a-only" }]);
299
+ assert.equal(f.changes.length, count);
300
+ });
301
+
302
+ test("newer discoveries win, and leaving scope during discovery suppresses its follow-up", async (t) => {
303
+ for (const destination of ["session", "global", "model"]) {
304
+ await t.test(destination, async () => {
305
+ const f = fixture();
306
+ await f.open();
307
+ const discovery = f.c.setScope("model");
308
+ const old = f.calls.at(-1);
309
+ const newer = f.c.setScope(destination);
310
+ if (destination === "model") {
311
+ f.calls.at(-1).resolve(MODELS);
312
+ await tick();
313
+ }
314
+ f.calls.at(-1).resolve(data("tools", { models: MODELS }));
315
+ await newer;
316
+ const count = f.calls.length;
317
+ old.resolve([{ provider: "old", id: "wrong" }]);
318
+ assert.equal(await discovery, false);
319
+ assert.equal(f.calls.length, count);
320
+ assert.equal(f.c.getSnapshot().selection.scope, destination);
321
+ assert.equal(f.c.getSnapshot().models.some((model) => model.provider === "old"), false);
322
+ });
323
+ }
324
+ });
325
+
326
+ test("target lifetime, foreground generation and dialog changes suppress reads, discovery and writes", async (t) => {
327
+ for (const field of ["tabId", "lifetime", "generation", "dialog"]) {
328
+ for (const operation of ["read", "models", "write", "inherit"]) {
329
+ await t.test(`${field}: ${operation}`, async () => {
330
+ const f = fixture();
331
+ let pending;
332
+ if (operation === "read") pending = f.c.open("tools", f.target());
333
+ else {
334
+ await f.open();
335
+ pending = operation === "models" ? f.c.setScope("model") : operation === "write" ? f.c.toggle("read") : f.c.inherit();
336
+ }
337
+ const call = f.calls.at(-1);
338
+ f.replace({ [field]: "replacement" });
339
+ const count = f.changes.length;
340
+ call.resolve(operation === "models" ? MODELS : data());
341
+ assert.equal(await pending, false);
342
+ assert.equal(f.changes.length, count);
343
+ assert.equal(f.mutations.length, 0);
344
+ assert.equal(f.calls.at(-1), call);
345
+ assert.equal(await f.c.toggle("read"), false);
346
+ assert.equal(await f.c.setScope("global"), false);
347
+ assert.equal(f.c.setFilter("enabled"), false);
348
+ });
349
+ }
350
+ }
351
+ });
352
+
353
+ test("old closed/reopened successes, failures and finally blocks cannot repaint or unlock new writes", async (t) => {
354
+ for (const operation of ["read", "models", "write", "inherit"]) {
355
+ for (const fail of [false, true]) {
356
+ await t.test(`${operation}, failure: ${fail}`, async () => {
357
+ const f = fixture();
358
+ let pending;
359
+ if (operation === "read") pending = f.c.open("tools", f.target());
360
+ else {
361
+ await f.open();
362
+ pending = operation === "models" ? f.c.setScope("model") : operation === "write" ? f.c.toggle("read") : f.c.inherit();
363
+ }
364
+ const old = f.calls.at(-1);
365
+ assert.equal(f.c.close(), true);
366
+ assert.equal(f.c.close(), false);
367
+ await f.open("skills");
368
+ const saving = f.c.toggle("shell");
369
+ const latest = f.calls.at(-1);
370
+ const snapshot = f.c.getSnapshot();
371
+ const count = f.changes.length;
372
+ if (fail) old.reject(new Error("Retired request failed"));
373
+ else old.resolve(operation === "models" ? MODELS : data());
374
+ assert.equal(await pending, false);
375
+ assert.deepEqual(f.c.getSnapshot(), snapshot);
376
+ assert.equal(f.changes.length, count);
377
+ assert.equal(f.c.getSnapshot().savingName, "shell");
378
+ assert.equal(await f.c.inherit(), false);
379
+ assert.equal(f.mutations.length, 0);
380
+ latest.resolve(data("skills"));
381
+ assert.equal(await saving, true);
382
+ assert.equal(f.c.getSnapshot().savingName, "");
383
+ assert.equal(f.mutations.length, 1);
384
+ });
385
+ }
386
+ }
387
+ });
388
+
389
+ test("current read/write failures release their own flags and permit retries", async (t) => {
390
+ for (const operation of ["read", "write", "inherit"]) {
391
+ await t.test(operation, async () => {
392
+ const f = fixture();
393
+ let failed;
394
+ if (operation === "read") failed = f.c.open("tools", f.target());
395
+ else {
396
+ await f.open();
397
+ failed = operation === "write" ? f.c.toggle("read") : f.c.inherit();
398
+ }
399
+ const before = f.c.getSnapshot().resources;
400
+ f.calls.at(-1).reject(new Error(`${operation} failed`));
401
+ assert.equal(await failed, false);
402
+ assert.equal(f.c.getSnapshot().error, `${operation} failed`);
403
+ assert.equal(f.c.getSnapshot().loading, false);
404
+ assert.equal(f.c.getSnapshot().savingName, "");
405
+ assert.equal(f.c.getSnapshot().resources, before);
406
+ assert.equal(f.mutations.length, 0);
407
+ const retry = operation === "read" ? f.c.setScope("global") : f.c.toggle("read");
408
+ assert.equal(f.c.getSnapshot().error, "");
409
+ f.calls.at(-1).resolve(data());
410
+ assert.equal(await retry, true);
411
+ });
412
+ }
413
+ });
414
+
415
+ test("snapshots, API records and callback projections cannot mutate owned state", async () => {
416
+ const f = fixture();
417
+ const input = data();
418
+ await f.open("tools", input);
419
+ const snapshot = f.c.getSnapshot();
420
+ input.tools[0].sourceInfo.source = "caller change";
421
+ input.tools.push({ name: "injected" });
422
+ assert.equal(snapshot.resources.length, 3);
423
+ assert.equal(snapshot.resources[0].sourceInfo.source, "builtin");
424
+ for (const project of [snapshot, f.changes.at(-1)]) {
425
+ assert.throws(() => { project.filter = "disabled"; }, TypeError);
426
+ assert.throws(() => { project.selection.scope = "global"; }, TypeError);
427
+ assert.throws(() => { project.resources[0].enabled = false; }, TypeError);
428
+ assert.throws(() => { project.resources[0].sourceInfo.source = "changed"; }, TypeError);
429
+ assert.throws(() => project.resources.push({ name: "changed" }), TypeError);
430
+ }
431
+ const models = MODELS.map((model) => ({ ...model, info: { authenticated: true } }));
432
+ await f.model("tools", data("tools", { models }));
433
+ models[0].info.authenticated = false;
434
+ assert.equal(f.c.getSnapshot().models[0].info.authenticated, true);
435
+ assert.throws(() => { f.c.getSnapshot().models[0].info.authenticated = false; }, TypeError);
436
+ const saving = f.c.toggle("read");
437
+ const call = f.calls.at(-1);
438
+ assert.throws(() => call.change.enabled.push("changed"), TypeError);
439
+ call.resolve(data());
440
+ await saving;
441
+ assert.throws(() => { f.mutations[0].selection.provider = "changed"; }, TypeError);
442
+ assert.throws(() => { f.mutations[0].name = "changed"; }, TypeError);
443
+ });
444
+
445
+ test("invalid scopes/models/names and closed methods dispatch nothing", async () => {
446
+ const f = fixture();
447
+ assert.equal(await f.c.toggle("read"), false);
448
+ assert.equal(await f.c.inherit(), false);
449
+ assert.equal(await f.c.setScope("global"), false);
450
+ assert.equal(await f.c.setModel(A), false);
451
+ assert.equal(f.c.setFilter("enabled"), false);
452
+ await f.open();
453
+ assert.equal(await f.c.setScope("bad"), false);
454
+ assert.equal(await f.c.setScope("session"), false);
455
+ assert.equal(await f.c.setModel(A), false);
456
+ assert.equal(await f.c.toggle("missing"), false);
457
+ assert.equal(await f.c.toggle(undefined), false);
458
+ assert.equal(f.calls.length, 1);
459
+ });
460
+
461
+ test("every dispatch rechecks ownership after synchronous rendering callbacks", async (t) => {
462
+ for (const operation of ["read", "models", "write"]) {
463
+ await t.test(operation, async () => {
464
+ const f = fixture();
465
+ if (operation !== "read") await f.open();
466
+ f.onChange = (snapshot) => { if (snapshot.loading || snapshot.savingName) f.c.close(); };
467
+ const count = f.calls.length;
468
+ const pending = operation === "read" ? f.c.open("tools", f.target()) : operation === "models" ? f.c.setScope("model") : f.c.toggle("read");
469
+ assert.equal(await pending, false);
470
+ assert.equal(f.calls.length, count);
471
+ assert.equal(f.c.getSnapshot().kind, null);
472
+ });
473
+ }
474
+ });
475
+
476
+ test("rendering a write completion can retire its notice or begin a newer write safely", async (t) => {
477
+ for (const action of ["close", "new-write"]) {
478
+ await t.test(action, async () => {
479
+ const f = fixture();
480
+ await f.open();
481
+ const first = f.c.toggle("read");
482
+ let newer;
483
+ f.onChange = (snapshot) => {
484
+ if (snapshot.savingName) return;
485
+ f.onChange = null;
486
+ if (action === "close") f.c.close();
487
+ else newer = f.c.toggle("shell");
488
+ };
489
+ f.calls.at(-1).resolve(data());
490
+ await first;
491
+ assert.equal(f.mutations.length, 0);
492
+ if (newer) {
493
+ assert.equal(f.c.getSnapshot().savingName, "shell");
494
+ f.calls.at(-1).resolve(data());
495
+ await newer;
496
+ assert.equal(f.mutations.length, 1);
497
+ assert.equal(f.mutations[0].name, "shell");
498
+ }
499
+ });
500
+ }
501
+ });
502
+
503
+ test("mutation callbacks observe unlocked accepted state and may close their own presentation", async () => {
504
+ const f = fixture();
505
+ await f.open("skills");
506
+ f.onMutation = (mutation) => {
507
+ assert.equal(f.c.getSnapshot().savingName, "");
508
+ assert.equal(f.c.getSnapshot().configured, true);
509
+ assert.equal(mutation.target, f.target());
510
+ f.c.close();
511
+ };
512
+ const saving = f.c.toggle("read");
513
+ f.calls.at(-1).resolve(data("skills", { configured: true }));
514
+ assert.equal(await saving, true);
515
+ assert.equal(f.c.getSnapshot().kind, null);
516
+ assert.equal(f.mutations.length, 1);
517
+ });
518
+
519
+ test("dispose is idempotent and suppresses all pending completions and future work", async (t) => {
520
+ for (const operation of ["read", "models", "write", "inherit"]) {
521
+ await t.test(operation, async () => {
522
+ const f = fixture();
523
+ let pending;
524
+ if (operation === "read") pending = f.c.open("tools", f.target());
525
+ else {
526
+ await f.open();
527
+ pending = operation === "models" ? f.c.setScope("model") : operation === "write" ? f.c.toggle("read") : f.c.inherit();
528
+ }
529
+ const call = f.calls.at(-1);
530
+ f.c.dispose();
531
+ const count = f.changes.length;
532
+ f.c.dispose();
533
+ call.reject(new Error("Disposed request failed"));
534
+ assert.equal(await pending, false);
535
+ assert.equal(f.changes.length, count);
536
+ assert.equal(f.mutations.length, 0);
537
+ assert.equal(f.c.getSnapshot().kind, null);
538
+ assert.equal(await f.c.open("skills", f.target()), false);
539
+ assert.equal(await f.c.setScope("global"), false);
540
+ assert.equal(await f.c.setModel(A), false);
541
+ assert.equal(await f.c.toggle("read"), false);
542
+ assert.equal(await f.c.inherit(), false);
543
+ assert.equal(f.c.setFilter("disabled"), false);
544
+ assert.equal(f.c.close(), false);
545
+ assert.equal(f.calls.at(-1), call);
546
+ });
547
+ }
548
+ });