@probelabs/probe 0.6.0-rc263 → 0.6.0-rc264

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.
@@ -17506,7 +17506,7 @@ var require_package2 = __commonJS({
17506
17506
  module2.exports = {
17507
17507
  name: "@aws-sdk/client-bedrock-runtime",
17508
17508
  description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
17509
- version: "3.999.0",
17509
+ version: "3.1000.0",
17510
17510
  scripts: {
17511
17511
  build: "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
17512
17512
  "build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
@@ -17517,7 +17517,11 @@ var require_package2 = __commonJS({
17517
17517
  clean: "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
17518
17518
  "extract:docs": "api-extractor run --local",
17519
17519
  "generate:client": "node ../../scripts/generate-clients/single-service --solo bedrock-runtime",
17520
- "test:index": "tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs"
17520
+ test: "yarn g:vitest run --passWithNoTests",
17521
+ "test:index": "tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs",
17522
+ "test:integration": "yarn g:vitest run --passWithNoTests -c vitest.config.integ.mts",
17523
+ "test:integration:watch": "yarn g:vitest run --passWithNoTests -c vitest.config.integ.mts",
17524
+ "test:watch": "yarn g:vitest watch --passWithNoTests"
17521
17525
  },
17522
17526
  main: "./dist-cjs/index.js",
17523
17527
  types: "./dist-types/index.d.ts",
@@ -17536,7 +17540,7 @@ var require_package2 = __commonJS({
17536
17540
  "@aws-sdk/middleware-user-agent": "^3.972.15",
17537
17541
  "@aws-sdk/middleware-websocket": "^3.972.10",
17538
17542
  "@aws-sdk/region-config-resolver": "^3.972.6",
17539
- "@aws-sdk/token-providers": "3.999.0",
17543
+ "@aws-sdk/token-providers": "3.1000.0",
17540
17544
  "@aws-sdk/types": "^3.973.4",
17541
17545
  "@aws-sdk/util-endpoints": "^3.996.3",
17542
17546
  "@aws-sdk/util-user-agent-browser": "^3.972.6",
@@ -17573,12 +17577,14 @@ var require_package2 = __commonJS({
17573
17577
  tslib: "^2.6.2"
17574
17578
  },
17575
17579
  devDependencies: {
17580
+ "@smithy/snapshot-testing": "^1.0.7",
17576
17581
  "@tsconfig/node20": "20.1.8",
17577
17582
  "@types/node": "^20.14.8",
17578
17583
  concurrently: "7.0.0",
17579
17584
  "downlevel-dts": "0.10.1",
17580
17585
  premove: "4.0.0",
17581
- typescript: "~5.8.3"
17586
+ typescript: "~5.8.3",
17587
+ vitest: "^4.0.17"
17582
17588
  },
17583
17589
  engines: {
17584
17590
  node: ">=20.0.0"
@@ -19580,9 +19586,9 @@ var init_sso_oidc = __esm({
19580
19586
  }
19581
19587
  });
19582
19588
 
19583
- // node_modules/@aws-sdk/token-providers/dist-cjs/index.js
19589
+ // node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-cjs/index.js
19584
19590
  var require_dist_cjs56 = __commonJS({
19585
- "node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports2) {
19591
+ "node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports2) {
19586
19592
  "use strict";
19587
19593
  var client = (init_client(), __toCommonJS(client_exports));
19588
19594
  var httpAuthSchemes = (init_httpAuthSchemes2(), __toCommonJS(httpAuthSchemes_exports));
@@ -23415,8 +23421,155 @@ var require_dist_cjs63 = __commonJS({
23415
23421
  }
23416
23422
  });
23417
23423
 
23418
- // node_modules/@smithy/eventstream-serde-node/dist-cjs/index.js
23424
+ // node_modules/@aws-sdk/token-providers/dist-cjs/index.js
23419
23425
  var require_dist_cjs64 = __commonJS({
23426
+ "node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports2) {
23427
+ "use strict";
23428
+ var client = (init_client(), __toCommonJS(client_exports));
23429
+ var httpAuthSchemes = (init_httpAuthSchemes2(), __toCommonJS(httpAuthSchemes_exports));
23430
+ var propertyProvider = require_dist_cjs24();
23431
+ var sharedIniFileLoader = require_dist_cjs42();
23432
+ var node_fs = require("node:fs");
23433
+ var fromEnvSigningName = ({ logger: logger2, signingName } = {}) => async () => {
23434
+ logger2?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
23435
+ if (!signingName) {
23436
+ throw new propertyProvider.TokenProviderError("Please pass 'signingName' to compute environment variable key", { logger: logger2 });
23437
+ }
23438
+ const bearerTokenKey = httpAuthSchemes.getBearerTokenEnvKey(signingName);
23439
+ if (!(bearerTokenKey in process.env)) {
23440
+ throw new propertyProvider.TokenProviderError(`Token not present in '${bearerTokenKey}' environment variable`, { logger: logger2 });
23441
+ }
23442
+ const token = { token: process.env[bearerTokenKey] };
23443
+ client.setTokenFeature(token, "BEARER_SERVICE_ENV_VARS", "3");
23444
+ return token;
23445
+ };
23446
+ var EXPIRE_WINDOW_MS = 5 * 60 * 1e3;
23447
+ var REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`;
23448
+ var getSsoOidcClient = async (ssoRegion, init = {}, callerClientConfig) => {
23449
+ const { SSOOIDCClient: SSOOIDCClient2 } = await Promise.resolve().then(() => (init_sso_oidc(), sso_oidc_exports));
23450
+ const coalesce = (prop) => init.clientConfig?.[prop] ?? init.parentClientConfig?.[prop] ?? callerClientConfig?.[prop];
23451
+ const ssoOidcClient = new SSOOIDCClient2(Object.assign({}, init.clientConfig ?? {}, {
23452
+ region: ssoRegion ?? init.clientConfig?.region,
23453
+ logger: coalesce("logger"),
23454
+ userAgentAppId: coalesce("userAgentAppId")
23455
+ }));
23456
+ return ssoOidcClient;
23457
+ };
23458
+ var getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}, callerClientConfig) => {
23459
+ const { CreateTokenCommand: CreateTokenCommand2 } = await Promise.resolve().then(() => (init_sso_oidc(), sso_oidc_exports));
23460
+ const ssoOidcClient = await getSsoOidcClient(ssoRegion, init, callerClientConfig);
23461
+ return ssoOidcClient.send(new CreateTokenCommand2({
23462
+ clientId: ssoToken.clientId,
23463
+ clientSecret: ssoToken.clientSecret,
23464
+ refreshToken: ssoToken.refreshToken,
23465
+ grantType: "refresh_token"
23466
+ }));
23467
+ };
23468
+ var validateTokenExpiry = (token) => {
23469
+ if (token.expiration && token.expiration.getTime() < Date.now()) {
23470
+ throw new propertyProvider.TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false);
23471
+ }
23472
+ };
23473
+ var validateTokenKey = (key, value, forRefresh = false) => {
23474
+ if (typeof value === "undefined") {
23475
+ throw new propertyProvider.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
23476
+ }
23477
+ };
23478
+ var { writeFile: writeFile2 } = node_fs.promises;
23479
+ var writeSSOTokenToFile = (id, ssoToken) => {
23480
+ const tokenFilepath = sharedIniFileLoader.getSSOTokenFilepath(id);
23481
+ const tokenString = JSON.stringify(ssoToken, null, 2);
23482
+ return writeFile2(tokenFilepath, tokenString);
23483
+ };
23484
+ var lastRefreshAttemptTime = /* @__PURE__ */ new Date(0);
23485
+ var fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
23486
+ init.logger?.debug("@aws-sdk/token-providers - fromSso");
23487
+ const profiles = await sharedIniFileLoader.parseKnownFiles(init);
23488
+ const profileName = sharedIniFileLoader.getProfileName({
23489
+ profile: init.profile ?? callerClientConfig?.profile
23490
+ });
23491
+ const profile = profiles[profileName];
23492
+ if (!profile) {
23493
+ throw new propertyProvider.TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false);
23494
+ } else if (!profile["sso_session"]) {
23495
+ throw new propertyProvider.TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
23496
+ }
23497
+ const ssoSessionName = profile["sso_session"];
23498
+ const ssoSessions = await sharedIniFileLoader.loadSsoSessionData(init);
23499
+ const ssoSession = ssoSessions[ssoSessionName];
23500
+ if (!ssoSession) {
23501
+ throw new propertyProvider.TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false);
23502
+ }
23503
+ for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) {
23504
+ if (!ssoSession[ssoSessionRequiredKey]) {
23505
+ throw new propertyProvider.TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false);
23506
+ }
23507
+ }
23508
+ ssoSession["sso_start_url"];
23509
+ const ssoRegion = ssoSession["sso_region"];
23510
+ let ssoToken;
23511
+ try {
23512
+ ssoToken = await sharedIniFileLoader.getSSOTokenFromFile(ssoSessionName);
23513
+ } catch (e5) {
23514
+ throw new propertyProvider.TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);
23515
+ }
23516
+ validateTokenKey("accessToken", ssoToken.accessToken);
23517
+ validateTokenKey("expiresAt", ssoToken.expiresAt);
23518
+ const { accessToken, expiresAt } = ssoToken;
23519
+ const existingToken = { token: accessToken, expiration: new Date(expiresAt) };
23520
+ if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {
23521
+ return existingToken;
23522
+ }
23523
+ if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1e3) {
23524
+ validateTokenExpiry(existingToken);
23525
+ return existingToken;
23526
+ }
23527
+ validateTokenKey("clientId", ssoToken.clientId, true);
23528
+ validateTokenKey("clientSecret", ssoToken.clientSecret, true);
23529
+ validateTokenKey("refreshToken", ssoToken.refreshToken, true);
23530
+ try {
23531
+ lastRefreshAttemptTime.setTime(Date.now());
23532
+ const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
23533
+ validateTokenKey("accessToken", newSsoOidcToken.accessToken);
23534
+ validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
23535
+ const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1e3);
23536
+ try {
23537
+ await writeSSOTokenToFile(ssoSessionName, {
23538
+ ...ssoToken,
23539
+ accessToken: newSsoOidcToken.accessToken,
23540
+ expiresAt: newTokenExpiration.toISOString(),
23541
+ refreshToken: newSsoOidcToken.refreshToken
23542
+ });
23543
+ } catch (error2) {
23544
+ }
23545
+ return {
23546
+ token: newSsoOidcToken.accessToken,
23547
+ expiration: newTokenExpiration
23548
+ };
23549
+ } catch (error2) {
23550
+ validateTokenExpiry(existingToken);
23551
+ return existingToken;
23552
+ }
23553
+ };
23554
+ var fromStatic = ({ token, logger: logger2 }) => async () => {
23555
+ logger2?.debug("@aws-sdk/token-providers - fromStatic");
23556
+ if (!token || !token.token) {
23557
+ throw new propertyProvider.TokenProviderError(`Please pass a valid token to fromStatic`, false);
23558
+ }
23559
+ return token;
23560
+ };
23561
+ var nodeProvider = (init = {}) => propertyProvider.memoize(propertyProvider.chain(fromSso(init), async () => {
23562
+ throw new propertyProvider.TokenProviderError("Could not load token from any providers", false);
23563
+ }), (token) => token.expiration !== void 0 && token.expiration.getTime() - Date.now() < 3e5, (token) => token.expiration !== void 0);
23564
+ exports2.fromEnvSigningName = fromEnvSigningName;
23565
+ exports2.fromSso = fromSso;
23566
+ exports2.fromStatic = fromStatic;
23567
+ exports2.nodeProvider = nodeProvider;
23568
+ }
23569
+ });
23570
+
23571
+ // node_modules/@smithy/eventstream-serde-node/dist-cjs/index.js
23572
+ var require_dist_cjs65 = __commonJS({
23420
23573
  "node_modules/@smithy/eventstream-serde-node/dist-cjs/index.js"(exports2) {
23421
23574
  "use strict";
23422
23575
  var eventstreamSerdeUniversal = require_dist_cjs35();
@@ -26098,11 +26251,11 @@ var require_runtimeConfig = __commonJS({
26098
26251
  var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2));
26099
26252
  var credential_provider_node_1 = require_dist_cjs62();
26100
26253
  var eventstream_handler_node_1 = require_dist_cjs63();
26101
- var token_providers_1 = require_dist_cjs56();
26254
+ var token_providers_1 = require_dist_cjs64();
26102
26255
  var util_user_agent_node_1 = require_dist_cjs51();
26103
26256
  var config_resolver_1 = require_dist_cjs39();
26104
26257
  var core_2 = (init_dist_es(), __toCommonJS(dist_es_exports));
26105
- var eventstream_serde_node_1 = require_dist_cjs64();
26258
+ var eventstream_serde_node_1 = require_dist_cjs65();
26106
26259
  var hash_node_1 = require_dist_cjs52();
26107
26260
  var middleware_retry_1 = require_dist_cjs47();
26108
26261
  var node_config_provider_1 = require_dist_cjs43();
@@ -26174,7 +26327,7 @@ var require_runtimeConfig = __commonJS({
26174
26327
  });
26175
26328
 
26176
26329
  // node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js
26177
- var require_dist_cjs65 = __commonJS({
26330
+ var require_dist_cjs66 = __commonJS({
26178
26331
  "node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js"(exports2) {
26179
26332
  "use strict";
26180
26333
  var middlewareEventstream = require_dist_cjs3();
@@ -27019,13 +27172,13 @@ var import_client_bedrock_runtime, import_client_bedrock_runtime2, import_client
27019
27172
  var init_dist3 = __esm({
27020
27173
  "node_modules/@ai-sdk/amazon-bedrock/dist/index.mjs"() {
27021
27174
  init_dist2();
27022
- import_client_bedrock_runtime = __toESM(require_dist_cjs65(), 1);
27175
+ import_client_bedrock_runtime = __toESM(require_dist_cjs66(), 1);
27023
27176
  init_dist();
27024
- import_client_bedrock_runtime2 = __toESM(require_dist_cjs65(), 1);
27177
+ import_client_bedrock_runtime2 = __toESM(require_dist_cjs66(), 1);
27025
27178
  init_dist();
27026
27179
  init_dist();
27027
27180
  init_dist2();
27028
- import_client_bedrock_runtime3 = __toESM(require_dist_cjs65(), 1);
27181
+ import_client_bedrock_runtime3 = __toESM(require_dist_cjs66(), 1);
27029
27182
  generateFileId = createIdGenerator({ prefix: "file", size: 16 });
27030
27183
  BedrockChatLanguageModel = class {
27031
27184
  constructor(modelId, settings, config) {
@@ -40251,6 +40404,122 @@ var init_bashPermissions = __esm({
40251
40404
  });
40252
40405
 
40253
40406
  // src/agent/bashExecutor.js
40407
+ function splitCommandComponents(command) {
40408
+ const parts = [];
40409
+ let current2 = "";
40410
+ let inQuote = false;
40411
+ let quoteChar = "";
40412
+ for (let i5 = 0; i5 < command.length; i5++) {
40413
+ const c5 = command[i5];
40414
+ const next = command[i5 + 1] || "";
40415
+ if (c5 === "\\" && !inQuote) {
40416
+ current2 += c5 + next;
40417
+ i5++;
40418
+ continue;
40419
+ }
40420
+ if (inQuote && quoteChar === '"' && c5 === "\\" && next) {
40421
+ current2 += c5 + next;
40422
+ i5++;
40423
+ continue;
40424
+ }
40425
+ if (!inQuote && (c5 === '"' || c5 === "'")) {
40426
+ inQuote = true;
40427
+ quoteChar = c5;
40428
+ current2 += c5;
40429
+ continue;
40430
+ }
40431
+ if (inQuote && c5 === quoteChar) {
40432
+ inQuote = false;
40433
+ current2 += c5;
40434
+ continue;
40435
+ }
40436
+ if (!inQuote) {
40437
+ if (c5 === "&" && next === "&" || c5 === "|" && next === "|") {
40438
+ if (current2.trim()) parts.push(current2.trim());
40439
+ current2 = "";
40440
+ i5++;
40441
+ continue;
40442
+ }
40443
+ if (c5 === "|" || c5 === ";") {
40444
+ if (current2.trim()) parts.push(current2.trim());
40445
+ current2 = "";
40446
+ continue;
40447
+ }
40448
+ }
40449
+ current2 += c5;
40450
+ }
40451
+ if (current2.trim()) parts.push(current2.trim());
40452
+ return parts;
40453
+ }
40454
+ function checkSingleCommandInteractive(command) {
40455
+ let effective = command.trim();
40456
+ while (/^\w+=\S*\s/.test(effective)) {
40457
+ effective = effective.replace(/^\w+=\S*\s+/, "");
40458
+ }
40459
+ const parts = effective.split(/\s+/);
40460
+ const base2 = parts[0];
40461
+ const args = parts.slice(1);
40462
+ if (["vi", "vim", "nvim", "nano", "emacs", "pico", "joe", "mcedit"].includes(base2)) {
40463
+ return `'${base2}' is an interactive editor and cannot run without a terminal. Use non-interactive file manipulation commands instead.`;
40464
+ }
40465
+ if (["less", "more"].includes(base2)) {
40466
+ return `'${base2}' is an interactive pager. Use 'cat', 'head', or 'tail' instead.`;
40467
+ }
40468
+ if (base2 === "git") {
40469
+ const sub = args[0];
40470
+ if (sub === "commit") {
40471
+ const hasNonInteractiveFlag = args.some(
40472
+ (a5) => a5 === "-m" || a5.startsWith("--message") || a5 === "-C" || a5 === "-c" || a5.startsWith("--fixup") || a5.startsWith("--squash") || a5 === "--allow-empty-message" || a5 === "--no-edit"
40473
+ );
40474
+ if (!hasNonInteractiveFlag) {
40475
+ return `Interactive command: 'git commit' opens an editor for the commit message. Use 'git commit -m "your message"' instead.`;
40476
+ }
40477
+ }
40478
+ if (sub === "rebase" && (args.includes("--continue") || args.includes("--skip"))) {
40479
+ return "Interactive command: 'git rebase --continue' opens an editor. Set environment variable GIT_EDITOR=true to accept default messages, e.g. pass env: {GIT_EDITOR: 'true'} or prepend GIT_EDITOR=true to the command.";
40480
+ }
40481
+ if (sub === "rebase" && (args.includes("-i") || args.includes("--interactive"))) {
40482
+ return "Interactive command: 'git rebase -i' requires an interactive editor. Interactive rebase cannot run without a terminal.";
40483
+ }
40484
+ if (sub === "merge" && !args.includes("--no-edit") && !args.includes("--no-commit") && !args.includes("--ff-only")) {
40485
+ return "Interactive command: 'git merge' may open an editor for the merge commit message. Add '--no-edit' to accept the default message.";
40486
+ }
40487
+ if (sub === "cherry-pick" && !args.includes("--no-edit")) {
40488
+ return "Interactive command: 'git cherry-pick' may open an editor. Add '--no-edit' to accept the default message.";
40489
+ }
40490
+ if (sub === "revert" && !args.includes("--no-edit")) {
40491
+ return "Interactive command: 'git revert' opens an editor. Add '--no-edit' to accept the default message.";
40492
+ }
40493
+ if (sub === "tag" && args.includes("-a") && !args.some((a5) => a5 === "-m" || a5.startsWith("--message"))) {
40494
+ return `Interactive command: 'git tag -a' opens an editor for the tag message. Use 'git tag -a <name> -m "message"' instead.`;
40495
+ }
40496
+ if (sub === "add" && (args.includes("-i") || args.includes("--interactive") || args.includes("-p") || args.includes("--patch"))) {
40497
+ return "Interactive command: 'git add -i/-p' requires interactive input. Use 'git add <files>' to stage specific files instead.";
40498
+ }
40499
+ }
40500
+ if (["python", "python3", "node", "irb", "ghci", "lua", "R", "ruby"].includes(base2) && args.length === 0) {
40501
+ return `Interactive command: '${base2}' without arguments starts an interactive REPL. Provide a script file or use '-c'/'--eval' for inline code.`;
40502
+ }
40503
+ if (base2 === "mysql" && !args.some((a5) => a5 === "-e" || a5.startsWith("--execute"))) {
40504
+ return `Interactive command: 'mysql' without -e flag starts an interactive session. Use 'mysql -e "SQL QUERY"' instead.`;
40505
+ }
40506
+ if (base2 === "psql" && !args.some((a5) => a5 === "-c" || a5.startsWith("--command") || a5 === "-f" || a5.startsWith("--file"))) {
40507
+ return `Interactive command: 'psql' without -c flag starts an interactive session. Use 'psql -c "SQL QUERY"' instead.`;
40508
+ }
40509
+ if (["top", "htop", "btop", "nmon"].includes(base2)) {
40510
+ return `Interactive command: '${base2}' is an interactive TUI tool. Use 'ps aux' or 'top -b -n 1' for non-interactive process listing.`;
40511
+ }
40512
+ return null;
40513
+ }
40514
+ function checkInteractiveCommand(command) {
40515
+ if (!command || typeof command !== "string") return null;
40516
+ const components = splitCommandComponents(command.trim());
40517
+ for (const component of components) {
40518
+ const result = checkSingleCommandInteractive(component);
40519
+ if (result) return result;
40520
+ }
40521
+ return null;
40522
+ }
40254
40523
  async function executeBashCommand(command, options = {}) {
40255
40524
  const {
40256
40525
  workingDirectory = process.cwd(),
@@ -40280,6 +40549,24 @@ async function executeBashCommand(command, options = {}) {
40280
40549
  };
40281
40550
  }
40282
40551
  const startTime = Date.now();
40552
+ const interactiveError = checkInteractiveCommand(command);
40553
+ if (interactiveError) {
40554
+ if (debug) {
40555
+ console.log(`[BashExecutor] Blocked interactive command: "${command}"`);
40556
+ console.log(`[BashExecutor] Reason: ${interactiveError}`);
40557
+ }
40558
+ return {
40559
+ success: false,
40560
+ error: interactiveError,
40561
+ stdout: "",
40562
+ stderr: interactiveError,
40563
+ exitCode: 1,
40564
+ command,
40565
+ workingDirectory: cwd,
40566
+ duration: 0,
40567
+ interactive: true
40568
+ };
40569
+ }
40283
40570
  if (debug) {
40284
40571
  console.log(`[BashExecutor] Executing command: "${command}"`);
40285
40572
  console.log(`[BashExecutor] Working directory: "${cwd}"`);
@@ -40290,6 +40577,8 @@ async function executeBashCommand(command, options = {}) {
40290
40577
  ...process.env,
40291
40578
  ...env
40292
40579
  };
40580
+ if (!processEnv.GIT_EDITOR) processEnv.GIT_EDITOR = "true";
40581
+ if (!processEnv.GIT_TERMINAL_PROMPT) processEnv.GIT_TERMINAL_PROMPT = "0";
40293
40582
  const isComplex = isComplexCommand(command);
40294
40583
  let cmd, cmdArgs, useShell;
40295
40584
  if (isComplex) {
@@ -40324,20 +40613,32 @@ async function executeBashCommand(command, options = {}) {
40324
40613
  // stdin ignored, capture stdout/stderr
40325
40614
  shell: useShell,
40326
40615
  // false for security
40616
+ detached: true,
40617
+ // new session — no controlling terminal
40327
40618
  windowsHide: true
40328
40619
  });
40329
40620
  let stdout = "";
40330
40621
  let stderr = "";
40331
40622
  let killed = false;
40332
40623
  let timeoutHandle;
40624
+ const killProcessGroup = (signal) => {
40625
+ try {
40626
+ if (child.pid) process.kill(-child.pid, signal);
40627
+ } catch {
40628
+ try {
40629
+ child.kill(signal);
40630
+ } catch {
40631
+ }
40632
+ }
40633
+ };
40333
40634
  if (timeout > 0) {
40334
40635
  timeoutHandle = setTimeout(() => {
40335
40636
  if (!killed) {
40336
40637
  killed = true;
40337
- child.kill("SIGTERM");
40638
+ killProcessGroup("SIGTERM");
40338
40639
  setTimeout(() => {
40339
40640
  if (child.exitCode === null) {
40340
- child.kill("SIGKILL");
40641
+ killProcessGroup("SIGKILL");
40341
40642
  }
40342
40643
  }, 5e3);
40343
40644
  }
@@ -40350,7 +40651,7 @@ async function executeBashCommand(command, options = {}) {
40350
40651
  } else {
40351
40652
  if (!killed) {
40352
40653
  killed = true;
40353
- child.kill("SIGTERM");
40654
+ killProcessGroup("SIGTERM");
40354
40655
  }
40355
40656
  }
40356
40657
  });
@@ -40361,7 +40662,7 @@ async function executeBashCommand(command, options = {}) {
40361
40662
  } else {
40362
40663
  if (!killed) {
40363
40664
  killed = true;
40364
- child.kill("SIGTERM");
40665
+ killProcessGroup("SIGTERM");
40365
40666
  }
40366
40667
  }
40367
40668
  });
@@ -66267,7 +66568,6 @@ var init_reg_exp = __esm({
66267
66568
  // node_modules/chevrotain/lib/src/scan/lexer.js
66268
66569
  function analyzeTokenTypes(tokenTypes, options) {
66269
66570
  options = defaults_default(options, {
66270
- useSticky: SUPPORT_STICKY,
66271
66571
  debug: false,
66272
66572
  safeMode: false,
66273
66573
  positionTracking: "full",
@@ -66316,7 +66616,7 @@ function analyzeTokenTypes(tokenTypes, options) {
66316
66616
  ], regExpSource[1])) {
66317
66617
  return regExpSource[1];
66318
66618
  } else {
66319
- return options.useSticky ? addStickyFlag(currPattern) : addStartOfInput(currPattern);
66619
+ return addStickyFlag(currPattern);
66320
66620
  }
66321
66621
  } else if (isFunction_default(currPattern)) {
66322
66622
  hasCustom = true;
@@ -66330,7 +66630,7 @@ function analyzeTokenTypes(tokenTypes, options) {
66330
66630
  } else {
66331
66631
  const escapedRegExpString = currPattern.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&");
66332
66632
  const wrappedRegExp = new RegExp(escapedRegExpString);
66333
- return options.useSticky ? addStickyFlag(wrappedRegExp) : addStartOfInput(wrappedRegExp);
66633
+ return addStickyFlag(wrappedRegExp);
66334
66634
  }
66335
66635
  } else {
66336
66636
  throw Error("non exhaustive match");
@@ -66734,10 +67034,6 @@ function noMetaChar(regExp) {
66734
67034
  function usesLookAheadOrBehind(regExp) {
66735
67035
  return /(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(regExp.source);
66736
67036
  }
66737
- function addStartOfInput(pattern) {
66738
- const flags = pattern.ignoreCase ? "i" : "";
66739
- return new RegExp(`^(?:${pattern.source})`, flags);
66740
- }
66741
67037
  function addStickyFlag(pattern) {
66742
67038
  const flags = pattern.ignoreCase ? "iy" : "y";
66743
67039
  return new RegExp(`${pattern.source}`, flags);
@@ -66926,7 +67222,7 @@ function initCharCodeToOptimizedIndexMap() {
66926
67222
  }
66927
67223
  }
66928
67224
  }
66929
- var PATTERN, DEFAULT_MODE, MODES, SUPPORT_STICKY, end_of_input, start_of_input, LineTerminatorOptimizedTester, minOptimizationVal, charCodeToOptimizedIdxMap;
67225
+ var PATTERN, DEFAULT_MODE, MODES, end_of_input, start_of_input, LineTerminatorOptimizedTester, minOptimizationVal, charCodeToOptimizedIdxMap;
66930
67226
  var init_lexer = __esm({
66931
67227
  "node_modules/chevrotain/lib/src/scan/lexer.js"() {
66932
67228
  init_api3();
@@ -66938,7 +67234,6 @@ var init_lexer = __esm({
66938
67234
  PATTERN = "PATTERN";
66939
67235
  DEFAULT_MODE = "defaultMode";
66940
67236
  MODES = "modes";
66941
- SUPPORT_STICKY = typeof new RegExp("(?:)").sticky === "boolean";
66942
67237
  end_of_input = /[^\\][$]/;
66943
67238
  start_of_input = /[^\\[][\^]|^\^/;
66944
67239
  LineTerminatorOptimizedTester = {
@@ -67254,13 +67549,6 @@ var init_lexer_public = __esm({
67254
67549
  PRINT_WARNING(warningDescriptor.message);
67255
67550
  });
67256
67551
  this.TRACE_INIT("Choosing sub-methods implementations", () => {
67257
- if (SUPPORT_STICKY) {
67258
- this.chopInput = identity_default;
67259
- this.match = this.matchWithTest;
67260
- } else {
67261
- this.updateLastIndex = noop_default;
67262
- this.match = this.matchWithExec;
67263
- }
67264
67552
  if (hasOnlySingleMode) {
67265
67553
  this.handleModes = noop_default;
67266
67554
  }
@@ -67323,7 +67611,7 @@ var init_lexer_public = __esm({
67323
67611
  // this method also used quite a bit of `!` none null assertions because it is too optimized
67324
67612
  // for `tsc` to always understand it is "safe"
67325
67613
  tokenizeInternal(text, initialMode) {
67326
- let i5, j5, k5, matchAltImage, longerAlt, matchedImage, payload2, altPayload, imageLength, group, tokType, newToken, errLength, droppedChar, msg, match2;
67614
+ let i5, j5, k5, matchAltImage, longerAlt, matchedImage, payload2, altPayload, imageLength, group, tokType, newToken, errLength, msg, match2;
67327
67615
  const orgText = text;
67328
67616
  const orgLength = orgText.length;
67329
67617
  let offset2 = 0;
@@ -67342,19 +67630,7 @@ var init_lexer_public = __esm({
67342
67630
  const modeStack = [];
67343
67631
  const emptyArray = [];
67344
67632
  Object.freeze(emptyArray);
67345
- let getPossiblePatterns;
67346
- function getPossiblePatternsSlow() {
67347
- return patternIdxToConfig;
67348
- }
67349
- function getPossiblePatternsOptimized(charCode) {
67350
- const optimizedCharIdx = charCodeToOptimizedIndex(charCode);
67351
- const possiblePatterns = currCharCodeToPatternIdxToConfig[optimizedCharIdx];
67352
- if (possiblePatterns === void 0) {
67353
- return emptyArray;
67354
- } else {
67355
- return possiblePatterns;
67356
- }
67357
- }
67633
+ let isOptimizedMode = false;
67358
67634
  const pop_mode = (popToken) => {
67359
67635
  if (modeStack.length === 1 && // if we have both a POP_MODE and a PUSH_MODE this is in-fact a "transition"
67360
67636
  // So no error should occur.
@@ -67375,9 +67651,9 @@ var init_lexer_public = __esm({
67375
67651
  currModePatternsLength = patternIdxToConfig.length;
67376
67652
  const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false;
67377
67653
  if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {
67378
- getPossiblePatterns = getPossiblePatternsOptimized;
67654
+ isOptimizedMode = true;
67379
67655
  } else {
67380
- getPossiblePatterns = getPossiblePatternsSlow;
67656
+ isOptimizedMode = false;
67381
67657
  }
67382
67658
  }
67383
67659
  };
@@ -67389,9 +67665,9 @@ var init_lexer_public = __esm({
67389
67665
  currModePatternsLength = patternIdxToConfig.length;
67390
67666
  const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false;
67391
67667
  if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {
67392
- getPossiblePatterns = getPossiblePatternsOptimized;
67668
+ isOptimizedMode = true;
67393
67669
  } else {
67394
- getPossiblePatterns = getPossiblePatternsSlow;
67670
+ isOptimizedMode = false;
67395
67671
  }
67396
67672
  }
67397
67673
  push_mode.call(this, initialMode);
@@ -67399,8 +67675,16 @@ var init_lexer_public = __esm({
67399
67675
  const recoveryEnabled = this.config.recoveryEnabled;
67400
67676
  while (offset2 < orgLength) {
67401
67677
  matchedImage = null;
67678
+ imageLength = -1;
67402
67679
  const nextCharCode = orgText.charCodeAt(offset2);
67403
- const chosenPatternIdxToConfig = getPossiblePatterns(nextCharCode);
67680
+ let chosenPatternIdxToConfig;
67681
+ if (isOptimizedMode) {
67682
+ const optimizedCharIdx = charCodeToOptimizedIndex(nextCharCode);
67683
+ const possiblePatterns = currCharCodeToPatternIdxToConfig[optimizedCharIdx];
67684
+ chosenPatternIdxToConfig = possiblePatterns !== void 0 ? possiblePatterns : emptyArray;
67685
+ } else {
67686
+ chosenPatternIdxToConfig = patternIdxToConfig;
67687
+ }
67404
67688
  const chosenPatternsLength = chosenPatternIdxToConfig.length;
67405
67689
  for (i5 = 0; i5 < chosenPatternsLength; i5++) {
67406
67690
  currConfig = chosenPatternIdxToConfig[i5];
@@ -67409,12 +67693,14 @@ var init_lexer_public = __esm({
67409
67693
  const singleCharCode = currConfig.short;
67410
67694
  if (singleCharCode !== false) {
67411
67695
  if (nextCharCode === singleCharCode) {
67696
+ imageLength = 1;
67412
67697
  matchedImage = currPattern;
67413
67698
  }
67414
67699
  } else if (currConfig.isCustom === true) {
67415
67700
  match2 = currPattern.exec(orgText, offset2, matchedTokens, groups);
67416
67701
  if (match2 !== null) {
67417
67702
  matchedImage = match2[0];
67703
+ imageLength = matchedImage.length;
67418
67704
  if (match2.payload !== void 0) {
67419
67705
  payload2 = match2.payload;
67420
67706
  }
@@ -67422,12 +67708,13 @@ var init_lexer_public = __esm({
67422
67708
  matchedImage = null;
67423
67709
  }
67424
67710
  } else {
67425
- this.updateLastIndex(currPattern, offset2);
67426
- matchedImage = this.match(currPattern, text, offset2);
67711
+ currPattern.lastIndex = offset2;
67712
+ imageLength = this.matchLength(currPattern, text, offset2);
67427
67713
  }
67428
- if (matchedImage !== null) {
67714
+ if (imageLength !== -1) {
67429
67715
  longerAlt = currConfig.longerAlt;
67430
67716
  if (longerAlt !== void 0) {
67717
+ matchedImage = text.substring(offset2, offset2 + imageLength);
67431
67718
  const longerAltLength = longerAlt.length;
67432
67719
  for (k5 = 0; k5 < longerAltLength; k5++) {
67433
67720
  const longerAltConfig = patternIdxToConfig[longerAlt[k5]];
@@ -67444,11 +67731,12 @@ var init_lexer_public = __esm({
67444
67731
  matchAltImage = null;
67445
67732
  }
67446
67733
  } else {
67447
- this.updateLastIndex(longerAltPattern, offset2);
67734
+ longerAltPattern.lastIndex = offset2;
67448
67735
  matchAltImage = this.match(longerAltPattern, text, offset2);
67449
67736
  }
67450
67737
  if (matchAltImage && matchAltImage.length > matchedImage.length) {
67451
67738
  matchedImage = matchAltImage;
67739
+ imageLength = matchAltImage.length;
67452
67740
  payload2 = altPayload;
67453
67741
  currConfig = longerAltConfig;
67454
67742
  break;
@@ -67458,10 +67746,10 @@ var init_lexer_public = __esm({
67458
67746
  break;
67459
67747
  }
67460
67748
  }
67461
- if (matchedImage !== null) {
67462
- imageLength = matchedImage.length;
67749
+ if (imageLength !== -1) {
67463
67750
  group = currConfig.group;
67464
67751
  if (group !== void 0) {
67752
+ matchedImage = matchedImage !== null ? matchedImage : text.substring(offset2, offset2 + imageLength);
67465
67753
  tokType = currConfig.tokenTypeIdx;
67466
67754
  newToken = this.createTokenInstance(matchedImage, offset2, tokType, currConfig.tokenType, line, column, imageLength);
67467
67755
  this.handlePayload(newToken, payload2);
@@ -67471,15 +67759,13 @@ var init_lexer_public = __esm({
67471
67759
  groups[group].push(newToken);
67472
67760
  }
67473
67761
  }
67474
- text = this.chopInput(text, imageLength);
67475
- offset2 = offset2 + imageLength;
67476
- column = this.computeNewColumn(column, imageLength);
67477
67762
  if (trackLines === true && currConfig.canLineTerminator === true) {
67478
67763
  let numOfLTsInMatch = 0;
67479
67764
  let foundTerminator;
67480
67765
  let lastLTEndOffset;
67481
67766
  lineTerminatorPattern.lastIndex = 0;
67482
67767
  do {
67768
+ matchedImage = matchedImage !== null ? matchedImage : text.substring(offset2, offset2 + imageLength);
67483
67769
  foundTerminator = lineTerminatorPattern.test(matchedImage);
67484
67770
  if (foundTerminator === true) {
67485
67771
  lastLTEndOffset = lineTerminatorPattern.lastIndex - 1;
@@ -67490,8 +67776,13 @@ var init_lexer_public = __esm({
67490
67776
  line = line + numOfLTsInMatch;
67491
67777
  column = imageLength - lastLTEndOffset;
67492
67778
  this.updateTokenEndLineColumnLocation(newToken, group, lastLTEndOffset, numOfLTsInMatch, line, column, imageLength);
67779
+ } else {
67780
+ column = this.computeNewColumn(column, imageLength);
67493
67781
  }
67782
+ } else {
67783
+ column = this.computeNewColumn(column, imageLength);
67494
67784
  }
67785
+ offset2 = offset2 + imageLength;
67495
67786
  this.handleModes(currConfig, pop_mode, push_mode, newToken);
67496
67787
  } else {
67497
67788
  const errorStartOffset = offset2;
@@ -67499,7 +67790,6 @@ var init_lexer_public = __esm({
67499
67790
  const errorColumn = column;
67500
67791
  let foundResyncPoint = recoveryEnabled === false;
67501
67792
  while (foundResyncPoint === false && offset2 < orgLength) {
67502
- text = this.chopInput(text, 1);
67503
67793
  offset2++;
67504
67794
  for (j5 = 0; j5 < currModePatternsLength; j5++) {
67505
67795
  const currConfig2 = patternIdxToConfig[j5];
@@ -67512,7 +67802,7 @@ var init_lexer_public = __esm({
67512
67802
  } else if (currConfig2.isCustom === true) {
67513
67803
  foundResyncPoint = currPattern.exec(orgText, offset2, matchedTokens, groups) !== null;
67514
67804
  } else {
67515
- this.updateLastIndex(currPattern, offset2);
67805
+ currPattern.lastIndex = offset2;
67516
67806
  foundResyncPoint = currPattern.exec(text) !== null;
67517
67807
  }
67518
67808
  if (foundResyncPoint === true) {
@@ -67555,12 +67845,6 @@ var init_lexer_public = __esm({
67555
67845
  push_mode.call(this, config.push);
67556
67846
  }
67557
67847
  }
67558
- chopInput(text, length) {
67559
- return text.substring(length);
67560
- }
67561
- updateLastIndex(regExp, newLastIndex) {
67562
- regExp.lastIndex = newLastIndex;
67563
- }
67564
67848
  // TODO: decrease this under 600 characters? inspect stripping comments option in TSC compiler
67565
67849
  updateTokenEndLineColumnLocation(newToken, group, lastLTIdx, numOfLTsInMatch, line, column, imageLength) {
67566
67850
  let lastCharIsLT, fixForEndingInLT;
@@ -67623,16 +67907,19 @@ var init_lexer_public = __esm({
67623
67907
  token.payload = payload2;
67624
67908
  }
67625
67909
  }
67626
- matchWithTest(pattern, text, offset2) {
67910
+ match(pattern, text, offset2) {
67627
67911
  const found = pattern.test(text);
67628
67912
  if (found === true) {
67629
67913
  return text.substring(offset2, pattern.lastIndex);
67630
67914
  }
67631
67915
  return null;
67632
67916
  }
67633
- matchWithExec(pattern, text) {
67634
- const regExpArray = pattern.exec(text);
67635
- return regExpArray !== null ? regExpArray[0] : null;
67917
+ matchLength(pattern, text, offset2) {
67918
+ const found = pattern.test(text);
67919
+ if (found === true) {
67920
+ return pattern.lastIndex - offset2;
67921
+ }
67922
+ return -1;
67636
67923
  }
67637
67924
  };
67638
67925
  Lexer.SKIPPED = "This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";
@@ -67824,12 +68111,20 @@ For Further details.`;
67824
68111
  return errMsg;
67825
68112
  },
67826
68113
  buildAlternationAmbiguityError(options) {
67827
- const pathMsg = map_default(options.prefixPath, (currtok) => tokenLabel2(currtok)).join(", ");
67828
68114
  const occurrence = options.alternation.idx === 0 ? "" : options.alternation.idx;
68115
+ const isEmptyPath = options.prefixPath.length === 0;
67829
68116
  let currMessage = `Ambiguous Alternatives Detected: <${options.ambiguityIndices.join(" ,")}> in <OR${occurrence}> inside <${options.topLevelRule.name}> Rule,
67830
- <${pathMsg}> may appears as a prefix path in all these alternatives.
67831
68117
  `;
67832
- currMessage = currMessage + `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
68118
+ if (isEmptyPath) {
68119
+ currMessage += `These alternatives are all empty (match no tokens), making them indistinguishable.
68120
+ Only the last alternative may be empty.
68121
+ `;
68122
+ } else {
68123
+ const pathMsg = map_default(options.prefixPath, (currtok) => tokenLabel2(currtok)).join(", ");
68124
+ currMessage += `<${pathMsg}> may appears as a prefix path in all these alternatives.
68125
+ `;
68126
+ }
68127
+ currMessage += `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
67833
68128
  For Further details.`;
67834
68129
  return currMessage;
67835
68130
  },