@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,582 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview UCAN service for Oracle
|
|
3
|
+
*
|
|
4
|
+
* Handles:
|
|
5
|
+
* 1. UCAN validation for MCP tool invocations (client → oracle)
|
|
6
|
+
* 2. UCAN invocation creation for downstream services (oracle → sandbox, etc.)
|
|
7
|
+
* 3. Ed25519 signing key management (stored in memory at startup)
|
|
8
|
+
* 4. Service DID resolution via did:web (/.well-known/did.json)
|
|
9
|
+
* 5. User delegation caching (keyed by user DID)
|
|
10
|
+
*/
|
|
11
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
12
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
14
|
+
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;
|
|
15
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16
|
+
};
|
|
17
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
18
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
19
|
+
};
|
|
20
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
21
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
22
|
+
};
|
|
23
|
+
var UcanService_1;
|
|
24
|
+
import { CACHE_MANAGER } from '@nestjs/cache-manager';
|
|
25
|
+
import { Inject, Injectable, Logger, } from '@nestjs/common';
|
|
26
|
+
// `ConfigService` must be a VALUE import — Nest needs the constructor in
|
|
27
|
+
// the compiled `design:paramtypes` metadata to resolve the DI graph.
|
|
28
|
+
// A `type` import erases it to `Function` and DI fails at boot.
|
|
29
|
+
import { ConfigService } from '@nestjs/config';
|
|
30
|
+
import { buildRequiredCapability, createMCPUCANConfig, loadUCANConfigFromEnv, requiresUCANAuth, } from './ucan.config.js';
|
|
31
|
+
import { signerFromMnemonic, parseDelegation, createInvocation, serializeInvocation, } from '@ixo/ucan';
|
|
32
|
+
class InMemoryInvocationStore {
|
|
33
|
+
store = new Map();
|
|
34
|
+
cleanupInterval = null;
|
|
35
|
+
defaultTtlMs;
|
|
36
|
+
constructor(options = {}) {
|
|
37
|
+
this.defaultTtlMs = options.defaultTtlMs ?? 24 * 60 * 60 * 1000;
|
|
38
|
+
const cleanupIntervalMs = options.cleanupIntervalMs ?? 60 * 60 * 1000;
|
|
39
|
+
this.cleanupInterval = setInterval(() => {
|
|
40
|
+
void this.cleanup();
|
|
41
|
+
}, cleanupIntervalMs);
|
|
42
|
+
if (this.cleanupInterval.unref) {
|
|
43
|
+
this.cleanupInterval.unref();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async has(cid) {
|
|
47
|
+
const expiry = this.store.get(cid);
|
|
48
|
+
if (!expiry)
|
|
49
|
+
return false;
|
|
50
|
+
if (Date.now() > expiry) {
|
|
51
|
+
this.store.delete(cid);
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
async add(cid, ttlMs) {
|
|
57
|
+
const ttl = ttlMs ?? this.defaultTtlMs;
|
|
58
|
+
this.store.set(cid, Date.now() + ttl);
|
|
59
|
+
}
|
|
60
|
+
async cleanup() {
|
|
61
|
+
const now = Date.now();
|
|
62
|
+
for (const [cid, expiry] of this.store.entries()) {
|
|
63
|
+
if (now > expiry) {
|
|
64
|
+
this.store.delete(cid);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
destroy() {
|
|
69
|
+
if (this.cleanupInterval) {
|
|
70
|
+
clearInterval(this.cleanupInterval);
|
|
71
|
+
this.cleanupInterval = null;
|
|
72
|
+
}
|
|
73
|
+
this.store.clear();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function createIxoDIDResolver(config) {
|
|
77
|
+
const DID_DOCUMENT_QUERY = `
|
|
78
|
+
query GetDIDDocument($id: String!) {
|
|
79
|
+
iids(filter: { id: { equalTo: $id } }) {
|
|
80
|
+
nodes {
|
|
81
|
+
id
|
|
82
|
+
verificationMethod
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
87
|
+
return async (did) => {
|
|
88
|
+
if (!did.startsWith('did:ixo:')) {
|
|
89
|
+
return {
|
|
90
|
+
error: {
|
|
91
|
+
name: 'DIDKeyResolutionError',
|
|
92
|
+
did,
|
|
93
|
+
message: `Cannot resolve ${did}: not a did:ixo identifier`,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
const response = await fetch(config.indexerUrl, {
|
|
99
|
+
method: 'POST',
|
|
100
|
+
headers: { 'Content-Type': 'application/json' },
|
|
101
|
+
body: JSON.stringify({
|
|
102
|
+
query: DID_DOCUMENT_QUERY,
|
|
103
|
+
variables: { id: did },
|
|
104
|
+
}),
|
|
105
|
+
});
|
|
106
|
+
if (!response.ok) {
|
|
107
|
+
return {
|
|
108
|
+
error: {
|
|
109
|
+
name: 'DIDKeyResolutionError',
|
|
110
|
+
did,
|
|
111
|
+
message: `Failed to fetch DID document: HTTP ${response.status}`,
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const data = (await response.json());
|
|
116
|
+
if (data.errors && data.errors.length > 0) {
|
|
117
|
+
return {
|
|
118
|
+
error: {
|
|
119
|
+
name: 'DIDKeyResolutionError',
|
|
120
|
+
did,
|
|
121
|
+
message: `GraphQL error: ${data.errors[0]?.message ?? 'Unknown error'}`,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
const didDoc = data.data?.iids?.nodes?.[0];
|
|
126
|
+
if (!didDoc) {
|
|
127
|
+
return {
|
|
128
|
+
error: {
|
|
129
|
+
name: 'DIDKeyResolutionError',
|
|
130
|
+
did,
|
|
131
|
+
message: `DID document not found for ${did}`,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
const keys = [];
|
|
136
|
+
for (const vm of didDoc.verificationMethod || []) {
|
|
137
|
+
if (vm.type.includes('Ed25519') &&
|
|
138
|
+
vm.publicKeyMultibase?.startsWith('z')) {
|
|
139
|
+
keys.push(`did:key:${vm.publicKeyMultibase}`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (keys.length === 0) {
|
|
143
|
+
return {
|
|
144
|
+
error: {
|
|
145
|
+
name: 'DIDKeyResolutionError',
|
|
146
|
+
did,
|
|
147
|
+
message: `No valid Ed25519 verification methods found for ${did}`,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
return { ok: keys };
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
return {
|
|
155
|
+
error: {
|
|
156
|
+
name: 'DIDKeyResolutionError',
|
|
157
|
+
did,
|
|
158
|
+
message: `Failed to resolve ${did}: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function createCompositeDIDResolver(resolvers) {
|
|
165
|
+
return async (did) => {
|
|
166
|
+
for (const resolver of resolvers) {
|
|
167
|
+
const result = await resolver(did);
|
|
168
|
+
if ('ok' in result) {
|
|
169
|
+
return result;
|
|
170
|
+
}
|
|
171
|
+
if (result.error.message.includes('not a did:')) {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
error: {
|
|
178
|
+
name: 'DIDKeyResolutionError',
|
|
179
|
+
did,
|
|
180
|
+
message: `No resolver could handle ${did}`,
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function createMCPResourceURI(oracleDid, serverName, toolName) {
|
|
186
|
+
return `ixo:oracle:${oracleDid}:mcp/${serverName}/${toolName}`;
|
|
187
|
+
}
|
|
188
|
+
// ============================================================================
|
|
189
|
+
// Constants
|
|
190
|
+
// ============================================================================
|
|
191
|
+
const DELEGATION_CACHE_PREFIX = 'ucan_delegation_';
|
|
192
|
+
const INVOCATION_CACHE_PREFIX = 'ucan_invocation_';
|
|
193
|
+
const MAX_INVOCATION_TTL_SECONDS = 3600; // 1 hour max
|
|
194
|
+
let UcanService = UcanService_1 = class UcanService {
|
|
195
|
+
configService;
|
|
196
|
+
cacheManager;
|
|
197
|
+
logger = new Logger(UcanService_1.name);
|
|
198
|
+
config;
|
|
199
|
+
invocationStore;
|
|
200
|
+
didResolver;
|
|
201
|
+
signingMnemonic = null;
|
|
202
|
+
oracleDid = null;
|
|
203
|
+
serviceDidCache = new Map();
|
|
204
|
+
constructor(configService, cacheManager) {
|
|
205
|
+
this.configService = configService;
|
|
206
|
+
this.cacheManager = cacheManager;
|
|
207
|
+
this.config = this.loadConfig();
|
|
208
|
+
this.invocationStore = new InMemoryInvocationStore({
|
|
209
|
+
defaultTtlMs: 24 * 60 * 60 * 1000,
|
|
210
|
+
cleanupIntervalMs: 60 * 60 * 1000,
|
|
211
|
+
});
|
|
212
|
+
const indexerUrl = this.configService.get('BLOCKSYNC_GRAPHQL_URL');
|
|
213
|
+
this.didResolver = this.createDIDResolver(indexerUrl);
|
|
214
|
+
this.logger.log('UCAN service initialized');
|
|
215
|
+
this.logger.log(`Oracle DID: ${this.config.oracleDid}`);
|
|
216
|
+
this.logger.log(`Root issuers: ${this.config.rootIssuers.join(', ')}`);
|
|
217
|
+
this.logger.log(`Protected MCP servers: ${Object.keys(this.config.requirements).join(', ') || 'none'}`);
|
|
218
|
+
}
|
|
219
|
+
onModuleDestroy() {
|
|
220
|
+
if (this.invocationStore instanceof InMemoryInvocationStore) {
|
|
221
|
+
this.invocationStore.destroy();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
loadConfig() {
|
|
225
|
+
const envConfig = loadUCANConfigFromEnv();
|
|
226
|
+
const oracleDid = this.configService.get('ORACLE_ENTITY_DID') ||
|
|
227
|
+
envConfig.oracleDid;
|
|
228
|
+
const rootIssuers = envConfig.rootIssuers.length > 0 ? envConfig.rootIssuers : [oracleDid];
|
|
229
|
+
return createMCPUCANConfig(oracleDid, rootIssuers, {});
|
|
230
|
+
}
|
|
231
|
+
createDIDResolver(indexerUrl) {
|
|
232
|
+
const resolvers = [];
|
|
233
|
+
if (indexerUrl) {
|
|
234
|
+
resolvers.push(createIxoDIDResolver({ indexerUrl }));
|
|
235
|
+
}
|
|
236
|
+
const didKeyResolver = async (did) => {
|
|
237
|
+
if (did.startsWith('did:key:')) {
|
|
238
|
+
return { ok: [did] };
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
error: {
|
|
242
|
+
name: 'DIDKeyResolutionError',
|
|
243
|
+
did,
|
|
244
|
+
message: 'Not a did:key',
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
resolvers.push(didKeyResolver);
|
|
249
|
+
return createCompositeDIDResolver(resolvers);
|
|
250
|
+
}
|
|
251
|
+
// ============================================================================
|
|
252
|
+
// Signing key management
|
|
253
|
+
// ============================================================================
|
|
254
|
+
/**
|
|
255
|
+
* Store the Ed25519 signing mnemonic in memory (called once at startup).
|
|
256
|
+
* Uses the same mnemonic from setupClaimSigningMnemonics.
|
|
257
|
+
*/
|
|
258
|
+
setSigningMnemonic(mnemonic, did) {
|
|
259
|
+
this.signingMnemonic = mnemonic;
|
|
260
|
+
this.oracleDid = did;
|
|
261
|
+
this.logger.log(`[UCAN] Signing mnemonic stored for ${did}`);
|
|
262
|
+
}
|
|
263
|
+
hasSigningKey() {
|
|
264
|
+
return this.signingMnemonic !== null;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Read the in-memory signing mnemonic. Other runtime consumers (e.g. the
|
|
268
|
+
* credits plugin's claim-signing path) call this to avoid re-fetching and
|
|
269
|
+
* re-decrypting it from the oracle's Matrix account room on every claim.
|
|
270
|
+
* Returns `null` when boot hasn't populated it yet.
|
|
271
|
+
*/
|
|
272
|
+
getSigningMnemonic() {
|
|
273
|
+
return this.signingMnemonic;
|
|
274
|
+
}
|
|
275
|
+
// ============================================================================
|
|
276
|
+
// User delegation caching
|
|
277
|
+
// ============================================================================
|
|
278
|
+
/**
|
|
279
|
+
* Cache a raw UCAN delegation string for a user.
|
|
280
|
+
* Called by auth-header.middleware after successful validation.
|
|
281
|
+
*/
|
|
282
|
+
async cacheDelegation(userDid, rawDelegation, expirationUnix) {
|
|
283
|
+
const ttlMs = expirationUnix
|
|
284
|
+
? expirationUnix * 1000 - Date.now()
|
|
285
|
+
: 7 * 24 * 60 * 60 * 1000; // 7 days default
|
|
286
|
+
if (ttlMs <= 0) {
|
|
287
|
+
this.logger.warn(`[UCAN] Delegation for ${userDid} already expired`);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
await this.cacheManager.set(`${DELEGATION_CACHE_PREFIX}${userDid}`, rawDelegation, ttlMs);
|
|
291
|
+
this.logger.debug(`[UCAN] Cached delegation for ${userDid} (TTL: ${Math.round(ttlMs / 1000)}s)`);
|
|
292
|
+
}
|
|
293
|
+
async getCachedDelegation(userDid) {
|
|
294
|
+
const cached = await this.cacheManager.get(`${DELEGATION_CACHE_PREFIX}${userDid}`);
|
|
295
|
+
return cached ?? null;
|
|
296
|
+
}
|
|
297
|
+
// ============================================================================
|
|
298
|
+
// Service DID resolution (did:web via /.well-known/did.json)
|
|
299
|
+
// ============================================================================
|
|
300
|
+
/**
|
|
301
|
+
* Resolve a service URL to its did:web DID.
|
|
302
|
+
* Fetches /.well-known/did.json from the service's domain and caches the result.
|
|
303
|
+
*/
|
|
304
|
+
async resolveServiceDid(serviceUrl) {
|
|
305
|
+
try {
|
|
306
|
+
const url = new URL(serviceUrl);
|
|
307
|
+
const origin = url.origin;
|
|
308
|
+
const cached = this.serviceDidCache.get(origin);
|
|
309
|
+
if (cached)
|
|
310
|
+
return cached;
|
|
311
|
+
const didDocUrl = `${origin}/.well-known/did.json`;
|
|
312
|
+
const response = await fetch(didDocUrl);
|
|
313
|
+
if (!response.ok) {
|
|
314
|
+
this.logger.warn(`[UCAN] Failed to fetch DID document from ${didDocUrl}: HTTP ${response.status}`);
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
const doc = (await response.json());
|
|
318
|
+
if (!doc.id) {
|
|
319
|
+
this.logger.warn(`[UCAN] DID document at ${didDocUrl} has no id field`);
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
this.serviceDidCache.set(origin, doc.id);
|
|
323
|
+
this.logger.log(`[UCAN] Resolved service DID for ${origin}: ${doc.id}`);
|
|
324
|
+
return doc.id;
|
|
325
|
+
}
|
|
326
|
+
catch (error) {
|
|
327
|
+
this.logger.warn(`[UCAN] Failed to resolve service DID for ${serviceUrl}: ${error instanceof Error ? error.message : String(error)}`);
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
// ============================================================================
|
|
332
|
+
// Service invocation creation (oracle → downstream service)
|
|
333
|
+
// ============================================================================
|
|
334
|
+
/**
|
|
335
|
+
* Create a serialized UCAN invocation for calling a downstream service.
|
|
336
|
+
* The invocation embeds the user's delegation as proof, forming:
|
|
337
|
+
* user (delegation.iss) → oracle (invocation.iss) → service (invocation.aud)
|
|
338
|
+
*
|
|
339
|
+
* @param serviceUrl - URL of the downstream service (used to resolve did:web)
|
|
340
|
+
* @param userDid - The user's DID (used to look up cached delegation)
|
|
341
|
+
* @param resource - The capability resource URI (e.g., 'ixo:sandbox')
|
|
342
|
+
* @returns Base64-encoded invocation CAR, or null if unavailable
|
|
343
|
+
*/
|
|
344
|
+
async createServiceInvocation(serviceUrl, userDid, resource = 'ixo:sandbox') {
|
|
345
|
+
const serviceDid = await this.resolveServiceDid(serviceUrl);
|
|
346
|
+
if (!serviceDid) {
|
|
347
|
+
this.logger.debug(`[UCAN] Could not resolve service DID for ${serviceUrl}`);
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
return this.mintInvocationForServiceDid(userDid, serviceDid, resource);
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Mint a UCAN invocation when the downstream service DID is already known
|
|
354
|
+
* (e.g. a plugin called `resolveServiceDid` separately and now wants to
|
|
355
|
+
* mint with the resolved DID directly). Same semantics as
|
|
356
|
+
* `createServiceInvocation` minus the URL → DID lookup.
|
|
357
|
+
*
|
|
358
|
+
* `opts.skipCache` — bypass the invocation cache. Required for downstream
|
|
359
|
+
* services that enforce single-use replay protection per invocation CID
|
|
360
|
+
* (e.g. composio-worker). Without this flag a cached CID would be reused
|
|
361
|
+
* across requests and rejected as a replay.
|
|
362
|
+
*/
|
|
363
|
+
async mintInvocationForServiceDid(userDid, serviceDid, resource = 'ixo:sandbox', opts = {}) {
|
|
364
|
+
if (!this.signingMnemonic || !this.oracleDid) {
|
|
365
|
+
this.logger.debug('[UCAN] No signing key available, skipping invocation');
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
const rawDelegation = await this.getCachedDelegation(userDid);
|
|
369
|
+
if (!rawDelegation) {
|
|
370
|
+
this.logger.debug(`[UCAN] No cached delegation for ${userDid}, skipping invocation`);
|
|
371
|
+
return null;
|
|
372
|
+
}
|
|
373
|
+
// Check invocation cache (skipped for replay-protected services)
|
|
374
|
+
const cacheKey = `${INVOCATION_CACHE_PREFIX}${userDid}:${serviceDid}`;
|
|
375
|
+
if (!opts.skipCache) {
|
|
376
|
+
const cached = await this.cacheManager.get(cacheKey);
|
|
377
|
+
if (cached && cached.expiresAt > Date.now() / 1000) {
|
|
378
|
+
this.logger.debug(`[UCAN] Using cached invocation for ${userDid} → ${serviceDid}`);
|
|
379
|
+
return cached.invocation;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
try {
|
|
383
|
+
const { signer } = await signerFromMnemonic(this.signingMnemonic, this.oracleDid);
|
|
384
|
+
const delegation = await parseDelegation(rawDelegation);
|
|
385
|
+
// Invocation TTL = min(1 hour, delegation expiration), whichever comes first
|
|
386
|
+
const nowSeconds = Math.floor(Date.now() / 1000);
|
|
387
|
+
const delegationExp = typeof delegation.expiration === 'number' &&
|
|
388
|
+
isFinite(delegation.expiration)
|
|
389
|
+
? delegation.expiration
|
|
390
|
+
: null;
|
|
391
|
+
const maxExp = nowSeconds + MAX_INVOCATION_TTL_SECONDS;
|
|
392
|
+
const expirationSeconds = delegationExp
|
|
393
|
+
? Math.min(maxExp, delegationExp)
|
|
394
|
+
: maxExp;
|
|
395
|
+
const invocation = await createInvocation({
|
|
396
|
+
issuer: signer,
|
|
397
|
+
audience: serviceDid,
|
|
398
|
+
capability: { can: '*', with: resource },
|
|
399
|
+
proofs: [delegation],
|
|
400
|
+
expiration: expirationSeconds,
|
|
401
|
+
});
|
|
402
|
+
const serialized = await serializeInvocation(invocation);
|
|
403
|
+
// Cache the invocation for its full lifetime (unless caller opted out)
|
|
404
|
+
const ttlMs = (expirationSeconds - nowSeconds) * 1000;
|
|
405
|
+
if (!opts.skipCache && ttlMs > 0) {
|
|
406
|
+
await this.cacheManager.set(cacheKey, { invocation: serialized, expiresAt: expirationSeconds }, ttlMs);
|
|
407
|
+
this.logger.debug(`[UCAN] Cached invocation for ${userDid} → ${serviceDid} (TTL: ${expirationSeconds - nowSeconds}s)`);
|
|
408
|
+
}
|
|
409
|
+
this.logger.debug(`[UCAN] Created invocation: iss=${this.oracleDid} aud=${serviceDid} user=${userDid}`);
|
|
410
|
+
return serialized;
|
|
411
|
+
}
|
|
412
|
+
catch (error) {
|
|
413
|
+
this.logger.warn(`[UCAN] Failed to create service invocation: ${error instanceof Error ? error.message : String(error)}`);
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Mint a UCAN invocation from a directly-supplied delegation CAR (rather
|
|
419
|
+
* than the per-user cached one used by {@link createServiceInvocation}).
|
|
420
|
+
*
|
|
421
|
+
* Use this when the caller already holds the user's signed delegation in
|
|
422
|
+
* hand — typically because they read it from a flow's Y.Doc by CID — and
|
|
423
|
+
* wants to mint a freshly-targeted invocation against a specific service
|
|
424
|
+
* route. The delegation MUST already name this oracle as its audience; the
|
|
425
|
+
* call fails loudly if it doesn't, since a delegation pointing at someone
|
|
426
|
+
* else can't legitimately be re-used by us.
|
|
427
|
+
*
|
|
428
|
+
* Each protected service call should use a freshly minted invocation —
|
|
429
|
+
* services typically track invocation CIDs to enforce single-use replay
|
|
430
|
+
* protection. Re-call this method before every protected request.
|
|
431
|
+
*
|
|
432
|
+
* @param delegationCar Base64-encoded delegation CAR (the user → oracle
|
|
433
|
+
* delegation signed in the editor)
|
|
434
|
+
* @param serviceUrl URL of the target service — used to resolve the did:web
|
|
435
|
+
* audience by fetching `<serviceUrl>/.well-known/did.json`
|
|
436
|
+
* @param capability The exact capability the service requires for this
|
|
437
|
+
* route, e.g. `{ can: 'service/action', with: 'ixo:service' }`. Defined
|
|
438
|
+
* by the target service; must match what its requireAuth middleware
|
|
439
|
+
* expects.
|
|
440
|
+
* @param options.maxTtlSeconds Max invocation lifetime; clamped to the
|
|
441
|
+
* delegation's own expiration. Default 60s — invocations are typically
|
|
442
|
+
* single-use so a long TTL is unnecessary and just widens the replay
|
|
443
|
+
* window.
|
|
444
|
+
*
|
|
445
|
+
* @returns Base64-encoded invocation CAR, or `{ error }` describing why it
|
|
446
|
+
* failed (so the caller can surface a useful message to the agent).
|
|
447
|
+
*/
|
|
448
|
+
async createInvocationFromDelegation(delegationCar, serviceUrl, capability, options = {}) {
|
|
449
|
+
if (!this.signingMnemonic || !this.oracleDid) {
|
|
450
|
+
return {
|
|
451
|
+
error: 'Oracle has no signing key configured — set SERVICE_ED25519_MNEMONIC',
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
if (!delegationCar || typeof delegationCar !== 'string') {
|
|
455
|
+
return { error: 'delegationCar (base64 CAR) is required' };
|
|
456
|
+
}
|
|
457
|
+
if (!capability ||
|
|
458
|
+
typeof capability.can !== 'string' ||
|
|
459
|
+
typeof capability.with !== 'string') {
|
|
460
|
+
return { error: 'capability { can, with } is required' };
|
|
461
|
+
}
|
|
462
|
+
const serviceDid = await this.resolveServiceDid(serviceUrl);
|
|
463
|
+
if (!serviceDid) {
|
|
464
|
+
return {
|
|
465
|
+
error: `Could not resolve worker DID via ${serviceUrl}/.well-known/did.json`,
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
try {
|
|
469
|
+
const { signer } = await signerFromMnemonic(this.signingMnemonic, this.oracleDid);
|
|
470
|
+
let delegation;
|
|
471
|
+
try {
|
|
472
|
+
delegation = await parseDelegation(delegationCar);
|
|
473
|
+
}
|
|
474
|
+
catch (err) {
|
|
475
|
+
return {
|
|
476
|
+
error: `Could not parse delegation CAR: ${err instanceof Error ? err.message : String(err)}`,
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
// Validate the delegation actually targets this oracle. If the user
|
|
480
|
+
// delegated to someone else, this oracle is not the intended issuer of
|
|
481
|
+
// invocations on top of it — fail loudly rather than mint a useless
|
|
482
|
+
// invocation that the worker would reject.
|
|
483
|
+
const delegationAudience = delegation.audience?.did?.();
|
|
484
|
+
if (delegationAudience && delegationAudience !== this.oracleDid) {
|
|
485
|
+
return {
|
|
486
|
+
error: `Delegation audience (${delegationAudience}) does not match this oracle DID (${this.oracleDid})`,
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
// Clamp TTL: never longer than the delegation's own expiration, and
|
|
490
|
+
// capped at maxTtlSeconds (default 60s — single-use replay protection
|
|
491
|
+
// means we don't gain anything from a longer window).
|
|
492
|
+
const nowSeconds = Math.floor(Date.now() / 1000);
|
|
493
|
+
const requestedTtl = options.maxTtlSeconds ?? 60;
|
|
494
|
+
const delegationExp = typeof delegation.expiration === 'number' &&
|
|
495
|
+
isFinite(delegation.expiration)
|
|
496
|
+
? delegation.expiration
|
|
497
|
+
: null;
|
|
498
|
+
let expirationSeconds = nowSeconds + requestedTtl;
|
|
499
|
+
if (delegationExp !== null) {
|
|
500
|
+
if (delegationExp <= nowSeconds) {
|
|
501
|
+
return {
|
|
502
|
+
error: `Delegation expired at ${new Date(delegationExp * 1000).toISOString()}`,
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
expirationSeconds = Math.min(expirationSeconds, delegationExp);
|
|
506
|
+
}
|
|
507
|
+
const invocation = await createInvocation({
|
|
508
|
+
issuer: signer,
|
|
509
|
+
audience: serviceDid,
|
|
510
|
+
capability: {
|
|
511
|
+
can: capability.can,
|
|
512
|
+
with: capability.with,
|
|
513
|
+
},
|
|
514
|
+
proofs: [delegation],
|
|
515
|
+
expiration: expirationSeconds,
|
|
516
|
+
});
|
|
517
|
+
const serialized = await serializeInvocation(invocation);
|
|
518
|
+
this.logger.debug(`[UCAN] Minted invocation iss=${this.oracleDid} aud=${serviceDid} can=${capability.can} ttl=${expirationSeconds - nowSeconds}s`);
|
|
519
|
+
return { invocation: serialized };
|
|
520
|
+
}
|
|
521
|
+
catch (error) {
|
|
522
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
523
|
+
this.logger.warn(`[UCAN] mint failed: ${message}`);
|
|
524
|
+
return { error: `Failed to mint invocation: ${message}` };
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
// ============================================================================
|
|
528
|
+
// MCP tool validation (existing)
|
|
529
|
+
// ============================================================================
|
|
530
|
+
requiresAuth(serverName, toolName) {
|
|
531
|
+
return requiresUCANAuth(this.config, serverName, toolName);
|
|
532
|
+
}
|
|
533
|
+
async validateMCPInvocation(serverName, toolName, invocationData) {
|
|
534
|
+
try {
|
|
535
|
+
const invocationBytes = typeof invocationData === 'string'
|
|
536
|
+
? Buffer.from(invocationData, 'base64')
|
|
537
|
+
: invocationData;
|
|
538
|
+
if (invocationBytes.length === 0) {
|
|
539
|
+
return { valid: false, error: 'Empty invocation data' };
|
|
540
|
+
}
|
|
541
|
+
const crypto = await import('node:crypto');
|
|
542
|
+
const hash = crypto
|
|
543
|
+
.createHash('sha256')
|
|
544
|
+
.update(invocationBytes)
|
|
545
|
+
.digest('hex');
|
|
546
|
+
const pseudoCid = `bafy${hash.slice(0, 52)}`;
|
|
547
|
+
if (await this.invocationStore.has(pseudoCid)) {
|
|
548
|
+
return {
|
|
549
|
+
valid: false,
|
|
550
|
+
error: 'Invocation has already been used (replay attack prevented)',
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
const requiredCapability = buildRequiredCapability(this.config, serverName, toolName);
|
|
554
|
+
this.logger.log(`UCAN validation for ${serverName}/${toolName} - Required capability: ${requiredCapability.can} on ${requiredCapability.with}`);
|
|
555
|
+
this.logger.warn(`UCAN validation is in placeholder mode. Full ucanto validation will be enabled once @ixo/ucan is built.`);
|
|
556
|
+
await this.invocationStore.add(pseudoCid);
|
|
557
|
+
return { valid: true, invokerDid: 'placeholder:invoker' };
|
|
558
|
+
}
|
|
559
|
+
catch (error) {
|
|
560
|
+
this.logger.error(`UCAN validation error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
561
|
+
return {
|
|
562
|
+
valid: false,
|
|
563
|
+
error: `Validation error: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
getRequiredCapabilityURI(serverName, toolName) {
|
|
568
|
+
return createMCPResourceURI(this.config.oracleDid, serverName, toolName);
|
|
569
|
+
}
|
|
570
|
+
getOracleDid() {
|
|
571
|
+
return this.config.oracleDid;
|
|
572
|
+
}
|
|
573
|
+
getRootIssuers() {
|
|
574
|
+
return this.config.rootIssuers;
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
UcanService = UcanService_1 = __decorate([
|
|
578
|
+
Injectable(),
|
|
579
|
+
__param(1, Inject(CACHE_MANAGER)),
|
|
580
|
+
__metadata("design:paramtypes", [ConfigService, Function])
|
|
581
|
+
], UcanService);
|
|
582
|
+
export { UcanService };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type AllEvents } from '@ixo/oracles-events';
|
|
2
|
+
import { EventEmitter } from 'node:events';
|
|
3
|
+
export declare const WS_SERVICE_EVENT_NAME = "wsService";
|
|
4
|
+
/**
|
|
5
|
+
* Cross-module event channel: graph nodes call `wsEmitter.emit(sessionId, event)`,
|
|
6
|
+
* the WS service listens for `WS_SERVICE_EVENT_NAME` and fans out to sockets.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Emitter extends EventEmitter {
|
|
9
|
+
emit(_sessionId: string, event: AllEvents): boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const wsEmitter: Emitter;
|
|
12
|
+
//# sourceMappingURL=emitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../../src/modules/ws/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,eAAO,MAAM,qBAAqB,cAAc,CAAC;AAEjD;;;GAGG;AACH,qBAAa,OAAQ,SAAQ,YAAY;IAC9B,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO;CAG7D;AAED,eAAO,MAAM,SAAS,SAAgB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
export const WS_SERVICE_EVENT_NAME = 'wsService';
|
|
3
|
+
/**
|
|
4
|
+
* Cross-module event channel: graph nodes call `wsEmitter.emit(sessionId, event)`,
|
|
5
|
+
* the WS service listens for `WS_SERVICE_EVENT_NAME` and fans out to sockets.
|
|
6
|
+
*/
|
|
7
|
+
export class Emitter extends EventEmitter {
|
|
8
|
+
emit(_sessionId, event) {
|
|
9
|
+
return super.emit(WS_SERVICE_EVENT_NAME, event);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export const wsEmitter = new Emitter();
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ConfigService } from '@nestjs/config';
|
|
2
|
+
import { type OnGatewayConnection, type OnGatewayDisconnect, type OnGatewayInit } from '@nestjs/websockets';
|
|
3
|
+
import { Server, Socket } from 'socket.io';
|
|
4
|
+
import { UcanService } from '../ucan/ucan.service.js';
|
|
5
|
+
import { WsService } from './ws.service.js';
|
|
6
|
+
export declare class WsGateway implements OnGatewayConnection, OnGatewayDisconnect, OnGatewayInit {
|
|
7
|
+
private readonly wsService;
|
|
8
|
+
private readonly configService;
|
|
9
|
+
private readonly ucanService?;
|
|
10
|
+
server: Server;
|
|
11
|
+
private readonly logger;
|
|
12
|
+
constructor(wsService: WsService, configService: ConfigService, ucanService?: UcanService | undefined);
|
|
13
|
+
afterInit(): void;
|
|
14
|
+
handleConnection(client: Socket): Promise<void>;
|
|
15
|
+
handleDisconnect(client: Socket): void;
|
|
16
|
+
handlePing(client: Socket): void;
|
|
17
|
+
handleStatus(client: Socket): void;
|
|
18
|
+
/**
|
|
19
|
+
* Forward a tool/action result back to LangGraph via the root event emitter.
|
|
20
|
+
*/
|
|
21
|
+
private handleFrontendToolResult;
|
|
22
|
+
handleToolResult(client: Socket, data: {
|
|
23
|
+
toolCallId: string;
|
|
24
|
+
result: unknown;
|
|
25
|
+
error?: string;
|
|
26
|
+
}): void;
|
|
27
|
+
handleActionCallResult(client: Socket, data: {
|
|
28
|
+
sessionId: string;
|
|
29
|
+
toolCallId: string;
|
|
30
|
+
result: unknown;
|
|
31
|
+
}): void;
|
|
32
|
+
handleListEvents(client: Socket): void;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=ws.gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws.gateway.d.ts","sourceRoot":"","sources":["../../../src/modules/ws/ws.gateway.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAML,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,qBAMa,SACX,YAAW,mBAAmB,EAAE,mBAAmB,EAAE,aAAa;IAQhE,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAClB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAP3C,MAAM,EAAG,MAAM,CAAC;IAEhB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8B;gBAGlC,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAChB,WAAW,CAAC,EAAE,WAAW,YAAA;IAGxD,SAAS,IAAI,IAAI;IAKX,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmFrD,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAgBtC,UAAU,CAAoB,MAAM,EAAE,MAAM,GAAG,IAAI;IAQnD,YAAY,CAAoB,MAAM,EAAE,MAAM,GAAG,IAAI;IAUrD;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAkChC,gBAAgB,CACK,MAAM,EAAE,MAAM,EAEjC,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAC5D,IAAI;IAcP,sBAAsB,CACD,MAAM,EAAE,MAAM,EAEjC,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,GAC/D,IAAI;IAaP,gBAAgB,CAAoB,MAAM,EAAE,MAAM,GAAG,IAAI;CA4B1D"}
|