happy2 0.0.11 → 0.0.13

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 (443) hide show
  1. package/README.md +10 -0
  2. package/package.json +2 -2
  3. package/packages/happy2-server/PLUGINS.md +205 -45
  4. package/packages/happy2-server/README.md +19 -7
  5. package/packages/happy2-server/dist/daemon.d.ts +39 -0
  6. package/packages/happy2-server/dist/daemon.d.ts.map +1 -0
  7. package/packages/happy2-server/dist/daemon.js +302 -0
  8. package/packages/happy2-server/dist/daemon.js.map +1 -0
  9. package/packages/happy2-server/dist/daemon.test.d.ts +2 -0
  10. package/packages/happy2-server/dist/daemon.test.d.ts.map +1 -0
  11. package/packages/happy2-server/dist/daemon.test.js +245 -0
  12. package/packages/happy2-server/dist/daemon.test.js.map +1 -0
  13. package/packages/happy2-server/dist/index.d.ts +3 -2
  14. package/packages/happy2-server/dist/index.d.ts.map +1 -1
  15. package/packages/happy2-server/dist/index.js +2 -1
  16. package/packages/happy2-server/dist/index.js.map +1 -1
  17. package/packages/happy2-server/dist/modules/agent/agentChatBind.d.ts +1 -0
  18. package/packages/happy2-server/dist/modules/agent/agentChatBind.d.ts.map +1 -1
  19. package/packages/happy2-server/dist/modules/agent/agentChatBind.js +4 -0
  20. package/packages/happy2-server/dist/modules/agent/agentChatBind.js.map +1 -1
  21. package/packages/happy2-server/dist/modules/agent/agentChatGetContext.d.ts.map +1 -1
  22. package/packages/happy2-server/dist/modules/agent/agentChatGetContext.js +3 -1
  23. package/packages/happy2-server/dist/modules/agent/agentChatGetContext.js.map +1 -1
  24. package/packages/happy2-server/dist/modules/agent/agentChatGetIdBySession.d.ts +7 -0
  25. package/packages/happy2-server/dist/modules/agent/agentChatGetIdBySession.d.ts.map +1 -0
  26. package/packages/happy2-server/dist/modules/agent/agentChatGetIdBySession.js +15 -0
  27. package/packages/happy2-server/dist/modules/agent/agentChatGetIdBySession.js.map +1 -0
  28. package/packages/happy2-server/dist/modules/agent/agentCreate.d.ts.map +1 -1
  29. package/packages/happy2-server/dist/modules/agent/agentCreate.js +1 -0
  30. package/packages/happy2-server/dist/modules/agent/agentCreate.js.map +1 -1
  31. package/packages/happy2-server/dist/modules/agent/agentEffortBindingList.d.ts +4 -2
  32. package/packages/happy2-server/dist/modules/agent/agentEffortBindingList.d.ts.map +1 -1
  33. package/packages/happy2-server/dist/modules/agent/agentEffortBindingList.js +8 -8
  34. package/packages/happy2-server/dist/modules/agent/agentEffortBindingList.js.map +1 -1
  35. package/packages/happy2-server/dist/modules/agent/agentEffortGetContext.d.ts +3 -3
  36. package/packages/happy2-server/dist/modules/agent/agentEffortGetContext.d.ts.map +1 -1
  37. package/packages/happy2-server/dist/modules/agent/agentEffortGetContext.js +4 -4
  38. package/packages/happy2-server/dist/modules/agent/agentEffortGetContext.js.map +1 -1
  39. package/packages/happy2-server/dist/modules/agent/agentEffortUpdate.d.ts +4 -4
  40. package/packages/happy2-server/dist/modules/agent/agentEffortUpdate.d.ts.map +1 -1
  41. package/packages/happy2-server/dist/modules/agent/agentEffortUpdate.js +57 -41
  42. package/packages/happy2-server/dist/modules/agent/agentEffortUpdate.js.map +1 -1
  43. package/packages/happy2-server/dist/modules/agent/agentImageCommitChange.d.ts +1 -1
  44. package/packages/happy2-server/dist/modules/agent/agentImageCommitChange.js +3 -3
  45. package/packages/happy2-server/dist/modules/agent/agentImageCommitChange.js.map +1 -1
  46. package/packages/happy2-server/dist/modules/agent/agentImageCreate.d.ts +1 -1
  47. package/packages/happy2-server/dist/modules/agent/agentImageCreate.js +3 -3
  48. package/packages/happy2-server/dist/modules/agent/agentImageCreate.js.map +1 -1
  49. package/packages/happy2-server/dist/modules/agent/agentImageGet.d.ts +1 -1
  50. package/packages/happy2-server/dist/modules/agent/agentImageGet.js +3 -3
  51. package/packages/happy2-server/dist/modules/agent/agentImageGet.js.map +1 -1
  52. package/packages/happy2-server/dist/modules/agent/agentImageGetChangeContext.d.ts +2 -1
  53. package/packages/happy2-server/dist/modules/agent/agentImageGetChangeContext.d.ts.map +1 -1
  54. package/packages/happy2-server/dist/modules/agent/agentImageGetChangeContext.js +11 -4
  55. package/packages/happy2-server/dist/modules/agent/agentImageGetChangeContext.js.map +1 -1
  56. package/packages/happy2-server/dist/modules/agent/agentImageList.d.ts +2 -2
  57. package/packages/happy2-server/dist/modules/agent/agentImageList.d.ts.map +1 -1
  58. package/packages/happy2-server/dist/modules/agent/agentImageList.js +8 -4
  59. package/packages/happy2-server/dist/modules/agent/agentImageList.js.map +1 -1
  60. package/packages/happy2-server/dist/modules/agent/agentImageRequestBuild.d.ts +1 -1
  61. package/packages/happy2-server/dist/modules/agent/agentImageRequestBuild.js +3 -3
  62. package/packages/happy2-server/dist/modules/agent/agentImageRequestBuild.js.map +1 -1
  63. package/packages/happy2-server/dist/modules/agent/agentImageSetDefault.d.ts +1 -1
  64. package/packages/happy2-server/dist/modules/agent/agentImageSetDefault.js +3 -3
  65. package/packages/happy2-server/dist/modules/agent/agentImageSetDefault.js.map +1 -1
  66. package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentDelete.d.ts +1 -1
  67. package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentDelete.js +3 -3
  68. package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentDelete.js.map +1 -1
  69. package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentList.d.ts +1 -1
  70. package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentList.js +3 -3
  71. package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentList.js.map +1 -1
  72. package/packages/happy2-server/dist/modules/agent/agentSecretAttachToAgent.d.ts +1 -1
  73. package/packages/happy2-server/dist/modules/agent/agentSecretAttachToAgent.js +3 -3
  74. package/packages/happy2-server/dist/modules/agent/agentSecretAttachToAgent.js.map +1 -1
  75. package/packages/happy2-server/dist/modules/agent/agentSecretAttachToChannel.d.ts +1 -1
  76. package/packages/happy2-server/dist/modules/agent/agentSecretAttachToChannel.js +3 -3
  77. package/packages/happy2-server/dist/modules/agent/agentSecretAttachToChannel.js.map +1 -1
  78. package/packages/happy2-server/dist/modules/agent/agentSecretAuthorizeManagement.d.ts +4 -3
  79. package/packages/happy2-server/dist/modules/agent/agentSecretAuthorizeManagement.d.ts.map +1 -1
  80. package/packages/happy2-server/dist/modules/agent/agentSecretAuthorizeManagement.js +5 -5
  81. package/packages/happy2-server/dist/modules/agent/agentSecretAuthorizeManagement.js.map +1 -1
  82. package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromAgent.d.ts +1 -1
  83. package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromAgent.js +3 -3
  84. package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromAgent.js.map +1 -1
  85. package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromChannel.d.ts +2 -2
  86. package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromChannel.js +4 -4
  87. package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromChannel.js.map +1 -1
  88. package/packages/happy2-server/dist/modules/agent/agentSecretRecordRegistration.d.ts +1 -1
  89. package/packages/happy2-server/dist/modules/agent/agentSecretRecordRegistration.js +3 -3
  90. package/packages/happy2-server/dist/modules/agent/agentSecretRecordRegistration.js.map +1 -1
  91. package/packages/happy2-server/dist/modules/agent/agentTurnStreamReply.d.ts +4 -0
  92. package/packages/happy2-server/dist/modules/agent/agentTurnStreamReply.d.ts.map +1 -1
  93. package/packages/happy2-server/dist/modules/agent/agentTurnStreamReply.js +207 -9
  94. package/packages/happy2-server/dist/modules/agent/agentTurnStreamReply.js.map +1 -1
  95. package/packages/happy2-server/dist/modules/agent/agentTurnTraceGet.d.ts +8 -0
  96. package/packages/happy2-server/dist/modules/agent/agentTurnTraceGet.d.ts.map +1 -0
  97. package/packages/happy2-server/dist/modules/agent/agentTurnTraceGet.js +86 -0
  98. package/packages/happy2-server/dist/modules/agent/agentTurnTraceGet.js.map +1 -0
  99. package/packages/happy2-server/dist/modules/agent/agentTurnTraceStart.d.ts +19 -0
  100. package/packages/happy2-server/dist/modules/agent/agentTurnTraceStart.d.ts.map +1 -0
  101. package/packages/happy2-server/dist/modules/agent/agentTurnTraceStart.js +87 -0
  102. package/packages/happy2-server/dist/modules/agent/agentTurnTraceStart.js.map +1 -0
  103. package/packages/happy2-server/dist/modules/agent/impl/agentChatContext.d.ts +2 -1
  104. package/packages/happy2-server/dist/modules/agent/impl/agentChatContext.d.ts.map +1 -1
  105. package/packages/happy2-server/dist/modules/agent/impl/agentEffortContext.d.ts +4 -1
  106. package/packages/happy2-server/dist/modules/agent/impl/agentEffortContext.d.ts.map +1 -1
  107. package/packages/happy2-server/dist/modules/agent/impl/agentEffortContextDb.d.ts +3 -3
  108. package/packages/happy2-server/dist/modules/agent/impl/agentEffortContextDb.d.ts.map +1 -1
  109. package/packages/happy2-server/dist/modules/agent/impl/agentEffortContextDb.js +26 -40
  110. package/packages/happy2-server/dist/modules/agent/impl/agentEffortContextDb.js.map +1 -1
  111. package/packages/happy2-server/dist/modules/agent/impl/finishAgentTurn.d.ts.map +1 -1
  112. package/packages/happy2-server/dist/modules/agent/impl/finishAgentTurn.js +63 -2
  113. package/packages/happy2-server/dist/modules/agent/impl/finishAgentTurn.js.map +1 -1
  114. package/packages/happy2-server/dist/modules/agent/types.d.ts +53 -0
  115. package/packages/happy2-server/dist/modules/agent/types.d.ts.map +1 -1
  116. package/packages/happy2-server/dist/modules/agents/daemon.d.ts +31 -2
  117. package/packages/happy2-server/dist/modules/agents/daemon.d.ts.map +1 -1
  118. package/packages/happy2-server/dist/modules/agents/daemon.js +12 -2
  119. package/packages/happy2-server/dist/modules/agents/daemon.js.map +1 -1
  120. package/packages/happy2-server/dist/modules/agents/service.d.ts +13 -6
  121. package/packages/happy2-server/dist/modules/agents/service.d.ts.map +1 -1
  122. package/packages/happy2-server/dist/modules/agents/service.js +497 -49
  123. package/packages/happy2-server/dist/modules/agents/service.js.map +1 -1
  124. package/packages/happy2-server/dist/modules/auth/developmentTokenCreate.d.ts +12 -0
  125. package/packages/happy2-server/dist/modules/auth/developmentTokenCreate.d.ts.map +1 -0
  126. package/packages/happy2-server/dist/modules/auth/developmentTokenCreate.js +27 -0
  127. package/packages/happy2-server/dist/modules/auth/developmentTokenCreate.js.map +1 -0
  128. package/packages/happy2-server/dist/modules/auth/developmentTokenFindActive.d.ts +8 -0
  129. package/packages/happy2-server/dist/modules/auth/developmentTokenFindActive.d.ts.map +1 -0
  130. package/packages/happy2-server/dist/modules/auth/developmentTokenFindActive.js +22 -0
  131. package/packages/happy2-server/dist/modules/auth/developmentTokenFindActive.js.map +1 -0
  132. package/packages/happy2-server/dist/modules/auth/methods.d.ts +1 -0
  133. package/packages/happy2-server/dist/modules/auth/methods.d.ts.map +1 -1
  134. package/packages/happy2-server/dist/modules/auth/methods.js +10 -6
  135. package/packages/happy2-server/dist/modules/auth/methods.js.map +1 -1
  136. package/packages/happy2-server/dist/modules/auth/service.d.ts +2 -0
  137. package/packages/happy2-server/dist/modules/auth/service.d.ts.map +1 -1
  138. package/packages/happy2-server/dist/modules/auth/service.js +26 -0
  139. package/packages/happy2-server/dist/modules/auth/service.js.map +1 -1
  140. package/packages/happy2-server/dist/modules/auth/tokens.d.ts +13 -0
  141. package/packages/happy2-server/dist/modules/auth/tokens.d.ts.map +1 -1
  142. package/packages/happy2-server/dist/modules/auth/tokens.js +59 -0
  143. package/packages/happy2-server/dist/modules/auth/tokens.js.map +1 -1
  144. package/packages/happy2-server/dist/modules/auth/tokens.test.d.ts +2 -0
  145. package/packages/happy2-server/dist/modules/auth/tokens.test.d.ts.map +1 -0
  146. package/packages/happy2-server/dist/modules/auth/tokens.test.js +48 -0
  147. package/packages/happy2-server/dist/modules/auth/tokens.test.js.map +1 -0
  148. package/packages/happy2-server/dist/modules/chat/asAgentTurnTrace.d.ts +17 -0
  149. package/packages/happy2-server/dist/modules/chat/asAgentTurnTrace.d.ts.map +1 -0
  150. package/packages/happy2-server/dist/modules/chat/asAgentTurnTrace.js +98 -0
  151. package/packages/happy2-server/dist/modules/chat/asAgentTurnTrace.js.map +1 -0
  152. package/packages/happy2-server/dist/modules/chat/asServiceMessage.d.ts.map +1 -1
  153. package/packages/happy2-server/dist/modules/chat/asServiceMessage.js +13 -5
  154. package/packages/happy2-server/dist/modules/chat/asServiceMessage.js.map +1 -1
  155. package/packages/happy2-server/dist/modules/chat/chatUpdateMetadata.d.ts +20 -0
  156. package/packages/happy2-server/dist/modules/chat/chatUpdateMetadata.d.ts.map +1 -0
  157. package/packages/happy2-server/dist/modules/chat/chatUpdateMetadata.js +38 -0
  158. package/packages/happy2-server/dist/modules/chat/chatUpdateMetadata.js.map +1 -0
  159. package/packages/happy2-server/dist/modules/chat/types.d.ts +6 -0
  160. package/packages/happy2-server/dist/modules/chat/types.d.ts.map +1 -1
  161. package/packages/happy2-server/dist/modules/chat/types.js.map +1 -1
  162. package/packages/happy2-server/dist/modules/chat/userRequireActiveHuman.d.ts +7 -0
  163. package/packages/happy2-server/dist/modules/chat/userRequireActiveHuman.d.ts.map +1 -0
  164. package/packages/happy2-server/dist/modules/chat/userRequireActiveHuman.js +19 -0
  165. package/packages/happy2-server/dist/modules/chat/userRequireActiveHuman.js.map +1 -0
  166. package/packages/happy2-server/dist/modules/chat/userRequireServerAdmin.d.ts +2 -2
  167. package/packages/happy2-server/dist/modules/chat/userRequireServerAdmin.d.ts.map +1 -1
  168. package/packages/happy2-server/dist/modules/chat/userRequireServerAdmin.js +8 -5
  169. package/packages/happy2-server/dist/modules/chat/userRequireServerAdmin.js.map +1 -1
  170. package/packages/happy2-server/dist/modules/config/defaults.d.ts.map +1 -1
  171. package/packages/happy2-server/dist/modules/config/defaults.js +3 -0
  172. package/packages/happy2-server/dist/modules/config/defaults.js.map +1 -1
  173. package/packages/happy2-server/dist/modules/config/defaults.test.js +1 -0
  174. package/packages/happy2-server/dist/modules/config/defaults.test.js.map +1 -1
  175. package/packages/happy2-server/dist/modules/config/loader.d.ts.map +1 -1
  176. package/packages/happy2-server/dist/modules/config/loader.js +9 -0
  177. package/packages/happy2-server/dist/modules/config/loader.js.map +1 -1
  178. package/packages/happy2-server/dist/modules/config/loader.test.js +27 -0
  179. package/packages/happy2-server/dist/modules/config/loader.test.js.map +1 -1
  180. package/packages/happy2-server/dist/modules/config/type.d.ts +5 -0
  181. package/packages/happy2-server/dist/modules/config/type.d.ts.map +1 -1
  182. package/packages/happy2-server/dist/modules/message/messageGetProjection.d.ts.map +1 -1
  183. package/packages/happy2-server/dist/modules/message/messageGetProjection.js +28 -0
  184. package/packages/happy2-server/dist/modules/message/messageGetProjection.js.map +1 -1
  185. package/packages/happy2-server/dist/modules/permission/impl/permissionEffectiveDb.d.ts +4 -0
  186. package/packages/happy2-server/dist/modules/permission/impl/permissionEffectiveDb.d.ts.map +1 -0
  187. package/packages/happy2-server/dist/modules/permission/impl/permissionEffectiveDb.js +39 -0
  188. package/packages/happy2-server/dist/modules/permission/impl/permissionEffectiveDb.js.map +1 -0
  189. package/packages/happy2-server/dist/modules/permission/impl/permissionMutationRecord.d.ts +10 -0
  190. package/packages/happy2-server/dist/modules/permission/impl/permissionMutationRecord.d.ts.map +1 -0
  191. package/packages/happy2-server/dist/modules/permission/impl/permissionMutationRecord.js +31 -0
  192. package/packages/happy2-server/dist/modules/permission/impl/permissionMutationRecord.js.map +1 -0
  193. package/packages/happy2-server/dist/modules/permission/permissionGetEffective.d.ts +8 -0
  194. package/packages/happy2-server/dist/modules/permission/permissionGetEffective.d.ts.map +1 -0
  195. package/packages/happy2-server/dist/modules/permission/permissionGetEffective.js +13 -0
  196. package/packages/happy2-server/dist/modules/permission/permissionGetEffective.js.map +1 -0
  197. package/packages/happy2-server/dist/modules/permission/roleCreate.d.ts +16 -0
  198. package/packages/happy2-server/dist/modules/permission/roleCreate.d.ts.map +1 -0
  199. package/packages/happy2-server/dist/modules/permission/roleCreate.js +70 -0
  200. package/packages/happy2-server/dist/modules/permission/roleCreate.js.map +1 -0
  201. package/packages/happy2-server/dist/modules/permission/roleDelete.d.ts +11 -0
  202. package/packages/happy2-server/dist/modules/permission/roleDelete.d.ts.map +1 -0
  203. package/packages/happy2-server/dist/modules/permission/roleDelete.js +41 -0
  204. package/packages/happy2-server/dist/modules/permission/roleDelete.js.map +1 -0
  205. package/packages/happy2-server/dist/modules/permission/roleList.d.ts +8 -0
  206. package/packages/happy2-server/dist/modules/permission/roleList.d.ts.map +1 -0
  207. package/packages/happy2-server/dist/modules/permission/roleList.js +36 -0
  208. package/packages/happy2-server/dist/modules/permission/roleList.js.map +1 -0
  209. package/packages/happy2-server/dist/modules/permission/roleUpdate.d.ts +14 -0
  210. package/packages/happy2-server/dist/modules/permission/roleUpdate.d.ts.map +1 -0
  211. package/packages/happy2-server/dist/modules/permission/roleUpdate.js +78 -0
  212. package/packages/happy2-server/dist/modules/permission/roleUpdate.js.map +1 -0
  213. package/packages/happy2-server/dist/modules/permission/types.d.ts +24 -0
  214. package/packages/happy2-server/dist/modules/permission/types.d.ts.map +1 -0
  215. package/packages/happy2-server/dist/modules/permission/types.js +10 -0
  216. package/packages/happy2-server/dist/modules/permission/types.js.map +1 -0
  217. package/packages/happy2-server/dist/modules/permission/userPermissionGet.d.ts +16 -0
  218. package/packages/happy2-server/dist/modules/permission/userPermissionGet.d.ts.map +1 -0
  219. package/packages/happy2-server/dist/modules/permission/userPermissionGet.js +33 -0
  220. package/packages/happy2-server/dist/modules/permission/userPermissionGet.js.map +1 -0
  221. package/packages/happy2-server/dist/modules/permission/userPermissionUpdate.d.ts +12 -0
  222. package/packages/happy2-server/dist/modules/permission/userPermissionUpdate.d.ts.map +1 -0
  223. package/packages/happy2-server/dist/modules/permission/userPermissionUpdate.js +44 -0
  224. package/packages/happy2-server/dist/modules/permission/userPermissionUpdate.js.map +1 -0
  225. package/packages/happy2-server/dist/modules/permission/userRequireAnyPermission.d.ts +8 -0
  226. package/packages/happy2-server/dist/modules/permission/userRequireAnyPermission.d.ts.map +1 -0
  227. package/packages/happy2-server/dist/modules/permission/userRequireAnyPermission.js +12 -0
  228. package/packages/happy2-server/dist/modules/permission/userRequireAnyPermission.js.map +1 -0
  229. package/packages/happy2-server/dist/modules/permission/userRequirePermission.d.ts +8 -0
  230. package/packages/happy2-server/dist/modules/permission/userRequirePermission.d.ts.map +1 -0
  231. package/packages/happy2-server/dist/modules/permission/userRequirePermission.js +12 -0
  232. package/packages/happy2-server/dist/modules/permission/userRequirePermission.js.map +1 -0
  233. package/packages/happy2-server/dist/modules/permission/userRoleAssign.d.ts +12 -0
  234. package/packages/happy2-server/dist/modules/permission/userRoleAssign.d.ts.map +1 -0
  235. package/packages/happy2-server/dist/modules/permission/userRoleAssign.js +46 -0
  236. package/packages/happy2-server/dist/modules/permission/userRoleAssign.js.map +1 -0
  237. package/packages/happy2-server/dist/modules/permission/userRoleUnassign.d.ts +12 -0
  238. package/packages/happy2-server/dist/modules/permission/userRoleUnassign.d.ts.map +1 -0
  239. package/packages/happy2-server/dist/modules/permission/userRoleUnassign.js +53 -0
  240. package/packages/happy2-server/dist/modules/permission/userRoleUnassign.js.map +1 -0
  241. package/packages/happy2-server/dist/modules/plugin/archive.d.ts +7 -0
  242. package/packages/happy2-server/dist/modules/plugin/archive.d.ts.map +1 -0
  243. package/packages/happy2-server/dist/modules/plugin/archive.js +222 -0
  244. package/packages/happy2-server/dist/modules/plugin/archive.js.map +1 -0
  245. package/packages/happy2-server/dist/modules/plugin/catalog.d.ts +5 -1
  246. package/packages/happy2-server/dist/modules/plugin/catalog.d.ts.map +1 -1
  247. package/packages/happy2-server/dist/modules/plugin/catalog.js +75 -15
  248. package/packages/happy2-server/dist/modules/plugin/catalog.js.map +1 -1
  249. package/packages/happy2-server/dist/modules/plugin/catalog.test.js +37 -0
  250. package/packages/happy2-server/dist/modules/plugin/catalog.test.js.map +1 -1
  251. package/packages/happy2-server/dist/modules/plugin/httpBridge.d.ts +1 -0
  252. package/packages/happy2-server/dist/modules/plugin/httpBridge.d.ts.map +1 -1
  253. package/packages/happy2-server/dist/modules/plugin/httpBridge.js +7 -0
  254. package/packages/happy2-server/dist/modules/plugin/httpBridge.js.map +1 -1
  255. package/packages/happy2-server/dist/modules/plugin/impl/asInstallation.d.ts.map +1 -1
  256. package/packages/happy2-server/dist/modules/plugin/impl/asInstallation.js +3 -2
  257. package/packages/happy2-server/dist/modules/plugin/impl/asInstallation.js.map +1 -1
  258. package/packages/happy2-server/dist/modules/plugin/impl/asPlugin.d.ts.map +1 -1
  259. package/packages/happy2-server/dist/modules/plugin/impl/asPlugin.js +17 -3
  260. package/packages/happy2-server/dist/modules/plugin/impl/asPlugin.js.map +1 -1
  261. package/packages/happy2-server/dist/modules/plugin/impl/effectiveContainer.d.ts +3 -0
  262. package/packages/happy2-server/dist/modules/plugin/impl/effectiveContainer.d.ts.map +1 -0
  263. package/packages/happy2-server/dist/modules/plugin/impl/effectiveContainer.js +12 -0
  264. package/packages/happy2-server/dist/modules/plugin/impl/effectiveContainer.js.map +1 -0
  265. package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.d.ts.map +1 -1
  266. package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.js +11 -0
  267. package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.js.map +1 -1
  268. package/packages/happy2-server/dist/modules/plugin/impl/pluginSkillSource.d.ts +11 -0
  269. package/packages/happy2-server/dist/modules/plugin/impl/pluginSkillSource.d.ts.map +1 -0
  270. package/packages/happy2-server/dist/modules/plugin/impl/pluginSkillSource.js +2 -0
  271. package/packages/happy2-server/dist/modules/plugin/impl/pluginSkillSource.js.map +1 -0
  272. package/packages/happy2-server/dist/modules/plugin/packageStore.d.ts +13 -0
  273. package/packages/happy2-server/dist/modules/plugin/packageStore.d.ts.map +1 -1
  274. package/packages/happy2-server/dist/modules/plugin/packageStore.js +122 -14
  275. package/packages/happy2-server/dist/modules/plugin/packageStore.js.map +1 -1
  276. package/packages/happy2-server/dist/modules/plugin/pluginAuthorizeManagement.d.ts +1 -1
  277. package/packages/happy2-server/dist/modules/plugin/pluginAuthorizeManagement.js +3 -3
  278. package/packages/happy2-server/dist/modules/plugin/pluginAuthorizeManagement.js.map +1 -1
  279. package/packages/happy2-server/dist/modules/plugin/pluginCatalogList.d.ts.map +1 -1
  280. package/packages/happy2-server/dist/modules/plugin/pluginCatalogList.js +15 -1
  281. package/packages/happy2-server/dist/modules/plugin/pluginCatalogList.js.map +1 -1
  282. package/packages/happy2-server/dist/modules/plugin/pluginContainerInstanceAuthorize.d.ts +10 -0
  283. package/packages/happy2-server/dist/modules/plugin/pluginContainerInstanceAuthorize.d.ts.map +1 -0
  284. package/packages/happy2-server/dist/modules/plugin/pluginContainerInstanceAuthorize.js +20 -0
  285. package/packages/happy2-server/dist/modules/plugin/pluginContainerInstanceAuthorize.js.map +1 -0
  286. package/packages/happy2-server/dist/modules/plugin/pluginContainerInstanceInvalidate.d.ts +12 -0
  287. package/packages/happy2-server/dist/modules/plugin/pluginContainerInstanceInvalidate.d.ts.map +1 -0
  288. package/packages/happy2-server/dist/modules/plugin/pluginContainerInstanceInvalidate.js +44 -0
  289. package/packages/happy2-server/dist/modules/plugin/pluginContainerInstanceInvalidate.js.map +1 -0
  290. package/packages/happy2-server/dist/modules/plugin/pluginFindBySource.d.ts +3 -1
  291. package/packages/happy2-server/dist/modules/plugin/pluginFindBySource.d.ts.map +1 -1
  292. package/packages/happy2-server/dist/modules/plugin/pluginFindBySource.js +1 -1
  293. package/packages/happy2-server/dist/modules/plugin/pluginFindBySource.js.map +1 -1
  294. package/packages/happy2-server/dist/modules/plugin/pluginGetImage.d.ts +1 -1
  295. package/packages/happy2-server/dist/modules/plugin/pluginGetImage.js +3 -3
  296. package/packages/happy2-server/dist/modules/plugin/pluginGetImage.js.map +1 -1
  297. package/packages/happy2-server/dist/modules/plugin/pluginGetSource.d.ts +13 -0
  298. package/packages/happy2-server/dist/modules/plugin/pluginGetSource.d.ts.map +1 -0
  299. package/packages/happy2-server/dist/modules/plugin/pluginGetSource.js +37 -0
  300. package/packages/happy2-server/dist/modules/plugin/pluginGetSource.js.map +1 -0
  301. package/packages/happy2-server/dist/modules/plugin/pluginInstall.d.ts.map +1 -1
  302. package/packages/happy2-server/dist/modules/plugin/pluginInstall.js +28 -9
  303. package/packages/happy2-server/dist/modules/plugin/pluginInstall.js.map +1 -1
  304. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRuntimeConfiguration.d.ts.map +1 -1
  305. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRuntimeConfiguration.js +18 -7
  306. package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRuntimeConfiguration.js.map +1 -1
  307. package/packages/happy2-server/dist/modules/plugin/pluginInstallationList.d.ts +1 -1
  308. package/packages/happy2-server/dist/modules/plugin/pluginInstallationList.js +3 -3
  309. package/packages/happy2-server/dist/modules/plugin/pluginInstallationList.js.map +1 -1
  310. package/packages/happy2-server/dist/modules/plugin/pluginInstallationListForHost.d.ts +14 -0
  311. package/packages/happy2-server/dist/modules/plugin/pluginInstallationListForHost.d.ts.map +1 -0
  312. package/packages/happy2-server/dist/modules/plugin/pluginInstallationListForHost.js +20 -0
  313. package/packages/happy2-server/dist/modules/plugin/pluginInstallationListForHost.js.map +1 -0
  314. package/packages/happy2-server/dist/modules/plugin/pluginInstallationUpdateStatus.d.ts +1 -0
  315. package/packages/happy2-server/dist/modules/plugin/pluginInstallationUpdateStatus.d.ts.map +1 -1
  316. package/packages/happy2-server/dist/modules/plugin/pluginInstallationUpdateStatus.js +1 -0
  317. package/packages/happy2-server/dist/modules/plugin/pluginInstallationUpdateStatus.js.map +1 -1
  318. package/packages/happy2-server/dist/modules/plugin/pluginList.d.ts +1 -1
  319. package/packages/happy2-server/dist/modules/plugin/pluginList.js +3 -3
  320. package/packages/happy2-server/dist/modules/plugin/pluginList.js.map +1 -1
  321. package/packages/happy2-server/dist/modules/plugin/pluginMcpToolsList.d.ts +11 -0
  322. package/packages/happy2-server/dist/modules/plugin/pluginMcpToolsList.d.ts.map +1 -0
  323. package/packages/happy2-server/dist/modules/plugin/pluginMcpToolsList.js +43 -0
  324. package/packages/happy2-server/dist/modules/plugin/pluginMcpToolsList.js.map +1 -0
  325. package/packages/happy2-server/dist/modules/plugin/pluginMcpToolsListReady.d.ts +15 -0
  326. package/packages/happy2-server/dist/modules/plugin/pluginMcpToolsListReady.d.ts.map +1 -0
  327. package/packages/happy2-server/dist/modules/plugin/pluginMcpToolsListReady.js +37 -0
  328. package/packages/happy2-server/dist/modules/plugin/pluginMcpToolsListReady.js.map +1 -0
  329. package/packages/happy2-server/dist/modules/plugin/pluginMcpToolsReplace.d.ts +16 -0
  330. package/packages/happy2-server/dist/modules/plugin/pluginMcpToolsReplace.d.ts.map +1 -0
  331. package/packages/happy2-server/dist/modules/plugin/pluginMcpToolsReplace.js +71 -0
  332. package/packages/happy2-server/dist/modules/plugin/pluginMcpToolsReplace.js.map +1 -0
  333. package/packages/happy2-server/dist/modules/plugin/pluginSkillsListInstalled.d.ts +8 -0
  334. package/packages/happy2-server/dist/modules/plugin/pluginSkillsListInstalled.d.ts.map +1 -0
  335. package/packages/happy2-server/dist/modules/plugin/pluginSkillsListInstalled.js +24 -0
  336. package/packages/happy2-server/dist/modules/plugin/pluginSkillsListInstalled.js.map +1 -0
  337. package/packages/happy2-server/dist/modules/plugin/pluginSkillsListReady.d.ts +8 -0
  338. package/packages/happy2-server/dist/modules/plugin/pluginSkillsListReady.d.ts.map +1 -0
  339. package/packages/happy2-server/dist/modules/plugin/pluginSkillsListReady.js +25 -0
  340. package/packages/happy2-server/dist/modules/plugin/pluginSkillsListReady.js.map +1 -0
  341. package/packages/happy2-server/dist/modules/plugin/pluginUninstall.d.ts +13 -0
  342. package/packages/happy2-server/dist/modules/plugin/pluginUninstall.d.ts.map +1 -0
  343. package/packages/happy2-server/dist/modules/plugin/pluginUninstall.js +63 -0
  344. package/packages/happy2-server/dist/modules/plugin/pluginUninstall.js.map +1 -0
  345. package/packages/happy2-server/dist/modules/plugin/runtime.d.ts +20 -0
  346. package/packages/happy2-server/dist/modules/plugin/runtime.d.ts.map +1 -1
  347. package/packages/happy2-server/dist/modules/plugin/runtime.js +88 -2
  348. package/packages/happy2-server/dist/modules/plugin/runtime.js.map +1 -1
  349. package/packages/happy2-server/dist/modules/plugin/service.d.ts +64 -5
  350. package/packages/happy2-server/dist/modules/plugin/service.d.ts.map +1 -1
  351. package/packages/happy2-server/dist/modules/plugin/service.js +552 -173
  352. package/packages/happy2-server/dist/modules/plugin/service.js.map +1 -1
  353. package/packages/happy2-server/dist/modules/plugin/source.d.ts +35 -0
  354. package/packages/happy2-server/dist/modules/plugin/source.d.ts.map +1 -0
  355. package/packages/happy2-server/dist/modules/plugin/source.js +189 -0
  356. package/packages/happy2-server/dist/modules/plugin/source.js.map +1 -0
  357. package/packages/happy2-server/dist/modules/plugin/types.d.ts +87 -11
  358. package/packages/happy2-server/dist/modules/plugin/types.d.ts.map +1 -1
  359. package/packages/happy2-server/dist/modules/plugin/types.js +1 -0
  360. package/packages/happy2-server/dist/modules/plugin/types.js.map +1 -1
  361. package/packages/happy2-server/dist/modules/realtime/events.d.ts +3 -0
  362. package/packages/happy2-server/dist/modules/realtime/events.d.ts.map +1 -1
  363. package/packages/happy2-server/dist/modules/realtime/events.js +37 -5
  364. package/packages/happy2-server/dist/modules/realtime/events.js.map +1 -1
  365. package/packages/happy2-server/dist/modules/realtime/local.test.js +2 -0
  366. package/packages/happy2-server/dist/modules/realtime/local.test.js.map +1 -1
  367. package/packages/happy2-server/dist/modules/sandbox/index.d.ts +1 -1
  368. package/packages/happy2-server/dist/modules/sandbox/index.d.ts.map +1 -1
  369. package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.d.ts +8 -1
  370. package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.d.ts.map +1 -1
  371. package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.js +105 -3
  372. package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.js.map +1 -1
  373. package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.test.js +82 -3
  374. package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.test.js.map +1 -1
  375. package/packages/happy2-server/dist/modules/sandbox/types.d.ts +17 -0
  376. package/packages/happy2-server/dist/modules/sandbox/types.d.ts.map +1 -1
  377. package/packages/happy2-server/dist/modules/schema.d.ts +2245 -233
  378. package/packages/happy2-server/dist/modules/schema.d.ts.map +1 -1
  379. package/packages/happy2-server/dist/modules/schema.js +120 -0
  380. package/packages/happy2-server/dist/modules/schema.js.map +1 -1
  381. package/packages/happy2-server/dist/modules/sync/syncGetDifference.d.ts.map +1 -1
  382. package/packages/happy2-server/dist/modules/sync/syncGetDifference.js +2 -0
  383. package/packages/happy2-server/dist/modules/sync/syncGetDifference.js.map +1 -1
  384. package/packages/happy2-server/dist/modules/user/userAdministrationList.js +2 -2
  385. package/packages/happy2-server/dist/modules/user/userAdministrationList.js.map +1 -1
  386. package/packages/happy2-server/dist/modules/user/userAdministrationUpdate.d.ts.map +1 -1
  387. package/packages/happy2-server/dist/modules/user/userAdministrationUpdate.js +49 -6
  388. package/packages/happy2-server/dist/modules/user/userAdministrationUpdate.js.map +1 -1
  389. package/packages/happy2-server/dist/modules/user/userCreateProfile.d.ts.map +1 -1
  390. package/packages/happy2-server/dist/modules/user/userCreateProfile.js +17 -2
  391. package/packages/happy2-server/dist/modules/user/userCreateProfile.js.map +1 -1
  392. package/packages/happy2-server/dist/routes/agents.d.ts.map +1 -1
  393. package/packages/happy2-server/dist/routes/agents.js +4 -2
  394. package/packages/happy2-server/dist/routes/agents.js.map +1 -1
  395. package/packages/happy2-server/dist/routes/auth.d.ts.map +1 -1
  396. package/packages/happy2-server/dist/routes/auth.js +12 -0
  397. package/packages/happy2-server/dist/routes/auth.js.map +1 -1
  398. package/packages/happy2-server/dist/routes/collaboration.d.ts.map +1 -1
  399. package/packages/happy2-server/dist/routes/collaboration.js +7 -0
  400. package/packages/happy2-server/dist/routes/collaboration.js.map +1 -1
  401. package/packages/happy2-server/dist/routes/files.d.ts.map +1 -1
  402. package/packages/happy2-server/dist/routes/files.js +2 -0
  403. package/packages/happy2-server/dist/routes/files.js.map +1 -1
  404. package/packages/happy2-server/dist/routes/permissions.d.ts +6 -0
  405. package/packages/happy2-server/dist/routes/permissions.d.ts.map +1 -0
  406. package/packages/happy2-server/dist/routes/permissions.js +207 -0
  407. package/packages/happy2-server/dist/routes/permissions.js.map +1 -0
  408. package/packages/happy2-server/dist/routes/pluginHost.d.ts +6 -0
  409. package/packages/happy2-server/dist/routes/pluginHost.d.ts.map +1 -0
  410. package/packages/happy2-server/dist/routes/pluginHost.js +106 -0
  411. package/packages/happy2-server/dist/routes/pluginHost.js.map +1 -0
  412. package/packages/happy2-server/dist/routes/plugins.d.ts.map +1 -1
  413. package/packages/happy2-server/dist/routes/plugins.js +159 -5
  414. package/packages/happy2-server/dist/routes/plugins.js.map +1 -1
  415. package/packages/happy2-server/dist/runner.js +20 -1
  416. package/packages/happy2-server/dist/runner.js.map +1 -1
  417. package/packages/happy2-server/dist/server.d.ts +4 -0
  418. package/packages/happy2-server/dist/server.d.ts.map +1 -1
  419. package/packages/happy2-server/dist/server.js +23 -1
  420. package/packages/happy2-server/dist/server.js.map +1 -1
  421. package/packages/happy2-server/dist/systemService.d.ts.map +1 -1
  422. package/packages/happy2-server/dist/systemService.js +16 -1
  423. package/packages/happy2-server/dist/systemService.js.map +1 -1
  424. package/packages/happy2-server/dist/systemService.test.js +15 -1
  425. package/packages/happy2-server/dist/systemService.test.js.map +1 -1
  426. package/packages/happy2-server/dist/web/assets/index-BaPUPGPe.css +2 -0
  427. package/packages/happy2-server/dist/web/assets/index-BnhFxR3U.js +39 -0
  428. package/packages/happy2-server/dist/web/index.html +2 -2
  429. package/packages/happy2-server/drizzle/0022_plugin_container_runtime_tools.sql +16 -0
  430. package/packages/happy2-server/drizzle/0023_roles_and_permissions.sql +82 -0
  431. package/packages/happy2-server/drizzle/0024_session_bound_dev_tokens.sql +11 -0
  432. package/packages/happy2-server/drizzle/0025_plugin_skills.sql +8 -0
  433. package/packages/happy2-server/drizzle/0026_agent_turn_traces.sql +35 -0
  434. package/packages/happy2-server/drizzle/0027_chat_agent_effort.sql +9 -0
  435. package/packages/happy2-server/drizzle/meta/_journal.json +42 -0
  436. package/packages/happy2-server/happy2.example.toml +14 -0
  437. package/packages/happy2-server/plugins/README.md +3 -1
  438. package/packages/happy2-server/plugins/chat-management/container/Dockerfile +6 -0
  439. package/packages/happy2-server/plugins/chat-management/plugin.json +17 -0
  440. package/packages/happy2-server/plugins/chat-management/plugin.png +0 -0
  441. package/packages/happy2-server/plugins/chat-management/server.mjs +113 -0
  442. package/packages/happy2-server/dist/web/assets/index-9SGCQLg7.js +0 -46
  443. package/packages/happy2-server/dist/web/assets/index-DWXBQDJB.css +0 -2
