@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,69 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { OraclePlugin } from '../../plugin-api/oracle-plugin.js';
|
|
3
|
+
import { createFirecrawlSubAgent } from './firecrawl-agent.js';
|
|
4
|
+
import { createDefaultFirecrawlMcpFactory, createFirecrawlTools, } from './firecrawl-tools.js';
|
|
5
|
+
const configSchema = z.object({
|
|
6
|
+
FIRECRAWL_MCP_URL: z
|
|
7
|
+
.string()
|
|
8
|
+
.url('FIRECRAWL_MCP_URL must be a valid HTTP(S) URL.'),
|
|
9
|
+
});
|
|
10
|
+
const manifest = {
|
|
11
|
+
title: 'Firecrawl',
|
|
12
|
+
summary: 'Web search and scraping of human-readable pages via Firecrawl.',
|
|
13
|
+
whenToUse: [
|
|
14
|
+
'User asks the agent to search the web for current information.',
|
|
15
|
+
'User wants the contents of a specific page summarized or extracted.',
|
|
16
|
+
'A question can only be answered by recent public web content.',
|
|
17
|
+
],
|
|
18
|
+
whenNotToUse: [
|
|
19
|
+
'Fetching from an API endpoint (URLs containing /api/, /v1/, /v2/, /v3/, or that return JSON/XML) — use the Sandbox instead.',
|
|
20
|
+
'IXO entity lookups (use the Domain Indexer).',
|
|
21
|
+
'Personal memory or past-conversation recall (use Memory).',
|
|
22
|
+
],
|
|
23
|
+
examples: [
|
|
24
|
+
{
|
|
25
|
+
user: 'What did OpenAI announce at their last event?',
|
|
26
|
+
thought: 'Recent public web content — delegate to call_firecrawl_agent for a fresh search.',
|
|
27
|
+
tool: 'call_firecrawl_agent',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
user: 'Pull the key points from this page: https://example.com/blog/post',
|
|
31
|
+
thought: 'Specific human-readable page — scrape it, summarize.',
|
|
32
|
+
tool: 'call_firecrawl_agent',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
tags: ['web', 'search', 'scrape', 'firecrawl'],
|
|
36
|
+
category: 'data',
|
|
37
|
+
visibility: 'on-demand',
|
|
38
|
+
stability: 'stable',
|
|
39
|
+
};
|
|
40
|
+
function resolveFirecrawlUrl(config) {
|
|
41
|
+
const parsed = configSchema.parse(config);
|
|
42
|
+
return parsed.FIRECRAWL_MCP_URL;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Firecrawl plugin. Exposes a sub-agent (`call_firecrawl_agent`) that wraps
|
|
46
|
+
* the upstream Firecrawl MCP server's `firecrawl_search` and
|
|
47
|
+
* `firecrawl_scrape` tools.
|
|
48
|
+
*/
|
|
49
|
+
export class FirecrawlPlugin extends OraclePlugin {
|
|
50
|
+
name = 'firecrawl';
|
|
51
|
+
version = '1.0.0';
|
|
52
|
+
manifest = manifest;
|
|
53
|
+
configSchema = configSchema;
|
|
54
|
+
autoDetectHint = 'FIRECRAWL_MCP_URL';
|
|
55
|
+
mcpFactory;
|
|
56
|
+
constructor(options = {}) {
|
|
57
|
+
super();
|
|
58
|
+
this.mcpFactory = options.mcpFactory ?? createDefaultFirecrawlMcpFactory;
|
|
59
|
+
}
|
|
60
|
+
autoDetect(env) {
|
|
61
|
+
return Boolean(env.FIRECRAWL_MCP_URL);
|
|
62
|
+
}
|
|
63
|
+
getSubAgents(ctx) {
|
|
64
|
+
const firecrawlUrl = resolveFirecrawlUrl(ctx.config);
|
|
65
|
+
const factory = this.mcpFactory(firecrawlUrl);
|
|
66
|
+
const tools = createFirecrawlTools(factory);
|
|
67
|
+
return [createFirecrawlSubAgent(tools)];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/firecrawl/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,KAAK,sBAAsB,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,GAC3B,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { OraclePlugin } from '../plugin-api/oracle-plugin.js';
|
|
2
|
+
import { AGUIPlugin } from './agui/index.js';
|
|
3
|
+
import { ComposioPlugin } from './composio/index.js';
|
|
4
|
+
import { CreditsPlugin } from './credits/index.js';
|
|
5
|
+
import { DomainIndexerPlugin } from './domain-indexer/index.js';
|
|
6
|
+
import { EditorPlugin } from './editor/index.js';
|
|
7
|
+
import { FirecrawlPlugin } from './firecrawl/index.js';
|
|
8
|
+
import { MatrixGroupChatsPlugin } from './matrix-group-chats/index.js';
|
|
9
|
+
import { MemoryPlugin } from './memory/index.js';
|
|
10
|
+
import { PortalPlugin } from './portal/index.js';
|
|
11
|
+
import { SandboxPlugin } from './sandbox/index.js';
|
|
12
|
+
import { SkillsPlugin } from './skills/index.js';
|
|
13
|
+
import { SlackPlugin } from './slack/index.js';
|
|
14
|
+
import { UserPreferencesPlugin } from './user-preferences/index.js';
|
|
15
|
+
export declare const memoryPlugin: MemoryPlugin;
|
|
16
|
+
export declare const portalPlugin: PortalPlugin;
|
|
17
|
+
export declare const firecrawlPlugin: FirecrawlPlugin;
|
|
18
|
+
export declare const domainIndexerPlugin: DomainIndexerPlugin;
|
|
19
|
+
export declare const composioPlugin: ComposioPlugin;
|
|
20
|
+
export declare const sandboxPlugin: SandboxPlugin;
|
|
21
|
+
export declare const skillsPlugin: SkillsPlugin;
|
|
22
|
+
export declare const editorPlugin: EditorPlugin;
|
|
23
|
+
export declare const aguiPlugin: AGUIPlugin;
|
|
24
|
+
export declare const slackPlugin: SlackPlugin;
|
|
25
|
+
export declare const tasksPlugin: OraclePlugin & {
|
|
26
|
+
readonly name: "tasks";
|
|
27
|
+
};
|
|
28
|
+
export declare const creditsPlugin: CreditsPlugin;
|
|
29
|
+
export declare const callsPlugin: OraclePlugin & {
|
|
30
|
+
readonly name: "calls";
|
|
31
|
+
};
|
|
32
|
+
export declare const userPreferencesPlugin: UserPreferencesPlugin;
|
|
33
|
+
export declare const matrixGroupChatsPlugin: MatrixGroupChatsPlugin;
|
|
34
|
+
/**
|
|
35
|
+
* The canonical bundled-plugin set used by `createOracleApp` when the
|
|
36
|
+
* caller does not supply `bundledPlugins`. Forks that need a custom
|
|
37
|
+
* bundled set pass their own array via `bundledPlugins`.
|
|
38
|
+
*
|
|
39
|
+
* Typed as a readonly tuple via `as const` so `BundledFeatureName` can
|
|
40
|
+
* derive the literal union of plugin names from this single source.
|
|
41
|
+
*/
|
|
42
|
+
export declare const BUNDLED_PLUGINS: readonly [MemoryPlugin, PortalPlugin, FirecrawlPlugin, DomainIndexerPlugin, ComposioPlugin, SandboxPlugin, SkillsPlugin, EditorPlugin, AGUIPlugin, SlackPlugin, OraclePlugin & {
|
|
43
|
+
readonly name: "tasks";
|
|
44
|
+
}, CreditsPlugin, OraclePlugin & {
|
|
45
|
+
readonly name: "calls";
|
|
46
|
+
}, UserPreferencesPlugin, MatrixGroupChatsPlugin];
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAqBpE,eAAO,MAAM,YAAY,cAAqB,CAAC;AAC/C,eAAO,MAAM,YAAY,cAAqB,CAAC;AAC/C,eAAO,MAAM,eAAe,iBAAwB,CAAC;AACrD,eAAO,MAAM,mBAAmB,qBAA4B,CAAC;AAC7D,eAAO,MAAM,cAAc,gBAAuB,CAAC;AACnD,eAAO,MAAM,aAAa,eAAsB,CAAC;AACjD,eAAO,MAAM,YAAY,cAAqB,CAAC;AAC/C,eAAO,MAAM,YAAY,cAAqB,CAAC;AAC/C,eAAO,MAAM,UAAU,YAAmB,CAAC;AAC3C,eAAO,MAAM,WAAW,aAAoB,CAAC;AAC7C,eAAO,MAAM,WAAW;;CAGtB,CAAC;AACH,eAAO,MAAM,aAAa,eAAsB,CAAC;AACjD,eAAO,MAAM,WAAW;;CAAyB,CAAC;AAClD,eAAO,MAAM,qBAAqB,uBAA8B,CAAC;AACjE,eAAO,MAAM,sBAAsB,wBAA+B,CAAC;AAEnE;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe;;;;iDAgBoB,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { AGUIPlugin } from './agui/index.js';
|
|
2
|
+
import { ComposioPlugin } from './composio/index.js';
|
|
3
|
+
import { CreditsPlugin } from './credits/index.js';
|
|
4
|
+
import { DomainIndexerPlugin } from './domain-indexer/index.js';
|
|
5
|
+
import { EditorPlugin } from './editor/index.js';
|
|
6
|
+
import { FirecrawlPlugin } from './firecrawl/index.js';
|
|
7
|
+
import { MatrixGroupChatsPlugin } from './matrix-group-chats/index.js';
|
|
8
|
+
import { MemoryPlugin } from './memory/index.js';
|
|
9
|
+
import { PortalPlugin } from './portal/index.js';
|
|
10
|
+
import { SandboxPlugin } from './sandbox/index.js';
|
|
11
|
+
import { SkillsPlugin } from './skills/index.js';
|
|
12
|
+
import { SlackPlugin } from './slack/index.js';
|
|
13
|
+
import { UserPreferencesPlugin } from './user-preferences/index.js';
|
|
14
|
+
const stubManifest = (title) => ({
|
|
15
|
+
title,
|
|
16
|
+
summary: `${title} plugin.`,
|
|
17
|
+
whenToUse: [],
|
|
18
|
+
visibility: 'silent',
|
|
19
|
+
stability: 'experimental',
|
|
20
|
+
});
|
|
21
|
+
const stub = (name, title, extras = {}) => ({
|
|
22
|
+
version: '0.0.0',
|
|
23
|
+
manifest: stubManifest(title),
|
|
24
|
+
...extras,
|
|
25
|
+
name,
|
|
26
|
+
});
|
|
27
|
+
export const memoryPlugin = new MemoryPlugin();
|
|
28
|
+
export const portalPlugin = new PortalPlugin();
|
|
29
|
+
export const firecrawlPlugin = new FirecrawlPlugin();
|
|
30
|
+
export const domainIndexerPlugin = new DomainIndexerPlugin();
|
|
31
|
+
export const composioPlugin = new ComposioPlugin();
|
|
32
|
+
export const sandboxPlugin = new SandboxPlugin();
|
|
33
|
+
export const skillsPlugin = new SkillsPlugin();
|
|
34
|
+
export const editorPlugin = new EditorPlugin();
|
|
35
|
+
export const aguiPlugin = new AGUIPlugin();
|
|
36
|
+
export const slackPlugin = new SlackPlugin();
|
|
37
|
+
export const tasksPlugin = stub('tasks', 'Tasks', {
|
|
38
|
+
autoDetect: (env) => Boolean(env.REDIS_URL),
|
|
39
|
+
autoDetectHint: 'REDIS_URL',
|
|
40
|
+
});
|
|
41
|
+
export const creditsPlugin = new CreditsPlugin();
|
|
42
|
+
export const callsPlugin = stub('calls', 'Calls');
|
|
43
|
+
export const userPreferencesPlugin = new UserPreferencesPlugin();
|
|
44
|
+
export const matrixGroupChatsPlugin = new MatrixGroupChatsPlugin();
|
|
45
|
+
/**
|
|
46
|
+
* The canonical bundled-plugin set used by `createOracleApp` when the
|
|
47
|
+
* caller does not supply `bundledPlugins`. Forks that need a custom
|
|
48
|
+
* bundled set pass their own array via `bundledPlugins`.
|
|
49
|
+
*
|
|
50
|
+
* Typed as a readonly tuple via `as const` so `BundledFeatureName` can
|
|
51
|
+
* derive the literal union of plugin names from this single source.
|
|
52
|
+
*/
|
|
53
|
+
export const BUNDLED_PLUGINS = [
|
|
54
|
+
memoryPlugin,
|
|
55
|
+
portalPlugin,
|
|
56
|
+
firecrawlPlugin,
|
|
57
|
+
domainIndexerPlugin,
|
|
58
|
+
composioPlugin,
|
|
59
|
+
sandboxPlugin,
|
|
60
|
+
skillsPlugin,
|
|
61
|
+
editorPlugin,
|
|
62
|
+
aguiPlugin,
|
|
63
|
+
slackPlugin,
|
|
64
|
+
tasksPlugin,
|
|
65
|
+
creditsPlugin,
|
|
66
|
+
callsPlugin,
|
|
67
|
+
userPreferencesPlugin,
|
|
68
|
+
matrixGroupChatsPlugin,
|
|
69
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel-memory.module.d.ts","sourceRoot":"","sources":["../../../src/plugins/matrix-group-chats/channel-memory.module.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,qBAKa,mBAAmB;CAAG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Global, Module } from '@nestjs/common';
|
|
8
|
+
import { ChannelMemoryService } from './channel-memory.service.js';
|
|
9
|
+
/**
|
|
10
|
+
* Channel-memory module. Globally exports `ChannelMemoryService` so other
|
|
11
|
+
* plugins / forks can inject it without re-importing the module.
|
|
12
|
+
*/
|
|
13
|
+
let ChannelMemoryModule = class ChannelMemoryModule {
|
|
14
|
+
};
|
|
15
|
+
ChannelMemoryModule = __decorate([
|
|
16
|
+
Global(),
|
|
17
|
+
Module({
|
|
18
|
+
providers: [ChannelMemoryService],
|
|
19
|
+
exports: [ChannelMemoryService],
|
|
20
|
+
})
|
|
21
|
+
], ChannelMemoryModule);
|
|
22
|
+
export { ChannelMemoryModule };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type ChannelMemoryChunk, type ChannelMember, type PinnedFact } from './channel-memory.types.js';
|
|
2
|
+
export interface TierRollupCandidate {
|
|
3
|
+
/** Inclusive lower bound of the bucket window (epoch ms). */
|
|
4
|
+
windowStart: number;
|
|
5
|
+
/** Exclusive upper bound. */
|
|
6
|
+
windowEnd: number;
|
|
7
|
+
/** Tier the rollup will produce (2 or 3). */
|
|
8
|
+
toTier: number;
|
|
9
|
+
/** Source chunks being consolidated. */
|
|
10
|
+
chunks: ChannelMemoryChunk[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* SQLite repository for channel memory chunks, pinned facts, and roster.
|
|
14
|
+
*
|
|
15
|
+
* One DB file per room. better-sqlite3 (already a transitive dep via the
|
|
16
|
+
* checkpointer) + FTS5 (built-in) for chunk search. Schema is created
|
|
17
|
+
* idempotently on init.
|
|
18
|
+
*/
|
|
19
|
+
export declare class ChannelMemoryRepo {
|
|
20
|
+
private readonly db;
|
|
21
|
+
constructor(databasePath: string);
|
|
22
|
+
private bootstrap;
|
|
23
|
+
insertChunk(chunk: ChannelMemoryChunk): void;
|
|
24
|
+
recentChunks(roomId: string, limit: number, tier?: number): ChannelMemoryChunk[];
|
|
25
|
+
oldestChunks(roomId: string, limit: number): ChannelMemoryChunk[];
|
|
26
|
+
countChunks(roomId: string): number;
|
|
27
|
+
/**
|
|
28
|
+
* Find tier=N chunks older than `olderThanTs` and return them grouped into
|
|
29
|
+
* fixed time buckets (week or month). Used by the tier scheduler to roll
|
|
30
|
+
* granular tier-1 chunks into a tier-2 weekly summary, then tier-2 into
|
|
31
|
+
* tier-3 monthly summaries.
|
|
32
|
+
*/
|
|
33
|
+
findRollupCandidates(roomId: string, args: {
|
|
34
|
+
sourceTier: number;
|
|
35
|
+
olderThanTs: number;
|
|
36
|
+
bucketMs: number;
|
|
37
|
+
minChunksPerBucket: number;
|
|
38
|
+
}): TierRollupCandidate[];
|
|
39
|
+
/**
|
|
40
|
+
* Atomically delete a list of source chunks and insert a rollup. Used by the
|
|
41
|
+
* tier scheduler — keeps the DB consistent if the process is interrupted
|
|
42
|
+
* mid-rollup.
|
|
43
|
+
*/
|
|
44
|
+
replaceWithRollup(sourceIds: string[], rollup: ChannelMemoryChunk): void;
|
|
45
|
+
searchChunks(roomId: string, query: string, limit: number): ChannelMemoryChunk[];
|
|
46
|
+
insertPinnedFact(fact: PinnedFact): void;
|
|
47
|
+
listPinnedFacts(roomId: string, limit?: number): PinnedFact[];
|
|
48
|
+
deletePinnedFact(roomId: string, factId: string): boolean;
|
|
49
|
+
upsertMembers(roomId: string, members: ChannelMember[]): void;
|
|
50
|
+
getMembers(roomId: string): ChannelMember[];
|
|
51
|
+
/**
|
|
52
|
+
* Force the SQLite WAL to disk before snapshot / upload, so the file on
|
|
53
|
+
* disk reflects every committed transaction. Cheap; safe to call often.
|
|
54
|
+
*/
|
|
55
|
+
checkpoint(): void;
|
|
56
|
+
/** List every room this DB has ever stored data for. */
|
|
57
|
+
listRoomIds(): string[];
|
|
58
|
+
close(): void;
|
|
59
|
+
private rowToChunk;
|
|
60
|
+
private rowToFact;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=channel-memory.repo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel-memory.repo.d.ts","sourceRoot":"","sources":["../../../src/plugins/matrix-group-chats/channel-memory.repo.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,UAAU,EAChB,MAAM,2BAA2B,CAAC;AAInC,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,MAAM,EAAE,kBAAkB,EAAE,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAe;gBAEtB,YAAY,EAAE,MAAM;IAShC,OAAO,CAAC,SAAS;IAmEjB,WAAW,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI;IAwB5C,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,SAAI,GAAG,kBAAkB,EAAE;IAY3E,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAYjE,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IASnC;;;;;OAKG;IACH,oBAAoB,CAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE;QACJ,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,kBAAkB,EAAE,MAAM,CAAC;KAC5B,GACA,mBAAmB,EAAE;IAmCxB;;;;OAIG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,kBAAkB,GAAG,IAAI;IAaxE,YAAY,CACV,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,kBAAkB,EAAE;IAsCvB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAiBxC,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,SAAM,GAAG,UAAU,EAAE;IAY1D,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAOzD,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,IAAI;IAY7D,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE;IAoB3C;;;OAGG;IACH,UAAU,IAAI,IAAI;IAUlB,wDAAwD;IACxD,WAAW,IAAI,MAAM,EAAE;IAWvB,KAAK,IAAI,IAAI;IAUb,OAAO,CAAC,UAAU,CAaf;IAEH,OAAO,CAAC,SAAS,CAOd;CACJ"}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { Logger } from '@nestjs/common';
|
|
2
|
+
import Database from 'better-sqlite3';
|
|
3
|
+
import * as fs from 'node:fs';
|
|
4
|
+
import * as path from 'node:path';
|
|
5
|
+
const logger = new Logger('ChannelMemoryRepo');
|
|
6
|
+
/**
|
|
7
|
+
* SQLite repository for channel memory chunks, pinned facts, and roster.
|
|
8
|
+
*
|
|
9
|
+
* One DB file per room. better-sqlite3 (already a transitive dep via the
|
|
10
|
+
* checkpointer) + FTS5 (built-in) for chunk search. Schema is created
|
|
11
|
+
* idempotently on init.
|
|
12
|
+
*/
|
|
13
|
+
export class ChannelMemoryRepo {
|
|
14
|
+
db;
|
|
15
|
+
constructor(databasePath) {
|
|
16
|
+
fs.mkdirSync(path.dirname(databasePath), { recursive: true });
|
|
17
|
+
this.db = new Database(databasePath);
|
|
18
|
+
this.db.pragma('journal_mode = WAL');
|
|
19
|
+
this.db.pragma('busy_timeout = 5000');
|
|
20
|
+
this.db.pragma('synchronous = NORMAL');
|
|
21
|
+
this.bootstrap();
|
|
22
|
+
}
|
|
23
|
+
bootstrap() {
|
|
24
|
+
this.db.exec(`
|
|
25
|
+
CREATE TABLE IF NOT EXISTS channel_memory_chunks (
|
|
26
|
+
id TEXT PRIMARY KEY,
|
|
27
|
+
room_id TEXT NOT NULL,
|
|
28
|
+
summary TEXT NOT NULL,
|
|
29
|
+
from_event_id TEXT NOT NULL,
|
|
30
|
+
to_event_id TEXT NOT NULL,
|
|
31
|
+
from_ts INTEGER NOT NULL,
|
|
32
|
+
to_ts INTEGER NOT NULL,
|
|
33
|
+
message_count INTEGER NOT NULL,
|
|
34
|
+
participants_json TEXT NOT NULL,
|
|
35
|
+
thread_ids_json TEXT NOT NULL,
|
|
36
|
+
tier INTEGER NOT NULL DEFAULT 1,
|
|
37
|
+
created_at INTEGER NOT NULL
|
|
38
|
+
);
|
|
39
|
+
CREATE INDEX IF NOT EXISTS idx_chunks_room_ts
|
|
40
|
+
ON channel_memory_chunks(room_id, to_ts DESC);
|
|
41
|
+
CREATE INDEX IF NOT EXISTS idx_chunks_room_tier_ts
|
|
42
|
+
ON channel_memory_chunks(room_id, tier, to_ts DESC);
|
|
43
|
+
|
|
44
|
+
CREATE TABLE IF NOT EXISTS channel_pinned_facts (
|
|
45
|
+
id TEXT PRIMARY KEY,
|
|
46
|
+
room_id TEXT NOT NULL,
|
|
47
|
+
fact TEXT NOT NULL,
|
|
48
|
+
pinned_by_did TEXT NOT NULL,
|
|
49
|
+
source_event_id TEXT,
|
|
50
|
+
created_at INTEGER NOT NULL
|
|
51
|
+
);
|
|
52
|
+
CREATE INDEX IF NOT EXISTS idx_facts_room
|
|
53
|
+
ON channel_pinned_facts(room_id, created_at DESC);
|
|
54
|
+
|
|
55
|
+
CREATE TABLE IF NOT EXISTS channel_meta (
|
|
56
|
+
room_id TEXT PRIMARY KEY,
|
|
57
|
+
members_json TEXT NOT NULL DEFAULT '[]',
|
|
58
|
+
updated_at INTEGER NOT NULL
|
|
59
|
+
);
|
|
60
|
+
`);
|
|
61
|
+
// FTS5 virtual table. Skip silently if SQLite was built without FTS5.
|
|
62
|
+
try {
|
|
63
|
+
this.db.exec(`
|
|
64
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS channel_memory_chunks_fts USING fts5(
|
|
65
|
+
summary,
|
|
66
|
+
room_id UNINDEXED,
|
|
67
|
+
content='channel_memory_chunks',
|
|
68
|
+
content_rowid='rowid',
|
|
69
|
+
tokenize='porter unicode61'
|
|
70
|
+
);
|
|
71
|
+
CREATE TRIGGER IF NOT EXISTS chunks_ai AFTER INSERT ON channel_memory_chunks
|
|
72
|
+
BEGIN
|
|
73
|
+
INSERT INTO channel_memory_chunks_fts(rowid, summary, room_id)
|
|
74
|
+
VALUES (new.rowid, new.summary, new.room_id);
|
|
75
|
+
END;
|
|
76
|
+
CREATE TRIGGER IF NOT EXISTS chunks_ad AFTER DELETE ON channel_memory_chunks
|
|
77
|
+
BEGIN
|
|
78
|
+
INSERT INTO channel_memory_chunks_fts(channel_memory_chunks_fts, rowid, summary, room_id)
|
|
79
|
+
VALUES ('delete', old.rowid, old.summary, old.room_id);
|
|
80
|
+
END;
|
|
81
|
+
`);
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
logger.warn(`[ChannelMemoryRepo] FTS5 bootstrap failed; search will use LIKE fallback. ${err instanceof Error ? err.message : String(err)}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
insertChunk(chunk) {
|
|
88
|
+
this.db
|
|
89
|
+
.prepare(`INSERT INTO channel_memory_chunks (
|
|
90
|
+
id, room_id, summary, from_event_id, to_event_id, from_ts, to_ts,
|
|
91
|
+
message_count, participants_json, thread_ids_json, tier, created_at
|
|
92
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
93
|
+
.run(chunk.id, chunk.roomId, chunk.summary, chunk.fromEventId, chunk.toEventId, chunk.fromTimestamp, chunk.toTimestamp, chunk.messageCount, JSON.stringify(chunk.participants), JSON.stringify(chunk.threadIds), chunk.tier, chunk.createdAt);
|
|
94
|
+
}
|
|
95
|
+
recentChunks(roomId, limit, tier = 1) {
|
|
96
|
+
const rows = this.db
|
|
97
|
+
.prepare(`SELECT * FROM channel_memory_chunks
|
|
98
|
+
WHERE room_id = ? AND tier = ?
|
|
99
|
+
ORDER BY to_ts DESC
|
|
100
|
+
LIMIT ?`)
|
|
101
|
+
.all(roomId, tier, limit);
|
|
102
|
+
return rows.map(this.rowToChunk);
|
|
103
|
+
}
|
|
104
|
+
oldestChunks(roomId, limit) {
|
|
105
|
+
const rows = this.db
|
|
106
|
+
.prepare(`SELECT * FROM channel_memory_chunks
|
|
107
|
+
WHERE room_id = ?
|
|
108
|
+
ORDER BY to_ts ASC
|
|
109
|
+
LIMIT ?`)
|
|
110
|
+
.all(roomId, limit);
|
|
111
|
+
return rows.map(this.rowToChunk);
|
|
112
|
+
}
|
|
113
|
+
countChunks(roomId) {
|
|
114
|
+
const row = this.db
|
|
115
|
+
.prepare(`SELECT COUNT(*) AS n FROM channel_memory_chunks WHERE room_id = ?`)
|
|
116
|
+
.get(roomId);
|
|
117
|
+
return row?.n ?? 0;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Find tier=N chunks older than `olderThanTs` and return them grouped into
|
|
121
|
+
* fixed time buckets (week or month). Used by the tier scheduler to roll
|
|
122
|
+
* granular tier-1 chunks into a tier-2 weekly summary, then tier-2 into
|
|
123
|
+
* tier-3 monthly summaries.
|
|
124
|
+
*/
|
|
125
|
+
findRollupCandidates(roomId, args) {
|
|
126
|
+
const rows = this.db
|
|
127
|
+
.prepare(`SELECT * FROM channel_memory_chunks
|
|
128
|
+
WHERE room_id = ? AND tier = ? AND to_ts < ?
|
|
129
|
+
ORDER BY to_ts ASC`)
|
|
130
|
+
.all(roomId, args.sourceTier, args.olderThanTs);
|
|
131
|
+
if (rows.length === 0)
|
|
132
|
+
return [];
|
|
133
|
+
const buckets = new Map();
|
|
134
|
+
for (const row of rows) {
|
|
135
|
+
const chunk = this.rowToChunk(row);
|
|
136
|
+
const bucketKey = Math.floor(chunk.toTimestamp / args.bucketMs) * args.bucketMs;
|
|
137
|
+
const list = buckets.get(bucketKey) ?? [];
|
|
138
|
+
list.push(chunk);
|
|
139
|
+
buckets.set(bucketKey, list);
|
|
140
|
+
}
|
|
141
|
+
const candidates = [];
|
|
142
|
+
for (const [bucketKey, chunks] of buckets.entries()) {
|
|
143
|
+
if (chunks.length < args.minChunksPerBucket)
|
|
144
|
+
continue;
|
|
145
|
+
candidates.push({
|
|
146
|
+
windowStart: bucketKey,
|
|
147
|
+
windowEnd: bucketKey + args.bucketMs,
|
|
148
|
+
toTier: args.sourceTier + 1,
|
|
149
|
+
chunks,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return candidates;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Atomically delete a list of source chunks and insert a rollup. Used by the
|
|
156
|
+
* tier scheduler — keeps the DB consistent if the process is interrupted
|
|
157
|
+
* mid-rollup.
|
|
158
|
+
*/
|
|
159
|
+
replaceWithRollup(sourceIds, rollup) {
|
|
160
|
+
const tx = this.db.transaction((ids, chunk) => {
|
|
161
|
+
const del = this.db.prepare(`DELETE FROM channel_memory_chunks WHERE id = ?`);
|
|
162
|
+
for (const id of ids)
|
|
163
|
+
del.run(id);
|
|
164
|
+
this.insertChunk(chunk);
|
|
165
|
+
});
|
|
166
|
+
tx(sourceIds, rollup);
|
|
167
|
+
}
|
|
168
|
+
searchChunks(roomId, query, limit) {
|
|
169
|
+
const trimmed = query.trim();
|
|
170
|
+
if (!trimmed)
|
|
171
|
+
return this.recentChunks(roomId, limit);
|
|
172
|
+
const words = trimmed.split(/\s+/).filter(Boolean);
|
|
173
|
+
const ftsQuery = words.length > 1 ? words.join(' OR ') : trimmed;
|
|
174
|
+
try {
|
|
175
|
+
const rows = this.db
|
|
176
|
+
.prepare(`SELECT c.* FROM channel_memory_chunks c
|
|
177
|
+
JOIN channel_memory_chunks_fts f ON f.rowid = c.rowid
|
|
178
|
+
WHERE c.room_id = ? AND channel_memory_chunks_fts MATCH ?
|
|
179
|
+
ORDER BY rank LIMIT ?`)
|
|
180
|
+
.all(roomId, ftsQuery, limit);
|
|
181
|
+
return rows.map(this.rowToChunk);
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
logger.debug?.(`[ChannelMemoryRepo] FTS query failed (${err instanceof Error ? err.message : String(err)}); falling back to LIKE`);
|
|
185
|
+
const likeConditions = words
|
|
186
|
+
.map(() => `summary LIKE ? ESCAPE '\\'`)
|
|
187
|
+
.join(' AND ');
|
|
188
|
+
const likeValues = words.map((w) => `%${w.replace(/[%_]/g, (c) => `\\${c}`)}%`);
|
|
189
|
+
const rows = this.db
|
|
190
|
+
.prepare(`SELECT * FROM channel_memory_chunks
|
|
191
|
+
WHERE room_id = ? AND ${likeConditions}
|
|
192
|
+
ORDER BY to_ts DESC LIMIT ?`)
|
|
193
|
+
.all(roomId, ...likeValues, limit);
|
|
194
|
+
return rows.map(this.rowToChunk);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
insertPinnedFact(fact) {
|
|
198
|
+
this.db
|
|
199
|
+
.prepare(`INSERT INTO channel_pinned_facts (
|
|
200
|
+
id, room_id, fact, pinned_by_did, source_event_id, created_at
|
|
201
|
+
) VALUES (?, ?, ?, ?, ?, ?)`)
|
|
202
|
+
.run(fact.id, fact.roomId, fact.fact, fact.pinnedByDid, fact.sourceEventId ?? null, fact.createdAt);
|
|
203
|
+
}
|
|
204
|
+
listPinnedFacts(roomId, limit = 100) {
|
|
205
|
+
const rows = this.db
|
|
206
|
+
.prepare(`SELECT * FROM channel_pinned_facts
|
|
207
|
+
WHERE room_id = ?
|
|
208
|
+
ORDER BY created_at DESC
|
|
209
|
+
LIMIT ?`)
|
|
210
|
+
.all(roomId, limit);
|
|
211
|
+
return rows.map(this.rowToFact);
|
|
212
|
+
}
|
|
213
|
+
deletePinnedFact(roomId, factId) {
|
|
214
|
+
const result = this.db
|
|
215
|
+
.prepare(`DELETE FROM channel_pinned_facts WHERE room_id = ? AND id = ?`)
|
|
216
|
+
.run(roomId, factId);
|
|
217
|
+
return result.changes > 0;
|
|
218
|
+
}
|
|
219
|
+
upsertMembers(roomId, members) {
|
|
220
|
+
this.db
|
|
221
|
+
.prepare(`INSERT INTO channel_meta (room_id, members_json, updated_at)
|
|
222
|
+
VALUES (?, ?, ?)
|
|
223
|
+
ON CONFLICT(room_id) DO UPDATE SET
|
|
224
|
+
members_json = excluded.members_json,
|
|
225
|
+
updated_at = excluded.updated_at`)
|
|
226
|
+
.run(roomId, JSON.stringify(members), Date.now());
|
|
227
|
+
}
|
|
228
|
+
getMembers(roomId) {
|
|
229
|
+
const row = this.db
|
|
230
|
+
.prepare(`SELECT members_json FROM channel_meta WHERE room_id = ?`)
|
|
231
|
+
.get(roomId);
|
|
232
|
+
if (!row?.members_json)
|
|
233
|
+
return [];
|
|
234
|
+
try {
|
|
235
|
+
const parsed = JSON.parse(row.members_json);
|
|
236
|
+
if (!Array.isArray(parsed))
|
|
237
|
+
return [];
|
|
238
|
+
return parsed.filter((m) => !!m &&
|
|
239
|
+
typeof m === 'object' &&
|
|
240
|
+
typeof m.matrixUserId === 'string' &&
|
|
241
|
+
typeof m.displayName === 'string');
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
return [];
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Force the SQLite WAL to disk before snapshot / upload, so the file on
|
|
249
|
+
* disk reflects every committed transaction. Cheap; safe to call often.
|
|
250
|
+
*/
|
|
251
|
+
checkpoint() {
|
|
252
|
+
try {
|
|
253
|
+
this.db.pragma('wal_checkpoint(TRUNCATE)');
|
|
254
|
+
}
|
|
255
|
+
catch (err) {
|
|
256
|
+
logger.warn(`[ChannelMemoryRepo] WAL checkpoint failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
/** List every room this DB has ever stored data for. */
|
|
260
|
+
listRoomIds() {
|
|
261
|
+
const rows = this.db
|
|
262
|
+
.prepare(`SELECT DISTINCT room_id FROM channel_memory_chunks
|
|
263
|
+
UNION
|
|
264
|
+
SELECT DISTINCT room_id FROM channel_meta`)
|
|
265
|
+
.all();
|
|
266
|
+
return rows.map((r) => r.room_id);
|
|
267
|
+
}
|
|
268
|
+
close() {
|
|
269
|
+
try {
|
|
270
|
+
this.db.close();
|
|
271
|
+
}
|
|
272
|
+
catch (err) {
|
|
273
|
+
logger.warn(`[ChannelMemoryRepo] close failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
rowToChunk = (row) => ({
|
|
277
|
+
id: row.id,
|
|
278
|
+
roomId: row.room_id,
|
|
279
|
+
summary: row.summary,
|
|
280
|
+
fromEventId: row.from_event_id,
|
|
281
|
+
toEventId: row.to_event_id,
|
|
282
|
+
fromTimestamp: row.from_ts,
|
|
283
|
+
toTimestamp: row.to_ts,
|
|
284
|
+
messageCount: row.message_count,
|
|
285
|
+
participants: safeJsonArray(row.participants_json),
|
|
286
|
+
threadIds: safeJsonArray(row.thread_ids_json),
|
|
287
|
+
tier: row.tier ?? 1,
|
|
288
|
+
createdAt: row.created_at,
|
|
289
|
+
});
|
|
290
|
+
rowToFact = (row) => ({
|
|
291
|
+
id: row.id,
|
|
292
|
+
roomId: row.room_id,
|
|
293
|
+
fact: row.fact,
|
|
294
|
+
pinnedByDid: row.pinned_by_did,
|
|
295
|
+
sourceEventId: row.source_event_id ?? undefined,
|
|
296
|
+
createdAt: row.created_at,
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
function safeJsonArray(raw) {
|
|
300
|
+
if (typeof raw !== 'string' || !raw.length)
|
|
301
|
+
return [];
|
|
302
|
+
try {
|
|
303
|
+
const parsed = JSON.parse(raw);
|
|
304
|
+
return Array.isArray(parsed)
|
|
305
|
+
? parsed.filter((s) => typeof s === 'string')
|
|
306
|
+
: [];
|
|
307
|
+
}
|
|
308
|
+
catch {
|
|
309
|
+
return [];
|
|
310
|
+
}
|
|
311
|
+
}
|