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,8 +1,8 @@
1
1
  import { type AgentImageSummary } from "../chat/types.js";
2
2
  import { type DrizzleExecutor } from "../drizzle.js";
3
3
  /**
4
- * Lists agent images in creation order and the optional configured default after requiring server-administrator access.
5
- * Reading settings and definitions as one response gives management clients the exact selection context without exposing internal images.
4
+ * Lists agent images and the configured default to a caller allowed to manage images, assign them to chats, or select a runtime for plugin installation.
5
+ * Reading summaries as one response gives each authorized selection surface exact context without granting image mutation authority.
6
6
  */
7
7
  export declare function agentImageList(executor: DrizzleExecutor, actorUserId: string): Promise<{
8
8
  defaultImageId?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"agentImageList.d.ts","sourceRoot":"","sources":["../../../sources/modules/agent/agentImageList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAOrD;;;GAGG;AACH,wBAAsB,cAAc,CAChC,QAAQ,EAAE,eAAe,EACzB,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC;IACP,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,iBAAiB,EAAE,CAAC;CAC/B,CAAC,CAuBD"}
1
+ {"version":3,"file":"agentImageList.d.ts","sourceRoot":"","sources":["../../../sources/modules/agent/agentImageList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAOrD;;;GAGG;AACH,wBAAsB,cAAc,CAChC,QAAQ,EAAE,eAAe,EACzB,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC;IACP,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,iBAAiB,EAAE,CAAC;CAC/B,CAAC,CA2BD"}
@@ -4,13 +4,17 @@ import { agentImageSelection } from "./impl/agentImageSelection.js";
4
4
  import { agentImages, agentImageSettings } from "../schema.js";
5
5
  import { asAgentImage } from "./impl/asAgentImage.js";
6
6
  import { eq } from "drizzle-orm";
7
- import { userRequireServerAdmin } from "../chat/userRequireServerAdmin.js";
7
+ import { userRequireAnyPermission } from "../permission/userRequireAnyPermission.js";
8
8
  /**
9
- * Lists agent images in creation order and the optional configured default after requiring server-administrator access.
10
- * Reading settings and definitions as one response gives management clients the exact selection context without exposing internal images.
9
+ * Lists agent images and the configured default to a caller allowed to manage images, assign them to chats, or select a runtime for plugin installation.
10
+ * Reading summaries as one response gives each authorized selection surface exact context without granting image mutation authority.
11
11
  */
12
12
  export async function agentImageList(executor, actorUserId) {
13
- await userRequireServerAdmin(executor, actorUserId);
13
+ await userRequireAnyPermission(executor, actorUserId, [
14
+ "manageImages",
15
+ "assignImagesToChats",
16
+ "managePlugins",
17
+ ]);
14
18
  const [settings, images] = await Promise.all([
15
19
  executor
16
20
  .select({
@@ -1 +1 @@
1
- {"version":3,"file":"agentImageList.js","sourceRoot":"","sources":["../../../sources/modules/agent/agentImageList.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAwB,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E;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OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAChC,QAAyB,EACzB,WAAmB;IAKnB,MAAM,wBAAwB,CAAC,QAAQ,EAAE,WAAW,EAAE;QAClD,cAAc;QACd,qBAAqB;QACrB,eAAe;KAClB,CAAC,CAAC;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACzC,QAAQ;aACH,MAAM,CAAC;YACJ,cAAc,EAAE,kBAAkB,CAAC,cAAc;SACpD,CAAC;aACD,IAAI,CAAC,kBAAkB,CAAC;aACxB,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;aACnC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5B,QAAQ;aACH,MAAM,CAAC,mBAAmB,CAAC;aAC3B,IAAI,CAAC,WAAW,CAAC;aACjB,OAAO,CAAC,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,CAAC;KACtD,CAAC,CAAC;IACH,OAAO;QACH,GAAG,CAAC,QAAQ,EAAE,cAAc;YACxB,CAAC,CAAC;gBACI,cAAc,EAAE,QAAQ,CAAC,cAAc;aAC1C;YACH,CAAC,CAAC,EAAE,CAAC;QACT,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC;KACnC,CAAC;AACN,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { type AgentImageSummary, type MutationHint } from "../chat/types.js";
2
2
  import { type DrizzleExecutor } from "../drizzle.js";
3
3
  /**
4
- * Queues an administrator-selected agentImages definition for a fresh build and resets its prior terminal output.
4
+ * Queues a manageImages-authorized agentImages definition for a fresh build and resets its prior terminal output.
5
5
  * Recording the lifecycle transition with its audit and sync evidence gives workers and clients one authoritative build request.
6
6
  */
7
7
  export declare function agentImageRequestBuild(executor: DrizzleExecutor, input: {
@@ -8,14 +8,14 @@ import { asAgentImage } from "./impl/asAgentImage.js";
8
8
  import { chatAppendAudit } from "../chat/chatAppendAudit.js";
9
9
  import { syncEventInsert } from "../sync/syncEventInsert.js";
10
10
  import { syncSequenceNext } from "../sync/syncSequenceNext.js";
11
- import { userRequireServerAdmin } from "../chat/userRequireServerAdmin.js";
11
+ import { userRequirePermission } from "../permission/userRequirePermission.js";
12
12
  /**
13
- * Queues an administrator-selected agentImages definition for a fresh build and resets its prior terminal output.
13
+ * Queues a manageImages-authorized agentImages definition for a fresh build and resets its prior terminal output.
14
14
  * Recording the lifecycle transition with its audit and sync evidence gives workers and clients one authoritative build request.
15
15
  */
16
16
  export async function agentImageRequestBuild(executor, input) {
17
17
  return withTransaction(executor, async (tx) => {
18
- await userRequireServerAdmin(tx, input.actorUserId);
18
+ await userRequirePermission(tx, input.actorUserId, "manageImages");
19
19
  const [current] = await tx
20
20
  .select({
21
21
  status: agentImages.status,
@@ -1 +1 @@
1
- {"version":3,"file":"agentImageRequestBuild.js","sourceRoot":"","sources":["../../../sources/modules/agent/agentImageRequestBuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,kBAAkB,EAAqB,MAAM,kBAAkB,CAAC;AAEjG,OAAO,EAAwB,eAAe,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,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AAS;YACjB,aAAa,EAAE,CAAC;YAChB,QAAQ,EAAE,EAAE;YACZ,iBAAiB,EAAE,CAAC;YACpB,gBAAgB,EAAE,IAAI;YACtB,iBAAiB,EAAE,IAAI;YACvB,gBAAgB,EAAE,GAAG,CAAA,mBAAmB;YACxC,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,IAAI;YACnB,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,cAAc,EAAE,IAAI;YACpB,SAAS,EAAE,GAAG,CAAA,mBAAmB;SACpC,CAAC;aACD,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;aACxC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACnE,MAAM,eAAe,CAAC,EAAE,EAAE;YACtB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,MAAM,EAAE,6BAA6B;YACrC,UAAU,EAAE,aAAa;YACzB,QAAQ,EAAE,KAAK,CAAC,OAAO;SAC1B,CAAC,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,EAAE,CAAC,CAAC;QAC5C,MAAM,eAAe,CAAC,EAAE,EAAE;YACtB,QAAQ;YACR,IAAI,EAAE,2BAA2B;YACjC,QAAQ,EAAE,KAAK,CAAC,OAAO;YACvB,WAAW,EAAE,KAAK,CAAC,WAAW;SACjC,CAAC,CAAC;QACH,OAAO;YACH,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;YACxC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;SAC7B,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { type AgentImageSummary, type MutationHint } from "../chat/types.js";
2
2
  import { type DrizzleExecutor } from "../drizzle.js";
3
3
  /**
4
- * Selects a ready image in agentImageSettings as the server default after administrator authorization.
4
+ * Selects a ready image in agentImageSettings as the server default after manageImages authorization.
5
5
  * Coupling the setting with sync and audit records prevents clients from seeing an unexplained default-image change.
6
6
  */
7
7
  export declare function agentImageSetDefault(executor: DrizzleExecutor, input: {
@@ -8,14 +8,14 @@ import { asAgentImage } from "./impl/asAgentImage.js";
8
8
  import { chatAppendAudit } from "../chat/chatAppendAudit.js";
9
9
  import { syncEventInsert } from "../sync/syncEventInsert.js";
10
10
  import { syncSequenceNext } from "../sync/syncSequenceNext.js";
11
- import { userRequireServerAdmin } from "../chat/userRequireServerAdmin.js";
11
+ import { userRequirePermission } from "../permission/userRequirePermission.js";
12
12
  /**
13
- * Selects a ready image in agentImageSettings as the server default after administrator authorization.
13
+ * Selects a ready image in agentImageSettings as the server default after manageImages authorization.
14
14
  * Coupling the setting with sync and audit records prevents clients from seeing an unexplained default-image change.
15
15
  */
16
16
  export async function agentImageSetDefault(executor, input) {
17
17
  return withTransaction(executor, async (tx) => {
18
- await userRequireServerAdmin(tx, input.actorUserId);
18
+ await userRequirePermission(tx, input.actorUserId, "manageImages");
19
19
  const [image] = await tx
20
20
  .select(agentImageSelection)
21
21
  .from(agentImages)
@@ -1 +1 @@
1
- {"version":3,"file":"agentImageSetDefault.js","sourceRoot":"","sources":["../../../sources/modules/agent/agentImageSetDefault.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,kBAAkB,EAAqB,MAAM,kBAAkB,CAAC;AAEjG,OAAO,EAAwB,eAAe,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE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,EAAE,4BAA4B;YAClC,QAAQ,EAAE,KAAK,CAAC,OAAO;YACvB,WAAW,EAAE,KAAK,CAAC,WAAW;SACjC,CAAC,CAAC;QACH,OAAO;YACH,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;YACxC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;SAC7B,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { type DrizzleExecutor } from "../drizzle.js";
2
2
  import { type MutationHint } from "../chat/types.js";
3
3
  /**
4
- * Removes every agentSecretAgentAssignments or agentSecretChannelAssignments row identified by an administrator-owned assignment.
4
+ * Removes all agentSecretAgentAssignments and agentSecretChannelAssignments for one secret after requiring manageSecrets permission.
5
5
  * Deleting the assignment alongside sync and audit evidence makes secret access disappear as one reviewable authorization change.
6
6
  */
7
7
  export declare function agentSecretAssignmentDelete(executor: DrizzleExecutor, input: {
@@ -6,14 +6,14 @@ import { eq } from "drizzle-orm";
6
6
  import { chatAppendAudit } from "../chat/chatAppendAudit.js";
7
7
  import { syncEventInsert } from "../sync/syncEventInsert.js";
8
8
  import { syncSequenceNext } from "../sync/syncSequenceNext.js";
9
- import { userRequireServerAdmin } from "../chat/userRequireServerAdmin.js";
9
+ import { userRequirePermission } from "../permission/userRequirePermission.js";
10
10
  /**
11
- * Removes every agentSecretAgentAssignments or agentSecretChannelAssignments row identified by an administrator-owned assignment.
11
+ * Removes all agentSecretAgentAssignments and agentSecretChannelAssignments for one secret after requiring manageSecrets permission.
12
12
  * Deleting the assignment alongside sync and audit evidence makes secret access disappear as one reviewable authorization change.
13
13
  */
14
14
  export async function agentSecretAssignmentDelete(executor, input) {
15
15
  return withTransaction(executor, async (tx) => {
16
- await userRequireServerAdmin(tx, input.actorUserId);
16
+ await userRequirePermission(tx, input.actorUserId, "manageSecrets");
17
17
  await tx
18
18
  .delete(agentSecretAgentAssignments)
19
19
  .where(eq(agentSecretAgentAssignments.secretId, input.secretId));
@@ -1 +1 @@
1
- {"version":3,"file":"agentSecretAssignmentDelete.js","sourceRoot":"","sources":["../../../sources/modules/agent/agentSecretAssignmentDelete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,eAAe,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAqB,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAE1F,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC7C,QAAyB,EACzB,KAGC;IAED,OAAO,eAAe,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;QAC1C,MAAM,sBAAsB,CAAC,EAAE,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;QACpD,MAAM,EAAE;aACH,MAAM,CAAC,2BAA2B,CAAC;aACnC,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrE,MAAM,EAAE;aACH,MAAM,CAAC,6BAA6B,CAAC;aACrC,KAAK,CAAC,EAAE,CAAC,6BAA6B,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvE,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,EAAE,CAAC,CAAC;QAC5C,MAAM,eAAe,CAAC,EAAE,EAAE;YACtB,QAAQ;YACR,IAAI,EAAE,qBAAqB;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,EAAE,CAAC,2BAA2B,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrE,MAAM,EAAE;aACH,MAAM,CAAC,6BAA6B,CAAC;aACrC,KAAK,CAAC,EAAE,CAAC,6BAA6B,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvE,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,EAAE,CAAC,CAAC;QAC5C,MAAM,eAAe,CAAC,EAAE,EAAE;YACtB,QAAQ;YACR,IAAI,EAAE,qBAAqB;YAC3B,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,WAAW,EAAE,KAAK,CAAC,WAAW;SACjC,CAAC,CAAC;QACH,MAAM,eAAe,CAAC,EAAE,EAAE;YACtB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,MAAM,EAAE,sBAAsB;YAC9B,UAAU,EAAE,cAAc;YAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ;SAC3B,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { type AgentSecretAssignment } from "./impl/agentSecretAssignment.js";
2
2
  import { type DrizzleExecutor } from "../drizzle.js";
3
3
  /**
4
- * Groups all direct-agent and channel secret assignments by secret identifier for an active server administrator.
4
+ * Groups secret assignments for a caller allowed to manage secrets or assign them to agents and channels.
5
5
  * Sorting both source rows and the merged result gives management clients stable agent and channel membership lists for each secret.
6
6
  */
7
7
  export declare function agentSecretAssignmentList(executor: DrizzleExecutor, actorUserId: string): Promise<AgentSecretAssignment[]>;
@@ -1,13 +1,13 @@
1
1
  import {} from "./impl/agentSecretAssignment.js";
2
2
  import {} from "../drizzle.js";
3
3
  import { agentSecretAgentAssignments, agentSecretChannelAssignments } from "../schema.js";
4
- import { userRequireServerAdmin } from "../chat/userRequireServerAdmin.js";
4
+ import { userRequireAnyPermission } from "../permission/userRequireAnyPermission.js";
5
5
  /**
6
- * Groups all direct-agent and channel secret assignments by secret identifier for an active server administrator.
6
+ * Groups secret assignments for a caller allowed to manage secrets or assign them to agents and channels.
7
7
  * Sorting both source rows and the merged result gives management clients stable agent and channel membership lists for each secret.
8
8
  */
9
9
  export async function agentSecretAssignmentList(executor, actorUserId) {
10
- await userRequireServerAdmin(executor, actorUserId);
10
+ await userRequireAnyPermission(executor, actorUserId, ["manageSecrets", "assignSecrets"]);
11
11
  const [agentRows, channelRows] = await Promise.all([
12
12
  executor
13
13
  .select({
@@ -1 +1 @@
1
- {"version":3,"file":"agentSecretAssignmentList.js","sourceRoot":"","sources":["../../../sources/modules/agent/agentSecretAssignmentList.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAwB,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAE1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC3C,QAAyB,EACzB,WAAmB;IAEnB,MAAM,sBAAsB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACpD,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC/C,QAAQ;aACH,MAAM,CAAC;YACJ,QAAQ,EAAE,2BAA2B,CAAC,QAAQ;YAC9C,WAAW,EAAE,2BAA2B,CAAC,WAAW;SACvD,CAAC;aACD,IAAI,CAAC,2BAA2B,CAAC;aACjC,OAAO,CAAC,2BAA2B,CAAC,QAAQ,EAAE,2BAA2B,CAAC,WAAW,CAAC;QAC3F,QAAQ;aACH,MAAM,CAAC;YACJ,QAAQ,EAAE,6BAA6B,CAAC,QAAQ;YAChD,SAAS,EAAE,6BAA6B,CAAC,MA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,KAAK,MAAM,GAAG,IAAI,SAAS;QAAE,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAClF,KAAK,MAAM,GAAG,IAAI,WAAW;QAAE,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAChF,OAAO,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAClD,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAC9C,CAAC;AACN,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { type MutationHint } from "../chat/types.js";
2
2
  import { type DrizzleExecutor } from "../drizzle.js";
3
3
  /**
4
- * Grants an agent access to a secret by inserting the unique agentSecretAgentAssignments relationship after administrator checks.
4
+ * Grants an agent access by inserting agentSecretAgentAssignments after requiring assignSecrets permission.
5
5
  * Keeping the grant, audit entry, and sync event together prevents silent expansion of an agent's runtime credentials.
6
6
  */
7
7
  export declare function agentSecretAttachToAgent(executor: DrizzleExecutor, input: {
@@ -6,14 +6,14 @@ import { areaHint } from "../chat/areaHint.js";
6
6
  import { chatAppendAudit } from "../chat/chatAppendAudit.js";
7
7
  import { syncEventInsert } from "../sync/syncEventInsert.js";
8
8
  import { syncSequenceNext } from "../sync/syncSequenceNext.js";
9
- import { userRequireServerAdmin } from "../chat/userRequireServerAdmin.js";
9
+ import { userRequirePermission } from "../permission/userRequirePermission.js";
10
10
  /**
11
- * Grants an agent access to a secret by inserting the unique agentSecretAgentAssignments relationship after administrator checks.
11
+ * Grants an agent access by inserting agentSecretAgentAssignments after requiring assignSecrets permission.
12
12
  * Keeping the grant, audit entry, and sync event together prevents silent expansion of an agent's runtime credentials.
13
13
  */
14
14
  export async function agentSecretAttachToAgent(executor, input) {
15
15
  return withTransaction(executor, async (tx) => {
16
- await userRequireServerAdmin(tx, input.actorUserId);
16
+ await userRequirePermission(tx, input.actorUserId, "assignSecrets");
17
17
  const [agent] = await tx
18
18
  .select({
19
19
  id: users.id,
@@ -1 +1 @@
1
- {"version":3,"file":"agentSecretAttachToAgent.js","sourceRoot":"","sources":["../../../sources/modules/agent/agentSecretAttachToAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAqB,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAwB,eAAe,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EAAE,2BAA2B,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC1C,QAAyB,EACzB,KAIC;IAED,OAAO,eAAe,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;QAC1C,MAAM,sBAAsB,CAAC,EAAE,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;QACpD,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,EAAE;aACnB,MAAM,CAAC;YACJ,EAAE,EAAE,KAAK,CAAC,EAAE;SACf,CAAC;aACD,IAAI,CAAC,KAAK,CAAC;aACX,KAAK,CACF,GAAG,CACC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,WAAW,CAAC,EAC/B,EAAE,CAAC,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GAAG,MAAM,EAAE;aACpB,MAAM,CAAC,2BAA2B,CAAC;aACnC,MAAM,CAAC;YACJ,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,eAAe,EAAE,KAAK,CAAC,WAAW;SACrC,CAAC;aACD,mBAAmB,EAAE;aACrB,SAAS,CAAC;YACP,QAAQ,EAAE,2BAA2B,CAAC,QAAQ;SACjD,CAAC,CAAC;QACP,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,OAAO,SAAS,CAAC;QACvC,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,EAAE,CAAC,CAAC;QAC5C,MAAM,eAAe,CAAC,EAAE,EAAE;YACtB,QAAQ;YACR,IAAI,EAAE,6BAA6B;YACnC,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,WAAW,EAAE,KAAK,CAAC,WAAW;SACjC,CAAC,CAAC;QACH,MAAM,eAAe,CAAC,EAAE,EAAE;YACtB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,MAAM,EAAE,gCAAgC;YACxC,UAAU,EAAE,MAAM;YAClB,QAAQ,EAAE,KAAK,CAAC,WAAW;YAC3B,KAAK,EAAE;gBACH,QAAQ,EAAE,KAAK,CAAC,QAAQ;aAC3B;SACJ,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { type MutationHint } from "../chat/types.js";
2
2
  import { type DrizzleExecutor } from "../drizzle.js";
3
3
  /**
4
- * Grants a secret identifier to an existing channel through agentSecretChannelAssignments after validating server-administrator authority and channel eligibility.
4
+ * Grants a secret to an eligible channel through agentSecretChannelAssignments after requiring assignSecrets permission.
5
5
  * The assignment, audit entry, and sync event commit together so the resulting credential exposure is never silent or partially reported.
6
6
  */
7
7
  export declare function agentSecretAttachToChannel(executor: DrizzleExecutor, input: {
@@ -6,14 +6,14 @@ import { areaHint } from "../chat/areaHint.js";
6
6
  import { chatAppendAudit } from "../chat/chatAppendAudit.js";
7
7
  import { syncEventInsert } from "../sync/syncEventInsert.js";
8
8
  import { syncSequenceNext } from "../sync/syncSequenceNext.js";
9
- import { userRequireServerAdmin } from "../chat/userRequireServerAdmin.js";
9
+ import { userRequirePermission } from "../permission/userRequirePermission.js";
10
10
  /**
11
- * Grants a secret identifier to an existing channel through agentSecretChannelAssignments after validating server-administrator authority and channel eligibility.
11
+ * Grants a secret to an eligible channel through agentSecretChannelAssignments after requiring assignSecrets permission.
12
12
  * The assignment, audit entry, and sync event commit together so the resulting credential exposure is never silent or partially reported.
13
13
  */
14
14
  export async function agentSecretAttachToChannel(executor, input) {
15
15
  return withTransaction(executor, async (tx) => {
16
- await userRequireServerAdmin(tx, input.actorUserId);
16
+ await userRequirePermission(tx, input.actorUserId, "assignSecrets");
17
17
  const [channel] = await tx
18
18
  .select({
19
19
  id: chats.id,
@@ -1 +1 @@
1
- {"version":3,"file":"agentSecretAttachToChannel.js","sourceRoot":"","sources":["../../../sources/modules/agent/agentSecretAttachToChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAqB,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAwB,eAAe,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EAAE,6BAA6B,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC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AAM,EAAE,kCAAkC;YAC1C,UAAU,EAAE,MAAM;YAClB,QAAQ,EAAE,KAAK,CAAC,SAAS;YACzB,MAAM,EAAE,KAAK,CAAC,SAAS;YACvB,KAAK,EAAE;gBACH,QAAQ,EAAE,KAAK,CAAC,QAAQ;aAC3B;SACJ,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import { type DrizzleExecutor } from "../drizzle.js";
2
+ import type { Permission } from "../permission/types.js";
2
3
  /**
3
- * Requires the actor to have an active profile and server-administrator role before any agent-secret management operation proceeds.
4
- * A shared authorization entry point keeps secret assignment routes from drifting to weaker account or profile checks.
4
+ * Requires the actor's requested secret-management capability before any external Rig secret operation proceeds.
5
+ * A shared authorization entry point keeps non-database secret lifecycle work aligned with the same grants enforced by durable actions.
5
6
  */
6
- export declare function agentSecretAuthorizeManagement(executor: DrizzleExecutor, actorUserId: string): Promise<void>;
7
+ export declare function agentSecretAuthorizeManagement(executor: DrizzleExecutor, actorUserId: string, permission: Extract<Permission, "manageSecrets" | "assignSecrets">): Promise<void>;
7
8
  //# sourceMappingURL=agentSecretAuthorizeManagement.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agentSecretAuthorizeManagement.d.ts","sourceRoot":"","sources":["../../../sources/modules/agent/agentSecretAuthorizeManagement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;;GAGG;AACH,wBAAsB,8BAA8B,CAChD,QAAQ,EAAE,eAAe,EACzB,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC,CAEf"}
1
+ {"version":3,"file":"agentSecretAuthorizeManagement.d.ts","sourceRoot":"","sources":["../../../sources/modules/agent/agentSecretAuthorizeManagement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD;;;GAGG;AACH,wBAAsB,8BAA8B,CAChD,QAAQ,EAAE,eAAe,EACzB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,eAAe,GAAG,eAAe,CAAC,GACnE,OAAO,CAAC,IAAI,CAAC,CAEf"}
@@ -1,10 +1,10 @@
1
1
  import {} from "../drizzle.js";
2
- import { userRequireServerAdmin } from "../chat/userRequireServerAdmin.js";
2
+ import { userRequirePermission } from "../permission/userRequirePermission.js";
3
3
  /**
4
- * Requires the actor to have an active profile and server-administrator role before any agent-secret management operation proceeds.
5
- * A shared authorization entry point keeps secret assignment routes from drifting to weaker account or profile checks.
4
+ * Requires the actor's requested secret-management capability before any external Rig secret operation proceeds.
5
+ * A shared authorization entry point keeps non-database secret lifecycle work aligned with the same grants enforced by durable actions.
6
6
  */
7
- export async function agentSecretAuthorizeManagement(executor, actorUserId) {
8
- await userRequireServerAdmin(executor, actorUserId);
7
+ export async function agentSecretAuthorizeManagement(executor, actorUserId, permission) {
8
+ await userRequirePermission(executor, actorUserId, permission);
9
9
  }
10
10
  //# sourceMappingURL=agentSecretAuthorizeManagement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agentSecretAuthorizeManagement.js","sourceRoot":"","sources":["../../../sources/modules/agent/agentSecretAuthorizeManagement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAChD,QAAyB,EACzB,WAAmB;IAEnB,MAAM,sBAAsB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AACxD,CAAC"}
1
+ {"version":3,"file":"agentSecretAuthorizeManagement.js","sourceRoot":"","sources":["../../../sources/modules/agent/agentSecretAuthorizeManagement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAE/E;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAChD,QAAyB,EACzB,WAAmB,EACnB,UAAkE;IAElE,MAAM,qBAAqB,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;AACnE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { type DrizzleExecutor } from "../drizzle.js";
2
2
  import { type MutationHint } from "../chat/types.js";
3
3
  /**
4
- * Revokes a direct agent secret grant by deleting its agentSecretAgentAssignments row under administrator authorization.
4
+ * Revokes a direct grant by deleting agentSecretAgentAssignments after requiring assignSecrets permission.
5
5
  * Publishing revocation and audit evidence in the same commit ensures future runs cannot retain a grant clients still believe exists.
6
6
  */
7
7
  export declare function agentSecretDetachFromAgent(executor: DrizzleExecutor, input: {
@@ -6,14 +6,14 @@ import { areaHint } from "../chat/areaHint.js";
6
6
  import { chatAppendAudit } from "../chat/chatAppendAudit.js";
7
7
  import { syncEventInsert } from "../sync/syncEventInsert.js";
8
8
  import { syncSequenceNext } from "../sync/syncSequenceNext.js";
9
- import { userRequireServerAdmin } from "../chat/userRequireServerAdmin.js";
9
+ import { userRequirePermission } from "../permission/userRequirePermission.js";
10
10
  /**
11
- * Revokes a direct agent secret grant by deleting its agentSecretAgentAssignments row under administrator authorization.
11
+ * Revokes a direct grant by deleting agentSecretAgentAssignments after requiring assignSecrets permission.
12
12
  * Publishing revocation and audit evidence in the same commit ensures future runs cannot retain a grant clients still believe exists.
13
13
  */
14
14
  export async function agentSecretDetachFromAgent(executor, input) {
15
15
  return withTransaction(executor, async (tx) => {
16
- await userRequireServerAdmin(tx, input.actorUserId);
16
+ await userRequirePermission(tx, input.actorUserId, "assignSecrets");
17
17
  const removed = await tx
18
18
  .delete(agentSecretAgentAssignments)
19
19
  .where(and(eq(agentSecretAgentAssignments.secretId, input.secretId), eq(agentSecretAgentAssignments.agentUserId, input.agentUserId)))
@@ -1 +1 @@
1
- {"version":3,"file":"agentSecretDetachFromAgent.js","sourceRoot":"","sources":["../../../sources/modules/agent/agentSecretDetachFromAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,eAAe,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAqB,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC5C,QAAyB,EACzB,KAIC;IAED,OAAO,eAAe,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;QAC1C,MAAM,sBAAsB,CAAC,EAAE,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;QACpD,MAAM,OAAO,GAAG,MAAM,EAAE;aACnB,MAAM,CAAC,2BAA2B,CAAC;aACnC,KAAK,CACF,GAAG,CACC,EAAE,CAAC,2BAA2B,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,EACxD,EAAE,CAAC,2BAA2B,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,CACjE,CACJ;aACA,SAAS,CAAC;YACP,QAAQ,EAAE,2BAA2B,CAAC,QAAQ;SACjD,CAAC,CAAC;QACP,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE,OAAO,SAAS,CAAC;QACtC,M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AAQ,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;QAC1C,MAAM,qBAAqB,CAAC,EAAE,EAAE,KAAK,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;QACpE,MAAM,OAAO,GAAG,MAAM,EAAE;aACnB,MAAM,CAAC,2BAA2B,CAAC;aACnC,KAAK,CACF,GAAG,CACC,EAAE,CAAC,2BAA2B,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,EACxD,EAAE,CAAC,2BAA2B,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,CACjE,CACJ;aACA,SAAS,CAAC;YACP,QAAQ,EAAE,2BAA2B,CAAC,QAAQ;SACjD,CAAC,CAAC;QACP,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE,OAAO,SAAS,CAAC;QACtC,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,EAAE,CAAC,CAAC;QAC5C,MAAM,eAAe,CAAC,EAAE,EAAE;YACtB,QAAQ;YACR,IAAI,EAAE,+BAA+B;YACrC,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,WAAW,EAAE,KAAK,CAAC,WAAW;SACjC,CAAC,CAAC;QACH,MAAM,eAAe,CAAC,EAAE,EAAE;YACtB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,MAAM,EAAE,kCAAkC;YAC1C,UAAU,EAAE,MAAM;YAClB,QAAQ,EAAE,KAAK,CAAC,WAAW;YAC3B,KAAK,EAAE;gBACH,QAAQ,EAAE,KAAK,CAAC,QAAQ;aAC3B;SACJ,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { type DrizzleExecutor } from "../drizzle.js";
2
2
  import { type MutationHint } from "../chat/types.js";
3
3
  /**
4
- * Revokes a channel's secret grant by removing the selected agentSecretChannelAssignments relationship after authorization.
5
- * The shared audit and sync transition makes the loss of runtime access immediate and attributable to its administrator.
4
+ * Revokes a channel grant from agentSecretChannelAssignments after requiring assignSecrets permission.
5
+ * The shared audit and sync transition makes the loss of runtime access immediate and attributable.
6
6
  */
7
7
  export declare function agentSecretDetachFromChannel(executor: DrizzleExecutor, input: {
8
8
  actorUserId: string;
@@ -6,14 +6,14 @@ import { areaHint } from "../chat/areaHint.js";
6
6
  import { chatAppendAudit } from "../chat/chatAppendAudit.js";
7
7
  import { syncEventInsert } from "../sync/syncEventInsert.js";
8
8
  import { syncSequenceNext } from "../sync/syncSequenceNext.js";
9
- import { userRequireServerAdmin } from "../chat/userRequireServerAdmin.js";
9
+ import { userRequirePermission } from "../permission/userRequirePermission.js";
10
10
  /**
11
- * Revokes a channel's secret grant by removing the selected agentSecretChannelAssignments relationship after authorization.
12
- * The shared audit and sync transition makes the loss of runtime access immediate and attributable to its administrator.
11
+ * Revokes a channel grant from agentSecretChannelAssignments after requiring assignSecrets permission.
12
+ * The shared audit and sync transition makes the loss of runtime access immediate and attributable.
13
13
  */
14
14
  export async function agentSecretDetachFromChannel(executor, input) {
15
15
  return withTransaction(executor, async (tx) => {
16
- await userRequireServerAdmin(tx, input.actorUserId);
16
+ await userRequirePermission(tx, input.actorUserId, "assignSecrets");
17
17
  const removed = await tx
18
18
  .delete(agentSecretChannelAssignments)
19
19
  .where(and(eq(agentSecretChannelAssignments.secretId, input.secretId), eq(agentSecretChannelAssignments.chatId, input.channelId)))
@@ -1 +1 @@
1
- {"version":3,"file":"agentSecretDetachFromChannel.js","sourceRoot":"","sources":["../../../sources/modules/agent/agentSecretDetachFromChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,eAAe,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAqB,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,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AC,CAC5D,CACJ;aACA,SAAS,CAAC;YACP,QAAQ,EAAE,6BAA6B,CAAC,QAAQ;SACnD,CAAC,CAAC;QACP,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE,OAAO,SAAS,CAAC;QACtC,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,EAAE,CAAC,CAAC;QAC5C,MAAM,eAAe,CAAC,EAAE,EAAE;YACtB,QAAQ;YACR,IAAI,EAAE,iCAAiC;YACvC,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,WAAW,EAAE,KAAK,CAAC,WAAW;SACjC,CAAC,CAAC;QACH,MAAM,eAAe,CAAC,EAAE,EAAE;YACtB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,MAAM,EAAE,oCAAoC;YAC5C,UAAU,EAAE,MAAM;YAClB,QAAQ,EAAE,KAAK,CAAC,SAAS;YACzB,MAAM,EAAE,KAAK,CAAC,SAAS;YACvB,KAAK,EAAE;gBACH,QAAQ,EAAE,KAAK,CAAC,QAAQ;aAC3B;SACJ,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { type DrizzleExecutor } from "../drizzle.js";
2
2
  import { type MutationHint } from "../chat/types.js";
3
3
  /**
4
- * Records an administrator-authorized agent-secret registration as a global sync event and audit entry.
4
+ * Records a manageSecrets-authorized agent-secret registration as a global sync event and audit entry.
5
5
  * The transaction keeps both durable records on the same sequence so observers cannot see an unaudited registration signal.
6
6
  */
7
7
  export declare function agentSecretRecordRegistration(executor: DrizzleExecutor, input: {
@@ -4,14 +4,14 @@ import { areaHint } from "../chat/areaHint.js";
4
4
  import { chatAppendAudit } from "../chat/chatAppendAudit.js";
5
5
  import { syncEventInsert } from "../sync/syncEventInsert.js";
6
6
  import { syncSequenceNext } from "../sync/syncSequenceNext.js";
7
- import { userRequireServerAdmin } from "../chat/userRequireServerAdmin.js";
7
+ import { userRequirePermission } from "../permission/userRequirePermission.js";
8
8
  /**
9
- * Records an administrator-authorized agent-secret registration as a global sync event and audit entry.
9
+ * Records a manageSecrets-authorized agent-secret registration as a global sync event and audit entry.
10
10
  * The transaction keeps both durable records on the same sequence so observers cannot see an unaudited registration signal.
11
11
  */
12
12
  export async function agentSecretRecordRegistration(executor, input) {
13
13
  return withTransaction(executor, async (tx) => {
14
- await userRequireServerAdmin(tx, input.actorUserId);
14
+ await userRequirePermission(tx, input.actorUserId, "manageSecrets");
15
15
  const sequence = await syncSequenceNext(tx);
16
16
  await syncEventInsert(tx, {
17
17
  sequence,
@@ -1 +1 @@
1
- {"version":3,"file":"agentSecretRecordRegistration.js","sourceRoot":"","sources":["../../../sources/modules/agent/agentSecretRecordRegistration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,eAAe,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAqB,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CAC/C,QAAyB,EACzB,KAGC;IAED,OAAO,eAAe,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;QAC1C,MAAM,sBAAsB,CAAC,EAAE,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;QACpD,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,EAAE,CAAC,CAAC;QAC5C,MAAM,eAAe,CAAC,EAAE,EAAE;YACtB,QAAQ;YACR,IAAI,EAAE,wBAAwB;YAC9B,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EAAE,KAAK,CAAC,WAAW;SACjC,CAAC,CAAC;QACH,MAAM,eAAe,CAAC,EAAE,EAAE;YACtB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,MAAM,EAAE,yBAAyB;YACjC,UAAU,EAAE,cAAc;YAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ;SAC3B,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { DrizzleExecutor } from "../drizzle.js";
2
+ /** Derives one session's host-mounted isolated home from its durable Rig binding cwd and does not mutate durable state. This boundary centralizes the sandbox layout contract used by plugin skill reconciliation. */
3
+ export declare function agentSkillHomeGet(executor: DrizzleExecutor, sessionId: string): Promise<string>;
4
+ //# sourceMappingURL=agentSkillHomeGet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentSkillHomeGet.d.ts","sourceRoot":"","sources":["../../../sources/modules/agent/agentSkillHomeGet.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD,sNAAsN;AACtN,wBAAsB,iBAAiB,CACnC,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAQjB"}
@@ -0,0 +1,15 @@
1
+ import { eq } from "drizzle-orm";
2
+ import { dirname, join } from "node:path";
3
+ import { agentRigBindings } from "../schema.js";
4
+ /** Derives one session's host-mounted isolated home from its durable Rig binding cwd and does not mutate durable state. This boundary centralizes the sandbox layout contract used by plugin skill reconciliation. */
5
+ export async function agentSkillHomeGet(executor, sessionId) {
6
+ const [binding] = await executor
7
+ .select({ cwd: agentRigBindings.cwd })
8
+ .from(agentRigBindings)
9
+ .where(eq(agentRigBindings.sessionId, sessionId))
10
+ .limit(1);
11
+ if (!binding)
12
+ throw new Error("Agent Rig binding was not found for skill reconciliation");
13
+ return join(dirname(binding.cwd), "home");
14
+ }
15
+ //# sourceMappingURL=agentSkillHomeGet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentSkillHomeGet.js","sourceRoot":"","sources":["../../../sources/modules/agent/agentSkillHomeGet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,sNAAsN;AACtN,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACnC,QAAyB,EACzB,SAAiB;IAEjB,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,QAAQ;SAC3B,MAAM,CAAC,EAAE,GAAG,EAAE,gBAAgB,CAAC,GAAG,EAAE,CAAC;SACrC,IAAI,CAAC,gBAAgB,CAAC;SACtB,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;SAChD,KAAK,CAAC,CAAC,CAAC,CAAC;IACd,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC1F,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=agentSkillHomeGet.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentSkillHomeGet.test.d.ts","sourceRoot":"","sources":["../../../sources/modules/agent/agentSkillHomeGet.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { describe, expect, it, vi } from "vitest";
2
+ import { agentSkillHomeGet } from "./agentSkillHomeGet.js";
3
+ function executorWithBinding(binding) {
4
+ const limit = vi.fn().mockResolvedValue(binding ? [binding] : []);
5
+ const where = vi.fn(() => ({ limit }));
6
+ const from = vi.fn(() => ({ where }));
7
+ return { select: vi.fn(() => ({ from })) };
8
+ }
9
+ describe("agentSkillHomeGet", () => {
10
+ it("derives the isolated home beside the durable Rig working directory", async () => {
11
+ await expect(agentSkillHomeGet(executorWithBinding({ cwd: "/sessions/run/worktree" }), "session-1")).resolves.toBe("/sessions/run/home");
12
+ });
13
+ it("rejects sessions without a durable Rig binding", async () => {
14
+ await expect(agentSkillHomeGet(executorWithBinding(undefined), "missing")).rejects.toThrow("Agent Rig binding was not found for skill reconciliation");
15
+ });
16
+ });
17
+ //# sourceMappingURL=agentSkillHomeGet.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentSkillHomeGet.test.js","sourceRoot":"","sources":["../../../sources/modules/agent/agentSkillHomeGet.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,SAAS,mBAAmB,CAAC,OAAoC;IAC7D,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAClE,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IACtC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAgC,CAAC;AAC7E,CAAC;AAED,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,oEAAoE,EAAE,KAAK,IAAI,EAAE;QAChF,MAAM,MAAM,CACR,iBAAiB,CAAC,mBAAmB,CAAC,EAAE,GAAG,EAAE,wBAAwB,EAAE,CAAC,EAAE,WAAW,CAAC,CACzF,CAAC,QAAQ,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE,KAAK,IAAI,EAAE;QAC5D,MAAM,MAAM,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CACtF,0DAA0D,CAC7D,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { DrizzleExecutor } from "../drizzle.js";
2
+ export interface AgentPluginReferencedUser {
3
+ id: string;
4
+ username: string;
5
+ firstName: string;
6
+ lastName?: string;
7
+ kind: "human" | "agent";
8
+ triggeredTurn: boolean;
9
+ }
10
+ /**
11
+ * Resolves the exact running agent turn, its triggering sender, and every concrete user mention recorded on that message.
12
+ * This read-only boundary keeps plugin capabilities tied to durable turn provenance instead of inferring authority from a reusable Rig session.
13
+ */
14
+ export declare function agentTurnGetPluginContext(executor: DrizzleExecutor, input: {
15
+ runId: string;
16
+ sessionId: string;
17
+ }): Promise<{
18
+ agentUserId: string;
19
+ chatId: string;
20
+ triggeredByUserId: string;
21
+ users: AgentPluginReferencedUser[];
22
+ } | undefined>;
23
+ //# sourceMappingURL=agentTurnGetPluginContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentTurnGetPluginContext.d.ts","sourceRoot":"","sources":["../../../sources/modules/agent/agentTurnGetPluginContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD,MAAM,WAAW,yBAAyB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;CAC1B;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAC3C,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC5C,OAAO,CACJ;IACI,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,yBAAyB,EAAE,CAAC;CACtC,GACD,SAAS,CACd,CAuEA"}