@buoy-gg/shared-ui 7.0.36 → 7.0.38

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 (284) hide show
  1. package/README.md +33 -26
  2. package/floating.d.ts +1 -0
  3. package/floating.js +2 -0
  4. package/lib/commonjs/JsModal.js +16 -1
  5. package/lib/commonjs/JsModal.web.js +16 -1
  6. package/lib/commonjs/dataViewer/CyberpunkInput.js +6 -1
  7. package/lib/commonjs/dataViewer/LiveExplorer.js +28 -16
  8. package/lib/commonjs/hooks/safe-area-impl.js +1 -1
  9. package/lib/commonjs/icons/ReactQueryIcon.js +9 -161
  10. package/lib/commonjs/icons/SentryBugIcon.js +9 -171
  11. package/lib/commonjs/index.js +57 -6
  12. package/lib/commonjs/license/AccountSetup.js +56 -0
  13. package/lib/commonjs/license/AccountSetup.web.js +81 -0
  14. package/lib/commonjs/license/FeatureGate.js +10 -43
  15. package/lib/commonjs/license/FreeAccountPrompt.js +35 -12
  16. package/lib/commonjs/license/index.js +0 -6
  17. package/lib/commonjs/license/licenseModule.js +56 -36
  18. package/lib/commonjs/license/tierLimits.js +12 -63
  19. package/lib/commonjs/storage/devToolsStorageKeys.js +8 -1
  20. package/lib/commonjs/stores/BaseEventStore.js +21 -5
  21. package/lib/commonjs/stores/createToolStore.js +21 -3
  22. package/lib/commonjs/stores/floatingToolStore.js +71 -0
  23. package/lib/commonjs/stores/floatingToolStore.test.js +112 -0
  24. package/lib/commonjs/sync/toolActionRegistry.js +85 -2
  25. package/lib/commonjs/ui/backgrounds/README.md +52 -0
  26. package/lib/commonjs/ui/backgrounds/ToolBackground.js +4 -2
  27. package/lib/commonjs/ui/backgrounds/index.js +8 -1
  28. package/lib/commonjs/ui/backgrounds/registry.js +8 -0
  29. package/lib/commonjs/ui/backgrounds/variants/wormhole/motion.js +48 -0
  30. package/lib/commonjs/ui/backgrounds/variants/wormhole/textures.js +3 -0
  31. package/lib/commonjs/ui/backgrounds/variants/wormhole.js +133 -0
  32. package/lib/commonjs/ui/components/ClipboardHintBanner.js +5 -6
  33. package/lib/commonjs/ui/components/CompactRow.js +94 -74
  34. package/lib/commonjs/ui/components/DraggableHeader.js +16 -1
  35. package/lib/commonjs/ui/components/HeaderSearchButton.js +17 -4
  36. package/lib/commonjs/ui/floating/FloatingTool.js +1010 -0
  37. package/lib/commonjs/ui/floating/FloatingTool.web.js +591 -0
  38. package/lib/commonjs/ui/floating/FloatingToolHost.js +32 -0
  39. package/lib/commonjs/ui/floating/FloatingToolHost.web.js +28 -0
  40. package/lib/commonjs/ui/floating/index.js +105 -0
  41. package/lib/commonjs/ui/floating/index.web.js +105 -0
  42. package/lib/commonjs/ui/floating/onboardingConstants.js +70 -0
  43. package/lib/commonjs/ui/floating/onboardingConstants.web.js +34 -0
  44. package/lib/commonjs/ui/gameUI/constants/gameUIColors.js +3 -1
  45. package/lib/commonjs/ui/index.js +118 -2
  46. package/lib/commonjs/ui/night/nightTheme.js +10 -0
  47. package/lib/commonjs/ui/night/primitives.js +22 -5
  48. package/lib/commonjs/ui/otto/OttoSceneView.js +69 -0
  49. package/lib/commonjs/ui/otto/index.js +22 -0
  50. package/lib/commonjs/ui/otto/ottoEngine.js +10 -7
  51. package/lib/commonjs/ui/otto/ottoScenes.js +949 -0
  52. package/lib/commonjs/utils/minimalSuperJSON.js +13 -3
  53. package/lib/module/JsModal.js +16 -1
  54. package/lib/module/JsModal.web.js +16 -1
  55. package/lib/module/dataViewer/CyberpunkInput.js +6 -1
  56. package/lib/module/dataViewer/LiveExplorer.js +28 -16
  57. package/lib/module/hooks/safe-area-impl.js +1 -1
  58. package/lib/module/icons/ReactQueryIcon.js +9 -161
  59. package/lib/module/icons/SentryBugIcon.js +9 -171
  60. package/lib/module/index.js +4 -1
  61. package/lib/module/license/AccountSetup.js +52 -0
  62. package/lib/module/license/AccountSetup.web.js +77 -0
  63. package/lib/module/license/FeatureGate.js +10 -43
  64. package/lib/module/license/FreeAccountPrompt.js +35 -12
  65. package/lib/module/license/index.js +1 -1
  66. package/lib/module/license/licenseModule.js +50 -35
  67. package/lib/module/license/tierLimits.js +13 -63
  68. package/lib/module/storage/devToolsStorageKeys.js +8 -1
  69. package/lib/module/stores/BaseEventStore.js +21 -5
  70. package/lib/module/stores/createToolStore.js +21 -3
  71. package/lib/module/stores/floatingToolStore.js +61 -0
  72. package/lib/module/stores/floatingToolStore.test.js +111 -0
  73. package/lib/module/sync/toolActionRegistry.js +84 -2
  74. package/lib/module/ui/backgrounds/README.md +52 -0
  75. package/lib/module/ui/backgrounds/ToolBackground.js +4 -2
  76. package/lib/module/ui/backgrounds/index.js +2 -1
  77. package/lib/module/ui/backgrounds/registry.js +8 -0
  78. package/lib/module/ui/backgrounds/variants/wormhole/motion.js +44 -0
  79. package/lib/module/ui/backgrounds/variants/wormhole/textures.js +3 -0
  80. package/lib/module/ui/backgrounds/variants/wormhole.js +129 -0
  81. package/lib/module/ui/components/ClipboardHintBanner.js +5 -6
  82. package/lib/module/ui/components/CompactRow.js +94 -74
  83. package/lib/module/ui/components/DraggableHeader.js +16 -1
  84. package/lib/module/ui/components/HeaderSearchButton.js +17 -4
  85. package/lib/module/ui/floating/FloatingTool.js +1003 -0
  86. package/lib/module/ui/floating/FloatingTool.web.js +590 -0
  87. package/lib/module/ui/floating/FloatingToolHost.js +29 -0
  88. package/lib/module/ui/floating/FloatingToolHost.web.js +25 -0
  89. package/lib/module/ui/floating/index.js +6 -0
  90. package/lib/module/ui/floating/index.web.js +6 -0
  91. package/lib/module/ui/floating/onboardingConstants.js +64 -0
  92. package/lib/module/ui/floating/onboardingConstants.web.js +27 -0
  93. package/lib/module/ui/gameUI/constants/gameUIColors.js +3 -1
  94. package/lib/module/ui/index.js +5 -1
  95. package/lib/module/ui/night/nightTheme.js +10 -0
  96. package/lib/module/ui/night/primitives.js +22 -5
  97. package/lib/module/ui/otto/OttoSceneView.js +64 -0
  98. package/lib/module/ui/otto/index.js +3 -1
  99. package/lib/module/ui/otto/ottoEngine.js +10 -7
  100. package/lib/module/ui/otto/ottoScenes.js +942 -0
  101. package/lib/module/utils/minimalSuperJSON.js +13 -3
  102. package/lib/typescript/commonjs/JsModal.d.ts +43 -2
  103. package/lib/typescript/commonjs/JsModal.d.ts.map +1 -1
  104. package/lib/typescript/commonjs/JsModal.web.d.ts +5 -2
  105. package/lib/typescript/commonjs/JsModal.web.d.ts.map +1 -1
  106. package/lib/typescript/commonjs/dataViewer/CyberpunkInput.d.ts.map +1 -1
  107. package/lib/typescript/commonjs/dataViewer/LiveExplorer.d.ts.map +1 -1
  108. package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
  109. package/lib/typescript/commonjs/icons/ReactQueryIcon.d.ts +1 -2
  110. package/lib/typescript/commonjs/icons/ReactQueryIcon.d.ts.map +1 -1
  111. package/lib/typescript/commonjs/icons/SentryBugIcon.d.ts +1 -2
  112. package/lib/typescript/commonjs/icons/SentryBugIcon.d.ts.map +1 -1
  113. package/lib/typescript/commonjs/index.d.ts +4 -1
  114. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  115. package/lib/typescript/commonjs/license/AccountSetup.d.ts +4 -0
  116. package/lib/typescript/commonjs/license/AccountSetup.d.ts.map +1 -0
  117. package/lib/typescript/commonjs/license/AccountSetup.web.d.ts +2 -0
  118. package/lib/typescript/commonjs/license/AccountSetup.web.d.ts.map +1 -0
  119. package/lib/typescript/commonjs/license/FeatureGate.d.ts +3 -19
  120. package/lib/typescript/commonjs/license/FeatureGate.d.ts.map +1 -1
  121. package/lib/typescript/commonjs/license/FreeAccountPrompt.d.ts +8 -11
  122. package/lib/typescript/commonjs/license/FreeAccountPrompt.d.ts.map +1 -1
  123. package/lib/typescript/commonjs/license/index.d.ts +1 -1
  124. package/lib/typescript/commonjs/license/index.d.ts.map +1 -1
  125. package/lib/typescript/commonjs/license/licenseModule.d.ts +18 -31
  126. package/lib/typescript/commonjs/license/licenseModule.d.ts.map +1 -1
  127. package/lib/typescript/commonjs/license/tierLimits.d.ts +9 -52
  128. package/lib/typescript/commonjs/license/tierLimits.d.ts.map +1 -1
  129. package/lib/typescript/commonjs/storage/devToolsStorageKeys.d.ts +6 -0
  130. package/lib/typescript/commonjs/storage/devToolsStorageKeys.d.ts.map +1 -1
  131. package/lib/typescript/commonjs/stores/BaseEventStore.d.ts.map +1 -1
  132. package/lib/typescript/commonjs/stores/createToolStore.d.ts.map +1 -1
  133. package/lib/typescript/commonjs/stores/floatingToolStore.d.ts +27 -0
  134. package/lib/typescript/commonjs/stores/floatingToolStore.d.ts.map +1 -0
  135. package/lib/typescript/commonjs/stores/floatingToolStore.test.d.ts +2 -0
  136. package/lib/typescript/commonjs/stores/floatingToolStore.test.d.ts.map +1 -0
  137. package/lib/typescript/commonjs/sync/toolActionRegistry.d.ts +4 -32
  138. package/lib/typescript/commonjs/sync/toolActionRegistry.d.ts.map +1 -1
  139. package/lib/typescript/commonjs/ui/backgrounds/ToolBackground.d.ts +7 -1
  140. package/lib/typescript/commonjs/ui/backgrounds/ToolBackground.d.ts.map +1 -1
  141. package/lib/typescript/commonjs/ui/backgrounds/index.d.ts +2 -1
  142. package/lib/typescript/commonjs/ui/backgrounds/index.d.ts.map +1 -1
  143. package/lib/typescript/commonjs/ui/backgrounds/registry.d.ts.map +1 -1
  144. package/lib/typescript/commonjs/ui/backgrounds/types.d.ts +11 -1
  145. package/lib/typescript/commonjs/ui/backgrounds/types.d.ts.map +1 -1
  146. package/lib/typescript/commonjs/ui/backgrounds/variants/wormhole/motion.d.ts +24 -0
  147. package/lib/typescript/commonjs/ui/backgrounds/variants/wormhole/motion.d.ts.map +1 -0
  148. package/lib/typescript/commonjs/ui/backgrounds/variants/wormhole/textures.d.ts +13 -0
  149. package/lib/typescript/commonjs/ui/backgrounds/variants/wormhole/textures.d.ts.map +1 -0
  150. package/lib/typescript/commonjs/ui/backgrounds/variants/wormhole.d.ts +3 -0
  151. package/lib/typescript/commonjs/ui/backgrounds/variants/wormhole.d.ts.map +1 -0
  152. package/lib/typescript/commonjs/ui/components/ClipboardHintBanner.d.ts.map +1 -1
  153. package/lib/typescript/commonjs/ui/components/CompactRow.d.ts +8 -1
  154. package/lib/typescript/commonjs/ui/components/CompactRow.d.ts.map +1 -1
  155. package/lib/typescript/commonjs/ui/components/DraggableHeader.d.ts +4 -1
  156. package/lib/typescript/commonjs/ui/components/DraggableHeader.d.ts.map +1 -1
  157. package/lib/typescript/commonjs/ui/components/HeaderSearchButton.d.ts +7 -1
  158. package/lib/typescript/commonjs/ui/components/HeaderSearchButton.d.ts.map +1 -1
  159. package/lib/typescript/commonjs/ui/floating/FloatingTool.d.ts +79 -0
  160. package/lib/typescript/commonjs/ui/floating/FloatingTool.d.ts.map +1 -0
  161. package/lib/typescript/commonjs/ui/floating/FloatingTool.web.d.ts +64 -0
  162. package/lib/typescript/commonjs/ui/floating/FloatingTool.web.d.ts.map +1 -0
  163. package/lib/typescript/commonjs/ui/floating/FloatingToolHost.d.ts +3 -0
  164. package/lib/typescript/commonjs/ui/floating/FloatingToolHost.d.ts.map +1 -0
  165. package/lib/typescript/commonjs/ui/floating/FloatingToolHost.web.d.ts +3 -0
  166. package/lib/typescript/commonjs/ui/floating/FloatingToolHost.web.d.ts.map +1 -0
  167. package/lib/typescript/commonjs/ui/floating/index.d.ts +7 -0
  168. package/lib/typescript/commonjs/ui/floating/index.d.ts.map +1 -0
  169. package/lib/typescript/commonjs/ui/floating/index.web.d.ts +7 -0
  170. package/lib/typescript/commonjs/ui/floating/index.web.d.ts.map +1 -0
  171. package/lib/typescript/commonjs/ui/floating/onboardingConstants.d.ts +30 -0
  172. package/lib/typescript/commonjs/ui/floating/onboardingConstants.d.ts.map +1 -0
  173. package/lib/typescript/commonjs/ui/floating/onboardingConstants.web.d.ts +13 -0
  174. package/lib/typescript/commonjs/ui/floating/onboardingConstants.web.d.ts.map +1 -0
  175. package/lib/typescript/commonjs/ui/gameUI/constants/gameUIColors.d.ts +2 -0
  176. package/lib/typescript/commonjs/ui/gameUI/constants/gameUIColors.d.ts.map +1 -1
  177. package/lib/typescript/commonjs/ui/index.d.ts +6 -0
  178. package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
  179. package/lib/typescript/commonjs/ui/night/nightTheme.d.ts +10 -0
  180. package/lib/typescript/commonjs/ui/night/nightTheme.d.ts.map +1 -1
  181. package/lib/typescript/commonjs/ui/night/primitives.d.ts +10 -3
  182. package/lib/typescript/commonjs/ui/night/primitives.d.ts.map +1 -1
  183. package/lib/typescript/commonjs/ui/otto/OttoSceneView.d.ts +30 -0
  184. package/lib/typescript/commonjs/ui/otto/OttoSceneView.d.ts.map +1 -0
  185. package/lib/typescript/commonjs/ui/otto/index.d.ts +2 -0
  186. package/lib/typescript/commonjs/ui/otto/index.d.ts.map +1 -1
  187. package/lib/typescript/commonjs/ui/otto/ottoEngine.d.ts +1 -1
  188. package/lib/typescript/commonjs/ui/otto/ottoEngine.d.ts.map +1 -1
  189. package/lib/typescript/commonjs/ui/otto/ottoScenes.d.ts +75 -0
  190. package/lib/typescript/commonjs/ui/otto/ottoScenes.d.ts.map +1 -0
  191. package/lib/typescript/commonjs/utils/minimalSuperJSON.d.ts.map +1 -1
  192. package/lib/typescript/module/JsModal.d.ts +43 -2
  193. package/lib/typescript/module/JsModal.d.ts.map +1 -1
  194. package/lib/typescript/module/JsModal.web.d.ts +5 -2
  195. package/lib/typescript/module/JsModal.web.d.ts.map +1 -1
  196. package/lib/typescript/module/dataViewer/CyberpunkInput.d.ts.map +1 -1
  197. package/lib/typescript/module/dataViewer/LiveExplorer.d.ts.map +1 -1
  198. package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
  199. package/lib/typescript/module/icons/ReactQueryIcon.d.ts +1 -2
  200. package/lib/typescript/module/icons/ReactQueryIcon.d.ts.map +1 -1
  201. package/lib/typescript/module/icons/SentryBugIcon.d.ts +1 -2
  202. package/lib/typescript/module/icons/SentryBugIcon.d.ts.map +1 -1
  203. package/lib/typescript/module/index.d.ts +4 -1
  204. package/lib/typescript/module/index.d.ts.map +1 -1
  205. package/lib/typescript/module/license/AccountSetup.d.ts +4 -0
  206. package/lib/typescript/module/license/AccountSetup.d.ts.map +1 -0
  207. package/lib/typescript/module/license/AccountSetup.web.d.ts +2 -0
  208. package/lib/typescript/module/license/AccountSetup.web.d.ts.map +1 -0
  209. package/lib/typescript/module/license/FeatureGate.d.ts +3 -19
  210. package/lib/typescript/module/license/FeatureGate.d.ts.map +1 -1
  211. package/lib/typescript/module/license/FreeAccountPrompt.d.ts +8 -11
  212. package/lib/typescript/module/license/FreeAccountPrompt.d.ts.map +1 -1
  213. package/lib/typescript/module/license/index.d.ts +1 -1
  214. package/lib/typescript/module/license/index.d.ts.map +1 -1
  215. package/lib/typescript/module/license/licenseModule.d.ts +18 -31
  216. package/lib/typescript/module/license/licenseModule.d.ts.map +1 -1
  217. package/lib/typescript/module/license/tierLimits.d.ts +9 -52
  218. package/lib/typescript/module/license/tierLimits.d.ts.map +1 -1
  219. package/lib/typescript/module/storage/devToolsStorageKeys.d.ts +6 -0
  220. package/lib/typescript/module/storage/devToolsStorageKeys.d.ts.map +1 -1
  221. package/lib/typescript/module/stores/BaseEventStore.d.ts.map +1 -1
  222. package/lib/typescript/module/stores/createToolStore.d.ts.map +1 -1
  223. package/lib/typescript/module/stores/floatingToolStore.d.ts +27 -0
  224. package/lib/typescript/module/stores/floatingToolStore.d.ts.map +1 -0
  225. package/lib/typescript/module/stores/floatingToolStore.test.d.ts +2 -0
  226. package/lib/typescript/module/stores/floatingToolStore.test.d.ts.map +1 -0
  227. package/lib/typescript/module/sync/toolActionRegistry.d.ts +4 -32
  228. package/lib/typescript/module/sync/toolActionRegistry.d.ts.map +1 -1
  229. package/lib/typescript/module/ui/backgrounds/ToolBackground.d.ts +7 -1
  230. package/lib/typescript/module/ui/backgrounds/ToolBackground.d.ts.map +1 -1
  231. package/lib/typescript/module/ui/backgrounds/index.d.ts +2 -1
  232. package/lib/typescript/module/ui/backgrounds/index.d.ts.map +1 -1
  233. package/lib/typescript/module/ui/backgrounds/registry.d.ts.map +1 -1
  234. package/lib/typescript/module/ui/backgrounds/types.d.ts +11 -1
  235. package/lib/typescript/module/ui/backgrounds/types.d.ts.map +1 -1
  236. package/lib/typescript/module/ui/backgrounds/variants/wormhole/motion.d.ts +24 -0
  237. package/lib/typescript/module/ui/backgrounds/variants/wormhole/motion.d.ts.map +1 -0
  238. package/lib/typescript/module/ui/backgrounds/variants/wormhole/textures.d.ts +13 -0
  239. package/lib/typescript/module/ui/backgrounds/variants/wormhole/textures.d.ts.map +1 -0
  240. package/lib/typescript/module/ui/backgrounds/variants/wormhole.d.ts +3 -0
  241. package/lib/typescript/module/ui/backgrounds/variants/wormhole.d.ts.map +1 -0
  242. package/lib/typescript/module/ui/components/ClipboardHintBanner.d.ts.map +1 -1
  243. package/lib/typescript/module/ui/components/CompactRow.d.ts +8 -1
  244. package/lib/typescript/module/ui/components/CompactRow.d.ts.map +1 -1
  245. package/lib/typescript/module/ui/components/DraggableHeader.d.ts +4 -1
  246. package/lib/typescript/module/ui/components/DraggableHeader.d.ts.map +1 -1
  247. package/lib/typescript/module/ui/components/HeaderSearchButton.d.ts +7 -1
  248. package/lib/typescript/module/ui/components/HeaderSearchButton.d.ts.map +1 -1
  249. package/lib/typescript/module/ui/floating/FloatingTool.d.ts +79 -0
  250. package/lib/typescript/module/ui/floating/FloatingTool.d.ts.map +1 -0
  251. package/lib/typescript/module/ui/floating/FloatingTool.web.d.ts +64 -0
  252. package/lib/typescript/module/ui/floating/FloatingTool.web.d.ts.map +1 -0
  253. package/lib/typescript/module/ui/floating/FloatingToolHost.d.ts +3 -0
  254. package/lib/typescript/module/ui/floating/FloatingToolHost.d.ts.map +1 -0
  255. package/lib/typescript/module/ui/floating/FloatingToolHost.web.d.ts +3 -0
  256. package/lib/typescript/module/ui/floating/FloatingToolHost.web.d.ts.map +1 -0
  257. package/lib/typescript/module/ui/floating/index.d.ts +7 -0
  258. package/lib/typescript/module/ui/floating/index.d.ts.map +1 -0
  259. package/lib/typescript/module/ui/floating/index.web.d.ts +7 -0
  260. package/lib/typescript/module/ui/floating/index.web.d.ts.map +1 -0
  261. package/lib/typescript/module/ui/floating/onboardingConstants.d.ts +30 -0
  262. package/lib/typescript/module/ui/floating/onboardingConstants.d.ts.map +1 -0
  263. package/lib/typescript/module/ui/floating/onboardingConstants.web.d.ts +13 -0
  264. package/lib/typescript/module/ui/floating/onboardingConstants.web.d.ts.map +1 -0
  265. package/lib/typescript/module/ui/gameUI/constants/gameUIColors.d.ts +2 -0
  266. package/lib/typescript/module/ui/gameUI/constants/gameUIColors.d.ts.map +1 -1
  267. package/lib/typescript/module/ui/index.d.ts +6 -0
  268. package/lib/typescript/module/ui/index.d.ts.map +1 -1
  269. package/lib/typescript/module/ui/night/nightTheme.d.ts +10 -0
  270. package/lib/typescript/module/ui/night/nightTheme.d.ts.map +1 -1
  271. package/lib/typescript/module/ui/night/primitives.d.ts +10 -3
  272. package/lib/typescript/module/ui/night/primitives.d.ts.map +1 -1
  273. package/lib/typescript/module/ui/otto/OttoSceneView.d.ts +30 -0
  274. package/lib/typescript/module/ui/otto/OttoSceneView.d.ts.map +1 -0
  275. package/lib/typescript/module/ui/otto/index.d.ts +2 -0
  276. package/lib/typescript/module/ui/otto/index.d.ts.map +1 -1
  277. package/lib/typescript/module/ui/otto/ottoEngine.d.ts +1 -1
  278. package/lib/typescript/module/ui/otto/ottoEngine.d.ts.map +1 -1
  279. package/lib/typescript/module/ui/otto/ottoScenes.d.ts +75 -0
  280. package/lib/typescript/module/ui/otto/ottoScenes.d.ts.map +1 -0
  281. package/lib/typescript/module/utils/minimalSuperJSON.d.ts.map +1 -1
  282. package/package.json +25 -5
  283. package/scripts/generate-wormhole-textures.cjs +261 -0
  284. package/scripts/test-wormhole-motion.cjs +59 -0
