@happyvertical/smrt-svelte 0.53.1 → 0.53.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. package/package.json +15 -15
  2. package/dist/__tests__/app-state.test.js +0 -156
  3. package/dist/__tests__/data-surface-bridge.test.js +0 -351
  4. package/dist/__tests__/provider-mode-harness.svelte +0 -14
  5. package/dist/__tests__/provider-mode-harness.svelte.d.ts +0 -11
  6. package/dist/__tests__/provider-mode-harness.svelte.d.ts.map +0 -1
  7. package/dist/__tests__/provider-mode-probe.svelte +0 -13
  8. package/dist/__tests__/provider-mode-probe.svelte.d.ts +0 -8
  9. package/dist/__tests__/provider-mode-probe.svelte.d.ts.map +0 -1
  10. package/dist/__tests__/provider-webmcp-harness.svelte +0 -14
  11. package/dist/__tests__/provider-webmcp-harness.svelte.d.ts +0 -8
  12. package/dist/__tests__/provider-webmcp-harness.svelte.d.ts.map +0 -1
  13. package/dist/__tests__/success-never-text.test.js +0 -100
  14. package/dist/__tests__/warm-clients.test.js +0 -186
  15. package/dist/browser-ai/adapters/llm/bitgpu-inference-backend.test.js +0 -464
  16. package/dist/browser-ai/adapters/llm/webllm-inference-backend.test.js +0 -646
  17. package/dist/browser-ai/adapters/stt/browser-speech.test.js +0 -113
  18. package/dist/browser-ai/adapters/stt/dictation-source.test.js +0 -52
  19. package/dist/browser-ai/svelte/components/__tests__/ModelStatusControl.test.js +0 -172
  20. package/dist/components/board/__tests__/Board.test.js +0 -498
  21. package/dist/components/board/__tests__/BoardSsrHarness.svelte +0 -30
  22. package/dist/components/board/__tests__/BoardSsrHarness.svelte.d.ts +0 -19
  23. package/dist/components/board/__tests__/BoardSsrHarness.svelte.d.ts.map +0 -1
  24. package/dist/components/forms/__tests__/AddressInput.behavior.test.js +0 -216
  25. package/dist/components/forms/__tests__/CheckboxInput.test.js +0 -92
  26. package/dist/components/forms/__tests__/DateRangeInput.behavior.test.js +0 -135
  27. package/dist/components/forms/__tests__/DateTimeInput.behavior.test.js +0 -113
  28. package/dist/components/forms/__tests__/FileUpload.error-alert.test.js +0 -37
  29. package/dist/components/forms/__tests__/FileUpload.native-form.test.js +0 -249
  30. package/dist/components/forms/__tests__/FileUpload.test.js +0 -90
  31. package/dist/components/forms/__tests__/FileUploadReset.fixture.svelte +0 -24
  32. package/dist/components/forms/__tests__/FileUploadReset.fixture.svelte.d.ts +0 -10
  33. package/dist/components/forms/__tests__/FileUploadReset.fixture.svelte.d.ts.map +0 -1
  34. package/dist/components/forms/__tests__/Form.behavior.test.js +0 -137
  35. package/dist/components/forms/__tests__/Form.extraction.test.js +0 -68
  36. package/dist/components/forms/__tests__/Form.stt-error.test.js +0 -57
  37. package/dist/components/forms/__tests__/Form.test.js +0 -86
  38. package/dist/components/forms/__tests__/Form.ui-controls.test.js +0 -119
  39. package/dist/components/forms/__tests__/Form.webmcp.test.js +0 -2336
  40. package/dist/components/forms/__tests__/FormMicButton.test.js +0 -92
  41. package/dist/components/forms/__tests__/FormScope.test.js +0 -39
  42. package/dist/components/forms/__tests__/MeasurementInput.behavior.test.js +0 -129
  43. package/dist/components/forms/__tests__/MoneyInput.behavior.test.js +0 -124
  44. package/dist/components/forms/__tests__/NumberInput.behavior.test.js +0 -151
  45. package/dist/components/forms/__tests__/PhoneInput.behavior.test.js +0 -96
  46. package/dist/components/forms/__tests__/SearchInput.test.js +0 -79
  47. package/dist/components/forms/__tests__/SelectInput.behavior.test.js +0 -132
  48. package/dist/components/forms/__tests__/TextInput.behavior.test.js +0 -131
  49. package/dist/components/forms/__tests__/TextareaInput.behavior.test.js +0 -96
  50. package/dist/components/forms/__tests__/async-invalid-field.fixture.svelte +0 -30
  51. package/dist/components/forms/__tests__/async-invalid-field.fixture.svelte.d.ts +0 -7
  52. package/dist/components/forms/__tests__/async-invalid-field.fixture.svelte.d.ts.map +0 -1
  53. package/dist/components/forms/__tests__/async-validation-form.fixture.svelte +0 -19
  54. package/dist/components/forms/__tests__/async-validation-form.fixture.svelte.d.ts +0 -9
  55. package/dist/components/forms/__tests__/async-validation-form.fixture.svelte.d.ts.map +0 -1
  56. package/dist/components/forms/__tests__/async-validation-snapshot-form.fixture.svelte +0 -21
  57. package/dist/components/forms/__tests__/async-validation-snapshot-form.fixture.svelte.d.ts +0 -8
  58. package/dist/components/forms/__tests__/async-validation-snapshot-form.fixture.svelte.d.ts.map +0 -1
  59. package/dist/components/forms/__tests__/composite-inputs-a11y.test.js +0 -69
  60. package/dist/components/forms/__tests__/compound-registration-wrapper.fixture.svelte +0 -27
  61. package/dist/components/forms/__tests__/compound-registration-wrapper.fixture.svelte.d.ts +0 -9
  62. package/dist/components/forms/__tests__/compound-registration-wrapper.fixture.svelte.d.ts.map +0 -1
  63. package/dist/components/forms/__tests__/custom-registration-field.fixture.svelte +0 -48
  64. package/dist/components/forms/__tests__/custom-registration-field.fixture.svelte.d.ts +0 -10
  65. package/dist/components/forms/__tests__/custom-registration-field.fixture.svelte.d.ts.map +0 -1
  66. package/dist/components/forms/__tests__/form-extraction-values.fixture.svelte +0 -26
  67. package/dist/components/forms/__tests__/form-extraction-values.fixture.svelte.d.ts +0 -13
  68. package/dist/components/forms/__tests__/form-extraction-values.fixture.svelte.d.ts.map +0 -1
  69. package/dist/components/forms/__tests__/form-registration-lifecycle.fixture.svelte +0 -52
  70. package/dist/components/forms/__tests__/form-registration-lifecycle.fixture.svelte.d.ts +0 -16
  71. package/dist/components/forms/__tests__/form-registration-lifecycle.fixture.svelte.d.ts.map +0 -1
  72. package/dist/components/forms/__tests__/form-scope.fixture.svelte +0 -30
  73. package/dist/components/forms/__tests__/form-scope.fixture.svelte.d.ts +0 -10
  74. package/dist/components/forms/__tests__/form-scope.fixture.svelte.d.ts.map +0 -1
  75. package/dist/components/forms/__tests__/form-with-fields.fixture.svelte +0 -158
  76. package/dist/components/forms/__tests__/form-with-fields.fixture.svelte.d.ts +0 -51
  77. package/dist/components/forms/__tests__/form-with-fields.fixture.svelte.d.ts.map +0 -1
  78. package/dist/components/forms/__tests__/form-with-policy-field.fixture.svelte +0 -24
  79. package/dist/components/forms/__tests__/form-with-policy-field.fixture.svelte.d.ts +0 -11
  80. package/dist/components/forms/__tests__/form-with-policy-field.fixture.svelte.d.ts.map +0 -1
  81. package/dist/components/forms/__tests__/form-with-structured-fields.fixture.svelte +0 -105
  82. package/dist/components/forms/__tests__/form-with-structured-fields.fixture.svelte.d.ts +0 -42
  83. package/dist/components/forms/__tests__/form-with-structured-fields.fixture.svelte.d.ts.map +0 -1
  84. package/dist/components/forms/__tests__/form-with-ui-controls.fixture.svelte +0 -84
  85. package/dist/components/forms/__tests__/form-with-ui-controls.fixture.svelte.d.ts +0 -14
  86. package/dist/components/forms/__tests__/form-with-ui-controls.fixture.svelte.d.ts.map +0 -1
  87. package/dist/components/forms/__tests__/legacy-form-context.fixture.svelte +0 -44
  88. package/dist/components/forms/__tests__/legacy-form-context.fixture.svelte.d.ts +0 -9
  89. package/dist/components/forms/__tests__/legacy-form-context.fixture.svelte.d.ts.map +0 -1
  90. package/dist/components/forms/__tests__/mic-keyboard-a11y.test.js +0 -74
  91. package/dist/components/forms/__tests__/policy-field.fixture.svelte +0 -35
  92. package/dist/components/forms/__tests__/policy-field.fixture.svelte.d.ts +0 -8
  93. package/dist/components/forms/__tests__/policy-field.fixture.svelte.d.ts.map +0 -1
  94. package/dist/components/forms/__tests__/rich-inputs-a11y.test.js +0 -87
  95. package/dist/components/settings/__tests__/SettingsCatalog.test.js +0 -69
  96. package/dist/components/settings/__tests__/catalog.test.js +0 -46
  97. package/dist/components/workspace/__tests__/AdminShell.responsive.test.js +0 -597
  98. package/dist/components/workspace/__tests__/AdminShell.test.js +0 -572
  99. package/dist/components/workspace/__tests__/RoleShell.test.js +0 -772
  100. package/dist/components/workspace/__tests__/TenantNav.test.js +0 -208
  101. package/dist/components/workspace/__tests__/WorkspaceAccountMenu.test.js +0 -79
  102. package/dist/components/workspace/__tests__/WorkspaceShell.test.js +0 -630
  103. package/dist/components/workspace/__tests__/admin-shell-header-overflow.test.js +0 -25
  104. package/dist/components/workspace/__tests__/admin-shell-hotkeys.test.js +0 -34
  105. package/dist/components/workspace/__tests__/admin-shell-mobile.test.js +0 -217
  106. package/dist/components/workspace/__tests__/admin-shell-mutation-effect-harness.svelte +0 -52
  107. package/dist/components/workspace/__tests__/admin-shell-mutation-effect-harness.svelte.d.ts +0 -23
  108. package/dist/components/workspace/__tests__/admin-shell-mutation-effect-harness.svelte.d.ts.map +0 -1
  109. package/dist/components/workspace/__tests__/admin-shell-page-contracts.test.js +0 -30
  110. package/dist/components/workspace/__tests__/admin-shell-responsive-state.test.js +0 -184
  111. package/dist/components/workspace/__tests__/admin-shell-settings.test.js +0 -25
  112. package/dist/components/workspace/__tests__/admin-shell-state.test.js +0 -286
  113. package/dist/components/workspace/__tests__/admin-shell-theme-hooks.test.js +0 -36
  114. package/dist/components/workspace/__tests__/breadcrumbs-helpers.test.js +0 -141
  115. package/dist/components/workspace/__tests__/context-forwarding-harness.svelte +0 -45
  116. package/dist/components/workspace/__tests__/context-forwarding-harness.svelte.d.ts +0 -21
  117. package/dist/components/workspace/__tests__/context-forwarding-harness.svelte.d.ts.map +0 -1
  118. package/dist/components/workspace/__tests__/define-tools-dock.test.js +0 -1188
  119. package/dist/components/workspace/__tests__/harness.svelte +0 -25
  120. package/dist/components/workspace/__tests__/harness.svelte.d.ts +0 -14
  121. package/dist/components/workspace/__tests__/harness.svelte.d.ts.map +0 -1
  122. package/dist/components/workspace/__tests__/index.test.js +0 -28
  123. package/dist/components/workspace/__tests__/legacy-index.test.js +0 -9
  124. package/dist/components/workspace/__tests__/manifest-nav-helpers.test.js +0 -24
  125. package/dist/components/workspace/__tests__/manifest-nav.test.js +0 -599
  126. package/dist/components/workspace/__tests__/nav-helpers.test.js +0 -95
  127. package/dist/components/workspace/__tests__/render-harness.svelte +0 -66
  128. package/dist/components/workspace/__tests__/render-harness.svelte.d.ts +0 -32
  129. package/dist/components/workspace/__tests__/render-harness.svelte.d.ts.map +0 -1
  130. package/dist/components/workspace/__tests__/render-tools-dock.test.js +0 -260
  131. package/dist/components/workspace/__tests__/role-shell-bind-harness.svelte +0 -58
  132. package/dist/components/workspace/__tests__/role-shell-bind-harness.svelte.d.ts +0 -16
  133. package/dist/components/workspace/__tests__/role-shell-bind-harness.svelte.d.ts.map +0 -1
  134. package/dist/components/workspace/__tests__/role-shell-switch-harness.svelte +0 -41
  135. package/dist/components/workspace/__tests__/role-shell-switch-harness.svelte.d.ts +0 -13
  136. package/dist/components/workspace/__tests__/role-shell-switch-harness.svelte.d.ts.map +0 -1
  137. package/dist/components/workspace/__tests__/shell-chrome-components.test.js +0 -108
  138. package/dist/components/workspace/__tests__/system-feed.test.js +0 -327
  139. package/dist/components/workspace/__tests__/test-icon.svelte +0 -17
  140. package/dist/components/workspace/__tests__/test-icon.svelte.d.ts +0 -19
  141. package/dist/components/workspace/__tests__/test-icon.svelte.d.ts.map +0 -1
  142. package/dist/components/workspace/__tests__/typed-tool-fixture/TypedTool.svelte +0 -38
  143. package/dist/components/workspace/__tests__/typed-tool-fixture/TypedTool.svelte.d.ts +0 -22
  144. package/dist/components/workspace/__tests__/typed-tool-fixture/TypedTool.svelte.d.ts.map +0 -1
  145. package/dist/components/workspace/__tests__/typed-tool-fixture/register-typed-tool.d.ts +0 -66
  146. package/dist/components/workspace/__tests__/typed-tool-fixture/register-typed-tool.d.ts.map +0 -1
  147. package/dist/components/workspace/__tests__/typed-tool-fixture/register-typed-tool.js +0 -115
  148. package/dist/components/workspace/__tests__/typed-tool-fixture/typed-tool-types.d.ts +0 -15
  149. package/dist/components/workspace/__tests__/typed-tool-fixture/typed-tool-types.d.ts.map +0 -1
  150. package/dist/components/workspace/__tests__/typed-tool-fixture/typed-tool-types.js +0 -7
  151. package/dist/components/workspace/__tests__/typed-tool-fixture.test.js +0 -115
  152. package/dist/components/workspace/__tests__/use-harness-orphan.svelte +0 -9
  153. package/dist/components/workspace/__tests__/use-harness-orphan.svelte.d.ts +0 -19
  154. package/dist/components/workspace/__tests__/use-harness-orphan.svelte.d.ts.map +0 -1
  155. package/dist/components/workspace/__tests__/use-harness.svelte +0 -23
  156. package/dist/components/workspace/__tests__/use-harness.svelte.d.ts +0 -8
  157. package/dist/components/workspace/__tests__/use-harness.svelte.d.ts.map +0 -1
  158. package/dist/components/workspace/__tests__/use-tools-dock.test.js +0 -33
  159. package/dist/components/workspace/__tests__/workspace-shell-bind-harness.svelte +0 -43
  160. package/dist/components/workspace/__tests__/workspace-shell-bind-harness.svelte.d.ts +0 -11
  161. package/dist/components/workspace/__tests__/workspace-shell-bind-harness.svelte.d.ts.map +0 -1
  162. package/dist/components/workspace/server/__tests__/compose-availability.test.js +0 -383
  163. package/dist/components/workspace/server/__tests__/typed-context-fixture.d.ts +0 -78
  164. package/dist/components/workspace/server/__tests__/typed-context-fixture.d.ts.map +0 -1
  165. package/dist/components/workspace/server/__tests__/typed-context-fixture.js +0 -104
  166. package/dist/hooks/__tests__/stt-consumer.fixture.svelte +0 -25
  167. package/dist/hooks/__tests__/stt-consumer.fixture.svelte.d.ts +0 -15
  168. package/dist/hooks/__tests__/stt-consumer.fixture.svelte.d.ts.map +0 -1
  169. package/dist/hooks/__tests__/stt-ownership-harness.svelte +0 -42
  170. package/dist/hooks/__tests__/stt-ownership-harness.svelte.d.ts +0 -20
  171. package/dist/hooks/__tests__/stt-ownership-harness.svelte.d.ts.map +0 -1
  172. package/dist/hooks/__tests__/useSTT-ownership.test.js +0 -102
  173. package/dist/i18n/__tests__/server.spec.js +0 -57
  174. package/dist/internal/logger.test.js +0 -54
  175. package/dist/provider-mode.test.js +0 -86
  176. package/dist/provider-webmcp.test.js +0 -244
  177. package/dist/state/__tests__/app-state-ai-lifecycle.test.js +0 -240
  178. package/dist/state/__tests__/warm-clients.test.js +0 -40
  179. package/dist/web/__tests__/activity-feed-harness.svelte +0 -32
  180. package/dist/web/__tests__/activity-feed-harness.svelte.d.ts +0 -18
  181. package/dist/web/__tests__/activity-feed-harness.svelte.d.ts.map +0 -1
  182. package/dist/web/__tests__/activity-feed.integration.svelte.test.js +0 -190
  183. package/dist/web/__tests__/activity-feed.svelte.test.js +0 -235
  184. package/dist/web/__tests__/assistant-dock.integration.svelte.test.js +0 -204
  185. package/dist/web/__tests__/data-surface-conformance.integration.svelte.test.js +0 -1392
  186. package/dist/web/__tests__/harness.svelte +0 -25
  187. package/dist/web/__tests__/harness.svelte.d.ts +0 -15
  188. package/dist/web/__tests__/harness.svelte.d.ts.map +0 -1
  189. package/dist/web/__tests__/list-data-surface.fixture.svelte +0 -59
  190. package/dist/web/__tests__/list-data-surface.fixture.svelte.d.ts +0 -14
  191. package/dist/web/__tests__/list-data-surface.fixture.svelte.d.ts.map +0 -1
  192. package/dist/web/__tests__/list-data-surface.svelte.test.js +0 -106
  193. package/dist/web/__tests__/list-data-surface.test.js +0 -651
  194. package/dist/web/__tests__/list-sort-surface.fixture.svelte +0 -41
  195. package/dist/web/__tests__/list-sort-surface.fixture.svelte.d.ts +0 -15
  196. package/dist/web/__tests__/list-sort-surface.fixture.svelte.d.ts.map +0 -1
  197. package/dist/web/__tests__/list-sort-surface.svelte.test.js +0 -59
  198. package/dist/web/__tests__/live-collection.svelte.test.js +0 -185
  199. package/dist/web/__tests__/provider-ui-registry.fixture.svelte +0 -43
  200. package/dist/web/__tests__/provider-ui-registry.fixture.svelte.d.ts +0 -13
  201. package/dist/web/__tests__/provider-ui-registry.fixture.svelte.d.ts.map +0 -1
  202. package/dist/web/__tests__/provider-ui-registry.test.js +0 -235
  203. package/dist/web/__tests__/remote-query-harness.svelte +0 -27
  204. package/dist/web/__tests__/remote-query-harness.svelte.d.ts +0 -11
  205. package/dist/web/__tests__/remote-query-harness.svelte.d.ts.map +0 -1
  206. package/dist/web/__tests__/remote-query.svelte.test.js +0 -101
  207. package/dist/web/__tests__/surfaces.child.fixture.svelte +0 -69
  208. package/dist/web/__tests__/surfaces.child.fixture.svelte.d.ts +0 -16
  209. package/dist/web/__tests__/surfaces.child.fixture.svelte.d.ts.map +0 -1
  210. package/dist/web/__tests__/surfaces.fixture.svelte +0 -26
  211. package/dist/web/__tests__/surfaces.fixture.svelte.d.ts +0 -18
  212. package/dist/web/__tests__/surfaces.fixture.svelte.d.ts.map +0 -1
  213. package/dist/web/__tests__/surfaces.svelte.test.js +0 -140
  214. package/dist/web/__tests__/update-available-harness.svelte +0 -46
  215. package/dist/web/__tests__/update-available-harness.svelte.d.ts +0 -22
  216. package/dist/web/__tests__/update-available-harness.svelte.d.ts.map +0 -1
  217. package/dist/web/__tests__/update-available.svelte.test.js +0 -137
  218. package/dist/web/__tests__/view-intent-provider.fixture.svelte +0 -28
  219. package/dist/web/__tests__/view-intent-provider.fixture.svelte.d.ts +0 -13
  220. package/dist/web/__tests__/view-intent-provider.fixture.svelte.d.ts.map +0 -1
  221. package/dist/web/__tests__/view-intent.fixture.svelte +0 -33
  222. package/dist/web/__tests__/view-intent.fixture.svelte.d.ts +0 -15
  223. package/dist/web/__tests__/view-intent.fixture.svelte.d.ts.map +0 -1
  224. package/dist/web/__tests__/view-intent.intents.d.ts +0 -14
  225. package/dist/web/__tests__/view-intent.intents.d.ts.map +0 -1
  226. package/dist/web/__tests__/view-intent.intents.js +0 -38
  227. package/dist/web/__tests__/view-intent.svelte.test.js +0 -244
  228. package/dist/web/__tests__/webmcp-composed.child.fixture.svelte +0 -73
  229. package/dist/web/__tests__/webmcp-composed.child.fixture.svelte.d.ts +0 -8
  230. package/dist/web/__tests__/webmcp-composed.child.fixture.svelte.d.ts.map +0 -1
  231. package/dist/web/__tests__/webmcp-composed.fixture.svelte +0 -52
  232. package/dist/web/__tests__/webmcp-composed.fixture.svelte.d.ts +0 -12
  233. package/dist/web/__tests__/webmcp-composed.fixture.svelte.d.ts.map +0 -1
  234. package/dist/web/__tests__/webmcp-composed.integration.svelte.test.js +0 -251
  235. package/dist/web/__tests__/webmcp-effects-reactivity.child.fixture.svelte +0 -16
  236. package/dist/web/__tests__/webmcp-effects-reactivity.child.fixture.svelte.d.ts +0 -19
  237. package/dist/web/__tests__/webmcp-effects-reactivity.child.fixture.svelte.d.ts.map +0 -1
  238. package/dist/web/__tests__/webmcp-effects-reactivity.fixture.svelte +0 -11
  239. package/dist/web/__tests__/webmcp-effects-reactivity.fixture.svelte.d.ts +0 -8
  240. package/dist/web/__tests__/webmcp-effects-reactivity.fixture.svelte.d.ts.map +0 -1
  241. package/dist/web/__tests__/webmcp-harness-reactive-samename.svelte +0 -20
  242. package/dist/web/__tests__/webmcp-harness-reactive-samename.svelte.d.ts +0 -7
  243. package/dist/web/__tests__/webmcp-harness-reactive-samename.svelte.d.ts.map +0 -1
  244. package/dist/web/__tests__/webmcp-harness-unannotated.svelte +0 -14
  245. package/dist/web/__tests__/webmcp-harness-unannotated.svelte.d.ts +0 -19
  246. package/dist/web/__tests__/webmcp-harness-unannotated.svelte.d.ts.map +0 -1
  247. package/dist/web/__tests__/webmcp-harness.svelte +0 -18
  248. package/dist/web/__tests__/webmcp-harness.svelte.d.ts +0 -7
  249. package/dist/web/__tests__/webmcp-harness.svelte.d.ts.map +0 -1
  250. package/dist/web/__tests__/webmcp-ssr.fixture.svelte +0 -13
  251. package/dist/web/__tests__/webmcp-ssr.fixture.svelte.d.ts +0 -19
  252. package/dist/web/__tests__/webmcp-ssr.fixture.svelte.d.ts.map +0 -1
  253. package/dist/web/__tests__/webmcp-ui.test.js +0 -723
  254. package/dist/web/__tests__/webmcp.test.js +0 -234
