happy2 0.0.12 → 0.0.14

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 (520) hide show
  1. package/package.json +2 -2
  2. package/packages/happy2-server/PLUGINS.md +281 -39
  3. package/packages/happy2-server/README.md +8 -7
  4. package/packages/happy2-server/dist/index.d.ts +3 -1
  5. package/packages/happy2-server/dist/index.d.ts.map +1 -1
  6. package/packages/happy2-server/dist/index.js +2 -0
  7. package/packages/happy2-server/dist/index.js.map +1 -1
  8. package/packages/happy2-server/dist/modules/agent/agentChatBind.d.ts +1 -0
  9. package/packages/happy2-server/dist/modules/agent/agentChatBind.d.ts.map +1 -1
  10. package/packages/happy2-server/dist/modules/agent/agentChatBind.js +4 -0
  11. package/packages/happy2-server/dist/modules/agent/agentChatBind.js.map +1 -1
  12. package/packages/happy2-server/dist/modules/agent/agentChatGetContext.d.ts.map +1 -1
  13. package/packages/happy2-server/dist/modules/agent/agentChatGetContext.js +3 -1
  14. package/packages/happy2-server/dist/modules/agent/agentChatGetContext.js.map +1 -1
  15. package/packages/happy2-server/dist/modules/agent/agentCreate.d.ts.map +1 -1
  16. package/packages/happy2-server/dist/modules/agent/agentCreate.js +1 -0
  17. package/packages/happy2-server/dist/modules/agent/agentCreate.js.map +1 -1
  18. package/packages/happy2-server/dist/modules/agent/agentEffortBindingList.d.ts +4 -2
  19. package/packages/happy2-server/dist/modules/agent/agentEffortBindingList.d.ts.map +1 -1
  20. package/packages/happy2-server/dist/modules/agent/agentEffortBindingList.js +8 -8
  21. package/packages/happy2-server/dist/modules/agent/agentEffortBindingList.js.map +1 -1
  22. package/packages/happy2-server/dist/modules/agent/agentEffortGetContext.d.ts +3 -3
  23. package/packages/happy2-server/dist/modules/agent/agentEffortGetContext.d.ts.map +1 -1
  24. package/packages/happy2-server/dist/modules/agent/agentEffortGetContext.js +4 -4
  25. package/packages/happy2-server/dist/modules/agent/agentEffortGetContext.js.map +1 -1
  26. package/packages/happy2-server/dist/modules/agent/agentEffortUpdate.d.ts +4 -4
  27. package/packages/happy2-server/dist/modules/agent/agentEffortUpdate.d.ts.map +1 -1
  28. package/packages/happy2-server/dist/modules/agent/agentEffortUpdate.js +57 -41
  29. package/packages/happy2-server/dist/modules/agent/agentEffortUpdate.js.map +1 -1
  30. package/packages/happy2-server/dist/modules/agent/agentImageCommitChange.d.ts +1 -1
  31. package/packages/happy2-server/dist/modules/agent/agentImageCommitChange.js +3 -3
  32. package/packages/happy2-server/dist/modules/agent/agentImageCommitChange.js.map +1 -1
  33. package/packages/happy2-server/dist/modules/agent/agentImageCreate.d.ts +1 -1
  34. package/packages/happy2-server/dist/modules/agent/agentImageCreate.js +3 -3
  35. package/packages/happy2-server/dist/modules/agent/agentImageCreate.js.map +1 -1
  36. package/packages/happy2-server/dist/modules/agent/agentImageGet.d.ts +1 -1
  37. package/packages/happy2-server/dist/modules/agent/agentImageGet.js +3 -3
  38. package/packages/happy2-server/dist/modules/agent/agentImageGet.js.map +1 -1
  39. package/packages/happy2-server/dist/modules/agent/agentImageGetChangeContext.d.ts +2 -1
  40. package/packages/happy2-server/dist/modules/agent/agentImageGetChangeContext.d.ts.map +1 -1
  41. package/packages/happy2-server/dist/modules/agent/agentImageGetChangeContext.js +11 -4
  42. package/packages/happy2-server/dist/modules/agent/agentImageGetChangeContext.js.map +1 -1
  43. package/packages/happy2-server/dist/modules/agent/agentImageList.d.ts +2 -2
  44. package/packages/happy2-server/dist/modules/agent/agentImageList.d.ts.map +1 -1
  45. package/packages/happy2-server/dist/modules/agent/agentImageList.js +8 -4
  46. package/packages/happy2-server/dist/modules/agent/agentImageList.js.map +1 -1
  47. package/packages/happy2-server/dist/modules/agent/agentImageRequestBuild.d.ts +1 -1
  48. package/packages/happy2-server/dist/modules/agent/agentImageRequestBuild.js +3 -3
  49. package/packages/happy2-server/dist/modules/agent/agentImageRequestBuild.js.map +1 -1
  50. package/packages/happy2-server/dist/modules/agent/agentImageSetDefault.d.ts +1 -1
  51. package/packages/happy2-server/dist/modules/agent/agentImageSetDefault.js +3 -3
  52. package/packages/happy2-server/dist/modules/agent/agentImageSetDefault.js.map +1 -1
  53. package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentDelete.d.ts +1 -1
  54. package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentDelete.js +3 -3
  55. package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentDelete.js.map +1 -1
  56. package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentList.d.ts +1 -1
  57. package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentList.js +3 -3
  58. package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentList.js.map +1 -1
  59. package/packages/happy2-server/dist/modules/agent/agentSecretAttachToAgent.d.ts +1 -1
  60. package/packages/happy2-server/dist/modules/agent/agentSecretAttachToAgent.js +3 -3
  61. package/packages/happy2-server/dist/modules/agent/agentSecretAttachToAgent.js.map +1 -1
  62. package/packages/happy2-server/dist/modules/agent/agentSecretAttachToChannel.d.ts +1 -1
  63. package/packages/happy2-server/dist/modules/agent/agentSecretAttachToChannel.js +3 -3
  64. package/packages/happy2-server/dist/modules/agent/agentSecretAttachToChannel.js.map +1 -1
  65. package/packages/happy2-server/dist/modules/agent/agentSecretAuthorizeManagement.d.ts +4 -3
  66. package/packages/happy2-server/dist/modules/agent/agentSecretAuthorizeManagement.d.ts.map +1 -1
  67. package/packages/happy2-server/dist/modules/agent/agentSecretAuthorizeManagement.js +5 -5
  68. package/packages/happy2-server/dist/modules/agent/agentSecretAuthorizeManagement.js.map +1 -1
  69. package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromAgent.d.ts +1 -1
  70. package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromAgent.js +3 -3
  71. package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromAgent.js.map +1 -1
  72. package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromChannel.d.ts +2 -2
  73. package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromChannel.js +4 -4
  74. package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromChannel.js.map +1 -1
  75. package/packages/happy2-server/dist/modules/agent/agentSecretRecordRegistration.d.ts +1 -1
  76. package/packages/happy2-server/dist/modules/agent/agentSecretRecordRegistration.js +3 -3
  77. package/packages/happy2-server/dist/modules/agent/agentSecretRecordRegistration.js.map +1 -1
  78. package/packages/happy2-server/dist/modules/agent/agentSkillHomeGet.d.ts +4 -0
  79. package/packages/happy2-server/dist/modules/agent/agentSkillHomeGet.d.ts.map +1 -0
  80. package/packages/happy2-server/dist/modules/agent/agentSkillHomeGet.js +15 -0
  81. package/packages/happy2-server/dist/modules/agent/agentSkillHomeGet.js.map +1 -0
  82. package/packages/happy2-server/dist/modules/agent/agentSkillHomeGet.test.d.ts +2 -0
  83. package/packages/happy2-server/dist/modules/agent/agentSkillHomeGet.test.d.ts.map +1 -0
  84. package/packages/happy2-server/dist/modules/agent/agentSkillHomeGet.test.js +17 -0
  85. package/packages/happy2-server/dist/modules/agent/agentSkillHomeGet.test.js.map +1 -0
  86. package/packages/happy2-server/dist/modules/agent/agentTurnGetPluginContext.d.ts +23 -0
  87. package/packages/happy2-server/dist/modules/agent/agentTurnGetPluginContext.d.ts.map +1 -0
  88. package/packages/happy2-server/dist/modules/agent/agentTurnGetPluginContext.js +70 -0
  89. package/packages/happy2-server/dist/modules/agent/agentTurnGetPluginContext.js.map +1 -0
  90. package/packages/happy2-server/dist/modules/agent/agentTurnStreamReply.d.ts +4 -0
  91. package/packages/happy2-server/dist/modules/agent/agentTurnStreamReply.d.ts.map +1 -1
  92. package/packages/happy2-server/dist/modules/agent/agentTurnStreamReply.js +207 -9
  93. package/packages/happy2-server/dist/modules/agent/agentTurnStreamReply.js.map +1 -1
  94. package/packages/happy2-server/dist/modules/agent/agentTurnTraceGet.d.ts +8 -0
  95. package/packages/happy2-server/dist/modules/agent/agentTurnTraceGet.d.ts.map +1 -0
  96. package/packages/happy2-server/dist/modules/agent/agentTurnTraceGet.js +86 -0
  97. package/packages/happy2-server/dist/modules/agent/agentTurnTraceGet.js.map +1 -0
  98. package/packages/happy2-server/dist/modules/agent/agentTurnTraceStart.d.ts +19 -0
  99. package/packages/happy2-server/dist/modules/agent/agentTurnTraceStart.d.ts.map +1 -0
  100. package/packages/happy2-server/dist/modules/agent/agentTurnTraceStart.js +87 -0
  101. package/packages/happy2-server/dist/modules/agent/agentTurnTraceStart.js.map +1 -0
  102. package/packages/happy2-server/dist/modules/agent/impl/agentChatContext.d.ts +2 -1
  103. package/packages/happy2-server/dist/modules/agent/impl/agentChatContext.d.ts.map +1 -1
  104. package/packages/happy2-server/dist/modules/agent/impl/agentEffortContext.d.ts +4 -1
  105. package/packages/happy2-server/dist/modules/agent/impl/agentEffortContext.d.ts.map +1 -1
  106. package/packages/happy2-server/dist/modules/agent/impl/agentEffortContextDb.d.ts +3 -3
  107. package/packages/happy2-server/dist/modules/agent/impl/agentEffortContextDb.d.ts.map +1 -1
  108. package/packages/happy2-server/dist/modules/agent/impl/agentEffortContextDb.js +26 -40
  109. package/packages/happy2-server/dist/modules/agent/impl/agentEffortContextDb.js.map +1 -1
  110. package/packages/happy2-server/dist/modules/agent/impl/finishAgentTurn.d.ts.map +1 -1
  111. package/packages/happy2-server/dist/modules/agent/impl/finishAgentTurn.js +63 -2
  112. package/packages/happy2-server/dist/modules/agent/impl/finishAgentTurn.js.map +1 -1
  113. package/packages/happy2-server/dist/modules/agent/types.d.ts +53 -0
  114. package/packages/happy2-server/dist/modules/agent/types.d.ts.map +1 -1
  115. package/packages/happy2-server/dist/modules/agents/daemon.d.ts +31 -2
  116. package/packages/happy2-server/dist/modules/agents/daemon.d.ts.map +1 -1
  117. package/packages/happy2-server/dist/modules/agents/daemon.js +12 -2
  118. package/packages/happy2-server/dist/modules/agents/daemon.js.map +1 -1
  119. package/packages/happy2-server/dist/modules/agents/service.d.ts +11 -6
  120. package/packages/happy2-server/dist/modules/agents/service.d.ts.map +1 -1
  121. package/packages/happy2-server/dist/modules/agents/service.js +498 -50
  122. package/packages/happy2-server/dist/modules/agents/service.js.map +1 -1
  123. package/packages/happy2-server/dist/modules/auth/developmentTokenCreate.d.ts +12 -0
  124. package/packages/happy2-server/dist/modules/auth/developmentTokenCreate.d.ts.map +1 -0
  125. package/packages/happy2-server/dist/modules/auth/developmentTokenCreate.js +27 -0
  126. package/packages/happy2-server/dist/modules/auth/developmentTokenCreate.js.map +1 -0
  127. package/packages/happy2-server/dist/modules/auth/developmentTokenFindActive.d.ts +8 -0
  128. package/packages/happy2-server/dist/modules/auth/developmentTokenFindActive.d.ts.map +1 -0
  129. package/packages/happy2-server/dist/modules/auth/developmentTokenFindActive.js +22 -0
  130. package/packages/happy2-server/dist/modules/auth/developmentTokenFindActive.js.map +1 -0
  131. package/packages/happy2-server/dist/modules/auth/methods.d.ts +1 -0
  132. package/packages/happy2-server/dist/modules/auth/methods.d.ts.map +1 -1
  133. package/packages/happy2-server/dist/modules/auth/methods.js +10 -6
  134. package/packages/happy2-server/dist/modules/auth/methods.js.map +1 -1
  135. package/packages/happy2-server/dist/modules/auth/service.d.ts +2 -0
  136. package/packages/happy2-server/dist/modules/auth/service.d.ts.map +1 -1
  137. package/packages/happy2-server/dist/modules/auth/service.js +26 -0
  138. package/packages/happy2-server/dist/modules/auth/service.js.map +1 -1
  139. package/packages/happy2-server/dist/modules/auth/tokens.d.ts +21 -0
  140. package/packages/happy2-server/dist/modules/auth/tokens.d.ts.map +1 -1
  141. package/packages/happy2-server/dist/modules/auth/tokens.js +97 -3
  142. package/packages/happy2-server/dist/modules/auth/tokens.js.map +1 -1
  143. package/packages/happy2-server/dist/modules/auth/tokens.test.js +77 -0
  144. package/packages/happy2-server/dist/modules/auth/tokens.test.js.map +1 -1
  145. package/packages/happy2-server/dist/modules/chat/asAgentTurnTrace.d.ts +17 -0
  146. package/packages/happy2-server/dist/modules/chat/asAgentTurnTrace.d.ts.map +1 -0
  147. package/packages/happy2-server/dist/modules/chat/asAgentTurnTrace.js +98 -0
  148. package/packages/happy2-server/dist/modules/chat/asAgentTurnTrace.js.map +1 -0
  149. package/packages/happy2-server/dist/modules/chat/asServiceMessage.d.ts.map +1 -1
  150. package/packages/happy2-server/dist/modules/chat/asServiceMessage.js +13 -5
  151. package/packages/happy2-server/dist/modules/chat/asServiceMessage.js.map +1 -1
  152. package/packages/happy2-server/dist/modules/chat/channelCreateWithMembers.d.ts +19 -0
  153. package/packages/happy2-server/dist/modules/chat/channelCreateWithMembers.d.ts.map +1 -0
  154. package/packages/happy2-server/dist/modules/chat/channelCreateWithMembers.js +87 -0
  155. package/packages/happy2-server/dist/modules/chat/channelCreateWithMembers.js.map +1 -0
  156. package/packages/happy2-server/dist/modules/chat/channelMembersUpdate.d.ts +15 -0
  157. package/packages/happy2-server/dist/modules/chat/channelMembersUpdate.d.ts.map +1 -0
  158. package/packages/happy2-server/dist/modules/chat/channelMembersUpdate.js +38 -0
  159. package/packages/happy2-server/dist/modules/chat/channelMembersUpdate.js.map +1 -0
  160. package/packages/happy2-server/dist/modules/chat/chatAppendAudit.d.ts +1 -1
  161. package/packages/happy2-server/dist/modules/chat/chatAppendAudit.d.ts.map +1 -1
  162. package/packages/happy2-server/dist/modules/chat/chatUpdateMetadata.d.ts +20 -0
  163. package/packages/happy2-server/dist/modules/chat/chatUpdateMetadata.d.ts.map +1 -0
  164. package/packages/happy2-server/dist/modules/chat/chatUpdateMetadata.js +38 -0
  165. package/packages/happy2-server/dist/modules/chat/chatUpdateMetadata.js.map +1 -0
  166. package/packages/happy2-server/dist/modules/chat/types.d.ts +6 -0
  167. package/packages/happy2-server/dist/modules/chat/types.d.ts.map +1 -1
  168. package/packages/happy2-server/dist/modules/chat/types.js.map +1 -1
  169. package/packages/happy2-server/dist/modules/chat/userRequireActiveHuman.d.ts +7 -0
  170. package/packages/happy2-server/dist/modules/chat/userRequireActiveHuman.d.ts.map +1 -0
  171. package/packages/happy2-server/dist/modules/chat/userRequireActiveHuman.js +19 -0
  172. package/packages/happy2-server/dist/modules/chat/userRequireActiveHuman.js.map +1 -0
  173. package/packages/happy2-server/dist/modules/chat/userRequireServerAdmin.d.ts +2 -2
  174. package/packages/happy2-server/dist/modules/chat/userRequireServerAdmin.d.ts.map +1 -1
  175. package/packages/happy2-server/dist/modules/chat/userRequireServerAdmin.js +8 -5
  176. package/packages/happy2-server/dist/modules/chat/userRequireServerAdmin.js.map +1 -1
  177. package/packages/happy2-server/dist/modules/config/defaults.d.ts.map +1 -1
  178. package/packages/happy2-server/dist/modules/config/defaults.js +1 -0
  179. package/packages/happy2-server/dist/modules/config/defaults.js.map +1 -1
  180. package/packages/happy2-server/dist/modules/config/defaults.test.js +1 -0
  181. package/packages/happy2-server/dist/modules/config/defaults.test.js.map +1 -1
  182. package/packages/happy2-server/dist/modules/config/loader.d.ts.map +1 -1
  183. package/packages/happy2-server/dist/modules/config/loader.js +4 -0
  184. package/packages/happy2-server/dist/modules/config/loader.js.map +1 -1
  185. package/packages/happy2-server/dist/modules/config/loader.test.js +12 -0
  186. package/packages/happy2-server/dist/modules/config/loader.test.js.map +1 -1
  187. package/packages/happy2-server/dist/modules/config/type.d.ts +3 -0
  188. package/packages/happy2-server/dist/modules/config/type.d.ts.map +1 -1
  189. package/packages/happy2-server/dist/modules/message/messageGetProjection.d.ts.map +1 -1
  190. package/packages/happy2-server/dist/modules/message/messageGetProjection.js +28 -0
  191. package/packages/happy2-server/dist/modules/message/messageGetProjection.js.map +1 -1
  192. package/packages/happy2-server/dist/modules/permission/impl/permissionEffectiveDb.d.ts +4 -0
  193. package/packages/happy2-server/dist/modules/permission/impl/permissionEffectiveDb.d.ts.map +1 -0
  194. package/packages/happy2-server/dist/modules/permission/impl/permissionEffectiveDb.js +39 -0
  195. package/packages/happy2-server/dist/modules/permission/impl/permissionEffectiveDb.js.map +1 -0
  196. package/packages/happy2-server/dist/modules/permission/impl/permissionMutationRecord.d.ts +10 -0
  197. package/packages/happy2-server/dist/modules/permission/impl/permissionMutationRecord.d.ts.map +1 -0
  198. package/packages/happy2-server/dist/modules/permission/impl/permissionMutationRecord.js +31 -0
  199. package/packages/happy2-server/dist/modules/permission/impl/permissionMutationRecord.js.map +1 -0
  200. package/packages/happy2-server/dist/modules/permission/permissionGetEffective.d.ts +8 -0
  201. package/packages/happy2-server/dist/modules/permission/permissionGetEffective.d.ts.map +1 -0
  202. package/packages/happy2-server/dist/modules/permission/permissionGetEffective.js +13 -0
  203. package/packages/happy2-server/dist/modules/permission/permissionGetEffective.js.map +1 -0
  204. package/packages/happy2-server/dist/modules/permission/roleCreate.d.ts +16 -0
  205. package/packages/happy2-server/dist/modules/permission/roleCreate.d.ts.map +1 -0
  206. package/packages/happy2-server/dist/modules/permission/roleCreate.js +70 -0
  207. package/packages/happy2-server/dist/modules/permission/roleCreate.js.map +1 -0
  208. package/packages/happy2-server/dist/modules/permission/roleDelete.d.ts +11 -0
  209. package/packages/happy2-server/dist/modules/permission/roleDelete.d.ts.map +1 -0
  210. package/packages/happy2-server/dist/modules/permission/roleDelete.js +41 -0
  211. package/packages/happy2-server/dist/modules/permission/roleDelete.js.map +1 -0
  212. package/packages/happy2-server/dist/modules/permission/roleList.d.ts +8 -0
  213. package/packages/happy2-server/dist/modules/permission/roleList.d.ts.map +1 -0
  214. package/packages/happy2-server/dist/modules/permission/roleList.js +36 -0
  215. package/packages/happy2-server/dist/modules/permission/roleList.js.map +1 -0
  216. package/packages/happy2-server/dist/modules/permission/roleUpdate.d.ts +14 -0
  217. package/packages/happy2-server/dist/modules/permission/roleUpdate.d.ts.map +1 -0
  218. package/packages/happy2-server/dist/modules/permission/roleUpdate.js +78 -0
  219. package/packages/happy2-server/dist/modules/permission/roleUpdate.js.map +1 -0
  220. package/packages/happy2-server/dist/modules/permission/types.d.ts +24 -0
  221. package/packages/happy2-server/dist/modules/permission/types.d.ts.map +1 -0
  222. package/packages/happy2-server/dist/modules/permission/types.js +10 -0
  223. package/packages/happy2-server/dist/modules/permission/types.js.map +1 -0
  224. package/packages/happy2-server/dist/modules/permission/userPermissionGet.d.ts +16 -0
  225. package/packages/happy2-server/dist/modules/permission/userPermissionGet.d.ts.map +1 -0
  226. package/packages/happy2-server/dist/modules/permission/userPermissionGet.js +33 -0
  227. package/packages/happy2-server/dist/modules/permission/userPermissionGet.js.map +1 -0
  228. package/packages/happy2-server/dist/modules/permission/userPermissionUpdate.d.ts +12 -0
  229. package/packages/happy2-server/dist/modules/permission/userPermissionUpdate.d.ts.map +1 -0
  230. package/packages/happy2-server/dist/modules/permission/userPermissionUpdate.js +44 -0
  231. package/packages/happy2-server/dist/modules/permission/userPermissionUpdate.js.map +1 -0
  232. package/packages/happy2-server/dist/modules/permission/userRequireAnyPermission.d.ts +8 -0
  233. package/packages/happy2-server/dist/modules/permission/userRequireAnyPermission.d.ts.map +1 -0
  234. package/packages/happy2-server/dist/modules/permission/userRequireAnyPermission.js +12 -0
  235. package/packages/happy2-server/dist/modules/permission/userRequireAnyPermission.js.map +1 -0
  236. package/packages/happy2-server/dist/modules/permission/userRequirePermission.d.ts +8 -0
  237. package/packages/happy2-server/dist/modules/permission/userRequirePermission.d.ts.map +1 -0
  238. package/packages/happy2-server/dist/modules/permission/userRequirePermission.js +12 -0
  239. package/packages/happy2-server/dist/modules/permission/userRequirePermission.js.map +1 -0
  240. package/packages/happy2-server/dist/modules/permission/userRoleAssign.d.ts +12 -0
  241. package/packages/happy2-server/dist/modules/permission/userRoleAssign.d.ts.map +1 -0
  242. package/packages/happy2-server/dist/modules/permission/userRoleAssign.js +46 -0
  243. package/packages/happy2-server/dist/modules/permission/userRoleAssign.js.map +1 -0
  244. package/packages/happy2-server/dist/modules/permission/userRoleUnassign.d.ts +12 -0
  245. package/packages/happy2-server/dist/modules/permission/userRoleUnassign.d.ts.map +1 -0
  246. package/packages/happy2-server/dist/modules/permission/userRoleUnassign.js +53 -0
  247. package/packages/happy2-server/dist/modules/permission/userRoleUnassign.js.map +1 -0
  248. package/packages/happy2-server/dist/modules/plugin/archive.d.ts +7 -0
  249. package/packages/happy2-server/dist/modules/plugin/archive.d.ts.map +1 -0
  250. package/packages/happy2-server/dist/modules/plugin/archive.js +222 -0
  251. package/packages/happy2-server/dist/modules/plugin/archive.js.map +1 -0
  252. package/packages/happy2-server/dist/modules/plugin/catalog.d.ts +5 -1
  253. package/packages/happy2-server/dist/modules/plugin/catalog.d.ts.map +1 -1
  254. package/packages/happy2-server/dist/modules/plugin/catalog.js +35 -16
  255. package/packages/happy2-server/dist/modules/plugin/catalog.js.map +1 -1
  256. package/packages/happy2-server/dist/modules/plugin/catalog.test.js +6 -2
  257. package/packages/happy2-server/dist/modules/plugin/catalog.test.js.map +1 -1
  258. package/packages/happy2-server/dist/modules/plugin/httpBridge.d.ts +1 -0
  259. package/packages/happy2-server/dist/modules/plugin/httpBridge.d.ts.map +1 -1
  260. package/packages/happy2-server/dist/modules/plugin/httpBridge.js +7 -0
  261. package/packages/happy2-server/dist/modules/plugin/httpBridge.js.map +1 -1
  262. package/packages/happy2-server/dist/modules/plugin/impl/apiPermissions.d.ts +5 -0
  263. package/packages/happy2-server/dist/modules/plugin/impl/apiPermissions.d.ts.map +1 -0
  264. package/packages/happy2-server/dist/modules/plugin/impl/apiPermissions.js +106 -0
  265. package/packages/happy2-server/dist/modules/plugin/impl/apiPermissions.js.map +1 -0
  266. package/packages/happy2-server/dist/modules/plugin/impl/asInstallation.d.ts.map +1 -1
  267. package/packages/happy2-server/dist/modules/plugin/impl/asInstallation.js +12 -2
  268. package/packages/happy2-server/dist/modules/plugin/impl/asInstallation.js.map +1 -1
  269. package/packages/happy2-server/dist/modules/plugin/impl/asManagementRequest.d.ts +3 -0
  270. package/packages/happy2-server/dist/modules/plugin/impl/asManagementRequest.d.ts.map +1 -0
  271. package/packages/happy2-server/dist/modules/plugin/impl/asManagementRequest.js +68 -0
  272. package/packages/happy2-server/dist/modules/plugin/impl/asManagementRequest.js.map +1 -0
  273. package/packages/happy2-server/dist/modules/plugin/impl/asPlugin.d.ts.map +1 -1
  274. package/packages/happy2-server/dist/modules/plugin/impl/asPlugin.js +12 -3
  275. package/packages/happy2-server/dist/modules/plugin/impl/asPlugin.js.map +1 -1
  276. package/packages/happy2-server/dist/modules/plugin/impl/installationSelection.d.ts +19 -0
  277. package/packages/happy2-server/dist/modules/plugin/impl/installationSelection.d.ts.map +1 -1
  278. package/packages/happy2-server/dist/modules/plugin/impl/installationSelection.js +1 -0
  279. package/packages/happy2-server/dist/modules/plugin/impl/installationSelection.js.map +1 -1
  280. package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.d.ts.map +1 -1
  281. package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.js +4 -2
  282. package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.js.map +1 -1
  283. package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.test.js +14 -0
  284. package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.test.js.map +1 -1
  285. package/packages/happy2-server/dist/modules/plugin/impl/managementRequestSelection.d.ts +345 -0
  286. package/packages/happy2-server/dist/modules/plugin/impl/managementRequestSelection.d.ts.map +1 -0
  287. package/packages/happy2-server/dist/modules/plugin/impl/managementRequestSelection.js +22 -0
  288. package/packages/happy2-server/dist/modules/plugin/impl/managementRequestSelection.js.map +1 -0
  289. package/packages/happy2-server/dist/modules/plugin/impl/pluginSkillSource.d.ts +11 -0
  290. package/packages/happy2-server/dist/modules/plugin/impl/pluginSkillSource.d.ts.map +1 -0
  291. package/packages/happy2-server/dist/modules/plugin/impl/pluginSkillSource.js +2 -0
  292. package/packages/happy2-server/dist/modules/plugin/impl/pluginSkillSource.js.map +1 -0
  293. package/packages/happy2-server/dist/modules/plugin/packageLinkDownloader.d.ts +16 -0
  294. package/packages/happy2-server/dist/modules/plugin/packageLinkDownloader.d.ts.map +1 -0
  295. package/packages/happy2-server/dist/modules/plugin/packageLinkDownloader.js +67 -0
  296. package/packages/happy2-server/dist/modules/plugin/packageLinkDownloader.js.map +1 -0
  297. package/packages/happy2-server/dist/modules/plugin/packageStore.d.ts +27 -1
  298. package/packages/happy2-server/dist/modules/plugin/packageStore.d.ts.map +1 -1
  299. package/packages/happy2-server/dist/modules/plugin/packageStore.js +234 -15
  300. package/packages/happy2-server/dist/modules/plugin/packageStore.js.map +1 -1
  301. package/packages/happy2-server/dist/modules/plugin/packageStore.test.d.ts +2 -0
  302. package/packages/happy2-server/dist/modules/plugin/packageStore.test.d.ts.map +1 -0
  303. package/packages/happy2-server/dist/modules/plugin/packageStore.test.js +50 -0
  304. package/packages/happy2-server/dist/modules/plugin/packageStore.test.js.map +1 -0
  305. package/packages/happy2-server/dist/modules/plugin/pluginAgentCallContextGet.d.ts +5 -0
  306. package/packages/happy2-server/dist/modules/plugin/pluginAgentCallContextGet.d.ts.map +1 -0
  307. package/packages/happy2-server/dist/modules/plugin/pluginAgentCallContextGet.js +26 -0
  308. package/packages/happy2-server/dist/modules/plugin/pluginAgentCallContextGet.js.map +1 -0
  309. package/packages/happy2-server/dist/modules/plugin/pluginAuthorizeManagement.d.ts +1 -1
  310. package/packages/happy2-server/dist/modules/plugin/pluginAuthorizeManagement.js +3 -3
  311. package/packages/happy2-server/dist/modules/plugin/pluginAuthorizeManagement.js.map +1 -1
  312. package/packages/happy2-server/dist/modules/plugin/pluginCatalogList.d.ts.map +1 -1
  313. package/packages/happy2-server/dist/modules/plugin/pluginCatalogList.js +7 -3
  314. package/packages/happy2-server/dist/modules/plugin/pluginCatalogList.js.map +1 -1
  315. package/packages/happy2-server/dist/modules/plugin/pluginDeveloperServer.test.d.ts +2 -0
  316. package/packages/happy2-server/dist/modules/plugin/pluginDeveloperServer.test.d.ts.map +1 -0
  317. package/packages/happy2-server/dist/modules/plugin/pluginDeveloperServer.test.js +44 -0
  318. package/packages/happy2-server/dist/modules/plugin/pluginDeveloperServer.test.js.map +1 -0
  319. package/packages/happy2-server/dist/modules/plugin/pluginFindBySource.d.ts +3 -1
  320. package/packages/happy2-server/dist/modules/plugin/pluginFindBySource.d.ts.map +1 -1
  321. package/packages/happy2-server/dist/modules/plugin/pluginFindBySource.js +1 -1
  322. package/packages/happy2-server/dist/modules/plugin/pluginFindBySource.js.map +1 -1
  323. package/packages/happy2-server/dist/modules/plugin/pluginGetImage.d.ts +1 -1
  324. package/packages/happy2-server/dist/modules/plugin/pluginGetImage.js +3 -3
  325. package/packages/happy2-server/dist/modules/plugin/pluginGetImage.js.map +1 -1
  326. package/packages/happy2-server/dist/modules/plugin/pluginGetSource.d.ts +13 -0
  327. package/packages/happy2-server/dist/modules/plugin/pluginGetSource.d.ts.map +1 -0
  328. package/packages/happy2-server/dist/modules/plugin/pluginGetSource.js +37 -0
  329. package/packages/happy2-server/dist/modules/plugin/pluginGetSource.js.map +1 -0
  330. package/packages/happy2-server/dist/modules/plugin/pluginInstall.d.ts +4 -2
  331. package/packages/happy2-server/dist/modules/plugin/pluginInstall.d.ts.map +1 -1
  332. package/packages/happy2-server/dist/modules/plugin/pluginInstall.js +36 -5
  333. package/packages/happy2-server/dist/modules/plugin/pluginInstall.js.map +1 -1
  334. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetContainerName.d.ts +7 -0
  335. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetContainerName.d.ts.map +1 -0
  336. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetContainerName.js +18 -0
  337. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetContainerName.js.map +1 -0
  338. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRequestUninstallContext.d.ts +13 -0
  339. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRequestUninstallContext.d.ts.map +1 -0
  340. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRequestUninstallContext.js +35 -0
  341. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRequestUninstallContext.js.map +1 -0
  342. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRuntimeConfiguration.d.ts.map +1 -1
  343. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRuntimeConfiguration.js +3 -1
  344. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRuntimeConfiguration.js.map +1 -1
  345. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetUninstallContext.d.ts +6 -0
  346. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetUninstallContext.d.ts.map +1 -0
  347. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetUninstallContext.js +17 -0
  348. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetUninstallContext.js.map +1 -0
  349. package/packages/happy2-server/dist/modules/plugin/pluginInstallationList.d.ts +1 -1
  350. package/packages/happy2-server/dist/modules/plugin/pluginInstallationList.js +3 -3
  351. package/packages/happy2-server/dist/modules/plugin/pluginInstallationList.js.map +1 -1
  352. package/packages/happy2-server/dist/modules/plugin/pluginInstallationPermissionsUpdate.d.ts +18 -0
  353. package/packages/happy2-server/dist/modules/plugin/pluginInstallationPermissionsUpdate.d.ts.map +1 -0
  354. package/packages/happy2-server/dist/modules/plugin/pluginInstallationPermissionsUpdate.js +92 -0
  355. package/packages/happy2-server/dist/modules/plugin/pluginInstallationPermissionsUpdate.js.map +1 -0
  356. package/packages/happy2-server/dist/modules/plugin/pluginInstallationUninstall.d.ts +16 -0
  357. package/packages/happy2-server/dist/modules/plugin/pluginInstallationUninstall.d.ts.map +1 -0
  358. package/packages/happy2-server/dist/modules/plugin/pluginInstallationUninstall.js +71 -0
  359. package/packages/happy2-server/dist/modules/plugin/pluginInstallationUninstall.js.map +1 -0
  360. package/packages/happy2-server/dist/modules/plugin/pluginList.d.ts +1 -1
  361. package/packages/happy2-server/dist/modules/plugin/pluginList.js +3 -3
  362. package/packages/happy2-server/dist/modules/plugin/pluginList.js.map +1 -1
  363. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestBeginInstall.d.ts +21 -0
  364. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestBeginInstall.d.ts.map +1 -0
  365. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestBeginInstall.js +71 -0
  366. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestBeginInstall.js.map +1 -0
  367. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestBeginUninstall.d.ts +12 -0
  368. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestBeginUninstall.d.ts.map +1 -0
  369. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestBeginUninstall.js +56 -0
  370. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestBeginUninstall.js.map +1 -0
  371. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCompleteInstall.d.ts +11 -0
  372. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCompleteInstall.d.ts.map +1 -0
  373. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCompleteInstall.js +44 -0
  374. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCompleteInstall.js.map +1 -0
  375. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCompleteUninstall.d.ts +10 -0
  376. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCompleteUninstall.d.ts.map +1 -0
  377. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCompleteUninstall.js +41 -0
  378. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCompleteUninstall.js.map +1 -0
  379. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCreateInstall.d.ts +26 -0
  380. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCreateInstall.d.ts.map +1 -0
  381. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCreateInstall.js +78 -0
  382. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCreateInstall.js.map +1 -0
  383. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCreateUninstall.d.ts +25 -0
  384. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCreateUninstall.d.ts.map +1 -0
  385. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCreateUninstall.js +76 -0
  386. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCreateUninstall.js.map +1 -0
  387. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestDeny.d.ts +11 -0
  388. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestDeny.d.ts.map +1 -0
  389. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestDeny.js +48 -0
  390. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestDeny.js.map +1 -0
  391. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestGetPackage.d.ts +12 -0
  392. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestGetPackage.d.ts.map +1 -0
  393. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestGetPackage.js +42 -0
  394. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestGetPackage.js.map +1 -0
  395. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestList.d.ts +5 -0
  396. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestList.d.ts.map +1 -0
  397. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestList.js +18 -0
  398. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestList.js.map +1 -0
  399. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestListTerminalIds.d.ts +4 -0
  400. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestListTerminalIds.d.ts.map +1 -0
  401. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestListTerminalIds.js +11 -0
  402. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestListTerminalIds.js.map +1 -0
  403. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestRecoverProcessing.d.ts +5 -0
  404. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestRecoverProcessing.d.ts.map +1 -0
  405. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestRecoverProcessing.js +75 -0
  406. package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestRecoverProcessing.js.map +1 -0
  407. package/packages/happy2-server/dist/modules/plugin/pluginSkillPackageListReady.d.ts +12 -0
  408. package/packages/happy2-server/dist/modules/plugin/pluginSkillPackageListReady.d.ts.map +1 -0
  409. package/packages/happy2-server/dist/modules/plugin/pluginSkillPackageListReady.js +33 -0
  410. package/packages/happy2-server/dist/modules/plugin/pluginSkillPackageListReady.js.map +1 -0
  411. package/packages/happy2-server/dist/modules/plugin/pluginSkillsListInstalled.d.ts +8 -0
  412. package/packages/happy2-server/dist/modules/plugin/pluginSkillsListInstalled.d.ts.map +1 -0
  413. package/packages/happy2-server/dist/modules/plugin/pluginSkillsListInstalled.js +24 -0
  414. package/packages/happy2-server/dist/modules/plugin/pluginSkillsListInstalled.js.map +1 -0
  415. package/packages/happy2-server/dist/modules/plugin/pluginSkillsListReady.d.ts +8 -0
  416. package/packages/happy2-server/dist/modules/plugin/pluginSkillsListReady.d.ts.map +1 -0
  417. package/packages/happy2-server/dist/modules/plugin/pluginSkillsListReady.js +25 -0
  418. package/packages/happy2-server/dist/modules/plugin/pluginSkillsListReady.js.map +1 -0
  419. package/packages/happy2-server/dist/modules/plugin/pluginUninstall.d.ts +13 -0
  420. package/packages/happy2-server/dist/modules/plugin/pluginUninstall.d.ts.map +1 -0
  421. package/packages/happy2-server/dist/modules/plugin/pluginUninstall.js +63 -0
  422. package/packages/happy2-server/dist/modules/plugin/pluginUninstall.js.map +1 -0
  423. package/packages/happy2-server/dist/modules/plugin/runtime.d.ts +1 -0
  424. package/packages/happy2-server/dist/modules/plugin/runtime.d.ts.map +1 -1
  425. package/packages/happy2-server/dist/modules/plugin/runtime.js +1 -0
  426. package/packages/happy2-server/dist/modules/plugin/runtime.js.map +1 -1
  427. package/packages/happy2-server/dist/modules/plugin/service.d.ts +157 -5
  428. package/packages/happy2-server/dist/modules/plugin/service.d.ts.map +1 -1
  429. package/packages/happy2-server/dist/modules/plugin/service.js +789 -19
  430. package/packages/happy2-server/dist/modules/plugin/service.js.map +1 -1
  431. package/packages/happy2-server/dist/modules/plugin/source.d.ts +35 -0
  432. package/packages/happy2-server/dist/modules/plugin/source.d.ts.map +1 -0
  433. package/packages/happy2-server/dist/modules/plugin/source.js +189 -0
  434. package/packages/happy2-server/dist/modules/plugin/source.js.map +1 -0
  435. package/packages/happy2-server/dist/modules/plugin/types.d.ts +116 -11
  436. package/packages/happy2-server/dist/modules/plugin/types.d.ts.map +1 -1
  437. package/packages/happy2-server/dist/modules/plugin/types.js +9 -0
  438. package/packages/happy2-server/dist/modules/plugin/types.js.map +1 -1
  439. package/packages/happy2-server/dist/modules/realtime/events.d.ts +3 -0
  440. package/packages/happy2-server/dist/modules/realtime/events.d.ts.map +1 -1
  441. package/packages/happy2-server/dist/modules/realtime/events.js +37 -5
  442. package/packages/happy2-server/dist/modules/realtime/events.js.map +1 -1
  443. package/packages/happy2-server/dist/modules/realtime/local.test.js +2 -0
  444. package/packages/happy2-server/dist/modules/realtime/local.test.js.map +1 -1
  445. package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.d.ts.map +1 -1
  446. package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.js +4 -2
  447. package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.js.map +1 -1
  448. package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.test.js +4 -1
  449. package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.test.js.map +1 -1
  450. package/packages/happy2-server/dist/modules/sandbox/types.d.ts +1 -0
  451. package/packages/happy2-server/dist/modules/sandbox/types.d.ts.map +1 -1
  452. package/packages/happy2-server/dist/modules/schema.d.ts +8024 -5446
  453. package/packages/happy2-server/dist/modules/schema.d.ts.map +1 -1
  454. package/packages/happy2-server/dist/modules/schema.js +140 -0
  455. package/packages/happy2-server/dist/modules/schema.js.map +1 -1
  456. package/packages/happy2-server/dist/modules/sync/syncGetDifference.d.ts.map +1 -1
  457. package/packages/happy2-server/dist/modules/sync/syncGetDifference.js +2 -0
  458. package/packages/happy2-server/dist/modules/sync/syncGetDifference.js.map +1 -1
  459. package/packages/happy2-server/dist/modules/user/userAdministrationList.js +2 -2
  460. package/packages/happy2-server/dist/modules/user/userAdministrationList.js.map +1 -1
  461. package/packages/happy2-server/dist/modules/user/userAdministrationUpdate.d.ts.map +1 -1
  462. package/packages/happy2-server/dist/modules/user/userAdministrationUpdate.js +49 -6
  463. package/packages/happy2-server/dist/modules/user/userAdministrationUpdate.js.map +1 -1
  464. package/packages/happy2-server/dist/modules/user/userCreateProfile.d.ts.map +1 -1
  465. package/packages/happy2-server/dist/modules/user/userCreateProfile.js +17 -2
  466. package/packages/happy2-server/dist/modules/user/userCreateProfile.js.map +1 -1
  467. package/packages/happy2-server/dist/routes/agents.d.ts.map +1 -1
  468. package/packages/happy2-server/dist/routes/agents.js +4 -2
  469. package/packages/happy2-server/dist/routes/agents.js.map +1 -1
  470. package/packages/happy2-server/dist/routes/auth.d.ts.map +1 -1
  471. package/packages/happy2-server/dist/routes/auth.js +12 -0
  472. package/packages/happy2-server/dist/routes/auth.js.map +1 -1
  473. package/packages/happy2-server/dist/routes/collaboration.d.ts.map +1 -1
  474. package/packages/happy2-server/dist/routes/collaboration.js +7 -0
  475. package/packages/happy2-server/dist/routes/collaboration.js.map +1 -1
  476. package/packages/happy2-server/dist/routes/files.d.ts.map +1 -1
  477. package/packages/happy2-server/dist/routes/files.js +2 -0
  478. package/packages/happy2-server/dist/routes/files.js.map +1 -1
  479. package/packages/happy2-server/dist/routes/permissions.d.ts +6 -0
  480. package/packages/happy2-server/dist/routes/permissions.d.ts.map +1 -0
  481. package/packages/happy2-server/dist/routes/permissions.js +207 -0
  482. package/packages/happy2-server/dist/routes/permissions.js.map +1 -0
  483. package/packages/happy2-server/dist/routes/pluginHost.d.ts +2 -1
  484. package/packages/happy2-server/dist/routes/pluginHost.d.ts.map +1 -1
  485. package/packages/happy2-server/dist/routes/pluginHost.js +356 -5
  486. package/packages/happy2-server/dist/routes/pluginHost.js.map +1 -1
  487. package/packages/happy2-server/dist/routes/plugins.d.ts.map +1 -1
  488. package/packages/happy2-server/dist/routes/plugins.js +375 -7
  489. package/packages/happy2-server/dist/routes/plugins.js.map +1 -1
  490. package/packages/happy2-server/dist/server.d.ts +4 -0
  491. package/packages/happy2-server/dist/server.d.ts.map +1 -1
  492. package/packages/happy2-server/dist/server.js +12 -7
  493. package/packages/happy2-server/dist/server.js.map +1 -1
  494. package/packages/happy2-server/dist/web/assets/index-Dn5SZu3y.js +39 -0
  495. package/packages/happy2-server/dist/web/assets/index-Dys3sWv8.css +2 -0
  496. package/packages/happy2-server/dist/web/index.html +2 -2
  497. package/packages/happy2-server/drizzle/0023_roles_and_permissions.sql +82 -0
  498. package/packages/happy2-server/drizzle/0024_session_bound_dev_tokens.sql +11 -0
  499. package/packages/happy2-server/drizzle/0025_plugin_skills.sql +8 -0
  500. package/packages/happy2-server/drizzle/0026_agent_turn_traces.sql +35 -0
  501. package/packages/happy2-server/drizzle/0027_chat_agent_effort.sql +9 -0
  502. package/packages/happy2-server/drizzle/0028_plugin_api_permissions.sql +1 -0
  503. package/packages/happy2-server/drizzle/0029_plugin_management_requests.sql +35 -0
  504. package/packages/happy2-server/drizzle/meta/_journal.json +49 -0
  505. package/packages/happy2-server/happy2.example.toml +6 -0
  506. package/packages/happy2-server/plugins/README.md +7 -1
  507. package/packages/happy2-server/plugins/chat-management/container/Dockerfile +6 -0
  508. package/packages/happy2-server/plugins/chat-management/plugin.json +17 -0
  509. package/packages/happy2-server/plugins/chat-management/plugin.png +0 -0
  510. package/packages/happy2-server/plugins/chat-management/server.mjs +280 -0
  511. package/packages/happy2-server/plugins/plugin-developer/container/Dockerfile +6 -0
  512. package/packages/happy2-server/plugins/plugin-developer/plugin.json +17 -0
  513. package/packages/happy2-server/plugins/plugin-developer/plugin.png +0 -0
  514. package/packages/happy2-server/plugins/plugin-developer/server.mjs +155 -0
  515. package/packages/happy2-server/plugins/plugin-developer/skills/happy2-plugin-development/SKILL.md +59 -0
  516. package/packages/happy2-server/plugins/plugin-developer/skills/happy2-plugin-development/references/host-api.md +63 -0
  517. package/packages/happy2-server/plugins/plugin-developer/skills/happy2-plugin-development/references/installing.md +86 -0
  518. package/packages/happy2-server/plugins/plugin-developer/skills/happy2-plugin-development/references/package-format.md +137 -0
  519. package/packages/happy2-server/dist/web/assets/index-9SGCQLg7.js +0 -46
  520. package/packages/happy2-server/dist/web/assets/index-DWXBQDJB.css +0 -2