package/README.md CHANGED
@@ -49,6 +49,16 @@ Open [http://127.0.0.1:3000](http://127.0.0.1:3000) in your browser. Happy (2)
49
49
  stores its database, files, generated secrets, agent workspaces, and private Rig
50
50
  runtime under `.happy2` in the directory where you start it.
51
51
 
52
+ Run it in the background without installing an operating-system service with:
53
+
54
+ ```sh
55
+ npx happy2 daemon start
56
+ npx happy2 daemon stop
57
+ ```
58
+
59
+ The daemon stores `happy2.pid` and `happy2.log` under `./.happy2`. Stopping it
60
+ terminates the daemon process tree and removes the PID file.
61
+
52
62
  Keep Happy (2) running across reboots with:
53
63
 
54
64
  ```sh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "happy2",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "Happy (2) desktop web app and server bundle",
5
5
  "repository": {
6
6
  "type": "git",
@@ -71,7 +71,7 @@
71
71
  "@libsql/client": "^0.17.4",
72
72
  "@modelcontextprotocol/sdk": "^1.29.0",
73
73
  "@paralleldrive/cuid2": "^3.3.0",
74
- "@slopus/rig": "^0.0.24",
74
+ "@slopus/rig": "^0.0.25",
75
75
  "drizzle-orm": "^0.45.2",
76
76
  "fastify": "^5.8.2",
77
77
  "jose": "^6.1.3",
@@ -1,34 +1,41 @@
1
1
  # Server plugins
2
2
 
3
- Happy (2) plugins package Agent Skills, an MCP server, or both. This first
4
- server-side implementation installs only packages bundled with the server. It
5
- already keeps catalog discovery, durable system plugins, immutable package/image
6
- snapshots, and independent runtime installations separate so a later remote
7
- catalog/download step can reuse the same boundaries.
3
+ Happy (2) plugins package Agent Skills, a persistent container command, an MCP
4
+ server, or any useful combination of those pieces. Administrators can install a
5
+ built-in package, upload one ZIP, download one ZIP over HTTPS, or import a GitHub
6
+ repository. Catalog discovery, verified preparation, durable system plugins,
7
+ immutable package/image snapshots, writable installation data, and independent
8
+ runtime installations remain separate boundaries.
8
9
 
9
10
  Plugin management is system-wide and administrator-only. The first installation
10
11
  of a catalog package creates one durable system-plugin record and one immutable
11
12
  package snapshot; later installations reuse that plugin identity and snapshot.
12
13
  Every installation has its own CUID2, variables, selected image, lifecycle, and
13
- dedicated container when it is a local stdio MCP. Remote MCP configuration is
14
+ dedicated container when it has a local runtime. Remote MCP configuration is
14
15
  persisted and health-checked independently per installation. Ready MCP
15
- installations expose their tools to Rig as durable external functions on every
16
- agent submission. Happy executes each durable call against the originating
16
+ installations expose their durably cached tools to Rig as external functions on
17
+ every agent submission. Happy executes each durable call against the originating
17
18
  installation and resolves the result back into the paused Rig run. This feature
18
- does not yet inject installed skills, and it does not yet implement upgrade,
19
- uninstall, marketplace download, or OAuth flows.
20
-
21
- Tool discovery is bounded to 15 seconds per agent submission, and one MCP tool
22
- execution is bounded to 30 seconds so a stalled plugin cannot indefinitely block
23
- turn submission or Rig's global event consumer. Before execution, Happy claims a
24
- 45-second database lease keyed by Rig session and call ID. Other server instances
25
- wait for that lease or replay its completed result instead of concurrently
26
- invoking the same tool. The first terminal outcome, including an MCP error or
27
- timeout, is persisted and reused for every later event delivery; Happy does not
28
- automatically retry an ambiguous failure because the first request may already
29
- have produced an external side effect. A process crash after the MCP side effect
30
- but before the outcome is committed can still cause one lease-expiry replay, so
31
- plugin tools with external side effects should themselves be idempotent.
19
+ does not yet inject installed skills or implement in-place upgrade, marketplace
20
+ discovery, or OAuth flows. Remote update checks report drift but deliberately do
21
+ not replace the installed snapshot.
22
+
23
+ MCP tools are discovered during each runtime activation and atomically replace
24
+ that installation's SQLite cache before it becomes ready. Local discovery runs
25
+ after every container creation, and remote discovery runs on every server
26
+ restart. Rig function discovery reads only this cache rather than opening every
27
+ MCP server again per submission. Each discovery page is bounded to 15
28
+ seconds, and one MCP tool execution is bounded to 30 seconds so a stalled plugin
29
+ cannot indefinitely block turn submission or Rig's global event consumer. Before
30
+ execution, Happy claims a 45-second database lease keyed by Rig session and call
31
+ ID. Other server instances wait for that lease or replay its completed result
32
+ instead of concurrently invoking the same tool. The first terminal outcome,
33
+ including an MCP error or timeout, is persisted and reused for every later event
34
+ delivery; Happy does not automatically retry an ambiguous failure because the
35
+ first request may already have produced an external side effect. A process crash
36
+ after the MCP side effect but before the outcome is committed can still cause one
37
+ lease-expiry replay, so plugin tools with external side effects should themselves
38
+ be idempotent.
32
39
 
33
40
  Rig sessions use Full access so durable external functions are executable without
34
41
  an unresolved permission prompt. Agent code still runs inside Happy's dedicated,
@@ -38,12 +45,16 @@ to a ready installation.
38
45
 
39
46
  ## Package anatomy
40
47
 
41
- Each built-in package is a directory below `packages/happy2-server/plugins`:
48
+ Each package has this shape. Built-ins live below
49
+ `packages/happy2-server/plugins`; installed snapshots live below the configured
50
+ `plugins.directory`:
42
51
 
43
52
  ```text
44
53
  example-plugin/
45
54
  ├── plugin.json
46
55
  ├── plugin.png
56
+ ├── data/ # server-owned; absent from source ZIPs
57
+ │ └── <installation-id>/ # persistent writable workspace
47
58
  ├── container/ # optional; used by bundled stdio runtimes
48
59
  │ └── Dockerfile
49
60
  └── skills/ # optional
@@ -69,6 +80,16 @@ symlinks, unsafe relative paths, duplicate names, oversized packages, malformed
69
80
  frontmatter, and unexpected manifest fields before the catalog becomes
70
81
  available.
71
82
 
83
+ Uploaded and downloaded ZIPs are capped at 50 MiB compressed. Extraction also
84
+ bounds entry count, file count, individual and total uncompressed sizes, and
85
+ actual DEFLATE output. It rejects ZIP64, encryption, unsupported compression,
86
+ links, path traversal, duplicate paths, local/central filename disagreement,
87
+ invalid checksums, and ambiguous generic archives. A generic uploaded or remote
88
+ ZIP must contain exactly one `plugin.json`. GitHub archives may instead contain
89
+ one root `plugin.json` or multiple `plugins/<name>/plugin.json` packages; when
90
+ there are multiple packages, preparation returns each verified candidate so the
91
+ administrator can choose one.
92
+
72
93
  `plugin.json` uses schema version 1:
73
94
 
74
95
  ```json
@@ -91,7 +112,13 @@ available.
91
112
  "description": "Region used for project queries.",
92
113
  "kind": "text"
93
114
  }
94
- ]
115
+ ],
116
+ "container": {
117
+ "dockerfile": "container/Dockerfile",
118
+ "command": "/plugin/bin/indexer",
119
+ "args": ["--watch"],
120
+ "permissions": ["plugins:list"]
121
+ }
95
122
  }
96
123
  ```
97
124
 
@@ -101,10 +128,18 @@ The durable system plugin and every installation receive separate CUID2 IDs.
101
128
  Variable keys are environment variable names. Every declared variable is
102
129
  required for each installation. Secret values are encrypted with AES-256-GCM
103
130
  and are never returned by catalog or installation reads; text values are stored
104
- as ordinary configuration. Both kinds are supplied to a stdio process as
105
- environment variables.
131
+ as ordinary configuration. Both kinds are supplied to configured local
132
+ processes as environment variables.
106
133
 
107
- A package must contain at least one skill or an `mcp` definition.
134
+ A package must contain at least one skill, `container`, or `mcp` definition.
135
+ `container.command` is optional when the same container exposes a stdio MCP;
136
+ otherwise it is required. A command and stdio MCP run alongside each other in
137
+ the same dedicated installation container. Container variables are supplied to
138
+ each configured process, not persisted in the image or container definition.
139
+
140
+ `container.permissions` is an exact allowlist of host API capabilities. The
141
+ currently supported permission is `plugins:list`. Unknown and duplicate
142
+ permissions are rejected when the package is loaded.
108
143
 
109
144
  The bundled `hello` package is the minimal skill-plus-MCP example. It declares no
110
145
  variables or MCP authentication, so an administrator can install it with an
@@ -118,10 +153,12 @@ container.
118
153
  "mcp": {
119
154
  "type": "stdio",
120
155
  "command": "/plugin/bin/project-mcp",
121
- "args": ["--stdio"],
122
- "container": {
123
- "dockerfile": "container/Dockerfile"
124
- }
156
+ "args": ["--stdio"]
157
+ },
158
+ "container": {
159
+ "dockerfile": "container/Dockerfile",
160
+ "args": [],
161
+ "permissions": []
125
162
  }
126
163
  }
