happy2 0.0.9 → 0.0.11

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 (235) hide show
  1. package/README.md +19 -0
  2. package/package.json +7 -3
  3. package/packages/happy2-server/PLUGINS.md +330 -0
  4. package/packages/happy2-server/README.md +28 -0
  5. package/packages/happy2-server/dist/index.d.ts +6 -0
  6. package/packages/happy2-server/dist/index.d.ts.map +1 -1
  7. package/packages/happy2-server/dist/index.js +4 -0
  8. package/packages/happy2-server/dist/index.js.map +1 -1
  9. package/packages/happy2-server/dist/modules/agents/daemon.d.ts +10 -13
  10. package/packages/happy2-server/dist/modules/agents/daemon.d.ts.map +1 -1
  11. package/packages/happy2-server/dist/modules/agents/daemon.js +19 -5
  12. package/packages/happy2-server/dist/modules/agents/daemon.js.map +1 -1
  13. package/packages/happy2-server/dist/modules/agents/service.d.ts +9 -1
  14. package/packages/happy2-server/dist/modules/agents/service.d.ts.map +1 -1
  15. package/packages/happy2-server/dist/modules/agents/service.js +59 -2
  16. package/packages/happy2-server/dist/modules/agents/service.js.map +1 -1
  17. package/packages/happy2-server/dist/modules/chat/types.d.ts +1 -1
  18. package/packages/happy2-server/dist/modules/chat/types.d.ts.map +1 -1
  19. package/packages/happy2-server/dist/modules/config/defaults.d.ts.map +1 -1
  20. package/packages/happy2-server/dist/modules/config/defaults.js +3 -0
  21. package/packages/happy2-server/dist/modules/config/defaults.js.map +1 -1
  22. package/packages/happy2-server/dist/modules/config/loader.d.ts.map +1 -1
  23. package/packages/happy2-server/dist/modules/config/loader.js +4 -0
  24. package/packages/happy2-server/dist/modules/config/loader.js.map +1 -1
  25. package/packages/happy2-server/dist/modules/config/paths.d.ts +1 -0
  26. package/packages/happy2-server/dist/modules/config/paths.d.ts.map +1 -1
  27. package/packages/happy2-server/dist/modules/config/paths.js +1 -0
  28. package/packages/happy2-server/dist/modules/config/paths.js.map +1 -1
  29. package/packages/happy2-server/dist/modules/config/paths.test.js +1 -0
  30. package/packages/happy2-server/dist/modules/config/paths.test.js.map +1 -1
  31. package/packages/happy2-server/dist/modules/config/type.d.ts +3 -0
  32. package/packages/happy2-server/dist/modules/config/type.d.ts.map +1 -1
  33. package/packages/happy2-server/dist/modules/integrations/transport.d.ts.map +1 -1
  34. package/packages/happy2-server/dist/modules/integrations/transport.js +8 -1
  35. package/packages/happy2-server/dist/modules/integrations/transport.js.map +1 -1
  36. package/packages/happy2-server/dist/modules/integrations/types.d.ts +2 -0
  37. package/packages/happy2-server/dist/modules/integrations/types.d.ts.map +1 -1
  38. package/packages/happy2-server/dist/modules/integrations/types.js.map +1 -1
  39. package/packages/happy2-server/dist/modules/plugin/catalog.d.ts +13 -0
  40. package/packages/happy2-server/dist/modules/plugin/catalog.d.ts.map +1 -0
  41. package/packages/happy2-server/dist/modules/plugin/catalog.js +359 -0
  42. package/packages/happy2-server/dist/modules/plugin/catalog.js.map +1 -0
  43. package/packages/happy2-server/dist/modules/plugin/catalog.test.d.ts +2 -0
  44. package/packages/happy2-server/dist/modules/plugin/catalog.test.d.ts.map +1 -0
  45. package/packages/happy2-server/dist/modules/plugin/catalog.test.js +139 -0
  46. package/packages/happy2-server/dist/modules/plugin/catalog.test.js.map +1 -0
  47. package/packages/happy2-server/dist/modules/plugin/functions.test.d.ts +2 -0
  48. package/packages/happy2-server/dist/modules/plugin/functions.test.d.ts.map +1 -0
  49. package/packages/happy2-server/dist/modules/plugin/functions.test.js +123 -0
  50. package/packages/happy2-server/dist/modules/plugin/functions.test.js.map +1 -0
  51. package/packages/happy2-server/dist/modules/plugin/httpBridge.d.ts +19 -0
  52. package/packages/happy2-server/dist/modules/plugin/httpBridge.d.ts.map +1 -0
  53. package/packages/happy2-server/dist/modules/plugin/httpBridge.js +206 -0
  54. package/packages/happy2-server/dist/modules/plugin/httpBridge.js.map +1 -0
  55. package/packages/happy2-server/dist/modules/plugin/impl/asInstallation.d.ts +3 -0
  56. package/packages/happy2-server/dist/modules/plugin/impl/asInstallation.d.ts.map +1 -0
  57. package/packages/happy2-server/dist/modules/plugin/impl/asInstallation.js +47 -0
  58. package/packages/happy2-server/dist/modules/plugin/impl/asInstallation.js.map +1 -0
  59. package/packages/happy2-server/dist/modules/plugin/impl/asPlugin.d.ts +3 -0
  60. package/packages/happy2-server/dist/modules/plugin/impl/asPlugin.d.ts.map +1 -0
  61. package/packages/happy2-server/dist/modules/plugin/impl/asPlugin.js +69 -0
  62. package/packages/happy2-server/dist/modules/plugin/impl/asPlugin.js.map +1 -0
  63. package/packages/happy2-server/dist/modules/plugin/impl/installationSelection.d.ts +288 -0
  64. package/packages/happy2-server/dist/modules/plugin/impl/installationSelection.d.ts.map +1 -0
  65. package/packages/happy2-server/dist/modules/plugin/impl/installationSelection.js +19 -0
  66. package/packages/happy2-server/dist/modules/plugin/impl/installationSelection.js.map +1 -0
  67. package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.d.ts +3 -0
  68. package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.d.ts.map +1 -0
  69. package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.js +52 -0
  70. package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.js.map +1 -0
  71. package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.test.d.ts +2 -0
  72. package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.test.d.ts.map +1 -0
  73. package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.test.js +17 -0
  74. package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.test.js.map +1 -0
  75. package/packages/happy2-server/dist/modules/plugin/impl/pluginFunctionResult.d.ts +3 -0
  76. package/packages/happy2-server/dist/modules/plugin/impl/pluginFunctionResult.d.ts.map +1 -0
  77. package/packages/happy2-server/dist/modules/plugin/impl/pluginFunctionResult.js +16 -0
  78. package/packages/happy2-server/dist/modules/plugin/impl/pluginFunctionResult.js.map +1 -0
  79. package/packages/happy2-server/dist/modules/plugin/impl/pluginSelection.d.ts +339 -0
  80. package/packages/happy2-server/dist/modules/plugin/impl/pluginSelection.d.ts.map +1 -0
  81. package/packages/happy2-server/dist/modules/plugin/impl/pluginSelection.js +22 -0
  82. package/packages/happy2-server/dist/modules/plugin/impl/pluginSelection.js.map +1 -0
  83. package/packages/happy2-server/dist/modules/plugin/index.d.ts +3 -0
  84. package/packages/happy2-server/dist/modules/plugin/index.d.ts.map +1 -0
  85. package/packages/happy2-server/dist/modules/plugin/index.js +3 -0
  86. package/packages/happy2-server/dist/modules/plugin/index.js.map +1 -0
  87. package/packages/happy2-server/dist/modules/plugin/packageStore.d.ts +15 -0
  88. package/packages/happy2-server/dist/modules/plugin/packageStore.d.ts.map +1 -0
  89. package/packages/happy2-server/dist/modules/plugin/packageStore.js +90 -0
  90. package/packages/happy2-server/dist/modules/plugin/packageStore.js.map +1 -0
  91. package/packages/happy2-server/dist/modules/plugin/pluginAuthorizeManagement.d.ts +7 -0
  92. package/packages/happy2-server/dist/modules/plugin/pluginAuthorizeManagement.d.ts.map +1 -0
  93. package/packages/happy2-server/dist/modules/plugin/pluginAuthorizeManagement.js +9 -0
  94. package/packages/happy2-server/dist/modules/plugin/pluginAuthorizeManagement.js.map +1 -0
  95. package/packages/happy2-server/dist/modules/plugin/pluginCatalogList.d.ts +9 -0
  96. package/packages/happy2-server/dist/modules/plugin/pluginCatalogList.d.ts.map +1 -0
  97. package/packages/happy2-server/dist/modules/plugin/pluginCatalogList.js +50 -0
  98. package/packages/happy2-server/dist/modules/plugin/pluginCatalogList.js.map +1 -0
  99. package/packages/happy2-server/dist/modules/plugin/pluginFindBySource.d.ts +9 -0
  100. package/packages/happy2-server/dist/modules/plugin/pluginFindBySource.d.ts.map +1 -0
  101. package/packages/happy2-server/dist/modules/plugin/pluginFindBySource.js +15 -0
  102. package/packages/happy2-server/dist/modules/plugin/pluginFindBySource.js.map +1 -0
  103. package/packages/happy2-server/dist/modules/plugin/pluginFunctionResultAcquire.d.ts +23 -0
  104. package/packages/happy2-server/dist/modules/plugin/pluginFunctionResultAcquire.d.ts.map +1 -0
  105. package/packages/happy2-server/dist/modules/plugin/pluginFunctionResultAcquire.js +54 -0
  106. package/packages/happy2-server/dist/modules/plugin/pluginFunctionResultAcquire.js.map +1 -0
  107. package/packages/happy2-server/dist/modules/plugin/pluginFunctionResultComplete.d.ts +13 -0
  108. package/packages/happy2-server/dist/modules/plugin/pluginFunctionResultComplete.d.ts.map +1 -0
  109. package/packages/happy2-server/dist/modules/plugin/pluginFunctionResultComplete.js +37 -0
  110. package/packages/happy2-server/dist/modules/plugin/pluginFunctionResultComplete.js.map +1 -0
  111. package/packages/happy2-server/dist/modules/plugin/pluginGetImage.d.ts +17 -0
  112. package/packages/happy2-server/dist/modules/plugin/pluginGetImage.d.ts.map +1 -0
  113. package/packages/happy2-server/dist/modules/plugin/pluginGetImage.js +29 -0
  114. package/packages/happy2-server/dist/modules/plugin/pluginGetImage.js.map +1 -0
  115. package/packages/happy2-server/dist/modules/plugin/pluginInstall.d.ts +27 -0
  116. package/packages/happy2-server/dist/modules/plugin/pluginInstall.d.ts.map +1 -0
  117. package/packages/happy2-server/dist/modules/plugin/pluginInstall.js +175 -0
  118. package/packages/happy2-server/dist/modules/plugin/pluginInstall.js.map +1 -0
  119. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRuntimeConfiguration.d.ts +9 -0
  120. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRuntimeConfiguration.d.ts.map +1 -0
  121. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRuntimeConfiguration.js +111 -0
  122. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRuntimeConfiguration.js.map +1 -0
  123. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetStatus.d.ts +11 -0
  124. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetStatus.d.ts.map +1 -0
  125. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetStatus.js +18 -0
  126. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetStatus.js.map +1 -0
  127. package/packages/happy2-server/dist/modules/plugin/pluginInstallationList.d.ts +8 -0
  128. package/packages/happy2-server/dist/modules/plugin/pluginInstallationList.d.ts.map +1 -0
  129. package/packages/happy2-server/dist/modules/plugin/pluginInstallationList.js +19 -0
  130. package/packages/happy2-server/dist/modules/plugin/pluginInstallationList.js.map +1 -0
  131. package/packages/happy2-server/dist/modules/plugin/pluginInstallationListIds.d.ts +7 -0
  132. package/packages/happy2-server/dist/modules/plugin/pluginInstallationListIds.d.ts.map +1 -0
  133. package/packages/happy2-server/dist/modules/plugin/pluginInstallationListIds.js +13 -0
  134. package/packages/happy2-server/dist/modules/plugin/pluginInstallationListIds.js.map +1 -0
  135. package/packages/happy2-server/dist/modules/plugin/pluginInstallationListReadyMcpIds.d.ts +7 -0
  136. package/packages/happy2-server/dist/modules/plugin/pluginInstallationListReadyMcpIds.d.ts.map +1 -0
  137. package/packages/happy2-server/dist/modules/plugin/pluginInstallationListReadyMcpIds.js +16 -0
  138. package/packages/happy2-server/dist/modules/plugin/pluginInstallationListReadyMcpIds.js.map +1 -0
  139. package/packages/happy2-server/dist/modules/plugin/pluginInstallationUpdateStatus.d.ts +15 -0
  140. package/packages/happy2-server/dist/modules/plugin/pluginInstallationUpdateStatus.d.ts.map +1 -0
  141. package/packages/happy2-server/dist/modules/plugin/pluginInstallationUpdateStatus.js +37 -0
  142. package/packages/happy2-server/dist/modules/plugin/pluginInstallationUpdateStatus.js.map +1 -0
  143. package/packages/happy2-server/dist/modules/plugin/pluginList.d.ts +8 -0
  144. package/packages/happy2-server/dist/modules/plugin/pluginList.d.ts.map +1 -0
  145. package/packages/happy2-server/dist/modules/plugin/pluginList.js +17 -0
  146. package/packages/happy2-server/dist/modules/plugin/pluginList.js.map +1 -0
  147. package/packages/happy2-server/dist/modules/plugin/pluginRemoveMissingBuiltins.d.ts +14 -0
  148. package/packages/happy2-server/dist/modules/plugin/pluginRemoveMissingBuiltins.d.ts.map +1 -0
  149. package/packages/happy2-server/dist/modules/plugin/pluginRemoveMissingBuiltins.js +51 -0
  150. package/packages/happy2-server/dist/modules/plugin/pluginRemoveMissingBuiltins.js.map +1 -0
  151. package/packages/happy2-server/dist/modules/plugin/runtime.d.ts +37 -0
  152. package/packages/happy2-server/dist/modules/plugin/runtime.d.ts.map +1 -0
  153. package/packages/happy2-server/dist/modules/plugin/runtime.js +62 -0
  154. package/packages/happy2-server/dist/modules/plugin/runtime.js.map +1 -0
  155. package/packages/happy2-server/dist/modules/plugin/secrets.d.ts +17 -0
  156. package/packages/happy2-server/dist/modules/plugin/secrets.d.ts.map +1 -0
  157. package/packages/happy2-server/dist/modules/plugin/secrets.js +56 -0
  158. package/packages/happy2-server/dist/modules/plugin/secrets.js.map +1 -0
  159. package/packages/happy2-server/dist/modules/plugin/secrets.test.d.ts +2 -0
  160. package/packages/happy2-server/dist/modules/plugin/secrets.test.d.ts.map +1 -0
  161. package/packages/happy2-server/dist/modules/plugin/secrets.test.js +14 -0
  162. package/packages/happy2-server/dist/modules/plugin/secrets.test.js.map +1 -0
  163. package/packages/happy2-server/dist/modules/plugin/service.d.ts +52 -0
  164. package/packages/happy2-server/dist/modules/plugin/service.d.ts.map +1 -0
  165. package/packages/happy2-server/dist/modules/plugin/service.js +538 -0
  166. package/packages/happy2-server/dist/modules/plugin/service.js.map +1 -0
  167. package/packages/happy2-server/dist/modules/plugin/types.d.ts +157 -0
  168. package/packages/happy2-server/dist/modules/plugin/types.d.ts.map +1 -0
  169. package/packages/happy2-server/dist/modules/plugin/types.js +9 -0
  170. package/packages/happy2-server/dist/modules/plugin/types.js.map +1 -0
  171. package/packages/happy2-server/dist/modules/plugin/utils/ndjsonStreamTransport.d.ts +19 -0
  172. package/packages/happy2-server/dist/modules/plugin/utils/ndjsonStreamTransport.d.ts.map +1 -0
  173. package/packages/happy2-server/dist/modules/plugin/utils/ndjsonStreamTransport.js +97 -0
  174. package/packages/happy2-server/dist/modules/plugin/utils/ndjsonStreamTransport.js.map +1 -0
  175. package/packages/happy2-server/dist/modules/plugin/utils/ndjsonStreamTransport.test.d.ts +2 -0
  176. package/packages/happy2-server/dist/modules/plugin/utils/ndjsonStreamTransport.test.d.ts.map +1 -0
  177. package/packages/happy2-server/dist/modules/plugin/utils/ndjsonStreamTransport.test.js +74 -0
  178. package/packages/happy2-server/dist/modules/plugin/utils/ndjsonStreamTransport.test.js.map +1 -0
  179. package/packages/happy2-server/dist/modules/plugin/utils/remoteMcpTransport.d.ts +29 -0
  180. package/packages/happy2-server/dist/modules/plugin/utils/remoteMcpTransport.d.ts.map +1 -0
  181. package/packages/happy2-server/dist/modules/plugin/utils/remoteMcpTransport.js +126 -0
  182. package/packages/happy2-server/dist/modules/plugin/utils/remoteMcpTransport.js.map +1 -0
  183. package/packages/happy2-server/dist/modules/plugin/utils/remoteMcpTransport.test.d.ts +2 -0
  184. package/packages/happy2-server/dist/modules/plugin/utils/remoteMcpTransport.test.d.ts.map +1 -0
  185. package/packages/happy2-server/dist/modules/plugin/utils/remoteMcpTransport.test.js +75 -0
  186. package/packages/happy2-server/dist/modules/plugin/utils/remoteMcpTransport.test.js.map +1 -0
  187. package/packages/happy2-server/dist/modules/sandbox/index.d.ts +1 -1
  188. package/packages/happy2-server/dist/modules/sandbox/index.d.ts.map +1 -1
  189. package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.d.ts +2 -1
  190. package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.d.ts.map +1 -1
  191. package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.js +117 -3
  192. package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.js.map +1 -1
  193. package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.test.js +81 -2
  194. package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.test.js.map +1 -1
  195. package/packages/happy2-server/dist/modules/sandbox/types.d.ts +8 -0
  196. package/packages/happy2-server/dist/modules/sandbox/types.d.ts.map +1 -1
  197. package/packages/happy2-server/dist/modules/schema.d.ts +7486 -5588
  198. package/packages/happy2-server/dist/modules/schema.d.ts.map +1 -1
  199. package/packages/happy2-server/dist/modules/schema.js +72 -1
  200. package/packages/happy2-server/dist/modules/schema.js.map +1 -1
  201. package/packages/happy2-server/dist/modules/sync/syncGetDifference.d.ts.map +1 -1
  202. package/packages/happy2-server/dist/modules/sync/syncGetDifference.js +2 -0
  203. package/packages/happy2-server/dist/modules/sync/syncGetDifference.js.map +1 -1
  204. package/packages/happy2-server/dist/routes/plugins.d.ts +8 -0
  205. package/packages/happy2-server/dist/routes/plugins.d.ts.map +1 -0
  206. package/packages/happy2-server/dist/routes/plugins.js +186 -0
  207. package/packages/happy2-server/dist/routes/plugins.js.map +1 -0
  208. package/packages/happy2-server/dist/runner.js +45 -19
  209. package/packages/happy2-server/dist/runner.js.map +1 -1
  210. package/packages/happy2-server/dist/server.d.ts +6 -0
  211. package/packages/happy2-server/dist/server.d.ts.map +1 -1
  212. package/packages/happy2-server/dist/server.js +46 -3
  213. package/packages/happy2-server/dist/server.js.map +1 -1
  214. package/packages/happy2-server/dist/systemService.d.ts +48 -0
  215. package/packages/happy2-server/dist/systemService.d.ts.map +1 -0
  216. package/packages/happy2-server/dist/systemService.js +308 -0
  217. package/packages/happy2-server/dist/systemService.js.map +1 -0
  218. package/packages/happy2-server/dist/systemService.test.d.ts +2 -0
  219. package/packages/happy2-server/dist/systemService.test.d.ts.map +1 -0
  220. package/packages/happy2-server/dist/systemService.test.js +266 -0
  221. package/packages/happy2-server/dist/systemService.test.js.map +1 -0
  222. package/packages/happy2-server/dist/web/assets/index-9SGCQLg7.js +46 -0
  223. package/packages/happy2-server/dist/web/assets/{index-DZ1uRLgV.css → index-DWXBQDJB.css} +1 -1
  224. package/packages/happy2-server/dist/web/index.html +2 -2
  225. package/packages/happy2-server/drizzle/0020_plugins.sql +61 -0
  226. package/packages/happy2-server/drizzle/0021_plugin_function_results.sql +11 -0
  227. package/packages/happy2-server/drizzle/meta/_journal.json +14 -0
  228. package/packages/happy2-server/happy2.example.toml +5 -0
  229. package/packages/happy2-server/plugins/README.md +7 -0
  230. package/packages/happy2-server/plugins/hello/container/Dockerfile +6 -0
  231. package/packages/happy2-server/plugins/hello/plugin.json +16 -0
  232. package/packages/happy2-server/plugins/hello/plugin.png +0 -0
  233. package/packages/happy2-server/plugins/hello/server.mjs +75 -0
  234. package/packages/happy2-server/plugins/hello/skills/hello/SKILL.md +11 -0
  235. package/packages/happy2-server/dist/web/assets/index-DH1SOwNV.js +0 -46
