@probelabs/visor 0.1.144 → 0.1.145

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 (97) hide show
  1. package/dist/config.d.ts.map +1 -1
  2. package/dist/docs/architecture.md +28 -0
  3. package/dist/docs/configuration.md +2 -0
  4. package/dist/docs/sandbox-engines.md +357 -0
  5. package/dist/docs/security.md +40 -0
  6. package/dist/generated/config-schema.d.ts +5 -0
  7. package/dist/generated/config-schema.d.ts.map +1 -1
  8. package/dist/generated/config-schema.json +9 -0
  9. package/dist/index.js +670 -162
  10. package/dist/output/traces/{run-2026-02-25T17-29-59-894Z.ndjson → run-2026-02-26T07-47-34-788Z.ndjson} +84 -84
  11. package/dist/{traces/run-2026-02-25T17-30-47-149Z.ndjson → output/traces/run-2026-02-26T07-48-25-935Z.ndjson} +1118 -1118
  12. package/dist/providers/mcp-check-provider.d.ts.map +1 -1
  13. package/dist/sandbox/bubblewrap-sandbox.d.ts +30 -0
  14. package/dist/sandbox/bubblewrap-sandbox.d.ts.map +1 -0
  15. package/dist/sandbox/index.d.ts +3 -1
  16. package/dist/sandbox/index.d.ts.map +1 -1
  17. package/dist/sandbox/sandbox-manager.d.ts +3 -2
  18. package/dist/sandbox/sandbox-manager.d.ts.map +1 -1
  19. package/dist/sandbox/seatbelt-sandbox.d.ts +36 -0
  20. package/dist/sandbox/seatbelt-sandbox.d.ts.map +1 -0
  21. package/dist/sandbox/types.d.ts +3 -1
  22. package/dist/sandbox/types.d.ts.map +1 -1
  23. package/dist/sdk/{check-provider-registry-VTNNTMWC.mjs → check-provider-registry-HFPKHYTG.mjs} +3 -3
  24. package/dist/sdk/{check-provider-registry-WBEOZCGW.mjs → check-provider-registry-HK6M4PDQ.mjs} +6 -6
  25. package/dist/sdk/{check-provider-registry-GKLK3I2X.mjs → check-provider-registry-TG5G2TF3.mjs} +6 -6
  26. package/dist/sdk/{chunk-D3UC5KUJ.mjs → chunk-5FXGIBJQ.mjs} +467 -100
  27. package/dist/sdk/chunk-5FXGIBJQ.mjs.map +1 -0
  28. package/dist/sdk/{chunk-FG6THKK7.mjs → chunk-6XPTQBXL.mjs} +3 -3
  29. package/dist/sdk/{chunk-FG6THKK7.mjs.map → chunk-6XPTQBXL.mjs.map} +1 -1
  30. package/dist/sdk/{chunk-N7LW3Q5B.mjs → chunk-E6SMU2Z4.mjs} +467 -100
  31. package/dist/sdk/chunk-E6SMU2Z4.mjs.map +1 -0
  32. package/dist/sdk/{chunk-PXWWPPNF.mjs → chunk-GZMQPC6D.mjs} +459 -92
  33. package/dist/sdk/chunk-GZMQPC6D.mjs.map +1 -0
  34. package/dist/sdk/{chunk-CLQTOZKH.mjs → chunk-I42ZCVA5.mjs} +3 -3
  35. package/dist/sdk/chunk-K3M5YVEU.mjs +1502 -0
  36. package/dist/sdk/chunk-K3M5YVEU.mjs.map +1 -0
  37. package/dist/sdk/{chunk-PQWAAGUP.mjs → chunk-L3XPYQ6I.mjs} +2 -2
  38. package/dist/sdk/chunk-L6ABOJVL.mjs +739 -0
  39. package/dist/sdk/chunk-L6ABOJVL.mjs.map +1 -0
  40. package/dist/sdk/chunk-OM3WYVFI.mjs +443 -0
  41. package/dist/sdk/chunk-OM3WYVFI.mjs.map +1 -0
  42. package/dist/sdk/{chunk-AKCHIYWU.mjs → chunk-YOKAA4IU.mjs} +96 -63
  43. package/dist/sdk/chunk-YOKAA4IU.mjs.map +1 -0
  44. package/dist/sdk/{config-KOKJ3PYE.mjs → config-AAB2FL22.mjs} +2 -2
  45. package/dist/sdk/{failure-condition-evaluator-LWH3NQ2S.mjs → failure-condition-evaluator-O464EJMD.mjs} +3 -3
  46. package/dist/sdk/failure-condition-evaluator-V3EJGD55.mjs +17 -0
  47. package/dist/sdk/{github-frontend-UUASYGNV.mjs → github-frontend-MSX6Q2WL.mjs} +3 -3
  48. package/dist/sdk/github-frontend-PSGUGYHT.mjs +1356 -0
  49. package/dist/sdk/github-frontend-PSGUGYHT.mjs.map +1 -0
  50. package/dist/sdk/{host-LAF3NFPZ.mjs → host-5BJ25CUZ.mjs} +2 -2
  51. package/dist/sdk/host-BYIV4QJ3.mjs +63 -0
  52. package/dist/sdk/host-BYIV4QJ3.mjs.map +1 -0
  53. package/dist/sdk/{routing-LEUV6A4K.mjs → routing-AJNUTCH7.mjs} +4 -4
  54. package/dist/sdk/routing-RIHVCEIU.mjs +25 -0
  55. package/dist/sdk/{schedule-tool-handler-EYDCUGOB.mjs → schedule-tool-handler-4O2VKNG2.mjs} +6 -6
  56. package/dist/sdk/{schedule-tool-handler-W7IB4MK3.mjs → schedule-tool-handler-BTLEDYAI.mjs} +3 -3
  57. package/dist/sdk/{schedule-tool-handler-7RGTKO24.mjs → schedule-tool-handler-R7PNPWWK.mjs} +6 -6
  58. package/dist/sdk/sdk.d.mts +3 -1
  59. package/dist/sdk/sdk.d.ts +3 -1
  60. package/dist/sdk/sdk.js +568 -168
  61. package/dist/sdk/sdk.js.map +1 -1
  62. package/dist/sdk/sdk.mjs +5 -5
  63. package/dist/sdk/{trace-helpers-NNBQNFWZ.mjs → trace-helpers-OZTZBK6T.mjs} +2 -2
  64. package/dist/sdk/trace-helpers-QQSTZGDT.mjs +25 -0
  65. package/dist/sdk/{workflow-check-provider-WW5U6R2P.mjs → workflow-check-provider-3IIKJFM4.mjs} +3 -3
  66. package/dist/sdk/workflow-check-provider-3IIKJFM4.mjs.map +1 -0
  67. package/dist/sdk/{workflow-check-provider-FLBIJQ4Z.mjs → workflow-check-provider-OM62QYHF.mjs} +6 -6
  68. package/dist/sdk/workflow-check-provider-OM62QYHF.mjs.map +1 -0
  69. package/dist/sdk/{workflow-check-provider-2G2CEXFR.mjs → workflow-check-provider-RARO4N5E.mjs} +6 -6
  70. package/dist/sdk/workflow-check-provider-RARO4N5E.mjs.map +1 -0
  71. package/dist/slack/socket-runner.d.ts.map +1 -1
  72. package/dist/traces/{run-2026-02-25T17-29-59-894Z.ndjson → run-2026-02-26T07-47-34-788Z.ndjson} +84 -84
  73. package/dist/{output/traces/run-2026-02-25T17-30-47-149Z.ndjson → traces/run-2026-02-26T07-48-25-935Z.ndjson} +1118 -1118
  74. package/dist/utils/workspace-manager.d.ts +9 -0
  75. package/dist/utils/workspace-manager.d.ts.map +1 -1
  76. package/package.json +2 -2
  77. package/dist/sdk/chunk-AKCHIYWU.mjs.map +0 -1
  78. package/dist/sdk/chunk-D3UC5KUJ.mjs.map +0 -1
  79. package/dist/sdk/chunk-N7LW3Q5B.mjs.map +0 -1
  80. package/dist/sdk/chunk-PXWWPPNF.mjs.map +0 -1
  81. /package/dist/sdk/{check-provider-registry-GKLK3I2X.mjs.map → check-provider-registry-HFPKHYTG.mjs.map} +0 -0
  82. /package/dist/sdk/{check-provider-registry-VTNNTMWC.mjs.map → check-provider-registry-HK6M4PDQ.mjs.map} +0 -0
  83. /package/dist/sdk/{check-provider-registry-WBEOZCGW.mjs.map → check-provider-registry-TG5G2TF3.mjs.map} +0 -0
  84. /package/dist/sdk/{chunk-CLQTOZKH.mjs.map → chunk-I42ZCVA5.mjs.map} +0 -0
  85. /package/dist/sdk/{chunk-PQWAAGUP.mjs.map → chunk-L3XPYQ6I.mjs.map} +0 -0
  86. /package/dist/sdk/{config-KOKJ3PYE.mjs.map → config-AAB2FL22.mjs.map} +0 -0
  87. /package/dist/sdk/{failure-condition-evaluator-LWH3NQ2S.mjs.map → failure-condition-evaluator-O464EJMD.mjs.map} +0 -0
  88. /package/dist/sdk/{routing-LEUV6A4K.mjs.map → failure-condition-evaluator-V3EJGD55.mjs.map} +0 -0
  89. /package/dist/sdk/{github-frontend-UUASYGNV.mjs.map → github-frontend-MSX6Q2WL.mjs.map} +0 -0
  90. /package/dist/sdk/{host-LAF3NFPZ.mjs.map → host-5BJ25CUZ.mjs.map} +0 -0
  91. /package/dist/sdk/{schedule-tool-handler-7RGTKO24.mjs.map → routing-AJNUTCH7.mjs.map} +0 -0
  92. /package/dist/sdk/{schedule-tool-handler-EYDCUGOB.mjs.map → routing-RIHVCEIU.mjs.map} +0 -0
  93. /package/dist/sdk/{schedule-tool-handler-W7IB4MK3.mjs.map → schedule-tool-handler-4O2VKNG2.mjs.map} +0 -0
  94. /package/dist/sdk/{trace-helpers-NNBQNFWZ.mjs.map → schedule-tool-handler-BTLEDYAI.mjs.map} +0 -0
  95. /package/dist/sdk/{workflow-check-provider-2G2CEXFR.mjs.map → schedule-tool-handler-R7PNPWWK.mjs.map} +0 -0
  96. /package/dist/sdk/{workflow-check-provider-FLBIJQ4Z.mjs.map → trace-helpers-OZTZBK6T.mjs.map} +0 -0
  97. /package/dist/sdk/{workflow-check-provider-WW5U6R2P.mjs.map → trace-helpers-QQSTZGDT.mjs.map} +0 -0
