@ixo/oracle-runtime 0.0.1

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 (583) hide show
  1. package/dist/bootstrap/ambient-factory.d.ts +32 -0
  2. package/dist/bootstrap/ambient-factory.d.ts.map +1 -0
  3. package/dist/bootstrap/ambient-factory.js +128 -0
  4. package/dist/bootstrap/create-oracle-app.d.ts +112 -0
  5. package/dist/bootstrap/create-oracle-app.d.ts.map +1 -0
  6. package/dist/bootstrap/create-oracle-app.js +530 -0
  7. package/dist/bootstrap/graceful-shutdown.d.ts +20 -0
  8. package/dist/bootstrap/graceful-shutdown.d.ts.map +1 -0
  9. package/dist/bootstrap/graceful-shutdown.js +61 -0
  10. package/dist/bootstrap/index.d.ts +13 -0
  11. package/dist/bootstrap/index.d.ts.map +1 -0
  12. package/dist/bootstrap/index.js +6 -0
  13. package/dist/bootstrap/inspect.d.ts +74 -0
  14. package/dist/bootstrap/inspect.d.ts.map +1 -0
  15. package/dist/bootstrap/inspect.js +111 -0
  16. package/dist/bootstrap/plugin-loader.d.ts +50 -0
  17. package/dist/bootstrap/plugin-loader.d.ts.map +1 -0
  18. package/dist/bootstrap/plugin-loader.js +119 -0
  19. package/dist/bootstrap/runtime-app-module.d.ts +38 -0
  20. package/dist/bootstrap/runtime-app-module.d.ts.map +1 -0
  21. package/dist/bootstrap/runtime-app-module.js +114 -0
  22. package/dist/bootstrap/schema-composer.d.ts +46 -0
  23. package/dist/bootstrap/schema-composer.d.ts.map +1 -0
  24. package/dist/bootstrap/schema-composer.js +65 -0
  25. package/dist/config/base-env-config.d.ts +31 -0
  26. package/dist/config/base-env-config.d.ts.map +1 -0
  27. package/dist/config/base-env-config.js +70 -0
  28. package/dist/config/base-env-schema.d.ts +77 -0
  29. package/dist/config/base-env-schema.d.ts.map +1 -0
  30. package/dist/config/base-env-schema.js +102 -0
  31. package/dist/events/scoped-emitter.d.ts +33 -0
  32. package/dist/events/scoped-emitter.d.ts.map +1 -0
  33. package/dist/events/scoped-emitter.js +32 -0
  34. package/dist/graph/index.d.ts +8 -0
  35. package/dist/graph/index.d.ts.map +1 -0
  36. package/dist/graph/index.js +6 -0
  37. package/dist/graph/main-agent-types.d.ts +88 -0
  38. package/dist/graph/main-agent-types.d.ts.map +1 -0
  39. package/dist/graph/main-agent-types.js +20 -0
  40. package/dist/graph/main-agent.d.ts +16 -0
  41. package/dist/graph/main-agent.d.ts.map +1 -0
  42. package/dist/graph/main-agent.js +251 -0
  43. package/dist/graph/middlewares/capability-gate-middleware.d.ts +35 -0
  44. package/dist/graph/middlewares/capability-gate-middleware.d.ts.map +1 -0
  45. package/dist/graph/middlewares/capability-gate-middleware.js +54 -0
  46. package/dist/graph/middlewares/index.d.ts +7 -0
  47. package/dist/graph/middlewares/index.d.ts.map +1 -0
  48. package/dist/graph/middlewares/index.js +6 -0
  49. package/dist/graph/middlewares/page-context-middleware.d.ts +23 -0
  50. package/dist/graph/middlewares/page-context-middleware.d.ts.map +1 -0
  51. package/dist/graph/middlewares/page-context-middleware.js +68 -0
  52. package/dist/graph/middlewares/safety-guardrail-middleware.d.ts +26 -0
  53. package/dist/graph/middlewares/safety-guardrail-middleware.d.ts.map +1 -0
  54. package/dist/graph/middlewares/safety-guardrail-middleware.js +88 -0
  55. package/dist/graph/middlewares/summarization-middleware.d.ts +17 -0
  56. package/dist/graph/middlewares/summarization-middleware.d.ts.map +1 -0
  57. package/dist/graph/middlewares/summarization-middleware.js +62 -0
  58. package/dist/graph/middlewares/tool-repetition-guard-middleware.d.ts +24 -0
  59. package/dist/graph/middlewares/tool-repetition-guard-middleware.d.ts.map +1 -0
  60. package/dist/graph/middlewares/tool-repetition-guard-middleware.js +112 -0
  61. package/dist/graph/middlewares/tool-validation-middleware.d.ts +24 -0
  62. package/dist/graph/middlewares/tool-validation-middleware.d.ts.map +1 -0
  63. package/dist/graph/middlewares/tool-validation-middleware.js +61 -0
  64. package/dist/graph/prompt-composer.d.ts +69 -0
  65. package/dist/graph/prompt-composer.d.ts.map +1 -0
  66. package/dist/graph/prompt-composer.js +315 -0
  67. package/dist/graph/state.d.ts +65 -0
  68. package/dist/graph/state.d.ts.map +1 -0
  69. package/dist/graph/state.js +60 -0
  70. package/dist/graph/sub-agent-fallback.d.ts +56 -0
  71. package/dist/graph/sub-agent-fallback.d.ts.map +1 -0
  72. package/dist/graph/sub-agent-fallback.js +79 -0
  73. package/dist/graph/subagent-as-tool.d.ts +77 -0
  74. package/dist/graph/subagent-as-tool.d.ts.map +1 -0
  75. package/dist/graph/subagent-as-tool.js +197 -0
  76. package/dist/graph/wrap-plugin-tool.d.ts +28 -0
  77. package/dist/graph/wrap-plugin-tool.d.ts.map +1 -0
  78. package/dist/graph/wrap-plugin-tool.js +30 -0
  79. package/dist/index.d.ts +33 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +28 -0
  82. package/dist/llm/index.d.ts +2 -0
  83. package/dist/llm/index.d.ts.map +1 -0
  84. package/dist/llm/index.js +1 -0
  85. package/dist/llm/llm-provider.d.ts +41 -0
  86. package/dist/llm/llm-provider.d.ts.map +1 -0
  87. package/dist/llm/llm-provider.js +130 -0
  88. package/dist/manifest/index.d.ts +6 -0
  89. package/dist/manifest/index.d.ts.map +1 -0
  90. package/dist/manifest/index.js +3 -0
  91. package/dist/manifest/schema.d.ts +31 -0
  92. package/dist/manifest/schema.d.ts.map +1 -0
  93. package/dist/manifest/schema.js +44 -0
  94. package/dist/manifest/tier1-renderer.d.ts +31 -0
  95. package/dist/manifest/tier1-renderer.d.ts.map +1 -0
  96. package/dist/manifest/tier1-renderer.js +68 -0
  97. package/dist/manifest/validator.d.ts +34 -0
  98. package/dist/manifest/validator.d.ts.map +1 -0
  99. package/dist/manifest/validator.js +111 -0
  100. package/dist/matrix/checkpointer/matrix-upload-utils.d.ts +66 -0
  101. package/dist/matrix/checkpointer/matrix-upload-utils.d.ts.map +1 -0
  102. package/dist/matrix/checkpointer/matrix-upload-utils.js +228 -0
  103. package/dist/matrix/checkpointer/type.d.ts +4 -0
  104. package/dist/matrix/checkpointer/type.d.ts.map +1 -0
  105. package/dist/matrix/checkpointer/type.js +1 -0
  106. package/dist/matrix/checkpointer/user-matrix-sqlite-sync-service.module.d.ts +3 -0
  107. package/dist/matrix/checkpointer/user-matrix-sqlite-sync-service.module.d.ts.map +1 -0
  108. package/dist/matrix/checkpointer/user-matrix-sqlite-sync-service.module.js +22 -0
  109. package/dist/matrix/checkpointer/user-matrix-sqlite-sync-service.service.d.ts +93 -0
  110. package/dist/matrix/checkpointer/user-matrix-sqlite-sync-service.service.d.ts.map +1 -0
  111. package/dist/matrix/checkpointer/user-matrix-sqlite-sync-service.service.js +856 -0
  112. package/dist/matrix/room-membership.d.ts +11 -0
  113. package/dist/matrix/room-membership.d.ts.map +1 -0
  114. package/dist/matrix/room-membership.js +33 -0
  115. package/dist/meta-tools/index.d.ts +28 -0
  116. package/dist/meta-tools/index.d.ts.map +1 -0
  117. package/dist/meta-tools/index.js +24 -0
  118. package/dist/meta-tools/list-capabilities.d.ts +12 -0
  119. package/dist/meta-tools/list-capabilities.d.ts.map +1 -0
  120. package/dist/meta-tools/list-capabilities.js +55 -0
  121. package/dist/meta-tools/load-capability.d.ts +24 -0
  122. package/dist/meta-tools/load-capability.d.ts.map +1 -0
  123. package/dist/meta-tools/load-capability.js +82 -0
  124. package/dist/modules/auth/auth-header.middleware.d.ts +37 -0
  125. package/dist/modules/auth/auth-header.middleware.d.ts.map +1 -0
  126. package/dist/modules/auth/auth-header.middleware.js +115 -0
  127. package/dist/modules/auth/auth.module.d.ts +9 -0
  128. package/dist/modules/auth/auth.module.d.ts.map +1 -0
  129. package/dist/modules/auth/auth.module.js +27 -0
  130. package/dist/modules/auth/index.d.ts +3 -0
  131. package/dist/modules/auth/index.d.ts.map +1 -0
  132. package/dist/modules/auth/index.js +2 -0
  133. package/dist/modules/auth/validate-ucan-delegation.d.ts +31 -0
  134. package/dist/modules/auth/validate-ucan-delegation.d.ts.map +1 -0
  135. package/dist/modules/auth/validate-ucan-delegation.js +36 -0
  136. package/dist/modules/blob-store/blob-store.module.d.ts +10 -0
  137. package/dist/modules/blob-store/blob-store.module.d.ts.map +1 -0
  138. package/dist/modules/blob-store/blob-store.module.js +25 -0
  139. package/dist/modules/blob-store/blob-store.service.d.ts +66 -0
  140. package/dist/modules/blob-store/blob-store.service.d.ts.map +1 -0
  141. package/dist/modules/blob-store/blob-store.service.js +108 -0
  142. package/dist/modules/blob-store/index.d.ts +3 -0
  143. package/dist/modules/blob-store/index.d.ts.map +1 -0
  144. package/dist/modules/blob-store/index.js +2 -0
  145. package/dist/modules/health/health.controller.d.ts +18 -0
  146. package/dist/modules/health/health.controller.d.ts.map +1 -0
  147. package/dist/modules/health/health.controller.js +48 -0
  148. package/dist/modules/health/health.module.d.ts +8 -0
  149. package/dist/modules/health/health.module.d.ts.map +1 -0
  150. package/dist/modules/health/health.module.js +21 -0
  151. package/dist/modules/index.d.ts +8 -0
  152. package/dist/modules/index.d.ts.map +1 -0
  153. package/dist/modules/index.js +6 -0
  154. package/dist/modules/messages/__test-fixtures__/deps.d.ts +41 -0
  155. package/dist/modules/messages/__test-fixtures__/deps.d.ts.map +1 -0
  156. package/dist/modules/messages/__test-fixtures__/deps.js +73 -0
  157. package/dist/modules/messages/__test-fixtures__/fake-agent.d.ts +27 -0
  158. package/dist/modules/messages/__test-fixtures__/fake-agent.d.ts.map +1 -0
  159. package/dist/modules/messages/__test-fixtures__/fake-agent.js +41 -0
  160. package/dist/modules/messages/__test-fixtures__/fake-response.d.ts +29 -0
  161. package/dist/modules/messages/__test-fixtures__/fake-response.d.ts.map +1 -0
  162. package/dist/modules/messages/__test-fixtures__/fake-response.js +55 -0
  163. package/dist/modules/messages/agent-builder.d.ts +64 -0
  164. package/dist/modules/messages/agent-builder.d.ts.map +1 -0
  165. package/dist/modules/messages/agent-builder.js +219 -0
  166. package/dist/modules/messages/batch-invoker.d.ts +36 -0
  167. package/dist/modules/messages/batch-invoker.d.ts.map +1 -0
  168. package/dist/modules/messages/batch-invoker.js +58 -0
  169. package/dist/modules/messages/dto/list-messages.dto.d.ts +4 -0
  170. package/dist/modules/messages/dto/list-messages.dto.d.ts.map +1 -0
  171. package/dist/modules/messages/dto/list-messages.dto.js +17 -0
  172. package/dist/modules/messages/dto/send-message.dto.d.ts +73 -0
  173. package/dist/modules/messages/dto/send-message.dto.d.ts.map +1 -0
  174. package/dist/modules/messages/dto/send-message.dto.js +318 -0
  175. package/dist/modules/messages/file-processing-credit-sink.port.d.ts +20 -0
  176. package/dist/modules/messages/file-processing-credit-sink.port.d.ts.map +1 -0
  177. package/dist/modules/messages/file-processing-credit-sink.port.js +1 -0
  178. package/dist/modules/messages/file-processing.service.d.ts +195 -0
  179. package/dist/modules/messages/file-processing.service.d.ts.map +1 -0
  180. package/dist/modules/messages/file-processing.service.js +1278 -0
  181. package/dist/modules/messages/homeserver-cache.d.ts +11 -0
  182. package/dist/modules/messages/homeserver-cache.d.ts.map +1 -0
  183. package/dist/modules/messages/homeserver-cache.js +31 -0
  184. package/dist/modules/messages/matrix-listener-bridge.d.ts +63 -0
  185. package/dist/modules/messages/matrix-listener-bridge.d.ts.map +1 -0
  186. package/dist/modules/messages/matrix-listener-bridge.js +280 -0
  187. package/dist/modules/messages/messages.controller.d.ts +13 -0
  188. package/dist/modules/messages/messages.controller.d.ts.map +1 -0
  189. package/dist/modules/messages/messages.controller.js +95 -0
  190. package/dist/modules/messages/messages.module.d.ts +3 -0
  191. package/dist/modules/messages/messages.module.d.ts.map +1 -0
  192. package/dist/modules/messages/messages.module.js +75 -0
  193. package/dist/modules/messages/messages.service.d.ts +112 -0
  194. package/dist/modules/messages/messages.service.d.ts.map +1 -0
  195. package/dist/modules/messages/messages.service.js +279 -0
  196. package/dist/modules/messages/oracle-runtime-bundle.d.ts +38 -0
  197. package/dist/modules/messages/oracle-runtime-bundle.d.ts.map +1 -0
  198. package/dist/modules/messages/oracle-runtime-bundle.js +40 -0
  199. package/dist/modules/messages/post-message-syncer.d.ts +30 -0
  200. package/dist/modules/messages/post-message-syncer.d.ts.map +1 -0
  201. package/dist/modules/messages/post-message-syncer.js +73 -0
  202. package/dist/modules/messages/request-preparer.d.ts +53 -0
  203. package/dist/modules/messages/request-preparer.d.ts.map +1 -0
  204. package/dist/modules/messages/request-preparer.js +139 -0
  205. package/dist/modules/messages/sse-stream-runner.d.ts +73 -0
  206. package/dist/modules/messages/sse-stream-runner.d.ts.map +1 -0
  207. package/dist/modules/messages/sse-stream-runner.js +352 -0
  208. package/dist/modules/messages/sse.utils.d.ts +29 -0
  209. package/dist/modules/messages/sse.utils.d.ts.map +1 -0
  210. package/dist/modules/messages/sse.utils.js +77 -0
  211. package/dist/modules/messages/user-context-fetcher.d.ts +41 -0
  212. package/dist/modules/messages/user-context-fetcher.d.ts.map +1 -0
  213. package/dist/modules/messages/user-context-fetcher.js +117 -0
  214. package/dist/modules/secrets/index.d.ts +2 -0
  215. package/dist/modules/secrets/index.d.ts.map +1 -0
  216. package/dist/modules/secrets/index.js +1 -0
  217. package/dist/modules/secrets/secrets.service.d.ts +29 -0
  218. package/dist/modules/secrets/secrets.service.d.ts.map +1 -0
  219. package/dist/modules/secrets/secrets.service.js +107 -0
  220. package/dist/modules/sessions/dto/create-session.dto.d.ts +6 -0
  221. package/dist/modules/sessions/dto/create-session.dto.d.ts.map +1 -0
  222. package/dist/modules/sessions/dto/create-session.dto.js +5 -0
  223. package/dist/modules/sessions/dto/delete-session.dto.d.ts +6 -0
  224. package/dist/modules/sessions/dto/delete-session.dto.d.ts.map +1 -0
  225. package/dist/modules/sessions/dto/delete-session.dto.js +5 -0
  226. package/dist/modules/sessions/dto/list-sessions.dto.d.ts +7 -0
  227. package/dist/modules/sessions/dto/list-sessions.dto.d.ts.map +1 -0
  228. package/dist/modules/sessions/dto/list-sessions.dto.js +6 -0
  229. package/dist/modules/sessions/session-history-processor.service.d.ts +48 -0
  230. package/dist/modules/sessions/session-history-processor.service.d.ts.map +1 -0
  231. package/dist/modules/sessions/session-history-processor.service.js +254 -0
  232. package/dist/modules/sessions/sessions.controller.d.ts +13 -0
  233. package/dist/modules/sessions/sessions.controller.d.ts.map +1 -0
  234. package/dist/modules/sessions/sessions.controller.js +113 -0
  235. package/dist/modules/sessions/sessions.module.d.ts +3 -0
  236. package/dist/modules/sessions/sessions.module.d.ts.map +1 -0
  237. package/dist/modules/sessions/sessions.module.js +49 -0
  238. package/dist/modules/sessions/sessions.service.d.ts +23 -0
  239. package/dist/modules/sessions/sessions.service.d.ts.map +1 -0
  240. package/dist/modules/sessions/sessions.service.js +168 -0
  241. package/dist/modules/subscription/subscription.middleware.d.ts +37 -0
  242. package/dist/modules/subscription/subscription.middleware.d.ts.map +1 -0
  243. package/dist/modules/subscription/subscription.middleware.js +141 -0
  244. package/dist/modules/subscription/subscription.module.d.ts +12 -0
  245. package/dist/modules/subscription/subscription.module.d.ts.map +1 -0
  246. package/dist/modules/subscription/subscription.module.js +26 -0
  247. package/dist/modules/throttler/throttler.module.d.ts +11 -0
  248. package/dist/modules/throttler/throttler.module.d.ts.map +1 -0
  249. package/dist/modules/throttler/throttler.module.js +32 -0
  250. package/dist/modules/ucan/index.d.ts +7 -0
  251. package/dist/modules/ucan/index.d.ts.map +1 -0
  252. package/dist/modules/ucan/index.js +6 -0
  253. package/dist/modules/ucan/ucan.config.d.ts +87 -0
  254. package/dist/modules/ucan/ucan.config.d.ts.map +1 -0
  255. package/dist/modules/ucan/ucan.config.js +114 -0
  256. package/dist/modules/ucan/ucan.module.d.ts +29 -0
  257. package/dist/modules/ucan/ucan.module.d.ts.map +1 -0
  258. package/dist/modules/ucan/ucan.module.js +46 -0
  259. package/dist/modules/ucan/ucan.service.d.ts +129 -0
  260. package/dist/modules/ucan/ucan.service.d.ts.map +1 -0
  261. package/dist/modules/ucan/ucan.service.js +582 -0
  262. package/dist/modules/ws/emitter.d.ts +12 -0
  263. package/dist/modules/ws/emitter.d.ts.map +1 -0
  264. package/dist/modules/ws/emitter.js +12 -0
  265. package/dist/modules/ws/ws.gateway.d.ts +34 -0
  266. package/dist/modules/ws/ws.gateway.d.ts.map +1 -0
  267. package/dist/modules/ws/ws.gateway.js +241 -0
  268. package/dist/modules/ws/ws.module.d.ts +3 -0
  269. package/dist/modules/ws/ws.module.d.ts.map +1 -0
  270. package/dist/modules/ws/ws.module.js +21 -0
  271. package/dist/modules/ws/ws.service.d.ts +25 -0
  272. package/dist/modules/ws/ws.service.d.ts.map +1 -0
  273. package/dist/modules/ws/ws.service.js +113 -0
  274. package/dist/plugin-api/define-plugin.d.ts +19 -0
  275. package/dist/plugin-api/define-plugin.d.ts.map +1 -0
  276. package/dist/plugin-api/define-plugin.js +25 -0
  277. package/dist/plugin-api/oracle-plugin.d.ts +92 -0
  278. package/dist/plugin-api/oracle-plugin.d.ts.map +1 -0
  279. package/dist/plugin-api/oracle-plugin.js +15 -0
  280. package/dist/plugin-api/tool-helper.d.ts +33 -0
  281. package/dist/plugin-api/tool-helper.d.ts.map +1 -0
  282. package/dist/plugin-api/tool-helper.js +40 -0
  283. package/dist/plugin-api/types.d.ts +378 -0
  284. package/dist/plugin-api/types.d.ts.map +1 -0
  285. package/dist/plugin-api/types.js +1 -0
  286. package/dist/plugins/agui/agui-agent.d.ts +10 -0
  287. package/dist/plugins/agui/agui-agent.d.ts.map +1 -0
  288. package/dist/plugins/agui/agui-agent.js +110 -0
  289. package/dist/plugins/agui/agui.plugin.d.ts +16 -0
  290. package/dist/plugins/agui/agui.plugin.d.ts.map +1 -0
  291. package/dist/plugins/agui/agui.plugin.js +117 -0
  292. package/dist/plugins/agui/index.d.ts +3 -0
  293. package/dist/plugins/agui/index.d.ts.map +1 -0
  294. package/dist/plugins/agui/index.js +2 -0
  295. package/dist/plugins/composio/composio-tools.d.ts +59 -0
  296. package/dist/plugins/composio/composio-tools.d.ts.map +1 -0
  297. package/dist/plugins/composio/composio-tools.js +88 -0
  298. package/dist/plugins/composio/composio-ucan.d.ts +14 -0
  299. package/dist/plugins/composio/composio-ucan.d.ts.map +1 -0
  300. package/dist/plugins/composio/composio-ucan.js +32 -0
  301. package/dist/plugins/composio/composio.plugin.d.ts +45 -0
  302. package/dist/plugins/composio/composio.plugin.d.ts.map +1 -0
  303. package/dist/plugins/composio/composio.plugin.js +116 -0
  304. package/dist/plugins/composio/index.d.ts +4 -0
  305. package/dist/plugins/composio/index.d.ts.map +1 -0
  306. package/dist/plugins/composio/index.js +3 -0
  307. package/dist/plugins/credits/claim-processing.module.d.ts +28 -0
  308. package/dist/plugins/credits/claim-processing.module.d.ts.map +1 -0
  309. package/dist/plugins/credits/claim-processing.module.js +37 -0
  310. package/dist/plugins/credits/claim-processing.service.d.ts +92 -0
  311. package/dist/plugins/credits/claim-processing.service.d.ts.map +1 -0
  312. package/dist/plugins/credits/claim-processing.service.js +406 -0
  313. package/dist/plugins/credits/credits-middleware.d.ts +23 -0
  314. package/dist/plugins/credits/credits-middleware.d.ts.map +1 -0
  315. package/dist/plugins/credits/credits-middleware.js +154 -0
  316. package/dist/plugins/credits/credits.plugin.d.ts +55 -0
  317. package/dist/plugins/credits/credits.plugin.d.ts.map +1 -0
  318. package/dist/plugins/credits/credits.plugin.js +95 -0
  319. package/dist/plugins/credits/file-processing-sink.module.d.ts +18 -0
  320. package/dist/plugins/credits/file-processing-sink.module.d.ts.map +1 -0
  321. package/dist/plugins/credits/file-processing-sink.module.js +56 -0
  322. package/dist/plugins/credits/index.d.ts +8 -0
  323. package/dist/plugins/credits/index.d.ts.map +1 -0
  324. package/dist/plugins/credits/index.js +7 -0
  325. package/dist/plugins/credits/subscription-sink.module.d.ts +23 -0
  326. package/dist/plugins/credits/subscription-sink.module.d.ts.map +1 -0
  327. package/dist/plugins/credits/subscription-sink.module.js +54 -0
  328. package/dist/plugins/credits/token-limiter.d.ts +139 -0
  329. package/dist/plugins/credits/token-limiter.d.ts.map +1 -0
  330. package/dist/plugins/credits/token-limiter.js +302 -0
  331. package/dist/plugins/domain-indexer/domain-indexer-agent.d.ts +7 -0
  332. package/dist/plugins/domain-indexer/domain-indexer-agent.d.ts.map +1 -0
  333. package/dist/plugins/domain-indexer/domain-indexer-agent.js +48 -0
  334. package/dist/plugins/domain-indexer/domain-indexer-tools.d.ts +8 -0
  335. package/dist/plugins/domain-indexer/domain-indexer-tools.d.ts.map +1 -0
  336. package/dist/plugins/domain-indexer/domain-indexer-tools.js +194 -0
  337. package/dist/plugins/domain-indexer/domain-indexer.plugin.d.ts +20 -0
  338. package/dist/plugins/domain-indexer/domain-indexer.plugin.d.ts.map +1 -0
  339. package/dist/plugins/domain-indexer/domain-indexer.plugin.js +78 -0
  340. package/dist/plugins/domain-indexer/index.d.ts +2 -0
  341. package/dist/plugins/domain-indexer/index.d.ts.map +1 -0
  342. package/dist/plugins/domain-indexer/index.js +1 -0
  343. package/dist/plugins/editor/apply-sandbox-output.d.ts +33 -0
  344. package/dist/plugins/editor/apply-sandbox-output.d.ts.map +1 -0
  345. package/dist/plugins/editor/apply-sandbox-output.js +302 -0
  346. package/dist/plugins/editor/block-actions.d.ts +84 -0
  347. package/dist/plugins/editor/block-actions.d.ts.map +1 -0
  348. package/dist/plugins/editor/block-actions.js +471 -0
  349. package/dist/plugins/editor/blocknote-helper.d.ts +147 -0
  350. package/dist/plugins/editor/blocknote-helper.d.ts.map +1 -0
  351. package/dist/plugins/editor/blocknote-helper.js +542 -0
  352. package/dist/plugins/editor/blocknote-tools.d.ts +364 -0
  353. package/dist/plugins/editor/blocknote-tools.d.ts.map +1 -0
  354. package/dist/plugins/editor/blocknote-tools.js +2123 -0
  355. package/dist/plugins/editor/editor-agent.d.ts +47 -0
  356. package/dist/plugins/editor/editor-agent.d.ts.map +1 -0
  357. package/dist/plugins/editor/editor-agent.js +158 -0
  358. package/dist/plugins/editor/editor-mx.d.ts +56 -0
  359. package/dist/plugins/editor/editor-mx.d.ts.map +1 -0
  360. package/dist/plugins/editor/editor-mx.js +100 -0
  361. package/dist/plugins/editor/editor.plugin.d.ts +32 -0
  362. package/dist/plugins/editor/editor.plugin.d.ts.map +1 -0
  363. package/dist/plugins/editor/editor.plugin.js +189 -0
  364. package/dist/plugins/editor/index.d.ts +6 -0
  365. package/dist/plugins/editor/index.d.ts.map +1 -0
  366. package/dist/plugins/editor/index.js +5 -0
  367. package/dist/plugins/editor/mint-invocation-tool.d.ts +72 -0
  368. package/dist/plugins/editor/mint-invocation-tool.d.ts.map +1 -0
  369. package/dist/plugins/editor/mint-invocation-tool.js +173 -0
  370. package/dist/plugins/editor/page-functions.d.ts +100 -0
  371. package/dist/plugins/editor/page-functions.d.ts.map +1 -0
  372. package/dist/plugins/editor/page-functions.js +317 -0
  373. package/dist/plugins/editor/page-tools.d.ts +75 -0
  374. package/dist/plugins/editor/page-tools.d.ts.map +1 -0
  375. package/dist/plugins/editor/page-tools.js +238 -0
  376. package/dist/plugins/editor/prompts.d.ts +22 -0
  377. package/dist/plugins/editor/prompts.d.ts.map +1 -0
  378. package/dist/plugins/editor/prompts.js +451 -0
  379. package/dist/plugins/editor/provider.d.ts +101 -0
  380. package/dist/plugins/editor/provider.d.ts.map +1 -0
  381. package/dist/plugins/editor/provider.js +249 -0
  382. package/dist/plugins/editor/standalone-editor-tool.d.ts +17 -0
  383. package/dist/plugins/editor/standalone-editor-tool.d.ts.map +1 -0
  384. package/dist/plugins/editor/standalone-editor-tool.js +136 -0
  385. package/dist/plugins/editor/survey-helpers.d.ts +112 -0
  386. package/dist/plugins/editor/survey-helpers.d.ts.map +1 -0
  387. package/dist/plugins/editor/survey-helpers.js +358 -0
  388. package/dist/plugins/firecrawl/firecrawl-agent.d.ts +7 -0
  389. package/dist/plugins/firecrawl/firecrawl-agent.d.ts.map +1 -0
  390. package/dist/plugins/firecrawl/firecrawl-agent.js +84 -0
  391. package/dist/plugins/firecrawl/firecrawl-tools.d.ts +37 -0
  392. package/dist/plugins/firecrawl/firecrawl-tools.d.ts.map +1 -0
  393. package/dist/plugins/firecrawl/firecrawl-tools.js +129 -0
  394. package/dist/plugins/firecrawl/firecrawl.plugin.d.ts +32 -0
  395. package/dist/plugins/firecrawl/firecrawl.plugin.d.ts.map +1 -0
  396. package/dist/plugins/firecrawl/firecrawl.plugin.js +69 -0
  397. package/dist/plugins/firecrawl/index.d.ts +3 -0
  398. package/dist/plugins/firecrawl/index.d.ts.map +1 -0
  399. package/dist/plugins/firecrawl/index.js +2 -0
  400. package/dist/plugins/index.d.ts +47 -0
  401. package/dist/plugins/index.d.ts.map +1 -0
  402. package/dist/plugins/index.js +69 -0
  403. package/dist/plugins/matrix-group-chats/channel-memory.module.d.ts +7 -0
  404. package/dist/plugins/matrix-group-chats/channel-memory.module.d.ts.map +1 -0
  405. package/dist/plugins/matrix-group-chats/channel-memory.module.js +22 -0
  406. package/dist/plugins/matrix-group-chats/channel-memory.repo.d.ts +62 -0
  407. package/dist/plugins/matrix-group-chats/channel-memory.repo.d.ts.map +1 -0
  408. package/dist/plugins/matrix-group-chats/channel-memory.repo.js +311 -0
  409. package/dist/plugins/matrix-group-chats/channel-memory.service.d.ts +89 -0
  410. package/dist/plugins/matrix-group-chats/channel-memory.service.d.ts.map +1 -0
  411. package/dist/plugins/matrix-group-chats/channel-memory.service.js +565 -0
  412. package/dist/plugins/matrix-group-chats/channel-memory.summarizer.d.ts +18 -0
  413. package/dist/plugins/matrix-group-chats/channel-memory.summarizer.d.ts.map +1 -0
  414. package/dist/plugins/matrix-group-chats/channel-memory.summarizer.js +128 -0
  415. package/dist/plugins/matrix-group-chats/channel-memory.types.d.ts +50 -0
  416. package/dist/plugins/matrix-group-chats/channel-memory.types.d.ts.map +1 -0
  417. package/dist/plugins/matrix-group-chats/channel-memory.types.js +2 -0
  418. package/dist/plugins/matrix-group-chats/guard.d.ts +83 -0
  419. package/dist/plugins/matrix-group-chats/guard.d.ts.map +1 -0
  420. package/dist/plugins/matrix-group-chats/guard.js +138 -0
  421. package/dist/plugins/matrix-group-chats/index.d.ts +59 -0
  422. package/dist/plugins/matrix-group-chats/index.d.ts.map +1 -0
  423. package/dist/plugins/matrix-group-chats/index.js +140 -0
  424. package/dist/plugins/matrix-group-chats/middleware.d.ts +31 -0
  425. package/dist/plugins/matrix-group-chats/middleware.d.ts.map +1 -0
  426. package/dist/plugins/matrix-group-chats/middleware.js +186 -0
  427. package/dist/plugins/matrix-group-chats/power-levels.d.ts +15 -0
  428. package/dist/plugins/matrix-group-chats/power-levels.d.ts.map +1 -0
  429. package/dist/plugins/matrix-group-chats/power-levels.js +36 -0
  430. package/dist/plugins/matrix-group-chats/room-info.d.ts +23 -0
  431. package/dist/plugins/matrix-group-chats/room-info.d.ts.map +1 -0
  432. package/dist/plugins/matrix-group-chats/room-info.js +34 -0
  433. package/dist/plugins/matrix-group-chats/tools.d.ts +8 -0
  434. package/dist/plugins/matrix-group-chats/tools.d.ts.map +1 -0
  435. package/dist/plugins/matrix-group-chats/tools.js +154 -0
  436. package/dist/plugins/memory/index.d.ts +5 -0
  437. package/dist/plugins/memory/index.d.ts.map +1 -0
  438. package/dist/plugins/memory/index.js +3 -0
  439. package/dist/plugins/memory/memory-tools.d.ts +52 -0
  440. package/dist/plugins/memory/memory-tools.d.ts.map +1 -0
  441. package/dist/plugins/memory/memory-tools.js +88 -0
  442. package/dist/plugins/memory/memory-ucan.d.ts +17 -0
  443. package/dist/plugins/memory/memory-ucan.d.ts.map +1 -0
  444. package/dist/plugins/memory/memory-ucan.js +43 -0
  445. package/dist/plugins/memory/memory.plugin.d.ts +51 -0
  446. package/dist/plugins/memory/memory.plugin.d.ts.map +1 -0
  447. package/dist/plugins/memory/memory.plugin.js +76 -0
  448. package/dist/plugins/memory/types.d.ts +75 -0
  449. package/dist/plugins/memory/types.d.ts.map +1 -0
  450. package/dist/plugins/memory/types.js +2 -0
  451. package/dist/plugins/portal/index.d.ts +3 -0
  452. package/dist/plugins/portal/index.d.ts.map +1 -0
  453. package/dist/plugins/portal/index.js +2 -0
  454. package/dist/plugins/portal/portal-agent.d.ts +9 -0
  455. package/dist/plugins/portal/portal-agent.d.ts.map +1 -0
  456. package/dist/plugins/portal/portal-agent.js +70 -0
  457. package/dist/plugins/portal/portal.plugin.d.ts +16 -0
  458. package/dist/plugins/portal/portal.plugin.d.ts.map +1 -0
  459. package/dist/plugins/portal/portal.plugin.js +115 -0
  460. package/dist/plugins/sandbox/index.d.ts +3 -0
  461. package/dist/plugins/sandbox/index.d.ts.map +1 -0
  462. package/dist/plugins/sandbox/index.js +2 -0
  463. package/dist/plugins/sandbox/sandbox-mcp.d.ts +46 -0
  464. package/dist/plugins/sandbox/sandbox-mcp.d.ts.map +1 -0
  465. package/dist/plugins/sandbox/sandbox-mcp.js +80 -0
  466. package/dist/plugins/sandbox/sandbox-write-blob.d.ts +22 -0
  467. package/dist/plugins/sandbox/sandbox-write-blob.d.ts.map +1 -0
  468. package/dist/plugins/sandbox/sandbox-write-blob.js +80 -0
  469. package/dist/plugins/sandbox/sandbox.plugin.d.ts +80 -0
  470. package/dist/plugins/sandbox/sandbox.plugin.d.ts.map +1 -0
  471. package/dist/plugins/sandbox/sandbox.plugin.js +204 -0
  472. package/dist/plugins/skills/index.d.ts +3 -0
  473. package/dist/plugins/skills/index.d.ts.map +1 -0
  474. package/dist/plugins/skills/index.js +2 -0
  475. package/dist/plugins/skills/skills-tools.d.ts +20 -0
  476. package/dist/plugins/skills/skills-tools.d.ts.map +1 -0
  477. package/dist/plugins/skills/skills-tools.js +204 -0
  478. package/dist/plugins/skills/skills-ucan.d.ts +24 -0
  479. package/dist/plugins/skills/skills-ucan.d.ts.map +1 -0
  480. package/dist/plugins/skills/skills-ucan.js +28 -0
  481. package/dist/plugins/skills/skills.plugin.d.ts +37 -0
  482. package/dist/plugins/skills/skills.plugin.d.ts.map +1 -0
  483. package/dist/plugins/skills/skills.plugin.js +82 -0
  484. package/dist/plugins/slack/index.d.ts +4 -0
  485. package/dist/plugins/slack/index.d.ts.map +1 -0
  486. package/dist/plugins/slack/index.js +3 -0
  487. package/dist/plugins/slack/slack.module.d.ts +9 -0
  488. package/dist/plugins/slack/slack.module.d.ts.map +1 -0
  489. package/dist/plugins/slack/slack.module.js +27 -0
  490. package/dist/plugins/slack/slack.plugin.d.ts +30 -0
  491. package/dist/plugins/slack/slack.plugin.d.ts.map +1 -0
  492. package/dist/plugins/slack/slack.plugin.js +40 -0
  493. package/dist/plugins/slack/slack.service.d.ts +32 -0
  494. package/dist/plugins/slack/slack.service.d.ts.map +1 -0
  495. package/dist/plugins/slack/slack.service.js +157 -0
  496. package/dist/plugins/user-preferences/index.d.ts +4 -0
  497. package/dist/plugins/user-preferences/index.d.ts.map +1 -0
  498. package/dist/plugins/user-preferences/index.js +3 -0
  499. package/dist/plugins/user-preferences/service/user-preferences.service.d.ts +61 -0
  500. package/dist/plugins/user-preferences/service/user-preferences.service.d.ts.map +1 -0
  501. package/dist/plugins/user-preferences/service/user-preferences.service.js +105 -0
  502. package/dist/plugins/user-preferences/user-preferences-http.module.d.ts +10 -0
  503. package/dist/plugins/user-preferences/user-preferences-http.module.d.ts.map +1 -0
  504. package/dist/plugins/user-preferences/user-preferences-http.module.js +23 -0
  505. package/dist/plugins/user-preferences/user-preferences-tool.d.ts +22 -0
  506. package/dist/plugins/user-preferences/user-preferences-tool.d.ts.map +1 -0
  507. package/dist/plugins/user-preferences/user-preferences-tool.js +103 -0
  508. package/dist/plugins/user-preferences/user-preferences.controller.d.ts +18 -0
  509. package/dist/plugins/user-preferences/user-preferences.controller.d.ts.map +1 -0
  510. package/dist/plugins/user-preferences/user-preferences.controller.js +72 -0
  511. package/dist/plugins/user-preferences/user-preferences.plugin.d.ts +27 -0
  512. package/dist/plugins/user-preferences/user-preferences.plugin.d.ts.map +1 -0
  513. package/dist/plugins/user-preferences/user-preferences.plugin.js +66 -0
  514. package/dist/registries/config-schema-registry.d.ts +24 -0
  515. package/dist/registries/config-schema-registry.d.ts.map +1 -0
  516. package/dist/registries/config-schema-registry.js +27 -0
  517. package/dist/registries/index.d.ts +13 -0
  518. package/dist/registries/index.d.ts.map +1 -0
  519. package/dist/registries/index.js +6 -0
  520. package/dist/registries/manifest-registry.d.ts +49 -0
  521. package/dist/registries/manifest-registry.d.ts.map +1 -0
  522. package/dist/registries/manifest-registry.js +53 -0
  523. package/dist/registries/middleware-registry.d.ts +41 -0
  524. package/dist/registries/middleware-registry.d.ts.map +1 -0
  525. package/dist/registries/middleware-registry.js +52 -0
  526. package/dist/registries/shared-state-registry.d.ts +41 -0
  527. package/dist/registries/shared-state-registry.d.ts.map +1 -0
  528. package/dist/registries/shared-state-registry.js +65 -0
  529. package/dist/registries/subagent-registry.d.ts +55 -0
  530. package/dist/registries/subagent-registry.d.ts.map +1 -0
  531. package/dist/registries/subagent-registry.js +106 -0
  532. package/dist/registries/test-fixtures.d.ts +47 -0
  533. package/dist/registries/test-fixtures.d.ts.map +1 -0
  534. package/dist/registries/test-fixtures.js +168 -0
  535. package/dist/registries/tool-registry.d.ts +74 -0
  536. package/dist/registries/tool-registry.d.ts.map +1 -0
  537. package/dist/registries/tool-registry.js +130 -0
  538. package/dist/runtime-context/ambient.d.ts +118 -0
  539. package/dist/runtime-context/ambient.d.ts.map +1 -0
  540. package/dist/runtime-context/ambient.js +1 -0
  541. package/dist/runtime-context/build-plugin.d.ts +20 -0
  542. package/dist/runtime-context/build-plugin.d.ts.map +1 -0
  543. package/dist/runtime-context/build-plugin.js +16 -0
  544. package/dist/runtime-context/build-runtime.d.ts +60 -0
  545. package/dist/runtime-context/build-runtime.d.ts.map +1 -0
  546. package/dist/runtime-context/build-runtime.js +81 -0
  547. package/dist/testing/create-test-runtime.d.ts +95 -0
  548. package/dist/testing/create-test-runtime.d.ts.map +1 -0
  549. package/dist/testing/create-test-runtime.js +302 -0
  550. package/dist/testing/index.d.ts +5 -0
  551. package/dist/testing/index.d.ts.map +1 -0
  552. package/dist/testing/index.js +5 -0
  553. package/dist/testing/integration/chat-client.d.ts +143 -0
  554. package/dist/testing/integration/chat-client.d.ts.map +1 -0
  555. package/dist/testing/integration/chat-client.js +238 -0
  556. package/dist/testing/integration/harness.d.ts +189 -0
  557. package/dist/testing/integration/harness.d.ts.map +1 -0
  558. package/dist/testing/integration/harness.js +461 -0
  559. package/dist/testing/integration/index.d.ts +14 -0
  560. package/dist/testing/integration/index.d.ts.map +1 -0
  561. package/dist/testing/integration/index.js +18 -0
  562. package/dist/testing/integration/setup.d.ts +2 -0
  563. package/dist/testing/integration/setup.d.ts.map +1 -0
  564. package/dist/testing/integration/setup.js +41 -0
  565. package/dist/testing/integration/sse-parser.d.ts +99 -0
  566. package/dist/testing/integration/sse-parser.d.ts.map +1 -0
  567. package/dist/testing/integration/sse-parser.js +125 -0
  568. package/dist/testing/integration/ucan.d.ts +74 -0
  569. package/dist/testing/integration/ucan.d.ts.map +1 -0
  570. package/dist/testing/integration/ucan.js +95 -0
  571. package/dist/testing/integration/wait-for-matrix-loaded.d.ts +19 -0
  572. package/dist/testing/integration/wait-for-matrix-loaded.d.ts.map +1 -0
  573. package/dist/testing/integration/wait-for-matrix-loaded.js +31 -0
  574. package/dist/testing/mocks.d.ts +64 -0
  575. package/dist/testing/mocks.d.ts.map +1 -0
  576. package/dist/testing/mocks.js +141 -0
  577. package/dist/testing/nest-doubles.d.ts +10 -0
  578. package/dist/testing/nest-doubles.d.ts.map +1 -0
  579. package/dist/testing/nest-doubles.js +19 -0
  580. package/dist/utils/emoji.d.ts +3 -0
  581. package/dist/utils/emoji.d.ts.map +1 -0
  582. package/dist/utils/emoji.js +36 -0
  583. package/package.json +102 -0
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Build the headers needed to call the Memory Engine MCP server on behalf of
3
+ * the current user.
4
+ *
5
+ * 1. Resolve the memory service DID via `runCtx.ucan.resolveServiceDid`
6
+ * (delegates the did:web lookup + cache to the Tier-0 UCAN service).
7
+ * 2. Mint an `ixo:memory` invocation using the user's signing key.
8
+ * 3. Layer the resulting Bearer token plus the active `x-room-id`.
9
+ *
10
+ * UCAN-only — no Matrix-OpenID fallback. If minting fails for any reason
11
+ * (no signing key, no cached delegation, did:web unresolved) the function
12
+ * returns `null` so callers can degrade silently rather than leak a
13
+ * half-built request to the upstream service.
14
+ */
15
+ export async function buildMemoryHeaders(runCtx, memoryMcpUrl) {
16
+ const memoryDid = await runCtx.ucan.resolveServiceDid(memoryMcpUrl);
17
+ if (!memoryDid)
18
+ return null;
19
+ try {
20
+ const invocation = await runCtx.ucan.mintInvocation({
21
+ did: memoryDid,
22
+ capability: 'ixo:memory',
23
+ });
24
+ if (!invocation || invocation.length === 0)
25
+ return null;
26
+ const headers = {
27
+ Authorization: `Bearer ${invocation}`,
28
+ 'X-Auth-Type': 'ucan',
29
+ 'User-Agent': 'LangChain-MCP-Client/1.0',
30
+ };
31
+ if (runCtx.session.roomId) {
32
+ headers['x-room-id'] = runCtx.session.roomId;
33
+ }
34
+ return headers;
35
+ }
36
+ catch (error) {
37
+ const detail = error instanceof Error
38
+ ? `${error.name}: ${error.message}`
39
+ : String(error);
40
+ runCtx.logger.warn(`[memory] failed to mint UCAN invocation: ${detail}`);
41
+ return null;
42
+ }
43
+ }
@@ -0,0 +1,51 @@
1
+ import { z } from 'zod';
2
+ import { OraclePlugin } from '../../plugin-api/oracle-plugin.js';
3
+ import type { PluginManifest, PluginTool, RuntimeContext, UserContextData } from '../../plugin-api/types.js';
4
+ import { type MemoryMcpFactory } from './memory-tools.js';
5
+ export interface MemoryPluginOptions {
6
+ /**
7
+ * Override the MCP-tools factory. Defaults to an HTTP MCP client against
8
+ * `MEMORY_MCP_URL` authenticated with a per-request UCAN invocation.
9
+ */
10
+ mcpFactory?: (memoryMcpUrl: string) => MemoryMcpFactory;
11
+ /**
12
+ * Filter the upstream tool surface. Defaults to {@link DEFAULT_MEMORY_TOOLS}
13
+ * (search + add + delete-episode). Pass an explicit list to expose
14
+ * `clear`, `add_oracle_knowledge`, etc.
15
+ */
16
+ selectedTools?: readonly string[];
17
+ }
18
+ /**
19
+ * Memory plugin. Surfaces upstream Memory Engine MCP tools directly — the
20
+ * agent sees the upstream names (`memory-engine__search_memory_engine`,
21
+ * `memory-engine__add_memory`, ...) with the upstream's own schemas. This
22
+ * matches the apps/app pattern that worked in production and avoids
23
+ * schema-mismatch failures from a local wrapper layer.
24
+ *
25
+ * Tool list is fetched per-request via `getRequestTools` because the MCP
26
+ * headers depend on the in-flight user's UCAN delegation.
27
+ *
28
+ * The runtime forwards memory tools into every sub-agent's tool list
29
+ * (filter in `main-agent.ts`), except `memory-engine__clear` — destructive,
30
+ * main-agent-only.
31
+ */
32
+ export declare class MemoryPlugin extends OraclePlugin {
33
+ static readonly NAME = "memory";
34
+ readonly name = "memory";
35
+ readonly version = "1.0.0";
36
+ readonly manifest: PluginManifest;
37
+ readonly configSchema: z.ZodObject<{
38
+ MEMORY_MCP_URL: z.ZodString;
39
+ MEMORY_ENGINE_URL: z.ZodString;
40
+ }, z.core.$strip>;
41
+ readonly autoDetectHint = "MEMORY_MCP_URL";
42
+ private readonly mcpFactory;
43
+ private readonly selectedTools;
44
+ constructor(options?: MemoryPluginOptions);
45
+ autoDetect(env: NodeJS.ProcessEnv): boolean;
46
+ getRequestTools(rtCtx: RuntimeContext): Promise<PluginTool[]>;
47
+ getSharedState(): Record<string, (state: {
48
+ userContext?: UserContextData;
49
+ }, runCtx: RuntimeContext) => unknown>;
50
+ }
51
+ //# sourceMappingURL=memory.plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/memory/memory.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,EAEV,cAAc,EACd,UAAU,EACV,cAAc,EACd,eAAe,EAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAC;AAgC3B,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,gBAAgB,CAAC;IACxD;;;;OAIG;IACH,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAOD;;;;;;;;;;;;;GAaG;AACH,qBAAa,YAAa,SAAQ,YAAY;IAC5C,MAAM,CAAC,QAAQ,CAAC,IAAI,YAAY;IAEhC,QAAQ,CAAC,IAAI,YAAqB;IAElC,QAAQ,CAAC,OAAO,WAAW;IAE3B,QAAQ,CAAC,QAAQ,iBAAY;IAE7B,SAAkB,YAAY;;;sBAAgB;IAE9C,SAAkB,cAAc,oBAAoB;IAEpD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6C;IAExE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAoB;gBAEtC,OAAO,GAAE,mBAAwB;IAMpC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO;IAIrC,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAMnE,cAAc,IAAI,MAAM,CAC/B,MAAM,EACN,CACE,KAAK,EAAE;QAAE,WAAW,CAAC,EAAE,eAAe,CAAA;KAAE,EACxC,MAAM,EAAE,cAAc,KACnB,OAAO,CACb;CAKF"}
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod';
2
+ import { OraclePlugin } from '../../plugin-api/oracle-plugin.js';
3
+ import { createDefaultMemoryMcpFactory, DEFAULT_MEMORY_TOOLS, fetchMemoryTools, } from './memory-tools.js';
4
+ const configSchema = z.object({
5
+ MEMORY_MCP_URL: z.string().url('MEMORY_MCP_URL must be a valid HTTP(S) URL.'),
6
+ MEMORY_ENGINE_URL: z
7
+ .string()
8
+ .url('MEMORY_ENGINE_URL must be a valid HTTP(S) URL.'),
9
+ });
10
+ const manifest = {
11
+ title: 'Memory',
12
+ summary: 'Durable memory across conversations: who the user is, what you have made for them, and what worked.',
13
+ whenToUse: [
14
+ 'First contact (no prior context loaded): greet, ask their name and what they want help with, then save what they tell you.',
15
+ 'You learn something durable about the user — name, role, ongoing project, a constraint, a relationship.',
16
+ 'You create an artifact for the user (file, document, edit, generated content): record what it is, what it is for, and the structural choices you made.',
17
+ 'The user expresses satisfaction or dissatisfaction with something you produced: capture what worked or what did not — tone, length, structure, style — against that artifact entry.',
18
+ 'The user references something they told you before, or something you made before.',
19
+ ],
20
+ whenNotToUse: [
21
+ 'Ephemeral conversation-only state (use the current message thread).',
22
+ 'Behavioral preferences about how to respond (call the user-preferences tool instead).',
23
+ 'Public web facts that are not specific to this user (use a web-search capability).',
24
+ 'Anything the user asked you to forget or framed as temporary.',
25
+ ],
26
+ tags: ['memory', 'recall', 'artifacts', 'personalization'],
27
+ category: 'memory',
28
+ visibility: 'always',
29
+ stability: 'stable',
30
+ };
31
+ function resolveMemoryUrl(config) {
32
+ const parsed = configSchema.parse(config);
33
+ return parsed.MEMORY_MCP_URL;
34
+ }
35
+ /**
36
+ * Memory plugin. Surfaces upstream Memory Engine MCP tools directly — the
37
+ * agent sees the upstream names (`memory-engine__search_memory_engine`,
38
+ * `memory-engine__add_memory`, ...) with the upstream's own schemas. This
39
+ * matches the apps/app pattern that worked in production and avoids
40
+ * schema-mismatch failures from a local wrapper layer.
41
+ *
42
+ * Tool list is fetched per-request via `getRequestTools` because the MCP
43
+ * headers depend on the in-flight user's UCAN delegation.
44
+ *
45
+ * The runtime forwards memory tools into every sub-agent's tool list
46
+ * (filter in `main-agent.ts`), except `memory-engine__clear` — destructive,
47
+ * main-agent-only.
48
+ */
49
+ export class MemoryPlugin extends OraclePlugin {
50
+ static NAME = 'memory';
51
+ name = MemoryPlugin.NAME;
52
+ version = '1.0.0';
53
+ manifest = manifest;
54
+ configSchema = configSchema;
55
+ autoDetectHint = 'MEMORY_MCP_URL';
56
+ mcpFactory;
57
+ selectedTools;
58
+ constructor(options = {}) {
59
+ super();
60
+ this.mcpFactory = options.mcpFactory ?? createDefaultMemoryMcpFactory;
61
+ this.selectedTools = options.selectedTools ?? DEFAULT_MEMORY_TOOLS;
62
+ }
63
+ autoDetect(env) {
64
+ return Boolean(env.MEMORY_MCP_URL);
65
+ }
66
+ async getRequestTools(rtCtx) {
67
+ const memoryUrl = resolveMemoryUrl(rtCtx.config);
68
+ const factory = this.mcpFactory(memoryUrl);
69
+ return fetchMemoryTools(rtCtx, factory, this.selectedTools);
70
+ }
71
+ getSharedState() {
72
+ return {
73
+ userProfile: (state) => state.userContext,
74
+ };
75
+ }
76
+ }
@@ -0,0 +1,75 @@
1
+ export type ComparisonOperator = '=' | '<>' | '>' | '<' | '>=' | '<=' | 'IS NULL' | 'IS NOT NULL';
2
+ /** A single date filter condition. `date` can be omitted for IS NULL / IS NOT NULL. */
3
+ export interface DateFilter {
4
+ date?: string;
5
+ comparison_operator: ComparisonOperator;
6
+ }
7
+ /**
8
+ * Date filters are passed as groups of OR-conditions combined with AND between groups:
9
+ * [[a, b], [c]] → (a OR b) AND (c)
10
+ */
11
+ export type DateFilterGroups = DateFilter[][];
12
+ export type SearchStrategy = 'balanced' | 'diverse' | 'precise' | 'contextual' | 'recent_memory' | 'facts_only' | 'entities_only' | 'topics_only';
13
+ export type KnowledgeLevel = 'user' | 'oracle' | 'both';
14
+ export type EntityType = 'Person' | 'Trait' | 'Value' | 'Identity' | 'Attribute' | 'Emotion' | 'Stress' | 'CopingStrategy' | 'Job' | 'Project' | 'Skill' | 'Tool' | 'Organization' | 'Goal' | 'Milestone' | 'Habit' | 'Routine' | 'Pattern' | 'Interest' | 'Hobby' | 'Content' | 'Preference' | 'Product' | 'Expertise' | 'LearningGoal' | 'Resource' | 'Location' | 'Experience' | 'Event' | 'Group' | 'Pet' | 'CommunicationStyle' | 'Language' | 'Task' | 'Belief' | 'Cause' | 'Procedure' | 'Agent' | 'SmartAccount' | 'OutcomeUnit' | 'Claim' | 'Evaluation' | 'ServiceEvent' | 'Payment' | 'VerifiableCredential';
15
+ export type EdgeType = 'Knows' | 'WorksWith' | 'Causes' | 'Enables' | 'Blocks' | 'PartOf' | 'BelongsTo' | 'Practices' | 'Uses' | 'Pursuing' | 'Requires' | 'Achieved' | 'EmployedAt' | 'WorksOn' | 'Manages' | 'LivesAt' | 'VisitedLocation' | 'LocatedIn' | 'Prefers' | 'Likes' | 'Dislikes' | 'InterestedIn' | 'ExpertiseIn' | 'Studying' | 'LearnedFrom' | 'Triggers' | 'Motivates' | 'ManagesVia' | 'Influences' | 'Supports' | 'MemberOf' | 'Owns' | 'CurrentlyIs' | 'WasPreviously' | 'AlignedWith' | 'ConflictsWith' | 'RelatesTo' | 'OWNS' | 'CONTROLS' | 'SUBMITS_CLAIM' | 'HAS_EVALUATION' | 'RESULTS_IN_OUTCOME' | 'TRIGGERS_PAYMENT' | 'PAYS_FOR_SERVICE' | 'HAS_IDENTITY';
16
+ /** memory-engine__search_memory_engine */
17
+ export interface SearchMemoryInput {
18
+ query: string;
19
+ strategy: SearchStrategy;
20
+ /** @default 'both' */
21
+ knowledge_level?: KnowledgeLevel;
22
+ /** UUID of a node to use as the graph traversal center */
23
+ center_node_uuid?: string;
24
+ node_labels?: EntityType[];
25
+ edge_types?: EdgeType[];
26
+ /** Filter on the edge/node valid_at timestamp */
27
+ valid_at?: DateFilterGroups;
28
+ /** Filter on the edge/node invalid_at timestamp */
29
+ invalid_at?: DateFilterGroups;
30
+ /** Filter on the edge/node created_at timestamp */
31
+ created_at?: DateFilterGroups;
32
+ /** Filter on the edge/node expired_at timestamp */
33
+ expired_at?: DateFilterGroups;
34
+ }
35
+ /** memory-engine__add_memory */
36
+ export interface AddMemoryInput {
37
+ /** Short label / title for the memory */
38
+ name: string;
39
+ /** The actual content/text to store */
40
+ content: string;
41
+ /** @default 'text' */
42
+ source?: string;
43
+ /** @default '' */
44
+ source_description?: string;
45
+ }
46
+ /** memory-engine__add_oracle_knowledge */
47
+ export interface AddOracleKnowledgeInput {
48
+ name: string;
49
+ content: string;
50
+ /** Must be true — agent must get explicit user confirmation before calling */
51
+ confirmed_insertion_from_user: boolean;
52
+ knowledge_space_type: 'public' | 'private';
53
+ /** @default 'text' */
54
+ source?: string;
55
+ /** @default '' */
56
+ source_description?: string;
57
+ }
58
+ /** memory-engine__delete_episode */
59
+ export interface DeleteEpisodeInput {
60
+ episode_uuid: string;
61
+ /** Must be true — agent must get explicit user confirmation before calling */
62
+ confirmed_deletion_from_user: boolean;
63
+ }
64
+ /** memory-engine__delete_edge */
65
+ export interface DeleteEdgeInput {
66
+ edge_uuid: string;
67
+ /** Must be true — agent must get explicit user confirmation before calling */
68
+ confirmed_deletion_from_user: boolean;
69
+ }
70
+ /** memory-engine__clear */
71
+ export interface ClearMemorySpaceInput {
72
+ /** Must be true — agent must get explicit user confirmation before calling */
73
+ confirmed_deletion_from_user: boolean;
74
+ }
75
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/memory/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAC1B,GAAG,GACH,IAAI,GACJ,GAAG,GACH,GAAG,GACH,IAAI,GACJ,IAAI,GACJ,SAAS,GACT,aAAa,CAAC;AAElB,uFAAuF;AACvF,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mBAAmB,EAAE,kBAAkB,CAAC;CACzC;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,EAAE,EAAE,CAAC;AAE9C,MAAM,MAAM,cAAc,GACtB,UAAU,GACV,SAAS,GACT,SAAS,GACT,YAAY,GACZ,eAAe,GACf,YAAY,GACZ,eAAe,GACf,aAAa,CAAC;AAElB,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;AAExD,MAAM,MAAM,UAAU,GAElB,QAAQ,GACR,OAAO,GACP,OAAO,GACP,UAAU,GACV,WAAW,GAEX,SAAS,GACT,QAAQ,GACR,gBAAgB,GAEhB,KAAK,GACL,SAAS,GACT,OAAO,GACP,MAAM,GACN,cAAc,GAEd,MAAM,GACN,WAAW,GAEX,OAAO,GACP,SAAS,GACT,SAAS,GAET,UAAU,GACV,OAAO,GACP,SAAS,GAET,YAAY,GACZ,SAAS,GAET,WAAW,GACX,cAAc,GACd,UAAU,GAEV,UAAU,GACV,YAAY,GACZ,OAAO,GAEP,OAAO,GACP,KAAK,GAEL,oBAAoB,GACpB,UAAU,GAEV,MAAM,GACN,QAAQ,GACR,OAAO,GAEP,WAAW,GAEX,OAAO,GACP,cAAc,GACd,aAAa,GACb,OAAO,GACP,YAAY,GACZ,cAAc,GACd,SAAS,GACT,sBAAsB,CAAC;AAE3B,MAAM,MAAM,QAAQ,GAEhB,OAAO,GACP,WAAW,GACX,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,WAAW,GACX,WAAW,GACX,MAAM,GACN,UAAU,GACV,UAAU,GACV,UAAU,GACV,YAAY,GACZ,SAAS,GACT,SAAS,GACT,SAAS,GACT,iBAAiB,GACjB,WAAW,GACX,SAAS,GACT,OAAO,GACP,UAAU,GACV,cAAc,GACd,aAAa,GACb,UAAU,GACV,aAAa,GACb,UAAU,GACV,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,UAAU,GACV,UAAU,GACV,MAAM,GACN,aAAa,GACb,eAAe,GACf,aAAa,GACb,eAAe,GACf,WAAW,GAEX,MAAM,GACN,UAAU,GACV,eAAe,GACf,gBAAgB,GAChB,oBAAoB,GACpB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,CAAC;AAInB,0CAA0C;AAC1C,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,cAAc,CAAC;IACzB,sBAAsB;IACtB,eAAe,CAAC,EAAE,cAAc,CAAC;IACjC,0DAA0D;IAC1D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC;IACxB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,mDAAmD;IACnD,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,mDAAmD;IACnD,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,mDAAmD;IACnD,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED,gCAAgC;AAChC,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,0CAA0C;AAC1C,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,6BAA6B,EAAE,OAAO,CAAC;IACvC,oBAAoB,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC3C,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,oCAAoC;AACpC,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,4BAA4B,EAAE,OAAO,CAAC;CACvC;AAED,iCAAiC;AACjC,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,4BAA4B,EAAE,OAAO,CAAC;CACvC;AAED,2BAA2B;AAC3B,MAAM,WAAW,qBAAqB;IACpC,8EAA8E;IAC9E,4BAA4B,EAAE,OAAO,CAAC;CACvC"}
@@ -0,0 +1,2 @@
1
+ // ─── Shared primitives ────────────────────────────────────────────────────────
2
+ export {};
@@ -0,0 +1,3 @@
1
+ export { PortalPlugin } from './portal.plugin.js';
2
+ export { createPortalSubAgent } from './portal-agent.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/portal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { PortalPlugin } from './portal.plugin.js';
2
+ export { createPortalSubAgent } from './portal-agent.js';
@@ -0,0 +1,9 @@
1
+ import type { PluginSubAgent, PluginTool } from '../../plugin-api/types.js';
2
+ /**
3
+ * Build the Portal sub-agent. Tools are derived per-request from
4
+ * `state.browserTools` (one PluginTool per declared browser tool). The
5
+ * resulting sub-agent calls the FE-declared tools and waits for the
6
+ * reverse-flowed result.
7
+ */
8
+ export declare function createPortalSubAgent(tools: PluginTool[]): PluginSubAgent;
9
+ //# sourceMappingURL=portal-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal-agent.d.ts","sourceRoot":"","sources":["../../../src/plugins/portal/portal-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAoE5E;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,cAAc,CAUxE"}
@@ -0,0 +1,70 @@
1
+ const sharedExpectations = `
2
+ You are the Portal Agent for this workspace. Your entire job is to operate the
3
+ user portal/UI on behalf of the user by calling the available tools responsibly.
4
+
5
+ Core expectations:
6
+ - Be the helpful front-line assistant for anything that can be done via the
7
+ portal tools you have access to.
8
+ - Never guess which tool to use—reference each tool's description and required
9
+ inputs before invoking it.
10
+ - Narrate your intent before triggering a tool, confirm the result afterwards,
11
+ and clearly communicate next steps or follow-up questions.
12
+ - Respect safety, data-privacy, and authorization boundaries described by each
13
+ tool.
14
+
15
+ Task discipline:
16
+ - You are a sub-agent invoked by the main agent. You receive a single task message — that is ALL the context you have.
17
+ - If the task is unclear, ambiguous, or missing critical details (IDs, names, scope, what to do), do NOT guess. Instead, STOP immediately and return a clear message explaining what information you need. The main agent will ask the user and re-invoke you with a complete task.
18
+ - Never loop or retry the same failing approach. If something fails twice, return the error and stop.
19
+ - Complete the requested task and STOP. Do not do additional unrequested work.
20
+ `.trim();
21
+ const workflowGuidelines = `
22
+ ### Workflow
23
+ 1. Clarify the user's goal and map it to one (or more) portal tools.
24
+ 2. Consult each tool's description before invoking it — verify required inputs.
25
+ 3. Pass parameters exactly as documented; never guess IDs or omit required fields.
26
+ 4. Summarize results back to the user, highlighting any outstanding actions or follow-ups.
27
+ 5. If no tool can satisfy the request, explain why and suggest alternatives.
28
+ `.trim();
29
+ const formatToolDocs = (tools) => {
30
+ if (!tools.length) {
31
+ return '- No portal tools configured. Ask a human operator for support.';
32
+ }
33
+ return tools
34
+ .map((t) => {
35
+ const description = t.description?.trim() ?? 'No description provided.';
36
+ return `- \`${t.name}\`: ${description}`;
37
+ })
38
+ .join('\n');
39
+ };
40
+ const buildPortalPrompt = ({ toolsDoc, extraInstructions, }) => `
41
+ ${sharedExpectations}
42
+
43
+ ### Available Portal Tools
44
+ ${toolsDoc}
45
+
46
+ ${workflowGuidelines}
47
+
48
+ ${extraInstructions ? `### Additional Instructions\n${extraInstructions}` : ''}
49
+ `.trim();
50
+ const buildPortalDescription = (tools) => {
51
+ const names = tools.map((t) => t.name).join(', ') || 'no configured tools';
52
+ return `Specialized Portal Agent that executes user-facing portal/UI actions. Supported actions: (${names}).`;
53
+ };
54
+ /**
55
+ * Build the Portal sub-agent. Tools are derived per-request from
56
+ * `state.browserTools` (one PluginTool per declared browser tool). The
57
+ * resulting sub-agent calls the FE-declared tools and waits for the
58
+ * reverse-flowed result.
59
+ */
60
+ export function createPortalSubAgent(tools) {
61
+ const toolsDoc = formatToolDocs(tools);
62
+ return {
63
+ name: 'Portal Agent',
64
+ description: buildPortalDescription(tools),
65
+ systemPrompt: buildPortalPrompt({ toolsDoc }),
66
+ tools,
67
+ model: 'subagent',
68
+ middlewares: [],
69
+ };
70
+ }
@@ -0,0 +1,16 @@
1
+ import { OraclePlugin } from '../../plugin-api/oracle-plugin.js';
2
+ import type { PluginManifest, PluginSubAgent, RuntimeContext } from '../../plugin-api/types.js';
3
+ /**
4
+ * Portal plugin. The sub-agent is built per-request from `state.browserTools`
5
+ * — the client declares its browser-side tools on each `sendMessage`, the
6
+ * runtime wraps each into a PluginTool, and the agent decides whether to
7
+ * delegate. When no browser tools are declared the plugin contributes
8
+ * nothing.
9
+ */
10
+ export declare class PortalPlugin extends OraclePlugin {
11
+ readonly name = "portal";
12
+ readonly version = "1.0.0";
13
+ readonly manifest: PluginManifest;
14
+ getRequestSubAgents(rtCtx: RuntimeContext): Promise<PluginSubAgent[]>;
15
+ }
16
+ //# sourceMappingURL=portal.plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal.plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/portal/portal.plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EAEd,cAAc,EACf,MAAM,2BAA2B,CAAC;AAgHnC;;;;;;GAMG;AACH,qBAAa,YAAa,SAAQ,YAAY;IAC5C,QAAQ,CAAC,IAAI,YAAY;IAEzB,QAAQ,CAAC,OAAO,WAAW;IAE3B,QAAQ,CAAC,QAAQ,iBAAY;IAEd,mBAAmB,CAChC,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,cAAc,EAAE,CAAC;CAO7B"}
@@ -0,0 +1,115 @@
1
+ import { callBrowserTool, logActionToMatrix } from '@ixo/common';
2
+ import { z } from 'zod';
3
+ import { OraclePlugin } from '../../plugin-api/oracle-plugin.js';
4
+ import { tool } from '../../plugin-api/tool-helper.js';
5
+ import { createPortalSubAgent } from './portal-agent.js';
6
+ const manifest = {
7
+ title: 'Portal',
8
+ summary: "Browser-side actions on the user's Portal UI — opens URLs, manipulates the DOM, runs FE-defined browser tools.",
9
+ whenToUse: [
10
+ 'User asks for an action the Portal FE exposes as a browser tool (declared in `state.browserTools`).',
11
+ "A task needs a browser-side capability the server can't do alone — open a URL in the user's tab, click a Portal button, fill a form.",
12
+ ],
13
+ whenNotToUse: [
14
+ 'No browser tools are declared on this request (sub-agent is not built).',
15
+ 'The task can be completed purely server-side (use a server tool or sub-agent).',
16
+ ],
17
+ examples: [
18
+ {
19
+ user: 'Open my workspace and navigate to the Reports page.',
20
+ thought: 'Portal exposes navigation as a browser tool — delegate via call_portal_agent with the target URL.',
21
+ tool: 'call_portal_agent',
22
+ },
23
+ ],
24
+ tags: ['portal', 'browser', 'ui'],
25
+ category: 'ui',
26
+ visibility: 'on-demand',
27
+ stability: 'stable',
28
+ };
29
+ /** Default per-tool timeout — matches today's `parserBrowserTool`. */
30
+ const BROWSER_TOOL_TIMEOUT_MS = 15_000;
31
+ const BROWSER_TOOL_SHAPE = z.object({
32
+ name: z.string(),
33
+ description: z.string(),
34
+ schema: z.record(z.string(), z.unknown()),
35
+ });
36
+ const ARGS_RECORD_SHAPE = z.record(z.string(), z.unknown());
37
+ function parseBrowserTools(value) {
38
+ if (!Array.isArray(value))
39
+ return [];
40
+ const out = [];
41
+ for (const entry of value) {
42
+ const parsed = BROWSER_TOOL_SHAPE.safeParse(entry);
43
+ if (parsed.success)
44
+ out.push(parsed.data);
45
+ }
46
+ return out;
47
+ }
48
+ function parseArgs(input) {
49
+ const parsed = ARGS_RECORD_SHAPE.safeParse(input ?? {});
50
+ return parsed.success ? parsed.data : {};
51
+ }
52
+ /**
53
+ * Build a single PluginTool that, when invoked, dispatches the browser tool to
54
+ * the user's frontend via the existing `callBrowserTool` helper and waits for
55
+ * the result. Mirrors today's `parserBrowserTool` behaviour (matrix logging on
56
+ * success, `tc-${requestId}` tool-call id) but sources `sessionId`,
57
+ * `requestId`, and `roomId` from `RuntimeContext` instead of LangChain's
58
+ * configurable bag.
59
+ */
60
+ function buildBrowserTool(descriptor) {
61
+ return tool(async (input, ctx) => {
62
+ const sessionId = ctx.session.id;
63
+ if (!sessionId) {
64
+ throw new Error('sessionId is required for browser tools');
65
+ }
66
+ const args = parseArgs(input);
67
+ const requestId = ctx.session.requestId;
68
+ const toolCallId = `tc-${requestId ?? 'noreq'}`;
69
+ const result = await callBrowserTool({
70
+ sessionId,
71
+ toolCallId,
72
+ toolName: descriptor.name,
73
+ args,
74
+ timeout: BROWSER_TOOL_TIMEOUT_MS,
75
+ });
76
+ if (ctx.session.roomId) {
77
+ void logActionToMatrix({
78
+ name: descriptor.name,
79
+ args,
80
+ result,
81
+ success: true,
82
+ }, {
83
+ roomId: ctx.session.roomId,
84
+ threadId: sessionId,
85
+ });
86
+ }
87
+ return result;
88
+ }, {
89
+ name: descriptor.name,
90
+ description: descriptor.description,
91
+ schema: z.fromJSONSchema(descriptor.schema),
92
+ });
93
+ }
94
+ function readBrowserTools(rtCtx) {
95
+ return parseBrowserTools(rtCtx.history.state.browserTools);
96
+ }
97
+ /**
98
+ * Portal plugin. The sub-agent is built per-request from `state.browserTools`
99
+ * — the client declares its browser-side tools on each `sendMessage`, the
100
+ * runtime wraps each into a PluginTool, and the agent decides whether to
101
+ * delegate. When no browser tools are declared the plugin contributes
102
+ * nothing.
103
+ */
104
+ export class PortalPlugin extends OraclePlugin {
105
+ name = 'portal';
106
+ version = '1.0.0';
107
+ manifest = manifest;
108
+ async getRequestSubAgents(rtCtx) {
109
+ const browserTools = readBrowserTools(rtCtx);
110
+ if (browserTools.length === 0)
111
+ return [];
112
+ const tools = browserTools.map(buildBrowserTool);
113
+ return [createPortalSubAgent(tools)];
114
+ }
115
+ }
@@ -0,0 +1,3 @@
1
+ export { SandboxPlugin, type SandboxMcpClientFactory, type SandboxMcpClientLike, type SandboxMcpTool, type SandboxPluginOptions, } from './sandbox.plugin.js';
2
+ export { parseOracleSecrets, SANDBOX_RUN_TOOL_NAME, type SandboxAuthBuilder, type SandboxHeaderInputs, } from './sandbox-mcp.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/sandbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,oBAAoB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { SandboxPlugin, } from './sandbox.plugin.js';
2
+ export { parseOracleSecrets, SANDBOX_RUN_TOOL_NAME, } from './sandbox-mcp.js';
@@ -0,0 +1,46 @@
1
+ import type { RuntimeContext } from '../../plugin-api/types.js';
2
+ /** Tool name surfaced by the upstream sandbox MCP. */
3
+ export declare const SANDBOX_RUN_TOOL_NAME = "sandbox_run";
4
+ /**
5
+ * Parse the `ORACLE_SECRETS` env value (format: `KEY1=value1,KEY2=value2`).
6
+ *
7
+ * Lifted from `apps/app/src/graph/agents/main-agent.ts` (lines 752-763).
8
+ * Whitespace around keys and values is trimmed; entries lacking an `=` or
9
+ * an empty key/value are skipped silently so a stray comma can't break boot.
10
+ */
11
+ export declare function parseOracleSecrets(raw: string): Record<string, string>;
12
+ /** Inputs to a {@link SandboxAuthBuilder} invocation. */
13
+ export interface SandboxHeaderInputs {
14
+ /** Sandbox MCP base URL — resolved to a did:web audience. */
15
+ sandboxMcpUrl: string;
16
+ /** Optional skills-service base URL for the X-Skills-Invocation header. */
17
+ skillsServiceUrl?: string;
18
+ /** Oracle operator secrets — mapped to `x-os-{key}` headers. */
19
+ oracleSecrets: Record<string, string>;
20
+ /** Per-room user secrets — mapped to `x-us-{key}` headers. */
21
+ userSecrets: Record<string, string>;
22
+ }
23
+ /**
24
+ * Mints the headers needed to call the sandbox MCP server on behalf of
25
+ * the current user. Encapsulates the four security-sensitive steps:
26
+ *
27
+ * 1. Resolve the sandbox service DID via did:web.
28
+ * 2. Mint an `ixo:sandbox` UCAN invocation → `Authorization: Bearer ...`.
29
+ * 3. Optionally mint a parallel `ixo:skills` invocation →
30
+ * `X-Skills-Invocation: ...` (forwarded by sandbox to the skills service).
31
+ * 4. Layer oracle + user secrets as `x-os-*` / `x-us-*` headers.
32
+ *
33
+ * UCAN-only — no Matrix-OpenID fallback. If minting fails for any reason
34
+ * (no signing key, no cached delegation, did:web unresolved) the returned
35
+ * header set simply omits the relevant token and the downstream service
36
+ * surfaces a clean unauthorized error instead of leaking a half-built
37
+ * request.
38
+ */
39
+ export type SandboxAuthBuilder = (inputs: SandboxHeaderInputs, runCtx: RuntimeContext) => Promise<Record<string, string>>;
40
+ /**
41
+ * Default {@link SandboxAuthBuilder}. Service-DID resolution and caching is
42
+ * delegated to `runCtx.ucan.resolveServiceDid` (cached per origin inside the
43
+ * Tier-0 UCAN service), so this builder is stateless.
44
+ */
45
+ export declare function createDefaultAuthBuilder(): SandboxAuthBuilder;
46
+ //# sourceMappingURL=sandbox-mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-mcp.d.ts","sourceRoot":"","sources":["../../../src/plugins/sandbox/sandbox-mcp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,sDAAsD;AACtD,eAAO,MAAM,qBAAqB,gBAAgB,CAAC;AAEnD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWtE;AAED,yDAAyD;AACzD,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,aAAa,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gEAAgE;IAChE,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAC/B,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,cAAc,KACnB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAErC;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,kBAAkB,CA8D7D"}
@@ -0,0 +1,80 @@
1
+ /** Tool name surfaced by the upstream sandbox MCP. */
2
+ export const SANDBOX_RUN_TOOL_NAME = 'sandbox_run';
3
+ /**
4
+ * Parse the `ORACLE_SECRETS` env value (format: `KEY1=value1,KEY2=value2`).
5
+ *
6
+ * Lifted from `apps/app/src/graph/agents/main-agent.ts` (lines 752-763).
7
+ * Whitespace around keys and values is trimmed; entries lacking an `=` or
8
+ * an empty key/value are skipped silently so a stray comma can't break boot.
9
+ */
10
+ export function parseOracleSecrets(raw) {
11
+ const out = {};
12
+ if (!raw)
13
+ return out;
14
+ for (const pair of raw.split(',')) {
15
+ const eqIdx = pair.indexOf('=');
16
+ if (eqIdx <= 0)
17
+ continue;
18
+ const key = pair.slice(0, eqIdx).trim();
19
+ const val = pair.slice(eqIdx + 1).trim();
20
+ if (key && val)
21
+ out[key] = val;
22
+ }
23
+ return out;
24
+ }
25
+ /**
26
+ * Default {@link SandboxAuthBuilder}. Service-DID resolution and caching is
27
+ * delegated to `runCtx.ucan.resolveServiceDid` (cached per origin inside the
28
+ * Tier-0 UCAN service), so this builder is stateless.
29
+ */
30
+ export function createDefaultAuthBuilder() {
31
+ return async (inputs, runCtx) => {
32
+ const headers = {};
33
+ const sandboxDid = await runCtx.ucan.resolveServiceDid(inputs.sandboxMcpUrl);
34
+ if (sandboxDid) {
35
+ try {
36
+ const invocation = await runCtx.ucan.mintInvocation({
37
+ did: sandboxDid,
38
+ capability: 'ixo:sandbox',
39
+ });
40
+ if (invocation) {
41
+ headers.Authorization = `Bearer ${invocation}`;
42
+ headers['X-Auth-Type'] = 'ucan';
43
+ }
44
+ }
45
+ catch (error) {
46
+ const detail = error instanceof Error
47
+ ? `${error.name}: ${error.message}`
48
+ : String(error);
49
+ runCtx.logger.warn(`[sandbox] failed to mint sandbox UCAN invocation: ${detail}`);
50
+ }
51
+ }
52
+ if (inputs.skillsServiceUrl) {
53
+ const skillsDid = await runCtx.ucan.resolveServiceDid(inputs.skillsServiceUrl);
54
+ if (skillsDid) {
55
+ try {
56
+ const skillsInvocation = await runCtx.ucan.mintInvocation({
57
+ did: skillsDid,
58
+ capability: 'ixo:skills',
59
+ });
60
+ if (skillsInvocation) {
61
+ headers['X-Skills-Invocation'] = skillsInvocation;
62
+ }
63
+ }
64
+ catch (error) {
65
+ const detail = error instanceof Error
66
+ ? `${error.name}: ${error.message}`
67
+ : String(error);
68
+ runCtx.logger.warn(`[sandbox] failed to mint skills UCAN invocation: ${detail}`);
69
+ }
70
+ }
71
+ }
72
+ for (const [k, v] of Object.entries(inputs.oracleSecrets)) {
73
+ headers[`x-os-${k.toLowerCase()}`] = v;
74
+ }
75
+ for (const [k, v] of Object.entries(inputs.userSecrets)) {
76
+ headers[`x-us-${k.toLowerCase()}`] = v;
77
+ }
78
+ return headers;
79
+ };
80
+ }