@@ -1 +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"}
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,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAE/E,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,qBAAqB,CAAC,QAAQ,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC;IACpE,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,18 @@
1
+ import type { DrizzleExecutor } from "../drizzle.js";
2
+ import type { MutationHint } from "../chat/types.js";
3
+ import type { PluginHostPermission, PluginInstallationSummary } from "./types.js";
4
+ /**
5
+ * Replaces one pluginInstallations row's user-approved API grants while enforcing its immutable manifest declarations.
6
+ * A changed grant set invalidates the current container incarnation and queues runtime reactivation in the same audited sync transaction so old tokens stop authorizing immediately.
7
+ */
8
+ export declare function pluginInstallationPermissionsUpdate(executor: DrizzleExecutor, input: {
9
+ actorUserId: string;
10
+ installationId: string;
11
+ permissions: readonly PluginHostPermission[];
12
+ }): Promise<{
13
+ changed: boolean;
14
+ containerName?: string;
15
+ hint?: MutationHint;
16
+ installation: PluginInstallationSummary;
17
+ }>;
18
+ //# sourceMappingURL=pluginInstallationPermissionsUpdate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginInstallationPermissionsUpdate.d.ts","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginInstallationPermissionsUpdate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAIrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAKrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAQlF;;;GAGG;AACH,wBAAsB,mCAAmC,CACrD,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,SAAS,oBAAoB,EAAE,CAAC;CAChD,GACF,OAAO,CAAC;IACP,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,YAAY,EAAE,yBAAyB,CAAC;CAC3C,CAAC,CAoED"}
@@ -0,0 +1,92 @@
1
+ import { eq, sql } from "drizzle-orm";
2
+ import { withTransaction } from "../drizzle.js";
3
+ import { chatAppendAudit } from "../chat/chatAppendAudit.js";
4
+ import { areaHint } from "../chat/areaHint.js";
5
+ import { userRequirePermission } from "../permission/userRequirePermission.js";
6
+ import { pluginInstallations, plugins } from "../schema.js";
7
+ import { syncEventInsert } from "../sync/syncEventInsert.js";
8
+ import { syncSequenceNext } from "../sync/syncSequenceNext.js";
9
+ import { PluginError } from "./types.js";
10
+ import { asPluginInstallation } from "./impl/asInstallation.js";
11
+ import { effectiveContainer } from "./impl/effectiveContainer.js";
12
+ import { installedManifest } from "./impl/installedManifest.js";
13
+ import { pluginInstallationSelection } from "./impl/installationSelection.js";
14
+ import { pluginPermissionsParse, pluginPermissionsValidate } from "./impl/apiPermissions.js";
15
+ /**
16
+ * Replaces one pluginInstallations row's user-approved API grants while enforcing its immutable manifest declarations.
17
+ * A changed grant set invalidates the current container incarnation and queues runtime reactivation in the same audited sync transaction so old tokens stop authorizing immediately.
18
+ */
19
+ export async function pluginInstallationPermissionsUpdate(executor, input) {
20
+ return withTransaction(executor, async (tx) => {
21
+ await userRequirePermission(tx, input.actorUserId, "managePlugins");
22
+ const [current] = await tx
23
+ .select({
24
+ ...pluginInstallationSelection,
25
+ manifestJson: plugins.manifestJson,
26
+ containerName: pluginInstallations.containerName,
27
+ })
28
+ .from(pluginInstallations)
29
+ .innerJoin(plugins, eq(pluginInstallations.pluginId, plugins.id))
30
+ .where(eq(pluginInstallations.id, input.installationId))
31
+ .limit(1);
32
+ if (!current)
33
+ throw new PluginError("not_found", "Plugin installation was not found");
34
+ const manifest = installedManifest(current.manifestJson);
35
+ const declared = effectiveContainer(manifest)?.permissions ?? [];
36
+ const granted = pluginPermissionsValidate(input.permissions, declared);
37
+ const before = pluginPermissionsParse(current.grantedPermissionsJson);
38
+ if (samePermissions(before, granted))
39
+ return {
40
+ changed: false,
41
+ ...(current.containerName ? { containerName: current.containerName } : {}),
42
+ installation: asPluginInstallation(current),
43
+ };
44
+ const sequence = await syncSequenceNext(tx);
45
+ await tx
46
+ .update(pluginInstallations)
47
+ .set({
48
+ grantedPermissionsJson: JSON.stringify(granted),
49
+ status: current.containerName ? "preparing" : current.status,
50
+ statusDetail: current.containerName
51
+ ? "Plugin runtime is queued to apply changed API permissions."
52
+ : current.statusDetail,
53
+ containerInstanceId: null,
54
+ syncSequence: sequence,
55
+ updatedAt: sql `CURRENT_TIMESTAMP`,
56
+ readyAt: current.containerName ? null : current.readyAt,
57
+ })
58
+ .where(eq(pluginInstallations.id, input.installationId));
59
+ await chatAppendAudit(tx, {
60
+ actorUserId: input.actorUserId,
61
+ action: "plugin.permissions_updated",
62
+ targetType: "plugin_installation",
63
+ targetId: input.installationId,
64
+ before: { grantedPermissions: before },
65
+ after: { grantedPermissions: granted },
66
+ });
67
+ await syncEventInsert(tx, {
68
+ sequence,
69
+ kind: "plugin.permissions_updated",
70
+ entityId: input.installationId,
71
+ actorUserId: input.actorUserId,
72
+ });
73
+ const [updated] = await tx
74
+ .select(pluginInstallationSelection)
75
+ .from(pluginInstallations)
76
+ .innerJoin(plugins, eq(pluginInstallations.pluginId, plugins.id))
77
+ .where(eq(pluginInstallations.id, input.installationId))
78
+ .limit(1);
79
+ if (!updated)
80
+ throw new Error("Plugin installation disappeared after permission update");
81
+ return {
82
+ changed: true,
83
+ ...(current.containerName ? { containerName: current.containerName } : {}),
84
+ hint: areaHint(sequence, "plugins"),
85
+ installation: asPluginInstallation(updated),
86
+ };
87
+ });
88
+ }
89
+ function samePermissions(left, right) {
90
+ return left.length === right.length && left.every((permission) => right.includes(permission));
91
+ }
92
+ //# sourceMappingURL=pluginInstallationPermissionsUpdate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginInstallationPermissionsUpdate.js","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginInstallationPermissionsUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,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,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,iBAAiB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EAAE;YACtB,QAAQ;YACR,IAAI,EAAE,4BAA4B;YAClC,QAAQ,EAAE,KAAK,CAAC,cAAc;YAC9B,WAAW,EAAE,KAAK,CAAC,WAAW;SACjC,CAAC,CAAC;QACH,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,EAAE;aACrB,MAAM,CAAC,2BAA2B,CAAC;aACnC,IAAI,CAAC,mBAAmB,CAAC;aACzB,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;aAChE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;aACvD,KAAK,CAAC,CAAC,CAAC,CAAC;QACd,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;QACzF,OAAO;YACH,OAAO,EAAE,IAAI;YACb,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1E,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;YACnC,YAAY,EAAE,oBAAoB,CAAC,OAAO,CAAC;SAC9C,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,eAAe,CACpB,IAAqC,EACrC,KAAsC;IAEtC,OAAO,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;AAClG,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { DrizzleExecutor } from "../drizzle.js";
2
+ import type { MutationHint } from "../chat/types.js";
3
+ /**
4
+ * Deletes one authorized plugin installation and its cascade-owned state, removing the plugin row when no installation remains.
5
+ * The transaction records actor provenance and a plugins sync event after PluginService has stopped process/container resources.
6
+ */
7
+ export declare function pluginInstallationUninstall(executor: DrizzleExecutor, input: {
8
+ installationId: string;
9
+ actorUserId?: string;
10
+ actorInstallationId?: string;
11
+ }): Promise<{
12
+ hint: MutationHint;
13
+ pluginId: string;
14
+ pluginRemoved: boolean;
15
+ }>;
16
+ //# sourceMappingURL=pluginInstallationUninstall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginInstallationUninstall.d.ts","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginInstallationUninstall.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAIrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOrD;;;GAGG;AACH,wBAAsB,2BAA2B,CAC7C,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC,GACF,OAAO,CAAC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAAE,CAAC,CAqD3E"}
@@ -0,0 +1,71 @@
1
+ import { eq } from "drizzle-orm";
2
+ import { withTransaction } from "../drizzle.js";
3
+ import { chatAppendAudit } from "../chat/chatAppendAudit.js";
4
+ import { areaHint } from "../chat/areaHint.js";
5
+ import { userRequirePermission } from "../permission/userRequirePermission.js";
6
+ import { pluginInstallations, plugins } from "../schema.js";
7
+ import { syncEventInsert } from "../sync/syncEventInsert.js";
8
+ import { syncSequenceNext } from "../sync/syncSequenceNext.js";
9
+ import { PluginError } from "./types.js";
10
+ /**
11
+ * Deletes one authorized plugin installation and its cascade-owned state, removing the plugin row when no installation remains.
12
+ * The transaction records actor provenance and a plugins sync event after PluginService has stopped process/container resources.
13
+ */
14
+ export async function pluginInstallationUninstall(executor, input) {
15
+ return withTransaction(executor, async (tx) => {
16
+ if (input.actorUserId)
17
+ await userRequirePermission(tx, input.actorUserId, "managePlugins");
18
+ else if (!input.actorInstallationId)
19
+ throw new PluginError("forbidden", "Plugin installation authority is required");
20
+ const [installation] = await tx
21
+ .select({
22
+ id: pluginInstallations.id,
23
+ pluginId: pluginInstallations.pluginId,
24
+ shortName: plugins.shortName,
25
+ sourceVersion: plugins.sourceVersion,
26
+ })
27
+ .from(pluginInstallations)
28
+ .innerJoin(plugins, eq(pluginInstallations.pluginId, plugins.id))
29
+ .where(eq(pluginInstallations.id, input.installationId))
30
+ .limit(1);
31
+ if (!installation)
32
+ throw new PluginError("not_found", "Plugin installation was not found");
33
+ await tx
34
+ .delete(pluginInstallations)
35
+ .where(eq(pluginInstallations.id, input.installationId));
36
+ const [remaining] = await tx
37
+ .select({ id: pluginInstallations.id })
38
+ .from(pluginInstallations)
39
+ .where(eq(pluginInstallations.pluginId, installation.pluginId))
40
+ .limit(1);
41
+ const pluginRemoved = !remaining;
42
+ if (pluginRemoved)
43
+ await tx.delete(plugins).where(eq(plugins.id, installation.pluginId));
44
+ await chatAppendAudit(tx, {
45
+ actorUserId: input.actorUserId,
46
+ action: "plugin.uninstalled",
47
+ targetType: "plugin_installation",
48
+ targetId: input.installationId,
49
+ before: {
50
+ pluginId: installation.pluginId,
51
+ shortName: installation.shortName,
52
+ actorInstallationId: input.actorInstallationId,
53
+ version: installation.sourceVersion,
54
+ },
55
+ after: { pluginRemoved },
56
+ });
57
+ const sequence = await syncSequenceNext(tx);
58
+ await syncEventInsert(tx, {
59
+ sequence,
60
+ kind: "plugin.uninstalled",
61
+ entityId: input.installationId,
62
+ actorUserId: input.actorUserId,
63
+ });
64
+ return {
65
+ hint: areaHint(sequence, "plugins"),
66
+ pluginId: installation.pluginId,
67
+ pluginRemoved,
68
+ };
69
+ });
70
+ }
71
+ //# sourceMappingURL=pluginInstallationUninstall.js.map
@@ -0,0 +1 @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AAa;aACtC;YACD,KAAK,EAAE,EAAE,aAAa,EAAE;SAC3B,CAAC,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,EAAE,CAAC,CAAC;QAC5C,MAAM,eAAe,CAAC,EAAE,EAAE;YACtB,QAAQ;YACR,IAAI,EAAE,oBAAoB;YAC1B,QAAQ,EAAE,KAAK,CAAC,cAAc;YAC9B,WAAW,EAAE,KAAK,CAAC,WAAW;SACjC,CAAC,CAAC;QACH,OAAO;YACH,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;YACnC,QAAQ,EAAE,YAAY,CAAC,QAAQ;YAC/B,aAAa;SAChB,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import type { DrizzleExecutor } from "../drizzle.js";
2
2
  import type { SystemPluginSummary } from "./types.js";