@@ -33,7 +33,7 @@ import {
33
33
  import {
34
34
  config_exports,
35
35
  init_config
36
- } from "./chunk-AKCHIYWU.mjs";
36
+ } from "./chunk-YOKAA4IU.mjs";
37
37
  import {
38
38
  ScheduleStore,
39
39
  buildScheduleToolContext,
@@ -53,11 +53,11 @@ import {
53
53
  init_routing,
54
54
  init_snapshot_store,
55
55
  snapshot_store_exports
56
- } from "./chunk-CLQTOZKH.mjs";
56
+ } from "./chunk-K3M5YVEU.mjs";
57
57
  import {
58
58
  FailureConditionEvaluator,
59
59
  init_failure_condition_evaluator
60
- } from "./chunk-PQWAAGUP.mjs";
60
+ } from "./chunk-L6ABOJVL.mjs";
61
61
  import {
62
62
  addEvent,
63
63
  emitNdjsonFallback,
@@ -68,7 +68,7 @@ import {
68
68
  setSpanAttributes,
69
69
  trace_helpers_exports,
70
70
  withActiveSpan
71
- } from "./chunk-FG6THKK7.mjs";
71
+ } from "./chunk-6XPTQBXL.mjs";
72
72
  import {
73
73
  addDiagramBlock,
74
74
  init_metrics
@@ -2288,7 +2288,7 @@ ${"=".repeat(60)}
2288
2288
  * Generate mock response for testing
2289
2289
  */
2290
2290
  async generateMockResponse(_prompt, _checkName, _schema) {
2291
- await new Promise((resolve6) => setTimeout(resolve6, 500));
2291
+ await new Promise((resolve8) => setTimeout(resolve8, 500));
2292
2292
  const name = (_checkName || "").toLowerCase();
2293
2293
  if (name.includes("extract-facts")) {
2294
2294
  const arr = Array.from({ length: 6 }, (_, i) => ({
@@ -3947,7 +3947,7 @@ async function executeWorkflowAsTool(workflowId, args, context2, argsOverrides)
3947
3947
  ...args,
3948
3948
  ...argsOverrides
3949
3949
  };
3950
- const { WorkflowCheckProvider: WorkflowCheckProvider2 } = await import("./workflow-check-provider-2G2CEXFR.mjs");
3950
+ const { WorkflowCheckProvider: WorkflowCheckProvider2 } = await import("./workflow-check-provider-RARO4N5E.mjs");
3951
3951
  const provider = new WorkflowCheckProvider2();
3952
3952
  const checkConfig = {
3953
3953
  type: "workflow",
@@ -8202,7 +8202,7 @@ async function executeCheckWithForEachItems2(checkId, forEachParent, forEachItem
8202
8202
  }
8203
8203
  }
8204
8204
  try {
8205
- const { evaluateTransitions } = await import("./routing-LEUV6A4K.mjs");
8205
+ const { evaluateTransitions } = await import("./routing-AJNUTCH7.mjs");
8206
8206
  const transTarget = await evaluateTransitions(
8207
8207
  onFinish.transitions,
8208
8208
  forEachParent,
@@ -8262,7 +8262,7 @@ async function executeCheckWithForEachItems2(checkId, forEachParent, forEachItem
8262
8262
  `[LevelDispatch] Error evaluating on_finish transitions for ${forEachParent}: ${e instanceof Error ? e.message : String(e)}`
8263
8263
  );
8264
8264
  }
8265
- const { evaluateGoto: evaluateGoto2 } = await import("./routing-LEUV6A4K.mjs");
8265
+ const { evaluateGoto: evaluateGoto2 } = await import("./routing-AJNUTCH7.mjs");
8266
8266
  if (context2.debug) {
8267
8267
  logger.info(
8268
8268
  `[LevelDispatch] Evaluating on_finish.goto_js for forEach parent: ${forEachParent}`
@@ -9974,8 +9974,8 @@ var init_runner = __esm({
9974
9974
  stats.sort((a, b) => (b.errorMessage ? 1 : 0) - (a.errorMessage ? 1 : 0));
9975
9975
  const results = this.aggregateResultsFromJournal();
9976
9976
  let totalDuration = 0;
9977
- for (const stat of stats) {
9978
- totalDuration = Math.max(totalDuration, stat.totalDuration);
9977
+ for (const stat2 of stats) {
9978
+ totalDuration = Math.max(totalDuration, stat2.totalDuration);
9979
9979
  }
9980
9980
  try {
9981
9981
  for (const s of stats) {
@@ -10641,9 +10641,271 @@ var init_cache_volume_manager = __esm({
10641
10641
  }
10642
10642
  });
10643
10643
 
10644
- // src/sandbox/sandbox-manager.ts
10645
- import { resolve, dirname, join as join6 } from "path";
10644
+ // src/sandbox/bubblewrap-sandbox.ts
10645
+ var bubblewrap_sandbox_exports = {};
10646
+ __export(bubblewrap_sandbox_exports, {
10647
+ BubblewrapSandbox: () => BubblewrapSandbox
10648
+ });
10649
+ import { promisify as promisify4 } from "util";
10650
+ import { execFile as execFileCb4 } from "child_process";
10646
10651
  import { existsSync as existsSync4 } from "fs";
10652
+ import { resolve } from "path";
10653
+ var execFileAsync4, EXEC_MAX_BUFFER4, BubblewrapSandbox;
10654
+ var init_bubblewrap_sandbox = __esm({
10655
+ "src/sandbox/bubblewrap-sandbox.ts"() {
10656
+ "use strict";
10657
+ init_logger();
10658
+ init_sandbox_telemetry();
10659
+ execFileAsync4 = promisify4(execFileCb4);
10660
+ EXEC_MAX_BUFFER4 = 50 * 1024 * 1024;
10661
+ BubblewrapSandbox = class {
10662
+ name;
10663
+ config;
10664
+ repoPath;
10665
+ constructor(name, config, repoPath) {
10666
+ this.name = name;
10667
+ this.config = config;
10668
+ this.repoPath = resolve(repoPath);
10669
+ }
10670
+ /**
10671
+ * Check if bwrap binary is available on the system.
10672
+ */
10673
+ static async isAvailable() {
10674
+ try {
10675
+ await execFileAsync4("which", ["bwrap"], { timeout: 5e3 });
10676
+ return true;
10677
+ } catch {
10678
+ return false;
10679
+ }
10680
+ }
10681
+ /**
10682
+ * Execute a command inside a bubblewrap sandbox.
10683
+ * Each exec creates a fresh namespace — no persistent container.
10684
+ */
10685
+ async exec(options) {
10686
+ const args = this.buildArgs(options);
10687
+ args.push("--", "/bin/sh", "-c", options.command);
10688
+ logger.debug(
10689
+ `[BubblewrapSandbox] Executing in sandbox '${this.name}': ${options.command.slice(0, 100)}`
10690
+ );
10691
+ try {
10692
+ const { stdout, stderr } = await execFileAsync4("bwrap", args, {
10693
+ maxBuffer: options.maxBuffer || EXEC_MAX_BUFFER4,
10694
+ timeout: options.timeoutMs || 6e5
10695
+ });
10696
+ addEvent2("visor.sandbox.bwrap.exec", {
10697
+ "visor.sandbox.name": this.name,
10698
+ "visor.sandbox.exit_code": 0
10699
+ });
10700
+ return { stdout, stderr, exitCode: 0 };
10701
+ } catch (err) {
10702
+ const execErr = err;
10703
+ const exitCode = typeof execErr.code === "number" ? execErr.code : 1;
10704
+ addEvent2("visor.sandbox.bwrap.exec", {
10705
+ "visor.sandbox.name": this.name,
10706
+ "visor.sandbox.exit_code": exitCode
10707
+ });
10708
+ return {
10709
+ stdout: execErr.stdout || "",
10710
+ stderr: execErr.stderr || "",
10711
+ exitCode
10712
+ };
10713
+ }
10714
+ }
10715
+ /**
10716
+ * No-op: bubblewrap processes are ephemeral (no persistent container to stop).
10717
+ */
10718
+ async stop() {
10719
+ }
10720
+ /**
10721
+ * Build the bwrap command-line arguments.
10722
+ */
10723
+ buildArgs(options) {
10724
+ const workdir = this.config.workdir || "/workspace";
10725
+ const args = [];
10726
+ args.push("--ro-bind", "/usr", "/usr");
10727
+ args.push("--ro-bind", "/bin", "/bin");
10728
+ if (existsSync4("/lib")) {
10729
+ args.push("--ro-bind", "/lib", "/lib");
10730
+ }
10731
+ if (existsSync4("/lib64")) {
10732
+ args.push("--ro-bind", "/lib64", "/lib64");
10733
+ }
10734
+ if (existsSync4("/etc/resolv.conf")) {
10735
+ args.push("--ro-bind", "/etc/resolv.conf", "/etc/resolv.conf");
10736
+ }
10737
+ if (existsSync4("/etc/ssl")) {
10738
+ args.push("--ro-bind", "/etc/ssl", "/etc/ssl");
10739
+ }
10740
+ args.push("--dev", "/dev");
10741
+ args.push("--proc", "/proc");
10742
+ args.push("--tmpfs", "/tmp");
10743
+ args.push("--tmpfs", "/root");
10744
+ if (this.config.read_only) {
10745
+ args.push("--ro-bind", this.repoPath, workdir);
10746
+ } else {
10747
+ args.push("--bind", this.repoPath, workdir);
10748
+ }
10749
+ args.push("--chdir", workdir);
10750
+ args.push("--unshare-pid");
10751
+ args.push("--new-session");
10752
+ args.push("--die-with-parent");
10753
+ if (this.config.network === false) {
10754
+ args.push("--unshare-net");
10755
+ }
10756
+ args.push("--clearenv");
10757
+ for (const [key, value] of Object.entries(options.env)) {
10758
+ if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(key)) {
10759
+ throw new Error(`Invalid environment variable name: '${key}'`);
10760
+ }
10761
+ args.push("--setenv", key, value);
10762
+ }
10763
+ return args;
10764
+ }
10765
+ };
10766
+ }
10767
+ });
10768
+
10769
+ // src/sandbox/seatbelt-sandbox.ts
10770
+ var seatbelt_sandbox_exports = {};
10771
+ __export(seatbelt_sandbox_exports, {
10772
+ SeatbeltSandbox: () => SeatbeltSandbox
10773
+ });
10774
+ import { promisify as promisify5 } from "util";
10775
+ import { execFile as execFileCb5 } from "child_process";
10776
+ import { resolve as resolve2 } from "path";
10777
+ import { realpathSync } from "fs";
10778
+ var execFileAsync5, EXEC_MAX_BUFFER5, SeatbeltSandbox;
10779
+ var init_seatbelt_sandbox = __esm({
10780
+ "src/sandbox/seatbelt-sandbox.ts"() {
10781
+ "use strict";
10782
+ init_logger();
10783
+ init_sandbox_telemetry();
10784
+ execFileAsync5 = promisify5(execFileCb5);
10785
+ EXEC_MAX_BUFFER5 = 50 * 1024 * 1024;
10786
+ SeatbeltSandbox = class {
10787
+ name;
10788
+ config;
10789
+ repoPath;
10790
+ constructor(name, config, repoPath) {
10791
+ this.name = name;
10792
+ this.config = config;
10793
+ this.repoPath = realpathSync(resolve2(repoPath));
10794
+ }
10795
+ /**
10796
+ * Check if sandbox-exec binary is available on the system.
10797
+ */
10798
+ static async isAvailable() {
10799
+ try {
10800
+ await execFileAsync5("which", ["sandbox-exec"], { timeout: 5e3 });
10801
+ return true;
10802
+ } catch {
10803
+ return false;
10804
+ }
10805
+ }
10806
+ /**
10807
+ * Execute a command inside a macOS seatbelt sandbox.
10808
+ * Each exec creates a fresh sandbox process — no persistent container.
10809
+ */
10810
+ async exec(options) {
10811
+ const profile = this.buildProfile();
10812
+ for (const key of Object.keys(options.env)) {
10813
+ if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(key)) {
10814
+ throw new Error(`Invalid environment variable name: '${key}'`);
10815
+ }
10816
+ }
10817
+ const args = ["-p", profile];
10818
+ args.push("/usr/bin/env", "-i");
10819
+ for (const [key, value] of Object.entries(options.env)) {
10820
+ args.push(`${key}=${value}`);
10821
+ }
10822
+ args.push("/bin/sh", "-c", options.command);
10823
+ logger.debug(
10824
+ `[SeatbeltSandbox] Executing in sandbox '${this.name}': ${options.command.slice(0, 100)}`
10825
+ );
10826
+ try {
10827
+ const { stdout, stderr } = await execFileAsync5("sandbox-exec", args, {
10828
+ maxBuffer: options.maxBuffer || EXEC_MAX_BUFFER5,
10829
+ timeout: options.timeoutMs || 6e5,
10830
+ cwd: this.repoPath
10831
+ });
10832
+ addEvent2("visor.sandbox.seatbelt.exec", {
10833
+ "visor.sandbox.name": this.name,
10834
+ "visor.sandbox.exit_code": 0
10835
+ });
10836
+ return { stdout, stderr, exitCode: 0 };
10837
+ } catch (err) {
10838
+ const execErr = err;
10839
+ const exitCode = typeof execErr.code === "number" ? execErr.code : 1;
10840
+ addEvent2("visor.sandbox.seatbelt.exec", {
10841
+ "visor.sandbox.name": this.name,
10842
+ "visor.sandbox.exit_code": exitCode
10843
+ });
10844
+ return {
10845
+ stdout: execErr.stdout || "",
10846
+ stderr: execErr.stderr || "",
10847
+ exitCode
10848
+ };
10849
+ }
10850
+ }
10851
+ /**
10852
+ * No-op: sandbox-exec processes are ephemeral (no persistent container to stop).
10853
+ */
10854
+ async stop() {
10855
+ }
10856
+ /**
10857
+ * Escape a path for use inside an SBPL profile string.
10858
+ * Escapes backslashes and double quotes.
10859
+ */
10860
+ escapePath(p) {
10861
+ return p.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
10862
+ }
10863
+ /**
10864
+ * Build the SBPL (Seatbelt Profile Language) profile string.
10865
+ */
10866
+ buildProfile() {
10867
+ const repoPath = this.escapePath(this.repoPath);
10868
+ const lines = [];
10869
+ lines.push("(version 1)");
10870
+ lines.push("(deny default)");
10871
+ lines.push("(allow process-exec)");
10872
+ lines.push("(allow process-fork)");
10873
+ lines.push("(allow file-read*");
10874
+ lines.push(' (literal "/")');
10875
+ lines.push(' (subpath "/usr")');
10876
+ lines.push(' (subpath "/bin")');
10877
+ lines.push(' (subpath "/sbin")');
10878
+ lines.push(' (subpath "/Library")');
10879
+ lines.push(' (subpath "/System")');
10880
+ lines.push(' (subpath "/private")');
10881
+ lines.push(' (subpath "/var")');
10882
+ lines.push(' (subpath "/etc")');
10883
+ lines.push(' (subpath "/dev")');
10884
+ lines.push(' (subpath "/tmp"))');
10885
+ lines.push("(allow file-write*");
10886
+ lines.push(' (subpath "/tmp")');
10887
+ lines.push(' (subpath "/private/tmp")');
10888
+ lines.push(' (subpath "/dev"))');
10889
+ lines.push('(allow file-write* (regex #"/private/var/folders/.*/T/xcrun_db"))');
10890
+ lines.push(`(allow file-read* (subpath "${repoPath}"))`);
10891
+ if (!this.config.read_only) {
10892
+ lines.push(`(allow file-write* (subpath "${repoPath}"))`);
10893
+ }
10894
+ if (this.config.network !== false) {
10895
+ lines.push("(allow network*)");
10896
+ }
10897
+ lines.push("(allow sysctl-read)");
10898
+ lines.push("(allow mach-lookup)");
10899
+ lines.push("(allow signal)");
10900
+ return lines.join("\n");
10901
+ }
10902
+ };
10903
+ }
10904
+ });
10905
+
10906
+ // src/sandbox/sandbox-manager.ts
10907
+ import { resolve as resolve3, dirname, join as join6 } from "path";
10908
+ import { existsSync as existsSync5 } from "fs";
10647
10909
  var SandboxManager;
10648
10910
  var init_sandbox_manager = __esm({
10649
10911
  "src/sandbox/sandbox-manager.ts"() {
@@ -10666,10 +10928,10 @@ var init_sandbox_manager = __esm({
10666
10928
  }
10667
10929
  constructor(sandboxDefs, repoPath, gitBranch) {
10668
10930
  this.sandboxDefs = sandboxDefs;
10669
- this.repoPath = resolve(repoPath);
10931
+ this.repoPath = resolve3(repoPath);
10670
10932
  this.gitBranch = gitBranch;
10671
10933
  this.cacheManager = new CacheVolumeManager();
10672
- this.visorDistPath = existsSync4(join6(__dirname, "index.js")) ? __dirname : resolve(dirname(__dirname));
10934
+ this.visorDistPath = existsSync5(join6(__dirname, "index.js")) ? __dirname : resolve3(dirname(__dirname));
10673
10935
  }
10674
10936
  /**
10675
10937
  * Resolve which sandbox a check should use.
@@ -10699,6 +10961,18 @@ var init_sandbox_manager = __esm({
10699
10961
  throw new Error(`Sandbox '${name}' is not defined`);
10700
10962
  }
10701
10963
  const mode = config.compose ? "compose" : "image";
10964
+ if (config.engine === "bubblewrap") {
10965
+ const { BubblewrapSandbox: BubblewrapSandbox2 } = (init_bubblewrap_sandbox(), __toCommonJS(bubblewrap_sandbox_exports));
10966
+ const instance = new BubblewrapSandbox2(name, config, this.repoPath);
10967
+ this.instances.set(name, instance);
10968
+ return instance;
10969
+ }
10970
+ if (config.engine === "seatbelt") {
10971
+ const { SeatbeltSandbox: SeatbeltSandbox2 } = (init_seatbelt_sandbox(), __toCommonJS(seatbelt_sandbox_exports));
10972
+ const instance = new SeatbeltSandbox2(name, config, this.repoPath);
10973
+ this.instances.set(name, instance);
10974
+ return instance;
10975
+ }
10702
10976
  return withActiveSpan2(
10703
10977
  "visor.sandbox.start",
10704
10978
  {
@@ -10878,8 +11152,8 @@ var init_workspace_manager = __esm({
10878
11152
  );
10879
11153
  if (this.cleanupRequested && this.activeOperations === 0) {
10880
11154
  logger.debug(`[Workspace] All references released, proceeding with deferred cleanup`);
10881
- for (const resolve6 of this.cleanupResolvers) {
10882
- resolve6();
11155
+ for (const resolve8 of this.cleanupResolvers) {
11156
+ resolve8();
10883
11157
  }
10884
11158
  this.cleanupResolvers = [];
10885
11159
  }
@@ -10929,13 +11203,34 @@ var init_workspace_manager = __esm({
10929
11203
  const mainProjectPath = path5.join(this.workspacePath, mainProjectName);
10930
11204
  const isGitRepo = await this.isGitRepository(this.originalPath);
10931
11205
  if (isGitRepo) {
10932
- await this.createMainProjectWorktree(mainProjectPath);
11206
+ const exists = await this.pathExists(mainProjectPath);
11207
+ if (exists) {
11208
+ logger.info(`[Workspace] Reusing existing main project worktree: ${mainProjectPath}`);
11209
+ const isValid = await this.isGitRepository(mainProjectPath);
11210
+ if (!isValid) {
11211
+ logger.warn(`[Workspace] Existing path is not a valid git dir, recreating`);
11212
+ await fsp.rm(mainProjectPath, { recursive: true, force: true });
11213
+ try {
11214
+ await commandExecutor.execute(
11215
+ `git -C ${shellEscape(this.originalPath)} worktree prune`,
11216
+ { timeout: 1e4 }
11217
+ );
11218
+ } catch {
11219
+ }
11220
+ await this.createMainProjectWorktree(mainProjectPath);
11221
+ }
11222
+ } else {
11223
+ await this.createMainProjectWorktree(mainProjectPath);
11224
+ }
10933
11225
  } else {
10934
11226
  logger.debug(`Original path is not a git repo, creating symlink`);
10935
- try {
10936
- await fsp.symlink(this.originalPath, mainProjectPath);
10937
- } catch (error) {
10938
- throw new Error(`Failed to create symlink for main project: ${error}`);
11227
+ const exists = await this.pathExists(mainProjectPath);
11228
+ if (!exists) {
11229
+ try {
11230
+ await fsp.symlink(this.originalPath, mainProjectPath);
11231
+ } catch (error) {
11232
+ throw new Error(`Failed to create symlink for main project: ${error}`);
11233
+ }
10939
11234
  }
10940
11235
  }
10941
11236
  this.registerCleanupHandlers();
@@ -10995,6 +11290,15 @@ var init_workspace_manager = __esm({
10995
11290
  * @param timeout Maximum time to wait for active operations (default: 60s)
10996
11291
  */
10997
11292
  async cleanup(timeout = 6e4) {
11293
+ if (!this.config.cleanupOnExit) {
11294
+ logger.debug(`[Workspace] Skipping cleanup (cleanupOnExit=false): ${this.workspacePath}`);
11295
+ _WorkspaceManager.instances.delete(this.sessionId);
11296
+ this.initialized = false;
11297
+ this.mainProjectInfo = null;
11298
+ this.projects.clear();
11299
+ this.usedNames.clear();
11300
+ return;
11301
+ }
10998
11302
  logger.info(
10999
11303
  `Cleaning up workspace: ${this.workspacePath} (active operations: ${this.activeOperations})`
11000
11304
  );
@@ -11004,19 +11308,19 @@ var init_workspace_manager = __esm({
11004
11308
  );
11005
11309
  this.cleanupRequested = true;
11006
11310
  await Promise.race([
11007
- new Promise((resolve6) => {
11311
+ new Promise((resolve8) => {
11008
11312
  if (this.activeOperations === 0) {
11009
- resolve6();
11313
+ resolve8();
11010
11314
  } else {
11011
- this.cleanupResolvers.push(resolve6);
11315
+ this.cleanupResolvers.push(resolve8);
11012
11316
  }
11013
11317
  }),
11014
- new Promise((resolve6) => {
11318
+ new Promise((resolve8) => {
11015
11319
  setTimeout(() => {
11016
11320
  logger.warn(
11017
11321
  `[Workspace] Cleanup timeout after ${timeout}ms, proceeding anyway (${this.activeOperations} operations still active)`
11018
11322
  );
11019
- resolve6();
11323
+ resolve8();
11020
11324
  }, timeout);
11021
11325
  })
11022
11326
  ]);
@@ -11046,6 +11350,68 @@ var init_workspace_manager = __esm({
11046
11350
  logger.warn(`Failed to cleanup workspace: ${error}`);
11047
11351
  }
11048
11352
  }
11353
+ /**
11354
+ * Check if a path exists (file or directory).
11355
+ */
11356
+ async pathExists(p) {
11357
+ try {
11358
+ await fsp.access(p);
11359
+ return true;
11360
+ } catch {
11361
+ return false;
11362
+ }
11363
+ }
11364
+ /**
11365
+ * Clean up stale workspace directories older than maxAge.
11366
+ * Call periodically (e.g. at socket-runner startup) to prevent disk bloat.
11367
+ */
11368
+ static async cleanupStale(basePath = process.env.VISOR_WORKSPACE_PATH || "/tmp/visor-workspaces", maxAgeMs = 24 * 60 * 60 * 1e3) {
11369
+ let cleaned = 0;
11370
+ try {
11371
+ const entries = await fsp.readdir(basePath, { withFileTypes: true });
11372
+ const now = Date.now();
11373
+ for (const entry of entries) {
11374
+ if (!entry.isDirectory()) continue;
11375
+ const dirPath = path5.join(basePath, entry.name);
11376
+ try {
11377
+ const stat2 = await fsp.stat(dirPath);
11378
+ if (now - stat2.mtimeMs > maxAgeMs) {
11379
+ try {
11380
+ const subdirs = await fsp.readdir(dirPath, { withFileTypes: true });
11381
+ for (const sub of subdirs) {
11382
+ if (!sub.isDirectory()) continue;
11383
+ const subPath = path5.join(dirPath, sub.name);
11384
+ const gitFilePath = path5.join(subPath, ".git");
11385
+ try {
11386
+ const gitContent = await fsp.readFile(gitFilePath, "utf-8");
11387
+ const match = gitContent.match(/gitdir:\s*(.+)/);
11388
+ if (match) {
11389
+ const worktreeGitDir = match[1].trim();
11390
+ const repoGitDir = worktreeGitDir.replace(/\/\.git\/worktrees\/.*$/, "");
11391
+ await commandExecutor.execute(
11392
+ `git -C ${shellEscape(repoGitDir)} worktree remove ${shellEscape(subPath)} --force`,
11393
+ { timeout: 1e4 }
11394
+ );
11395
+ }
11396
+ } catch {
11397
+ }
11398
+ }
11399
+ } catch {
11400
+ }
11401
+ await fsp.rm(dirPath, { recursive: true, force: true });
11402
+ cleaned++;
11403
+ }
11404
+ } catch {
11405
+ }
11406
+ }
11407
+ if (cleaned > 0) {
11408
+ logger.info(`[Workspace] Cleaned up ${cleaned} stale workspace(s) from ${basePath}`);
11409
+ }
11410
+ } catch (error) {
11411
+ logger.debug(`[Workspace] Stale cleanup error: ${error}`);
11412
+ }
11413
+ return cleaned;
11414
+ }
11049
11415
  /**
11050
11416
  * Create worktree for the main project
11051
11417
  *
@@ -11435,7 +11801,7 @@ var init_state_machine_execution_engine = __esm({
11435
11801
  try {
11436
11802
  const map = options?.webhookContext?.webhookData;
11437
11803
  if (map) {
11438
- const { CheckProviderRegistry: CheckProviderRegistry2 } = await import("./check-provider-registry-WBEOZCGW.mjs");
11804
+ const { CheckProviderRegistry: CheckProviderRegistry2 } = await import("./check-provider-registry-TG5G2TF3.mjs");
11439
11805
  const reg = CheckProviderRegistry2.getInstance();
11440
11806
  const p = reg.getProvider("http_input");
11441
11807
  if (p && typeof p.setWebhookContext === "function") p.setWebhookContext(map);
@@ -11548,7 +11914,7 @@ var init_state_machine_execution_engine = __esm({
11548
11914
  logger.info("[StateMachine] Using state machine engine");
11549
11915
  }
11550
11916
  if (!config) {
11551
- const { ConfigManager } = await import("./config-KOKJ3PYE.mjs");
11917
+ const { ConfigManager } = await import("./config-AAB2FL22.mjs");
11552
11918
  const configManager = new ConfigManager();
11553
11919
  config = await configManager.getDefaultConfig();
11554
11920
  logger.debug("[StateMachine] Using default configuration (no config provided)");
@@ -11558,7 +11924,7 @@ var init_state_machine_execution_engine = __esm({
11558
11924
  tag_filter: tagFilter
11559
11925
  } : config;
11560
11926
  try {
11561
- const { CheckProviderRegistry: CheckProviderRegistry2 } = await import("./check-provider-registry-WBEOZCGW.mjs");
11927
+ const { CheckProviderRegistry: CheckProviderRegistry2 } = await import("./check-provider-registry-TG5G2TF3.mjs");
11562
11928
  const registry = CheckProviderRegistry2.getInstance();
11563
11929
  registry.setCustomTools(configWithTagFilter.tools || {});
11564
11930
  } catch (error) {
@@ -11622,7 +11988,7 @@ var init_state_machine_execution_engine = __esm({
11622
11988
  try {
11623
11989
  const webhookData = this.executionContext?.webhookContext?.webhookData;
11624
11990
  if (webhookData instanceof Map) {
11625
- const { extractSlackContext: extractSlackContext2 } = await import("./schedule-tool-handler-EYDCUGOB.mjs");
11991
+ const { extractSlackContext: extractSlackContext2 } = await import("./schedule-tool-handler-R7PNPWWK.mjs");
11626
11992
  const slackCtx = extractSlackContext2(webhookData);
11627
11993
  if (slackCtx) {
11628
11994
  const payload = Array.from(webhookData.values())[0];
@@ -11651,7 +12017,7 @@ var init_state_machine_execution_engine = __esm({
11651
12017
  if (Array.isArray(configWithTagFilter.frontends) && configWithTagFilter.frontends.length > 0) {
11652
12018
  try {
11653
12019
  const { EventBus } = await import("./event-bus-5K3Y2FCS.mjs");
11654
- const { FrontendsHost } = await import("./host-LAF3NFPZ.mjs");
12020
+ const { FrontendsHost } = await import("./host-BYIV4QJ3.mjs");
11655
12021
  const bus = new EventBus();
11656
12022
  context2.eventBus = bus;
11657
12023
  frontendsHost = new FrontendsHost(bus, logger);
@@ -12001,9 +12367,9 @@ var init_state_machine_execution_engine = __esm({
12001
12367
  * @returns Array of failure condition evaluation results
12002
12368
  */
12003
12369
  async evaluateFailureConditions(checkName, reviewSummary, config, previousOutputs, authorAssociation) {
12004
- const { FailureConditionEvaluator: FailureConditionEvaluator2 } = await import("./failure-condition-evaluator-LWH3NQ2S.mjs");
12370
+ const { FailureConditionEvaluator: FailureConditionEvaluator2 } = await import("./failure-condition-evaluator-V3EJGD55.mjs");
12005
12371
  const evaluator = new FailureConditionEvaluator2();
12006
- const { addEvent: addEvent3 } = await import("./trace-helpers-NNBQNFWZ.mjs");
12372
+ const { addEvent: addEvent3 } = await import("./trace-helpers-OZTZBK6T.mjs");
12007
12373
  const { addFailIfTriggered } = await import("./metrics-I6A7IHG4.mjs");
12008
12374
  const checkConfig = config.checks?.[checkName];
12009
12375
  if (!checkConfig) {
@@ -12460,7 +12826,7 @@ var init_mcp_custom_sse_server = __esm({
12460
12826
  * Returns the actual bound port number
12461
12827
  */
12462
12828
  async start() {
12463
- return new Promise((resolve6, reject) => {
12829
+ return new Promise((resolve8, reject) => {
12464
12830
  try {
12465
12831
  this.server = http.createServer((req, res) => {
12466
12832
  this.handleRequest(req, res).catch((error) => {
@@ -12494,7 +12860,7 @@ var init_mcp_custom_sse_server = __esm({
12494
12860
  );
12495
12861
  }
12496
12862
  this.startKeepalive();
12497
- resolve6(this.port);
12863
+ resolve8(this.port);
12498
12864
  });
12499
12865
  } catch (error) {
12500
12866
  reject(error);
@@ -12557,7 +12923,7 @@ var init_mcp_custom_sse_server = __esm({
12557
12923
  logger.debug(
12558
12924
  `[CustomToolsSSEServer:${this.sessionId}] Grace period before stop: ${waitMs}ms (activeToolCalls=${this.activeToolCalls})`
12559
12925
  );
12560
- await new Promise((resolve6) => setTimeout(resolve6, waitMs));
12926
+ await new Promise((resolve8) => setTimeout(resolve8, waitMs));
12561
12927
  }
12562
12928
  }
12563
12929
  if (this.activeToolCalls > 0) {
@@ -12566,7 +12932,7 @@ var init_mcp_custom_sse_server = __esm({
12566
12932
  `[CustomToolsSSEServer:${this.sessionId}] Waiting for ${this.activeToolCalls} active tool call(s) before stop`
12567
12933
  );
12568
12934
  while (this.activeToolCalls > 0 && Date.now() - startedAt < effectiveDrainTimeoutMs) {
12569
- await new Promise((resolve6) => setTimeout(resolve6, 250));
12935
+ await new Promise((resolve8) => setTimeout(resolve8, 250));
12570
12936
  }
12571
12937
  if (this.activeToolCalls > 0) {
12572
12938
  logger.warn(
@@ -12591,21 +12957,21 @@ var init_mcp_custom_sse_server = __esm({
12591
12957
  }
12592
12958
  this.connections.clear();
12593
12959
  if (this.server) {
12594
- await new Promise((resolve6, reject) => {
12960
+ await new Promise((resolve8, reject) => {
12595
12961
  const timeout = setTimeout(() => {
12596
12962
  if (this.debug) {
12597
12963
  logger.debug(
12598
12964
  `[CustomToolsSSEServer:${this.sessionId}] Force closing server after timeout`
12599
12965
  );
12600
12966
  }
12601
- this.server?.close(() => resolve6());
12967
+ this.server?.close(() => resolve8());
12602
12968
  }, 5e3);
12603
12969
  this.server.close((error) => {
12604
12970
  clearTimeout(timeout);
12605
12971
  if (error) {
12606
12972
  reject(error);
12607
12973
  } else {
12608
- resolve6();
12974
+ resolve8();
12609
12975
  }
12610
12976
  });
12611
12977
  });
@@ -13031,7 +13397,7 @@ var init_mcp_custom_sse_server = __esm({
13031
13397
  logger.warn(
13032
13398
  `[CustomToolsSSEServer:${this.sessionId}] Tool ${toolName} failed (attempt ${attempt + 1}/${retryCount + 1}): ${errorMsg}. Retrying in ${delay}ms`
13033
13399
  );
13034
- await new Promise((resolve6) => setTimeout(resolve6, delay));
13400
+ await new Promise((resolve8) => setTimeout(resolve8, delay));
13035
13401
  attempt++;
13036
13402
  }
13037
13403
  }
@@ -13336,8 +13702,8 @@ var init_ai_check_provider = __esm({
13336
13702
  }
13337
13703
  const fs10 = __require("fs").promises;
13338
13704
  try {
13339
- const stat = await fs10.stat(resolvedPath);
13340
- return stat.isFile();
13705
+ const stat2 = await fs10.stat(resolvedPath);
13706
+ return stat2.isFile();
13341
13707
  } catch {
13342
13708
  return hasFileExtension && (isRelativePath || isAbsolutePath || hasPathSeparators);
13343
13709
  }
@@ -16585,8 +16951,8 @@ var init_claude_code_check_provider = __esm({
16585
16951
  resolvedPath = path9.resolve(process.cwd(), str);
16586
16952
  }
16587
16953
  try {
16588
- const stat = await fs7.stat(resolvedPath);
16589
- return stat.isFile();
16954
+ const stat2 = await fs7.stat(resolvedPath);
16955
+ return stat2.isFile();
16590
16956
  } catch {
16591
16957
  return hasFileExtension && (isRelativePath || isAbsolutePath || hasPathSeparators);
16592
16958
  }
@@ -22215,8 +22581,8 @@ var require_util2 = __commonJS({
22215
22581
  function createDeferredPromise() {
22216
22582
  let res;
22217
22583
  let rej;
22218
- const promise = new Promise((resolve6, reject) => {
22219
- res = resolve6;
22584
+ const promise = new Promise((resolve8, reject) => {
22585
+ res = resolve8;
22220
22586
  rej = reject;
22221
22587
  });
22222
22588
  return { promise, resolve: res, reject: rej };
@@ -23721,8 +24087,8 @@ Content-Type: ${value.type || "application/octet-stream"}\r
23721
24087
  });
23722
24088
  }
23723
24089
  });
23724
- const busboyResolve = new Promise((resolve6, reject) => {
23725
- busboy.on("finish", resolve6);
24090
+ const busboyResolve = new Promise((resolve8, reject) => {
24091
+ busboy.on("finish", resolve8);
23726
24092
  busboy.on("error", (err) => reject(new TypeError(err)));
23727
24093
  });
23728
24094
  if (this.body !== null) for await (const chunk of consumeBody(this[kState].body)) busboy.write(chunk);
@@ -24256,9 +24622,9 @@ var require_dispatcher_base = __commonJS({
24256
24622
  }
24257
24623
  close(callback) {
24258
24624
  if (callback === void 0) {
24259
- return new Promise((resolve6, reject) => {
24625
+ return new Promise((resolve8, reject) => {
24260
24626
  this.close((err, data) => {
24261
- return err ? reject(err) : resolve6(data);
24627
+ return err ? reject(err) : resolve8(data);
24262
24628
  });
24263
24629
  });
24264
24630
  }
@@ -24296,12 +24662,12 @@ var require_dispatcher_base = __commonJS({
24296
24662
  err = null;
24297
24663
  }
24298
24664
  if (callback === void 0) {
24299
- return new Promise((resolve6, reject) => {
24665
+ return new Promise((resolve8, reject) => {
24300
24666
  this.destroy(err, (err2, data) => {
24301
24667
  return err2 ? (
24302
24668
  /* istanbul ignore next: should never error */
24303
24669
  reject(err2)
24304
- ) : resolve6(data);
24670
+ ) : resolve8(data);
24305
24671
  });
24306
24672
  });
24307
24673
  }
@@ -25363,16 +25729,16 @@ var require_client = __commonJS({
25363
25729
  return this[kNeedDrain] < 2;
25364
25730
  }
25365
25731
  async [kClose]() {
25366
- return new Promise((resolve6) => {
25732
+ return new Promise((resolve8) => {
25367
25733
  if (!this[kSize]) {
25368
- resolve6(null);
25734
+ resolve8(null);
25369
25735
  } else {
25370
- this[kClosedResolve] = resolve6;
25736
+ this[kClosedResolve] = resolve8;
25371
25737
  }
25372
25738
  });
25373
25739
  }
25374
25740
  async [kDestroy](err) {
25375
- return new Promise((resolve6) => {
25741
+ return new Promise((resolve8) => {
25376
25742
  const requests = this[kQueue].splice(this[kPendingIdx]);
25377
25743
  for (let i = 0; i < requests.length; i++) {
25378
25744
  const request = requests[i];
@@ -25383,7 +25749,7 @@ var require_client = __commonJS({
25383
25749
  this[kClosedResolve]();
25384
25750
  this[kClosedResolve] = null;
25385
25751
  }
25386
- resolve6();
25752
+ resolve8();
25387
25753
  };
25388
25754
  if (this[kHTTP2Session] != null) {
25389
25755
  util.destroy(this[kHTTP2Session], err);
@@ -25963,7 +26329,7 @@ var require_client = __commonJS({
25963
26329
  });
25964
26330
  }
25965
26331
  try {
25966
- const socket = await new Promise((resolve6, reject) => {
26332
+ const socket = await new Promise((resolve8, reject) => {
25967
26333
  client[kConnector]({
25968
26334
  host,
25969
26335
  hostname,
@@ -25975,7 +26341,7 @@ var require_client = __commonJS({
25975
26341
  if (err) {
25976
26342
  reject(err);
25977
26343
  } else {
25978
- resolve6(socket2);
26344
+ resolve8(socket2);
25979
26345
  }
25980
26346
  });
25981
26347
  });
@@ -26599,12 +26965,12 @@ upgrade: ${upgrade}\r
26599
26965
  cb();
26600
26966
  }
26601
26967
  }
26602
- const waitForDrain = () => new Promise((resolve6, reject) => {
26968
+ const waitForDrain = () => new Promise((resolve8, reject) => {
26603
26969
  assert(callback === null);
26604
26970
  if (socket[kError]) {
26605
26971
  reject(socket[kError]);
26606
26972
  } else {
26607
- callback = resolve6;
26973
+ callback = resolve8;
26608
26974
  }
26609
26975
  });
26610
26976
  if (client[kHTTPConnVersion] === "h2") {
@@ -26950,8 +27316,8 @@ var require_pool_base = __commonJS({
26950
27316
  if (this[kQueue].isEmpty()) {
26951
27317
  return Promise.all(this[kClients].map((c) => c.close()));
26952
27318
  } else {
26953
- return new Promise((resolve6) => {
26954
- this[kClosedResolve] = resolve6;
27319
+ return new Promise((resolve8) => {
27320
+ this[kClosedResolve] = resolve8;
26955
27321
  });
26956
27322
  }
26957
27323
  }
@@ -27529,7 +27895,7 @@ var require_readable = __commonJS({
27529
27895
  if (this.closed) {
27530
27896
  return Promise.resolve(null);
27531
27897
  }
27532
- return new Promise((resolve6, reject) => {
27898
+ return new Promise((resolve8, reject) => {
27533
27899
  const signalListenerCleanup = signal ? util.addAbortListener(signal, () => {
27534
27900
  this.destroy();
27535
27901
  }) : noop;
@@ -27538,7 +27904,7 @@ var require_readable = __commonJS({
27538
27904
  if (signal && signal.aborted) {
27539
27905
  reject(signal.reason || Object.assign(new Error("The operation was aborted"), { name: "AbortError" }));
27540
27906
  } else {
27541
- resolve6(null);
27907
+ resolve8(null);
27542
27908
  }
27543
27909
  }).on("error", noop).on("data", function(chunk) {
27544
27910
  limit -= chunk.length;
@@ -27560,11 +27926,11 @@ var require_readable = __commonJS({
27560
27926
  throw new TypeError("unusable");
27561
27927
  }
27562
27928
  assert(!stream[kConsume]);
27563
- return new Promise((resolve6, reject) => {
27929
+ return new Promise((resolve8, reject) => {
27564
27930
  stream[kConsume] = {
27565
27931
  type,
27566
27932
  stream,
27567
- resolve: resolve6,
27933
+ resolve: resolve8,
27568
27934
  reject,
27569
27935
  length: 0,
27570
27936
  body: []
@@ -27599,12 +27965,12 @@ var require_readable = __commonJS({
27599
27965
  }
27600
27966
  }
27601
27967
  function consumeEnd(consume2) {
27602
- const { type, body, resolve: resolve6, stream, length } = consume2;
27968
+ const { type, body, resolve: resolve8, stream, length } = consume2;
27603
27969
  try {
27604
27970
  if (type === "text") {
27605
- resolve6(toUSVString(Buffer.concat(body)));
27971
+ resolve8(toUSVString(Buffer.concat(body)));
27606
27972
  } else if (type === "json") {
27607
- resolve6(JSON.parse(Buffer.concat(body)));
27973
+ resolve8(JSON.parse(Buffer.concat(body)));
27608
27974
  } else if (type === "arrayBuffer") {
27609
27975
  const dst = new Uint8Array(length);
27610
27976
  let pos = 0;
@@ -27612,12 +27978,12 @@ var require_readable = __commonJS({
27612
27978
  dst.set(buf, pos);
27613
27979
  pos += buf.byteLength;
27614
27980
  }
27615
- resolve6(dst.buffer);
27981
+ resolve8(dst.buffer);
27616
27982
  } else if (type === "blob") {
27617
27983
  if (!Blob2) {
27618
27984
  Blob2 = __require("buffer").Blob;
27619
27985
  }
27620
- resolve6(new Blob2(body, { type: stream[kContentType] }));
27986
+ resolve8(new Blob2(body, { type: stream[kContentType] }));
27621
27987
  }
27622
27988
  consumeFinish(consume2);
27623
27989
  } catch (err) {
@@ -27874,9 +28240,9 @@ var require_api_request = __commonJS({
27874
28240
  };
27875
28241
  function request(opts, callback) {
27876
28242
  if (callback === void 0) {
27877
- return new Promise((resolve6, reject) => {
28243
+ return new Promise((resolve8, reject) => {
27878
28244
  request.call(this, opts, (err, data) => {
27879
- return err ? reject(err) : resolve6(data);
28245
+ return err ? reject(err) : resolve8(data);
27880
28246
  });
27881
28247
  });
27882
28248
  }
@@ -28049,9 +28415,9 @@ var require_api_stream = __commonJS({
28049
28415
  };
28050
28416
  function stream(opts, factory, callback) {
28051
28417
  if (callback === void 0) {
28052
- return new Promise((resolve6, reject) => {
28418
+ return new Promise((resolve8, reject) => {
28053
28419
  stream.call(this, opts, factory, (err, data) => {
28054
- return err ? reject(err) : resolve6(data);
28420
+ return err ? reject(err) : resolve8(data);
28055
28421
  });
28056
28422
  });
28057
28423
  }
@@ -28332,9 +28698,9 @@ var require_api_upgrade = __commonJS({
28332
28698
  };
28333
28699
  function upgrade(opts, callback) {
28334
28700
  if (callback === void 0) {
28335
- return new Promise((resolve6, reject) => {
28701
+ return new Promise((resolve8, reject) => {
28336
28702
  upgrade.call(this, opts, (err, data) => {
28337
- return err ? reject(err) : resolve6(data);
28703
+ return err ? reject(err) : resolve8(data);
28338
28704
  });
28339
28705
  });
28340
28706
  }
@@ -28423,9 +28789,9 @@ var require_api_connect = __commonJS({
28423
28789
  };
28424
28790
  function connect(opts, callback) {
28425
28791
  if (callback === void 0) {
28426
- return new Promise((resolve6, reject) => {
28792
+ return new Promise((resolve8, reject) => {
28427
28793
  connect.call(this, opts, (err, data) => {
28428
- return err ? reject(err) : resolve6(data);
28794
+ return err ? reject(err) : resolve8(data);
28429
28795
  });
28430
28796
  });
28431
28797
  }
@@ -28949,7 +29315,7 @@ var require_mock_interceptor = __commonJS({
28949
29315
  var require_mock_client = __commonJS({
28950
29316
  "node_modules/undici/lib/mock/mock-client.js"(exports, module) {
28951
29317
  "use strict";
28952
- var { promisify: promisify4 } = __require("util");
29318
+ var { promisify: promisify6 } = __require("util");
28953
29319
  var Client2 = require_client();
28954
29320
  var { buildMockDispatch } = require_mock_utils();
28955
29321
  var {
@@ -28989,7 +29355,7 @@ var require_mock_client = __commonJS({
28989
29355
  return new MockInterceptor(opts, this[kDispatches]);
28990
29356
  }
28991
29357
  async [kClose]() {
28992
- await promisify4(this[kOriginalClose])();
29358
+ await promisify6(this[kOriginalClose])();
28993
29359
  this[kConnected] = 0;
28994
29360
  this[kMockAgent][Symbols.kClients].delete(this[kOrigin]);
28995
29361
  }
@@ -29002,7 +29368,7 @@ var require_mock_client = __commonJS({
29002
29368
  var require_mock_pool = __commonJS({
29003
29369
  "node_modules/undici/lib/mock/mock-pool.js"(exports, module) {
29004
29370
  "use strict";
29005
- var { promisify: promisify4 } = __require("util");
29371
+ var { promisify: promisify6 } = __require("util");
29006
29372
  var Pool = require_pool();
29007
29373
  var { buildMockDispatch } = require_mock_utils();
29008
29374
  var {
@@ -29042,7 +29408,7 @@ var require_mock_pool = __commonJS({
29042
29408
  return new MockInterceptor(opts, this[kDispatches]);
29043
29409
  }
29044
29410
  async [kClose]() {
29045
- await promisify4(this[kOriginalClose])();
29411
+ await promisify6(this[kOriginalClose])();
29046
29412
  this[kConnected] = 0;
29047
29413
  this[kMockAgent][Symbols.kClients].delete(this[kOrigin]);
29048
29414
  }
@@ -32048,7 +32414,7 @@ var require_fetch = __commonJS({
32048
32414
  async function dispatch({ body }) {
32049
32415
  const url = requestCurrentURL(request);
32050
32416
  const agent = fetchParams.controller.dispatcher;
32051
- return new Promise((resolve6, reject) => agent.dispatch(
32417
+ return new Promise((resolve8, reject) => agent.dispatch(
32052
32418
  {
32053
32419
  path: url.pathname + url.search,
32054
32420
  origin: url.origin,
@@ -32124,7 +32490,7 @@ var require_fetch = __commonJS({
32124
32490
  }
32125
32491
  }
32126
32492
  }
32127
- resolve6({
32493
+ resolve8({
32128
32494
  status,
32129
32495
  statusText,
32130
32496
  headersList: headers[kHeadersList],
@@ -32167,7 +32533,7 @@ var require_fetch = __commonJS({
32167
32533
  const val = headersList[n + 1].toString("latin1");
32168
32534
  headers[kHeadersList].append(key, val);
32169
32535
  }
32170
- resolve6({
32536
+ resolve8({
32171
32537
  status,
32172
32538
  statusText: STATUS_CODES[status],
32173
32539
  headersList: headers[kHeadersList],
@@ -35708,7 +36074,8 @@ var init_mcp_check_provider = __esm({
35708
36074
  fileCount: prInfo.files.length,
35709
36075
  outputs: this.buildOutputContext(dependencyResults),
35710
36076
  args: sessionInfo?.args || {},
35711
- env: this.getSafeEnvironmentVariables()
36077
+ env: this.getSafeEnvironmentVariables(),
36078
+ inputs: config.workflowInputs || sessionInfo?.workflowInputs || {}
35712
36079
  };
35713
36080
  let methodArgs = cfg.methodArgs || {};
35714
36081
  if (cfg.argsTransform) {
@@ -35961,7 +36328,7 @@ var init_mcp_check_provider = __esm({
35961
36328
  logger.warn(
35962
36329
  `MCP ${transportName} failed (attempt ${attempt + 1}/${maxRetries + 1}), retrying in ${delay}ms: ${error instanceof Error ? error.message : String(error)}`
35963
36330
  );
35964
- await new Promise((resolve6) => setTimeout(resolve6, delay));
36331
+ await new Promise((resolve8) => setTimeout(resolve8, delay));
35965
36332
  attempt += 1;
35966
36333
  } finally {
35967
36334
  try {
@@ -36244,7 +36611,7 @@ async function acquirePromptLock() {
36244
36611
  activePrompt = true;
36245
36612
  return;
36246
36613
  }
36247
- await new Promise((resolve6) => waiters.push(resolve6));
36614
+ await new Promise((resolve8) => waiters.push(resolve8));
36248
36615
  activePrompt = true;
36249
36616
  }
36250
36617
  function releasePromptLock() {
@@ -36254,7 +36621,7 @@ function releasePromptLock() {
36254
36621
  }
36255
36622
  async function interactivePrompt(options) {
36256
36623
  await acquirePromptLock();
36257
- return new Promise((resolve6, reject) => {
36624
+ return new Promise((resolve8, reject) => {
36258
36625
  const dbg = process.env.VISOR_DEBUG === "true";
36259
36626
  try {
36260
36627
  if (dbg) {
@@ -36341,12 +36708,12 @@ async function interactivePrompt(options) {
36341
36708
  };
36342
36709
  const finish = (value) => {
36343
36710
  cleanup();
36344
- resolve6(value);
36711
+ resolve8(value);
36345
36712
  };
36346
36713
  if (options.timeout && options.timeout > 0) {
36347
36714
  timeoutId = setTimeout(() => {
36348
36715
  cleanup();
36349
- if (defaultValue !== void 0) return resolve6(defaultValue);
36716
+ if (defaultValue !== void 0) return resolve8(defaultValue);
36350
36717
  return reject(new Error("Input timeout"));
36351
36718
  }, options.timeout);
36352
36719
  }
@@ -36478,7 +36845,7 @@ async function interactivePrompt(options) {
36478
36845
  });
36479
36846
  }
36480
36847
  async function simplePrompt(prompt) {
36481
- return new Promise((resolve6) => {
36848
+ return new Promise((resolve8) => {
36482
36849
  const rl = readline.createInterface({
36483
36850
  input: process.stdin,
36484
36851
  output: process.stdout
@@ -36494,7 +36861,7 @@ async function simplePrompt(prompt) {
36494
36861
  rl.question(`${prompt}
36495
36862
  > `, (answer) => {
36496
36863
  rl.close();
36497
- resolve6(answer.trim());
36864
+ resolve8(answer.trim());
36498
36865
  });
36499
36866
  });
36500
36867
  }
@@ -36512,7 +36879,7 @@ function isStdinAvailable() {
36512
36879
  return !process.stdin.isTTY;
36513
36880
  }
36514
36881
  async function readStdin(timeout, maxSize = 1024 * 1024) {
36515
- return new Promise((resolve6, reject) => {
36882
+ return new Promise((resolve8, reject) => {
36516
36883
  let data = "";
36517
36884
  let timeoutId;
36518
36885
  if (timeout) {
@@ -36539,7 +36906,7 @@ async function readStdin(timeout, maxSize = 1024 * 1024) {
36539
36906
  };
36540
36907
  const onEnd = () => {
36541
36908
  cleanup();
36542
- resolve6(data.trim());
36909
+ resolve8(data.trim());
36543
36910
  };
36544
36911
  const onError = (err) => {
36545
36912
  cleanup();
@@ -37327,7 +37694,7 @@ function buildBuiltinGlobals(opts) {
37327
37694
  const scheduleFn = async (args = {}) => {
37328
37695
  try {
37329
37696
  const { handleScheduleAction: handleScheduleAction2, buildScheduleToolContext: buildScheduleToolContext2 } = await import("./schedule-tool-2COUUTF7.mjs");
37330
- const { extractSlackContext: extractSlackContext2 } = await import("./schedule-tool-handler-EYDCUGOB.mjs");
37697
+ const { extractSlackContext: extractSlackContext2 } = await import("./schedule-tool-handler-R7PNPWWK.mjs");
37331
37698
  const parentCtx = opts.sessionInfo?._parentContext;
37332
37699
  const webhookData = parentCtx?.prInfo?.eventContext?.webhookData;
37333
37700
  const visorCfg = parentCtx?.config;
@@ -40281,4 +40648,4 @@ undici/lib/fetch/body.js:
40281
40648
  undici/lib/websocket/frame.js:
40282
40649
  (*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
40283
40650
  */
40284
- //# sourceMappingURL=chunk-D3UC5KUJ.mjs.map
40651
+ //# sourceMappingURL=chunk-5FXGIBJQ.mjs.map