@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,358 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
/**
|
|
3
|
+
* Survey Helper Functions
|
|
4
|
+
*
|
|
5
|
+
* Utilities for parsing, validating, and working with SurveyJS survey schemas
|
|
6
|
+
* and answers in domainCreator blocks.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Parse a JSON string survey schema into a structured object
|
|
10
|
+
*/
|
|
11
|
+
export function parseSurveySchema(schemaString) {
|
|
12
|
+
try {
|
|
13
|
+
if (!schemaString || typeof schemaString !== 'string') {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const parsed = JSON.parse(schemaString);
|
|
17
|
+
return parsed;
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.error('Error parsing survey schema:', error);
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parse a JSON string of answers into a structured object
|
|
26
|
+
*/
|
|
27
|
+
export function parseSurveyAnswers(answersString) {
|
|
28
|
+
try {
|
|
29
|
+
if (!answersString || typeof answersString !== 'string') {
|
|
30
|
+
return {};
|
|
31
|
+
}
|
|
32
|
+
const parsed = JSON.parse(answersString);
|
|
33
|
+
return parsed;
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.error('Error parsing survey answers:', error);
|
|
37
|
+
return {};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Evaluate a visibility condition against current answers
|
|
42
|
+
* Simple evaluation for common patterns like {field} = value or {field} = true
|
|
43
|
+
*/
|
|
44
|
+
export function evaluateVisibilityCondition(condition, answers) {
|
|
45
|
+
if (!condition) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
// Handle simple patterns like {field} = value or {field} = true
|
|
50
|
+
const match = condition.match(/\{([^}]+)\}\s*=\s*(.+)/);
|
|
51
|
+
if (match && match[1] !== undefined && match[2] !== undefined) {
|
|
52
|
+
const fieldName = match[1].trim();
|
|
53
|
+
const expectedValue = match[2].trim();
|
|
54
|
+
const actualValue = answers[fieldName];
|
|
55
|
+
// Handle boolean strings
|
|
56
|
+
if (expectedValue === 'true') {
|
|
57
|
+
return actualValue === true || actualValue === 'true';
|
|
58
|
+
}
|
|
59
|
+
if (expectedValue === 'false') {
|
|
60
|
+
return actualValue === false || actualValue === 'false';
|
|
61
|
+
}
|
|
62
|
+
// Handle quoted strings
|
|
63
|
+
if ((expectedValue.startsWith('"') && expectedValue.endsWith('"')) ||
|
|
64
|
+
(expectedValue.startsWith("'") && expectedValue.endsWith("'"))) {
|
|
65
|
+
const unquoted = expectedValue.slice(1, -1);
|
|
66
|
+
return String(actualValue) === unquoted;
|
|
67
|
+
}
|
|
68
|
+
// Direct comparison
|
|
69
|
+
return String(actualValue) === expectedValue;
|
|
70
|
+
}
|
|
71
|
+
// Default to visible if we can't parse
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
console.error('Error evaluating visibility condition:', error);
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Fetch choices from a URL
|
|
81
|
+
*/
|
|
82
|
+
async function fetchChoicesFromUrl(choicesByUrl) {
|
|
83
|
+
try {
|
|
84
|
+
const response = await fetch(choicesByUrl.url, {
|
|
85
|
+
method: 'GET',
|
|
86
|
+
headers: {
|
|
87
|
+
'Content-Type': 'application/json',
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
if (!response.ok) {
|
|
91
|
+
console.warn(`Failed to fetch choices from ${choicesByUrl.url}: ${response.statusText}`);
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
const data = await response.json();
|
|
95
|
+
// Handle array response
|
|
96
|
+
if (Array.isArray(data)) {
|
|
97
|
+
return data.map((item) => ({
|
|
98
|
+
value: String(item[choicesByUrl.valueName] ?? item.value ?? ''),
|
|
99
|
+
text: String(item[choicesByUrl.titleName] ?? item.text ?? item.title ?? ''),
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
// Handle object response
|
|
103
|
+
if (typeof data === 'object' && data !== null) {
|
|
104
|
+
// If the response has a data property that's an array
|
|
105
|
+
if (Array.isArray(data.data)) {
|
|
106
|
+
return data.data.map((item) => ({
|
|
107
|
+
value: String(item[choicesByUrl.valueName] ?? item.value ?? ''),
|
|
108
|
+
text: String(item[choicesByUrl.titleName] ?? item.text ?? item.title ?? ''),
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
// If the response itself is an object with valueName and titleName properties
|
|
112
|
+
if (data[choicesByUrl.valueName] !== undefined) {
|
|
113
|
+
return [
|
|
114
|
+
{
|
|
115
|
+
value: String(data[choicesByUrl.valueName]),
|
|
116
|
+
text: String(data[choicesByUrl.titleName] ?? data[choicesByUrl.valueName]),
|
|
117
|
+
},
|
|
118
|
+
];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
console.warn(`Unexpected response format from ${choicesByUrl.url}`);
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
console.error(`Error fetching choices from ${choicesByUrl.url}:`, error);
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Extract all questions from a survey schema with metadata
|
|
131
|
+
* Fetches choices from choicesByUrl if present
|
|
132
|
+
* If answers are provided, computes visibility inline
|
|
133
|
+
*/
|
|
134
|
+
export async function extractSurveyQuestions(schema, answers) {
|
|
135
|
+
const questions = [];
|
|
136
|
+
if (!schema.pages || !Array.isArray(schema.pages)) {
|
|
137
|
+
return questions;
|
|
138
|
+
}
|
|
139
|
+
async function extractFromElements(elements, pageName, pageTitle) {
|
|
140
|
+
for (const element of elements) {
|
|
141
|
+
// Skip elements without a name (they're not answerable)
|
|
142
|
+
if (!element.name) {
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
let choices = element.choices;
|
|
146
|
+
// Fetch choices from URL if choicesByUrl is present
|
|
147
|
+
if (element.choicesByUrl && !choices) {
|
|
148
|
+
const fetchedChoices = await fetchChoicesFromUrl(element.choicesByUrl);
|
|
149
|
+
if (fetchedChoices) {
|
|
150
|
+
choices = fetchedChoices;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const question = {
|
|
154
|
+
name: element.name,
|
|
155
|
+
title: element.title || element.name,
|
|
156
|
+
description: element.description,
|
|
157
|
+
type: element.type,
|
|
158
|
+
inputType: element.inputType,
|
|
159
|
+
isRequired: element.isRequired === true,
|
|
160
|
+
isVisible: answers
|
|
161
|
+
? evaluateVisibilityCondition(element.visibleIf, answers)
|
|
162
|
+
: true, // Default to visible if no answers provided
|
|
163
|
+
visibleIf: element.visibleIf,
|
|
164
|
+
defaultValue: element.defaultValue,
|
|
165
|
+
choices,
|
|
166
|
+
choicesByUrl: element.choicesByUrl,
|
|
167
|
+
pageName,
|
|
168
|
+
pageTitle,
|
|
169
|
+
};
|
|
170
|
+
questions.push(question);
|
|
171
|
+
// Handle nested elements (panels, paneldynamic)
|
|
172
|
+
if (element.elements && Array.isArray(element.elements)) {
|
|
173
|
+
await extractFromElements(element.elements, pageName, pageTitle);
|
|
174
|
+
}
|
|
175
|
+
// Handle template elements (paneldynamic)
|
|
176
|
+
if (element.templateElements && Array.isArray(element.templateElements)) {
|
|
177
|
+
await extractFromElements(element.templateElements, pageName, pageTitle);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
for (const page of schema.pages) {
|
|
182
|
+
if (page.elements && Array.isArray(page.elements)) {
|
|
183
|
+
await extractFromElements(page.elements, page.name, page.title || page.name);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return questions;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Get all visible questions based on current answers
|
|
190
|
+
*/
|
|
191
|
+
export async function getVisibleQuestions(answers, schema) {
|
|
192
|
+
const allQuestions = await extractSurveyQuestions(schema, answers);
|
|
193
|
+
return allQuestions.filter((q) => q.isVisible !== false);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Get missing required fields from answers
|
|
197
|
+
*/
|
|
198
|
+
export async function getMissingRequiredFields(answers, schema) {
|
|
199
|
+
const visibleQuestions = await getVisibleQuestions(answers, schema);
|
|
200
|
+
const missing = [];
|
|
201
|
+
for (const question of visibleQuestions) {
|
|
202
|
+
if (question.isRequired) {
|
|
203
|
+
const value = answers[question.name];
|
|
204
|
+
if (value === undefined ||
|
|
205
|
+
value === null ||
|
|
206
|
+
value === '' ||
|
|
207
|
+
(Array.isArray(value) && value.length === 0)) {
|
|
208
|
+
missing.push(question.name);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return missing;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Validate a single answer value against a question
|
|
216
|
+
* Returns errors for visible questions, warnings for hidden questions
|
|
217
|
+
*/
|
|
218
|
+
function validateAnswerValue(question, value, options = {
|
|
219
|
+
checkRequired: true,
|
|
220
|
+
returnAsWarnings: false,
|
|
221
|
+
}) {
|
|
222
|
+
const issues = [];
|
|
223
|
+
// Check required (only if checkRequired is true)
|
|
224
|
+
if (options.checkRequired && question.isRequired) {
|
|
225
|
+
if (value === undefined ||
|
|
226
|
+
value === null ||
|
|
227
|
+
value === '' ||
|
|
228
|
+
(Array.isArray(value) && value.length === 0)) {
|
|
229
|
+
if (options.returnAsWarnings) {
|
|
230
|
+
issues.push({
|
|
231
|
+
field: question.name,
|
|
232
|
+
message: `${question.title || question.name} is required`,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
issues.push({
|
|
237
|
+
field: question.name,
|
|
238
|
+
message: `${question.title || question.name} is required`,
|
|
239
|
+
type: 'required',
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
return issues; // Don't check other validations if required is missing
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
// Check type and format
|
|
246
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
247
|
+
const addIssue = (message, type) => {
|
|
248
|
+
if (options.returnAsWarnings) {
|
|
249
|
+
issues.push({ field: question.name, message });
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
issues.push({
|
|
253
|
+
field: question.name,
|
|
254
|
+
message,
|
|
255
|
+
type: type || 'type',
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
switch (question.type) {
|
|
260
|
+
case 'boolean':
|
|
261
|
+
if (typeof value !== 'boolean' &&
|
|
262
|
+
value !== 'true' &&
|
|
263
|
+
value !== 'false') {
|
|
264
|
+
addIssue(`${question.title || question.name} must be a boolean`, 'type');
|
|
265
|
+
}
|
|
266
|
+
break;
|
|
267
|
+
case 'text':
|
|
268
|
+
if (typeof value !== 'string') {
|
|
269
|
+
addIssue(`${question.title || question.name} must be a string`, 'type');
|
|
270
|
+
}
|
|
271
|
+
break;
|
|
272
|
+
case 'dropdown':
|
|
273
|
+
if (typeof value !== 'string') {
|
|
274
|
+
addIssue(`${question.title || question.name} must be a string`, 'type');
|
|
275
|
+
}
|
|
276
|
+
// Check choices if available
|
|
277
|
+
if (question.choices && Array.isArray(question.choices)) {
|
|
278
|
+
const validValues = question.choices.map((c) => c.value);
|
|
279
|
+
if (!validValues.includes(String(value))) {
|
|
280
|
+
addIssue(`${question.title || question.name} must be one of: ${validValues.join(', ')}`, 'choice');
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
break;
|
|
284
|
+
case 'paneldynamic':
|
|
285
|
+
if (!Array.isArray(value)) {
|
|
286
|
+
addIssue(`${question.title || question.name} must be an array`, 'type');
|
|
287
|
+
}
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
// Check input type formats
|
|
291
|
+
if (question.inputType === 'email' && typeof value === 'string') {
|
|
292
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
293
|
+
if (!emailRegex.test(value)) {
|
|
294
|
+
addIssue(`${question.title || question.name} must be a valid email address`, 'format');
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
if (question.inputType === 'url' && typeof value === 'string') {
|
|
298
|
+
try {
|
|
299
|
+
new URL(value);
|
|
300
|
+
}
|
|
301
|
+
catch {
|
|
302
|
+
addIssue(`${question.title || question.name} must be a valid URL`, 'format');
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return issues;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Validate answers against schema requirements
|
|
310
|
+
*/
|
|
311
|
+
export async function validateAnswersAgainstSchema(answers, schema) {
|
|
312
|
+
const errors = [];
|
|
313
|
+
const warnings = [];
|
|
314
|
+
const visibleQuestions = await getVisibleQuestions(answers, schema);
|
|
315
|
+
const allQuestions = await extractSurveyQuestions(schema, answers);
|
|
316
|
+
// Validate visible questions - return errors
|
|
317
|
+
for (const question of visibleQuestions) {
|
|
318
|
+
const value = answers[question.name];
|
|
319
|
+
const questionErrors = validateAnswerValue(question, value, {
|
|
320
|
+
checkRequired: true,
|
|
321
|
+
returnAsWarnings: false,
|
|
322
|
+
});
|
|
323
|
+
errors.push(...questionErrors);
|
|
324
|
+
}
|
|
325
|
+
// Validate hidden questions that have answers - return warnings (skip required check)
|
|
326
|
+
const visibleQuestionNames = new Set(visibleQuestions.map((q) => q.name));
|
|
327
|
+
for (const question of allQuestions) {
|
|
328
|
+
if (!visibleQuestionNames.has(question.name)) {
|
|
329
|
+
// This is a hidden question
|
|
330
|
+
const value = answers[question.name];
|
|
331
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
332
|
+
// Only validate if agent provided a value for hidden field
|
|
333
|
+
const questionWarnings = validateAnswerValue(question, value, {
|
|
334
|
+
checkRequired: false,
|
|
335
|
+
returnAsWarnings: true,
|
|
336
|
+
});
|
|
337
|
+
warnings.push(...questionWarnings);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
// Check for answers that don't correspond to ANY question (visible or hidden)
|
|
342
|
+
const allQuestionNames = new Set(allQuestions.map((q) => q.name));
|
|
343
|
+
for (const answerKey of Object.keys(answers)) {
|
|
344
|
+
if (!allQuestionNames.has(answerKey)) {
|
|
345
|
+
warnings.push({
|
|
346
|
+
field: answerKey,
|
|
347
|
+
message: `Answer for "${answerKey}" does not correspond to any question in the schema`,
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
const result = {
|
|
352
|
+
valid: errors.length === 0,
|
|
353
|
+
errors,
|
|
354
|
+
warnings,
|
|
355
|
+
};
|
|
356
|
+
console.log('validateAnswersAgainstSchema result:', result);
|
|
357
|
+
return result;
|
|
358
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PluginSubAgent, PluginTool } from '../../plugin-api/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Build the Firecrawl sub-agent definition. Tools are supplied by the
|
|
4
|
+
* plugin and close over a `MultiServerMCPClient` keyed to `FIRECRAWL_MCP_URL`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createFirecrawlSubAgent(tools: PluginTool[]): PluginSubAgent;
|
|
7
|
+
//# sourceMappingURL=firecrawl-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firecrawl-agent.d.ts","sourceRoot":"","sources":["../../../src/plugins/firecrawl/firecrawl-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AA+E5E;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,cAAc,CAS3E"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const SHARED_EXPECTATIONS = `
|
|
2
|
+
You are the Firecrawl Agent for this workspace. Your entire job is to perform
|
|
3
|
+
web search and scraping tasks through the Firecrawl MCP tools on behalf of the
|
|
4
|
+
user.
|
|
5
|
+
|
|
6
|
+
🚨 **API REJECTION RULE**: You are ONLY for scraping human-readable web pages and web search. If the task asks you to fetch data from an API endpoint (any URL containing /api/, /v1/, /v2/, /v3/, returning JSON/XML data, or any REST/GraphQL endpoint), you MUST refuse and reply: "This is an API call — use the Sandbox instead (write a script with fetch/curl/requests). I only handle web pages and web search." Do NOT attempt to scrape API endpoints.
|
|
7
|
+
|
|
8
|
+
Core expectations:
|
|
9
|
+
- Treat published web content as potentially unreliable—cross-check when you can.
|
|
10
|
+
- Never make HTTP requests directly; always operate through the exposed Firecrawl
|
|
11
|
+
tools and respect their rate limits.
|
|
12
|
+
- Narrate what you're about to fetch or search, then summarize the findings with
|
|
13
|
+
citations (URLs) when possible.
|
|
14
|
+
- Call out stale, conflicting, or missing information before acting on it.
|
|
15
|
+
|
|
16
|
+
Efficiency rules (CRITICAL — you run under a strict time budget):
|
|
17
|
+
- **Search once, search smart.** Write a single, well-crafted search query that
|
|
18
|
+
targets exactly what you need. Do NOT issue multiple redundant searches hoping
|
|
19
|
+
for better results.
|
|
20
|
+
- **One source is enough when the data is clear.** For factual lookups (prices,
|
|
21
|
+
weather, scores, exchange rates), use ONE authoritative result. Do not scrape
|
|
22
|
+
multiple sites to cross-verify commodity prices or similar public data.
|
|
23
|
+
- **Prefer search over scrape.** \`firecrawl_search\` returns snippets directly —
|
|
24
|
+
use it first. Only fall back to \`firecrawl_scrape\` when you need full-page
|
|
25
|
+
content that search snippets can't provide (e.g., full articles, tables).
|
|
26
|
+
- **Never crawl entire sites.** If a search gives you the answer, stop. Do not
|
|
27
|
+
follow links to "learn more" or scrape additional pages for context.
|
|
28
|
+
- **Fail fast.** If a search returns no useful results on the first try, report
|
|
29
|
+
what you found (or didn't) and stop. Do NOT rephrase and retry endlessly.
|
|
30
|
+
- **Total tool calls budget: max 3.** You should almost always finish in 1-2 tool
|
|
31
|
+
calls. If you've made 3 calls, wrap up with whatever you have.
|
|
32
|
+
|
|
33
|
+
Task discipline:
|
|
34
|
+
- You are a sub-agent invoked by the main agent. You receive a single task message — that is ALL the context you have.
|
|
35
|
+
- If the task is unclear, ambiguous, or missing critical details (IDs, names, scope, what to do), do NOT guess. Instead, STOP immediately and return a clear message explaining what information you need. The main agent will ask the user and re-invoke you with a complete task.
|
|
36
|
+
- Never loop or retry the same failing approach. If something fails twice, return the error and stop.
|
|
37
|
+
- Complete the requested task and STOP. Do not do additional unrequested work.
|
|
38
|
+
`.trim();
|
|
39
|
+
const WORKFLOW_GUIDELINES = `
|
|
40
|
+
### Workflow
|
|
41
|
+
1. Identify the single most important piece of information the task needs.
|
|
42
|
+
2. Write ONE precise search query (e.g., "gold spot price USD today" — not
|
|
43
|
+
"gold price" then "gold market" then "gold value per ounce").
|
|
44
|
+
3. If the search result contains the answer, extract it and STOP.
|
|
45
|
+
4. Only scrape a URL if the search snippet was incomplete and you need the full page.
|
|
46
|
+
5. Return findings with citations. If data is unavailable, say so — don't keep searching.
|
|
47
|
+
`.trim();
|
|
48
|
+
const formatToolDocs = (tools) => {
|
|
49
|
+
if (!tools.length) {
|
|
50
|
+
return '- No Firecrawl tools are currently configured.';
|
|
51
|
+
}
|
|
52
|
+
return tools
|
|
53
|
+
.map((t) => {
|
|
54
|
+
const description = t.description?.trim() ?? 'No description provided.';
|
|
55
|
+
return `Firecrawl Agent: \`${t.name}\`: ${description}`;
|
|
56
|
+
})
|
|
57
|
+
.join('\n');
|
|
58
|
+
};
|
|
59
|
+
const buildFirecrawlPrompt = (tools) => `
|
|
60
|
+
${SHARED_EXPECTATIONS}
|
|
61
|
+
|
|
62
|
+
### Available Firecrawl Tools
|
|
63
|
+
${formatToolDocs(tools)}
|
|
64
|
+
|
|
65
|
+
${WORKFLOW_GUIDELINES}
|
|
66
|
+
`.trim();
|
|
67
|
+
const buildFirecrawlDescription = (tools) => {
|
|
68
|
+
const names = tools.map((t) => t.name).join(', ') || 'no tools configured';
|
|
69
|
+
return `Firecrawl Agent for web search & scraping human-readable web pages via (${names}). NOT for API calls — use the Sandbox for APIs (fetch/curl/requests).`;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Build the Firecrawl sub-agent definition. Tools are supplied by the
|
|
73
|
+
* plugin and close over a `MultiServerMCPClient` keyed to `FIRECRAWL_MCP_URL`.
|
|
74
|
+
*/
|
|
75
|
+
export function createFirecrawlSubAgent(tools) {
|
|
76
|
+
return {
|
|
77
|
+
name: 'Firecrawl Agent',
|
|
78
|
+
description: buildFirecrawlDescription(tools),
|
|
79
|
+
systemPrompt: buildFirecrawlPrompt(tools),
|
|
80
|
+
tools,
|
|
81
|
+
model: 'subagent',
|
|
82
|
+
middlewares: [],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { PluginTool } from '../../plugin-api/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Minimal surface a Firecrawl MCP tool needs to expose to be proxied: an
|
|
4
|
+
* identifier and an `invoke` method. `MultiServerMCPClient.getTools()`
|
|
5
|
+
* returns `DynamicStructuredTool[]` which trivially satisfies this shape,
|
|
6
|
+
* and unit tests can satisfy it with a plain object — no SDK ceremony.
|
|
7
|
+
*/
|
|
8
|
+
export interface FirecrawlMcpProxyTool {
|
|
9
|
+
name: string;
|
|
10
|
+
invoke: (input: unknown) => Promise<unknown>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Tool names that the upstream Firecrawl MCP server exposes (prefixed with
|
|
14
|
+
* the server name configured in {@link MultiServerMCPClient}). Filtering by
|
|
15
|
+
* these names keeps the agent's surface area tight even if the server adds
|
|
16
|
+
* extra capabilities later.
|
|
17
|
+
*/
|
|
18
|
+
export declare const FIRECRAWL_SCRAPE_MCP_NAME = "firecrawl__firecrawl_scrape";
|
|
19
|
+
export declare const FIRECRAWL_SEARCH_MCP_NAME = "firecrawl__firecrawl_search";
|
|
20
|
+
/** Public tool names shown to the agent (server prefix dropped). */
|
|
21
|
+
export declare const FIRECRAWL_SCRAPE_TOOL = "firecrawl_scrape";
|
|
22
|
+
export declare const FIRECRAWL_SEARCH_TOOL = "firecrawl_search";
|
|
23
|
+
/**
|
|
24
|
+
* Factory for the underlying MCP-tool list. Injectable so unit tests can
|
|
25
|
+
* substitute a stub without spinning up the real MCP transport.
|
|
26
|
+
*/
|
|
27
|
+
export type FirecrawlMcpFactory = () => Promise<FirecrawlMcpProxyTool[]>;
|
|
28
|
+
/** Build the default factory keyed to `FIRECRAWL_MCP_URL`. */
|
|
29
|
+
export declare function createDefaultFirecrawlMcpFactory(firecrawlUrl: string): FirecrawlMcpFactory;
|
|
30
|
+
/**
|
|
31
|
+
* Construct the two Firecrawl plugin tools. Each tool's handler proxies
|
|
32
|
+
* the validated input into the upstream MCP server using the supplied
|
|
33
|
+
* factory. Schemas are declared statically so the agent sees a stable
|
|
34
|
+
* tool surface even before the first MCP fetch.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createFirecrawlTools(factory: FirecrawlMcpFactory): PluginTool[];
|
|
37
|
+
//# sourceMappingURL=firecrawl-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firecrawl-tools.d.ts","sourceRoot":"","sources":["../../../src/plugins/firecrawl/firecrawl-tools.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9C;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,gCAAgC,CAAC;AACvE,eAAO,MAAM,yBAAyB,gCAAgC,CAAC;AAEvE,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AACxD,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AA+CxD;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;AAEzE,8DAA8D;AAC9D,wBAAgB,gCAAgC,CAC9C,YAAY,EAAE,MAAM,GACnB,mBAAmB,CA8BrB;AA6BD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,mBAAmB,GAC3B,UAAU,EAAE,CAoCd"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { MultiServerMCPClient } from '@langchain/mcp-adapters';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { tool } from '../../plugin-api/tool-helper.js';
|
|
4
|
+
/**
|
|
5
|
+
* Tool names that the upstream Firecrawl MCP server exposes (prefixed with
|
|
6
|
+
* the server name configured in {@link MultiServerMCPClient}). Filtering by
|
|
7
|
+
* these names keeps the agent's surface area tight even if the server adds
|
|
8
|
+
* extra capabilities later.
|
|
9
|
+
*/
|
|
10
|
+
export const FIRECRAWL_SCRAPE_MCP_NAME = 'firecrawl__firecrawl_scrape';
|
|
11
|
+
export const FIRECRAWL_SEARCH_MCP_NAME = 'firecrawl__firecrawl_search';
|
|
12
|
+
/** Public tool names shown to the agent (server prefix dropped). */
|
|
13
|
+
export const FIRECRAWL_SCRAPE_TOOL = 'firecrawl_scrape';
|
|
14
|
+
export const FIRECRAWL_SEARCH_TOOL = 'firecrawl_search';
|
|
15
|
+
const SEARCH_DESCRIPTION = `Web search via Firecrawl. Returns a ranked list of result snippets with titles and URLs.
|
|
16
|
+
|
|
17
|
+
Use this BEFORE \`firecrawl_scrape\` whenever a search snippet is enough — it's faster and cheaper. Only escalate to scraping when the snippet is incomplete and you need the full page.
|
|
18
|
+
|
|
19
|
+
🚨 Never use this for API endpoints (any URL with /api/, /v1/, /v2/, /v3/, or returning JSON/XML). Use the Sandbox for those.`;
|
|
20
|
+
const SCRAPE_DESCRIPTION = `Scrape a single human-readable web page via Firecrawl. Returns the page as Markdown plus structured metadata.
|
|
21
|
+
|
|
22
|
+
Use this only when you've already tried \`firecrawl_search\` and need the full page content (long article, table, structured data on a static page).
|
|
23
|
+
|
|
24
|
+
🚨 Never use this on API endpoints (any URL with /api/, /v1/, /v2/, /v3/, or returning JSON/XML). Use the Sandbox for those.`;
|
|
25
|
+
const searchSchema = z.object({
|
|
26
|
+
query: z
|
|
27
|
+
.string()
|
|
28
|
+
.min(1, 'Query is required and cannot be empty.')
|
|
29
|
+
.describe('Search query — write ONE precise, well-targeted query.'),
|
|
30
|
+
limit: z
|
|
31
|
+
.number()
|
|
32
|
+
.int()
|
|
33
|
+
.min(1)
|
|
34
|
+
.max(10)
|
|
35
|
+
.optional()
|
|
36
|
+
.describe('Max number of results (1-10). Default upstream.'),
|
|
37
|
+
});
|
|
38
|
+
const scrapeSchema = z.object({
|
|
39
|
+
url: z
|
|
40
|
+
.string()
|
|
41
|
+
.url()
|
|
42
|
+
.describe('Fully-qualified URL of the page to scrape (https://...).'),
|
|
43
|
+
formats: z
|
|
44
|
+
.array(z.enum(['markdown', 'html', 'rawHtml', 'links', 'screenshot']))
|
|
45
|
+
.optional()
|
|
46
|
+
.describe("Output formats. Defaults to ['markdown']. Use 'links' to enumerate outbound URLs."),
|
|
47
|
+
onlyMainContent: z
|
|
48
|
+
.boolean()
|
|
49
|
+
.optional()
|
|
50
|
+
.describe('When true (default), strips navigation, ads, and boilerplate — returns just the main content block.'),
|
|
51
|
+
});
|
|
52
|
+
/** Build the default factory keyed to `FIRECRAWL_MCP_URL`. */
|
|
53
|
+
export function createDefaultFirecrawlMcpFactory(firecrawlUrl) {
|
|
54
|
+
let cached = null;
|
|
55
|
+
return () => {
|
|
56
|
+
cached ??= (async () => {
|
|
57
|
+
const client = new MultiServerMCPClient({
|
|
58
|
+
useStandardContentBlocks: true,
|
|
59
|
+
defaultToolTimeout: 120_000,
|
|
60
|
+
prefixToolNameWithServerName: true,
|
|
61
|
+
mcpServers: {
|
|
62
|
+
firecrawl: {
|
|
63
|
+
type: 'http',
|
|
64
|
+
transport: 'http',
|
|
65
|
+
url: firecrawlUrl,
|
|
66
|
+
reconnect: {
|
|
67
|
+
enabled: true,
|
|
68
|
+
maxAttempts: 3,
|
|
69
|
+
delayMs: 2000,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
const all = await client.getTools();
|
|
75
|
+
return all.filter((t) => t.name === FIRECRAWL_SCRAPE_MCP_NAME ||
|
|
76
|
+
t.name === FIRECRAWL_SEARCH_MCP_NAME);
|
|
77
|
+
})();
|
|
78
|
+
return cached;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Build a handler that proxies a validated input through the MCP client.
|
|
83
|
+
* The underlying tool is resolved lazily on the first call and cached.
|
|
84
|
+
*/
|
|
85
|
+
function buildProxyHandler({ factory, mcpToolName, publicToolName, }) {
|
|
86
|
+
return async (args) => {
|
|
87
|
+
const mcpTools = await factory();
|
|
88
|
+
const target = mcpTools.find((t) => t.name === mcpToolName);
|
|
89
|
+
if (!target) {
|
|
90
|
+
throw new Error(`${publicToolName}: upstream MCP tool "${mcpToolName}" is not exposed by the configured Firecrawl server.`);
|
|
91
|
+
}
|
|
92
|
+
return target.invoke(args);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Construct the two Firecrawl plugin tools. Each tool's handler proxies
|
|
97
|
+
* the validated input into the upstream MCP server using the supplied
|
|
98
|
+
* factory. Schemas are declared statically so the agent sees a stable
|
|
99
|
+
* tool surface even before the first MCP fetch.
|
|
100
|
+
*/
|
|
101
|
+
export function createFirecrawlTools(factory) {
|
|
102
|
+
const search = tool(async (rawArgs) => {
|
|
103
|
+
const parsed = searchSchema.parse(rawArgs);
|
|
104
|
+
const handler = buildProxyHandler({
|
|
105
|
+
factory,
|
|
106
|
+
mcpToolName: FIRECRAWL_SEARCH_MCP_NAME,
|
|
107
|
+
publicToolName: FIRECRAWL_SEARCH_TOOL,
|
|
108
|
+
});
|
|
109
|
+
return handler(parsed);
|
|
110
|
+
}, {
|
|
111
|
+
name: FIRECRAWL_SEARCH_TOOL,
|
|
112
|
+
description: SEARCH_DESCRIPTION,
|
|
113
|
+
schema: searchSchema,
|
|
114
|
+
});
|
|
115
|
+
const scrape = tool(async (rawArgs) => {
|
|
116
|
+
const parsed = scrapeSchema.parse(rawArgs);
|
|
117
|
+
const handler = buildProxyHandler({
|
|
118
|
+
factory,
|
|
119
|
+
mcpToolName: FIRECRAWL_SCRAPE_MCP_NAME,
|
|
120
|
+
publicToolName: FIRECRAWL_SCRAPE_TOOL,
|
|
121
|
+
});
|
|
122
|
+
return handler(parsed);
|
|
123
|
+
}, {
|
|
124
|
+
name: FIRECRAWL_SCRAPE_TOOL,
|
|
125
|
+
description: SCRAPE_DESCRIPTION,
|
|
126
|
+
schema: scrapeSchema,
|
|
127
|
+
});
|
|
128
|
+
return [search, scrape];
|
|
129
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { OraclePlugin } from '../../plugin-api/oracle-plugin.js';
|
|
3
|
+
import type { PluginContext, PluginManifest, PluginSubAgent } from '../../plugin-api/types.js';
|
|
4
|
+
import { type FirecrawlMcpFactory } from './firecrawl-tools.js';
|
|
5
|
+
/** Optional dependency injection — primarily for tests. */
|
|
6
|
+
export interface FirecrawlPluginOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Override the MCP-tools factory. Defaults to a Firecrawl-MCP HTTP client
|
|
9
|
+
* built from `FIRECRAWL_MCP_URL`. Tests pass a stub so the plugin never
|
|
10
|
+
* touches the network.
|
|
11
|
+
*/
|
|
12
|
+
mcpFactory?: (firecrawlUrl: string) => FirecrawlMcpFactory;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Firecrawl plugin. Exposes a sub-agent (`call_firecrawl_agent`) that wraps
|
|
16
|
+
* the upstream Firecrawl MCP server's `firecrawl_search` and
|
|
17
|
+
* `firecrawl_scrape` tools.
|
|
18
|
+
*/
|
|
19
|
+
export declare class FirecrawlPlugin extends OraclePlugin {
|
|
20
|
+
readonly name = "firecrawl";
|
|
21
|
+
readonly version = "1.0.0";
|
|
22
|
+
readonly manifest: PluginManifest;
|
|
23
|
+
readonly configSchema: z.ZodObject<{
|
|
24
|
+
FIRECRAWL_MCP_URL: z.ZodString;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
readonly autoDetectHint = "FIRECRAWL_MCP_URL";
|
|
27
|
+
private readonly mcpFactory;
|
|
28
|
+
constructor(options?: FirecrawlPluginOptions);
|
|
29
|
+
autoDetect(env: NodeJS.ProcessEnv): boolean;
|
|
30
|
+
getSubAgents(ctx: PluginContext): PluginSubAgent[];
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=firecrawl.plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firecrawl.plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/firecrawl/firecrawl.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,EAEV,aAAa,EACb,cAAc,EACd,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,sBAAsB,CAAC;AA6C9B,2DAA2D;AAC3D,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,mBAAmB,CAAC;CAC5D;AAED;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,QAAQ,CAAC,IAAI,eAAe;IAE5B,QAAQ,CAAC,OAAO,WAAW;IAE3B,QAAQ,CAAC,QAAQ,iBAAY;IAE7B,SAAkB,YAAY;;sBAAgB;IAE9C,SAAkB,cAAc,uBAAuB;IAEvD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgD;gBAE/D,OAAO,GAAE,sBAA2B;IAKvC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO;IAI3C,YAAY,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,EAAE;CAM5D"}
|