@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,125 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
/**
|
|
3
|
+
* SSE event types + stream parser for integration tests.
|
|
4
|
+
*
|
|
5
|
+
* **MIRROR of `packages/oracles-client-sdk/src/utils/sse-parser.ts`.**
|
|
6
|
+
* Keep both files in sync. The SSE wire format is the contract between
|
|
7
|
+
* the runtime (server) and the client SDK (frontend) — tests need to
|
|
8
|
+
* parse it exactly the way real clients do, with the same typed event
|
|
9
|
+
* union, or they'll drift from production behavior.
|
|
10
|
+
*
|
|
11
|
+
* Cross-package import was rejected because `oracles-client-sdk` is a
|
|
12
|
+
* React-tagged package (`"use client"`) and importing into a Node test
|
|
13
|
+
* harness creates an awkward dependency direction. Duplication of a
|
|
14
|
+
* shared wire contract is the lesser evil. If this file ever changes,
|
|
15
|
+
* update its twin in the client SDK at the same time.
|
|
16
|
+
*/
|
|
17
|
+
function isValidSSEEventType(eventType) {
|
|
18
|
+
const validEventTypes = [
|
|
19
|
+
'message',
|
|
20
|
+
'tool_call',
|
|
21
|
+
'action_call',
|
|
22
|
+
'error',
|
|
23
|
+
'done',
|
|
24
|
+
'router.update',
|
|
25
|
+
'render_component',
|
|
26
|
+
'browser_tool_call',
|
|
27
|
+
'message_cache_invalidation',
|
|
28
|
+
'reasoning',
|
|
29
|
+
];
|
|
30
|
+
return validEventTypes.includes(eventType);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Parse SSE stream from a ReadableStream reader. Yields typed `SSEEvent`s.
|
|
34
|
+
* Handles buffer management across chunk boundaries, JSON parse errors,
|
|
35
|
+
* and graceful abort behavior.
|
|
36
|
+
*/
|
|
37
|
+
export async function* parseSSEStream(reader) {
|
|
38
|
+
const decoder = new TextDecoder();
|
|
39
|
+
let buffer = '';
|
|
40
|
+
try {
|
|
41
|
+
while (true) {
|
|
42
|
+
let readResult;
|
|
43
|
+
try {
|
|
44
|
+
readResult = await reader.read();
|
|
45
|
+
}
|
|
46
|
+
catch (readError) {
|
|
47
|
+
if (readError instanceof Error &&
|
|
48
|
+
(readError.name === 'AbortError' ||
|
|
49
|
+
(readError instanceof DOMException &&
|
|
50
|
+
readError.name === 'AbortError'))) {
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
throw readError;
|
|
54
|
+
}
|
|
55
|
+
const { done, value } = readResult;
|
|
56
|
+
if (done)
|
|
57
|
+
break;
|
|
58
|
+
buffer += decoder.decode(value, { stream: true });
|
|
59
|
+
const lines = buffer.split('\n');
|
|
60
|
+
buffer = lines.pop() || '';
|
|
61
|
+
let event = '';
|
|
62
|
+
let data = '';
|
|
63
|
+
for (const line of lines) {
|
|
64
|
+
const trimmedLine = line.trim();
|
|
65
|
+
if (trimmedLine === '' || trimmedLine.startsWith(':')) {
|
|
66
|
+
if (event && data) {
|
|
67
|
+
try {
|
|
68
|
+
const parsedData = JSON.parse(data);
|
|
69
|
+
if (isValidSSEEventType(event)) {
|
|
70
|
+
yield { event, data: parsedData };
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch (parseError) {
|
|
74
|
+
console.warn('Failed to parse SSE data:', data, parseError);
|
|
75
|
+
}
|
|
76
|
+
event = '';
|
|
77
|
+
data = '';
|
|
78
|
+
}
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (trimmedLine.startsWith('event:')) {
|
|
82
|
+
event = trimmedLine.slice(6).trim();
|
|
83
|
+
}
|
|
84
|
+
else if (trimmedLine.startsWith('data:')) {
|
|
85
|
+
data = trimmedLine.slice(5).trim();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Flush any trailing event left in the buffer.
|
|
90
|
+
if (buffer.trim()) {
|
|
91
|
+
const lines = buffer.split('\n');
|
|
92
|
+
let event = '';
|
|
93
|
+
let data = '';
|
|
94
|
+
for (const line of lines) {
|
|
95
|
+
const trimmedLine = line.trim();
|
|
96
|
+
if (trimmedLine.startsWith('event:')) {
|
|
97
|
+
event = trimmedLine.slice(6).trim();
|
|
98
|
+
}
|
|
99
|
+
else if (trimmedLine.startsWith('data:')) {
|
|
100
|
+
data = trimmedLine.slice(5).trim();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (event && data) {
|
|
104
|
+
try {
|
|
105
|
+
const parsedData = JSON.parse(data);
|
|
106
|
+
if (isValidSSEEventType(event)) {
|
|
107
|
+
yield { event, data: parsedData };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
catch (parseError) {
|
|
111
|
+
console.warn('Failed to parse final SSE data:', data, parseError);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
if (error instanceof Error &&
|
|
118
|
+
(error.name === 'AbortError' ||
|
|
119
|
+
(error instanceof DOMException && error.name === 'AbortError'))) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
console.error('Error parsing SSE stream:', error);
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UCAN delegation minting for integration tests.
|
|
3
|
+
*
|
|
4
|
+
* Wraps `@ixo/ucan`'s `signerFromMnemonic` + `createDelegation` +
|
|
5
|
+
* `serializeDelegation` pipeline into one call. The result is a base64
|
|
6
|
+
* CAR-encoded delegation string suitable for the `x-ucan-delegation`
|
|
7
|
+
* request header — what the runtime's `AuthHeaderMiddleware` validates.
|
|
8
|
+
*
|
|
9
|
+
* Capability constants below match the strings the runtime / plugins
|
|
10
|
+
* already expect. **Composio routes through the sandbox capability** —
|
|
11
|
+
* there is no separate `composioCap` and tests that exercise composio
|
|
12
|
+
* must include `sandboxCap` in their capability set.
|
|
13
|
+
*/
|
|
14
|
+
import { type Capability } from '@ixo/ucan';
|
|
15
|
+
/** Memory plugin capability — read/write user memories. */
|
|
16
|
+
export declare const memoryCap: Capability;
|
|
17
|
+
/**
|
|
18
|
+
* Sandbox capability — covers the sandbox plugin AND Composio (composio
|
|
19
|
+
* routes through the sandbox infra). There is intentionally no
|
|
20
|
+
* `composioCap`; tests that need composio access list `sandboxCap`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const sandboxCap: Capability;
|
|
23
|
+
/** Skills plugin capability — search/list/run skill capsules. */
|
|
24
|
+
export declare const skillsCap: Capability;
|
|
25
|
+
/** Subscriptions read capability — covers the credits middleware lookup. */
|
|
26
|
+
export declare const subscriptionsReadCap: Capability;
|
|
27
|
+
/** Convenience: the full capability bundle for "no-friction" tests. */
|
|
28
|
+
export declare const allCaps: Capability[];
|
|
29
|
+
/** Options accepted by `mintUserDelegation`. */
|
|
30
|
+
export interface MintUserDelegationOptions {
|
|
31
|
+
/**
|
|
32
|
+
* BIP39 mnemonic for the test user. Stored in `.env.integration` as
|
|
33
|
+
* `TEST_USER_MNEMONIC`. Test files normally pass
|
|
34
|
+
* `process.env.TEST_USER_MNEMONIC!`.
|
|
35
|
+
*/
|
|
36
|
+
userMnemonic: string;
|
|
37
|
+
/**
|
|
38
|
+
* The oracle's DID — the delegation's audience. Tests normally pass
|
|
39
|
+
* `process.env.ORACLE_DID!`. Matches the `serverDid` the runtime's
|
|
40
|
+
* UCAN validator boots with.
|
|
41
|
+
*/
|
|
42
|
+
oracleDid: string;
|
|
43
|
+
/**
|
|
44
|
+
* The test user's DID. Defaults to the DID derived from the mnemonic
|
|
45
|
+
* by `signerFromMnemonic`. Pass `process.env.TEST_USER_DID!` when the
|
|
46
|
+
* user has an on-chain Ed25519 verification method so the issuer string
|
|
47
|
+
* matches what the chain-aware validator resolves.
|
|
48
|
+
*/
|
|
49
|
+
userDid?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Capabilities granted by the delegation. Tests that exercise UCAN
|
|
52
|
+
* failure modes pass a narrower set (e.g. `[memoryCap]` to a sandbox
|
|
53
|
+
* test to assert a clean auth error).
|
|
54
|
+
*/
|
|
55
|
+
capabilities: Capability[];
|
|
56
|
+
/**
|
|
57
|
+
* Time-to-live, in **seconds** (not ms — `@ixo/ucan` uses Unix seconds
|
|
58
|
+
* for expiration). Defaults to 7 days.
|
|
59
|
+
*/
|
|
60
|
+
ttlSec?: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Mint a real Ed25519-signed UCAN delegation string for the test user.
|
|
64
|
+
*
|
|
65
|
+
* Pipeline (verbatim per the integration-testing spec §6/§8 Phase 0.6):
|
|
66
|
+
*
|
|
67
|
+
* `signerFromMnemonic(userMnemonic, userDid?)` → `createDelegation({
|
|
68
|
+
* issuer, audience: oracleDid, capabilities, expiration: now+ttl })` →
|
|
69
|
+
* `serializeDelegation()`
|
|
70
|
+
*
|
|
71
|
+
* `expiration` is Unix **seconds**, not milliseconds — a frequent footgun.
|
|
72
|
+
*/
|
|
73
|
+
export declare function mintUserDelegation(opts: MintUserDelegationOptions): Promise<string>;
|
|
74
|
+
//# sourceMappingURL=ucan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ucan.d.ts","sourceRoot":"","sources":["../../../src/testing/integration/ucan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AAkCnB,2DAA2D;AAC3D,eAAO,MAAM,SAAS,EAAE,UAGvB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,UAGxB,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,SAAS,EAAE,UAGvB,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,oBAAoB,EAAE,UAGlC,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,OAAO,EAAE,UAAU,EAK/B,CAAC;AAEF,gDAAgD;AAChD,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,MAAM,CAAC,CAiBjB"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UCAN delegation minting for integration tests.
|
|
3
|
+
*
|
|
4
|
+
* Wraps `@ixo/ucan`'s `signerFromMnemonic` + `createDelegation` +
|
|
5
|
+
* `serializeDelegation` pipeline into one call. The result is a base64
|
|
6
|
+
* CAR-encoded delegation string suitable for the `x-ucan-delegation`
|
|
7
|
+
* request header — what the runtime's `AuthHeaderMiddleware` validates.
|
|
8
|
+
*
|
|
9
|
+
* Capability constants below match the strings the runtime / plugins
|
|
10
|
+
* already expect. **Composio routes through the sandbox capability** —
|
|
11
|
+
* there is no separate `composioCap` and tests that exercise composio
|
|
12
|
+
* must include `sandboxCap` in their capability set.
|
|
13
|
+
*/
|
|
14
|
+
import { createDelegation, serializeDelegation, signerFromMnemonic, } from '@ixo/ucan';
|
|
15
|
+
/** Type predicate: tag a string as the `did:ixo:` brand `@ixo/ucan` accepts. */
|
|
16
|
+
function isIxoDid(did) {
|
|
17
|
+
return did.startsWith('did:ixo:');
|
|
18
|
+
}
|
|
19
|
+
/** Type predicate: tag a string as the `did:key:` brand `@ixo/ucan` accepts. */
|
|
20
|
+
function isKeyDid(did) {
|
|
21
|
+
return did.startsWith('did:key:');
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Narrow a string DID to one of the brands the UCAN library accepts. Returns
|
|
25
|
+
* `undefined` for `undefined` input (so the caller can fall through to the
|
|
26
|
+
* signer's auto-derived `did:key:` identity); throws for unsupported methods
|
|
27
|
+
* so a typo in `.env.integration` fails loudly.
|
|
28
|
+
*/
|
|
29
|
+
function toSupportedDid(did) {
|
|
30
|
+
if (did === undefined)
|
|
31
|
+
return undefined;
|
|
32
|
+
if (isIxoDid(did))
|
|
33
|
+
return did;
|
|
34
|
+
if (isKeyDid(did))
|
|
35
|
+
return did;
|
|
36
|
+
const prefix = did.split(':').slice(0, 2).join(':');
|
|
37
|
+
throw new Error(`[mintUserDelegation] Unsupported DID method '${prefix}' — ` +
|
|
38
|
+
`only did:ixo: and did:key: are accepted. Got: ${did}`);
|
|
39
|
+
}
|
|
40
|
+
/** One week in seconds — default TTL for a test delegation. */
|
|
41
|
+
const ONE_WEEK_SECONDS = 7 * 24 * 60 * 60;
|
|
42
|
+
/** Memory plugin capability — read/write user memories. */
|
|
43
|
+
export const memoryCap = {
|
|
44
|
+
can: 'memory/*',
|
|
45
|
+
with: 'ixo:memory',
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Sandbox capability — covers the sandbox plugin AND Composio (composio
|
|
49
|
+
* routes through the sandbox infra). There is intentionally no
|
|
50
|
+
* `composioCap`; tests that need composio access list `sandboxCap`.
|
|
51
|
+
*/
|
|
52
|
+
export const sandboxCap = {
|
|
53
|
+
can: 'sandbox/*',
|
|
54
|
+
with: 'ixo:sandbox',
|
|
55
|
+
};
|
|
56
|
+
/** Skills plugin capability — search/list/run skill capsules. */
|
|
57
|
+
export const skillsCap = {
|
|
58
|
+
can: 'skills/*',
|
|
59
|
+
with: 'ixo:skills',
|
|
60
|
+
};
|
|
61
|
+
/** Subscriptions read capability — covers the credits middleware lookup. */
|
|
62
|
+
export const subscriptionsReadCap = {
|
|
63
|
+
can: 'subscriptions/read',
|
|
64
|
+
with: 'ixo:subscriptions',
|
|
65
|
+
};
|
|
66
|
+
/** Convenience: the full capability bundle for "no-friction" tests. */
|
|
67
|
+
export const allCaps = [
|
|
68
|
+
memoryCap,
|
|
69
|
+
sandboxCap,
|
|
70
|
+
skillsCap,
|
|
71
|
+
subscriptionsReadCap,
|
|
72
|
+
];
|
|
73
|
+
/**
|
|
74
|
+
* Mint a real Ed25519-signed UCAN delegation string for the test user.
|
|
75
|
+
*
|
|
76
|
+
* Pipeline (verbatim per the integration-testing spec §6/§8 Phase 0.6):
|
|
77
|
+
*
|
|
78
|
+
* `signerFromMnemonic(userMnemonic, userDid?)` → `createDelegation({
|
|
79
|
+
* issuer, audience: oracleDid, capabilities, expiration: now+ttl })` →
|
|
80
|
+
* `serializeDelegation()`
|
|
81
|
+
*
|
|
82
|
+
* `expiration` is Unix **seconds**, not milliseconds — a frequent footgun.
|
|
83
|
+
*/
|
|
84
|
+
export async function mintUserDelegation(opts) {
|
|
85
|
+
const ttlSec = opts.ttlSec ?? ONE_WEEK_SECONDS;
|
|
86
|
+
const expiration = Math.floor(Date.now() / 1000) + ttlSec;
|
|
87
|
+
const { signer } = await signerFromMnemonic(opts.userMnemonic, toSupportedDid(opts.userDid));
|
|
88
|
+
const delegation = await createDelegation({
|
|
89
|
+
issuer: signer,
|
|
90
|
+
audience: opts.oracleDid,
|
|
91
|
+
capabilities: opts.capabilities,
|
|
92
|
+
expiration,
|
|
93
|
+
});
|
|
94
|
+
return serializeDelegation(delegation);
|
|
95
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type IntegrationOracle } from './harness.js';
|
|
2
|
+
/**
|
|
3
|
+
* Block until the booted oracle reports `matrix:loaded`. Many downstream
|
|
4
|
+
* code paths depend on the Matrix-side signing identity (loaded after init
|
|
5
|
+
* completes):
|
|
6
|
+
*
|
|
7
|
+
* - `UcanService.mintInvocation` returns null until the signing mnemonic
|
|
8
|
+
* is wired, so plugin Tier-A direct invocations fail.
|
|
9
|
+
* - `SubscriptionMiddleware` rejects authenticated requests with
|
|
10
|
+
* "UCAN signing key not configured" before the key lands.
|
|
11
|
+
* - `RequestPreparer` resolves the user's encrypted Matrix room id from
|
|
12
|
+
* the Matrix client when the session row doesn't carry one, which
|
|
13
|
+
* requires Matrix to be initialized.
|
|
14
|
+
*
|
|
15
|
+
* Throws when `matrix:failed` is emitted (boot is broken — fail loudly,
|
|
16
|
+
* not after 60s of polling) or when the deadline elapses.
|
|
17
|
+
*/
|
|
18
|
+
export declare function waitForMatrixLoaded(oracle: IntegrationOracle, timeoutMs?: number): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=wait-for-matrix-loaded.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait-for-matrix-loaded.d.ts","sourceRoot":"","sources":["../../../src/testing/integration/wait-for-matrix-loaded.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,iBAAiB,EACzB,SAAS,SAAS,GACjB,OAAO,CAAC,IAAI,CAAC,CAqBf"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block until the booted oracle reports `matrix:loaded`. Many downstream
|
|
3
|
+
* code paths depend on the Matrix-side signing identity (loaded after init
|
|
4
|
+
* completes):
|
|
5
|
+
*
|
|
6
|
+
* - `UcanService.mintInvocation` returns null until the signing mnemonic
|
|
7
|
+
* is wired, so plugin Tier-A direct invocations fail.
|
|
8
|
+
* - `SubscriptionMiddleware` rejects authenticated requests with
|
|
9
|
+
* "UCAN signing key not configured" before the key lands.
|
|
10
|
+
* - `RequestPreparer` resolves the user's encrypted Matrix room id from
|
|
11
|
+
* the Matrix client when the session row doesn't carry one, which
|
|
12
|
+
* requires Matrix to be initialized.
|
|
13
|
+
*
|
|
14
|
+
* Throws when `matrix:failed` is emitted (boot is broken — fail loudly,
|
|
15
|
+
* not after 60s of polling) or when the deadline elapses.
|
|
16
|
+
*/
|
|
17
|
+
export async function waitForMatrixLoaded(oracle, timeoutMs = 60_000) {
|
|
18
|
+
const deadline = Date.now() + timeoutMs;
|
|
19
|
+
while (Date.now() < deadline) {
|
|
20
|
+
const loaded = oracle.events.statusChanges.find((e) => e.plugin === 'matrix' && e.to === 'loaded');
|
|
21
|
+
if (loaded)
|
|
22
|
+
return;
|
|
23
|
+
const failed = oracle.events.statusChanges.find((e) => e.plugin === 'matrix' && e.to === 'failed');
|
|
24
|
+
if (failed) {
|
|
25
|
+
throw new Error(`Matrix init failed during boot: ${failed.reason ?? 'no reason given'}`);
|
|
26
|
+
}
|
|
27
|
+
await new Promise((r) => setTimeout(r, 250));
|
|
28
|
+
}
|
|
29
|
+
throw new Error(`Matrix did not reach 'loaded' within ${timeoutMs}ms — last events: ` +
|
|
30
|
+
JSON.stringify(oracle.events.statusChanges.slice(-5)));
|
|
31
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { BlobStoreAdapter, EmitAdapter, LlmAdapter, MatrixAdapter, SecretsAdapter, UcanAdapter } from '../runtime-context/ambient.js';
|
|
2
|
+
import type { Logger } from '../plugin-api/types.js';
|
|
3
|
+
/** Minimal `Response`-like envelope returned from `mockResponse`. */
|
|
4
|
+
export interface MockResponseLike {
|
|
5
|
+
status: number;
|
|
6
|
+
ok: boolean;
|
|
7
|
+
headers: Record<string, string>;
|
|
8
|
+
json: () => Promise<unknown>;
|
|
9
|
+
text: () => Promise<string>;
|
|
10
|
+
}
|
|
11
|
+
/** Init options accepted by `mockResponse`. */
|
|
12
|
+
export interface MockResponseInit {
|
|
13
|
+
status?: number;
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Build a minimal `Response`-shaped object suitable for `mocks.fetch`
|
|
18
|
+
* handlers. Plugins typically call `response.json()` or `response.text()` —
|
|
19
|
+
* both are covered. Non-2xx statuses set `ok: false`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function mockResponse(body: unknown, init?: MockResponseInit): MockResponseLike;
|
|
22
|
+
/** Overrides accepted by `mockMatrix`. Any unspecified method gets a no-op stub. */
|
|
23
|
+
export type MockMatrixOverrides = Partial<MatrixAdapter>;
|
|
24
|
+
/**
|
|
25
|
+
* Build a `MatrixAdapter` whose default methods are `vi.fn()` stubs.
|
|
26
|
+
* Overrides shadow defaults; the rest keep recorded-no-op behaviour so tests
|
|
27
|
+
* can `expect(matrix.postToRoom).toHaveBeenCalled()`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function mockMatrix(overrides?: MockMatrixOverrides): MatrixAdapter;
|
|
30
|
+
/** Options accepted by `mockLlm`. */
|
|
31
|
+
export interface MockLlmOptions {
|
|
32
|
+
/** A single string or list of strings the fake model returns in order. */
|
|
33
|
+
respondWith?: string | string[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Build an `LlmAdapter` backed by LangChain's official `fakeModel()` helper.
|
|
37
|
+
* The fake model exposes `.calls` and `.callCount` so plugin authors can
|
|
38
|
+
* assert on the message trajectory, plus `.respondWithTools(...)` to script
|
|
39
|
+
* tool-call sequences when needed.
|
|
40
|
+
*
|
|
41
|
+
* Docs: https://docs.langchain.com/oss/javascript/langchain/test/unit-testing
|
|
42
|
+
*/
|
|
43
|
+
export declare function mockLlm(opts?: MockLlmOptions): LlmAdapter;
|
|
44
|
+
/**
|
|
45
|
+
* Build a `SecretsAdapter` whose `getValues` returns the supplied record
|
|
46
|
+
* (filtered to the requested keys). `getIndex` reflects the same record as
|
|
47
|
+
* `{ key: { key } }` entries.
|
|
48
|
+
*/
|
|
49
|
+
export declare function mockSecrets(record?: Record<string, string>): SecretsAdapter;
|
|
50
|
+
/** A no-op event sink that swallows every emit (record-only via `vi.fn`). */
|
|
51
|
+
export declare function mockEmit(): EmitAdapter;
|
|
52
|
+
/**
|
|
53
|
+
* Build a `BlobStoreAdapter` backed by an in-memory Map. The same
|
|
54
|
+
* user-DID-namespaced behaviour as `BlobStoreService` — cross-user reads
|
|
55
|
+
* miss, malformed ids are rejected — without touching `cache-manager`.
|
|
56
|
+
*/
|
|
57
|
+
export declare function mockBlobStore(): BlobStoreAdapter;
|
|
58
|
+
/** A permissive UCAN adapter — every check passes; mintInvocation returns a stub cid. */
|
|
59
|
+
export declare function mockUcan(): UcanAdapter;
|
|
60
|
+
/** A no-op logger suitable for tests. */
|
|
61
|
+
export declare function mockLogger(): Logger;
|
|
62
|
+
/** Public type re-export so authors can type their fetch handlers. */
|
|
63
|
+
export type FetchHandler = (url: string, init?: RequestInit) => unknown | Promise<unknown>;
|
|
64
|
+
//# sourceMappingURL=mocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/testing/mocks.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,aAAa,EACb,cAAc,EACd,WAAW,EACZ,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,MAAM,EAGP,MAAM,wBAAwB,CAAC;AAEhC,qEAAqE;AACrE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED,+CAA+C;AAC/C,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,OAAO,EACb,IAAI,GAAE,gBAAqB,GAC1B,gBAAgB,CAWlB;AAED,oFAAoF;AACpF,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,SAAS,GAAE,mBAAwB,GAAG,aAAa,CAkB7E;AAED,qCAAqC;AACrC,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,IAAI,GAAE,cAAmB,GAAG,UAAU,CAc7D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAClC,cAAc,CAehB;AAED,6EAA6E;AAC7E,wBAAgB,QAAQ,IAAI,WAAW,CAEtC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,gBAAgB,CAsBhD;AAED,yFAAyF;AACzF,wBAAgB,QAAQ,IAAI,WAAW,CAWtC;AAED,yCAAyC;AACzC,wBAAgB,UAAU,IAAI,MAAM,CAMnC;AAED,sEAAsE;AACtE,MAAM,MAAM,YAAY,GAAG,CACzB,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,WAAW,KACf,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
import { AIMessage } from '@langchain/core/messages';
|
|
3
|
+
import { fakeModel } from 'langchain';
|
|
4
|
+
/**
|
|
5
|
+
* Build a minimal `Response`-shaped object suitable for `mocks.fetch`
|
|
6
|
+
* handlers. Plugins typically call `response.json()` or `response.text()` —
|
|
7
|
+
* both are covered. Non-2xx statuses set `ok: false`.
|
|
8
|
+
*/
|
|
9
|
+
export function mockResponse(body, init = {}) {
|
|
10
|
+
const status = init.status ?? 200;
|
|
11
|
+
const headers = init.headers ?? {};
|
|
12
|
+
const text = typeof body === 'string' ? body : JSON.stringify(body ?? null);
|
|
13
|
+
return {
|
|
14
|
+
status,
|
|
15
|
+
ok: status >= 200 && status < 300,
|
|
16
|
+
headers,
|
|
17
|
+
json: async () => (typeof body === 'string' ? JSON.parse(body) : body),
|
|
18
|
+
text: async () => text,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Build a `MatrixAdapter` whose default methods are `vi.fn()` stubs.
|
|
23
|
+
* Overrides shadow defaults; the rest keep recorded-no-op behaviour so tests
|
|
24
|
+
* can `expect(matrix.postToRoom).toHaveBeenCalled()`.
|
|
25
|
+
*/
|
|
26
|
+
export function mockMatrix(overrides = {}) {
|
|
27
|
+
const defaults = {
|
|
28
|
+
postToRoom: vi.fn(async () => 'mock-event-id'),
|
|
29
|
+
getRoomState: vi.fn(async (roomId) => ({
|
|
30
|
+
roomId,
|
|
31
|
+
state: [],
|
|
32
|
+
})),
|
|
33
|
+
getEventById: vi.fn(async (_roomId, eventId) => ({
|
|
34
|
+
eventId,
|
|
35
|
+
type: 'm.room.message',
|
|
36
|
+
content: {},
|
|
37
|
+
})),
|
|
38
|
+
};
|
|
39
|
+
return { ...defaults, ...overrides };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Build an `LlmAdapter` backed by LangChain's official `fakeModel()` helper.
|
|
43
|
+
* The fake model exposes `.calls` and `.callCount` so plugin authors can
|
|
44
|
+
* assert on the message trajectory, plus `.respondWithTools(...)` to script
|
|
45
|
+
* tool-call sequences when needed.
|
|
46
|
+
*
|
|
47
|
+
* Docs: https://docs.langchain.com/oss/javascript/langchain/test/unit-testing
|
|
48
|
+
*/
|
|
49
|
+
export function mockLlm(opts = {}) {
|
|
50
|
+
const responses = opts.respondWith === undefined
|
|
51
|
+
? ['ok']
|
|
52
|
+
: Array.isArray(opts.respondWith)
|
|
53
|
+
? opts.respondWith
|
|
54
|
+
: [opts.respondWith];
|
|
55
|
+
return {
|
|
56
|
+
get: () => {
|
|
57
|
+
const m = fakeModel();
|
|
58
|
+
for (const r of responses)
|
|
59
|
+
m.respond(new AIMessage(r));
|
|
60
|
+
return m;
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Build a `SecretsAdapter` whose `getValues` returns the supplied record
|
|
66
|
+
* (filtered to the requested keys). `getIndex` reflects the same record as
|
|
67
|
+
* `{ key: { key } }` entries.
|
|
68
|
+
*/
|
|
69
|
+
export function mockSecrets(record = {}) {
|
|
70
|
+
return {
|
|
71
|
+
getIndex: async () => {
|
|
72
|
+
const out = {};
|
|
73
|
+
for (const k of Object.keys(record))
|
|
74
|
+
out[k] = { key: k };
|
|
75
|
+
return out;
|
|
76
|
+
},
|
|
77
|
+
getValues: async (_roomId, keys) => {
|
|
78
|
+
const out = {};
|
|
79
|
+
for (const k of keys) {
|
|
80
|
+
if (k in record)
|
|
81
|
+
out[k] = record[k];
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/** A no-op event sink that swallows every emit (record-only via `vi.fn`). */
|
|
88
|
+
export function mockEmit() {
|
|
89
|
+
return { emit: vi.fn() };
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Build a `BlobStoreAdapter` backed by an in-memory Map. The same
|
|
93
|
+
* user-DID-namespaced behaviour as `BlobStoreService` — cross-user reads
|
|
94
|
+
* miss, malformed ids are rejected — without touching `cache-manager`.
|
|
95
|
+
*/
|
|
96
|
+
export function mockBlobStore() {
|
|
97
|
+
const ID_PATTERN = /^blob_[0-9a-f]{16}$/;
|
|
98
|
+
const store = new Map();
|
|
99
|
+
let counter = 0;
|
|
100
|
+
return {
|
|
101
|
+
put: vi.fn(async ({ userDid, name, value }) => {
|
|
102
|
+
if (!userDid)
|
|
103
|
+
throw new Error('BlobStore.put: userDid is required');
|
|
104
|
+
if (typeof value !== 'string' || value.length === 0) {
|
|
105
|
+
throw new Error('BlobStore.put: value must be a non-empty string');
|
|
106
|
+
}
|
|
107
|
+
const id = `blob_${(counter++).toString(16).padStart(16, '0')}`;
|
|
108
|
+
store.set(`blob:${userDid}:${id}`, { name, value });
|
|
109
|
+
return id;
|
|
110
|
+
}),
|
|
111
|
+
get: vi.fn(async ({ userDid, blobId }) => {
|
|
112
|
+
if (!userDid)
|
|
113
|
+
return null;
|
|
114
|
+
if (typeof blobId !== 'string' || !ID_PATTERN.test(blobId))
|
|
115
|
+
return null;
|
|
116
|
+
return store.get(`blob:${userDid}:${blobId}`) ?? null;
|
|
117
|
+
}),
|
|
118
|
+
isValidBlobId: (value) => typeof value === 'string' && ID_PATTERN.test(value),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/** A permissive UCAN adapter — every check passes; mintInvocation returns a stub cid. */
|
|
122
|
+
export function mockUcan() {
|
|
123
|
+
return {
|
|
124
|
+
hasCapability: vi.fn(() => true),
|
|
125
|
+
requireCapability: vi.fn(),
|
|
126
|
+
mintInvocation: vi.fn(async () => 'mock-invocation-cid'),
|
|
127
|
+
resolveServiceDid: vi.fn(async () => 'did:web:example.com'),
|
|
128
|
+
hasSigningKey: vi.fn(() => true),
|
|
129
|
+
createInvocationFromDelegation: vi.fn(async () => ({
|
|
130
|
+
invocation: 'mock-invocation-car',
|
|
131
|
+
})),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/** A no-op logger suitable for tests. */
|
|
135
|
+
export function mockLogger() {
|
|
136
|
+
return {
|
|
137
|
+
log: vi.fn(),
|
|
138
|
+
error: vi.fn(),
|
|
139
|
+
warn: vi.fn(),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ConfigService } from '@nestjs/config';
|
|
2
|
+
/**
|
|
3
|
+
* Typed `ConfigService` double for NestJS module tests. `get` returns the
|
|
4
|
+
* value or undefined; `getOrThrow` throws when the key is absent. The
|
|
5
|
+
* `as unknown as ConfigService` lives at the boundary because the real
|
|
6
|
+
* service exposes additional internal methods (`changes`, `internalConfig`,
|
|
7
|
+
* etc.) that no SUT in this repo consumes.
|
|
8
|
+
*/
|
|
9
|
+
export declare function makeConfig(values?: Record<string, unknown>): ConfigService;
|
|
10
|
+
//# sourceMappingURL=nest-doubles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nest-doubles.d.ts","sourceRoot":"","sources":["../../src/testing/nest-doubles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGpD;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACnC,aAAa,CAUf"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
/**
|
|
3
|
+
* Typed `ConfigService` double for NestJS module tests. `get` returns the
|
|
4
|
+
* value or undefined; `getOrThrow` throws when the key is absent. The
|
|
5
|
+
* `as unknown as ConfigService` lives at the boundary because the real
|
|
6
|
+
* service exposes additional internal methods (`changes`, `internalConfig`,
|
|
7
|
+
* etc.) that no SUT in this repo consumes.
|
|
8
|
+
*/
|
|
9
|
+
export function makeConfig(values = {}) {
|
|
10
|
+
return {
|
|
11
|
+
get: vi.fn((key) => values[key]),
|
|
12
|
+
getOrThrow: vi.fn((key) => {
|
|
13
|
+
if (!(key in values)) {
|
|
14
|
+
throw new Error(`Config "${key}" missing`);
|
|
15
|
+
}
|
|
16
|
+
return values[key];
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emoji.d.ts","sourceRoot":"","sources":["../../src/utils/emoji.ts"],"names":[],"mappings":"AAcA,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAmB9C;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAYhD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Logger } from '@nestjs/common';
|
|
2
|
+
import { emojify as nodeEmojify, unemojify as nodeUnemojify } from 'node-emoji';
|
|
3
|
+
const logger = new Logger('Emoji');
|
|
4
|
+
function toStringSafe(input) {
|
|
5
|
+
if (typeof input === 'string')
|
|
6
|
+
return input;
|
|
7
|
+
try {
|
|
8
|
+
return JSON.stringify(input);
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return String(input);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function emojify(input) {
|
|
15
|
+
if (typeof input !== 'string') {
|
|
16
|
+
logger.debug('emojify received non-string input; returning input as-is.', input);
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
return nodeEmojify(String(input));
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
const str = toStringSafe(input);
|
|
23
|
+
logger.debug(`emojify failed (${err instanceof Error ? err.message : String(err)}); returning input as-is. input=${str}`, input, err);
|
|
24
|
+
return str;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export function unemojify(input) {
|
|
28
|
+
try {
|
|
29
|
+
return nodeUnemojify(input);
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
const str = toStringSafe(input);
|
|
33
|
+
logger.debug(`unemojify failed (${err instanceof Error ? err.message : String(err)}); returning input as-is. input=${str}`, input, err);
|
|
34
|
+
return str;
|
|
35
|
+
}
|
|
36
|
+
}
|