@probelabs/visor 0.1.145 → 0.1.146-ee

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/index.js +1722 -25
  2. package/dist/sdk/{check-provider-registry-HK6M4PDQ.mjs → check-provider-registry-TH25S2OB.mjs} +3 -3
  3. package/dist/sdk/{check-provider-registry-TG5G2TF3.mjs → check-provider-registry-WSFL2SVQ.mjs} +5 -5
  4. package/dist/sdk/{chunk-E6SMU2Z4.mjs → chunk-3BOOHJI5.mjs} +12 -12
  5. package/dist/sdk/{chunk-5FXGIBJQ.mjs.map → chunk-3BOOHJI5.mjs.map} +1 -1
  6. package/dist/sdk/{chunk-GZMQPC6D.mjs → chunk-74YJMONB.mjs} +14 -14
  7. package/dist/sdk/{host-BYIV4QJ3.mjs → host-GA76UESS.mjs} +2 -2
  8. package/dist/sdk/knex-store-HPXJILBL.mjs +411 -0
  9. package/dist/sdk/knex-store-HPXJILBL.mjs.map +1 -0
  10. package/dist/sdk/loader-ZC5G3JGJ.mjs +89 -0
  11. package/dist/sdk/loader-ZC5G3JGJ.mjs.map +1 -0
  12. package/dist/sdk/opa-policy-engine-S2S2ULEI.mjs +655 -0
  13. package/dist/sdk/opa-policy-engine-S2S2ULEI.mjs.map +1 -0
  14. package/dist/sdk/{schedule-tool-handler-4O2VKNG2.mjs → schedule-tool-handler-62K3NGH6.mjs} +2 -2
  15. package/dist/sdk/{schedule-tool-handler-BTLEDYAI.mjs → schedule-tool-handler-NYL2ONJB.mjs} +6 -6
  16. package/dist/sdk/sdk.js +1517 -259
  17. package/dist/sdk/sdk.js.map +1 -1
  18. package/dist/sdk/sdk.mjs +5 -5
  19. package/dist/sdk/validator-XTZJZZJH.mjs +134 -0
  20. package/dist/sdk/validator-XTZJZZJH.mjs.map +1 -0
  21. package/dist/sdk/{workflow-check-provider-OM62QYHF.mjs → workflow-check-provider-LVUUL2PZ.mjs} +3 -3
  22. package/dist/sdk/{workflow-check-provider-RARO4N5E.mjs → workflow-check-provider-XC7E5OFH.mjs} +5 -5
  23. package/package.json +1 -1
  24. package/dist/output/traces/run-2026-02-26T07-47-34-788Z.ndjson +0 -138
  25. package/dist/output/traces/run-2026-02-26T07-48-25-935Z.ndjson +0 -1442
  26. package/dist/sdk/check-provider-registry-HFPKHYTG.mjs +0 -30
  27. package/dist/sdk/chunk-5FXGIBJQ.mjs +0 -40651
  28. package/dist/sdk/chunk-6XPTQBXL.mjs +0 -443
  29. package/dist/sdk/chunk-6XPTQBXL.mjs.map +0 -1
  30. package/dist/sdk/chunk-E6SMU2Z4.mjs.map +0 -1
  31. package/dist/sdk/chunk-K3M5YVEU.mjs +0 -1502
  32. package/dist/sdk/chunk-K3M5YVEU.mjs.map +0 -1
  33. package/dist/sdk/chunk-L6ABOJVL.mjs +0 -739
  34. package/dist/sdk/chunk-L6ABOJVL.mjs.map +0 -1
  35. package/dist/sdk/chunk-O7WE6HCA.mjs +0 -443
  36. package/dist/sdk/chunk-O7WE6HCA.mjs.map +0 -1
  37. package/dist/sdk/chunk-PES5G5RR.mjs +0 -1502
  38. package/dist/sdk/chunk-PES5G5RR.mjs.map +0 -1
  39. package/dist/sdk/chunk-XHIXKNUF.mjs +0 -739
  40. package/dist/sdk/chunk-XHIXKNUF.mjs.map +0 -1
  41. package/dist/sdk/failure-condition-evaluator-2BJHKTMX.mjs +0 -17
  42. package/dist/sdk/failure-condition-evaluator-V3EJGD55.mjs +0 -17
  43. package/dist/sdk/github-frontend-ICKRZ4VV.mjs +0 -1356
  44. package/dist/sdk/github-frontend-ICKRZ4VV.mjs.map +0 -1
  45. package/dist/sdk/github-frontend-PSGUGYHT.mjs +0 -1356
  46. package/dist/sdk/github-frontend-PSGUGYHT.mjs.map +0 -1
  47. package/dist/sdk/host-CVJ3VG5Y.mjs +0 -63
  48. package/dist/sdk/host-CVJ3VG5Y.mjs.map +0 -1
  49. package/dist/sdk/routing-3XDRYU3Z.mjs +0 -25
  50. package/dist/sdk/routing-AJNUTCH7.mjs +0 -25
  51. package/dist/sdk/routing-AJNUTCH7.mjs.map +0 -1
  52. package/dist/sdk/schedule-tool-handler-4O2VKNG2.mjs.map +0 -1
  53. package/dist/sdk/schedule-tool-handler-BTLEDYAI.mjs.map +0 -1
  54. package/dist/sdk/schedule-tool-handler-R7PNPWWK.mjs +0 -40
  55. package/dist/sdk/schedule-tool-handler-R7PNPWWK.mjs.map +0 -1
  56. package/dist/sdk/trace-helpers-OZTZBK6T.mjs +0 -25
  57. package/dist/sdk/trace-helpers-OZTZBK6T.mjs.map +0 -1
  58. package/dist/sdk/trace-helpers-VUUP6ILH.mjs +0 -25
  59. package/dist/sdk/trace-helpers-VUUP6ILH.mjs.map +0 -1
  60. package/dist/sdk/workflow-check-provider-3IIKJFM4.mjs +0 -30
  61. package/dist/sdk/workflow-check-provider-3IIKJFM4.mjs.map +0 -1
  62. package/dist/sdk/workflow-check-provider-OM62QYHF.mjs.map +0 -1
  63. package/dist/sdk/workflow-check-provider-RARO4N5E.mjs.map +0 -1
  64. package/dist/traces/run-2026-02-26T07-47-34-788Z.ndjson +0 -138
  65. package/dist/traces/run-2026-02-26T07-48-25-935Z.ndjson +0 -1442
  66. /package/dist/sdk/{check-provider-registry-HFPKHYTG.mjs.map → check-provider-registry-TH25S2OB.mjs.map} +0 -0
  67. /package/dist/sdk/{check-provider-registry-HK6M4PDQ.mjs.map → check-provider-registry-WSFL2SVQ.mjs.map} +0 -0
  68. /package/dist/sdk/{chunk-GZMQPC6D.mjs.map → chunk-74YJMONB.mjs.map} +0 -0
  69. /package/dist/sdk/{host-BYIV4QJ3.mjs.map → host-GA76UESS.mjs.map} +0 -0
  70. /package/dist/sdk/{check-provider-registry-TG5G2TF3.mjs.map → schedule-tool-handler-62K3NGH6.mjs.map} +0 -0
  71. /package/dist/sdk/{failure-condition-evaluator-2BJHKTMX.mjs.map → schedule-tool-handler-NYL2ONJB.mjs.map} +0 -0
  72. /package/dist/sdk/{failure-condition-evaluator-V3EJGD55.mjs.map → workflow-check-provider-LVUUL2PZ.mjs.map} +0 -0
  73. /package/dist/sdk/{routing-3XDRYU3Z.mjs.map → workflow-check-provider-XC7E5OFH.mjs.map} +0 -0
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- process.env.VISOR_VERSION = '0.1.145';
2
+ process.env.VISOR_VERSION = '0.1.146';
3
3
  process.env.PROBE_VERSION = '0.6.0-rc260';
