@probelabs/visor 0.1.150-ee → 0.1.151

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 (79) hide show
  1. package/dist/index.js +340 -2214
  2. package/dist/output/traces/run-2026-03-04T06-08-59-294Z.ndjson +138 -0
  3. package/dist/output/traces/run-2026-03-04T06-09-44-093Z.ndjson +2197 -0
  4. package/dist/sdk/{check-provider-registry-RRYBG6AU.mjs → check-provider-registry-EBH64VK3.mjs} +5 -5
  5. package/dist/sdk/{check-provider-registry-VHM53BTI.mjs → check-provider-registry-IGIIFX67.mjs} +5 -5
  6. package/dist/sdk/check-provider-registry-OQE2DVYM.mjs +29 -0
  7. package/dist/sdk/chunk-3ITUIFJW.mjs +443 -0
  8. package/dist/sdk/chunk-3ITUIFJW.mjs.map +1 -0
  9. package/dist/sdk/{chunk-GLROSEYJ.mjs → chunk-BBV64BPF.mjs} +3 -3
  10. package/dist/sdk/chunk-CZOKADR7.mjs +1502 -0
  11. package/dist/sdk/chunk-CZOKADR7.mjs.map +1 -0
  12. package/dist/sdk/{chunk-O4H5KZ7Y.mjs → chunk-I2OWVR63.mjs} +16 -16
  13. package/dist/sdk/{chunk-O4H5KZ7Y.mjs.map → chunk-I2OWVR63.mjs.map} +1 -1
  14. package/dist/sdk/{chunk-FZEQ744M.mjs → chunk-LH3PEGKM.mjs} +2 -2
  15. package/dist/sdk/chunk-MITJQ2QS.mjs +739 -0
  16. package/dist/sdk/chunk-MITJQ2QS.mjs.map +1 -0
  17. package/dist/sdk/{chunk-PETLPNRA.mjs → chunk-NE3OOOB2.mjs} +2 -2
  18. package/dist/sdk/{chunk-PETLPNRA.mjs.map → chunk-NE3OOOB2.mjs.map} +1 -1
  19. package/dist/sdk/chunk-OVALXWC6.mjs +43715 -0
  20. package/dist/sdk/chunk-OVALXWC6.mjs.map +1 -0
  21. package/dist/sdk/{chunk-AADKUA6L.mjs → chunk-U4ZJWL63.mjs} +15 -15
  22. package/dist/sdk/{failure-condition-evaluator-XV2ZMFFY.mjs → failure-condition-evaluator-V5KJ3HQP.mjs} +3 -3
  23. package/dist/sdk/failure-condition-evaluator-XYC6LZAV.mjs +17 -0
  24. package/dist/sdk/{github-frontend-A2R7D4N6.mjs → github-frontend-4DISXYOR.mjs} +3 -3
  25. package/dist/sdk/github-frontend-NWH4ZK77.mjs +1368 -0
  26. package/dist/sdk/github-frontend-NWH4ZK77.mjs.map +1 -0
  27. package/dist/sdk/{host-BRZQLVCH.mjs → host-7WIF5HKA.mjs} +2 -2
  28. package/dist/sdk/{host-MR7L57QI.mjs → host-V6ZZYETT.mjs} +2 -2
  29. package/dist/sdk/{routing-V3MYZAOH.mjs → routing-6SKBL7AX.mjs} +4 -4
  30. package/dist/sdk/routing-ODVQHICC.mjs +25 -0
  31. package/dist/sdk/{schedule-tool-4QDBJV74.mjs → schedule-tool-C2GJJRLH.mjs} +5 -5
  32. package/dist/sdk/{schedule-tool-NYLNJUEW.mjs → schedule-tool-GPRPNHIH.mjs} +5 -5
  33. package/dist/sdk/schedule-tool-SFHR3T3S.mjs +35 -0
  34. package/dist/sdk/{schedule-tool-handler-27XEVLSY.mjs → schedule-tool-handler-3C6DATDV.mjs} +5 -5
  35. package/dist/sdk/{schedule-tool-handler-EFQIYD3W.mjs → schedule-tool-handler-JCOBGMRA.mjs} +5 -5
  36. package/dist/sdk/schedule-tool-handler-JCOBGMRA.mjs.map +1 -0
  37. package/dist/sdk/schedule-tool-handler-Q6FWPGEB.mjs +39 -0
  38. package/dist/sdk/schedule-tool-handler-Q6FWPGEB.mjs.map +1 -0
  39. package/dist/sdk/sdk.js +260 -1634
  40. package/dist/sdk/sdk.js.map +1 -1
  41. package/dist/sdk/sdk.mjs +4 -4
  42. package/dist/sdk/{trace-helpers-6NSZBC35.mjs → trace-helpers-LKAADSNB.mjs} +2 -2
  43. package/dist/sdk/trace-helpers-LKAADSNB.mjs.map +1 -0
  44. package/dist/sdk/trace-helpers-NGQVPQE3.mjs +25 -0
  45. package/dist/sdk/trace-helpers-NGQVPQE3.mjs.map +1 -0
  46. package/dist/sdk/{workflow-check-provider-3MVUCEJR.mjs → workflow-check-provider-3QZCXXKD.mjs} +5 -5
  47. package/dist/sdk/workflow-check-provider-3QZCXXKD.mjs.map +1 -0
  48. package/dist/sdk/{workflow-check-provider-XLH7N4FV.mjs → workflow-check-provider-CH3ARLBE.mjs} +5 -5
  49. package/dist/sdk/workflow-check-provider-CH3ARLBE.mjs.map +1 -0
  50. package/dist/sdk/workflow-check-provider-G46WE4EJ.mjs +29 -0
  51. package/dist/sdk/workflow-check-provider-G46WE4EJ.mjs.map +1 -0
  52. package/dist/traces/run-2026-03-04T06-08-59-294Z.ndjson +138 -0
  53. package/dist/traces/run-2026-03-04T06-09-44-093Z.ndjson +2197 -0
  54. package/package.json +2 -2
  55. package/dist/sdk/knex-store-CRORFJE6.mjs +0 -527
  56. package/dist/sdk/knex-store-CRORFJE6.mjs.map +0 -1
  57. package/dist/sdk/loader-NJCF7DUS.mjs +0 -89
  58. package/dist/sdk/loader-NJCF7DUS.mjs.map +0 -1
  59. package/dist/sdk/opa-policy-engine-S2S2ULEI.mjs +0 -655
  60. package/dist/sdk/opa-policy-engine-S2S2ULEI.mjs.map +0 -1
  61. package/dist/sdk/validator-XTZJZZJH.mjs +0 -134
  62. package/dist/sdk/validator-XTZJZZJH.mjs.map +0 -1
  63. /package/dist/sdk/{check-provider-registry-RRYBG6AU.mjs.map → check-provider-registry-EBH64VK3.mjs.map} +0 -0
  64. /package/dist/sdk/{check-provider-registry-VHM53BTI.mjs.map → check-provider-registry-IGIIFX67.mjs.map} +0 -0
  65. /package/dist/sdk/{failure-condition-evaluator-XV2ZMFFY.mjs.map → check-provider-registry-OQE2DVYM.mjs.map} +0 -0
  66. /package/dist/sdk/{chunk-GLROSEYJ.mjs.map → chunk-BBV64BPF.mjs.map} +0 -0
  67. /package/dist/sdk/{chunk-FZEQ744M.mjs.map → chunk-LH3PEGKM.mjs.map} +0 -0
  68. /package/dist/sdk/{chunk-AADKUA6L.mjs.map → chunk-U4ZJWL63.mjs.map} +0 -0
  69. /package/dist/sdk/{routing-V3MYZAOH.mjs.map → failure-condition-evaluator-V5KJ3HQP.mjs.map} +0 -0
  70. /package/dist/sdk/{schedule-tool-4QDBJV74.mjs.map → failure-condition-evaluator-XYC6LZAV.mjs.map} +0 -0
  71. /package/dist/sdk/{github-frontend-A2R7D4N6.mjs.map → github-frontend-4DISXYOR.mjs.map} +0 -0
  72. /package/dist/sdk/{host-BRZQLVCH.mjs.map → host-7WIF5HKA.mjs.map} +0 -0
  73. /package/dist/sdk/{host-MR7L57QI.mjs.map → host-V6ZZYETT.mjs.map} +0 -0
  74. /package/dist/sdk/{schedule-tool-NYLNJUEW.mjs.map → routing-6SKBL7AX.mjs.map} +0 -0
  75. /package/dist/sdk/{schedule-tool-handler-27XEVLSY.mjs.map → routing-ODVQHICC.mjs.map} +0 -0
  76. /package/dist/sdk/{schedule-tool-handler-EFQIYD3W.mjs.map → schedule-tool-C2GJJRLH.mjs.map} +0 -0
  77. /package/dist/sdk/{trace-helpers-6NSZBC35.mjs.map → schedule-tool-GPRPNHIH.mjs.map} +0 -0
  78. /package/dist/sdk/{workflow-check-provider-3MVUCEJR.mjs.map → schedule-tool-SFHR3T3S.mjs.map} +0 -0
  79. /package/dist/sdk/{workflow-check-provider-XLH7N4FV.mjs.map → schedule-tool-handler-3C6DATDV.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.150';
3
- process.env.PROBE_VERSION = '0.6.0-rc266';
4
- process.env.VISOR_COMMIT_SHA = '3b87c12790f72a2050000f18b840f18909bda118';
5
- process.env.VISOR_COMMIT_SHORT = '3b87c12';
2
+ process.env.VISOR_VERSION = '0.1.151';
3
+ process.env.PROBE_VERSION = '0.6.0-rc268';
4
+ process.env.VISOR_COMMIT_SHA = 'b06d244c0580c243801a29bbeae739a8198bea09';
5
+ process.env.VISOR_COMMIT_SHORT = 'b06d244c0';
6
6
  /******/ (() => { // webpackBootstrap
7
7
  /******/ var __webpack_modules__ = ({
8
8
 
@@ -161210,7 +161210,7 @@ async function handleDumpPolicyInput(checkId, argv) {
161210
161210
  let PolicyInputBuilder;
161211
161211
  try {
161212
161212
  // @ts-ignore — enterprise/ may not exist in OSS builds (caught at runtime)
161213
- const mod = await Promise.resolve().then(() => __importStar(__nccwpck_require__(17117)));
161213
+ const mod = await Promise.resolve().then(() => __importStar(__nccwpck_require__(71370)));
161214
161214
  PolicyInputBuilder = mod.PolicyInputBuilder;
161215
161215
  }
161216
161216
  catch {
@@ -167053,1810 +167053,6 @@ class DependencyResolver {
167053
167053
  exports.DependencyResolver = DependencyResolver;
167054
167054
 
167055
167055
 
167056
- /***/ }),
167057
-
167058
- /***/ 50069:
167059
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
167060
-
167061
- "use strict";
167062
-
167063
- /**
167064
- * Copyright (c) ProbeLabs. All rights reserved.
167065
- * Licensed under the Elastic License 2.0; you may not use this file except
167066
- * in compliance with the Elastic License 2.0.
167067
- */
167068
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
167069
- if (k2 === undefined) k2 = k;
167070
- var desc = Object.getOwnPropertyDescriptor(m, k);
167071
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
167072
- desc = { enumerable: true, get: function() { return m[k]; } };
167073
- }
167074
- Object.defineProperty(o, k2, desc);
167075
- }) : (function(o, m, k, k2) {
167076
- if (k2 === undefined) k2 = k;
167077
- o[k2] = m[k];
167078
- }));
167079
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
167080
- Object.defineProperty(o, "default", { enumerable: true, value: v });
167081
- }) : function(o, v) {
167082
- o["default"] = v;
167083
- });
167084
- var __importStar = (this && this.__importStar) || (function () {
167085
- var ownKeys = function(o) {
167086
- ownKeys = Object.getOwnPropertyNames || function (o) {
167087
- var ar = [];
167088
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
167089
- return ar;
167090
- };
167091
- return ownKeys(o);
167092
- };
167093
- return function (mod) {
167094
- if (mod && mod.__esModule) return mod;
167095
- var result = {};
167096
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
167097
- __setModuleDefault(result, mod);
167098
- return result;
167099
- };
167100
- })();
167101
- Object.defineProperty(exports, "__esModule", ({ value: true }));
167102
- exports.LicenseValidator = void 0;
167103
- const crypto = __importStar(__nccwpck_require__(76982));
167104
- const fs = __importStar(__nccwpck_require__(79896));
167105
- const path = __importStar(__nccwpck_require__(16928));
167106
- class LicenseValidator {
167107
- /** Ed25519 public key for license verification (PEM format). */
167108
- static PUBLIC_KEY = '-----BEGIN PUBLIC KEY-----\n' +
167109
- 'MCowBQYDK2VwAyEAI/Zd08EFmgIdrDm/HXd0l3/5GBt7R1PrdvhdmEXhJlU=\n' +
167110
- '-----END PUBLIC KEY-----\n';
167111
- cache = null;
167112
- static CACHE_TTL = 5 * 60 * 1000; // 5 minutes
167113
- static GRACE_PERIOD = 72 * 3600 * 1000; // 72 hours after expiry
167114
- /**
167115
- * Load and validate license from environment or file.
167116
- *
167117
- * Resolution order:
167118
- * 1. VISOR_LICENSE env var (JWT string)
167119
- * 2. VISOR_LICENSE_FILE env var (path to file)
167120
- * 3. .visor-license in project root (cwd)
167121
- * 4. .visor-license in ~/.config/visor/
167122
- */
167123
- async loadAndValidate() {
167124
- // Return cached result if still fresh
167125
- if (this.cache && Date.now() - this.cache.validatedAt < LicenseValidator.CACHE_TTL) {
167126
- return this.cache.payload;
167127
- }
167128
- const token = this.resolveToken();
167129
- if (!token)
167130
- return null;
167131
- const payload = this.verifyAndDecode(token);
167132
- if (!payload)
167133
- return null;
167134
- this.cache = { payload, validatedAt: Date.now() };
167135
- return payload;
167136
- }
167137
- /** Check if a specific feature is licensed */
167138
- hasFeature(feature) {
167139
- if (!this.cache)
167140
- return false;
167141
- return this.cache.payload.features.includes(feature);
167142
- }
167143
- /** Check if license is valid (with grace period) */
167144
- isValid() {
167145
- if (!this.cache)
167146
- return false;
167147
- const now = Date.now();
167148
- const expiryMs = this.cache.payload.exp * 1000;
167149
- return now < expiryMs + LicenseValidator.GRACE_PERIOD;
167150
- }
167151
- /** Check if the license is within its grace period (expired but still valid) */
167152
- isInGracePeriod() {
167153
- if (!this.cache)
167154
- return false;
167155
- const now = Date.now();
167156
- const expiryMs = this.cache.payload.exp * 1000;
167157
- return now >= expiryMs && now < expiryMs + LicenseValidator.GRACE_PERIOD;
167158
- }
167159
- resolveToken() {
167160
- // 1. Direct env var
167161
- if (process.env.VISOR_LICENSE) {
167162
- return process.env.VISOR_LICENSE.trim();
167163
- }
167164
- // 2. File path from env (validate against path traversal)
167165
- if (process.env.VISOR_LICENSE_FILE) {
167166
- // path.resolve() produces an absolute path with all '..' segments resolved,
167167
- // so a separate resolved.includes('..') check is unnecessary.
167168
- const resolved = path.resolve(process.env.VISOR_LICENSE_FILE);
167169
- const home = process.env.HOME || process.env.USERPROFILE || '';
167170
- const allowedPrefixes = [path.normalize(process.cwd())];
167171
- if (home)
167172
- allowedPrefixes.push(path.normalize(path.join(home, '.config', 'visor')));
167173
- // Resolve symlinks so an attacker cannot create a symlink inside an
167174
- // allowed prefix that points to an arbitrary file outside it.
167175
- let realPath;
167176
- try {
167177
- realPath = fs.realpathSync(resolved);
167178
- }
167179
- catch {
167180
- return null; // File doesn't exist or isn't accessible
167181
- }
167182
- const isSafe = allowedPrefixes.some(prefix => realPath === prefix || realPath.startsWith(prefix + path.sep));
167183
- if (!isSafe)
167184
- return null;
167185
- return this.readFile(realPath);
167186
- }
167187
- // 3. .visor-license in cwd
167188
- const cwdPath = path.join(process.cwd(), '.visor-license');
167189
- const cwdToken = this.readFile(cwdPath);
167190
- if (cwdToken)
167191
- return cwdToken;
167192
- // 4. ~/.config/visor/.visor-license
167193
- const home = process.env.HOME || process.env.USERPROFILE || '';
167194
- if (home) {
167195
- const configPath = path.join(home, '.config', 'visor', '.visor-license');
167196
- const configToken = this.readFile(configPath);
167197
- if (configToken)
167198
- return configToken;
167199
- }
167200
- return null;
167201
- }
167202
- readFile(filePath) {
167203
- try {
167204
- return fs.readFileSync(filePath, 'utf-8').trim();
167205
- }
167206
- catch {
167207
- return null;
167208
- }
167209
- }
167210
- verifyAndDecode(token) {
167211
- try {
167212
- const parts = token.split('.');
167213
- if (parts.length !== 3)
167214
- return null;
167215
- const [headerB64, payloadB64, signatureB64] = parts;
167216
- // Decode header to verify algorithm
167217
- const header = JSON.parse(Buffer.from(headerB64, 'base64url').toString());
167218
- if (header.alg !== 'EdDSA')
167219
- return null;
167220
- // Verify signature
167221
- const data = `${headerB64}.${payloadB64}`;
167222
- const signature = Buffer.from(signatureB64, 'base64url');
167223
- const publicKey = crypto.createPublicKey(LicenseValidator.PUBLIC_KEY);
167224
- // Validate that the loaded public key is actually Ed25519 (OID 1.3.101.112).
167225
- // This prevents algorithm-confusion attacks if the embedded key were ever
167226
- // swapped to a different type.
167227
- if (publicKey.asymmetricKeyType !== 'ed25519') {
167228
- return null;
167229
- }
167230
- // Ed25519 verification: algorithm must be null because EdDSA performs its
167231
- // own internal hashing (SHA-512) — passing a digest algorithm here would
167232
- // cause Node.js to throw. The key type is validated above.
167233
- const isValid = crypto.verify(null, Buffer.from(data), publicKey, signature);
167234
- if (!isValid)
167235
- return null;
167236
- // Decode payload
167237
- const payload = JSON.parse(Buffer.from(payloadB64, 'base64url').toString());
167238
- // Validate required fields
167239
- if (!payload.org ||
167240
- !Array.isArray(payload.features) ||
167241
- typeof payload.exp !== 'number' ||
167242
- typeof payload.iat !== 'number' ||
167243
- !payload.sub) {
167244
- return null;
167245
- }
167246
- // Check expiry (with grace period)
167247
- const now = Date.now();
167248
- const expiryMs = payload.exp * 1000;
167249
- if (now >= expiryMs + LicenseValidator.GRACE_PERIOD) {
167250
- return null;
167251
- }
167252
- return payload;
167253
- }
167254
- catch {
167255
- return null;
167256
- }
167257
- }
167258
- }
167259
- exports.LicenseValidator = LicenseValidator;
167260
-
167261
-
167262
- /***/ }),
167263
-
167264
- /***/ 87068:
167265
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
167266
-
167267
- "use strict";
167268
-
167269
- /**
167270
- * Copyright (c) ProbeLabs. All rights reserved.
167271
- * Licensed under the Elastic License 2.0; you may not use this file except
167272
- * in compliance with the Elastic License 2.0.
167273
- */
167274
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
167275
- if (k2 === undefined) k2 = k;
167276
- var desc = Object.getOwnPropertyDescriptor(m, k);
167277
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
167278
- desc = { enumerable: true, get: function() { return m[k]; } };
167279
- }
167280
- Object.defineProperty(o, k2, desc);
167281
- }) : (function(o, m, k, k2) {
167282
- if (k2 === undefined) k2 = k;
167283
- o[k2] = m[k];
167284
- }));
167285
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
167286
- Object.defineProperty(o, "default", { enumerable: true, value: v });
167287
- }) : function(o, v) {
167288
- o["default"] = v;
167289
- });
167290
- var __importStar = (this && this.__importStar) || (function () {
167291
- var ownKeys = function(o) {
167292
- ownKeys = Object.getOwnPropertyNames || function (o) {
167293
- var ar = [];
167294
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
167295
- return ar;
167296
- };
167297
- return ownKeys(o);
167298
- };
167299
- return function (mod) {
167300
- if (mod && mod.__esModule) return mod;
167301
- var result = {};
167302
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
167303
- __setModuleDefault(result, mod);
167304
- return result;
167305
- };
167306
- })();
167307
- Object.defineProperty(exports, "__esModule", ({ value: true }));
167308
- exports.loadEnterprisePolicyEngine = loadEnterprisePolicyEngine;
167309
- exports.loadEnterpriseStoreBackend = loadEnterpriseStoreBackend;
167310
- const default_engine_1 = __nccwpck_require__(93866);
167311
- /**
167312
- * Load the enterprise policy engine if licensed, otherwise return the default no-op engine.
167313
- *
167314
- * This is the sole import boundary between OSS and enterprise code. Core code
167315
- * must only import from this module (via dynamic `await import()`), never from
167316
- * individual enterprise submodules.
167317
- */
167318
- async function loadEnterprisePolicyEngine(config) {
167319
- try {
167320
- const { LicenseValidator } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(50069)));
167321
- const validator = new LicenseValidator();
167322
- const license = await validator.loadAndValidate();
167323
- if (!license || !validator.hasFeature('policy')) {
167324
- return new default_engine_1.DefaultPolicyEngine();
167325
- }
167326
- if (validator.isInGracePeriod()) {
167327
- // eslint-disable-next-line no-console
167328
- console.warn('[visor:enterprise] License has expired but is within the 72-hour grace period. ' +
167329
- 'Please renew your license.');
167330
- }
167331
- const { OpaPolicyEngine } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(39530)));
167332
- const engine = new OpaPolicyEngine(config);
167333
- await engine.initialize(config);
167334
- return engine;
167335
- }
167336
- catch (err) {
167337
- // Enterprise code not available or initialization failed
167338
- const msg = err instanceof Error ? err.message : String(err);
167339
- try {
167340
- const { logger } = __nccwpck_require__(86999);
167341
- logger.warn(`[PolicyEngine] Enterprise policy init failed, falling back to default: ${msg}`);
167342
- }
167343
- catch {
167344
- // silent
167345
- }
167346
- return new default_engine_1.DefaultPolicyEngine();
167347
- }
167348
- }
167349
- /**
167350
- * Load the enterprise schedule store backend if licensed.
167351
- *
167352
- * @param driver Database driver ('postgresql', 'mysql', or 'mssql')
167353
- * @param storageConfig Storage configuration with connection details
167354
- * @param haConfig Optional HA configuration
167355
- * @throws Error if enterprise license is not available or missing 'scheduler-sql' feature
167356
- */
167357
- async function loadEnterpriseStoreBackend(driver, storageConfig, haConfig) {
167358
- const { LicenseValidator } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(50069)));
167359
- const validator = new LicenseValidator();
167360
- const license = await validator.loadAndValidate();
167361
- if (!license || !validator.hasFeature('scheduler-sql')) {
167362
- throw new Error(`The ${driver} schedule storage driver requires a Visor Enterprise license ` +
167363
- `with the 'scheduler-sql' feature. Please upgrade or use driver: 'sqlite' (default).`);
167364
- }
167365
- if (validator.isInGracePeriod()) {
167366
- // eslint-disable-next-line no-console
167367
- console.warn('[visor:enterprise] License has expired but is within the 72-hour grace period. ' +
167368
- 'Please renew your license.');
167369
- }
167370
- const { KnexStoreBackend } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(63737)));
167371
- return new KnexStoreBackend(driver, storageConfig, haConfig);
167372
- }
167373
-
167374
-
167375
- /***/ }),
167376
-
167377
- /***/ 628:
167378
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
167379
-
167380
- "use strict";
167381
-
167382
- /**
167383
- * Copyright (c) ProbeLabs. All rights reserved.
167384
- * Licensed under the Elastic License 2.0; you may not use this file except
167385
- * in compliance with the Elastic License 2.0.
167386
- */
167387
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
167388
- if (k2 === undefined) k2 = k;
167389
- var desc = Object.getOwnPropertyDescriptor(m, k);
167390
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
167391
- desc = { enumerable: true, get: function() { return m[k]; } };
167392
- }
167393
- Object.defineProperty(o, k2, desc);
167394
- }) : (function(o, m, k, k2) {
167395
- if (k2 === undefined) k2 = k;
167396
- o[k2] = m[k];
167397
- }));
167398
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
167399
- Object.defineProperty(o, "default", { enumerable: true, value: v });
167400
- }) : function(o, v) {
167401
- o["default"] = v;
167402
- });
167403
- var __importStar = (this && this.__importStar) || (function () {
167404
- var ownKeys = function(o) {
167405
- ownKeys = Object.getOwnPropertyNames || function (o) {
167406
- var ar = [];
167407
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
167408
- return ar;
167409
- };
167410
- return ownKeys(o);
167411
- };
167412
- return function (mod) {
167413
- if (mod && mod.__esModule) return mod;
167414
- var result = {};
167415
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
167416
- __setModuleDefault(result, mod);
167417
- return result;
167418
- };
167419
- })();
167420
- Object.defineProperty(exports, "__esModule", ({ value: true }));
167421
- exports.OpaCompiler = void 0;
167422
- const fs = __importStar(__nccwpck_require__(79896));
167423
- const path = __importStar(__nccwpck_require__(16928));
167424
- const os = __importStar(__nccwpck_require__(70857));
167425
- const crypto = __importStar(__nccwpck_require__(76982));
167426
- const child_process_1 = __nccwpck_require__(35317);
167427
- /**
167428
- * OPA Rego Compiler - compiles .rego policy files to WASM bundles using the `opa` CLI.
167429
- *
167430
- * Handles:
167431
- * - Resolving input paths to WASM bytes (direct .wasm, directory with policy.wasm, or .rego files)
167432
- * - Compiling .rego files to WASM via `opa build`
167433
- * - Caching compiled bundles based on content hashes
167434
- * - Extracting policy.wasm from OPA tar.gz bundles
167435
- *
167436
- * Requires:
167437
- * - `opa` CLI on PATH (only when auto-compiling .rego files)
167438
- */
167439
- class OpaCompiler {
167440
- static CACHE_DIR = path.join(os.tmpdir(), 'visor-opa-cache');
167441
- /**
167442
- * Resolve the input paths to WASM bytes.
167443
- *
167444
- * Strategy:
167445
- * 1. If any path is a .wasm file, read it directly
167446
- * 2. If a directory contains policy.wasm, read it
167447
- * 3. Otherwise, collect all .rego files and auto-compile via `opa build`
167448
- */
167449
- async resolveWasmBytes(paths) {
167450
- // Collect .rego files and check for existing .wasm
167451
- const regoFiles = [];
167452
- for (const p of paths) {
167453
- const resolved = path.resolve(p);
167454
- // Reject paths containing '..' after resolution (path traversal)
167455
- if (path.normalize(resolved).includes('..')) {
167456
- throw new Error(`Policy path contains traversal sequences: ${p}`);
167457
- }
167458
- // Direct .wasm file
167459
- if (resolved.endsWith('.wasm') && fs.existsSync(resolved)) {
167460
- return fs.readFileSync(resolved);
167461
- }
167462
- if (!fs.existsSync(resolved))
167463
- continue;
167464
- const stat = fs.statSync(resolved);
167465
- if (stat.isDirectory()) {
167466
- // Check for pre-compiled policy.wasm in directory
167467
- const wasmCandidate = path.join(resolved, 'policy.wasm');
167468
- if (fs.existsSync(wasmCandidate)) {
167469
- return fs.readFileSync(wasmCandidate);
167470
- }
167471
- // Collect all .rego files from directory
167472
- const files = fs.readdirSync(resolved);
167473
- for (const f of files) {
167474
- if (f.endsWith('.rego')) {
167475
- regoFiles.push(path.join(resolved, f));
167476
- }
167477
- }
167478
- }
167479
- else if (resolved.endsWith('.rego')) {
167480
- regoFiles.push(resolved);
167481
- }
167482
- }
167483
- if (regoFiles.length === 0) {
167484
- throw new Error(`OPA WASM evaluator: no .wasm bundle or .rego files found in: ${paths.join(', ')}`);
167485
- }
167486
- // Auto-compile .rego -> .wasm
167487
- return this.compileRego(regoFiles);
167488
- }
167489
- /**
167490
- * Auto-compile .rego files to a WASM bundle using the `opa` CLI.
167491
- *
167492
- * Caches the compiled bundle based on a content hash of all input .rego files
167493
- * so subsequent runs skip compilation if policies haven't changed.
167494
- */
167495
- compileRego(regoFiles) {
167496
- // Check that `opa` CLI is available
167497
- try {
167498
- (0, child_process_1.execFileSync)('opa', ['version'], { stdio: 'pipe' });
167499
- }
167500
- catch {
167501
- throw new Error('OPA CLI (`opa`) not found on PATH. Install it from https://www.openpolicyagent.org/docs/latest/#running-opa\n' +
167502
- 'Or pre-compile your .rego files: opa build -t wasm -e visor -o bundle.tar.gz ' +
167503
- regoFiles.join(' '));
167504
- }
167505
- // Compute content hash for cache key
167506
- const hash = crypto.createHash('sha256');
167507
- for (const f of regoFiles.sort()) {
167508
- hash.update(fs.readFileSync(f));
167509
- hash.update(f); // include filename for disambiguation
167510
- }
167511
- const cacheKey = hash.digest('hex').slice(0, 16);
167512
- const cacheDir = OpaCompiler.CACHE_DIR;
167513
- const cachedWasm = path.join(cacheDir, `${cacheKey}.wasm`);
167514
- // Return cached bundle if still valid
167515
- if (fs.existsSync(cachedWasm)) {
167516
- return fs.readFileSync(cachedWasm);
167517
- }
167518
- // Compile to WASM via opa build
167519
- fs.mkdirSync(cacheDir, { recursive: true });
167520
- const bundleTar = path.join(cacheDir, `${cacheKey}-bundle.tar.gz`);
167521
- try {
167522
- const args = [
167523
- 'build',
167524
- '-t',
167525
- 'wasm',
167526
- '-e',
167527
- 'visor', // entrypoint: the visor package tree
167528
- '-o',
167529
- bundleTar,
167530
- ...regoFiles,
167531
- ];
167532
- (0, child_process_1.execFileSync)('opa', args, {
167533
- stdio: 'pipe',
167534
- timeout: 30000,
167535
- });
167536
- }
167537
- catch (err) {
167538
- const stderr = err?.stderr?.toString() || '';
167539
- throw new Error(`Failed to compile .rego files to WASM:\n${stderr}\n` +
167540
- 'Ensure your .rego files are valid and the `opa` CLI is installed.');
167541
- }
167542
- // Extract policy.wasm from the tar.gz bundle
167543
- // OPA bundles are tar.gz with /policy.wasm inside
167544
- try {
167545
- (0, child_process_1.execFileSync)('tar', ['-xzf', bundleTar, '-C', cacheDir, '/policy.wasm'], {
167546
- stdio: 'pipe',
167547
- });
167548
- const extractedWasm = path.join(cacheDir, 'policy.wasm');
167549
- if (fs.existsSync(extractedWasm)) {
167550
- // Move to cache-key named file
167551
- fs.renameSync(extractedWasm, cachedWasm);
167552
- }
167553
- }
167554
- catch {
167555
- // Some tar implementations don't like leading /
167556
- try {
167557
- (0, child_process_1.execFileSync)('tar', ['-xzf', bundleTar, '-C', cacheDir, 'policy.wasm'], {
167558
- stdio: 'pipe',
167559
- });
167560
- const extractedWasm = path.join(cacheDir, 'policy.wasm');
167561
- if (fs.existsSync(extractedWasm)) {
167562
- fs.renameSync(extractedWasm, cachedWasm);
167563
- }
167564
- }
167565
- catch (err2) {
167566
- throw new Error(`Failed to extract policy.wasm from OPA bundle: ${err2?.message || err2}`);
167567
- }
167568
- }
167569
- // Clean up tar
167570
- try {
167571
- fs.unlinkSync(bundleTar);
167572
- }
167573
- catch { }
167574
- if (!fs.existsSync(cachedWasm)) {
167575
- throw new Error('OPA build succeeded but policy.wasm was not found in the bundle');
167576
- }
167577
- return fs.readFileSync(cachedWasm);
167578
- }
167579
- }
167580
- exports.OpaCompiler = OpaCompiler;
167581
-
167582
-
167583
- /***/ }),
167584
-
167585
- /***/ 44693:
167586
- /***/ ((__unused_webpack_module, exports) => {
167587
-
167588
- "use strict";
167589
-
167590
- /**
167591
- * Copyright (c) ProbeLabs. All rights reserved.
167592
- * Licensed under the Elastic License 2.0; you may not use this file except
167593
- * in compliance with the Elastic License 2.0.
167594
- */
167595
- Object.defineProperty(exports, "__esModule", ({ value: true }));
167596
- exports.OpaHttpEvaluator = void 0;
167597
- /**
167598
- * OPA HTTP Evaluator - evaluates policies via an external OPA server's REST API.
167599
- *
167600
- * Uses the built-in `fetch` API (Node 18+), so no extra dependencies are needed.
167601
- */
167602
- class OpaHttpEvaluator {
167603
- baseUrl;
167604
- timeout;
167605
- constructor(baseUrl, timeout = 5000) {
167606
- // Validate URL format and protocol
167607
- let parsed;
167608
- try {
167609
- parsed = new URL(baseUrl);
167610
- }
167611
- catch {
167612
- throw new Error(`OPA HTTP evaluator: invalid URL: ${baseUrl}`);
167613
- }
167614
- if (!['http:', 'https:'].includes(parsed.protocol)) {
167615
- throw new Error(`OPA HTTP evaluator: url must use http:// or https:// protocol, got: ${baseUrl}`);
167616
- }
167617
- // Block cloud metadata, loopback, link-local, and private network addresses
167618
- const hostname = parsed.hostname;
167619
- if (this.isBlockedHostname(hostname)) {
167620
- throw new Error(`OPA HTTP evaluator: url must not point to internal, loopback, or private network addresses`);
167621
- }
167622
- // Normalize: strip trailing slash
167623
- this.baseUrl = baseUrl.replace(/\/+$/, '');
167624
- this.timeout = timeout;
167625
- }
167626
- /**
167627
- * Check if a hostname is blocked due to SSRF concerns.
167628
- *
167629
- * Blocks:
167630
- * - Loopback addresses (127.x.x.x, localhost, 0.0.0.0, ::1)
167631
- * - Link-local addresses (169.254.x.x)
167632
- * - Private networks (10.x.x.x, 172.16-31.x.x, 192.168.x.x)
167633
- * - IPv6 unique local addresses (fd00::/8)
167634
- * - Cloud metadata services (*.internal)
167635
- */
167636
- isBlockedHostname(hostname) {
167637
- if (!hostname)
167638
- return true; // block empty hostnames
167639
- // Normalize hostname: lowercase and remove brackets for IPv6
167640
- const normalized = hostname.toLowerCase().replace(/^\[|\]$/g, '');
167641
- // Block .internal domains (cloud metadata services)
167642
- if (normalized === 'metadata.google.internal' || normalized.endsWith('.internal')) {
167643
- return true;
167644
- }
167645
- // Block localhost variants
167646
- if (normalized === 'localhost' || normalized === 'localhost.localdomain') {
167647
- return true;
167648
- }
167649
- // Block IPv6 loopback
167650
- if (normalized === '::1' || normalized === '0:0:0:0:0:0:0:1') {
167651
- return true;
167652
- }
167653
- // Check IPv4 patterns
167654
- const ipv4Pattern = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
167655
- const ipv4Match = normalized.match(ipv4Pattern);
167656
- if (ipv4Match) {
167657
- const octets = ipv4Match.slice(1, 5).map(Number);
167658
- // Validate octets are in range [0, 255]
167659
- if (octets.some(octet => octet > 255)) {
167660
- return false;
167661
- }
167662
- const [a, b] = octets;
167663
- // Block loopback: 127.0.0.0/8
167664
- if (a === 127) {
167665
- return true;
167666
- }
167667
- // Block 0.0.0.0/8 (this host)
167668
- if (a === 0) {
167669
- return true;
167670
- }
167671
- // Block link-local: 169.254.0.0/16
167672
- if (a === 169 && b === 254) {
167673
- return true;
167674
- }
167675
- // Block private networks
167676
- // 10.0.0.0/8
167677
- if (a === 10) {
167678
- return true;
167679
- }
167680
- // 172.16.0.0/12 (172.16.x.x through 172.31.x.x)
167681
- if (a === 172 && b >= 16 && b <= 31) {
167682
- return true;
167683
- }
167684
- // 192.168.0.0/16
167685
- if (a === 192 && b === 168) {
167686
- return true;
167687
- }
167688
- }
167689
- // Check IPv6 patterns
167690
- // Block unique local addresses: fd00::/8
167691
- if (normalized.startsWith('fd') || normalized.startsWith('fc')) {
167692
- return true;
167693
- }
167694
- // Block link-local: fe80::/10
167695
- if (normalized.startsWith('fe80:')) {
167696
- return true;
167697
- }
167698
- return false;
167699
- }
167700
- /**
167701
- * Evaluate a policy rule against an input document via OPA REST API.
167702
- *
167703
- * @param input - The input document to evaluate
167704
- * @param rulePath - OPA rule path (e.g., 'visor/check/execute')
167705
- * @returns The result object from OPA, or undefined on error
167706
- */
167707
- async evaluate(input, rulePath) {
167708
- // OPA Data API: POST /v1/data/<path>
167709
- const encodedPath = rulePath
167710
- .split('/')
167711
- .map(s => encodeURIComponent(s))
167712
- .join('/');
167713
- const url = `${this.baseUrl}/v1/data/${encodedPath}`;
167714
- const controller = new AbortController();
167715
- const timer = setTimeout(() => controller.abort(), this.timeout);
167716
- try {
167717
- const response = await fetch(url, {
167718
- method: 'POST',
167719
- headers: { 'Content-Type': 'application/json' },
167720
- body: JSON.stringify({ input }),
167721
- signal: controller.signal,
167722
- });
167723
- if (!response.ok) {
167724
- throw new Error(`OPA HTTP ${response.status}: ${response.statusText}`);
167725
- }
167726
- let body;
167727
- try {
167728
- body = await response.json();
167729
- }
167730
- catch (jsonErr) {
167731
- throw new Error(`OPA HTTP evaluator: failed to parse JSON response: ${jsonErr instanceof Error ? jsonErr.message : String(jsonErr)}`);
167732
- }
167733
- // OPA returns { result: { ... } }
167734
- return body?.result;
167735
- }
167736
- finally {
167737
- clearTimeout(timer);
167738
- }
167739
- }
167740
- async shutdown() {
167741
- // No persistent connections to close
167742
- }
167743
- }
167744
- exports.OpaHttpEvaluator = OpaHttpEvaluator;
167745
-
167746
-
167747
- /***/ }),
167748
-
167749
- /***/ 39530:
167750
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
167751
-
167752
- "use strict";
167753
-
167754
- /**
167755
- * Copyright (c) ProbeLabs. All rights reserved.
167756
- * Licensed under the Elastic License 2.0; you may not use this file except
167757
- * in compliance with the Elastic License 2.0.
167758
- */
167759
- Object.defineProperty(exports, "__esModule", ({ value: true }));
167760
- exports.OpaPolicyEngine = void 0;
167761
- const opa_wasm_evaluator_1 = __nccwpck_require__(8613);
167762
- const opa_http_evaluator_1 = __nccwpck_require__(44693);
167763
- const policy_input_builder_1 = __nccwpck_require__(17117);
167764
- /**
167765
- * Enterprise OPA Policy Engine.
167766
- *
167767
- * Wraps both WASM (local) and HTTP (remote) OPA evaluators behind the
167768
- * OSS PolicyEngine interface. All OPA input building and role resolution
167769
- * is handled internally — the OSS call sites pass only plain types.
167770
- */
167771
- class OpaPolicyEngine {
167772
- evaluator = null;
167773
- fallback;
167774
- timeout;
167775
- config;
167776
- inputBuilder = null;
167777
- logger = null;
167778
- constructor(config) {
167779
- this.config = config;
167780
- this.fallback = config.fallback || 'deny';
167781
- this.timeout = config.timeout || 5000;
167782
- }
167783
- async initialize(config) {
167784
- // Resolve logger once at initialization
167785
- try {
167786
- this.logger = (__nccwpck_require__(86999).logger);
167787
- }
167788
- catch {
167789
- // logger not available in this context
167790
- }
167791
- // Build actor/repo context from environment (available at engine init time)
167792
- const actor = {
167793
- authorAssociation: process.env.VISOR_AUTHOR_ASSOCIATION,
167794
- login: process.env.VISOR_AUTHOR_LOGIN || process.env.GITHUB_ACTOR,
167795
- isLocalMode: !process.env.GITHUB_ACTIONS,
167796
- };
167797
- const repo = {
167798
- owner: process.env.GITHUB_REPOSITORY_OWNER,
167799
- name: process.env.GITHUB_REPOSITORY?.split('/')[1],
167800
- branch: process.env.GITHUB_HEAD_REF,
167801
- baseBranch: process.env.GITHUB_BASE_REF,
167802
- event: process.env.GITHUB_EVENT_NAME,
167803
- };
167804
- const prNum = process.env.GITHUB_PR_NUMBER
167805
- ? parseInt(process.env.GITHUB_PR_NUMBER, 10)
167806
- : undefined;
167807
- const pullRequest = {
167808
- number: prNum !== undefined && Number.isFinite(prNum) ? prNum : undefined,
167809
- };
167810
- this.inputBuilder = new policy_input_builder_1.PolicyInputBuilder(config, actor, repo, pullRequest);
167811
- if (config.engine === 'local') {
167812
- if (!config.rules) {
167813
- throw new Error('OPA local mode requires `policy.rules` path to .wasm or .rego files');
167814
- }
167815
- const wasm = new opa_wasm_evaluator_1.OpaWasmEvaluator();
167816
- await wasm.initialize(config.rules);
167817
- if (config.data) {
167818
- wasm.loadData(config.data);
167819
- }
167820
- this.evaluator = wasm;
167821
- }
167822
- else if (config.engine === 'remote') {
167823
- if (!config.url) {
167824
- throw new Error('OPA remote mode requires `policy.url` pointing to OPA server');
167825
- }
167826
- this.evaluator = new opa_http_evaluator_1.OpaHttpEvaluator(config.url, this.timeout);
167827
- }
167828
- else {
167829
- this.evaluator = null;
167830
- }
167831
- }
167832
- /**
167833
- * Update actor/repo/PR context (e.g., after PR info becomes available).
167834
- * Called by the enterprise loader when engine context is enriched.
167835
- */
167836
- setActorContext(actor, repo, pullRequest) {
167837
- this.inputBuilder = new policy_input_builder_1.PolicyInputBuilder(this.config, actor, repo, pullRequest);
167838
- }
167839
- async evaluateCheckExecution(checkId, checkConfig) {
167840
- if (!this.evaluator || !this.inputBuilder)
167841
- return { allowed: true };
167842
- const cfg = checkConfig && typeof checkConfig === 'object'
167843
- ? checkConfig
167844
- : {};
167845
- const policyOverride = cfg.policy;
167846
- const input = this.inputBuilder.forCheckExecution({
167847
- id: checkId,
167848
- type: cfg.type || 'ai',
167849
- group: cfg.group,
167850
- tags: cfg.tags,
167851
- criticality: cfg.criticality,
167852
- sandbox: cfg.sandbox,
167853
- policy: policyOverride,
167854
- });
167855
- return this.doEvaluate(input, this.resolveRulePath('check.execute', policyOverride?.rule));
167856
- }
167857
- async evaluateToolInvocation(serverName, methodName, transport) {
167858
- if (!this.evaluator || !this.inputBuilder)
167859
- return { allowed: true };
167860
- const input = this.inputBuilder.forToolInvocation(serverName, methodName, transport);
167861
- return this.doEvaluate(input, 'visor/tool/invoke');
167862
- }
167863
- async evaluateCapabilities(checkId, capabilities) {
167864
- if (!this.evaluator || !this.inputBuilder)
167865
- return { allowed: true };
167866
- const input = this.inputBuilder.forCapabilityResolve(checkId, capabilities);
167867
- return this.doEvaluate(input, 'visor/capability/resolve');
167868
- }
167869
- async shutdown() {
167870
- if (this.evaluator && 'shutdown' in this.evaluator) {
167871
- await this.evaluator.shutdown();
167872
- }
167873
- this.evaluator = null;
167874
- this.inputBuilder = null;
167875
- }
167876
- resolveRulePath(defaultScope, override) {
167877
- if (override) {
167878
- return override.startsWith('visor/') ? override : `visor/${override}`;
167879
- }
167880
- return `visor/${defaultScope.replace(/\./g, '/')}`;
167881
- }
167882
- async doEvaluate(input, rulePath) {
167883
- try {
167884
- this.logger?.debug(`[PolicyEngine] Evaluating ${rulePath}`, JSON.stringify(input));
167885
- let timer;
167886
- const timeoutPromise = new Promise((_resolve, reject) => {
167887
- timer = setTimeout(() => reject(new Error('policy evaluation timeout')), this.timeout);
167888
- });
167889
- try {
167890
- const result = await Promise.race([this.rawEvaluate(input, rulePath), timeoutPromise]);
167891
- const decision = this.parseDecision(result);
167892
- // In warn mode, override denied decisions to allowed but flag as warn
167893
- if (!decision.allowed && this.fallback === 'warn') {
167894
- decision.allowed = true;
167895
- decision.warn = true;
167896
- decision.reason = `audit: ${decision.reason || 'policy denied'}`;
167897
- }
167898
- this.logger?.debug(`[PolicyEngine] Decision for ${rulePath}: allowed=${decision.allowed}, warn=${decision.warn || false}, reason=${decision.reason || 'none'}`);
167899
- return decision;
167900
- }
167901
- finally {
167902
- if (timer)
167903
- clearTimeout(timer);
167904
- }
167905
- }
167906
- catch (err) {
167907
- const msg = err instanceof Error ? err.message : String(err);
167908
- this.logger?.warn(`[PolicyEngine] Evaluation failed for ${rulePath}: ${msg}`);
167909
- return {
167910
- allowed: this.fallback === 'allow' || this.fallback === 'warn',
167911
- warn: this.fallback === 'warn' ? true : undefined,
167912
- reason: `policy evaluation failed, fallback=${this.fallback}`,
167913
- };
167914
- }
167915
- }
167916
- async rawEvaluate(input, rulePath) {
167917
- if (this.evaluator instanceof opa_wasm_evaluator_1.OpaWasmEvaluator) {
167918
- const result = await this.evaluator.evaluate(input);
167919
- // WASM compiled with `-e visor` entrypoint returns the full visor package tree.
167920
- // Navigate to the specific rule subtree using rulePath segments.
167921
- // e.g., 'visor/check/execute' → result.check.execute
167922
- return this.navigateWasmResult(result, rulePath);
167923
- }
167924
- return this.evaluator.evaluate(input, rulePath);
167925
- }
167926
- /**
167927
- * Navigate nested OPA WASM result tree to reach the specific rule's output.
167928
- * The WASM entrypoint `-e visor` means the result root IS the visor package,
167929
- * so we strip the `visor/` prefix and walk the remaining segments.
167930
- */
167931
- navigateWasmResult(result, rulePath) {
167932
- if (!result || typeof result !== 'object')
167933
- return result;
167934
- // Strip the 'visor/' prefix (matches our compilation entrypoint)
167935
- const segments = rulePath.replace(/^visor\//, '').split('/');
167936
- let current = result;
167937
- for (const seg of segments) {
167938
- if (current && typeof current === 'object' && seg in current) {
167939
- current = current[seg];
167940
- }
167941
- else {
167942
- return undefined; // path not found in result tree
167943
- }
167944
- }
167945
- return current;
167946
- }
167947
- parseDecision(result) {
167948
- if (result === undefined || result === null) {
167949
- return {
167950
- allowed: this.fallback === 'allow' || this.fallback === 'warn',
167951
- warn: this.fallback === 'warn' ? true : undefined,
167952
- reason: this.fallback === 'warn' ? 'audit: no policy result' : 'no policy result',
167953
- };
167954
- }
167955
- const allowed = result.allowed !== false;
167956
- const decision = {
167957
- allowed,
167958
- reason: result.reason,
167959
- };
167960
- if (result.capabilities) {
167961
- decision.capabilities = result.capabilities;
167962
- }
167963
- return decision;
167964
- }
167965
- }
167966
- exports.OpaPolicyEngine = OpaPolicyEngine;
167967
-
167968
-
167969
- /***/ }),
167970
-
167971
- /***/ 8613:
167972
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
167973
-
167974
- "use strict";
167975
-
167976
- /**
167977
- * Copyright (c) ProbeLabs. All rights reserved.
167978
- * Licensed under the Elastic License 2.0; you may not use this file except
167979
- * in compliance with the Elastic License 2.0.
167980
- */
167981
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
167982
- if (k2 === undefined) k2 = k;
167983
- var desc = Object.getOwnPropertyDescriptor(m, k);
167984
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
167985
- desc = { enumerable: true, get: function() { return m[k]; } };
167986
- }
167987
- Object.defineProperty(o, k2, desc);
167988
- }) : (function(o, m, k, k2) {
167989
- if (k2 === undefined) k2 = k;
167990
- o[k2] = m[k];
167991
- }));
167992
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
167993
- Object.defineProperty(o, "default", { enumerable: true, value: v });
167994
- }) : function(o, v) {
167995
- o["default"] = v;
167996
- });
167997
- var __importStar = (this && this.__importStar) || (function () {
167998
- var ownKeys = function(o) {
167999
- ownKeys = Object.getOwnPropertyNames || function (o) {
168000
- var ar = [];
168001
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
168002
- return ar;
168003
- };
168004
- return ownKeys(o);
168005
- };
168006
- return function (mod) {
168007
- if (mod && mod.__esModule) return mod;
168008
- var result = {};
168009
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
168010
- __setModuleDefault(result, mod);
168011
- return result;
168012
- };
168013
- })();
168014
- Object.defineProperty(exports, "__esModule", ({ value: true }));
168015
- exports.OpaWasmEvaluator = void 0;
168016
- const fs = __importStar(__nccwpck_require__(79896));
168017
- const path = __importStar(__nccwpck_require__(16928));
168018
- const opa_compiler_1 = __nccwpck_require__(628);
168019
- /**
168020
- * OPA WASM Evaluator - loads and evaluates OPA policies locally.
168021
- *
168022
- * Supports three input formats:
168023
- * 1. Pre-compiled `.wasm` bundle — loaded directly (fastest startup)
168024
- * 2. `.rego` files or directory — auto-compiled to WASM via `opa build` CLI
168025
- * 3. Directory with `policy.wasm` inside — loaded directly
168026
- *
168027
- * Compilation and caching of .rego files is delegated to {@link OpaCompiler}.
168028
- *
168029
- * Requires:
168030
- * - `@open-policy-agent/opa-wasm` npm package (optional dep)
168031
- * - `opa` CLI on PATH (only when auto-compiling .rego files)
168032
- */
168033
- class OpaWasmEvaluator {
168034
- policy = null;
168035
- dataDocument = {};
168036
- compiler = new opa_compiler_1.OpaCompiler();
168037
- async initialize(rulesPath) {
168038
- const paths = Array.isArray(rulesPath) ? rulesPath : [rulesPath];
168039
- const wasmBytes = await this.compiler.resolveWasmBytes(paths);
168040
- try {
168041
- // Use createRequire to load the optional dep at runtime without ncc bundling it.
168042
- // `new Function('id', 'return require(id)')` fails in ncc bundles because
168043
- // `require` is not in the `new Function` scope. `createRequire` works correctly
168044
- // because it creates a real Node.js require rooted at the given path.
168045
- // eslint-disable-next-line @typescript-eslint/no-var-requires
168046
- const { createRequire } = __nccwpck_require__(73339);
168047
- const runtimeRequire = createRequire(__filename);
168048
- const opaWasm = runtimeRequire('@open-policy-agent/opa-wasm');
168049
- const loadPolicy = opaWasm.loadPolicy || opaWasm.default?.loadPolicy;
168050
- if (!loadPolicy) {
168051
- throw new Error('loadPolicy not found in @open-policy-agent/opa-wasm');
168052
- }
168053
- this.policy = await loadPolicy(wasmBytes);
168054
- }
168055
- catch (err) {
168056
- if (err?.code === 'MODULE_NOT_FOUND' || err?.code === 'ERR_MODULE_NOT_FOUND') {
168057
- throw new Error('OPA WASM evaluator requires @open-policy-agent/opa-wasm. ' +
168058
- 'Install it with: npm install @open-policy-agent/opa-wasm');
168059
- }
168060
- throw err;
168061
- }
168062
- }
168063
- /**
168064
- * Load external data from a JSON file to use as the OPA data document.
168065
- * The loaded data will be passed to `policy.setData()` during evaluation,
168066
- * making it available in Rego via `data.<key>`.
168067
- */
168068
- loadData(dataPath) {
168069
- const resolved = path.resolve(dataPath);
168070
- if (path.normalize(resolved).includes('..')) {
168071
- throw new Error(`Data path contains traversal sequences: ${dataPath}`);
168072
- }
168073
- if (!fs.existsSync(resolved)) {
168074
- throw new Error(`OPA data file not found: ${resolved}`);
168075
- }
168076
- const stat = fs.statSync(resolved);
168077
- if (stat.size > 10 * 1024 * 1024) {
168078
- throw new Error(`OPA data file exceeds 10MB limit: ${resolved} (${stat.size} bytes)`);
168079
- }
168080
- const raw = fs.readFileSync(resolved, 'utf-8');
168081
- try {
168082
- const parsed = JSON.parse(raw);
168083
- if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
168084
- throw new Error('OPA data file must contain a JSON object (not an array or primitive)');
168085
- }
168086
- this.dataDocument = parsed;
168087
- }
168088
- catch (err) {
168089
- if (err.message.startsWith('OPA data file must')) {
168090
- throw err;
168091
- }
168092
- throw new Error(`Failed to parse OPA data file ${resolved}: ${err.message}`);
168093
- }
168094
- }
168095
- async evaluate(input) {
168096
- if (!this.policy) {
168097
- throw new Error('OPA WASM evaluator not initialized');
168098
- }
168099
- this.policy.setData(this.dataDocument);
168100
- const resultSet = this.policy.evaluate(input);
168101
- if (Array.isArray(resultSet) && resultSet.length > 0) {
168102
- return resultSet[0].result;
168103
- }
168104
- return undefined;
168105
- }
168106
- async shutdown() {
168107
- if (this.policy) {
168108
- // opa-wasm policy objects may have a close/free method for WASM cleanup
168109
- if (typeof this.policy.close === 'function') {
168110
- try {
168111
- this.policy.close();
168112
- }
168113
- catch { }
168114
- }
168115
- else if (typeof this.policy.free === 'function') {
168116
- try {
168117
- this.policy.free();
168118
- }
168119
- catch { }
168120
- }
168121
- }
168122
- this.policy = null;
168123
- }
168124
- }
168125
- exports.OpaWasmEvaluator = OpaWasmEvaluator;
168126
-
168127
-
168128
- /***/ }),
168129
-
168130
- /***/ 17117:
168131
- /***/ ((__unused_webpack_module, exports) => {
168132
-
168133
- "use strict";
168134
-
168135
- /**
168136
- * Copyright (c) ProbeLabs. All rights reserved.
168137
- * Licensed under the Elastic License 2.0; you may not use this file except
168138
- * in compliance with the Elastic License 2.0.
168139
- */
168140
- Object.defineProperty(exports, "__esModule", ({ value: true }));
168141
- exports.PolicyInputBuilder = void 0;
168142
- /**
168143
- * Builds OPA-compatible input documents from engine context.
168144
- *
168145
- * Resolves actor roles from the `policy.roles` config section by matching
168146
- * the actor's authorAssociation and login against role definitions.
168147
- */
168148
- class PolicyInputBuilder {
168149
- roles;
168150
- actor;
168151
- repository;
168152
- pullRequest;
168153
- constructor(policyConfig, actor, repository, pullRequest) {
168154
- this.roles = policyConfig.roles || {};
168155
- this.actor = actor;
168156
- this.repository = repository;
168157
- this.pullRequest = pullRequest;
168158
- }
168159
- /** Resolve which roles apply to the current actor. */
168160
- resolveRoles() {
168161
- const matched = [];
168162
- for (const [roleName, roleConfig] of Object.entries(this.roles)) {
168163
- let identityMatch = false;
168164
- if (roleConfig.author_association &&
168165
- this.actor.authorAssociation &&
168166
- roleConfig.author_association.includes(this.actor.authorAssociation)) {
168167
- identityMatch = true;
168168
- }
168169
- if (!identityMatch &&
168170
- roleConfig.users &&
168171
- this.actor.login &&
168172
- roleConfig.users.includes(this.actor.login)) {
168173
- identityMatch = true;
168174
- }
168175
- // Slack user ID match
168176
- if (!identityMatch &&
168177
- roleConfig.slack_users &&
168178
- this.actor.slack?.userId &&
168179
- roleConfig.slack_users.includes(this.actor.slack.userId)) {
168180
- identityMatch = true;
168181
- }
168182
- // Email match (case-insensitive)
168183
- if (!identityMatch && roleConfig.emails && this.actor.slack?.email) {
168184
- const actorEmail = this.actor.slack.email.toLowerCase();
168185
- if (roleConfig.emails.some(e => e.toLowerCase() === actorEmail)) {
168186
- identityMatch = true;
168187
- }
168188
- }
168189
- // Note: teams-based role resolution requires GitHub API access (read:org scope)
168190
- // and is not yet implemented. If configured, the role will not match via teams.
168191
- if (!identityMatch)
168192
- continue;
168193
- // slack_channels gate: if set, the role only applies when triggered from one of these channels
168194
- if (roleConfig.slack_channels && roleConfig.slack_channels.length > 0) {
168195
- if (!this.actor.slack?.channelId ||
168196
- !roleConfig.slack_channels.includes(this.actor.slack.channelId)) {
168197
- continue;
168198
- }
168199
- }
168200
- matched.push(roleName);
168201
- }
168202
- return matched;
168203
- }
168204
- buildActor() {
168205
- return {
168206
- authorAssociation: this.actor.authorAssociation,
168207
- login: this.actor.login,
168208
- roles: this.resolveRoles(),
168209
- isLocalMode: this.actor.isLocalMode,
168210
- ...(this.actor.slack && { slack: this.actor.slack }),
168211
- };
168212
- }
168213
- forCheckExecution(check) {
168214
- return {
168215
- scope: 'check.execute',
168216
- check: {
168217
- id: check.id,
168218
- type: check.type,
168219
- group: check.group,
168220
- tags: check.tags,
168221
- criticality: check.criticality,
168222
- sandbox: check.sandbox,
168223
- policy: check.policy,
168224
- },
168225
- actor: this.buildActor(),
168226
- repository: this.repository,
168227
- pullRequest: this.pullRequest,
168228
- };
168229
- }
168230
- forToolInvocation(serverName, methodName, transport) {
168231
- return {
168232
- scope: 'tool.invoke',
168233
- tool: { serverName, methodName, transport },
168234
- actor: this.buildActor(),
168235
- repository: this.repository,
168236
- pullRequest: this.pullRequest,
168237
- };
168238
- }
168239
- forCapabilityResolve(checkId, capabilities) {
168240
- return {
168241
- scope: 'capability.resolve',
168242
- check: { id: checkId, type: 'ai' },
168243
- capability: capabilities,
168244
- actor: this.buildActor(),
168245
- repository: this.repository,
168246
- pullRequest: this.pullRequest,
168247
- };
168248
- }
168249
- }
168250
- exports.PolicyInputBuilder = PolicyInputBuilder;
168251
-
168252
-
168253
- /***/ }),
168254
-
168255
- /***/ 63737:
168256
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
168257
-
168258
- "use strict";
168259
-
168260
- /**
168261
- * Copyright (c) ProbeLabs. All rights reserved.
168262
- * Licensed under the Elastic License 2.0; you may not use this file except
168263
- * in compliance with the Elastic License 2.0.
168264
- */
168265
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
168266
- if (k2 === undefined) k2 = k;
168267
- var desc = Object.getOwnPropertyDescriptor(m, k);
168268
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
168269
- desc = { enumerable: true, get: function() { return m[k]; } };
168270
- }
168271
- Object.defineProperty(o, k2, desc);
168272
- }) : (function(o, m, k, k2) {
168273
- if (k2 === undefined) k2 = k;
168274
- o[k2] = m[k];
168275
- }));
168276
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
168277
- Object.defineProperty(o, "default", { enumerable: true, value: v });
168278
- }) : function(o, v) {
168279
- o["default"] = v;
168280
- });
168281
- var __importStar = (this && this.__importStar) || (function () {
168282
- var ownKeys = function(o) {
168283
- ownKeys = Object.getOwnPropertyNames || function (o) {
168284
- var ar = [];
168285
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
168286
- return ar;
168287
- };
168288
- return ownKeys(o);
168289
- };
168290
- return function (mod) {
168291
- if (mod && mod.__esModule) return mod;
168292
- var result = {};
168293
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
168294
- __setModuleDefault(result, mod);
168295
- return result;
168296
- };
168297
- })();
168298
- Object.defineProperty(exports, "__esModule", ({ value: true }));
168299
- exports.KnexStoreBackend = void 0;
168300
- /**
168301
- * Knex-backed schedule store for PostgreSQL, MySQL, and MSSQL (Enterprise)
168302
- *
168303
- * Uses Knex query builder for database-agnostic SQL. Same schema as SQLite backend
168304
- * but with real distributed locking via row-level claims (claimed_by/claimed_at/lock_token).
168305
- */
168306
- const fs = __importStar(__nccwpck_require__(79896));
168307
- const path = __importStar(__nccwpck_require__(16928));
168308
- const uuid_1 = __nccwpck_require__(31914);
168309
- const logger_1 = __nccwpck_require__(86999);
168310
- function toNum(val) {
168311
- if (val === null || val === undefined)
168312
- return undefined;
168313
- return typeof val === 'string' ? parseInt(val, 10) : val;
168314
- }
168315
- function safeJsonParse(value) {
168316
- if (!value)
168317
- return undefined;
168318
- try {
168319
- return JSON.parse(value);
168320
- }
168321
- catch {
168322
- return undefined;
168323
- }
168324
- }
168325
- function fromTriggerRow(row) {
168326
- return {
168327
- id: row.id,
168328
- creatorId: row.creator_id,
168329
- creatorContext: row.creator_context ?? undefined,
168330
- creatorName: row.creator_name ?? undefined,
168331
- description: row.description ?? undefined,
168332
- channels: safeJsonParse(row.channels),
168333
- fromUsers: safeJsonParse(row.from_users),
168334
- fromBots: row.from_bots === true || row.from_bots === 1,
168335
- contains: safeJsonParse(row.contains),
168336
- matchPattern: row.match_pattern ?? undefined,
168337
- threads: row.threads,
168338
- workflow: row.workflow,
168339
- inputs: safeJsonParse(row.inputs),
168340
- outputContext: safeJsonParse(row.output_context),
168341
- status: row.status,
168342
- enabled: row.enabled === true || row.enabled === 1,
168343
- createdAt: toNum(row.created_at),
168344
- };
168345
- }
168346
- function toTriggerInsertRow(trigger) {
168347
- return {
168348
- id: trigger.id,
168349
- creator_id: trigger.creatorId,
168350
- creator_context: trigger.creatorContext ?? null,
168351
- creator_name: trigger.creatorName ?? null,
168352
- description: trigger.description ?? null,
168353
- channels: trigger.channels ? JSON.stringify(trigger.channels) : null,
168354
- from_users: trigger.fromUsers ? JSON.stringify(trigger.fromUsers) : null,
168355
- from_bots: trigger.fromBots,
168356
- contains: trigger.contains ? JSON.stringify(trigger.contains) : null,
168357
- match_pattern: trigger.matchPattern ?? null,
168358
- threads: trigger.threads,
168359
- workflow: trigger.workflow,
168360
- inputs: trigger.inputs ? JSON.stringify(trigger.inputs) : null,
168361
- output_context: trigger.outputContext ? JSON.stringify(trigger.outputContext) : null,
168362
- status: trigger.status,
168363
- enabled: trigger.enabled,
168364
- created_at: trigger.createdAt,
168365
- };
168366
- }
168367
- function fromDbRow(row) {
168368
- return {
168369
- id: row.id,
168370
- creatorId: row.creator_id,
168371
- creatorContext: row.creator_context ?? undefined,
168372
- creatorName: row.creator_name ?? undefined,
168373
- timezone: row.timezone,
168374
- schedule: row.schedule_expr,
168375
- runAt: toNum(row.run_at),
168376
- isRecurring: row.is_recurring === true || row.is_recurring === 1,
168377
- originalExpression: row.original_expression,
168378
- workflow: row.workflow ?? undefined,
168379
- workflowInputs: safeJsonParse(row.workflow_inputs),
168380
- outputContext: safeJsonParse(row.output_context),
168381
- status: row.status,
168382
- createdAt: toNum(row.created_at),
168383
- lastRunAt: toNum(row.last_run_at),
168384
- nextRunAt: toNum(row.next_run_at),
168385
- runCount: row.run_count,
168386
- failureCount: row.failure_count,
168387
- lastError: row.last_error ?? undefined,
168388
- previousResponse: row.previous_response ?? undefined,
168389
- };
168390
- }
168391
- function toInsertRow(schedule) {
168392
- return {
168393
- id: schedule.id,
168394
- creator_id: schedule.creatorId,
168395
- creator_context: schedule.creatorContext ?? null,
168396
- creator_name: schedule.creatorName ?? null,
168397
- timezone: schedule.timezone,
168398
- schedule_expr: schedule.schedule,
168399
- run_at: schedule.runAt ?? null,
168400
- is_recurring: schedule.isRecurring,
168401
- original_expression: schedule.originalExpression,
168402
- workflow: schedule.workflow ?? null,
168403
- workflow_inputs: schedule.workflowInputs ? JSON.stringify(schedule.workflowInputs) : null,
168404
- output_context: schedule.outputContext ? JSON.stringify(schedule.outputContext) : null,
168405
- status: schedule.status,
168406
- created_at: schedule.createdAt,
168407
- last_run_at: schedule.lastRunAt ?? null,
168408
- next_run_at: schedule.nextRunAt ?? null,
168409
- run_count: schedule.runCount,
168410
- failure_count: schedule.failureCount,
168411
- last_error: schedule.lastError ?? null,
168412
- previous_response: schedule.previousResponse ?? null,
168413
- };
168414
- }
168415
- /**
168416
- * Enterprise Knex-backed store for PostgreSQL, MySQL, and MSSQL
168417
- */
168418
- class KnexStoreBackend {
168419
- knex = null;
168420
- driver;
168421
- connection;
168422
- constructor(driver, storageConfig, _haConfig) {
168423
- this.driver = driver;
168424
- this.connection = (storageConfig.connection || {});
168425
- }
168426
- async initialize() {
168427
- // Load knex dynamically
168428
- const { createRequire } = __nccwpck_require__(73339);
168429
- const runtimeRequire = createRequire(__filename);
168430
- let knexFactory;
168431
- try {
168432
- knexFactory = runtimeRequire('knex');
168433
- }
168434
- catch (err) {
168435
- const code = err?.code;
168436
- if (code === 'MODULE_NOT_FOUND' || code === 'ERR_MODULE_NOT_FOUND') {
168437
- throw new Error('knex is required for PostgreSQL/MySQL/MSSQL schedule storage. ' +
168438
- 'Install it with: npm install knex');
168439
- }
168440
- throw err;
168441
- }
168442
- const clientMap = {
168443
- postgresql: 'pg',
168444
- mysql: 'mysql2',
168445
- mssql: 'tedious',
168446
- };
168447
- const client = clientMap[this.driver];
168448
- // Build connection config
168449
- let connection;
168450
- if (this.connection.connection_string) {
168451
- connection = this.connection.connection_string;
168452
- }
168453
- else if (this.driver === 'mssql') {
168454
- connection = this.buildMssqlConnection();
168455
- }
168456
- else {
168457
- connection = this.buildStandardConnection();
168458
- }
168459
- this.knex = knexFactory({
168460
- client,
168461
- connection,
168462
- pool: {
168463
- min: this.connection.pool?.min ?? 0,
168464
- max: this.connection.pool?.max ?? 10,
168465
- },
168466
- });
168467
- // Run schema migration
168468
- await this.migrateSchema();
168469
- logger_1.logger.info(`[KnexStore] Initialized (${this.driver})`);
168470
- }
168471
- buildStandardConnection() {
168472
- return {
168473
- host: this.connection.host || 'localhost',
168474
- port: this.connection.port,
168475
- database: this.connection.database || 'visor',
168476
- user: this.connection.user,
168477
- password: this.connection.password,
168478
- ssl: this.resolveSslConfig(),
168479
- };
168480
- }
168481
- buildMssqlConnection() {
168482
- const ssl = this.connection.ssl;
168483
- const sslEnabled = ssl === true || (typeof ssl === 'object' && ssl.enabled !== false);
168484
- return {
168485
- server: this.connection.host || 'localhost',
168486
- port: this.connection.port,
168487
- database: this.connection.database || 'visor',
168488
- user: this.connection.user,
168489
- password: this.connection.password,
168490
- options: {
168491
- encrypt: sslEnabled,
168492
- trustServerCertificate: typeof ssl === 'object' ? ssl.reject_unauthorized === false : !sslEnabled,
168493
- },
168494
- };
168495
- }
168496
- resolveSslConfig() {
168497
- const ssl = this.connection.ssl;
168498
- if (ssl === false || ssl === undefined)
168499
- return false;
168500
- if (ssl === true)
168501
- return { rejectUnauthorized: true };
168502
- // Object config
168503
- if (ssl.enabled === false)
168504
- return false;
168505
- const result = {
168506
- rejectUnauthorized: ssl.reject_unauthorized !== false,
168507
- };
168508
- if (ssl.ca) {
168509
- const caPath = this.validateSslPath(ssl.ca, 'CA certificate');
168510
- result.ca = fs.readFileSync(caPath, 'utf8');
168511
- }
168512
- if (ssl.cert) {
168513
- const certPath = this.validateSslPath(ssl.cert, 'client certificate');
168514
- result.cert = fs.readFileSync(certPath, 'utf8');
168515
- }
168516
- if (ssl.key) {
168517
- const keyPath = this.validateSslPath(ssl.key, 'client key');
168518
- result.key = fs.readFileSync(keyPath, 'utf8');
168519
- }
168520
- return result;
168521
- }
168522
- validateSslPath(filePath, label) {
168523
- const resolved = path.resolve(filePath);
168524
- if (resolved !== path.normalize(resolved)) {
168525
- throw new Error(`SSL ${label} path contains invalid sequences: ${filePath}`);
168526
- }
168527
- if (!fs.existsSync(resolved)) {
168528
- throw new Error(`SSL ${label} not found: ${filePath}`);
168529
- }
168530
- return resolved;
168531
- }
168532
- async shutdown() {
168533
- if (this.knex) {
168534
- await this.knex.destroy();
168535
- this.knex = null;
168536
- }
168537
- }
168538
- async migrateSchema() {
168539
- const knex = this.getKnex();
168540
- const exists = await knex.schema.hasTable('schedules');
168541
- if (!exists) {
168542
- await knex.schema.createTable('schedules', table => {
168543
- table.string('id', 36).primary();
168544
- table.string('creator_id', 255).notNullable().index();
168545
- table.string('creator_context', 255);
168546
- table.string('creator_name', 255);
168547
- table.string('timezone', 64).notNullable().defaultTo('UTC');
168548
- table.string('schedule_expr', 255);
168549
- table.bigInteger('run_at');
168550
- table.boolean('is_recurring').notNullable();
168551
- table.text('original_expression');
168552
- table.string('workflow', 255);
168553
- table.text('workflow_inputs');
168554
- table.text('output_context');
168555
- table.string('status', 20).notNullable().index();
168556
- table.bigInteger('created_at').notNullable();
168557
- table.bigInteger('last_run_at');
168558
- table.bigInteger('next_run_at');
168559
- table.integer('run_count').notNullable().defaultTo(0);
168560
- table.integer('failure_count').notNullable().defaultTo(0);
168561
- table.text('last_error');
168562
- table.text('previous_response');
168563
- table.index(['status', 'next_run_at']);
168564
- });
168565
- }
168566
- // Create message_triggers table
168567
- const triggersExist = await knex.schema.hasTable('message_triggers');
168568
- if (!triggersExist) {
168569
- await knex.schema.createTable('message_triggers', table => {
168570
- table.string('id', 36).primary();
168571
- table.string('creator_id', 255).notNullable().index();
168572
- table.string('creator_context', 255);
168573
- table.string('creator_name', 255);
168574
- table.text('description');
168575
- table.text('channels'); // JSON array
168576
- table.text('from_users'); // JSON array
168577
- table.boolean('from_bots').notNullable().defaultTo(false);
168578
- table.text('contains'); // JSON array
168579
- table.text('match_pattern');
168580
- table.string('threads', 20).notNullable().defaultTo('any');
168581
- table.string('workflow', 255).notNullable();
168582
- table.text('inputs'); // JSON
168583
- table.text('output_context'); // JSON
168584
- table.string('status', 20).notNullable().defaultTo('active').index();
168585
- table.boolean('enabled').notNullable().defaultTo(true);
168586
- table.bigInteger('created_at').notNullable();
168587
- });
168588
- }
168589
- // Create scheduler_locks table for distributed locking
168590
- const locksExist = await knex.schema.hasTable('scheduler_locks');
168591
- if (!locksExist) {
168592
- await knex.schema.createTable('scheduler_locks', table => {
168593
- table.string('lock_id', 255).primary();
168594
- table.string('node_id', 255).notNullable();
168595
- table.string('lock_token', 36).notNullable();
168596
- table.bigInteger('acquired_at').notNullable();
168597
- table.bigInteger('expires_at').notNullable();
168598
- });
168599
- }
168600
- }
168601
- getKnex() {
168602
- if (!this.knex) {
168603
- throw new Error('[KnexStore] Not initialized. Call initialize() first.');
168604
- }
168605
- return this.knex;
168606
- }
168607
- // --- CRUD ---
168608
- async create(schedule) {
168609
- const knex = this.getKnex();
168610
- const newSchedule = {
168611
- ...schedule,
168612
- id: (0, uuid_1.v4)(),
168613
- createdAt: Date.now(),
168614
- runCount: 0,
168615
- failureCount: 0,
168616
- status: 'active',
168617
- };
168618
- await knex('schedules').insert(toInsertRow(newSchedule));
168619
- logger_1.logger.info(`[KnexStore] Created schedule ${newSchedule.id} for user ${newSchedule.creatorId}`);
168620
- return newSchedule;
168621
- }
168622
- async importSchedule(schedule) {
168623
- const knex = this.getKnex();
168624
- const existing = await knex('schedules').where('id', schedule.id).first();
168625
- if (existing)
168626
- return; // Already imported (idempotent)
168627
- await knex('schedules').insert(toInsertRow(schedule));
168628
- }
168629
- async get(id) {
168630
- const knex = this.getKnex();
168631
- const row = await knex('schedules').where('id', id).first();
168632
- return row ? fromDbRow(row) : undefined;
168633
- }
168634
- async update(id, patch) {
168635
- const knex = this.getKnex();
168636
- const existing = await knex('schedules').where('id', id).first();
168637
- if (!existing)
168638
- return undefined;
168639
- const current = fromDbRow(existing);
168640
- const updated = { ...current, ...patch, id: current.id };
168641
- const row = toInsertRow(updated);
168642
- // Remove id from update (PK cannot change)
168643
- delete row.id;
168644
- await knex('schedules').where('id', id).update(row);
168645
- return updated;
168646
- }
168647
- async delete(id) {
168648
- const knex = this.getKnex();
168649
- const deleted = await knex('schedules').where('id', id).del();
168650
- if (deleted > 0) {
168651
- logger_1.logger.info(`[KnexStore] Deleted schedule ${id}`);
168652
- return true;
168653
- }
168654
- return false;
168655
- }
168656
- // --- Queries ---
168657
- async getByCreator(creatorId) {
168658
- const knex = this.getKnex();
168659
- const rows = await knex('schedules').where('creator_id', creatorId);
168660
- return rows.map((r) => fromDbRow(r));
168661
- }
168662
- async getActiveSchedules() {
168663
- const knex = this.getKnex();
168664
- const rows = await knex('schedules').where('status', 'active');
168665
- return rows.map((r) => fromDbRow(r));
168666
- }
168667
- async getDueSchedules(now) {
168668
- const ts = now ?? Date.now();
168669
- const knex = this.getKnex();
168670
- // MSSQL uses 1/0 for booleans
168671
- const bFalse = this.driver === 'mssql' ? 0 : false;
168672
- const bTrue = this.driver === 'mssql' ? 1 : true;
168673
- const rows = await knex('schedules')
168674
- .where('status', 'active')
168675
- .andWhere(function () {
168676
- this.where(function () {
168677
- this.where('is_recurring', bFalse)
168678
- .whereNotNull('run_at')
168679
- .where('run_at', '<=', ts);
168680
- }).orWhere(function () {
168681
- this.where('is_recurring', bTrue)
168682
- .whereNotNull('next_run_at')
168683
- .where('next_run_at', '<=', ts);
168684
- });
168685
- });
168686
- return rows.map((r) => fromDbRow(r));
168687
- }
168688
- async findByWorkflow(creatorId, workflowName) {
168689
- const knex = this.getKnex();
168690
- const escaped = workflowName.toLowerCase().replace(/[%_\\]/g, '\\$&');
168691
- const pattern = `%${escaped}%`;
168692
- const rows = await knex('schedules')
168693
- .where('creator_id', creatorId)
168694
- .where('status', 'active')
168695
- .whereRaw("LOWER(workflow) LIKE ? ESCAPE '\\'", [pattern]);
168696
- return rows.map((r) => fromDbRow(r));
168697
- }
168698
- async getAll() {
168699
- const knex = this.getKnex();
168700
- const rows = await knex('schedules');
168701
- return rows.map((r) => fromDbRow(r));
168702
- }
168703
- async getStats() {
168704
- const knex = this.getKnex();
168705
- // MSSQL uses 1/0 for booleans; PostgreSQL/MySQL accept both true/1
168706
- const boolTrue = this.driver === 'mssql' ? '1' : 'true';
168707
- const boolFalse = this.driver === 'mssql' ? '0' : 'false';
168708
- const result = await knex('schedules')
168709
- .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`))
168710
- .first();
168711
- return {
168712
- total: Number(result.total) || 0,
168713
- active: Number(result.active) || 0,
168714
- paused: Number(result.paused) || 0,
168715
- completed: Number(result.completed) || 0,
168716
- failed: Number(result.failed) || 0,
168717
- recurring: Number(result.recurring) || 0,
168718
- oneTime: Number(result.one_time) || 0,
168719
- };
168720
- }
168721
- async validateLimits(creatorId, isRecurring, limits) {
168722
- const knex = this.getKnex();
168723
- if (limits.maxGlobal) {
168724
- const result = await knex('schedules').count('* as cnt').first();
168725
- if (Number(result?.cnt) >= limits.maxGlobal) {
168726
- throw new Error(`Global schedule limit reached (${limits.maxGlobal})`);
168727
- }
168728
- }
168729
- if (limits.maxPerUser) {
168730
- const result = await knex('schedules')
168731
- .where('creator_id', creatorId)
168732
- .count('* as cnt')
168733
- .first();
168734
- if (Number(result?.cnt) >= limits.maxPerUser) {
168735
- throw new Error(`You have reached the maximum number of schedules (${limits.maxPerUser})`);
168736
- }
168737
- }
168738
- if (isRecurring && limits.maxRecurringPerUser) {
168739
- const bTrue = this.driver === 'mssql' ? 1 : true;
168740
- const result = await knex('schedules')
168741
- .where('creator_id', creatorId)
168742
- .where('is_recurring', bTrue)
168743
- .count('* as cnt')
168744
- .first();
168745
- if (Number(result?.cnt) >= limits.maxRecurringPerUser) {
168746
- throw new Error(`You have reached the maximum number of recurring schedules (${limits.maxRecurringPerUser})`);
168747
- }
168748
- }
168749
- }
168750
- // --- HA Distributed Locking (via scheduler_locks table) ---
168751
- async tryAcquireLock(lockId, nodeId, ttlSeconds) {
168752
- const knex = this.getKnex();
168753
- const now = Date.now();
168754
- const expiresAt = now + ttlSeconds * 1000;
168755
- const token = (0, uuid_1.v4)();
168756
- // Step 1: Try to claim an existing expired lock
168757
- const updated = await knex('scheduler_locks')
168758
- .where('lock_id', lockId)
168759
- .where('expires_at', '<', now)
168760
- .update({
168761
- node_id: nodeId,
168762
- lock_token: token,
168763
- acquired_at: now,
168764
- expires_at: expiresAt,
168765
- });
168766
- if (updated > 0)
168767
- return token;
168768
- // Step 2: Try to INSERT a new lock row
168769
- try {
168770
- await knex('scheduler_locks').insert({
168771
- lock_id: lockId,
168772
- node_id: nodeId,
168773
- lock_token: token,
168774
- acquired_at: now,
168775
- expires_at: expiresAt,
168776
- });
168777
- return token;
168778
- }
168779
- catch {
168780
- // Unique constraint violation — another node holds the lock
168781
- return null;
168782
- }
168783
- }
168784
- async releaseLock(lockId, lockToken) {
168785
- const knex = this.getKnex();
168786
- await knex('scheduler_locks').where('lock_id', lockId).where('lock_token', lockToken).del();
168787
- }
168788
- async renewLock(lockId, lockToken, ttlSeconds) {
168789
- const knex = this.getKnex();
168790
- const now = Date.now();
168791
- const expiresAt = now + ttlSeconds * 1000;
168792
- const updated = await knex('scheduler_locks')
168793
- .where('lock_id', lockId)
168794
- .where('lock_token', lockToken)
168795
- .update({ acquired_at: now, expires_at: expiresAt });
168796
- return updated > 0;
168797
- }
168798
- async flush() {
168799
- // No-op for server-based backends
168800
- }
168801
- // --- Message Trigger CRUD ---
168802
- async createTrigger(trigger) {
168803
- const knex = this.getKnex();
168804
- const newTrigger = {
168805
- ...trigger,
168806
- id: (0, uuid_1.v4)(),
168807
- createdAt: Date.now(),
168808
- };
168809
- await knex('message_triggers').insert(toTriggerInsertRow(newTrigger));
168810
- logger_1.logger.info(`[KnexStore] Created trigger ${newTrigger.id} for user ${newTrigger.creatorId}`);
168811
- return newTrigger;
168812
- }
168813
- async getTrigger(id) {
168814
- const knex = this.getKnex();
168815
- const row = await knex('message_triggers').where('id', id).first();
168816
- return row ? fromTriggerRow(row) : undefined;
168817
- }
168818
- async updateTrigger(id, patch) {
168819
- const knex = this.getKnex();
168820
- const existing = await knex('message_triggers').where('id', id).first();
168821
- if (!existing)
168822
- return undefined;
168823
- const current = fromTriggerRow(existing);
168824
- const updated = {
168825
- ...current,
168826
- ...patch,
168827
- id: current.id,
168828
- createdAt: current.createdAt,
168829
- };
168830
- const row = toTriggerInsertRow(updated);
168831
- delete row.id;
168832
- await knex('message_triggers').where('id', id).update(row);
168833
- return updated;
168834
- }
168835
- async deleteTrigger(id) {
168836
- const knex = this.getKnex();
168837
- const deleted = await knex('message_triggers').where('id', id).del();
168838
- if (deleted > 0) {
168839
- logger_1.logger.info(`[KnexStore] Deleted trigger ${id}`);
168840
- return true;
168841
- }
168842
- return false;
168843
- }
168844
- async getTriggersByCreator(creatorId) {
168845
- const knex = this.getKnex();
168846
- const rows = await knex('message_triggers').where('creator_id', creatorId);
168847
- return rows.map((r) => fromTriggerRow(r));
168848
- }
168849
- async getActiveTriggers() {
168850
- const knex = this.getKnex();
168851
- const rows = await knex('message_triggers')
168852
- .where('status', 'active')
168853
- .where('enabled', this.driver === 'mssql' ? 1 : true);
168854
- return rows.map((r) => fromTriggerRow(r));
168855
- }
168856
- }
168857
- exports.KnexStoreBackend = KnexStoreBackend;
168858
-
168859
-
168860
167056
  /***/ }),
168861
167057
 
168862
167058
  /***/ 83864:
@@ -179830,35 +178026,6 @@ class OutputFormatters {
179830
178026
  exports.OutputFormatters = OutputFormatters;
179831
178027
 
179832
178028
 
179833
- /***/ }),
179834
-
179835
- /***/ 93866:
179836
- /***/ ((__unused_webpack_module, exports) => {
179837
-
179838
- "use strict";
179839
-
179840
- Object.defineProperty(exports, "__esModule", ({ value: true }));
179841
- exports.DefaultPolicyEngine = void 0;
179842
- /**
179843
- * Default (no-op) policy engine — always allows everything.
179844
- * Used when no enterprise license is present or policy is disabled.
179845
- */
179846
- class DefaultPolicyEngine {
179847
- async initialize(_config) { }
179848
- async evaluateCheckExecution(_checkId, _checkConfig) {
179849
- return { allowed: true };
179850
- }
179851
- async evaluateToolInvocation(_serverName, _methodName, _transport) {
179852
- return { allowed: true };
179853
- }
179854
- async evaluateCapabilities(_checkId, _capabilities) {
179855
- return { allowed: true };
179856
- }
179857
- async shutdown() { }
179858
- }
179859
- exports.DefaultPolicyEngine = DefaultPolicyEngine;
179860
-
179861
-
179862
178029
  /***/ }),
179863
178030
 
179864
178031
  /***/ 96611:
@@ -201475,7 +199642,7 @@ class StateMachineExecutionEngine {
201475
199642
  try {
201476
199643
  logger_1.logger.debug(`[PolicyEngine] Loading enterprise policy engine (engine=${configWithTagFilter.policy.engine})`);
201477
199644
  // @ts-ignore — enterprise/ may not exist in OSS builds (caught at runtime)
201478
- const { loadEnterprisePolicyEngine } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(87068)));
199645
+ const { loadEnterprisePolicyEngine } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(7065)));
201479
199646
  context.policyEngine = await loadEnterprisePolicyEngine(configWithTagFilter.policy);
201480
199647
  logger_1.logger.debug(`[PolicyEngine] Initialized: ${context.policyEngine?.constructor?.name || 'unknown'}`);
201481
199648
  }
@@ -211746,7 +209913,7 @@ async function initTelemetry(opts = {}) {
211746
209913
  const path = __nccwpck_require__(16928);
211747
209914
  const outDir = opts.file?.dir ||
211748
209915
  process.env.VISOR_TRACE_DIR ||
211749
- path.join(process.cwd(), 'output', 'traces');
209916
+ __nccwpck_require__.ab + "traces";
211750
209917
  fs.mkdirSync(outDir, { recursive: true });
211751
209918
  const ts = new Date().toISOString().replace(/[:.]/g, '-');
211752
209919
  process.env.VISOR_FALLBACK_TRACE_FILE = path.join(outDir, `run-${ts}.ndjson`);
@@ -211951,7 +210118,7 @@ async function shutdownTelemetry() {
211951
210118
  if (process.env.VISOR_TRACE_REPORT === 'true') {
211952
210119
  const fs = __nccwpck_require__(79896);
211953
210120
  const path = __nccwpck_require__(16928);
211954
- const outDir = process.env.VISOR_TRACE_DIR || path.join(process.cwd(), 'output', 'traces');
210121
+ const outDir = process.env.VISOR_TRACE_DIR || __nccwpck_require__.ab + "traces";
211955
210122
  if (!fs.existsSync(outDir))
211956
210123
  fs.mkdirSync(outDir, { recursive: true });
211957
210124
  const ts = new Date().toISOString().replace(/[:.]/g, '-');
@@ -212450,7 +210617,7 @@ function __getOrCreateNdjsonPath() {
212450
210617
  fs.mkdirSync(dir, { recursive: true });
212451
210618
  return __ndjsonPath;
212452
210619
  }
212453
- const outDir = process.env.VISOR_TRACE_DIR || path.join(process.cwd(), 'output', 'traces');
210620
+ const outDir = process.env.VISOR_TRACE_DIR || __nccwpck_require__.ab + "traces";
212454
210621
  if (!fs.existsSync(outDir))
212455
210622
  fs.mkdirSync(outDir, { recursive: true });
212456
210623
  if (!__ndjsonPath) {
@@ -226404,6 +224571,22 @@ class WorkflowRegistry {
226404
224571
  exports.WorkflowRegistry = WorkflowRegistry;
226405
224572
 
226406
224573
 
224574
+ /***/ }),
224575
+
224576
+ /***/ 7065:
224577
+ /***/ ((module) => {
224578
+
224579
+ module.exports = eval("require")("./enterprise/loader");
224580
+
224581
+
224582
+ /***/ }),
224583
+
224584
+ /***/ 71370:
224585
+ /***/ ((module) => {
224586
+
224587
+ module.exports = eval("require")("./enterprise/policy/policy-input-builder");
224588
+
224589
+
226407
224590
  /***/ }),
226408
224591
 
226409
224592
  /***/ 18327:
@@ -262678,7 +260861,7 @@ var require_fxp = __commonJS({
262678
260861
  }, o: (t6, e6) => Object.prototype.hasOwnProperty.call(t6, e6), r: (t6) => {
262679
260862
  "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t6, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t6, "__esModule", { value: true });
262680
260863
  } }, e5 = {};
262681
- t5.r(e5), t5.d(e5, { XMLBuilder: () => dt, XMLParser: () => it, XMLValidator: () => gt });
260864
+ t5.r(e5), t5.d(e5, { XMLBuilder: () => gt, XMLParser: () => it, XMLValidator: () => xt });
262682
260865
  const n5 = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD", i5 = new RegExp("^[" + n5 + "][" + n5 + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");
262683
260866
  function s5(t6, e6) {
262684
260867
  const n6 = [];
@@ -262700,90 +260883,90 @@ var require_fxp = __commonJS({
262700
260883
  const n6 = [];
262701
260884
  let i6 = false, s6 = false;
262702
260885
  "\uFEFF" === t6[0] && (t6 = t6.substr(1));
262703
- for (let o6 = 0; o6 < t6.length; o6++) if ("<" === t6[o6] && "?" === t6[o6 + 1]) {
262704
- if (o6 += 2, o6 = u5(t6, o6), o6.err) return o6;
260886
+ for (let r6 = 0; r6 < t6.length; r6++) if ("<" === t6[r6] && "?" === t6[r6 + 1]) {
260887
+ if (r6 += 2, r6 = u5(t6, r6), r6.err) return r6;
262705
260888
  } else {
262706
- if ("<" !== t6[o6]) {
262707
- if (l5(t6[o6])) continue;
262708
- return m5("InvalidChar", "char '" + t6[o6] + "' is not expected.", b5(t6, o6));
260889
+ if ("<" !== t6[r6]) {
260890
+ if (l5(t6[r6])) continue;
260891
+ return m5("InvalidChar", "char '" + t6[r6] + "' is not expected.", N(t6, r6));
262709
260892
  }
262710
260893
  {
262711
- let a6 = o6;
262712
- if (o6++, "!" === t6[o6]) {
262713
- o6 = h5(t6, o6);
260894
+ let o6 = r6;
260895
+ if (r6++, "!" === t6[r6]) {
260896
+ r6 = d5(t6, r6);
262714
260897
  continue;
262715
260898
  }
262716
260899
  {
262717
- let d6 = false;
262718
- "/" === t6[o6] && (d6 = true, o6++);
262719
- let p6 = "";
262720
- for (; o6 < t6.length && ">" !== t6[o6] && " " !== t6[o6] && " " !== t6[o6] && "\n" !== t6[o6] && "\r" !== t6[o6]; o6++) p6 += t6[o6];
262721
- if (p6 = p6.trim(), "/" === p6[p6.length - 1] && (p6 = p6.substring(0, p6.length - 1), o6--), !r5(p6)) {
260900
+ let a6 = false;
260901
+ "/" === t6[r6] && (a6 = true, r6++);
260902
+ let h6 = "";
260903
+ for (; r6 < t6.length && ">" !== t6[r6] && " " !== t6[r6] && " " !== t6[r6] && "\n" !== t6[r6] && "\r" !== t6[r6]; r6++) h6 += t6[r6];
260904
+ if (h6 = h6.trim(), "/" === h6[h6.length - 1] && (h6 = h6.substring(0, h6.length - 1), r6--), !b5(h6)) {
262722
260905
  let e7;
262723
- return e7 = 0 === p6.trim().length ? "Invalid space after '<'." : "Tag '" + p6 + "' is an invalid name.", m5("InvalidTag", e7, b5(t6, o6));
260906
+ return e7 = 0 === h6.trim().length ? "Invalid space after '<'." : "Tag '" + h6 + "' is an invalid name.", m5("InvalidTag", e7, N(t6, r6));
262724
260907
  }
262725
- const c6 = f5(t6, o6);
262726
- if (false === c6) return m5("InvalidAttr", "Attributes for '" + p6 + "' have open quote.", b5(t6, o6));
262727
- let E3 = c6.value;
262728
- if (o6 = c6.index, "/" === E3[E3.length - 1]) {
262729
- const n7 = o6 - E3.length;
262730
- E3 = E3.substring(0, E3.length - 1);
262731
- const s7 = g5(E3, e6);
262732
- if (true !== s7) return m5(s7.err.code, s7.err.msg, b5(t6, n7 + s7.err.line));
260908
+ const p6 = c5(t6, r6);
260909
+ if (false === p6) return m5("InvalidAttr", "Attributes for '" + h6 + "' have open quote.", N(t6, r6));
260910
+ let f6 = p6.value;
260911
+ if (r6 = p6.index, "/" === f6[f6.length - 1]) {
260912
+ const n7 = r6 - f6.length;
260913
+ f6 = f6.substring(0, f6.length - 1);
260914
+ const s7 = g5(f6, e6);
260915
+ if (true !== s7) return m5(s7.err.code, s7.err.msg, N(t6, n7 + s7.err.line));
262733
260916
  i6 = true;
262734
- } else if (d6) {
262735
- if (!c6.tagClosed) return m5("InvalidTag", "Closing tag '" + p6 + "' doesn't have proper closing.", b5(t6, o6));
262736
- if (E3.trim().length > 0) return m5("InvalidTag", "Closing tag '" + p6 + "' can't have attributes or invalid starting.", b5(t6, a6));
262737
- if (0 === n6.length) return m5("InvalidTag", "Closing tag '" + p6 + "' has not been opened.", b5(t6, a6));
260917
+ } else if (a6) {
260918
+ if (!p6.tagClosed) return m5("InvalidTag", "Closing tag '" + h6 + "' doesn't have proper closing.", N(t6, r6));
260919
+ if (f6.trim().length > 0) return m5("InvalidTag", "Closing tag '" + h6 + "' can't have attributes or invalid starting.", N(t6, o6));
260920
+ if (0 === n6.length) return m5("InvalidTag", "Closing tag '" + h6 + "' has not been opened.", N(t6, o6));
262738
260921
  {
262739
260922
  const e7 = n6.pop();
262740
- if (p6 !== e7.tagName) {
262741
- let n7 = b5(t6, e7.tagStartPos);
262742
- return m5("InvalidTag", "Expected closing tag '" + e7.tagName + "' (opened in line " + n7.line + ", col " + n7.col + ") instead of closing tag '" + p6 + "'.", b5(t6, a6));
260923
+ if (h6 !== e7.tagName) {
260924
+ let n7 = N(t6, e7.tagStartPos);
260925
+ return m5("InvalidTag", "Expected closing tag '" + e7.tagName + "' (opened in line " + n7.line + ", col " + n7.col + ") instead of closing tag '" + h6 + "'.", N(t6, o6));
262743
260926
  }
262744
260927
  0 == n6.length && (s6 = true);
262745
260928
  }
262746
260929
  } else {
262747
- const r6 = g5(E3, e6);
262748
- if (true !== r6) return m5(r6.err.code, r6.err.msg, b5(t6, o6 - E3.length + r6.err.line));
262749
- if (true === s6) return m5("InvalidXml", "Multiple possible root nodes found.", b5(t6, o6));
262750
- -1 !== e6.unpairedTags.indexOf(p6) || n6.push({ tagName: p6, tagStartPos: a6 }), i6 = true;
260930
+ const a7 = g5(f6, e6);
260931
+ if (true !== a7) return m5(a7.err.code, a7.err.msg, N(t6, r6 - f6.length + a7.err.line));
260932
+ if (true === s6) return m5("InvalidXml", "Multiple possible root nodes found.", N(t6, r6));
260933
+ -1 !== e6.unpairedTags.indexOf(h6) || n6.push({ tagName: h6, tagStartPos: o6 }), i6 = true;
262751
260934
  }
262752
- for (o6++; o6 < t6.length; o6++) if ("<" === t6[o6]) {
262753
- if ("!" === t6[o6 + 1]) {
262754
- o6++, o6 = h5(t6, o6);
260935
+ for (r6++; r6 < t6.length; r6++) if ("<" === t6[r6]) {
260936
+ if ("!" === t6[r6 + 1]) {
260937
+ r6++, r6 = d5(t6, r6);
262755
260938
  continue;
262756
260939
  }
262757
- if ("?" !== t6[o6 + 1]) break;
262758
- if (o6 = u5(t6, ++o6), o6.err) return o6;
262759
- } else if ("&" === t6[o6]) {
262760
- const e7 = x5(t6, o6);
262761
- if (-1 == e7) return m5("InvalidChar", "char '&' is not expected.", b5(t6, o6));
262762
- o6 = e7;
262763
- } else if (true === s6 && !l5(t6[o6])) return m5("InvalidXml", "Extra text at the end", b5(t6, o6));
262764
- "<" === t6[o6] && o6--;
260940
+ if ("?" !== t6[r6 + 1]) break;
260941
+ if (r6 = u5(t6, ++r6), r6.err) return r6;
260942
+ } else if ("&" === t6[r6]) {
260943
+ const e7 = x5(t6, r6);
260944
+ if (-1 == e7) return m5("InvalidChar", "char '&' is not expected.", N(t6, r6));
260945
+ r6 = e7;
260946
+ } else if (true === s6 && !l5(t6[r6])) return m5("InvalidXml", "Extra text at the end", N(t6, r6));
260947
+ "<" === t6[r6] && r6--;
262765
260948
  }
262766
260949
  }
262767
260950
  }
262768
- return i6 ? 1 == n6.length ? m5("InvalidTag", "Unclosed tag '" + n6[0].tagName + "'.", b5(t6, n6[0].tagStartPos)) : !(n6.length > 0) || m5("InvalidXml", "Invalid '" + JSON.stringify(n6.map(((t7) => t7.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m5("InvalidXml", "Start tag expected.", 1);
260951
+ return i6 ? 1 == n6.length ? m5("InvalidTag", "Unclosed tag '" + n6[0].tagName + "'.", N(t6, n6[0].tagStartPos)) : !(n6.length > 0) || m5("InvalidXml", "Invalid '" + JSON.stringify(n6.map((t7) => t7.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m5("InvalidXml", "Start tag expected.", 1);
262769
260952
  }
262770
260953
  function l5(t6) {
262771
260954
  return " " === t6 || " " === t6 || "\n" === t6 || "\r" === t6;
262772
260955
  }
262773
260956
  function u5(t6, e6) {
262774
260957
  const n6 = e6;
262775
- for (; e6 < t6.length; e6++) if ("?" != t6[e6] && " " != t6[e6]) ;
262776
- else {
260958
+ for (; e6 < t6.length; e6++) if ("?" == t6[e6] || " " == t6[e6]) {
262777
260959
  const i6 = t6.substr(n6, e6 - n6);
262778
- if (e6 > 5 && "xml" === i6) return m5("InvalidXml", "XML declaration allowed only at the start of the document.", b5(t6, e6));
260960
+ if (e6 > 5 && "xml" === i6) return m5("InvalidXml", "XML declaration allowed only at the start of the document.", N(t6, e6));
262779
260961
  if ("?" == t6[e6] && ">" == t6[e6 + 1]) {
262780
260962
  e6++;
262781
260963
  break;
262782
260964
  }
260965
+ continue;
262783
260966
  }
262784
260967
  return e6;
262785
260968
  }
262786
- function h5(t6, e6) {
260969
+ function d5(t6, e6) {
262787
260970
  if (t6.length > e6 + 5 && "-" === t6[e6 + 1] && "-" === t6[e6 + 2]) {
262788
260971
  for (e6 += 3; e6 < t6.length; e6++) if ("-" === t6[e6] && "-" === t6[e6 + 1] && ">" === t6[e6 + 2]) {
262789
260972
  e6 += 2;
@@ -262801,11 +260984,11 @@ var require_fxp = __commonJS({
262801
260984
  }
262802
260985
  return e6;
262803
260986
  }
262804
- const d5 = '"', p5 = "'";
262805
- function f5(t6, e6) {
260987
+ const h5 = '"', p5 = "'";
260988
+ function c5(t6, e6) {
262806
260989
  let n6 = "", i6 = "", s6 = false;
262807
260990
  for (; e6 < t6.length; e6++) {
262808
- if (t6[e6] === d5 || t6[e6] === p5) "" === i6 ? i6 = t6[e6] : i6 !== t6[e6] || (i6 = "");
260991
+ if (t6[e6] === h5 || t6[e6] === p5) "" === i6 ? i6 = t6[e6] : i6 !== t6[e6] || (i6 = "");
262809
260992
  else if (">" === t6[e6] && "" === i6) {
262810
260993
  s6 = true;
262811
260994
  break;
@@ -262814,16 +260997,16 @@ var require_fxp = __commonJS({
262814
260997
  }
262815
260998
  return "" === i6 && { value: n6, index: e6, tagClosed: s6 };
262816
260999
  }
262817
- const c5 = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
261000
+ const f5 = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
262818
261001
  function g5(t6, e6) {
262819
- const n6 = s5(t6, c5), i6 = {};
261002
+ const n6 = s5(t6, f5), i6 = {};
262820
261003
  for (let t7 = 0; t7 < n6.length; t7++) {
262821
- if (0 === n6[t7][1].length) return m5("InvalidAttr", "Attribute '" + n6[t7][2] + "' has no space in starting.", N(n6[t7]));
262822
- if (void 0 !== n6[t7][3] && void 0 === n6[t7][4]) return m5("InvalidAttr", "Attribute '" + n6[t7][2] + "' is without value.", N(n6[t7]));
262823
- if (void 0 === n6[t7][3] && !e6.allowBooleanAttributes) return m5("InvalidAttr", "boolean attribute '" + n6[t7][2] + "' is not allowed.", N(n6[t7]));
261004
+ if (0 === n6[t7][1].length) return m5("InvalidAttr", "Attribute '" + n6[t7][2] + "' has no space in starting.", y2(n6[t7]));
261005
+ if (void 0 !== n6[t7][3] && void 0 === n6[t7][4]) return m5("InvalidAttr", "Attribute '" + n6[t7][2] + "' is without value.", y2(n6[t7]));
261006
+ if (void 0 === n6[t7][3] && !e6.allowBooleanAttributes) return m5("InvalidAttr", "boolean attribute '" + n6[t7][2] + "' is not allowed.", y2(n6[t7]));
262824
261007
  const s6 = n6[t7][2];
262825
- if (!E2(s6)) return m5("InvalidAttr", "Attribute '" + s6 + "' is an invalid name.", N(n6[t7]));
262826
- if (i6.hasOwnProperty(s6)) return m5("InvalidAttr", "Attribute '" + s6 + "' is repeated.", N(n6[t7]));
261008
+ if (!E2(s6)) return m5("InvalidAttr", "Attribute '" + s6 + "' is an invalid name.", y2(n6[t7]));
261009
+ if (Object.prototype.hasOwnProperty.call(i6, s6)) return m5("InvalidAttr", "Attribute '" + s6 + "' is repeated.", y2(n6[t7]));
262827
261010
  i6[s6] = 1;
262828
261011
  }
262829
261012
  return true;
@@ -262851,49 +261034,52 @@ var require_fxp = __commonJS({
262851
261034
  function E2(t6) {
262852
261035
  return r5(t6);
262853
261036
  }
262854
- function b5(t6, e6) {
261037
+ function b5(t6) {
261038
+ return r5(t6);
261039
+ }
261040
+ function N(t6, e6) {
262855
261041
  const n6 = t6.substring(0, e6).split(/\r?\n/);
262856
261042
  return { line: n6.length, col: n6[n6.length - 1].length + 1 };
262857
261043
  }
262858
- function N(t6) {
261044
+ function y2(t6) {
262859
261045
  return t6.startIndex + t6[1].length;
262860
261046
  }
262861
- const y2 = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t6, e6) {
261047
+ const T = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t6, e6) {
262862
261048
  return e6;
262863
261049
  }, attributeValueProcessor: function(t6, e6) {
262864
261050
  return e6;
262865
261051
  }, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t6, e6, n6) {
262866
261052
  return t6;
262867
- }, captureMetaData: false };
262868
- function T(t6) {
262869
- return "boolean" == typeof t6 ? { enabled: t6, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t6 && null !== t6 ? { enabled: false !== t6.enabled, maxEntitySize: t6.maxEntitySize ?? 1e4, maxExpansionDepth: t6.maxExpansionDepth ?? 10, maxTotalExpansions: t6.maxTotalExpansions ?? 1e3, maxExpandedLength: t6.maxExpandedLength ?? 1e5, allowedTags: t6.allowedTags ?? null, tagFilter: t6.tagFilter ?? null } : T(true);
261053
+ }, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true };
261054
+ function w5(t6) {
261055
+ return "boolean" == typeof t6 ? { enabled: t6, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t6 && null !== t6 ? { enabled: false !== t6.enabled, maxEntitySize: t6.maxEntitySize ?? 1e4, maxExpansionDepth: t6.maxExpansionDepth ?? 10, maxTotalExpansions: t6.maxTotalExpansions ?? 1e3, maxExpandedLength: t6.maxExpandedLength ?? 1e5, allowedTags: t6.allowedTags ?? null, tagFilter: t6.tagFilter ?? null } : w5(true);
262870
261056
  }
262871
- const w5 = function(t6) {
262872
- const e6 = Object.assign({}, y2, t6);
262873
- return e6.processEntities = T(e6.processEntities), e6;
261057
+ const v5 = function(t6) {
261058
+ const e6 = Object.assign({}, T, t6);
261059
+ return e6.processEntities = w5(e6.processEntities), e6;
262874
261060
  };
262875
- let v5;
262876
- v5 = "function" != typeof Symbol ? "@@xmlMetadata" : Symbol("XML Node Metadata");
261061
+ let O;
261062
+ O = "function" != typeof Symbol ? "@@xmlMetadata" : Symbol("XML Node Metadata");
262877
261063
  class I2 {
262878
261064
  constructor(t6) {
262879
- this.tagname = t6, this.child = [], this[":@"] = {};
261065
+ this.tagname = t6, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null);
262880
261066
  }
262881
261067
  add(t6, e6) {
262882
261068
  "__proto__" === t6 && (t6 = "#__proto__"), this.child.push({ [t6]: e6 });
262883
261069
  }
262884
261070
  addChild(t6, e6) {
262885
- "__proto__" === t6.tagname && (t6.tagname = "#__proto__"), t6[":@"] && Object.keys(t6[":@"]).length > 0 ? this.child.push({ [t6.tagname]: t6.child, ":@": t6[":@"] }) : this.child.push({ [t6.tagname]: t6.child }), void 0 !== e6 && (this.child[this.child.length - 1][v5] = { startIndex: e6 });
261071
+ "__proto__" === t6.tagname && (t6.tagname = "#__proto__"), t6[":@"] && Object.keys(t6[":@"]).length > 0 ? this.child.push({ [t6.tagname]: t6.child, ":@": t6[":@"] }) : this.child.push({ [t6.tagname]: t6.child }), void 0 !== e6 && (this.child[this.child.length - 1][O] = { startIndex: e6 });
262886
261072
  }
262887
261073
  static getMetaDataSymbol() {
262888
- return v5;
261074
+ return O;
262889
261075
  }
262890
261076
  }
262891
- class O {
261077
+ class P {
262892
261078
  constructor(t6) {
262893
261079
  this.suppressValidationErr = !t6, this.options = t6;
262894
261080
  }
262895
261081
  readDocType(t6, e6) {
262896
- const n6 = {};
261082
+ const n6 = /* @__PURE__ */ Object.create(null);
262897
261083
  if ("O" !== t6[e6 + 3] || "C" !== t6[e6 + 4] || "T" !== t6[e6 + 5] || "Y" !== t6[e6 + 6] || "P" !== t6[e6 + 7] || "E" !== t6[e6 + 8]) throw new Error("Invalid Tag instead of DOCTYPE");
262898
261084
  {
262899
261085
  e6 += 9;
@@ -262902,23 +261088,23 @@ var require_fxp = __commonJS({
262902
261088
  if (r6 ? "-" === t6[e6 - 1] && "-" === t6[e6 - 2] && (r6 = false, i6--) : i6--, 0 === i6) break;
262903
261089
  } else "[" === t6[e6] ? s6 = true : o6 += t6[e6];
262904
261090
  else {
262905
- if (s6 && A2(t6, "!ENTITY", e6)) {
261091
+ if (s6 && S(t6, "!ENTITY", e6)) {
262906
261092
  let i7, s7;
262907
261093
  if (e6 += 7, [i7, s7, e6] = this.readEntityExp(t6, e6 + 1, this.suppressValidationErr), -1 === s7.indexOf("&")) {
262908
261094
  const t7 = i7.replace(/[.\-+*:]/g, "\\.");
262909
261095
  n6[i7] = { regx: RegExp(`&${t7};`, "g"), val: s7 };
262910
261096
  }
262911
- } else if (s6 && A2(t6, "!ELEMENT", e6)) {
261097
+ } else if (s6 && S(t6, "!ELEMENT", e6)) {
262912
261098
  e6 += 8;
262913
261099
  const { index: n7 } = this.readElementExp(t6, e6 + 1);
262914
261100
  e6 = n7;
262915
- } else if (s6 && A2(t6, "!ATTLIST", e6)) e6 += 8;
262916
- else if (s6 && A2(t6, "!NOTATION", e6)) {
261101
+ } else if (s6 && S(t6, "!ATTLIST", e6)) e6 += 8;
261102
+ else if (s6 && S(t6, "!NOTATION", e6)) {
262917
261103
  e6 += 9;
262918
261104
  const { index: n7 } = this.readNotationExp(t6, e6 + 1, this.suppressValidationErr);
262919
261105
  e6 = n7;
262920
261106
  } else {
262921
- if (!A2(t6, "!--", e6)) throw new Error("Invalid DOCTYPE");
261107
+ if (!S(t6, "!--", e6)) throw new Error("Invalid DOCTYPE");
262922
261108
  r6 = true;
262923
261109
  }
262924
261110
  i6++, o6 = "";
@@ -262928,10 +261114,10 @@ var require_fxp = __commonJS({
262928
261114
  return { entities: n6, i: e6 };
262929
261115
  }
262930
261116
  readEntityExp(t6, e6) {
262931
- e6 = P(t6, e6);
261117
+ e6 = A2(t6, e6);
262932
261118
  let n6 = "";
262933
261119
  for (; e6 < t6.length && !/\s/.test(t6[e6]) && '"' !== t6[e6] && "'" !== t6[e6]; ) n6 += t6[e6], e6++;
262934
- if (S(n6), e6 = P(t6, e6), !this.suppressValidationErr) {
261120
+ if (C2(n6), e6 = A2(t6, e6), !this.suppressValidationErr) {
262935
261121
  if ("SYSTEM" === t6.substring(e6, e6 + 6).toUpperCase()) throw new Error("External entities are not supported");
262936
261122
  if ("%" === t6[e6]) throw new Error("Parameter entities are not supported");
262937
261123
  }
@@ -262940,15 +261126,15 @@ var require_fxp = __commonJS({
262940
261126
  return [n6, i6, --e6];
262941
261127
  }
262942
261128
  readNotationExp(t6, e6) {
262943
- e6 = P(t6, e6);
261129
+ e6 = A2(t6, e6);
262944
261130
  let n6 = "";
262945
261131
  for (; e6 < t6.length && !/\s/.test(t6[e6]); ) n6 += t6[e6], e6++;
262946
- !this.suppressValidationErr && S(n6), e6 = P(t6, e6);
261132
+ !this.suppressValidationErr && C2(n6), e6 = A2(t6, e6);
262947
261133
  const i6 = t6.substring(e6, e6 + 6).toUpperCase();
262948
261134
  if (!this.suppressValidationErr && "SYSTEM" !== i6 && "PUBLIC" !== i6) throw new Error(`Expected SYSTEM or PUBLIC, found "${i6}"`);
262949
- e6 += i6.length, e6 = P(t6, e6);
261135
+ e6 += i6.length, e6 = A2(t6, e6);
262950
261136
  let s6 = null, r6 = null;
262951
- if ("PUBLIC" === i6) [e6, s6] = this.readIdentifierVal(t6, e6, "publicIdentifier"), '"' !== t6[e6 = P(t6, e6)] && "'" !== t6[e6] || ([e6, r6] = this.readIdentifierVal(t6, e6, "systemIdentifier"));
261137
+ if ("PUBLIC" === i6) [e6, s6] = this.readIdentifierVal(t6, e6, "publicIdentifier"), '"' !== t6[e6 = A2(t6, e6)] && "'" !== t6[e6] || ([e6, r6] = this.readIdentifierVal(t6, e6, "systemIdentifier"));
262952
261138
  else if ("SYSTEM" === i6 && ([e6, r6] = this.readIdentifierVal(t6, e6, "systemIdentifier"), !this.suppressValidationErr && !r6)) throw new Error("Missing mandatory system identifier for SYSTEM notation");
262953
261139
  return { notationName: n6, publicIdentifier: s6, systemIdentifier: r6, index: --e6 };
262954
261140
  }
@@ -262961,13 +261147,13 @@ var require_fxp = __commonJS({
262961
261147
  return [++e6, i6];
262962
261148
  }
262963
261149
  readElementExp(t6, e6) {
262964
- e6 = P(t6, e6);
261150
+ e6 = A2(t6, e6);
262965
261151
  let n6 = "";
262966
261152
  for (; e6 < t6.length && !/\s/.test(t6[e6]); ) n6 += t6[e6], e6++;
262967
261153
  if (!this.suppressValidationErr && !r5(n6)) throw new Error(`Invalid element name: "${n6}"`);
262968
261154
  let i6 = "";
262969
- if ("E" === t6[e6 = P(t6, e6)] && A2(t6, "MPTY", e6)) e6 += 4;
262970
- else if ("A" === t6[e6] && A2(t6, "NY", e6)) e6 += 2;
261155
+ if ("E" === t6[e6 = A2(t6, e6)] && S(t6, "MPTY", e6)) e6 += 4;
261156
+ else if ("A" === t6[e6] && S(t6, "NY", e6)) e6 += 2;
262971
261157
  else if ("(" === t6[e6]) {
262972
261158
  for (e6++; e6 < t6.length && ")" !== t6[e6]; ) i6 += t6[e6], e6++;
262973
261159
  if (")" !== t6[e6]) throw new Error("Unterminated content model");
@@ -262975,24 +261161,24 @@ var require_fxp = __commonJS({
262975
261161
  return { elementName: n6, contentModel: i6.trim(), index: e6 };
262976
261162
  }
262977
261163
  readAttlistExp(t6, e6) {
262978
- e6 = P(t6, e6);
261164
+ e6 = A2(t6, e6);
262979
261165
  let n6 = "";
262980
261166
  for (; e6 < t6.length && !/\s/.test(t6[e6]); ) n6 += t6[e6], e6++;
262981
- S(n6), e6 = P(t6, e6);
261167
+ C2(n6), e6 = A2(t6, e6);
262982
261168
  let i6 = "";
262983
261169
  for (; e6 < t6.length && !/\s/.test(t6[e6]); ) i6 += t6[e6], e6++;
262984
- if (!S(i6)) throw new Error(`Invalid attribute name: "${i6}"`);
262985
- e6 = P(t6, e6);
261170
+ if (!C2(i6)) throw new Error(`Invalid attribute name: "${i6}"`);
261171
+ e6 = A2(t6, e6);
262986
261172
  let s6 = "";
262987
261173
  if ("NOTATION" === t6.substring(e6, e6 + 8).toUpperCase()) {
262988
- if (s6 = "NOTATION", "(" !== t6[e6 = P(t6, e6 += 8)]) throw new Error(`Expected '(', found "${t6[e6]}"`);
261174
+ if (s6 = "NOTATION", "(" !== t6[e6 = A2(t6, e6 += 8)]) throw new Error(`Expected '(', found "${t6[e6]}"`);
262989
261175
  e6++;
262990
261176
  let n7 = [];
262991
261177
  for (; e6 < t6.length && ")" !== t6[e6]; ) {
262992
261178
  let i7 = "";
262993
261179
  for (; e6 < t6.length && "|" !== t6[e6] && ")" !== t6[e6]; ) i7 += t6[e6], e6++;
262994
- if (i7 = i7.trim(), !S(i7)) throw new Error(`Invalid notation name: "${i7}"`);
262995
- n7.push(i7), "|" === t6[e6] && (e6++, e6 = P(t6, e6));
261180
+ if (i7 = i7.trim(), !C2(i7)) throw new Error(`Invalid notation name: "${i7}"`);
261181
+ n7.push(i7), "|" === t6[e6] && (e6++, e6 = A2(t6, e6));
262996
261182
  }
262997
261183
  if (")" !== t6[e6]) throw new Error("Unterminated list of notations");
262998
261184
  e6++, s6 += " (" + n7.join("|") + ")";
@@ -263001,45 +261187,43 @@ var require_fxp = __commonJS({
263001
261187
  const n7 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
263002
261188
  if (!this.suppressValidationErr && !n7.includes(s6.toUpperCase())) throw new Error(`Invalid attribute type: "${s6}"`);
263003
261189
  }
263004
- e6 = P(t6, e6);
261190
+ e6 = A2(t6, e6);
263005
261191
  let r6 = "";
263006
261192
  return "#REQUIRED" === t6.substring(e6, e6 + 8).toUpperCase() ? (r6 = "#REQUIRED", e6 += 8) : "#IMPLIED" === t6.substring(e6, e6 + 7).toUpperCase() ? (r6 = "#IMPLIED", e6 += 7) : [e6, r6] = this.readIdentifierVal(t6, e6, "ATTLIST"), { elementName: n6, attributeName: i6, attributeType: s6, defaultValue: r6, index: e6 };
263007
261193
  }
263008
261194
  }
263009
- const P = (t6, e6) => {
261195
+ const A2 = (t6, e6) => {
263010
261196
  for (; e6 < t6.length && /\s/.test(t6[e6]); ) e6++;
263011
261197
  return e6;
263012
261198
  };
263013
- function A2(t6, e6, n6) {
261199
+ function S(t6, e6, n6) {
263014
261200
  for (let i6 = 0; i6 < e6.length; i6++) if (e6[i6] !== t6[n6 + i6 + 1]) return false;
263015
261201
  return true;
263016
261202
  }
263017
- function S(t6) {
261203
+ function C2(t6) {
263018
261204
  if (r5(t6)) return t6;
263019
261205
  throw new Error(`Invalid entity name ${t6}`);
263020
261206
  }
263021
- const C2 = /^[-+]?0x[a-fA-F0-9]+$/, $ = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, V = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true };
263022
- const D2 = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
263023
- function L(t6) {
263024
- return "function" == typeof t6 ? t6 : Array.isArray(t6) ? (e6) => {
263025
- for (const n6 of t6) {
263026
- if ("string" == typeof n6 && e6 === n6) return true;
263027
- if (n6 instanceof RegExp && n6.test(e6)) return true;
263028
- }
263029
- } : () => false;
263030
- }
263031
- class F2 {
261207
+ const $ = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, D2 = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true };
261208
+ const j5 = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
261209
+ class L {
263032
261210
  constructor(t6) {
263033
- if (this.options = t6, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t7, e6) => K(e6, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t7, e6) => K(e6, 16, "&#x") } }, this.addExternalEntities = j5, this.parseXml = B2, this.parseTextData = M, this.resolveNameSpace = _, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q5, this.saveTextToParentTag = G2, this.addChild = R, this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) {
261211
+ var e6;
261212
+ if (this.options = t6, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t7, e7) => K(e7, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t7, e7) => K(e7, 16, "&#x") } }, this.addExternalEntities = F2, this.parseXml = R, this.parseTextData = M, this.resolveNameSpace = k5, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q5, this.saveTextToParentTag = G2, this.addChild = B2, this.ignoreAttributesFn = "function" == typeof (e6 = this.options.ignoreAttributes) ? e6 : Array.isArray(e6) ? (t7) => {
261213
+ for (const n6 of e6) {
261214
+ if ("string" == typeof n6 && t7 === n6) return true;
261215
+ if (n6 instanceof RegExp && n6.test(t7)) return true;
261216
+ }
261217
+ } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) {
263034
261218
  this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set();
263035
261219
  for (let t7 = 0; t7 < this.options.stopNodes.length; t7++) {
263036
- const e6 = this.options.stopNodes[t7];
263037
- "string" == typeof e6 && (e6.startsWith("*.") ? this.stopNodesWildcard.add(e6.substring(2)) : this.stopNodesExact.add(e6));
261220
+ const e7 = this.options.stopNodes[t7];
261221
+ "string" == typeof e7 && (e7.startsWith("*.") ? this.stopNodesWildcard.add(e7.substring(2)) : this.stopNodesExact.add(e7));
263038
261222
  }
263039
261223
  }
263040
261224
  }
263041
261225
  }
263042
- function j5(t6) {
261226
+ function F2(t6) {
263043
261227
  const e6 = Object.keys(t6);
263044
261228
  for (let n6 = 0; n6 < e6.length; n6++) {
263045
261229
  const i6 = e6[n6], s6 = i6.replace(/[.\-+*:]/g, "\\.");
@@ -263053,7 +261237,7 @@ var require_fxp = __commonJS({
263053
261237
  return null == i7 ? t6 : typeof i7 != typeof t6 || i7 !== t6 ? i7 : this.options.trimValues || t6.trim() === t6 ? Z(t6, this.options.parseTagValue, this.options.numberParseOptions) : t6;
263054
261238
  }
263055
261239
  }
263056
- function _(t6) {
261240
+ function k5(t6) {
263057
261241
  if (this.options.removeNSPrefix) {
263058
261242
  const e6 = t6.split(":"), n6 = "/" === t6.charAt(0) ? "/" : "";
263059
261243
  if ("xmlns" === e6[0]) return "";
@@ -263061,10 +261245,10 @@ var require_fxp = __commonJS({
263061
261245
  }
263062
261246
  return t6;
263063
261247
  }
263064
- const k5 = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
261248
+ const _ = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
263065
261249
  function U(t6, e6, n6) {
263066
261250
  if (true !== this.options.ignoreAttributes && "string" == typeof t6) {
263067
- const i6 = s5(t6, k5), r6 = i6.length, o6 = {};
261251
+ const i6 = s5(t6, _), r6 = i6.length, o6 = {};
263068
261252
  for (let t7 = 0; t7 < r6; t7++) {
263069
261253
  const s6 = this.resolveNameSpace(i6[t7][1]);
263070
261254
  if (this.ignoreAttributesFn(s6, e6)) continue;
@@ -263083,12 +261267,12 @@ var require_fxp = __commonJS({
263083
261267
  return o6;
263084
261268
  }
263085
261269
  }
263086
- const B2 = function(t6) {
261270
+ const R = function(t6) {
263087
261271
  t6 = t6.replace(/\r\n?/g, "\n");
263088
261272
  const e6 = new I2("!xml");
263089
261273
  let n6 = e6, i6 = "", s6 = "";
263090
261274
  this.entityExpansionCount = 0, this.currentExpandedLength = 0;
263091
- const r6 = new O(this.options.processEntities);
261275
+ const r6 = new P(this.options.processEntities);
263092
261276
  for (let o6 = 0; o6 < t6.length; o6++) if ("<" === t6[o6]) if ("/" === t6[o6 + 1]) {
263093
261277
  const e7 = z2(t6, ">", o6, "Closing Tag is not closed.");
263094
261278
  let r7 = t6.substring(o6 + 2, e7).trim();
@@ -263128,26 +261312,27 @@ var require_fxp = __commonJS({
263128
261312
  } else {
263129
261313
  let r7 = W(t6, o6, this.options.removeNSPrefix), a6 = r7.tagName;
263130
261314
  const l6 = r7.rawTagName;
263131
- let u6 = r7.tagExp, h6 = r7.attrExpPresent, d6 = r7.closeIndex;
261315
+ let u6 = r7.tagExp, d6 = r7.attrExpPresent, h6 = r7.closeIndex;
263132
261316
  if (this.options.transformTagName) {
263133
261317
  const t7 = this.options.transformTagName(a6);
263134
261318
  u6 === a6 && (u6 = t7), a6 = t7;
263135
261319
  }
261320
+ if (this.options.strictReservedNames && (a6 === this.options.commentPropName || a6 === this.options.cdataPropName)) throw new Error(`Invalid tag name: ${a6}`);
263136
261321
  n6 && i6 && "!xml" !== n6.tagname && (i6 = this.saveTextToParentTag(i6, n6, s6, false));
263137
261322
  const p6 = n6;
263138
261323
  p6 && -1 !== this.options.unpairedTags.indexOf(p6.tagname) && (n6 = this.tagsNodeStack.pop(), s6 = s6.substring(0, s6.lastIndexOf("."))), a6 !== e6.tagname && (s6 += s6 ? "." + a6 : a6);
263139
- const f6 = o6;
261324
+ const c6 = o6;
263140
261325
  if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s6, a6)) {
263141
261326
  let e7 = "";
263142
261327
  if (u6.length > 0 && u6.lastIndexOf("/") === u6.length - 1) "/" === a6[a6.length - 1] ? (a6 = a6.substr(0, a6.length - 1), s6 = s6.substr(0, s6.length - 1), u6 = a6) : u6 = u6.substr(0, u6.length - 1), o6 = r7.closeIndex;
263143
261328
  else if (-1 !== this.options.unpairedTags.indexOf(a6)) o6 = r7.closeIndex;
263144
261329
  else {
263145
- const n7 = this.readStopNodeData(t6, l6, d6 + 1);
261330
+ const n7 = this.readStopNodeData(t6, l6, h6 + 1);
263146
261331
  if (!n7) throw new Error(`Unexpected end of ${l6}`);
263147
261332
  o6 = n7.i, e7 = n7.tagContent;
263148
261333
  }
263149
261334
  const i7 = new I2(a6);
263150
- a6 !== u6 && h6 && (i7[":@"] = this.buildAttributesMap(u6, s6, a6)), e7 && (e7 = this.parseTextData(e7, a6, s6, true, h6, true, true)), s6 = s6.substr(0, s6.lastIndexOf(".")), i7.add(this.options.textNodeName, e7), this.addChild(n6, i7, s6, f6);
261335
+ a6 !== u6 && d6 && (i7[":@"] = this.buildAttributesMap(u6, s6, a6)), e7 && (e7 = this.parseTextData(e7, a6, s6, true, d6, true, true)), s6 = s6.substr(0, s6.lastIndexOf(".")), i7.add(this.options.textNodeName, e7), this.addChild(n6, i7, s6, c6);
263151
261336
  } else {
263152
261337
  if (u6.length > 0 && u6.lastIndexOf("/") === u6.length - 1) {
263153
261338
  if ("/" === a6[a6.length - 1] ? (a6 = a6.substr(0, a6.length - 1), s6 = s6.substr(0, s6.length - 1), u6 = a6) : u6 = u6.substr(0, u6.length - 1), this.options.transformTagName) {
@@ -263155,18 +261340,26 @@ var require_fxp = __commonJS({
263155
261340
  u6 === a6 && (u6 = t8), a6 = t8;
263156
261341
  }
263157
261342
  const t7 = new I2(a6);
263158
- a6 !== u6 && h6 && (t7[":@"] = this.buildAttributesMap(u6, s6, a6)), this.addChild(n6, t7, s6, f6), s6 = s6.substr(0, s6.lastIndexOf("."));
261343
+ a6 !== u6 && d6 && (t7[":@"] = this.buildAttributesMap(u6, s6, a6)), this.addChild(n6, t7, s6, c6), s6 = s6.substr(0, s6.lastIndexOf("."));
263159
261344
  } else {
263160
- const t7 = new I2(a6);
263161
- this.tagsNodeStack.push(n6), a6 !== u6 && h6 && (t7[":@"] = this.buildAttributesMap(u6, s6, a6)), this.addChild(n6, t7, s6, f6), n6 = t7;
261345
+ if (-1 !== this.options.unpairedTags.indexOf(a6)) {
261346
+ const t7 = new I2(a6);
261347
+ a6 !== u6 && d6 && (t7[":@"] = this.buildAttributesMap(u6, s6)), this.addChild(n6, t7, s6, c6), s6 = s6.substr(0, s6.lastIndexOf(".")), o6 = r7.closeIndex;
261348
+ continue;
261349
+ }
261350
+ {
261351
+ const t7 = new I2(a6);
261352
+ if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded");
261353
+ this.tagsNodeStack.push(n6), a6 !== u6 && d6 && (t7[":@"] = this.buildAttributesMap(u6, s6, a6)), this.addChild(n6, t7, s6, c6), n6 = t7;
261354
+ }
263162
261355
  }
263163
- i6 = "", o6 = d6;
261356
+ i6 = "", o6 = h6;
263164
261357
  }
263165
261358
  }
263166
261359
  else i6 += t6[o6];
263167
261360
  return e6.child;
263168
261361
  };
263169
- function R(t6, e6, n6, i6) {
261362
+ function B2(t6, e6, n6, i6) {
263170
261363
  this.options.captureMetaData || (i6 = void 0);
263171
261364
  const s6 = this.options.updateTag(e6.tagname, n6, e6[":@"]);
263172
261365
  false === s6 || ("string" == typeof s6 ? (e6.tagname = s6, t6.addChild(e6, i6)) : t6.addChild(e6, i6));
@@ -263227,12 +261420,12 @@ var require_fxp = __commonJS({
263227
261420
  const o6 = s6.index, a6 = r6.search(/\s/);
263228
261421
  let l6 = r6, u6 = true;
263229
261422
  -1 !== a6 && (l6 = r6.substring(0, a6), r6 = r6.substring(a6 + 1).trimStart());
263230
- const h6 = l6;
261423
+ const d6 = l6;
263231
261424
  if (n6) {
263232
261425
  const t7 = l6.indexOf(":");
263233
261426
  -1 !== t7 && (l6 = l6.substr(t7 + 1), u6 = l6 !== s6.data.substr(t7 + 1));
263234
261427
  }
263235
- return { tagName: l6, tagExp: r6, closeIndex: o6, attrExpPresent: u6, rawTagName: h6 };
261428
+ return { tagName: l6, tagExp: r6, closeIndex: o6, attrExpPresent: u6, rawTagName: d6 };
263236
261429
  }
263237
261430
  function q5(t6, e6, n6) {
263238
261431
  const i6 = n6;
@@ -263253,19 +261446,19 @@ var require_fxp = __commonJS({
263253
261446
  if (e6 && "string" == typeof t6) {
263254
261447
  const e7 = t6.trim();
263255
261448
  return "true" === e7 || "false" !== e7 && (function(t7, e8 = {}) {
263256
- if (e8 = Object.assign({}, V, e8), !t7 || "string" != typeof t7) return t7;
261449
+ if (e8 = Object.assign({}, D2, e8), !t7 || "string" != typeof t7) return t7;
263257
261450
  let n7 = t7.trim();
263258
261451
  if (void 0 !== e8.skipLike && e8.skipLike.test(n7)) return t7;
263259
261452
  if ("0" === t7) return 0;
263260
- if (e8.hex && C2.test(n7)) return (function(t8) {
261453
+ if (e8.hex && $.test(n7)) return (function(t8) {
263261
261454
  if (parseInt) return parseInt(t8, 16);
263262
261455
  if (Number.parseInt) return Number.parseInt(t8, 16);
263263
261456
  if (window && window.parseInt) return window.parseInt(t8, 16);
263264
261457
  throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
263265
261458
  })(n7);
263266
- if (-1 !== n7.search(/.+[eE].+/)) return (function(t8, e9, n8) {
261459
+ if (n7.includes("e") || n7.includes("E")) return (function(t8, e9, n8) {
263267
261460
  if (!n8.eNotation) return t8;
263268
- const i7 = e9.match(D2);
261461
+ const i7 = e9.match(j5);
263269
261462
  if (i7) {
263270
261463
  let s6 = i7[1] || "";
263271
261464
  const r6 = -1 === i7[3].indexOf("e") ? "E" : "e", o6 = i7[2], a6 = s6 ? t8[o6.length + 1] === r6 : t8[o6.length] === r6;
@@ -263274,7 +261467,7 @@ var require_fxp = __commonJS({
263274
261467
  return t8;
263275
261468
  })(t7, n7, e8);
263276
261469
  {
263277
- const s6 = $.exec(n7);
261470
+ const s6 = V.exec(n7);
263278
261471
  if (s6) {
263279
261472
  const r6 = s6[1] || "", o6 = s6[2];
263280
261473
  let a6 = (i6 = s6[3]) && -1 !== i6.indexOf(".") ? ("." === (i6 = i6.replace(/0+$/, "")) ? i6 = "0" : "." === i6[0] ? i6 = "0" + i6 : "." === i6[i6.length - 1] && (i6 = i6.substring(0, i6.length - 1)), i6) : i6;
@@ -263282,7 +261475,7 @@ var require_fxp = __commonJS({
263282
261475
  if (!e8.leadingZeros && (o6.length > 1 || 1 === o6.length && !l6)) return t7;
263283
261476
  {
263284
261477
  const i7 = Number(n7), s7 = String(i7);
263285
- if (0 === i7 || -0 === i7) return i7;
261478
+ if (0 === i7) return i7;
263286
261479
  if (-1 !== s7.search(/[eE]/)) return e8.eNotation ? i7 : t7;
263287
261480
  if (-1 !== n7.indexOf(".")) return "0" === s7 || s7 === a6 || s7 === `${r6}${a6}` ? i7 : t7;
263288
261481
  let l7 = o6 ? a6 : n7;
@@ -263316,7 +261509,7 @@ var require_fxp = __commonJS({
263316
261509
  if (o6[a6]) {
263317
261510
  let t7 = H2(o6[a6], e6, l6);
263318
261511
  const n7 = nt(t7, e6);
263319
- void 0 !== o6[Q] && (t7[Q] = o6[Q]), o6[":@"] ? et(t7, o6[":@"], l6, e6) : 1 !== Object.keys(t7).length || void 0 === t7[e6.textNodeName] || e6.alwaysCreateTextNode ? 0 === Object.keys(t7).length && (e6.alwaysCreateTextNode ? t7[e6.textNodeName] = "" : t7 = "") : t7 = t7[e6.textNodeName], void 0 !== s6[a6] && s6.hasOwnProperty(a6) ? (Array.isArray(s6[a6]) || (s6[a6] = [s6[a6]]), s6[a6].push(t7)) : e6.isArray(a6, l6, n7) ? s6[a6] = [t7] : s6[a6] = t7;
261512
+ o6[":@"] ? et(t7, o6[":@"], l6, e6) : 1 !== Object.keys(t7).length || void 0 === t7[e6.textNodeName] || e6.alwaysCreateTextNode ? 0 === Object.keys(t7).length && (e6.alwaysCreateTextNode ? t7[e6.textNodeName] = "" : t7 = "") : t7 = t7[e6.textNodeName], void 0 !== o6[Q] && "object" == typeof t7 && null !== t7 && (t7[Q] = o6[Q]), void 0 !== s6[a6] && Object.prototype.hasOwnProperty.call(s6, a6) ? (Array.isArray(s6[a6]) || (s6[a6] = [s6[a6]]), s6[a6].push(t7)) : e6.isArray(a6, l6, n7) ? s6[a6] = [t7] : s6[a6] = t7;
263320
261513
  }
263321
261514
  }
263322
261515
  }
@@ -263344,7 +261537,7 @@ var require_fxp = __commonJS({
263344
261537
  }
263345
261538
  class it {
263346
261539
  constructor(t6) {
263347
- this.externalEntities = {}, this.options = w5(t6);
261540
+ this.externalEntities = {}, this.options = v5(t6);
263348
261541
  }
263349
261542
  parse(t6, e6) {
263350
261543
  if ("string" != typeof t6 && t6.toString) t6 = t6.toString();
@@ -263354,7 +261547,7 @@ var require_fxp = __commonJS({
263354
261547
  const n7 = a5(t6, e6);
263355
261548
  if (true !== n7) throw Error(`${n7.err.msg}:${n7.err.line}:${n7.err.col}`);
263356
261549
  }
263357
- const n6 = new F2(this.options);
261550
+ const n6 = new L(this.options);
263358
261551
  n6.addExternalEntities(this.externalEntities);
263359
261552
  const i6 = n6.parseXml(t6);
263360
261553
  return this.options.preserveOrder || void 0 === i6 ? i6 : J2(i6, this.options);
@@ -263375,6 +261568,13 @@ var require_fxp = __commonJS({
263375
261568
  }
263376
261569
  function rt(t6, e6, n6, i6) {
263377
261570
  let s6 = "", r6 = false;
261571
+ if (!Array.isArray(t6)) {
261572
+ if (null != t6) {
261573
+ let n7 = t6.toString();
261574
+ return n7 = ut(n7, e6), n7;
261575
+ }
261576
+ return "";
261577
+ }
263378
261578
  for (let o6 = 0; o6 < t6.length; o6++) {
263379
261579
  const a6 = t6[o6], l6 = ot(a6);
263380
261580
  if (void 0 === l6) continue;
@@ -263398,10 +261598,10 @@ var require_fxp = __commonJS({
263398
261598
  o7 = 0 !== o7.length ? " " + o7 : "", s6 += n7 + `<${l6}${o7}${t7}?>`, r6 = true;
263399
261599
  continue;
263400
261600
  }
263401
- let h6 = i6;
263402
- "" !== h6 && (h6 += e6.indentBy);
263403
- const d6 = i6 + `<${l6}${at3(a6[":@"], e6)}`, p6 = rt(a6[l6], e6, u6, h6);
263404
- -1 !== e6.unpairedTags.indexOf(l6) ? e6.suppressUnpairedNode ? s6 += d6 + ">" : s6 += d6 + "/>" : p6 && 0 !== p6.length || !e6.suppressEmptyNode ? p6 && p6.endsWith(">") ? s6 += d6 + `>${p6}${i6}</${l6}>` : (s6 += d6 + ">", p6 && "" !== i6 && (p6.includes("/>") || p6.includes("</")) ? s6 += i6 + e6.indentBy + p6 + i6 : s6 += p6, s6 += `</${l6}>`) : s6 += d6 + "/>", r6 = true;
261601
+ let d6 = i6;
261602
+ "" !== d6 && (d6 += e6.indentBy);
261603
+ const h6 = i6 + `<${l6}${at3(a6[":@"], e6)}`, p6 = rt(a6[l6], e6, u6, d6);
261604
+ -1 !== e6.unpairedTags.indexOf(l6) ? e6.suppressUnpairedNode ? s6 += h6 + ">" : s6 += h6 + "/>" : p6 && 0 !== p6.length || !e6.suppressEmptyNode ? p6 && p6.endsWith(">") ? s6 += h6 + `>${p6}${i6}</${l6}>` : (s6 += h6 + ">", p6 && "" !== i6 && (p6.includes("/>") || p6.includes("</")) ? s6 += i6 + e6.indentBy + p6 + i6 : s6 += p6, s6 += `</${l6}>`) : s6 += h6 + "/>", r6 = true;
263405
261605
  }
263406
261606
  return s6;
263407
261607
  }
@@ -263409,13 +261609,13 @@ var require_fxp = __commonJS({
263409
261609
  const e6 = Object.keys(t6);
263410
261610
  for (let n6 = 0; n6 < e6.length; n6++) {
263411
261611
  const i6 = e6[n6];
263412
- if (t6.hasOwnProperty(i6) && ":@" !== i6) return i6;
261612
+ if (Object.prototype.hasOwnProperty.call(t6, i6) && ":@" !== i6) return i6;
263413
261613
  }
263414
261614
  }
263415
261615
  function at3(t6, e6) {
263416
261616
  let n6 = "";
263417
261617
  if (t6 && !e6.ignoreAttributes) for (let i6 in t6) {
263418
- if (!t6.hasOwnProperty(i6)) continue;
261618
+ if (!Object.prototype.hasOwnProperty.call(t6, i6)) continue;
263419
261619
  let s6 = e6.attributeValueProcessor(i6, t6[i6]);
263420
261620
  s6 = ut(s6, e6), true === s6 && e6.suppressBooleanAttributes ? n6 += ` ${i6.substr(e6.attributeNamePrefix.length)}` : n6 += ` ${i6.substr(e6.attributeNamePrefix.length)}="${s6}"`;
263421
261621
  }
@@ -263433,15 +261633,21 @@ var require_fxp = __commonJS({
263433
261633
  }
263434
261634
  return t6;
263435
261635
  }
263436
- const ht = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t6, e6) {
261636
+ const dt = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t6, e6) {
263437
261637
  return e6;
263438
261638
  }, attributeValueProcessor: function(t6, e6) {
263439
261639
  return e6;
263440
261640
  }, preserveOrder: false, commentPropName: false, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&amp;" }, { regex: new RegExp(">", "g"), val: "&gt;" }, { regex: new RegExp("<", "g"), val: "&lt;" }, { regex: new RegExp("'", "g"), val: "&apos;" }, { regex: new RegExp('"', "g"), val: "&quot;" }], processEntities: true, stopNodes: [], oneListGroup: false };
263441
- function dt(t6) {
263442
- this.options = Object.assign({}, ht, t6), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() {
261641
+ function ht(t6) {
261642
+ var e6;
261643
+ this.options = Object.assign({}, dt, t6), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() {
263443
261644
  return false;
263444
- } : (this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ct), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ft, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() {
261645
+ } : (this.ignoreAttributesFn = "function" == typeof (e6 = this.options.ignoreAttributes) ? e6 : Array.isArray(e6) ? (t7) => {
261646
+ for (const n6 of e6) {
261647
+ if ("string" == typeof n6 && t7 === n6) return true;
261648
+ if (n6 instanceof RegExp && n6.test(t7)) return true;
261649
+ }
261650
+ } : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ft), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ct, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() {
263445
261651
  return "";
263446
261652
  }, this.tagEndChar = ">", this.newLine = "");
263447
261653
  }
@@ -263449,15 +261655,15 @@ var require_fxp = __commonJS({
263449
261655
  const s6 = this.j2x(t6, n6 + 1, i6.concat(e6));
263450
261656
  return void 0 !== t6[this.options.textNodeName] && 1 === Object.keys(t6).length ? this.buildTextValNode(t6[this.options.textNodeName], e6, s6.attrStr, n6) : this.buildObjectNode(s6.val, e6, s6.attrStr, n6);
263451
261657
  }
263452
- function ft(t6) {
261658
+ function ct(t6) {
263453
261659
  return this.options.indentBy.repeat(t6);
263454
261660
  }
263455
- function ct(t6) {
261661
+ function ft(t6) {
263456
261662
  return !(!t6.startsWith(this.options.attributeNamePrefix) || t6 === this.options.textNodeName) && t6.substr(this.attrPrefixLen);
263457
261663
  }
263458
- dt.prototype.build = function(t6) {
261664
+ ht.prototype.build = function(t6) {
263459
261665
  return this.options.preserveOrder ? st(t6, this.options) : (Array.isArray(t6) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t6 = { [this.options.arrayNodeName]: t6 }), this.j2x(t6, 0, []).val);
263460
- }, dt.prototype.j2x = function(t6, e6, n6) {
261666
+ }, ht.prototype.j2x = function(t6, e6, n6) {
263461
261667
  let i6 = "", s6 = "";
263462
261668
  const r6 = n6.join(".");
263463
261669
  for (let o6 in t6) if (Object.prototype.hasOwnProperty.call(t6, o6)) if (void 0 === t6[o6]) this.isAttribute(o6) && (s6 += "");
@@ -263492,18 +261698,18 @@ var require_fxp = __commonJS({
263492
261698
  for (let s7 = 0; s7 < n7; s7++) i6 += this.buildAttrPairStr(e7[s7], "" + t6[o6][e7[s7]]);
263493
261699
  } else s6 += this.processTextOrObjNode(t6[o6], o6, e6, n6);
263494
261700
  return { attrStr: i6, val: s6 };
263495
- }, dt.prototype.buildAttrPairStr = function(t6, e6) {
261701
+ }, ht.prototype.buildAttrPairStr = function(t6, e6) {
263496
261702
  return e6 = this.options.attributeValueProcessor(t6, "" + e6), e6 = this.replaceEntitiesValue(e6), this.options.suppressBooleanAttributes && "true" === e6 ? " " + t6 : " " + t6 + '="' + e6 + '"';
263497
- }, dt.prototype.buildObjectNode = function(t6, e6, n6, i6) {
261703
+ }, ht.prototype.buildObjectNode = function(t6, e6, n6, i6) {
263498
261704
  if ("" === t6) return "?" === e6[0] ? this.indentate(i6) + "<" + e6 + n6 + "?" + this.tagEndChar : this.indentate(i6) + "<" + e6 + n6 + this.closeTag(e6) + this.tagEndChar;
263499
261705
  {
263500
261706
  let s6 = "</" + e6 + this.tagEndChar, r6 = "";
263501
261707
  return "?" === e6[0] && (r6 = "?", s6 = ""), !n6 && "" !== n6 || -1 !== t6.indexOf("<") ? false !== this.options.commentPropName && e6 === this.options.commentPropName && 0 === r6.length ? this.indentate(i6) + `<!--${t6}-->` + this.newLine : this.indentate(i6) + "<" + e6 + n6 + r6 + this.tagEndChar + t6 + this.indentate(i6) + s6 : this.indentate(i6) + "<" + e6 + n6 + r6 + ">" + t6 + s6;
263502
261708
  }
263503
- }, dt.prototype.closeTag = function(t6) {
261709
+ }, ht.prototype.closeTag = function(t6) {
263504
261710
  let e6 = "";
263505
261711
  return -1 !== this.options.unpairedTags.indexOf(t6) ? this.options.suppressUnpairedNode || (e6 = "/") : e6 = this.options.suppressEmptyNode ? "/" : `></${t6}`, e6;
263506
- }, dt.prototype.buildTextValNode = function(t6, e6, n6, i6) {
261712
+ }, ht.prototype.buildTextValNode = function(t6, e6, n6, i6) {
263507
261713
  if (false !== this.options.cdataPropName && e6 === this.options.cdataPropName) return this.indentate(i6) + `<![CDATA[${t6}]]>` + this.newLine;
263508
261714
  if (false !== this.options.commentPropName && e6 === this.options.commentPropName) return this.indentate(i6) + `<!--${t6}-->` + this.newLine;
263509
261715
  if ("?" === e6[0]) return this.indentate(i6) + "<" + e6 + n6 + "?" + this.tagEndChar;
@@ -263511,14 +261717,14 @@ var require_fxp = __commonJS({
263511
261717
  let s6 = this.options.tagValueProcessor(e6, t6);
263512
261718
  return s6 = this.replaceEntitiesValue(s6), "" === s6 ? this.indentate(i6) + "<" + e6 + n6 + this.closeTag(e6) + this.tagEndChar : this.indentate(i6) + "<" + e6 + n6 + ">" + s6 + "</" + e6 + this.tagEndChar;
263513
261719
  }
263514
- }, dt.prototype.replaceEntitiesValue = function(t6) {
261720
+ }, ht.prototype.replaceEntitiesValue = function(t6) {
263515
261721
  if (t6 && t6.length > 0 && this.options.processEntities) for (let e6 = 0; e6 < this.options.entities.length; e6++) {
263516
261722
  const n6 = this.options.entities[e6];
263517
261723
  t6 = t6.replace(n6.regex, n6.val);
263518
261724
  }
263519
261725
  return t6;
263520
261726
  };
263521
- const gt = { validate: a5 };
261727
+ const gt = ht, xt = { validate: a5 };
263522
261728
  module2.exports = e5;
263523
261729
  })();
263524
261730
  }
@@ -263538,7 +261744,8 @@ var require_xml_parser = __commonJS({
263538
261744
  ignoreDeclaration: true,
263539
261745
  parseTagValue: false,
263540
261746
  trimValues: false,
263541
- tagValueProcessor: (_, val) => val.trim() === "" && val.includes("\n") ? "" : void 0
261747
+ tagValueProcessor: (_, val) => val.trim() === "" && val.includes("\n") ? "" : void 0,
261748
+ maxNestedTags: 1024
263542
261749
  });
263543
261750
  parser.addEntity("#xD", "\r");
263544
261751
  parser.addEntity("#10", "\n");
@@ -268091,7 +266298,7 @@ var require_package2 = __commonJS({
268091
266298
  module2.exports = {
268092
266299
  name: "@aws-sdk/client-bedrock-runtime",
268093
266300
  description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
268094
- version: "3.1000.0",
266301
+ version: "3.1001.0",
268095
266302
  scripts: {
268096
266303
  build: "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
268097
266304
  "build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
@@ -268115,54 +266322,54 @@ var require_package2 = __commonJS({
268115
266322
  dependencies: {
268116
266323
  "@aws-crypto/sha256-browser": "5.2.0",
268117
266324
  "@aws-crypto/sha256-js": "5.2.0",
268118
- "@aws-sdk/core": "^3.973.15",
268119
- "@aws-sdk/credential-provider-node": "^3.972.14",
266325
+ "@aws-sdk/core": "^3.973.16",
266326
+ "@aws-sdk/credential-provider-node": "^3.972.15",
268120
266327
  "@aws-sdk/eventstream-handler-node": "^3.972.9",
268121
266328
  "@aws-sdk/middleware-eventstream": "^3.972.6",
268122
266329
  "@aws-sdk/middleware-host-header": "^3.972.6",
268123
266330
  "@aws-sdk/middleware-logger": "^3.972.6",
268124
266331
  "@aws-sdk/middleware-recursion-detection": "^3.972.6",
268125
- "@aws-sdk/middleware-user-agent": "^3.972.15",
268126
- "@aws-sdk/middleware-websocket": "^3.972.10",
266332
+ "@aws-sdk/middleware-user-agent": "^3.972.16",
266333
+ "@aws-sdk/middleware-websocket": "^3.972.11",
268127
266334
  "@aws-sdk/region-config-resolver": "^3.972.6",
268128
- "@aws-sdk/token-providers": "3.1000.0",
266335
+ "@aws-sdk/token-providers": "3.1001.0",
268129
266336
  "@aws-sdk/types": "^3.973.4",
268130
266337
  "@aws-sdk/util-endpoints": "^3.996.3",
268131
266338
  "@aws-sdk/util-user-agent-browser": "^3.972.6",
268132
- "@aws-sdk/util-user-agent-node": "^3.973.0",
266339
+ "@aws-sdk/util-user-agent-node": "^3.973.1",
268133
266340
  "@smithy/config-resolver": "^4.4.9",
268134
- "@smithy/core": "^3.23.6",
266341
+ "@smithy/core": "^3.23.7",
268135
266342
  "@smithy/eventstream-serde-browser": "^4.2.10",
268136
266343
  "@smithy/eventstream-serde-config-resolver": "^4.3.10",
268137
266344
  "@smithy/eventstream-serde-node": "^4.2.10",
268138
- "@smithy/fetch-http-handler": "^5.3.11",
266345
+ "@smithy/fetch-http-handler": "^5.3.12",
268139
266346
  "@smithy/hash-node": "^4.2.10",
268140
266347
  "@smithy/invalid-dependency": "^4.2.10",
268141
266348
  "@smithy/middleware-content-length": "^4.2.10",
268142
- "@smithy/middleware-endpoint": "^4.4.20",
268143
- "@smithy/middleware-retry": "^4.4.37",
266349
+ "@smithy/middleware-endpoint": "^4.4.21",
266350
+ "@smithy/middleware-retry": "^4.4.38",
268144
266351
  "@smithy/middleware-serde": "^4.2.11",
268145
266352
  "@smithy/middleware-stack": "^4.2.10",
268146
266353
  "@smithy/node-config-provider": "^4.3.10",
268147
- "@smithy/node-http-handler": "^4.4.12",
266354
+ "@smithy/node-http-handler": "^4.4.13",
268148
266355
  "@smithy/protocol-http": "^5.3.10",
268149
- "@smithy/smithy-client": "^4.12.0",
266356
+ "@smithy/smithy-client": "^4.12.1",
268150
266357
  "@smithy/types": "^4.13.0",
268151
266358
  "@smithy/url-parser": "^4.2.10",
268152
266359
  "@smithy/util-base64": "^4.3.1",
268153
266360
  "@smithy/util-body-length-browser": "^4.2.1",
268154
266361
  "@smithy/util-body-length-node": "^4.2.2",
268155
- "@smithy/util-defaults-mode-browser": "^4.3.36",
268156
- "@smithy/util-defaults-mode-node": "^4.2.39",
266362
+ "@smithy/util-defaults-mode-browser": "^4.3.37",
266363
+ "@smithy/util-defaults-mode-node": "^4.2.40",
268157
266364
  "@smithy/util-endpoints": "^3.3.1",
268158
266365
  "@smithy/util-middleware": "^4.2.10",
268159
266366
  "@smithy/util-retry": "^4.2.10",
268160
- "@smithy/util-stream": "^4.5.15",
266367
+ "@smithy/util-stream": "^4.5.16",
268161
266368
  "@smithy/util-utf8": "^4.2.1",
268162
266369
  tslib: "^2.6.2"
268163
266370
  },
268164
266371
  devDependencies: {
268165
- "@smithy/snapshot-testing": "^1.0.7",
266372
+ "@smithy/snapshot-testing": "^1.0.8",
268166
266373
  "@tsconfig/node20": "20.1.8",
268167
266374
  "@types/node": "^20.14.8",
268168
266375
  concurrently: "7.0.0",
@@ -268878,7 +267085,7 @@ var init_package = __esm({
268878
267085
  "node_modules/@aws-sdk/nested-clients/package.json"() {
268879
267086
  package_default = {
268880
267087
  name: "@aws-sdk/nested-clients",
268881
- version: "3.996.3",
267088
+ version: "3.996.4",
268882
267089
  description: "Nested clients for AWS SDK packages.",
268883
267090
  main: "./dist-cjs/index.js",
268884
267091
  module: "./dist-es/index.js",
@@ -268907,37 +267114,37 @@ var init_package = __esm({
268907
267114
  dependencies: {
268908
267115
  "@aws-crypto/sha256-browser": "5.2.0",
268909
267116
  "@aws-crypto/sha256-js": "5.2.0",
268910
- "@aws-sdk/core": "^3.973.15",
267117
+ "@aws-sdk/core": "^3.973.16",
268911
267118
  "@aws-sdk/middleware-host-header": "^3.972.6",
268912
267119
  "@aws-sdk/middleware-logger": "^3.972.6",
268913
267120
  "@aws-sdk/middleware-recursion-detection": "^3.972.6",
268914
- "@aws-sdk/middleware-user-agent": "^3.972.15",
267121
+ "@aws-sdk/middleware-user-agent": "^3.972.16",
268915
267122
  "@aws-sdk/region-config-resolver": "^3.972.6",
268916
267123
  "@aws-sdk/types": "^3.973.4",
268917
267124
  "@aws-sdk/util-endpoints": "^3.996.3",
268918
267125
  "@aws-sdk/util-user-agent-browser": "^3.972.6",
268919
- "@aws-sdk/util-user-agent-node": "^3.973.0",
267126
+ "@aws-sdk/util-user-agent-node": "^3.973.1",
268920
267127
  "@smithy/config-resolver": "^4.4.9",
268921
- "@smithy/core": "^3.23.6",
268922
- "@smithy/fetch-http-handler": "^5.3.11",
267128
+ "@smithy/core": "^3.23.7",
267129
+ "@smithy/fetch-http-handler": "^5.3.12",
268923
267130
  "@smithy/hash-node": "^4.2.10",
268924
267131
  "@smithy/invalid-dependency": "^4.2.10",
268925
267132
  "@smithy/middleware-content-length": "^4.2.10",
268926
- "@smithy/middleware-endpoint": "^4.4.20",
268927
- "@smithy/middleware-retry": "^4.4.37",
267133
+ "@smithy/middleware-endpoint": "^4.4.21",
267134
+ "@smithy/middleware-retry": "^4.4.38",
268928
267135
  "@smithy/middleware-serde": "^4.2.11",
268929
267136
  "@smithy/middleware-stack": "^4.2.10",
268930
267137
  "@smithy/node-config-provider": "^4.3.10",
268931
- "@smithy/node-http-handler": "^4.4.12",
267138
+ "@smithy/node-http-handler": "^4.4.13",
268932
267139
  "@smithy/protocol-http": "^5.3.10",
268933
- "@smithy/smithy-client": "^4.12.0",
267140
+ "@smithy/smithy-client": "^4.12.1",
268934
267141
  "@smithy/types": "^4.13.0",
268935
267142
  "@smithy/url-parser": "^4.2.10",
268936
267143
  "@smithy/util-base64": "^4.3.1",
268937
267144
  "@smithy/util-body-length-browser": "^4.2.1",
268938
267145
  "@smithy/util-body-length-node": "^4.2.2",
268939
- "@smithy/util-defaults-mode-browser": "^4.3.36",
268940
- "@smithy/util-defaults-mode-node": "^4.2.39",
267146
+ "@smithy/util-defaults-mode-browser": "^4.3.37",
267147
+ "@smithy/util-defaults-mode-node": "^4.2.40",
268941
267148
  "@smithy/util-endpoints": "^3.3.1",
268942
267149
  "@smithy/util-middleware": "^4.2.10",
268943
267150
  "@smithy/util-retry": "^4.2.10",
@@ -269042,17 +267249,30 @@ var require_dist_cjs51 = __commonJS({
269042
267249
  }
269043
267250
  return ["md/nodejs", node_process.versions.node];
269044
267251
  };
269045
- var getTypeScriptPackageJsonPath = (dirname6 = "") => {
269046
- let nodeModulesPath;
267252
+ var SEMVER_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/;
267253
+ var getSanitizedTypeScriptVersion = (version2 = "") => {
267254
+ const match2 = version2.match(SEMVER_REGEX);
267255
+ if (!match2) {
267256
+ return void 0;
267257
+ }
267258
+ const [major, minor, patch, prerelease] = [match2[1], match2[2], match2[3], match2[4]];
267259
+ return prerelease ? `${major}.${minor}.${patch}-${prerelease}` : `${major}.${minor}.${patch}`;
267260
+ };
267261
+ var typescriptPackageJsonPath = node_path.join("node_modules", "typescript", "package.json");
267262
+ var getTypeScriptPackageJsonPaths = (dirname6) => {
267263
+ const cwdPath = node_path.join(process.cwd(), typescriptPackageJsonPath);
267264
+ if (!dirname6) {
267265
+ return [cwdPath];
267266
+ }
269047
267267
  const normalizedPath = node_path.normalize(dirname6);
269048
267268
  const parts = normalizedPath.split(node_path.sep);
269049
267269
  const nodeModulesIndex = parts.indexOf("node_modules");
269050
- if (nodeModulesIndex !== -1) {
269051
- nodeModulesPath = parts.slice(0, nodeModulesIndex).join(node_path.sep);
269052
- } else {
269053
- nodeModulesPath = dirname6;
267270
+ const parentDir = nodeModulesIndex !== -1 ? parts.slice(0, nodeModulesIndex).join(node_path.sep) : dirname6;
267271
+ const parentDirPath = node_path.join(parentDir, typescriptPackageJsonPath);
267272
+ if (cwdPath === parentDirPath) {
267273
+ return [cwdPath];
269054
267274
  }
269055
- return node_path.join(nodeModulesPath, "node_modules", "typescript", "package.json");
267275
+ return [parentDirPath, cwdPath];
269056
267276
  };
269057
267277
  var tscVersion;
269058
267278
  var getTypeScriptUserAgentPair = async () => {
@@ -269061,18 +267281,22 @@ var require_dist_cjs51 = __commonJS({
269061
267281
  } else if (typeof tscVersion === "string") {
269062
267282
  return ["md/tsc", tscVersion];
269063
267283
  }
269064
- try {
269065
- const packageJson = await promises.readFile(getTypeScriptPackageJsonPath(__dirname), "utf-8");
269066
- const { version: version2 } = JSON.parse(packageJson);
269067
- if (typeof version2 !== "string") {
269068
- tscVersion = null;
269069
- return void 0;
267284
+ const dirname6 = typeof __dirname !== "undefined" ? __dirname : void 0;
267285
+ for (const typescriptPackageJsonPath2 of getTypeScriptPackageJsonPaths(dirname6)) {
267286
+ try {
267287
+ const packageJson = await promises.readFile(typescriptPackageJsonPath2, "utf-8");
267288
+ const { version: version2 } = JSON.parse(packageJson);
267289
+ const sanitizedVersion = getSanitizedTypeScriptVersion(version2);
267290
+ if (typeof sanitizedVersion !== "string") {
267291
+ continue;
267292
+ }
267293
+ tscVersion = sanitizedVersion;
267294
+ return ["md/tsc", tscVersion];
267295
+ } catch {
269070
267296
  }
269071
- tscVersion = version2;
269072
- return ["md/tsc", tscVersion];
269073
- } catch {
269074
- tscVersion = null;
269075
267297
  }
267298
+ tscVersion = null;
267299
+ return void 0;
269076
267300
  };
269077
267301
  var crtAvailability = {
269078
267302
  isCrtAvailable: false
@@ -270171,9 +268395,9 @@ var init_sso_oidc = __esm({
270171
268395
  }
270172
268396
  });
270173
268397
 
270174
- // node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-cjs/index.js
268398
+ // node_modules/@aws-sdk/token-providers/dist-cjs/index.js
270175
268399
  var require_dist_cjs56 = __commonJS({
270176
- "node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports2) {
268400
+ "node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports2) {
270177
268401
  "use strict";
270178
268402
  var client = (init_client(), __toCommonJS(client_exports));
270179
268403
  var httpAuthSchemes = (init_httpAuthSchemes2(), __toCommonJS(httpAuthSchemes_exports));
@@ -274006,155 +272230,8 @@ var require_dist_cjs63 = __commonJS({
274006
272230
  }
274007
272231
  });
274008
272232
 
274009
- // node_modules/@aws-sdk/token-providers/dist-cjs/index.js
274010
- var require_dist_cjs64 = __commonJS({
274011
- "node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports2) {
274012
- "use strict";
274013
- var client = (init_client(), __toCommonJS(client_exports));
274014
- var httpAuthSchemes = (init_httpAuthSchemes2(), __toCommonJS(httpAuthSchemes_exports));
274015
- var propertyProvider = require_dist_cjs24();
274016
- var sharedIniFileLoader = require_dist_cjs42();
274017
- var node_fs = __nccwpck_require__(73024);
274018
- var fromEnvSigningName = ({ logger: logger2, signingName } = {}) => async () => {
274019
- logger2?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
274020
- if (!signingName) {
274021
- throw new propertyProvider.TokenProviderError("Please pass 'signingName' to compute environment variable key", { logger: logger2 });
274022
- }
274023
- const bearerTokenKey = httpAuthSchemes.getBearerTokenEnvKey(signingName);
274024
- if (!(bearerTokenKey in process.env)) {
274025
- throw new propertyProvider.TokenProviderError(`Token not present in '${bearerTokenKey}' environment variable`, { logger: logger2 });
274026
- }
274027
- const token = { token: process.env[bearerTokenKey] };
274028
- client.setTokenFeature(token, "BEARER_SERVICE_ENV_VARS", "3");
274029
- return token;
274030
- };
274031
- var EXPIRE_WINDOW_MS = 5 * 60 * 1e3;
274032
- var REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`;
274033
- var getSsoOidcClient = async (ssoRegion, init = {}, callerClientConfig) => {
274034
- const { SSOOIDCClient: SSOOIDCClient2 } = await Promise.resolve().then(() => (init_sso_oidc(), sso_oidc_exports));
274035
- const coalesce = (prop) => init.clientConfig?.[prop] ?? init.parentClientConfig?.[prop] ?? callerClientConfig?.[prop];
274036
- const ssoOidcClient = new SSOOIDCClient2(Object.assign({}, init.clientConfig ?? {}, {
274037
- region: ssoRegion ?? init.clientConfig?.region,
274038
- logger: coalesce("logger"),
274039
- userAgentAppId: coalesce("userAgentAppId")
274040
- }));
274041
- return ssoOidcClient;
274042
- };
274043
- var getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}, callerClientConfig) => {
274044
- const { CreateTokenCommand: CreateTokenCommand2 } = await Promise.resolve().then(() => (init_sso_oidc(), sso_oidc_exports));
274045
- const ssoOidcClient = await getSsoOidcClient(ssoRegion, init, callerClientConfig);
274046
- return ssoOidcClient.send(new CreateTokenCommand2({
274047
- clientId: ssoToken.clientId,
274048
- clientSecret: ssoToken.clientSecret,
274049
- refreshToken: ssoToken.refreshToken,
274050
- grantType: "refresh_token"
274051
- }));
274052
- };
274053
- var validateTokenExpiry = (token) => {
274054
- if (token.expiration && token.expiration.getTime() < Date.now()) {
274055
- throw new propertyProvider.TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false);
274056
- }
274057
- };
274058
- var validateTokenKey = (key, value, forRefresh = false) => {
274059
- if (typeof value === "undefined") {
274060
- throw new propertyProvider.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
274061
- }
274062
- };
274063
- var { writeFile: writeFile2 } = node_fs.promises;
274064
- var writeSSOTokenToFile = (id, ssoToken) => {
274065
- const tokenFilepath = sharedIniFileLoader.getSSOTokenFilepath(id);
274066
- const tokenString = JSON.stringify(ssoToken, null, 2);
274067
- return writeFile2(tokenFilepath, tokenString);
274068
- };
274069
- var lastRefreshAttemptTime = /* @__PURE__ */ new Date(0);
274070
- var fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
274071
- init.logger?.debug("@aws-sdk/token-providers - fromSso");
274072
- const profiles = await sharedIniFileLoader.parseKnownFiles(init);
274073
- const profileName = sharedIniFileLoader.getProfileName({
274074
- profile: init.profile ?? callerClientConfig?.profile
274075
- });
274076
- const profile = profiles[profileName];
274077
- if (!profile) {
274078
- throw new propertyProvider.TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false);
274079
- } else if (!profile["sso_session"]) {
274080
- throw new propertyProvider.TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
274081
- }
274082
- const ssoSessionName = profile["sso_session"];
274083
- const ssoSessions = await sharedIniFileLoader.loadSsoSessionData(init);
274084
- const ssoSession = ssoSessions[ssoSessionName];
274085
- if (!ssoSession) {
274086
- throw new propertyProvider.TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false);
274087
- }
274088
- for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) {
274089
- if (!ssoSession[ssoSessionRequiredKey]) {
274090
- throw new propertyProvider.TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false);
274091
- }
274092
- }
274093
- ssoSession["sso_start_url"];
274094
- const ssoRegion = ssoSession["sso_region"];
274095
- let ssoToken;
274096
- try {
274097
- ssoToken = await sharedIniFileLoader.getSSOTokenFromFile(ssoSessionName);
274098
- } catch (e5) {
274099
- throw new propertyProvider.TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);
274100
- }
274101
- validateTokenKey("accessToken", ssoToken.accessToken);
274102
- validateTokenKey("expiresAt", ssoToken.expiresAt);
274103
- const { accessToken, expiresAt } = ssoToken;
274104
- const existingToken = { token: accessToken, expiration: new Date(expiresAt) };
274105
- if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {
274106
- return existingToken;
274107
- }
274108
- if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1e3) {
274109
- validateTokenExpiry(existingToken);
274110
- return existingToken;
274111
- }
274112
- validateTokenKey("clientId", ssoToken.clientId, true);
274113
- validateTokenKey("clientSecret", ssoToken.clientSecret, true);
274114
- validateTokenKey("refreshToken", ssoToken.refreshToken, true);
274115
- try {
274116
- lastRefreshAttemptTime.setTime(Date.now());
274117
- const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
274118
- validateTokenKey("accessToken", newSsoOidcToken.accessToken);
274119
- validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
274120
- const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1e3);
274121
- try {
274122
- await writeSSOTokenToFile(ssoSessionName, {
274123
- ...ssoToken,
274124
- accessToken: newSsoOidcToken.accessToken,
274125
- expiresAt: newTokenExpiration.toISOString(),
274126
- refreshToken: newSsoOidcToken.refreshToken
274127
- });
274128
- } catch (error2) {
274129
- }
274130
- return {
274131
- token: newSsoOidcToken.accessToken,
274132
- expiration: newTokenExpiration
274133
- };
274134
- } catch (error2) {
274135
- validateTokenExpiry(existingToken);
274136
- return existingToken;
274137
- }
274138
- };
274139
- var fromStatic = ({ token, logger: logger2 }) => async () => {
274140
- logger2?.debug("@aws-sdk/token-providers - fromStatic");
274141
- if (!token || !token.token) {
274142
- throw new propertyProvider.TokenProviderError(`Please pass a valid token to fromStatic`, false);
274143
- }
274144
- return token;
274145
- };
274146
- var nodeProvider = (init = {}) => propertyProvider.memoize(propertyProvider.chain(fromSso(init), async () => {
274147
- throw new propertyProvider.TokenProviderError("Could not load token from any providers", false);
274148
- }), (token) => token.expiration !== void 0 && token.expiration.getTime() - Date.now() < 3e5, (token) => token.expiration !== void 0);
274149
- exports2.fromEnvSigningName = fromEnvSigningName;
274150
- exports2.fromSso = fromSso;
274151
- exports2.fromStatic = fromStatic;
274152
- exports2.nodeProvider = nodeProvider;
274153
- }
274154
- });
274155
-
274156
272233
  // node_modules/@smithy/eventstream-serde-node/dist-cjs/index.js