127
164
  ```
@@ -129,7 +166,8 @@ container.
129
166
  The Dockerfile path is package-relative. Creating the durable system plugin
130
167
  copies the entire package once to `plugins.directory` before writing its
131
168
  database record. Each installation lifecycle builds or resolves that exact
132
- snapshot with the selected local Docker or Podman provider, using a
169
+ snapshot, excluding the server-owned `data/` subtree from the build context,
170
+ with the selected local Docker or Podman provider, using a
133
171
  content-addressed `happy2-plugin:<sha256>` tag. It then creates a dedicated,
134
172
  read-only container named from the installation CUID2, with `init`, all Linux capabilities
135
173
  dropped, privilege escalation disabled, bounded shared memory, and ephemeral
@@ -142,26 +180,38 @@ bundled Dockerfile is responsible for copying or installing its MCP executable
142
180
  and dependencies into the image. The MCP command itself must use newline-
143
181
  delimited JSON-RPC on stdin/stdout and must not write non-protocol output to
144
182
  stdout.
145
- The fixed `HOME`, `TMPDIR`, and working directory are `/tmp`, so tools that
146
- need a cache can still run without making the image root writable.
183
+ The fixed `HOME` and `TMPDIR` are `/tmp`. The server creates
184
+ `<plugins.directory>/<plugin-id>/data/<installation-id>` with private
185
+ permissions, bind-mounts it read-write at `/workspace`, and uses `/workspace` as
186
+ the container working directory. This is the plugin's persistent filesystem;
187
+ the image root remains read-only. Different installations never share a data
188
+ directory. Uninstalling the system plugin removes every linked installation,
189
+ container, immutable package asset, and data subtree.
147
190
 
148
191
  Each installation container stays alive as that installation's plugin runtime.
149
- Each HTTP MCP session starts
192
+ The optional persistent command is started detached once for each container
193
+ incarnation and monitored through a PID marker in the container's ephemeral
194
+ `/run`. Server restart recovery adopts and resumes monitoring that same command
195
+ without double-starting it. Each HTTP MCP session starts
150
196
  the configured command with `docker exec`/`podman exec`; variables reach that
151
197
  process through Docker/Podman's environment-copy option. Values are never placed
152
198
  in command arguments, Happy's process environment, the long-lived container
153
199
  definition, or the image build; they exist only in the short-lived OCI CLI child
154
- and the MCP process. Variables that could alter the OCI client itself, such as
200
+ and the target persistent-command or MCP process. Variables that could alter the OCI client itself, such as
155
201
  `DOCKER_*`, proxy, loader, or executable-path settings, are rejected. Happy
156
202
  transparently bridges newline-delimited stdio JSON-RPC to MCP Streamable HTTP, so
157
203
  the plugin itself does not need an HTTP server.
158
204
 
159
205
  ## Stdio MCP using a selected container image
160
206
 
161
- Omit `mcp.container` when the plugin does not bundle its own Dockerfile:
207
+ Omit `container.dockerfile` when the plugin does not bundle its own Dockerfile:
162
208
 
163
209
  ```json