@@ -1,383 +0,0 @@
1
- /**
2
- * Tests for the server-side dock availability gate composer
3
- * (happyvertical/smrt#1226 Phase 4c).
4
- *
5
- * Covers:
6
- * - tools without `gates` are unconditionally included (back-compat)
7
- * - single passing / failing gate
8
- * - AND semantics across multiple gates
9
- * - sync and async evaluators
10
- * - unknown-prefix error message (loud-fail)
11
- * - context pass-through
12
- * - edge cases (empty arrays / maps)
13
- * - label / badge passthrough into AvailableTool
14
- */
15
- import { describe, expect, it, vi } from 'vitest';
16
- import { composeDockAvailability } from '../compose-availability.js';
17
- const alwaysTrue = () => true;
18
- const alwaysFalse = () => false;
19
- const asyncTrue = async () => true;
20
- const asyncFalse = async () => false;
21
- describe('composeDockAvailability', () => {
22
- it('includes tools without a `gates` field unconditionally', async () => {
23
- const result = await composeDockAvailability({
24
- tools: [{ id: 'chat', label: 'Chat' }],
25
- context: {},
26
- evaluators: {},
27
- });
28
- expect(result).toHaveLength(1);
29
- expect(result[0]?.id).toBe('chat');
30
- });
31
- it('includes tools with an empty `gates` array unconditionally', async () => {
32
- const result = await composeDockAvailability({
33
- tools: [{ id: 'chat', label: 'Chat', gates: [] }],
34
- context: {},
35
- evaluators: {},
36
- });
37
- expect(result).toHaveLength(1);
38
- expect(result[0]?.id).toBe('chat');
39
- });
40
- it('includes a tool whose single gate evaluates to true', async () => {
41
- const result = await composeDockAvailability({
42
- tools: [{ id: 'video', label: 'Video', gates: ['feature:video-tools'] }],
43
- context: {},
44
- evaluators: { feature: alwaysTrue },
45
- });
46
- expect(result).toHaveLength(1);
47
- expect(result[0]?.id).toBe('video');
48
- });
49
- it('excludes a tool whose single gate evaluates to false', async () => {
50
- const result = await composeDockAvailability({
51
- tools: [{ id: 'video', label: 'Video', gates: ['feature:video-tools'] }],
52
- context: {},
53
- evaluators: { feature: alwaysFalse },
54
- });
55
- expect(result).toEqual([]);
56
- });
57
- it('requires ALL gates to pass (AND semantics)', async () => {
58
- const result = await composeDockAvailability({
59
- tools: [
60
- {
61
- id: 'restricted',
62
- label: 'Restricted',
63
- gates: ['permission:foo', 'feature:bar'],
64
- },
65
- ],
66
- context: {},
67
- evaluators: { permission: alwaysTrue, feature: alwaysFalse },
68
- });
69
- expect(result).toEqual([]);
70
- });
71
- it('includes a tool only when EVERY gate passes', async () => {
72
- const result = await composeDockAvailability({
73
- tools: [
74
- {
75
- id: 'allowed',
76
- label: 'Allowed',
77
- gates: ['permission:foo', 'feature:bar'],
78
- },
79
- ],
80
- context: {},
81
- evaluators: { permission: alwaysTrue, feature: asyncTrue },
82
- });
83
- expect(result).toHaveLength(1);
84
- expect(result[0]?.id).toBe('allowed');
85
- });
86
- it('accepts sync evaluators that return a plain boolean', async () => {
87
- const result = await composeDockAvailability({
88
- tools: [{ id: 't', label: 'T', gates: ['x:y'] }],
89
- context: {},
90
- evaluators: { x: (_id, _ctx) => true },
91
- });
92
- expect(result).toHaveLength(1);
93
- });
94
- it('accepts async evaluators that return a Promise<boolean>', async () => {
95
- const result = await composeDockAvailability({
96
- tools: [{ id: 't', label: 'T', gates: ['x:y'] }],
97
- context: {},
98
- evaluators: { x: async () => true },
99
- });
100
- expect(result).toHaveLength(1);
101
- });
102
- it('throws with a clear message when a gate prefix has no evaluator', async () => {
103
- await expect(composeDockAvailability({
104
- tools: [
105
- { id: 'video', label: 'Video', gates: ['feature:video-tools'] },
106
- ],
107
- context: {},
108
- evaluators: { permission: alwaysTrue },
109
- })).rejects.toThrow(/No evaluator registered for gate prefix "feature".*tool "video".*gate "feature:video-tools".*Available prefixes: permission/);
110
- });
111
- it('reports `(none)` for available prefixes when the evaluators map is empty', async () => {
112
- await expect(composeDockAvailability({
113
- tools: [
114
- { id: 'video', label: 'Video', gates: ['feature:video-tools'] },
115
- ],
116
- context: {},
117
- evaluators: {},
118
- })).rejects.toThrow(/Available prefixes: \(none\)/);
119
- });
120
- it('passes the supplied `context` through to each evaluator', async () => {
121
- const ctx = { userId: 'u-1', tenantId: 't-1' };
122
- const permission = vi.fn(() => true);
123
- const feature = vi.fn(() => true);
124
- await composeDockAvailability({
125
- tools: [
126
- {
127
- id: 'tool',
128
- label: 'Tool',
129
- gates: ['permission:articles.publish', 'feature:video-tools'],
130
- },
131
- ],
132
- context: ctx,
133
- evaluators: { permission, feature },
134
- });
135
- expect(permission).toHaveBeenCalledWith('permission:articles.publish', ctx);
136
- expect(feature).toHaveBeenCalledWith('feature:video-tools', ctx);
137
- });
138
- it('returns an empty array for an empty `tools` input', async () => {
139
- const result = await composeDockAvailability({
140
- tools: [],
141
- context: {},
142
- evaluators: {},
143
- });
144
- expect(result).toEqual([]);
145
- });
146
- it('handles an empty `evaluators` map fine when no tools have gates', async () => {
147
- const result = await composeDockAvailability({
148
- tools: [
149
- { id: 'a', label: 'A' },
150
- { id: 'b', label: 'B' },
151
- ],
152
- context: {},
153
- evaluators: {},
154
- });
155
- expect(result.map((t) => t.id)).toEqual(['a', 'b']);
156
- });
157
- it('passes through `label` and `badge` from the tool def to AvailableTool', async () => {
158
- const tools = [
159
- { id: 'inbox', label: 'Inbox', badge: 3 },
160
- { id: 'tasks', label: 'Tasks', badge: 'new' },
161
- { id: 'plain', label: 'Plain' }, // no badge → omitted in output
162
- ];
163
- const result = await composeDockAvailability({
164
- tools,
165
- context: {},
166
- evaluators: {},
167
- });
168
- expect(result).toEqual([
169
- { id: 'inbox', label: 'Inbox', badge: 3 },
170
- { id: 'tasks', label: 'Tasks', badge: 'new' },
171
- { id: 'plain', label: 'Plain' },
172
- ]);
173
- });
174
- it('omits a missing `label` from the AvailableTool result (lets the dock fall back)', async () => {
175
- const result = await composeDockAvailability({
176
- tools: [{ id: 'no-label' }],
177
- context: {},
178
- evaluators: {},
179
- });
180
- // No `label` key at all — `defineToolsDock.applyAvailability` falls
181
- // back to the registered ToolDef metadata.
182
- expect(result[0]).toEqual({ id: 'no-label' });
183
- expect(result[0]).not.toHaveProperty('label');
184
- expect(result[0]).not.toHaveProperty('badge');
185
- });
186
- it('omits `badge` when the tool def has no badge (no implicit clear)', async () => {
187
- const result = await composeDockAvailability({
188
- tools: [{ id: 'chat', label: 'Chat', gates: [] }],
189
- context: {},
190
- evaluators: {},
191
- });
192
- // The dock treats `badge: null` as an explicit clear of the
193
- // registered default badge. Absence must remain absence.
194
- expect(result[0]).toEqual({ id: 'chat', label: 'Chat' });
195
- expect(result[0]).not.toHaveProperty('badge');
196
- });
197
- it('preserves explicit `badge: null` when the caller does set it', async () => {
198
- const result = await composeDockAvailability({
199
- tools: [{ id: 'reset', label: 'Reset', badge: null }],
200
- context: {},
201
- evaluators: {},
202
- });
203
- expect(result[0]).toEqual({ id: 'reset', label: 'Reset', badge: null });
204
- });
205
- it('filters a mixed input correctly (gated + ungated, pass + fail)', async () => {
206
- const result = await composeDockAvailability({
207
- tools: [
208
- { id: 'always', label: 'Always' },
209
- { id: 'allowed', label: 'Allowed', gates: ['permission:foo'] },
210
- { id: 'denied', label: 'Denied', gates: ['permission:bar'] },
211
- { id: 'flagged', label: 'Flagged', gates: ['feature:on'] },
212
- ],
213
- context: { userId: 'u-1' },
214
- evaluators: {
215
- permission: async (id) => id === 'permission:foo',
216
- feature: asyncTrue,
217
- },
218
- });
219
- expect(result.map((t) => t.id)).toEqual(['always', 'allowed', 'flagged']);
220
- });
221
- it('still throws on unknown prefix even when other gates on the same tool would have passed', async () => {
222
- await expect(composeDockAvailability({
223
- tools: [
224
- {
225
- id: 'mixed',
226
- label: 'Mixed',
227
- gates: ['permission:ok', 'mystery:??'],
228
- },
229
- ],
230
- context: {},
231
- evaluators: { permission: alwaysTrue },
232
- })).rejects.toThrow(/gate "mystery:\?\?"/);
233
- });
234
- it('treats async evaluator rejections as errors (does not swallow)', async () => {
235
- await expect(composeDockAvailability({
236
- tools: [{ id: 't', label: 'T', gates: ['boom:bar'] }],
237
- context: {},
238
- evaluators: {
239
- boom: async () => {
240
- throw new Error('evaluator exploded');
241
- },
242
- },
243
- })).rejects.toThrow('evaluator exploded');
244
- });
245
- it('respects falsy results from async evaluators (excludes the tool)', async () => {
246
- const result = await composeDockAvailability({
247
- tools: [{ id: 't', label: 'T', gates: ['x:y'] }],
248
- context: {},
249
- evaluators: { x: asyncFalse },
250
- });
251
- expect(result).toEqual([]);
252
- });
253
- // Regression: a gate prefix that names an inherited `Object.prototype`
254
- // property (e.g. `constructor`, `toString`, `hasOwnProperty`, `valueOf`,
255
- // `__proto__`) MUST NOT bypass the unknown-prefix fail-loud path. Prior
256
- // to the fix, `evaluators[prefix]` resolved to a built-in function and
257
- // got invoked, returning a truthy value and silently passing the gate.
258
- it('throws on prototype-key gate prefixes (constructor, toString, hasOwnProperty, valueOf, __proto__)', async () => {
259
- const evaluators = { permission: () => true };
260
- for (const prefix of [
261
- 'constructor',
262
- 'toString',
263
- 'hasOwnProperty',
264
- 'valueOf',
265
- '__proto__',
266
- ]) {
267
- await expect(composeDockAvailability({
268
- tools: [{ id: 'x', label: 'X', gates: [`${prefix}:any`] }],
269
- context: {},
270
- evaluators,
271
- })).rejects.toThrow(/No evaluator registered for gate prefix/);
272
- }
273
- });
274
- it('throws when an evaluator entry is not a function', async () => {
275
- await expect(composeDockAvailability({
276
- tools: [{ id: 'x', label: 'X', gates: ['permission:any'] }],
277
- context: {},
278
- evaluators: {
279
- // Intentional non-function evaluator — should fail loud.
280
- permission: 'not-a-function',
281
- },
282
- })).rejects.toThrow(/No evaluator registered/);
283
- });
284
- // Regression for the TCtx generic parameterization (issue 1242 fix #5).
285
- // Verifies the typed-context flow compiles end-to-end: the evaluator
286
- // receives a typed `ctx` (string fields, not `unknown`) without a cast.
287
- it('preserves the caller-supplied context type through to evaluators (TCtx generic)', async () => {
288
- let observedUserId;
289
- let observedTenantId;
290
- const result = await composeDockAvailability({
291
- tools: [{ id: 't', label: 'T', gates: ['permission:articles.publish'] }],
292
- context: { userId: 'u-1', tenantId: 't-1' },
293
- evaluators: {
294
- permission: (gateId, ctx) => {
295
- // No cast required — ctx.userId and ctx.tenantId are typed string.
296
- observedUserId = ctx.userId;
297
- observedTenantId = ctx.tenantId;
298
- const [, slug] = gateId.split(':', 2);
299
- return slug === 'articles.publish';
300
- },
301
- },
302
- });
303
- expect(result).toHaveLength(1);
304
- expect(observedUserId).toBe('u-1');
305
- expect(observedTenantId).toBe('t-1');
306
- });
307
- // Regression: an interface-style context (no string index signature) must
308
- // be accepted by `TCtx`. The round-1 fixup parameterized
309
- // `TCtx extends Record<string, unknown>`, which rejected interfaces under
310
- // strict TS — the same trap we hit with `TActions` in #1239. The
311
- // self-mapped constraint `{ [K in keyof TCtx]: unknown }` accepts
312
- // interfaces without forcing the consumer to add an index signature.
313
- //
314
- // The compile-time guard lives in
315
- // `./__tests__/typed-context-fixture/typed-context.ts` — see the JSDoc
316
- // there. The runtime check below confirms the same interface-style
317
- // context round-trips through evaluators at runtime.
318
- it('accepts an interface-style TCtx (no string index signature)', async () => {
319
- let observedUserId;
320
- const result = await composeDockAvailability({
321
- tools: [{ id: 't', label: 'T', gates: ['permission:any'] }],
322
- context: { userId: 'u-1', tenantId: 't-1' },
323
- evaluators: {
324
- permission: (_gateId, ctx) => {
325
- // No cast — ctx.userId is typed string.
326
- observedUserId = ctx.userId;
327
- return true;
328
- },
329
- },
330
- });
331
- expect(result).toHaveLength(1);
332
- expect(observedUserId).toBe('u-1');
333
- });
334
- // Regression for fix #2 of round-3: `.every(Boolean)` fails OPEN for
335
- // truthy non-booleans. `Boolean('false')`, `Boolean({})`, `Boolean([])`
336
- // are all true, so an untyped evaluator returning a wrapped object, a
337
- // sentinel string, or a number would silently grant access. The composer
338
- // now uses strict `=== true`.
339
- it('fails closed on truthy non-boolean evaluator returns', async () => {
340
- // Evaluators MUST return boolean per the type, but consumers in plain
341
- // JS or with untyped wrappers can slip non-boolean returns through.
342
- // Verify that truthy non-booleans don't grant access.
343
- const cases = [
344
- {
345
- id: 'string-true',
346
- evaluator: () => 'true',
347
- },
348
- {
349
- id: 'object',
350
- evaluator: () => ({ allowed: false }),
351
- },
352
- {
353
- id: 'array',
354
- evaluator: () => [],
355
- },
356
- {
357
- id: 'number-1',
358
- evaluator: () => 1,
359
- },
360
- {
361
- id: 'falsestring',
362
- evaluator: () => 'false',
363
- },
364
- ];
365
- for (const { id, evaluator } of cases) {
366
- const result = await composeDockAvailability({
367
- tools: [{ id, label: id, gates: ['permission:any'] }],
368
- context: {},
369
- evaluators: { permission: evaluator },
370
- });
371
- // fail-closed: gate doesn't pass
372
- expect(result).toEqual([]);
373
- }
374
- });
375
- it('passes only on literal `true` (not truthy values)', async () => {
376
- const result = await composeDockAvailability({
377
- tools: [{ id: 'pass-true', label: 'Pass', gates: ['permission:any'] }],
378
- context: {},
379
- evaluators: { permission: () => true },
380
- });
381
- expect(result).toEqual([{ id: 'pass-true', label: 'Pass' }]);
382
- });
383
- });
@@ -1,78 +0,0 @@
1
- /**
2
- * Compile-time regression fixture for the `TCtx` generic on
3
- * `composeDockAvailability` / `ComposeDockAvailabilityOptions` /
4
- * `GateEvaluator`.
5
- *
6
- * This is the contract round-3 of PR #1242 is restoring:
7
- *
8
- * - `TCtx` must accept an INTERFACE (no string index signature). The
9
- * round-1 fixup tightened the constraint to
10
- * `TCtx extends Record<string, unknown>`, which silently rejected
11
- * interface-style contexts — the same trap Copilot caught with
12
- * `TActions` in PR #1239. The constraint is now a self-mapped
13
- * `{ [K in keyof TCtx]: unknown }` (matching the `TActions` pattern in
14
- * `../../types.ts`).
15
- *
16
- * - The default `TCtx = GateEvaluationContext` must keep existing
17
- * untyped call sites compiling unchanged.
18
- *
19
- * - The factory's `<TCtx>` generic must flow through to each evaluator
20
- * so `ctx.fieldName` is typed without a cast at the evaluator call
21
- * site.
22
- *
23
- * Lives in a `.ts` file (NOT `.test.ts`) so:
24
- * - `tsc --noEmit` (the package's `typecheck` script, run in CI via
25
- * `pnpm turbo run typecheck`) does include it — the package's
26
- * `tsconfig.svelte.json` includes `src/** /*.ts` and excludes only
27
- * `**\/*.test.ts` and `**\/*.spec.ts`.
28
- * - Vitest does NOT execute it (no `.test.ts` suffix), so the
29
- * `_assertInterfaceTCtx*` symbols below never run — their bodies must
30
- * just compile.
31
- *
32
- * Mirrors the same pattern as
33
- * `../../__tests__/typed-tool-fixture/register-typed-tool.ts` (PR #1239).
34
- */
35
- import type { ComposeDockAvailabilityOptions, GateEvaluator } from '../types.js';
36
- /**
37
- * Interface-style context — no string index signature. Under a bare
38
- * `Record<string, unknown>` constraint this fails to satisfy `TCtx`
39
- * (TS2344). Under the self-mapped `{ [K in keyof TCtx]: unknown }`
40
- * constraint it's accepted.
41
- */
42
- interface MyInterfaceContext {
43
- userId: string;
44
- tenantId: string;
45
- }
46
- /**
47
- * Type-only assertion: an `Options` literal parameterized over an
48
- * interface-style context must compile, and the evaluator must receive a
49
- * typed `ctx` (no cast) with the consumer's field types.
50
- *
51
- * If `TCtx` ever tightens back to `Record<string, unknown>`, this
52
- * declaration fails with TS2344 ("Type 'MyInterfaceContext' does not
53
- * satisfy the constraint 'Record<string, unknown>'").
54
- */
55
- export declare const _assertInterfaceTCtxOptions: ComposeDockAvailabilityOptions<MyInterfaceContext>;
56
- /**
57
- * Type-only assertion: `GateEvaluator<MyInterfaceContext>` accepts an
58
- * interface. Same regression as above, but exercised through the
59
- * `GateEvaluator` alias directly (which `ComposeDockAvailabilityOptions`
60
- * indexes into via `evaluators`).
61
- */
62
- export declare const _assertInterfaceTCtxEvaluator: GateEvaluator<MyInterfaceContext>;
63
- /**
64
- * Type-only assertion: the `composeDockAvailability<TCtx>` factory
65
- * accepts an interface-style `TCtx` and threads it through to evaluators
66
- * without erasure. Never called at runtime — its body just has to
67
- * compile.
68
- */
69
- export declare function _assertInterfaceTCtxFactoryFlow(): Promise<void>;
70
- /**
71
- * Type-only assertion: the untyped (back-compat) call site must still
72
- * compile with no generic argument and resolve `TCtx` to the default
73
- * `GateEvaluationContext` (`Record<string, unknown>`). If the default
74
- * ever drifted, every existing untyped consumer would break.
75
- */
76
- export declare function _assertUntypedDefaultTCtx(): Promise<void>;
77
- export {};
78
- //# sourceMappingURL=typed-context-fixture.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typed-context-fixture.d.ts","sourceRoot":"","sources":["../../../../../src/components/workspace/server/__tests__/typed-context-fixture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,KAAK,EACV,8BAA8B,EAG9B,aAAa,EACd,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,EAAE,8BAA8B,CAAC,kBAAkB,CAYxF,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,EAAE,aAAa,CACvD,kBAAkB,CAInB,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,+BAA+B,IAAI,OAAO,CAAC,IAAI,CAAC,CAiBrE;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAO/D"}
@@ -1,104 +0,0 @@
1
- /**
2
- * Compile-time regression fixture for the `TCtx` generic on
3
- * `composeDockAvailability` / `ComposeDockAvailabilityOptions` /
4
- * `GateEvaluator`.
5
- *
6
- * This is the contract round-3 of PR #1242 is restoring:
7
- *
8
- * - `TCtx` must accept an INTERFACE (no string index signature). The
9
- * round-1 fixup tightened the constraint to
10
- * `TCtx extends Record<string, unknown>`, which silently rejected
11
- * interface-style contexts — the same trap Copilot caught with
12
- * `TActions` in PR #1239. The constraint is now a self-mapped
13
- * `{ [K in keyof TCtx]: unknown }` (matching the `TActions` pattern in
14
- * `../../types.ts`).
15
- *
16
- * - The default `TCtx = GateEvaluationContext` must keep existing
17
- * untyped call sites compiling unchanged.
18
- *
19
- * - The factory's `<TCtx>` generic must flow through to each evaluator
20
- * so `ctx.fieldName` is typed without a cast at the evaluator call
21
- * site.
22
- *
23
- * Lives in a `.ts` file (NOT `.test.ts`) so:
24
- * - `tsc --noEmit` (the package's `typecheck` script, run in CI via
25
- * `pnpm turbo run typecheck`) does include it — the package's
26
- * `tsconfig.svelte.json` includes `src/** /*.ts` and excludes only
27
- * `**\/*.test.ts` and `**\/*.spec.ts`.
28
- * - Vitest does NOT execute it (no `.test.ts` suffix), so the
29
- * `_assertInterfaceTCtx*` symbols below never run — their bodies must
30
- * just compile.
31
- *
32
- * Mirrors the same pattern as
33
- * `../../__tests__/typed-tool-fixture/register-typed-tool.ts` (PR #1239).
34
- */
35
- import { composeDockAvailability } from '../compose-availability.js';
36
- /**
37
- * Type-only assertion: an `Options` literal parameterized over an
38
- * interface-style context must compile, and the evaluator must receive a
39
- * typed `ctx` (no cast) with the consumer's field types.
40
- *
41
- * If `TCtx` ever tightens back to `Record<string, unknown>`, this
42
- * declaration fails with TS2344 ("Type 'MyInterfaceContext' does not
43
- * satisfy the constraint 'Record<string, unknown>'").
44
- */
45
- export const _assertInterfaceTCtxOptions = {
46
- tools: [],
47
- context: { userId: 'u-1', tenantId: 't-1' },
48
- evaluators: {
49
- permission: (gateId, ctx) => {
50
- // No cast required — ctx.userId / ctx.tenantId are typed `string`.
51
- const _userId = ctx.userId;
52
- const _tenantId = ctx.tenantId;
53
- return gateId.startsWith('permission:');
54
- },
55
- },
56
- };
57
- /**
58
- * Type-only assertion: `GateEvaluator<MyInterfaceContext>` accepts an
59
- * interface. Same regression as above, but exercised through the
60
- * `GateEvaluator` alias directly (which `ComposeDockAvailabilityOptions`
61
- * indexes into via `evaluators`).
62
- */
63
- export const _assertInterfaceTCtxEvaluator = (gateId, ctx) => {
64
- const _ = ctx.userId;
65
- return gateId === 'permission:any';
66
- };
67
- /**
68
- * Type-only assertion: the `composeDockAvailability<TCtx>` factory
69
- * accepts an interface-style `TCtx` and threads it through to evaluators
70
- * without erasure. Never called at runtime — its body just has to
71
- * compile.
72
- */
73
- export async function _assertInterfaceTCtxFactoryFlow() {
74
- const tools = [
75
- { id: 't', label: 'T', gates: ['permission:any'] },
76
- ];
77
- await composeDockAvailability({
78
- tools,
79
- context: { userId: 'u-1', tenantId: 't-1' },
80
- evaluators: {
81
- permission: (_gateId, ctx) => {
82
- // TYPED: ctx.userId is `string`, not `unknown`. If the factory
83
- // dropped its generic on the evaluator signature, the next line
84
- // would only compile as `unknown`.
85
- const _userId = ctx.userId;
86
- return true;
87
- },
88
- },
89
- });
90
- }
91
- /**
92
- * Type-only assertion: the untyped (back-compat) call site must still
93
- * compile with no generic argument and resolve `TCtx` to the default
94
- * `GateEvaluationContext` (`Record<string, unknown>`). If the default
95
- * ever drifted, every existing untyped consumer would break.
96
- */
97
- export async function _assertUntypedDefaultTCtx() {
98
- const ctx = { foo: 'bar' };
99
- await composeDockAvailability({
100
- tools: [{ id: 't', label: 'T' }],
101
- context: ctx,
102
- evaluators: {},
103
- });
104
- }
@@ -1,25 +0,0 @@
1
- <script lang="ts">
2
- /**
3
- * Test consumer that calls the real `useSTT()` hook so its `onDestroy`
4
- * per-hook ownership logic (R4) runs when this component unmounts.
5
- */
6
- import { type UseSTTReturn, useSTT } from '../useSTT.svelte.js';
7
-
8
- interface Props {
9
- /** Hand the live hook back to the test so it can call start()/stop(). */
10
- onReady?: (stt: UseSTTReturn) => void;
11
- /** If true, start a listening session as soon as this consumer mounts. */
12
- autoStart?: boolean;
13
- }
14
-
15
- const { onReady, autoStart = false }: Props = $props();
16
-
17
- const stt = useSTT();
18
- // This fixture intentionally snapshots props during setup (test-only).
19
- // svelte-ignore state_referenced_locally
20
- onReady?.(stt);
21
- // svelte-ignore state_referenced_locally
22
- if (autoStart) {
23
- void stt.start();
24
- }
25
- </script>
@@ -1,15 +0,0 @@
1
- /**
2
- * Test consumer that calls the real `useSTT()` hook so its `onDestroy`
3
- * per-hook ownership logic (R4) runs when this component unmounts.
4
- */
5
- import { type UseSTTReturn } from '../useSTT.svelte.js';
6
- interface Props {
7
- /** Hand the live hook back to the test so it can call start()/stop(). */
8
- onReady?: (stt: UseSTTReturn) => void;
9
- /** If true, start a listening session as soon as this consumer mounts. */
10
- autoStart?: boolean;
11
- }
12
- declare const SttConsumer: import("svelte").Component<Props, {}, "">;
13
- type SttConsumer = ReturnType<typeof SttConsumer>;
14
- export default SttConsumer;
15
- //# sourceMappingURL=stt-consumer.fixture.svelte.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stt-consumer.fixture.svelte.d.ts","sourceRoot":"","sources":["../../../src/hooks/__tests__/stt-consumer.fixture.svelte.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,OAAO,EAAE,KAAK,YAAY,EAAU,MAAM,qBAAqB,CAAC;AAGhE,UAAU,KAAK;IACb,yEAAyE;IACzE,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,IAAI,CAAC;IACtC,0EAA0E;IAC1E,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAoBD,QAAA,MAAM,WAAW,2CAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
@@ -1,42 +0,0 @@
1
- <script lang="ts">
2
- /**
3
- * R4 harness: sets a fake app-state manager on context, then mounts/unmounts
4
- * `useSTT()` consumers so the test can prove per-hook ownership — unmounting a
5
- * consumer that did NOT start listening must not stop the shared singleton.
6
- */
7
- import type { SmrtAppStateManager } from '../../state/app-state.svelte.js';
8
- import { setAppStateContext } from '../../state/context.js';
9
- import type { UseSTTReturn } from '../useSTT.svelte.js';
10
- import SttConsumer from './stt-consumer.fixture.svelte';
11
-
12
- interface Props {
13
- manager: SmrtAppStateManager;
14
- showA?: boolean;
15
- showB?: boolean;
16
- onReadyA?: (stt: UseSTTReturn) => void;
17
- onReadyB?: (stt: UseSTTReturn) => void;
18
- autoStartA?: boolean;
19
- autoStartB?: boolean;
20
- }
21
-
22
- const {
23
- manager,
24
- showA = true,
25
- showB = true,
26
- onReadyA,
27
- onReadyB,
28
- autoStartA = false,
29
- autoStartB = false,
30
- }: Props = $props();
31
-
32
- // Context is set once during setup with the initial manager (test-only).
33
- // svelte-ignore state_referenced_locally
34
- setAppStateContext(manager);
35
- </script>
36
-
37
- {#if showA}
38
- <SttConsumer onReady={onReadyA} autoStart={autoStartA} />
39
- {/if}
40
- {#if showB}
41
- <SttConsumer onReady={onReadyB} autoStart={autoStartB} />
42
- {/if}
@@ -1,20 +0,0 @@
1
- /**
2
- * R4 harness: sets a fake app-state manager on context, then mounts/unmounts
3
- * `useSTT()` consumers so the test can prove per-hook ownership — unmounting a
4
- * consumer that did NOT start listening must not stop the shared singleton.
5
- */
6
- import type { SmrtAppStateManager } from '../../state/app-state.svelte.js';
7
- import type { UseSTTReturn } from '../useSTT.svelte.js';
8
- interface Props {
9
- manager: SmrtAppStateManager;
10
- showA?: boolean;
11
- showB?: boolean;
12
- onReadyA?: (stt: UseSTTReturn) => void;
13
- onReadyB?: (stt: UseSTTReturn) => void;
14
- autoStartA?: boolean;
15
- autoStartB?: boolean;
16
- }
17
- declare const SttOwnershipHarness: import("svelte").Component<Props, {}, "">;
18
- type SttOwnershipHarness = ReturnType<typeof SttOwnershipHarness>;
19
- export default SttOwnershipHarness;
20
- //# sourceMappingURL=stt-ownership-harness.svelte.d.ts.map