@probelabs/visor 0.1.131-ee → 0.1.131

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 (49) hide show
  1. package/dist/index.js +22 -1719
  2. package/dist/output/traces/run-2026-02-15T19-14-20-379Z.ndjson +138 -0
  3. package/dist/output/traces/run-2026-02-15T19-15-09-410Z.ndjson +1357 -0
  4. package/dist/sdk/{check-provider-registry-FMHECPI4.mjs → check-provider-registry-AAPPJ4CP.mjs} +3 -3
  5. package/dist/sdk/check-provider-registry-S7BMQ2FC.mjs +28 -0
  6. package/dist/sdk/chunk-6ZZ4DPAA.mjs +39912 -0
  7. package/dist/sdk/{chunk-UXMMGCAS.mjs.map → chunk-6ZZ4DPAA.mjs.map} +1 -1
  8. package/dist/sdk/{chunk-UXMMGCAS.mjs → chunk-LDFUW34H.mjs} +10 -10
  9. package/dist/sdk/chunk-LDFUW34H.mjs.map +1 -0
  10. package/dist/sdk/chunk-OMFPM576.mjs +739 -0
  11. package/dist/sdk/chunk-OMFPM576.mjs.map +1 -0
  12. package/dist/sdk/chunk-RI77TA6V.mjs +436 -0
  13. package/dist/sdk/chunk-RI77TA6V.mjs.map +1 -0
  14. package/dist/sdk/chunk-VO4N6TEL.mjs +1502 -0
  15. package/dist/sdk/chunk-VO4N6TEL.mjs.map +1 -0
  16. package/dist/sdk/failure-condition-evaluator-KN55WXRO.mjs +17 -0
  17. package/dist/sdk/github-frontend-HCOKL53D.mjs +1356 -0
  18. package/dist/sdk/github-frontend-HCOKL53D.mjs.map +1 -0
  19. package/dist/sdk/{host-GOOVFXW6.mjs → host-SAT6RHDX.mjs} +2 -2
  20. package/dist/sdk/routing-KFYQGOYU.mjs +25 -0
  21. package/dist/sdk/routing-KFYQGOYU.mjs.map +1 -0
  22. package/dist/sdk/schedule-tool-handler-G353DHS6.mjs +38 -0
  23. package/dist/sdk/schedule-tool-handler-G353DHS6.mjs.map +1 -0
  24. package/dist/sdk/{schedule-tool-handler-YTBMLVEA.mjs → schedule-tool-handler-OQF57URO.mjs} +3 -3
  25. package/dist/sdk/schedule-tool-handler-OQF57URO.mjs.map +1 -0
  26. package/dist/sdk/sdk.js +274 -1532
  27. package/dist/sdk/sdk.js.map +1 -1
  28. package/dist/sdk/sdk.mjs +5 -5
  29. package/dist/sdk/trace-helpers-LOPBHYYX.mjs +25 -0
  30. package/dist/sdk/trace-helpers-LOPBHYYX.mjs.map +1 -0
  31. package/dist/sdk/{workflow-check-provider-4SA32BO7.mjs → workflow-check-provider-LRWD52WN.mjs} +3 -3
  32. package/dist/sdk/workflow-check-provider-LRWD52WN.mjs.map +1 -0
  33. package/dist/sdk/workflow-check-provider-N2DRFQDB.mjs +28 -0
  34. package/dist/sdk/workflow-check-provider-N2DRFQDB.mjs.map +1 -0
  35. package/dist/traces/run-2026-02-15T19-14-20-379Z.ndjson +138 -0
  36. package/dist/traces/run-2026-02-15T19-15-09-410Z.ndjson +1357 -0
  37. package/package.json +1 -1
  38. package/dist/sdk/knex-store-HPXJILBL.mjs +0 -411
  39. package/dist/sdk/knex-store-HPXJILBL.mjs.map +0 -1
  40. package/dist/sdk/loader-ID5LMXOW.mjs +0 -89
  41. package/dist/sdk/loader-ID5LMXOW.mjs.map +0 -1
  42. package/dist/sdk/opa-policy-engine-UUPFN5CL.mjs +0 -655
  43. package/dist/sdk/opa-policy-engine-UUPFN5CL.mjs.map +0 -1
  44. package/dist/sdk/validator-XTZJZZJH.mjs +0 -134
  45. package/dist/sdk/validator-XTZJZZJH.mjs.map +0 -1
  46. /package/dist/sdk/{check-provider-registry-FMHECPI4.mjs.map → check-provider-registry-AAPPJ4CP.mjs.map} +0 -0
  47. /package/dist/sdk/{schedule-tool-handler-YTBMLVEA.mjs.map → check-provider-registry-S7BMQ2FC.mjs.map} +0 -0
  48. /package/dist/sdk/{workflow-check-provider-4SA32BO7.mjs.map → failure-condition-evaluator-KN55WXRO.mjs.map} +0 -0
  49. /package/dist/sdk/{host-GOOVFXW6.mjs.map → host-SAT6RHDX.mjs.map} +0 -0
