@probelabs/probe 0.6.0-rc145 → 0.6.0-rc146

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.
@@ -33,6 +33,364 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
+ // node_modules/dotenv/package.json
37
+ var require_package = __commonJS({
38
+ "node_modules/dotenv/package.json"(exports2, module2) {
39
+ module2.exports = {
40
+ name: "dotenv",
41
+ version: "16.6.1",
42
+ description: "Loads environment variables from .env file",
43
+ main: "lib/main.js",
44
+ types: "lib/main.d.ts",
45
+ exports: {
46
+ ".": {
47
+ types: "./lib/main.d.ts",
48
+ require: "./lib/main.js",
49
+ default: "./lib/main.js"
50
+ },
51
+ "./config": "./config.js",
52
+ "./config.js": "./config.js",
53
+ "./lib/env-options": "./lib/env-options.js",
54
+ "./lib/env-options.js": "./lib/env-options.js",
55
+ "./lib/cli-options": "./lib/cli-options.js",
56
+ "./lib/cli-options.js": "./lib/cli-options.js",
57
+ "./package.json": "./package.json"
58
+ },
59
+ scripts: {
60
+ "dts-check": "tsc --project tests/types/tsconfig.json",
61
+ lint: "standard",
62
+ pretest: "npm run lint && npm run dts-check",
63
+ test: "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
64
+ "test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
65
+ prerelease: "npm test",
66
+ release: "standard-version"
67
+ },
68
+ repository: {
69
+ type: "git",
70
+ url: "git://github.com/motdotla/dotenv.git"
71
+ },
72
+ homepage: "https://github.com/motdotla/dotenv#readme",
73
+ funding: "https://dotenvx.com",
74
+ keywords: [
75
+ "dotenv",
76
+ "env",
77
+ ".env",
78
+ "environment",
79
+ "variables",
80
+ "config",
81
+ "settings"
82
+ ],
83
+ readmeFilename: "README.md",
84
+ license: "BSD-2-Clause",
85
+ devDependencies: {
86
+ "@types/node": "^18.11.3",
87
+ decache: "^4.6.2",
88
+ sinon: "^14.0.1",
89
+ standard: "^17.0.0",
90
+ "standard-version": "^9.5.0",
91
+ tap: "^19.2.0",
92
+ typescript: "^4.8.4"
93
+ },
94
+ engines: {
95
+ node: ">=12"
96
+ },
97
+ browser: {
98
+ fs: false
99
+ }
100
+ };
101
+ }
102
+ });
103
+
104
+ // node_modules/dotenv/lib/main.js
105
+ var require_main = __commonJS({
106
+ "node_modules/dotenv/lib/main.js"(exports2, module2) {
107
+ var fs6 = require("fs");
108
+ var path7 = require("path");
109
+ var os3 = require("os");
110
+ var crypto2 = require("crypto");
111
+ var packageJson = require_package();
112
+ var version = packageJson.version;
113
+ var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
114
+ function parse6(src) {
115
+ const obj = {};
116
+ let lines = src.toString();
117
+ lines = lines.replace(/\r\n?/mg, "\n");
118
+ let match2;
119
+ while ((match2 = LINE.exec(lines)) != null) {
120
+ const key = match2[1];
121
+ let value = match2[2] || "";
122
+ value = value.trim();
123
+ const maybeQuote = value[0];
124
+ value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
125
+ if (maybeQuote === '"') {
126
+ value = value.replace(/\\n/g, "\n");
127
+ value = value.replace(/\\r/g, "\r");
128
+ }
129
+ obj[key] = value;
130
+ }
131
+ return obj;
132
+ }
133
+ function _parseVault(options) {
134
+ options = options || {};
135
+ const vaultPath = _vaultPath(options);
136
+ options.path = vaultPath;
137
+ const result = DotenvModule.configDotenv(options);
138
+ if (!result.parsed) {
139
+ const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
140
+ err.code = "MISSING_DATA";
141
+ throw err;
142
+ }
143
+ const keys2 = _dotenvKey(options).split(",");
144
+ const length = keys2.length;
145
+ let decrypted;
146
+ for (let i3 = 0; i3 < length; i3++) {
147
+ try {
148
+ const key = keys2[i3].trim();
149
+ const attrs = _instructions(result, key);
150
+ decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
151
+ break;
152
+ } catch (error2) {
153
+ if (i3 + 1 >= length) {
154
+ throw error2;
155
+ }
156
+ }
157
+ }
158
+ return DotenvModule.parse(decrypted);
159
+ }
160
+ function _warn(message) {
161
+ console.log(`[dotenv@${version}][WARN] ${message}`);
162
+ }
163
+ function _debug(message) {
164
+ console.log(`[dotenv@${version}][DEBUG] ${message}`);
165
+ }
166
+ function _log(message) {
167
+ console.log(`[dotenv@${version}] ${message}`);
168
+ }
169
+ function _dotenvKey(options) {
170
+ if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
171
+ return options.DOTENV_KEY;
172
+ }
173
+ if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
174
+ return process.env.DOTENV_KEY;
175
+ }
176
+ return "";
177
+ }
178
+ function _instructions(result, dotenvKey) {
179
+ let uri;
180
+ try {
181
+ uri = new URL(dotenvKey);
182
+ } catch (error2) {
183
+ if (error2.code === "ERR_INVALID_URL") {
184
+ const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
185
+ err.code = "INVALID_DOTENV_KEY";
186
+ throw err;
187
+ }
188
+ throw error2;
189
+ }
190
+ const key = uri.password;
191
+ if (!key) {
192
+ const err = new Error("INVALID_DOTENV_KEY: Missing key part");
193
+ err.code = "INVALID_DOTENV_KEY";
194
+ throw err;
195
+ }
196
+ const environment = uri.searchParams.get("environment");
197
+ if (!environment) {
198
+ const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
199
+ err.code = "INVALID_DOTENV_KEY";
200
+ throw err;
201
+ }
202
+ const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
203
+ const ciphertext = result.parsed[environmentKey];
204
+ if (!ciphertext) {
205
+ const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
206
+ err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
207
+ throw err;
208
+ }
209
+ return { ciphertext, key };
210
+ }
211
+ function _vaultPath(options) {
212
+ let possibleVaultPath = null;
213
+ if (options && options.path && options.path.length > 0) {
214
+ if (Array.isArray(options.path)) {
215
+ for (const filepath of options.path) {
216
+ if (fs6.existsSync(filepath)) {
217
+ possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
218
+ }
219
+ }
220
+ } else {
221
+ possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
222
+ }
223
+ } else {
224
+ possibleVaultPath = path7.resolve(process.cwd(), ".env.vault");
225
+ }
226
+ if (fs6.existsSync(possibleVaultPath)) {
227
+ return possibleVaultPath;
228
+ }
229
+ return null;
230
+ }
231
+ function _resolveHome(envPath) {
232
+ return envPath[0] === "~" ? path7.join(os3.homedir(), envPath.slice(1)) : envPath;
233
+ }
234
+ function _configVault(options) {
235
+ const debug = Boolean(options && options.debug);
236
+ const quiet = options && "quiet" in options ? options.quiet : true;
237
+ if (debug || !quiet) {
238
+ _log("Loading env from encrypted .env.vault");
239
+ }
240
+ const parsed = DotenvModule._parseVault(options);
241
+ let processEnv = process.env;
242
+ if (options && options.processEnv != null) {
243
+ processEnv = options.processEnv;
244
+ }
245
+ DotenvModule.populate(processEnv, parsed, options);
246
+ return { parsed };
247
+ }
248
+ function configDotenv(options) {
249
+ const dotenvPath = path7.resolve(process.cwd(), ".env");
250
+ let encoding = "utf8";
251
+ const debug = Boolean(options && options.debug);
252
+ const quiet = options && "quiet" in options ? options.quiet : true;
253
+ if (options && options.encoding) {
254
+ encoding = options.encoding;
255
+ } else {
256
+ if (debug) {
257
+ _debug("No encoding is specified. UTF-8 is used by default");
258
+ }
259
+ }
260
+ let optionPaths = [dotenvPath];
261
+ if (options && options.path) {
262
+ if (!Array.isArray(options.path)) {
263
+ optionPaths = [_resolveHome(options.path)];
264
+ } else {
265
+ optionPaths = [];
266
+ for (const filepath of options.path) {
267
+ optionPaths.push(_resolveHome(filepath));
268
+ }
269
+ }
270
+ }
271
+ let lastError;
272
+ const parsedAll = {};
273
+ for (const path8 of optionPaths) {
274
+ try {
275
+ const parsed = DotenvModule.parse(fs6.readFileSync(path8, { encoding }));
276
+ DotenvModule.populate(parsedAll, parsed, options);
277
+ } catch (e3) {
278
+ if (debug) {
279
+ _debug(`Failed to load ${path8} ${e3.message}`);
280
+ }
281
+ lastError = e3;
282
+ }
283
+ }
284
+ let processEnv = process.env;
285
+ if (options && options.processEnv != null) {
286
+ processEnv = options.processEnv;
287
+ }
288
+ DotenvModule.populate(processEnv, parsedAll, options);
289
+ if (debug || !quiet) {
290
+ const keysCount = Object.keys(parsedAll).length;
291
+ const shortPaths = [];
292
+ for (const filePath of optionPaths) {
293
+ try {
294
+ const relative = path7.relative(process.cwd(), filePath);
295
+ shortPaths.push(relative);
296
+ } catch (e3) {
297
+ if (debug) {
298
+ _debug(`Failed to load ${filePath} ${e3.message}`);
299
+ }
300
+ lastError = e3;
301
+ }
302
+ }
303
+ _log(`injecting env (${keysCount}) from ${shortPaths.join(",")}`);
304
+ }
305
+ if (lastError) {
306
+ return { parsed: parsedAll, error: lastError };
307
+ } else {
308
+ return { parsed: parsedAll };
309
+ }
310
+ }
311
+ function config(options) {
312
+ if (_dotenvKey(options).length === 0) {
313
+ return DotenvModule.configDotenv(options);
314
+ }
315
+ const vaultPath = _vaultPath(options);
316
+ if (!vaultPath) {
317
+ _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
318
+ return DotenvModule.configDotenv(options);
319
+ }
320
+ return DotenvModule._configVault(options);
321
+ }
322
+ function decrypt(encrypted, keyStr) {
323
+ const key = Buffer.from(keyStr.slice(-64), "hex");
324
+ let ciphertext = Buffer.from(encrypted, "base64");
325
+ const nonce = ciphertext.subarray(0, 12);
326
+ const authTag = ciphertext.subarray(-16);
327
+ ciphertext = ciphertext.subarray(12, -16);
328
+ try {
329
+ const aesgcm = crypto2.createDecipheriv("aes-256-gcm", key, nonce);
330
+ aesgcm.setAuthTag(authTag);
331
+ return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
332
+ } catch (error2) {
333
+ const isRange = error2 instanceof RangeError;
334
+ const invalidKeyLength = error2.message === "Invalid key length";
335
+ const decryptionFailed = error2.message === "Unsupported state or unable to authenticate data";
336
+ if (isRange || invalidKeyLength) {
337
+ const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
338
+ err.code = "INVALID_DOTENV_KEY";
339
+ throw err;
340
+ } else if (decryptionFailed) {
341
+ const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
342
+ err.code = "DECRYPTION_FAILED";
343
+ throw err;
344
+ } else {
345
+ throw error2;
346
+ }
347
+ }
348
+ }
349
+ function populate(processEnv, parsed, options = {}) {
350
+ const debug = Boolean(options && options.debug);
351
+ const override = Boolean(options && options.override);
352
+ if (typeof parsed !== "object") {
353
+ const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
354
+ err.code = "OBJECT_REQUIRED";
355
+ throw err;
356
+ }
357
+ for (const key of Object.keys(parsed)) {
358
+ if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
359
+ if (override === true) {
360
+ processEnv[key] = parsed[key];
361
+ }
362
+ if (debug) {
363
+ if (override === true) {
364
+ _debug(`"${key}" is already defined and WAS overwritten`);
365
+ } else {
366
+ _debug(`"${key}" is already defined and was NOT overwritten`);
367
+ }
368
+ }
369
+ } else {
370
+ processEnv[key] = parsed[key];
371
+ }
372
+ }
373
+ }
374
+ var DotenvModule = {
375
+ configDotenv,
376
+ _configVault,
377
+ _parseVault,
378
+ config,
379
+ decrypt,
380
+ parse: parse6,
381
+ populate
382
+ };
383
+ module2.exports.configDotenv = DotenvModule.configDotenv;
384
+ module2.exports._configVault = DotenvModule._configVault;
385
+ module2.exports._parseVault = DotenvModule._parseVault;
386
+ module2.exports.config = DotenvModule.config;
387
+ module2.exports.decrypt = DotenvModule.decrypt;
388
+ module2.exports.parse = DotenvModule.parse;
389
+ module2.exports.populate = DotenvModule.populate;
390
+ module2.exports = DotenvModule;
391
+ }
392
+ });
393
+
36
394
  // node_modules/@ai-sdk/provider/dist/index.mjs
