@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.
- package/dist/bootstrap/ambient-factory.d.ts +32 -0
- package/dist/bootstrap/ambient-factory.d.ts.map +1 -0
- package/dist/bootstrap/ambient-factory.js +128 -0
- package/dist/bootstrap/create-oracle-app.d.ts +112 -0
- package/dist/bootstrap/create-oracle-app.d.ts.map +1 -0
- package/dist/bootstrap/create-oracle-app.js +530 -0
- package/dist/bootstrap/graceful-shutdown.d.ts +20 -0
- package/dist/bootstrap/graceful-shutdown.d.ts.map +1 -0
- package/dist/bootstrap/graceful-shutdown.js +61 -0
- package/dist/bootstrap/index.d.ts +13 -0
- package/dist/bootstrap/index.d.ts.map +1 -0
- package/dist/bootstrap/index.js +6 -0
- package/dist/bootstrap/inspect.d.ts +74 -0
- package/dist/bootstrap/inspect.d.ts.map +1 -0
- package/dist/bootstrap/inspect.js +111 -0
- package/dist/bootstrap/plugin-loader.d.ts +50 -0
- package/dist/bootstrap/plugin-loader.d.ts.map +1 -0
- package/dist/bootstrap/plugin-loader.js +119 -0
- package/dist/bootstrap/runtime-app-module.d.ts +38 -0
- package/dist/bootstrap/runtime-app-module.d.ts.map +1 -0
- package/dist/bootstrap/runtime-app-module.js +114 -0
- package/dist/bootstrap/schema-composer.d.ts +46 -0
- package/dist/bootstrap/schema-composer.d.ts.map +1 -0
- package/dist/bootstrap/schema-composer.js +65 -0
- package/dist/config/base-env-config.d.ts +31 -0
- package/dist/config/base-env-config.d.ts.map +1 -0
- package/dist/config/base-env-config.js +70 -0
- package/dist/config/base-env-schema.d.ts +77 -0
- package/dist/config/base-env-schema.d.ts.map +1 -0
- package/dist/config/base-env-schema.js +102 -0
- package/dist/events/scoped-emitter.d.ts +33 -0
- package/dist/events/scoped-emitter.d.ts.map +1 -0
- package/dist/events/scoped-emitter.js +32 -0
- package/dist/graph/index.d.ts +8 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +6 -0
- package/dist/graph/main-agent-types.d.ts +88 -0
- package/dist/graph/main-agent-types.d.ts.map +1 -0
- package/dist/graph/main-agent-types.js +20 -0
- package/dist/graph/main-agent.d.ts +16 -0
- package/dist/graph/main-agent.d.ts.map +1 -0
- package/dist/graph/main-agent.js +251 -0
- package/dist/graph/middlewares/capability-gate-middleware.d.ts +35 -0
- package/dist/graph/middlewares/capability-gate-middleware.d.ts.map +1 -0
- package/dist/graph/middlewares/capability-gate-middleware.js +54 -0
- package/dist/graph/middlewares/index.d.ts +7 -0
- package/dist/graph/middlewares/index.d.ts.map +1 -0
- package/dist/graph/middlewares/index.js +6 -0
- package/dist/graph/middlewares/page-context-middleware.d.ts +23 -0
- package/dist/graph/middlewares/page-context-middleware.d.ts.map +1 -0
- package/dist/graph/middlewares/page-context-middleware.js +68 -0
- package/dist/graph/middlewares/safety-guardrail-middleware.d.ts +26 -0
- package/dist/graph/middlewares/safety-guardrail-middleware.d.ts.map +1 -0
- package/dist/graph/middlewares/safety-guardrail-middleware.js +88 -0
- package/dist/graph/middlewares/summarization-middleware.d.ts +17 -0
- package/dist/graph/middlewares/summarization-middleware.d.ts.map +1 -0
- package/dist/graph/middlewares/summarization-middleware.js +62 -0
- package/dist/graph/middlewares/tool-repetition-guard-middleware.d.ts +24 -0
- package/dist/graph/middlewares/tool-repetition-guard-middleware.d.ts.map +1 -0
- package/dist/graph/middlewares/tool-repetition-guard-middleware.js +112 -0
- package/dist/graph/middlewares/tool-validation-middleware.d.ts +24 -0
- package/dist/graph/middlewares/tool-validation-middleware.d.ts.map +1 -0
- package/dist/graph/middlewares/tool-validation-middleware.js +61 -0
- package/dist/graph/prompt-composer.d.ts +69 -0
- package/dist/graph/prompt-composer.d.ts.map +1 -0
- package/dist/graph/prompt-composer.js +315 -0
- package/dist/graph/state.d.ts +65 -0
- package/dist/graph/state.d.ts.map +1 -0
- package/dist/graph/state.js +60 -0
- package/dist/graph/sub-agent-fallback.d.ts +56 -0
- package/dist/graph/sub-agent-fallback.d.ts.map +1 -0
- package/dist/graph/sub-agent-fallback.js +79 -0
- package/dist/graph/subagent-as-tool.d.ts +77 -0
- package/dist/graph/subagent-as-tool.d.ts.map +1 -0
- package/dist/graph/subagent-as-tool.js +197 -0
- package/dist/graph/wrap-plugin-tool.d.ts +28 -0
- package/dist/graph/wrap-plugin-tool.d.ts.map +1 -0
- package/dist/graph/wrap-plugin-tool.js +30 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/llm/index.d.ts +2 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/index.js +1 -0
- package/dist/llm/llm-provider.d.ts +41 -0
- package/dist/llm/llm-provider.d.ts.map +1 -0
- package/dist/llm/llm-provider.js +130 -0
- package/dist/manifest/index.d.ts +6 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +3 -0
- package/dist/manifest/schema.d.ts +31 -0
- package/dist/manifest/schema.d.ts.map +1 -0
- package/dist/manifest/schema.js +44 -0
- package/dist/manifest/tier1-renderer.d.ts +31 -0
- package/dist/manifest/tier1-renderer.d.ts.map +1 -0
- package/dist/manifest/tier1-renderer.js +68 -0
- package/dist/manifest/validator.d.ts +34 -0
- package/dist/manifest/validator.d.ts.map +1 -0
- package/dist/manifest/validator.js +111 -0
- package/dist/matrix/checkpointer/matrix-upload-utils.d.ts +66 -0
- package/dist/matrix/checkpointer/matrix-upload-utils.d.ts.map +1 -0
- package/dist/matrix/checkpointer/matrix-upload-utils.js +228 -0
- package/dist/matrix/checkpointer/type.d.ts +4 -0
- package/dist/matrix/checkpointer/type.d.ts.map +1 -0
- package/dist/matrix/checkpointer/type.js +1 -0
- package/dist/matrix/checkpointer/user-matrix-sqlite-sync-service.module.d.ts +3 -0
- package/dist/matrix/checkpointer/user-matrix-sqlite-sync-service.module.d.ts.map +1 -0
- package/dist/matrix/checkpointer/user-matrix-sqlite-sync-service.module.js +22 -0
- package/dist/matrix/checkpointer/user-matrix-sqlite-sync-service.service.d.ts +93 -0
- package/dist/matrix/checkpointer/user-matrix-sqlite-sync-service.service.d.ts.map +1 -0
- package/dist/matrix/checkpointer/user-matrix-sqlite-sync-service.service.js +856 -0
- package/dist/matrix/room-membership.d.ts +11 -0
- package/dist/matrix/room-membership.d.ts.map +1 -0
- package/dist/matrix/room-membership.js +33 -0
- package/dist/meta-tools/index.d.ts +28 -0
- package/dist/meta-tools/index.d.ts.map +1 -0
- package/dist/meta-tools/index.js +24 -0
- package/dist/meta-tools/list-capabilities.d.ts +12 -0
- package/dist/meta-tools/list-capabilities.d.ts.map +1 -0
- package/dist/meta-tools/list-capabilities.js +55 -0
- package/dist/meta-tools/load-capability.d.ts +24 -0
- package/dist/meta-tools/load-capability.d.ts.map +1 -0
- package/dist/meta-tools/load-capability.js +82 -0
- package/dist/modules/auth/auth-header.middleware.d.ts +37 -0
- package/dist/modules/auth/auth-header.middleware.d.ts.map +1 -0
- package/dist/modules/auth/auth-header.middleware.js +115 -0
- package/dist/modules/auth/auth.module.d.ts +9 -0
- package/dist/modules/auth/auth.module.d.ts.map +1 -0
- package/dist/modules/auth/auth.module.js +27 -0
- package/dist/modules/auth/index.d.ts +3 -0
- package/dist/modules/auth/index.d.ts.map +1 -0
- package/dist/modules/auth/index.js +2 -0
- package/dist/modules/auth/validate-ucan-delegation.d.ts +31 -0
- package/dist/modules/auth/validate-ucan-delegation.d.ts.map +1 -0
- package/dist/modules/auth/validate-ucan-delegation.js +36 -0
- package/dist/modules/blob-store/blob-store.module.d.ts +10 -0
- package/dist/modules/blob-store/blob-store.module.d.ts.map +1 -0
- package/dist/modules/blob-store/blob-store.module.js +25 -0
- package/dist/modules/blob-store/blob-store.service.d.ts +66 -0
- package/dist/modules/blob-store/blob-store.service.d.ts.map +1 -0
- package/dist/modules/blob-store/blob-store.service.js +108 -0
- package/dist/modules/blob-store/index.d.ts +3 -0
- package/dist/modules/blob-store/index.d.ts.map +1 -0
- package/dist/modules/blob-store/index.js +2 -0
- package/dist/modules/health/health.controller.d.ts +18 -0
- package/dist/modules/health/health.controller.d.ts.map +1 -0
- package/dist/modules/health/health.controller.js +48 -0
- package/dist/modules/health/health.module.d.ts +8 -0
- package/dist/modules/health/health.module.d.ts.map +1 -0
- package/dist/modules/health/health.module.js +21 -0
- package/dist/modules/index.d.ts +8 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/modules/index.js +6 -0
- package/dist/modules/messages/__test-fixtures__/deps.d.ts +41 -0
- package/dist/modules/messages/__test-fixtures__/deps.d.ts.map +1 -0
- package/dist/modules/messages/__test-fixtures__/deps.js +73 -0
- package/dist/modules/messages/__test-fixtures__/fake-agent.d.ts +27 -0
- package/dist/modules/messages/__test-fixtures__/fake-agent.d.ts.map +1 -0
- package/dist/modules/messages/__test-fixtures__/fake-agent.js +41 -0
- package/dist/modules/messages/__test-fixtures__/fake-response.d.ts +29 -0
- package/dist/modules/messages/__test-fixtures__/fake-response.d.ts.map +1 -0
- package/dist/modules/messages/__test-fixtures__/fake-response.js +55 -0
- package/dist/modules/messages/agent-builder.d.ts +64 -0
- package/dist/modules/messages/agent-builder.d.ts.map +1 -0
- package/dist/modules/messages/agent-builder.js +219 -0
- package/dist/modules/messages/batch-invoker.d.ts +36 -0
- package/dist/modules/messages/batch-invoker.d.ts.map +1 -0
- package/dist/modules/messages/batch-invoker.js +58 -0
- package/dist/modules/messages/dto/list-messages.dto.d.ts +4 -0
- package/dist/modules/messages/dto/list-messages.dto.d.ts.map +1 -0
- package/dist/modules/messages/dto/list-messages.dto.js +17 -0
- package/dist/modules/messages/dto/send-message.dto.d.ts +73 -0
- package/dist/modules/messages/dto/send-message.dto.d.ts.map +1 -0
- package/dist/modules/messages/dto/send-message.dto.js +318 -0
- package/dist/modules/messages/file-processing-credit-sink.port.d.ts +20 -0
- package/dist/modules/messages/file-processing-credit-sink.port.d.ts.map +1 -0
- package/dist/modules/messages/file-processing-credit-sink.port.js +1 -0
- package/dist/modules/messages/file-processing.service.d.ts +195 -0
- package/dist/modules/messages/file-processing.service.d.ts.map +1 -0
- package/dist/modules/messages/file-processing.service.js +1278 -0
- package/dist/modules/messages/homeserver-cache.d.ts +11 -0
- package/dist/modules/messages/homeserver-cache.d.ts.map +1 -0
- package/dist/modules/messages/homeserver-cache.js +31 -0
- package/dist/modules/messages/matrix-listener-bridge.d.ts +63 -0
- package/dist/modules/messages/matrix-listener-bridge.d.ts.map +1 -0
- package/dist/modules/messages/matrix-listener-bridge.js +280 -0
- package/dist/modules/messages/messages.controller.d.ts +13 -0
- package/dist/modules/messages/messages.controller.d.ts.map +1 -0
- package/dist/modules/messages/messages.controller.js +95 -0
- package/dist/modules/messages/messages.module.d.ts +3 -0
- package/dist/modules/messages/messages.module.d.ts.map +1 -0
- package/dist/modules/messages/messages.module.js +75 -0
- package/dist/modules/messages/messages.service.d.ts +112 -0
- package/dist/modules/messages/messages.service.d.ts.map +1 -0
- package/dist/modules/messages/messages.service.js +279 -0
- package/dist/modules/messages/oracle-runtime-bundle.d.ts +38 -0
- package/dist/modules/messages/oracle-runtime-bundle.d.ts.map +1 -0
- package/dist/modules/messages/oracle-runtime-bundle.js +40 -0
- package/dist/modules/messages/post-message-syncer.d.ts +30 -0
- package/dist/modules/messages/post-message-syncer.d.ts.map +1 -0
- package/dist/modules/messages/post-message-syncer.js +73 -0
- package/dist/modules/messages/request-preparer.d.ts +53 -0
- package/dist/modules/messages/request-preparer.d.ts.map +1 -0
- package/dist/modules/messages/request-preparer.js +139 -0
- package/dist/modules/messages/sse-stream-runner.d.ts +73 -0
- package/dist/modules/messages/sse-stream-runner.d.ts.map +1 -0
- package/dist/modules/messages/sse-stream-runner.js +352 -0
- package/dist/modules/messages/sse.utils.d.ts +29 -0
- package/dist/modules/messages/sse.utils.d.ts.map +1 -0
- package/dist/modules/messages/sse.utils.js +77 -0
- package/dist/modules/messages/user-context-fetcher.d.ts +41 -0
- package/dist/modules/messages/user-context-fetcher.d.ts.map +1 -0
- package/dist/modules/messages/user-context-fetcher.js +117 -0
- package/dist/modules/secrets/index.d.ts +2 -0
- package/dist/modules/secrets/index.d.ts.map +1 -0
- package/dist/modules/secrets/index.js +1 -0
- package/dist/modules/secrets/secrets.service.d.ts +29 -0
- package/dist/modules/secrets/secrets.service.d.ts.map +1 -0
- package/dist/modules/secrets/secrets.service.js +107 -0
- package/dist/modules/sessions/dto/create-session.dto.d.ts +6 -0
- package/dist/modules/sessions/dto/create-session.dto.d.ts.map +1 -0
- package/dist/modules/sessions/dto/create-session.dto.js +5 -0
- package/dist/modules/sessions/dto/delete-session.dto.d.ts +6 -0
- package/dist/modules/sessions/dto/delete-session.dto.d.ts.map +1 -0
- package/dist/modules/sessions/dto/delete-session.dto.js +5 -0
- package/dist/modules/sessions/dto/list-sessions.dto.d.ts +7 -0
- package/dist/modules/sessions/dto/list-sessions.dto.d.ts.map +1 -0
- package/dist/modules/sessions/dto/list-sessions.dto.js +6 -0
- package/dist/modules/sessions/session-history-processor.service.d.ts +48 -0
- package/dist/modules/sessions/session-history-processor.service.d.ts.map +1 -0
- package/dist/modules/sessions/session-history-processor.service.js +254 -0
- package/dist/modules/sessions/sessions.controller.d.ts +13 -0
- package/dist/modules/sessions/sessions.controller.d.ts.map +1 -0
- package/dist/modules/sessions/sessions.controller.js +113 -0
- package/dist/modules/sessions/sessions.module.d.ts +3 -0
- package/dist/modules/sessions/sessions.module.d.ts.map +1 -0
- package/dist/modules/sessions/sessions.module.js +49 -0
- package/dist/modules/sessions/sessions.service.d.ts +23 -0
- package/dist/modules/sessions/sessions.service.d.ts.map +1 -0
- package/dist/modules/sessions/sessions.service.js +168 -0
- package/dist/modules/subscription/subscription.middleware.d.ts +37 -0
- package/dist/modules/subscription/subscription.middleware.d.ts.map +1 -0
- package/dist/modules/subscription/subscription.middleware.js +141 -0
- package/dist/modules/subscription/subscription.module.d.ts +12 -0
- package/dist/modules/subscription/subscription.module.d.ts.map +1 -0
- package/dist/modules/subscription/subscription.module.js +26 -0
- package/dist/modules/throttler/throttler.module.d.ts +11 -0
- package/dist/modules/throttler/throttler.module.d.ts.map +1 -0
- package/dist/modules/throttler/throttler.module.js +32 -0
- package/dist/modules/ucan/index.d.ts +7 -0
- package/dist/modules/ucan/index.d.ts.map +1 -0
- package/dist/modules/ucan/index.js +6 -0
- package/dist/modules/ucan/ucan.config.d.ts +87 -0
- package/dist/modules/ucan/ucan.config.d.ts.map +1 -0
- package/dist/modules/ucan/ucan.config.js +114 -0
- package/dist/modules/ucan/ucan.module.d.ts +29 -0
- package/dist/modules/ucan/ucan.module.d.ts.map +1 -0
- package/dist/modules/ucan/ucan.module.js +46 -0
- package/dist/modules/ucan/ucan.service.d.ts +129 -0
- package/dist/modules/ucan/ucan.service.d.ts.map +1 -0
- package/dist/modules/ucan/ucan.service.js +582 -0
- package/dist/modules/ws/emitter.d.ts +12 -0
- package/dist/modules/ws/emitter.d.ts.map +1 -0
- package/dist/modules/ws/emitter.js +12 -0
- package/dist/modules/ws/ws.gateway.d.ts +34 -0
- package/dist/modules/ws/ws.gateway.d.ts.map +1 -0
- package/dist/modules/ws/ws.gateway.js +241 -0
- package/dist/modules/ws/ws.module.d.ts +3 -0
- package/dist/modules/ws/ws.module.d.ts.map +1 -0
- package/dist/modules/ws/ws.module.js +21 -0
- package/dist/modules/ws/ws.service.d.ts +25 -0
- package/dist/modules/ws/ws.service.d.ts.map +1 -0
- package/dist/modules/ws/ws.service.js +113 -0
- package/dist/plugin-api/define-plugin.d.ts +19 -0
- package/dist/plugin-api/define-plugin.d.ts.map +1 -0
- package/dist/plugin-api/define-plugin.js +25 -0
- package/dist/plugin-api/oracle-plugin.d.ts +92 -0
- package/dist/plugin-api/oracle-plugin.d.ts.map +1 -0
- package/dist/plugin-api/oracle-plugin.js +15 -0
- package/dist/plugin-api/tool-helper.d.ts +33 -0
- package/dist/plugin-api/tool-helper.d.ts.map +1 -0
- package/dist/plugin-api/tool-helper.js +40 -0
- package/dist/plugin-api/types.d.ts +378 -0
- package/dist/plugin-api/types.d.ts.map +1 -0
- package/dist/plugin-api/types.js +1 -0
- package/dist/plugins/agui/agui-agent.d.ts +10 -0
- package/dist/plugins/agui/agui-agent.d.ts.map +1 -0
- package/dist/plugins/agui/agui-agent.js +110 -0
- package/dist/plugins/agui/agui.plugin.d.ts +16 -0
- package/dist/plugins/agui/agui.plugin.d.ts.map +1 -0
- package/dist/plugins/agui/agui.plugin.js +117 -0
- package/dist/plugins/agui/index.d.ts +3 -0
- package/dist/plugins/agui/index.d.ts.map +1 -0
- package/dist/plugins/agui/index.js +2 -0
- package/dist/plugins/composio/composio-tools.d.ts +59 -0
- package/dist/plugins/composio/composio-tools.d.ts.map +1 -0
- package/dist/plugins/composio/composio-tools.js +88 -0
- package/dist/plugins/composio/composio-ucan.d.ts +14 -0
- package/dist/plugins/composio/composio-ucan.d.ts.map +1 -0
- package/dist/plugins/composio/composio-ucan.js +32 -0
- package/dist/plugins/composio/composio.plugin.d.ts +45 -0
- package/dist/plugins/composio/composio.plugin.d.ts.map +1 -0
- package/dist/plugins/composio/composio.plugin.js +116 -0
- package/dist/plugins/composio/index.d.ts +4 -0
- package/dist/plugins/composio/index.d.ts.map +1 -0
- package/dist/plugins/composio/index.js +3 -0
- package/dist/plugins/credits/claim-processing.module.d.ts +28 -0
- package/dist/plugins/credits/claim-processing.module.d.ts.map +1 -0
- package/dist/plugins/credits/claim-processing.module.js +37 -0
- package/dist/plugins/credits/claim-processing.service.d.ts +92 -0
- package/dist/plugins/credits/claim-processing.service.d.ts.map +1 -0
- package/dist/plugins/credits/claim-processing.service.js +406 -0
- package/dist/plugins/credits/credits-middleware.d.ts +23 -0
- package/dist/plugins/credits/credits-middleware.d.ts.map +1 -0
- package/dist/plugins/credits/credits-middleware.js +154 -0
- package/dist/plugins/credits/credits.plugin.d.ts +55 -0
- package/dist/plugins/credits/credits.plugin.d.ts.map +1 -0
- package/dist/plugins/credits/credits.plugin.js +95 -0
- package/dist/plugins/credits/file-processing-sink.module.d.ts +18 -0
- package/dist/plugins/credits/file-processing-sink.module.d.ts.map +1 -0
- package/dist/plugins/credits/file-processing-sink.module.js +56 -0
- package/dist/plugins/credits/index.d.ts +8 -0
- package/dist/plugins/credits/index.d.ts.map +1 -0
- package/dist/plugins/credits/index.js +7 -0
- package/dist/plugins/credits/subscription-sink.module.d.ts +23 -0
- package/dist/plugins/credits/subscription-sink.module.d.ts.map +1 -0
- package/dist/plugins/credits/subscription-sink.module.js +54 -0
- package/dist/plugins/credits/token-limiter.d.ts +139 -0
- package/dist/plugins/credits/token-limiter.d.ts.map +1 -0
- package/dist/plugins/credits/token-limiter.js +302 -0
- package/dist/plugins/domain-indexer/domain-indexer-agent.d.ts +7 -0
- package/dist/plugins/domain-indexer/domain-indexer-agent.d.ts.map +1 -0
- package/dist/plugins/domain-indexer/domain-indexer-agent.js +48 -0
- package/dist/plugins/domain-indexer/domain-indexer-tools.d.ts +8 -0
- package/dist/plugins/domain-indexer/domain-indexer-tools.d.ts.map +1 -0
- package/dist/plugins/domain-indexer/domain-indexer-tools.js +194 -0
- package/dist/plugins/domain-indexer/domain-indexer.plugin.d.ts +20 -0
- package/dist/plugins/domain-indexer/domain-indexer.plugin.d.ts.map +1 -0
- package/dist/plugins/domain-indexer/domain-indexer.plugin.js +78 -0
- package/dist/plugins/domain-indexer/index.d.ts +2 -0
- package/dist/plugins/domain-indexer/index.d.ts.map +1 -0
- package/dist/plugins/domain-indexer/index.js +1 -0
- package/dist/plugins/editor/apply-sandbox-output.d.ts +33 -0
- package/dist/plugins/editor/apply-sandbox-output.d.ts.map +1 -0
- package/dist/plugins/editor/apply-sandbox-output.js +302 -0
- package/dist/plugins/editor/block-actions.d.ts +84 -0
- package/dist/plugins/editor/block-actions.d.ts.map +1 -0
- package/dist/plugins/editor/block-actions.js +471 -0
- package/dist/plugins/editor/blocknote-helper.d.ts +147 -0
- package/dist/plugins/editor/blocknote-helper.d.ts.map +1 -0
- package/dist/plugins/editor/blocknote-helper.js +542 -0
- package/dist/plugins/editor/blocknote-tools.d.ts +364 -0
- package/dist/plugins/editor/blocknote-tools.d.ts.map +1 -0
- package/dist/plugins/editor/blocknote-tools.js +2123 -0
- package/dist/plugins/editor/editor-agent.d.ts +47 -0
- package/dist/plugins/editor/editor-agent.d.ts.map +1 -0
- package/dist/plugins/editor/editor-agent.js +158 -0
- package/dist/plugins/editor/editor-mx.d.ts +56 -0
- package/dist/plugins/editor/editor-mx.d.ts.map +1 -0
- package/dist/plugins/editor/editor-mx.js +100 -0
- package/dist/plugins/editor/editor.plugin.d.ts +32 -0
- package/dist/plugins/editor/editor.plugin.d.ts.map +1 -0
- package/dist/plugins/editor/editor.plugin.js +189 -0
- package/dist/plugins/editor/index.d.ts +6 -0
- package/dist/plugins/editor/index.d.ts.map +1 -0
- package/dist/plugins/editor/index.js +5 -0
- package/dist/plugins/editor/mint-invocation-tool.d.ts +72 -0
- package/dist/plugins/editor/mint-invocation-tool.d.ts.map +1 -0
- package/dist/plugins/editor/mint-invocation-tool.js +173 -0
- package/dist/plugins/editor/page-functions.d.ts +100 -0
- package/dist/plugins/editor/page-functions.d.ts.map +1 -0
- package/dist/plugins/editor/page-functions.js +317 -0
- package/dist/plugins/editor/page-tools.d.ts +75 -0
- package/dist/plugins/editor/page-tools.d.ts.map +1 -0
- package/dist/plugins/editor/page-tools.js +238 -0
- package/dist/plugins/editor/prompts.d.ts +22 -0
- package/dist/plugins/editor/prompts.d.ts.map +1 -0
- package/dist/plugins/editor/prompts.js +451 -0
- package/dist/plugins/editor/provider.d.ts +101 -0
- package/dist/plugins/editor/provider.d.ts.map +1 -0
- package/dist/plugins/editor/provider.js +249 -0
- package/dist/plugins/editor/standalone-editor-tool.d.ts +17 -0
- package/dist/plugins/editor/standalone-editor-tool.d.ts.map +1 -0
- package/dist/plugins/editor/standalone-editor-tool.js +136 -0
- package/dist/plugins/editor/survey-helpers.d.ts +112 -0
- package/dist/plugins/editor/survey-helpers.d.ts.map +1 -0
- package/dist/plugins/editor/survey-helpers.js +358 -0
- package/dist/plugins/firecrawl/firecrawl-agent.d.ts +7 -0
- package/dist/plugins/firecrawl/firecrawl-agent.d.ts.map +1 -0
- package/dist/plugins/firecrawl/firecrawl-agent.js +84 -0
- package/dist/plugins/firecrawl/firecrawl-tools.d.ts +37 -0
- package/dist/plugins/firecrawl/firecrawl-tools.d.ts.map +1 -0
- package/dist/plugins/firecrawl/firecrawl-tools.js +129 -0
- package/dist/plugins/firecrawl/firecrawl.plugin.d.ts +32 -0
- package/dist/plugins/firecrawl/firecrawl.plugin.d.ts.map +1 -0
- package/dist/plugins/firecrawl/firecrawl.plugin.js +69 -0
- package/dist/plugins/firecrawl/index.d.ts +3 -0
- package/dist/plugins/firecrawl/index.d.ts.map +1 -0
- package/dist/plugins/firecrawl/index.js +2 -0
- package/dist/plugins/index.d.ts +47 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +69 -0
- package/dist/plugins/matrix-group-chats/channel-memory.module.d.ts +7 -0
- package/dist/plugins/matrix-group-chats/channel-memory.module.d.ts.map +1 -0
- package/dist/plugins/matrix-group-chats/channel-memory.module.js +22 -0
- package/dist/plugins/matrix-group-chats/channel-memory.repo.d.ts +62 -0
- package/dist/plugins/matrix-group-chats/channel-memory.repo.d.ts.map +1 -0
- package/dist/plugins/matrix-group-chats/channel-memory.repo.js +311 -0
- package/dist/plugins/matrix-group-chats/channel-memory.service.d.ts +89 -0
- package/dist/plugins/matrix-group-chats/channel-memory.service.d.ts.map +1 -0
- package/dist/plugins/matrix-group-chats/channel-memory.service.js +565 -0
- package/dist/plugins/matrix-group-chats/channel-memory.summarizer.d.ts +18 -0
- package/dist/plugins/matrix-group-chats/channel-memory.summarizer.d.ts.map +1 -0
- package/dist/plugins/matrix-group-chats/channel-memory.summarizer.js +128 -0
- package/dist/plugins/matrix-group-chats/channel-memory.types.d.ts +50 -0
- package/dist/plugins/matrix-group-chats/channel-memory.types.d.ts.map +1 -0
- package/dist/plugins/matrix-group-chats/channel-memory.types.js +2 -0
- package/dist/plugins/matrix-group-chats/guard.d.ts +83 -0
- package/dist/plugins/matrix-group-chats/guard.d.ts.map +1 -0
- package/dist/plugins/matrix-group-chats/guard.js +138 -0
- package/dist/plugins/matrix-group-chats/index.d.ts +59 -0
- package/dist/plugins/matrix-group-chats/index.d.ts.map +1 -0
- package/dist/plugins/matrix-group-chats/index.js +140 -0
- package/dist/plugins/matrix-group-chats/middleware.d.ts +31 -0
- package/dist/plugins/matrix-group-chats/middleware.d.ts.map +1 -0
- package/dist/plugins/matrix-group-chats/middleware.js +186 -0
- package/dist/plugins/matrix-group-chats/power-levels.d.ts +15 -0
- package/dist/plugins/matrix-group-chats/power-levels.d.ts.map +1 -0
- package/dist/plugins/matrix-group-chats/power-levels.js +36 -0
- package/dist/plugins/matrix-group-chats/room-info.d.ts +23 -0
- package/dist/plugins/matrix-group-chats/room-info.d.ts.map +1 -0
- package/dist/plugins/matrix-group-chats/room-info.js +34 -0
- package/dist/plugins/matrix-group-chats/tools.d.ts +8 -0
- package/dist/plugins/matrix-group-chats/tools.d.ts.map +1 -0
- package/dist/plugins/matrix-group-chats/tools.js +154 -0
- package/dist/plugins/memory/index.d.ts +5 -0
- package/dist/plugins/memory/index.d.ts.map +1 -0
- package/dist/plugins/memory/index.js +3 -0
- package/dist/plugins/memory/memory-tools.d.ts +52 -0
- package/dist/plugins/memory/memory-tools.d.ts.map +1 -0
- package/dist/plugins/memory/memory-tools.js +88 -0
- package/dist/plugins/memory/memory-ucan.d.ts +17 -0
- package/dist/plugins/memory/memory-ucan.d.ts.map +1 -0
- package/dist/plugins/memory/memory-ucan.js +43 -0
- package/dist/plugins/memory/memory.plugin.d.ts +51 -0
- package/dist/plugins/memory/memory.plugin.d.ts.map +1 -0
- package/dist/plugins/memory/memory.plugin.js +76 -0
- package/dist/plugins/memory/types.d.ts +75 -0
- package/dist/plugins/memory/types.d.ts.map +1 -0
- package/dist/plugins/memory/types.js +2 -0
- package/dist/plugins/portal/index.d.ts +3 -0
- package/dist/plugins/portal/index.d.ts.map +1 -0
- package/dist/plugins/portal/index.js +2 -0
- package/dist/plugins/portal/portal-agent.d.ts +9 -0
- package/dist/plugins/portal/portal-agent.d.ts.map +1 -0
- package/dist/plugins/portal/portal-agent.js +70 -0
- package/dist/plugins/portal/portal.plugin.d.ts +16 -0
- package/dist/plugins/portal/portal.plugin.d.ts.map +1 -0
- package/dist/plugins/portal/portal.plugin.js +115 -0
- package/dist/plugins/sandbox/index.d.ts +3 -0
- package/dist/plugins/sandbox/index.d.ts.map +1 -0
- package/dist/plugins/sandbox/index.js +2 -0
- package/dist/plugins/sandbox/sandbox-mcp.d.ts +46 -0
- package/dist/plugins/sandbox/sandbox-mcp.d.ts.map +1 -0
- package/dist/plugins/sandbox/sandbox-mcp.js +80 -0
- package/dist/plugins/sandbox/sandbox-write-blob.d.ts +22 -0
- package/dist/plugins/sandbox/sandbox-write-blob.d.ts.map +1 -0
- package/dist/plugins/sandbox/sandbox-write-blob.js +80 -0
- package/dist/plugins/sandbox/sandbox.plugin.d.ts +80 -0
- package/dist/plugins/sandbox/sandbox.plugin.d.ts.map +1 -0
- package/dist/plugins/sandbox/sandbox.plugin.js +204 -0
- package/dist/plugins/skills/index.d.ts +3 -0
- package/dist/plugins/skills/index.d.ts.map +1 -0
- package/dist/plugins/skills/index.js +2 -0
- package/dist/plugins/skills/skills-tools.d.ts +20 -0
- package/dist/plugins/skills/skills-tools.d.ts.map +1 -0
- package/dist/plugins/skills/skills-tools.js +204 -0
- package/dist/plugins/skills/skills-ucan.d.ts +24 -0
- package/dist/plugins/skills/skills-ucan.d.ts.map +1 -0
- package/dist/plugins/skills/skills-ucan.js +28 -0
- package/dist/plugins/skills/skills.plugin.d.ts +37 -0
- package/dist/plugins/skills/skills.plugin.d.ts.map +1 -0
- package/dist/plugins/skills/skills.plugin.js +82 -0
- package/dist/plugins/slack/index.d.ts +4 -0
- package/dist/plugins/slack/index.d.ts.map +1 -0
- package/dist/plugins/slack/index.js +3 -0
- package/dist/plugins/slack/slack.module.d.ts +9 -0
- package/dist/plugins/slack/slack.module.d.ts.map +1 -0
- package/dist/plugins/slack/slack.module.js +27 -0
- package/dist/plugins/slack/slack.plugin.d.ts +30 -0
- package/dist/plugins/slack/slack.plugin.d.ts.map +1 -0
- package/dist/plugins/slack/slack.plugin.js +40 -0
- package/dist/plugins/slack/slack.service.d.ts +32 -0
- package/dist/plugins/slack/slack.service.d.ts.map +1 -0
- package/dist/plugins/slack/slack.service.js +157 -0
- package/dist/plugins/user-preferences/index.d.ts +4 -0
- package/dist/plugins/user-preferences/index.d.ts.map +1 -0
- package/dist/plugins/user-preferences/index.js +3 -0
- package/dist/plugins/user-preferences/service/user-preferences.service.d.ts +61 -0
- package/dist/plugins/user-preferences/service/user-preferences.service.d.ts.map +1 -0
- package/dist/plugins/user-preferences/service/user-preferences.service.js +105 -0
- package/dist/plugins/user-preferences/user-preferences-http.module.d.ts +10 -0
- package/dist/plugins/user-preferences/user-preferences-http.module.d.ts.map +1 -0
- package/dist/plugins/user-preferences/user-preferences-http.module.js +23 -0
- package/dist/plugins/user-preferences/user-preferences-tool.d.ts +22 -0
- package/dist/plugins/user-preferences/user-preferences-tool.d.ts.map +1 -0
- package/dist/plugins/user-preferences/user-preferences-tool.js +103 -0
- package/dist/plugins/user-preferences/user-preferences.controller.d.ts +18 -0
- package/dist/plugins/user-preferences/user-preferences.controller.d.ts.map +1 -0
- package/dist/plugins/user-preferences/user-preferences.controller.js +72 -0
- package/dist/plugins/user-preferences/user-preferences.plugin.d.ts +27 -0
- package/dist/plugins/user-preferences/user-preferences.plugin.d.ts.map +1 -0
- package/dist/plugins/user-preferences/user-preferences.plugin.js +66 -0
- package/dist/registries/config-schema-registry.d.ts +24 -0
- package/dist/registries/config-schema-registry.d.ts.map +1 -0
- package/dist/registries/config-schema-registry.js +27 -0
- package/dist/registries/index.d.ts +13 -0
- package/dist/registries/index.d.ts.map +1 -0
- package/dist/registries/index.js +6 -0
- package/dist/registries/manifest-registry.d.ts +49 -0
- package/dist/registries/manifest-registry.d.ts.map +1 -0
- package/dist/registries/manifest-registry.js +53 -0
- package/dist/registries/middleware-registry.d.ts +41 -0
- package/dist/registries/middleware-registry.d.ts.map +1 -0
- package/dist/registries/middleware-registry.js +52 -0
- package/dist/registries/shared-state-registry.d.ts +41 -0
- package/dist/registries/shared-state-registry.d.ts.map +1 -0
- package/dist/registries/shared-state-registry.js +65 -0
- package/dist/registries/subagent-registry.d.ts +55 -0
- package/dist/registries/subagent-registry.d.ts.map +1 -0
- package/dist/registries/subagent-registry.js +106 -0
- package/dist/registries/test-fixtures.d.ts +47 -0
- package/dist/registries/test-fixtures.d.ts.map +1 -0
- package/dist/registries/test-fixtures.js +168 -0
- package/dist/registries/tool-registry.d.ts +74 -0
- package/dist/registries/tool-registry.d.ts.map +1 -0
- package/dist/registries/tool-registry.js +130 -0
- package/dist/runtime-context/ambient.d.ts +118 -0
- package/dist/runtime-context/ambient.d.ts.map +1 -0
- package/dist/runtime-context/ambient.js +1 -0
- package/dist/runtime-context/build-plugin.d.ts +20 -0
- package/dist/runtime-context/build-plugin.d.ts.map +1 -0
- package/dist/runtime-context/build-plugin.js +16 -0
- package/dist/runtime-context/build-runtime.d.ts +60 -0
- package/dist/runtime-context/build-runtime.d.ts.map +1 -0
- package/dist/runtime-context/build-runtime.js +81 -0
- package/dist/testing/create-test-runtime.d.ts +95 -0
- package/dist/testing/create-test-runtime.d.ts.map +1 -0
- package/dist/testing/create-test-runtime.js +302 -0
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +5 -0
- package/dist/testing/integration/chat-client.d.ts +143 -0
- package/dist/testing/integration/chat-client.d.ts.map +1 -0
- package/dist/testing/integration/chat-client.js +238 -0
- package/dist/testing/integration/harness.d.ts +189 -0
- package/dist/testing/integration/harness.d.ts.map +1 -0
- package/dist/testing/integration/harness.js +461 -0
- package/dist/testing/integration/index.d.ts +14 -0
- package/dist/testing/integration/index.d.ts.map +1 -0
- package/dist/testing/integration/index.js +18 -0
- package/dist/testing/integration/setup.d.ts +2 -0
- package/dist/testing/integration/setup.d.ts.map +1 -0
- package/dist/testing/integration/setup.js +41 -0
- package/dist/testing/integration/sse-parser.d.ts +99 -0
- package/dist/testing/integration/sse-parser.d.ts.map +1 -0
- package/dist/testing/integration/sse-parser.js +125 -0
- package/dist/testing/integration/ucan.d.ts +74 -0
- package/dist/testing/integration/ucan.d.ts.map +1 -0
- package/dist/testing/integration/ucan.js +95 -0
- package/dist/testing/integration/wait-for-matrix-loaded.d.ts +19 -0
- package/dist/testing/integration/wait-for-matrix-loaded.d.ts.map +1 -0
- package/dist/testing/integration/wait-for-matrix-loaded.js +31 -0
- package/dist/testing/mocks.d.ts +64 -0
- package/dist/testing/mocks.d.ts.map +1 -0
- package/dist/testing/mocks.js +141 -0
- package/dist/testing/nest-doubles.d.ts +10 -0
- package/dist/testing/nest-doubles.d.ts.map +1 -0
- package/dist/testing/nest-doubles.js +19 -0
- package/dist/utils/emoji.d.ts +3 -0
- package/dist/utils/emoji.d.ts.map +1 -0
- package/dist/utils/emoji.js +36 -0
- package/package.json +102 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { SessionManagerService, type ListOracleMessagesResponse } from '@ixo/common';
|
|
2
|
+
import { type OnModuleInit } from '@nestjs/common';
|
|
3
|
+
import { ConfigService } from '@nestjs/config';
|
|
4
|
+
import type { Request, Response } from 'express';
|
|
5
|
+
import { UserMatrixSqliteSyncService } from '../../matrix/checkpointer/user-matrix-sqlite-sync-service.service.js';
|
|
6
|
+
import { BatchInvoker } from './batch-invoker.js';
|
|
7
|
+
import { type ListMessagesDto } from './dto/list-messages.dto.js';
|
|
8
|
+
import { type SendMessagePayload, type SendMessageResponse } from './dto/send-message.dto.js';
|
|
9
|
+
import { FileProcessingService } from './file-processing.service.js';
|
|
10
|
+
import { MatrixListenerBridge } from './matrix-listener-bridge.js';
|
|
11
|
+
import { PostMessageSyncer } from './post-message-syncer.js';
|
|
12
|
+
import { RequestPreparer } from './request-preparer.js';
|
|
13
|
+
import { SseStreamRunner } from './sse-stream-runner.js';
|
|
14
|
+
/**
|
|
15
|
+
* Express-side auth shape (as set by `AuthHeaderMiddleware`). Mirrors the
|
|
16
|
+
* declaration-merged `Request.authData.ucanDelegation` so the controller
|
|
17
|
+
* can hand it down without translating UCAN's native `can`/`with` naming
|
|
18
|
+
* into the plugin-API's `action`/`resource` naming at the boundary.
|
|
19
|
+
* Translation lives in `AgentBuilder` where the value is actually consumed
|
|
20
|
+
* as a `UcanDelegation`.
|
|
21
|
+
*/
|
|
22
|
+
export interface AuthUcanDelegation {
|
|
23
|
+
raw: string;
|
|
24
|
+
issuer: string;
|
|
25
|
+
audience: string;
|
|
26
|
+
capabilities: unknown[];
|
|
27
|
+
expiration?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface SendMessageRequest extends SendMessagePayload {
|
|
30
|
+
res?: Response;
|
|
31
|
+
req?: Request;
|
|
32
|
+
clientType?: 'matrix' | 'slack' | 'portal';
|
|
33
|
+
msgFromMatrixRoom?: boolean;
|
|
34
|
+
overrideLangchainThreadId?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Authenticated UCAN delegation from `req.authData.ucanDelegation`.
|
|
37
|
+
* Threaded through to `requestCtx.user.ucanDelegation` so plugins can
|
|
38
|
+
* mint downstream invocations from the raw header. Absent on the Matrix
|
|
39
|
+
* listener path — the bot acts as the oracle, not as a user.
|
|
40
|
+
*/
|
|
41
|
+
ucanDelegation?: AuthUcanDelegation;
|
|
42
|
+
/** Sender's full Matrix user id (e.g. `@alice:matrix.example`). */
|
|
43
|
+
senderMatrixUserId?: string;
|
|
44
|
+
/** Matrix event id of the latest text event the user sent. */
|
|
45
|
+
matrixEventId?: string;
|
|
46
|
+
/** Raw `m.mentions` payload from the Matrix event, used by group-chat gating. */
|
|
47
|
+
matrixMentions?: {
|
|
48
|
+
user_ids?: string[];
|
|
49
|
+
};
|
|
50
|
+
/** Raw `m.relates_to` payload, used to detect reply-to-bot. */
|
|
51
|
+
matrixRelatesTo?: {
|
|
52
|
+
'm.in_reply_to'?: {
|
|
53
|
+
event_id: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
/** Room id (mirrors the bridge call) — used for display-name + roomInfo lookups. */
|
|
57
|
+
matrixRoomId?: string;
|
|
58
|
+
}
|
|
59
|
+
type SendMessageReply = SendMessageResponse;
|
|
60
|
+
/**
|
|
61
|
+
* Public entry point for the chat HTTP surface. Owns:
|
|
62
|
+
*
|
|
63
|
+
* - the AbortController registry (one in-flight stream per session)
|
|
64
|
+
* - the cross-cutting "Matrix replay of the user's text" fire-and-forget
|
|
65
|
+
* - delegation to `RequestPreparer` → (`SseStreamRunner` |
|
|
66
|
+
* `BatchInvoker`) → `PostMessageSyncer`
|
|
67
|
+
*
|
|
68
|
+
* The Matrix listener bridge calls back into `sendMessage({ clientType:
|
|
69
|
+
* 'matrix' })` for the matrix-room ingress path. That keeps the chat code
|
|
70
|
+
* path linear: every request, regardless of source, lands here.
|
|
71
|
+
*/
|
|
72
|
+
export declare class MessagesService implements OnModuleInit {
|
|
73
|
+
private readonly preparer;
|
|
74
|
+
private readonly streamer;
|
|
75
|
+
private readonly batchInvoker;
|
|
76
|
+
private readonly fileProcessing;
|
|
77
|
+
private readonly checkpointSync;
|
|
78
|
+
private readonly postSync;
|
|
79
|
+
private readonly matrixBridge;
|
|
80
|
+
private readonly sessions;
|
|
81
|
+
private readonly config;
|
|
82
|
+
private readonly logger;
|
|
83
|
+
private readonly abortControllers;
|
|
84
|
+
constructor(preparer: RequestPreparer, streamer: SseStreamRunner, batchInvoker: BatchInvoker, fileProcessing: FileProcessingService, checkpointSync: UserMatrixSqliteSyncService, postSync: PostMessageSyncer, matrixBridge: MatrixListenerBridge, sessions: SessionManagerService, config: ConfigService);
|
|
85
|
+
onModuleInit(): void;
|
|
86
|
+
abortRequest(sessionId: string): boolean;
|
|
87
|
+
listMessages(params: ListMessagesDto & {
|
|
88
|
+
did: string;
|
|
89
|
+
homeServer?: string;
|
|
90
|
+
}): Promise<ListOracleMessagesResponse>;
|
|
91
|
+
sendMessage(params: SendMessageRequest): Promise<SendMessageReply | undefined>;
|
|
92
|
+
private assembleInput;
|
|
93
|
+
/**
|
|
94
|
+
* Build the `content` and `additional_kwargs` for the HumanMessage that
|
|
95
|
+
* lands in graph state. For Matrix-originated turns this is where we:
|
|
96
|
+
* - resolve the speaker's display name (via the existing 30-min cache
|
|
97
|
+
* on `MatrixManager.getCachedDisplayName`)
|
|
98
|
+
* - decide whether the room is a group (memberCount > 2) and prefix
|
|
99
|
+
* the content with `[DisplayName]: ` if so — so the agent reads who
|
|
100
|
+
* is speaking without any middleware mutating state mid-graph
|
|
101
|
+
* - stash speaker + threading metadata + raw `m.mentions` /
|
|
102
|
+
* `m.relates_to` on `additional_kwargs` for downstream consumers
|
|
103
|
+
* (the group-chat gating middleware reads them)
|
|
104
|
+
*
|
|
105
|
+
* Non-Matrix turns (portal, slack) keep the prior behaviour: just
|
|
106
|
+
* `msgFromMatrixRoom` + `timestamp`.
|
|
107
|
+
*/
|
|
108
|
+
private buildHumanMessageParts;
|
|
109
|
+
private firePostSync;
|
|
110
|
+
}
|
|
111
|
+
export {};
|
|
112
|
+
//# sourceMappingURL=messages.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.service.d.ts","sourceRoot":"","sources":["../../../src/modules/messages/messages.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EAErB,KAAK,0BAA0B,EAChC,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,sEAAsE,CAAC;AACnH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,OAAO,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC3C,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,kBAAkB,CAAC;IAEpC,mEAAmE;IACnE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iFAAiF;IACjF,cAAc,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACzC,+DAA+D;IAC/D,eAAe,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IAC7D,oFAAoF;IACpF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,KAAK,gBAAgB,GAAG,mBAAmB,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,qBACa,eAAgB,YAAW,YAAY;IAKhD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAZzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAC3D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAsC;gBAGpD,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,eAAe,EACzB,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,qBAAqB,EACrC,cAAc,EAAE,2BAA2B,EAC3C,QAAQ,EAAE,iBAAiB,EAC3B,YAAY,EAAE,oBAAoB,EAClC,QAAQ,EAAE,qBAAqB,EAC/B,MAAM,EAAE,aAAa;IAGxC,YAAY,IAAI,IAAI;IAoBpB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAQlC,YAAY,CAChB,MAAM,EAAE,eAAe,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAC7D,OAAO,CAAC,0BAA0B,CAAC;IAqBhC,WAAW,CACf,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;YAwE1B,aAAa;IAuD3B;;;;;;;;;;;;;;OAcG;YACW,sBAAsB;IA4DpC,OAAO,CAAC,YAAY;CAoBrB"}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var MessagesService_1;
|
|
11
|
+
import { SessionManagerService, transformGraphStateMessageToListMessageResponse, } from '@ixo/common';
|
|
12
|
+
import { MatrixManager } from '@ixo/matrix';
|
|
13
|
+
import { SqliteSaver } from '@ixo/sqlite-saver';
|
|
14
|
+
import { Injectable, Logger } from '@nestjs/common';
|
|
15
|
+
import { ConfigService } from '@nestjs/config';
|
|
16
|
+
import { AIMessage, HumanMessage } from 'langchain';
|
|
17
|
+
import { UserMatrixSqliteSyncService } from '../../matrix/checkpointer/user-matrix-sqlite-sync-service.service.js';
|
|
18
|
+
import { BatchInvoker } from './batch-invoker.js';
|
|
19
|
+
import { FileProcessingService } from './file-processing.service.js';
|
|
20
|
+
import { MatrixListenerBridge } from './matrix-listener-bridge.js';
|
|
21
|
+
import { PostMessageSyncer } from './post-message-syncer.js';
|
|
22
|
+
import { RequestPreparer } from './request-preparer.js';
|
|
23
|
+
import { SseStreamRunner } from './sse-stream-runner.js';
|
|
24
|
+
/**
|
|
25
|
+
* Public entry point for the chat HTTP surface. Owns:
|
|
26
|
+
*
|
|
27
|
+
* - the AbortController registry (one in-flight stream per session)
|
|
28
|
+
* - the cross-cutting "Matrix replay of the user's text" fire-and-forget
|
|
29
|
+
* - delegation to `RequestPreparer` → (`SseStreamRunner` |
|
|
30
|
+
* `BatchInvoker`) → `PostMessageSyncer`
|
|
31
|
+
*
|
|
32
|
+
* The Matrix listener bridge calls back into `sendMessage({ clientType:
|
|
33
|
+
* 'matrix' })` for the matrix-room ingress path. That keeps the chat code
|
|
34
|
+
* path linear: every request, regardless of source, lands here.
|
|
35
|
+
*/
|
|
36
|
+
let MessagesService = MessagesService_1 = class MessagesService {
|
|
37
|
+
preparer;
|
|
38
|
+
streamer;
|
|
39
|
+
batchInvoker;
|
|
40
|
+
fileProcessing;
|
|
41
|
+
checkpointSync;
|
|
42
|
+
postSync;
|
|
43
|
+
matrixBridge;
|
|
44
|
+
sessions;
|
|
45
|
+
config;
|
|
46
|
+
logger = new Logger(MessagesService_1.name);
|
|
47
|
+
abortControllers = new Map();
|
|
48
|
+
constructor(preparer, streamer, batchInvoker, fileProcessing, checkpointSync, postSync, matrixBridge, sessions, config) {
|
|
49
|
+
this.preparer = preparer;
|
|
50
|
+
this.streamer = streamer;
|
|
51
|
+
this.batchInvoker = batchInvoker;
|
|
52
|
+
this.fileProcessing = fileProcessing;
|
|
53
|
+
this.checkpointSync = checkpointSync;
|
|
54
|
+
this.postSync = postSync;
|
|
55
|
+
this.matrixBridge = matrixBridge;
|
|
56
|
+
this.sessions = sessions;
|
|
57
|
+
this.config = config;
|
|
58
|
+
}
|
|
59
|
+
onModuleInit() {
|
|
60
|
+
this.matrixBridge.setDeliverHandler((msg) => this.sendMessage({
|
|
61
|
+
clientType: 'matrix',
|
|
62
|
+
message: msg.message,
|
|
63
|
+
did: msg.did,
|
|
64
|
+
sessionId: msg.threadId,
|
|
65
|
+
overrideLangchainThreadId: msg.langchainThreadId,
|
|
66
|
+
homeServer: msg.homeServer,
|
|
67
|
+
msgFromMatrixRoom: true,
|
|
68
|
+
senderMatrixUserId: msg.senderMatrixUserId,
|
|
69
|
+
matrixEventId: msg.eventId,
|
|
70
|
+
matrixMentions: msg.mentions,
|
|
71
|
+
matrixRelatesTo: msg.relatesTo,
|
|
72
|
+
matrixRoomId: msg.roomId,
|
|
73
|
+
...(msg.attachments && { attachments: msg.attachments }),
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
abortRequest(sessionId) {
|
|
77
|
+
const controller = this.abortControllers.get(sessionId);
|
|
78
|
+
if (!controller)
|
|
79
|
+
return false;
|
|
80
|
+
controller.abort();
|
|
81
|
+
this.abortControllers.delete(sessionId);
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
async listMessages(params) {
|
|
85
|
+
const { did, sessionId } = params;
|
|
86
|
+
this.preparer.validateSessionId(sessionId, did);
|
|
87
|
+
this.checkpointSync.markUserActive(did);
|
|
88
|
+
try {
|
|
89
|
+
const db = await this.checkpointSync.getUserDatabase(did);
|
|
90
|
+
const saver = SqliteSaver.fromDatabase(db);
|
|
91
|
+
const tuple = await saver.getTuple({
|
|
92
|
+
configurable: { thread_id: sessionId },
|
|
93
|
+
});
|
|
94
|
+
const messages = tuple?.checkpoint?.channel_values?.messages ?? [];
|
|
95
|
+
return transformGraphStateMessageToListMessageResponse(messages);
|
|
96
|
+
}
|
|
97
|
+
finally {
|
|
98
|
+
this.checkpointSync.markUserInactive(did);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async sendMessage(params) {
|
|
102
|
+
this.checkpointSync.markUserActive(params.did);
|
|
103
|
+
try {
|
|
104
|
+
const prepared = await this.preparer.prepare(params);
|
|
105
|
+
const inputMessages = await this.assembleInput(params, prepared);
|
|
106
|
+
const msgFromMatrixRoom = params.msgFromMatrixRoom ?? false;
|
|
107
|
+
if (!msgFromMatrixRoom) {
|
|
108
|
+
this.sessions.matrixManger
|
|
109
|
+
.sendMessage({
|
|
110
|
+
message: params.message,
|
|
111
|
+
roomId: prepared.roomId,
|
|
112
|
+
threadId: prepared.sessionId,
|
|
113
|
+
isOracleAdmin: false,
|
|
114
|
+
})
|
|
115
|
+
.catch((err) => this.logger.error('Matrix replay (user message) failed', err));
|
|
116
|
+
}
|
|
117
|
+
if (params.stream && params.res) {
|
|
118
|
+
await this.streamer.run({
|
|
119
|
+
payload: { ...params },
|
|
120
|
+
prepared,
|
|
121
|
+
inputMessages,
|
|
122
|
+
res: params.res,
|
|
123
|
+
abortControllers: this.abortControllers,
|
|
124
|
+
onComplete: (assistantText) => {
|
|
125
|
+
if (!msgFromMatrixRoom && assistantText) {
|
|
126
|
+
this.sessions.matrixManger
|
|
127
|
+
.sendMessage({
|
|
128
|
+
message: assistantText,
|
|
129
|
+
roomId: prepared.roomId,
|
|
130
|
+
threadId: prepared.sessionId,
|
|
131
|
+
isOracleAdmin: true,
|
|
132
|
+
})
|
|
133
|
+
.catch((err) => this.logger.error('Matrix replay (AI response) failed', err));
|
|
134
|
+
}
|
|
135
|
+
this.firePostSync(params, prepared);
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
const result = await this.batchInvoker.invoke({
|
|
141
|
+
payload: { ...params },
|
|
142
|
+
prepared,
|
|
143
|
+
inputMessages,
|
|
144
|
+
});
|
|
145
|
+
if (!msgFromMatrixRoom) {
|
|
146
|
+
this.sessions.matrixManger
|
|
147
|
+
.sendMessage({
|
|
148
|
+
message: result.message.content,
|
|
149
|
+
roomId: prepared.roomId,
|
|
150
|
+
threadId: prepared.sessionId,
|
|
151
|
+
isOracleAdmin: true,
|
|
152
|
+
})
|
|
153
|
+
.catch((err) => this.logger.error('Matrix replay (AI response) failed', err));
|
|
154
|
+
}
|
|
155
|
+
this.firePostSync(params, prepared);
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
158
|
+
finally {
|
|
159
|
+
this.checkpointSync.markUserInactive(params.did);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async assembleInput(params, prepared) {
|
|
163
|
+
const msgFromMatrixRoom = params.msgFromMatrixRoom ?? false;
|
|
164
|
+
const timestamp = new Date().toISOString();
|
|
165
|
+
const { content, additionalKwargs } = await this.buildHumanMessageParts(params, prepared, msgFromMatrixRoom, timestamp);
|
|
166
|
+
const out = [
|
|
167
|
+
new HumanMessage({
|
|
168
|
+
content,
|
|
169
|
+
additional_kwargs: additionalKwargs,
|
|
170
|
+
}),
|
|
171
|
+
];
|
|
172
|
+
if (!params.attachments?.length)
|
|
173
|
+
return out;
|
|
174
|
+
this.logger.log(`sendMessage: ${params.attachments.length} attachment(s) for session ${prepared.sessionId}`);
|
|
175
|
+
const { texts, metadata } = await this.fileProcessing.processAttachments(params.attachments, prepared.roomId, params.did);
|
|
176
|
+
texts.forEach((text, i) => {
|
|
177
|
+
const meta = metadata[i];
|
|
178
|
+
if (!meta)
|
|
179
|
+
return;
|
|
180
|
+
const sourceRef = meta.eventId
|
|
181
|
+
? `[source: eventId="${meta.eventId}"]`
|
|
182
|
+
: meta.mxcUri
|
|
183
|
+
? `[source: url="${meta.mxcUri}"]`
|
|
184
|
+
: '';
|
|
185
|
+
const content = sourceRef ? `${sourceRef}\n${text}` : text;
|
|
186
|
+
out.push(new AIMessage({
|
|
187
|
+
content,
|
|
188
|
+
additional_kwargs: {
|
|
189
|
+
msgFromMatrixRoom,
|
|
190
|
+
timestamp: new Date().toISOString(),
|
|
191
|
+
attachment: meta,
|
|
192
|
+
},
|
|
193
|
+
}));
|
|
194
|
+
});
|
|
195
|
+
return out;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Build the `content` and `additional_kwargs` for the HumanMessage that
|
|
199
|
+
* lands in graph state. For Matrix-originated turns this is where we:
|
|
200
|
+
* - resolve the speaker's display name (via the existing 30-min cache
|
|
201
|
+
* on `MatrixManager.getCachedDisplayName`)
|
|
202
|
+
* - decide whether the room is a group (memberCount > 2) and prefix
|
|
203
|
+
* the content with `[DisplayName]: ` if so — so the agent reads who
|
|
204
|
+
* is speaking without any middleware mutating state mid-graph
|
|
205
|
+
* - stash speaker + threading metadata + raw `m.mentions` /
|
|
206
|
+
* `m.relates_to` on `additional_kwargs` for downstream consumers
|
|
207
|
+
* (the group-chat gating middleware reads them)
|
|
208
|
+
*
|
|
209
|
+
* Non-Matrix turns (portal, slack) keep the prior behaviour: just
|
|
210
|
+
* `msgFromMatrixRoom` + `timestamp`.
|
|
211
|
+
*/
|
|
212
|
+
async buildHumanMessageParts(params, prepared, msgFromMatrixRoom, timestamp) {
|
|
213
|
+
const baseKwargs = {
|
|
214
|
+
msgFromMatrixRoom,
|
|
215
|
+
timestamp,
|
|
216
|
+
};
|
|
217
|
+
if (!msgFromMatrixRoom || !params.senderMatrixUserId) {
|
|
218
|
+
return { content: params.message, additionalKwargs: baseKwargs };
|
|
219
|
+
}
|
|
220
|
+
const roomId = params.matrixRoomId ?? prepared.roomId;
|
|
221
|
+
const matrixManager = MatrixManager.getInstance();
|
|
222
|
+
const [displayName, roomInfo] = await Promise.all([
|
|
223
|
+
matrixManager
|
|
224
|
+
.getCachedDisplayName(params.senderMatrixUserId, roomId)
|
|
225
|
+
.catch((err) => {
|
|
226
|
+
this.logger.warn(`getCachedDisplayName failed for ${params.senderMatrixUserId}: ${err instanceof Error ? err.message : String(err)}`);
|
|
227
|
+
return params.senderMatrixUserId;
|
|
228
|
+
}),
|
|
229
|
+
matrixManager.getRoomInfo(roomId).catch((err) => {
|
|
230
|
+
this.logger.warn(`getRoomInfo failed for ${roomId}: ${err instanceof Error ? err.message : String(err)}`);
|
|
231
|
+
return undefined;
|
|
232
|
+
}),
|
|
233
|
+
]);
|
|
234
|
+
const isGroupRoom = !!roomInfo && !roomInfo.isDirect && roomInfo.memberCount > 2;
|
|
235
|
+
const prefix = `[${displayName}]: `;
|
|
236
|
+
const content = isGroupRoom && !params.message.startsWith(prefix)
|
|
237
|
+
? `${prefix}${params.message}`
|
|
238
|
+
: params.message;
|
|
239
|
+
const additionalKwargs = {
|
|
240
|
+
...baseKwargs,
|
|
241
|
+
senderDid: params.did,
|
|
242
|
+
senderMatrixUserId: params.senderMatrixUserId,
|
|
243
|
+
senderDisplayName: displayName,
|
|
244
|
+
threadId: prepared.sessionId,
|
|
245
|
+
};
|
|
246
|
+
if (params.matrixEventId)
|
|
247
|
+
additionalKwargs.eventId = params.matrixEventId;
|
|
248
|
+
if (params.matrixMentions)
|
|
249
|
+
additionalKwargs['m.mentions'] = params.matrixMentions;
|
|
250
|
+
if (params.matrixRelatesTo)
|
|
251
|
+
additionalKwargs['m.relates_to'] = params.matrixRelatesTo;
|
|
252
|
+
return { content, additionalKwargs };
|
|
253
|
+
}
|
|
254
|
+
firePostSync(params, prepared) {
|
|
255
|
+
// Keep the user active for the duration of the fire-and-forget sync —
|
|
256
|
+
// the matching markUserInactive lives in PostMessageSyncer.
|
|
257
|
+
this.checkpointSync.markUserActive(params.did);
|
|
258
|
+
this.postSync.run({
|
|
259
|
+
did: params.did,
|
|
260
|
+
sessionId: prepared.sessionId,
|
|
261
|
+
langchainThreadId: prepared.langchainThreadId,
|
|
262
|
+
roomId: prepared.roomId,
|
|
263
|
+
targetSession: prepared.targetSession,
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
MessagesService = MessagesService_1 = __decorate([
|
|
268
|
+
Injectable(),
|
|
269
|
+
__metadata("design:paramtypes", [RequestPreparer,
|
|
270
|
+
SseStreamRunner,
|
|
271
|
+
BatchInvoker,
|
|
272
|
+
FileProcessingService,
|
|
273
|
+
UserMatrixSqliteSyncService,
|
|
274
|
+
PostMessageSyncer,
|
|
275
|
+
MatrixListenerBridge,
|
|
276
|
+
SessionManagerService,
|
|
277
|
+
ConfigService])
|
|
278
|
+
], MessagesService);
|
|
279
|
+
export { MessagesService };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { MainAgentHooks } from '../../graph/main-agent-types.js';
|
|
2
|
+
import type { MergedConfig, OracleIdentity } from '../../plugin-api/types.js';
|
|
3
|
+
import type { ConfigSchemaRegistry, ManifestRegistry, MiddlewareRegistry, SharedStateRegistry, SubAgentRegistry, ToolRegistry } from '../../registries/index.js';
|
|
4
|
+
import type { AmbientServices } from '../../runtime-context/ambient.js';
|
|
5
|
+
/** Snapshot of everything `createMainAgent` needs at request time. */
|
|
6
|
+
export interface OracleRuntimeBundle {
|
|
7
|
+
ambient: AmbientServices;
|
|
8
|
+
registries: {
|
|
9
|
+
tools: ToolRegistry;
|
|
10
|
+
subAgents: SubAgentRegistry;
|
|
11
|
+
middlewares: MiddlewareRegistry;
|
|
12
|
+
manifests: ManifestRegistry;
|
|
13
|
+
configSchema: ConfigSchemaRegistry;
|
|
14
|
+
sharedState: SharedStateRegistry;
|
|
15
|
+
};
|
|
16
|
+
identity: OracleIdentity;
|
|
17
|
+
config: MergedConfig;
|
|
18
|
+
availablePlugins: ReadonlySet<string>;
|
|
19
|
+
hooks?: MainAgentHooks;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Empty-at-construction Nest provider populated by `createOracleApp` once
|
|
23
|
+
* Nest's DI container is up and the ambient services are wired. Downstream
|
|
24
|
+
* services (MessagesService, etc.) inject the holder and read the bundle
|
|
25
|
+
* per request.
|
|
26
|
+
*
|
|
27
|
+
* The holder pattern exists because `AmbientServices` depends on Nest's DI
|
|
28
|
+
* (UcanService, SecretsService) but `RuntimeAppModule` has to register
|
|
29
|
+
* MessagesService BEFORE those services exist. The holder breaks the
|
|
30
|
+
* chicken-and-egg.
|
|
31
|
+
*/
|
|
32
|
+
export declare class OracleRuntimeBundleHolder {
|
|
33
|
+
private bundle;
|
|
34
|
+
populate(bundle: OracleRuntimeBundle): void;
|
|
35
|
+
get(): OracleRuntimeBundle;
|
|
36
|
+
isReady(): boolean;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=oracle-runtime-bundle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oracle-runtime-bundle.d.ts","sourceRoot":"","sources":["../../../src/modules/messages/oracle-runtime-bundle.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAExE,sEAAsE;AACtE,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE;QACV,KAAK,EAAE,YAAY,CAAC;QACpB,SAAS,EAAE,gBAAgB,CAAC;QAC5B,WAAW,EAAE,kBAAkB,CAAC;QAChC,SAAS,EAAE,gBAAgB,CAAC;QAC5B,YAAY,EAAE,oBAAoB,CAAC;QACnC,WAAW,EAAE,mBAAmB,CAAC;KAClC,CAAC;IACF,QAAQ,EAAE,cAAc,CAAC;IACzB,MAAM,EAAE,YAAY,CAAC;IACrB,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,qBACa,yBAAyB;IACpC,OAAO,CAAC,MAAM,CAAoC;IAElD,QAAQ,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI;IAS3C,GAAG,IAAI,mBAAmB;IAS1B,OAAO,IAAI,OAAO;CAGnB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Injectable } from '@nestjs/common';
|
|
8
|
+
/**
|
|
9
|
+
* Empty-at-construction Nest provider populated by `createOracleApp` once
|
|
10
|
+
* Nest's DI container is up and the ambient services are wired. Downstream
|
|
11
|
+
* services (MessagesService, etc.) inject the holder and read the bundle
|
|
12
|
+
* per request.
|
|
13
|
+
*
|
|
14
|
+
* The holder pattern exists because `AmbientServices` depends on Nest's DI
|
|
15
|
+
* (UcanService, SecretsService) but `RuntimeAppModule` has to register
|
|
16
|
+
* MessagesService BEFORE those services exist. The holder breaks the
|
|
17
|
+
* chicken-and-egg.
|
|
18
|
+
*/
|
|
19
|
+
let OracleRuntimeBundleHolder = class OracleRuntimeBundleHolder {
|
|
20
|
+
bundle = null;
|
|
21
|
+
populate(bundle) {
|
|
22
|
+
if (this.bundle !== null) {
|
|
23
|
+
throw new Error('OracleRuntimeBundleHolder.populate called twice — bundle is single-shot.');
|
|
24
|
+
}
|
|
25
|
+
this.bundle = bundle;
|
|
26
|
+
}
|
|
27
|
+
get() {
|
|
28
|
+
if (this.bundle === null) {
|
|
29
|
+
throw new Error('OracleRuntimeBundleHolder.get called before populate — createOracleApp must run first.');
|
|
30
|
+
}
|
|
31
|
+
return this.bundle;
|
|
32
|
+
}
|
|
33
|
+
isReady() {
|
|
34
|
+
return this.bundle !== null;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
OracleRuntimeBundleHolder = __decorate([
|
|
38
|
+
Injectable()
|
|
39
|
+
], OracleRuntimeBundleHolder);
|
|
40
|
+
export { OracleRuntimeBundleHolder };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SessionManagerService, type ChatSession } from '@ixo/common';
|
|
2
|
+
import { ConfigService } from '@nestjs/config';
|
|
3
|
+
import { UserMatrixSqliteSyncService } from '../../matrix/checkpointer/user-matrix-sqlite-sync-service.service.js';
|
|
4
|
+
export interface PostSyncInput {
|
|
5
|
+
did: string;
|
|
6
|
+
sessionId: string;
|
|
7
|
+
langchainThreadId: string;
|
|
8
|
+
roomId: string;
|
|
9
|
+
targetSession: ChatSession;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Fire-and-forget session sync that runs after each chat turn. Reads the
|
|
13
|
+
* just-written checkpoint via the cached SQLite connection (no Matrix
|
|
14
|
+
* re-sync — the connection is already warm from `RequestPreparer`) and
|
|
15
|
+
* mirrors the message list + lastProcessedCount into
|
|
16
|
+
* `SessionManagerService`.
|
|
17
|
+
*
|
|
18
|
+
* Ref-counted DB activity is handled by the caller via
|
|
19
|
+
* `markUserActive` / `markUserInactive` — this service just performs the
|
|
20
|
+
* read + write without juggling the counter.
|
|
21
|
+
*/
|
|
22
|
+
export declare class PostMessageSyncer {
|
|
23
|
+
private readonly checkpointSync;
|
|
24
|
+
private readonly sessions;
|
|
25
|
+
private readonly config;
|
|
26
|
+
private readonly logger;
|
|
27
|
+
constructor(checkpointSync: UserMatrixSqliteSyncService, sessions: SessionManagerService, config: ConfigService);
|
|
28
|
+
run(input: PostSyncInput): void;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=post-message-syncer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"post-message-syncer.d.ts","sourceRoot":"","sources":["../../../src/modules/messages/post-message-syncer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAErB,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,sEAAsE,CAAC;AAEnH,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,WAAW,CAAC;CAC5B;AAED;;;;;;;;;;GAUG;AACH,qBACa,iBAAiB;IAI1B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IALzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsC;gBAG1C,cAAc,EAAE,2BAA2B,EAC3C,QAAQ,EAAE,qBAAqB,EAC/B,MAAM,EAAE,aAAa;IAGxC,GAAG,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;CAgChC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var PostMessageSyncer_1;
|
|
11
|
+
import { SessionManagerService, transformGraphStateMessageToListMessageResponse, } from '@ixo/common';
|
|
12
|
+
import { SqliteSaver } from '@ixo/sqlite-saver';
|
|
13
|
+
import { Injectable, Logger } from '@nestjs/common';
|
|
14
|
+
import { ConfigService } from '@nestjs/config';
|
|
15
|
+
import { UserMatrixSqliteSyncService } from '../../matrix/checkpointer/user-matrix-sqlite-sync-service.service.js';
|
|
16
|
+
/**
|
|
17
|
+
* Fire-and-forget session sync that runs after each chat turn. Reads the
|
|
18
|
+
* just-written checkpoint via the cached SQLite connection (no Matrix
|
|
19
|
+
* re-sync — the connection is already warm from `RequestPreparer`) and
|
|
20
|
+
* mirrors the message list + lastProcessedCount into
|
|
21
|
+
* `SessionManagerService`.
|
|
22
|
+
*
|
|
23
|
+
* Ref-counted DB activity is handled by the caller via
|
|
24
|
+
* `markUserActive` / `markUserInactive` — this service just performs the
|
|
25
|
+
* read + write without juggling the counter.
|
|
26
|
+
*/
|
|
27
|
+
let PostMessageSyncer = PostMessageSyncer_1 = class PostMessageSyncer {
|
|
28
|
+
checkpointSync;
|
|
29
|
+
sessions;
|
|
30
|
+
config;
|
|
31
|
+
logger = new Logger(PostMessageSyncer_1.name);
|
|
32
|
+
constructor(checkpointSync, sessions, config) {
|
|
33
|
+
this.checkpointSync = checkpointSync;
|
|
34
|
+
this.sessions = sessions;
|
|
35
|
+
this.config = config;
|
|
36
|
+
}
|
|
37
|
+
run(input) {
|
|
38
|
+
void Promise.resolve().then(async () => {
|
|
39
|
+
try {
|
|
40
|
+
const db = await this.checkpointSync.getUserDatabaseNoSync(input.did);
|
|
41
|
+
const saver = SqliteSaver.fromDatabase(db);
|
|
42
|
+
const tuple = await saver.getTuple({
|
|
43
|
+
configurable: { thread_id: input.langchainThreadId },
|
|
44
|
+
});
|
|
45
|
+
const messages = tuple?.checkpoint?.channel_values?.messages ?? [];
|
|
46
|
+
const transformed = transformGraphStateMessageToListMessageResponse(messages);
|
|
47
|
+
await this.sessions.syncSessionSet({
|
|
48
|
+
sessionId: input.sessionId,
|
|
49
|
+
oracleName: this.config.getOrThrow('ORACLE_NAME'),
|
|
50
|
+
did: input.did,
|
|
51
|
+
messages: transformed.messages.map((m) => m.content.toString()),
|
|
52
|
+
oracleDid: this.config.getOrThrow('ORACLE_DID'),
|
|
53
|
+
oracleEntityDid: this.config.getOrThrow('ORACLE_ENTITY_DID'),
|
|
54
|
+
lastProcessedCount: input.targetSession?.lastProcessedCount ?? 0,
|
|
55
|
+
roomId: input.roomId,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
this.logger.error('Failed to perform post-message sync', error);
|
|
60
|
+
}
|
|
61
|
+
finally {
|
|
62
|
+
this.checkpointSync.markUserInactive(input.did);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
PostMessageSyncer = PostMessageSyncer_1 = __decorate([
|
|
68
|
+
Injectable(),
|
|
69
|
+
__metadata("design:paramtypes", [UserMatrixSqliteSyncService,
|
|
70
|
+
SessionManagerService,
|
|
71
|
+
ConfigService])
|
|
72
|
+
], PostMessageSyncer);
|
|
73
|
+
export { PostMessageSyncer };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { SessionManagerService, type ChatSession } from '@ixo/common';
|
|
2
|
+
import { ConfigService } from '@nestjs/config';
|
|
3
|
+
import type { Request } from 'express';
|
|
4
|
+
import { UserMatrixSqliteSyncService } from '../../matrix/checkpointer/user-matrix-sqlite-sync-service.service.js';
|
|
5
|
+
import { type SendMessagePayload } from './dto/send-message.dto.js';
|
|
6
|
+
import { HomeServerCache } from './homeserver-cache.js';
|
|
7
|
+
export interface RuntimeRequestConfig {
|
|
8
|
+
configurable: {
|
|
9
|
+
thread_id: string;
|
|
10
|
+
requestId: string;
|
|
11
|
+
sessionId: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface PreparedRequest {
|
|
15
|
+
sessionId: string;
|
|
16
|
+
langchainThreadId: string;
|
|
17
|
+
roomId: string;
|
|
18
|
+
homeServerName: string;
|
|
19
|
+
requestId: string;
|
|
20
|
+
runnableConfig: RuntimeRequestConfig;
|
|
21
|
+
targetSession: ChatSession;
|
|
22
|
+
timezone?: string;
|
|
23
|
+
currentTime?: string;
|
|
24
|
+
}
|
|
25
|
+
export type PrepareInput = SendMessagePayload & {
|
|
26
|
+
req?: Request;
|
|
27
|
+
overrideLangchainThreadId?: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Resolves everything the agent build needs from the incoming request:
|
|
31
|
+
*
|
|
32
|
+
* - session lookup (parallel with the Matrix → SQLite sync triggered the
|
|
33
|
+
* first time we see this user this process)
|
|
34
|
+
* - room id resolution (uses the cached value when present, otherwise asks
|
|
35
|
+
* Matrix)
|
|
36
|
+
* - per-DID home-server cache
|
|
37
|
+
* - timezone / current-time extraction
|
|
38
|
+
* - the `runnableConfig` LangGraph needs for checkpointing
|
|
39
|
+
*
|
|
40
|
+
* Construction is hot-path code — every chat request runs this once.
|
|
41
|
+
*/
|
|
42
|
+
export declare class RequestPreparer {
|
|
43
|
+
private readonly sessions;
|
|
44
|
+
private readonly checkpointSync;
|
|
45
|
+
private readonly homeServerCache;
|
|
46
|
+
private readonly config;
|
|
47
|
+
constructor(sessions: SessionManagerService, checkpointSync: UserMatrixSqliteSyncService, homeServerCache: HomeServerCache, config: ConfigService);
|
|
48
|
+
prepare(payload: PrepareInput): Promise<PreparedRequest>;
|
|
49
|
+
validateSessionId(sessionId: string | undefined, did: string | undefined): void;
|
|
50
|
+
private resolveTimezone;
|
|
51
|
+
private formatTimeInTimezone;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=request-preparer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-preparer.d.ts","sourceRoot":"","sources":["../../../src/modules/messages/request-preparer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAMtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,2BAA2B,EAAE,MAAM,sEAAsE,CAAC;AACnH,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE;QACZ,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,oBAAoB,CAAC;IACrC,aAAa,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,YAAY,GAAG,kBAAkB,GAAG;IAC9C,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,qBACa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAHN,QAAQ,EAAE,qBAAqB,EAC/B,cAAc,EAAE,2BAA2B,EAC3C,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,aAAa;IAGlC,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC;IAmE9D,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS;IAMxE,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,oBAAoB;CAoB7B"}
|