@vibesdotdev/applets 0.0.0-stage → 1.0.0-rc.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 (421) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +43 -2
  3. package/dist/applet-gate.d.ts +47 -0
  4. package/dist/applet-gate.d.ts.map +1 -0
  5. package/dist/applet-gate.js +167 -0
  6. package/dist/applet-gate.js.map +1 -0
  7. package/dist/applet-root-surface.d.ts +135 -0
  8. package/dist/applet-root-surface.d.ts.map +1 -0
  9. package/dist/applet-root-surface.js +222 -0
  10. package/dist/applet-root-surface.js.map +1 -0
  11. package/dist/applet-value-bound.d.ts +24 -0
  12. package/dist/applet-value-bound.d.ts.map +1 -0
  13. package/dist/applet-value-bound.js +46 -0
  14. package/dist/applet-value-bound.js.map +1 -0
  15. package/dist/applets.cloud.plugin.d.ts +4 -0
  16. package/dist/applets.cloud.plugin.d.ts.map +1 -0
  17. package/dist/applets.cloud.plugin.js +11 -0
  18. package/dist/applets.cloud.plugin.js.map +1 -0
  19. package/dist/applets.consumer.plugin.d.ts +4 -0
  20. package/dist/applets.consumer.plugin.d.ts.map +1 -0
  21. package/dist/applets.consumer.plugin.js +11 -0
  22. package/dist/applets.consumer.plugin.js.map +1 -0
  23. package/dist/applets.plugin.d.ts +3 -0
  24. package/dist/applets.plugin.d.ts.map +1 -0
  25. package/dist/applets.plugin.js +30 -0
  26. package/dist/applets.plugin.js.map +1 -0
  27. package/dist/authorization.d.ts +87 -0
  28. package/dist/authorization.d.ts.map +1 -0
  29. package/dist/authorization.js +189 -0
  30. package/dist/authorization.js.map +1 -0
  31. package/dist/browser-runtime.d.ts +34 -0
  32. package/dist/browser-runtime.d.ts.map +1 -0
  33. package/dist/browser-runtime.js +5 -0
  34. package/dist/browser-runtime.js.map +1 -0
  35. package/dist/build-definition.d.ts +34 -0
  36. package/dist/build-definition.d.ts.map +1 -0
  37. package/dist/build-definition.js +44 -0
  38. package/dist/build-definition.js.map +1 -0
  39. package/dist/capabilities/capability.kind.d.ts +44 -0
  40. package/dist/capabilities/capability.kind.d.ts.map +1 -0
  41. package/dist/capabilities/capability.kind.js +17 -0
  42. package/dist/capabilities/capability.kind.js.map +1 -0
  43. package/dist/capabilities/runtime-dispatch.d.ts +9 -0
  44. package/dist/capabilities/runtime-dispatch.d.ts.map +1 -0
  45. package/dist/capabilities/runtime-dispatch.js +62 -0
  46. package/dist/capabilities/runtime-dispatch.js.map +1 -0
  47. package/dist/cli/applet-group.descriptor.d.ts +11 -0
  48. package/dist/cli/applet-group.descriptor.d.ts.map +1 -0
  49. package/dist/cli/applet-group.descriptor.js +19 -0
  50. package/dist/cli/applet-group.descriptor.js.map +1 -0
  51. package/dist/cli/applet-local-store.storage.descriptor.d.ts +66 -0
  52. package/dist/cli/applet-local-store.storage.descriptor.d.ts.map +1 -0
  53. package/dist/cli/applet-local-store.storage.descriptor.js +39 -0
  54. package/dist/cli/applet-local-store.storage.descriptor.js.map +1 -0
  55. package/dist/cli/applet-serve.process.descriptor.d.ts +37 -0
  56. package/dist/cli/applet-serve.process.descriptor.d.ts.map +1 -0
  57. package/dist/cli/applet-serve.process.descriptor.js +41 -0
  58. package/dist/cli/applet-serve.process.descriptor.js.map +1 -0
  59. package/dist/cli/commands/build.command.descriptor.d.ts +40 -0
  60. package/dist/cli/commands/build.command.descriptor.d.ts.map +1 -0
  61. package/dist/cli/commands/build.command.descriptor.js +52 -0
  62. package/dist/cli/commands/build.command.descriptor.js.map +1 -0
  63. package/dist/cli/commands/build.command.impl.d.ts +8 -0
  64. package/dist/cli/commands/build.command.impl.d.ts.map +1 -0
  65. package/dist/cli/commands/build.command.impl.js +116 -0
  66. package/dist/cli/commands/build.command.impl.js.map +1 -0
  67. package/dist/cli/commands/init.command.descriptor.d.ts +29 -0
  68. package/dist/cli/commands/init.command.descriptor.d.ts.map +1 -0
  69. package/dist/cli/commands/init.command.descriptor.js +23 -0
  70. package/dist/cli/commands/init.command.descriptor.js.map +1 -0
  71. package/dist/cli/commands/init.command.impl.d.ts +7 -0
  72. package/dist/cli/commands/init.command.impl.d.ts.map +1 -0
  73. package/dist/cli/commands/init.command.impl.js +64 -0
  74. package/dist/cli/commands/init.command.impl.js.map +1 -0
  75. package/dist/cli/commands/list.command.descriptor.d.ts +26 -0
  76. package/dist/cli/commands/list.command.descriptor.d.ts.map +1 -0
  77. package/dist/cli/commands/list.command.descriptor.js +22 -0
  78. package/dist/cli/commands/list.command.descriptor.js.map +1 -0
  79. package/dist/cli/commands/list.command.impl.d.ts +13 -0
  80. package/dist/cli/commands/list.command.impl.d.ts.map +1 -0
  81. package/dist/cli/commands/list.command.impl.js +47 -0
  82. package/dist/cli/commands/list.command.impl.js.map +1 -0
  83. package/dist/cli/commands/serve-stylesheet.d.ts +11 -0
  84. package/dist/cli/commands/serve-stylesheet.d.ts.map +1 -0
  85. package/dist/cli/commands/serve-stylesheet.js +50 -0
  86. package/dist/cli/commands/serve-stylesheet.js.map +1 -0
  87. package/dist/cli/commands/serve-surface.d.ts +36 -0
  88. package/dist/cli/commands/serve-surface.d.ts.map +1 -0
  89. package/dist/cli/commands/serve-surface.js +410 -0
  90. package/dist/cli/commands/serve-surface.js.map +1 -0
  91. package/dist/cli/commands/serve.command.descriptor.d.ts +42 -0
  92. package/dist/cli/commands/serve.command.descriptor.d.ts.map +1 -0
  93. package/dist/cli/commands/serve.command.descriptor.js +46 -0
  94. package/dist/cli/commands/serve.command.descriptor.js.map +1 -0
  95. package/dist/cli/commands/serve.command.impl.d.ts +110 -0
  96. package/dist/cli/commands/serve.command.impl.d.ts.map +1 -0
  97. package/dist/cli/commands/serve.command.impl.js +1105 -0
  98. package/dist/cli/commands/serve.command.impl.js.map +1 -0
  99. package/dist/cli/commands/serve.schemas.d.ts +127 -0
  100. package/dist/cli/commands/serve.schemas.d.ts.map +1 -0
  101. package/dist/cli/commands/serve.schemas.js +85 -0
  102. package/dist/cli/commands/serve.schemas.js.map +1 -0
  103. package/dist/cli/commands/served-applet-browser.d.ts +12 -0
  104. package/dist/cli/commands/served-applet-browser.d.ts.map +1 -0
  105. package/dist/cli/commands/served-applet-browser.js +48 -0
  106. package/dist/cli/commands/served-applet-browser.js.map +1 -0
  107. package/dist/cli/commands/served-applet-connection.d.ts +15 -0
  108. package/dist/cli/commands/served-applet-connection.d.ts.map +1 -0
  109. package/dist/cli/commands/served-applet-connection.js +25 -0
  110. package/dist/cli/commands/served-applet-connection.js.map +1 -0
  111. package/dist/cli/commands/served-applet-rpc.d.ts +16 -0
  112. package/dist/cli/commands/served-applet-rpc.d.ts.map +1 -0
  113. package/dist/cli/commands/served-applet-rpc.js +108 -0
  114. package/dist/cli/commands/served-applet-rpc.js.map +1 -0
  115. package/dist/cli/commands/served-applet-surface.d.ts +14 -0
  116. package/dist/cli/commands/served-applet-surface.d.ts.map +1 -0
  117. package/dist/cli/commands/served-applet-surface.js +99 -0
  118. package/dist/cli/commands/served-applet-surface.js.map +1 -0
  119. package/dist/cli/commands/templates.command.descriptor.d.ts +22 -0
  120. package/dist/cli/commands/templates.command.descriptor.d.ts.map +1 -0
  121. package/dist/cli/commands/templates.command.descriptor.js +21 -0
  122. package/dist/cli/commands/templates.command.descriptor.js.map +1 -0
  123. package/dist/cli/commands/templates.command.impl.d.ts +35 -0
  124. package/dist/cli/commands/templates.command.impl.d.ts.map +1 -0
  125. package/dist/cli/commands/templates.command.impl.js +59 -0
  126. package/dist/cli/commands/templates.command.impl.js.map +1 -0
  127. package/dist/cli/index.d.ts +7 -0
  128. package/dist/cli/index.d.ts.map +1 -0
  129. package/dist/cli/index.js +7 -0
  130. package/dist/cli/index.js.map +1 -0
  131. package/dist/cli/local-serve.authz-policy.descriptor.d.ts +22 -0
  132. package/dist/cli/local-serve.authz-policy.descriptor.d.ts.map +1 -0
  133. package/dist/cli/local-serve.authz-policy.descriptor.js +13 -0
  134. package/dist/cli/local-serve.authz-policy.descriptor.js.map +1 -0
  135. package/dist/cli/plugin.d.ts +19 -0
  136. package/dist/cli/plugin.d.ts.map +1 -0
  137. package/dist/cli/plugin.js +57 -0
  138. package/dist/cli/plugin.js.map +1 -0
  139. package/dist/cli/project-files.d.ts +48 -0
  140. package/dist/cli/project-files.d.ts.map +1 -0
  141. package/dist/cli/project-files.js +130 -0
  142. package/dist/cli/project-files.js.map +1 -0
  143. package/dist/client/contract.d.ts +113 -0
  144. package/dist/client/contract.d.ts.map +1 -0
  145. package/dist/client/contract.js +17 -0
  146. package/dist/client/contract.js.map +1 -0
  147. package/dist/client/index.d.ts +3 -0
  148. package/dist/client/index.d.ts.map +1 -0
  149. package/dist/client/index.js +3 -0
  150. package/dist/client/index.js.map +1 -0
  151. package/dist/client/repository.context.d.ts +113 -0
  152. package/dist/client/repository.context.d.ts.map +1 -0
  153. package/dist/client/repository.context.js +8 -0
  154. package/dist/client/repository.context.js.map +1 -0
  155. package/dist/client/runtime-client.d.ts +22 -0
  156. package/dist/client/runtime-client.d.ts.map +1 -0
  157. package/dist/client/runtime-client.js +200 -0
  158. package/dist/client/runtime-client.js.map +1 -0
  159. package/dist/companion-path.d.ts +25 -0
  160. package/dist/companion-path.d.ts.map +1 -0
  161. package/dist/companion-path.js +90 -0
  162. package/dist/companion-path.js.map +1 -0
  163. package/dist/component-ref.d.ts +12 -0
  164. package/dist/component-ref.d.ts.map +1 -0
  165. package/dist/component-ref.js +45 -0
  166. package/dist/component-ref.js.map +1 -0
  167. package/dist/composition-plan.d.ts +92 -0
  168. package/dist/composition-plan.d.ts.map +1 -0
  169. package/dist/composition-plan.js +44 -0
  170. package/dist/composition-plan.js.map +1 -0
  171. package/dist/composition.d.ts +97 -0
  172. package/dist/composition.d.ts.map +1 -0
  173. package/dist/composition.js +99 -0
  174. package/dist/composition.js.map +1 -0
  175. package/dist/config/applets.config.descriptor.d.ts +55 -0
  176. package/dist/config/applets.config.descriptor.d.ts.map +1 -0
  177. package/dist/config/applets.config.descriptor.js +37 -0
  178. package/dist/config/applets.config.descriptor.js.map +1 -0
  179. package/dist/config/load.d.ts +4 -0
  180. package/dist/config/load.d.ts.map +1 -0
  181. package/dist/config/load.js +12 -0
  182. package/dist/config/load.js.map +1 -0
  183. package/dist/content-path.d.ts +62 -0
  184. package/dist/content-path.d.ts.map +1 -0
  185. package/dist/content-path.js +121 -0
  186. package/dist/content-path.js.map +1 -0
  187. package/dist/contribution-registry.d.ts +270 -0
  188. package/dist/contribution-registry.d.ts.map +1 -0
  189. package/dist/contribution-registry.js +488 -0
  190. package/dist/contribution-registry.js.map +1 -0
  191. package/dist/docs/applets.docs.descriptor.d.ts +4 -0
  192. package/dist/docs/applets.docs.descriptor.d.ts.map +1 -0
  193. package/dist/docs/applets.docs.descriptor.js +74 -0
  194. package/dist/docs/applets.docs.descriptor.js.map +1 -0
  195. package/dist/host/local-host.contract.d.ts +7 -0
  196. package/dist/host/local-host.contract.d.ts.map +1 -0
  197. package/dist/host/local-host.contract.js +2 -0
  198. package/dist/host/local-host.contract.js.map +1 -0
  199. package/dist/host/local-host.impl.d.ts +9 -0
  200. package/dist/host/local-host.impl.d.ts.map +1 -0
  201. package/dist/host/local-host.impl.js +41 -0
  202. package/dist/host/local-host.impl.js.map +1 -0
  203. package/dist/host/local-host.plugin.d.ts +3 -0
  204. package/dist/host/local-host.plugin.d.ts.map +1 -0
  205. package/dist/host/local-host.plugin.js +16 -0
  206. package/dist/host/local-host.plugin.js.map +1 -0
  207. package/dist/index.d.ts +28 -0
  208. package/dist/index.d.ts.map +1 -0
  209. package/dist/index.js +27 -0
  210. package/dist/index.js.map +1 -0
  211. package/dist/local-project.d.ts +106 -0
  212. package/dist/local-project.d.ts.map +1 -0
  213. package/dist/local-project.js +277 -0
  214. package/dist/local-project.js.map +1 -0
  215. package/dist/manifest-hash.d.ts +12 -0
  216. package/dist/manifest-hash.d.ts.map +1 -0
  217. package/dist/manifest-hash.js +76 -0
  218. package/dist/manifest-hash.js.map +1 -0
  219. package/dist/presentation.d.ts +43 -0
  220. package/dist/presentation.d.ts.map +1 -0
  221. package/dist/presentation.js +36 -0
  222. package/dist/presentation.js.map +1 -0
  223. package/dist/retention.d.ts +34 -0
  224. package/dist/retention.d.ts.map +1 -0
  225. package/dist/retention.js +51 -0
  226. package/dist/retention.js.map +1 -0
  227. package/dist/schemas/applet-messages.d.ts +97 -0
  228. package/dist/schemas/applet-messages.d.ts.map +1 -0
  229. package/dist/schemas/applet-messages.js +51 -0
  230. package/dist/schemas/applet-messages.js.map +1 -0
  231. package/dist/schemas/capabilities.d.ts +37 -0
  232. package/dist/schemas/capabilities.d.ts.map +1 -0
  233. package/dist/schemas/capabilities.js +28 -0
  234. package/dist/schemas/capabilities.js.map +1 -0
  235. package/dist/schemas/component-release-ref.d.ts +13 -0
  236. package/dist/schemas/component-release-ref.d.ts.map +1 -0
  237. package/dist/schemas/component-release-ref.js +21 -0
  238. package/dist/schemas/component-release-ref.js.map +1 -0
  239. package/dist/schemas/contributes.d.ts +306 -0
  240. package/dist/schemas/contributes.d.ts.map +1 -0
  241. package/dist/schemas/contributes.js +184 -0
  242. package/dist/schemas/contributes.js.map +1 -0
  243. package/dist/schemas/definition.d.ts +301 -0
  244. package/dist/schemas/definition.d.ts.map +1 -0
  245. package/dist/schemas/definition.js +457 -0
  246. package/dist/schemas/definition.js.map +1 -0
  247. package/dist/schemas/dispatch.d.ts +52 -0
  248. package/dist/schemas/dispatch.d.ts.map +1 -0
  249. package/dist/schemas/dispatch.js +32 -0
  250. package/dist/schemas/dispatch.js.map +1 -0
  251. package/dist/schemas/grants.d.ts +56 -0
  252. package/dist/schemas/grants.d.ts.map +1 -0
  253. package/dist/schemas/grants.js +64 -0
  254. package/dist/schemas/grants.js.map +1 -0
  255. package/dist/schemas/index.d.ts +16 -0
  256. package/dist/schemas/index.d.ts.map +1 -0
  257. package/dist/schemas/index.js +16 -0
  258. package/dist/schemas/index.js.map +1 -0
  259. package/dist/schemas/instance.d.ts +230 -0
  260. package/dist/schemas/instance.d.ts.map +1 -0
  261. package/dist/schemas/instance.js +44 -0
  262. package/dist/schemas/instance.js.map +1 -0
  263. package/dist/schemas/lineage.d.ts +60 -0
  264. package/dist/schemas/lineage.d.ts.map +1 -0
  265. package/dist/schemas/lineage.js +52 -0
  266. package/dist/schemas/lineage.js.map +1 -0
  267. package/dist/schemas/observation.d.ts +70 -0
  268. package/dist/schemas/observation.d.ts.map +1 -0
  269. package/dist/schemas/observation.js +49 -0
  270. package/dist/schemas/observation.js.map +1 -0
  271. package/dist/schemas/patterns.d.ts +24 -0
  272. package/dist/schemas/patterns.d.ts.map +1 -0
  273. package/dist/schemas/patterns.js +24 -0
  274. package/dist/schemas/patterns.js.map +1 -0
  275. package/dist/schemas/publishing.d.ts +27 -0
  276. package/dist/schemas/publishing.d.ts.map +1 -0
  277. package/dist/schemas/publishing.js +20 -0
  278. package/dist/schemas/publishing.js.map +1 -0
  279. package/dist/schemas/run.d.ts +35 -0
  280. package/dist/schemas/run.d.ts.map +1 -0
  281. package/dist/schemas/run.js +26 -0
  282. package/dist/schemas/run.js.map +1 -0
  283. package/dist/schemas/share-link.d.ts +61 -0
  284. package/dist/schemas/share-link.d.ts.map +1 -0
  285. package/dist/schemas/share-link.js +68 -0
  286. package/dist/schemas/share-link.js.map +1 -0
  287. package/dist/schemas/state-events.d.ts +66 -0
  288. package/dist/schemas/state-events.d.ts.map +1 -0
  289. package/dist/schemas/state-events.js +66 -0
  290. package/dist/schemas/state-events.js.map +1 -0
  291. package/dist/schemas/subscription.d.ts +47 -0
  292. package/dist/schemas/subscription.d.ts.map +1 -0
  293. package/dist/schemas/subscription.js +46 -0
  294. package/dist/schemas/subscription.js.map +1 -0
  295. package/dist/schemas/template-revision.d.ts +53 -0
  296. package/dist/schemas/template-revision.d.ts.map +1 -0
  297. package/dist/schemas/template-revision.js +30 -0
  298. package/dist/schemas/template-revision.js.map +1 -0
  299. package/dist/selection.d.ts +22 -0
  300. package/dist/selection.d.ts.map +1 -0
  301. package/dist/selection.js +21 -0
  302. package/dist/selection.js.map +1 -0
  303. package/dist/storage/index.d.ts +27 -0
  304. package/dist/storage/index.d.ts.map +1 -0
  305. package/dist/storage/index.js +27 -0
  306. package/dist/storage/index.js.map +1 -0
  307. package/dist/storage/records.d.ts +28 -0
  308. package/dist/storage/records.d.ts.map +1 -0
  309. package/dist/storage/records.js +272 -0
  310. package/dist/storage/records.js.map +1 -0
  311. package/dist/svelte/applets-svelte.plugin.d.ts +38 -0
  312. package/dist/svelte/applets-svelte.plugin.d.ts.map +1 -0
  313. package/dist/svelte/applets-svelte.plugin.js +25 -0
  314. package/dist/svelte/components/AppletCanvas.svelte +488 -0
  315. package/dist/svelte/components/AppletCanvas.svelte.d.ts +53 -0
  316. package/dist/svelte/components/AppletCanvas.svelte.d.ts.map +1 -0
  317. package/dist/svelte/components/AppletCatalog.svelte +42 -0
  318. package/dist/svelte/components/AppletCatalog.svelte.d.ts +8 -0
  319. package/dist/svelte/components/AppletCatalog.svelte.d.ts.map +1 -0
  320. package/dist/svelte/components/AppletComposition.svelte +128 -0
  321. package/dist/svelte/components/AppletComposition.svelte.d.ts +30 -0
  322. package/dist/svelte/components/AppletComposition.svelte.d.ts.map +1 -0
  323. package/dist/svelte/components/AppletConsent.svelte +143 -0
  324. package/dist/svelte/components/AppletConsent.svelte.d.ts +12 -0
  325. package/dist/svelte/components/AppletConsent.svelte.d.ts.map +1 -0
  326. package/dist/svelte/components/LocalAppletView.svelte +102 -0
  327. package/dist/svelte/components/LocalAppletView.svelte.d.ts +13 -0
  328. package/dist/svelte/components/LocalAppletView.svelte.d.ts.map +1 -0
  329. package/dist/svelte/components/RunnableTracker.svelte +51 -0
  330. package/dist/svelte/components/RunnableTracker.svelte.d.ts +18 -0
  331. package/dist/svelte/components/RunnableTracker.svelte.d.ts.map +1 -0
  332. package/dist/svelte/index.d.ts +11 -0
  333. package/dist/svelte/index.d.ts.map +1 -0
  334. package/dist/svelte/index.js +10 -0
  335. package/dist/svelte/lib/canvas-lifecycle.d.ts +68 -0
  336. package/dist/svelte/lib/canvas-lifecycle.d.ts.map +1 -0
  337. package/dist/svelte/lib/canvas-lifecycle.js +99 -0
  338. package/dist/svelte/lib/capability-review.d.ts +64 -0
  339. package/dist/svelte/lib/capability-review.d.ts.map +1 -0
  340. package/dist/svelte/lib/capability-review.js +77 -0
  341. package/dist/svelte/lib/message-protocol.d.ts +184 -0
  342. package/dist/svelte/lib/message-protocol.d.ts.map +1 -0
  343. package/dist/svelte/lib/message-protocol.js +251 -0
  344. package/dist/svelte/runnable-source.d.ts +5 -0
  345. package/dist/svelte/runnable-source.d.ts.map +1 -0
  346. package/dist/svelte/runnable-source.js +92 -0
  347. package/dist/svelte/serve-index.svelte +39 -0
  348. package/dist/svelte/serve-index.svelte.d.ts +10 -0
  349. package/dist/svelte/serve-index.svelte.d.ts.map +1 -0
  350. package/dist/svelte/state.svelte.d.ts +26 -0
  351. package/dist/svelte/state.svelte.d.ts.map +1 -0
  352. package/dist/svelte/state.svelte.js +74 -0
  353. package/dist/svelte/styles.css +4 -0
  354. package/dist/svelte/tool-widgets/AppletToolCard.svelte +148 -0
  355. package/dist/svelte/tool-widgets/AppletToolCard.svelte.d.ts +5 -0
  356. package/dist/svelte/tool-widgets/AppletToolCard.svelte.d.ts.map +1 -0
  357. package/dist/svelte/tool-widgets/applet-tool-card.d.ts +41 -0
  358. package/dist/svelte/tool-widgets/applet-tool-card.d.ts.map +1 -0
  359. package/dist/svelte/tool-widgets/applet-tool-card.js +167 -0
  360. package/dist/svelte/tool-widgets/index.d.ts +3 -0
  361. package/dist/svelte/tool-widgets/index.d.ts.map +1 -0
  362. package/dist/svelte/tool-widgets/index.js +2 -0
  363. package/dist/templates/index.d.ts +2 -0
  364. package/dist/templates/index.d.ts.map +1 -0
  365. package/dist/templates/index.js +2 -0
  366. package/dist/templates/index.js.map +1 -0
  367. package/dist/templates/template.kind.d.ts +39 -0
  368. package/dist/templates/template.kind.d.ts.map +1 -0
  369. package/dist/templates/template.kind.js +29 -0
  370. package/dist/templates/template.kind.js.map +1 -0
  371. package/dist/tools/applet.descriptor.d.ts +196 -0
  372. package/dist/tools/applet.descriptor.d.ts.map +1 -0
  373. package/dist/tools/applet.descriptor.js +81 -0
  374. package/dist/tools/applet.descriptor.js.map +1 -0
  375. package/dist/tools/applet.impl.d.ts +32 -0
  376. package/dist/tools/applet.impl.d.ts.map +1 -0
  377. package/dist/tools/applet.impl.js +485 -0
  378. package/dist/tools/applet.impl.js.map +1 -0
  379. package/dist/tools/applet.schemas.d.ts +198 -0
  380. package/dist/tools/applet.schemas.d.ts.map +1 -0
  381. package/dist/tools/applet.schemas.js +136 -0
  382. package/dist/tools/applet.schemas.js.map +1 -0
  383. package/dist/tools/index.d.ts +3 -0
  384. package/dist/tools/index.d.ts.map +1 -0
  385. package/dist/tools/index.js +3 -0
  386. package/dist/tools/index.js.map +1 -0
  387. package/dist/upgrade.d.ts +45 -0
  388. package/dist/upgrade.d.ts.map +1 -0
  389. package/dist/upgrade.js +179 -0
  390. package/dist/upgrade.js.map +1 -0
  391. package/dist/vite.d.ts +26 -0
  392. package/dist/vite.d.ts.map +1 -0
  393. package/dist/vite.js +28 -0
  394. package/dist/vite.js.map +1 -0
  395. package/package.json +264 -4
  396. package/templates/applet-tour/Applet.svelte +95 -0
  397. package/templates/applet-tour/applet.descriptor.ts +15 -0
  398. package/templates/assembly-field/Applet.svelte +242 -0
  399. package/templates/assembly-field/applet.descriptor.ts +7 -0
  400. package/templates/assembly-field/applet.storage.json +47 -0
  401. package/templates/assembly-field/schemas/settings.ts +14 -0
  402. package/templates/assembly-field/settings.ts +32 -0
  403. package/templates/benchmark-comparison/Applet.svelte +17 -0
  404. package/templates/benchmark-comparison/applet.descriptor.ts +7 -0
  405. package/templates/file-diff-viewer/Applet.svelte +91 -0
  406. package/templates/file-diff-viewer/applet.descriptor.ts +14 -0
  407. package/templates/file-diff-viewer/diff.ts +63 -0
  408. package/templates/file-viewer/Applet.svelte +80 -0
  409. package/templates/file-viewer/applet.descriptor.ts +14 -0
  410. package/templates/fleet-runs/Applet.svelte +14 -0
  411. package/templates/fleet-runs/applet.descriptor.ts +7 -0
  412. package/templates/graph-runbook-tracker/Applet.svelte +13 -0
  413. package/templates/graph-runbook-tracker/applet.descriptor.ts +7 -0
  414. package/templates/runbook-tracker/Applet.svelte +12 -0
  415. package/templates/runbook-tracker/applet.descriptor.ts +7 -0
  416. package/templates/runnable-tracker/Applet.svelte +16 -0
  417. package/templates/runnable-tracker/applet.descriptor.ts +10 -0
  418. package/templates/storage-viewer/Applet.svelte +90 -0
  419. package/templates/storage-viewer/applet.descriptor.ts +15 -0
  420. package/templates/workspace-graph-runbook-tracker/Applet.svelte +13 -0
  421. package/templates/workspace-graph-runbook-tracker/applet.descriptor.ts +7 -0