164
210
  {
211
+ "container": {
212
+ "args": [],
213
+ "permissions": []
214
+ },
165
215
  "mcp": {
166
216
  "type": "stdio",
167
217
  "command": "npx",
@@ -203,6 +253,39 @@ custom static headers described above. Production remote requests are capped at
203
253
  1,000,000 bytes and responses at 256,000 bytes, matching the bounded webhook
204
254
  transport used for SSRF-safe address pinning.
205
255
 
256
+ ## External package preparation
257
+
258
+ External installation is a two-step, administrator-only flow. Preparation does
259
+ all network and archive work before durable installation, and streams progress
260
+ as SSE:
261
+
262
+ - `POST /v0/admin/pluginPackages/preparePlugin` accepts either multipart form
263
+ data with one `plugin` ZIP file, or JSON containing
264
+ `{"source":{"kind":"zip_url"|"github","url":"https://..."}}`.
265
+ - The server downloads remote archives through its public-HTTPS SSRF policy,
266
+ revalidates and pins DNS at every redirect, verifies package structure and
267
+ metadata, and emits `progress` events.
268
+ - It emits `prepared` for one candidate or `selection_required` for multiple
269
+ GitHub candidates. Each candidate includes a 15-minute, administrator-bound,
270
+ one-use `preparedToken`, the immutable digest, source identity, version,
271
+ display name, description, skill descriptions, variable definitions, MCP
272
+ mode, and image metadata.
273
+ - `POST /v0/admin/pluginPackages/installPlugin` accepts the selected
274
+ `preparedToken`, `variables`, and optional `containerImageId`. It returns HTTP
275
+ 202 after consuming the token and making the installation durable.
276
+
277
+ A GitHub URL may identify a repository or one `tree/<ref>` URL. The root
278
+ `plugin.json` wins when present; otherwise the server discovers direct
279
+ `plugins/<name>` children. ZIP URLs are stored as their normalized URL. Uploaded
280
+ packages have content-addressed source identities and cannot be checked for a
281
+ remote update.
282
+
283
+ `POST /v0/admin/systemPlugins/:pluginId/checkForUpdate` is also an SSE endpoint.
284
+ It downloads and verifies the same selected remote path, emits progress, then a
285
+ `checked` event containing installed and remote versions/digests plus
286
+ `updateAvailable`. Built-ins are compared with the current catalog. The check is
287
+ read-only; a changed package requires an explicit future upgrade flow.
288
+
206
289
  ## Installation and lifecycle
207
290
 
208
291
  `POST /v0/admin/plugins/:shortName/installPlugin` accepts:
@@ -220,8 +303,8 @@ transport used for SSRF-safe address pinning.
220
303
  The request body may be omitted when the manifest declares no variables and
221
304
  does not require a selected container image.
222
305
 
223
- `containerImageId` is required only for stdio manifests without a bundled
224
- container, and it is rejected in every other case. Unknown, missing, empty, or
306
+ `containerImageId` is required for every local container manifest without a
307
+ bundled Dockerfile, and it is rejected in every other case. Unknown, missing, empty, or
225
308
  oversized variable values are rejected. The endpoint returns HTTP 202 after the
226
309
  durable system plugin (created once), immutable package/image snapshot, new
227
310
  installation, variables, audit entry, initial state, and sync event are durable.
@@ -235,14 +318,21 @@ explicit upgrade action exists. Catalog reads therefore project the stored
235
318
  variable and MCP requirements for the install form while retaining the newer
236
319
  catalog version and `updateAvailable` indicator.
237
320
 
321
+ `POST /v0/admin/systemPlugins/:pluginId/uninstallPlugin` atomically removes the
322
+ system plugin, all linked installations and secrets, and publishes audit/sync
323
+ evidence. Runtime cleanup then stops linked containers and removes the entire
324
+ stored package directory, including images, descriptors, skills, and every
325
+ installation's persistent `data` directory.
326
+
238
327
  An installation has one of these durable health states:
239
328
 
240
329
  - `preparing`: copying/reconciling package and image/container state.
241
330
  - `starting`: the container exists or remote endpoint is selected and MCP
242
331
  initialization/health checking is in progress.
243
- - `ready`: the MCP server completed initialization and ping (local), or returned
244
- a valid initialization response (remote). A skills-only plugin becomes ready
245
- immediately after its durable install.
332
+ - `ready`: a container-only command survived its startup probe; or a local or
333
+ remote MCP server completed initialization, ping, and durable tool discovery.
334
+ A skills-only plugin becomes ready immediately
335
+ after its durable install.
246
336
  - `broken_configuration`: stored variables, selected image state, manifest
247
337
  material, or resolved headers cannot form a valid runtime configuration.
248
338
  - `failed`: package integrity, image build, container creation, process startup,
@@ -253,8 +343,10 @@ Every transition updates `plugin_installations`, appends a `plugin.*` sync
253
343
  event, and publishes the normal server SSE hint with the `plugins` area. Clients
254
344
  must reconcile the durable catalog after a hint; the event itself is not state.
255
345
  On server restart, every installation is reconciled again. Its package path and
256
- SHA-256 digest are revalidated first; local containers are then recreated from
257
- the installed snapshot, and remote endpoints are rechecked.
346
+ SHA-256 digest are revalidated first; a running local container with matching
347
+ installation and incarnation labels is adopted, otherwise it is recreated from
348
+ the installed snapshot. Adopted persistent commands resume liveness monitoring.
349
+ Remote endpoints are rechecked.
258
350
 
259
351
  ## Read and MCP endpoints
260
352
 
@@ -277,6 +369,72 @@ the installed snapshot, and remote endpoints are rechecked.
277
369
  Streamable HTTP bridge for one ready local stdio installation. It follows MCP
278
370
  session semantics via `Mcp-Session-Id`. Happy’s existing bearer session is
279
371
  required; there is no plugin-specific OAuth exchange.
372
+ - `GET /v0/admin/pluginInstallations/:installationId/mcpTools` returns the last
373
+ successfully synchronized MCP tool schemas from SQLite. It never contacts the
374
+ MCP server. Tool discovery is replaced atomically on every runtime activation,
375
+ including each server restart.
376
+ - `GET /plugins` on the dedicated plugin host listener is the first
377
+ capability-scoped host API. It is deliberately absent from the product API
378
+ listener. A
379
+ container may call it only when its manifest grants `plugins:list` and it
380
+ presents the incarnation token supplied as `HAPPY2_PLUGIN_API_TOKEN`.
381
+ - `POST /chats/updateChat` on that same listener changes the current chat's
382
+ `title` and/or `description`. It requires the installation runtime bearer
383
+ token, the `chats:update` manifest permission, and the current call's chat
384
+ capability in `X-Happy2-Chat-Token`. The endpoint deliberately accepts no
385
+ chat ID: the signed capability selects the chat, so tool arguments cannot
386
+ redirect the update to another conversation.
387
+
388
+ Container processes receive `HAPPY2_PLUGIN_API_URL` and
389
+ `HAPPY2_PLUGIN_API_TOKEN`. The URL is always
390
+ `http://happy2.host.internal:<plugins.host_api_port>`; the hardened container
391
+ adds `happy2.host.internal:host-gateway`, while the capability-only listener
392
+ binds `plugins.host_api_host` on that fixed port. HTTP/TCP and the OCI
393
+ `host-gateway` mapping work across Docker and Podman on macOS and Linux.
394
+ The cross-platform default bind is `0.0.0.0` because a loopback bind is not
395
+ reachable through Docker Desktop's or Podman's host gateway. Operators who
396
+ expose the host to an untrusted LAN should firewall
397
+ `plugins.host_api_port`; it is a container capability endpoint, not a public
398
+ service.
399
+
400
+ The token is an RS256 capability containing the installation ID, a random CUID2
401
+ container-incarnation ID, and the exact manifest permissions. Token bytes are
402
+ never stored. The incarnation ID is stored in `plugin_installations` and also
403
+ attached to the OCI container as `dev.happy2.plugin-instance`. On each request,
404
+ Happy verifies the signature, matches the incarnation against the ready database
405
+ row, and confirms that the correspondingly labelled container is running. A
406
+ stopped, missing, or replaced container therefore receives 403. A surviving
407
+ container and its token remain valid after a server restart; startup adopts the
408
+ matching container and refreshes its MCP tool cache instead of recreating it.
409
+ The token intentionally has no time expiration: its lifetime is exactly the
410
+ database-and-OCI incarnation lifetime, allowing a command to survive arbitrarily
411
+ many server restarts without persisting or rotating token bytes. Killing,
412
+ replacing, failing, or removing that incarnation immediately makes the token
413
+ unauthorized.
414
+ The capability is not a user session and the dedicated listener exposes no
415
+ ordinary `/v0` APIs.
416
+
417
+ When Happy asks an installed MCP tool to run for an agent, it adds the following
418
+ request metadata:
419
+
420
+ ```json
421
+ {
422
+ "_meta": {
423
+ "happy2/chat": {
424
+ "id": "current-chat-cuid2",
425
+ "token": "signed-chat-capability-jwt"
426
+ }
427
+ }
428
+ }
429
+ ```
430
+
431
+ The RS256 chat token has no expiration and is bound to both that chat and the
432
+ specific plugin installation receiving the call. Plugin host chat actions also
433
+ require the running installation's ordinary runtime token; presenting a chat
434
+ token through another installation is rejected. Uninstalling or replacing an
435
+ installation therefore prevents its old chat tokens from being used by a new
436
+ installation. Chat IDs remain immutable and are supplied in metadata and API
437
+ results for correlation, never accepted as mutation input.
280
438
 
281
439
  The bridge allows at most 128 simultaneous sessions server-wide and 16 per
282
440
  authenticated user. Idle sessions close after 15 minutes; inbound requests and
@@ -297,7 +455,9 @@ thumbhash, and SHA-256 checksum.
297
455
 
298
456
  `plugin_installations` records a separate CUID2 and foreign key to `plugins`,
299
457
  plus that instance's container/image choice, lifecycle state, error detail,
300
- installer, and timestamps. `plugin_installation_variables` records each declared
458
+ installer, tool-sync timestamp, and timestamps. `plugin_mcp_tools` contains the
459
+ last complete MCP discovery keyed by installation and tool name.
460
+ `plugin_installation_variables` records each declared
301
461
  value for one installation; secret rows contain authenticated ciphertext rather
302
462
  than plaintext. No installation uses `shortName` as identity.
303
463
 
@@ -18,6 +18,10 @@ npx happy2
18
18
  npx happy2 service start --config ./happy2.toml
19
19
  npx happy2 service stop
20
20
 
21
+ # Start or stop it as a background process in the current directory
22
+ npx happy2 daemon start --config ./happy2.toml
23
+ npx happy2 daemon stop
24
+
21
25
  # Development, with reload and no configuration file:
22
26
  pnpm dev:server
23
27
 
@@ -62,6 +66,13 @@ reinstallation. `happy2 service stop` directly stops and removes the macOS Launc
62
66
  while on Linux it prints the `sudo` commands that stop, disable, and remove the
63
67
  systemd unit.
64
68
 
69
+ `happy2 daemon start` starts the all-in-one app in a detached process group and
70
+ returns immediately. It writes `.happy2/happy2.pid` and appends output to
71
+ `.happy2/happy2.log` in the current directory. `happy2 daemon stop` sends the
72
+ whole process group a graceful termination signal, force-stops it if necessary,
73
+ and removes the PID file. Unlike `service start`, daemon mode does not arrange
74
+ automatic startup after a login or reboot.
75
+
65
76
  The service preserves the installation-time working directory, `PATH`, and
66
77
  optional `RIG_HOME`. When `--config` is supplied, its path is made
67
78
  absolute before installation. Put service secrets and SMTP environment values
@@ -362,13 +373,14 @@ authenticated Unix socket. Configure `[agents]` with the socket, token, Rig
362
373
  executable, and server-owned `default_cwd`; clients cannot select filesystem
363
374
  paths.
364
375
 
365
- An agent's reasoning effort is durable profile state. Any authenticated user can
366
- read its current value and the effort levels supported by all of its active Rig
367
- sessions from `GET /v0/agents/:agentUserId/effort`; only the agent's creator or
368
- a server administrator can change it with
369
- `POST /v0/agents/:agentUserId/changeEffort`. A change is applied to every
370
- existing private Rig session, inherited by sessions created later, reconciled
371
- again after server restart, and published as a normal `users` sync hint.
376
+ An agent's profile effort is the default for new chat sessions. Each bound chat
377
+ stores its own durable override, exposed to active chat members through
378
+ `GET /v0/chats/:chatId/agents/:agentUserId/effort` and
379
+ `POST /v0/chats/:chatId/agents/:agentUserId/changeEffort`. Changing one chat
380
+ updates only that chat's Rig session, survives restart, and appends an
381
+ `agent_effort_changed` service message to the same chat. Choosing the already
382
+ effective value is a no-op and does not add duplicate history. A newly bound
383
+ chat inherits the agent profile default rather than another chat's override.
372
384
 
373
385
  The server seeds immutable `Daycare Minimal` and `Daycare Full` definitions from
374
386
  the pinned upstream Daycare runtime Dockerfiles. Both use Ubuntu 24.04; Full adds
@@ -0,0 +1,39 @@
1
+ export interface DaemonHost {
2
+ cwd: string;
3
+ environment: NodeJS.ProcessEnv;
4
+ executablePath: string;
5
+ executableArguments: readonly string[];
6
+ scriptPath: string;
7
+ directoryCreate(path: string): Promise<void>;
8
+ fileCreate(path: string, contents: string): Promise<boolean>;
9
+ fileExists(path: string): Promise<boolean>;
10
+ fileRead(path: string): Promise<string>;
11
+ fileRemove(path: string): Promise<void>;
12
+ processStart(input: {
13
+ arguments_: readonly string[];
14
+ cwd: string;
15
+ environment: NodeJS.ProcessEnv;
16
+ executablePath: string;
17
+ logPath: string;
18
+ pidPath: string;
19
+ }): Promise<number>;
20
+ processAlive(pid: number): boolean;
21
+ processTreeAlive(pid: number): boolean;
22
+ processTreeSignal(pid: number, signal: NodeJS.Signals): void;
23
+ wait(milliseconds: number): Promise<void>;
24
+ log(message: string): void;
25
+ }
26
+ export type ParsedDaemonCommand = {
27
+ action: "help" | "invalid" | "stop";
28
+ } | {
29
+ action: "start";
30
+ configPath?: string;
31
+ };
32
+ export declare function parseDaemonCommand(arguments_: readonly string[]): ParsedDaemonCommand;
33
+ export declare function daemonStart(options: {
34
+ configPath?: string;
35
+ }, host?: DaemonHost): Promise<void>;
36
+ export declare function daemonStop(host?: DaemonHost): Promise<void>;
37
+ export declare function daemonUsage(): string;
38
+ export declare function createDaemonHost(): DaemonHost;
39
+ //# sourceMappingURL=daemon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../sources/daemon.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,UAAU;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC,UAAU,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,YAAY,CAAC,KAAK,EAAE;QAChB,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;QAC9B,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,EAAE,MAAM,CAAC,UAAU,CAAC;QAC/B,cAAc,EAAE,MAAM,CAAC;QACvB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvC,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IAC7D,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,MAAM,mBAAmB,GACzB;IAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAA;CAAE,GACvC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/C,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,mBAAmB,CAgCrF;AAED,wBAAsB,WAAW,CAC7B,OAAO,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EAChC,IAAI,GAAE,UAA+B,GACtC,OAAO,CAAC,IAAI,CAAC,CAyCf;AAED,wBAAsB,UAAU,CAAC,IAAI,GAAE,UAA+B,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BrF;AAED,wBAAgB,WAAW,IAAI,MAAM,CAQpC;AA4DD,wBAAgB,gBAAgB,IAAI,UAAU,CAuG7C"}