@probelabs/visor 0.1.187-ee → 0.1.187

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.
Files changed (410) hide show
  1. package/dist/{102.index.js → 140.index.js} +3 -3
  2. package/dist/{736.index.js → 142.index.js} +36 -36
  3. package/dist/{961.index.js → 223.index.js} +16 -16
  4. package/dist/{840.index.js → 676.index.js} +12 -12
  5. package/dist/{663.index.js → 85.index.js} +15 -15
  6. package/dist/action-cli-bridge.d.ts.map +1 -1
  7. package/dist/agent-protocol/a2a-frontend.d.ts.map +1 -1
  8. package/dist/agent-protocol/index.d.ts.map +1 -1
  9. package/dist/agent-protocol/push-notification-manager.d.ts.map +1 -1
  10. package/dist/agent-protocol/state-transitions.d.ts.map +1 -1
  11. package/dist/agent-protocol/task-evaluator.d.ts.map +1 -1
  12. package/dist/agent-protocol/task-live-update-slack.d.ts.map +1 -1
  13. package/dist/agent-protocol/task-live-update-teams.d.ts.map +1 -1
  14. package/dist/agent-protocol/task-live-update-telegram.d.ts.map +1 -1
  15. package/dist/agent-protocol/task-live-updates.d.ts.map +1 -1
  16. package/dist/agent-protocol/task-progress-tool.d.ts.map +1 -1
  17. package/dist/agent-protocol/task-queue.d.ts.map +1 -1
  18. package/dist/agent-protocol/task-store.d.ts.map +1 -1
  19. package/dist/agent-protocol/task-stream-manager.d.ts.map +1 -1
  20. package/dist/agent-protocol/task-trace-resolution.d.ts.map +1 -1
  21. package/dist/agent-protocol/tasks-cli-handler.d.ts.map +1 -1
  22. package/dist/agent-protocol/tasks-tui.d.ts.map +1 -1
  23. package/dist/agent-protocol/trace-serializer.d.ts.map +1 -1
  24. package/dist/agent-protocol/track-execution.d.ts.map +1 -1
  25. package/dist/agent-protocol/types.d.ts.map +1 -1
  26. package/dist/ai-review-service.d.ts.map +1 -1
  27. package/dist/check-execution-engine.d.ts.map +1 -1
  28. package/dist/cli-main.d.ts.map +1 -1
  29. package/dist/cli.d.ts.map +1 -1
  30. package/dist/commands.d.ts.map +1 -1
  31. package/dist/config/cli-handler.d.ts.map +1 -1
  32. package/dist/config/config-reloader.d.ts.map +1 -1
  33. package/dist/config/config-snapshot-store.d.ts.map +1 -1
  34. package/dist/config/config-watcher.d.ts.map +1 -1
  35. package/dist/config/types.d.ts.map +1 -1
  36. package/dist/config.d.ts.map +1 -1
  37. package/dist/cron-scheduler.d.ts.map +1 -1
  38. package/dist/debug-visualizer/debug-span-exporter.d.ts.map +1 -1
  39. package/dist/debug-visualizer/trace-reader.d.ts.map +1 -1
  40. package/dist/debug-visualizer/ws-server.d.ts.map +1 -1
  41. package/dist/dependency-resolver.d.ts.map +1 -1
  42. package/dist/email/adapter.d.ts.map +1 -1
  43. package/dist/email/client.d.ts.map +1 -1
  44. package/dist/email/markdown.d.ts.map +1 -1
  45. package/dist/email/polling-runner.d.ts.map +1 -1
  46. package/dist/engine/on-finish/orchestrator.d.ts.map +1 -1
  47. package/dist/engine/on-finish/utils.d.ts.map +1 -1
  48. package/dist/event-bus/event-bus.d.ts.map +1 -1
  49. package/dist/event-bus/types.d.ts.map +1 -1
  50. package/dist/event-mapper.d.ts.map +1 -1
  51. package/dist/failure-condition-evaluator.d.ts.map +1 -1
  52. package/dist/footer.d.ts.map +1 -1
  53. package/dist/frontends/email-frontend.d.ts.map +1 -1
  54. package/dist/frontends/github-frontend.d.ts.map +1 -1
  55. package/dist/frontends/host.d.ts.map +1 -1
  56. package/dist/frontends/ndjson-sink.d.ts.map +1 -1
  57. package/dist/frontends/slack-frontend.d.ts.map +1 -1
  58. package/dist/frontends/teams-frontend.d.ts.map +1 -1
  59. package/dist/frontends/telegram-frontend.d.ts.map +1 -1
  60. package/dist/frontends/whatsapp-frontend.d.ts.map +1 -1
  61. package/dist/generated/config-schema.d.ts.map +1 -1
  62. package/dist/git-repository-analyzer.d.ts.map +1 -1
  63. package/dist/github-auth.d.ts.map +1 -1
  64. package/dist/github-check-service.d.ts.map +1 -1
  65. package/dist/github-comments.d.ts.map +1 -1
  66. package/dist/github-reactions.d.ts.map +1 -1
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +8154 -9971
  69. package/dist/issue-filter.d.ts.map +1 -1
  70. package/dist/liquid-extensions.d.ts.map +1 -1
  71. package/dist/logger.d.ts.map +1 -1
  72. package/dist/mcp-job-manager.d.ts.map +1 -1
  73. package/dist/mcp-server.d.ts.map +1 -1
  74. package/dist/memory-store.d.ts.map +1 -1
  75. package/dist/output/traces/run-2026-08-20T13-50-06-218Z.ndjson +3148 -0
  76. package/dist/output-formatters.d.ts.map +1 -1
  77. package/dist/policy/default-engine.d.ts.map +1 -1
  78. package/dist/policy/index.d.ts.map +1 -1
  79. package/dist/policy/policy-check-command.d.ts.map +1 -1
  80. package/dist/policy/types.d.ts.map +1 -1
  81. package/dist/pr-analyzer.d.ts.map +1 -1
  82. package/dist/pr-detector.d.ts.map +1 -1
  83. package/dist/providers/a2a-check-provider.d.ts.map +1 -1
  84. package/dist/providers/ai-check-provider.d.ts.map +1 -1
  85. package/dist/providers/api-tool-executor.d.ts.map +1 -1
  86. package/dist/providers/check-provider-registry.d.ts.map +1 -1
  87. package/dist/providers/check-provider.interface.d.ts.map +1 -1
  88. package/dist/providers/claude-code-check-provider.d.ts.map +1 -1
  89. package/dist/providers/claude-code-types.d.ts.map +1 -1
  90. package/dist/providers/command-check-provider.d.ts.map +1 -1
  91. package/dist/providers/custom-tool-executor.d.ts.map +1 -1
  92. package/dist/providers/git-checkout-provider.d.ts.map +1 -1
  93. package/dist/providers/github-ops-provider.d.ts.map +1 -1
  94. package/dist/providers/http-check-provider.d.ts.map +1 -1
  95. package/dist/providers/http-client-provider.d.ts.map +1 -1
  96. package/dist/providers/http-input-provider.d.ts.map +1 -1
  97. package/dist/providers/human-input-check-provider.d.ts.map +1 -1
  98. package/dist/providers/index.d.ts.map +1 -1
  99. package/dist/providers/log-check-provider.d.ts.map +1 -1
  100. package/dist/providers/mcp-check-provider.d.ts.map +1 -1
  101. package/dist/providers/mcp-custom-sse-server.d.ts.map +1 -1
  102. package/dist/providers/mcp-tools.d.ts.map +1 -1
  103. package/dist/providers/memory-check-provider.d.ts.map +1 -1
  104. package/dist/providers/noop-check-provider.d.ts.map +1 -1
  105. package/dist/providers/script-check-provider.d.ts.map +1 -1
  106. package/dist/providers/utcp-check-provider.d.ts.map +1 -1
  107. package/dist/providers/workflow-check-provider.d.ts.map +1 -1
  108. package/dist/providers/workflow-tool-executor.d.ts.map +1 -1
  109. package/dist/reviewer.d.ts.map +1 -1
  110. package/dist/runners/config-reload-runtime.d.ts.map +1 -1
  111. package/dist/runners/graceful-restart.d.ts.map +1 -1
  112. package/dist/runners/mcp-server-runner.d.ts.map +1 -1
  113. package/dist/runners/process-cli-handler.d.ts.map +1 -1
  114. package/dist/runners/process-discovery.d.ts.map +1 -1
  115. package/dist/runners/runner-factory.d.ts.map +1 -1
  116. package/dist/runners/runner-host.d.ts.map +1 -1
  117. package/dist/runners/runner.d.ts.map +1 -1
  118. package/dist/runners/telemetry-init.d.ts.map +1 -1
  119. package/dist/sandbox/bubblewrap-sandbox.d.ts.map +1 -1
  120. package/dist/sandbox/cache-volume-manager.d.ts.map +1 -1
  121. package/dist/sandbox/check-runner.d.ts.map +1 -1
  122. package/dist/sandbox/compose-generator.d.ts.map +1 -1
  123. package/dist/sandbox/docker-compose-sandbox.d.ts.map +1 -1
  124. package/dist/sandbox/docker-image-sandbox.d.ts.map +1 -1
  125. package/dist/sandbox/env-filter.d.ts.map +1 -1
  126. package/dist/sandbox/index.d.ts.map +1 -1
  127. package/dist/sandbox/sandbox-manager.d.ts.map +1 -1
  128. package/dist/sandbox/sandbox-telemetry.d.ts.map +1 -1
  129. package/dist/sandbox/seatbelt-sandbox.d.ts.map +1 -1
  130. package/dist/sandbox/trace-ingester.d.ts.map +1 -1
  131. package/dist/sandbox/types.d.ts.map +1 -1
  132. package/dist/scheduler/cli-handler.d.ts.map +1 -1
  133. package/dist/scheduler/index.d.ts.map +1 -1
  134. package/dist/scheduler/message-trigger.d.ts.map +1 -1
  135. package/dist/scheduler/schedule-parser.d.ts.map +1 -1
  136. package/dist/scheduler/schedule-store.d.ts.map +1 -1
  137. package/dist/scheduler/schedule-tool.d.ts.map +1 -1
  138. package/dist/scheduler/scheduler.d.ts.map +1 -1
  139. package/dist/scheduler/store/index.d.ts.map +1 -1
  140. package/dist/scheduler/store/json-migrator.d.ts.map +1 -1
  141. package/dist/scheduler/store/sqlite-store.d.ts.map +1 -1
  142. package/dist/scheduler/store/types.d.ts.map +1 -1
  143. package/dist/sdk/{a2a-frontend-QVKJ7MVW.mjs → a2a-frontend-XCQ4CQUF.mjs} +3 -3
  144. package/dist/sdk/{check-provider-registry-QUUL6JI2.mjs → check-provider-registry-2D3MCWP3.mjs} +6 -6
  145. package/dist/sdk/{chunk-6LQEODDA.mjs → chunk-B2LQT6QU.mjs} +2 -2
  146. package/dist/sdk/chunk-B2LQT6QU.mjs.map +1 -0
  147. package/dist/sdk/{chunk-PZADRRLX.mjs → chunk-S3GSZRYC.mjs} +2 -2
  148. package/dist/sdk/{chunk-HQCCT6WP.mjs → chunk-TGQBEM3Y.mjs} +203 -203
  149. package/dist/sdk/chunk-TGQBEM3Y.mjs.map +1 -0
  150. package/dist/sdk/{chunk-BBLBZVWC.mjs → chunk-VS3JE2DL.mjs} +3 -3
  151. package/dist/sdk/{chunk-QLT42TX7.mjs → chunk-YETG675X.mjs} +2 -2
  152. package/dist/sdk/{dist-YLO6HUFD.mjs → dist-VBYEFQ6T.mjs} +85 -311
  153. package/dist/sdk/dist-VBYEFQ6T.mjs.map +1 -0
  154. package/dist/sdk/{email-frontend-6O454VL5.mjs → email-frontend-AE5TYWNC.mjs} +2 -2
  155. package/dist/sdk/{failure-condition-evaluator-USY3ISVA.mjs → failure-condition-evaluator-66PWLV3D.mjs} +4 -4
  156. package/dist/sdk/{github-frontend-2T5PWYD5.mjs → github-frontend-BBFKCY4M.mjs} +4 -4
  157. package/dist/sdk/{host-UZESVA6Z.mjs → host-UQRZDLT7.mjs} +4 -4
  158. package/dist/sdk/{routing-TYXT3STD.mjs → routing-Q647KUMO.mjs} +5 -5
  159. package/dist/sdk/{schedule-tool-ODMIDBMT.mjs → schedule-tool-WMGSM6IT.mjs} +6 -6
  160. package/dist/sdk/{schedule-tool-handler-IQSKBFLS.mjs → schedule-tool-handler-JMDHCGZ2.mjs} +6 -6
  161. package/dist/sdk/sdk.js +916 -2290
  162. package/dist/sdk/sdk.js.map +1 -1
  163. package/dist/sdk/sdk.mjs +5 -5
  164. package/dist/sdk/{trace-helpers-AM2QE5UZ.mjs → trace-helpers-AIUGQLK5.mjs} +3 -3
  165. package/dist/sdk/{track-execution-VJJVJH6K.mjs → track-execution-CFRZXMEC.mjs} +2 -2
  166. package/dist/sdk/{workflow-check-provider-XOWQYWTC.mjs → workflow-check-provider-G7A67EPP.mjs} +6 -6
  167. package/dist/sdk.d.ts.map +1 -1
  168. package/dist/session-registry.d.ts.map +1 -1
  169. package/dist/slack/adapter.d.ts.map +1 -1
  170. package/dist/slack/cache-prewarmer.d.ts.map +1 -1
  171. package/dist/slack/client.d.ts.map +1 -1
  172. package/dist/slack/markdown.d.ts.map +1 -1
  173. package/dist/slack/prompt-state.d.ts.map +1 -1
  174. package/dist/slack/rate-limiter.d.ts.map +1 -1
  175. package/dist/slack/schedule-tool-handler.d.ts.map +1 -1
  176. package/dist/slack/signature.d.ts.map +1 -1
  177. package/dist/slack/slack-output-adapter.d.ts.map +1 -1
  178. package/dist/slack/socket-runner.d.ts.map +1 -1
  179. package/dist/slack/thread-cache.d.ts.map +1 -1
  180. package/dist/snapshot-store.d.ts.map +1 -1
  181. package/dist/state-machine/context/build-engine-context.d.ts.map +1 -1
  182. package/dist/state-machine/context/workflow-inputs.d.ts.map +1 -1
  183. package/dist/state-machine/dispatch/debounce-manager.d.ts.map +1 -1
  184. package/dist/state-machine/dispatch/dependency-gating.d.ts.map +1 -1
  185. package/dist/state-machine/dispatch/execution-invoker.d.ts.map +1 -1
  186. package/dist/state-machine/dispatch/foreach-processor.d.ts.map +1 -1
  187. package/dist/state-machine/dispatch/history-snapshot.d.ts.map +1 -1
  188. package/dist/state-machine/dispatch/on-init-handlers.d.ts.map +1 -1
  189. package/dist/state-machine/dispatch/policy-gate.d.ts.map +1 -1
  190. package/dist/state-machine/dispatch/renderer-schema.d.ts.map +1 -1
  191. package/dist/state-machine/dispatch/sandbox-routing.d.ts.map +1 -1
  192. package/dist/state-machine/dispatch/stats-manager.d.ts.map +1 -1
  193. package/dist/state-machine/dispatch/template-renderer.d.ts.map +1 -1
  194. package/dist/state-machine/execution/summary.d.ts.map +1 -1
  195. package/dist/state-machine/runner.d.ts.map +1 -1
  196. package/dist/state-machine/states/check-running.d.ts.map +1 -1
  197. package/dist/state-machine/states/completed.d.ts.map +1 -1
  198. package/dist/state-machine/states/error.d.ts.map +1 -1
  199. package/dist/state-machine/states/init.d.ts.map +1 -1
  200. package/dist/state-machine/states/level-dispatch.d.ts.map +1 -1
  201. package/dist/state-machine/states/plan-ready.d.ts.map +1 -1
  202. package/dist/state-machine/states/routing.d.ts.map +1 -1
  203. package/dist/state-machine/states/wave-planning.d.ts.map +1 -1
  204. package/dist/state-machine/workflow-projection.d.ts.map +1 -1
  205. package/dist/state-machine-execution-engine.d.ts.map +1 -1
  206. package/dist/teams/adapter.d.ts.map +1 -1
  207. package/dist/teams/client.d.ts.map +1 -1
  208. package/dist/teams/markdown.d.ts.map +1 -1
  209. package/dist/teams/webhook-runner.d.ts.map +1 -1
  210. package/dist/telegram/adapter.d.ts.map +1 -1
  211. package/dist/telegram/client.d.ts.map +1 -1
  212. package/dist/telegram/markdown.d.ts.map +1 -1
  213. package/dist/telegram/polling-runner.d.ts.map +1 -1
  214. package/dist/telemetry/fallback-ndjson.d.ts.map +1 -1
  215. package/dist/telemetry/file-span-exporter.d.ts.map +1 -1
  216. package/dist/telemetry/lazy-otel.d.ts.map +1 -1
  217. package/dist/telemetry/metrics.d.ts.map +1 -1
  218. package/dist/telemetry/opentelemetry.d.ts.map +1 -1
  219. package/dist/telemetry/state-capture.d.ts.map +1 -1
  220. package/dist/telemetry/trace-helpers.d.ts.map +1 -1
  221. package/dist/telemetry/trace-report-exporter.d.ts.map +1 -1
  222. package/dist/test-runner/assertions.d.ts.map +1 -1
  223. package/dist/test-runner/conversation-sugar.d.ts.map +1 -1
  224. package/dist/test-runner/core/environment.d.ts.map +1 -1
  225. package/dist/test-runner/core/fixture.d.ts.map +1 -1
  226. package/dist/test-runner/core/flow-stage.d.ts.map +1 -1
  227. package/dist/test-runner/core/mocks.d.ts.map +1 -1
  228. package/dist/test-runner/core/test-execution-wrapper.d.ts.map +1 -1
  229. package/dist/test-runner/evaluators.d.ts.map +1 -1
  230. package/dist/test-runner/fixture-loader.d.ts.map +1 -1
  231. package/dist/test-runner/index.d.ts.map +1 -1
  232. package/dist/test-runner/llm-judge.d.ts.map +1 -1
  233. package/dist/test-runner/recorders/github-recorder.d.ts.map +1 -1
  234. package/dist/test-runner/recorders/global-recorder.d.ts.map +1 -1
  235. package/dist/test-runner/recorders/slack-recorder.d.ts.map +1 -1
  236. package/dist/test-runner/utils/selectors.d.ts.map +1 -1
  237. package/dist/test-runner/validator.d.ts.map +1 -1
  238. package/dist/traces/run-2026-08-20T13-50-06-218Z.ndjson +3148 -0
  239. package/dist/tui/chat-runner.d.ts.map +1 -1
  240. package/dist/tui/chat-state.d.ts.map +1 -1
  241. package/dist/tui/chat-tui.d.ts.map +1 -1
  242. package/dist/tui/components/chat-box.d.ts.map +1 -1
  243. package/dist/tui/components/input-bar.d.ts.map +1 -1
  244. package/dist/tui/components/status-bar.d.ts.map +1 -1
  245. package/dist/tui/components/trace-viewer.d.ts.map +1 -1
  246. package/dist/tui/index.d.ts.map +1 -1
  247. package/dist/tui/tui-frontend.d.ts.map +1 -1
  248. package/dist/types/bot.d.ts.map +1 -1
  249. package/dist/types/cli.d.ts.map +1 -1
  250. package/dist/types/config.d.ts.map +1 -1
  251. package/dist/types/engine.d.ts.map +1 -1
  252. package/dist/types/execution.d.ts.map +1 -1
  253. package/dist/types/git-checkout.d.ts.map +1 -1
  254. package/dist/types/github.d.ts.map +1 -1
  255. package/dist/types/workflow.d.ts.map +1 -1
  256. package/dist/utils/author-permissions.d.ts.map +1 -1
  257. package/dist/utils/child-process-error-handler.d.ts.map +1 -1
  258. package/dist/utils/command-executor.d.ts.map +1 -1
  259. package/dist/utils/comment-metadata.d.ts.map +1 -1
  260. package/dist/utils/config-loader.d.ts.map +1 -1
  261. package/dist/utils/config-merger.d.ts.map +1 -1
  262. package/dist/utils/diff-processor.d.ts.map +1 -1
  263. package/dist/utils/env-exposure.d.ts.map +1 -1
  264. package/dist/utils/env-resolver.d.ts.map +1 -1
  265. package/dist/utils/fair-concurrency-limiter.d.ts.map +1 -1
  266. package/dist/utils/file-exclusion.d.ts.map +1 -1
  267. package/dist/utils/head-sha.d.ts.map +1 -1
  268. package/dist/utils/human-id.d.ts.map +1 -1
  269. package/dist/utils/instance-id.d.ts.map +1 -1
  270. package/dist/utils/interactive-prompt.d.ts.map +1 -1
  271. package/dist/utils/issue-normalizer.d.ts.map +1 -1
  272. package/dist/utils/json-text-extractor.d.ts.map +1 -1
  273. package/dist/utils/mermaid-telemetry.d.ts.map +1 -1
  274. package/dist/utils/oauth2-token-cache.d.ts.map +1 -1
  275. package/dist/utils/rate-limiter.d.ts.map +1 -1
  276. package/dist/utils/sandbox.d.ts.map +1 -1
  277. package/dist/utils/script-memory-ops.d.ts.map +1 -1
  278. package/dist/utils/script-tool-environment.d.ts.map +1 -1
  279. package/dist/utils/stdin-reader.d.ts.map +1 -1
  280. package/dist/utils/template-context.d.ts.map +1 -1
  281. package/dist/utils/tool-resolver.d.ts.map +1 -1
  282. package/dist/utils/toolkit-expander.d.ts.map +1 -1
  283. package/dist/utils/tracer-init.d.ts.map +1 -1
  284. package/dist/utils/ui-helpers.d.ts.map +1 -1
  285. package/dist/utils/user-facing-error.d.ts.map +1 -1
  286. package/dist/utils/workspace-manager.d.ts.map +1 -1
  287. package/dist/utils/worktree-cleanup.d.ts.map +1 -1
  288. package/dist/utils/worktree-manager.d.ts.map +1 -1
  289. package/dist/webhook-server.d.ts.map +1 -1
  290. package/dist/whatsapp/adapter.d.ts.map +1 -1
  291. package/dist/whatsapp/client.d.ts.map +1 -1
  292. package/dist/whatsapp/markdown.d.ts.map +1 -1
  293. package/dist/whatsapp/webhook-runner.d.ts.map +1 -1
  294. package/dist/workflow-executor.d.ts.map +1 -1
  295. package/dist/workflow-registry.d.ts.map +1 -1
  296. package/package.json +1 -1
  297. package/dist/enterprise/license/validator.d.ts +0 -39
  298. package/dist/enterprise/license/validator.d.ts.map +0 -1
  299. package/dist/enterprise/loader.d.ts +0 -25
  300. package/dist/enterprise/loader.d.ts.map +0 -1
  301. package/dist/enterprise/policy/opa-compiler.d.ts +0 -37
  302. package/dist/enterprise/policy/opa-compiler.d.ts.map +0 -1
  303. package/dist/enterprise/policy/opa-http-evaluator.d.ts +0 -36
  304. package/dist/enterprise/policy/opa-http-evaluator.d.ts.map +0 -1
  305. package/dist/enterprise/policy/opa-policy-engine.d.ts +0 -48
  306. package/dist/enterprise/policy/opa-policy-engine.d.ts.map +0 -1
  307. package/dist/enterprise/policy/opa-wasm-evaluator.d.ts +0 -34
  308. package/dist/enterprise/policy/opa-wasm-evaluator.d.ts.map +0 -1
  309. package/dist/enterprise/policy/policy-input-builder.d.ts +0 -122
  310. package/dist/enterprise/policy/policy-input-builder.d.ts.map +0 -1
  311. package/dist/enterprise/scheduler/knex-store.d.ts +0 -47
  312. package/dist/enterprise/scheduler/knex-store.d.ts.map +0 -1
  313. package/dist/sdk/a2a-frontend-7EGXSULE.mjs +0 -1751
  314. package/dist/sdk/a2a-frontend-7EGXSULE.mjs.map +0 -1
  315. package/dist/sdk/check-provider-registry-IGNTM4MW.mjs +0 -32
  316. package/dist/sdk/chunk-6DDNEBZ7.mjs +0 -6119
  317. package/dist/sdk/chunk-6DDNEBZ7.mjs.map +0 -1
  318. package/dist/sdk/chunk-6LQEODDA.mjs.map +0 -1
  319. package/dist/sdk/chunk-7XKHFRPN.mjs +0 -739
  320. package/dist/sdk/chunk-D6O5SCPC.mjs +0 -621
  321. package/dist/sdk/chunk-D6O5SCPC.mjs.map +0 -1
  322. package/dist/sdk/chunk-H2ZWNJJO.mjs +0 -204
  323. package/dist/sdk/chunk-H2ZWNJJO.mjs.map +0 -1
  324. package/dist/sdk/chunk-HMVD3AEC.mjs +0 -47064
  325. package/dist/sdk/chunk-HMVD3AEC.mjs.map +0 -1
  326. package/dist/sdk/chunk-HQCCT6WP.mjs.map +0 -1
  327. package/dist/sdk/chunk-IY5PQ5EN.mjs +0 -1724
  328. package/dist/sdk/chunk-IY5PQ5EN.mjs.map +0 -1
  329. package/dist/sdk/chunk-PDQTEBOJ.mjs +0 -213
  330. package/dist/sdk/chunk-PDQTEBOJ.mjs.map +0 -1
  331. package/dist/sdk/chunk-PUHU6UY6.mjs +0 -391
  332. package/dist/sdk/chunk-PUHU6UY6.mjs.map +0 -1
  333. package/dist/sdk/chunk-PZADRRLX.mjs.map +0 -1
  334. package/dist/sdk/chunk-RQDLVMER.mjs +0 -1507
  335. package/dist/sdk/chunk-RQDLVMER.mjs.map +0 -1
  336. package/dist/sdk/chunk-TSX3YS3F.mjs +0 -825
  337. package/dist/sdk/chunk-TSX3YS3F.mjs.map +0 -1
  338. package/dist/sdk/chunk-WZQMTD7W.mjs +0 -33
  339. package/dist/sdk/chunk-WZQMTD7W.mjs.map +0 -1
  340. package/dist/sdk/chunk-XXAEN5KU.mjs +0 -197
  341. package/dist/sdk/chunk-XXAEN5KU.mjs.map +0 -1
  342. package/dist/sdk/chunk-ZCBVXBKG.mjs +0 -1150
  343. package/dist/sdk/chunk-ZCBVXBKG.mjs.map +0 -1
  344. package/dist/sdk/config-BI5ZXG6D.mjs +0 -16
  345. package/dist/sdk/dist-NERCHNRR.mjs +0 -7955
  346. package/dist/sdk/dist-NERCHNRR.mjs.map +0 -1
  347. package/dist/sdk/dist-YLO6HUFD.mjs.map +0 -1
  348. package/dist/sdk/email-frontend-JE7H3LBC.mjs +0 -701
  349. package/dist/sdk/email-frontend-JE7H3LBC.mjs.map +0 -1
  350. package/dist/sdk/failure-condition-evaluator-7WHZUYDC.mjs +0 -18
  351. package/dist/sdk/github-frontend-RGK4DPRI.mjs +0 -1394
  352. package/dist/sdk/github-frontend-RGK4DPRI.mjs.map +0 -1
  353. package/dist/sdk/host-YWXWROIE.mjs +0 -87
  354. package/dist/sdk/host-YWXWROIE.mjs.map +0 -1
  355. package/dist/sdk/knex-store-KCMFAMH5.mjs +0 -527
  356. package/dist/sdk/knex-store-KCMFAMH5.mjs.map +0 -1
  357. package/dist/sdk/loader-35YWX5UQ.mjs +0 -89
  358. package/dist/sdk/loader-35YWX5UQ.mjs.map +0 -1
  359. package/dist/sdk/opa-policy-engine-FY5D45YS.mjs +0 -655
  360. package/dist/sdk/opa-policy-engine-FY5D45YS.mjs.map +0 -1
  361. package/dist/sdk/routing-PHHRW2C7.mjs +0 -26
  362. package/dist/sdk/schedule-tool-ITD445EO.mjs +0 -38
  363. package/dist/sdk/schedule-tool-ITD445EO.mjs.map +0 -1
  364. package/dist/sdk/schedule-tool-ODMIDBMT.mjs.map +0 -1
  365. package/dist/sdk/schedule-tool-handler-5WPHFBOG.mjs +0 -42
  366. package/dist/sdk/schedule-tool-handler-5WPHFBOG.mjs.map +0 -1
  367. package/dist/sdk/schedule-tool-handler-IQSKBFLS.mjs.map +0 -1
  368. package/dist/sdk/session-registry-6PV6SGEJ.mjs +0 -10
  369. package/dist/sdk/session-registry-6PV6SGEJ.mjs.map +0 -1
  370. package/dist/sdk/slack-frontend-H7PX5GE7.mjs +0 -985
  371. package/dist/sdk/slack-frontend-H7PX5GE7.mjs.map +0 -1
  372. package/dist/sdk/task-evaluator-H3BXC7SE.mjs +0 -263
  373. package/dist/sdk/task-evaluator-H3BXC7SE.mjs.map +0 -1
  374. package/dist/sdk/teams-frontend-HCT4MTY4.mjs +0 -342
  375. package/dist/sdk/teams-frontend-HCT4MTY4.mjs.map +0 -1
  376. package/dist/sdk/telegram-frontend-YQRYDKPN.mjs +0 -586
  377. package/dist/sdk/telegram-frontend-YQRYDKPN.mjs.map +0 -1
  378. package/dist/sdk/trace-helpers-AM2QE5UZ.mjs.map +0 -1
  379. package/dist/sdk/trace-helpers-OMF4C24T.mjs +0 -31
  380. package/dist/sdk/trace-helpers-OMF4C24T.mjs.map +0 -1
  381. package/dist/sdk/trace-reader-OVE4DL2D.mjs +0 -270
  382. package/dist/sdk/trace-reader-OVE4DL2D.mjs.map +0 -1
  383. package/dist/sdk/trace-serializer-EBHTHZYT.mjs +0 -24
  384. package/dist/sdk/trace-serializer-EBHTHZYT.mjs.map +0 -1
  385. package/dist/sdk/track-execution-BULXL2XD.mjs +0 -249
  386. package/dist/sdk/track-execution-BULXL2XD.mjs.map +0 -1
  387. package/dist/sdk/utcp-check-provider-Q4PD5EP2.mjs +0 -16
  388. package/dist/sdk/utcp-check-provider-Q4PD5EP2.mjs.map +0 -1
  389. package/dist/sdk/validator-XTZJZZJH.mjs +0 -134
  390. package/dist/sdk/validator-XTZJZZJH.mjs.map +0 -1
  391. package/dist/sdk/whatsapp-frontend-72XEIUIR.mjs +0 -438
  392. package/dist/sdk/whatsapp-frontend-72XEIUIR.mjs.map +0 -1
  393. package/dist/sdk/workflow-check-provider-OVZDCL4E.mjs +0 -32
  394. package/dist/sdk/workflow-check-provider-OVZDCL4E.mjs.map +0 -1
  395. package/dist/sdk/workflow-check-provider-XOWQYWTC.mjs.map +0 -1
  396. /package/dist/sdk/{a2a-frontend-QVKJ7MVW.mjs.map → a2a-frontend-XCQ4CQUF.mjs.map} +0 -0
  397. /package/dist/sdk/{check-provider-registry-IGNTM4MW.mjs.map → check-provider-registry-2D3MCWP3.mjs.map} +0 -0
  398. /package/dist/sdk/{chunk-7XKHFRPN.mjs.map → chunk-S3GSZRYC.mjs.map} +0 -0
  399. /package/dist/sdk/{chunk-BBLBZVWC.mjs.map → chunk-VS3JE2DL.mjs.map} +0 -0
  400. /package/dist/sdk/{chunk-QLT42TX7.mjs.map → chunk-YETG675X.mjs.map} +0 -0
  401. /package/dist/sdk/{email-frontend-6O454VL5.mjs.map → email-frontend-AE5TYWNC.mjs.map} +0 -0
  402. /package/dist/sdk/{check-provider-registry-QUUL6JI2.mjs.map → failure-condition-evaluator-66PWLV3D.mjs.map} +0 -0
  403. /package/dist/sdk/{github-frontend-2T5PWYD5.mjs.map → github-frontend-BBFKCY4M.mjs.map} +0 -0
  404. /package/dist/sdk/{host-UZESVA6Z.mjs.map → host-UQRZDLT7.mjs.map} +0 -0
  405. /package/dist/sdk/{config-BI5ZXG6D.mjs.map → routing-Q647KUMO.mjs.map} +0 -0
  406. /package/dist/sdk/{failure-condition-evaluator-7WHZUYDC.mjs.map → schedule-tool-WMGSM6IT.mjs.map} +0 -0
  407. /package/dist/sdk/{failure-condition-evaluator-USY3ISVA.mjs.map → schedule-tool-handler-JMDHCGZ2.mjs.map} +0 -0
  408. /package/dist/sdk/{routing-PHHRW2C7.mjs.map → trace-helpers-AIUGQLK5.mjs.map} +0 -0
  409. /package/dist/sdk/{track-execution-VJJVJH6K.mjs.map → track-execution-CFRZXMEC.mjs.map} +0 -0
  410. /package/dist/sdk/{routing-TYXT3STD.mjs.map → workflow-check-provider-G7A67EPP.mjs.map} +0 -0
@@ -1,701 +0,0 @@
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-YLO6HUFD.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, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
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+&quot;[^&]*&quot;)?\)/g,
478
- (_m, alt, url) => `<img src="${url}" alt="${alt || "image"}" style="max-width:100%;">`
479
- );
480
- processed = processed.replace(
481
- /\[([^\]]+)\]\(([^)\s]+)(?:\s+&quot;[^&]*&quot;)?\)/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-JE7H3LBC.mjs.map