3
3
  /**
4
- * Lists durable system plugins and their persisted package-image metadata for an active server administrator.
4
+ * Lists durable system plugins and package-image metadata after requiring managePlugins permission.
5
5
  * This read-only boundary does not mutate durable state and keeps catalog packages distinct from reusable installed plugin identities.
6
6
  */
7
7
  export declare function pluginList(executor: DrizzleExecutor, actorUserId: string): Promise<SystemPluginSummary[]>;
@@ -1,13 +1,13 @@
1
1
  import { plugins } from "../schema.js";
2
- import { userRequireServerAdmin } from "../chat/userRequireServerAdmin.js";
2
+ import { userRequirePermission } from "../permission/userRequirePermission.js";
3
3
  import { asSystemPlugin } from "./impl/asPlugin.js";
4
4
  import { pluginSelection } from "./impl/pluginSelection.js";
5
5
  /**
6
- * Lists durable system plugins and their persisted package-image metadata for an active server administrator.
6
+ * Lists durable system plugins and package-image metadata after requiring managePlugins permission.
7
7
  * This read-only boundary does not mutate durable state and keeps catalog packages distinct from reusable installed plugin identities.
8
8
  */
9
9
  export async function pluginList(executor, actorUserId) {
10
- await userRequireServerAdmin(executor, actorUserId);
10
+ await userRequirePermission(executor, actorUserId, "managePlugins");
11
11
  const rows = await executor
12
12
  .select(pluginSelection)
13
13
  .from(plugins)
@@ -1 +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"}
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,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,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,qBAAqB,CAAC,QAAQ,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC;IACpE,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,21 @@
1
+ import type { DrizzleExecutor } from "../drizzle.js";
2
+ import type { MutationHint } from "../chat/types.js";
3
+ import { type PluginSource } from "./types.js";
4
+ export interface PluginManagementRequestInstallWork {
5
+ id: string;
6
+ chatId: string;
7
+ installationId: string;
8
+ packageDigest: string;
9
+ packageDirectory: string;
10
+ source: Extract<PluginSource, {
11
+ kind: "archive" | "link";
12
+ }>;
13
+ hint: MutationHint;
14
+ }
15
+ /** Claims one pending pluginManagementRequests install by changing it to processing for an active chat-member administrator. This durable state boundary serializes approval before filesystem and runtime side effects begin. */
16
+ export declare function pluginManagementRequestBeginInstall(executor: DrizzleExecutor, input: {
17
+ actorUserId: string;
18
+ chatId: string;
19
+ requestId: string;
20
+ }): Promise<PluginManagementRequestInstallWork>;
21
+ //# sourceMappingURL=pluginManagementRequestBeginInstall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginManagementRequestBeginInstall.d.ts","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginManagementRequestBeginInstall.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIrD,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5D,MAAM,WAAW,kCAAkC;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC,YAAY,EAAE;QAAE,IAAI,EAAE,SAAS,GAAG,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5D,IAAI,EAAE,YAAY,CAAC;CACtB;AAED,kOAAkO;AAClO,wBAAsB,mCAAmC,CACrD,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAClE,OAAO,CAAC,kCAAkC,CAAC,CA6E7C"}
@@ -0,0 +1,71 @@
1
+ import { and, eq, sql } from "drizzle-orm";
2
+ import { withTransaction } from "../drizzle.js";
3
+ import { chatGetAccess } from "../chat/chatGetAccess.js";
4
+ import { chatAdvanceWithSequence } from "../chat/chatAdvanceWithSequence.js";
5
+ import { chatHint } from "../chat/chatHint.js";
6
+ import { userRequireServerAdmin } from "../chat/userRequireServerAdmin.js";
7
+ import { pluginManagementRequests } from "../schema.js";
8
+ import { syncSequenceNext } from "../sync/syncSequenceNext.js";
9
+ import { PluginError } from "./types.js";
10
+ /** Claims one pending pluginManagementRequests install by changing it to processing for an active chat-member administrator. This durable state boundary serializes approval before filesystem and runtime side effects begin. */
11
+ export async function pluginManagementRequestBeginInstall(executor, input) {
12
+ return withTransaction(executor, async (tx) => {
13
+ await userRequireServerAdmin(tx, input.actorUserId);
14
+ if (!(await chatGetAccess(tx, input.actorUserId, input.chatId, true)))
15
+ throw new PluginError("forbidden", "Chat membership is required");
16
+ const [row] = await tx
17
+ .select({
18
+ id: pluginManagementRequests.id,
19
+ action: pluginManagementRequests.action,
20
+ status: pluginManagementRequests.status,
21
+ chatId: pluginManagementRequests.chatId,
22
+ sourceKind: pluginManagementRequests.sourceKind,
23
+ sourceReference: pluginManagementRequests.sourceReference,
24
+ packageDigest: pluginManagementRequests.packageDigest,
25
+ packageDirectory: pluginManagementRequests.packageDirectory,
26
+ installationId: pluginManagementRequests.installationId,
27
+ })
28
+ .from(pluginManagementRequests)
29
+ .where(and(eq(pluginManagementRequests.id, input.requestId), eq(pluginManagementRequests.chatId, input.chatId)))
30
+ .limit(1);
31
+ if (!row)
32
+ throw new PluginError("not_found", "Plugin management request was not found");
33
+ if (row.action !== "install")
34
+ throw new PluginError("conflict", "Request is not an install");
35
+ if (row.status !== "pending")
36
+ throw new PluginError("conflict", `Plugin request is already ${row.status}`);
37
+ if ((row.sourceKind !== "archive" && row.sourceKind !== "link") ||
38
+ !row.sourceReference ||
39
+ !row.packageDigest ||
40
+ !row.packageDirectory ||
41
+ !row.installationId)
42
+ throw new Error("Plugin install request has incomplete package metadata");
43
+ const updated = await tx
44
+ .update(pluginManagementRequests)
45
+ .set({
46
+ status: "processing",
47
+ resolvedByUserId: input.actorUserId,
48
+ updatedAt: sql `CURRENT_TIMESTAMP`,
49
+ })
50
+ .where(and(eq(pluginManagementRequests.id, input.requestId), eq(pluginManagementRequests.status, "pending")))
51
+ .returning({ id: pluginManagementRequests.id });
52
+ if (updated.length !== 1)
53
+ throw new PluginError("conflict", "Plugin request was already resolved");
54
+ const sequence = await syncSequenceNext(tx);
55
+ await tx
56
+ .update(pluginManagementRequests)
57
+ .set({ syncSequence: sequence })
58
+ .where(eq(pluginManagementRequests.id, input.requestId));
59
+ const mutation = await chatAdvanceWithSequence(tx, sequence, input.actorUserId, input.chatId, "plugin.install_processing", input.requestId);
60
+ return {
61
+ id: row.id,
62
+ chatId: row.chatId,
63
+ installationId: row.installationId,
64
+ packageDigest: row.packageDigest,
65
+ packageDirectory: row.packageDirectory,
66
+ source: { kind: row.sourceKind, reference: row.sourceReference },
67
+ hint: chatHint(sequence, input.chatId, mutation.pts),
68
+ };
69
+ });
70
+ }
71
+ //# sourceMappingURL=pluginManagementRequestBeginInstall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginManagementRequestBeginInstall.js","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginManagementRequestBeginInstall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,E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,EAAE,EAAE,CAAC,CAAC;QACpD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YACpB,MAAM,IAAI,WAAW,CAAC,UAAU,EAAE,qCAAqC,CAAC,CAAC;QAC7E,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,EAAE,CAAC,CAAC;QAC5C,MAAM,EAAE;aACH,MAAM,CAAC,wBAAwB,CAAC;aAChC,GAAG,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC;aAC/B,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAAC,EAAE,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAC7D,MAAM,QAAQ,GAAG,MAAM,uBAAuB,CAC1C,EAAE,EACF,QAAQ,EACR,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,MAAM,EACZ,2BAA2B,EAC3B,KAAK,CAAC,SAAS,CAClB,CAAC;QACF,OAAO;YACH,EAAE,EAAE,GAAG,CAAC,EAAE;YACV,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,cAAc,EAAE,GAAG,CAAC,cAAc;YAClC,aAAa,EAAE,GAAG,CAAC,aAAa;YAChC,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;YACtC,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,CAAC,eAAe,EAAE;YAChE,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC;SACvD,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { DrizzleExecutor } from "../drizzle.js";
2
+ import type { MutationHint } from "../chat/types.js";
3
+ /** Claims one pending pluginManagementRequests uninstall by changing it to processing for a chat-member administrator. This durable state boundary serializes approval and returns the exact installation target for runtime removal. */
4
+ export declare function pluginManagementRequestBeginUninstall(executor: DrizzleExecutor, input: {
5
+ actorUserId: string;
6
+ chatId: string;
7
+ requestId: string;
8
+ }): Promise<{
9
+ targetInstallationId: string;
10
+ hint: MutationHint;
11
+ }>;
12
+ //# sourceMappingURL=pluginManagementRequestBeginUninstall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginManagementRequestBeginUninstall.d.ts","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginManagementRequestBeginUninstall.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAMrD,yOAAyO;AACzO,wBAAsB,qCAAqC,CACvD,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAClE,OAAO,CAAC;IAAE,oBAAoB,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC,CA2D/D"}
@@ -0,0 +1,56 @@
1
+ import { and, eq, sql } from "drizzle-orm";
2
+ import { withTransaction } from "../drizzle.js";
3
+ import { chatGetAccess } from "../chat/chatGetAccess.js";
4
+ import { chatAdvanceWithSequence } from "../chat/chatAdvanceWithSequence.js";
5
+ import { chatHint } from "../chat/chatHint.js";
6
+ import { userRequireServerAdmin } from "../chat/userRequireServerAdmin.js";
7
+ import { pluginManagementRequests } from "../schema.js";
8
+ import { syncSequenceNext } from "../sync/syncSequenceNext.js";
9
+ import { PluginError } from "./types.js";
10
+ /** Claims one pending pluginManagementRequests uninstall by changing it to processing for a chat-member administrator. This durable state boundary serializes approval and returns the exact installation target for runtime removal. */
11
+ export async function pluginManagementRequestBeginUninstall(executor, input) {
12
+ return withTransaction(executor, async (tx) => {
13
+ await userRequireServerAdmin(tx, input.actorUserId);
14
+ if (!(await chatGetAccess(tx, input.actorUserId, input.chatId, true)))
15
+ throw new PluginError("forbidden", "Chat membership is required");
16
+ const [row] = await tx
17
+ .select({
18
+ action: pluginManagementRequests.action,
19
+ status: pluginManagementRequests.status,
20
+ targetInstallationId: pluginManagementRequests.targetInstallationId,
21
+ })
22
+ .from(pluginManagementRequests)
23
+ .where(and(eq(pluginManagementRequests.id, input.requestId), eq(pluginManagementRequests.chatId, input.chatId)))
24
+ .limit(1);
25
+ if (!row)
26
+ throw new PluginError("not_found", "Plugin management request was not found");
27
+ if (row.action !== "uninstall")
28
+ throw new PluginError("conflict", "Request is not an uninstall");
29
+ if (row.status !== "pending")
30
+ throw new PluginError("conflict", `Plugin request is already ${row.status}`);
31
+ if (!row.targetInstallationId)
32
+ throw new Error("Plugin uninstall request has no target");
33
+ const updated = await tx
34
+ .update(pluginManagementRequests)
35
+ .set({
36
+ status: "processing",
37
+ resolvedByUserId: input.actorUserId,
38
+ updatedAt: sql `CURRENT_TIMESTAMP`,
39
+ })
40
+ .where(and(eq(pluginManagementRequests.id, input.requestId), eq(pluginManagementRequests.status, "pending")))
41
+ .returning({ id: pluginManagementRequests.id });
42
+ if (updated.length !== 1)
43
+ throw new PluginError("conflict", "Plugin request was already resolved");
44
+ const sequence = await syncSequenceNext(tx);
45
+ await tx
46
+ .update(pluginManagementRequests)
47
+ .set({ syncSequence: sequence })
48
+ .where(eq(pluginManagementRequests.id, input.requestId));
49
+ const mutation = await chatAdvanceWithSequence(tx, sequence, input.actorUserId, input.chatId, "plugin.uninstall_processing", input.requestId);
50
+ return {
51
+ targetInstallationId: row.targetInstallationId,
52
+ hint: chatHint(sequence, input.chatId, mutation.pts),
53
+ };
54
+ });
55
+ }
56
+ //# sourceMappingURL=pluginManagementRequestBeginUninstall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginManagementRequestBeginUninstall.js","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginManagementRequestBeginUninstall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa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AC;QAC7D,MAAM,QAAQ,GAAG,MAAM,uBAAuB,CAC1C,EAAE,EACF,QAAQ,EACR,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,MAAM,EACZ,6BAA6B,EAC7B,KAAK,CAAC,SAAS,CAClB,CAAC;QACF,OAAO;YACH,oBAAoB,EAAE,GAAG,CAAC,oBAAoB;YAC9C,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC;SACvD,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { DrizzleExecutor } from "../drizzle.js";
2
+ import type { MutationHint } from "../chat/types.js";
3
+ /** Finalizes a claimed pluginManagementRequests install as approved or failed and advances the originating chats point in one transaction. This completion boundary makes the runtime outcome, audit evidence, and reactive card resolution converge durably. */
4
+ export declare function pluginManagementRequestCompleteInstall(executor: DrizzleExecutor, input: {
5
+ actorUserId: string;
6
+ requestId: string;
7
+ chatId: string;
8
+ installationId: string;
9
+ error?: string;
10
+ }): Promise<MutationHint>;
11
+ //# sourceMappingURL=pluginManagementRequestCompleteInstall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginManagementRequestCompleteInstall.d.ts","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginManagementRequestCompleteInstall.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIrD,iQAAiQ;AACjQ,wBAAsB,sCAAsC,CACxD,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,GACF,OAAO,CAAC,YAAY,CAAC,CA+CvB"}
@@ -0,0 +1,44 @@
1
+ import { and, eq, sql } from "drizzle-orm";
2
+ import { withTransaction } from "../drizzle.js";
3
+ import { chatAdvanceWithSequence } from "../chat/chatAdvanceWithSequence.js";
4
+ import { chatAppendAudit } from "../chat/chatAppendAudit.js";
5
+ import { chatHint } from "../chat/chatHint.js";
6
+ import { pluginManagementRequests } from "../schema.js";
7
+ import { syncSequenceNext } from "../sync/syncSequenceNext.js";
8
+ /** Finalizes a claimed pluginManagementRequests install as approved or failed and advances the originating chats point in one transaction. This completion boundary makes the runtime outcome, audit evidence, and reactive card resolution converge durably. */
9
+ export async function pluginManagementRequestCompleteInstall(executor, input) {
10
+ return withTransaction(executor, async (tx) => {
11
+ const status = input.error ? "failed" : "approved";
12
+ const updated = await tx
13
+ .update(pluginManagementRequests)
14
+ .set({
15
+ status,
16
+ lastError: input.error,
17
+ resolvedAt: sql `CURRENT_TIMESTAMP`,
18
+ updatedAt: sql `CURRENT_TIMESTAMP`,
19
+ })
20
+ .where(and(eq(pluginManagementRequests.id, input.requestId), eq(pluginManagementRequests.chatId, input.chatId), eq(pluginManagementRequests.status, "processing"), eq(pluginManagementRequests.installationId, input.installationId)))
21
+ .returning({ id: pluginManagementRequests.id });
22
+ if (updated.length !== 1)
23
+ throw new Error("Claimed plugin install request was not found");
24
+ await chatAppendAudit(tx, {
25
+ actorUserId: input.actorUserId,
26
+ action: input.error ? "plugin.install_failed" : "plugin.install_approved",
27
+ targetType: "plugin_management_request",
28
+ targetId: input.requestId,
29
+ chatId: input.chatId,
30
+ after: {
31
+ installationId: input.installationId,
32
+ ...(input.error ? { error: input.error } : {}),
33
+ },
34
+ });
35
+ const sequence = await syncSequenceNext(tx);
36
+ await tx
37
+ .update(pluginManagementRequests)
38
+ .set({ syncSequence: sequence })
39
+ .where(eq(pluginManagementRequests.id, input.requestId));
40
+ const mutation = await chatAdvanceWithSequence(tx, sequence, input.actorUserId, input.chatId, input.error ? "plugin.install_failed" : "plugin.install_approved", input.requestId);
41
+ return chatHint(sequence, input.chatId, mutation.pts);
42
+ });
43
+ }
44
+ //# sourceMappingURL=pluginManagementRequestCompleteInstall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginManagementRequestCompleteInstall.js","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginManagementRequestCompleteInstall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,iQAAiQ;AACjQ,MAAM,CAAC,KAAK,UAAU,sCAAsC,CACxD,QAAyB,EACzB,KAMC;IAED,OAAO,eAAe,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;QAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC;QACnD,MAAM,OAAO,GAAG,MAAM,EAAE;aACnB,MAAM,CAAC,wBAAwB,CAAC;aAChC,GAAG,CAAC;YACD,MAAM;YACN,SAAS,EAAE,KAAK,CAAC,KAAK;YACtB,UAAU,EAAE,GAAG,CAAA,mBAAmB;YAClC,SAAS,EAAE,GAAG,CAAA,mBAAmB;SACpC,CAAC;aACD,KAAK,CACF,GAAG,CACC,EAAE,CAAC,wBAAwB,CAAC,EAAE,EAAE,KAAK,CAAC,SAAS,CAAC,EAChD,EAAE,CAAC,wBAAwB,CAAC,MAAM,EAAE,KAAK,CAAC,M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yB,EACjE,KAAK,CAAC,SAAS,CAClB,CAAC;QACF,OAAO,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { DrizzleExecutor } from "../drizzle.js";
2
+ import type { MutationHint } from "../chat/types.js";
3
+ /** Finalizes a claimed pluginManagementRequests uninstall as approved or failed and advances the originating chats point in one transaction. This completion boundary records the runtime-removal outcome with audit and reactive card evidence. */
4
+ export declare function pluginManagementRequestCompleteUninstall(executor: DrizzleExecutor, input: {
5
+ actorUserId: string;
6
+ chatId: string;
7
+ requestId: string;
8
+ error?: string;
9
+ }): Promise<MutationHint>;
10
+ //# sourceMappingURL=pluginManagementRequestCompleteUninstall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginManagementRequestCompleteUninstall.d.ts","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginManagementRequestCompleteUninstall.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIrD,oPAAoP;AACpP,wBAAsB,wCAAwC,CAC1D,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAClF,OAAO,CAAC,YAAY,CAAC,CA2CvB"}
@@ -0,0 +1,41 @@
1
+ import { and, eq, sql } from "drizzle-orm";
2
+ import { withTransaction } from "../drizzle.js";
3
+ import { chatAdvanceWithSequence } from "../chat/chatAdvanceWithSequence.js";
4
+ import { chatAppendAudit } from "../chat/chatAppendAudit.js";
5
+ import { chatHint } from "../chat/chatHint.js";
6
+ import { pluginManagementRequests } from "../schema.js";
7
+ import { syncSequenceNext } from "../sync/syncSequenceNext.js";
8
+ /** Finalizes a claimed pluginManagementRequests uninstall as approved or failed and advances the originating chats point in one transaction. This completion boundary records the runtime-removal outcome with audit and reactive card evidence. */
9
+ export async function pluginManagementRequestCompleteUninstall(executor, input) {
10
+ return withTransaction(executor, async (tx) => {
11
+ const status = input.error ? "failed" : "approved";
12
+ const updated = await tx
13
+ .update(pluginManagementRequests)
14
+ .set({
15
+ status,
16
+ lastError: input.error,
17
+ resolvedAt: sql `CURRENT_TIMESTAMP`,
18
+ updatedAt: sql `CURRENT_TIMESTAMP`,
19
+ })
20
+ .where(and(eq(pluginManagementRequests.id, input.requestId), eq(pluginManagementRequests.chatId, input.chatId), eq(pluginManagementRequests.status, "processing")))
21
+ .returning({ id: pluginManagementRequests.id });
22
+ if (updated.length !== 1)
23
+ throw new Error("Claimed plugin uninstall request was not found");
24
+ await chatAppendAudit(tx, {
25
+ actorUserId: input.actorUserId,
26
+ action: input.error ? "plugin.uninstall_failed" : "plugin.uninstall_approved",
27
+ targetType: "plugin_management_request",
28
+ targetId: input.requestId,
29
+ chatId: input.chatId,
30
+ after: input.error ? { error: input.error } : undefined,
31
+ });
32
+ const sequence = await syncSequenceNext(tx);
33
+ await tx
34
+ .update(pluginManagementRequests)
35
+ .set({ syncSequence: sequence })
36
+ .where(eq(pluginManagementRequests.id, input.requestId));
37
+ const mutation = await chatAdvanceWithSequence(tx, sequence, input.actorUserId, input.chatId, input.error ? "plugin.uninstall_failed" : "plugin.uninstall_approved", input.requestId);
38
+ return chatHint(sequence, input.chatId, mutation.pts);
39
+ });
40
+ }
41
+ //# sourceMappingURL=pluginManagementRequestCompleteUninstall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginManagementRequestCompleteUninstall.js","sourceRoot":"","sources":["../../../sources/modules/plugin/pluginManagementRequestCompleteUninstall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,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