@@ -4,107 +4,87 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TIER_LIMITS = void 0;
7
- exports.freeKeyRaises = freeKeyRaises;
8
7
  exports.resolveEffectiveTier = resolveEffectiveTier;
9
8
  exports.useLimit = useLimit;
10
9
  var _licenseModule = require("./licenseModule.js");
11
10
  /**
12
- * Per-tier numeric limits — the ONLY thing that separates anonymous from free.
11
+ * Per-tier numeric limits — the ONLY thing that separates free from pro on a
12
+ * count.
13
13
  *
14
- * Every binary Pro gate (copy-to-clipboard, state editing, storage mutations,
15
- * navigation) is identical for both: locked. That keeps the tier split to one
16
- * table instead of scattered conditionals.
17
- *
18
- * The governing rule: **the free column never moves.** Anonymous is carved out
19
- * BELOW today's free tier — nothing is ever added to free in exchange for an
20
- * account, because that would come straight out of the Pro upgrade.
14
+ * Binary Pro gates (copy-to-clipboard, state editing, storage mutations,
15
+ * navigation) live in the tools themselves; this table is only for "how many".
16
+ * Whether the tools are usable at all is account admission, which is a
17
+ * separate question from the tier and is never expressed as a limit.
21
18
  */
22
19
 
23
20
  const LIMITS = {
24
21
  // ── network ───────────────────────────────────────────────────────────────
25
22
  "network.requests": {
26
- anonymous: 5,
27
23
  free: 25,
28
24
  pro: Infinity
29
25
  },
30
26
  "network.saved": {
31
- anonymous: 1,
32
27
  free: 5,
33
28
  pro: 50
34
29
  },
35
- // Already 1 for free, so 25% would be 0 — which deletes the feature rather
36
- // than trialling it. Raising the FREE value to make room is not an option.
37
30
  "network.overrideRules": {
38
- anonymous: 1,
39
31
  free: 1,
40
32
  pro: 50
41
33
  },
42
34
  // ── storage ───────────────────────────────────────────────────────────────
43
35
  "storage.events": {
44
- anonymous: 5,
45
36
  free: 25,
46
37
  pro: Infinity
47
38
  },
48
39
  "storage.keys": {
49
- anonymous: 5,
50
40
  free: 25,
51
41
  pro: Infinity
52
42
  },
53
- // Same floor-at-1 reasoning as network.overrideRules.
54
43
  "storage.mmkvInstances": {
55
- anonymous: 1,
56
44
  free: 1,
57
45
  pro: Infinity
58
46
  },
59
47
  // ── state tools ───────────────────────────────────────────────────────────
60
48
  "redux.actions": {
61
- anonymous: 5,
62
49
  free: 25,
63
50
  pro: Infinity
64
51
  },
65
52
  "zustand.changes": {
66
- anonymous: 5,
67
53
  free: 25,
68
54
  pro: Infinity
69
55
  },
70
56
  "jotai.changes": {
71
- anonymous: 5,
72
57
  free: 25,
73
58
  pro: Infinity
74
59
  },
75
60
  "events.entries": {
76
- anonymous: 5,
77
61
  free: 25,
78
62
  pro: Infinity
79
63
  },
80
64
  // ── render / navigation ───────────────────────────────────────────────────
81
65
  "highlightUpdates.components": {
82
- anonymous: 5,
83
66
  free: 25,
84
67
  pro: Infinity
85
68
  },
86
69
  "highlightUpdates.historyEvents": {
87
- anonymous: 1,
88
70
  free: 3,
89
71
  pro: Infinity
90
72
  },
91
73
  "highlightUpdates.detailEvents": {
92
- anonymous: 2,
93
74
  free: 5,
94
75
  pro: Infinity
95
76
  },
96
77
  "routeEvents.entries": {
97
- anonymous: 1,
98
78
  free: 3,
99
79
  pro: Infinity
100
80
  },
81
+ // One restore point at a time. The floating bar's safety slot is not one
82
+ // the user chose to keep, so it is not counted against this.
101
83
  "timeMachine.snapshots": {
102
- anonymous: 1,
103
- free: 2,
84
+ free: 1,
104
85
  pro: Infinity
105
86
  },
106
87
  "perfMonitor.automationCases": {
107
- anonymous: 1,
108
88
  free: 3,
109
89
  pro: Infinity
110
90
  },
@@ -113,12 +93,10 @@ const LIMITS = {
113
93
  // three-endpoint scenario either runs whole or refuses up front, and is never
114
94
  // silently trimmed to one rule mid-run. Enforcement is atomic in pre-flight.
115
95
  "scenarios.saved": {
116
- anonymous: 1,
117
96
  free: 3,
118
97
  pro: Infinity
119
98
  },
120
99
  "scenarios.active": {
121
- anonymous: 1,
122
100
  free: 1,
123
101
  pro: 3
124
102
  }
@@ -129,17 +107,11 @@ const TIER_LIMITS = exports.TIER_LIMITS = LIMITS;
129
107
  * The tier whose limits actually apply.
130
108
  *
131
109
  * `hasProAccess` is `useIsPro()`, which is true for a real Pro license OR the
132
- * free Weekend Pass. Routing the Weekend Pass through here is what keeps
133
- * today's behavior intact: weekend users get Pro limits, exactly as they do
134
- * now. When the Weekend Pass is later gated to key-holders, that change lands
135
- * here for free — no limit call site has to know about it.
110
+ * Weekend Pass. Routing the Weekend Pass through here is what gives weekend
111
+ * users Pro limits without any limit call site having to know about it.
136
112
  */
137
113
  function resolveEffectiveTier(tier, hasProAccess) {
138
- if (hasProAccess) return "pro";
139
- // The switch lives in @buoy-gg/license so that this and the Weekend Pass
140
- // change flip together — see isAnonymousTierEnabled().
141
- if (!(0, _licenseModule.isAnonymousTierEnabled)() && tier === "anonymous") return "free";
142
- return tier;
114
+ return hasProAccess ? "pro" : tier;
143
115
  }
144
116
 
145
117
  /**
@@ -153,27 +125,4 @@ function useLimit(key) {
153
125
  const hasProAccess = (0, _licenseModule.getUseIsPro)()();
154
126
  const tier = (0, _licenseModule.getUseTier)()();
155
127
  return TIER_LIMITS[key][resolveEffectiveTier(tier, hasProAccess)];
156
- }
157
-
158
- /**
159
- * Whether claiming a FREE key would actually raise this limit right now.
160
- *
161
- * The anonymous upsell must never promise something a free key won't deliver.
162
- * Two ways it could lie, and this closes both:
163
- *
164
- * - **Pro-exclusive features.** Copy-to-clipboard, state editing, storage
165
- * mutations and navigation are locked for anonymous AND free alike. Telling
166
- * an anonymous user a free key opens them would be false.
167
- * - **Limits that are already equal.** Override rules and MMKV instances sit
168
- * at 1 for both tiers, so a key changes nothing there either.
169
- *
170
- * It also respects `ANONYMOUS_TIER_ENABLED`: while the anonymous tier is off,
171
- * an anonymous user is *already* getting the free limits, so there is nothing
172
- * to claim and this correctly returns false everywhere. That falls out of
173
- * asking `resolveEffectiveTier` rather than reading the table directly, so the
174
- * switch and the copy can never disagree.
175
- */
176
- function freeKeyRaises(key) {
177
- const limits = TIER_LIMITS[key];
178
- return limits[resolveEffectiveTier("anonymous", false)] < limits[resolveEffectiveTier("free", false)];
179
128
  }
@@ -133,7 +133,14 @@ const devToolsStorageKeys = exports.devToolsStorageKeys = {
133
133
  */
134
134
  timeMachine: {
135
135
  root: () => `${devToolsStorageKeys.base}_time_machine`,
136
- diffViewerMode: () => `${devToolsStorageKeys.timeMachine.root()}_diff_viewer_mode` // 'split' | 'tree'
136
+ diffViewerMode: () => `${devToolsStorageKeys.timeMachine.root()}_diff_viewer_mode`,
137
+ // 'split' | 'tree'
138
+ /** The restore point the floating restore bar restores on tap (snapshot id). */
139
+ armedPoint: () => `${devToolsStorageKeys.timeMachine.root()}_armed_point`,
140
+ /** "1" when the action bar restores in reload mode (storage, then a JS reload). */
141
+ barReloadMode: () => `${devToolsStorageKeys.timeMachine.root()}_bar_reload_mode`,
142
+ /** Source ids switched OFF in the Sources strip (JSON string array). */
143
+ disabledSources: () => `${devToolsStorageKeys.timeMachine.root()}_disabled_sources`
137
144
  },
138
145
  /**
139
146
  * Scenarios storage keys. The library (saved + draft scenarios) and the
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.BaseEventStore = void 0;
7
+ var _licenseModule = require("../license/licenseModule.js");
7
8
  var _subscribable = require("../utils/subscribable.js");
8
9
  var _subscriberCountNotifier = require("../utils/subscriberCountNotifier.js");
9
10
  /**
@@ -68,6 +69,20 @@ class BaseEventStore extends _subscribable.Subscribable {
68
69
  super();
69
70
  this.maxEvents = options.maxEvents ?? 500;
70
71
  this.storeName = options.storeName;
72
+ // Defer until subclass fields are initialized before invoking lifecycle hooks.
73
+ Promise.resolve().then(() => {
74
+ const reconcile = () => {
75
+ if ((0, _licenseModule.getAccountAccess)().status === "locked") {
76
+ this.stopCapturing();
77
+ this.events = [];
78
+ this.notifyArrayListeners();
79
+ } else if (this.getTotalSubscriberCount() > 0 && !this.captureSuppressed && !this.isCapturing()) {
80
+ this.startCapturing();
81
+ }
82
+ };
83
+ (0, _licenseModule.subscribeAccountAccess)(reconcile);
84
+ reconcile();
85
+ });
71
86
  }
72
87
 
73
88
  // ===========================================================================
@@ -97,7 +112,7 @@ class BaseEventStore extends _subscribable.Subscribable {
97
112
  * Starts capturing if no one was subscribed.
98
113
  */
99
114
  onSubscribe() {
100
- if (this.getTotalSubscriberCount() === 1 && !this.captureSuppressed) {
115
+ if (this.getTotalSubscriberCount() === 1 && !this.captureSuppressed && (0, _licenseModule.getAccountAccess)().status !== "locked") {
101
116
  this.startCapturing();
102
117
  }
103
118
  (0, _subscriberCountNotifier.notifySubscriberCountChange)(this.storeName);
@@ -137,7 +152,7 @@ class BaseEventStore extends _subscribable.Subscribable {
137
152
  this.arrayListeners.add(listener);
138
153
 
139
154
  // Start capturing if this is the first subscriber
140
- if (wasEmpty && !this.captureSuppressed) {
155
+ if (wasEmpty && !this.captureSuppressed && (0, _licenseModule.getAccountAccess)().status !== "locked") {
141
156
  this.startCapturing();
142
157
  }
143
158
 
@@ -184,11 +199,12 @@ class BaseEventStore extends _subscribable.Subscribable {
184
199
  * @param event - The event to add
185
200
  */
186
201
  addEvent(event) {
202
+ if ((0, _licenseModule.getAccountAccess)().status === "locked") return;
187
203
  // Add to beginning (newest first) and limit to maxEvents
188
204
  this.events = [event, ...this.events].slice(0, this.maxEvents);
189
205
 
190
206
  // Notify individual event callbacks (via Subscribable)
191
- this.notify(event);
207
+ if ((0, _licenseModule.hasAccountAccess)()) this.notify(event);
192
208
 
193
209
  // Notify array listeners
194
210
  this.notifyArrayListeners();
@@ -212,14 +228,14 @@ class BaseEventStore extends _subscribable.Subscribable {
212
228
  * Get all events (newest first)
213
229
  */
214
230
  getEvents() {
215
- return this.events;
231
+ return (0, _licenseModule.hasAccountAccess)() ? this.events : [];
216
232
  }
217
233
 
218
234
  /**
219
235
  * Get event count
220
236
  */
221
237
  getEventCount() {
222
- return this.events.length;
238
+ return (0, _licenseModule.hasAccountAccess)() ? this.events.length : 0;
223
239
  }
224
240
 
225
241
  /**
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createToolStore = createToolStore;
7
+ var _licenseModule = require("../license/licenseModule.js");
7
8
  /**
8
9
  * createToolStore — the one bounded, subscribable buffer every tool used to
9
10
  * hand-roll.
@@ -53,6 +54,16 @@ function createToolStore(options) {
53
54
  let nextId = options.firstId ?? 1;
54
55
  let lastFlushAt = 0;
55
56
  let emitScheduled = false;
57
+ const empty = [];
58
+ let observing = false;
59
+ function observe() {
60
+ if (observing) return;
61
+ observing = true;
62
+ (0, _licenseModule.subscribeAccountAccess)(() => {
63
+ if ((0, _licenseModule.getAccountAccess)().status === "locked") items = [];
64
+ emit();
65
+ });
66
+ }
56
67
  const listeners = new Set();
57
68
  const clearListeners = new Set();
58
69
  function fire() {
@@ -83,19 +94,22 @@ function createToolStore(options) {
83
94
  const store = {
84
95
  id,
85
96
  subscribe(listener) {
97
+ observe();
86
98
  listeners.add(listener);
87
99
  return () => {
88
100
  listeners.delete(listener);
89
101
  };
90
102
  },
91
103
  getSnapshot() {
92
- return items;
104
+ observe();
105
+ return (0, _licenseModule.hasAccountAccess)() ? items : empty;
93
106
  },
94
107
  size() {
95
- return items.length;
108
+ return (0, _licenseModule.hasAccountAccess)() ? items.length : 0;
96
109
  },
97
110
  add(item) {
98
- if (paused) return;
111
+ observe();
112
+ if (paused || (0, _licenseModule.getAccountAccess)().status === "locked") return;
99
113
  if (order === "append") {
100
114
  items = items.length >= max ? [...items.slice(items.length - max + 1), item] : [...items, item];
101
115
  } else {
@@ -104,10 +118,14 @@ function createToolStore(options) {
104
118
  emit();
105
119
  },
106
120
  set(next) {
121
+ observe();
122
+ if (!(0, _licenseModule.hasAccountAccess)()) return;
107
123
  items = trim(next);
108
124
  emit();
109
125
  },
110
126
  update(fn) {
127
+ observe();
128
+ if ((0, _licenseModule.getAccountAccess)().status === "locked") return;
111
129
  items = trim(fn(items));
112
130
  emit();
113
131
  },
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.dismissFloatingTool = dismissFloatingTool;
7
+ exports.getFloatingTools = void 0;
8
+ exports.openFloatingTool = openFloatingTool;
9
+ exports.registerPersistentFloatingTool = registerPersistentFloatingTool;
10
+ exports.subscribeFloatingTools = void 0;
11
+ let entries = [];
12
+ let revision = 0;
13
+ const listeners = new Set();
14
+ const notify = () => listeners.forEach(listener => listener());
15
+ const getFloatingTools = () => entries;
16
+ exports.getFloatingTools = getFloatingTools;
17
+ const subscribeFloatingTools = listener => {
18
+ listeners.add(listener);
19
+ return () => {
20
+ listeners.delete(listener);
21
+ };
22
+ };
23
+
24
+ /** Open or restore one tool. Mount FloatingToolHost once at the application root. */
25
+ exports.subscribeFloatingTools = subscribeFloatingTools;
26
+ function openFloatingTool(tool) {
27
+ if (!tool.id.trim()) throw new Error("Floating tools need a non-empty id");
28
+ const entry = {
29
+ ...tool,
30
+ revealToken: ++revision
31
+ };
32
+ entries = entries.some(value => value.id === tool.id) ? entries.map(value => value.id === tool.id ? entry : value) : [...entries, entry];
33
+ notify();
34
+ }
35
+
36
+ /** Removes the UI only. Tool actions such as Stop belong to the tool's own controller. */
37
+ function dismissFloatingTool(id) {
38
+ if (!entries.some(entry => entry.id === id)) return;
39
+ entries = entries.filter(entry => entry.id !== id);
40
+ notify();
41
+ }
42
+
43
+ /** Register at app startup to restore an open tool using its existing position storage. */
44
+ function registerPersistentFloatingTool(tool, storage) {
45
+ if (!tool.id.trim()) throw new Error("Floating tools need a non-empty id");
46
+ const key = `@buoy/floating-tool/${tool.id}/open`;
47
+ let disposed = false;
48
+ let changed = false;
49
+ let wasOpen = entries.some(entry => entry.id === tool.id);
50
+ let writes = Promise.resolve();
51
+ const unsubscribe = subscribeFloatingTools(() => {
52
+ const isOpen = entries.some(entry => entry.id === tool.id);
53
+ if (isOpen === wasOpen) return;
54
+ wasOpen = isOpen;
55
+ changed = true;
56
+ writes = writes.then(() => storage.setItem(key, isOpen ? "1" : "0")).then(() => {}, () => {});
57
+ });
58
+ void storage.getItem(key).then(saved => {
59
+ if (disposed || changed || wasOpen || saved !== "1") return;
60
+ // Zero restores the saved hidden state; explicit opens still reveal the tool.
61
+ entries = [...entries, {
62
+ ...tool,
63
+ revealToken: 0
64
+ }];
65
+ notify();
66
+ }).catch(() => {});
67
+ return () => {
68
+ disposed = true;
69
+ unsubscribe();
70
+ };
71
+ }
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+
3
+ var _vitest = require("vitest");
4
+ var _floatingToolStore = require("./floatingToolStore.js");
5
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
6
+ (0, _vitest.afterEach)(() => (0, _floatingToolStore.getFloatingTools)().forEach(tool => (0, _floatingToolStore.dismissFloatingTool)(tool.id)));
7
+ (0, _vitest.describe)("floating tool registry", () => {
8
+ (0, _vitest.it)("restores an existing id and keeps other tools intact", () => {
9
+ (0, _floatingToolStore.openFloatingTool)({
10
+ id: "network",
11
+ render: () => null
12
+ });
13
+ (0, _floatingToolStore.openFloatingTool)({
14
+ id: "recorder",
15
+ render: () => null
16
+ });
17
+ const first = (0, _floatingToolStore.getFloatingTools)()[0].revealToken;
18
+ const other = (0, _floatingToolStore.getFloatingTools)()[1];
19
+ (0, _floatingToolStore.openFloatingTool)({
20
+ id: "network",
21
+ render: () => "updated"
22
+ });
23
+ (0, _vitest.expect)((0, _floatingToolStore.getFloatingTools)()).toHaveLength(2);
24
+ (0, _vitest.expect)((0, _floatingToolStore.getFloatingTools)()[0].revealToken).toBeGreaterThan(first);
25
+ (0, _vitest.expect)((0, _floatingToolStore.getFloatingTools)()[1]).toBe(other);
26
+ });
27
+ (0, _vitest.it)("publishes stable snapshots and isolates dismissal", () => {
28
+ const listener = _vitest.vi.fn();
29
+ const unsubscribe = (0, _floatingToolStore.subscribeFloatingTools)(listener);
30
+ (0, _floatingToolStore.openFloatingTool)({
31
+ id: "one",
32
+ render: () => null
33
+ });
34
+ const snapshot = (0, _floatingToolStore.getFloatingTools)();
35
+ (0, _vitest.expect)((0, _floatingToolStore.getFloatingTools)()).toBe(snapshot);
36
+ (0, _floatingToolStore.dismissFloatingTool)("missing");
37
+ (0, _vitest.expect)(listener).toHaveBeenCalledTimes(1);
38
+ (0, _floatingToolStore.openFloatingTool)({
39
+ id: "two",
40
+ render: () => null
41
+ });
42
+ (0, _floatingToolStore.dismissFloatingTool)("one");
43
+ (0, _vitest.expect)((0, _floatingToolStore.getFloatingTools)().map(tool => tool.id)).toEqual(["two"]);
44
+ unsubscribe();
45
+ (0, _floatingToolStore.dismissFloatingTool)("two");
46
+ (0, _vitest.expect)(listener).toHaveBeenCalledTimes(3);
47
+ });
48
+ (0, _vitest.it)("rejects missing tool identities", () => {
49
+ (0, _vitest.expect)(() => (0, _floatingToolStore.openFloatingTool)({
50
+ id: " ",
51
+ render: () => null
52
+ })).toThrow("non-empty id");
53
+ (0, _vitest.expect)((0, _floatingToolStore.getFloatingTools)()).toHaveLength(0);
54
+ });
55
+ });
56
+ (0, _vitest.describe)("persistent floating tools", () => {
57
+ (0, _vitest.it)("restores after a fresh registry loads and remembers dismissal", async () => {
58
+ const values = new Map();
59
+ const storage = {
60
+ getItem: _vitest.vi.fn(async key => values.get(key) ?? null),
61
+ setItem: _vitest.vi.fn(async (key, value) => {
62
+ values.set(key, value);
63
+ })
64
+ };
65
+ const tool = {
66
+ id: "persisted",
67
+ render: () => null
68
+ };
69
+ _vitest.vi.resetModules();
70
+ const first = await Promise.resolve().then(() => _interopRequireWildcard(require("./floatingToolStore")));
71
+ const disposeFirst = first.registerPersistentFloatingTool(tool, storage);
72
+ first.openFloatingTool(tool);
73
+ await _vitest.vi.waitFor(() => (0, _vitest.expect)(values.get("@buoy/floating-tool/persisted/open")).toBe("1"));
74
+ disposeFirst();
75
+ _vitest.vi.resetModules();
76
+ const second = await Promise.resolve().then(() => _interopRequireWildcard(require("./floatingToolStore")));
77
+ const disposeSecond = second.registerPersistentFloatingTool(tool, storage);
78
+ await _vitest.vi.waitFor(() => (0, _vitest.expect)(second.getFloatingTools()).toHaveLength(1));
79
+ (0, _vitest.expect)(second.getFloatingTools()[0].revealToken).toBe(0);
80
+ second.dismissFloatingTool(tool.id);
81
+ await _vitest.vi.waitFor(() => (0, _vitest.expect)(values.get("@buoy/floating-tool/persisted/open")).toBe("0"));
82
+ disposeSecond();
83
+ _vitest.vi.resetModules();
84
+ const third = await Promise.resolve().then(() => _interopRequireWildcard(require("./floatingToolStore")));
85
+ const disposeThird = third.registerPersistentFloatingTool(tool, storage);
86
+ await Promise.resolve();
87
+ (0, _vitest.expect)(third.getFloatingTools()).toHaveLength(0);
88
+ disposeThird();
89
+ });
90
+ (0, _vitest.it)("does not reopen a tool closed while its saved state was loading", async () => {
91
+ _vitest.vi.resetModules();
92
+ const registry = await Promise.resolve().then(() => _interopRequireWildcard(require("./floatingToolStore")));
93
+ let resolve;
94
+ const storage = {
95
+ getItem: () => new Promise(done => {
96
+ resolve = done;
97
+ }),
98
+ setItem: _vitest.vi.fn(async () => {})
99
+ };
100
+ const tool = {
101
+ id: "race",
102
+ render: () => null
103
+ };
104
+ const dispose = registry.registerPersistentFloatingTool(tool, storage);
105
+ registry.openFloatingTool(tool);
106
+ registry.dismissFloatingTool(tool.id);
107
+ resolve("1");
108
+ await _vitest.vi.waitFor(() => (0, _vitest.expect)(storage.setItem).toHaveBeenLastCalledWith("@buoy/floating-tool/race/open", "0"));
109
+ (0, _vitest.expect)(registry.getFloatingTools()).toHaveLength(0);
110
+ dispose();
111
+ });
112
+ });
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.dispatchToolAction = dispatchToolAction;
7
7
  exports.getToolAdapters = getToolAdapters;
8
+ exports.guardToolAdapter = guardToolAdapter;
8
9
  exports.isToolRegistryReady = isToolRegistryReady;
9
10
  exports.listSnapshotToolIds = listSnapshotToolIds;
10
11
  exports.listToolActions = listToolActions;
@@ -12,6 +13,7 @@ exports.listToolIds = listToolIds;
12
13
  exports.readToolSnapshot = readToolSnapshot;
13
14
  exports.registerToolAdapters = registerToolAdapters;
14
15
  exports.waitForToolRegistry = waitForToolRegistry;
16
+ var _licenseModule = require("../license/licenseModule.js");
15
17
  /**
16
18
  * toolActionRegistry — the on-device twin of the broker's action dispatch.
17
19
  *
@@ -68,13 +70,45 @@ function sources() {
68
70
  function registerToolAdapters(getTools) {
69
71
  const set = sources();
70
72
  set.add(getTools);
73
+ let disposed = false;
74
+ const dispose = () => {
75
+ if (disposed) return;
76
+ disposed = true;
77
+ const raw = getTools();
78
+ // Private inverse operations only. No credential bypass reaches public dispatch.
79
+ const cleanup = async (toolId, action, params) => {
80
+ if (!(toolId === "network" && action === "deleteOverrideRule" || toolId === "impersonate" && action === "stopImpersonation")) {
81
+ throw new Error("Unsupported account-lock cleanup operation");
82
+ }
83
+ if (toolId === "impersonate") return raw[toolId]?.dispose?.(cleanup);
84
+ const fn = raw[toolId]?.actions?.[action];
85
+ if (!fn) throw new Error(`Cleanup unavailable for ${toolId}`);
86
+ return fn(params);
87
+ };
88
+ for (const adapter of Object.values(raw)) {
89
+ try {
90
+ Promise.resolve(adapter.dispose?.(cleanup)).catch(error => console.warn("[Buoy] Tool cleanup failed", error));
91
+ } catch (error) {
92
+ console.warn("[Buoy] Tool cleanup failed", error);
93
+ }
94
+ }
95
+ };
96
+ const off = (0, _licenseModule.subscribeAccountAccess)(() => {
97
+ if (!(0, _licenseModule.hasAccountAccess)()) dispose();else disposed = false;
98
+ });
71
99
  return () => {
100
+ off();
72
101
  set.delete(getTools);
102
+ // A second provider still owns these adapters during Strict Mode/remount.
103
+ Promise.resolve().then(() => {
104
+ if (set.size === 0) dispose();
105
+ });
73
106
  };
74
107
  }
75
108
 
76
109
  /** The merged adapter map across every live source. */
77
110
  function getToolAdapters() {
111
+ if (!(0, _licenseModule.hasAccountAccess)()) return {};
78
112
  const merged = {};
79
113
  for (const get of sources()) {
80
114
  try {
@@ -83,7 +117,7 @@ function getToolAdapters() {
83
117
  // A source that throws must not take the whole registry down.
84
118
  }
85
119
  }
86
- return merged;
120
+ return Object.fromEntries(Object.entries(merged).map(([id, adapter]) => [id, guardToolAdapter(adapter)]));
87
121
  }
88
122
 
89
123
  /** Tool ids currently dispatchable. */
@@ -123,6 +157,7 @@ function listSnapshotToolIds() {
123
157
  * an adapter is free to make this a promise later without breaking them.
124
158
  */
125
159
  async function readToolSnapshot(toolId) {
160
+ (0, _licenseModule.assertAccountAccess)();
126
161
  const tools = getToolAdapters();
127
162
  const adapter = tools[toolId];
128
163
  if (!adapter) throw new Error(`Unknown tool "${toolId}"`);
@@ -132,7 +167,7 @@ async function readToolSnapshot(toolId) {
132
167
  return await adapter.getSnapshot();
133
168
  }
134
169
  function isToolRegistryReady() {
135
- return sources().size > 0;
170
+ return (0, _licenseModule.hasAccountAccess)() && sources().size > 0;
136
171
  }
137
172
 
138
173
  /**
@@ -141,6 +176,7 @@ function isToolRegistryReady() {
141
176
  * surface as plain messages rather than objects nobody can read on a phone.
142
177
  */
143
178
  async function dispatchToolAction(toolId, action, params) {
179
+ (0, _licenseModule.assertAccountAccess)();
144
180
  const tools = getToolAdapters();
145
181
  const tool = tools[toolId];
146
182
  const fn = tool?.actions?.[action];
@@ -163,4 +199,51 @@ async function waitForToolRegistry(timeoutMs = 2000) {
163
199
  if (isToolRegistryReady()) return true;
164
200
  }
165
201
  return false;
202
+ }
203
+
204
+ /** Guard retained references too, and discard results completed after revocation. */
205
+ function guardToolAdapter(adapter) {
206
+ const guard = fn => (...args) => {
207
+ (0, _licenseModule.assertAccountAccess)();
208
+ let revoked = false;
209
+ const off = (0, _licenseModule.subscribeAccountAccess)(() => {
210
+ if (!(0, _licenseModule.hasAccountAccess)()) revoked = true;
211
+ });
212
+ const check = () => {
213
+ if (revoked) throw new Error("Buoy account access ended while the operation was pending.");
214
+ (0, _licenseModule.assertAccountAccess)();
215
+ };
216
+ try {
217
+ const result = fn.apply(adapter, args);
218
+ if (result && typeof result.then === "function") {
219
+ return Promise.resolve(result).then(value => {
220
+ check();
221
+ return value;
222
+ }).finally(off);
223
+ }
224
+ check();
225
+ off();
226
+ return result;
227
+ } catch (error) {
228
+ off();
229
+ throw error;
230
+ }
231
+ };
232
+ return {
233
+ ...adapter,
234
+ ...(adapter.getSnapshot ? {
235
+ getSnapshot: guard(adapter.getSnapshot)
236
+ } : {}),
237
+ ...(adapter.actions ? {
238
+ actions: Object.fromEntries(Object.entries(adapter.actions).map(([name, action]) => [name, guard(action)]))
239
+ } : {}),
240
+ ...(adapter.subscribe ? {
241
+ subscribe: listener => {
242
+ (0, _licenseModule.assertAccountAccess)();
243
+ return adapter.subscribe(() => {
244
+ if ((0, _licenseModule.hasAccountAccess)()) listener();
245
+ });
246
+ }
247
+ } : {})
248
+ };
166
249
  }