274157
- var require_dist_cjs65 = __commonJS({
272234
+ var require_dist_cjs64 = __commonJS({
274158
272235
  "node_modules/@smithy/eventstream-serde-node/dist-cjs/index.js"(exports2) {
274159
272236
  "use strict";
274160
272237
  var eventstreamSerdeUniversal = require_dist_cjs35();
@@ -276836,11 +274913,11 @@ var require_runtimeConfig = __commonJS({
276836
274913
  var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2));
276837
274914
  var credential_provider_node_1 = require_dist_cjs62();
276838
274915
  var eventstream_handler_node_1 = require_dist_cjs63();
276839
- var token_providers_1 = require_dist_cjs64();
274916
+ var token_providers_1 = require_dist_cjs56();
276840
274917
  var util_user_agent_node_1 = require_dist_cjs51();
276841
274918
  var config_resolver_1 = require_dist_cjs39();
276842
274919
  var core_2 = (init_dist_es(), __toCommonJS(dist_es_exports));
276843
- var eventstream_serde_node_1 = require_dist_cjs65();
274920
+ var eventstream_serde_node_1 = require_dist_cjs64();
276844
274921
  var hash_node_1 = require_dist_cjs52();
276845
274922
  var middleware_retry_1 = require_dist_cjs47();
276846
274923
  var node_config_provider_1 = require_dist_cjs43();
@@ -276912,7 +274989,7 @@ var require_runtimeConfig = __commonJS({
276912
274989
  });
276913
274990
 
276914
274991
  // node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js
276915
- var require_dist_cjs66 = __commonJS({
274992
+ var require_dist_cjs65 = __commonJS({
276916
274993
  "node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js"(exports2) {
276917
274994
  "use strict";
276918
274995
  var middlewareEventstream = require_dist_cjs3();
@@ -277757,13 +275834,13 @@ var import_client_bedrock_runtime, import_client_bedrock_runtime2, import_client
277757
275834
  var init_dist3 = __esm({
277758
275835
  "node_modules/@ai-sdk/amazon-bedrock/dist/index.mjs"() {
277759
275836
  init_dist2();
277760
- import_client_bedrock_runtime = __toESM(require_dist_cjs66(), 1);
275837
+ import_client_bedrock_runtime = __toESM(require_dist_cjs65(), 1);
277761
275838
  init_dist();
277762
- import_client_bedrock_runtime2 = __toESM(require_dist_cjs66(), 1);
275839
+ import_client_bedrock_runtime2 = __toESM(require_dist_cjs65(), 1);
277763
275840
  init_dist();
277764
275841
  init_dist();
277765
275842
  init_dist2();
277766
- import_client_bedrock_runtime3 = __toESM(require_dist_cjs66(), 1);
275843
+ import_client_bedrock_runtime3 = __toESM(require_dist_cjs65(), 1);
277767
275844
  generateFileId = createIdGenerator({ prefix: "file", size: 16 });
277768
275845
  BedrockChatLanguageModel = class {
277769
275846
  constructor(modelId, settings, config) {
@@ -285454,6 +283531,8 @@ var init_fileTracker = __esm({
285454
283531
  this.debug = options.debug || false;
285455
283532
  this._seenFiles = /* @__PURE__ */ new Set();
285456
283533
  this._contentRecords = /* @__PURE__ */ new Map();
283534
+ this._textEditCounts = /* @__PURE__ */ new Map();
283535
+ this.maxConsecutiveTextEdits = 3;
285457
283536
  }
285458
283537
  /**
285459
283538
  * Mark a file as "seen" — the LLM has read its content.
@@ -285461,6 +283540,7 @@ var init_fileTracker = __esm({
285461
283540
  */
285462
283541
  markFileSeen(resolvedPath2) {
285463
283542
  this._seenFiles.add(resolvedPath2);
283543
+ this._textEditCounts.set(resolvedPath2, 0);
285464
283544
  if (this.debug) {
285465
283545
  console.error(`[FileTracker] Marked as seen: ${resolvedPath2}`);
285466
283546
  }
@@ -285606,9 +283686,37 @@ var init_fileTracker = __esm({
285606
283686
  * @param {string} resolvedPath - Absolute path to the file
285607
283687
  */
285608
283688
  async trackFileAfterWrite(resolvedPath2) {
285609
- this.markFileSeen(resolvedPath2);
283689
+ this._seenFiles.add(resolvedPath2);
285610
283690
  this.invalidateFileRecords(resolvedPath2);
285611
283691
  }
283692
+ /**
283693
+ * Record a text-mode edit (old_string/new_string) to a file.
283694
+ * Increments the consecutive edit counter.
283695
+ * @param {string} resolvedPath - Absolute path to the file
283696
+ */
283697
+ recordTextEdit(resolvedPath2) {
283698
+ const count = (this._textEditCounts.get(resolvedPath2) || 0) + 1;
283699
+ this._textEditCounts.set(resolvedPath2, count);
283700
+ if (this.debug) {
283701
+ console.error(`[FileTracker] Text edit #${count} for ${resolvedPath2}`);
283702
+ }
283703
+ }
283704
+ /**
283705
+ * Check if a file has had too many consecutive text edits without a re-read.
283706
+ * @param {string} resolvedPath - Absolute path to the file
283707
+ * @returns {{ok: boolean, editCount?: number, message?: string}}
283708
+ */
283709
+ checkTextEditStaleness(resolvedPath2) {
283710
+ const count = this._textEditCounts.get(resolvedPath2) || 0;
283711
+ if (count >= this.maxConsecutiveTextEdits) {
283712
+ return {
283713
+ ok: false,
283714
+ editCount: count,
283715
+ message: `This file has been edited ${count} times without being re-read. Use 'extract' to re-read the current file content before making more edits, to ensure you are working with the actual state of the file.`
283716
+ };
283717
+ }
283718
+ return { ok: true, editCount: count };
283719
+ }
285612
283720
  /**
285613
283721
  * Update the stored hash for a symbol after a successful write.
285614
283722
  * Enables chained edits to the same symbol.
@@ -285652,6 +283760,7 @@ var init_fileTracker = __esm({
285652
283760
  clear() {
285653
283761
  this._seenFiles.clear();
285654
283762
  this._contentRecords.clear();
283763
+ this._textEditCounts.clear();
285655
283764
  }
285656
283765
  };
285657
283766
  }
@@ -331452,6 +329561,9 @@ var init_prompts = __esm({
331452
329561
  predefinedPrompts = {
331453
329562
  "code-explorer": `You are ProbeChat Code Explorer, a specialized AI assistant focused on helping developers, product managers, and QAs understand and navigate codebases. Your primary function is to answer questions based on code, explain how systems work, and provide insights into code functionality using the provided code analysis tools.
331454
329563
 
329564
+ CRITICAL - You are READ-ONLY:
329565
+ You must NEVER create, modify, delete, or write files. You are strictly an exploration and analysis tool. If asked to make changes, implement features, fix bugs, or modify a PR, refuse and explain that file modifications must be done by the engineer tool \u2014 your role is only to investigate code and answer questions. Do not attempt workarounds using bash commands (echo, cat, tee, sed, etc.) to write files.
329566
+
331455
329567
  When exploring code:
331456
329568
  - Provide clear, concise explanations based on user request
331457
329569
  - Find and highlight the most relevant code snippets, if required
@@ -356184,7 +354296,9 @@ var init_ProbeAgent = __esm({
356184
354296
  return nativeTools;
356185
354297
  }
356186
354298
  for (const [toolName, toolImpl] of Object.entries(this.toolImplementations)) {
356187
- const { schema, description } = this._getToolSchemaAndDescription(toolName);
354299
+ const toolInfo = this._getToolSchemaAndDescription(toolName);
354300
+ if (!toolInfo) continue;
354301
+ const { schema, description } = toolInfo;
356188
354302
  if (schema && description) {
356189
354303
  nativeTools[toolName] = wrapTool(toolName, schema, description, toolImpl.execute);
356190
354304
  }
@@ -357087,11 +355201,11 @@ Follow these instructions carefully:
357087
355201
  6. Prefer concise and focused search queries. Use specific keywords and phrases to narrow down results.${this.allowEdit ? `
357088
355202
  7. When modifying files, choose the appropriate tool:
357089
355203
  - Use 'edit' for all code modifications:
357090
- * For small changes (a line or a few lines), use old_string + new_string \u2014 copy old_string verbatim from the file.
357091
- * For rewriting entire functions/classes/methods, use the symbol parameter instead (no exact text matching needed).
357092
- * For editing specific lines from search/extract output, use start_line (and optionally end_line) with the line numbers shown in the output.${this.hashLines ? ' Line references include content hashes (e.g. "42:ab") for integrity verification.' : ""}
355204
+ * PREFERRED: Use start_line (and optionally end_line) for line-targeted editing \u2014 this is the safest and most precise approach.${this.hashLines ? ' Use the line:hash references from extract/search output (e.g. "42:ab") for integrity verification.' : ""} Always use extract first to see line numbers${this.hashLines ? " and hashes" : ""}, then edit by line reference.
357093
355205
  * For editing inside large functions: first use extract with the symbol target (e.g. "file.js#myFunction") to see the function with line numbers${this.hashLines ? " and hashes" : ""}, then use start_line/end_line to surgically edit specific lines within it.
357094
- * IMPORTANT: Keep old_string as small as possible \u2014 include only the lines you need to change plus minimal context for uniqueness. For replacing large blocks (10+ lines), prefer line-targeted editing with start_line/end_line to constrain scope.
355206
+ * For rewriting entire functions/classes/methods, use the symbol parameter instead (no exact text matching needed).
355207
+ * FALLBACK ONLY: Use old_string + new_string for simple single-line changes where the text is unique. Copy old_string verbatim from the file. Keep old_string as small as possible.
355208
+ * IMPORTANT: After multiple edits to the same file, re-read the changed areas before continuing \u2014 use extract with a targeted symbol (e.g. "file.js#myFunction") or a line range (e.g. "file.js:50-80") instead of re-reading the full file.
357095
355209
  - Use 'create' for new files or complete file rewrites.
357096
355210
  - If an edit fails, read the error message \u2014 it tells you exactly how to fix the call and retry.
357097
355211
  - The system tracks which files you've seen via search/extract. If you try to edit a file you haven't read, or one that changed since you last read it, the edit will fail with instructions to re-read first. Always use extract before editing to ensure you have current file content.` : ""}
@@ -360333,6 +358447,15 @@ Example: <extract><targets>${displayPath}</targets></extract>`;
360333
358447
  if (typeof old_string !== "string") {
360334
358448
  return `Error editing file: Invalid old_string - must be a string. Provide the exact text to find in the file, or use the symbol parameter instead for AST-aware editing by name.`;
360335
358449
  }
358450
+ if (options.fileTracker) {
358451
+ const staleCheck = options.fileTracker.checkTextEditStaleness(resolvedPath2);
358452
+ if (!staleCheck.ok) {
358453
+ const displayPath = toRelativePath(resolvedPath2, workspaceRoot);
358454
+ return `Error editing ${displayPath}: ${staleCheck.message}
358455
+
358456
+ Example: <extract><targets>${displayPath}</targets></extract>`;
358457
+ }
358458
+ }
360336
358459
  const content = await import_fs11.promises.readFile(resolvedPath2, "utf-8");
360337
358460
  let matchTarget = old_string;
360338
358461
  let matchStrategy = "exact";
@@ -360366,7 +358489,10 @@ Example: <extract><targets>${displayPath}</targets></extract>`;
360366
358489
  return `Error editing file: No changes made - the replacement result is identical to the original. Verify that old_string and new_string are actually different. If fuzzy matching was used, the matched text may already equal new_string.`;
360367
358490
  }
360368
358491
  await import_fs11.promises.writeFile(resolvedPath2, newContent, "utf-8");
360369
- if (options.fileTracker) await options.fileTracker.trackFileAfterWrite(resolvedPath2);
358492
+ if (options.fileTracker) {
358493
+ await options.fileTracker.trackFileAfterWrite(resolvedPath2);
358494
+ options.fileTracker.recordTextEdit(resolvedPath2);
358495
+ }
360370
358496
  const replacedCount = replace_all ? occurrences : 1;
360371
358497
  if (debug) {
360372
358498
  console.error(`[Edit] Successfully edited ${resolvedPath2}, replaced ${replacedCount} occurrence(s)`);
@@ -396991,7 +395117,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"100":"Continue","101":"Switching Pro
396991
395117
  /***/ ((module) => {
396992
395118
 
396993
395119
  "use strict";
396994
- 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-rc266","@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"]}}');
395120
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@probelabs/visor","version":"0.1.151","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-rc268","@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"]}}');
396995
395121
 
396996
395122
  /***/ })
396997
395123