@@ -0,0 +1,222 @@
1
+ /**
2
+ * The one object an applet connection can reach.
3
+ *
4
+ * The host puts exactly this in its reference table for a connection, and
5
+ * `dispatchRequest` derefs `targetRef` through that table — so a frame cannot
6
+ * fabricate a ref and reach anything else. The surface here IS the attack
7
+ * surface, which is why it is small and why every method is named in the gate.
8
+ *
9
+ * Authorization is NOT re-done here; `createAppletInvokeGate` runs first on the
10
+ * `authz` phase. What this does is BIND: it reads scope and authority from the
11
+ * manifest and hands the backend a binding the caller could not have chosen.
12
+ * The gate proves a store was declared; this decides what that declaration
13
+ * MEANS. A caller that could name its own scope could read another viewer's
14
+ * rows.
15
+ *
16
+ * A2 runtime parity: the surface also carries a PRINCIPAL-BOUND runtime handle
17
+ * (`runtimeQuery`, `runtimeCall`, `runtimeToolCall`). The host binds the
18
+ * principal (local: the user; cloud: the viewer); the applet can never name it,
19
+ * and every call runs through the host's invoke pipeline so the same authz
20
+ * chain gates it as any other remote peer.
21
+ */
22
+ import * as z from 'zod/v4';
23
+ import { CapabilityError } from '@vibesdotdev/kernel';
24
+ import { boundedJsonValueSchema } from '@vibesdotdev/shared/schemas';
25
+ import { appletValueViolations, boundAppletValue, parseAppletRuntimeHostValue } from "./applet-value-bound.js";
26
+ /**
27
+ * Every method an applet connection may call on its root surface. A host that
28
+ * serves the surface over runtime-rpc advertises exactly these as the listen
29
+ * target's `rootMethods`; an unadvertised method is refused before dispatch.
30
+ */
31
+ export const APPLET_ROOT_SURFACE_METHODS = Object.freeze([
32
+ 'storageGet',
33
+ 'storageList',
34
+ 'storagePut',
35
+ 'storageDelete',
36
+ 'assetUrl',
37
+ 'capabilityInvoke',
38
+ 'runtimeQuery',
39
+ 'runtimeCall',
40
+ 'runtimeToolCall'
41
+ ]);
42
+ /** A function value: a callback argument or an unsubscribe answer, carried by the wire as a ref. */
43
+ export const appletRuntimeCallbackSchema = z.custom((value) => value instanceof Function);
44
+ /** A host's raw runtime answer, parsed where it enters the surface: a function, bounded JSON, or nothing. */
45
+ export const appletRuntimeHostValueSchema = z.union([appletRuntimeCallbackSchema, boundedJsonValueSchema]).optional();
46
+ /** Longest key an applet may address. Bounded because it reaches a store. */
47
+ const MAX_KEY_LENGTH = 256;
48
+ /** Largest page an applet may request in one call. */
49
+ const MAX_LIST_LIMIT = 500;
50
+ const storageKeySchema = z.string().min(1).max(MAX_KEY_LENGTH);
51
+ /** Most positional runtime-call arguments one applet call may carry. */
52
+ const MAX_RUNTIME_ARGS = 16;
53
+ /** Most descriptors one runtime query answers. */
54
+ export const MAX_RUNTIME_DESCRIPTORS = 100;
55
+ /** Longest description the descriptor projection carries. */
56
+ export const MAX_RUNTIME_DESCRIPTION = 280;
57
+ /** Runtime names: kind ids, descriptor ids, method names and tool ids. */
58
+ const runtimeNameSchema = z
59
+ .string()
60
+ .min(1)
61
+ .max(256)
62
+ .regex(/^[A-Za-z0-9][A-Za-z0-9._/-]*$/);
63
+ const runtimeDescriptorViewSchema = z.object({
64
+ id: z.string().min(1).max(256),
65
+ name: z.string(),
66
+ description: z.string().max(MAX_RUNTIME_DESCRIPTION).optional(),
67
+ enabled: z.boolean()
68
+ });
69
+ /** What one `runtimeQuery` answers, checked at the surface before it crosses. */
70
+ export const appletRuntimeQueryViewSchema = z.object({
71
+ kind: z.string().min(1).max(256),
72
+ total: z.number().int().nonnegative(),
73
+ truncated: z.boolean(),
74
+ descriptors: z.array(runtimeDescriptorViewSchema).max(MAX_RUNTIME_DESCRIPTORS)
75
+ });
76
+ export function createAppletRootSurface(input) {
77
+ const { instanceId, manifest, backend } = input;
78
+ function bind(descriptorId) {
79
+ const store = manifest.storage.find((candidate) => candidate.id === descriptorId);
80
+ if (!store) {
81
+ // Unreachable when the gate ran, and a refusal rather than a throw of
82
+ // `undefined` if this surface is ever reached another way. Defence in
83
+ // depth on the one object an untrusted peer can call — and the ONLY
84
+ // control on a host that runs no gate, such as `vibes applet serve`.
85
+ throw new CapabilityError(`Store "${descriptorId}" is not declared by this release.`, 'NOT_FOUND', {
86
+ reason: 'applet-store-undeclared',
87
+ details: { store: descriptorId }
88
+ });
89
+ }
90
+ return {
91
+ descriptorId: store.id,
92
+ scope: store.scope,
93
+ authority: store.authority,
94
+ instanceId
95
+ };
96
+ }
97
+ /** NaN and Infinity are not limits. `Math.trunc(NaN)` is NaN, and a NaN limit
98
+ * reaches the store as an empty page — the applet is told it has no data. */
99
+ function clampLimit(value) {
100
+ const requested = Number(value);
101
+ if (!Number.isFinite(requested))
102
+ return MAX_LIST_LIMIT;
103
+ return Math.min(Math.max(Math.trunc(requested), 1), MAX_LIST_LIMIT);
104
+ }
105
+ function checkKey(key) {
106
+ const checked = storageKeySchema.safeParse(key);
107
+ if (checked.success)
108
+ return checked.data;
109
+ throw new CapabilityError(`Storage key must be 1..${MAX_KEY_LENGTH} characters.`, 'INVALID_INPUT', {
110
+ reason: 'applet-store-key-invalid',
111
+ cause: checked.error
112
+ });
113
+ }
114
+ /** A runtime name (kind, descriptor id, method or tool id), or the given typed refusal. */
115
+ function checkRuntimeName(value, reason) {
116
+ const checked = runtimeNameSchema.safeParse(value);
117
+ if (checked.success)
118
+ return checked.data;
119
+ throw new CapabilityError('Runtime names are 1..256 characters of [A-Za-z0-9._/-].', 'INVALID_INPUT', {
120
+ reason,
121
+ cause: checked.error
122
+ });
123
+ }
124
+ /** Positional runtime-call arguments: bounded in count; each bounded JSON or a callback (passed through). */
125
+ function checkRuntimeArgs(args) {
126
+ if (args === undefined)
127
+ return [];
128
+ const list = z.array(z.unknown()).safeParse(args);
129
+ if (!list.success) {
130
+ throw new CapabilityError('Runtime arguments must be an array.', 'INVALID_INPUT', {
131
+ reason: 'applet-runtime-call-invalid',
132
+ cause: list.error
133
+ });
134
+ }
135
+ if (list.data.length > MAX_RUNTIME_ARGS) {
136
+ throw new CapabilityError(`Runtime arguments must be at most ${MAX_RUNTIME_ARGS} values.`, 'INVALID_INPUT', {
137
+ reason: 'applet-runtime-call-invalid'
138
+ });
139
+ }
140
+ return list.data.map((arg) => {
141
+ const callback = appletRuntimeCallbackSchema.safeParse(arg);
142
+ return callback.success ? callback.data : boundAppletValue(arg, 'value');
143
+ });
144
+ }
145
+ /** This host binds no runtime handle to the surface; the applet cannot reach a runtime here. */
146
+ function runtimeUnavailable() {
147
+ return new CapabilityError('This host binds no runtime handle to the applet surface.', 'UNAVAILABLE', {
148
+ reason: 'applet-runtime-unavailable',
149
+ retryable: false
150
+ });
151
+ }
152
+ // Every method is `async` so EVERY failure is a rejection.
153
+ //
154
+ // `bind` and `checkKey` throw, and with a non-async arrow they threw
155
+ // SYNCHRONOUSLY — so one method had two failure modes and a caller had to
156
+ // handle both. Over RPC that difference is invisible until it is not, and this
157
+ // is the one object an untrusted peer calls.
158
+ return {
159
+ storageGet: async (descriptorId, key) => backend.storageGet(bind(descriptorId), checkKey(key)),
160
+ storageList: async (descriptorId, query) => {
161
+ // Clamped, not trusted. A caller asking for a million rows is asking
162
+ // the host to do a million rows of work.
163
+ const listQuery = {};
164
+ if (query?.limit !== undefined)
165
+ listQuery.limit = clampLimit(query.limit);
166
+ if (query?.cursor !== undefined)
167
+ listQuery.cursor = String(query.cursor).slice(0, 512);
168
+ return backend.storageList(bind(descriptorId), listQuery);
169
+ },
170
+ storagePut: async (descriptorId, key, value) => backend.storagePut(bind(descriptorId), checkKey(key), boundAppletValue(value, 'value')),
171
+ storageDelete: async (descriptorId, key) => backend.storageDelete(bind(descriptorId), checkKey(key)),
172
+ assetUrl: async (assetId) => {
173
+ const asset = manifest.assets.find((candidate) => candidate.assetId === assetId);
174
+ if (!asset) {
175
+ throw new CapabilityError(`Asset "${assetId}" is not referenced by this release.`, 'NOT_FOUND', {
176
+ reason: 'applet-asset-unreferenced',
177
+ details: { asset: assetId }
178
+ });
179
+ }
180
+ // The pinned revision and digest come from the MANIFEST, so an applet
181
+ // cannot ask for a different version of an asset it legitimately
182
+ // references.
183
+ return backend.assetUrl(asset.assetId, asset.revision, asset.digest);
184
+ },
185
+ // The capability answer is bounded like every other data answer: values in, answers out.
186
+ capabilityInvoke: async (capability, value) => boundAppletValue(await backend.capabilityInvoke(capability, boundAppletValue(value ?? {}, 'value')), 'answer'),
187
+ runtimeQuery: async (kind) => {
188
+ const backendQuery = backend.runtimeQuery;
189
+ if (!backendQuery)
190
+ throw runtimeUnavailable();
191
+ const checked = checkRuntimeName(kind, 'applet-runtime-query-invalid');
192
+ const view = appletRuntimeQueryViewSchema.safeParse(await backendQuery(checked));
193
+ if (!view.success) {
194
+ throw new CapabilityError('The runtime query answered a shape this surface cannot carry.', 'INVALID_INPUT', {
195
+ reason: 'applet-runtime-query-invalid',
196
+ details: { violations: appletValueViolations(view.error) },
197
+ cause: view.error
198
+ });
199
+ }
200
+ return view.data;
201
+ },
202
+ // Variadic: a callback crosses runtime-rpc as a ref only as a TOP-LEVEL argument (one nested in an array is data).
203
+ runtimeCall: async (kind, id, method, ...args) => {
204
+ const backendCall = backend.runtimeCall;
205
+ if (!backendCall)
206
+ throw runtimeUnavailable();
207
+ const checkedKind = checkRuntimeName(kind, 'applet-runtime-call-invalid');
208
+ const checkedId = checkRuntimeName(id, 'applet-runtime-call-invalid');
209
+ const checkedMethod = checkRuntimeName(method, 'applet-runtime-call-invalid');
210
+ const checkedArgs = checkRuntimeArgs(args);
211
+ return parseAppletRuntimeHostValue(await backendCall(checkedKind, checkedId, checkedMethod, checkedArgs));
212
+ },
213
+ runtimeToolCall: async (toolId, input) => {
214
+ const backendToolCall = backend.runtimeToolCall;
215
+ if (!backendToolCall)
216
+ throw runtimeUnavailable();
217
+ const checked = checkRuntimeName(toolId, 'applet-runtime-tool-invalid');
218
+ return boundAppletValue(await backendToolCall(checked, boundAppletValue(input ?? {}, 'value')), 'answer');
219
+ }
220
+ };
221
+ }
222
+ //# sourceMappingURL=applet-root-surface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applet-root-surface.js","sourceRoot":"","sources":["../src/applet-root-surface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAGrE,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAiF/G;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,MAAM,CAAC;IACxD,YAAY;IACZ,aAAa;IACb,YAAY;IACZ,eAAe;IACf,UAAU;IACV,kBAAkB;IAClB,cAAc;IACd,aAAa;IACb,iBAAiB;CACR,CAAgD,CAAC;AAE3D,oGAAoG;AACpG,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAwB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,YAAY,QAAQ,CAAC,CAAC;AACjH,6GAA6G;AAC7G,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,2BAA2B,EAAE,sBAAsB,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAEtH,6EAA6E;AAC7E,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,sDAAsD;AACtD,MAAM,cAAc,GAAG,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B,CAAC,CAAC;YACxE,OAAO,gBAAgB,CAAC,MAAM,eAAe,CAAC,OAAO,EAAE,gBAAgB,CAAC,KAAK,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC3G,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The one rule that bounds a value at the applet boundary, in both directions.
3
+ *
4
+ * Package-internal: not re-exported from `src/index.ts` and not a package
5
+ * export. The root surface, the local serve backend and the capability
6
+ * dispatcher all call it, so a refusal reads the same wherever it is raised.
7
+ *
8
+ * The refusal is value-free. Bound messages name only limits and counts, so
9
+ * they are copied into the message and `details.violations`. Issue PATHS are
10
+ * keys from the value itself, so they never leave this module.
11
+ */
12
+ import * as z from 'zod/v4';
13
+ import type { JsonValue } from '@vibesdotdev/shared/types';
14
+ import { type AppletRuntimeAnswer, type AppletRuntimeHostValue } from './applet-root-surface.ts';
15
+ /** The bound messages of a failed parse, messages only: an issue path is value keys and never crosses. */
16
+ export declare function appletValueViolations(error: z.ZodError): string[];
17
+ /**
18
+ * A value in (`'value'`) or an answer out (`'answer'`), as bounded JSON, or the typed
19
+ * `INVALID_INPUT` `applet-value-unbounded` refusal naming the first violated bound.
20
+ */
21
+ export declare function boundAppletValue(value: unknown, subject: 'value' | 'answer'): JsonValue;
22
+ /** A host's raw runtime answer: a function crosses back as a ref; anything else is a bounded answer or refused. */
23
+ export declare function parseAppletRuntimeHostValue(value: AppletRuntimeHostValue): AppletRuntimeAnswer;
24
+ //# sourceMappingURL=applet-value-bound.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applet-value-bound.d.ts","sourceRoot":"","sources":["../src/applet-value-bound.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAEN,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,MAAM,0BAA0B,CAAC;AAQlC,0GAA0G;AAC1G,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,GAAG,MAAM,EAAE,CAEjE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAWvF;AAED,mHAAmH;AACnH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,sBAAsB,GAAG,mBAAmB,CAG9F"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The one rule that bounds a value at the applet boundary, in both directions.
3
+ *
4
+ * Package-internal: not re-exported from `src/index.ts` and not a package
5
+ * export. The root surface, the local serve backend and the capability
6
+ * dispatcher all call it, so a refusal reads the same wherever it is raised.
7
+ *
8
+ * The refusal is value-free. Bound messages name only limits and counts, so
9
+ * they are copied into the message and `details.violations`. Issue PATHS are
10
+ * keys from the value itself, so they never leave this module.
11
+ */
12
+ import * as z from 'zod/v4';
13
+ import { CapabilityError } from '@vibesdotdev/kernel';
14
+ import { boundedJsonValueSchema } from '@vibesdotdev/shared/schemas';
15
+ import { appletRuntimeCallbackSchema } from "./applet-root-surface.js";
16
+ /** Most bound messages one refusal reports. */
17
+ const MAX_REPORTED_VIOLATIONS = 8;
18
+ /** Bounded JSON at the applet boundary: nothing (a void answer, an omitted value) crosses as `null`. */
19
+ const appletBoundedValueSchema = z.preprocess((value) => value ?? null, boundedJsonValueSchema);
20
+ /** The bound messages of a failed parse, messages only: an issue path is value keys and never crosses. */
21
+ export function appletValueViolations(error) {
22
+ return error.issues.slice(0, MAX_REPORTED_VIOLATIONS).map((issue) => issue.message);
23
+ }
24
+ /**
25
+ * A value in (`'value'`) or an answer out (`'answer'`), as bounded JSON, or the typed
26
+ * `INVALID_INPUT` `applet-value-unbounded` refusal naming the first violated bound.
27
+ */
28
+ export function boundAppletValue(value, subject) {
29
+ const bounded = appletBoundedValueSchema.safeParse(value);
30
+ if (bounded.success)
31
+ return bounded.data;
32
+ const violations = appletValueViolations(bounded.error);
33
+ const more = bounded.error.issues.length > 1 ? ` (+${bounded.error.issues.length - 1} more)` : '';
34
+ const prefix = subject === 'answer' ? 'Runtime answer refused' : 'Value refused';
35
+ throw new CapabilityError(`${prefix}: ${violations[0] ?? 'not bounded JSON'}${more}`, 'INVALID_INPUT', {
36
+ reason: 'applet-value-unbounded',
37
+ details: { violations },
38
+ cause: bounded.error
39
+ });
40
+ }
41
+ /** A host's raw runtime answer: a function crosses back as a ref; anything else is a bounded answer or refused. */
42
+ export function parseAppletRuntimeHostValue(value) {
43
+ const callback = appletRuntimeCallbackSchema.safeParse(value);
44
+ return callback.success ? callback.data : boundAppletValue(value, 'answer');
45
+ }
46
+ //# sourceMappingURL=applet-value-bound.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applet-value-bound.js","sourceRoot":"","sources":["../src/applet-value-bound.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EACN,2BAA2B,EAG3B,MAAM,0BAA0B,CAAC;AAElC,+CAA+C;AAC/C,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAElC,wGAAwG;AACxG,MAAM,wBAAwB,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI,EAAE,sBAAsB,CAAC,CAAC;AAEhG,0GAA0G;AAC1G,MAAM,UAAU,qBAAqB,CAAC,KAAiB;IACtD,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACrF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc,EAAE,OAA2B;IAC3E,MAAM,OAAO,GAAG,wBAAwB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC1D,IAAI,OAAO,CAAC,OAAO;QAAE,OAAO,OAAO,CAAC,IAAI,CAAC;IACzC,MAAM,UAAU,GAAG,qBAAqB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IAClG,MAAM,MAAM,GAAG,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,eAAe,CAAC;IACjF,MAAM,IAAI,eAAe,CAAC,GAAG,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,kBAAkB,GAAG,IAAI,EAAE,EAAE,eAAe,EAAE;QACtG,MAAM,EAAE,wBAAwB;QAChC,OAAO,EAAE,EAAE,UAAU,EAAE;QACvB,KAAK,EAAE,OAAO,CAAC,KAAK;KACpB,CAAC,CAAC;AACJ,CAAC;AAED,mHAAmH;AACnH,MAAM,UAAU,2BAA2B,CAAC,KAA6B;IACxE,MAAM,QAAQ,GAAG,2BAA2B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9D,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** Executable applet tool; compose alongside the universal Applets descriptors. */
2
+ declare const plugin: import("@vibesdotdev/kernel").RuntimePlugin;
3
+ export default plugin;
4
+ //# sourceMappingURL=applets.cloud.plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applets.cloud.plugin.d.ts","sourceRoot":"","sources":["../src/applets.cloud.plugin.ts"],"names":[],"mappings":"AAEA,mFAAmF;AACnF,QAAA,MAAM,MAAM,6CAMV,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { createRuntimePlugin, loader } from '@vibesdotdev/kernel';
2
+ /** Executable applet tool; compose alongside the universal Applets descriptors. */
3
+ const plugin = createRuntimePlugin({
4
+ id: 'applets.cloud',
5
+ name: 'Applets cloud tool',
6
+ loaders: [
7
+ loader('applet', { kind: 'tools/tool', scope: 'cloud' }, () => import("./tools/applet.impl.js"))
8
+ ]
9
+ });
10
+ export default plugin;
11
+ //# sourceMappingURL=applets.cloud.plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applets.cloud.plugin.js","sourceRoot":"","sources":["../src/applets.cloud.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElE,mFAAmF;AACnF,MAAM,MAAM,GAAG,mBAAmB,CAAC;IAClC,EAAE,EAAE,eAAe;IACnB,IAAI,EAAE,oBAAoB;IAC1B,OAAO,EAAE;QACR,MAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC;KAChG;CACD,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** Executable applet tool; compose alongside the universal Applets descriptors. */
2
+ declare const plugin: import("@vibesdotdev/kernel").RuntimePlugin;
3
+ export default plugin;
4
+ //# sourceMappingURL=applets.consumer.plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applets.consumer.plugin.d.ts","sourceRoot":"","sources":["../src/applets.consumer.plugin.ts"],"names":[],"mappings":"AAEA,mFAAmF;AACnF,QAAA,MAAM,MAAM,6CAMV,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { createRuntimePlugin, loader } from '@vibesdotdev/kernel';
2
+ /** Executable applet tool; compose alongside the universal Applets descriptors. */
3
+ const plugin = createRuntimePlugin({
4
+ id: 'applets.consumer',
5
+ name: 'Applets consumer tool',
6
+ loaders: [
7
+ loader('applet', { kind: 'tools/tool', scope: 'consumer' }, () => import("./tools/applet.impl.js"))
8
+ ]
9
+ });
10
+ export default plugin;
11
+ //# sourceMappingURL=applets.consumer.plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applets.consumer.plugin.js","sourceRoot":"","sources":["../src/applets.consumer.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElE,mFAAmF;AACnF,MAAM,MAAM,GAAG,mBAAmB,CAAC;IAClC,EAAE,EAAE,kBAAkB;IACtB,IAAI,EAAE,uBAAuB;IAC7B,OAAO,EAAE;QACR,MAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC;KACnG;CACD,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const appletsPlugin: import("@vibesdotdev/kernel").RuntimePlugin;
2
+ export default appletsPlugin;
3
+ //# sourceMappingURL=applets.plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applets.plugin.d.ts","sourceRoot":"","sources":["../src/applets.plugin.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,aAAa,6CAuBxB,CAAC;AAEH,eAAe,aAAa,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { appletCapabilityKind } from "./capabilities/capability.kind.js";
2
+ import { createRuntimePlugin, loader } from '@vibesdotdev/kernel';
3
+ import { appletStorageRecordDescriptors } from "./storage/records.js";
4
+ import { appletsClientDescriptor } from "./client/contract.js";
5
+ import appletDescriptor from "./tools/applet.descriptor.js";
6
+ import { appletTemplateKind } from "./templates/template.kind.js";
7
+ import appletsDocsDescriptor from "./docs/applets.docs.descriptor.js";
8
+ import { appletsRepositoryContextDescriptor } from "./client/repository.context.js";
9
+ import appletsConfigDescriptor from "./config/applets.config.descriptor.js";
10
+ export const appletsPlugin = createRuntimePlugin({
11
+ id: 'applets',
12
+ name: 'Applets',
13
+ description: 'Applet instance, execution, state, event, and provenance storage; the applets runtime client; and the agent-facing applet tool.',
14
+ dependencies: ['context', 'runtime-client', 'storage'],
15
+ // Register domain kinds; each host composes its own scoped implementations.
16
+ kinds: [appletTemplateKind, appletCapabilityKind],
17
+ descriptors: [
18
+ ...appletStorageRecordDescriptors,
19
+ appletsRepositoryContextDescriptor,
20
+ appletsClientDescriptor,
21
+ appletDescriptor,
22
+ appletsDocsDescriptor,
23
+ appletsConfigDescriptor
24
+ ],
25
+ loaders: [
26
+ loader(appletsClientDescriptor.id, { kind: 'runtime/client' }, () => import("./client/runtime-client.js"))
27
+ ]
28
+ });
29
+ export default appletsPlugin;
30
+ //# sourceMappingURL=applets.plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applets.plugin.js","sourceRoot":"","sources":["../src/applets.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,gBAAgB,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,qBAAqB,MAAM,mCAAmC,CAAC;AACtE,OAAO,EACN,kCAAkC,EAClC,MAAM,gCAAgC,CAAC;AACxC,OAAO,uBAAuB,MAAM,uCAAuC,CAAC;AAE5E,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC;IAChD,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,SAAS;IACf,WAAW,EACV,iIAAiI;IAClI,YAAY,EAAE,CAAC,SAAS,EAAE,gBAAgB,EAAE,SAAS,CAAC;IACtD,4EAA4E;IAC5E,KAAK,EAAE,CAAC,kBAAkB,EAAE,oBAAoB,CAAC;IACjD,WAAW,EAAE;QACZ,GAAG,8BAA8B;QACjC,kCAAkC;QAClC,uBAAuB;QACvB,gBAAgB;QAChB,qBAAqB;QACrB,uBAAuB;KACvB;IACD,OAAO,EAAE;QACR,MAAM,CACL,uBAAuB,CAAC,EAAE,EAC1B,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAC1B,GAAG,EAAE,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAC1C;KACD;CACD,CAAC,CAAC;AAEH,eAAe,aAAa,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Invoke-time authorization for a contributed implementation.
3
+ *
4
+ * This is the load-bearing capability check, and the only one that is not
5
+ * advisory. Two earlier designs were wrong in ways worth naming, because the
6
+ * shape of this function is a direct response to both:
7
+ *
8
+ * 1. `requires ⊆ manifest.capabilities` is VACUOUS as a security control. Both
9
+ * sides are author-authored in one file, so an author writes the same
10
+ * escalation twice and passes. It is a coherence check, nothing more.
11
+ *
12
+ * 2. Deregistering shim loaders on revoke is NOT a boundary. Registration is a
13
+ * cache; a long-lived runtime keeps its shims until something restarts it.
14
+ * Authority must therefore be re-derived from live state on EVERY dispatch,
15
+ * which is what this function does. Nothing here may be memoized.
16
+ *
17
+ * Consent is a one-time human act. Enforcement is per-call and never cached.
18
+ */
19
+ import type { AppletCapabilityGrant, AppletLaunchLease } from './schemas/grants.ts';
20
+ import type { AppletSubscription } from './schemas/subscription.ts';
21
+ import type { ComponentReleaseRef } from './schemas/component-release-ref.ts';
22
+ export type AppletAuthorizationDenial = 'subscription-revoked' | 'subscription-paused' | 'subscription-needs-consent' | 'grant-mismatched' | 'grant-instance-mismatch' | 'lease-required' | 'grant-revoked' | 'grant-release-mismatch' | 'release-mismatch' | 'lease-revoked' | 'lease-expired' | 'lease-mismatched' | 'lease-run-mismatch' | 'capability-not-granted';
23
+ export type AppletAuthorizationDecision = {
24
+ allowed: true;
25
+ } | {
26
+ allowed: false;
27
+ reason: AppletAuthorizationDenial;
28
+ detail: string;
29
+ };
30
+ export interface AppletAuthorizationInput {
31
+ subscription: AppletSubscription;
32
+ grant: AppletCapabilityGrant;
33
+ /** Present for a run-scoped dispatch; omitted for a subscription-scoped one. */
34
+ lease?: AppletLaunchLease;
35
+ /**
36
+ * Whether a live launch lease is mandatory for this dispatch.
37
+ *
38
+ * An optional lease is a hole if the caller decides: forgetting to pass one
39
+ * silently skips expiry and revocation.
40
+ *
41
+ * DEFAULTS CLOSED. A dispatch requires a live lease unless the caller
42
+ * explicitly proves it is subscription-scoped by passing `false`. Keying this
43
+ * off a surface enum meant any new surface value silently lost lease
44
+ * enforcement with no test failing.
45
+ */
46
+ leaseRequired?: boolean;
47
+ /** The release the dispatch claims to be running. */
48
+ release: ComponentReleaseRef;
49
+ /** Capability tags the contributed implementation declared. */
50
+ requires: readonly string[];
51
+ /**
52
+ * The run this dispatch belongs to, as claimed INDEPENDENTLY of the lease.
53
+ *
54
+ * Only meaningful when the caller knows its run from another source. The shim
55
+ * does not: it reads the lease and would be comparing the lease to itself, so
56
+ * it deliberately passes nothing rather than performing a check that can
57
+ * never deny. A surface that tracks runs separately should pass it.
58
+ */
59
+ runId?: string;
60
+ now: Date;
61
+ }
62
+ /**
63
+ * Decide whether one contributed implementation may run right now.
64
+ *
65
+ * Fails closed on every branch: an unexpected state is a denial, never a
66
+ * fallthrough to allowed.
67
+ */
68
+ export declare function authorizeAppletContribution(input: AppletAuthorizationInput): AppletAuthorizationDecision;
69
+ /**
70
+ * Whether a contribution should be REGISTERED at all for this grant.
71
+ *
72
+ * A capability marked `required: false` may be declined at consent. A tool that
73
+ * needs a declined capability must be absent from `vibes tools list` rather than
74
+ * present and always throwing — a listed tool that never works is worse than one
75
+ * that was never offered.
76
+ */
77
+ export declare function isContributionRegistrable(requires: readonly string[], grantedCapabilities: readonly string[]): boolean;
78
+ /** Consent cannot promise authority for which the trusted host has no implementation. */
79
+ export declare function assertSupportedAppletCapabilities(requested: readonly string[], supported: Iterable<string>): void;
80
+ /** Derive consent from pinned metadata; legacy releases without a definition treat every tag as required. */
81
+ export declare function selectSupportedAppletCapabilities(tags: readonly string[], definition: {
82
+ capabilities: readonly {
83
+ tag: string;
84
+ required?: boolean;
85
+ }[];
86
+ } | null, supported: Iterable<string>): string[];
87
+ //# sourceMappingURL=authorization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../src/authorization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAE9E,MAAM,MAAM,yBAAyB,GAClC,sBAAsB,GACtB,qBAAqB,GACrB,4BAA4B,GAC5B,kBAAkB,GAClB,yBAAyB,GACzB,gBAAgB,GAChB,eAAe,GACf,wBAAwB,GACxB,kBAAkB,GAClB,eAAe,GACf,eAAe,GACf,kBAAkB,GAClB,oBAAoB,GACpB,wBAAwB,CAAC;AAE5B,MAAM,MAAM,2BAA2B,GACtC;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,yBAAyB,CAAC;IA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