4
- process.env.VISOR_COMMIT_SHA = '7f399fc32c663ce91b7adbb19c6f29bcd7f41931';
5
- process.env.VISOR_COMMIT_SHORT = '7f399fc';
4
+ process.env.VISOR_COMMIT_SHA = 'd2ab098a3650d6798ede2306a8ed4b5fdb6214fb';
5
+ process.env.VISOR_COMMIT_SHORT = 'd2ab098';
6
6
  /******/ (() => { // webpackBootstrap
7
7
  /******/ var __webpack_modules__ = ({
8
8
 
@@ -161190,7 +161190,7 @@ async function handleDumpPolicyInput(checkId, argv) {
161190
161190
  let PolicyInputBuilder;
161191
161191
  try {
161192
161192
  // @ts-ignore — enterprise/ may not exist in OSS builds (caught at runtime)
161193
- const mod = await Promise.resolve().then(() => __importStar(__nccwpck_require__(71370)));
161193
+ const mod = await Promise.resolve().then(() => __importStar(__nccwpck_require__(17117)));
161194
161194
  PolicyInputBuilder = mod.PolicyInputBuilder;
161195
161195
  }
161196
161196
  catch {
@@ -167012,6 +167012,1690 @@ class DependencyResolver {
167012
167012
  exports.DependencyResolver = DependencyResolver;
167013
167013
 
167014
167014
 
167015
+ /***/ }),
167016
+
167017
+ /***/ 50069:
167018
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
167019
+
167020
+ "use strict";
167021
+
167022
+ /**
167023
+ * Copyright (c) ProbeLabs. All rights reserved.
167024
+ * Licensed under the Elastic License 2.0; you may not use this file except
167025
+ * in compliance with the Elastic License 2.0.
167026
+ */
167027
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
167028
+ if (k2 === undefined) k2 = k;
167029
+ var desc = Object.getOwnPropertyDescriptor(m, k);
167030
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
167031
+ desc = { enumerable: true, get: function() { return m[k]; } };
167032
+ }
167033
+ Object.defineProperty(o, k2, desc);
167034
+ }) : (function(o, m, k, k2) {
167035
+ if (k2 === undefined) k2 = k;
167036
+ o[k2] = m[k];
167037
+ }));
167038
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
167039
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
167040
+ }) : function(o, v) {
167041
+ o["default"] = v;
167042
+ });
167043
+ var __importStar = (this && this.__importStar) || (function () {
167044
+ var ownKeys = function(o) {
167045
+ ownKeys = Object.getOwnPropertyNames || function (o) {
167046
+ var ar = [];
167047
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
167048
+ return ar;
167049
+ };
167050
+ return ownKeys(o);
167051
+ };
167052
+ return function (mod) {
167053
+ if (mod && mod.__esModule) return mod;
167054
+ var result = {};
167055
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
167056
+ __setModuleDefault(result, mod);
167057
+ return result;
167058
+ };
167059
+ })();
167060
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
167061
+ exports.LicenseValidator = void 0;
167062
+ const crypto = __importStar(__nccwpck_require__(76982));
167063
+ const fs = __importStar(__nccwpck_require__(79896));
167064
+ const path = __importStar(__nccwpck_require__(16928));
167065
+ class LicenseValidator {
167066
+ /** Ed25519 public key for license verification (PEM format). */
167067
+ static PUBLIC_KEY = '-----BEGIN PUBLIC KEY-----\n' +
167068
+ 'MCowBQYDK2VwAyEAI/Zd08EFmgIdrDm/HXd0l3/5GBt7R1PrdvhdmEXhJlU=\n' +
167069
+ '-----END PUBLIC KEY-----\n';
167070
+ cache = null;
167071
+ static CACHE_TTL = 5 * 60 * 1000; // 5 minutes
167072
+ static GRACE_PERIOD = 72 * 3600 * 1000; // 72 hours after expiry
167073
+ /**
167074
+ * Load and validate license from environment or file.
167075
+ *
167076
+ * Resolution order:
167077
+ * 1. VISOR_LICENSE env var (JWT string)
167078
+ * 2. VISOR_LICENSE_FILE env var (path to file)
167079
+ * 3. .visor-license in project root (cwd)
167080
+ * 4. .visor-license in ~/.config/visor/
167081
+ */
167082
+ async loadAndValidate() {
167083
+ // Return cached result if still fresh
167084
+ if (this.cache && Date.now() - this.cache.validatedAt < LicenseValidator.CACHE_TTL) {
167085
+ return this.cache.payload;
167086
+ }
167087
+ const token = this.resolveToken();
167088
+ if (!token)
167089
+ return null;
167090
+ const payload = this.verifyAndDecode(token);
167091
+ if (!payload)
167092
+ return null;
167093
+ this.cache = { payload, validatedAt: Date.now() };
167094
+ return payload;
167095
+ }
167096
+ /** Check if a specific feature is licensed */
167097
+ hasFeature(feature) {
167098
+ if (!this.cache)
167099
+ return false;
167100
+ return this.cache.payload.features.includes(feature);
167101
+ }
167102
+ /** Check if license is valid (with grace period) */
167103
+ isValid() {
167104
+ if (!this.cache)
167105
+ return false;
167106
+ const now = Date.now();
167107
+ const expiryMs = this.cache.payload.exp * 1000;
167108
+ return now < expiryMs + LicenseValidator.GRACE_PERIOD;
167109
+ }
167110
+ /** Check if the license is within its grace period (expired but still valid) */
167111
+ isInGracePeriod() {
167112
+ if (!this.cache)
167113
+ return false;
167114
+ const now = Date.now();
167115
+ const expiryMs = this.cache.payload.exp * 1000;
167116
+ return now >= expiryMs && now < expiryMs + LicenseValidator.GRACE_PERIOD;
167117
+ }
167118
+ resolveToken() {
167119
+ // 1. Direct env var
167120
+ if (process.env.VISOR_LICENSE) {
167121
+ return process.env.VISOR_LICENSE.trim();
167122
+ }
167123
+ // 2. File path from env (validate against path traversal)
167124
+ if (process.env.VISOR_LICENSE_FILE) {
167125
+ // path.resolve() produces an absolute path with all '..' segments resolved,
167126
+ // so a separate resolved.includes('..') check is unnecessary.
167127
+ const resolved = path.resolve(process.env.VISOR_LICENSE_FILE);
167128
+ const home = process.env.HOME || process.env.USERPROFILE || '';
167129
+ const allowedPrefixes = [path.normalize(process.cwd())];
167130
+ if (home)
167131
+ allowedPrefixes.push(path.normalize(path.join(home, '.config', 'visor')));
167132
+ // Resolve symlinks so an attacker cannot create a symlink inside an
167133
+ // allowed prefix that points to an arbitrary file outside it.
167134
+ let realPath;
167135
+ try {
167136
+ realPath = fs.realpathSync(resolved);
167137
+ }
167138
+ catch {
167139
+ return null; // File doesn't exist or isn't accessible
167140
+ }
167141
+ const isSafe = allowedPrefixes.some(prefix => realPath === prefix || realPath.startsWith(prefix + path.sep));
167142
+ if (!isSafe)
167143
+ return null;
167144
+ return this.readFile(realPath);
167145
+ }
167146
+ // 3. .visor-license in cwd
167147
+ const cwdPath = path.join(process.cwd(), '.visor-license');
167148
+ const cwdToken = this.readFile(cwdPath);
167149
+ if (cwdToken)
167150
+ return cwdToken;
167151
+ // 4. ~/.config/visor/.visor-license
167152
+ const home = process.env.HOME || process.env.USERPROFILE || '';
167153
+ if (home) {
167154
+ const configPath = path.join(home, '.config', 'visor', '.visor-license');
167155
+ const configToken = this.readFile(configPath);
167156
+ if (configToken)
167157
+ return configToken;
167158
+ }
167159
+ return null;
167160
+ }
167161
+ readFile(filePath) {
167162
+ try {
167163
+ return fs.readFileSync(filePath, 'utf-8').trim();
167164
+ }
167165
+ catch {
167166
+ return null;
167167
+ }
167168
+ }
167169
+ verifyAndDecode(token) {
167170
+ try {
167171
+ const parts = token.split('.');
167172
+ if (parts.length !== 3)
167173
+ return null;
167174
+ const [headerB64, payloadB64, signatureB64] = parts;
167175
+ // Decode header to verify algorithm
167176
+ const header = JSON.parse(Buffer.from(headerB64, 'base64url').toString());
167177
+ if (header.alg !== 'EdDSA')
167178
+ return null;
167179
+ // Verify signature
167180
+ const data = `${headerB64}.${payloadB64}`;
167181
+ const signature = Buffer.from(signatureB64, 'base64url');
167182
+ const publicKey = crypto.createPublicKey(LicenseValidator.PUBLIC_KEY);
167183
+ // Validate that the loaded public key is actually Ed25519 (OID 1.3.101.112).
167184
+ // This prevents algorithm-confusion attacks if the embedded key were ever
167185
+ // swapped to a different type.
167186
+ if (publicKey.asymmetricKeyType !== 'ed25519') {
167187
+ return null;
167188
+ }
167189
+ // Ed25519 verification: algorithm must be null because EdDSA performs its
167190
+ // own internal hashing (SHA-512) — passing a digest algorithm here would
167191
+ // cause Node.js to throw. The key type is validated above.
167192
+ const isValid = crypto.verify(null, Buffer.from(data), publicKey, signature);
167193
+ if (!isValid)
167194
+ return null;
167195
+ // Decode payload
167196
+ const payload = JSON.parse(Buffer.from(payloadB64, 'base64url').toString());
167197
+ // Validate required fields
167198
+ if (!payload.org ||
167199
+ !Array.isArray(payload.features) ||
167200
+ typeof payload.exp !== 'number' ||
167201
+ typeof payload.iat !== 'number' ||
167202
+ !payload.sub) {
167203
+ return null;
167204
+ }
167205
+ // Check expiry (with grace period)
167206
+ const now = Date.now();
167207
+ const expiryMs = payload.exp * 1000;
167208
+ if (now >= expiryMs + LicenseValidator.GRACE_PERIOD) {
167209
+ return null;
167210
+ }
167211
+ return payload;
167212
+ }
167213
+ catch {
167214
+ return null;
167215
+ }
167216
+ }
167217
+ }
167218
+ exports.LicenseValidator = LicenseValidator;
167219
+
167220
+
167221
+ /***/ }),
167222
+
167223
+ /***/ 87068:
167224
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
167225
+
167226
+ "use strict";
167227
+
167228
+ /**
167229
+ * Copyright (c) ProbeLabs. All rights reserved.
167230
+ * Licensed under the Elastic License 2.0; you may not use this file except
167231
+ * in compliance with the Elastic License 2.0.
167232
+ */
167233
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
167234
+ if (k2 === undefined) k2 = k;
167235
+ var desc = Object.getOwnPropertyDescriptor(m, k);
167236
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
167237
+ desc = { enumerable: true, get: function() { return m[k]; } };
167238
+ }
167239
+ Object.defineProperty(o, k2, desc);
167240
+ }) : (function(o, m, k, k2) {
167241
+ if (k2 === undefined) k2 = k;
167242
+ o[k2] = m[k];
167243
+ }));
167244
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
167245
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
167246
+ }) : function(o, v) {
167247
+ o["default"] = v;
167248
+ });
167249
+ var __importStar = (this && this.__importStar) || (function () {
167250
+ var ownKeys = function(o) {
167251
+ ownKeys = Object.getOwnPropertyNames || function (o) {
167252
+ var ar = [];
167253
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
167254
+ return ar;
167255
+ };
167256
+ return ownKeys(o);
167257
+ };
167258
+ return function (mod) {
167259
+ if (mod && mod.__esModule) return mod;
167260
+ var result = {};
167261
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
167262
+ __setModuleDefault(result, mod);
167263
+ return result;
167264
+ };
167265
+ })();
167266
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
167267
+ exports.loadEnterprisePolicyEngine = loadEnterprisePolicyEngine;
167268
+ exports.loadEnterpriseStoreBackend = loadEnterpriseStoreBackend;
167269
+ const default_engine_1 = __nccwpck_require__(93866);
167270
+ /**
167271
+ * Load the enterprise policy engine if licensed, otherwise return the default no-op engine.
167272
+ *
167273
+ * This is the sole import boundary between OSS and enterprise code. Core code
167274
+ * must only import from this module (via dynamic `await import()`), never from
167275
+ * individual enterprise submodules.
167276
+ */
167277
+ async function loadEnterprisePolicyEngine(config) {
167278
+ try {
167279
+ const { LicenseValidator } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(50069)));
167280
+ const validator = new LicenseValidator();
167281
+ const license = await validator.loadAndValidate();
167282
+ if (!license || !validator.hasFeature('policy')) {
167283
+ return new default_engine_1.DefaultPolicyEngine();
167284
+ }
167285
+ if (validator.isInGracePeriod()) {
167286
+ // eslint-disable-next-line no-console
167287
+ console.warn('[visor:enterprise] License has expired but is within the 72-hour grace period. ' +
167288
+ 'Please renew your license.');
167289
+ }
167290
+ const { OpaPolicyEngine } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(39530)));
167291
+ const engine = new OpaPolicyEngine(config);
167292
+ await engine.initialize(config);
167293
+ return engine;
167294
+ }
167295
+ catch (err) {
167296
+ // Enterprise code not available or initialization failed
167297
+ const msg = err instanceof Error ? err.message : String(err);
167298
+ try {
167299
+ const { logger } = __nccwpck_require__(86999);
167300
+ logger.warn(`[PolicyEngine] Enterprise policy init failed, falling back to default: ${msg}`);
167301
+ }
167302
+ catch {
167303
+ // silent
167304
+ }
167305
+ return new default_engine_1.DefaultPolicyEngine();
167306
+ }
167307
+ }
167308
+ /**
167309
+ * Load the enterprise schedule store backend if licensed.
167310
+ *
167311
+ * @param driver Database driver ('postgresql', 'mysql', or 'mssql')
167312
+ * @param storageConfig Storage configuration with connection details
167313
+ * @param haConfig Optional HA configuration
167314
+ * @throws Error if enterprise license is not available or missing 'scheduler-sql' feature
167315
+ */
167316
+ async function loadEnterpriseStoreBackend(driver, storageConfig, haConfig) {
167317
+ const { LicenseValidator } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(50069)));
167318
+ const validator = new LicenseValidator();
167319
+ const license = await validator.loadAndValidate();
167320
+ if (!license || !validator.hasFeature('scheduler-sql')) {
167321
+ throw new Error(`The ${driver} schedule storage driver requires a Visor Enterprise license ` +
167322
+ `with the 'scheduler-sql' feature. Please upgrade or use driver: 'sqlite' (default).`);
167323
+ }
167324
+ if (validator.isInGracePeriod()) {
167325
+ // eslint-disable-next-line no-console
167326
+ console.warn('[visor:enterprise] License has expired but is within the 72-hour grace period. ' +
167327
+ 'Please renew your license.');
167328
+ }
167329
+ const { KnexStoreBackend } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(63737)));
167330
+ return new KnexStoreBackend(driver, storageConfig, haConfig);
167331
+ }
167332
+
167333
+
167334
+ /***/ }),
167335
+
167336
+ /***/ 628:
167337
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
167338
+
167339
+ "use strict";
167340
+
167341
+ /**
167342
+ * Copyright (c) ProbeLabs. All rights reserved.
167343
+ * Licensed under the Elastic License 2.0; you may not use this file except
167344
+ * in compliance with the Elastic License 2.0.
167345
+ */
167346
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
167347
+ if (k2 === undefined) k2 = k;
167348
+ var desc = Object.getOwnPropertyDescriptor(m, k);
167349
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
167350
+ desc = { enumerable: true, get: function() { return m[k]; } };
167351
+ }
167352
+ Object.defineProperty(o, k2, desc);
167353
+ }) : (function(o, m, k, k2) {
167354
+ if (k2 === undefined) k2 = k;
167355
+ o[k2] = m[k];
167356
+ }));
167357
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
167358
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
167359
+ }) : function(o, v) {
167360
+ o["default"] = v;
167361
+ });
167362
+ var __importStar = (this && this.__importStar) || (function () {
167363
+ var ownKeys = function(o) {
167364
+ ownKeys = Object.getOwnPropertyNames || function (o) {
167365
+ var ar = [];
167366
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
167367
+ return ar;
167368
+ };
167369
+ return ownKeys(o);
167370
+ };
167371
+ return function (mod) {
167372
+ if (mod && mod.__esModule) return mod;
167373
+ var result = {};
167374
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
167375
+ __setModuleDefault(result, mod);
167376
+ return result;
167377
+ };
167378
+ })();
167379
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
167380
+ exports.OpaCompiler = void 0;
167381
+ const fs = __importStar(__nccwpck_require__(79896));
167382
+ const path = __importStar(__nccwpck_require__(16928));
167383
+ const os = __importStar(__nccwpck_require__(70857));
167384
+ const crypto = __importStar(__nccwpck_require__(76982));
167385
+ const child_process_1 = __nccwpck_require__(35317);
167386
+ /**
167387
+ * OPA Rego Compiler - compiles .rego policy files to WASM bundles using the `opa` CLI.
167388
+ *
167389
+ * Handles:
167390
+ * - Resolving input paths to WASM bytes (direct .wasm, directory with policy.wasm, or .rego files)
167391
+ * - Compiling .rego files to WASM via `opa build`
167392
+ * - Caching compiled bundles based on content hashes
167393
+ * - Extracting policy.wasm from OPA tar.gz bundles
167394
+ *
167395
+ * Requires:
167396
+ * - `opa` CLI on PATH (only when auto-compiling .rego files)
167397
+ */
167398
+ class OpaCompiler {
167399
+ static CACHE_DIR = path.join(os.tmpdir(), 'visor-opa-cache');
167400
+ /**
167401
+ * Resolve the input paths to WASM bytes.
167402
+ *
167403
+ * Strategy:
167404
+ * 1. If any path is a .wasm file, read it directly
167405
+ * 2. If a directory contains policy.wasm, read it
167406
+ * 3. Otherwise, collect all .rego files and auto-compile via `opa build`
167407
+ */
167408
+ async resolveWasmBytes(paths) {
167409
+ // Collect .rego files and check for existing .wasm
167410
+ const regoFiles = [];
167411
+ for (const p of paths) {
167412
+ const resolved = path.resolve(p);
167413
+ // Reject paths containing '..' after resolution (path traversal)
167414
+ if (path.normalize(resolved).includes('..')) {
167415
+ throw new Error(`Policy path contains traversal sequences: ${p}`);
167416
+ }
167417
+ // Direct .wasm file
167418
+ if (resolved.endsWith('.wasm') && fs.existsSync(resolved)) {
167419
+ return fs.readFileSync(resolved);
167420
+ }
167421
+ if (!fs.existsSync(resolved))
167422
+ continue;
167423
+ const stat = fs.statSync(resolved);
167424
+ if (stat.isDirectory()) {
167425
+ // Check for pre-compiled policy.wasm in directory
167426
+ const wasmCandidate = path.join(resolved, 'policy.wasm');
167427
+ if (fs.existsSync(wasmCandidate)) {
167428
+ return fs.readFileSync(wasmCandidate);
167429
+ }
167430
+ // Collect all .rego files from directory
167431
+ const files = fs.readdirSync(resolved);
167432
+ for (const f of files) {
167433
+ if (f.endsWith('.rego')) {
167434
+ regoFiles.push(path.join(resolved, f));
167435
+ }
167436
+ }
167437
+ }
167438
+ else if (resolved.endsWith('.rego')) {
167439
+ regoFiles.push(resolved);
167440
+ }
167441
+ }
167442
+ if (regoFiles.length === 0) {
167443
+ throw new Error(`OPA WASM evaluator: no .wasm bundle or .rego files found in: ${paths.join(', ')}`);
167444
+ }
167445
+ // Auto-compile .rego -> .wasm
167446
+ return this.compileRego(regoFiles);
167447
+ }
167448
+ /**
167449
+ * Auto-compile .rego files to a WASM bundle using the `opa` CLI.
167450
+ *
167451
+ * Caches the compiled bundle based on a content hash of all input .rego files
167452
+ * so subsequent runs skip compilation if policies haven't changed.
167453
+ */
167454
+ compileRego(regoFiles) {
167455
+ // Check that `opa` CLI is available
167456
+ try {
167457
+ (0, child_process_1.execFileSync)('opa', ['version'], { stdio: 'pipe' });
167458
+ }
167459
+ catch {
167460
+ throw new Error('OPA CLI (`opa`) not found on PATH. Install it from https://www.openpolicyagent.org/docs/latest/#running-opa\n' +
167461
+ 'Or pre-compile your .rego files: opa build -t wasm -e visor -o bundle.tar.gz ' +
167462
+ regoFiles.join(' '));
167463
+ }
167464
+ // Compute content hash for cache key
167465
+ const hash = crypto.createHash('sha256');
167466
+ for (const f of regoFiles.sort()) {
167467
+ hash.update(fs.readFileSync(f));
167468
+ hash.update(f); // include filename for disambiguation
167469
+ }
167470
+ const cacheKey = hash.digest('hex').slice(0, 16);
167471
+ const cacheDir = OpaCompiler.CACHE_DIR;
167472
+ const cachedWasm = path.join(cacheDir, `${cacheKey}.wasm`);
167473
+ // Return cached bundle if still valid
167474
+ if (fs.existsSync(cachedWasm)) {
167475
+ return fs.readFileSync(cachedWasm);
167476
+ }
167477
+ // Compile to WASM via opa build
167478
+ fs.mkdirSync(cacheDir, { recursive: true });
167479
+ const bundleTar = path.join(cacheDir, `${cacheKey}-bundle.tar.gz`);
167480
+ try {
167481
+ const args = [
167482
+ 'build',
167483
+ '-t',
167484
+ 'wasm',
167485
+ '-e',
167486
+ 'visor', // entrypoint: the visor package tree
167487
+ '-o',
167488
+ bundleTar,
167489
+ ...regoFiles,
167490
+ ];
167491
+ (0, child_process_1.execFileSync)('opa', args, {
167492
+ stdio: 'pipe',
167493
+ timeout: 30000,
167494
+ });
167495
+ }
167496
+ catch (err) {
167497
+ const stderr = err?.stderr?.toString() || '';
167498
+ throw new Error(`Failed to compile .rego files to WASM:\n${stderr}\n` +
167499
+ 'Ensure your .rego files are valid and the `opa` CLI is installed.');
167500
+ }
167501
+ // Extract policy.wasm from the tar.gz bundle
167502
+ // OPA bundles are tar.gz with /policy.wasm inside
167503
+ try {
167504
+ (0, child_process_1.execFileSync)('tar', ['-xzf', bundleTar, '-C', cacheDir, '/policy.wasm'], {
167505
+ stdio: 'pipe',
167506
+ });
167507
+ const extractedWasm = path.join(cacheDir, 'policy.wasm');
167508
+ if (fs.existsSync(extractedWasm)) {
167509
+ // Move to cache-key named file
167510
+ fs.renameSync(extractedWasm, cachedWasm);
167511
+ }
167512
+ }
167513
+ catch {
167514
+ // Some tar implementations don't like leading /
167515
+ try {
167516
+ (0, child_process_1.execFileSync)('tar', ['-xzf', bundleTar, '-C', cacheDir, 'policy.wasm'], {
167517
+ stdio: 'pipe',
167518
+ });
167519
+ const extractedWasm = path.join(cacheDir, 'policy.wasm');
167520
+ if (fs.existsSync(extractedWasm)) {
167521
+ fs.renameSync(extractedWasm, cachedWasm);
167522
+ }
167523
+ }
167524
+ catch (err2) {
167525
+ throw new Error(`Failed to extract policy.wasm from OPA bundle: ${err2?.message || err2}`);
167526
+ }
167527
+ }
167528
+ // Clean up tar
167529
+ try {
167530
+ fs.unlinkSync(bundleTar);
167531
+ }
167532
+ catch { }
167533
+ if (!fs.existsSync(cachedWasm)) {
167534
+ throw new Error('OPA build succeeded but policy.wasm was not found in the bundle');
167535
+ }
167536
+ return fs.readFileSync(cachedWasm);
167537
+ }
167538
+ }
167539
+ exports.OpaCompiler = OpaCompiler;
167540
+
167541
+
167542
+ /***/ }),
167543
+
167544
+ /***/ 44693:
167545
+ /***/ ((__unused_webpack_module, exports) => {
167546
+
167547
+ "use strict";
167548
+
167549
+ /**
167550
+ * Copyright (c) ProbeLabs. All rights reserved.
167551
+ * Licensed under the Elastic License 2.0; you may not use this file except
167552
+ * in compliance with the Elastic License 2.0.
167553
+ */
167554
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
167555
+ exports.OpaHttpEvaluator = void 0;
167556
+ /**
167557
+ * OPA HTTP Evaluator - evaluates policies via an external OPA server's REST API.
167558
+ *
167559
+ * Uses the built-in `fetch` API (Node 18+), so no extra dependencies are needed.
167560
+ */
167561
+ class OpaHttpEvaluator {
167562
+ baseUrl;
167563
+ timeout;
167564
+ constructor(baseUrl, timeout = 5000) {
167565
+ // Validate URL format and protocol
167566
+ let parsed;
167567
+ try {
167568
+ parsed = new URL(baseUrl);
167569
+ }
167570
+ catch {
167571
+ throw new Error(`OPA HTTP evaluator: invalid URL: ${baseUrl}`);
167572
+ }
167573
+ if (!['http:', 'https:'].includes(parsed.protocol)) {
167574
+ throw new Error(`OPA HTTP evaluator: url must use http:// or https:// protocol, got: ${baseUrl}`);
167575
+ }
167576
+ // Block cloud metadata, loopback, link-local, and private network addresses
167577
+ const hostname = parsed.hostname;
167578
+ if (this.isBlockedHostname(hostname)) {
167579
+ throw new Error(`OPA HTTP evaluator: url must not point to internal, loopback, or private network addresses`);
167580
+ }
167581
+ // Normalize: strip trailing slash
167582
+ this.baseUrl = baseUrl.replace(/\/+$/, '');
167583
+ this.timeout = timeout;
167584
+ }
167585
+ /**
167586
+ * Check if a hostname is blocked due to SSRF concerns.
167587
+ *
167588
+ * Blocks:
167589
+ * - Loopback addresses (127.x.x.x, localhost, 0.0.0.0, ::1)
167590
+ * - Link-local addresses (169.254.x.x)
167591
+ * - Private networks (10.x.x.x, 172.16-31.x.x, 192.168.x.x)
167592
+ * - IPv6 unique local addresses (fd00::/8)
167593
+ * - Cloud metadata services (*.internal)
167594
+ */
167595
+ isBlockedHostname(hostname) {
167596
+ if (!hostname)
167597
+ return true; // block empty hostnames
167598
+ // Normalize hostname: lowercase and remove brackets for IPv6
167599
+ const normalized = hostname.toLowerCase().replace(/^\[|\]$/g, '');
167600
+ // Block .internal domains (cloud metadata services)
167601
+ if (normalized === 'metadata.google.internal' || normalized.endsWith('.internal')) {
167602
+ return true;
167603
+ }
167604
+ // Block localhost variants
167605
+ if (normalized === 'localhost' || normalized === 'localhost.localdomain') {
167606
+ return true;
167607
+ }
167608
+ // Block IPv6 loopback
167609
+ if (normalized === '::1' || normalized === '0:0:0:0:0:0:0:1') {
167610
+ return true;
167611
+ }
167612
+ // Check IPv4 patterns
167613
+ const ipv4Pattern = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
167614
+ const ipv4Match = normalized.match(ipv4Pattern);
167615
+ if (ipv4Match) {
167616
+ const octets = ipv4Match.slice(1, 5).map(Number);
167617
+ // Validate octets are in range [0, 255]
167618
+ if (octets.some(octet => octet > 255)) {
167619
+ return false;
167620
+ }
167621
+ const [a, b] = octets;
167622
+ // Block loopback: 127.0.0.0/8
167623
+ if (a === 127) {
167624
+ return true;
167625
+ }
167626
+ // Block 0.0.0.0/8 (this host)
167627
+ if (a === 0) {
167628
+ return true;
167629
+ }
167630
+ // Block link-local: 169.254.0.0/16
167631
+ if (a === 169 && b === 254) {
167632
+ return true;
167633
+ }
167634
+ // Block private networks
167635
+ // 10.0.0.0/8
167636
+ if (a === 10) {
167637
+ return true;
167638
+ }
167639
+ // 172.16.0.0/12 (172.16.x.x through 172.31.x.x)
167640
+ if (a === 172 && b >= 16 && b <= 31) {
167641
+ return true;
167642
+ }
167643
+ // 192.168.0.0/16
167644
+ if (a === 192 && b === 168) {
167645
+ return true;
167646
+ }
167647
+ }
167648
+ // Check IPv6 patterns
167649
+ // Block unique local addresses: fd00::/8
167650
+ if (normalized.startsWith('fd') || normalized.startsWith('fc')) {
167651
+ return true;
167652
+ }
167653
+ // Block link-local: fe80::/10
167654
+ if (normalized.startsWith('fe80:')) {
167655
+ return true;
167656
+ }
167657
+ return false;
167658
+ }
167659
+ /**
167660
+ * Evaluate a policy rule against an input document via OPA REST API.
167661
+ *
167662
+ * @param input - The input document to evaluate
167663
+ * @param rulePath - OPA rule path (e.g., 'visor/check/execute')
167664
+ * @returns The result object from OPA, or undefined on error
167665
+ */
167666
+ async evaluate(input, rulePath) {
167667
+ // OPA Data API: POST /v1/data/<path>
167668
+ const encodedPath = rulePath
167669
+ .split('/')
167670
+ .map(s => encodeURIComponent(s))
167671
+ .join('/');
167672
+ const url = `${this.baseUrl}/v1/data/${encodedPath}`;
167673
+ const controller = new AbortController();
167674
+ const timer = setTimeout(() => controller.abort(), this.timeout);
167675
+ try {
167676
+ const response = await fetch(url, {
167677
+ method: 'POST',
167678
+ headers: { 'Content-Type': 'application/json' },
167679
+ body: JSON.stringify({ input }),
167680
+ signal: controller.signal,
167681
+ });
167682
+ if (!response.ok) {
167683
+ throw new Error(`OPA HTTP ${response.status}: ${response.statusText}`);
167684
+ }
167685
+ let body;
167686
+ try {
167687
+ body = await response.json();
167688
+ }
167689
+ catch (jsonErr) {
167690
+ throw new Error(`OPA HTTP evaluator: failed to parse JSON response: ${jsonErr instanceof Error ? jsonErr.message : String(jsonErr)}`);
167691
+ }
167692
+ // OPA returns { result: { ... } }
167693
+ return body?.result;
167694
+ }
167695
+ finally {
167696
+ clearTimeout(timer);
167697
+ }
167698
+ }
167699
+ async shutdown() {
167700
+ // No persistent connections to close
167701
+ }
167702
+ }
167703
+ exports.OpaHttpEvaluator = OpaHttpEvaluator;
167704
+
167705
+
167706
+ /***/ }),
167707
+
167708
+ /***/ 39530:
167709
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
167710
+
167711
+ "use strict";
167712
+
167713
+ /**
167714
+ * Copyright (c) ProbeLabs. All rights reserved.
167715
+ * Licensed under the Elastic License 2.0; you may not use this file except
167716
+ * in compliance with the Elastic License 2.0.
167717
+ */
167718
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
167719
+ exports.OpaPolicyEngine = void 0;
167720
+ const opa_wasm_evaluator_1 = __nccwpck_require__(8613);
167721
+ const opa_http_evaluator_1 = __nccwpck_require__(44693);
167722
+ const policy_input_builder_1 = __nccwpck_require__(17117);
167723
+ /**
167724
+ * Enterprise OPA Policy Engine.
167725
+ *
167726
+ * Wraps both WASM (local) and HTTP (remote) OPA evaluators behind the
167727
+ * OSS PolicyEngine interface. All OPA input building and role resolution
167728
+ * is handled internally — the OSS call sites pass only plain types.
167729
+ */
167730
+ class OpaPolicyEngine {
167731
+ evaluator = null;
167732
+ fallback;
167733
+ timeout;
167734
+ config;
167735
+ inputBuilder = null;
167736
+ logger = null;
167737
+ constructor(config) {
167738
+ this.config = config;
167739
+ this.fallback = config.fallback || 'deny';
167740
+ this.timeout = config.timeout || 5000;
167741
+ }
167742
+ async initialize(config) {
167743
+ // Resolve logger once at initialization
167744
+ try {
167745
+ this.logger = (__nccwpck_require__(86999).logger);
167746
+ }
167747
+ catch {
167748
+ // logger not available in this context
167749
+ }
167750
+ // Build actor/repo context from environment (available at engine init time)
167751
+ const actor = {
167752
+ authorAssociation: process.env.VISOR_AUTHOR_ASSOCIATION,
167753
+ login: process.env.VISOR_AUTHOR_LOGIN || process.env.GITHUB_ACTOR,
167754
+ isLocalMode: !process.env.GITHUB_ACTIONS,
167755
+ };
167756
+ const repo = {
167757
+ owner: process.env.GITHUB_REPOSITORY_OWNER,
167758
+ name: process.env.GITHUB_REPOSITORY?.split('/')[1],
167759
+ branch: process.env.GITHUB_HEAD_REF,
167760
+ baseBranch: process.env.GITHUB_BASE_REF,
167761
+ event: process.env.GITHUB_EVENT_NAME,
167762
+ };
167763
+ const prNum = process.env.GITHUB_PR_NUMBER
167764
+ ? parseInt(process.env.GITHUB_PR_NUMBER, 10)
167765
+ : undefined;
167766
+ const pullRequest = {
167767
+ number: prNum !== undefined && Number.isFinite(prNum) ? prNum : undefined,
167768
+ };
167769
+ this.inputBuilder = new policy_input_builder_1.PolicyInputBuilder(config, actor, repo, pullRequest);
167770
+ if (config.engine === 'local') {
167771
+ if (!config.rules) {
167772
+ throw new Error('OPA local mode requires `policy.rules` path to .wasm or .rego files');
167773
+ }
167774
+ const wasm = new opa_wasm_evaluator_1.OpaWasmEvaluator();
167775
+ await wasm.initialize(config.rules);
167776
+ if (config.data) {
167777
+ wasm.loadData(config.data);
167778
+ }
167779
+ this.evaluator = wasm;
167780
+ }
167781
+ else if (config.engine === 'remote') {
167782
+ if (!config.url) {
167783
+ throw new Error('OPA remote mode requires `policy.url` pointing to OPA server');
167784
+ }
167785
+ this.evaluator = new opa_http_evaluator_1.OpaHttpEvaluator(config.url, this.timeout);
167786
+ }
167787
+ else {
167788
+ this.evaluator = null;
167789
+ }
167790
+ }
167791
+ /**
167792
+ * Update actor/repo/PR context (e.g., after PR info becomes available).
167793
+ * Called by the enterprise loader when engine context is enriched.
167794
+ */
167795
+ setActorContext(actor, repo, pullRequest) {
167796
+ this.inputBuilder = new policy_input_builder_1.PolicyInputBuilder(this.config, actor, repo, pullRequest);
167797
+ }
167798
+ async evaluateCheckExecution(checkId, checkConfig) {
167799
+ if (!this.evaluator || !this.inputBuilder)
167800
+ return { allowed: true };
167801
+ const cfg = checkConfig && typeof checkConfig === 'object'
167802
+ ? checkConfig
167803
+ : {};
167804
+ const policyOverride = cfg.policy;
167805
+ const input = this.inputBuilder.forCheckExecution({
167806
+ id: checkId,
167807
+ type: cfg.type || 'ai',
167808
+ group: cfg.group,
167809
+ tags: cfg.tags,
167810
+ criticality: cfg.criticality,
167811
+ sandbox: cfg.sandbox,
167812
+ policy: policyOverride,
167813
+ });
167814
+ return this.doEvaluate(input, this.resolveRulePath('check.execute', policyOverride?.rule));
167815
+ }
167816
+ async evaluateToolInvocation(serverName, methodName, transport) {
167817
+ if (!this.evaluator || !this.inputBuilder)
167818
+ return { allowed: true };
167819
+ const input = this.inputBuilder.forToolInvocation(serverName, methodName, transport);
167820
+ return this.doEvaluate(input, 'visor/tool/invoke');
167821
+ }
167822
+ async evaluateCapabilities(checkId, capabilities) {
167823
+ if (!this.evaluator || !this.inputBuilder)
167824
+ return { allowed: true };
167825
+ const input = this.inputBuilder.forCapabilityResolve(checkId, capabilities);
167826
+ return this.doEvaluate(input, 'visor/capability/resolve');
167827
+ }
167828
+ async shutdown() {
167829
+ if (this.evaluator && 'shutdown' in this.evaluator) {
167830
+ await this.evaluator.shutdown();
167831
+ }
167832
+ this.evaluator = null;
167833
+ this.inputBuilder = null;
167834
+ }
167835
+ resolveRulePath(defaultScope, override) {
167836
+ if (override) {
167837
+ return override.startsWith('visor/') ? override : `visor/${override}`;
167838
+ }
167839
+ return `visor/${defaultScope.replace(/\./g, '/')}`;
167840
+ }
167841
+ async doEvaluate(input, rulePath) {
167842
+ try {
167843
+ this.logger?.debug(`[PolicyEngine] Evaluating ${rulePath}`, JSON.stringify(input));
167844
+ let timer;
167845
+ const timeoutPromise = new Promise((_resolve, reject) => {
167846
+ timer = setTimeout(() => reject(new Error('policy evaluation timeout')), this.timeout);
167847
+ });
167848
+ try {
167849
+ const result = await Promise.race([this.rawEvaluate(input, rulePath), timeoutPromise]);
167850
+ const decision = this.parseDecision(result);
167851
+ // In warn mode, override denied decisions to allowed but flag as warn
167852
+ if (!decision.allowed && this.fallback === 'warn') {
167853
+ decision.allowed = true;
167854
+ decision.warn = true;
167855
+ decision.reason = `audit: ${decision.reason || 'policy denied'}`;
167856
+ }
167857
+ this.logger?.debug(`[PolicyEngine] Decision for ${rulePath}: allowed=${decision.allowed}, warn=${decision.warn || false}, reason=${decision.reason || 'none'}`);
167858
+ return decision;
167859
+ }
167860
+ finally {
167861
+ if (timer)
167862
+ clearTimeout(timer);
167863
+ }
167864
+ }
167865
+ catch (err) {
167866
+ const msg = err instanceof Error ? err.message : String(err);
167867
+ this.logger?.warn(`[PolicyEngine] Evaluation failed for ${rulePath}: ${msg}`);
167868
+ return {
167869
+ allowed: this.fallback === 'allow' || this.fallback === 'warn',
167870
+ warn: this.fallback === 'warn' ? true : undefined,
167871
+ reason: `policy evaluation failed, fallback=${this.fallback}`,
167872
+ };
167873
+ }
167874
+ }
167875
+ async rawEvaluate(input, rulePath) {
167876
+ if (this.evaluator instanceof opa_wasm_evaluator_1.OpaWasmEvaluator) {
167877
+ const result = await this.evaluator.evaluate(input);
167878
+ // WASM compiled with `-e visor` entrypoint returns the full visor package tree.
167879
+ // Navigate to the specific rule subtree using rulePath segments.
167880
+ // e.g., 'visor/check/execute' → result.check.execute
167881
+ return this.navigateWasmResult(result, rulePath);
167882
+ }
167883
+ return this.evaluator.evaluate(input, rulePath);
167884
+ }
167885
+ /**
167886
+ * Navigate nested OPA WASM result tree to reach the specific rule's output.
167887
+ * The WASM entrypoint `-e visor` means the result root IS the visor package,
167888
+ * so we strip the `visor/` prefix and walk the remaining segments.
167889
+ */
167890
+ navigateWasmResult(result, rulePath) {
167891
+ if (!result || typeof result !== 'object')
167892
+ return result;
167893
+ // Strip the 'visor/' prefix (matches our compilation entrypoint)
167894
+ const segments = rulePath.replace(/^visor\//, '').split('/');
167895
+ let current = result;
167896
+ for (const seg of segments) {
167897
+ if (current && typeof current === 'object' && seg in current) {
167898
+ current = current[seg];
167899
+ }
167900
+ else {
167901
+ return undefined; // path not found in result tree
167902
+ }
167903
+ }
167904
+ return current;
167905
+ }
167906
+ parseDecision(result) {
167907
+ if (result === undefined || result === null) {
167908
+ return {
167909
+ allowed: this.fallback === 'allow' || this.fallback === 'warn',
167910
+ warn: this.fallback === 'warn' ? true : undefined,
167911
+ reason: this.fallback === 'warn' ? 'audit: no policy result' : 'no policy result',
167912
+ };
167913
+ }
167914
+ const allowed = result.allowed !== false;
167915
+ const decision = {
167916
+ allowed,
167917
+ reason: result.reason,
167918
+ };
167919
+ if (result.capabilities) {
167920
+ decision.capabilities = result.capabilities;
167921
+ }
167922
+ return decision;
167923
+ }
167924
+ }
167925
+ exports.OpaPolicyEngine = OpaPolicyEngine;
167926
+
167927
+
167928
+ /***/ }),
167929
+
167930
+ /***/ 8613:
167931
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
167932
+
167933
+ "use strict";
167934
+
167935
+ /**
167936
+ * Copyright (c) ProbeLabs. All rights reserved.
167937
+ * Licensed under the Elastic License 2.0; you may not use this file except
167938
+ * in compliance with the Elastic License 2.0.
167939
+ */
167940
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
167941
+ if (k2 === undefined) k2 = k;
167942
+ var desc = Object.getOwnPropertyDescriptor(m, k);
167943
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
167944
+ desc = { enumerable: true, get: function() { return m[k]; } };
167945
+ }
167946
+ Object.defineProperty(o, k2, desc);
167947
+ }) : (function(o, m, k, k2) {
167948
+ if (k2 === undefined) k2 = k;
167949
+ o[k2] = m[k];
167950
+ }));
167951
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
167952
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
167953
+ }) : function(o, v) {
167954
+ o["default"] = v;
167955
+ });
167956
+ var __importStar = (this && this.__importStar) || (function () {
167957
+ var ownKeys = function(o) {
167958
+ ownKeys = Object.getOwnPropertyNames || function (o) {
167959
+ var ar = [];
167960
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
167961
+ return ar;
167962
+ };
167963
+ return ownKeys(o);
167964
+ };
167965
+ return function (mod) {
167966
+ if (mod && mod.__esModule) return mod;
167967
+ var result = {};
167968
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
167969
+ __setModuleDefault(result, mod);
167970
+ return result;
167971
+ };
167972
+ })();
167973
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
167974
+ exports.OpaWasmEvaluator = void 0;
167975
+ const fs = __importStar(__nccwpck_require__(79896));
167976
+ const path = __importStar(__nccwpck_require__(16928));
167977
+ const opa_compiler_1 = __nccwpck_require__(628);
167978
+ /**
167979
+ * OPA WASM Evaluator - loads and evaluates OPA policies locally.
167980
+ *
167981
+ * Supports three input formats:
167982
+ * 1. Pre-compiled `.wasm` bundle — loaded directly (fastest startup)
167983
+ * 2. `.rego` files or directory — auto-compiled to WASM via `opa build` CLI
167984
+ * 3. Directory with `policy.wasm` inside — loaded directly
167985
+ *
167986
+ * Compilation and caching of .rego files is delegated to {@link OpaCompiler}.
167987
+ *
167988
+ * Requires:
167989
+ * - `@open-policy-agent/opa-wasm` npm package (optional dep)
167990
+ * - `opa` CLI on PATH (only when auto-compiling .rego files)
167991
+ */
167992
+ class OpaWasmEvaluator {
167993
+ policy = null;
167994
+ dataDocument = {};
167995
+ compiler = new opa_compiler_1.OpaCompiler();
167996
+ async initialize(rulesPath) {
167997
+ const paths = Array.isArray(rulesPath) ? rulesPath : [rulesPath];
167998
+ const wasmBytes = await this.compiler.resolveWasmBytes(paths);
167999
+ try {
168000
+ // Use createRequire to load the optional dep at runtime without ncc bundling it.
168001
+ // `new Function('id', 'return require(id)')` fails in ncc bundles because
168002
+ // `require` is not in the `new Function` scope. `createRequire` works correctly
168003
+ // because it creates a real Node.js require rooted at the given path.
168004
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
168005
+ const { createRequire } = __nccwpck_require__(73339);
168006
+ const runtimeRequire = createRequire(__filename);
168007
+ const opaWasm = runtimeRequire('@open-policy-agent/opa-wasm');
168008
+ const loadPolicy = opaWasm.loadPolicy || opaWasm.default?.loadPolicy;
168009
+ if (!loadPolicy) {
168010
+ throw new Error('loadPolicy not found in @open-policy-agent/opa-wasm');
168011
+ }
168012
+ this.policy = await loadPolicy(wasmBytes);
168013
+ }
168014
+ catch (err) {
168015
+ if (err?.code === 'MODULE_NOT_FOUND' || err?.code === 'ERR_MODULE_NOT_FOUND') {
168016
+ throw new Error('OPA WASM evaluator requires @open-policy-agent/opa-wasm. ' +
168017
+ 'Install it with: npm install @open-policy-agent/opa-wasm');
168018
+ }
168019
+ throw err;
168020
+ }
168021
+ }
168022
+ /**
168023
+ * Load external data from a JSON file to use as the OPA data document.
168024
+ * The loaded data will be passed to `policy.setData()` during evaluation,
168025
+ * making it available in Rego via `data.<key>`.
168026
+ */
168027
+ loadData(dataPath) {
168028
+ const resolved = path.resolve(dataPath);
168029
+ if (path.normalize(resolved).includes('..')) {
168030
+ throw new Error(`Data path contains traversal sequences: ${dataPath}`);
168031
+ }
168032
+ if (!fs.existsSync(resolved)) {
168033
+ throw new Error(`OPA data file not found: ${resolved}`);
168034
+ }
168035
+ const stat = fs.statSync(resolved);
168036
+ if (stat.size > 10 * 1024 * 1024) {
168037
+ throw new Error(`OPA data file exceeds 10MB limit: ${resolved} (${stat.size} bytes)`);
168038
+ }
168039
+ const raw = fs.readFileSync(resolved, 'utf-8');
168040
+ try {
168041
+ const parsed = JSON.parse(raw);
168042
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
168043
+ throw new Error('OPA data file must contain a JSON object (not an array or primitive)');
168044
+ }
168045
+ this.dataDocument = parsed;
168046
+ }
168047
+ catch (err) {
168048
+ if (err.message.startsWith('OPA data file must')) {
168049
+ throw err;
168050
+ }
168051
+ throw new Error(`Failed to parse OPA data file ${resolved}: ${err.message}`);
168052
+ }
168053
+ }
168054
+ async evaluate(input) {
168055
+ if (!this.policy) {
168056
+ throw new Error('OPA WASM evaluator not initialized');
168057
+ }
168058
+ this.policy.setData(this.dataDocument);
168059
+ const resultSet = this.policy.evaluate(input);
168060
+ if (Array.isArray(resultSet) && resultSet.length > 0) {
168061
+ return resultSet[0].result;
168062
+ }
168063
+ return undefined;
168064
+ }
168065
+ async shutdown() {
168066
+ if (this.policy) {
168067
+ // opa-wasm policy objects may have a close/free method for WASM cleanup
168068
+ if (typeof this.policy.close === 'function') {
168069
+ try {
168070
+ this.policy.close();
168071
+ }
168072
+ catch { }
168073
+ }
168074
+ else if (typeof this.policy.free === 'function') {
168075
+ try {
168076
+ this.policy.free();
168077
+ }
168078
+ catch { }
168079
+ }
168080
+ }
168081
+ this.policy = null;
168082
+ }
168083
+ }
168084
+ exports.OpaWasmEvaluator = OpaWasmEvaluator;
168085
+
168086
+
168087
+ /***/ }),
168088
+
168089
+ /***/ 17117:
168090
+ /***/ ((__unused_webpack_module, exports) => {
168091
+
168092
+ "use strict";
168093
+
168094
+ /**
168095
+ * Copyright (c) ProbeLabs. All rights reserved.
168096
+ * Licensed under the Elastic License 2.0; you may not use this file except
168097
+ * in compliance with the Elastic License 2.0.
168098
+ */
168099
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
168100
+ exports.PolicyInputBuilder = void 0;
168101
+ /**
168102
+ * Builds OPA-compatible input documents from engine context.
168103
+ *
168104
+ * Resolves actor roles from the `policy.roles` config section by matching
168105
+ * the actor's authorAssociation and login against role definitions.
168106
+ */
168107
+ class PolicyInputBuilder {
168108
+ roles;
168109
+ actor;
168110
+ repository;
168111
+ pullRequest;
168112
+ constructor(policyConfig, actor, repository, pullRequest) {
168113
+ this.roles = policyConfig.roles || {};
168114
+ this.actor = actor;
168115
+ this.repository = repository;
168116
+ this.pullRequest = pullRequest;
168117
+ }
168118
+ /** Resolve which roles apply to the current actor. */
168119
+ resolveRoles() {
168120
+ const matched = [];
168121
+ for (const [roleName, roleConfig] of Object.entries(this.roles)) {
168122
+ let identityMatch = false;
168123
+ if (roleConfig.author_association &&
168124
+ this.actor.authorAssociation &&
168125
+ roleConfig.author_association.includes(this.actor.authorAssociation)) {
168126
+ identityMatch = true;
168127
+ }
168128
+ if (!identityMatch &&
168129
+ roleConfig.users &&
168130
+ this.actor.login &&
168131
+ roleConfig.users.includes(this.actor.login)) {
168132
+ identityMatch = true;
168133
+ }
168134
+ // Slack user ID match
168135
+ if (!identityMatch &&
168136
+ roleConfig.slack_users &&
168137
+ this.actor.slack?.userId &&
168138
+ roleConfig.slack_users.includes(this.actor.slack.userId)) {
168139
+ identityMatch = true;
168140
+ }
168141
+ // Email match (case-insensitive)
168142
+ if (!identityMatch && roleConfig.emails && this.actor.slack?.email) {
168143
+ const actorEmail = this.actor.slack.email.toLowerCase();
168144
+ if (roleConfig.emails.some(e => e.toLowerCase() === actorEmail)) {
168145
+ identityMatch = true;
168146
+ }
168147
+ }
168148
+ // Note: teams-based role resolution requires GitHub API access (read:org scope)
168149
+ // and is not yet implemented. If configured, the role will not match via teams.
168150
+ if (!identityMatch)
168151
+ continue;
168152
+ // slack_channels gate: if set, the role only applies when triggered from one of these channels
168153
+ if (roleConfig.slack_channels && roleConfig.slack_channels.length > 0) {
168154
+ if (!this.actor.slack?.channelId ||
168155
+ !roleConfig.slack_channels.includes(this.actor.slack.channelId)) {
168156
+ continue;
168157
+ }
168158
+ }
168159
+ matched.push(roleName);
168160
+ }
168161
+ return matched;
168162
+ }
168163
+ buildActor() {
168164
+ return {
168165
+ authorAssociation: this.actor.authorAssociation,
168166
+ login: this.actor.login,
168167
+ roles: this.resolveRoles(),
168168
+ isLocalMode: this.actor.isLocalMode,
168169
+ ...(this.actor.slack && { slack: this.actor.slack }),
168170
+ };
168171
+ }
168172
+ forCheckExecution(check) {
168173
+ return {
168174
+ scope: 'check.execute',
168175
+ check: {
168176
+ id: check.id,
168177
+ type: check.type,
168178
+ group: check.group,
168179
+ tags: check.tags,
168180
+ criticality: check.criticality,
168181
+ sandbox: check.sandbox,
168182
+ policy: check.policy,
168183
+ },
168184
+ actor: this.buildActor(),
168185
+ repository: this.repository,
168186
+ pullRequest: this.pullRequest,
168187
+ };
168188
+ }
168189
+ forToolInvocation(serverName, methodName, transport) {
168190
+ return {
168191
+ scope: 'tool.invoke',
168192
+ tool: { serverName, methodName, transport },
168193
+ actor: this.buildActor(),
168194
+ repository: this.repository,
168195
+ pullRequest: this.pullRequest,
168196
+ };
168197
+ }
168198
+ forCapabilityResolve(checkId, capabilities) {
168199
+ return {
168200
+ scope: 'capability.resolve',
168201
+ check: { id: checkId, type: 'ai' },
168202
+ capability: capabilities,
168203
+ actor: this.buildActor(),
168204
+ repository: this.repository,
168205
+ pullRequest: this.pullRequest,
168206
+ };
168207
+ }
168208
+ }
168209
+ exports.PolicyInputBuilder = PolicyInputBuilder;
168210
+
168211
+
168212
+ /***/ }),
168213
+
168214
+ /***/ 63737:
168215
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
168216
+
168217
+ "use strict";
168218
+
168219
+ /**
168220
+ * Copyright (c) ProbeLabs. All rights reserved.
168221
+ * Licensed under the Elastic License 2.0; you may not use this file except
168222
+ * in compliance with the Elastic License 2.0.
168223
+ */
168224
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
168225
+ if (k2 === undefined) k2 = k;
168226
+ var desc = Object.getOwnPropertyDescriptor(m, k);
168227
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
168228
+ desc = { enumerable: true, get: function() { return m[k]; } };
168229
+ }
168230
+ Object.defineProperty(o, k2, desc);
168231
+ }) : (function(o, m, k, k2) {
168232
+ if (k2 === undefined) k2 = k;
168233
+ o[k2] = m[k];
168234
+ }));
168235
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
168236
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
168237
+ }) : function(o, v) {
168238
+ o["default"] = v;
168239
+ });
168240
+ var __importStar = (this && this.__importStar) || (function () {
168241
+ var ownKeys = function(o) {
168242
+ ownKeys = Object.getOwnPropertyNames || function (o) {
168243
+ var ar = [];
168244
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
168245
+ return ar;
168246
+ };
168247
+ return ownKeys(o);
168248
+ };
168249
+ return function (mod) {
168250
+ if (mod && mod.__esModule) return mod;
168251
+ var result = {};
168252
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
168253
+ __setModuleDefault(result, mod);
168254
+ return result;
168255
+ };
168256
+ })();
168257
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
168258
+ exports.KnexStoreBackend = void 0;
168259
+ /**
168260
+ * Knex-backed schedule store for PostgreSQL, MySQL, and MSSQL (Enterprise)
168261
+ *
168262
+ * Uses Knex query builder for database-agnostic SQL. Same schema as SQLite backend
168263
+ * but with real distributed locking via row-level claims (claimed_by/claimed_at/lock_token).
168264
+ */
168265
+ const fs = __importStar(__nccwpck_require__(79896));
168266
+ const path = __importStar(__nccwpck_require__(16928));
168267
+ const uuid_1 = __nccwpck_require__(31914);
168268
+ const logger_1 = __nccwpck_require__(86999);
168269
+ function toNum(val) {
168270
+ if (val === null || val === undefined)
168271
+ return undefined;
168272
+ return typeof val === 'string' ? parseInt(val, 10) : val;
168273
+ }
168274
+ function safeJsonParse(value) {
168275
+ if (!value)
168276
+ return undefined;
168277
+ try {
168278
+ return JSON.parse(value);
168279
+ }
168280
+ catch {
168281
+ return undefined;
168282
+ }
168283
+ }
168284
+ function fromDbRow(row) {
168285
+ return {
168286
+ id: row.id,
168287
+ creatorId: row.creator_id,
168288
+ creatorContext: row.creator_context ?? undefined,
168289
+ creatorName: row.creator_name ?? undefined,
168290
+ timezone: row.timezone,
168291
+ schedule: row.schedule_expr,
168292
+ runAt: toNum(row.run_at),
168293
+ isRecurring: row.is_recurring === true || row.is_recurring === 1,
168294
+ originalExpression: row.original_expression,
168295
+ workflow: row.workflow ?? undefined,
168296
+ workflowInputs: safeJsonParse(row.workflow_inputs),
168297
+ outputContext: safeJsonParse(row.output_context),
168298
+ status: row.status,
168299
+ createdAt: toNum(row.created_at),
168300
+ lastRunAt: toNum(row.last_run_at),
168301
+ nextRunAt: toNum(row.next_run_at),
168302
+ runCount: row.run_count,
168303
+ failureCount: row.failure_count,
168304
+ lastError: row.last_error ?? undefined,
168305
+ previousResponse: row.previous_response ?? undefined,
168306
+ };
168307
+ }
168308
+ function toInsertRow(schedule) {
168309
+ return {
168310
+ id: schedule.id,
168311
+ creator_id: schedule.creatorId,
168312
+ creator_context: schedule.creatorContext ?? null,
168313
+ creator_name: schedule.creatorName ?? null,
168314
+ timezone: schedule.timezone,
168315
+ schedule_expr: schedule.schedule,
168316
+ run_at: schedule.runAt ?? null,
168317
+ is_recurring: schedule.isRecurring,
168318
+ original_expression: schedule.originalExpression,
168319
+ workflow: schedule.workflow ?? null,
168320
+ workflow_inputs: schedule.workflowInputs ? JSON.stringify(schedule.workflowInputs) : null,
168321
+ output_context: schedule.outputContext ? JSON.stringify(schedule.outputContext) : null,
168322
+ status: schedule.status,
168323
+ created_at: schedule.createdAt,
168324
+ last_run_at: schedule.lastRunAt ?? null,
168325
+ next_run_at: schedule.nextRunAt ?? null,
168326
+ run_count: schedule.runCount,
168327
+ failure_count: schedule.failureCount,
168328
+ last_error: schedule.lastError ?? null,
168329
+ previous_response: schedule.previousResponse ?? null,
168330
+ };
168331
+ }
168332
+ /**
168333
+ * Enterprise Knex-backed store for PostgreSQL, MySQL, and MSSQL
168334
+ */
168335
+ class KnexStoreBackend {
168336
+ knex = null;
168337
+ driver;
168338
+ connection;
168339
+ constructor(driver, storageConfig, _haConfig) {
168340
+ this.driver = driver;
168341
+ this.connection = (storageConfig.connection || {});
168342
+ }
168343
+ async initialize() {
168344
+ // Load knex dynamically
168345
+ const { createRequire } = __nccwpck_require__(73339);
168346
+ const runtimeRequire = createRequire(__filename);
168347
+ let knexFactory;
168348
+ try {
168349
+ knexFactory = runtimeRequire('knex');
168350
+ }
168351
+ catch (err) {
168352
+ const code = err?.code;
168353
+ if (code === 'MODULE_NOT_FOUND' || code === 'ERR_MODULE_NOT_FOUND') {
168354
+ throw new Error('knex is required for PostgreSQL/MySQL/MSSQL schedule storage. ' +
168355
+ 'Install it with: npm install knex');
168356
+ }
168357
+ throw err;
168358
+ }
168359
+ const clientMap = {
168360
+ postgresql: 'pg',
168361
+ mysql: 'mysql2',
168362
+ mssql: 'tedious',
168363
+ };
168364
+ const client = clientMap[this.driver];
168365
+ // Build connection config
168366
+ let connection;
168367
+ if (this.connection.connection_string) {
168368
+ connection = this.connection.connection_string;
168369
+ }
168370
+ else if (this.driver === 'mssql') {
168371
+ connection = this.buildMssqlConnection();
168372
+ }
168373
+ else {
168374
+ connection = this.buildStandardConnection();
168375
+ }
168376
+ this.knex = knexFactory({
168377
+ client,
168378
+ connection,
168379
+ pool: {
168380
+ min: this.connection.pool?.min ?? 0,
168381
+ max: this.connection.pool?.max ?? 10,
168382
+ },
168383
+ });
168384
+ // Run schema migration
168385
+ await this.migrateSchema();
168386
+ logger_1.logger.info(`[KnexStore] Initialized (${this.driver})`);
168387
+ }
168388
+ buildStandardConnection() {
168389
+ return {
168390
+ host: this.connection.host || 'localhost',
168391
+ port: this.connection.port,
168392
+ database: this.connection.database || 'visor',
168393
+ user: this.connection.user,
168394
+ password: this.connection.password,
168395
+ ssl: this.resolveSslConfig(),
168396
+ };
168397
+ }
168398
+ buildMssqlConnection() {
168399
+ const ssl = this.connection.ssl;
168400
+ const sslEnabled = ssl === true || (typeof ssl === 'object' && ssl.enabled !== false);
168401
+ return {
168402
+ server: this.connection.host || 'localhost',
168403
+ port: this.connection.port,
168404
+ database: this.connection.database || 'visor',
168405
+ user: this.connection.user,
168406
+ password: this.connection.password,
168407
+ options: {
168408
+ encrypt: sslEnabled,
168409
+ trustServerCertificate: typeof ssl === 'object' ? ssl.reject_unauthorized === false : !sslEnabled,
168410
+ },
168411
+ };
168412
+ }
168413
+ resolveSslConfig() {
168414
+ const ssl = this.connection.ssl;
168415
+ if (ssl === false || ssl === undefined)
168416
+ return false;
168417
+ if (ssl === true)
168418
+ return { rejectUnauthorized: true };
168419
+ // Object config
168420
+ if (ssl.enabled === false)
168421
+ return false;
168422
+ const result = {
168423
+ rejectUnauthorized: ssl.reject_unauthorized !== false,
168424
+ };
168425
+ if (ssl.ca) {
168426
+ const caPath = this.validateSslPath(ssl.ca, 'CA certificate');
168427
+ result.ca = fs.readFileSync(caPath, 'utf8');
168428
+ }
168429
+ if (ssl.cert) {
168430
+ const certPath = this.validateSslPath(ssl.cert, 'client certificate');
168431
+ result.cert = fs.readFileSync(certPath, 'utf8');
168432
+ }
168433
+ if (ssl.key) {
168434
+ const keyPath = this.validateSslPath(ssl.key, 'client key');
168435
+ result.key = fs.readFileSync(keyPath, 'utf8');
168436
+ }
168437
+ return result;
168438
+ }
168439
+ validateSslPath(filePath, label) {
168440
+ const resolved = path.resolve(filePath);
168441
+ if (resolved !== path.normalize(resolved)) {
168442
+ throw new Error(`SSL ${label} path contains invalid sequences: ${filePath}`);
168443
+ }
168444
+ if (!fs.existsSync(resolved)) {
168445
+ throw new Error(`SSL ${label} not found: ${filePath}`);
168446
+ }
168447
+ return resolved;
168448
+ }
168449
+ async shutdown() {
168450
+ if (this.knex) {
168451
+ await this.knex.destroy();
168452
+ this.knex = null;
168453
+ }
168454
+ }
168455
+ async migrateSchema() {
168456
+ const knex = this.getKnex();
168457
+ const exists = await knex.schema.hasTable('schedules');
168458
+ if (!exists) {
168459
+ await knex.schema.createTable('schedules', table => {
168460
+ table.string('id', 36).primary();
168461
+ table.string('creator_id', 255).notNullable().index();
168462
+ table.string('creator_context', 255);
168463
+ table.string('creator_name', 255);
168464
+ table.string('timezone', 64).notNullable().defaultTo('UTC');
168465
+ table.string('schedule_expr', 255);
168466
+ table.bigInteger('run_at');
168467
+ table.boolean('is_recurring').notNullable();
168468
+ table.text('original_expression');
168469
+ table.string('workflow', 255);
168470
+ table.text('workflow_inputs');
168471
+ table.text('output_context');
168472
+ table.string('status', 20).notNullable().index();
168473
+ table.bigInteger('created_at').notNullable();
168474
+ table.bigInteger('last_run_at');
168475
+ table.bigInteger('next_run_at');
168476
+ table.integer('run_count').notNullable().defaultTo(0);
168477
+ table.integer('failure_count').notNullable().defaultTo(0);
168478
+ table.text('last_error');
168479
+ table.text('previous_response');
168480
+ table.index(['status', 'next_run_at']);
168481
+ });
168482
+ }
168483
+ // Create scheduler_locks table for distributed locking
168484
+ const locksExist = await knex.schema.hasTable('scheduler_locks');
168485
+ if (!locksExist) {
168486
+ await knex.schema.createTable('scheduler_locks', table => {
168487
+ table.string('lock_id', 255).primary();
168488
+ table.string('node_id', 255).notNullable();
168489
+ table.string('lock_token', 36).notNullable();
168490
+ table.bigInteger('acquired_at').notNullable();
168491
+ table.bigInteger('expires_at').notNullable();
168492
+ });
168493
+ }
168494
+ }
168495
+ getKnex() {
168496
+ if (!this.knex) {
168497
+ throw new Error('[KnexStore] Not initialized. Call initialize() first.');
168498
+ }
168499
+ return this.knex;
168500
+ }
168501
+ // --- CRUD ---
168502
+ async create(schedule) {
168503
+ const knex = this.getKnex();
168504
+ const newSchedule = {
168505
+ ...schedule,
168506
+ id: (0, uuid_1.v4)(),
168507
+ createdAt: Date.now(),
168508
+ runCount: 0,
168509
+ failureCount: 0,
168510
+ status: 'active',
168511
+ };
168512
+ await knex('schedules').insert(toInsertRow(newSchedule));
168513
+ logger_1.logger.info(`[KnexStore] Created schedule ${newSchedule.id} for user ${newSchedule.creatorId}`);
168514
+ return newSchedule;
168515
+ }
168516
+ async importSchedule(schedule) {
168517
+ const knex = this.getKnex();
168518
+ const existing = await knex('schedules').where('id', schedule.id).first();
168519
+ if (existing)
168520
+ return; // Already imported (idempotent)
168521
+ await knex('schedules').insert(toInsertRow(schedule));
168522
+ }
168523
+ async get(id) {
168524
+ const knex = this.getKnex();
168525
+ const row = await knex('schedules').where('id', id).first();
168526
+ return row ? fromDbRow(row) : undefined;
168527
+ }
168528
+ async update(id, patch) {
168529
+ const knex = this.getKnex();
168530
+ const existing = await knex('schedules').where('id', id).first();
168531
+ if (!existing)
168532
+ return undefined;
168533
+ const current = fromDbRow(existing);
168534
+ const updated = { ...current, ...patch, id: current.id };
168535
+ const row = toInsertRow(updated);
168536
+ // Remove id from update (PK cannot change)
168537
+ delete row.id;
168538
+ await knex('schedules').where('id', id).update(row);
168539
+ return updated;
168540
+ }
168541
+ async delete(id) {
168542
+ const knex = this.getKnex();
168543
+ const deleted = await knex('schedules').where('id', id).del();
168544
+ if (deleted > 0) {
168545
+ logger_1.logger.info(`[KnexStore] Deleted schedule ${id}`);
168546
+ return true;
168547
+ }
168548
+ return false;
168549
+ }
168550
+ // --- Queries ---
168551
+ async getByCreator(creatorId) {
168552
+ const knex = this.getKnex();
168553
+ const rows = await knex('schedules').where('creator_id', creatorId);
168554
+ return rows.map((r) => fromDbRow(r));
168555
+ }
168556
+ async getActiveSchedules() {
168557
+ const knex = this.getKnex();
168558
+ const rows = await knex('schedules').where('status', 'active');
168559
+ return rows.map((r) => fromDbRow(r));
168560
+ }
168561
+ async getDueSchedules(now) {
168562
+ const ts = now ?? Date.now();
168563
+ const knex = this.getKnex();
168564
+ // MSSQL uses 1/0 for booleans
168565
+ const bFalse = this.driver === 'mssql' ? 0 : false;
168566
+ const bTrue = this.driver === 'mssql' ? 1 : true;
168567
+ const rows = await knex('schedules')
168568
+ .where('status', 'active')
168569
+ .andWhere(function () {
168570
+ this.where(function () {
168571
+ this.where('is_recurring', bFalse)
168572
+ .whereNotNull('run_at')
168573
+ .where('run_at', '<=', ts);
168574
+ }).orWhere(function () {
168575
+ this.where('is_recurring', bTrue)
168576
+ .whereNotNull('next_run_at')
168577
+ .where('next_run_at', '<=', ts);
168578
+ });
168579
+ });
168580
+ return rows.map((r) => fromDbRow(r));
168581
+ }
168582
+ async findByWorkflow(creatorId, workflowName) {
168583
+ const knex = this.getKnex();
168584
+ const escaped = workflowName.toLowerCase().replace(/[%_\\]/g, '\\$&');
168585
+ const pattern = `%${escaped}%`;
168586
+ const rows = await knex('schedules')
168587
+ .where('creator_id', creatorId)
168588
+ .where('status', 'active')
168589
+ .whereRaw("LOWER(workflow) LIKE ? ESCAPE '\\'", [pattern]);
168590
+ return rows.map((r) => fromDbRow(r));
168591
+ }
168592
+ async getAll() {
168593
+ const knex = this.getKnex();
168594
+ const rows = await knex('schedules');
168595
+ return rows.map((r) => fromDbRow(r));
168596
+ }
168597
+ async getStats() {
168598
+ const knex = this.getKnex();
168599
+ // MSSQL uses 1/0 for booleans; PostgreSQL/MySQL accept both true/1
168600
+ const boolTrue = this.driver === 'mssql' ? '1' : 'true';
168601
+ const boolFalse = this.driver === 'mssql' ? '0' : 'false';
168602
+ const result = await knex('schedules')
168603
+ .select(knex.raw('COUNT(*) as total'), knex.raw("SUM(CASE WHEN status = 'active' THEN 1 ELSE 0 END) as active"), knex.raw("SUM(CASE WHEN status = 'paused' THEN 1 ELSE 0 END) as paused"), knex.raw("SUM(CASE WHEN status = 'completed' THEN 1 ELSE 0 END) as completed"), knex.raw("SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) as failed"), knex.raw(`SUM(CASE WHEN is_recurring = ${boolTrue} THEN 1 ELSE 0 END) as recurring`), knex.raw(`SUM(CASE WHEN is_recurring = ${boolFalse} THEN 1 ELSE 0 END) as one_time`))
168604
+ .first();
168605
+ return {
168606
+ total: Number(result.total) || 0,
168607
+ active: Number(result.active) || 0,
168608
+ paused: Number(result.paused) || 0,
168609
+ completed: Number(result.completed) || 0,
168610
+ failed: Number(result.failed) || 0,
168611
+ recurring: Number(result.recurring) || 0,
168612
+ oneTime: Number(result.one_time) || 0,
168613
+ };
168614
+ }
168615
+ async validateLimits(creatorId, isRecurring, limits) {
168616
+ const knex = this.getKnex();
168617
+ if (limits.maxGlobal) {
168618
+ const result = await knex('schedules').count('* as cnt').first();
168619
+ if (Number(result?.cnt) >= limits.maxGlobal) {
168620
+ throw new Error(`Global schedule limit reached (${limits.maxGlobal})`);
168621
+ }
168622
+ }
168623
+ if (limits.maxPerUser) {
168624
+ const result = await knex('schedules')
168625
+ .where('creator_id', creatorId)
168626
+ .count('* as cnt')
168627
+ .first();
168628
+ if (Number(result?.cnt) >= limits.maxPerUser) {
168629
+ throw new Error(`You have reached the maximum number of schedules (${limits.maxPerUser})`);
168630
+ }
168631
+ }
168632
+ if (isRecurring && limits.maxRecurringPerUser) {
168633
+ const bTrue = this.driver === 'mssql' ? 1 : true;
168634
+ const result = await knex('schedules')
168635
+ .where('creator_id', creatorId)
168636
+ .where('is_recurring', bTrue)
168637
+ .count('* as cnt')
168638
+ .first();
168639
+ if (Number(result?.cnt) >= limits.maxRecurringPerUser) {
168640
+ throw new Error(`You have reached the maximum number of recurring schedules (${limits.maxRecurringPerUser})`);
168641
+ }
168642
+ }
168643
+ }
168644
+ // --- HA Distributed Locking (via scheduler_locks table) ---
168645
+ async tryAcquireLock(lockId, nodeId, ttlSeconds) {
168646
+ const knex = this.getKnex();
168647
+ const now = Date.now();
168648
+ const expiresAt = now + ttlSeconds * 1000;
168649
+ const token = (0, uuid_1.v4)();
168650
+ // Step 1: Try to claim an existing expired lock
168651
+ const updated = await knex('scheduler_locks')
168652
+ .where('lock_id', lockId)
168653
+ .where('expires_at', '<', now)
168654
+ .update({
168655
+ node_id: nodeId,
168656
+ lock_token: token,
168657
+ acquired_at: now,
168658
+ expires_at: expiresAt,
168659
+ });
168660
+ if (updated > 0)
168661
+ return token;
168662
+ // Step 2: Try to INSERT a new lock row
168663
+ try {
168664
+ await knex('scheduler_locks').insert({
168665
+ lock_id: lockId,
168666
+ node_id: nodeId,
168667
+ lock_token: token,
168668
+ acquired_at: now,
168669
+ expires_at: expiresAt,
168670
+ });
168671
+ return token;
168672
+ }
168673
+ catch {
168674
+ // Unique constraint violation — another node holds the lock
168675
+ return null;
168676
+ }
168677
+ }
168678
+ async releaseLock(lockId, lockToken) {
168679
+ const knex = this.getKnex();
168680
+ await knex('scheduler_locks').where('lock_id', lockId).where('lock_token', lockToken).del();
168681
+ }
168682
+ async renewLock(lockId, lockToken, ttlSeconds) {
168683
+ const knex = this.getKnex();
168684
+ const now = Date.now();
168685
+ const expiresAt = now + ttlSeconds * 1000;
168686
+ const updated = await knex('scheduler_locks')
168687
+ .where('lock_id', lockId)
168688
+ .where('lock_token', lockToken)
168689
+ .update({ acquired_at: now, expires_at: expiresAt });
168690
+ return updated > 0;
168691
+ }
168692
+ async flush() {
168693
+ // No-op for server-based backends
168694
+ }
168695
+ }
168696
+ exports.KnexStoreBackend = KnexStoreBackend;
168697
+
168698
+
167015
168699
  /***/ }),