@@ -0,0 +1,19 @@
1
+ import { eq } from "drizzle-orm";
2
+ import { pluginInstallations, plugins } from "../schema.js";
3
+ import { userRequireServerAdmin } from "../chat/userRequireServerAdmin.js";
4
+ import { pluginInstallationSelection } from "./impl/installationSelection.js";
5
+ import { asPluginInstallation } from "./impl/asInstallation.js";
6
+ /**
7
+ * Lists durable system plugin installations and their latest lifecycle state for an active server administrator.
8
+ * This read-only action does not mutate durable state and centralizes authorization before installation health is joined into the catalog.
9
+ */
10
+ export async function pluginInstallationList(executor, actorUserId) {
11
+ await userRequireServerAdmin(executor, actorUserId);
12
+ const rows = await executor
13
+ .select(pluginInstallationSelection)
14
+ .from(pluginInstallations)
15
+ .innerJoin(plugins, eq(pluginInstallations.pluginId, plugins.id))
16
+ .orderBy(pluginInstallations.installedAt, pluginInstallations.id);
17
+ return rows.map(asPluginInstallation);
18
+ }
19
+ //# sourceMappingURL=pluginInstallationList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginInstallationList.js","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginInstallationList.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CACxC,QAAyB,EACzB,WAAmB;IAEnB,MAAM,sBAAsB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACpD,MAAM,IAAI,GAAG,MAAM,QAAQ;SACtB,MAAM,CAAC,2BAA2B,CAAC;SACnC,IAAI,CAAC,mBAAmB,CAAC;SACzB,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;SAChE,OAAO,CAAC,mBAAmB,CAAC,WAAW,EAAE,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACtE,OAAO,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { DrizzleExecutor } from "../drizzle.js";
2
+ /**
3
+ * Lists every durable plugin installation id so the lifecycle worker can reconcile all runtimes after server startup.
4
+ * This read-only worker boundary does not mutate durable state and avoids coupling restart recovery to catalog availability.
5
+ */
6
+ export declare function pluginInstallationListIds(executor: DrizzleExecutor): Promise<string[]>;
7
+ //# sourceMappingURL=pluginInstallationListIds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginInstallationListIds.d.ts","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginInstallationListIds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD;;;GAGG;AACH,wBAAsB,yBAAyB,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAM5F"}
@@ -0,0 +1,13 @@
1
+ import { pluginInstallations } from "../schema.js";
2
+ /**
3
+ * Lists every durable plugin installation id so the lifecycle worker can reconcile all runtimes after server startup.
4
+ * This read-only worker boundary does not mutate durable state and avoids coupling restart recovery to catalog availability.
5
+ */
6
+ export async function pluginInstallationListIds(executor) {
7
+ const rows = await executor
8
+ .select({ id: pluginInstallations.id })
9
+ .from(pluginInstallations)
10
+ .orderBy(pluginInstallations.installedAt, pluginInstallations.id);
11
+ return rows.map(({ id }) => id);
12
+ }
13
+ //# sourceMappingURL=pluginInstallationListIds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginInstallationListIds.js","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginInstallationListIds.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,QAAyB;IACrE,MAAM,IAAI,GAAG,MAAM,QAAQ;SACtB,MAAM,CAAC,EAAE,EAAE,EAAE,mBAAmB,CAAC,EAAE,EAAE,CAAC;SACtC,IAAI,CAAC,mBAAmB,CAAC;SACzB,OAAO,CAAC,mBAAmB,CAAC,WAAW,EAAE,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACtE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { DrizzleExecutor } from "../drizzle.js";
2
+ /**
3
+ * Lists ready MCP-backed plugin installation identities for agent function discovery and execution.
4
+ * This worker-facing read excludes skills-only and unhealthy installations so Rig receives only callable durable functions.
5
+ */
6
+ export declare function pluginInstallationListReadyMcpIds(executor: DrizzleExecutor): Promise<string[]>;
7
+ //# sourceMappingURL=pluginInstallationListReadyMcpIds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginInstallationListReadyMcpIds.d.ts","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginInstallationListReadyMcpIds.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD;;;GAGG;AACH,wBAAsB,iCAAiC,CACnD,QAAQ,EAAE,eAAe,GAC1B,OAAO,CAAC,MAAM,EAAE,CAAC,CAanB"}
@@ -0,0 +1,16 @@
1
+ import { and, eq, sql } from "drizzle-orm";
2
+ import { pluginInstallations, plugins } from "../schema.js";
3
+ /**
4
+ * Lists ready MCP-backed plugin installation identities for agent function discovery and execution.
5
+ * This worker-facing read excludes skills-only and unhealthy installations so Rig receives only callable durable functions.
6
+ */
7
+ export async function pluginInstallationListReadyMcpIds(executor) {
8
+ const rows = await executor
9
+ .select({ id: pluginInstallations.id })
10
+ .from(pluginInstallations)
11
+ .innerJoin(plugins, eq(pluginInstallations.pluginId, plugins.id))
12
+ .where(and(eq(pluginInstallations.status, "ready"), sql `json_type(${plugins.manifestJson}, '$.mcp') IS NOT NULL`))
13
+ .orderBy(pluginInstallations.installedAt, pluginInstallations.id);
14
+ return rows.map(({ id }) => id);
15
+ }
16
+ //# sourceMappingURL=pluginInstallationListReadyMcpIds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginInstallationListReadyMcpIds.js","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginInstallationListReadyMcpIds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iCAAiC,CACnD,QAAyB;IAEzB,MAAM,IAAI,GAAG,MAAM,QAAQ;SACtB,MAAM,CAAC,EAAE,EAAE,EAAE,mBAAmB,CAAC,EAAE,EAAE,CAAC;SACtC,IAAI,CAAC,mBAAmB,CAAC;SACzB,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;SAChE,KAAK,CACF,GAAG,CACC,EAAE,CAAC,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,EACvC,GAAG,CAAA,aAAa,OAAO,CAAC,YAAY,wBAAwB,CAC/D,CACJ;SACA,OAAO,CAAC,mBAAmB,CAAC,WAAW,EAAE,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACtE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { DrizzleExecutor } from "../drizzle.js";
2
+ import type { MutationHint } from "../chat/types.js";
3
+ import type { PluginInstallationStatus } from "./types.js";
4
+ /**
5
+ * Commits a worker-observed lifecycle state to pluginInstallations and appends its matching sync event.
6
+ * The transaction makes asynchronous preparation and health transitions durable and reactive without letting the worker mutate tables directly.
7
+ */
8
+ export declare function pluginInstallationUpdateStatus(executor: DrizzleExecutor, input: {
9
+ installationId: string;
10
+ status: PluginInstallationStatus;
11
+ detail: string;
12
+ error?: string;
13
+ runtimeImageTag?: string;
14
+ }): Promise<MutationHint>;
15
+ //# sourceMappingURL=pluginInstallationUpdateStatus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginInstallationUpdateStatus.d.ts","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginInstallationUpdateStatus.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAMrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE3D;;;GAGG;AACH,wBAAsB,8BAA8B,CAChD,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,wBAAwB,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,GACF,OAAO,CAAC,YAAY,CAAC,CAwBvB"}
@@ -0,0 +1,37 @@
1
+ import { eq, sql } from "drizzle-orm";
2
+ import { withTransaction } from "../drizzle.js";
3
+ import { pluginInstallations } from "../schema.js";
4
+ import { syncSequenceNext } from "../sync/syncSequenceNext.js";
5
+ import { syncEventInsert } from "../sync/syncEventInsert.js";
6
+ import { areaHint } from "../chat/areaHint.js";
7
+ /**
8
+ * Commits a worker-observed lifecycle state to pluginInstallations and appends its matching sync event.
9
+ * The transaction makes asynchronous preparation and health transitions durable and reactive without letting the worker mutate tables directly.
10
+ */
11
+ export async function pluginInstallationUpdateStatus(executor, input) {
12
+ return withTransaction(executor, async (tx) => {
13
+ const sequence = await syncSequenceNext(tx);
14
+ const [updated] = await tx
15
+ .update(pluginInstallations)
16
+ .set({
17
+ status: input.status,
18
+ statusDetail: input.detail,
19
+ lastError: input.error ?? null,
20
+ runtimeImageTag: input.runtimeImageTag,
21
+ syncSequence: sequence,
22
+ updatedAt: sql `CURRENT_TIMESTAMP`,
23
+ readyAt: input.status === "ready" ? sql `CURRENT_TIMESTAMP` : null,
24
+ })
25
+ .where(eq(pluginInstallations.id, input.installationId))
26
+ .returning({ id: pluginInstallations.id });
27
+ if (!updated)
28
+ throw new Error("Plugin installation disappeared during status update");
29
+ await syncEventInsert(tx, {
30
+ sequence,
31
+ kind: `plugin.${input.status}`,
32
+ entityId: input.installationId,
33
+ });
34
+ return areaHint(sequence, "plugins");
35
+ });
36
+ }
37
+ //# sourceMappingURL=pluginInstallationUpdateStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginInstallationUpdateStatus.js","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginInstallationUpdateStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE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AAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { DrizzleExecutor } from "../drizzle.js";
2
+ import type { SystemPluginSummary } from "./types.js";
3
+ /**
4
+ * Lists durable system plugins and their persisted package-image metadata for an active server administrator.
5
+ * This read-only boundary does not mutate durable state and keeps catalog packages distinct from reusable installed plugin identities.
6
+ */
7
+ export declare function pluginList(executor: DrizzleExecutor, actorUserId: string): Promise<SystemPluginSummary[]>;
8
+ //# sourceMappingURL=pluginList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginList.d.ts","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD;;;GAGG;AACH,wBAAsB,UAAU,CAC5B,QAAQ,EAAE,eAAe,EACzB,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAOhC"}
@@ -0,0 +1,17 @@
1
+ import { plugins } from "../schema.js";
2
+ import { userRequireServerAdmin } from "../chat/userRequireServerAdmin.js";
3
+ import { asSystemPlugin } from "./impl/asPlugin.js";
4
+ import { pluginSelection } from "./impl/pluginSelection.js";
5
+ /**
6
+ * Lists durable system plugins and their persisted package-image metadata for an active server administrator.
7
+ * This read-only boundary does not mutate durable state and keeps catalog packages distinct from reusable installed plugin identities.
8
+ */
9
+ export async function pluginList(executor, actorUserId) {
10
+ await userRequireServerAdmin(executor, actorUserId);
11
+ const rows = await executor
12
+ .select(pluginSelection)
13
+ .from(plugins)
14
+ .orderBy(plugins.installedAt, plugins.id);
15
+ return rows.map(asSystemPlugin);
16
+ }
17
+ //# sourceMappingURL=pluginList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginList.js","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginList.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAG5D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC5B,QAAyB,EACzB,WAAmB;IAEnB,MAAM,sBAAsB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACpD,MAAM,IAAI,GAAG,MAAM,QAAQ;SACtB,MAAM,CAAC,eAAe,CAAC;SACvB,IAAI,CAAC,OAAO,CAAC;SACb,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IAC9C,OAAO,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { DrizzleExecutor } from "../drizzle.js";
2
+ import type { MutationHint } from "../chat/types.js";
3
+ /**
4
+ * Removes system plugins whose built-in source is no longer present, including their pluginInstallations and cascade-owned pluginInstallationVariables.
5
+ * The transaction records syncEvents for the deleted plugin identities so startup pruning is durable and clients can reconcile the plugins area.
6
+ */
7
+ export declare function pluginRemoveMissingBuiltins(executor: DrizzleExecutor, availableSourceReferences: readonly string[]): Promise<{
8
+ hint?: MutationHint;
9
+ plugins: Array<{
10
+ pluginId: string;
11
+ containerNames: string[];
12
+ }>;
13
+ }>;
14
+ //# sourceMappingURL=pluginRemoveMissingBuiltins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginRemoveMissingBuiltins.d.ts","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginRemoveMissingBuiltins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAKrD;;;GAGG;AACH,wBAAsB,2BAA2B,CAC7C,QAAQ,EAAE,eAAe,EACzB,yBAAyB,EAAE,SAAS,MAAM,EAAE,GAC7C,OAAO,CAAC;IACP,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CAClE,CAAC,CAwCD"}
@@ -0,0 +1,51 @@
1
+ import { eq, inArray } from "drizzle-orm";
2
+ import { withTransaction } from "../drizzle.js";
3
+ import { areaHint } from "../chat/areaHint.js";
4
+ import { pluginInstallations, plugins } from "../schema.js";
5
+ import { syncEventInsert } from "../sync/syncEventInsert.js";
6
+ import { syncSequenceNext } from "../sync/syncSequenceNext.js";
7
+ /**
8
+ * Removes system plugins whose built-in source is no longer present, including their pluginInstallations and cascade-owned pluginInstallationVariables.
9
+ * The transaction records syncEvents for the deleted plugin identities so startup pruning is durable and clients can reconcile the plugins area.
10
+ */
11
+ export async function pluginRemoveMissingBuiltins(executor, availableSourceReferences) {
12
+ return withTransaction(executor, async (tx) => {
13
+ const available = new Set(availableSourceReferences);
14
+ const builtins = await tx
15
+ .select({ id: plugins.id, sourceReference: plugins.sourceReference })
16
+ .from(plugins)
17
+ .where(eq(plugins.sourceKind, "builtin"));
18
+ const missing = builtins.filter(({ sourceReference }) => !available.has(sourceReference));
19
+ if (missing.length === 0)
20
+ return { plugins: [] };
21
+ const pluginIds = missing.map(({ id }) => id);
22
+ const installations = await tx
23
+ .select({
24
+ pluginId: pluginInstallations.pluginId,
25
+ containerName: pluginInstallations.containerName,
26
+ })
27
+ .from(pluginInstallations)
28
+ .where(inArray(pluginInstallations.pluginId, pluginIds));
29
+ await tx
30
+ .delete(pluginInstallations)
31
+ .where(inArray(pluginInstallations.pluginId, pluginIds));
32
+ await tx.delete(plugins).where(inArray(plugins.id, pluginIds));
33
+ const sequence = await syncSequenceNext(tx);
34
+ for (const { id } of missing)
35
+ await syncEventInsert(tx, {
36
+ sequence,
37
+ kind: "plugin.builtin_removed",
38
+ entityId: id,
39
+ });
40
+ return {
41
+ hint: areaHint(sequence, "plugins"),
42
+ plugins: missing.map(({ id }) => ({
43
+ pluginId: id,
44
+ containerNames: installations
45
+ .filter(({ pluginId, containerName }) => pluginId === id && containerName)
46
+ .map(({ containerName }) => containerName),
47
+ })),
48
+ };
49
+ });
50
+ }
51
+ //# sourceMappingURL=pluginRemoveMissingBuiltins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginRemoveMissingBuiltins.js","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginRemoveMissingBuiltins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC7C,QAAyB,EACzB,yBAA4C;IAK5C,OAAO,eAAe,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;QAC1C,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,yBAAyB,CAAC,CAAC;QACrD,MAAM,QAAQ,GAAG,MAAM,EAAE;aACpB,MAAM,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,eAAe,EAAE,OAAO,CAAC,eAAe,EAAE,CAAC;aACpE,IAAI,CAAC,OAAO,CAAC;aACb,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CA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E,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC9B,QAAQ,EAAE,EAAE;gBACZ,cAAc,EAAE,aAAa;qBACxB,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,QAAQ,KAAK,EAAE,IAAI,aAAa,CAAC;qBACzE,GAAG,CAAC,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,aAAc,CAAC;aAClD,CAAC,CAAC;SACN,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
2
+ import type { AgentSandboxRuntimeResolver } from "../sandbox/index.js";
3
+ export interface PluginLocalPrepareInput {
4
+ build?: {
5
+ contextDirectory: string;
6
+ dockerfile: string;
7
+ tag: string;
8
+ };
9
+ containerName: string;
10
+ imageTag: string;
11
+ installationId: string;
12
+ }
13
+ export interface PluginLocalOpenInput {
14
+ args: readonly string[];
15
+ command: string;
16
+ containerName: string;
17
+ environment: Readonly<Record<string, string>>;
18
+ }
19
+ export interface PluginMcpRuntime {
20
+ prepareLocal(input: PluginLocalPrepareInput, signal?: AbortSignal): Promise<{
21
+ imageTag: string;
22
+ }>;
23
+ openLocal(input: PluginLocalOpenInput, signal?: AbortSignal): Promise<Transport>;
24
+ removeLocal(containerName: string): Promise<void>;
25
+ }
26
+ /** Runs stdio MCP packages in dedicated containers owned by the selected local sandbox provider. */
27
+ export declare class SandboxPluginMcpRuntime implements PluginMcpRuntime {
28
+ private readonly provider;
29
+ constructor(provider: AgentSandboxRuntimeResolver);
30
+ prepareLocal(input: PluginLocalPrepareInput, signal?: AbortSignal): Promise<{
31
+ imageTag: string;
32
+ }>;
33
+ openLocal(input: PluginLocalOpenInput, signal?: AbortSignal): Promise<Transport>;
34
+ removeLocal(containerName: string): Promise<void>;
35
+ private localProvider;
36
+ }
37
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
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QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CA4B/B;IAEK,SAAS,CAAC,KAAK,EAAE,oBAAoB,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAmBrF;IAEK,WAAW,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEtD;YAEa,aAAa;CAmB9B"}
@@ -0,0 +1,62 @@
1
+ import { PluginError } from "./types.js";
2
+ import { NdjsonStreamTransport } from "./utils/ndjsonStreamTransport.js";
3
+ /** Runs stdio MCP packages in dedicated containers owned by the selected local sandbox provider. */
4
+ export class SandboxPluginMcpRuntime {
5
+ provider;
6
+ constructor(provider) {
7
+ this.provider = provider;
8
+ }
9
+ async prepareLocal(input, signal) {
10
+ const provider = await this.localProvider();
11
+ if (!provider.createPluginSandbox)
12
+ throw new PluginError("broken_configuration", `${provider.displayName} does not support plugin containers`);
13
+ if (input.build && input.build.tag !== input.imageTag)
14
+ throw new Error("Plugin build and runtime image tags must match");
15
+ await provider.removeSandbox(input.containerName);
16
+ if (input.build)
17
+ await provider.buildImage({
18
+ buildContext: input.build.contextDirectory,
19
+ dockerfile: input.build.dockerfile,
20
+ tag: input.build.tag,
21
+ }, { signal });
22
+ await provider.createPluginSandbox({
23
+ containerName: input.containerName,
24
+ imageTag: input.imageTag,
25
+ installationId: input.installationId,
26
+ }, signal);
27
+ return { imageTag: input.imageTag };
28
+ }
29
+ async openLocal(input, signal) {
30
+ const provider = await this.localProvider();
31
+ let handle;
32
+ try {
33
+ handle = provider.attachTerminal({
34
+ containerName: input.containerName,
35
+ command: [input.command, ...input.args],
36
+ environment: input.environment,
37
+ }, signal);
38
+ }
39
+ catch (error) {
40
+ throw new PluginError("broken_configuration", error instanceof Error ? error.message : "Plugin environment is invalid");
41
+ }
42
+ return new NdjsonStreamTransport(handle);
43
+ }
44
+ async removeLocal(containerName) {
45
+ await (await this.localProvider()).removeSandbox(containerName);
46
+ }
47
+ async localProvider() {
48
+ let provider;
49
+ try {
50
+ provider = (await this.provider());
51
+ }
52
+ catch (error) {
53
+ throw new PluginError("broken_configuration", error instanceof Error
54
+ ? error.message
55
+ : "A local sandbox provider is not configured");
56
+ }
57
+ if (provider.locality !== "local")
58
+ throw new PluginError("broken_configuration", "Stdio MCP plugins require a local sandbox provider");
59
+ return provider;
60
+ }
61
+ }
62
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../sources/modules/plugin/runtime.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAyBzE,oGAAoG;AACpG,MAAM,OAAO,uBAAuB;IACH,QAAQ;IAArC,YAA6B,QAAqC;wBAArC,QAAQ;IAAgC,CAAC;IAEtE,KAAK,CAAC,YAAY,CACd,KAA8B,EAC9B,MAAoB;QAEpB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAC5C,IAAI,CAAC,QAAQ,CAAC,mBAAmB;YAC7B,MAAM,IAAI,WAAW,CACjB,sBAAsB,EACtB,GAAG,QAAQ,CAAC,WAAW,qCAAqC,CAC/D,CAAC;QACN,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,QAAQ;YACjD,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QACtE,MAAM,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAClD,IAAI,KAAK,CAAC,KAAK;YACX,MAAM,QAAQ,CAAC,UAAU,CACrB;gBACI,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,gBAAgB;gBAC1C,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU;gBAClC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG;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E,CAAC;YACb,MAAM,IAAI,WAAW,CACjB,sBAAsB,EACtB,KAAK,YAAY,KAAK;gBAClB,CAAC,CAAC,KAAK,CAAC,OAAO;gBACf,CAAC,CAAC,4CAA4C,CACrD,CAAC;QACN,CAAC;QACD,IAAI,QAAQ,CAAC,QAAQ,KAAK,OAAO;YAC7B,MAAM,IAAI,WAAW,CACjB,sBAAsB,EACtB,oDAAoD,CACvD,CAAC;QACN,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ"}
@@ -0,0 +1,17 @@
1
+ export interface PluginSecretContext {
2
+ installationId: string;
3
+ key: string;
4
+ }
5
+ export interface PluginSecretProtector {
6
+ protect(secret: string, context: PluginSecretContext): Promise<string>;
7
+ reveal(ciphertext: string, context: PluginSecretContext): Promise<string>;
8
+ }
9
+ /** Authenticated envelope dedicated to recoverable plugin environment variables. */
10
+ export declare class AesGcmPluginSecretProtector implements PluginSecretProtector {
11
+ private readonly key;
12
+ constructor(key: Uint8Array);
13
+ static fromBase64(value: string): AesGcmPluginSecretProtector;
14
+ protect(secret: string, context: PluginSecretContext): Promise<string>;
15
+ reveal(envelope: string, context: PluginSecretContext): Promise<string>;
16
+ }
17
+ //# sourceMappingURL=secrets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../../sources/modules/plugin/secrets.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,mBAAmB;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IAClC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7E;AAED,oFAAoF;AACpF,qBAAa,2BAA4B,YAAW,qBAAqB;IACrE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAE7B,YAAY,GAAG,EAAE,UAAU,EAG1B;IAED,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,2BAA2B,CAG5D;IAEK,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ3E;IAEK,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAmB5E;CACJ"}
@@ -0,0 +1,56 @@
1
+ import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
2
+ const CIPHER = "aes-256-gcm";
3
+ const CONTEXT = Buffer.from("happy2:plugin-variable:v1", "utf8");
4
+ /** Authenticated envelope dedicated to recoverable plugin environment variables. */
5
+ export class AesGcmPluginSecretProtector {
6
+ key;
7
+ constructor(key) {
8
+ if (key.byteLength !== 32)
9
+ throw new TypeError("Plugin secret key must be 32 bytes");
10
+ this.key = Buffer.from(key);
11
+ }
12
+ static fromBase64(value) {
13
+ if (!value)
14
+ throw new TypeError("Plugin secret key is required");
15
+ return new AesGcmPluginSecretProtector(Buffer.from(value, "base64url"));
16
+ }
17
+ async protect(secret, context) {
18
+ if (!secret)
19
+ throw new TypeError("Plugin secret must not be empty");
20
+ const nonce = randomBytes(12);
21
+ const cipher = createCipheriv(CIPHER, this.key, nonce);
22
+ cipher.setAAD(aad(context));
23
+ const ciphertext = Buffer.concat([cipher.update(secret, "utf8"), cipher.final()]);
24
+ const tag = cipher.getAuthTag();
25
+ return `v1.${nonce.toString("base64url")}.${ciphertext.toString("base64url")}.${tag.toString("base64url")}`;
26
+ }
27
+ async reveal(envelope, context) {
28
+ const [version, nonceValue, ciphertextValue, tagValue, unexpected] = envelope.split(".");
29
+ if (version !== "v1" || !nonceValue || !ciphertextValue || !tagValue || unexpected)
30
+ throw new Error("Invalid plugin secret envelope");
31
+ try {
32
+ const decipher = createDecipheriv(CIPHER, this.key, Buffer.from(nonceValue, "base64url"));
33
+ decipher.setAAD(aad(context));
34
+ decipher.setAuthTag(Buffer.from(tagValue, "base64url"));
35
+ return Buffer.concat([
36
+ decipher.update(Buffer.from(ciphertextValue, "base64url")),
37
+ decipher.final(),
38
+ ]).toString("utf8");
39
+ }
40
+ catch {
41
+ throw new Error("Plugin secret could not be authenticated");
42
+ }
43
+ }
44
+ }
45
+ function aad(context) {
46
+ if (!context.installationId || !context.key)
47
+ throw new TypeError("Plugin secret context is required");
48
+ return Buffer.concat([
49
+ CONTEXT,
50
+ Buffer.from("\0", "utf8"),
51
+ Buffer.from(context.installationId, "utf8"),
52
+ Buffer.from("\0", "utf8"),
53
+ Buffer.from(context.key, "utf8"),
54
+ ]);
55
+ }
56
+ //# sourceMappingURL=secrets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets.js","sourceRoot":"","sources":["../../../sources/modules/plugin/secrets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE5E,MAAM,MAAM,GAAG,aAAa,CAAC;AAC7B,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;AAYjE,oFAAoF;AACpF,MAAM,OAAO,2BAA2B;IACnB,GAAG,CAAS;IAE7B,YAAY,GAAe;QACvB,IAAI,GAAG,CAAC,UAAU,KAAK,EAAE;YAAE,MAAM,IAAI,SAAS,CAAC,oCAAoC,CAAC,CAAC;QACrF,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,KAAa;QAC3B,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,SAAS,CAAC,+BAA+B,CAAC,CAAC;QACjE,OAAO,IAAI,2BAA2B,CAAC,MAAM,CAAC,IAAI,CAAC,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C;YACF,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;YAC9B,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;YACxD,OAAO,MAAM,CAAC,MAAM,CAAC;gBACjB,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;gBAC1D,QAAQ,CAAC,KAAK,EAAE;aACnB,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACL,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAChE,CAAC;IACL,CAAC;CACJ;AAED,SAAS,GAAG,CAAC,OAA4B;IACrC,IAAI,CAAC,OAAO,CAAC,cAAc,IAAI,CAAC,OAAO,CAAC,GAAG;QACvC,MAAM,IAAI,SAAS,CAAC,mCAAmC,CAAC,CAAC;IAC7D,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,OAAO;QACP,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;QACzB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC;QAC3C,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;QACzB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC;KACnC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=secrets.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets.test.d.ts","sourceRoot":"","sources":["../../../sources/modules/plugin/secrets.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { randomBytes } from "node:crypto";
2
+ import { describe, expect, it } from "vitest";
3
+ import { AesGcmPluginSecretProtector } from "./secrets.js";
4
+ describe("AesGcmPluginSecretProtector", () => {
5
+ it("binds ciphertext to its installation and variable key", async () => {
6
+ const protector = new AesGcmPluginSecretProtector(randomBytes(32));
7
+ const context = { installationId: "cplugin", key: "API_TOKEN" };
8
+ const encrypted = await protector.protect("secret-value", context);
9
+ await expect(protector.reveal(encrypted, context)).resolves.toBe("secret-value");
10
+ await expect(protector.reveal(encrypted, { ...context, key: "OTHER_TOKEN" })).rejects.toThrow("could not be authenticated");
11
+ expect(encrypted).not.toContain("secret-value");
12
+ });
13
+ });
14
+ //# sourceMappingURL=secrets.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets.test.js","sourceRoot":"","sources":["../../../sources/modules/plugin/secrets.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAE3D,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IACzC,EAAE,CAAC,uDAAuD,EAAE,KAAK,IAAI,EAAE;QACnE,MAAM,SAAS,GAAG,IAAI,2BAA2B,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;QACnE,MAAM,OAAO,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC;QAChE,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAEnE,MAAM,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACjF,MAAM,MAAM,CACR,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC,CAClE,CAAC,OAAO,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;QAChD,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,52 @@
1
+ import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
2
+ import type { DrizzleExecutor } from "../drizzle.js";
3
+ import type { PubSub } from "../realtime/index.js";
4
+ import type { WebhookUrlPolicy } from "../integrations/ssrf.js";
5
+ import type { WebhookTransport } from "../integrations/types.js";
6
+ import type { PluginCatalog } from "./catalog.js";
7
+ import type { PluginPackageStore } from "./packageStore.js";
8
+ import type { PluginMcpRuntime } from "./runtime.js";
9
+ import type { PluginSecretProtector } from "./secrets.js";
10
+ import { type PluginFunctionDefinition, type PluginFunctionResult, type PluginInstallationSummary } from "./types.js";
11
+ /** Coordinates durable plugin installs with asynchronous container preparation, MCP health probes, restart recovery, and local connection creation. */
12
+ export declare class PluginService {
13
+ private readonly executor;
14
+ private readonly pubsub;
15
+ private readonly catalog;
16
+ private readonly packages;
17
+ private readonly secrets;
18
+ private readonly runtime;
19
+ private readonly urlPolicy;
20
+ private readonly remoteTransport;
21
+ private readonly onError;
22
+ private readonly activations;
23
+ private readonly localContainers;
24
+ private closed;
25
+ constructor(executor: DrizzleExecutor, pubsub: PubSub, catalog: PluginCatalog, packages: PluginPackageStore, secrets: PluginSecretProtector, runtime: PluginMcpRuntime, urlPolicy: WebhookUrlPolicy, remoteTransport: WebhookTransport, onError: (error: unknown) => void);
26
+ start(): Promise<void>;
27
+ install(input: {
28
+ actorUserId: string;
29
+ shortName: string;
30
+ variables: Readonly<Record<string, string>>;
31
+ containerImageId?: string;
32
+ }): Promise<PluginInstallationSummary>;
33
+ image(actorUserId: string, pluginId: string): Promise<{
34
+ body: Buffer;
35
+ contentType: string;
36
+ checksumSha256: string;
37
+ }>;
38
+ openLocal(installationId: string): Promise<Transport>;
39
+ listFunctions(signal?: AbortSignal): Promise<readonly PluginFunctionDefinition[]>;
40
+ private listFunctionsWithSignal;
41
+ callFunction(functionName: string, args: unknown, signal?: AbortSignal): Promise<PluginFunctionResult>;
42
+ private callFunctionWithSignal;
43
+ close(): Promise<void>;
44
+ private activate;
45
+ private withClient;
46
+ private runActivation;
47
+ private probeLocal;
48
+ private probeRemote;
49
+ private status;
50
+ private publish;
51
+ }
52
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../sources/modules/plugin/service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAUjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAEH,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAEjC,MAAM,YAAY,CAAC;AAOpB,uJAAuJ;AACvJ,qBAAa,aAAa;IASlB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO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