@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,461 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration test harness — real ambient services + real Nest boot.
|
|
3
|
+
*
|
|
4
|
+
* - `createIntegrationOracle()` boots the full Nest app on an ephemeral
|
|
5
|
+
* port. Tier B tests drive it via `ChatClient`. This is the sibling of
|
|
6
|
+
* `createOracleApp()` — same boot path, same Matrix init, same graceful
|
|
7
|
+
* shutdown. The only differences are: ephemeral port (`port: 0`) and
|
|
8
|
+
* captured lifecycle events. There are intentionally no
|
|
9
|
+
* `skipMatrixInit` / `skipGracefulShutdown` flags — integration tests
|
|
10
|
+
* boot the same stack production does. If Matrix is unreachable, the
|
|
11
|
+
* test fails; that failure IS the signal (spec §6, §11 #10).
|
|
12
|
+
*
|
|
13
|
+
* - `createIntegrationRuntime()` builds a real `RuntimeContext` against
|
|
14
|
+
* real ambient services and lets a test invoke a plugin's tool / sub-
|
|
15
|
+
* agent / middleware directly — no Nest, no HTTP, no model. This is
|
|
16
|
+
* the sibling of `createTestRuntime()`, with `mockLlm`/`mockMatrix`
|
|
17
|
+
* swapped for the production adapters.
|
|
18
|
+
*
|
|
19
|
+
* Both surfaces deliberately reuse `resolvePlugins` / registry population
|
|
20
|
+
* from the unit-test runtime so they validate the same wiring code that
|
|
21
|
+
* production goes through.
|
|
22
|
+
*/
|
|
23
|
+
import { HumanMessage } from '@langchain/core/messages';
|
|
24
|
+
import { createOracleApp, } from '../../bootstrap/create-oracle-app.js';
|
|
25
|
+
import { resolvePlugins, } from '../../bootstrap/plugin-loader.js';
|
|
26
|
+
import { getProviderChatModel } from '../../llm/llm-provider.js';
|
|
27
|
+
import { buildMetaTools } from '../../meta-tools/index.js';
|
|
28
|
+
import { ConfigSchemaRegistry, ManifestRegistry, MiddlewareRegistry, SharedStateRegistry, SubAgentRegistry, ToolRegistry, } from '../../registries/index.js';
|
|
29
|
+
import { mockBlobStore } from '../mocks.js';
|
|
30
|
+
import { buildPluginContext } from '../../runtime-context/build-plugin.js';
|
|
31
|
+
import { buildRuntimeContext, } from '../../runtime-context/build-runtime.js';
|
|
32
|
+
/**
|
|
33
|
+
* Default test model overrides (spec §7 PR-tier).
|
|
34
|
+
*
|
|
35
|
+
* - `main` → `moonshotai/kimi-k2.5` (production *subagent* model — proven
|
|
36
|
+
* to call tools in this codebase; cheaper than the production
|
|
37
|
+
* `main` model `kimi-k2.6`)
|
|
38
|
+
* - `subagent` → `openai/gpt-oss-120b` (cheaper sub-agent for tests)
|
|
39
|
+
*
|
|
40
|
+
* Roles not in this map fall through to `getProviderChatModel(role)` — the
|
|
41
|
+
* production resolver — so `routing`, `guard`, `session-title`, `vision`,
|
|
42
|
+
* `skills`, etc. all behave exactly like production.
|
|
43
|
+
*/
|
|
44
|
+
const TEST_MODEL_OVERRIDES = {
|
|
45
|
+
main: 'moonshotai/kimi-k2.6',
|
|
46
|
+
subagent: 'openai/gpt-oss-120b',
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Build the default `resolveModel` hook installed by `createIntegrationOracle`.
|
|
50
|
+
*
|
|
51
|
+
* Honors the test model overrides above for the roles the spec calls out;
|
|
52
|
+
* everything else falls through to `getProviderChatModel(role, params)`
|
|
53
|
+
* unchanged.
|
|
54
|
+
*/
|
|
55
|
+
function buildTestResolveModel() {
|
|
56
|
+
return (role, params) => {
|
|
57
|
+
const override = TEST_MODEL_OVERRIDES[role];
|
|
58
|
+
if (override === undefined) {
|
|
59
|
+
return getProviderChatModel(role, params);
|
|
60
|
+
}
|
|
61
|
+
return getProviderChatModel(role, { ...(params ?? {}), model: override });
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Minimum config baseline that satisfies `createOracleApp`'s validator. */
|
|
65
|
+
const IDENTITY_DEFAULTS = {
|
|
66
|
+
name: 'IXO Active Agent',
|
|
67
|
+
org: 'IXO',
|
|
68
|
+
description: 'A proactive, agentic personal assistant who autonomously engages, anticipates needs, and takes initiative to help users accomplish goals with minimal explicit direction.',
|
|
69
|
+
prompt: {
|
|
70
|
+
opening: "You are IXO, a proactive, agentic personal assistant. Your mission is to anticipate the user's needs, take initiative to suggest helpful actions or insights, and continuously engage to drive progress even when the user is passive. Don't wait for direct instructions—foresee tasks, flag important developments, and collaborate actively as an empowered agent.",
|
|
71
|
+
capabilities: '- Autonomously identify relevant tasks, reminders, or information the user may need\n- Propose helpful actions or follow-ups without waiting for user prompts\n- Summarize ongoing context and progress\n- Take initiative to drive productivity and keep the user informed',
|
|
72
|
+
communicationStyle: "Friendly, proactive, and collaborative. Confidently suggest next steps and actively check in with the user. Use plain language, but don't hesitate to lead conversations or propose actions.",
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Boot the runtime on an ephemeral port with real ambient services. Wraps
|
|
77
|
+
* `createOracleApp` identically to production — Matrix init still runs in
|
|
78
|
+
* the background, graceful shutdown still registers. The only test-time
|
|
79
|
+
* concessions are the ephemeral `port: 0` default and the captured
|
|
80
|
+
* lifecycle-event buffers exposed on `result.events`.
|
|
81
|
+
*/
|
|
82
|
+
export async function createIntegrationOracle(opts = {}) {
|
|
83
|
+
const events = {
|
|
84
|
+
statusChanges: [],
|
|
85
|
+
errors: [],
|
|
86
|
+
};
|
|
87
|
+
const logger = opts.logger ?? {
|
|
88
|
+
log: () => undefined,
|
|
89
|
+
warn: () => undefined,
|
|
90
|
+
error: () => undefined,
|
|
91
|
+
debug: () => undefined,
|
|
92
|
+
};
|
|
93
|
+
// Default `resolveModel` swaps the production main/subagent models for the
|
|
94
|
+
// PR-tier test pair (spec §7). Caller-supplied hooks merge on top — any
|
|
95
|
+
// key the caller sets wins. `resolveModel` itself is overridable for tests
|
|
96
|
+
// that need a deterministic fake (e.g. trajectory recording).
|
|
97
|
+
const mergedHooks = {
|
|
98
|
+
resolveModel: buildTestResolveModel(),
|
|
99
|
+
...opts.hooks,
|
|
100
|
+
};
|
|
101
|
+
const app = await createOracleApp({
|
|
102
|
+
config: opts.config ?? IDENTITY_DEFAULTS,
|
|
103
|
+
plugins: opts.plugins ?? [],
|
|
104
|
+
bundledPlugins: opts.bundledPlugins,
|
|
105
|
+
features: opts.features,
|
|
106
|
+
nestModules: opts.nestModules,
|
|
107
|
+
authExcludedRoutes: opts.authExcludedRoutes,
|
|
108
|
+
env: opts.env,
|
|
109
|
+
logger,
|
|
110
|
+
hooks: mergedHooks,
|
|
111
|
+
});
|
|
112
|
+
app.onPluginStatusChange((event) => {
|
|
113
|
+
events.statusChanges.push(event);
|
|
114
|
+
});
|
|
115
|
+
app.onError((err, source) => {
|
|
116
|
+
events.errors.push({ err, source });
|
|
117
|
+
});
|
|
118
|
+
const portOpt = opts.port ?? 0;
|
|
119
|
+
await app.listen(portOpt);
|
|
120
|
+
// Resolve the actual bound port. NestJS wraps express; `getHttpServer()`
|
|
121
|
+
// returns the underlying HTTP server, whose `address()` exposes the port
|
|
122
|
+
// when bound. Falls back to `portOpt` for environments where the
|
|
123
|
+
// introspection isn't available (lightweight test runtimes that stub
|
|
124
|
+
// `NestFactory.create`).
|
|
125
|
+
const baseUrl = resolveBaseUrl(app, portOpt);
|
|
126
|
+
let closed = false;
|
|
127
|
+
const close = async () => {
|
|
128
|
+
if (closed)
|
|
129
|
+
return;
|
|
130
|
+
closed = true;
|
|
131
|
+
const nestApp = app.getNestApp();
|
|
132
|
+
if (typeof nestApp.close === 'function') {
|
|
133
|
+
await nestApp.close();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
baseUrl,
|
|
138
|
+
app,
|
|
139
|
+
events,
|
|
140
|
+
status: () => app.plugins.status(),
|
|
141
|
+
close,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/** Resolve the bound `http://host:port` for a started `OracleApp`. */
|
|
145
|
+
function resolveBaseUrl(app, fallbackPort) {
|
|
146
|
+
const nestApp = app.getNestApp();
|
|
147
|
+
const getServer = nestApp.getHttpServer;
|
|
148
|
+
if (typeof getServer === 'function') {
|
|
149
|
+
const server = getServer.call(nestApp);
|
|
150
|
+
if (server && typeof server.address === 'function') {
|
|
151
|
+
const addr = server.address();
|
|
152
|
+
if (addr && typeof addr === 'object' && typeof addr.port === 'number') {
|
|
153
|
+
return `http://127.0.0.1:${addr.port}`;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return `http://127.0.0.1:${fallbackPort}`;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Build a Tier A runtime backed by real ambient services. The harness:
|
|
161
|
+
*
|
|
162
|
+
* 1. Resolves the plugin list via the production loader (same `autoDetect`
|
|
163
|
+
* gates a real boot would run).
|
|
164
|
+
* 2. Populates the six registries.
|
|
165
|
+
* 3. Wires real adapters for `llm`, `secrets`, `matrix`, `ucan`, `emit`
|
|
166
|
+
* (in-memory no-ops for Matrix and secrets — the harness doesn't need
|
|
167
|
+
* a live homeserver to call a plugin tool that doesn't depend on one).
|
|
168
|
+
* 4. Builds a fresh `RuntimeContext` per invocation using the test
|
|
169
|
+
* user/session/delegation.
|
|
170
|
+
*
|
|
171
|
+
* Use this when you want to call a tool *directly* against the real upstream
|
|
172
|
+
* (Memory Engine, Sandbox, Skills, Composio, Firecrawl, …) without a model.
|
|
173
|
+
*/
|
|
174
|
+
export async function createIntegrationRuntime(opts) {
|
|
175
|
+
const logger = opts.logger ?? {
|
|
176
|
+
log: () => undefined,
|
|
177
|
+
warn: () => undefined,
|
|
178
|
+
error: () => undefined,
|
|
179
|
+
debug: () => undefined,
|
|
180
|
+
};
|
|
181
|
+
const config = opts.config ?? process.env;
|
|
182
|
+
// Stringify the config for plugin-loader autoDetect probes — `process.env`
|
|
183
|
+
// values are strings, so the test config must look the same to keep the
|
|
184
|
+
// boot path consistent.
|
|
185
|
+
const envForLoader = {};
|
|
186
|
+
for (const [k, v] of Object.entries(config)) {
|
|
187
|
+
if (v === undefined || v === null)
|
|
188
|
+
continue;
|
|
189
|
+
envForLoader[k] = typeof v === 'string' ? v : String(v);
|
|
190
|
+
}
|
|
191
|
+
const resolved = resolvePlugins({
|
|
192
|
+
bundled: opts.plugins,
|
|
193
|
+
features: opts.features,
|
|
194
|
+
env: envForLoader,
|
|
195
|
+
logger,
|
|
196
|
+
});
|
|
197
|
+
const loadedPluginNames = new Set(resolved.loaded.map((p) => p.name));
|
|
198
|
+
const tools = new ToolRegistry();
|
|
199
|
+
const subAgents = new SubAgentRegistry();
|
|
200
|
+
const middlewares = new MiddlewareRegistry();
|
|
201
|
+
const manifests = new ManifestRegistry();
|
|
202
|
+
const configSchemas = new ConfigSchemaRegistry();
|
|
203
|
+
const sharedState = new SharedStateRegistry();
|
|
204
|
+
for (const plugin of resolved.loaded) {
|
|
205
|
+
tools.register(plugin);
|
|
206
|
+
subAgents.register(plugin);
|
|
207
|
+
middlewares.register(plugin);
|
|
208
|
+
manifests.register(plugin);
|
|
209
|
+
configSchemas.register(plugin);
|
|
210
|
+
sharedState.register(plugin);
|
|
211
|
+
}
|
|
212
|
+
const identity = {
|
|
213
|
+
name: 'IntegrationTestOracle',
|
|
214
|
+
org: 'IXO',
|
|
215
|
+
description: 'createIntegrationRuntime',
|
|
216
|
+
entityDid: typeof config.ORACLE_ENTITY_DID === 'string'
|
|
217
|
+
? config.ORACLE_ENTITY_DID
|
|
218
|
+
: 'did:ixo:test',
|
|
219
|
+
...opts.identity,
|
|
220
|
+
};
|
|
221
|
+
// Real LLM adapter — production-grade provider.
|
|
222
|
+
const llmAdapter = {
|
|
223
|
+
get(role, params) {
|
|
224
|
+
return getProviderChatModel(role, params);
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
// Matrix / secrets stay in-memory by default. Tests that need a live
|
|
228
|
+
// Matrix surface should boot via `createIntegrationOracle()` instead —
|
|
229
|
+
// a Tier A test that depends on Matrix is mis-tiered.
|
|
230
|
+
const matrixAdapter = {
|
|
231
|
+
async postToRoom() {
|
|
232
|
+
return 'integration-noop-event-id';
|
|
233
|
+
},
|
|
234
|
+
async getRoomState(roomId) {
|
|
235
|
+
return { roomId, state: [] };
|
|
236
|
+
},
|
|
237
|
+
async getEventById(_roomId, eventId) {
|
|
238
|
+
return { eventId, type: 'm.room.message', content: {} };
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
const secretsAdapter = {
|
|
242
|
+
async getIndex() {
|
|
243
|
+
return {};
|
|
244
|
+
},
|
|
245
|
+
async getValues() {
|
|
246
|
+
return {};
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
// UCAN adapter — honors the parsed capability list, matching production.
|
|
250
|
+
// Callers can swap in a real adapter via `opts.ucan` when the plugin under
|
|
251
|
+
// test needs to mint downstream invocations (memory / sandbox / skills /
|
|
252
|
+
// composio). Typical pattern: boot an oracle via `createIntegrationOracle`
|
|
253
|
+
// and pass `bootedOracle.app.ambient.ucan` here.
|
|
254
|
+
const ucanCapabilities = opts.capabilities ?? [];
|
|
255
|
+
const ucanAdapter = opts.ucan ?? {
|
|
256
|
+
hasCapability(delegation, resource, action) {
|
|
257
|
+
const caps = delegation?.capabilities ?? ucanCapabilities;
|
|
258
|
+
return Boolean(caps.some((cap) => cap.resource === resource && cap.action === action));
|
|
259
|
+
},
|
|
260
|
+
requireCapability(delegation, resource, action) {
|
|
261
|
+
const caps = delegation?.capabilities ?? ucanCapabilities;
|
|
262
|
+
const ok = caps.some((cap) => cap.resource === resource && cap.action === action);
|
|
263
|
+
if (!ok) {
|
|
264
|
+
throw new Error(`UCAN capability missing: '${action}' on '${resource}'.`);
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
async mintInvocation() {
|
|
268
|
+
throw new Error('createIntegrationRuntime: mintInvocation is not wired. Pass ' +
|
|
269
|
+
'`ucan: bootedOracle.app.ambient.ucan` from a `createIntegrationOracle()` ' +
|
|
270
|
+
'boot if your test needs downstream service invocations.');
|
|
271
|
+
},
|
|
272
|
+
async resolveServiceDid() {
|
|
273
|
+
return null;
|
|
274
|
+
},
|
|
275
|
+
hasSigningKey() {
|
|
276
|
+
return false;
|
|
277
|
+
},
|
|
278
|
+
async createInvocationFromDelegation() {
|
|
279
|
+
throw new Error('createIntegrationRuntime: createInvocationFromDelegation is not wired. Pass ' +
|
|
280
|
+
'`ucan: bootedOracle.app.ambient.ucan` from a `createIntegrationOracle()` ' +
|
|
281
|
+
'boot if your test needs CAR-driven invocation minting.');
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
const emitAdapter = {
|
|
285
|
+
emit() {
|
|
286
|
+
// Silent — tests that need to assert on events should use
|
|
287
|
+
// createIntegrationOracle().events instead.
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
const blobStoreAdapter = mockBlobStore();
|
|
291
|
+
const ambient = {
|
|
292
|
+
config,
|
|
293
|
+
identity,
|
|
294
|
+
availablePlugins: loadedPluginNames,
|
|
295
|
+
secrets: secretsAdapter,
|
|
296
|
+
blobStore: blobStoreAdapter,
|
|
297
|
+
matrix: matrixAdapter,
|
|
298
|
+
llm: llmAdapter,
|
|
299
|
+
emit: emitAdapter,
|
|
300
|
+
ucan: ucanAdapter,
|
|
301
|
+
logger,
|
|
302
|
+
};
|
|
303
|
+
const buildCtxFor = (pluginName) => buildPluginContext({
|
|
304
|
+
config,
|
|
305
|
+
identity,
|
|
306
|
+
availablePlugins: loadedPluginNames,
|
|
307
|
+
logger,
|
|
308
|
+
pluginName,
|
|
309
|
+
});
|
|
310
|
+
const sharedBuildCtx = buildCtxFor('__integration__');
|
|
311
|
+
const pluginCollectedTools = await tools.collect(sharedBuildCtx);
|
|
312
|
+
const collectedSubAgents = await subAgents.collect(sharedBuildCtx);
|
|
313
|
+
const collectedMiddlewares = middlewares.collect(sharedBuildCtx);
|
|
314
|
+
// Meta-tools (`list_capabilities`, `load_capability`) are registered by
|
|
315
|
+
// the runtime at agent-build time in production — not by plugins. The
|
|
316
|
+
// Tier A harness wires them in here so direct `invokeTool` can reach
|
|
317
|
+
// them; same instance the agent would see at runtime.
|
|
318
|
+
const metaToolEntries = buildMetaTools({
|
|
319
|
+
manifestRegistry: manifests,
|
|
320
|
+
toolRegistry: tools,
|
|
321
|
+
}).map((tool) => ({ pluginName: '__meta__', tool }));
|
|
322
|
+
const collectedTools = [...pluginCollectedTools, ...metaToolEntries];
|
|
323
|
+
const delegation = {
|
|
324
|
+
raw: opts.delegation ?? '',
|
|
325
|
+
issuer: opts.user.did,
|
|
326
|
+
audience: identity.entityDid,
|
|
327
|
+
capabilities: ucanCapabilities,
|
|
328
|
+
};
|
|
329
|
+
const buildRtCtx = () => {
|
|
330
|
+
const runConfig = {
|
|
331
|
+
context: {
|
|
332
|
+
user: {
|
|
333
|
+
did: opts.user.did,
|
|
334
|
+
matrixUserId: opts.user.matrixUserId ??
|
|
335
|
+
`@${opts.user.did.replaceAll(':', '-')}:test-host`,
|
|
336
|
+
ucanDelegation: delegation,
|
|
337
|
+
},
|
|
338
|
+
session: {
|
|
339
|
+
id: opts.session?.id ?? `integration-session-${Date.now()}`,
|
|
340
|
+
client: opts.session?.client ?? 'portal',
|
|
341
|
+
requestId: opts.session?.requestId ?? `integration-req-${Date.now()}`,
|
|
342
|
+
...(opts.session ?? {}),
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
};
|
|
346
|
+
const stateInput = {
|
|
347
|
+
messages: [],
|
|
348
|
+
// Default: pre-load every resolved plugin so Tier A direct-invoke
|
|
349
|
+
// tests don't need to call `load_capability` before reaching the
|
|
350
|
+
// plugin's tools. Tests that exercise the on-demand-load flow itself
|
|
351
|
+
// (`list_capabilities`, `load_capability`) override this with
|
|
352
|
+
// `state: { loadedPlugins: new Set() }` for an empty-start scenario.
|
|
353
|
+
loadedPlugins: loadedPluginNames,
|
|
354
|
+
...(opts.state ?? {}),
|
|
355
|
+
};
|
|
356
|
+
return buildRuntimeContext(runConfig, ambient, stateInput);
|
|
357
|
+
};
|
|
358
|
+
// If the caller asked for a custom fetch, install it for the duration of
|
|
359
|
+
// the runtime. We restore on close() so parallel tests don't poison each
|
|
360
|
+
// other's globalThis.fetch.
|
|
361
|
+
const originalFetch = globalThis.fetch;
|
|
362
|
+
if (opts.fetch) {
|
|
363
|
+
globalThis.fetch = opts.fetch;
|
|
364
|
+
}
|
|
365
|
+
return {
|
|
366
|
+
async invokeTool(name, args) {
|
|
367
|
+
const rtCtx = buildRtCtx();
|
|
368
|
+
// First check boot tools (collected once at harness construction).
|
|
369
|
+
let entry = collectedTools.find((t) => t.tool.name === name);
|
|
370
|
+
if (!entry) {
|
|
371
|
+
// Fall through to per-request tools — `getRequestTools(rtCtx)` reads
|
|
372
|
+
// the live runtime context (timezone, ucan delegation, etc.) so it
|
|
373
|
+
// must be collected per-invocation rather than at harness build time.
|
|
374
|
+
const requestTools = await tools.collectRequest(rtCtx);
|
|
375
|
+
entry = requestTools.find((t) => t.tool.name === name);
|
|
376
|
+
}
|
|
377
|
+
if (!entry) {
|
|
378
|
+
const available = [
|
|
379
|
+
...collectedTools.map((t) => t.tool.name),
|
|
380
|
+
...(await tools.collectRequest(rtCtx)).map((t) => t.tool.name),
|
|
381
|
+
].join(', ');
|
|
382
|
+
throw new Error(`Tool "${name}" not found. Registered tools: ${available || '(none)'}.`);
|
|
383
|
+
}
|
|
384
|
+
return entry.tool.handler(args, rtCtx);
|
|
385
|
+
},
|
|
386
|
+
async invokeMiddleware(nameOrIndex, state, runtimeArg) {
|
|
387
|
+
const middleware = findMiddleware(collectedMiddlewares, nameOrIndex);
|
|
388
|
+
const runtimeCtx = runtimeArg ?? { context: {} };
|
|
389
|
+
const out = {};
|
|
390
|
+
// LangChain v1.x middleware hooks have rich generic types; at the
|
|
391
|
+
// harness boundary they all collapse to `(state, runtime) => result`.
|
|
392
|
+
// The same shape `create-test-runtime.ts` uses.
|
|
393
|
+
const hookBag = middleware;
|
|
394
|
+
const before1 = await runHook(hookBag.beforeAgent, state, runtimeCtx);
|
|
395
|
+
if (before1 !== undefined)
|
|
396
|
+
out.before = before1;
|
|
397
|
+
const before2 = await runHook(hookBag.beforeModel, state, runtimeCtx);
|
|
398
|
+
if (before2 !== undefined)
|
|
399
|
+
out.before = before2;
|
|
400
|
+
const after1 = await runHook(hookBag.afterModel, state, runtimeCtx);
|
|
401
|
+
if (after1 !== undefined)
|
|
402
|
+
out.after = after1;
|
|
403
|
+
const after2 = await runHook(hookBag.afterAgent, state, runtimeCtx);
|
|
404
|
+
if (after2 !== undefined)
|
|
405
|
+
out.after = after2;
|
|
406
|
+
return out;
|
|
407
|
+
},
|
|
408
|
+
async invokeSubAgent(name, task) {
|
|
409
|
+
const entry = collectedSubAgents.find((s) => s.subAgent.name === name);
|
|
410
|
+
if (!entry) {
|
|
411
|
+
throw new Error(`Sub-agent "${name}" not found. Registered: ${collectedSubAgents.map((s) => s.subAgent.name).join(', ') ||
|
|
412
|
+
'(none)'}.`);
|
|
413
|
+
}
|
|
414
|
+
const sub = entry.subAgent;
|
|
415
|
+
const buildCtx = buildCtxFor(entry.pluginName);
|
|
416
|
+
const subTools = typeof sub.tools === 'function' ? sub.tools(buildCtx) : sub.tools;
|
|
417
|
+
const systemPrompt = typeof sub.systemPrompt === 'function'
|
|
418
|
+
? sub.systemPrompt(buildCtx)
|
|
419
|
+
: sub.systemPrompt;
|
|
420
|
+
const model = ambient.llm.get(sub.model ?? 'subagent');
|
|
421
|
+
const reply = await model.invoke([new HumanMessage(task)]);
|
|
422
|
+
const replyText = typeof reply.content === 'string'
|
|
423
|
+
? reply.content
|
|
424
|
+
: JSON.stringify(reply.content);
|
|
425
|
+
return JSON.stringify({
|
|
426
|
+
subAgent: sub.name,
|
|
427
|
+
plugin: entry.pluginName,
|
|
428
|
+
task,
|
|
429
|
+
systemPromptPreview: systemPrompt.slice(0, 80),
|
|
430
|
+
toolNames: subTools.map((t) => t.name),
|
|
431
|
+
reply: replyText,
|
|
432
|
+
});
|
|
433
|
+
},
|
|
434
|
+
ambient,
|
|
435
|
+
async close() {
|
|
436
|
+
if (opts.fetch) {
|
|
437
|
+
globalThis.fetch = originalFetch;
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
async function runHook(entry, state, runtime) {
|
|
443
|
+
if (!entry)
|
|
444
|
+
return undefined;
|
|
445
|
+
const fn = typeof entry === 'function' ? entry : entry.hook;
|
|
446
|
+
return fn(state, runtime);
|
|
447
|
+
}
|
|
448
|
+
function findMiddleware(collected, nameOrIndex) {
|
|
449
|
+
if (typeof nameOrIndex === 'number') {
|
|
450
|
+
const found = collected[nameOrIndex];
|
|
451
|
+
if (!found) {
|
|
452
|
+
throw new Error(`Middleware index ${nameOrIndex} out of range (0..${collected.length - 1}).`);
|
|
453
|
+
}
|
|
454
|
+
return found.middleware;
|
|
455
|
+
}
|
|
456
|
+
const direct = collected.find((m) => m.middleware.name === nameOrIndex);
|
|
457
|
+
if (direct)
|
|
458
|
+
return direct.middleware;
|
|
459
|
+
const names = collected.map((m) => m.middleware.name).join(', ');
|
|
460
|
+
throw new Error(`Middleware "${nameOrIndex}" not found. Registered: ${names || '(none)'}.`);
|
|
461
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public surface for `@ixo/oracle-runtime/testing/integration`.
|
|
3
|
+
*
|
|
4
|
+
* Five exports total — anything else would be over-abstraction (see spec §6).
|
|
5
|
+
* Tests skip via `test.skipIf(!process.env.X)`, sequence steps via plain
|
|
6
|
+
* `await`s, and lean on the matchers `expect.extend(langchainMatchers)` adds
|
|
7
|
+
* inside `setup.ts`. No DSLs.
|
|
8
|
+
*/
|
|
9
|
+
export { createIntegrationOracle, createIntegrationRuntime, type CreateIntegrationOracleOptions, type CreateIntegrationRuntimeOptions, type IntegrationOracle, type IntegrationRuntime, type IntegrationCapability, } from './harness.js';
|
|
10
|
+
export { ChatClient, type ChatClientOptions, type SendOptions, type SendResult, type StreamOptions, type StreamFinal, } from './chat-client.js';
|
|
11
|
+
export { mintUserDelegation, memoryCap, sandboxCap, skillsCap, subscriptionsReadCap, allCaps, type MintUserDelegationOptions, } from './ucan.js';
|
|
12
|
+
export { waitForMatrixLoaded } from './wait-for-matrix-loaded.js';
|
|
13
|
+
export { parseSSEStream, type SSEEvent, type SSEMessageEventData, type SSEToolCallEventData, type SSEActionCallEventData, type SSEErrorEventData, type SSEDoneEventData, type SSERouterUpdateEventData, type SSERenderComponentEventData, type SSEBrowserToolCallEventData, type SSEMessageCacheInvalidationEventData, type SSEReasoningEventData, } from './sse-parser.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testing/integration/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EACpC,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,GAC3B,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,UAAU,EACV,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,WAAW,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,OAAO,EACP,KAAK,yBAAyB,GAC/B,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAOlE,OAAO,EACL,cAAc,EACd,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,oCAAoC,EACzC,KAAK,qBAAqB,GAC3B,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public surface for `@ixo/oracle-runtime/testing/integration`.
|
|
3
|
+
*
|
|
4
|
+
* Five exports total — anything else would be over-abstraction (see spec §6).
|
|
5
|
+
* Tests skip via `test.skipIf(!process.env.X)`, sequence steps via plain
|
|
6
|
+
* `await`s, and lean on the matchers `expect.extend(langchainMatchers)` adds
|
|
7
|
+
* inside `setup.ts`. No DSLs.
|
|
8
|
+
*/
|
|
9
|
+
export { createIntegrationOracle, createIntegrationRuntime, } from './harness.js';
|
|
10
|
+
export { ChatClient, } from './chat-client.js';
|
|
11
|
+
export { mintUserDelegation, memoryCap, sandboxCap, skillsCap, subscriptionsReadCap, allCaps, } from './ucan.js';
|
|
12
|
+
export { waitForMatrixLoaded } from './wait-for-matrix-loaded.js';
|
|
13
|
+
// Typed SSE events — mirror of `packages/oracles-client-sdk/src/utils/sse-parser.ts`.
|
|
14
|
+
// Tests use these to type-narrow when asserting on streamed events:
|
|
15
|
+
// for await (const evt of client.stream(sessionId, msg)) {
|
|
16
|
+
// if (evt.event === 'tool_call') { evt.data.toolName } // typed
|
|
17
|
+
// }
|
|
18
|
+
export { parseSSEStream, } from './sse-parser.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../src/testing/integration/setup.ts"],"names":[],"mappings":"AAqBA,OAAO,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vitest setupFile for integration tests.
|
|
3
|
+
*
|
|
4
|
+
* Loads env from the package-local `.env.integration` only. Deliberately
|
|
5
|
+
* does NOT reach into a sibling package's `.env` — that coupling would
|
|
6
|
+
* break for any consumer who forks @ixo/oracle-runtime to build their
|
|
7
|
+
* own oracle without an `apps/qiforge-example/` directory next door.
|
|
8
|
+
*
|
|
9
|
+
* Consumers writing tests against @ixo/oracle-runtime/testing/integration
|
|
10
|
+
* configure their own vitest setupFile in their own package; this file
|
|
11
|
+
* is the runtime package's own setup.
|
|
12
|
+
*
|
|
13
|
+
* Setup is intentionally minimal: dotenv + langchainMatchers. Spec §6
|
|
14
|
+
* bans `env-loader`, `requires()`, `runScenario`, custom matchers
|
|
15
|
+
* modules, and failure-diagnostics modules — use vitest as-is.
|
|
16
|
+
*/
|
|
17
|
+
import { langchainMatchers } from '@langchain/core/testing';
|
|
18
|
+
import { Logger } from '@nestjs/common';
|
|
19
|
+
import { config as dotenvConfig } from 'dotenv';
|
|
20
|
+
import { dirname, resolve } from 'node:path';
|
|
21
|
+
import { fileURLToPath } from 'node:url';
|
|
22
|
+
import 'reflect-metadata';
|
|
23
|
+
import { expect } from 'vitest';
|
|
24
|
+
// Resolve package root relative to this setup file. This file lives at
|
|
25
|
+
// `src/testing/integration/setup.ts`; package root is three directories up.
|
|
26
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
27
|
+
const __dirname = dirname(__filename);
|
|
28
|
+
const packageRoot = resolve(__dirname, '../../..');
|
|
29
|
+
// Single env file owned by the package. Self-contained — no cross-package
|
|
30
|
+
// reads. Missing file is silently tolerated (CI provides env via secrets).
|
|
31
|
+
dotenvConfig({ path: resolve(packageRoot, '.env.integration') });
|
|
32
|
+
// Silence @ixo/logger (winston) info/debug spam in integration runs. The
|
|
33
|
+
// logger is a singleton that reads LOG_LEVEL at construction, so this must
|
|
34
|
+
// land before any test module imports it. Honors a caller-provided value.
|
|
35
|
+
process.env.LOG_LEVEL ??= 'warn';
|
|
36
|
+
// Silence NestJS internal logs (route mappings, module init, etc.) — the
|
|
37
|
+
// harness already passes a no-op `PluginLogger` to `createOracleApp`, but
|
|
38
|
+
// Nest core instantiates its own `Logger` singletons that write to stdout
|
|
39
|
+
// independently. `error` + `warn` stay on so real failures surface.
|
|
40
|
+
Logger.overrideLogger(['error', 'warn']);
|
|
41
|
+
expect.extend(langchainMatchers);
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSE event types + stream parser for integration tests.
|
|
3
|
+
*
|
|
4
|
+
* **MIRROR of `packages/oracles-client-sdk/src/utils/sse-parser.ts`.**
|
|
5
|
+
* Keep both files in sync. The SSE wire format is the contract between
|
|
6
|
+
* the runtime (server) and the client SDK (frontend) — tests need to
|
|
7
|
+
* parse it exactly the way real clients do, with the same typed event
|
|
8
|
+
* union, or they'll drift from production behavior.
|
|
9
|
+
*
|
|
10
|
+
* Cross-package import was rejected because `oracles-client-sdk` is a
|
|
11
|
+
* React-tagged package (`"use client"`) and importing into a Node test
|
|
12
|
+
* harness creates an awkward dependency direction. Duplication of a
|
|
13
|
+
* shared wire contract is the lesser evil. If this file ever changes,
|
|
14
|
+
* update its twin in the client SDK at the same time.
|
|
15
|
+
*/
|
|
16
|
+
export interface BaseSSEEvent<TEvent extends string, TData> {
|
|
17
|
+
event: TEvent;
|
|
18
|
+
data: TData;
|
|
19
|
+
}
|
|
20
|
+
export interface SSEMessageEventData {
|
|
21
|
+
content: string;
|
|
22
|
+
timestamp: string;
|
|
23
|
+
}
|
|
24
|
+
export interface SSEToolCallEventData {
|
|
25
|
+
sessionId: string;
|
|
26
|
+
requestId: string;
|
|
27
|
+
toolName: string;
|
|
28
|
+
args: Record<string, unknown>;
|
|
29
|
+
status: 'isRunning' | 'done';
|
|
30
|
+
output?: string;
|
|
31
|
+
eventId?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface SSEErrorEventData {
|
|
34
|
+
error: string;
|
|
35
|
+
timestamp: string;
|
|
36
|
+
}
|
|
37
|
+
export interface SSEDoneEventData {
|
|
38
|
+
timestamp?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface SSERouterUpdateEventData {
|
|
41
|
+
step: string;
|
|
42
|
+
sessionId: string;
|
|
43
|
+
requestId: string;
|
|
44
|
+
eventId?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface SSERenderComponentEventData {
|
|
47
|
+
componentName: string;
|
|
48
|
+
args?: Record<string, unknown>;
|
|
49
|
+
status?: 'isRunning' | 'done';
|
|
50
|
+
sessionId: string;
|
|
51
|
+
requestId: string;
|
|
52
|
+
eventId?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface SSEBrowserToolCallEventData {
|
|
55
|
+
toolName: string;
|
|
56
|
+
args?: Record<string, unknown>;
|
|
57
|
+
status?: 'isRunning' | 'done';
|
|
58
|
+
sessionId: string;
|
|
59
|
+
requestId: string;
|
|
60
|
+
eventId?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface SSEActionCallEventData {
|
|
63
|
+
sessionId: string;
|
|
64
|
+
requestId: string;
|
|
65
|
+
toolName: string;
|
|
66
|
+
args?: Record<string, unknown>;
|
|
67
|
+
status?: 'isRunning' | 'done' | 'error';
|
|
68
|
+
output?: string;
|
|
69
|
+
toolCallId?: string;
|
|
70
|
+
error?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface SSEMessageCacheInvalidationEventData {
|
|
73
|
+
status?: 'isRunning' | 'done';
|
|
74
|
+
sessionId: string;
|
|
75
|
+
requestId: string;
|
|
76
|
+
eventId?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface SSEReasoningEventData {
|
|
79
|
+
sessionId: string;
|
|
80
|
+
requestId: string;
|
|
81
|
+
reasoning: string;
|
|
82
|
+
reasoningDetails?: Array<{
|
|
83
|
+
type: string;
|
|
84
|
+
text: string;
|
|
85
|
+
format: string;
|
|
86
|
+
index: number;
|
|
87
|
+
}>;
|
|
88
|
+
isComplete?: boolean;
|
|
89
|
+
timestamp?: string;
|
|
90
|
+
eventId?: string;
|
|
91
|
+
}
|
|
92
|
+
export type SSEEvent = BaseSSEEvent<'message', SSEMessageEventData> | BaseSSEEvent<'tool_call', SSEToolCallEventData> | BaseSSEEvent<'action_call', SSEActionCallEventData> | BaseSSEEvent<'error', SSEErrorEventData> | BaseSSEEvent<'done', SSEDoneEventData> | BaseSSEEvent<'router.update', SSERouterUpdateEventData> | BaseSSEEvent<'render_component', SSERenderComponentEventData> | BaseSSEEvent<'browser_tool_call', SSEBrowserToolCallEventData> | BaseSSEEvent<'message_cache_invalidation', SSEMessageCacheInvalidationEventData> | BaseSSEEvent<'reasoning', SSEReasoningEventData>;
|
|
93
|
+
/**
|
|
94
|
+
* Parse SSE stream from a ReadableStream reader. Yields typed `SSEEvent`s.
|
|
95
|
+
* Handles buffer management across chunk boundaries, JSON parse errors,
|
|
96
|
+
* and graceful abort behavior.
|
|
97
|
+
*/
|
|
98
|
+
export declare function parseSSEStream(reader: ReadableStreamDefaultReader<Uint8Array>): AsyncGenerator<SSEEvent>;
|
|
99
|
+
//# sourceMappingURL=sse-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse-parser.d.ts","sourceRoot":"","sources":["../../../src/testing/integration/sse-parser.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;GAcG;AAGH,MAAM,WAAW,YAAY,CAAC,MAAM,SAAS,MAAM,EAAE,KAAK;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,KAAK,CAAC;CACb;AAGD,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oCAAoC;IACnD,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,KAAK,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,MAAM,MAAM,QAAQ,GAChB,YAAY,CAAC,SAAS,EAAE,mBAAmB,CAAC,GAC5C,YAAY,CAAC,WAAW,EAAE,oBAAoB,CAAC,GAC/C,YAAY,CAAC,aAAa,EAAE,sBAAsB,CAAC,GACnD,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC,GACxC,YAAY,CAAC,MAAM,EAAE,gBAAgB,CAAC,GACtC,YAAY,CAAC,eAAe,EAAE,wBAAwB,CAAC,GACvD,YAAY,CAAC,kBAAkB,EAAE,2BAA2B,CAAC,GAC7D,YAAY,CAAC,mBAAmB,EAAE,2BAA2B,CAAC,GAC9D,YAAY,CACV,4BAA4B,EAC5B,oCAAoC,CACrC,GACD,YAAY,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC;AAoBrD;;;;GAIG;AACH,wBAAuB,cAAc,CACnC,MAAM,EAAE,2BAA2B,CAAC,UAAU,CAAC,GAC9C,cAAc,CAAC,QAAQ,CAAC,CA6F1B"}
|