37
395
  var marker, symbol, _a, _AISDKError, AISDKError, name, marker2, symbol2, _a2, name2, marker3, symbol3, _a3, name3, marker4, symbol4, _a4, InvalidArgumentError, name4, marker5, symbol5, _a5, name5, marker6, symbol6, _a6, name6, marker7, symbol7, _a7, name7, marker8, symbol8, _a8, name8, marker9, symbol9, _a9, LoadSettingError, name9, marker10, symbol10, _a10, name10, marker11, symbol11, _a11, name11, marker12, symbol12, _a12, name12, marker13, symbol13, _a13, name13, marker14, symbol14, _a14, UnsupportedFunctionalityError;
38
396
  var init_dist = __esm({
@@ -13550,7 +13908,7 @@ var require_uint32ArrayFrom = __commonJS({
13550
13908
  });
13551
13909
 
13552
13910
  // node_modules/@aws-crypto/util/build/main/index.js
13553
- var require_main = __commonJS({
13911
+ var require_main2 = __commonJS({
13554
13912
  "node_modules/@aws-crypto/util/build/main/index.js"(exports2) {
13555
13913
  "use strict";
13556
13914
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -13581,8 +13939,8 @@ var require_aws_crc32 = __commonJS({
13581
13939
  Object.defineProperty(exports2, "__esModule", { value: true });
13582
13940
  exports2.AwsCrc32 = void 0;
13583
13941
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
13584
- var util_1 = require_main();
13585
- var index_1 = require_main2();
13942
+ var util_1 = require_main2();
13943
+ var index_1 = require_main3();
13586
13944
  var AwsCrc32 = (
13587
13945
  /** @class */
13588
13946
  (function() {
@@ -13612,13 +13970,13 @@ var require_aws_crc32 = __commonJS({
13612
13970
  });
13613
13971
 
13614
13972
  // node_modules/@aws-crypto/crc32/build/main/index.js
13615
- var require_main2 = __commonJS({
13973
+ var require_main3 = __commonJS({
13616
13974
  "node_modules/@aws-crypto/crc32/build/main/index.js"(exports2) {
13617
13975
  "use strict";
13618
13976
  Object.defineProperty(exports2, "__esModule", { value: true });
13619
13977
  exports2.AwsCrc32 = exports2.Crc32 = exports2.crc32 = void 0;
13620
13978
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
13621
- var util_1 = require_main();
13979
+ var util_1 = require_main2();
13622
13980
  function crc32(data2) {
13623
13981
  return new Crc32().update(data2).digest();
13624
13982
  }
@@ -13924,7 +14282,7 @@ var require_main2 = __commonJS({
13924
14282
  var require_dist_cjs33 = __commonJS({
13925
14283
  "node_modules/@smithy/eventstream-codec/dist-cjs/index.js"(exports2) {
13926
14284
  "use strict";
13927
- var crc32 = require_main2();
14285
+ var crc32 = require_main3();
13928
14286
  var utilHexEncoding = require_dist_cjs17();
13929
14287
  var Int64 = class _Int64 {
13930
14288
  bytes;
@@ -16474,12 +16832,12 @@ var require_httpAuthSchemeProvider = __commonJS({
16474
16832
  });
16475
16833
 
16476
16834
  // node_modules/@aws-sdk/client-bedrock-runtime/package.json
16477
- var require_package = __commonJS({
16835
+ var require_package2 = __commonJS({
16478
16836
  "node_modules/@aws-sdk/client-bedrock-runtime/package.json"(exports2, module2) {
16479
16837
  module2.exports = {
16480
16838
  name: "@aws-sdk/client-bedrock-runtime",
16481
16839
  description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
16482
- version: "3.911.0",
16840
+ version: "3.913.0",
16483
16841
  scripts: {
16484
16842
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
16485
16843
  "build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
@@ -16499,7 +16857,7 @@ var require_package = __commonJS({
16499
16857
  "@aws-crypto/sha256-browser": "5.2.0",
16500
16858
  "@aws-crypto/sha256-js": "5.2.0",
16501
16859
  "@aws-sdk/core": "3.911.0",
16502
- "@aws-sdk/credential-provider-node": "3.911.0",
16860
+ "@aws-sdk/credential-provider-node": "3.913.0",
16503
16861
  "@aws-sdk/eventstream-handler-node": "3.910.0",
16504
16862
  "@aws-sdk/middleware-eventstream": "3.910.0",
16505
16863
  "@aws-sdk/middleware-host-header": "3.910.0",
@@ -18708,7 +19066,7 @@ var require_httpAuthSchemeProvider2 = __commonJS({
18708
19066
  });
18709
19067
 
18710
19068
  // node_modules/@aws-sdk/client-sso/package.json
18711
- var require_package2 = __commonJS({
19069
+ var require_package3 = __commonJS({
18712
19070
  "node_modules/@aws-sdk/client-sso/package.json"(exports2, module2) {
18713
19071
  module2.exports = {
18714
19072
  name: "@aws-sdk/client-sso",
@@ -18923,7 +19281,7 @@ var require_runtimeConfig = __commonJS({
18923
19281
  Object.defineProperty(exports2, "__esModule", { value: true });
18924
19282
  exports2.getRuntimeConfig = void 0;
18925
19283
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
18926
- var package_json_1 = tslib_1.__importDefault(require_package2());
19284
+ var package_json_1 = tslib_1.__importDefault(require_package3());
18927
19285
  var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2));
18928
19286
  var util_user_agent_node_1 = require_dist_cjs51();
18929
19287
  var config_resolver_1 = require_dist_cjs39();
@@ -21157,7 +21515,7 @@ var require_dist_cjs61 = __commonJS({
21157
21515
  }
21158
21516
  return withProviderProfile;
21159
21517
  };
21160
- var resolveAssumeRoleCredentials = async (profileName, profiles, options, visitedProfiles = {}) => {
21518
+ var resolveAssumeRoleCredentials = async (profileName, profiles, options, visitedProfiles = {}, resolveProfileData2) => {
21161
21519
  options.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");
21162
21520
  const profileData = profiles[profileName];
21163
21521
  const { source_profile, region } = profileData;
@@ -21176,7 +21534,7 @@ var require_dist_cjs61 = __commonJS({
21176
21534
  throw new propertyProvider.CredentialsProviderError(`Detected a cycle attempting to resolve credentials for profile ${sharedIniFileLoader.getProfileName(options)}. Profiles visited: ` + Object.keys(visitedProfiles).join(", "), { logger: options.logger });
21177
21535
  }
21178
21536
  options.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${source_profile ? `source_profile=[${source_profile}]` : `profile=[${profileName}]`}`);
21179
- const sourceCredsProvider = source_profile ? resolveProfileData(source_profile, profiles, options, {
21537
+ const sourceCredsProvider = source_profile ? resolveProfileData2(source_profile, profiles, options, {
21180
21538
  ...visitedProfiles,
21181
21539
  [source_profile]: true
21182
21540
  }, isCredentialSourceWithoutRoleArn(profiles[source_profile] ?? {})) : (await resolveCredentialSource(profileData.credential_source, profileName, options.logger)(options))();
@@ -21252,7 +21610,7 @@ var require_dist_cjs61 = __commonJS({
21252
21610
  return resolveStaticCredentials(data2, options);
21253
21611
  }
21254
21612
  if (isAssumeRoleRecursiveCall || isAssumeRoleProfile(data2, { profile: profileName, logger: options.logger })) {
21255
- return resolveAssumeRoleCredentials(profileName, profiles, options, visitedProfiles);
21613
+ return resolveAssumeRoleCredentials(profileName, profiles, options, visitedProfiles, resolveProfileData);
21256
21614
  }
21257
21615
  if (isStaticCredsProfile(data2)) {
21258
21616
  return resolveStaticCredentials(data2, options);
@@ -21644,7 +22002,7 @@ var require_runtimeConfig2 = __commonJS({
21644
22002
  Object.defineProperty(exports2, "__esModule", { value: true });
21645
22003
  exports2.getRuntimeConfig = void 0;
21646
22004
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
21647
- var package_json_1 = tslib_1.__importDefault(require_package());
22005
+ var package_json_1 = tslib_1.__importDefault(require_package2());
21648
22006
  var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2));
21649
22007
  var credential_provider_node_1 = require_dist_cjs62();
21650
22008
  var eventstream_handler_node_1 = require_dist_cjs63();
@@ -41840,9 +42198,11 @@ var init_hooks = __esm({
41840
42198
  });
41841
42199
 
41842
42200
  // src/index.js
42201
+ var import_dotenv;
41843
42202
  var init_index = __esm({
41844
42203
  "src/index.js"() {
41845
42204
  "use strict";
42205
+ import_dotenv = __toESM(require_main(), 1);
41846
42206
  init_search();
41847
42207
  init_query();
41848
42208
  init_extract();
@@ -41862,6 +42222,7 @@ var init_index = __esm({
41862
42222
  init_probeTool();
41863
42223
  init_storage();
41864
42224
  init_hooks();
42225
+ import_dotenv.default.config();
41865
42226
  }
41866
42227
  });
41867
42228
 
@@ -53945,8 +54306,8 @@ var init_parser2 = __esm({
53945
54306
  { ALT: () => this.CONSUME(Identifier) },
53946
54307
  { ALT: () => this.CONSUME(Text) },
53947
54308
  { ALT: () => this.CONSUME(NumberLiteral) },
53948
- { ALT: () => this.CONSUME(RoundOpen) },
53949
- { ALT: () => this.CONSUME(RoundClose) },
54309
+ // Note: RoundOpen and RoundClose (parentheses) are NOT allowed in unquoted labels
54310
+ // to match Mermaid's behavior - use quoted labels like ["text (with parens)"] instead
53950
54311
  // Allow HTML-like tags (e.g., <br/>) inside labels
53951
54312
  { ALT: () => this.CONSUME(AngleLess) },
53952
54313
  { ALT: () => this.CONSUME(AngleOpen) },
@@ -54035,7 +54396,17 @@ var init_parser2 = __esm({
54035
54396
  this.OR([
54036
54397
  { ALT: () => this.CONSUME(Identifier) },
54037
54398
  { ALT: () => this.CONSUME(Text) },
54038
- { ALT: () => this.CONSUME(NumberLiteral) }
54399
+ { ALT: () => this.CONSUME(NumberLiteral) },
54400
+ // Allow HTML-like angle brackets and slashes for <br/>, <i>, etc.
54401
+ { ALT: () => this.CONSUME(AngleLess) },
54402
+ { ALT: () => this.CONSUME(AngleOpen) },
54403
+ { ALT: () => this.CONSUME(ForwardSlash) },
54404
+ { ALT: () => this.CONSUME(Backslash) },
54405
+ // Allow common punctuation seen in labels
54406
+ { ALT: () => this.CONSUME(Comma) },
54407
+ { ALT: () => this.CONSUME(Colon) },
54408
+ { ALT: () => this.CONSUME(Ampersand) },
54409
+ { ALT: () => this.CONSUME(Semicolon) }
54039
54410
  ]);
54040
54411
  });
54041
54412
  });
@@ -54647,7 +55018,7 @@ var init_semantics = __esm({
54647
55018
  this.ctx.errors.push({
54648
55019
  line: q3.startLine ?? 1,
54649
55020
  column: col,
54650
- severity: "warning",
55021
+ severity: "error",
54651
55022
  code: "FL-LABEL-CURLY-IN-QUOTED",
54652
55023
  message: "Curly braces inside quoted label text may be parsed as a shape by Mermaid. Replace { and } with HTML entities.",
54653
55024
  hint: 'Use &#123; and &#125; for { and } inside quoted text, e.g., "tyk-trace-&#123;id&#125;".',
@@ -54777,6 +55148,8 @@ var init_semantics = __esm({
54777
55148
  this.ctx.errors.push({
54778
55149
  line: tk.startLine ?? 1,
54779
55150
  column: col,
55151
+ // Treat backticks in quoted labels as errors (CLI rejects in many cases);
55152
+ // outside quotes, surface as a warning.
54780
55153
  severity: inQuoted ? "error" : "warning",
54781
55154
  code: "FL-LABEL-BACKTICK",
54782
55155
  message: "Backticks (`\u2026`) inside node labels are not supported by Mermaid.",
@@ -56061,7 +56434,7 @@ function validateFlowchart(text, options = {}) {
56061
56434
  code: "FL-LABEL-ESCAPED-QUOTE",
56062
56435
  message: 'Escaped quotes (\\") in node labels are accepted by Mermaid, but using &quot; is preferred for portability.',
56063
56436
  hint: 'Prefer &quot; inside quoted labels, e.g., A["He said &quot;Hi&quot;"]'
56064
- }).map((e3) => ({ ...e3, severity: "warning" }));
56437
+ }).map((e3) => ({ ...e3, severity: "error" }));
56065
56438
  const seenDoubleLines = new Set(prevErrors.filter((e3) => e3.code === "FL-LABEL-DOUBLE-IN-DOUBLE").map((e3) => e3.line));
56066
56439
  const escapedLinesAll = new Set(detectEscapedQuotes(tokens, { code: "x" }).map((e3) => e3.line));
56067
56440
  const dbl = detectDoubleInDouble(tokens, {
@@ -58340,11 +58713,85 @@ function computeFixes(text, errors, level = "safe") {
58340
58713
  const patchedLines = /* @__PURE__ */ new Set();
58341
58714
  const seen = /* @__PURE__ */ new Set();
58342
58715
  const piQuoteClosedLines = /* @__PURE__ */ new Set();
58716
+ function sanitizeAllQuotedSegmentsInShapes(lineText, lineNo) {
58717
+ const shapes = [
58718
+ { open: "[[", close: "]]" },
58719
+ { open: "((", close: "))" },
58720
+ { open: "{{", close: "}}" },
58721
+ { open: "[(", close: ")]" },
58722
+ { open: "([", close: "])" },
58723
+ { open: "{", close: "}" },
58724
+ { open: "[", close: "]" },
58725
+ { open: "(", close: ")" }
58726
+ ];
58727
+ let idx = 0;
58728
+ let produced = 0;
58729
+ while (idx < lineText.length) {
58730
+ let found = null;
58731
+ for (const s3 of shapes) {
58732
+ const i3 = lineText.indexOf(s3.open, idx);
58733
+ if (i3 !== -1 && (found === null || i3 < found.i))
58734
+ found = { ...s3, i: i3 };
58735
+ }
58736
+ if (!found)
58737
+ break;
58738
+ const contentStart = found.i + found.open.length;
58739
+ const closeIdx = lineText.indexOf(found.close, contentStart);
58740
+ if (closeIdx === -1) {
58741
+ idx = contentStart;
58742
+ continue;
58743
+ }
58744
+ let q1 = -1;
58745
+ for (let i3 = contentStart; i3 < closeIdx; i3++) {
58746
+ if (lineText[i3] === '"' && lineText[i3 - 1] !== "\\") {
58747
+ q1 = i3;
58748
+ break;
58749
+ }
58750
+ }
58751
+ if (q1 !== -1) {
58752
+ let q22 = -1;
58753
+ for (let j3 = closeIdx - 1; j3 > q1; j3--) {
58754
+ if (lineText[j3] === '"' && lineText[j3 - 1] !== "\\") {
58755
+ q22 = j3;
58756
+ break;
58757
+ }
58758
+ }
58759
+ if (q22 !== -1) {
58760
+ const inner = lineText.slice(q1 + 1, q22);
58761
+ const replaced = sanitizeQuotedInner(inner);
58762
+ if (replaced !== inner) {
58763
+ edits.push({ start: { line: lineNo, column: q1 + 2 }, end: { line: lineNo, column: q22 + 1 }, newText: replaced });
58764
+ produced++;
58765
+ }
58766
+ }
58767
+ }
58768
+ idx = closeIdx + found.close.length;
58769
+ }
58770
+ return produced;
58771
+ }
58772
+ function sanitizeQuotedInner(inner) {
58773
+ const SENT_Q = "\0__Q__";
58774
+ let out = inner.split("&quot;").join(SENT_Q);
58775
+ out = out.replace(/`/g, "");
58776
+ out = out.replace(/\\\"/g, "&quot;");
58777
+ out = out.replace(/\"/g, "&quot;");
58778
+ out = out.replace(/"/g, "&quot;");
58779
+ out = out.split(SENT_Q).join("&quot;");
58780
+ return out;
58781
+ }
58343
58782
  for (const e3 of errors) {
58344
58783
  const key = `${e3.code}@${e3.line}:${e3.column}:${e3.length ?? 1}`;
58345
58784
  if (seen.has(key))
58346
58785
  continue;
58347
58786
  seen.add(key);
58787
+ if ((e3.code === "FL-LABEL-ESCAPED-QUOTE" || e3.code === "FL-LABEL-CURLY-IN-QUOTED" || e3.code === "FL-LABEL-DOUBLE-IN-DOUBLE" || e3.code === "FL-LABEL-BACKTICK") && !patchedLines.has(e3.line)) {
58788
+ const lineText = lineTextAt(text, e3.line);
58789
+ const produced = sanitizeAllQuotedSegmentsInShapes(lineText, e3.line);
58790
+ patchedLines.add(e3.line);
58791
+ if (produced > 0) {
58792
+ continue;
58793
+ }
58794
+ }
58348
58795
  if (is("FL-ARROW-INVALID", e3)) {
58349
58796
  edits.push(replaceRange(text, at(e3), e3.length ?? 2, "-->"));
58350
58797
  continue;
@@ -58449,6 +58896,8 @@ function computeFixes(text, errors, level = "safe") {
58449
58896
  continue;
58450
58897
  }
58451
58898
  if (is("FL-LABEL-ESCAPED-QUOTE", e3)) {
58899
+ if (patchedLines.has(e3.line))
58900
+ continue;
58452
58901
  const lineText = lineTextAt(text, e3.line);
58453
58902
  const caret0 = Math.max(0, e3.column - 1);
58454
58903
  const opens = [
@@ -58471,17 +58920,10 @@ function computeFixes(text, errors, level = "safe") {
58471
58920
  const q22 = lineText.lastIndexOf('"', closeIdx - 1);
58472
58921
  if (q1 !== -1 && q22 !== -1 && q22 > q1) {
58473
58922
  const inner = lineText.slice(q1 + 1, q22);
58474
- if (inner.includes('\\"')) {
58475
- const replaced = inner.split('\\"').join("&quot;");
58923
+ const replaced = sanitizeQuotedInner(inner);
58924
+ if (replaced !== inner) {
58476
58925
  edits.push({ start: { line: e3.line, column: q1 + 2 }, end: { line: e3.line, column: q22 + 1 }, newText: replaced });
58477
58926
  continue;
58478
- if (is("FL-META-UNSUPPORTED", e3)) {
58479
- if (level === "all") {
58480
- const lineText2 = lineTextAt(text, e3.line);
58481
- edits.push({ start: { line: e3.line, column: 1 }, end: { line: e3.line + 1, column: 1 }, newText: "" });
58482
- }
58483
- continue;
58484
- }
58485
58927
  }
58486
58928
  }
58487
58929
  }
@@ -58491,11 +58933,12 @@ function computeFixes(text, errors, level = "safe") {
58491
58933
  }
58492
58934
  if (is("FL-META-UNSUPPORTED", e3)) {
58493
58935
  if (level === "all") {
58936
+ const lineText = lineTextAt(text, e3.line);
58494
58937
  edits.push({ start: { line: e3.line, column: 1 }, end: { line: e3.line + 1, column: 1 }, newText: "" });
58495
58938
  }
58496
58939
  continue;
58497
58940
  }
58498
- if (is("FL-LABEL-BACKTICK", e3)) {
58941
+ if (is("FL-LABEL-BACKTICK", e3) && e3.severity === "warning") {
58499
58942
  edits.push(replaceRange(text, at(e3), e3.length ?? 1, ""));
58500
58943
  continue;
58501
58944
  }
@@ -58505,13 +58948,13 @@ function computeFixes(text, errors, level = "safe") {
58505
58948
  let qOpenIdx = -1;
58506
58949
  let qChar = null;
58507
58950
  for (let i3 = caret0; i3 >= 0; i3--) {
58508
- const ch2 = lineText[i3];
58509
- const code = ch2 ? ch2.charCodeAt(0) : -1;
58951
+ const ch = lineText[i3];
58952
+ const code = ch ? ch.charCodeAt(0) : -1;
58510
58953
  if (code === 34 || code === 39) {
58511
58954
  const bs = i3 > 0 && lineText[i3 - 1] === "\\";
58512
58955
  if (!bs) {
58513
58956
  qOpenIdx = i3;
58514
- qChar = ch2;
58957
+ qChar = ch;
58515
58958
  break;
58516
58959
  }
58517
58960
  }
@@ -58519,8 +58962,8 @@ function computeFixes(text, errors, level = "safe") {
58519
58962
  if (qOpenIdx !== -1 && qChar) {
58520
58963
  let qCloseIdx = -1;
58521
58964
  for (let j3 = qOpenIdx + 1; j3 < lineText.length; j3++) {
58522
- const ch2 = lineText[j3];
58523
- const code = ch2 ? ch2.charCodeAt(0) : -1;
58965
+ const ch = lineText[j3];
58966
+ const code = ch ? ch.charCodeAt(0) : -1;
58524
58967
  if (code === (qChar ? qChar.charCodeAt(0) : -1)) {
58525
58968
  const bs = lineText[j3 - 1] === "\\";
58526
58969
  if (!bs) {
@@ -58531,17 +58974,13 @@ function computeFixes(text, errors, level = "safe") {
58531
58974
  }
58532
58975
  if (qCloseIdx > qOpenIdx) {
58533
58976
  const inner = lineText.slice(qOpenIdx + 1, qCloseIdx);
58534
- const replaced = inner.replace(/\{/g, "&#123;").replace(/\}/g, "&#125;");
58977
+ const replaced = sanitizeQuotedInner(inner);
58535
58978
  if (replaced !== inner) {
58536
58979
  edits.push({ start: { line: e3.line, column: qOpenIdx + 2 }, end: { line: e3.line, column: qCloseIdx + 1 }, newText: replaced });
58537
58980
  continue;
58538
58981
  }
58539
58982
  }
58540
58983
  }
58541
- const ch = lineText[caret0] || "";
58542
- const rep = ch === "{" ? "&#123;" : ch === "}" ? "&#125;" : ch;
58543
- if (rep !== ch)
58544
- edits.push(replaceRange(text, at(e3), e3.length ?? 1, rep));
58545
58984
  continue;
58546
58985
  }
58547
58986
  if (is("FL-END-WITHOUT-SUBGRAPH", e3)) {
@@ -58553,6 +58992,11 @@ function computeFixes(text, errors, level = "safe") {
58553
58992
  if (is("FL-LABEL-DOUBLE-IN-DOUBLE", e3)) {
58554
58993
  const lineText = lineTextAt(text, e3.line);
58555
58994
  const caret0 = Math.max(0, e3.column - 1);
58995
+ const rawDqCount = (lineText.match(/\"/g) || []).length;
58996
+ const unescapedDqCount = (lineText.replace(/\\\"/g, "").match(/\"/g) || []).length;
58997
+ if (rawDqCount + unescapedDqCount > 8 && level !== "all") {
58998
+ continue;
58999
+ }
58556
59000
  const opens = [
58557
59001
  { tok: "[[", idx: lineText.lastIndexOf("[[", caret0) },
58558
59002
  { tok: "((", idx: lineText.lastIndexOf("((", caret0) },
@@ -58576,7 +59020,7 @@ function computeFixes(text, errors, level = "safe") {
58576
59020
  const q22 = lineText.lastIndexOf('"', closeIdx - 1);
58577
59021
  if (q1 !== -1 && q22 !== -1 && q22 > q1) {
58578
59022
  const inner = lineText.slice(q1 + 1, q22);
58579
- const replaced = inner.split("&quot;").join("\0").split('"').join("&quot;").split("\0").join("&quot;");
59023
+ const replaced = sanitizeQuotedInner(inner);
58580
59024
  if (replaced !== inner) {
58581
59025
  const start = { line: e3.line, column: q1 + 2 };
58582
59026
  const end = { line: e3.line, column: q22 + 1 };
@@ -58938,6 +59382,10 @@ function computeFixes(text, errors, level = "safe") {
58938
59382
  if (level === "safe" || level === "all") {
58939
59383
  const lineText = lineTextAt(text, e3.line);
58940
59384
  const caret0 = Math.max(0, e3.column - 1);
59385
+ const dq = (lineText.replace(/\\\"/g, "").match(/\"/g) || []).length;
59386
+ if (lineText.length > 600 || dq > 8) {
59387
+ continue;
59388
+ }
58941
59389
  const openPairs = [
58942
59390
  { open: "[[", close: "]]", idx: lineText.lastIndexOf("[[", caret0), delta: 2 },
58943
59391
  { open: "((", close: "))", idx: lineText.lastIndexOf("((", caret0), delta: 2 },
@@ -58988,6 +59436,24 @@ function computeFixes(text, errors, level = "safe") {
58988
59436
  { open: "[", close: "]" },
58989
59437
  { open: "(", close: ")" }
58990
59438
  ];
59439
+ const findMatchingCloser = (text2, openIdx, opener, closer) => {
59440
+ let pos = openIdx + opener.length;
59441
+ let depth = 1;
59442
+ while (pos < text2.length && depth > 0) {
59443
+ if (text2.slice(pos, pos + opener.length) === opener) {
59444
+ depth++;
59445
+ pos += opener.length;
59446
+ } else if (text2.slice(pos, pos + closer.length) === closer) {
59447
+ depth--;
59448
+ if (depth === 0)
59449
+ return pos;
59450
+ pos += closer.length;
59451
+ } else {
59452
+ pos++;
59453
+ }
59454
+ }
59455
+ return -1;
59456
+ };
58991
59457
  for (const shape of shapes) {
58992
59458
  let searchStart = 0;
58993
59459
  while (true) {
@@ -58995,7 +59461,7 @@ function computeFixes(text, errors, level = "safe") {
58995
59461
  if (openIdx === -1)
58996
59462
  break;
58997
59463
  const contentStart = openIdx + shape.open.length;
58998
- const closeIdx = lineText.indexOf(shape.close, contentStart);
59464
+ const closeIdx = shape.open === "(" && shape.close === ")" ? findMatchingCloser(lineText, openIdx, shape.open, shape.close) : lineText.indexOf(shape.close, contentStart);
58999
59465
  if (closeIdx === -1)
59000
59466
  break;
59001
59467
  if (openIdx <= caret0 && caret0 < closeIdx) {
@@ -59013,10 +59479,11 @@ function computeFixes(text, errors, level = "safe") {
59013
59479
  const left = core.slice(0, 1);
59014
59480
  const right = core.slice(-1);
59015
59481
  const isSlashPair = (l3, r3) => l3 === "/" && r3 === "/" || l3 === "\\" && r3 === "\\" || l3 === "/" && r3 === "\\" || l3 === "\\" && r3 === "/";
59016
- if (core.length >= 2 && isSlashPair(left, right)) {
59017
- break;
59482
+ const isParallelogramShape = core.length >= 2 && isSlashPair(left, right);
59483
+ let replaced = inner.replace(/\(/g, "&#40;").replace(/\)/g, "&#41;");
59484
+ if (isParallelogramShape) {
59485
+ replaced = replaced.replace(/"/g, "&quot;");
59018
59486
  }
59019
- const replaced = inner.replace(/\(/g, "&#40;").replace(/\)/g, "&#41;");
59020
59487
  if (replaced !== inner) {
59021
59488
  edits.push({ start: { line: e3.line, column: contentStart + 1 }, end: { line: e3.line, column: closeIdx + 1 }, newText: replaced });
59022
59489
  patchedLines.add(e3.line);
@@ -69136,7 +69603,7 @@ ${baseGroup}
69136
69603
  return out;
69137
69604
  }
69138
69605
  htmlDecode(s3) {
69139
- return s3.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'");
69606
+ return s3.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&#96;/g, "`").replace(/&#123;/g, "{").replace(/&#125;/g, "}").replace(/&#40;/g, "(").replace(/&#41;/g, ")");
69140
69607
  }
69141
69608
  generateEdge(edge, padX, padY, nodeMap) {
69142
69609
  if (!edge.points || edge.points.length < 2) {
@@ -73846,9 +74313,10 @@ __export(ProbeAgent_exports, {
73846
74313
  ProbeAgent: () => ProbeAgent
73847
74314
  });
73848
74315
  module.exports = __toCommonJS(ProbeAgent_exports);
73849
- var import_anthropic, import_openai, import_google, import_ai3, import_crypto5, import_events2, import_fs10, import_promises2, import_path11, MAX_TOOL_ITERATIONS, MAX_HISTORY_MESSAGES, SUPPORTED_IMAGE_EXTENSIONS, MAX_IMAGE_FILE_SIZE, ProbeAgent;
74316
+ var import_dotenv2, import_anthropic, import_openai, import_google, import_ai3, import_crypto5, import_events2, import_fs10, import_promises2, import_path11, MAX_TOOL_ITERATIONS, MAX_HISTORY_MESSAGES, SUPPORTED_IMAGE_EXTENSIONS, MAX_IMAGE_FILE_SIZE, ProbeAgent;
73850
74317
  var init_ProbeAgent = __esm({
73851
74318
  "src/agent/ProbeAgent.js"() {
74319
+ import_dotenv2 = __toESM(require_main(), 1);
73852
74320
  import_anthropic = require("@ai-sdk/anthropic");
73853
74321
  import_openai = require("@ai-sdk/openai");
73854
74322
  import_google = require("@ai-sdk/google");
@@ -73870,6 +74338,7 @@ var init_ProbeAgent = __esm({
73870
74338
  init_schemaUtils();
73871
74339
  init_xmlParsingUtils();
73872
74340
  init_mcp();
74341
+ import_dotenv2.default.config();
73873
74342
  MAX_TOOL_ITERATIONS = parseInt(process.env.MAX_TOOL_ITERATIONS || "30", 10);
73874
74343
  MAX_HISTORY_MESSAGES = 100;
73875
74344
  SUPPORTED_IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "webp", "gif", "bmp", "svg"];