@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,542 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper functions for Y.js BlockNote operations
|
|
3
|
+
*
|
|
4
|
+
* These functions handle the low-level Y.Doc operations
|
|
5
|
+
* that the LangChain tools use.
|
|
6
|
+
*
|
|
7
|
+
* Matches the pattern from the CLI commands (runAddBlock, runEditBlock, etc.)
|
|
8
|
+
*/
|
|
9
|
+
import * as Y from 'yjs';
|
|
10
|
+
import { MatrixProviderManager } from './provider.js';
|
|
11
|
+
import { parseSurveyAnswers, parseSurveySchema } from './survey-helpers.js';
|
|
12
|
+
// Re-export helpers from blockActions for consistency
|
|
13
|
+
export { appendBlock, editBlock, deleteBlock, } from './block-actions.js';
|
|
14
|
+
/**
|
|
15
|
+
* Initialize provider, do work, and dispose
|
|
16
|
+
* This matches the pattern from runAddBlock.ts exactly
|
|
17
|
+
*/
|
|
18
|
+
export async function withProvider(matrixClient, config, work) {
|
|
19
|
+
const providerManager = new MatrixProviderManager(matrixClient, config);
|
|
20
|
+
try {
|
|
21
|
+
const { doc } = await providerManager.init();
|
|
22
|
+
const result = await work(doc);
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
finally {
|
|
26
|
+
await providerManager.dispose();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Find a block container by ID
|
|
31
|
+
*/
|
|
32
|
+
export function findBlockById(container, blockId) {
|
|
33
|
+
const nodes = container.toArray();
|
|
34
|
+
for (const node of nodes) {
|
|
35
|
+
if (!(node instanceof Y.XmlElement)) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const candidateId = node.getAttribute('id');
|
|
39
|
+
if (candidateId === blockId) {
|
|
40
|
+
return node;
|
|
41
|
+
}
|
|
42
|
+
// Recursively search nested structures
|
|
43
|
+
const nested = findBlockById(node, blockId);
|
|
44
|
+
if (nested) {
|
|
45
|
+
return nested;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
// Helper to get any attribute (same as blockActions.ts)
|
|
51
|
+
export const getAnyAttribute = (element, key) => {
|
|
52
|
+
return element.getAttribute(key);
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Extract text content from an element (EXACT copy from runListBlocks.ts)
|
|
56
|
+
*/
|
|
57
|
+
export function extractText(element) {
|
|
58
|
+
const parts = [];
|
|
59
|
+
const visit = (node) => {
|
|
60
|
+
if (node instanceof Y.XmlText) {
|
|
61
|
+
parts.push(node.toString());
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
node.toArray().forEach((child) => {
|
|
65
|
+
if (child instanceof Y.XmlElement || child instanceof Y.XmlText) {
|
|
66
|
+
visit(child);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
visit(element);
|
|
71
|
+
return parts.join('');
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Extract complete block details (EXACT copy from runListBlocks.ts - THE WORKING VERSION!)
|
|
75
|
+
*/
|
|
76
|
+
function extractBlockDetail(element) {
|
|
77
|
+
if (element instanceof Y.XmlText) {
|
|
78
|
+
return {
|
|
79
|
+
id: '',
|
|
80
|
+
nodeName: '#text',
|
|
81
|
+
blockType: '',
|
|
82
|
+
attributes: {},
|
|
83
|
+
children: [],
|
|
84
|
+
text: element.toString(),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const detail = {
|
|
88
|
+
id: element.getAttribute('id') || '',
|
|
89
|
+
nodeName: element.nodeName,
|
|
90
|
+
blockType: '',
|
|
91
|
+
attributes: {},
|
|
92
|
+
};
|
|
93
|
+
const xmlAttrs = element.getAttributes();
|
|
94
|
+
for (const [key, value] of Object.entries(xmlAttrs)) {
|
|
95
|
+
detail.attributes[key] = value;
|
|
96
|
+
}
|
|
97
|
+
const attrsValue = getAnyAttribute(element, 'attrs');
|
|
98
|
+
if (attrsValue) {
|
|
99
|
+
detail.attributes.attrs = attrsValue;
|
|
100
|
+
// Extract blockType from attrs if available
|
|
101
|
+
const attrsType = attrsValue.type;
|
|
102
|
+
if (typeof attrsType === 'string') {
|
|
103
|
+
detail.blockType = attrsType;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const children = element.toArray();
|
|
107
|
+
detail.children = [];
|
|
108
|
+
for (const child of children) {
|
|
109
|
+
if (child instanceof Y.XmlElement || child instanceof Y.XmlText) {
|
|
110
|
+
const childDetail = extractBlockDetail(child);
|
|
111
|
+
if (childDetail) {
|
|
112
|
+
detail.children.push(childDetail);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const textContent = extractText(element);
|
|
117
|
+
if (textContent.length > 0) {
|
|
118
|
+
detail.text = textContent;
|
|
119
|
+
}
|
|
120
|
+
return detail;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Extract user-facing properties from a block.
|
|
124
|
+
* Flattens the internal CRDT structure so ALL block properties are visible:
|
|
125
|
+
* 1. Extracts every entry from attrs.props (the canonical source)
|
|
126
|
+
* 2. Fills gaps from child element direct attributes (BlockNote mirrors props there)
|
|
127
|
+
* 3. Parses surveySchema and answers from JSON strings when present
|
|
128
|
+
*
|
|
129
|
+
* Generic — works for any block type without hardcoding field names.
|
|
130
|
+
*/
|
|
131
|
+
export function extractBlockProperties(detail) {
|
|
132
|
+
const merged = {};
|
|
133
|
+
// --- Source 1: attrs.props on the blockContainer (canonical) ---
|
|
134
|
+
const directAttrs = detail.attributes || {};
|
|
135
|
+
const attrsObj = directAttrs.attrs || {};
|
|
136
|
+
const attrsProps = attrsObj.props || {};
|
|
137
|
+
for (const [key, value] of Object.entries(attrsProps)) {
|
|
138
|
+
merged[key] = value;
|
|
139
|
+
}
|
|
140
|
+
// --- Source 2: child element direct attributes ---
|
|
141
|
+
// BlockNote mirrors props as direct attributes on the typed child element
|
|
142
|
+
const contentChild = detail.children?.find((c) => c.nodeName &&
|
|
143
|
+
c.nodeName !== '#text' &&
|
|
144
|
+
c.nodeName !== 'blockGroup' &&
|
|
145
|
+
c.nodeName !== 'blockContainer');
|
|
146
|
+
if (contentChild) {
|
|
147
|
+
for (const [key, value] of Object.entries(contentChild.attributes || {})) {
|
|
148
|
+
// Skip structural keys that are not user-facing props
|
|
149
|
+
if (key === 'id' || key === 'attrs')
|
|
150
|
+
continue;
|
|
151
|
+
if (!(key in merged)) {
|
|
152
|
+
merged[key] = value;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// --- Parse JSON strings for known structured fields ---
|
|
157
|
+
if (typeof merged.surveySchema === 'string') {
|
|
158
|
+
const parsedSchema = parseSurveySchema(merged.surveySchema);
|
|
159
|
+
if (parsedSchema) {
|
|
160
|
+
merged.surveySchema = parsedSchema;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (typeof merged.answers === 'string') {
|
|
164
|
+
const parsedAnswers = parseSurveyAnswers(merged.answers);
|
|
165
|
+
if (parsedAnswers && Object.keys(parsedAnswers).length > 0) {
|
|
166
|
+
merged.answers = parsedAnswers;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// Parse `inputs` JSON string so agents see structured data
|
|
170
|
+
if (typeof merged.inputs === 'string') {
|
|
171
|
+
try {
|
|
172
|
+
const parsed = JSON.parse(merged.inputs);
|
|
173
|
+
if (parsed && typeof parsed === 'object') {
|
|
174
|
+
merged.inputs = parsed;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
// keep raw string if not valid JSON
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// Parse `links` JSON string so agents see structured data
|
|
182
|
+
if (typeof merged.links === 'string') {
|
|
183
|
+
try {
|
|
184
|
+
const parsed = JSON.parse(merged.links);
|
|
185
|
+
if (Array.isArray(parsed)) {
|
|
186
|
+
merged.links = parsed;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
// keep raw string if not valid JSON
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return merged;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Transform block detail into agent-friendly format
|
|
197
|
+
*/
|
|
198
|
+
export function simplifyBlockForAgent(detail) {
|
|
199
|
+
// Use detail.blockType (already extracted in extractBlockDetail)
|
|
200
|
+
// If not available, check first child element's nodeName
|
|
201
|
+
// Fallback to nodeName
|
|
202
|
+
let blockType = detail.blockType;
|
|
203
|
+
if (!blockType && detail.children && detail.children.length > 0) {
|
|
204
|
+
const firstChild = detail.children.find((c) => c.nodeName && c.nodeName !== '#text' && c.nodeName !== 'blockGroup');
|
|
205
|
+
if (firstChild) {
|
|
206
|
+
blockType = firstChild.nodeName;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (!blockType) {
|
|
210
|
+
blockType = detail.nodeName;
|
|
211
|
+
}
|
|
212
|
+
const properties = extractBlockProperties(detail);
|
|
213
|
+
return {
|
|
214
|
+
id: detail.id,
|
|
215
|
+
type: blockType,
|
|
216
|
+
properties,
|
|
217
|
+
...(detail.text && { text: detail.text }),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Collect all block containers from the document (EXACT copy from runListBlocks.ts)
|
|
222
|
+
*/
|
|
223
|
+
export function collectAllBlocks(fragment, _includeText = true) {
|
|
224
|
+
const results = [];
|
|
225
|
+
function collectBlockContainers(container, results) {
|
|
226
|
+
const nodes = container.toArray();
|
|
227
|
+
for (const node of nodes) {
|
|
228
|
+
if (!(node instanceof Y.XmlElement)) {
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
if (node.nodeName === 'blockContainer') {
|
|
232
|
+
const detail = extractBlockDetail(node);
|
|
233
|
+
if (detail) {
|
|
234
|
+
results.push(detail);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
collectBlockContainers(node, results);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
collectBlockContainers(fragment, results);
|
|
241
|
+
return results;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Get block by ID and return its details
|
|
245
|
+
*/
|
|
246
|
+
export function getBlockDetail(doc, blockId, _includeText = true) {
|
|
247
|
+
const fragment = doc.getXmlFragment('document');
|
|
248
|
+
const blockContainer = findBlockById(fragment, blockId);
|
|
249
|
+
if (!blockContainer) {
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
return extractBlockDetail(blockContainer);
|
|
253
|
+
}
|
|
254
|
+
// ─── Y.Doc Namespace Helpers ─────────────────────────────────────────
|
|
255
|
+
// Pure functions that read from Y.Doc namespaces beyond 'document'.
|
|
256
|
+
// Each operates on an already-synced Y.Doc — no Matrix I/O.
|
|
257
|
+
/**
|
|
258
|
+
* Read flow metadata from Y.Map('root') + Y.Text('title').
|
|
259
|
+
* Returns ALL entries from the root map — no field filtering.
|
|
260
|
+
*/
|
|
261
|
+
export function readFlowMetadata(doc) {
|
|
262
|
+
const root = doc.getMap('root');
|
|
263
|
+
const titleText = doc.getText('title');
|
|
264
|
+
const result = {};
|
|
265
|
+
root.forEach((value, key) => {
|
|
266
|
+
result[key] = value;
|
|
267
|
+
});
|
|
268
|
+
// Title from Y.Text takes precedence over root map entry
|
|
269
|
+
const titleStr = titleText.toString();
|
|
270
|
+
if (titleStr) {
|
|
271
|
+
result.title = titleStr;
|
|
272
|
+
}
|
|
273
|
+
return result;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Read all flow nodes from Y.Array('flow').
|
|
277
|
+
* Returns raw entries without type casting.
|
|
278
|
+
*/
|
|
279
|
+
export function readFlowNodes(doc) {
|
|
280
|
+
const flowArray = doc.getArray('flow');
|
|
281
|
+
return flowArray.toArray();
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Read runtime state from Y.Map('runtime').
|
|
285
|
+
* If nodeId provided, returns only that node's state.
|
|
286
|
+
* Returns raw objects — no type filtering.
|
|
287
|
+
*/
|
|
288
|
+
export function readRuntimeState(doc, nodeId) {
|
|
289
|
+
const runtimeMap = doc.getMap('runtime');
|
|
290
|
+
if (nodeId) {
|
|
291
|
+
const state = runtimeMap.get(nodeId);
|
|
292
|
+
return state ? { [nodeId]: state } : {};
|
|
293
|
+
}
|
|
294
|
+
const result = {};
|
|
295
|
+
runtimeMap.forEach((value, key) => {
|
|
296
|
+
if (value && typeof value === 'object') {
|
|
297
|
+
result[key] = value;
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
return result;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Merge updates into a block's runtime state in Y.Map('runtime').
|
|
304
|
+
* Reads existing state first, spreads, then writes the merged result.
|
|
305
|
+
* Must be called inside a doc.transact() by the caller.
|
|
306
|
+
*/
|
|
307
|
+
export function updateRuntimeState(doc, blockId, updates) {
|
|
308
|
+
const runtimeMap = doc.getMap('runtime');
|
|
309
|
+
const existing = runtimeMap.get(blockId) || {};
|
|
310
|
+
const merged = { ...existing, ...updates };
|
|
311
|
+
runtimeMap.set(blockId, merged);
|
|
312
|
+
return merged;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Read audit trail events for a specific block from Y.Map('auditTrail').
|
|
316
|
+
* Returns raw entries without type casting.
|
|
317
|
+
*/
|
|
318
|
+
export function readAuditTrailForBlock(doc, blockId) {
|
|
319
|
+
const auditTrailMap = doc.getMap('auditTrail');
|
|
320
|
+
const eventsArray = auditTrailMap.get(blockId);
|
|
321
|
+
if (!eventsArray || !(eventsArray instanceof Y.Array)) {
|
|
322
|
+
return [];
|
|
323
|
+
}
|
|
324
|
+
return eventsArray
|
|
325
|
+
.toArray()
|
|
326
|
+
.filter((e) => e != null && typeof e === 'object');
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Read invocations from Y.Map('invocations'), optionally filtered by blockId.
|
|
330
|
+
* Sorted by executedAt descending (most recent first) if the field exists.
|
|
331
|
+
* Returns raw entries without type casting.
|
|
332
|
+
*/
|
|
333
|
+
export function readInvocations(doc, blockId) {
|
|
334
|
+
const invocationsMap = doc.getMap('invocations');
|
|
335
|
+
const all = [];
|
|
336
|
+
invocationsMap.forEach((value) => {
|
|
337
|
+
if (value && typeof value === 'object') {
|
|
338
|
+
all.push(value);
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
// Sort by executedAt if present (entries without it sort last)
|
|
342
|
+
const sorted = all.sort((a, b) => {
|
|
343
|
+
const aTime = typeof a.executedAt === 'number' ? a.executedAt : 0;
|
|
344
|
+
const bTime = typeof b.executedAt === 'number' ? b.executedAt : 0;
|
|
345
|
+
return bTime - aTime;
|
|
346
|
+
});
|
|
347
|
+
return blockId ? sorted.filter((i) => i.blockId === blockId) : sorted;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Read delegations from Y.Map('delegations').
|
|
351
|
+
* Handles both v2 StoredEntry { v: 2, data: ... } and legacy JSON strings.
|
|
352
|
+
* Returns raw entries without type casting.
|
|
353
|
+
*/
|
|
354
|
+
export function readDelegations(doc) {
|
|
355
|
+
const ROOT_KEY = '__root__';
|
|
356
|
+
const VERSION_KEY = '__version__';
|
|
357
|
+
const delegationsMap = doc.getMap('delegations');
|
|
358
|
+
const rootCid = delegationsMap.get(ROOT_KEY) || null;
|
|
359
|
+
const delegations = [];
|
|
360
|
+
delegationsMap.forEach((value, key) => {
|
|
361
|
+
if (key === ROOT_KEY || key === VERSION_KEY)
|
|
362
|
+
return;
|
|
363
|
+
// New v2 format: { v: 2, data: {...} }
|
|
364
|
+
if (value &&
|
|
365
|
+
typeof value === 'object' &&
|
|
366
|
+
value.v === 2 &&
|
|
367
|
+
value.data) {
|
|
368
|
+
delegations.push(value.data);
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
// Legacy format: JSON string — normalize + spread all original fields
|
|
372
|
+
if (typeof value === 'string') {
|
|
373
|
+
try {
|
|
374
|
+
const parsed = JSON.parse(value);
|
|
375
|
+
delegations.push({
|
|
376
|
+
...parsed,
|
|
377
|
+
cid: parsed.id || key,
|
|
378
|
+
issuerDid: parsed.issuer || '',
|
|
379
|
+
audienceDid: parsed.audience || '',
|
|
380
|
+
capabilities: parsed.capabilities || [],
|
|
381
|
+
expiration: parsed.expiration,
|
|
382
|
+
createdAt: parsed.issuedAt
|
|
383
|
+
? new Date(parsed.issuedAt).getTime()
|
|
384
|
+
: 0,
|
|
385
|
+
format: 'legacy',
|
|
386
|
+
proofCids: parsed.proofs || [],
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
catch {
|
|
390
|
+
/* skip malformed entries */
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
return { rootCid, delegations };
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Evaluate a block's condition config against all blocks in the document.
|
|
398
|
+
* Returns computed visibility and enabled state.
|
|
399
|
+
*/
|
|
400
|
+
export function evaluateBlockConditions(conditionConfig, allBlocks) {
|
|
401
|
+
if (!conditionConfig.enabled || conditionConfig.conditions.length === 0) {
|
|
402
|
+
return { isVisible: true, isEnabled: true, actions: [] };
|
|
403
|
+
}
|
|
404
|
+
// Build a props map keyed by block ID for fast lookup
|
|
405
|
+
const blockPropsMap = new Map();
|
|
406
|
+
allBlocks.forEach((b) => {
|
|
407
|
+
// Merge direct attributes and nested attrs.props
|
|
408
|
+
const attrs = b.attributes || {};
|
|
409
|
+
const attrsObj = attrs.attrs || {};
|
|
410
|
+
const props = attrsObj.props || {};
|
|
411
|
+
blockPropsMap.set(b.id, { ...attrs, ...attrsObj, ...props });
|
|
412
|
+
});
|
|
413
|
+
const results = conditionConfig.conditions.map((condition) => {
|
|
414
|
+
const sourceProps = blockPropsMap.get(condition.sourceBlockId);
|
|
415
|
+
if (!sourceProps)
|
|
416
|
+
return { condition, passes: false };
|
|
417
|
+
const sourceValue = sourceProps[condition.rule.property];
|
|
418
|
+
const ruleValue = condition.rule.value;
|
|
419
|
+
let passes = false;
|
|
420
|
+
switch (condition.rule.operator) {
|
|
421
|
+
case 'equals':
|
|
422
|
+
passes = String(sourceValue) === String(ruleValue);
|
|
423
|
+
break;
|
|
424
|
+
case 'not_equals':
|
|
425
|
+
passes = String(sourceValue) !== String(ruleValue);
|
|
426
|
+
break;
|
|
427
|
+
case 'greater_than':
|
|
428
|
+
passes = Number(sourceValue) > Number(ruleValue);
|
|
429
|
+
break;
|
|
430
|
+
case 'less_than':
|
|
431
|
+
passes = Number(sourceValue) < Number(ruleValue);
|
|
432
|
+
break;
|
|
433
|
+
case 'contains':
|
|
434
|
+
passes = String(sourceValue ?? '')
|
|
435
|
+
.toLowerCase()
|
|
436
|
+
.includes(String(ruleValue).toLowerCase());
|
|
437
|
+
break;
|
|
438
|
+
case 'not_contains':
|
|
439
|
+
passes = !String(sourceValue ?? '')
|
|
440
|
+
.toLowerCase()
|
|
441
|
+
.includes(String(ruleValue).toLowerCase());
|
|
442
|
+
break;
|
|
443
|
+
case 'is_empty':
|
|
444
|
+
passes =
|
|
445
|
+
sourceValue === undefined ||
|
|
446
|
+
sourceValue === null ||
|
|
447
|
+
String(sourceValue).trim() === '';
|
|
448
|
+
break;
|
|
449
|
+
case 'is_not_empty':
|
|
450
|
+
passes =
|
|
451
|
+
sourceValue !== undefined &&
|
|
452
|
+
sourceValue !== null &&
|
|
453
|
+
String(sourceValue).trim() !== '';
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
return { condition, passes };
|
|
457
|
+
});
|
|
458
|
+
// Aggregate based on mode
|
|
459
|
+
const allPass = conditionConfig.mode === 'all_must_pass'
|
|
460
|
+
? results.every((r) => r.passes)
|
|
461
|
+
: results.some((r) => r.passes);
|
|
462
|
+
const passingResults = conditionConfig.mode === 'all_must_pass'
|
|
463
|
+
? allPass
|
|
464
|
+
? results
|
|
465
|
+
: []
|
|
466
|
+
: results.filter((r) => r.passes);
|
|
467
|
+
const actions = passingResults.map((r) => ({
|
|
468
|
+
action: r.condition.effect.action,
|
|
469
|
+
message: r.condition.effect.message,
|
|
470
|
+
conditionName: r.condition.name,
|
|
471
|
+
}));
|
|
472
|
+
// Derive visibility and enabled state from actions
|
|
473
|
+
const hasVisibilityConditions = conditionConfig.conditions.some((c) => c.effect.action === 'show' || c.effect.action === 'hide');
|
|
474
|
+
const hasEnableConditions = conditionConfig.conditions.some((c) => c.effect.action === 'enable' || c.effect.action === 'disable');
|
|
475
|
+
const hideActions = actions.filter((a) => a.action === 'hide');
|
|
476
|
+
const showActions = actions.filter((a) => a.action === 'show');
|
|
477
|
+
const disableActions = actions.filter((a) => a.action === 'disable');
|
|
478
|
+
const isVisible = hasVisibilityConditions
|
|
479
|
+
? hideActions.length === 0 && (showActions.length > 0 || !allPass)
|
|
480
|
+
: true;
|
|
481
|
+
const isEnabled = hasEnableConditions ? disableActions.length === 0 : true;
|
|
482
|
+
return { isVisible, isEnabled, actions };
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Resolve {{blockId.propPath}} template references in a string.
|
|
486
|
+
* Returns the string with all references replaced by their resolved values.
|
|
487
|
+
*/
|
|
488
|
+
export function resolveBlockReferences(template, allBlocks) {
|
|
489
|
+
const REFERENCE_REGEX = /\{\{([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_.]+)\}\}/g;
|
|
490
|
+
// Build a props map for all blocks
|
|
491
|
+
const blockPropsMap = new Map();
|
|
492
|
+
allBlocks.forEach((b) => {
|
|
493
|
+
const attrs = b.attributes || {};
|
|
494
|
+
const attrsObj = attrs.attrs || {};
|
|
495
|
+
const props = attrsObj.props || {};
|
|
496
|
+
blockPropsMap.set(b.id, { ...attrs, ...attrsObj, ...props });
|
|
497
|
+
});
|
|
498
|
+
return template.replace(REFERENCE_REGEX, (fullMatch, blockId, propPath) => {
|
|
499
|
+
const props = blockPropsMap.get(blockId);
|
|
500
|
+
if (!props)
|
|
501
|
+
return fullMatch;
|
|
502
|
+
// Navigate nested path (e.g. "response.data.items")
|
|
503
|
+
const pathParts = propPath.split('.');
|
|
504
|
+
let value = props;
|
|
505
|
+
for (const part of pathParts) {
|
|
506
|
+
if (value && typeof value === 'object') {
|
|
507
|
+
value = value[part];
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
return '';
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
// For response props stored as JSON strings, parse and navigate
|
|
514
|
+
if (pathParts[0] === 'response' && typeof props['response'] === 'string') {
|
|
515
|
+
try {
|
|
516
|
+
const parsed = JSON.parse(props['response']);
|
|
517
|
+
let innerValue = parsed;
|
|
518
|
+
for (const part of pathParts.slice(1)) {
|
|
519
|
+
if (innerValue && typeof innerValue === 'object') {
|
|
520
|
+
innerValue = innerValue[part];
|
|
521
|
+
}
|
|
522
|
+
else {
|
|
523
|
+
return '';
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
if (innerValue === undefined || innerValue === null)
|
|
527
|
+
return '';
|
|
528
|
+
if (typeof innerValue === 'object')
|
|
529
|
+
return JSON.stringify(innerValue);
|
|
530
|
+
return String(innerValue);
|
|
531
|
+
}
|
|
532
|
+
catch {
|
|
533
|
+
/* fall through to default */
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
if (value === undefined || value === null)
|
|
537
|
+
return '';
|
|
538
|
+
if (typeof value === 'object')
|
|
539
|
+
return JSON.stringify(value);
|
|
540
|
+
return String(value);
|
|
541
|
+
});
|
|
542
|
+
}
|