167016
168700
 
167017
168701
  /***/ 83864:
@@ -177693,6 +179377,35 @@ class OutputFormatters {
177693
179377
  exports.OutputFormatters = OutputFormatters;
177694
179378
 
177695
179379
 
179380
+ /***/ }),
179381
+
179382
+ /***/ 93866:
179383
+ /***/ ((__unused_webpack_module, exports) => {
179384
+
179385
+ "use strict";
179386
+
179387
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
179388
+ exports.DefaultPolicyEngine = void 0;
179389
+ /**
179390
+ * Default (no-op) policy engine — always allows everything.
179391
+ * Used when no enterprise license is present or policy is disabled.
179392
+ */
179393
+ class DefaultPolicyEngine {
179394
+ async initialize(_config) { }
179395
+ async evaluateCheckExecution(_checkId, _checkConfig) {
179396
+ return { allowed: true };
179397
+ }
179398
+ async evaluateToolInvocation(_serverName, _methodName, _transport) {
179399
+ return { allowed: true };
179400
+ }
179401
+ async evaluateCapabilities(_checkId, _capabilities) {
179402
+ return { allowed: true };
179403
+ }
179404
+ async shutdown() { }
179405
+ }
179406
+ exports.DefaultPolicyEngine = DefaultPolicyEngine;
179407
+
179408
+
177696
179409
  /***/ }),
