@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,66 @@
|
|
|
1
|
+
import { Cache } from '@nestjs/cache-manager';
|
|
2
|
+
/**
|
|
3
|
+
* BlobStore — short-TTL keyed value store for content that the LLM should
|
|
4
|
+
* never have to relay verbatim.
|
|
5
|
+
*
|
|
6
|
+
* Use case: tools that produce long, opaque, error-prone strings (UCAN
|
|
7
|
+
* invocation/delegation CARs, JWTs, signed envelopes, etc.). The producing
|
|
8
|
+
* tool stores the value here and returns a short hex blobId. A consuming
|
|
9
|
+
* tool (e.g. `sandbox_write_blob`) takes the blobId, looks the value up
|
|
10
|
+
* server-side, and forwards it to its destination — the value never enters
|
|
11
|
+
* the LLM's context.
|
|
12
|
+
*
|
|
13
|
+
* Backed by `@nestjs/cache-manager`'s global Cache (in-memory by default;
|
|
14
|
+
* swap to Redis by changing the CacheModule factory if/when needed).
|
|
15
|
+
*
|
|
16
|
+
* Ownership: blobs are namespaced by issuing user DID. A blob produced for
|
|
17
|
+
* user A cannot be retrieved with user B's DID — the lookup just misses,
|
|
18
|
+
* same as it would for a non-existent ID.
|
|
19
|
+
*/
|
|
20
|
+
export declare class BlobStoreService {
|
|
21
|
+
private readonly cacheManager;
|
|
22
|
+
private readonly logger;
|
|
23
|
+
/** Default TTL when none specified. 1 hour is a sensible cap for anything
|
|
24
|
+
* routed through here — most callers will pass a tighter value (e.g. an
|
|
25
|
+
* invocation's own expiration, ~60s). */
|
|
26
|
+
static readonly DEFAULT_TTL_SECONDS: number;
|
|
27
|
+
/** Hard ceiling enforced regardless of caller request. Protects the cache
|
|
28
|
+
* from being held hostage by a buggy producer. */
|
|
29
|
+
static readonly MAX_TTL_SECONDS: number;
|
|
30
|
+
/** Hex-character ID, prefixed so callers can validate format before
|
|
31
|
+
* paying for a cache lookup. 16 hex chars = 64 bits of entropy — enough
|
|
32
|
+
* to be unguessable for short-lived blobs. */
|
|
33
|
+
static readonly ID_PREFIX = "blob_";
|
|
34
|
+
static readonly ID_PATTERN: RegExp;
|
|
35
|
+
constructor(cacheManager: Cache);
|
|
36
|
+
private cacheKey;
|
|
37
|
+
/**
|
|
38
|
+
* Validate that a string is a well-formed blob ID. Use this in tool
|
|
39
|
+
* input schemas / handlers to reject malformed IDs early — the cache
|
|
40
|
+
* lookup would miss anyway, but failing fast gives a clearer error.
|
|
41
|
+
*/
|
|
42
|
+
isValidBlobId(value: unknown): value is string;
|
|
43
|
+
/**
|
|
44
|
+
* Store a value and return a fresh blobId. The TTL is clamped to
|
|
45
|
+
* `MAX_TTL_SECONDS`. Callers should pass `userDid` from a trusted source
|
|
46
|
+
* (auth middleware / agent state), NOT from LLM-supplied arguments.
|
|
47
|
+
*/
|
|
48
|
+
put(params: {
|
|
49
|
+
userDid: string;
|
|
50
|
+
name: string;
|
|
51
|
+
value: string;
|
|
52
|
+
ttlSeconds?: number;
|
|
53
|
+
}): Promise<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Retrieve a blob by id, scoped to the requesting user. Returns null if
|
|
56
|
+
* the blob doesn't exist, has expired, or belongs to a different user.
|
|
57
|
+
*/
|
|
58
|
+
get(params: {
|
|
59
|
+
userDid: string;
|
|
60
|
+
blobId: string;
|
|
61
|
+
}): Promise<{
|
|
62
|
+
name: string;
|
|
63
|
+
value: string;
|
|
64
|
+
} | null>;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=blob-store.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blob-store.service.d.ts","sourceRoot":"","sources":["../../../src/modules/blob-store/blob-store.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAiB,MAAM,uBAAuB,CAAC;AAI7D;;;;;;;;;;;;;;;;;GAiBG;AACH,qBACa,gBAAgB;IAkBQ,OAAO,CAAC,QAAQ,CAAC,YAAY;IAjBhE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqC;IAE5D;;6CAEyC;IACzC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,SAAW;IAE9C;sDACkD;IAClD,MAAM,CAAC,QAAQ,CAAC,eAAe,SAAgB;IAE/C;;kDAE8C;IAC9C,MAAM,CAAC,QAAQ,CAAC,SAAS,WAAW;IACpC,MAAM,CAAC,QAAQ,CAAC,UAAU,SAAyB;gBAEC,YAAY,EAAE,KAAK;IAEvE,OAAO,CAAC,QAAQ;IAIhB;;;;OAIG;IACH,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM;IAI9C;;;;OAIG;IACG,GAAG,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,MAAM,CAAC;IA6BnB;;;OAGG;IACG,GAAG,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAqBpD"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
var BlobStoreService_1;
|
|
14
|
+
import { Cache, CACHE_MANAGER } from '@nestjs/cache-manager';
|
|
15
|
+
import { Inject, Injectable, Logger } from '@nestjs/common';
|
|
16
|
+
import { randomBytes } from 'node:crypto';
|
|
17
|
+
/**
|
|
18
|
+
* BlobStore — short-TTL keyed value store for content that the LLM should
|
|
19
|
+
* never have to relay verbatim.
|
|
20
|
+
*
|
|
21
|
+
* Use case: tools that produce long, opaque, error-prone strings (UCAN
|
|
22
|
+
* invocation/delegation CARs, JWTs, signed envelopes, etc.). The producing
|
|
23
|
+
* tool stores the value here and returns a short hex blobId. A consuming
|
|
24
|
+
* tool (e.g. `sandbox_write_blob`) takes the blobId, looks the value up
|
|
25
|
+
* server-side, and forwards it to its destination — the value never enters
|
|
26
|
+
* the LLM's context.
|
|
27
|
+
*
|
|
28
|
+
* Backed by `@nestjs/cache-manager`'s global Cache (in-memory by default;
|
|
29
|
+
* swap to Redis by changing the CacheModule factory if/when needed).
|
|
30
|
+
*
|
|
31
|
+
* Ownership: blobs are namespaced by issuing user DID. A blob produced for
|
|
32
|
+
* user A cannot be retrieved with user B's DID — the lookup just misses,
|
|
33
|
+
* same as it would for a non-existent ID.
|
|
34
|
+
*/
|
|
35
|
+
let BlobStoreService = class BlobStoreService {
|
|
36
|
+
static { BlobStoreService_1 = this; }
|
|
37
|
+
cacheManager;
|
|
38
|
+
logger = new Logger(BlobStoreService_1.name);
|
|
39
|
+
/** Default TTL when none specified. 1 hour is a sensible cap for anything
|
|
40
|
+
* routed through here — most callers will pass a tighter value (e.g. an
|
|
41
|
+
* invocation's own expiration, ~60s). */
|
|
42
|
+
static DEFAULT_TTL_SECONDS = 60 * 60;
|
|
43
|
+
/** Hard ceiling enforced regardless of caller request. Protects the cache
|
|
44
|
+
* from being held hostage by a buggy producer. */
|
|
45
|
+
static MAX_TTL_SECONDS = 24 * 60 * 60;
|
|
46
|
+
/** Hex-character ID, prefixed so callers can validate format before
|
|
47
|
+
* paying for a cache lookup. 16 hex chars = 64 bits of entropy — enough
|
|
48
|
+
* to be unguessable for short-lived blobs. */
|
|
49
|
+
static ID_PREFIX = 'blob_';
|
|
50
|
+
static ID_PATTERN = /^blob_[0-9a-f]{16}$/;
|
|
51
|
+
constructor(cacheManager) {
|
|
52
|
+
this.cacheManager = cacheManager;
|
|
53
|
+
}
|
|
54
|
+
cacheKey(userDid, blobId) {
|
|
55
|
+
return `blob:${userDid}:${blobId}`;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Validate that a string is a well-formed blob ID. Use this in tool
|
|
59
|
+
* input schemas / handlers to reject malformed IDs early — the cache
|
|
60
|
+
* lookup would miss anyway, but failing fast gives a clearer error.
|
|
61
|
+
*/
|
|
62
|
+
isValidBlobId(value) {
|
|
63
|
+
return typeof value === 'string' && BlobStoreService_1.ID_PATTERN.test(value);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Store a value and return a fresh blobId. The TTL is clamped to
|
|
67
|
+
* `MAX_TTL_SECONDS`. Callers should pass `userDid` from a trusted source
|
|
68
|
+
* (auth middleware / agent state), NOT from LLM-supplied arguments.
|
|
69
|
+
*/
|
|
70
|
+
async put(params) {
|
|
71
|
+
if (!params.userDid) {
|
|
72
|
+
throw new Error('BlobStore.put: userDid is required');
|
|
73
|
+
}
|
|
74
|
+
if (typeof params.value !== 'string' || params.value.length === 0) {
|
|
75
|
+
throw new Error('BlobStore.put: value must be a non-empty string');
|
|
76
|
+
}
|
|
77
|
+
const ttlSeconds = Math.min(Math.max(1, params.ttlSeconds ?? BlobStoreService_1.DEFAULT_TTL_SECONDS), BlobStoreService_1.MAX_TTL_SECONDS);
|
|
78
|
+
const blobId = `${BlobStoreService_1.ID_PREFIX}${randomBytes(8).toString('hex')}`;
|
|
79
|
+
const key = this.cacheKey(params.userDid, blobId);
|
|
80
|
+
await this.cacheManager.set(key, { name: params.name, value: params.value }, ttlSeconds * 1000);
|
|
81
|
+
this.logger.debug(`[blob-store] put ${blobId} (name=${params.name}, ttl=${ttlSeconds}s, valueLen=${params.value.length}, user=${params.userDid})`);
|
|
82
|
+
return blobId;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Retrieve a blob by id, scoped to the requesting user. Returns null if
|
|
86
|
+
* the blob doesn't exist, has expired, or belongs to a different user.
|
|
87
|
+
*/
|
|
88
|
+
async get(params) {
|
|
89
|
+
if (!params.userDid)
|
|
90
|
+
return null;
|
|
91
|
+
if (!this.isValidBlobId(params.blobId))
|
|
92
|
+
return null;
|
|
93
|
+
const key = this.cacheKey(params.userDid, params.blobId);
|
|
94
|
+
const cached = await this.cacheManager.get(key);
|
|
95
|
+
if (!cached) {
|
|
96
|
+
this.logger.debug(`[blob-store] miss ${params.blobId} (user=${params.userDid})`);
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
this.logger.debug(`[blob-store] hit ${params.blobId} (name=${cached.name}, user=${params.userDid})`);
|
|
100
|
+
return cached;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
BlobStoreService = BlobStoreService_1 = __decorate([
|
|
104
|
+
Injectable(),
|
|
105
|
+
__param(0, Inject(CACHE_MANAGER)),
|
|
106
|
+
__metadata("design:paramtypes", [Cache])
|
|
107
|
+
], BlobStoreService);
|
|
108
|
+
export { BlobStoreService };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/blob-store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Always-on health surface. Both routes are excluded from the auth
|
|
3
|
+
* middleware (see `RuntimeAppModule.AUTH_EXCLUDED_ROUTES`) so probes
|
|
4
|
+
* (Railway, Fly, k8s liveness/readiness) and a friendly landing page
|
|
5
|
+
* can hit the oracle without a UCAN delegation header.
|
|
6
|
+
*/
|
|
7
|
+
export declare class HealthController {
|
|
8
|
+
root(): {
|
|
9
|
+
status: string;
|
|
10
|
+
message: string;
|
|
11
|
+
timestamp: string;
|
|
12
|
+
};
|
|
13
|
+
health(): {
|
|
14
|
+
status: string;
|
|
15
|
+
timestamp: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=health.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.controller.d.ts","sourceRoot":"","sources":["../../../src/modules/health/health.controller.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,qBAEa,gBAAgB;IAG3B,IAAI;;;;;IAUJ,MAAM;;;;CAGP"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Controller, Get } from '@nestjs/common';
|
|
11
|
+
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
|
12
|
+
/**
|
|
13
|
+
* Always-on health surface. Both routes are excluded from the auth
|
|
14
|
+
* middleware (see `RuntimeAppModule.AUTH_EXCLUDED_ROUTES`) so probes
|
|
15
|
+
* (Railway, Fly, k8s liveness/readiness) and a friendly landing page
|
|
16
|
+
* can hit the oracle without a UCAN delegation header.
|
|
17
|
+
*/
|
|
18
|
+
let HealthController = class HealthController {
|
|
19
|
+
root() {
|
|
20
|
+
return {
|
|
21
|
+
status: 'ok',
|
|
22
|
+
message: 'QiForge oracle is running. See /docs for the API.',
|
|
23
|
+
timestamp: new Date().toISOString(),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
health() {
|
|
27
|
+
return { status: 'ok', timestamp: new Date().toISOString() };
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
__decorate([
|
|
31
|
+
Get(),
|
|
32
|
+
ApiOperation({ summary: 'Root — oracle landing.' }),
|
|
33
|
+
__metadata("design:type", Function),
|
|
34
|
+
__metadata("design:paramtypes", []),
|
|
35
|
+
__metadata("design:returntype", void 0)
|
|
36
|
+
], HealthController.prototype, "root", null);
|
|
37
|
+
__decorate([
|
|
38
|
+
Get('health'),
|
|
39
|
+
ApiOperation({ summary: 'Liveness probe.' }),
|
|
40
|
+
__metadata("design:type", Function),
|
|
41
|
+
__metadata("design:paramtypes", []),
|
|
42
|
+
__metadata("design:returntype", void 0)
|
|
43
|
+
], HealthController.prototype, "health", null);
|
|
44
|
+
HealthController = __decorate([
|
|
45
|
+
ApiTags('health'),
|
|
46
|
+
Controller()
|
|
47
|
+
], HealthController);
|
|
48
|
+
export { HealthController };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Always-on health surface registered by `RuntimeAppModule`. Both routes
|
|
3
|
+
* are auth-excluded so probes (load balancers, k8s liveness/readiness,
|
|
4
|
+
* uptime monitors) can hit the oracle without a UCAN delegation header.
|
|
5
|
+
*/
|
|
6
|
+
export declare class HealthModule {
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=health.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.module.d.ts","sourceRoot":"","sources":["../../../src/modules/health/health.module.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,qBAGa,YAAY;CAAG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Module } from '@nestjs/common';
|
|
8
|
+
import { HealthController } from './health.controller.js';
|
|
9
|
+
/**
|
|
10
|
+
* Always-on health surface registered by `RuntimeAppModule`. Both routes
|
|
11
|
+
* are auth-excluded so probes (load balancers, k8s liveness/readiness,
|
|
12
|
+
* uptime monitors) can hit the oracle without a UCAN delegation header.
|
|
13
|
+
*/
|
|
14
|
+
let HealthModule = class HealthModule {
|
|
15
|
+
};
|
|
16
|
+
HealthModule = __decorate([
|
|
17
|
+
Module({
|
|
18
|
+
controllers: [HealthController],
|
|
19
|
+
})
|
|
20
|
+
], HealthModule);
|
|
21
|
+
export { HealthModule };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { SubscriptionModule } from './subscription/subscription.module.js';
|
|
2
|
+
export { SubscriptionMiddleware, SUBSCRIPTION_CREDIT_SINK, } from './subscription/subscription.middleware.js';
|
|
3
|
+
export type { SubscriptionCreditSink } from './subscription/subscription.middleware.js';
|
|
4
|
+
export { ThrottlerModule } from './throttler/throttler.module.js';
|
|
5
|
+
export { SessionsModule } from './sessions/sessions.module.js';
|
|
6
|
+
export { MessagesModule } from './messages/messages.module.js';
|
|
7
|
+
export { WsModule } from './ws/ws.module.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,2CAA2C,CAAC;AACnD,YAAY,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAExF,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { SubscriptionModule } from './subscription/subscription.module.js';
|
|
2
|
+
export { SubscriptionMiddleware, SUBSCRIPTION_CREDIT_SINK, } from './subscription/subscription.middleware.js';
|
|
3
|
+
export { ThrottlerModule } from './throttler/throttler.module.js';
|
|
4
|
+
export { SessionsModule } from './sessions/sessions.module.js';
|
|
5
|
+
export { MessagesModule } from './messages/messages.module.js';
|
|
6
|
+
export { WsModule } from './ws/ws.module.js';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type PreparedRequest } from '../request-preparer.js';
|
|
2
|
+
/**
|
|
3
|
+
* Stub for `UserMatrixSqliteSyncService`. Only the methods the chat
|
|
4
|
+
* pipeline touches are present — `markUserActive`/`markUserInactive`
|
|
5
|
+
* (ref-count contract), `getUserDatabase` (initial sync), and
|
|
6
|
+
* `getUserDatabaseNoSync` (cached connection used by `PostMessageSyncer`).
|
|
7
|
+
*/
|
|
8
|
+
export declare function makeCheckpointSync(): {
|
|
9
|
+
markUserActive: import("vitest").Mock<(...args: any[]) => any>;
|
|
10
|
+
markUserInactive: import("vitest").Mock<(...args: any[]) => any>;
|
|
11
|
+
getUserDatabase: import("vitest").Mock<(...args: any[]) => any>;
|
|
12
|
+
getUserDatabaseNoSync: import("vitest").Mock<(...args: any[]) => any>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Stub for `SessionManagerService` plus its embedded `matrixManger`.
|
|
16
|
+
* Returns `vi.fn()` for every method the chat pipeline calls so tests
|
|
17
|
+
* can target individual methods with `.mockResolvedValueOnce(...)`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function makeSessionManagerStub(): {
|
|
20
|
+
createSession: import("vitest").Mock<(...args: any[]) => any>;
|
|
21
|
+
listSessions: import("vitest").Mock<(...args: any[]) => any>;
|
|
22
|
+
deleteSession: import("vitest").Mock<(...args: any[]) => any>;
|
|
23
|
+
getSession: import("vitest").Mock<(...args: any[]) => any>;
|
|
24
|
+
updateLastProcessedCount: import("vitest").Mock<(...args: any[]) => any>;
|
|
25
|
+
syncSessionSet: import("vitest").Mock<(...args: any[]) => any>;
|
|
26
|
+
matrixManger: {
|
|
27
|
+
sendMessage: import("vitest").Mock<(...args: any[]) => any>;
|
|
28
|
+
getOracleRoomIdWithHomeServer: import("vitest").Mock<(...args: any[]) => any>;
|
|
29
|
+
getDisplayName: import("vitest").Mock<(...args: any[]) => any>;
|
|
30
|
+
getEventById: import("vitest").Mock<(...args: any[]) => any>;
|
|
31
|
+
onMessage: import("vitest").Mock<() => () => undefined>;
|
|
32
|
+
init: import("vitest").Mock<(...args: any[]) => any>;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Build a `PreparedRequest` with sensible defaults that downstream
|
|
37
|
+
* consumers (`SseStreamRunner`, `BatchInvoker`, `MessagesService`) can
|
|
38
|
+
* use as-is. Pass `overrides` to mutate any field per-test.
|
|
39
|
+
*/
|
|
40
|
+
export declare function makePrepared(overrides?: Partial<PreparedRequest>): PreparedRequest;
|
|
41
|
+
//# sourceMappingURL=deps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../../../../src/modules/messages/__test-fixtures__/deps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;;;GAKG;AACH,wBAAgB,kBAAkB;;;;;EAOjC;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB;;;;;;;;;;;;;;;EAiBrC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,SAAS,GAAE,OAAO,CAAC,eAAe,CAAM,GACvC,eAAe,CA6BjB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
/**
|
|
3
|
+
* Stub for `UserMatrixSqliteSyncService`. Only the methods the chat
|
|
4
|
+
* pipeline touches are present — `markUserActive`/`markUserInactive`
|
|
5
|
+
* (ref-count contract), `getUserDatabase` (initial sync), and
|
|
6
|
+
* `getUserDatabaseNoSync` (cached connection used by `PostMessageSyncer`).
|
|
7
|
+
*/
|
|
8
|
+
export function makeCheckpointSync() {
|
|
9
|
+
return {
|
|
10
|
+
markUserActive: vi.fn(),
|
|
11
|
+
markUserInactive: vi.fn(),
|
|
12
|
+
getUserDatabase: vi.fn(),
|
|
13
|
+
getUserDatabaseNoSync: vi.fn(),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Stub for `SessionManagerService` plus its embedded `matrixManger`.
|
|
18
|
+
* Returns `vi.fn()` for every method the chat pipeline calls so tests
|
|
19
|
+
* can target individual methods with `.mockResolvedValueOnce(...)`.
|
|
20
|
+
*/
|
|
21
|
+
export function makeSessionManagerStub() {
|
|
22
|
+
return {
|
|
23
|
+
createSession: vi.fn(),
|
|
24
|
+
listSessions: vi.fn(),
|
|
25
|
+
deleteSession: vi.fn(),
|
|
26
|
+
getSession: vi.fn(),
|
|
27
|
+
updateLastProcessedCount: vi.fn(),
|
|
28
|
+
syncSessionSet: vi.fn(),
|
|
29
|
+
matrixManger: {
|
|
30
|
+
sendMessage: vi.fn().mockResolvedValue(undefined),
|
|
31
|
+
getOracleRoomIdWithHomeServer: vi.fn(),
|
|
32
|
+
getDisplayName: vi.fn(),
|
|
33
|
+
getEventById: vi.fn(),
|
|
34
|
+
onMessage: vi.fn(() => () => undefined),
|
|
35
|
+
init: vi.fn().mockResolvedValue(undefined),
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Build a `PreparedRequest` with sensible defaults that downstream
|
|
41
|
+
* consumers (`SseStreamRunner`, `BatchInvoker`, `MessagesService`) can
|
|
42
|
+
* use as-is. Pass `overrides` to mutate any field per-test.
|
|
43
|
+
*/
|
|
44
|
+
export function makePrepared(overrides = {}) {
|
|
45
|
+
const baseSession = {
|
|
46
|
+
sessionId: 'sess-1',
|
|
47
|
+
lastUpdatedAt: '2026-05-21T00:00:00.000Z',
|
|
48
|
+
createdAt: '2026-05-20T00:00:00.000Z',
|
|
49
|
+
oracleName: 'TestOracle',
|
|
50
|
+
oracleDid: 'did:ixo:oracle',
|
|
51
|
+
oracleEntityDid: 'did:ixo:oracle-entity',
|
|
52
|
+
lastProcessedCount: 0,
|
|
53
|
+
roomId: '!room:home',
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
sessionId: 'sess-1',
|
|
57
|
+
langchainThreadId: 'sess-1',
|
|
58
|
+
roomId: '!room:home',
|
|
59
|
+
homeServerName: 'home.server',
|
|
60
|
+
requestId: 'req-1',
|
|
61
|
+
runnableConfig: {
|
|
62
|
+
configurable: {
|
|
63
|
+
thread_id: 'sess-1',
|
|
64
|
+
requestId: 'req-1',
|
|
65
|
+
sessionId: 'sess-1',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
targetSession: baseSession,
|
|
69
|
+
timezone: 'UTC',
|
|
70
|
+
currentTime: '2026-05-21T00:00:00Z',
|
|
71
|
+
...overrides,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { StreamEvent } from '@langchain/core/tracers/log_stream';
|
|
2
|
+
/**
|
|
3
|
+
* Minimal `CompiledMainAgent` surface used by `SseStreamRunner` and the
|
|
4
|
+
* batch invoker — `streamEvents` (async iterable of `StreamEvent`) and
|
|
5
|
+
* `invoke` (single result). The runner only reads `event`, `data`,
|
|
6
|
+
* `run_id`, and `name` from each yielded event, so the fixture pins a
|
|
7
|
+
* `StreamEvent[]` and replays them in order.
|
|
8
|
+
*/
|
|
9
|
+
export interface FakeAgent {
|
|
10
|
+
streamEvents: (input: unknown, cfg: unknown) => AsyncIterable<StreamEvent>;
|
|
11
|
+
invoke: (input: unknown, cfg: unknown) => Promise<{
|
|
12
|
+
messages: unknown[];
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Build a fake agent that yields the provided events one-by-one with a
|
|
17
|
+
* microtask boundary between each. The boundary gives callers a chance
|
|
18
|
+
* to call `abortController.abort()` between events and observe the
|
|
19
|
+
* runner break out of its for-await loop on the next iteration.
|
|
20
|
+
*/
|
|
21
|
+
export declare function makeFakeAgent(events: StreamEvent[]): FakeAgent;
|
|
22
|
+
/**
|
|
23
|
+
* Build a fake agent whose stream throws when consumed. Used for the
|
|
24
|
+
* non-abort error branch test.
|
|
25
|
+
*/
|
|
26
|
+
export declare function makeThrowingFakeAgent(error: Error): FakeAgent;
|
|
27
|
+
//# sourceMappingURL=fake-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake-agent.d.ts","sourceRoot":"","sources":["../../../../src/modules/messages/__test-fixtures__/fake-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,KAAK,aAAa,CAAC,WAAW,CAAC,CAAC;IAC3E,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC;QAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC,CAAC;CAC5E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,CAgB9D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,CAc7D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build a fake agent that yields the provided events one-by-one with a
|
|
3
|
+
* microtask boundary between each. The boundary gives callers a chance
|
|
4
|
+
* to call `abortController.abort()` between events and observe the
|
|
5
|
+
* runner break out of its for-await loop on the next iteration.
|
|
6
|
+
*/
|
|
7
|
+
export function makeFakeAgent(events) {
|
|
8
|
+
return {
|
|
9
|
+
streamEvents() {
|
|
10
|
+
return (async function* () {
|
|
11
|
+
for (const evt of events) {
|
|
12
|
+
// Microtask boundary — lets tests call `abortController.abort()`
|
|
13
|
+
// between events and observe the runner break out on the next loop.
|
|
14
|
+
await Promise.resolve();
|
|
15
|
+
yield evt;
|
|
16
|
+
}
|
|
17
|
+
})();
|
|
18
|
+
},
|
|
19
|
+
async invoke() {
|
|
20
|
+
return { messages: [] };
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build a fake agent whose stream throws when consumed. Used for the
|
|
26
|
+
* non-abort error branch test.
|
|
27
|
+
*/
|
|
28
|
+
export function makeThrowingFakeAgent(error) {
|
|
29
|
+
return {
|
|
30
|
+
streamEvents() {
|
|
31
|
+
return (async function* () {
|
|
32
|
+
await Promise.resolve();
|
|
33
|
+
throw error;
|
|
34
|
+
yield undefined;
|
|
35
|
+
})();
|
|
36
|
+
},
|
|
37
|
+
async invoke() {
|
|
38
|
+
return { messages: [] };
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
/**
|
|
3
|
+
* Structurally-typed `express.Response` test double. Captures every
|
|
4
|
+
* `write` chunk into a buffer so tests can assert on the SSE wire
|
|
5
|
+
* format directly. Inherits from `EventEmitter` so `res.on('close', …)`
|
|
6
|
+
* registrations from the SUT can be triggered via `emit('close')`.
|
|
7
|
+
*
|
|
8
|
+
* Not declared as `implements Pick<Response, ...>` because Express's
|
|
9
|
+
* method signatures return `Response<...>` (not `this`), which the
|
|
10
|
+
* chainable methods here can't satisfy. The type contract lives at the
|
|
11
|
+
* SUT injection site (`as unknown as Response`), where the partial-mock
|
|
12
|
+
* intent is surface-visible.
|
|
13
|
+
*/
|
|
14
|
+
export declare class FakeResponse extends EventEmitter {
|
|
15
|
+
writes: string[];
|
|
16
|
+
headersSent: boolean;
|
|
17
|
+
writableEnded: boolean;
|
|
18
|
+
setHeaders: Record<string, string>;
|
|
19
|
+
statusCode: number;
|
|
20
|
+
jsonBody: unknown;
|
|
21
|
+
set(field: Record<string, string>): this;
|
|
22
|
+
set(field: string, value?: string | string[]): this;
|
|
23
|
+
flushHeaders(): void;
|
|
24
|
+
write(chunk: string | Buffer): boolean;
|
|
25
|
+
end(): this;
|
|
26
|
+
status(code: number): this;
|
|
27
|
+
json(body: unknown): this;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=fake-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake-response.d.ts","sourceRoot":"","sources":["../../../../src/modules/messages/__test-fixtures__/fake-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,qBAAa,YAAa,SAAQ,YAAY;IACrC,MAAM,EAAE,MAAM,EAAE,CAAM;IACtB,WAAW,UAAS;IACpB,aAAa,UAAS;IACtB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;IACxC,UAAU,SAAO;IACjB,QAAQ,EAAE,OAAO,CAAC;IAEzB,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IACxC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI;IAcnD,YAAY,IAAI,IAAI;IAIpB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO;IAQtC,GAAG,IAAI,IAAI;IAKX,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK1B,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;CAK1B"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
/**
|
|
3
|
+
* Structurally-typed `express.Response` test double. Captures every
|
|
4
|
+
* `write` chunk into a buffer so tests can assert on the SSE wire
|
|
5
|
+
* format directly. Inherits from `EventEmitter` so `res.on('close', …)`
|
|
6
|
+
* registrations from the SUT can be triggered via `emit('close')`.
|
|
7
|
+
*
|
|
8
|
+
* Not declared as `implements Pick<Response, ...>` because Express's
|
|
9
|
+
* method signatures return `Response<...>` (not `this`), which the
|
|
10
|
+
* chainable methods here can't satisfy. The type contract lives at the
|
|
11
|
+
* SUT injection site (`as unknown as Response`), where the partial-mock
|
|
12
|
+
* intent is surface-visible.
|
|
13
|
+
*/
|
|
14
|
+
export class FakeResponse extends EventEmitter {
|
|
15
|
+
writes = [];
|
|
16
|
+
headersSent = false;
|
|
17
|
+
writableEnded = false;
|
|
18
|
+
setHeaders = {};
|
|
19
|
+
statusCode = 200;
|
|
20
|
+
jsonBody;
|
|
21
|
+
set(field, value) {
|
|
22
|
+
if (typeof field === 'string') {
|
|
23
|
+
if (value !== undefined) {
|
|
24
|
+
this.setHeaders[field] = Array.isArray(value)
|
|
25
|
+
? value.join(', ')
|
|
26
|
+
: value;
|
|
27
|
+
}
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
this.setHeaders = { ...this.setHeaders, ...field };
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
flushHeaders() {
|
|
34
|
+
this.headersSent = true;
|
|
35
|
+
}
|
|
36
|
+
write(chunk) {
|
|
37
|
+
if (this.writableEnded)
|
|
38
|
+
return false;
|
|
39
|
+
this.writes.push(typeof chunk === 'string' ? chunk : chunk.toString('utf8'));
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
end() {
|
|
43
|
+
this.writableEnded = true;
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
status(code) {
|
|
47
|
+
this.statusCode = code;
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
json(body) {
|
|
51
|
+
this.jsonBody = body;
|
|
52
|
+
this.writableEnded = true;
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
}
|