package/dist/index.js CHANGED
@@ -148961,7 +148961,7 @@ async function handleDumpPolicyInput(checkId, argv) {
148961
148961
  let PolicyInputBuilder;
148962
148962
  try {
148963
148963
  // @ts-ignore — enterprise/ may not exist in OSS builds (caught at runtime)
148964
- const mod = await Promise.resolve().then(() => __importStar(__nccwpck_require__(17117)));
148964
+ const mod = await Promise.resolve().then(() => __importStar(__nccwpck_require__(71370)));
148965
148965
  PolicyInputBuilder = mod.PolicyInputBuilder;
148966
148966
  }
148967
148967
  catch {
@@ -154451,1690 +154451,6 @@ class DependencyResolver {
154451
154451
  exports.DependencyResolver = DependencyResolver;
154452
154452
 
154453
154453
 
154454
- /***/ }),
154455
-
154456
- /***/ 50069:
154457
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
154458
-
154459
- "use strict";
154460
-
154461
- /**
154462
- * Copyright (c) ProbeLabs. All rights reserved.
154463
- * Licensed under the Elastic License 2.0; you may not use this file except
154464
- * in compliance with the Elastic License 2.0.
154465
- */
154466
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
154467
- if (k2 === undefined) k2 = k;
154468
- var desc = Object.getOwnPropertyDescriptor(m, k);
154469
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
154470
- desc = { enumerable: true, get: function() { return m[k]; } };
154471
- }
154472
- Object.defineProperty(o, k2, desc);
154473
- }) : (function(o, m, k, k2) {
154474
- if (k2 === undefined) k2 = k;
154475
- o[k2] = m[k];
154476
- }));
154477
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
154478
- Object.defineProperty(o, "default", { enumerable: true, value: v });
154479
- }) : function(o, v) {
154480
- o["default"] = v;
154481
- });
154482
- var __importStar = (this && this.__importStar) || (function () {
154483
- var ownKeys = function(o) {
154484
- ownKeys = Object.getOwnPropertyNames || function (o) {
154485
- var ar = [];
154486
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
154487
- return ar;
154488
- };
154489
- return ownKeys(o);
154490
- };
154491
- return function (mod) {
154492
- if (mod && mod.__esModule) return mod;
154493
- var result = {};
154494
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
154495
- __setModuleDefault(result, mod);
154496
- return result;
154497
- };
154498
- })();
154499
- Object.defineProperty(exports, "__esModule", ({ value: true }));
154500
- exports.LicenseValidator = void 0;
154501
- const crypto = __importStar(__nccwpck_require__(76982));
154502
- const fs = __importStar(__nccwpck_require__(79896));
154503
- const path = __importStar(__nccwpck_require__(16928));
154504
- class LicenseValidator {
154505
- /** Ed25519 public key for license verification (PEM format). */
154506
- static PUBLIC_KEY = '-----BEGIN PUBLIC KEY-----\n' +
154507
- 'MCowBQYDK2VwAyEAI/Zd08EFmgIdrDm/HXd0l3/5GBt7R1PrdvhdmEXhJlU=\n' +
154508
- '-----END PUBLIC KEY-----\n';
154509
- cache = null;
154510
- static CACHE_TTL = 5 * 60 * 1000; // 5 minutes
154511
- static GRACE_PERIOD = 72 * 3600 * 1000; // 72 hours after expiry
154512
- /**
154513
- * Load and validate license from environment or file.
154514
- *
154515
- * Resolution order:
154516
- * 1. VISOR_LICENSE env var (JWT string)
154517
- * 2. VISOR_LICENSE_FILE env var (path to file)
154518
- * 3. .visor-license in project root (cwd)
154519
- * 4. .visor-license in ~/.config/visor/
154520
- */
154521
- async loadAndValidate() {
154522
- // Return cached result if still fresh
154523
- if (this.cache && Date.now() - this.cache.validatedAt < LicenseValidator.CACHE_TTL) {
154524
- return this.cache.payload;
154525
- }
154526
- const token = this.resolveToken();
154527
- if (!token)
154528
- return null;
154529
- const payload = this.verifyAndDecode(token);
154530
- if (!payload)
154531
- return null;
154532
- this.cache = { payload, validatedAt: Date.now() };
154533
- return payload;
154534
- }
154535
- /** Check if a specific feature is licensed */
154536
- hasFeature(feature) {
154537
- if (!this.cache)
154538
- return false;
154539
- return this.cache.payload.features.includes(feature);
154540
- }
154541
- /** Check if license is valid (with grace period) */
154542
- isValid() {
154543
- if (!this.cache)
154544
- return false;
154545
- const now = Date.now();
154546
- const expiryMs = this.cache.payload.exp * 1000;
154547
- return now < expiryMs + LicenseValidator.GRACE_PERIOD;
154548
- }
154549
- /** Check if the license is within its grace period (expired but still valid) */
154550
- isInGracePeriod() {
154551
- if (!this.cache)
154552
- return false;
154553
- const now = Date.now();
154554
- const expiryMs = this.cache.payload.exp * 1000;
154555
- return now >= expiryMs && now < expiryMs + LicenseValidator.GRACE_PERIOD;
154556
- }
154557
- resolveToken() {
154558
- // 1. Direct env var
154559
- if (process.env.VISOR_LICENSE) {
154560
- return process.env.VISOR_LICENSE.trim();
154561
- }
154562
- // 2. File path from env (validate against path traversal)
154563
- if (process.env.VISOR_LICENSE_FILE) {
154564
- // path.resolve() produces an absolute path with all '..' segments resolved,
154565
- // so a separate resolved.includes('..') check is unnecessary.
154566
- const resolved = path.resolve(process.env.VISOR_LICENSE_FILE);
154567
- const home = process.env.HOME || process.env.USERPROFILE || '';
154568
- const allowedPrefixes = [path.normalize(process.cwd())];
154569
- if (home)
154570
- allowedPrefixes.push(path.normalize(path.join(home, '.config', 'visor')));
154571
- // Resolve symlinks so an attacker cannot create a symlink inside an
154572
- // allowed prefix that points to an arbitrary file outside it.
154573
- let realPath;
154574
- try {
154575
- realPath = fs.realpathSync(resolved);
154576
- }
154577
- catch {
154578
- return null; // File doesn't exist or isn't accessible
154579
- }
154580
- const isSafe = allowedPrefixes.some(prefix => realPath === prefix || realPath.startsWith(prefix + path.sep));
154581
- if (!isSafe)
154582
- return null;
154583
- return this.readFile(realPath);
154584
- }
154585
- // 3. .visor-license in cwd
154586
- const cwdPath = path.join(process.cwd(), '.visor-license');
154587
- const cwdToken = this.readFile(cwdPath);
154588
- if (cwdToken)
154589
- return cwdToken;
154590
- // 4. ~/.config/visor/.visor-license
154591
- const home = process.env.HOME || process.env.USERPROFILE || '';
154592
- if (home) {
154593
- const configPath = path.join(home, '.config', 'visor', '.visor-license');
154594
- const configToken = this.readFile(configPath);
154595
- if (configToken)
154596
- return configToken;
154597
- }
154598
- return null;
154599
- }
154600
- readFile(filePath) {
154601
- try {
154602
- return fs.readFileSync(filePath, 'utf-8').trim();
154603
- }
154604
- catch {
154605
- return null;
154606
- }
154607
- }
154608
- verifyAndDecode(token) {
154609
- try {
154610
- const parts = token.split('.');
154611
- if (parts.length !== 3)
154612
- return null;
154613
- const [headerB64, payloadB64, signatureB64] = parts;
154614
- // Decode header to verify algorithm
154615
- const header = JSON.parse(Buffer.from(headerB64, 'base64url').toString());
154616
- if (header.alg !== 'EdDSA')
154617
- return null;
154618
- // Verify signature
154619
- const data = `${headerB64}.${payloadB64}`;
154620
- const signature = Buffer.from(signatureB64, 'base64url');
154621
- const publicKey = crypto.createPublicKey(LicenseValidator.PUBLIC_KEY);
154622
- // Validate that the loaded public key is actually Ed25519 (OID 1.3.101.112).
154623
- // This prevents algorithm-confusion attacks if the embedded key were ever
154624
- // swapped to a different type.
154625
- if (publicKey.asymmetricKeyType !== 'ed25519') {
154626
- return null;
154627
- }
154628
- // Ed25519 verification: algorithm must be null because EdDSA performs its
154629
- // own internal hashing (SHA-512) — passing a digest algorithm here would
154630
- // cause Node.js to throw. The key type is validated above.
154631
- const isValid = crypto.verify(null, Buffer.from(data), publicKey, signature);
154632
- if (!isValid)
154633
- return null;
154634
- // Decode payload
154635
- const payload = JSON.parse(Buffer.from(payloadB64, 'base64url').toString());
154636
- // Validate required fields
154637
- if (!payload.org ||
154638
- !Array.isArray(payload.features) ||
154639
- typeof payload.exp !== 'number' ||
154640
- typeof payload.iat !== 'number' ||
154641
- !payload.sub) {
154642
- return null;
154643
- }
154644
- // Check expiry (with grace period)
154645
- const now = Date.now();
154646
- const expiryMs = payload.exp * 1000;
154647
- if (now >= expiryMs + LicenseValidator.GRACE_PERIOD) {
154648
- return null;
154649
- }
154650
- return payload;
154651
- }
154652
- catch {
154653
- return null;
154654
- }
154655
- }
154656
- }
154657
- exports.LicenseValidator = LicenseValidator;
154658
-
154659
-
154660
- /***/ }),
154661
-
154662
- /***/ 87068:
154663
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
154664
-
154665
- "use strict";
154666
-
154667
- /**
154668
- * Copyright (c) ProbeLabs. All rights reserved.
154669
- * Licensed under the Elastic License 2.0; you may not use this file except
154670
- * in compliance with the Elastic License 2.0.
154671
- */
154672
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
154673
- if (k2 === undefined) k2 = k;
154674
- var desc = Object.getOwnPropertyDescriptor(m, k);
154675
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
154676
- desc = { enumerable: true, get: function() { return m[k]; } };
154677
- }
154678
- Object.defineProperty(o, k2, desc);
154679
- }) : (function(o, m, k, k2) {
154680
- if (k2 === undefined) k2 = k;
154681
- o[k2] = m[k];
154682
- }));
154683
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
154684
- Object.defineProperty(o, "default", { enumerable: true, value: v });
154685
- }) : function(o, v) {
154686
- o["default"] = v;
154687
- });
154688
- var __importStar = (this && this.__importStar) || (function () {
154689
- var ownKeys = function(o) {
154690
- ownKeys = Object.getOwnPropertyNames || function (o) {
154691
- var ar = [];
154692
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
154693
- return ar;
154694
- };
154695
- return ownKeys(o);
154696
- };
154697
- return function (mod) {
154698
- if (mod && mod.__esModule) return mod;
154699
- var result = {};
154700
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
154701
- __setModuleDefault(result, mod);
154702
- return result;
154703
- };
154704
- })();
154705
- Object.defineProperty(exports, "__esModule", ({ value: true }));
154706
- exports.loadEnterprisePolicyEngine = loadEnterprisePolicyEngine;
154707
- exports.loadEnterpriseStoreBackend = loadEnterpriseStoreBackend;
154708
- const default_engine_1 = __nccwpck_require__(93866);
154709
- /**
154710
- * Load the enterprise policy engine if licensed, otherwise return the default no-op engine.
154711
- *
154712
- * This is the sole import boundary between OSS and enterprise code. Core code
154713
- * must only import from this module (via dynamic `await import()`), never from
154714
- * individual enterprise submodules.
154715
- */
154716
- async function loadEnterprisePolicyEngine(config) {
154717
- try {
154718
- const { LicenseValidator } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(50069)));
154719
- const validator = new LicenseValidator();
154720
- const license = await validator.loadAndValidate();
154721
- if (!license || !validator.hasFeature('policy')) {
154722
- return new default_engine_1.DefaultPolicyEngine();
154723
- }
154724
- if (validator.isInGracePeriod()) {
154725
- // eslint-disable-next-line no-console
154726
- console.warn('[visor:enterprise] License has expired but is within the 72-hour grace period. ' +
154727
- 'Please renew your license.');
154728
- }
154729
- const { OpaPolicyEngine } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(39530)));
154730
- const engine = new OpaPolicyEngine(config);
154731
- await engine.initialize(config);
154732
- return engine;
154733
- }
154734
- catch (err) {
154735
- // Enterprise code not available or initialization failed
154736
- const msg = err instanceof Error ? err.message : String(err);
154737
- try {
154738
- const { logger } = __nccwpck_require__(86999);
154739
- logger.warn(`[PolicyEngine] Enterprise policy init failed, falling back to default: ${msg}`);
154740
- }
154741
- catch {
154742
- // silent
154743
- }
154744
- return new default_engine_1.DefaultPolicyEngine();
154745
- }
154746
- }
154747
- /**
154748
- * Load the enterprise schedule store backend if licensed.
154749
- *
154750
- * @param driver Database driver ('postgresql', 'mysql', or 'mssql')
154751
- * @param storageConfig Storage configuration with connection details
154752
- * @param haConfig Optional HA configuration
154753
- * @throws Error if enterprise license is not available or missing 'scheduler-sql' feature
154754
- */
154755
- async function loadEnterpriseStoreBackend(driver, storageConfig, haConfig) {
154756
- const { LicenseValidator } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(50069)));
154757
- const validator = new LicenseValidator();
154758
- const license = await validator.loadAndValidate();
154759
- if (!license || !validator.hasFeature('scheduler-sql')) {
154760
- throw new Error(`The ${driver} schedule storage driver requires a Visor Enterprise license ` +
154761
- `with the 'scheduler-sql' feature. Please upgrade or use driver: 'sqlite' (default).`);
154762
- }
154763
- if (validator.isInGracePeriod()) {
154764
- // eslint-disable-next-line no-console
154765
- console.warn('[visor:enterprise] License has expired but is within the 72-hour grace period. ' +
154766
- 'Please renew your license.');
154767
- }
154768
- const { KnexStoreBackend } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(63737)));
154769
- return new KnexStoreBackend(driver, storageConfig, haConfig);
154770
- }
154771
-
154772
-
154773
- /***/ }),
154774
-
154775
- /***/ 628:
154776
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
154777
-
154778
- "use strict";
154779
-
154780
- /**
154781
- * Copyright (c) ProbeLabs. All rights reserved.
154782
- * Licensed under the Elastic License 2.0; you may not use this file except
154783
- * in compliance with the Elastic License 2.0.
154784
- */
154785
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
154786
- if (k2 === undefined) k2 = k;
154787
- var desc = Object.getOwnPropertyDescriptor(m, k);
154788
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
154789
- desc = { enumerable: true, get: function() { return m[k]; } };
154790
- }
154791
- Object.defineProperty(o, k2, desc);
154792
- }) : (function(o, m, k, k2) {
154793
- if (k2 === undefined) k2 = k;
154794
- o[k2] = m[k];
154795
- }));
154796
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
154797
- Object.defineProperty(o, "default", { enumerable: true, value: v });
154798
- }) : function(o, v) {
154799
- o["default"] = v;
154800
- });
154801
- var __importStar = (this && this.__importStar) || (function () {
154802
- var ownKeys = function(o) {
154803
- ownKeys = Object.getOwnPropertyNames || function (o) {
154804
- var ar = [];
154805
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
154806
- return ar;
154807
- };
154808
- return ownKeys(o);
154809
- };
154810
- return function (mod) {
154811
- if (mod && mod.__esModule) return mod;
154812
- var result = {};
154813
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
154814
- __setModuleDefault(result, mod);
154815
- return result;
154816
- };
154817
- })();
154818
- Object.defineProperty(exports, "__esModule", ({ value: true }));
154819
- exports.OpaCompiler = void 0;
154820
- const fs = __importStar(__nccwpck_require__(79896));
154821
- const path = __importStar(__nccwpck_require__(16928));
154822
- const os = __importStar(__nccwpck_require__(70857));
154823
- const crypto = __importStar(__nccwpck_require__(76982));
154824
- const child_process_1 = __nccwpck_require__(35317);
154825
- /**
154826
- * OPA Rego Compiler - compiles .rego policy files to WASM bundles using the `opa` CLI.
154827
- *
154828
- * Handles:
154829
- * - Resolving input paths to WASM bytes (direct .wasm, directory with policy.wasm, or .rego files)
154830
- * - Compiling .rego files to WASM via `opa build`
154831
- * - Caching compiled bundles based on content hashes
154832
- * - Extracting policy.wasm from OPA tar.gz bundles
154833
- *
154834
- * Requires:
154835
- * - `opa` CLI on PATH (only when auto-compiling .rego files)
154836
- */
154837
- class OpaCompiler {
154838
- static CACHE_DIR = path.join(os.tmpdir(), 'visor-opa-cache');
154839
- /**
154840
- * Resolve the input paths to WASM bytes.
154841
- *
154842
- * Strategy:
154843
- * 1. If any path is a .wasm file, read it directly
154844
- * 2. If a directory contains policy.wasm, read it
154845
- * 3. Otherwise, collect all .rego files and auto-compile via `opa build`
154846
- */
154847
- async resolveWasmBytes(paths) {
154848
- // Collect .rego files and check for existing .wasm
154849
- const regoFiles = [];
154850
- for (const p of paths) {
154851
- const resolved = path.resolve(p);
154852
- // Reject paths containing '..' after resolution (path traversal)
154853
- if (path.normalize(resolved).includes('..')) {
154854
- throw new Error(`Policy path contains traversal sequences: ${p}`);
154855
- }
154856
- // Direct .wasm file
154857
- if (resolved.endsWith('.wasm') && fs.existsSync(resolved)) {
154858
- return fs.readFileSync(resolved);
154859
- }
154860
- if (!fs.existsSync(resolved))
154861
- continue;
154862
- const stat = fs.statSync(resolved);
154863
- if (stat.isDirectory()) {
154864
- // Check for pre-compiled policy.wasm in directory
154865
- const wasmCandidate = path.join(resolved, 'policy.wasm');
154866
- if (fs.existsSync(wasmCandidate)) {
154867
- return fs.readFileSync(wasmCandidate);
154868
- }
154869
- // Collect all .rego files from directory
154870
- const files = fs.readdirSync(resolved);
154871
- for (const f of files) {
154872
- if (f.endsWith('.rego')) {
154873
- regoFiles.push(path.join(resolved, f));
154874
- }
154875
- }
154876
- }
154877
- else if (resolved.endsWith('.rego')) {
154878
- regoFiles.push(resolved);
154879
- }
154880
- }
154881
- if (regoFiles.length === 0) {
154882
- throw new Error(`OPA WASM evaluator: no .wasm bundle or .rego files found in: ${paths.join(', ')}`);
154883
- }
154884
- // Auto-compile .rego -> .wasm
154885
- return this.compileRego(regoFiles);
154886
- }
154887
- /**
154888
- * Auto-compile .rego files to a WASM bundle using the `opa` CLI.
154889
- *
154890
- * Caches the compiled bundle based on a content hash of all input .rego files
154891
- * so subsequent runs skip compilation if policies haven't changed.
154892
- */
154893
- compileRego(regoFiles) {
154894
- // Check that `opa` CLI is available
154895
- try {
154896
- (0, child_process_1.execFileSync)('opa', ['version'], { stdio: 'pipe' });
154897
- }
154898
- catch {
154899
- throw new Error('OPA CLI (`opa`) not found on PATH. Install it from https://www.openpolicyagent.org/docs/latest/#running-opa\n' +
154900
- 'Or pre-compile your .rego files: opa build -t wasm -e visor -o bundle.tar.gz ' +
154901
- regoFiles.join(' '));
154902
- }
154903
- // Compute content hash for cache key
154904
- const hash = crypto.createHash('sha256');
154905
- for (const f of regoFiles.sort()) {
154906
- hash.update(fs.readFileSync(f));
154907
- hash.update(f); // include filename for disambiguation
154908
- }
154909
- const cacheKey = hash.digest('hex').slice(0, 16);
154910
- const cacheDir = OpaCompiler.CACHE_DIR;
154911
- const cachedWasm = path.join(cacheDir, `${cacheKey}.wasm`);
154912
- // Return cached bundle if still valid
154913
- if (fs.existsSync(cachedWasm)) {
154914
- return fs.readFileSync(cachedWasm);
154915
- }
154916
- // Compile to WASM via opa build
154917
- fs.mkdirSync(cacheDir, { recursive: true });
154918
- const bundleTar = path.join(cacheDir, `${cacheKey}-bundle.tar.gz`);
154919
- try {
154920
- const args = [
154921
- 'build',
154922
- '-t',
154923
- 'wasm',
154924
- '-e',
154925
- 'visor', // entrypoint: the visor package tree
154926
- '-o',
154927
- bundleTar,
154928
- ...regoFiles,
154929
- ];
154930
- (0, child_process_1.execFileSync)('opa', args, {
154931
- stdio: 'pipe',
154932
- timeout: 30000,
154933
- });
154934
- }
154935
- catch (err) {
154936
- const stderr = err?.stderr?.toString() || '';
154937
- throw new Error(`Failed to compile .rego files to WASM:\n${stderr}\n` +
154938
- 'Ensure your .rego files are valid and the `opa` CLI is installed.');
154939
- }
154940
- // Extract policy.wasm from the tar.gz bundle
154941
- // OPA bundles are tar.gz with /policy.wasm inside
154942
- try {
154943
- (0, child_process_1.execFileSync)('tar', ['-xzf', bundleTar, '-C', cacheDir, '/policy.wasm'], {
154944
- stdio: 'pipe',
154945
- });
154946
- const extractedWasm = path.join(cacheDir, 'policy.wasm');
154947
- if (fs.existsSync(extractedWasm)) {
154948
- // Move to cache-key named file
154949
- fs.renameSync(extractedWasm, cachedWasm);
154950
- }
154951
- }
154952
- catch {
154953
- // Some tar implementations don't like leading /
154954
- try {
154955
- (0, child_process_1.execFileSync)('tar', ['-xzf', bundleTar, '-C', cacheDir, 'policy.wasm'], {
154956
- stdio: 'pipe',
154957
- });
154958
- const extractedWasm = path.join(cacheDir, 'policy.wasm');
154959
- if (fs.existsSync(extractedWasm)) {
154960
- fs.renameSync(extractedWasm, cachedWasm);
154961
- }
154962
- }
154963
- catch (err2) {
154964
- throw new Error(`Failed to extract policy.wasm from OPA bundle: ${err2?.message || err2}`);
154965
- }
154966
- }
154967
- // Clean up tar
154968
- try {
154969
- fs.unlinkSync(bundleTar);
154970
- }
154971
- catch { }
154972
- if (!fs.existsSync(cachedWasm)) {
154973
- throw new Error('OPA build succeeded but policy.wasm was not found in the bundle');
154974
- }
154975
- return fs.readFileSync(cachedWasm);
154976
- }
154977
- }
154978
- exports.OpaCompiler = OpaCompiler;
154979
-
154980
-
154981
- /***/ }),
154982
-
154983
- /***/ 44693:
154984
- /***/ ((__unused_webpack_module, exports) => {
154985
-
154986
- "use strict";
154987
-
154988
- /**
154989
- * Copyright (c) ProbeLabs. All rights reserved.
154990
- * Licensed under the Elastic License 2.0; you may not use this file except
154991
- * in compliance with the Elastic License 2.0.
154992
- */
154993
- Object.defineProperty(exports, "__esModule", ({ value: true }));
154994
- exports.OpaHttpEvaluator = void 0;
154995
- /**
154996
- * OPA HTTP Evaluator - evaluates policies via an external OPA server's REST API.
154997
- *
154998
- * Uses the built-in `fetch` API (Node 18+), so no extra dependencies are needed.
154999
- */
155000
- class OpaHttpEvaluator {
155001
- baseUrl;
155002
- timeout;
155003
- constructor(baseUrl, timeout = 5000) {
155004
- // Validate URL format and protocol
155005
- let parsed;
155006
- try {
155007
- parsed = new URL(baseUrl);
155008
- }
155009
- catch {
155010
- throw new Error(`OPA HTTP evaluator: invalid URL: ${baseUrl}`);
155011
- }
155012
- if (!['http:', 'https:'].includes(parsed.protocol)) {
155013
- throw new Error(`OPA HTTP evaluator: url must use http:// or https:// protocol, got: ${baseUrl}`);
155014
- }
155015
- // Block cloud metadata, loopback, link-local, and private network addresses
155016
- const hostname = parsed.hostname;
155017
- if (this.isBlockedHostname(hostname)) {
155018
- throw new Error(`OPA HTTP evaluator: url must not point to internal, loopback, or private network addresses`);
155019
- }
155020
- // Normalize: strip trailing slash
155021
- this.baseUrl = baseUrl.replace(/\/+$/, '');
155022
- this.timeout = timeout;
155023
- }
155024
- /**
155025
- * Check if a hostname is blocked due to SSRF concerns.
155026
- *
155027
- * Blocks:
155028
- * - Loopback addresses (127.x.x.x, localhost, 0.0.0.0, ::1)
155029
- * - Link-local addresses (169.254.x.x)
155030
- * - Private networks (10.x.x.x, 172.16-31.x.x, 192.168.x.x)
155031
- * - IPv6 unique local addresses (fd00::/8)
155032
- * - Cloud metadata services (*.internal)
155033
- */
155034
- isBlockedHostname(hostname) {
155035
- if (!hostname)
155036
- return true; // block empty hostnames
155037
- // Normalize hostname: lowercase and remove brackets for IPv6
155038
- const normalized = hostname.toLowerCase().replace(/^\[|\]$/g, '');
155039
- // Block .internal domains (cloud metadata services)
155040
- if (normalized === 'metadata.google.internal' || normalized.endsWith('.internal')) {
155041
- return true;
155042
- }
155043
- // Block localhost variants
155044
- if (normalized === 'localhost' || normalized === 'localhost.localdomain') {
155045
- return true;
155046
- }
155047
- // Block IPv6 loopback
155048
- if (normalized === '::1' || normalized === '0:0:0:0:0:0:0:1') {
155049
- return true;
155050
- }
155051
- // Check IPv4 patterns
155052
- const ipv4Pattern = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
155053
- const ipv4Match = normalized.match(ipv4Pattern);
155054
- if (ipv4Match) {
155055
- const octets = ipv4Match.slice(1, 5).map(Number);
155056
- // Validate octets are in range [0, 255]
155057
- if (octets.some(octet => octet > 255)) {
155058
- return false;
155059
- }
155060
- const [a, b] = octets;
155061
- // Block loopback: 127.0.0.0/8
155062
- if (a === 127) {
155063
- return true;
155064
- }
155065
- // Block 0.0.0.0/8 (this host)
155066
- if (a === 0) {
155067
- return true;
155068
- }
155069
- // Block link-local: 169.254.0.0/16
155070
- if (a === 169 && b === 254) {
155071
- return true;
155072
- }
155073
- // Block private networks
155074
- // 10.0.0.0/8
155075
- if (a === 10) {
155076
- return true;
155077
- }
155078
- // 172.16.0.0/12 (172.16.x.x through 172.31.x.x)
155079
- if (a === 172 && b >= 16 && b <= 31) {
155080
- return true;
155081
- }
155082
- // 192.168.0.0/16
155083
- if (a === 192 && b === 168) {
155084
- return true;
155085
- }
155086
- }
155087
- // Check IPv6 patterns
155088
- // Block unique local addresses: fd00::/8
155089
- if (normalized.startsWith('fd') || normalized.startsWith('fc')) {
155090
- return true;
155091
- }
155092
- // Block link-local: fe80::/10
155093
- if (normalized.startsWith('fe80:')) {
155094
- return true;
155095
- }
155096
- return false;
155097
- }
155098
- /**
155099
- * Evaluate a policy rule against an input document via OPA REST API.
155100
- *
155101
- * @param input - The input document to evaluate
155102
- * @param rulePath - OPA rule path (e.g., 'visor/check/execute')
155103
- * @returns The result object from OPA, or undefined on error
155104
- */
155105
- async evaluate(input, rulePath) {
155106
- // OPA Data API: POST /v1/data/<path>
155107
- const encodedPath = rulePath
155108
- .split('/')
155109
- .map(s => encodeURIComponent(s))
155110
- .join('/');
155111
- const url = `${this.baseUrl}/v1/data/${encodedPath}`;
155112
- const controller = new AbortController();
155113
- const timer = setTimeout(() => controller.abort(), this.timeout);
155114
- try {
155115
- const response = await fetch(url, {
155116
- method: 'POST',
155117
- headers: { 'Content-Type': 'application/json' },
155118
- body: JSON.stringify({ input }),
155119
- signal: controller.signal,
155120
- });
155121
- if (!response.ok) {
155122
- throw new Error(`OPA HTTP ${response.status}: ${response.statusText}`);
155123
- }
155124
- let body;
155125
- try {
155126
- body = await response.json();
155127
- }
155128
- catch (jsonErr) {
155129
- throw new Error(`OPA HTTP evaluator: failed to parse JSON response: ${jsonErr instanceof Error ? jsonErr.message : String(jsonErr)}`);
155130
- }
155131
- // OPA returns { result: { ... } }
155132
- return body?.result;
155133
- }
155134
- finally {
155135
- clearTimeout(timer);
155136
- }
155137
- }
155138
- async shutdown() {
155139
- // No persistent connections to close
155140
- }
155141
- }
155142
- exports.OpaHttpEvaluator = OpaHttpEvaluator;
155143
-
155144
-
155145
- /***/ }),
155146
-
155147
- /***/ 39530:
155148
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
155149
-
155150
- "use strict";
155151
-
155152
- /**
155153
- * Copyright (c) ProbeLabs. All rights reserved.
155154
- * Licensed under the Elastic License 2.0; you may not use this file except
155155
- * in compliance with the Elastic License 2.0.
155156
- */
155157
- Object.defineProperty(exports, "__esModule", ({ value: true }));
155158
- exports.OpaPolicyEngine = void 0;
155159
- const opa_wasm_evaluator_1 = __nccwpck_require__(8613);
155160
- const opa_http_evaluator_1 = __nccwpck_require__(44693);
155161
- const policy_input_builder_1 = __nccwpck_require__(17117);
155162
- /**
155163
- * Enterprise OPA Policy Engine.
155164
- *
155165
- * Wraps both WASM (local) and HTTP (remote) OPA evaluators behind the
155166
- * OSS PolicyEngine interface. All OPA input building and role resolution
155167
- * is handled internally — the OSS call sites pass only plain types.
155168
- */
155169
- class OpaPolicyEngine {
155170
- evaluator = null;
155171
- fallback;
155172
- timeout;
155173
- config;
155174
- inputBuilder = null;
155175
- logger = null;
155176
- constructor(config) {
155177
- this.config = config;
155178
- this.fallback = config.fallback || 'deny';
155179
- this.timeout = config.timeout || 5000;
155180
- }
155181
- async initialize(config) {
155182
- // Resolve logger once at initialization
155183
- try {
155184
- this.logger = (__nccwpck_require__(86999).logger);
155185
- }
155186
- catch {
155187
- // logger not available in this context
155188
- }
155189
- // Build actor/repo context from environment (available at engine init time)
155190
- const actor = {
155191
- authorAssociation: process.env.VISOR_AUTHOR_ASSOCIATION,
155192
- login: process.env.VISOR_AUTHOR_LOGIN || process.env.GITHUB_ACTOR,
155193
- isLocalMode: !process.env.GITHUB_ACTIONS,
155194
- };
155195
- const repo = {
155196
- owner: process.env.GITHUB_REPOSITORY_OWNER,
155197
- name: process.env.GITHUB_REPOSITORY?.split('/')[1],
155198
- branch: process.env.GITHUB_HEAD_REF,
155199
- baseBranch: process.env.GITHUB_BASE_REF,
155200
- event: process.env.GITHUB_EVENT_NAME,
155201
- };
155202
- const prNum = process.env.GITHUB_PR_NUMBER
155203
- ? parseInt(process.env.GITHUB_PR_NUMBER, 10)
155204
- : undefined;
155205
- const pullRequest = {
155206
- number: prNum !== undefined && Number.isFinite(prNum) ? prNum : undefined,
155207
- };
155208
- this.inputBuilder = new policy_input_builder_1.PolicyInputBuilder(config, actor, repo, pullRequest);
155209
- if (config.engine === 'local') {
155210
- if (!config.rules) {
155211
- throw new Error('OPA local mode requires `policy.rules` path to .wasm or .rego files');
155212
- }
155213
- const wasm = new opa_wasm_evaluator_1.OpaWasmEvaluator();
155214
- await wasm.initialize(config.rules);
155215
- if (config.data) {
155216
- wasm.loadData(config.data);
155217
- }
155218
- this.evaluator = wasm;
155219
- }
155220
- else if (config.engine === 'remote') {
155221
- if (!config.url) {
155222
- throw new Error('OPA remote mode requires `policy.url` pointing to OPA server');
155223
- }
155224
- this.evaluator = new opa_http_evaluator_1.OpaHttpEvaluator(config.url, this.timeout);
155225
- }
155226
- else {
155227
- this.evaluator = null;
155228
- }
155229
- }
155230
- /**
155231
- * Update actor/repo/PR context (e.g., after PR info becomes available).
155232
- * Called by the enterprise loader when engine context is enriched.
155233
- */
155234
- setActorContext(actor, repo, pullRequest) {
155235
- this.inputBuilder = new policy_input_builder_1.PolicyInputBuilder(this.config, actor, repo, pullRequest);
155236
- }
155237
- async evaluateCheckExecution(checkId, checkConfig) {
155238
- if (!this.evaluator || !this.inputBuilder)
155239
- return { allowed: true };
155240
- const cfg = checkConfig && typeof checkConfig === 'object'
155241
- ? checkConfig
155242
- : {};
155243
- const policyOverride = cfg.policy;
155244
- const input = this.inputBuilder.forCheckExecution({
155245
- id: checkId,
155246
- type: cfg.type || 'ai',
155247
- group: cfg.group,
155248
- tags: cfg.tags,
155249
- criticality: cfg.criticality,
155250
- sandbox: cfg.sandbox,
155251
- policy: policyOverride,
155252
- });
155253
- return this.doEvaluate(input, this.resolveRulePath('check.execute', policyOverride?.rule));
155254
- }
155255
- async evaluateToolInvocation(serverName, methodName, transport) {
155256
- if (!this.evaluator || !this.inputBuilder)
155257
- return { allowed: true };
155258
- const input = this.inputBuilder.forToolInvocation(serverName, methodName, transport);
155259
- return this.doEvaluate(input, 'visor/tool/invoke');
155260
- }
155261
- async evaluateCapabilities(checkId, capabilities) {
155262
- if (!this.evaluator || !this.inputBuilder)
155263
- return { allowed: true };
155264
- const input = this.inputBuilder.forCapabilityResolve(checkId, capabilities);
155265
- return this.doEvaluate(input, 'visor/capability/resolve');
155266
- }
155267
- async shutdown() {
155268
- if (this.evaluator && 'shutdown' in this.evaluator) {
155269
- await this.evaluator.shutdown();
155270
- }
155271
- this.evaluator = null;
155272
- this.inputBuilder = null;
155273
- }
155274
- resolveRulePath(defaultScope, override) {
155275
- if (override) {
155276
- return override.startsWith('visor/') ? override : `visor/${override}`;
155277
- }
155278
- return `visor/${defaultScope.replace(/\./g, '/')}`;
155279
- }
155280
- async doEvaluate(input, rulePath) {
155281
- try {
155282
- this.logger?.debug(`[PolicyEngine] Evaluating ${rulePath}`, JSON.stringify(input));
155283
- let timer;
155284
- const timeoutPromise = new Promise((_resolve, reject) => {
155285
- timer = setTimeout(() => reject(new Error('policy evaluation timeout')), this.timeout);
155286
- });
155287
- try {
155288
- const result = await Promise.race([this.rawEvaluate(input, rulePath), timeoutPromise]);
155289
- const decision = this.parseDecision(result);
155290
- // In warn mode, override denied decisions to allowed but flag as warn
155291
- if (!decision.allowed && this.fallback === 'warn') {
155292
- decision.allowed = true;
155293
- decision.warn = true;
155294
- decision.reason = `audit: ${decision.reason || 'policy denied'}`;
155295
- }
155296
- this.logger?.debug(`[PolicyEngine] Decision for ${rulePath}: allowed=${decision.allowed}, warn=${decision.warn || false}, reason=${decision.reason || 'none'}`);
155297
- return decision;
155298
- }
155299
- finally {
155300
- if (timer)
155301
- clearTimeout(timer);
155302
- }
155303
- }
155304
- catch (err) {
155305
- const msg = err instanceof Error ? err.message : String(err);
155306
- this.logger?.warn(`[PolicyEngine] Evaluation failed for ${rulePath}: ${msg}`);
155307
- return {
155308
- allowed: this.fallback === 'allow' || this.fallback === 'warn',
155309
- warn: this.fallback === 'warn' ? true : undefined,
155310
- reason: `policy evaluation failed, fallback=${this.fallback}`,
155311
- };
155312
- }
155313
- }
155314
- async rawEvaluate(input, rulePath) {
155315
- if (this.evaluator instanceof opa_wasm_evaluator_1.OpaWasmEvaluator) {
155316
- const result = await this.evaluator.evaluate(input);
155317
- // WASM compiled with `-e visor` entrypoint returns the full visor package tree.
155318
- // Navigate to the specific rule subtree using rulePath segments.
155319
- // e.g., 'visor/check/execute' → result.check.execute
155320
- return this.navigateWasmResult(result, rulePath);
155321
- }
155322
- return this.evaluator.evaluate(input, rulePath);
155323
- }
155324
- /**
155325
- * Navigate nested OPA WASM result tree to reach the specific rule's output.
155326
- * The WASM entrypoint `-e visor` means the result root IS the visor package,
155327
- * so we strip the `visor/` prefix and walk the remaining segments.
155328
- */
155329
- navigateWasmResult(result, rulePath) {
155330
- if (!result || typeof result !== 'object')
155331
- return result;
155332
- // Strip the 'visor/' prefix (matches our compilation entrypoint)
155333
- const segments = rulePath.replace(/^visor\//, '').split('/');
155334
- let current = result;
155335
- for (const seg of segments) {
155336
- if (current && typeof current === 'object' && seg in current) {
155337
- current = current[seg];
155338
- }
155339
- else {
155340
- return undefined; // path not found in result tree
155341
- }
155342
- }
155343
- return current;
155344
- }
155345
- parseDecision(result) {
155346
- if (result === undefined || result === null) {
155347
- return {
155348
- allowed: this.fallback === 'allow' || this.fallback === 'warn',
155349
- warn: this.fallback === 'warn' ? true : undefined,
155350
- reason: this.fallback === 'warn' ? 'audit: no policy result' : 'no policy result',
155351
- };
155352
- }
155353
- const allowed = result.allowed !== false;
155354
- const decision = {
155355
- allowed,
155356
- reason: result.reason,
155357
- };
155358
- if (result.capabilities) {
155359
- decision.capabilities = result.capabilities;
155360
- }
155361
- return decision;
155362
- }
155363
- }
155364
- exports.OpaPolicyEngine = OpaPolicyEngine;
155365
-
155366
-
155367
- /***/ }),
155368
-
155369
- /***/ 8613:
155370
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
155371
-
155372
- "use strict";
155373
-
155374
- /**
155375
- * Copyright (c) ProbeLabs. All rights reserved.
155376
- * Licensed under the Elastic License 2.0; you may not use this file except
155377
- * in compliance with the Elastic License 2.0.
155378
- */
155379
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
155380
- if (k2 === undefined) k2 = k;
155381
- var desc = Object.getOwnPropertyDescriptor(m, k);
155382
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
155383
- desc = { enumerable: true, get: function() { return m[k]; } };
155384
- }
155385
- Object.defineProperty(o, k2, desc);
155386
- }) : (function(o, m, k, k2) {
155387
- if (k2 === undefined) k2 = k;
155388
- o[k2] = m[k];
155389
- }));
155390
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
155391
- Object.defineProperty(o, "default", { enumerable: true, value: v });
155392
- }) : function(o, v) {
155393
- o["default"] = v;
155394
- });
155395
- var __importStar = (this && this.__importStar) || (function () {
155396
- var ownKeys = function(o) {
155397
- ownKeys = Object.getOwnPropertyNames || function (o) {
155398
- var ar = [];
155399
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
155400
- return ar;
155401
- };
155402
- return ownKeys(o);
155403
- };
155404
- return function (mod) {
155405
- if (mod && mod.__esModule) return mod;
155406
- var result = {};
155407
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
155408
- __setModuleDefault(result, mod);
155409
- return result;
155410
- };
155411
- })();
155412
- Object.defineProperty(exports, "__esModule", ({ value: true }));
155413
- exports.OpaWasmEvaluator = void 0;
155414
- const fs = __importStar(__nccwpck_require__(79896));
155415
- const path = __importStar(__nccwpck_require__(16928));
155416
- const opa_compiler_1 = __nccwpck_require__(628);
155417
- /**
155418
- * OPA WASM Evaluator - loads and evaluates OPA policies locally.
155419
- *
155420
- * Supports three input formats:
155421
- * 1. Pre-compiled `.wasm` bundle — loaded directly (fastest startup)
155422
- * 2. `.rego` files or directory — auto-compiled to WASM via `opa build` CLI
155423
- * 3. Directory with `policy.wasm` inside — loaded directly
155424
- *
155425
- * Compilation and caching of .rego files is delegated to {@link OpaCompiler}.
155426
- *
155427
- * Requires:
155428
- * - `@open-policy-agent/opa-wasm` npm package (optional dep)
155429
- * - `opa` CLI on PATH (only when auto-compiling .rego files)
155430
- */
155431
- class OpaWasmEvaluator {
155432
- policy = null;
155433
- dataDocument = {};
155434
- compiler = new opa_compiler_1.OpaCompiler();
155435
- async initialize(rulesPath) {
155436
- const paths = Array.isArray(rulesPath) ? rulesPath : [rulesPath];
155437
- const wasmBytes = await this.compiler.resolveWasmBytes(paths);
155438
- try {
155439
- // Use createRequire to load the optional dep at runtime without ncc bundling it.
155440
- // `new Function('id', 'return require(id)')` fails in ncc bundles because
155441
- // `require` is not in the `new Function` scope. `createRequire` works correctly
155442
- // because it creates a real Node.js require rooted at the given path.
155443
- // eslint-disable-next-line @typescript-eslint/no-var-requires
155444
- const { createRequire } = __nccwpck_require__(73339);
155445
- const runtimeRequire = createRequire(__filename);
155446
- const opaWasm = runtimeRequire('@open-policy-agent/opa-wasm');
155447
- const loadPolicy = opaWasm.loadPolicy || opaWasm.default?.loadPolicy;
155448
- if (!loadPolicy) {
155449
- throw new Error('loadPolicy not found in @open-policy-agent/opa-wasm');
155450
- }
155451
- this.policy = await loadPolicy(wasmBytes);
155452
- }
155453
- catch (err) {
155454
- if (err?.code === 'MODULE_NOT_FOUND' || err?.code === 'ERR_MODULE_NOT_FOUND') {
155455
- throw new Error('OPA WASM evaluator requires @open-policy-agent/opa-wasm. ' +
155456
- 'Install it with: npm install @open-policy-agent/opa-wasm');
155457
- }
155458
- throw err;
155459
- }
155460
- }
155461
- /**
155462
- * Load external data from a JSON file to use as the OPA data document.
155463
- * The loaded data will be passed to `policy.setData()` during evaluation,
155464
- * making it available in Rego via `data.<key>`.
155465
- */
155466
- loadData(dataPath) {
155467
- const resolved = path.resolve(dataPath);
155468
- if (path.normalize(resolved).includes('..')) {
155469
- throw new Error(`Data path contains traversal sequences: ${dataPath}`);
155470
- }
155471
- if (!fs.existsSync(resolved)) {
155472
- throw new Error(`OPA data file not found: ${resolved}`);
155473
- }
155474
- const stat = fs.statSync(resolved);
155475
- if (stat.size > 10 * 1024 * 1024) {
155476
- throw new Error(`OPA data file exceeds 10MB limit: ${resolved} (${stat.size} bytes)`);
155477
- }
155478
- const raw = fs.readFileSync(resolved, 'utf-8');
155479
- try {
155480
- const parsed = JSON.parse(raw);
155481
- if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
155482
- throw new Error('OPA data file must contain a JSON object (not an array or primitive)');
155483
- }
155484
- this.dataDocument = parsed;
155485
- }
155486
- catch (err) {
155487
- if (err.message.startsWith('OPA data file must')) {
155488
- throw err;
155489
- }
155490
- throw new Error(`Failed to parse OPA data file ${resolved}: ${err.message}`);
155491
- }
155492
- }
155493
- async evaluate(input) {
155494
- if (!this.policy) {
155495
- throw new Error('OPA WASM evaluator not initialized');
155496
- }
155497
- this.policy.setData(this.dataDocument);
155498
- const resultSet = this.policy.evaluate(input);
155499
- if (Array.isArray(resultSet) && resultSet.length > 0) {
155500
- return resultSet[0].result;
155501
- }
155502
- return undefined;
155503
- }
155504
- async shutdown() {
155505
- if (this.policy) {
155506
- // opa-wasm policy objects may have a close/free method for WASM cleanup
155507
- if (typeof this.policy.close === 'function') {
155508
- try {
155509
- this.policy.close();
155510
- }
155511
- catch { }
155512
- }
155513
- else if (typeof this.policy.free === 'function') {
155514
- try {
155515
- this.policy.free();
155516
- }
155517
- catch { }
155518
- }
155519
- }
155520
- this.policy = null;
155521
- }
155522
- }
155523
- exports.OpaWasmEvaluator = OpaWasmEvaluator;
155524
-
155525
-
155526
- /***/ }),
155527
-
155528
- /***/ 17117:
155529
- /***/ ((__unused_webpack_module, exports) => {
155530
-
155531
- "use strict";
155532
-
155533
- /**
155534
- * Copyright (c) ProbeLabs. All rights reserved.
155535
- * Licensed under the Elastic License 2.0; you may not use this file except
155536
- * in compliance with the Elastic License 2.0.
155537
- */
155538
- Object.defineProperty(exports, "__esModule", ({ value: true }));
155539
- exports.PolicyInputBuilder = void 0;
155540
- /**
155541
- * Builds OPA-compatible input documents from engine context.
155542
- *
155543
- * Resolves actor roles from the `policy.roles` config section by matching
155544
- * the actor's authorAssociation and login against role definitions.
155545
- */
155546
- class PolicyInputBuilder {
155547
- roles;
155548
- actor;
155549
- repository;
155550
- pullRequest;
155551
- constructor(policyConfig, actor, repository, pullRequest) {
155552
- this.roles = policyConfig.roles || {};
155553
- this.actor = actor;
155554
- this.repository = repository;
155555
- this.pullRequest = pullRequest;
155556
- }
155557
- /** Resolve which roles apply to the current actor. */
155558
- resolveRoles() {
155559
- const matched = [];
155560
- for (const [roleName, roleConfig] of Object.entries(this.roles)) {
155561
- let identityMatch = false;
155562
- if (roleConfig.author_association &&
155563
- this.actor.authorAssociation &&
155564
- roleConfig.author_association.includes(this.actor.authorAssociation)) {
155565
- identityMatch = true;
155566
- }
155567
- if (!identityMatch &&
155568
- roleConfig.users &&
155569
- this.actor.login &&
155570
- roleConfig.users.includes(this.actor.login)) {
155571
- identityMatch = true;
155572
- }
155573
- // Slack user ID match
155574
- if (!identityMatch &&
155575
- roleConfig.slack_users &&
155576
- this.actor.slack?.userId &&
155577
- roleConfig.slack_users.includes(this.actor.slack.userId)) {
155578
- identityMatch = true;
155579
- }
155580
- // Email match (case-insensitive)
155581
- if (!identityMatch && roleConfig.emails && this.actor.slack?.email) {
155582
- const actorEmail = this.actor.slack.email.toLowerCase();
155583
- if (roleConfig.emails.some(e => e.toLowerCase() === actorEmail)) {
155584
- identityMatch = true;
155585
- }
155586
- }
155587
- // Note: teams-based role resolution requires GitHub API access (read:org scope)
155588
- // and is not yet implemented. If configured, the role will not match via teams.
155589
- if (!identityMatch)
155590
- continue;
155591
- // slack_channels gate: if set, the role only applies when triggered from one of these channels
155592
- if (roleConfig.slack_channels && roleConfig.slack_channels.length > 0) {
155593
- if (!this.actor.slack?.channelId ||
155594
- !roleConfig.slack_channels.includes(this.actor.slack.channelId)) {
155595
- continue;
155596
- }
155597
- }
155598
- matched.push(roleName);
155599
- }
155600
- return matched;
155601
- }
155602
- buildActor() {
155603
- return {
155604
- authorAssociation: this.actor.authorAssociation,
155605
- login: this.actor.login,
155606
- roles: this.resolveRoles(),
155607
- isLocalMode: this.actor.isLocalMode,
155608
- ...(this.actor.slack && { slack: this.actor.slack }),
155609
- };
155610
- }
155611
- forCheckExecution(check) {
155612
- return {
155613
- scope: 'check.execute',
155614
- check: {
155615
- id: check.id,
155616
- type: check.type,
155617
- group: check.group,
155618
- tags: check.tags,
155619
- criticality: check.criticality,
155620
- sandbox: check.sandbox,
155621
- policy: check.policy,
155622
- },
155623
- actor: this.buildActor(),
155624
- repository: this.repository,
155625
- pullRequest: this.pullRequest,
155626
- };
155627
- }
155628
- forToolInvocation(serverName, methodName, transport) {
155629
- return {
155630
- scope: 'tool.invoke',
155631
- tool: { serverName, methodName, transport },
155632
- actor: this.buildActor(),
155633
- repository: this.repository,
155634
- pullRequest: this.pullRequest,
155635
- };
155636
- }
155637
- forCapabilityResolve(checkId, capabilities) {
155638
- return {
155639
- scope: 'capability.resolve',
155640
- check: { id: checkId, type: 'ai' },
155641
- capability: capabilities,
155642
- actor: this.buildActor(),
155643
- repository: this.repository,
155644
- pullRequest: this.pullRequest,
155645
- };
155646
- }
155647
- }
155648
- exports.PolicyInputBuilder = PolicyInputBuilder;
155649
-
155650
-
155651
- /***/ }),
155652
-
155653
- /***/ 63737:
155654
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
155655
-
155656
- "use strict";
155657
-
155658
- /**
155659
- * Copyright (c) ProbeLabs. All rights reserved.
155660
- * Licensed under the Elastic License 2.0; you may not use this file except
155661
- * in compliance with the Elastic License 2.0.
155662
- */
155663
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
155664
- if (k2 === undefined) k2 = k;
155665
- var desc = Object.getOwnPropertyDescriptor(m, k);
155666
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
155667
- desc = { enumerable: true, get: function() { return m[k]; } };
155668
- }
155669
- Object.defineProperty(o, k2, desc);
155670
- }) : (function(o, m, k, k2) {
155671
- if (k2 === undefined) k2 = k;
155672
- o[k2] = m[k];
155673
- }));
155674
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
155675
- Object.defineProperty(o, "default", { enumerable: true, value: v });
155676
- }) : function(o, v) {
155677
- o["default"] = v;
155678
- });
155679
- var __importStar = (this && this.__importStar) || (function () {
155680
- var ownKeys = function(o) {
155681
- ownKeys = Object.getOwnPropertyNames || function (o) {
155682
- var ar = [];
155683
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
155684
- return ar;
155685
- };
155686
- return ownKeys(o);
155687
- };
155688
- return function (mod) {
155689
- if (mod && mod.__esModule) return mod;
155690
- var result = {};
155691
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
155692
- __setModuleDefault(result, mod);
155693
- return result;
155694
- };
155695
- })();
155696
- Object.defineProperty(exports, "__esModule", ({ value: true }));
155697
- exports.KnexStoreBackend = void 0;
155698
- /**
155699
- * Knex-backed schedule store for PostgreSQL, MySQL, and MSSQL (Enterprise)
155700
- *
155701
- * Uses Knex query builder for database-agnostic SQL. Same schema as SQLite backend
155702
- * but with real distributed locking via row-level claims (claimed_by/claimed_at/lock_token).
155703
- */
155704
- const fs = __importStar(__nccwpck_require__(79896));
155705
- const path = __importStar(__nccwpck_require__(16928));
155706
- const uuid_1 = __nccwpck_require__(31914);
155707
- const logger_1 = __nccwpck_require__(86999);
155708
- function toNum(val) {
155709
- if (val === null || val === undefined)
155710
- return undefined;
155711
- return typeof val === 'string' ? parseInt(val, 10) : val;
155712
- }
155713
- function safeJsonParse(value) {
155714
- if (!value)
155715
- return undefined;
155716
- try {
155717
- return JSON.parse(value);
155718
- }
155719
- catch {
155720
- return undefined;
155721
- }
155722
- }
155723
- function fromDbRow(row) {
155724
- return {
155725
- id: row.id,
155726
- creatorId: row.creator_id,
155727
- creatorContext: row.creator_context ?? undefined,
155728
- creatorName: row.creator_name ?? undefined,
155729
- timezone: row.timezone,
155730
- schedule: row.schedule_expr,
155731
- runAt: toNum(row.run_at),
155732
- isRecurring: row.is_recurring === true || row.is_recurring === 1,
155733
- originalExpression: row.original_expression,
155734
- workflow: row.workflow ?? undefined,
155735
- workflowInputs: safeJsonParse(row.workflow_inputs),
155736
- outputContext: safeJsonParse(row.output_context),
155737
- status: row.status,
155738
- createdAt: toNum(row.created_at),
155739
- lastRunAt: toNum(row.last_run_at),
155740
- nextRunAt: toNum(row.next_run_at),
155741
- runCount: row.run_count,
155742
- failureCount: row.failure_count,
155743
- lastError: row.last_error ?? undefined,
155744
- previousResponse: row.previous_response ?? undefined,
155745
- };
155746
- }
155747
- function toInsertRow(schedule) {
155748
- return {
155749
- id: schedule.id,
155750
- creator_id: schedule.creatorId,
155751
- creator_context: schedule.creatorContext ?? null,
155752
- creator_name: schedule.creatorName ?? null,
155753
- timezone: schedule.timezone,
155754
- schedule_expr: schedule.schedule,
155755
- run_at: schedule.runAt ?? null,
155756
- is_recurring: schedule.isRecurring,
155757
- original_expression: schedule.originalExpression,
155758
- workflow: schedule.workflow ?? null,
155759
- workflow_inputs: schedule.workflowInputs ? JSON.stringify(schedule.workflowInputs) : null,
155760
- output_context: schedule.outputContext ? JSON.stringify(schedule.outputContext) : null,
155761
- status: schedule.status,
155762
- created_at: schedule.createdAt,
155763
- last_run_at: schedule.lastRunAt ?? null,
155764
- next_run_at: schedule.nextRunAt ?? null,
155765
- run_count: schedule.runCount,
155766
- failure_count: schedule.failureCount,
155767
- last_error: schedule.lastError ?? null,
155768
- previous_response: schedule.previousResponse ?? null,
155769
- };
155770
- }
155771
- /**
155772
- * Enterprise Knex-backed store for PostgreSQL, MySQL, and MSSQL
155773
- */
155774
- class KnexStoreBackend {
155775
- knex = null;
155776
- driver;
155777
- connection;
155778
- constructor(driver, storageConfig, _haConfig) {
155779
- this.driver = driver;
155780
- this.connection = (storageConfig.connection || {});
155781
- }
155782
- async initialize() {
155783
- // Load knex dynamically
155784
- const { createRequire } = __nccwpck_require__(73339);
155785
- const runtimeRequire = createRequire(__filename);
155786
- let knexFactory;
155787
- try {
155788
- knexFactory = runtimeRequire('knex');
155789
- }
155790
- catch (err) {
155791
- const code = err?.code;
155792
- if (code === 'MODULE_NOT_FOUND' || code === 'ERR_MODULE_NOT_FOUND') {
155793
- throw new Error('knex is required for PostgreSQL/MySQL/MSSQL schedule storage. ' +
155794
- 'Install it with: npm install knex');
155795
- }
155796
- throw err;
155797
- }
155798
- const clientMap = {
155799
- postgresql: 'pg',
155800
- mysql: 'mysql2',
155801
- mssql: 'tedious',
155802
- };
155803
- const client = clientMap[this.driver];
155804
- // Build connection config
155805
- let connection;
155806
- if (this.connection.connection_string) {
155807
- connection = this.connection.connection_string;
155808
- }
155809
- else if (this.driver === 'mssql') {
155810
- connection = this.buildMssqlConnection();
155811
- }
155812
- else {
155813
- connection = this.buildStandardConnection();
155814
- }
155815
- this.knex = knexFactory({
155816
- client,
155817
- connection,
155818
- pool: {
155819
- min: this.connection.pool?.min ?? 0,
155820
- max: this.connection.pool?.max ?? 10,
155821
- },
155822
- });
155823
- // Run schema migration
155824
- await this.migrateSchema();
155825
- logger_1.logger.info(`[KnexStore] Initialized (${this.driver})`);
155826
- }
155827
- buildStandardConnection() {
155828
- return {
155829
- host: this.connection.host || 'localhost',
155830
- port: this.connection.port,
155831
- database: this.connection.database || 'visor',
155832
- user: this.connection.user,
155833
- password: this.connection.password,
155834
- ssl: this.resolveSslConfig(),
155835
- };
155836
- }
155837
- buildMssqlConnection() {
155838
- const ssl = this.connection.ssl;
155839
- const sslEnabled = ssl === true || (typeof ssl === 'object' && ssl.enabled !== false);
155840
- return {
155841
- server: this.connection.host || 'localhost',
155842
- port: this.connection.port,
155843
- database: this.connection.database || 'visor',
155844
- user: this.connection.user,
155845
- password: this.connection.password,
155846
- options: {
155847
- encrypt: sslEnabled,
155848
- trustServerCertificate: typeof ssl === 'object' ? ssl.reject_unauthorized === false : !sslEnabled,
155849
- },
155850
- };
155851
- }
155852
- resolveSslConfig() {
155853
- const ssl = this.connection.ssl;
155854
- if (ssl === false || ssl === undefined)
155855
- return false;
155856
- if (ssl === true)
155857
- return { rejectUnauthorized: true };
155858
- // Object config
155859
- if (ssl.enabled === false)
155860
- return false;
155861
- const result = {
155862
- rejectUnauthorized: ssl.reject_unauthorized !== false,
155863
- };
155864
- if (ssl.ca) {
155865
- const caPath = this.validateSslPath(ssl.ca, 'CA certificate');
155866
- result.ca = fs.readFileSync(caPath, 'utf8');
155867
- }
155868
- if (ssl.cert) {
155869
- const certPath = this.validateSslPath(ssl.cert, 'client certificate');
155870
- result.cert = fs.readFileSync(certPath, 'utf8');
155871
- }
155872
- if (ssl.key) {
155873
- const keyPath = this.validateSslPath(ssl.key, 'client key');
155874
- result.key = fs.readFileSync(keyPath, 'utf8');
155875
- }
155876
- return result;
155877
- }
155878
- validateSslPath(filePath, label) {
155879
- const resolved = path.resolve(filePath);
155880
- if (resolved !== path.normalize(resolved)) {
155881
- throw new Error(`SSL ${label} path contains invalid sequences: ${filePath}`);
155882
- }
155883
- if (!fs.existsSync(resolved)) {
155884
- throw new Error(`SSL ${label} not found: ${filePath}`);
155885
- }
155886
- return resolved;
155887
- }
155888
- async shutdown() {
155889
- if (this.knex) {
155890
- await this.knex.destroy();
155891
- this.knex = null;
155892
- }
155893
- }
155894
- async migrateSchema() {
155895
- const knex = this.getKnex();
155896
- const exists = await knex.schema.hasTable('schedules');
155897
- if (!exists) {
155898
- await knex.schema.createTable('schedules', table => {
155899
- table.string('id', 36).primary();
155900
- table.string('creator_id', 255).notNullable().index();
155901
- table.string('creator_context', 255);
155902
- table.string('creator_name', 255);
155903
- table.string('timezone', 64).notNullable().defaultTo('UTC');
155904
- table.string('schedule_expr', 255);
155905
- table.bigInteger('run_at');
155906
- table.boolean('is_recurring').notNullable();
155907
- table.text('original_expression');
155908
- table.string('workflow', 255);
155909
- table.text('workflow_inputs');
155910
- table.text('output_context');
155911
- table.string('status', 20).notNullable().index();
155912
- table.bigInteger('created_at').notNullable();
155913
- table.bigInteger('last_run_at');
155914
- table.bigInteger('next_run_at');
155915
- table.integer('run_count').notNullable().defaultTo(0);
155916
- table.integer('failure_count').notNullable().defaultTo(0);
155917
- table.text('last_error');
155918
- table.text('previous_response');
155919
- table.index(['status', 'next_run_at']);
155920
- });
155921
- }
155922
- // Create scheduler_locks table for distributed locking
155923
- const locksExist = await knex.schema.hasTable('scheduler_locks');
155924
- if (!locksExist) {
155925
- await knex.schema.createTable('scheduler_locks', table => {
155926
- table.string('lock_id', 255).primary();
155927
- table.string('node_id', 255).notNullable();
155928
- table.string('lock_token', 36).notNullable();
155929
- table.bigInteger('acquired_at').notNullable();
155930
- table.bigInteger('expires_at').notNullable();
155931
- });
155932
- }
155933
- }
155934
- getKnex() {
155935
- if (!this.knex) {
155936
- throw new Error('[KnexStore] Not initialized. Call initialize() first.');
155937
- }
155938
- return this.knex;
155939
- }
155940
- // --- CRUD ---
155941
- async create(schedule) {
155942
- const knex = this.getKnex();
155943
- const newSchedule = {
155944
- ...schedule,
155945
- id: (0, uuid_1.v4)(),
155946
- createdAt: Date.now(),
155947
- runCount: 0,
155948
- failureCount: 0,
155949
- status: 'active',
155950
- };
155951
- await knex('schedules').insert(toInsertRow(newSchedule));
155952
- logger_1.logger.info(`[KnexStore] Created schedule ${newSchedule.id} for user ${newSchedule.creatorId}`);
155953
- return newSchedule;
155954
- }
155955
- async importSchedule(schedule) {
155956
- const knex = this.getKnex();
155957
- const existing = await knex('schedules').where('id', schedule.id).first();
155958
- if (existing)
155959
- return; // Already imported (idempotent)
155960
- await knex('schedules').insert(toInsertRow(schedule));
155961
- }
155962
- async get(id) {
155963
- const knex = this.getKnex();
155964
- const row = await knex('schedules').where('id', id).first();
155965
- return row ? fromDbRow(row) : undefined;
155966
- }
155967
- async update(id, patch) {
155968
- const knex = this.getKnex();
155969
- const existing = await knex('schedules').where('id', id).first();
155970
- if (!existing)
155971
- return undefined;
155972
- const current = fromDbRow(existing);
155973
- const updated = { ...current, ...patch, id: current.id };
155974
- const row = toInsertRow(updated);
155975
- // Remove id from update (PK cannot change)
155976
- delete row.id;
155977
- await knex('schedules').where('id', id).update(row);
155978
- return updated;
155979
- }
155980
- async delete(id) {
155981
- const knex = this.getKnex();
155982
- const deleted = await knex('schedules').where('id', id).del();
155983
- if (deleted > 0) {
155984
- logger_1.logger.info(`[KnexStore] Deleted schedule ${id}`);
155985
- return true;
155986
- }
155987
- return false;
155988
- }
155989
- // --- Queries ---
155990
- async getByCreator(creatorId) {
155991
- const knex = this.getKnex();
155992
- const rows = await knex('schedules').where('creator_id', creatorId);
155993
- return rows.map((r) => fromDbRow(r));
155994
- }
155995
- async getActiveSchedules() {
155996
- const knex = this.getKnex();
155997
- const rows = await knex('schedules').where('status', 'active');
155998
- return rows.map((r) => fromDbRow(r));
155999
- }
156000
- async getDueSchedules(now) {
156001
- const ts = now ?? Date.now();
156002
- const knex = this.getKnex();
156003
- // MSSQL uses 1/0 for booleans
156004
- const bFalse = this.driver === 'mssql' ? 0 : false;
156005
- const bTrue = this.driver === 'mssql' ? 1 : true;
156006
- const rows = await knex('schedules')
156007
- .where('status', 'active')
156008
- .andWhere(function () {
156009
- this.where(function () {
156010
- this.where('is_recurring', bFalse)
156011
- .whereNotNull('run_at')
156012
- .where('run_at', '<=', ts);
156013
- }).orWhere(function () {
156014
- this.where('is_recurring', bTrue)
156015
- .whereNotNull('next_run_at')
156016
- .where('next_run_at', '<=', ts);
156017
- });
156018
- });
156019
- return rows.map((r) => fromDbRow(r));
156020
- }
156021
- async findByWorkflow(creatorId, workflowName) {
156022
- const knex = this.getKnex();
156023
- const escaped = workflowName.toLowerCase().replace(/[%_\\]/g, '\\$&');
156024
- const pattern = `%${escaped}%`;
156025
- const rows = await knex('schedules')
156026
- .where('creator_id', creatorId)
156027
- .where('status', 'active')
156028
- .whereRaw("LOWER(workflow) LIKE ? ESCAPE '\\'", [pattern]);
156029
- return rows.map((r) => fromDbRow(r));
156030
- }
156031
- async getAll() {
156032
- const knex = this.getKnex();
156033
- const rows = await knex('schedules');
156034
- return rows.map((r) => fromDbRow(r));
156035
- }
156036
- async getStats() {
156037
- const knex = this.getKnex();
156038
- // MSSQL uses 1/0 for booleans; PostgreSQL/MySQL accept both true/1
156039
- const boolTrue = this.driver === 'mssql' ? '1' : 'true';
156040
- const boolFalse = this.driver === 'mssql' ? '0' : 'false';
156041
- const result = await knex('schedules')
156042
- .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`))
156043
- .first();
156044
- return {
156045
- total: Number(result.total) || 0,
156046
- active: Number(result.active) || 0,
156047
- paused: Number(result.paused) || 0,
156048
- completed: Number(result.completed) || 0,
156049
- failed: Number(result.failed) || 0,
156050
- recurring: Number(result.recurring) || 0,
156051
- oneTime: Number(result.one_time) || 0,
156052
- };
156053
- }
156054
- async validateLimits(creatorId, isRecurring, limits) {
156055
- const knex = this.getKnex();
156056
- if (limits.maxGlobal) {
156057
- const result = await knex('schedules').count('* as cnt').first();
156058
- if (Number(result?.cnt) >= limits.maxGlobal) {
156059
- throw new Error(`Global schedule limit reached (${limits.maxGlobal})`);
156060
- }
156061
- }
156062
- if (limits.maxPerUser) {
156063
- const result = await knex('schedules')
156064
- .where('creator_id', creatorId)
156065
- .count('* as cnt')
156066
- .first();
156067
- if (Number(result?.cnt) >= limits.maxPerUser) {
156068
- throw new Error(`You have reached the maximum number of schedules (${limits.maxPerUser})`);
156069
- }
156070
- }
156071
- if (isRecurring && limits.maxRecurringPerUser) {
156072
- const bTrue = this.driver === 'mssql' ? 1 : true;
156073
- const result = await knex('schedules')
156074
- .where('creator_id', creatorId)
156075
- .where('is_recurring', bTrue)
156076
- .count('* as cnt')
156077
- .first();
156078
- if (Number(result?.cnt) >= limits.maxRecurringPerUser) {
156079
- throw new Error(`You have reached the maximum number of recurring schedules (${limits.maxRecurringPerUser})`);
156080
- }
156081
- }
156082
- }
156083
- // --- HA Distributed Locking (via scheduler_locks table) ---
156084
- async tryAcquireLock(lockId, nodeId, ttlSeconds) {
156085
- const knex = this.getKnex();
156086
- const now = Date.now();
156087
- const expiresAt = now + ttlSeconds * 1000;
156088
- const token = (0, uuid_1.v4)();
156089
- // Step 1: Try to claim an existing expired lock
156090
- const updated = await knex('scheduler_locks')
156091
- .where('lock_id', lockId)
156092
- .where('expires_at', '<', now)
156093
- .update({
156094
- node_id: nodeId,
156095
- lock_token: token,
156096
- acquired_at: now,
156097
- expires_at: expiresAt,
156098
- });
156099
- if (updated > 0)
156100
- return token;
156101
- // Step 2: Try to INSERT a new lock row
156102
- try {
156103
- await knex('scheduler_locks').insert({
156104
- lock_id: lockId,
156105
- node_id: nodeId,
156106
- lock_token: token,
156107
- acquired_at: now,
156108
- expires_at: expiresAt,
156109
- });
156110
- return token;
156111
- }
156112
- catch {
156113
- // Unique constraint violation — another node holds the lock
156114
- return null;
156115
- }
156116
- }
156117
- async releaseLock(lockId, lockToken) {
156118
- const knex = this.getKnex();
156119
- await knex('scheduler_locks').where('lock_id', lockId).where('lock_token', lockToken).del();
156120
- }
156121
- async renewLock(lockId, lockToken, ttlSeconds) {
156122
- const knex = this.getKnex();
156123
- const now = Date.now();
156124
- const expiresAt = now + ttlSeconds * 1000;
156125
- const updated = await knex('scheduler_locks')
156126
- .where('lock_id', lockId)
156127
- .where('lock_token', lockToken)
156128
- .update({ acquired_at: now, expires_at: expiresAt });
156129
- return updated > 0;
156130
- }
156131
- async flush() {
156132
- // No-op for server-based backends
156133
- }
156134
- }
156135
- exports.KnexStoreBackend = KnexStoreBackend;
156136
-
156137
-
156138
154454
  /***/ }),
156139
154455
 
156140
154456
  /***/ 83864:
@@ -166121,35 +164437,6 @@ class OutputFormatters {
166121
164437
  exports.OutputFormatters = OutputFormatters;
166122
164438
 
166123
164439
 
166124
- /***/ }),
166125
-
166126
- /***/ 93866:
166127
- /***/ ((__unused_webpack_module, exports) => {
166128
-
166129
- "use strict";
166130
-
166131
- Object.defineProperty(exports, "__esModule", ({ value: true }));
166132
- exports.DefaultPolicyEngine = void 0;
166133
- /**
166134
- * Default (no-op) policy engine — always allows everything.
166135
- * Used when no enterprise license is present or policy is disabled.
166136
- */
166137
- class DefaultPolicyEngine {
166138
- async initialize(_config) { }
166139
- async evaluateCheckExecution(_checkId, _checkConfig) {
166140
- return { allowed: true };
166141
- }
166142
- async evaluateToolInvocation(_serverName, _methodName, _transport) {
166143
- return { allowed: true };
166144
- }
166145
- async evaluateCapabilities(_checkId, _capabilities) {
166146
- return { allowed: true };
166147
- }
166148
- async shutdown() { }
166149
- }
166150
- exports.DefaultPolicyEngine = DefaultPolicyEngine;
166151
-
166152
-
166153
164440
  /***/ }),
166154
164441
 
166155
164442
  /***/ 96611:
@@ -184957,7 +183244,7 @@ class StateMachineExecutionEngine {
184957
183244
  try {
184958
183245
  logger_1.logger.debug(`[PolicyEngine] Loading enterprise policy engine (engine=${configWithTagFilter.policy.engine})`);
184959
183246
  // @ts-ignore — enterprise/ may not exist in OSS builds (caught at runtime)
184960
- const { loadEnterprisePolicyEngine } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(87068)));
183247
+ const { loadEnterprisePolicyEngine } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(7065)));
184961
183248
  context.policyEngine = await loadEnterprisePolicyEngine(configWithTagFilter.policy);
184962
183249
  logger_1.logger.debug(`[PolicyEngine] Initialized: ${context.policyEngine?.constructor?.name || 'unknown'}`);
184963
183250
  }
@@ -195207,7 +193494,7 @@ async function initTelemetry(opts = {}) {
195207
193494
  const path = __nccwpck_require__(16928);
195208
193495
  const outDir = opts.file?.dir ||
195209
193496
  process.env.VISOR_TRACE_DIR ||
195210
- path.join(process.cwd(), 'output', 'traces');
193497
+ __nccwpck_require__.ab + "traces";
195211
193498
  fs.mkdirSync(outDir, { recursive: true });
195212
193499
  const ts = new Date().toISOString().replace(/[:.]/g, '-');
195213
193500
  process.env.VISOR_FALLBACK_TRACE_FILE = path.join(outDir, `run-${ts}.ndjson`);
@@ -195410,7 +193697,7 @@ async function shutdownTelemetry() {
195410
193697
  if (process.env.VISOR_TRACE_REPORT === 'true') {
195411
193698
  const fs = __nccwpck_require__(79896);
195412
193699
  const path = __nccwpck_require__(16928);
195413
- const outDir = process.env.VISOR_TRACE_DIR || path.join(process.cwd(), 'output', 'traces');
193700
+ const outDir = process.env.VISOR_TRACE_DIR || __nccwpck_require__.ab + "traces";
195414
193701
  if (!fs.existsSync(outDir))
195415
193702
  fs.mkdirSync(outDir, { recursive: true });
195416
193703
  const ts = new Date().toISOString().replace(/[:.]/g, '-');
@@ -195909,7 +194196,7 @@ function __getOrCreateNdjsonPath() {
195909
194196
  fs.mkdirSync(dir, { recursive: true });
195910
194197
  return __ndjsonPath;
195911
194198
  }
195912
- const outDir = process.env.VISOR_TRACE_DIR || path.join(process.cwd(), 'output', 'traces');
194199
+ const outDir = process.env.VISOR_TRACE_DIR || __nccwpck_require__.ab + "traces";
195913
194200
  if (!fs.existsSync(outDir))
195914
194201
  fs.mkdirSync(outDir, { recursive: true });
195915
194202
  if (!__ndjsonPath) {
@@ -208018,6 +206305,22 @@ class WorkflowRegistry {
208018
206305
  exports.WorkflowRegistry = WorkflowRegistry;
208019
206306
 
208020
206307
 
206308
+ /***/ }),
206309
+
206310
+ /***/ 7065:
206311
+ /***/ ((module) => {
206312
+
206313
+ module.exports = eval("require")("./enterprise/loader");
206314
+
206315
+
206316
+ /***/ }),
206317
+
206318
+ /***/ 71370:
206319
+ /***/ ((module) => {
206320
+
206321
+ module.exports = eval("require")("./enterprise/policy/policy-input-builder");
206322
+
206323
+
208021
206324
  /***/ }),
208022
206325
 
208023
206326
  /***/ 18327:
@@ -362803,7 +361106,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"100":"Continue","101":"Switching Pro
362803
361106
  /***/ ((module) => {
362804
361107
 
362805
361108
  "use strict";
362806
- 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":"","prebuild":"npm run clean && node scripts/generate-config-schema.js","pretest":"node scripts/generate-config-schema.js && npm run build:cli","pretest:unit":"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-powered code review tool for GitHub Pull Requests - CLI and GitHub Action","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","@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","@probelabs/probe":"^0.6.0-rc232","@types/commander":"^2.12.0","@types/uuid":"^10.0.0","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","dotenv":"^17.2.3","ignore":"^7.0.5","js-yaml":"^4.1.0","liquidjs":"^10.21.1","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","@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","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"]}}');
361109
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@probelabs/visor","version":"0.1.131","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":"","prebuild":"npm run clean && node scripts/generate-config-schema.js","pretest":"node scripts/generate-config-schema.js && npm run build:cli","pretest:unit":"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-powered code review tool for GitHub Pull Requests - CLI and GitHub Action","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","@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","@probelabs/probe":"^0.6.0-rc232","@types/commander":"^2.12.0","@types/uuid":"^10.0.0","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","dotenv":"^17.2.3","ignore":"^7.0.5","js-yaml":"^4.1.0","liquidjs":"^10.21.1","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","@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","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"]}}');
362807
361110
 
362808
361111
  /***/ })
362809
361112