@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,74 @@
|
|
|
1
|
+
import type { OraclePlugin } from '../plugin-api/oracle-plugin.js';
|
|
2
|
+
import type { PluginContext, PluginTool, RuntimeContext } from '../plugin-api/types.js';
|
|
3
|
+
/** A collected tool tagged with the plugin that contributed it. */
|
|
4
|
+
export interface RegisteredTool {
|
|
5
|
+
pluginName: string;
|
|
6
|
+
tool: PluginTool;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Stores plugins that contribute tools and resolves them lazily by invoking
|
|
10
|
+
* each plugin's `getTools(buildCtx)` once at collection time.
|
|
11
|
+
*
|
|
12
|
+
* Tools live in a flat namespace — duplicate names across plugins are a
|
|
13
|
+
* boot error caught by `assertNoCollisions()`.
|
|
14
|
+
*
|
|
15
|
+
* Boot-time outputs from `getTools(buildCtx)` are cached after the first
|
|
16
|
+
* `collectBoot(buildCtx)` call. The request hot path only re-runs each
|
|
17
|
+
* plugin's `getRequestTools(rtCtx)` — request-time variation lives there.
|
|
18
|
+
*
|
|
19
|
+
* ## Cache safety / cross-user isolation
|
|
20
|
+
*
|
|
21
|
+
* `PluginContext` (the `buildCtx` passed to `getTools`) is **defined by
|
|
22
|
+
* `plugin-api/types.ts` to hold no user, session, or request data** — it
|
|
23
|
+
* only carries `{ config, identity, availablePlugins, logger }`, all
|
|
24
|
+
* oracle-scoped and stable for the process lifetime.
|
|
25
|
+
*
|
|
26
|
+
* Cached `PluginTool` objects are therefore safe to share between users:
|
|
27
|
+
* their handlers receive a fresh `RuntimeContext` from `wrapPluginTool`
|
|
28
|
+
* on every invocation, and that per-request context is what carries
|
|
29
|
+
* `user.did`, `session.id`, `ucanDelegation`, etc. The cache stores
|
|
30
|
+
* static tool definitions; per-request wrapping is always fresh.
|
|
31
|
+
*/
|
|
32
|
+
export declare class ToolRegistry {
|
|
33
|
+
private readonly plugins;
|
|
34
|
+
private bootCache;
|
|
35
|
+
private collected;
|
|
36
|
+
/** Add a plugin whose `getTools` will be called at `collect()` time. */
|
|
37
|
+
register(plugin: OraclePlugin): void;
|
|
38
|
+
/**
|
|
39
|
+
* Run every plugin's `getTools(buildCtx)` once and cache the result. Safe
|
|
40
|
+
* to call multiple times — subsequent calls return the cached list.
|
|
41
|
+
*/
|
|
42
|
+
collectBoot(buildCtx: PluginContext): Promise<RegisteredTool[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Run every plugin's `getRequestTools(rtCtx)`. Does NOT touch the boot
|
|
45
|
+
* cache — boot-time tools must be collected via `collectBoot(buildCtx)`
|
|
46
|
+
* before the first request.
|
|
47
|
+
*/
|
|
48
|
+
collectRequest(rtCtx: RuntimeContext): Promise<RegisteredTool[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Combined boot + request collection used by the main agent build. Uses
|
|
51
|
+
* the cached boot output when present so per-request rebuilds skip the
|
|
52
|
+
* `getTools` invocations that don't depend on runtime state.
|
|
53
|
+
*/
|
|
54
|
+
collect(buildCtx: PluginContext, rtCtx?: RuntimeContext): Promise<RegisteredTool[]>;
|
|
55
|
+
/** The flat list of tool names produced by the most recent `collect()`. */
|
|
56
|
+
toolNames(): string[];
|
|
57
|
+
/**
|
|
58
|
+
* Tool names contributed by a given plugin in the most recent `collect()`
|
|
59
|
+
* (or `collectBoot()` if no full collection has happened yet).
|
|
60
|
+
*/
|
|
61
|
+
toolNamesForPlugin(pluginName: string): string[];
|
|
62
|
+
/**
|
|
63
|
+
* The tools contributed by a given plugin in the most recent collection
|
|
64
|
+
* (boot-only if a full request collection has not yet happened).
|
|
65
|
+
*/
|
|
66
|
+
toolsForPlugin(pluginName: string): PluginTool[];
|
|
67
|
+
/**
|
|
68
|
+
* Throw if two plugins contribute a tool with the same name. The error
|
|
69
|
+
* message names every colliding plugin pair so the boot log points at the
|
|
70
|
+
* actual conflict.
|
|
71
|
+
*/
|
|
72
|
+
assertNoCollisions(): void;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=tool-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-registry.d.ts","sourceRoot":"","sources":["../../src/registries/tool-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,cAAc,EACf,MAAM,wBAAwB,CAAC;AAEhC,mEAAmE;AACnE,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,UAAU,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsB;IAC9C,OAAO,CAAC,SAAS,CAAiC;IAClD,OAAO,CAAC,SAAS,CAAiC;IAElD,wEAAwE;IACxE,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAMpC;;;OAGG;IACG,WAAW,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAcrE;;;;OAIG;IACG,cAAc,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAYtE;;;;OAIG;IACG,OAAO,CACX,QAAQ,EAAE,aAAa,EACvB,KAAK,CAAC,EAAE,cAAc,GACrB,OAAO,CAAC,cAAc,EAAE,CAAC;IAQ5B,2EAA2E;IAC3E,SAAS,IAAI,MAAM,EAAE;IAMrB;;;OAGG;IACH,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE;IAMhD;;;OAGG;IACH,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,EAAE;IAMhD;;;;OAIG;IACH,kBAAkB,IAAI,IAAI;CAuB3B"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stores plugins that contribute tools and resolves them lazily by invoking
|
|
3
|
+
* each plugin's `getTools(buildCtx)` once at collection time.
|
|
4
|
+
*
|
|
5
|
+
* Tools live in a flat namespace — duplicate names across plugins are a
|
|
6
|
+
* boot error caught by `assertNoCollisions()`.
|
|
7
|
+
*
|
|
8
|
+
* Boot-time outputs from `getTools(buildCtx)` are cached after the first
|
|
9
|
+
* `collectBoot(buildCtx)` call. The request hot path only re-runs each
|
|
10
|
+
* plugin's `getRequestTools(rtCtx)` — request-time variation lives there.
|
|
11
|
+
*
|
|
12
|
+
* ## Cache safety / cross-user isolation
|
|
13
|
+
*
|
|
14
|
+
* `PluginContext` (the `buildCtx` passed to `getTools`) is **defined by
|
|
15
|
+
* `plugin-api/types.ts` to hold no user, session, or request data** — it
|
|
16
|
+
* only carries `{ config, identity, availablePlugins, logger }`, all
|
|
17
|
+
* oracle-scoped and stable for the process lifetime.
|
|
18
|
+
*
|
|
19
|
+
* Cached `PluginTool` objects are therefore safe to share between users:
|
|
20
|
+
* their handlers receive a fresh `RuntimeContext` from `wrapPluginTool`
|
|
21
|
+
* on every invocation, and that per-request context is what carries
|
|
22
|
+
* `user.did`, `session.id`, `ucanDelegation`, etc. The cache stores
|
|
23
|
+
* static tool definitions; per-request wrapping is always fresh.
|
|
24
|
+
*/
|
|
25
|
+
export class ToolRegistry {
|
|
26
|
+
plugins = [];
|
|
27
|
+
bootCache = null;
|
|
28
|
+
collected = null;
|
|
29
|
+
/** Add a plugin whose `getTools` will be called at `collect()` time. */
|
|
30
|
+
register(plugin) {
|
|
31
|
+
this.plugins.push(plugin);
|
|
32
|
+
this.bootCache = null;
|
|
33
|
+
this.collected = null;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Run every plugin's `getTools(buildCtx)` once and cache the result. Safe
|
|
37
|
+
* to call multiple times — subsequent calls return the cached list.
|
|
38
|
+
*/
|
|
39
|
+
async collectBoot(buildCtx) {
|
|
40
|
+
if (this.bootCache !== null)
|
|
41
|
+
return this.bootCache;
|
|
42
|
+
const out = [];
|
|
43
|
+
for (const plugin of this.plugins) {
|
|
44
|
+
if (!plugin.getTools)
|
|
45
|
+
continue;
|
|
46
|
+
const tools = await plugin.getTools(buildCtx);
|
|
47
|
+
for (const tool of tools) {
|
|
48
|
+
out.push({ pluginName: plugin.name, tool });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
this.bootCache = out;
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Run every plugin's `getRequestTools(rtCtx)`. Does NOT touch the boot
|
|
56
|
+
* cache — boot-time tools must be collected via `collectBoot(buildCtx)`
|
|
57
|
+
* before the first request.
|
|
58
|
+
*/
|
|
59
|
+
async collectRequest(rtCtx) {
|
|
60
|
+
const out = [];
|
|
61
|
+
for (const plugin of this.plugins) {
|
|
62
|
+
if (!plugin.getRequestTools)
|
|
63
|
+
continue;
|
|
64
|
+
const requestTools = await plugin.getRequestTools(rtCtx);
|
|
65
|
+
for (const tool of requestTools) {
|
|
66
|
+
out.push({ pluginName: plugin.name, tool });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return out;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Combined boot + request collection used by the main agent build. Uses
|
|
73
|
+
* the cached boot output when present so per-request rebuilds skip the
|
|
74
|
+
* `getTools` invocations that don't depend on runtime state.
|
|
75
|
+
*/
|
|
76
|
+
async collect(buildCtx, rtCtx) {
|
|
77
|
+
const boot = await this.collectBoot(buildCtx);
|
|
78
|
+
const request = rtCtx ? await this.collectRequest(rtCtx) : [];
|
|
79
|
+
const out = [...boot, ...request];
|
|
80
|
+
this.collected = out;
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
/** The flat list of tool names produced by the most recent `collect()`. */
|
|
84
|
+
toolNames() {
|
|
85
|
+
return (this.collected ?? this.bootCache ?? []).map((entry) => entry.tool.name);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Tool names contributed by a given plugin in the most recent `collect()`
|
|
89
|
+
* (or `collectBoot()` if no full collection has happened yet).
|
|
90
|
+
*/
|
|
91
|
+
toolNamesForPlugin(pluginName) {
|
|
92
|
+
return (this.collected ?? this.bootCache ?? [])
|
|
93
|
+
.filter((entry) => entry.pluginName === pluginName)
|
|
94
|
+
.map((entry) => entry.tool.name);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The tools contributed by a given plugin in the most recent collection
|
|
98
|
+
* (boot-only if a full request collection has not yet happened).
|
|
99
|
+
*/
|
|
100
|
+
toolsForPlugin(pluginName) {
|
|
101
|
+
return (this.collected ?? this.bootCache ?? [])
|
|
102
|
+
.filter((entry) => entry.pluginName === pluginName)
|
|
103
|
+
.map((entry) => entry.tool);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Throw if two plugins contribute a tool with the same name. The error
|
|
107
|
+
* message names every colliding plugin pair so the boot log points at the
|
|
108
|
+
* actual conflict.
|
|
109
|
+
*/
|
|
110
|
+
assertNoCollisions() {
|
|
111
|
+
const source = this.collected ?? this.bootCache;
|
|
112
|
+
if (source === null) {
|
|
113
|
+
throw new Error('ToolRegistry.assertNoCollisions called before collect');
|
|
114
|
+
}
|
|
115
|
+
const seen = new Map();
|
|
116
|
+
const collisions = [];
|
|
117
|
+
for (const { pluginName, tool } of source) {
|
|
118
|
+
const prev = seen.get(tool.name);
|
|
119
|
+
if (prev !== undefined && prev !== pluginName) {
|
|
120
|
+
collisions.push(`Tool "${tool.name}" registered by both "${prev}" and "${pluginName}"`);
|
|
121
|
+
}
|
|
122
|
+
else if (prev === undefined) {
|
|
123
|
+
seen.set(tool.name, pluginName);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (collisions.length > 0) {
|
|
127
|
+
throw new Error(`ToolRegistry: tool name collisions detected:\n - ${collisions.join('\n - ')}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { ChatOpenAIFields, Logger, MatrixEvent, ModelRole, OracleIdentity, RoomStateSnapshot, SecretIndex } from '../plugin-api/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Per-room secrets adapter. Wraps the host's secrets service so plugins
|
|
5
|
+
* never reach for a singleton directly.
|
|
6
|
+
*/
|
|
7
|
+
export interface SecretsAdapter {
|
|
8
|
+
getIndex(roomId: string): Promise<SecretIndex>;
|
|
9
|
+
getValues(roomId: string, keys: string[]): Promise<Record<string, string>>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Blob-store adapter — short-TTL keyed store for content that should never
|
|
13
|
+
* be relayed through the LLM. Wraps `BlobStoreService` so plugins reach
|
|
14
|
+
* it only via the narrow `rtCtx.blobStore` shape.
|
|
15
|
+
*/
|
|
16
|
+
export interface BlobStoreAdapter {
|
|
17
|
+
put(params: {
|
|
18
|
+
userDid: string;
|
|
19
|
+
name: string;
|
|
20
|
+
value: string;
|
|
21
|
+
ttlSeconds?: number;
|
|
22
|
+
}): Promise<string>;
|
|
23
|
+
get(params: {
|
|
24
|
+
userDid: string;
|
|
25
|
+
blobId: string;
|
|
26
|
+
}): Promise<{
|
|
27
|
+
name: string;
|
|
28
|
+
value: string;
|
|
29
|
+
} | null>;
|
|
30
|
+
isValidBlobId(value: unknown): value is string;
|
|
31
|
+
}
|
|
32
|
+
/** Matrix adapter exposing only scoped operations a plugin should ever need. */
|
|
33
|
+
export interface MatrixAdapter {
|
|
34
|
+
postToRoom(roomId: string, content: unknown): Promise<string>;
|
|
35
|
+
getRoomState(roomId: string): Promise<RoomStateSnapshot>;
|
|
36
|
+
getEventById(roomId: string, eventId: string): Promise<MatrixEvent>;
|
|
37
|
+
}
|
|
38
|
+
/** LLM adapter — turns role tags into chat models. */
|
|
39
|
+
export interface LlmAdapter {
|
|
40
|
+
get(role: ModelRole, params?: ChatOpenAIFields): BaseChatModel;
|
|
41
|
+
}
|
|
42
|
+
/** UCAN adapter — capability checks and downstream invocation minting. */
|
|
43
|
+
export interface UcanAdapter {
|
|
44
|
+
hasCapability(delegation: {
|
|
45
|
+
capabilities?: ReadonlyArray<{
|
|
46
|
+
resource: string;
|
|
47
|
+
action: string;
|
|
48
|
+
}>;
|
|
49
|
+
} | undefined, resource: string, action: string): boolean;
|
|
50
|
+
requireCapability(delegation: {
|
|
51
|
+
capabilities?: ReadonlyArray<{
|
|
52
|
+
resource: string;
|
|
53
|
+
action: string;
|
|
54
|
+
}>;
|
|
55
|
+
} | undefined, resource: string, action: string): void;
|
|
56
|
+
mintInvocation(userDid: string, target: {
|
|
57
|
+
did: string;
|
|
58
|
+
capability: string;
|
|
59
|
+
}, opts?: {
|
|
60
|
+
skipCache?: boolean;
|
|
61
|
+
}): Promise<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Resolve a downstream service URL to its did:web identifier (fetched
|
|
64
|
+
* once from `/.well-known/did.json` and cached by origin). Returns `null`
|
|
65
|
+
* when the document is missing or has no `id` — callers degrade gracefully
|
|
66
|
+
* instead of throwing.
|
|
67
|
+
*/
|
|
68
|
+
resolveServiceDid(serviceUrl: string): Promise<string | null>;
|
|
69
|
+
/**
|
|
70
|
+
* `true` once the oracle has loaded its Ed25519 signing mnemonic at boot.
|
|
71
|
+
* Plugins that mint downstream invocations (e.g. the editor's
|
|
72
|
+
* `mint_invocation` tool) gate registration on this — without a signing
|
|
73
|
+
* key, minting is a no-op and the tool should advertise an error instead
|
|
74
|
+
* of pretending to work.
|
|
75
|
+
*/
|
|
76
|
+
hasSigningKey(): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Mint a UCAN invocation from a directly-supplied delegation CAR — used
|
|
79
|
+
* when the caller has the user's signed delegation in hand (typically read
|
|
80
|
+
* from a flow's Y.Doc by CID) and wants a freshly-targeted invocation
|
|
81
|
+
* against a specific service route. Returns `{ invocation }` on success
|
|
82
|
+
* or `{ error }` with a surfaced-verbatim reason on failure (signing key
|
|
83
|
+
* missing, delegation audience mismatch, did:web unreachable, etc.).
|
|
84
|
+
*/
|
|
85
|
+
createInvocationFromDelegation(delegationCar: string, serviceUrl: string, capability: {
|
|
86
|
+
can: string;
|
|
87
|
+
with: string;
|
|
88
|
+
}, options?: {
|
|
89
|
+
maxTtlSeconds?: number;
|
|
90
|
+
}): Promise<{
|
|
91
|
+
invocation: string;
|
|
92
|
+
} | {
|
|
93
|
+
error: string;
|
|
94
|
+
}>;
|
|
95
|
+
}
|
|
96
|
+
/** Raw event payload — what callers pass before the scoped emitter adds session/request ids. */
|
|
97
|
+
export type RawEventPayload = Record<string, unknown>;
|
|
98
|
+
/** Low-level event sink used by the scoped emitter. */
|
|
99
|
+
export interface EmitAdapter {
|
|
100
|
+
emit(eventName: string, payload: RawEventPayload): void;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Ambient services bag captured once at boot. Lives behind PluginContext /
|
|
104
|
+
* RuntimeContext synthesis — never exposed to plugin authors directly.
|
|
105
|
+
*/
|
|
106
|
+
export interface AmbientServices {
|
|
107
|
+
config: Record<string, unknown>;
|
|
108
|
+
identity: OracleIdentity;
|
|
109
|
+
availablePlugins: ReadonlySet<string>;
|
|
110
|
+
secrets: SecretsAdapter;
|
|
111
|
+
blobStore: BlobStoreAdapter;
|
|
112
|
+
matrix: MatrixAdapter;
|
|
113
|
+
llm: LlmAdapter;
|
|
114
|
+
emit: EmitAdapter;
|
|
115
|
+
ucan: UcanAdapter;
|
|
116
|
+
logger: Logger;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=ambient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ambient.d.ts","sourceRoot":"","sources":["../../src/runtime-context/ambient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EACV,gBAAgB,EAChB,MAAM,EACN,WAAW,EACX,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAEhC;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC/C,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5E;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,MAAM,EAAE;QACV,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,CAAC;IACpB,GAAG,CAAC,MAAM,EAAE;QACV,OAAO,EAAE,MAAM,CAAC;QAChB,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CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Logger, MergedConfig, OracleIdentity, PluginContext } from '../plugin-api/types.js';
|
|
2
|
+
export interface BuildPluginContextInput<TConfig = MergedConfig> {
|
|
3
|
+
/** Merged Zod-validated env (core + every loaded plugin's `configSchema`). */
|
|
4
|
+
config: TConfig;
|
|
5
|
+
/** Identity of this oracle, set by the fork at `createOracleApp`. */
|
|
6
|
+
identity: OracleIdentity;
|
|
7
|
+
/** Names of the plugins resolved at boot. */
|
|
8
|
+
availablePlugins: ReadonlySet<string>;
|
|
9
|
+
/** Base logger; auto-bound to the calling plugin's name when supported. */
|
|
10
|
+
logger: Logger;
|
|
11
|
+
/** Plugin name used to scope the logger. */
|
|
12
|
+
pluginName: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Build the boot-time PluginContext passed to plugin methods that produce
|
|
16
|
+
* tools, sub-agents and middlewares. Lives once per request build — holds no
|
|
17
|
+
* user, no session, no live socket, no request data.
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildPluginContext<TConfig = MergedConfig>(input: BuildPluginContextInput<TConfig>): PluginContext<TConfig>;
|
|
20
|
+
//# sourceMappingURL=build-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-plugin.d.ts","sourceRoot":"","sources":["../../src/runtime-context/build-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EACZ,cAAc,EACd,aAAa,EACd,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,uBAAuB,CAAC,OAAO,GAAG,YAAY;IAC7D,8EAA8E;IAC9E,MAAM,EAAE,OAAO,CAAC;IAChB,qEAAqE;IACrE,QAAQ,EAAE,cAAc,CAAC;IACzB,6CAA6C;IAC7C,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAG,YAAY,EACvD,KAAK,EAAE,uBAAuB,CAAC,OAAO,CAAC,GACtC,aAAa,CAAC,OAAO,CAAC,CAWxB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the boot-time PluginContext passed to plugin methods that produce
|
|
3
|
+
* tools, sub-agents and middlewares. Lives once per request build — holds no
|
|
4
|
+
* user, no session, no live socket, no request data.
|
|
5
|
+
*/
|
|
6
|
+
export function buildPluginContext(input) {
|
|
7
|
+
const scopedLogger = input.logger.child
|
|
8
|
+
? input.logger.child({ plugin: input.pluginName })
|
|
9
|
+
: input.logger;
|
|
10
|
+
return {
|
|
11
|
+
config: input.config,
|
|
12
|
+
identity: input.identity,
|
|
13
|
+
availablePlugins: input.availablePlugins,
|
|
14
|
+
logger: scopedLogger,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
|
+
import type { MergedConfig, RuntimeContext, SharedAccessors, UcanDelegation, UserContextData } from '../plugin-api/types.js';
|
|
3
|
+
import type { AmbientServices } from './ambient.js';
|
|
4
|
+
/** Fixed empty `shared` accessors — frozen so callers can't mutate. */
|
|
5
|
+
declare const EMPTY_SHARED: SharedAccessors;
|
|
6
|
+
/**
|
|
7
|
+
* The user channel passed in via LangGraph's per-run context. Mirrors today's
|
|
8
|
+
* `state.config` + auth headers consumed by the request middleware.
|
|
9
|
+
*/
|
|
10
|
+
export interface RuntimeUserContext {
|
|
11
|
+
did: string;
|
|
12
|
+
matrixUserId: string;
|
|
13
|
+
ucanDelegation: UcanDelegation;
|
|
14
|
+
timezone?: string;
|
|
15
|
+
currentTime?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Session info threaded through from `SessionsService`. */
|
|
18
|
+
export interface RuntimeSessionContext {
|
|
19
|
+
id: string;
|
|
20
|
+
client: 'portal' | 'matrix' | 'slack';
|
|
21
|
+
wsId?: string;
|
|
22
|
+
requestId: string;
|
|
23
|
+
roomId?: string;
|
|
24
|
+
}
|
|
25
|
+
/** What LangGraph hands us at invocation time on `runtime.context`. */
|
|
26
|
+
export interface RunConfigContext {
|
|
27
|
+
user: RuntimeUserContext;
|
|
28
|
+
session: RuntimeSessionContext;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The `runtime` argument passed to a tool handler in LangGraph v1. We read
|
|
32
|
+
* the `context` channel, the optional `signal`, and the optional `toolCall`
|
|
33
|
+
* (populated by LangChain when the handler runs in response to a model tool
|
|
34
|
+
* call — surfaced on `RuntimeContext.toolCallId`).
|
|
35
|
+
*/
|
|
36
|
+
export interface RunConfig {
|
|
37
|
+
context: RunConfigContext;
|
|
38
|
+
signal?: AbortSignal;
|
|
39
|
+
toolCall?: {
|
|
40
|
+
id?: string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Minimum shape of the graph state that build-runtime depends on. Real graphs
|
|
45
|
+
* extend this freely.
|
|
46
|
+
*/
|
|
47
|
+
export interface RuntimeStateInput {
|
|
48
|
+
messages: readonly BaseMessage[];
|
|
49
|
+
userContext?: UserContextData;
|
|
50
|
+
loadedPlugins?: ReadonlySet<string>;
|
|
51
|
+
[key: string]: unknown;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Build the per-request RuntimeContext exposed to tool handlers, sub-agent
|
|
55
|
+
* handlers and plugin-middleware hooks. Synthesizes user/session from the
|
|
56
|
+
* LangGraph runtime channel, history from state, and the rest from ambient.
|
|
57
|
+
*/
|
|
58
|
+
export declare function buildRuntimeContext<TConfig = MergedConfig>(runConfig: RunConfig, ambient: AmbientServices, state: RuntimeStateInput): RuntimeContext<TConfig>;
|
|
59
|
+
export { EMPTY_SHARED };
|
|
60
|
+
//# sourceMappingURL=build-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-runtime.d.ts","sourceRoot":"","sources":["../../src/runtime-context/build-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EACV,YAAY,EAEZ,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,uEAAuE;AACvE,QAAA,MAAM,YAAY,EAAE,eAAmC,CAAC;AAExD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,4DAA4D;AAC5D,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,uEAAuE;AACvE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,qBAAqB,CAAC;CAChC;AAED;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;IACjC,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAG,YAAY,EACxD,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,iBAAiB,GACvB,cAAc,CAAC,OAAO,CAAC,CA+FzB;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { createScopedEmitter } from '../events/scoped-emitter.js';
|
|
2
|
+
/** Fixed empty `shared` accessors — frozen so callers can't mutate. */
|
|
3
|
+
const EMPTY_SHARED = Object.freeze({});
|
|
4
|
+
/**
|
|
5
|
+
* Build the per-request RuntimeContext exposed to tool handlers, sub-agent
|
|
6
|
+
* handlers and plugin-middleware hooks. Synthesizes user/session from the
|
|
7
|
+
* LangGraph runtime channel, history from state, and the rest from ambient.
|
|
8
|
+
*/
|
|
9
|
+
export function buildRuntimeContext(runConfig, ambient, state) {
|
|
10
|
+
const session = runConfig.context.session;
|
|
11
|
+
const user = runConfig.context.user;
|
|
12
|
+
const messages = state.messages ?? [];
|
|
13
|
+
const userContext = state.userContext ?? {};
|
|
14
|
+
const loadedPlugins = state.loadedPlugins ?? new Set();
|
|
15
|
+
const recent = (n) => n <= 0 ? [] : messages.slice(Math.max(0, messages.length - n));
|
|
16
|
+
const readonlyState = {
|
|
17
|
+
...state,
|
|
18
|
+
messages,
|
|
19
|
+
userContext,
|
|
20
|
+
loadedPlugins,
|
|
21
|
+
};
|
|
22
|
+
const emit = createScopedEmitter({ sessionId: session.id, requestId: session.requestId }, ambient.emit);
|
|
23
|
+
const abortSignal = runConfig.signal ?? new AbortController().signal;
|
|
24
|
+
const delegation = user.ucanDelegation;
|
|
25
|
+
return {
|
|
26
|
+
user,
|
|
27
|
+
session,
|
|
28
|
+
history: {
|
|
29
|
+
messages,
|
|
30
|
+
recent,
|
|
31
|
+
userContext,
|
|
32
|
+
state: readonlyState,
|
|
33
|
+
},
|
|
34
|
+
config: ambient.config,
|
|
35
|
+
availablePlugins: ambient.availablePlugins,
|
|
36
|
+
loadedPlugins,
|
|
37
|
+
secrets: {
|
|
38
|
+
getIndex: () => {
|
|
39
|
+
if (!session.roomId) {
|
|
40
|
+
return Promise.resolve({});
|
|
41
|
+
}
|
|
42
|
+
return ambient.secrets.getIndex(session.roomId);
|
|
43
|
+
},
|
|
44
|
+
getValues: (keys) => {
|
|
45
|
+
if (!session.roomId) {
|
|
46
|
+
return Promise.resolve({});
|
|
47
|
+
}
|
|
48
|
+
return ambient.secrets.getValues(session.roomId, keys);
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
blobStore: {
|
|
52
|
+
put: (params) => ambient.blobStore.put(params),
|
|
53
|
+
get: (params) => ambient.blobStore.get(params),
|
|
54
|
+
isValidBlobId: (value) => ambient.blobStore.isValidBlobId(value),
|
|
55
|
+
},
|
|
56
|
+
matrix: {
|
|
57
|
+
postToRoom: (roomId, content) => ambient.matrix.postToRoom(roomId, content),
|
|
58
|
+
getRoomState: (roomId) => ambient.matrix.getRoomState(roomId),
|
|
59
|
+
getEventById: (roomId, eventId) => ambient.matrix.getEventById(roomId, eventId),
|
|
60
|
+
},
|
|
61
|
+
ucan: {
|
|
62
|
+
hasCapability: (resource, action) => ambient.ucan.hasCapability(delegation, resource, action),
|
|
63
|
+
requireCapability: (resource, action) => {
|
|
64
|
+
ambient.ucan.requireCapability(delegation, resource, action);
|
|
65
|
+
},
|
|
66
|
+
mintInvocation: (target, opts) => ambient.ucan.mintInvocation(user.did, target, opts),
|
|
67
|
+
resolveServiceDid: (serviceUrl) => ambient.ucan.resolveServiceDid(serviceUrl),
|
|
68
|
+
hasSigningKey: () => ambient.ucan.hasSigningKey(),
|
|
69
|
+
createInvocationFromDelegation: (car, serviceUrl, capability, opts) => ambient.ucan.createInvocationFromDelegation(car, serviceUrl, capability, opts),
|
|
70
|
+
},
|
|
71
|
+
llm: {
|
|
72
|
+
get: (role, params) => ambient.llm.get(role, params),
|
|
73
|
+
},
|
|
74
|
+
emit,
|
|
75
|
+
logger: ambient.logger,
|
|
76
|
+
abortSignal,
|
|
77
|
+
shared: EMPTY_SHARED,
|
|
78
|
+
...(runConfig.toolCall?.id ? { toolCallId: runConfig.toolCall.id } : {}),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export { EMPTY_SHARED };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { type BaseMessage } from '@langchain/core/messages';
|
|
2
|
+
import { type FeatureToggle } from '../bootstrap/plugin-loader.js';
|
|
3
|
+
import type { OraclePlugin } from '../plugin-api/oracle-plugin.js';
|
|
4
|
+
import type { Logger, OracleIdentity, PluginManifest, PluginTool, ReadonlyState, RuntimeContext } from '../plugin-api/types.js';
|
|
5
|
+
import { type FetchHandler, type MockMatrixOverrides } from './mocks.js';
|
|
6
|
+
/** Options accepted by `createTestRuntime`. */
|
|
7
|
+
export interface CreateTestRuntimeOptions {
|
|
8
|
+
/** Plugins under test. Resolved via the production plugin loader. */
|
|
9
|
+
plugins: OraclePlugin[];
|
|
10
|
+
/**
|
|
11
|
+
* Feature toggles, same shape as `createOracleApp`. Defaults to `'auto'`
|
|
12
|
+
* for plugins that have an `autoDetect`, otherwise on.
|
|
13
|
+
*/
|
|
14
|
+
features?: Partial<Record<string, FeatureToggle>>;
|
|
15
|
+
/** Merged config (env vars). Plugins read this through `ctx.config`. */
|
|
16
|
+
config?: Record<string, unknown>;
|
|
17
|
+
/** Override fields on the synthesized RuntimeContext.user. */
|
|
18
|
+
user?: Partial<RuntimeContext['user']>;
|
|
19
|
+
/** Override fields on the synthesized RuntimeContext.session. */
|
|
20
|
+
session?: Partial<RuntimeContext['session']>;
|
|
21
|
+
/** Override fields on the read-only state passed to invoked handlers. */
|
|
22
|
+
state?: Partial<ReadonlyState>;
|
|
23
|
+
/** Override the identity exposed to plugin builders. */
|
|
24
|
+
identity?: Partial<OracleIdentity>;
|
|
25
|
+
/** Logger. Defaults to a `vi.fn()`-backed no-op. */
|
|
26
|
+
logger?: Logger;
|
|
27
|
+
/** Mock adapter overrides. */
|
|
28
|
+
mocks?: {
|
|
29
|
+
fetch?: FetchHandler;
|
|
30
|
+
matrix?: MockMatrixOverrides;
|
|
31
|
+
secrets?: Record<string, string>;
|
|
32
|
+
llm?: {
|
|
33
|
+
respondWith?: string | string[];
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** A `list_capabilities`-shaped row. */
|
|
38
|
+
export interface CapabilityListing {
|
|
39
|
+
name: string;
|
|
40
|
+
summary: string;
|
|
41
|
+
visibility: NonNullable<PluginManifest['visibility']>;
|
|
42
|
+
loaded: boolean;
|
|
43
|
+
category?: PluginManifest['category'];
|
|
44
|
+
tags: string[];
|
|
45
|
+
}
|
|
46
|
+
/** Public surface of the test runtime. */
|
|
47
|
+
export interface TestRuntime {
|
|
48
|
+
/** Invoke a tool by its registered name. */
|
|
49
|
+
invokeTool: (name: string, args: unknown) => Promise<unknown>;
|
|
50
|
+
/** Invoke a middleware's hooks in isolation. */
|
|
51
|
+
invokeMiddleware: (nameOrIndex: string | number, state: Record<string, unknown>, runtime?: {
|
|
52
|
+
context?: Record<string, unknown>;
|
|
53
|
+
}) => Promise<{
|
|
54
|
+
before?: unknown;
|
|
55
|
+
after?: unknown;
|
|
56
|
+
}>;
|
|
57
|
+
/** Invoke a sub-agent with a textual task; returns the LLM's first response. */
|
|
58
|
+
invokeSubAgent: (name: string, task: string) => Promise<string>;
|
|
59
|
+
/** List tools. Filter by plugin if supplied. */
|
|
60
|
+
listTools: (plugin?: string) => PluginTool[];
|
|
61
|
+
/** Read a plugin's manifest. Throws if unknown. */
|
|
62
|
+
getManifest: (plugin: string) => PluginManifest;
|
|
63
|
+
/** Same shape as the `list_capabilities` meta-tool. */
|
|
64
|
+
listCapabilities: () => CapabilityListing[];
|
|
65
|
+
/** Add a plugin to `loadedPlugins` for subsequent calls. */
|
|
66
|
+
loadCapability: (name: string) => void;
|
|
67
|
+
/** Throws on any registry collision. */
|
|
68
|
+
assertNoCollisions: () => void;
|
|
69
|
+
/** Throws on any invalid manifest. */
|
|
70
|
+
assertManifestValid: () => void;
|
|
71
|
+
/**
|
|
72
|
+
* Stub for full agent invocation. Throws — full agent assembly lands once
|
|
73
|
+
* `createMainAgent` is consumed by `createOracleApp`.
|
|
74
|
+
*/
|
|
75
|
+
invokeAgent: (messages: BaseMessage[]) => Promise<{
|
|
76
|
+
messages: BaseMessage[];
|
|
77
|
+
}>;
|
|
78
|
+
/** Mock-control surface; rebinds the underlying ambient services. */
|
|
79
|
+
mocks: {
|
|
80
|
+
matrix: (overrides: MockMatrixOverrides) => void;
|
|
81
|
+
fetch: (handler: FetchHandler) => void;
|
|
82
|
+
};
|
|
83
|
+
/** Cleanup — releases anything the harness allocated. */
|
|
84
|
+
close: () => Promise<void>;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Build a `TestRuntime` for unit-testing one or more plugins in isolation.
|
|
88
|
+
*
|
|
89
|
+
* The harness wires the same registries the production runtime does, so
|
|
90
|
+
* collisions, manifest validation, and meta-tool behavior all match what
|
|
91
|
+
* an oracle would see at boot. It does NOT spin up Matrix, Redis, or a
|
|
92
|
+
* real LLM — every ambient service is replaced with a mock by default.
|
|
93
|
+
*/
|
|
94
|
+
export declare function createTestRuntime(opts: CreateTestRuntimeOptions): Promise<TestRuntime>;
|
|
95
|
+
//# sourceMappingURL=create-test-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-test-runtime.d.ts","sourceRoot":"","sources":["../../src/testing/create-test-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC1E,O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