@probelabs/visor 0.1.185 → 0.1.186-ee
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/{140.index.js → 102.index.js} +3 -3
- package/dist/{85.index.js → 663.index.js} +15 -15
- package/dist/{142.index.js → 736.index.js} +36 -36
- package/dist/{676.index.js → 840.index.js} +12 -12
- package/dist/{223.index.js → 961.index.js} +16 -16
- package/dist/action-cli-bridge.d.ts.map +1 -1
- package/dist/agent-protocol/a2a-frontend.d.ts.map +1 -1
- package/dist/agent-protocol/index.d.ts.map +1 -1
- package/dist/agent-protocol/push-notification-manager.d.ts.map +1 -1
- package/dist/agent-protocol/state-transitions.d.ts.map +1 -1
- package/dist/agent-protocol/task-evaluator.d.ts.map +1 -1
- package/dist/agent-protocol/task-live-update-slack.d.ts.map +1 -1
- package/dist/agent-protocol/task-live-update-teams.d.ts.map +1 -1
- package/dist/agent-protocol/task-live-update-telegram.d.ts.map +1 -1
- package/dist/agent-protocol/task-live-updates.d.ts.map +1 -1
- package/dist/agent-protocol/task-progress-tool.d.ts.map +1 -1
- package/dist/agent-protocol/task-queue.d.ts.map +1 -1
- package/dist/agent-protocol/task-store.d.ts.map +1 -1
- package/dist/agent-protocol/task-stream-manager.d.ts.map +1 -1
- package/dist/agent-protocol/task-trace-resolution.d.ts.map +1 -1
- package/dist/agent-protocol/tasks-cli-handler.d.ts.map +1 -1
- package/dist/agent-protocol/tasks-tui.d.ts.map +1 -1
- package/dist/agent-protocol/trace-serializer.d.ts.map +1 -1
- package/dist/agent-protocol/track-execution.d.ts.map +1 -1
- package/dist/agent-protocol/types.d.ts.map +1 -1
- package/dist/ai-review-service.d.ts.map +1 -1
- package/dist/check-execution-engine.d.ts.map +1 -1
- package/dist/cli-main.d.ts.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/commands.d.ts.map +1 -1
- package/dist/config/cli-handler.d.ts.map +1 -1
- package/dist/config/config-reloader.d.ts.map +1 -1
- package/dist/config/config-snapshot-store.d.ts.map +1 -1
- package/dist/config/config-watcher.d.ts +3 -1
- package/dist/config/config-watcher.d.ts.map +1 -1
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/cron-scheduler.d.ts.map +1 -1
- package/dist/debug-visualizer/debug-span-exporter.d.ts.map +1 -1
- package/dist/debug-visualizer/trace-reader.d.ts.map +1 -1
- package/dist/debug-visualizer/ws-server.d.ts.map +1 -1
- package/dist/dependency-resolver.d.ts.map +1 -1
- package/dist/email/adapter.d.ts.map +1 -1
- package/dist/email/client.d.ts.map +1 -1
- package/dist/email/markdown.d.ts.map +1 -1
- package/dist/email/polling-runner.d.ts.map +1 -1
- package/dist/engine/on-finish/orchestrator.d.ts.map +1 -1
- package/dist/engine/on-finish/utils.d.ts.map +1 -1
- package/dist/enterprise/license/validator.d.ts +39 -0
- package/dist/enterprise/license/validator.d.ts.map +1 -0
- package/dist/enterprise/loader.d.ts +25 -0
- package/dist/enterprise/loader.d.ts.map +1 -0
- package/dist/enterprise/policy/opa-compiler.d.ts +37 -0
- package/dist/enterprise/policy/opa-compiler.d.ts.map +1 -0
- package/dist/enterprise/policy/opa-http-evaluator.d.ts +36 -0
- package/dist/enterprise/policy/opa-http-evaluator.d.ts.map +1 -0
- package/dist/enterprise/policy/opa-policy-engine.d.ts +48 -0
- package/dist/enterprise/policy/opa-policy-engine.d.ts.map +1 -0
- package/dist/enterprise/policy/opa-wasm-evaluator.d.ts +34 -0
- package/dist/enterprise/policy/opa-wasm-evaluator.d.ts.map +1 -0
- package/dist/enterprise/policy/policy-input-builder.d.ts +122 -0
- package/dist/enterprise/policy/policy-input-builder.d.ts.map +1 -0
- package/dist/enterprise/scheduler/knex-store.d.ts +47 -0
- package/dist/enterprise/scheduler/knex-store.d.ts.map +1 -0
- package/dist/event-bus/event-bus.d.ts.map +1 -1
- package/dist/event-bus/types.d.ts.map +1 -1
- package/dist/event-mapper.d.ts.map +1 -1
- package/dist/failure-condition-evaluator.d.ts.map +1 -1
- package/dist/footer.d.ts.map +1 -1
- package/dist/frontends/email-frontend.d.ts.map +1 -1
- package/dist/frontends/github-frontend.d.ts.map +1 -1
- package/dist/frontends/host.d.ts.map +1 -1
- package/dist/frontends/ndjson-sink.d.ts.map +1 -1
- package/dist/frontends/slack-frontend.d.ts.map +1 -1
- package/dist/frontends/teams-frontend.d.ts.map +1 -1
- package/dist/frontends/telegram-frontend.d.ts.map +1 -1
- package/dist/frontends/whatsapp-frontend.d.ts.map +1 -1
- package/dist/generated/config-schema.d.ts.map +1 -1
- package/dist/git-repository-analyzer.d.ts.map +1 -1
- package/dist/github-auth.d.ts.map +1 -1
- package/dist/github-check-service.d.ts.map +1 -1
- package/dist/github-comments.d.ts.map +1 -1
- package/dist/github-reactions.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10113 -8188
- package/dist/issue-filter.d.ts.map +1 -1
- package/dist/liquid-extensions.d.ts.map +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/mcp-job-manager.d.ts.map +1 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/memory-store.d.ts.map +1 -1
- package/dist/output-formatters.d.ts.map +1 -1
- package/dist/policy/default-engine.d.ts.map +1 -1
- package/dist/policy/index.d.ts.map +1 -1
- package/dist/policy/policy-check-command.d.ts.map +1 -1
- package/dist/policy/types.d.ts.map +1 -1
- package/dist/pr-analyzer.d.ts.map +1 -1
- package/dist/pr-detector.d.ts.map +1 -1
- package/dist/providers/a2a-check-provider.d.ts.map +1 -1
- package/dist/providers/ai-check-provider.d.ts.map +1 -1
- package/dist/providers/api-tool-executor.d.ts.map +1 -1
- package/dist/providers/check-provider-registry.d.ts.map +1 -1
- package/dist/providers/check-provider.interface.d.ts.map +1 -1
- package/dist/providers/claude-code-check-provider.d.ts.map +1 -1
- package/dist/providers/claude-code-types.d.ts.map +1 -1
- package/dist/providers/command-check-provider.d.ts.map +1 -1
- package/dist/providers/custom-tool-executor.d.ts.map +1 -1
- package/dist/providers/git-checkout-provider.d.ts.map +1 -1
- package/dist/providers/github-ops-provider.d.ts.map +1 -1
- package/dist/providers/http-check-provider.d.ts.map +1 -1
- package/dist/providers/http-client-provider.d.ts.map +1 -1
- package/dist/providers/http-input-provider.d.ts.map +1 -1
- package/dist/providers/human-input-check-provider.d.ts.map +1 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/log-check-provider.d.ts.map +1 -1
- package/dist/providers/mcp-check-provider.d.ts.map +1 -1
- package/dist/providers/mcp-custom-sse-server.d.ts.map +1 -1
- package/dist/providers/mcp-tools.d.ts.map +1 -1
- package/dist/providers/memory-check-provider.d.ts.map +1 -1
- package/dist/providers/noop-check-provider.d.ts.map +1 -1
- package/dist/providers/script-check-provider.d.ts.map +1 -1
- package/dist/providers/utcp-check-provider.d.ts.map +1 -1
- package/dist/providers/workflow-check-provider.d.ts.map +1 -1
- package/dist/providers/workflow-tool-executor.d.ts.map +1 -1
- package/dist/reviewer.d.ts.map +1 -1
- package/dist/runners/config-reload-runtime.d.ts +13 -0
- package/dist/runners/config-reload-runtime.d.ts.map +1 -0
- package/dist/runners/graceful-restart.d.ts.map +1 -1
- package/dist/runners/mcp-server-runner.d.ts.map +1 -1
- package/dist/runners/process-cli-handler.d.ts.map +1 -1
- package/dist/runners/process-discovery.d.ts.map +1 -1
- package/dist/runners/runner-factory.d.ts.map +1 -1
- package/dist/runners/runner-host.d.ts.map +1 -1
- package/dist/runners/runner.d.ts.map +1 -1
- package/dist/runners/telemetry-init.d.ts.map +1 -1
- package/dist/sandbox/bubblewrap-sandbox.d.ts.map +1 -1
- package/dist/sandbox/cache-volume-manager.d.ts.map +1 -1
- package/dist/sandbox/check-runner.d.ts.map +1 -1
- package/dist/sandbox/compose-generator.d.ts.map +1 -1
- package/dist/sandbox/docker-compose-sandbox.d.ts.map +1 -1
- package/dist/sandbox/docker-image-sandbox.d.ts.map +1 -1
- package/dist/sandbox/env-filter.d.ts.map +1 -1
- package/dist/sandbox/index.d.ts.map +1 -1
- package/dist/sandbox/sandbox-manager.d.ts.map +1 -1
- package/dist/sandbox/sandbox-telemetry.d.ts.map +1 -1
- package/dist/sandbox/seatbelt-sandbox.d.ts.map +1 -1
- package/dist/sandbox/trace-ingester.d.ts.map +1 -1
- package/dist/sandbox/types.d.ts.map +1 -1
- package/dist/scheduler/cli-handler.d.ts.map +1 -1
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/message-trigger.d.ts.map +1 -1
- package/dist/scheduler/schedule-parser.d.ts.map +1 -1
- package/dist/scheduler/schedule-store.d.ts.map +1 -1
- package/dist/scheduler/schedule-tool.d.ts.map +1 -1
- package/dist/scheduler/scheduler.d.ts.map +1 -1
- package/dist/scheduler/store/index.d.ts.map +1 -1
- package/dist/scheduler/store/json-migrator.d.ts.map +1 -1
- package/dist/scheduler/store/sqlite-store.d.ts.map +1 -1
- package/dist/scheduler/store/types.d.ts.map +1 -1
- package/dist/sdk/{a2a-frontend-JZA4Z24P.mjs → a2a-frontend-OI4OVSKC.mjs} +3 -3
- package/dist/sdk/check-provider-registry-7T2AEWLU.mjs +32 -0
- package/dist/sdk/{check-provider-registry-XYPGKCY4.mjs → check-provider-registry-TQR32QBD.mjs} +6 -6
- package/dist/sdk/{chunk-WRRRKWYW.mjs → chunk-7XKHFRPN.mjs} +2 -2
- package/dist/sdk/chunk-LWH6CVLZ.mjs +47064 -0
- package/dist/sdk/chunk-LWH6CVLZ.mjs.map +1 -0
- package/dist/sdk/{chunk-YXRO7X7C.mjs → chunk-PUHU6UY6.mjs} +2 -2
- package/dist/sdk/chunk-PUHU6UY6.mjs.map +1 -0
- package/dist/sdk/{chunk-J3BA347Q.mjs → chunk-QLT42TX7.mjs} +2 -2
- package/dist/sdk/{chunk-ROLS2CKF.mjs → chunk-TAOGXCWT.mjs} +185 -182
- package/dist/sdk/chunk-TAOGXCWT.mjs.map +1 -0
- package/dist/sdk/{chunk-YIKN7TSP.mjs → chunk-UM7LGO2P.mjs} +3 -3
- package/dist/sdk/chunk-XX6WT332.mjs +6118 -0
- package/dist/sdk/chunk-XX6WT332.mjs.map +1 -0
- package/dist/sdk/config-BCYAVJ5S.mjs +16 -0
- package/dist/sdk/dist-NERCHNRR.mjs +7955 -0
- package/dist/sdk/dist-NERCHNRR.mjs.map +1 -0
- package/dist/sdk/{dist-VBYEFQ6T.mjs → dist-PN5UHL6A.mjs} +75 -22
- package/dist/sdk/dist-PN5UHL6A.mjs.map +1 -0
- package/dist/sdk/{email-frontend-P7QE4UUJ.mjs → email-frontend-6JU4L33L.mjs} +2 -2
- package/dist/sdk/email-frontend-ECHQCFTR.mjs +701 -0
- package/dist/sdk/email-frontend-ECHQCFTR.mjs.map +1 -0
- package/dist/sdk/{failure-condition-evaluator-WY5S2SU2.mjs → failure-condition-evaluator-USY3ISVA.mjs} +4 -4
- package/dist/sdk/{github-frontend-O22WILVL.mjs → github-frontend-2T5PWYD5.mjs} +4 -4
- package/dist/sdk/{host-HJXAU545.mjs → host-OJSMCLKK.mjs} +4 -4
- package/dist/sdk/host-RM6UJEPP.mjs +87 -0
- package/dist/sdk/host-RM6UJEPP.mjs.map +1 -0
- package/dist/sdk/knex-store-KCMFAMH5.mjs +527 -0
- package/dist/sdk/knex-store-KCMFAMH5.mjs.map +1 -0
- package/dist/sdk/loader-35YWX5UQ.mjs +89 -0
- package/dist/sdk/loader-35YWX5UQ.mjs.map +1 -0
- package/dist/sdk/opa-policy-engine-FY5D45YS.mjs +655 -0
- package/dist/sdk/opa-policy-engine-FY5D45YS.mjs.map +1 -0
- package/dist/sdk/{routing-Q6QSYM5L.mjs → routing-NNQQSLWA.mjs} +5 -5
- package/dist/sdk/schedule-tool-25C5NMDG.mjs +38 -0
- package/dist/sdk/{schedule-tool-L7AHV4V7.mjs → schedule-tool-7IQI6MID.mjs} +6 -6
- package/dist/sdk/{schedule-tool-handler-RDTTPA7Y.mjs → schedule-tool-handler-IYBNJLTV.mjs} +6 -6
- package/dist/sdk/schedule-tool-handler-IYBNJLTV.mjs.map +1 -0
- package/dist/sdk/schedule-tool-handler-VWGTVSB6.mjs +42 -0
- package/dist/sdk/schedule-tool-handler-VWGTVSB6.mjs.map +1 -0
- package/dist/sdk/sdk.js +2379 -935
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/sdk.mjs +6 -6
- package/dist/sdk/{trace-helpers-CHHZEO7P.mjs → trace-helpers-OMF4C24T.mjs} +3 -3
- package/dist/sdk/trace-helpers-OMF4C24T.mjs.map +1 -0
- package/dist/sdk/{track-execution-FX5ZX47L.mjs → track-execution-3CHMGEPH.mjs} +2 -2
- package/dist/sdk/validator-XTZJZZJH.mjs +134 -0
- package/dist/sdk/validator-XTZJZZJH.mjs.map +1 -0
- package/dist/sdk/{workflow-check-provider-67W3MGOP.mjs → workflow-check-provider-FOWDJUO3.mjs} +6 -6
- package/dist/sdk/workflow-check-provider-FOWDJUO3.mjs.map +1 -0
- package/dist/sdk/workflow-check-provider-MRP3C2NC.mjs +32 -0
- package/dist/sdk/workflow-check-provider-MRP3C2NC.mjs.map +1 -0
- package/dist/sdk.d.ts.map +1 -1
- package/dist/session-registry.d.ts.map +1 -1
- package/dist/slack/adapter.d.ts.map +1 -1
- package/dist/slack/cache-prewarmer.d.ts.map +1 -1
- package/dist/slack/client.d.ts.map +1 -1
- package/dist/slack/markdown.d.ts.map +1 -1
- package/dist/slack/prompt-state.d.ts.map +1 -1
- package/dist/slack/rate-limiter.d.ts.map +1 -1
- package/dist/slack/schedule-tool-handler.d.ts.map +1 -1
- package/dist/slack/signature.d.ts.map +1 -1
- package/dist/slack/slack-output-adapter.d.ts.map +1 -1
- package/dist/slack/socket-runner.d.ts.map +1 -1
- package/dist/slack/thread-cache.d.ts.map +1 -1
- package/dist/snapshot-store.d.ts.map +1 -1
- package/dist/state-machine/context/build-engine-context.d.ts.map +1 -1
- package/dist/state-machine/context/workflow-inputs.d.ts.map +1 -1
- package/dist/state-machine/dispatch/dependency-gating.d.ts.map +1 -1
- package/dist/state-machine/dispatch/execution-invoker.d.ts.map +1 -1
- package/dist/state-machine/dispatch/foreach-processor.d.ts.map +1 -1
- package/dist/state-machine/dispatch/history-snapshot.d.ts.map +1 -1
- package/dist/state-machine/dispatch/on-init-handlers.d.ts.map +1 -1
- package/dist/state-machine/dispatch/policy-gate.d.ts.map +1 -1
- package/dist/state-machine/dispatch/renderer-schema.d.ts.map +1 -1
- package/dist/state-machine/dispatch/sandbox-routing.d.ts.map +1 -1
- package/dist/state-machine/dispatch/stats-manager.d.ts.map +1 -1
- package/dist/state-machine/dispatch/template-renderer.d.ts.map +1 -1
- package/dist/state-machine/execution/summary.d.ts.map +1 -1
- package/dist/state-machine/runner.d.ts.map +1 -1
- package/dist/state-machine/states/check-running.d.ts.map +1 -1
- package/dist/state-machine/states/completed.d.ts.map +1 -1
- package/dist/state-machine/states/error.d.ts.map +1 -1
- package/dist/state-machine/states/init.d.ts.map +1 -1
- package/dist/state-machine/states/level-dispatch.d.ts.map +1 -1
- package/dist/state-machine/states/plan-ready.d.ts.map +1 -1
- package/dist/state-machine/states/routing.d.ts.map +1 -1
- package/dist/state-machine/states/wave-planning.d.ts.map +1 -1
- package/dist/state-machine/workflow-projection.d.ts.map +1 -1
- package/dist/state-machine-execution-engine.d.ts.map +1 -1
- package/dist/teams/adapter.d.ts.map +1 -1
- package/dist/teams/client.d.ts.map +1 -1
- package/dist/teams/markdown.d.ts.map +1 -1
- package/dist/teams/webhook-runner.d.ts.map +1 -1
- package/dist/telegram/adapter.d.ts.map +1 -1
- package/dist/telegram/client.d.ts.map +1 -1
- package/dist/telegram/markdown.d.ts.map +1 -1
- package/dist/telegram/polling-runner.d.ts.map +1 -1
- package/dist/telemetry/fallback-ndjson.d.ts.map +1 -1
- package/dist/telemetry/file-span-exporter.d.ts.map +1 -1
- package/dist/telemetry/lazy-otel.d.ts.map +1 -1
- package/dist/telemetry/metrics.d.ts.map +1 -1
- package/dist/telemetry/opentelemetry.d.ts.map +1 -1
- package/dist/telemetry/state-capture.d.ts.map +1 -1
- package/dist/telemetry/trace-helpers.d.ts.map +1 -1
- package/dist/telemetry/trace-report-exporter.d.ts.map +1 -1
- package/dist/test-runner/assertions.d.ts.map +1 -1
- package/dist/test-runner/conversation-sugar.d.ts.map +1 -1
- package/dist/test-runner/core/environment.d.ts.map +1 -1
- package/dist/test-runner/core/fixture.d.ts.map +1 -1
- package/dist/test-runner/core/flow-stage.d.ts.map +1 -1
- package/dist/test-runner/core/mocks.d.ts.map +1 -1
- package/dist/test-runner/core/test-execution-wrapper.d.ts.map +1 -1
- package/dist/test-runner/evaluators.d.ts.map +1 -1
- package/dist/test-runner/fixture-loader.d.ts.map +1 -1
- package/dist/test-runner/index.d.ts.map +1 -1
- package/dist/test-runner/llm-judge.d.ts.map +1 -1
- package/dist/test-runner/recorders/github-recorder.d.ts.map +1 -1
- package/dist/test-runner/recorders/global-recorder.d.ts.map +1 -1
- package/dist/test-runner/recorders/slack-recorder.d.ts.map +1 -1
- package/dist/test-runner/utils/selectors.d.ts.map +1 -1
- package/dist/test-runner/validator.d.ts.map +1 -1
- package/dist/tui/chat-runner.d.ts.map +1 -1
- package/dist/tui/chat-state.d.ts.map +1 -1
- package/dist/tui/chat-tui.d.ts.map +1 -1
- package/dist/tui/components/chat-box.d.ts.map +1 -1
- package/dist/tui/components/input-bar.d.ts.map +1 -1
- package/dist/tui/components/status-bar.d.ts.map +1 -1
- package/dist/tui/components/trace-viewer.d.ts.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/tui-frontend.d.ts.map +1 -1
- package/dist/types/bot.d.ts.map +1 -1
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/engine.d.ts.map +1 -1
- package/dist/types/execution.d.ts.map +1 -1
- package/dist/types/git-checkout.d.ts.map +1 -1
- package/dist/types/github.d.ts.map +1 -1
- package/dist/types/workflow.d.ts.map +1 -1
- package/dist/utils/author-permissions.d.ts.map +1 -1
- package/dist/utils/command-executor.d.ts.map +1 -1
- package/dist/utils/comment-metadata.d.ts.map +1 -1
- package/dist/utils/config-loader.d.ts +12 -0
- package/dist/utils/config-loader.d.ts.map +1 -1
- package/dist/utils/config-merger.d.ts.map +1 -1
- package/dist/utils/diff-processor.d.ts.map +1 -1
- package/dist/utils/env-exposure.d.ts.map +1 -1
- package/dist/utils/env-resolver.d.ts.map +1 -1
- package/dist/utils/fair-concurrency-limiter.d.ts.map +1 -1
- package/dist/utils/file-exclusion.d.ts.map +1 -1
- package/dist/utils/head-sha.d.ts.map +1 -1
- package/dist/utils/human-id.d.ts.map +1 -1
- package/dist/utils/instance-id.d.ts.map +1 -1
- package/dist/utils/interactive-prompt.d.ts.map +1 -1
- package/dist/utils/issue-normalizer.d.ts.map +1 -1
- package/dist/utils/json-text-extractor.d.ts.map +1 -1
- package/dist/utils/mermaid-telemetry.d.ts.map +1 -1
- package/dist/utils/oauth2-token-cache.d.ts.map +1 -1
- package/dist/utils/rate-limiter.d.ts.map +1 -1
- package/dist/utils/sandbox.d.ts.map +1 -1
- package/dist/utils/script-memory-ops.d.ts.map +1 -1
- package/dist/utils/script-tool-environment.d.ts.map +1 -1
- package/dist/utils/stdin-reader.d.ts.map +1 -1
- package/dist/utils/template-context.d.ts.map +1 -1
- package/dist/utils/tool-resolver.d.ts.map +1 -1
- package/dist/utils/toolkit-expander.d.ts.map +1 -1
- package/dist/utils/tracer-init.d.ts.map +1 -1
- package/dist/utils/ui-helpers.d.ts.map +1 -1
- package/dist/utils/workspace-manager.d.ts.map +1 -1
- package/dist/utils/worktree-cleanup.d.ts.map +1 -1
- package/dist/utils/worktree-manager.d.ts.map +1 -1
- package/dist/webhook-server.d.ts.map +1 -1
- package/dist/whatsapp/adapter.d.ts.map +1 -1
- package/dist/whatsapp/client.d.ts.map +1 -1
- package/dist/whatsapp/markdown.d.ts.map +1 -1
- package/dist/whatsapp/webhook-runner.d.ts.map +1 -1
- package/dist/workflow-executor.d.ts.map +1 -1
- package/dist/workflow-registry.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/output/traces/run-2026-03-21T19-15-13-188Z.ndjson +0 -252
- package/dist/output/traces/run-2026-03-21T19-15-52-421Z.ndjson +0 -3148
- package/dist/sdk/chunk-ROLS2CKF.mjs.map +0 -1
- package/dist/sdk/chunk-YXRO7X7C.mjs.map +0 -1
- package/dist/sdk/dist-VBYEFQ6T.mjs.map +0 -1
- package/dist/traces/run-2026-03-21T19-15-13-188Z.ndjson +0 -252
- package/dist/traces/run-2026-03-21T19-15-52-421Z.ndjson +0 -3148
- /package/dist/sdk/{a2a-frontend-JZA4Z24P.mjs.map → a2a-frontend-OI4OVSKC.mjs.map} +0 -0
- /package/dist/sdk/{check-provider-registry-XYPGKCY4.mjs.map → check-provider-registry-7T2AEWLU.mjs.map} +0 -0
- /package/dist/sdk/{failure-condition-evaluator-WY5S2SU2.mjs.map → check-provider-registry-TQR32QBD.mjs.map} +0 -0
- /package/dist/sdk/{chunk-WRRRKWYW.mjs.map → chunk-7XKHFRPN.mjs.map} +0 -0
- /package/dist/sdk/{chunk-J3BA347Q.mjs.map → chunk-QLT42TX7.mjs.map} +0 -0
- /package/dist/sdk/{chunk-YIKN7TSP.mjs.map → chunk-UM7LGO2P.mjs.map} +0 -0
- /package/dist/sdk/{routing-Q6QSYM5L.mjs.map → config-BCYAVJ5S.mjs.map} +0 -0
- /package/dist/sdk/{email-frontend-P7QE4UUJ.mjs.map → email-frontend-6JU4L33L.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-L7AHV4V7.mjs.map → failure-condition-evaluator-USY3ISVA.mjs.map} +0 -0
- /package/dist/sdk/{github-frontend-O22WILVL.mjs.map → github-frontend-2T5PWYD5.mjs.map} +0 -0
- /package/dist/sdk/{host-HJXAU545.mjs.map → host-OJSMCLKK.mjs.map} +0 -0
- /package/dist/sdk/{schedule-tool-handler-RDTTPA7Y.mjs.map → routing-NNQQSLWA.mjs.map} +0 -0
- /package/dist/sdk/{trace-helpers-CHHZEO7P.mjs.map → schedule-tool-25C5NMDG.mjs.map} +0 -0
- /package/dist/sdk/{workflow-check-provider-67W3MGOP.mjs.map → schedule-tool-7IQI6MID.mjs.map} +0 -0
- /package/dist/sdk/{track-execution-FX5ZX47L.mjs.map → track-execution-3CHMGEPH.mjs.map} +0 -0
|
@@ -0,0 +1,701 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__esm
|
|
3
|
+
} from "./chunk-J7LXIPZS.mjs";
|
|
4
|
+
|
|
5
|
+
// src/email/client.ts
|
|
6
|
+
import { createHash, randomUUID } from "crypto";
|
|
7
|
+
var EmailClient;
|
|
8
|
+
var init_client = __esm({
|
|
9
|
+
"src/email/client.ts"() {
|
|
10
|
+
"use strict";
|
|
11
|
+
EmailClient = class {
|
|
12
|
+
receiveBackend;
|
|
13
|
+
sendBackend;
|
|
14
|
+
// IMAP
|
|
15
|
+
imapConfig;
|
|
16
|
+
imapClient;
|
|
17
|
+
// ImapFlow instance (lazily created)
|
|
18
|
+
// SMTP
|
|
19
|
+
smtpConfig;
|
|
20
|
+
smtpTransport;
|
|
21
|
+
// nodemailer transport
|
|
22
|
+
// Resend
|
|
23
|
+
resendConfig;
|
|
24
|
+
resendClient;
|
|
25
|
+
// Resend instance
|
|
26
|
+
fromAddress;
|
|
27
|
+
constructor(opts) {
|
|
28
|
+
this.receiveBackend = opts.receive?.type || "imap";
|
|
29
|
+
this.sendBackend = opts.send?.type || "smtp";
|
|
30
|
+
if (this.receiveBackend === "imap" && opts.receive) {
|
|
31
|
+
const r = opts.receive;
|
|
32
|
+
if (!r.host && !process.env.EMAIL_IMAP_HOST) {
|
|
33
|
+
throw new Error("IMAP host is required (set receive.host or EMAIL_IMAP_HOST)");
|
|
34
|
+
}
|
|
35
|
+
this.imapConfig = {
|
|
36
|
+
host: r.host || process.env.EMAIL_IMAP_HOST,
|
|
37
|
+
port: r.port || parseInt(process.env.EMAIL_IMAP_PORT || "993"),
|
|
38
|
+
auth: {
|
|
39
|
+
user: r.auth?.user || process.env.EMAIL_USER || "",
|
|
40
|
+
pass: r.auth?.pass || process.env.EMAIL_PASSWORD || ""
|
|
41
|
+
},
|
|
42
|
+
secure: r.secure ?? true,
|
|
43
|
+
pollInterval: r.pollInterval || parseInt(process.env.EMAIL_POLL_INTERVAL || "30"),
|
|
44
|
+
folder: r.folder || "INBOX",
|
|
45
|
+
markRead: r.markRead ?? true
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (this.receiveBackend === "resend") {
|
|
49
|
+
const r = opts.receive;
|
|
50
|
+
const apiKey = r.api_key || r.apiKey || process.env.RESEND_API_KEY;
|
|
51
|
+
if (!apiKey) throw new Error("Resend API key is required for receive");
|
|
52
|
+
this.resendConfig = {
|
|
53
|
+
apiKey,
|
|
54
|
+
webhookSecret: r.webhook_secret || r.webhookSecret || process.env.RESEND_WEBHOOK_SECRET
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (this.sendBackend === "smtp") {
|
|
58
|
+
const s = opts.send;
|
|
59
|
+
if (!s.host && !process.env.EMAIL_SMTP_HOST) {
|
|
60
|
+
throw new Error("SMTP host is required (set send.host or EMAIL_SMTP_HOST)");
|
|
61
|
+
}
|
|
62
|
+
this.smtpConfig = {
|
|
63
|
+
host: s.host || process.env.EMAIL_SMTP_HOST,
|
|
64
|
+
port: s.port || parseInt(process.env.EMAIL_SMTP_PORT || "587"),
|
|
65
|
+
auth: {
|
|
66
|
+
user: s.auth?.user || process.env.EMAIL_USER || "",
|
|
67
|
+
pass: s.auth?.pass || process.env.EMAIL_PASSWORD || ""
|
|
68
|
+
},
|
|
69
|
+
secure: s.secure ?? true,
|
|
70
|
+
from: s.from || process.env.EMAIL_FROM || ""
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (this.sendBackend === "resend") {
|
|
74
|
+
const s = opts.send;
|
|
75
|
+
const apiKey = s.api_key || s.apiKey || process.env.RESEND_API_KEY;
|
|
76
|
+
if (!apiKey) throw new Error("Resend API key is required for send");
|
|
77
|
+
if (!this.resendConfig) {
|
|
78
|
+
this.resendConfig = { apiKey };
|
|
79
|
+
}
|
|
80
|
+
this.resendConfig.from = s.from || process.env.EMAIL_FROM;
|
|
81
|
+
}
|
|
82
|
+
this.fromAddress = opts.send?.from || process.env.EMAIL_FROM || this.smtpConfig?.from || this.resendConfig?.from || "";
|
|
83
|
+
}
|
|
84
|
+
/** Get the configured from address */
|
|
85
|
+
getFromAddress() {
|
|
86
|
+
return this.fromAddress;
|
|
87
|
+
}
|
|
88
|
+
/** Get the receive backend type */
|
|
89
|
+
getReceiveBackend() {
|
|
90
|
+
return this.receiveBackend;
|
|
91
|
+
}
|
|
92
|
+
// ─── IMAP Receive ───
|
|
93
|
+
/** Connect to IMAP server */
|
|
94
|
+
async connectImap() {
|
|
95
|
+
if (this.receiveBackend !== "imap" || !this.imapConfig) return;
|
|
96
|
+
const { ImapFlow } = await import("imapflow");
|
|
97
|
+
this.imapClient = new ImapFlow({
|
|
98
|
+
host: this.imapConfig.host,
|
|
99
|
+
port: this.imapConfig.port || 993,
|
|
100
|
+
secure: this.imapConfig.secure ?? true,
|
|
101
|
+
auth: this.imapConfig.auth,
|
|
102
|
+
logger: false
|
|
103
|
+
});
|
|
104
|
+
await this.imapClient.connect();
|
|
105
|
+
}
|
|
106
|
+
/** Fetch unseen messages from IMAP */
|
|
107
|
+
async fetchNewMessages() {
|
|
108
|
+
if (!this.imapClient || !this.imapConfig) return [];
|
|
109
|
+
const { simpleParser } = await import("mailparser");
|
|
110
|
+
const lock = await this.imapClient.getMailboxLock(this.imapConfig.folder || "INBOX");
|
|
111
|
+
try {
|
|
112
|
+
const messages = [];
|
|
113
|
+
for await (const msg of this.imapClient.fetch({ seen: false }, { source: true, uid: true })) {
|
|
114
|
+
const parsed = await simpleParser(msg.source);
|
|
115
|
+
const messageId = parsed.messageId || `<${randomUUID()}@visor>`;
|
|
116
|
+
const inReplyTo = typeof parsed.inReplyTo === "string" ? parsed.inReplyTo : void 0;
|
|
117
|
+
const references = parsed.references ? Array.isArray(parsed.references) ? parsed.references : [parsed.references] : void 0;
|
|
118
|
+
messages.push({
|
|
119
|
+
id: String(msg.uid),
|
|
120
|
+
messageId,
|
|
121
|
+
inReplyTo,
|
|
122
|
+
references,
|
|
123
|
+
from: typeof parsed.from?.text === "string" ? parsed.from.text : "",
|
|
124
|
+
to: parsed.to ? Array.isArray(parsed.to) ? parsed.to.map((a) => a.text || "") : [parsed.to.text || ""] : [],
|
|
125
|
+
cc: parsed.cc ? Array.isArray(parsed.cc) ? parsed.cc.map((a) => a.text || "") : [parsed.cc.text || ""] : void 0,
|
|
126
|
+
subject: parsed.subject || "",
|
|
127
|
+
text: parsed.text || "",
|
|
128
|
+
html: parsed.html || void 0,
|
|
129
|
+
date: parsed.date || /* @__PURE__ */ new Date()
|
|
130
|
+
});
|
|
131
|
+
if (this.imapConfig.markRead !== false) {
|
|
132
|
+
try {
|
|
133
|
+
await this.imapClient.messageFlagsAdd({ uid: msg.uid }, ["\\Seen"], { uid: true });
|
|
134
|
+
} catch {
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return messages;
|
|
139
|
+
} finally {
|
|
140
|
+
lock.release();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/** Disconnect IMAP */
|
|
144
|
+
async disconnectImap() {
|
|
145
|
+
if (this.imapClient) {
|
|
146
|
+
try {
|
|
147
|
+
await this.imapClient.logout();
|
|
148
|
+
} catch {
|
|
149
|
+
}
|
|
150
|
+
this.imapClient = void 0;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// ─── Resend Receive ───
|
|
154
|
+
/** Fetch full email content from Resend by ID */
|
|
155
|
+
async fetchResendEmail(emailId) {
|
|
156
|
+
try {
|
|
157
|
+
const resend = await this.getResendClient();
|
|
158
|
+
const result = await resend.emails.get(emailId);
|
|
159
|
+
const email = result.data || result;
|
|
160
|
+
if (!email) return null;
|
|
161
|
+
const headers = {};
|
|
162
|
+
if (Array.isArray(email.headers)) {
|
|
163
|
+
for (const h of email.headers) {
|
|
164
|
+
if (h.name && h.value) headers[h.name.toLowerCase()] = h.value;
|
|
165
|
+
}
|
|
166
|
+
} else if (email.headers && typeof email.headers === "object") {
|
|
167
|
+
for (const [k, v] of Object.entries(email.headers)) {
|
|
168
|
+
headers[k.toLowerCase()] = String(v);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
const references = headers["references"] ? headers["references"].split(/\s+/).filter(Boolean) : void 0;
|
|
172
|
+
return {
|
|
173
|
+
id: emailId,
|
|
174
|
+
messageId: headers["message-id"] || `<${emailId}@resend>`,
|
|
175
|
+
inReplyTo: headers["in-reply-to"] || void 0,
|
|
176
|
+
references,
|
|
177
|
+
from: typeof email.from === "string" ? email.from : email.from?.email || "",
|
|
178
|
+
to: Array.isArray(email.to) ? email.to.map((t) => typeof t === "string" ? t : t?.email || "") : [String(email.to || "")],
|
|
179
|
+
subject: email.subject || "",
|
|
180
|
+
text: email.text || email.body || "",
|
|
181
|
+
html: email.html || void 0,
|
|
182
|
+
date: email.created_at ? new Date(email.created_at) : /* @__PURE__ */ new Date()
|
|
183
|
+
};
|
|
184
|
+
} catch (err) {
|
|
185
|
+
console.warn(`[EmailClient] Failed to fetch Resend email ${emailId}: ${err}`);
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* List received inbound emails from Resend via polling.
|
|
191
|
+
* Uses GET /emails/receiving with cursor-based pagination.
|
|
192
|
+
* Returns email summaries (call fetchResendEmail for full content).
|
|
193
|
+
*/
|
|
194
|
+
async listReceivedEmails(opts) {
|
|
195
|
+
if (!this.resendConfig?.apiKey) {
|
|
196
|
+
return { emails: [], hasMore: false };
|
|
197
|
+
}
|
|
198
|
+
try {
|
|
199
|
+
const params = new URLSearchParams();
|
|
200
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
201
|
+
if (opts?.after) params.set("after", opts.after);
|
|
202
|
+
const qs = params.toString();
|
|
203
|
+
const url = `https://api.resend.com/emails/receiving${qs ? `?${qs}` : ""}`;
|
|
204
|
+
const resp = await fetch(url, {
|
|
205
|
+
headers: {
|
|
206
|
+
Authorization: `Bearer ${this.resendConfig.apiKey}`,
|
|
207
|
+
"Content-Type": "application/json"
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
if (!resp.ok) {
|
|
211
|
+
console.warn(
|
|
212
|
+
`[EmailClient] Resend list received failed: ${resp.status} ${resp.statusText}`
|
|
213
|
+
);
|
|
214
|
+
return { emails: [], hasMore: false };
|
|
215
|
+
}
|
|
216
|
+
const body = await resp.json();
|
|
217
|
+
const data = Array.isArray(body.data) ? body.data : [];
|
|
218
|
+
const emails = data.map((e) => ({
|
|
219
|
+
id: e.id,
|
|
220
|
+
from: typeof e.from === "string" ? e.from : e.from?.email || "",
|
|
221
|
+
to: Array.isArray(e.to) ? e.to.map((t) => typeof t === "string" ? t : t?.email || "") : [],
|
|
222
|
+
subject: e.subject || "",
|
|
223
|
+
created_at: e.created_at || "",
|
|
224
|
+
message_id: e.message_id
|
|
225
|
+
}));
|
|
226
|
+
const lastId = emails.length > 0 ? emails[emails.length - 1].id : void 0;
|
|
227
|
+
return {
|
|
228
|
+
emails,
|
|
229
|
+
hasMore: !!body.has_more,
|
|
230
|
+
lastId
|
|
231
|
+
};
|
|
232
|
+
} catch (err) {
|
|
233
|
+
console.warn(`[EmailClient] Resend list received error: ${err}`);
|
|
234
|
+
return { emails: [], hasMore: false };
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/** Verify Resend webhook signature */
|
|
238
|
+
async verifyResendWebhook(payload, headers) {
|
|
239
|
+
if (!this.resendConfig?.webhookSecret) return true;
|
|
240
|
+
try {
|
|
241
|
+
const { Webhook } = await import("./dist-PN5UHL6A.mjs");
|
|
242
|
+
const wh = new Webhook(this.resendConfig.webhookSecret);
|
|
243
|
+
wh.verify(payload, {
|
|
244
|
+
"svix-id": headers["svix-id"] || "",
|
|
245
|
+
"svix-timestamp": headers["svix-timestamp"] || "",
|
|
246
|
+
"svix-signature": headers["svix-signature"] || ""
|
|
247
|
+
});
|
|
248
|
+
return true;
|
|
249
|
+
} catch {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
// ─── Send ───
|
|
254
|
+
/** Send an email via configured backend (SMTP or Resend) */
|
|
255
|
+
async sendEmail(opts) {
|
|
256
|
+
const messageId = opts.messageId || `<${randomUUID()}@visor>`;
|
|
257
|
+
if (this.sendBackend === "resend") {
|
|
258
|
+
return this.sendViaResend(opts, messageId);
|
|
259
|
+
}
|
|
260
|
+
return this.sendViaSmtp(opts, messageId);
|
|
261
|
+
}
|
|
262
|
+
async sendViaSmtp(opts, messageId) {
|
|
263
|
+
try {
|
|
264
|
+
const transport = await this.getSmtpTransport();
|
|
265
|
+
const to = Array.isArray(opts.to) ? opts.to.join(", ") : opts.to;
|
|
266
|
+
const mailOpts = {
|
|
267
|
+
from: this.fromAddress,
|
|
268
|
+
to,
|
|
269
|
+
subject: opts.subject,
|
|
270
|
+
text: opts.text,
|
|
271
|
+
messageId
|
|
272
|
+
};
|
|
273
|
+
if (opts.html) mailOpts.html = opts.html;
|
|
274
|
+
if (opts.inReplyTo) mailOpts.inReplyTo = opts.inReplyTo;
|
|
275
|
+
if (opts.references && opts.references.length > 0) {
|
|
276
|
+
mailOpts.references = opts.references.join(" ");
|
|
277
|
+
}
|
|
278
|
+
const info = await transport.sendMail(mailOpts);
|
|
279
|
+
return {
|
|
280
|
+
ok: true,
|
|
281
|
+
messageId: info.messageId || messageId
|
|
282
|
+
};
|
|
283
|
+
} catch (err) {
|
|
284
|
+
const errMsg = err?.message || String(err);
|
|
285
|
+
console.warn(`[EmailClient] SMTP send failed: ${errMsg}`);
|
|
286
|
+
return { ok: false, error: errMsg };
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
async sendViaResend(opts, messageId) {
|
|
290
|
+
try {
|
|
291
|
+
const resend = await this.getResendClient();
|
|
292
|
+
const to = Array.isArray(opts.to) ? opts.to : [opts.to];
|
|
293
|
+
const headers = {};
|
|
294
|
+
headers["Message-ID"] = messageId;
|
|
295
|
+
if (opts.inReplyTo) headers["In-Reply-To"] = opts.inReplyTo;
|
|
296
|
+
if (opts.references && opts.references.length > 0) {
|
|
297
|
+
headers["References"] = opts.references.join(" ");
|
|
298
|
+
}
|
|
299
|
+
const sendOpts = {
|
|
300
|
+
from: this.fromAddress,
|
|
301
|
+
to,
|
|
302
|
+
subject: opts.subject,
|
|
303
|
+
text: opts.text,
|
|
304
|
+
headers
|
|
305
|
+
};
|
|
306
|
+
if (opts.html) sendOpts.html = opts.html;
|
|
307
|
+
const result = await resend.emails.send(sendOpts);
|
|
308
|
+
const data = result.data || result;
|
|
309
|
+
return {
|
|
310
|
+
ok: true,
|
|
311
|
+
messageId: data?.id ? `<${data.id}@resend>` : messageId
|
|
312
|
+
};
|
|
313
|
+
} catch (err) {
|
|
314
|
+
const errMsg = err?.message || String(err);
|
|
315
|
+
console.warn(`[EmailClient] Resend send failed: ${errMsg}`);
|
|
316
|
+
return { ok: false, error: errMsg };
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
// ─── Lazy initialization helpers ───
|
|
320
|
+
async getSmtpTransport() {
|
|
321
|
+
if (this.smtpTransport) return this.smtpTransport;
|
|
322
|
+
const nodemailer = await import("nodemailer");
|
|
323
|
+
this.smtpTransport = nodemailer.createTransport({
|
|
324
|
+
host: this.smtpConfig.host,
|
|
325
|
+
port: this.smtpConfig.port || 587,
|
|
326
|
+
secure: this.smtpConfig.secure ?? true,
|
|
327
|
+
auth: this.smtpConfig.auth
|
|
328
|
+
});
|
|
329
|
+
return this.smtpTransport;
|
|
330
|
+
}
|
|
331
|
+
async getResendClient() {
|
|
332
|
+
if (this.resendClient) return this.resendClient;
|
|
333
|
+
const { Resend } = await import("resend");
|
|
334
|
+
this.resendClient = new Resend(this.resendConfig.apiKey);
|
|
335
|
+
return this.resendClient;
|
|
336
|
+
}
|
|
337
|
+
/** Generate a deterministic thread ID from a Message-ID chain */
|
|
338
|
+
static deriveThreadId(rootMessageId) {
|
|
339
|
+
return createHash("sha256").update(rootMessageId).digest("hex").slice(0, 16);
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
// src/email/markdown.ts
|
|
346
|
+
function escapeHtml(text) {
|
|
347
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
348
|
+
}
|
|
349
|
+
function markdownToEmailHtml(text) {
|
|
350
|
+
if (!text || typeof text !== "string") return "";
|
|
351
|
+
const lines = text.split(/\r?\n/);
|
|
352
|
+
const result = [];
|
|
353
|
+
let inCodeBlock = false;
|
|
354
|
+
let codeBlockLang = "";
|
|
355
|
+
let codeLines = [];
|
|
356
|
+
let inBlockquote = false;
|
|
357
|
+
let blockquoteLines = [];
|
|
358
|
+
const listStack = [];
|
|
359
|
+
const flushBlockquote = () => {
|
|
360
|
+
if (blockquoteLines.length > 0) {
|
|
361
|
+
result.push(
|
|
362
|
+
`<blockquote style="border-left:3px solid #ccc;margin:8px 0;padding:4px 12px;color:#555;">${blockquoteLines.join("<br>")}</blockquote>`
|
|
363
|
+
);
|
|
364
|
+
blockquoteLines = [];
|
|
365
|
+
inBlockquote = false;
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
const flushList = () => {
|
|
369
|
+
while (listStack.length > 0) {
|
|
370
|
+
const tag = listStack.pop();
|
|
371
|
+
result.push(`</${tag}>`);
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
for (let i = 0; i < lines.length; i++) {
|
|
375
|
+
const trimmed = lines[i].trimStart();
|
|
376
|
+
if (/^```/.test(trimmed)) {
|
|
377
|
+
if (!inCodeBlock) {
|
|
378
|
+
flushBlockquote();
|
|
379
|
+
flushList();
|
|
380
|
+
inCodeBlock = true;
|
|
381
|
+
codeBlockLang = trimmed.slice(3).trim();
|
|
382
|
+
codeLines = [];
|
|
383
|
+
} else {
|
|
384
|
+
const escaped = codeLines.map((l) => escapeHtml(l)).join("\n");
|
|
385
|
+
const langAttr = codeBlockLang ? ` class="language-${escapeHtml(codeBlockLang)}"` : "";
|
|
386
|
+
result.push(
|
|
387
|
+
`<pre style="background:#f4f4f4;padding:12px;border-radius:4px;overflow-x:auto;font-size:13px;"><code${langAttr}>${escaped}</code></pre>`
|
|
388
|
+
);
|
|
389
|
+
inCodeBlock = false;
|
|
390
|
+
codeBlockLang = "";
|
|
391
|
+
codeLines = [];
|
|
392
|
+
}
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
if (inCodeBlock) {
|
|
396
|
+
codeLines.push(lines[i]);
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
const bqMatch = /^>\s?(.*)$/.exec(trimmed);
|
|
400
|
+
if (bqMatch) {
|
|
401
|
+
flushList();
|
|
402
|
+
inBlockquote = true;
|
|
403
|
+
blockquoteLines.push(convertInline(bqMatch[1]));
|
|
404
|
+
continue;
|
|
405
|
+
} else if (inBlockquote) {
|
|
406
|
+
flushBlockquote();
|
|
407
|
+
}
|
|
408
|
+
const bulletMatch = /^(\s*)([-*])\s+(.+)$/.exec(lines[i]);
|
|
409
|
+
if (bulletMatch) {
|
|
410
|
+
if (listStack.length === 0 || listStack[listStack.length - 1] !== "ul") {
|
|
411
|
+
flushList();
|
|
412
|
+
listStack.push("ul");
|
|
413
|
+
result.push('<ul style="margin:4px 0;padding-left:24px;">');
|
|
414
|
+
}
|
|
415
|
+
result.push(`<li>${convertInline(bulletMatch[3])}</li>`);
|
|
416
|
+
continue;
|
|
417
|
+
}
|
|
418
|
+
const numMatch = /^(\s*)(\d+)\.\s+(.+)$/.exec(lines[i]);
|
|
419
|
+
if (numMatch) {
|
|
420
|
+
if (listStack.length === 0 || listStack[listStack.length - 1] !== "ol") {
|
|
421
|
+
flushList();
|
|
422
|
+
listStack.push("ol");
|
|
423
|
+
result.push('<ol style="margin:4px 0;padding-left:24px;">');
|
|
424
|
+
}
|
|
425
|
+
result.push(`<li>${convertInline(numMatch[3])}</li>`);
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
if (listStack.length > 0) flushList();
|
|
429
|
+
const line = lines[i];
|
|
430
|
+
const headerMatch = /^(#{1,6})\s+(.+)$/.exec(line.trimStart());
|
|
431
|
+
if (headerMatch) {
|
|
432
|
+
const level = headerMatch[1].length;
|
|
433
|
+
const sizes = {
|
|
434
|
+
1: "24px",
|
|
435
|
+
2: "20px",
|
|
436
|
+
3: "18px",
|
|
437
|
+
4: "16px",
|
|
438
|
+
5: "14px",
|
|
439
|
+
6: "13px"
|
|
440
|
+
};
|
|
441
|
+
result.push(
|
|
442
|
+
`<h${level} style="font-size:${sizes[level]};margin:16px 0 8px 0;">${convertInline(headerMatch[2].trim())}</h${level}>`
|
|
443
|
+
);
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
if (/^[-*_]{3,}\s*$/.test(trimmed)) {
|
|
447
|
+
result.push('<hr style="border:none;border-top:1px solid #ddd;margin:16px 0;">');
|
|
448
|
+
continue;
|
|
449
|
+
}
|
|
450
|
+
if (trimmed === "") {
|
|
451
|
+
result.push("<br>");
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
result.push(`<p style="margin:4px 0;">${convertInline(line)}</p>`);
|
|
455
|
+
}
|
|
456
|
+
if (inCodeBlock && codeLines.length > 0) {
|
|
457
|
+
const escaped = codeLines.map((l) => escapeHtml(l)).join("\n");
|
|
458
|
+
result.push(
|
|
459
|
+
`<pre style="background:#f4f4f4;padding:12px;border-radius:4px;overflow-x:auto;font-size:13px;"><code>${escaped}</code></pre>`
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
flushBlockquote();
|
|
463
|
+
flushList();
|
|
464
|
+
return result.join("\n");
|
|
465
|
+
}
|
|
466
|
+
function convertInline(line) {
|
|
467
|
+
const codeSpans = [];
|
|
468
|
+
let processed = line.replace(/`([^`]+)`/g, (_m, code) => {
|
|
469
|
+
const idx = codeSpans.length;
|
|
470
|
+
codeSpans.push(
|
|
471
|
+
`<code style="background:#f0f0f0;padding:1px 4px;border-radius:3px;font-size:13px;">${escapeHtml(code)}</code>`
|
|
472
|
+
);
|
|
473
|
+
return `\0CODE${idx}\0`;
|
|
474
|
+
});
|
|
475
|
+
processed = escapeHtml(processed);
|
|
476
|
+
processed = processed.replace(
|
|
477
|
+
/!\[([^\]]*)\]\(([^)\s]+)(?:\s+"[^&]*")?\)/g,
|
|
478
|
+
(_m, alt, url) => `<img src="${url}" alt="${alt || "image"}" style="max-width:100%;">`
|
|
479
|
+
);
|
|
480
|
+
processed = processed.replace(
|
|
481
|
+
/\[([^\]]+)\]\(([^)\s]+)(?:\s+"[^&]*")?\)/g,
|
|
482
|
+
(_m, label, url) => `<a href="${url}" style="color:#0066cc;">${label}</a>`
|
|
483
|
+
);
|
|
484
|
+
processed = processed.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>");
|
|
485
|
+
processed = processed.replace(/__([^_]+)__/g, "<strong>$1</strong>");
|
|
486
|
+
processed = processed.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g, "<em>$1</em>");
|
|
487
|
+
processed = processed.replace(/~~([^~]+)~~/g, "<del>$1</del>");
|
|
488
|
+
processed = processed.replace(
|
|
489
|
+
/\x00CODE(\d+)\x00/g,
|
|
490
|
+
(_m, idx) => codeSpans[parseInt(idx)]
|
|
491
|
+
);
|
|
492
|
+
return processed;
|
|
493
|
+
}
|
|
494
|
+
function wrapInEmailTemplate(bodyHtml) {
|
|
495
|
+
return `<!DOCTYPE html>
|
|
496
|
+
<html>
|
|
497
|
+
<head>
|
|
498
|
+
<meta charset="utf-8">
|
|
499
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
500
|
+
</head>
|
|
501
|
+
<body style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:14px;line-height:1.5;color:#333;max-width:600px;margin:0 auto;padding:16px;">
|
|
502
|
+
${bodyHtml}
|
|
503
|
+
</body>
|
|
504
|
+
</html>`;
|
|
505
|
+
}
|
|
506
|
+
function addRePrefix(subject) {
|
|
507
|
+
if (!subject) return "Re:";
|
|
508
|
+
if (/^Re:/i.test(subject.trim())) return subject.trim();
|
|
509
|
+
return `Re: ${subject.trim()}`;
|
|
510
|
+
}
|
|
511
|
+
function formatEmailText(text) {
|
|
512
|
+
return markdownToEmailHtml(text);
|
|
513
|
+
}
|
|
514
|
+
var init_markdown = __esm({
|
|
515
|
+
"src/email/markdown.ts"() {
|
|
516
|
+
"use strict";
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
// src/frontends/email-frontend.ts
|
|
521
|
+
var EmailFrontend;
|
|
522
|
+
var init_email_frontend = __esm({
|
|
523
|
+
"src/frontends/email-frontend.ts"() {
|
|
524
|
+
init_client();
|
|
525
|
+
init_markdown();
|
|
526
|
+
EmailFrontend = class {
|
|
527
|
+
name = "email";
|
|
528
|
+
subs = [];
|
|
529
|
+
cfg;
|
|
530
|
+
errorNotified = false;
|
|
531
|
+
constructor(config) {
|
|
532
|
+
this.cfg = config || {};
|
|
533
|
+
}
|
|
534
|
+
start(ctx) {
|
|
535
|
+
const bus = ctx.eventBus;
|
|
536
|
+
try {
|
|
537
|
+
ctx.logger.info(`[email-frontend] started`);
|
|
538
|
+
} catch {
|
|
539
|
+
}
|
|
540
|
+
this.subs.push(
|
|
541
|
+
bus.on("CheckCompleted", async (env) => {
|
|
542
|
+
const ev = env && env.payload || env;
|
|
543
|
+
await this.maybePostDirectReply(ctx, ev.checkId, ev.result).catch(() => {
|
|
544
|
+
});
|
|
545
|
+
})
|
|
546
|
+
);
|
|
547
|
+
this.subs.push(
|
|
548
|
+
bus.on("CheckErrored", async (env) => {
|
|
549
|
+
const ev = env && env.payload || env;
|
|
550
|
+
const message = ev?.error?.message || "Execution error";
|
|
551
|
+
await this.maybePostError(ctx, "Check failed", message, ev?.checkId).catch(() => {
|
|
552
|
+
});
|
|
553
|
+
})
|
|
554
|
+
);
|
|
555
|
+
this.subs.push(
|
|
556
|
+
bus.on("Shutdown", async (env) => {
|
|
557
|
+
const ev = env && env.payload || env;
|
|
558
|
+
const message = ev?.error?.message || "Fatal error";
|
|
559
|
+
await this.maybePostError(ctx, "Run failed", message).catch(() => {
|
|
560
|
+
});
|
|
561
|
+
})
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
stop() {
|
|
565
|
+
for (const s of this.subs) s.unsubscribe();
|
|
566
|
+
this.subs = [];
|
|
567
|
+
}
|
|
568
|
+
getEmailClient(ctx) {
|
|
569
|
+
const injected = ctx.emailClient;
|
|
570
|
+
if (injected) return injected;
|
|
571
|
+
try {
|
|
572
|
+
const emailConfig = ctx.webhookContext?.webhookData?.get("/bots/email/message");
|
|
573
|
+
const sendCfg = this.cfg.send || emailConfig?.sendConfig;
|
|
574
|
+
if (sendCfg || process.env.EMAIL_SMTP_HOST || process.env.RESEND_API_KEY) {
|
|
575
|
+
return new EmailClient({
|
|
576
|
+
send: sendCfg || {
|
|
577
|
+
type: process.env.RESEND_API_KEY ? "resend" : "smtp"
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
} catch {
|
|
582
|
+
}
|
|
583
|
+
return void 0;
|
|
584
|
+
}
|
|
585
|
+
getInboundEmailPayload(ctx) {
|
|
586
|
+
try {
|
|
587
|
+
const endpoint = "/bots/email/message";
|
|
588
|
+
return ctx.webhookContext?.webhookData?.get(endpoint) || null;
|
|
589
|
+
} catch {
|
|
590
|
+
return null;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
async maybePostError(ctx, title, message, checkId) {
|
|
594
|
+
if (this.errorNotified) return;
|
|
595
|
+
const client = this.getEmailClient(ctx);
|
|
596
|
+
if (!client) return;
|
|
597
|
+
const payload = this.getInboundEmailPayload(ctx);
|
|
598
|
+
const ev = payload?.event;
|
|
599
|
+
if (!ev?.from) return;
|
|
600
|
+
let text = `${title}`;
|
|
601
|
+
if (checkId) text += `
|
|
602
|
+
Check: ${checkId}`;
|
|
603
|
+
if (message) text += `
|
|
604
|
+
${message}`;
|
|
605
|
+
const sendOpts = {
|
|
606
|
+
to: ev.from,
|
|
607
|
+
subject: ev.subject ? addRePrefix(ev.subject) : `Visor: ${title}`,
|
|
608
|
+
text,
|
|
609
|
+
html: wrapInEmailTemplate(`<p><strong>${title}</strong></p><p>${message}</p>`)
|
|
610
|
+
};
|
|
611
|
+
if (ev.messageId) {
|
|
612
|
+
sendOpts.inReplyTo = ev.messageId;
|
|
613
|
+
sendOpts.references = ev.references ? [...ev.references, ev.messageId] : [ev.messageId];
|
|
614
|
+
}
|
|
615
|
+
await client.sendEmail(sendOpts);
|
|
616
|
+
this.errorNotified = true;
|
|
617
|
+
}
|
|
618
|
+
async maybePostDirectReply(ctx, checkId, result) {
|
|
619
|
+
try {
|
|
620
|
+
const cfg = ctx.config || {};
|
|
621
|
+
const checkCfg = cfg.checks?.[checkId];
|
|
622
|
+
if (!checkCfg) return;
|
|
623
|
+
const providerType = checkCfg.type || "";
|
|
624
|
+
const isAi = providerType === "ai";
|
|
625
|
+
const isLogChat = providerType === "log" && checkCfg.group === "chat";
|
|
626
|
+
const isWorkflow = providerType === "workflow";
|
|
627
|
+
if (!isAi && !isLogChat && !isWorkflow) return;
|
|
628
|
+
if (checkCfg.criticality === "internal") return;
|
|
629
|
+
if (isAi) {
|
|
630
|
+
const schema = checkCfg.schema;
|
|
631
|
+
if (typeof schema === "string") {
|
|
632
|
+
const simpleSchemas = ["code-review", "markdown", "text", "plain"];
|
|
633
|
+
if (!simpleSchemas.includes(schema)) return;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
const client = this.getEmailClient(ctx);
|
|
637
|
+
if (!client) return;
|
|
638
|
+
const payload = this.getInboundEmailPayload(ctx);
|
|
639
|
+
const ev = payload?.event;
|
|
640
|
+
if (!ev?.from) {
|
|
641
|
+
ctx.logger.warn(`[email-frontend] skip posting reply for ${checkId}: missing from address`);
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
const out = result?.output;
|
|
645
|
+
let text;
|
|
646
|
+
if (out && typeof out.text === "string" && out.text.trim().length > 0) {
|
|
647
|
+
text = out.text.trim();
|
|
648
|
+
} else if (isAi && typeof checkCfg.schema === "string") {
|
|
649
|
+
if (typeof result?.content === "string" && result.content.trim().length > 0) {
|
|
650
|
+
text = result.content.trim();
|
|
651
|
+
}
|
|
652
|
+
} else if (isLogChat && typeof result?.logOutput === "string") {
|
|
653
|
+
const raw = result.logOutput;
|
|
654
|
+
if (raw.trim().length > 0) text = raw.trim();
|
|
655
|
+
}
|
|
656
|
+
if (out && typeof out._rawOutput === "string" && out._rawOutput.trim().length > 0) {
|
|
657
|
+
text = (text || "") + "\n\n" + out._rawOutput.trim();
|
|
658
|
+
}
|
|
659
|
+
if (!text) {
|
|
660
|
+
ctx.logger.info(`[email-frontend] skip posting reply for ${checkId}: no renderable text`);
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
text = text.replace(/\\n/g, "\n");
|
|
664
|
+
const htmlBody = formatEmailText(text);
|
|
665
|
+
const sendOpts = {
|
|
666
|
+
to: ev.from,
|
|
667
|
+
subject: ev.subject ? addRePrefix(ev.subject) : `Re: Visor response`,
|
|
668
|
+
text,
|
|
669
|
+
html: wrapInEmailTemplate(htmlBody)
|
|
670
|
+
};
|
|
671
|
+
if (ev.messageId) {
|
|
672
|
+
sendOpts.inReplyTo = ev.messageId;
|
|
673
|
+
sendOpts.references = ev.references ? [...ev.references, ev.messageId] : [ev.messageId];
|
|
674
|
+
}
|
|
675
|
+
const sendResult = await client.sendEmail(sendOpts);
|
|
676
|
+
if (!sendResult.ok) {
|
|
677
|
+
ctx.logger.warn(
|
|
678
|
+
`[email-frontend] failed to send reply for ${checkId}: ${sendResult.error}`
|
|
679
|
+
);
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
ctx.logger.info(
|
|
683
|
+
`[email-frontend] sent reply for ${checkId} to ${ev.from} (messageId=${sendResult.messageId})`
|
|
684
|
+
);
|
|
685
|
+
} catch (err) {
|
|
686
|
+
try {
|
|
687
|
+
ctx.logger.warn(
|
|
688
|
+
`[email-frontend] maybePostDirectReply failed for ${checkId}: ${err instanceof Error ? err.message : String(err)}`
|
|
689
|
+
);
|
|
690
|
+
} catch {
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
init_email_frontend();
|
|
698
|
+
export {
|
|
699
|
+
EmailFrontend
|
|
700
|
+
};
|
|
701
|
+
//# sourceMappingURL=email-frontend-ECHQCFTR.mjs.map
|