177697
179410
 
177698
179411
  /***/ 96611:
@@ -198286,7 +199999,7 @@ class StateMachineExecutionEngine {
198286
199999
  try {
198287
200000
  logger_1.logger.debug(`[PolicyEngine] Loading enterprise policy engine (engine=${configWithTagFilter.policy.engine})`);
198288
200001
  // @ts-ignore — enterprise/ may not exist in OSS builds (caught at runtime)
198289
- const { loadEnterprisePolicyEngine } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(7065)));
200002
+ const { loadEnterprisePolicyEngine } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(87068)));
198290
200003
  context.policyEngine = await loadEnterprisePolicyEngine(configWithTagFilter.policy);
198291
200004
  logger_1.logger.debug(`[PolicyEngine] Initialized: ${context.policyEngine?.constructor?.name || 'unknown'}`);
198292
200005
  }
@@ -208550,7 +210263,7 @@ async function initTelemetry(opts = {}) {
208550
210263
  const path = __nccwpck_require__(16928);
208551
210264
  const outDir = opts.file?.dir ||
208552
210265
  process.env.VISOR_TRACE_DIR ||
208553
- __nccwpck_require__.ab + "traces";
210266
+ path.join(process.cwd(), 'output', 'traces');
208554
210267
  fs.mkdirSync(outDir, { recursive: true });
208555
210268
  const ts = new Date().toISOString().replace(/[:.]/g, '-');
208556
210269
  process.env.VISOR_FALLBACK_TRACE_FILE = path.join(outDir, `run-${ts}.ndjson`);
@@ -208755,7 +210468,7 @@ async function shutdownTelemetry() {
208755
210468
  if (process.env.VISOR_TRACE_REPORT === 'true') {
208756
210469
  const fs = __nccwpck_require__(79896);
208757
210470
  const path = __nccwpck_require__(16928);
208758
- const outDir = process.env.VISOR_TRACE_DIR || __nccwpck_require__.ab + "traces";
210471
+ const outDir = process.env.VISOR_TRACE_DIR || path.join(process.cwd(), 'output', 'traces');
208759
210472
  if (!fs.existsSync(outDir))
208760
210473
  fs.mkdirSync(outDir, { recursive: true });
208761
210474
  const ts = new Date().toISOString().replace(/[:.]/g, '-');
@@ -209254,7 +210967,7 @@ function __getOrCreateNdjsonPath() {
209254
210967
  fs.mkdirSync(dir, { recursive: true });
209255
210968
  return __ndjsonPath;
209256
210969
  }
209257
- const outDir = process.env.VISOR_TRACE_DIR || __nccwpck_require__.ab + "traces";
210970
+ const outDir = process.env.VISOR_TRACE_DIR || path.join(process.cwd(), 'output', 'traces');
209258
210971
  if (!fs.existsSync(outDir))
209259
210972
  fs.mkdirSync(outDir, { recursive: true });
209260
210973
  if (!__ndjsonPath) {
@@ -222674,22 +224387,6 @@ class WorkflowRegistry {
222674
224387
  exports.WorkflowRegistry = WorkflowRegistry;
222675
224388
 
222676
224389
 
222677
- /***/ }),
222678
-
222679
- /***/ 7065:
222680
- /***/ ((module) => {
222681
-
222682
- module.exports = eval("require")("./enterprise/loader");
222683
-
222684
-
222685
- /***/ }),
222686
-
222687
- /***/ 71370:
222688
- /***/ ((module) => {
222689
-
222690
- module.exports = eval("require")("./enterprise/policy/policy-input-builder");
222691
-
222692
-
222693
224390
  /***/ }),
222694
224391
 
222695
224392
  /***/ 18327:
@@ -394863,7 +396560,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"100":"Continue","101":"Switching Pro
394863
396560
  /***/ ((module) => {
394864
396561
 
394865
396562
  "use strict";
394866
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@probelabs/visor","version":"0.1.145","main":"dist/index.js","bin":{"visor":"./dist/index.js"},"exports":{".":{"require":"./dist/index.js","import":"./dist/index.js"},"./sdk":{"types":"./dist/sdk/sdk.d.ts","import":"./dist/sdk/sdk.mjs","require":"./dist/sdk/sdk.js"},"./cli":{"require":"./dist/index.js"}},"files":["dist/","defaults/","action.yml","README.md","LICENSE"],"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"scripts":{"build:cli":"ncc build src/index.ts -o dist && cp -r defaults dist/ && cp -r output dist/ && cp -r docs dist/ && cp -r examples dist/ && cp -r src/debug-visualizer/ui dist/debug-visualizer/ && node scripts/inject-version.js && echo \'#!/usr/bin/env node\' | cat - dist/index.js > temp && mv temp dist/index.js && chmod +x dist/index.js","build:sdk":"tsup src/sdk.ts --dts --sourcemap --format esm,cjs --out-dir dist/sdk","build":"./scripts/build-oss.sh","build:ee":"npm run build:cli && npm run build:sdk","test":"jest && npm run test:yaml","test:unit":"jest","prepublishOnly":"npm run build","test:watch":"jest --watch","test:coverage":"jest --coverage","test:ee":"jest --testPathPatterns=\'tests/ee\' --testPathIgnorePatterns=\'/node_modules/\' --no-coverage","test:manual:bash":"RUN_MANUAL_TESTS=true jest tests/manual/bash-config-manual.test.ts","lint":"eslint src tests --ext .ts","lint:fix":"eslint src tests --ext .ts --fix","format":"prettier --write src tests","format:check":"prettier --check src tests","clean":"","clean:traces":"node scripts/clean-traces.js","prebuild":"npm run clean && node scripts/generate-config-schema.js","pretest":"npm run clean:traces && node scripts/generate-config-schema.js && npm run build:cli","pretest:unit":"npm run clean:traces && node scripts/generate-config-schema.js && npm run build:cli","test:with-build":"npm run build:cli && jest","test:yaml":"node dist/index.js test --progress compact","test:yaml:parallel":"node dist/index.js test --progress compact --max-parallel 4","prepare":"husky","pre-commit":"lint-staged","deploy:site":"cd site && npx wrangler pages deploy . --project-name=visor-site --commit-dirty=true","deploy:worker":"npx wrangler deploy","deploy":"npm run deploy:site && npm run deploy:worker","publish:ee":"./scripts/publish-ee.sh","release":"./scripts/release.sh","release:patch":"./scripts/release.sh patch","release:minor":"./scripts/release.sh minor","release:major":"./scripts/release.sh major","release:prerelease":"./scripts/release.sh prerelease","docs:validate":"node scripts/validate-readme-links.js","workshop:setup":"npm install -D reveal-md@6.1.2","workshop:serve":"cd workshop && reveal-md slides.md -w","workshop:export":"reveal-md workshop/slides.md --static workshop/build","workshop:pdf":"reveal-md workshop/slides.md --print workshop/Visor-Workshop.pdf --print-size letter","workshop:pdf:ci":"reveal-md workshop/slides.md --print workshop/Visor-Workshop.pdf --print-size letter --puppeteer-launch-args=\\"--no-sandbox --disable-dev-shm-usage\\"","workshop:pdf:a4":"reveal-md workshop/slides.md --print workshop/Visor-Workshop-A4.pdf --print-size A4","workshop:build":"npm run workshop:export && npm run workshop:pdf","simulate:issue":"TS_NODE_TRANSPILE_ONLY=1 ts-node scripts/simulate-gh-run.ts --event issues --action opened --debug","simulate:comment":"TS_NODE_TRANSPILE_ONLY=1 ts-node scripts/simulate-gh-run.ts --event issue_comment --action created --debug"},"keywords":["code-review","ai","github-action","cli","pr-review","visor"],"author":"Probe Labs","license":"MIT","description":"AI workflow engine for code review, assistants, and automation — orchestrate checks, MCP tools, and AI providers with YAML-driven pipelines","repository":{"type":"git","url":"git+https://github.com/probelabs/visor.git"},"bugs":{"url":"https://github.com/probelabs/visor/issues"},"homepage":"https://github.com/probelabs/visor#readme","dependencies":{"@actions/core":"^1.11.1","@apidevtools/swagger-parser":"^12.1.0","@modelcontextprotocol/sdk":"^1.25.3","@nyariv/sandboxjs":"github:probelabs/SandboxJS#f1c13b8eee98734a8ea024061eada4aa9a9ff2e9","@octokit/action":"^8.0.2","@octokit/auth-app":"^8.1.0","@octokit/core":"^7.0.3","@octokit/rest":"^22.0.0","@opentelemetry/api":"^1.9.0","@opentelemetry/core":"^1.30.1","@opentelemetry/exporter-trace-otlp-grpc":"^0.203.0","@opentelemetry/exporter-trace-otlp-http":"^0.203.0","@opentelemetry/instrumentation":"^0.203.0","@opentelemetry/resources":"^1.30.1","@opentelemetry/sdk-metrics":"^1.30.1","@opentelemetry/sdk-node":"^0.203.0","@opentelemetry/sdk-trace-base":"^1.30.1","@opentelemetry/semantic-conventions":"^1.30.1","@probelabs/probe":"^0.6.0-rc260","@types/commander":"^2.12.0","@types/uuid":"^10.0.0","acorn":"^8.16.0","acorn-walk":"^8.3.5","ajv":"^8.17.1","ajv-formats":"^3.0.1","better-sqlite3":"^11.0.0","blessed":"^0.1.81","cli-table3":"^0.6.5","commander":"^14.0.0","deepmerge":"^4.3.1","dotenv":"^17.2.3","ignore":"^7.0.5","js-yaml":"^4.1.0","jsonpath-plus":"^10.4.0","liquidjs":"^10.21.1","minimatch":"^10.2.2","node-cron":"^3.0.3","open":"^9.1.0","simple-git":"^3.28.0","uuid":"^11.1.0","ws":"^8.18.3"},"optionalDependencies":{"@anthropic/claude-code-sdk":"npm:null@*","@open-policy-agent/opa-wasm":"^1.10.0","knex":"^3.1.0","mysql2":"^3.11.0","pg":"^8.13.0","tedious":"^19.0.0"},"devDependencies":{"@eslint/js":"^9.34.0","@kie/act-js":"^2.6.2","@kie/mock-github":"^2.0.1","@swc/core":"^1.13.2","@swc/jest":"^0.2.37","@types/better-sqlite3":"^7.6.0","@types/blessed":"^0.1.27","@types/jest":"^30.0.0","@types/js-yaml":"^4.0.9","@types/node":"^24.3.0","@types/node-cron":"^3.0.11","@types/ws":"^8.18.1","@typescript-eslint/eslint-plugin":"^8.42.0","@typescript-eslint/parser":"^8.42.0","@vercel/ncc":"^0.38.4","eslint":"^9.34.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4","husky":"^9.1.7","jest":"^30.1.3","lint-staged":"^16.1.6","prettier":"^3.6.2","reveal-md":"^6.1.2","ts-json-schema-generator":"^1.5.1","ts-node":"^10.9.2","tsup":"^8.5.0","typescript":"^5.9.2","wrangler":"^3.0.0"},"peerDependenciesMeta":{"@anthropic/claude-code-sdk":{"optional":true}},"directories":{"test":"tests"},"lint-staged":{"src/**/*.{ts,js}":["eslint --fix","prettier --write"],"tests/**/*.{ts,js}":["eslint --fix","prettier --write"],"*.{json,md,yml,yaml}":["prettier --write"]}}');
396563
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@probelabs/visor","version":"0.1.42","main":"dist/index.js","bin":{"visor":"./dist/index.js"},"exports":{".":{"require":"./dist/index.js","import":"./dist/index.js"},"./sdk":{"types":"./dist/sdk/sdk.d.ts","import":"./dist/sdk/sdk.mjs","require":"./dist/sdk/sdk.js"},"./cli":{"require":"./dist/index.js"}},"files":["dist/","defaults/","action.yml","README.md","LICENSE"],"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"scripts":{"build:cli":"ncc build src/index.ts -o dist && cp -r defaults dist/ && cp -r output dist/ && cp -r docs dist/ && cp -r examples dist/ && cp -r src/debug-visualizer/ui dist/debug-visualizer/ && node scripts/inject-version.js && echo \'#!/usr/bin/env node\' | cat - dist/index.js > temp && mv temp dist/index.js && chmod +x dist/index.js","build:sdk":"tsup src/sdk.ts --dts --sourcemap --format esm,cjs --out-dir dist/sdk","build":"./scripts/build-oss.sh","build:ee":"npm run build:cli && npm run build:sdk","test":"jest && npm run test:yaml","test:unit":"jest","prepublishOnly":"npm run build","test:watch":"jest --watch","test:coverage":"jest --coverage","test:ee":"jest --testPathPatterns=\'tests/ee\' --testPathIgnorePatterns=\'/node_modules/\' --no-coverage","test:manual:bash":"RUN_MANUAL_TESTS=true jest tests/manual/bash-config-manual.test.ts","lint":"eslint src tests --ext .ts","lint:fix":"eslint src tests --ext .ts --fix","format":"prettier --write src tests","format:check":"prettier --check src tests","clean":"","clean:traces":"node scripts/clean-traces.js","prebuild":"npm run clean && node scripts/generate-config-schema.js","pretest":"npm run clean:traces && node scripts/generate-config-schema.js && npm run build:cli","pretest:unit":"npm run clean:traces && node scripts/generate-config-schema.js && npm run build:cli","test:with-build":"npm run build:cli && jest","test:yaml":"node dist/index.js test --progress compact","test:yaml:parallel":"node dist/index.js test --progress compact --max-parallel 4","prepare":"husky","pre-commit":"lint-staged","deploy:site":"cd site && npx wrangler pages deploy . --project-name=visor-site --commit-dirty=true","deploy:worker":"npx wrangler deploy","deploy":"npm run deploy:site && npm run deploy:worker","publish:ee":"./scripts/publish-ee.sh","release":"./scripts/release.sh","release:patch":"./scripts/release.sh patch","release:minor":"./scripts/release.sh minor","release:major":"./scripts/release.sh major","release:prerelease":"./scripts/release.sh prerelease","docs:validate":"node scripts/validate-readme-links.js","workshop:setup":"npm install -D reveal-md@6.1.2","workshop:serve":"cd workshop && reveal-md slides.md -w","workshop:export":"reveal-md workshop/slides.md --static workshop/build","workshop:pdf":"reveal-md workshop/slides.md --print workshop/Visor-Workshop.pdf --print-size letter","workshop:pdf:ci":"reveal-md workshop/slides.md --print workshop/Visor-Workshop.pdf --print-size letter --puppeteer-launch-args=\\"--no-sandbox --disable-dev-shm-usage\\"","workshop:pdf:a4":"reveal-md workshop/slides.md --print workshop/Visor-Workshop-A4.pdf --print-size A4","workshop:build":"npm run workshop:export && npm run workshop:pdf","simulate:issue":"TS_NODE_TRANSPILE_ONLY=1 ts-node scripts/simulate-gh-run.ts --event issues --action opened --debug","simulate:comment":"TS_NODE_TRANSPILE_ONLY=1 ts-node scripts/simulate-gh-run.ts --event issue_comment --action created --debug"},"keywords":["code-review","ai","github-action","cli","pr-review","visor"],"author":"Probe Labs","license":"MIT","description":"AI workflow engine for code review, assistants, and automation — orchestrate checks, MCP tools, and AI providers with YAML-driven pipelines","repository":{"type":"git","url":"git+https://github.com/probelabs/visor.git"},"bugs":{"url":"https://github.com/probelabs/visor/issues"},"homepage":"https://github.com/probelabs/visor#readme","dependencies":{"@actions/core":"^1.11.1","@apidevtools/swagger-parser":"^12.1.0","@modelcontextprotocol/sdk":"^1.25.3","@nyariv/sandboxjs":"github:probelabs/SandboxJS#f1c13b8eee98734a8ea024061eada4aa9a9ff2e9","@octokit/action":"^8.0.2","@octokit/auth-app":"^8.1.0","@octokit/core":"^7.0.3","@octokit/rest":"^22.0.0","@opentelemetry/api":"^1.9.0","@opentelemetry/core":"^1.30.1","@opentelemetry/exporter-trace-otlp-grpc":"^0.203.0","@opentelemetry/exporter-trace-otlp-http":"^0.203.0","@opentelemetry/instrumentation":"^0.203.0","@opentelemetry/resources":"^1.30.1","@opentelemetry/sdk-metrics":"^1.30.1","@opentelemetry/sdk-node":"^0.203.0","@opentelemetry/sdk-trace-base":"^1.30.1","@opentelemetry/semantic-conventions":"^1.30.1","@probelabs/probe":"^0.6.0-rc260","@types/commander":"^2.12.0","@types/uuid":"^10.0.0","acorn":"^8.16.0","acorn-walk":"^8.3.5","ajv":"^8.17.1","ajv-formats":"^3.0.1","better-sqlite3":"^11.0.0","blessed":"^0.1.81","cli-table3":"^0.6.5","commander":"^14.0.0","deepmerge":"^4.3.1","dotenv":"^17.2.3","ignore":"^7.0.5","js-yaml":"^4.1.0","jsonpath-plus":"^10.4.0","liquidjs":"^10.21.1","minimatch":"^10.2.2","node-cron":"^3.0.3","open":"^9.1.0","simple-git":"^3.28.0","uuid":"^11.1.0","ws":"^8.18.3"},"optionalDependencies":{"@anthropic/claude-code-sdk":"npm:null@*","@open-policy-agent/opa-wasm":"^1.10.0","knex":"^3.1.0","mysql2":"^3.11.0","pg":"^8.13.0","tedious":"^19.0.0"},"devDependencies":{"@eslint/js":"^9.34.0","@kie/act-js":"^2.6.2","@kie/mock-github":"^2.0.1","@swc/core":"^1.13.2","@swc/jest":"^0.2.37","@types/better-sqlite3":"^7.6.0","@types/blessed":"^0.1.27","@types/jest":"^30.0.0","@types/js-yaml":"^4.0.9","@types/node":"^24.3.0","@types/node-cron":"^3.0.11","@types/ws":"^8.18.1","@typescript-eslint/eslint-plugin":"^8.42.0","@typescript-eslint/parser":"^8.42.0","@vercel/ncc":"^0.38.4","eslint":"^9.34.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4","husky":"^9.1.7","jest":"^30.1.3","lint-staged":"^16.1.6","prettier":"^3.6.2","reveal-md":"^6.1.2","ts-json-schema-generator":"^1.5.1","ts-node":"^10.9.2","tsup":"^8.5.0","typescript":"^5.9.2","wrangler":"^3.0.0"},"peerDependenciesMeta":{"@anthropic/claude-code-sdk":{"optional":true}},"directories":{"test":"tests"},"lint-staged":{"src/**/*.{ts,js}":["eslint --fix","prettier --write"],"tests/**/*.{ts,js}":["eslint --fix","prettier --write"],"*.{json,md,yml,yaml}":["prettier --write"]}}');
394867
396564
 
394868
396565
  /***/ })
394869
396566