@probelabs/probe 0.6.0-rc263 → 0.6.0-rc265
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.
- package/bin/binaries/probe-v0.6.0-rc265-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc265-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc265-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc265-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc265-x86_64-unknown-linux-musl.tar.gz +0 -0
- package/build/agent/ProbeAgent.js +1 -0
- package/build/agent/bashExecutor.js +233 -7
- package/build/agent/index.js +244 -67
- package/build/agent/shared/prompts.js +25 -2
- package/build/tools/edit.js +7 -0
- package/cjs/agent/ProbeAgent.cjs +410 -80
- package/cjs/index.cjs +410 -80
- package/package.json +2 -2
- package/src/agent/ProbeAgent.js +1 -0
- package/src/agent/bashExecutor.js +233 -7
- package/src/agent/shared/prompts.js +25 -2
- package/src/tools/edit.js +7 -0
- package/bin/binaries/probe-v0.6.0-rc263-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc263-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc263-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc263-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc263-x86_64-unknown-linux-musl.tar.gz +0 -0
package/cjs/index.cjs
CHANGED
|
@@ -19363,7 +19363,7 @@ var require_package2 = __commonJS({
|
|
|
19363
19363
|
module2.exports = {
|
|
19364
19364
|
name: "@aws-sdk/client-bedrock-runtime",
|
|
19365
19365
|
description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
|
|
19366
|
-
version: "3.
|
|
19366
|
+
version: "3.1000.0",
|
|
19367
19367
|
scripts: {
|
|
19368
19368
|
build: "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
19369
19369
|
"build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
|
|
@@ -19374,7 +19374,11 @@ var require_package2 = __commonJS({
|
|
|
19374
19374
|
clean: "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
|
|
19375
19375
|
"extract:docs": "api-extractor run --local",
|
|
19376
19376
|
"generate:client": "node ../../scripts/generate-clients/single-service --solo bedrock-runtime",
|
|
19377
|
-
|
|
19377
|
+
test: "yarn g:vitest run --passWithNoTests",
|
|
19378
|
+
"test:index": "tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs",
|
|
19379
|
+
"test:integration": "yarn g:vitest run --passWithNoTests -c vitest.config.integ.mts",
|
|
19380
|
+
"test:integration:watch": "yarn g:vitest run --passWithNoTests -c vitest.config.integ.mts",
|
|
19381
|
+
"test:watch": "yarn g:vitest watch --passWithNoTests"
|
|
19378
19382
|
},
|
|
19379
19383
|
main: "./dist-cjs/index.js",
|
|
19380
19384
|
types: "./dist-types/index.d.ts",
|
|
@@ -19393,7 +19397,7 @@ var require_package2 = __commonJS({
|
|
|
19393
19397
|
"@aws-sdk/middleware-user-agent": "^3.972.15",
|
|
19394
19398
|
"@aws-sdk/middleware-websocket": "^3.972.10",
|
|
19395
19399
|
"@aws-sdk/region-config-resolver": "^3.972.6",
|
|
19396
|
-
"@aws-sdk/token-providers": "3.
|
|
19400
|
+
"@aws-sdk/token-providers": "3.1000.0",
|
|
19397
19401
|
"@aws-sdk/types": "^3.973.4",
|
|
19398
19402
|
"@aws-sdk/util-endpoints": "^3.996.3",
|
|
19399
19403
|
"@aws-sdk/util-user-agent-browser": "^3.972.6",
|
|
@@ -19430,12 +19434,14 @@ var require_package2 = __commonJS({
|
|
|
19430
19434
|
tslib: "^2.6.2"
|
|
19431
19435
|
},
|
|
19432
19436
|
devDependencies: {
|
|
19437
|
+
"@smithy/snapshot-testing": "^1.0.7",
|
|
19433
19438
|
"@tsconfig/node20": "20.1.8",
|
|
19434
19439
|
"@types/node": "^20.14.8",
|
|
19435
19440
|
concurrently: "7.0.0",
|
|
19436
19441
|
"downlevel-dts": "0.10.1",
|
|
19437
19442
|
premove: "4.0.0",
|
|
19438
|
-
typescript: "~5.8.3"
|
|
19443
|
+
typescript: "~5.8.3",
|
|
19444
|
+
vitest: "^4.0.17"
|
|
19439
19445
|
},
|
|
19440
19446
|
engines: {
|
|
19441
19447
|
node: ">=20.0.0"
|
|
@@ -21437,9 +21443,9 @@ var init_sso_oidc = __esm({
|
|
|
21437
21443
|
}
|
|
21438
21444
|
});
|
|
21439
21445
|
|
|
21440
|
-
// node_modules/@aws-sdk/token-providers/dist-cjs/index.js
|
|
21446
|
+
// node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-cjs/index.js
|
|
21441
21447
|
var require_dist_cjs56 = __commonJS({
|
|
21442
|
-
"node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports2) {
|
|
21448
|
+
"node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports2) {
|
|
21443
21449
|
"use strict";
|
|
21444
21450
|
var client = (init_client(), __toCommonJS(client_exports));
|
|
21445
21451
|
var httpAuthSchemes = (init_httpAuthSchemes2(), __toCommonJS(httpAuthSchemes_exports));
|
|
@@ -25272,8 +25278,155 @@ var require_dist_cjs63 = __commonJS({
|
|
|
25272
25278
|
}
|
|
25273
25279
|
});
|
|
25274
25280
|
|
|
25275
|
-
// node_modules/@
|
|
25281
|
+
// node_modules/@aws-sdk/token-providers/dist-cjs/index.js
|
|
25276
25282
|
var require_dist_cjs64 = __commonJS({
|
|
25283
|
+
"node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports2) {
|
|
25284
|
+
"use strict";
|
|
25285
|
+
var client = (init_client(), __toCommonJS(client_exports));
|
|
25286
|
+
var httpAuthSchemes = (init_httpAuthSchemes2(), __toCommonJS(httpAuthSchemes_exports));
|
|
25287
|
+
var propertyProvider = require_dist_cjs24();
|
|
25288
|
+
var sharedIniFileLoader = require_dist_cjs42();
|
|
25289
|
+
var node_fs = require("node:fs");
|
|
25290
|
+
var fromEnvSigningName = ({ logger: logger2, signingName } = {}) => async () => {
|
|
25291
|
+
logger2?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
|
|
25292
|
+
if (!signingName) {
|
|
25293
|
+
throw new propertyProvider.TokenProviderError("Please pass 'signingName' to compute environment variable key", { logger: logger2 });
|
|
25294
|
+
}
|
|
25295
|
+
const bearerTokenKey = httpAuthSchemes.getBearerTokenEnvKey(signingName);
|
|
25296
|
+
if (!(bearerTokenKey in process.env)) {
|
|
25297
|
+
throw new propertyProvider.TokenProviderError(`Token not present in '${bearerTokenKey}' environment variable`, { logger: logger2 });
|
|
25298
|
+
}
|
|
25299
|
+
const token = { token: process.env[bearerTokenKey] };
|
|
25300
|
+
client.setTokenFeature(token, "BEARER_SERVICE_ENV_VARS", "3");
|
|
25301
|
+
return token;
|
|
25302
|
+
};
|
|
25303
|
+
var EXPIRE_WINDOW_MS = 5 * 60 * 1e3;
|
|
25304
|
+
var REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`;
|
|
25305
|
+
var getSsoOidcClient = async (ssoRegion, init = {}, callerClientConfig) => {
|
|
25306
|
+
const { SSOOIDCClient: SSOOIDCClient2 } = await Promise.resolve().then(() => (init_sso_oidc(), sso_oidc_exports));
|
|
25307
|
+
const coalesce = (prop) => init.clientConfig?.[prop] ?? init.parentClientConfig?.[prop] ?? callerClientConfig?.[prop];
|
|
25308
|
+
const ssoOidcClient = new SSOOIDCClient2(Object.assign({}, init.clientConfig ?? {}, {
|
|
25309
|
+
region: ssoRegion ?? init.clientConfig?.region,
|
|
25310
|
+
logger: coalesce("logger"),
|
|
25311
|
+
userAgentAppId: coalesce("userAgentAppId")
|
|
25312
|
+
}));
|
|
25313
|
+
return ssoOidcClient;
|
|
25314
|
+
};
|
|
25315
|
+
var getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}, callerClientConfig) => {
|
|
25316
|
+
const { CreateTokenCommand: CreateTokenCommand2 } = await Promise.resolve().then(() => (init_sso_oidc(), sso_oidc_exports));
|
|
25317
|
+
const ssoOidcClient = await getSsoOidcClient(ssoRegion, init, callerClientConfig);
|
|
25318
|
+
return ssoOidcClient.send(new CreateTokenCommand2({
|
|
25319
|
+
clientId: ssoToken.clientId,
|
|
25320
|
+
clientSecret: ssoToken.clientSecret,
|
|
25321
|
+
refreshToken: ssoToken.refreshToken,
|
|
25322
|
+
grantType: "refresh_token"
|
|
25323
|
+
}));
|
|
25324
|
+
};
|
|
25325
|
+
var validateTokenExpiry = (token) => {
|
|
25326
|
+
if (token.expiration && token.expiration.getTime() < Date.now()) {
|
|
25327
|
+
throw new propertyProvider.TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false);
|
|
25328
|
+
}
|
|
25329
|
+
};
|
|
25330
|
+
var validateTokenKey = (key, value, forRefresh = false) => {
|
|
25331
|
+
if (typeof value === "undefined") {
|
|
25332
|
+
throw new propertyProvider.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
|
|
25333
|
+
}
|
|
25334
|
+
};
|
|
25335
|
+
var { writeFile: writeFile2 } = node_fs.promises;
|
|
25336
|
+
var writeSSOTokenToFile = (id, ssoToken) => {
|
|
25337
|
+
const tokenFilepath = sharedIniFileLoader.getSSOTokenFilepath(id);
|
|
25338
|
+
const tokenString = JSON.stringify(ssoToken, null, 2);
|
|
25339
|
+
return writeFile2(tokenFilepath, tokenString);
|
|
25340
|
+
};
|
|
25341
|
+
var lastRefreshAttemptTime = /* @__PURE__ */ new Date(0);
|
|
25342
|
+
var fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
25343
|
+
init.logger?.debug("@aws-sdk/token-providers - fromSso");
|
|
25344
|
+
const profiles = await sharedIniFileLoader.parseKnownFiles(init);
|
|
25345
|
+
const profileName = sharedIniFileLoader.getProfileName({
|
|
25346
|
+
profile: init.profile ?? callerClientConfig?.profile
|
|
25347
|
+
});
|
|
25348
|
+
const profile = profiles[profileName];
|
|
25349
|
+
if (!profile) {
|
|
25350
|
+
throw new propertyProvider.TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false);
|
|
25351
|
+
} else if (!profile["sso_session"]) {
|
|
25352
|
+
throw new propertyProvider.TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
|
|
25353
|
+
}
|
|
25354
|
+
const ssoSessionName = profile["sso_session"];
|
|
25355
|
+
const ssoSessions = await sharedIniFileLoader.loadSsoSessionData(init);
|
|
25356
|
+
const ssoSession = ssoSessions[ssoSessionName];
|
|
25357
|
+
if (!ssoSession) {
|
|
25358
|
+
throw new propertyProvider.TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false);
|
|
25359
|
+
}
|
|
25360
|
+
for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) {
|
|
25361
|
+
if (!ssoSession[ssoSessionRequiredKey]) {
|
|
25362
|
+
throw new propertyProvider.TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false);
|
|
25363
|
+
}
|
|
25364
|
+
}
|
|
25365
|
+
ssoSession["sso_start_url"];
|
|
25366
|
+
const ssoRegion = ssoSession["sso_region"];
|
|
25367
|
+
let ssoToken;
|
|
25368
|
+
try {
|
|
25369
|
+
ssoToken = await sharedIniFileLoader.getSSOTokenFromFile(ssoSessionName);
|
|
25370
|
+
} catch (e5) {
|
|
25371
|
+
throw new propertyProvider.TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);
|
|
25372
|
+
}
|
|
25373
|
+
validateTokenKey("accessToken", ssoToken.accessToken);
|
|
25374
|
+
validateTokenKey("expiresAt", ssoToken.expiresAt);
|
|
25375
|
+
const { accessToken, expiresAt } = ssoToken;
|
|
25376
|
+
const existingToken = { token: accessToken, expiration: new Date(expiresAt) };
|
|
25377
|
+
if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {
|
|
25378
|
+
return existingToken;
|
|
25379
|
+
}
|
|
25380
|
+
if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1e3) {
|
|
25381
|
+
validateTokenExpiry(existingToken);
|
|
25382
|
+
return existingToken;
|
|
25383
|
+
}
|
|
25384
|
+
validateTokenKey("clientId", ssoToken.clientId, true);
|
|
25385
|
+
validateTokenKey("clientSecret", ssoToken.clientSecret, true);
|
|
25386
|
+
validateTokenKey("refreshToken", ssoToken.refreshToken, true);
|
|
25387
|
+
try {
|
|
25388
|
+
lastRefreshAttemptTime.setTime(Date.now());
|
|
25389
|
+
const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
|
|
25390
|
+
validateTokenKey("accessToken", newSsoOidcToken.accessToken);
|
|
25391
|
+
validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
|
|
25392
|
+
const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1e3);
|
|
25393
|
+
try {
|
|
25394
|
+
await writeSSOTokenToFile(ssoSessionName, {
|
|
25395
|
+
...ssoToken,
|
|
25396
|
+
accessToken: newSsoOidcToken.accessToken,
|
|
25397
|
+
expiresAt: newTokenExpiration.toISOString(),
|
|
25398
|
+
refreshToken: newSsoOidcToken.refreshToken
|
|
25399
|
+
});
|
|
25400
|
+
} catch (error2) {
|
|
25401
|
+
}
|
|
25402
|
+
return {
|
|
25403
|
+
token: newSsoOidcToken.accessToken,
|
|
25404
|
+
expiration: newTokenExpiration
|
|
25405
|
+
};
|
|
25406
|
+
} catch (error2) {
|
|
25407
|
+
validateTokenExpiry(existingToken);
|
|
25408
|
+
return existingToken;
|
|
25409
|
+
}
|
|
25410
|
+
};
|
|
25411
|
+
var fromStatic = ({ token, logger: logger2 }) => async () => {
|
|
25412
|
+
logger2?.debug("@aws-sdk/token-providers - fromStatic");
|
|
25413
|
+
if (!token || !token.token) {
|
|
25414
|
+
throw new propertyProvider.TokenProviderError(`Please pass a valid token to fromStatic`, false);
|
|
25415
|
+
}
|
|
25416
|
+
return token;
|
|
25417
|
+
};
|
|
25418
|
+
var nodeProvider = (init = {}) => propertyProvider.memoize(propertyProvider.chain(fromSso(init), async () => {
|
|
25419
|
+
throw new propertyProvider.TokenProviderError("Could not load token from any providers", false);
|
|
25420
|
+
}), (token) => token.expiration !== void 0 && token.expiration.getTime() - Date.now() < 3e5, (token) => token.expiration !== void 0);
|
|
25421
|
+
exports2.fromEnvSigningName = fromEnvSigningName;
|
|
25422
|
+
exports2.fromSso = fromSso;
|
|
25423
|
+
exports2.fromStatic = fromStatic;
|
|
25424
|
+
exports2.nodeProvider = nodeProvider;
|
|
25425
|
+
}
|
|
25426
|
+
});
|
|
25427
|
+
|
|
25428
|
+
// node_modules/@smithy/eventstream-serde-node/dist-cjs/index.js
|
|
25429
|
+
var require_dist_cjs65 = __commonJS({
|
|
25277
25430
|
"node_modules/@smithy/eventstream-serde-node/dist-cjs/index.js"(exports2) {
|
|
25278
25431
|
"use strict";
|
|
25279
25432
|
var eventstreamSerdeUniversal = require_dist_cjs35();
|
|
@@ -27955,11 +28108,11 @@ var require_runtimeConfig = __commonJS({
|
|
|
27955
28108
|
var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2));
|
|
27956
28109
|
var credential_provider_node_1 = require_dist_cjs62();
|
|
27957
28110
|
var eventstream_handler_node_1 = require_dist_cjs63();
|
|
27958
|
-
var token_providers_1 =
|
|
28111
|
+
var token_providers_1 = require_dist_cjs64();
|
|
27959
28112
|
var util_user_agent_node_1 = require_dist_cjs51();
|
|
27960
28113
|
var config_resolver_1 = require_dist_cjs39();
|
|
27961
28114
|
var core_2 = (init_dist_es(), __toCommonJS(dist_es_exports));
|
|
27962
|
-
var eventstream_serde_node_1 =
|
|
28115
|
+
var eventstream_serde_node_1 = require_dist_cjs65();
|
|
27963
28116
|
var hash_node_1 = require_dist_cjs52();
|
|
27964
28117
|
var middleware_retry_1 = require_dist_cjs47();
|
|
27965
28118
|
var node_config_provider_1 = require_dist_cjs43();
|
|
@@ -28031,7 +28184,7 @@ var require_runtimeConfig = __commonJS({
|
|
|
28031
28184
|
});
|
|
28032
28185
|
|
|
28033
28186
|
// node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js
|
|
28034
|
-
var
|
|
28187
|
+
var require_dist_cjs66 = __commonJS({
|
|
28035
28188
|
"node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js"(exports2) {
|
|
28036
28189
|
"use strict";
|
|
28037
28190
|
var middlewareEventstream = require_dist_cjs3();
|
|
@@ -28876,13 +29029,13 @@ var import_client_bedrock_runtime, import_client_bedrock_runtime2, import_client
|
|
|
28876
29029
|
var init_dist3 = __esm({
|
|
28877
29030
|
"node_modules/@ai-sdk/amazon-bedrock/dist/index.mjs"() {
|
|
28878
29031
|
init_dist2();
|
|
28879
|
-
import_client_bedrock_runtime = __toESM(
|
|
29032
|
+
import_client_bedrock_runtime = __toESM(require_dist_cjs66(), 1);
|
|
28880
29033
|
init_dist();
|
|
28881
|
-
import_client_bedrock_runtime2 = __toESM(
|
|
29034
|
+
import_client_bedrock_runtime2 = __toESM(require_dist_cjs66(), 1);
|
|
28882
29035
|
init_dist();
|
|
28883
29036
|
init_dist();
|
|
28884
29037
|
init_dist2();
|
|
28885
|
-
import_client_bedrock_runtime3 = __toESM(
|
|
29038
|
+
import_client_bedrock_runtime3 = __toESM(require_dist_cjs66(), 1);
|
|
28886
29039
|
generateFileId = createIdGenerator({ prefix: "file", size: 16 });
|
|
28887
29040
|
BedrockChatLanguageModel = class {
|
|
28888
29041
|
constructor(modelId, settings, config) {
|
|
@@ -36035,6 +36188,11 @@ Example: <extract><targets>${displayPath}</targets></extract>`;
|
|
|
36035
36188
|
if (!replace_all && occurrences > 1) {
|
|
36036
36189
|
return `Error editing file: Multiple occurrences found - the old_string appears ${occurrences} times in ${file_path}. To fix: (1) Set replace_all=true to replace all occurrences, or (2) Include more surrounding lines in old_string to make the match unique (add the full line or adjacent lines for context).`;
|
|
36037
36190
|
}
|
|
36191
|
+
const oldLines = matchTarget.split("\n").length;
|
|
36192
|
+
const newLines = new_string.split("\n").length;
|
|
36193
|
+
if (oldLines >= 20 && newLines < oldLines * 0.5) {
|
|
36194
|
+
return `Error editing file: Edit scope too large \u2014 replacing ${oldLines} lines with ${newLines} lines risks accidental content deletion. To fix: (1) Use line-targeted editing (start_line/end_line) instead to constrain scope, or (2) Split into smaller, focused edits that each target only the lines you intend to change.`;
|
|
36195
|
+
}
|
|
36038
36196
|
let newContent;
|
|
36039
36197
|
if (replace_all) {
|
|
36040
36198
|
newContent = content.replaceAll(matchTarget, new_string);
|
|
@@ -52050,7 +52208,6 @@ var init_reg_exp = __esm({
|
|
|
52050
52208
|
// node_modules/chevrotain/lib/src/scan/lexer.js
|
|
52051
52209
|
function analyzeTokenTypes(tokenTypes, options) {
|
|
52052
52210
|
options = defaults_default(options, {
|
|
52053
|
-
useSticky: SUPPORT_STICKY,
|
|
52054
52211
|
debug: false,
|
|
52055
52212
|
safeMode: false,
|
|
52056
52213
|
positionTracking: "full",
|
|
@@ -52099,7 +52256,7 @@ function analyzeTokenTypes(tokenTypes, options) {
|
|
|
52099
52256
|
], regExpSource[1])) {
|
|
52100
52257
|
return regExpSource[1];
|
|
52101
52258
|
} else {
|
|
52102
|
-
return
|
|
52259
|
+
return addStickyFlag(currPattern);
|
|
52103
52260
|
}
|
|
52104
52261
|
} else if (isFunction_default(currPattern)) {
|
|
52105
52262
|
hasCustom = true;
|
|
@@ -52113,7 +52270,7 @@ function analyzeTokenTypes(tokenTypes, options) {
|
|
|
52113
52270
|
} else {
|
|
52114
52271
|
const escapedRegExpString = currPattern.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&");
|
|
52115
52272
|
const wrappedRegExp = new RegExp(escapedRegExpString);
|
|
52116
|
-
return
|
|
52273
|
+
return addStickyFlag(wrappedRegExp);
|
|
52117
52274
|
}
|
|
52118
52275
|
} else {
|
|
52119
52276
|
throw Error("non exhaustive match");
|
|
@@ -52517,10 +52674,6 @@ function noMetaChar(regExp) {
|
|
|
52517
52674
|
function usesLookAheadOrBehind(regExp) {
|
|
52518
52675
|
return /(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(regExp.source);
|
|
52519
52676
|
}
|
|
52520
|
-
function addStartOfInput(pattern) {
|
|
52521
|
-
const flags = pattern.ignoreCase ? "i" : "";
|
|
52522
|
-
return new RegExp(`^(?:${pattern.source})`, flags);
|
|
52523
|
-
}
|
|
52524
52677
|
function addStickyFlag(pattern) {
|
|
52525
52678
|
const flags = pattern.ignoreCase ? "iy" : "y";
|
|
52526
52679
|
return new RegExp(`${pattern.source}`, flags);
|
|
@@ -52709,7 +52862,7 @@ function initCharCodeToOptimizedIndexMap() {
|
|
|
52709
52862
|
}
|
|
52710
52863
|
}
|
|
52711
52864
|
}
|
|
52712
|
-
var PATTERN, DEFAULT_MODE, MODES,
|
|
52865
|
+
var PATTERN, DEFAULT_MODE, MODES, end_of_input, start_of_input, LineTerminatorOptimizedTester, minOptimizationVal, charCodeToOptimizedIdxMap;
|
|
52713
52866
|
var init_lexer = __esm({
|
|
52714
52867
|
"node_modules/chevrotain/lib/src/scan/lexer.js"() {
|
|
52715
52868
|
init_api3();
|
|
@@ -52721,7 +52874,6 @@ var init_lexer = __esm({
|
|
|
52721
52874
|
PATTERN = "PATTERN";
|
|
52722
52875
|
DEFAULT_MODE = "defaultMode";
|
|
52723
52876
|
MODES = "modes";
|
|
52724
|
-
SUPPORT_STICKY = typeof new RegExp("(?:)").sticky === "boolean";
|
|
52725
52877
|
end_of_input = /[^\\][$]/;
|
|
52726
52878
|
start_of_input = /[^\\[][\^]|^\^/;
|
|
52727
52879
|
LineTerminatorOptimizedTester = {
|
|
@@ -53037,13 +53189,6 @@ var init_lexer_public = __esm({
|
|
|
53037
53189
|
PRINT_WARNING(warningDescriptor.message);
|
|
53038
53190
|
});
|
|
53039
53191
|
this.TRACE_INIT("Choosing sub-methods implementations", () => {
|
|
53040
|
-
if (SUPPORT_STICKY) {
|
|
53041
|
-
this.chopInput = identity_default;
|
|
53042
|
-
this.match = this.matchWithTest;
|
|
53043
|
-
} else {
|
|
53044
|
-
this.updateLastIndex = noop_default;
|
|
53045
|
-
this.match = this.matchWithExec;
|
|
53046
|
-
}
|
|
53047
53192
|
if (hasOnlySingleMode) {
|
|
53048
53193
|
this.handleModes = noop_default;
|
|
53049
53194
|
}
|
|
@@ -53106,7 +53251,7 @@ var init_lexer_public = __esm({
|
|
|
53106
53251
|
// this method also used quite a bit of `!` none null assertions because it is too optimized
|
|
53107
53252
|
// for `tsc` to always understand it is "safe"
|
|
53108
53253
|
tokenizeInternal(text, initialMode) {
|
|
53109
|
-
let i5, j5, k5, matchAltImage, longerAlt, matchedImage, payload2, altPayload, imageLength, group, tokType, newToken, errLength,
|
|
53254
|
+
let i5, j5, k5, matchAltImage, longerAlt, matchedImage, payload2, altPayload, imageLength, group, tokType, newToken, errLength, msg, match2;
|
|
53110
53255
|
const orgText = text;
|
|
53111
53256
|
const orgLength = orgText.length;
|
|
53112
53257
|
let offset2 = 0;
|
|
@@ -53125,19 +53270,7 @@ var init_lexer_public = __esm({
|
|
|
53125
53270
|
const modeStack = [];
|
|
53126
53271
|
const emptyArray = [];
|
|
53127
53272
|
Object.freeze(emptyArray);
|
|
53128
|
-
let
|
|
53129
|
-
function getPossiblePatternsSlow() {
|
|
53130
|
-
return patternIdxToConfig;
|
|
53131
|
-
}
|
|
53132
|
-
function getPossiblePatternsOptimized(charCode) {
|
|
53133
|
-
const optimizedCharIdx = charCodeToOptimizedIndex(charCode);
|
|
53134
|
-
const possiblePatterns = currCharCodeToPatternIdxToConfig[optimizedCharIdx];
|
|
53135
|
-
if (possiblePatterns === void 0) {
|
|
53136
|
-
return emptyArray;
|
|
53137
|
-
} else {
|
|
53138
|
-
return possiblePatterns;
|
|
53139
|
-
}
|
|
53140
|
-
}
|
|
53273
|
+
let isOptimizedMode = false;
|
|
53141
53274
|
const pop_mode = (popToken) => {
|
|
53142
53275
|
if (modeStack.length === 1 && // if we have both a POP_MODE and a PUSH_MODE this is in-fact a "transition"
|
|
53143
53276
|
// So no error should occur.
|
|
@@ -53158,9 +53291,9 @@ var init_lexer_public = __esm({
|
|
|
53158
53291
|
currModePatternsLength = patternIdxToConfig.length;
|
|
53159
53292
|
const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false;
|
|
53160
53293
|
if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {
|
|
53161
|
-
|
|
53294
|
+
isOptimizedMode = true;
|
|
53162
53295
|
} else {
|
|
53163
|
-
|
|
53296
|
+
isOptimizedMode = false;
|
|
53164
53297
|
}
|
|
53165
53298
|
}
|
|
53166
53299
|
};
|
|
@@ -53172,9 +53305,9 @@ var init_lexer_public = __esm({
|
|
|
53172
53305
|
currModePatternsLength = patternIdxToConfig.length;
|
|
53173
53306
|
const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false;
|
|
53174
53307
|
if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {
|
|
53175
|
-
|
|
53308
|
+
isOptimizedMode = true;
|
|
53176
53309
|
} else {
|
|
53177
|
-
|
|
53310
|
+
isOptimizedMode = false;
|
|
53178
53311
|
}
|
|
53179
53312
|
}
|
|
53180
53313
|
push_mode.call(this, initialMode);
|
|
@@ -53182,8 +53315,16 @@ var init_lexer_public = __esm({
|
|
|
53182
53315
|
const recoveryEnabled = this.config.recoveryEnabled;
|
|
53183
53316
|
while (offset2 < orgLength) {
|
|
53184
53317
|
matchedImage = null;
|
|
53318
|
+
imageLength = -1;
|
|
53185
53319
|
const nextCharCode = orgText.charCodeAt(offset2);
|
|
53186
|
-
|
|
53320
|
+
let chosenPatternIdxToConfig;
|
|
53321
|
+
if (isOptimizedMode) {
|
|
53322
|
+
const optimizedCharIdx = charCodeToOptimizedIndex(nextCharCode);
|
|
53323
|
+
const possiblePatterns = currCharCodeToPatternIdxToConfig[optimizedCharIdx];
|
|
53324
|
+
chosenPatternIdxToConfig = possiblePatterns !== void 0 ? possiblePatterns : emptyArray;
|
|
53325
|
+
} else {
|
|
53326
|
+
chosenPatternIdxToConfig = patternIdxToConfig;
|
|
53327
|
+
}
|
|
53187
53328
|
const chosenPatternsLength = chosenPatternIdxToConfig.length;
|
|
53188
53329
|
for (i5 = 0; i5 < chosenPatternsLength; i5++) {
|
|
53189
53330
|
currConfig = chosenPatternIdxToConfig[i5];
|
|
@@ -53192,12 +53333,14 @@ var init_lexer_public = __esm({
|
|
|
53192
53333
|
const singleCharCode = currConfig.short;
|
|
53193
53334
|
if (singleCharCode !== false) {
|
|
53194
53335
|
if (nextCharCode === singleCharCode) {
|
|
53336
|
+
imageLength = 1;
|
|
53195
53337
|
matchedImage = currPattern;
|
|
53196
53338
|
}
|
|
53197
53339
|
} else if (currConfig.isCustom === true) {
|
|
53198
53340
|
match2 = currPattern.exec(orgText, offset2, matchedTokens, groups);
|
|
53199
53341
|
if (match2 !== null) {
|
|
53200
53342
|
matchedImage = match2[0];
|
|
53343
|
+
imageLength = matchedImage.length;
|
|
53201
53344
|
if (match2.payload !== void 0) {
|
|
53202
53345
|
payload2 = match2.payload;
|
|
53203
53346
|
}
|
|
@@ -53205,12 +53348,13 @@ var init_lexer_public = __esm({
|
|
|
53205
53348
|
matchedImage = null;
|
|
53206
53349
|
}
|
|
53207
53350
|
} else {
|
|
53208
|
-
|
|
53209
|
-
|
|
53351
|
+
currPattern.lastIndex = offset2;
|
|
53352
|
+
imageLength = this.matchLength(currPattern, text, offset2);
|
|
53210
53353
|
}
|
|
53211
|
-
if (
|
|
53354
|
+
if (imageLength !== -1) {
|
|
53212
53355
|
longerAlt = currConfig.longerAlt;
|
|
53213
53356
|
if (longerAlt !== void 0) {
|
|
53357
|
+
matchedImage = text.substring(offset2, offset2 + imageLength);
|
|
53214
53358
|
const longerAltLength = longerAlt.length;
|
|
53215
53359
|
for (k5 = 0; k5 < longerAltLength; k5++) {
|
|
53216
53360
|
const longerAltConfig = patternIdxToConfig[longerAlt[k5]];
|
|
@@ -53227,11 +53371,12 @@ var init_lexer_public = __esm({
|
|
|
53227
53371
|
matchAltImage = null;
|
|
53228
53372
|
}
|
|
53229
53373
|
} else {
|
|
53230
|
-
|
|
53374
|
+
longerAltPattern.lastIndex = offset2;
|
|
53231
53375
|
matchAltImage = this.match(longerAltPattern, text, offset2);
|
|
53232
53376
|
}
|
|
53233
53377
|
if (matchAltImage && matchAltImage.length > matchedImage.length) {
|
|
53234
53378
|
matchedImage = matchAltImage;
|
|
53379
|
+
imageLength = matchAltImage.length;
|
|
53235
53380
|
payload2 = altPayload;
|
|
53236
53381
|
currConfig = longerAltConfig;
|
|
53237
53382
|
break;
|
|
@@ -53241,10 +53386,10 @@ var init_lexer_public = __esm({
|
|
|
53241
53386
|
break;
|
|
53242
53387
|
}
|
|
53243
53388
|
}
|
|
53244
|
-
if (
|
|
53245
|
-
imageLength = matchedImage.length;
|
|
53389
|
+
if (imageLength !== -1) {
|
|
53246
53390
|
group = currConfig.group;
|
|
53247
53391
|
if (group !== void 0) {
|
|
53392
|
+
matchedImage = matchedImage !== null ? matchedImage : text.substring(offset2, offset2 + imageLength);
|
|
53248
53393
|
tokType = currConfig.tokenTypeIdx;
|
|
53249
53394
|
newToken = this.createTokenInstance(matchedImage, offset2, tokType, currConfig.tokenType, line, column, imageLength);
|
|
53250
53395
|
this.handlePayload(newToken, payload2);
|
|
@@ -53254,15 +53399,13 @@ var init_lexer_public = __esm({
|
|
|
53254
53399
|
groups[group].push(newToken);
|
|
53255
53400
|
}
|
|
53256
53401
|
}
|
|
53257
|
-
text = this.chopInput(text, imageLength);
|
|
53258
|
-
offset2 = offset2 + imageLength;
|
|
53259
|
-
column = this.computeNewColumn(column, imageLength);
|
|
53260
53402
|
if (trackLines === true && currConfig.canLineTerminator === true) {
|
|
53261
53403
|
let numOfLTsInMatch = 0;
|
|
53262
53404
|
let foundTerminator;
|
|
53263
53405
|
let lastLTEndOffset;
|
|
53264
53406
|
lineTerminatorPattern.lastIndex = 0;
|
|
53265
53407
|
do {
|
|
53408
|
+
matchedImage = matchedImage !== null ? matchedImage : text.substring(offset2, offset2 + imageLength);
|
|
53266
53409
|
foundTerminator = lineTerminatorPattern.test(matchedImage);
|
|
53267
53410
|
if (foundTerminator === true) {
|
|
53268
53411
|
lastLTEndOffset = lineTerminatorPattern.lastIndex - 1;
|
|
@@ -53273,8 +53416,13 @@ var init_lexer_public = __esm({
|
|
|
53273
53416
|
line = line + numOfLTsInMatch;
|
|
53274
53417
|
column = imageLength - lastLTEndOffset;
|
|
53275
53418
|
this.updateTokenEndLineColumnLocation(newToken, group, lastLTEndOffset, numOfLTsInMatch, line, column, imageLength);
|
|
53419
|
+
} else {
|
|
53420
|
+
column = this.computeNewColumn(column, imageLength);
|
|
53276
53421
|
}
|
|
53422
|
+
} else {
|
|
53423
|
+
column = this.computeNewColumn(column, imageLength);
|
|
53277
53424
|
}
|
|
53425
|
+
offset2 = offset2 + imageLength;
|
|
53278
53426
|
this.handleModes(currConfig, pop_mode, push_mode, newToken);
|
|
53279
53427
|
} else {
|
|
53280
53428
|
const errorStartOffset = offset2;
|
|
@@ -53282,7 +53430,6 @@ var init_lexer_public = __esm({
|
|
|
53282
53430
|
const errorColumn = column;
|
|
53283
53431
|
let foundResyncPoint = recoveryEnabled === false;
|
|
53284
53432
|
while (foundResyncPoint === false && offset2 < orgLength) {
|
|
53285
|
-
text = this.chopInput(text, 1);
|
|
53286
53433
|
offset2++;
|
|
53287
53434
|
for (j5 = 0; j5 < currModePatternsLength; j5++) {
|
|
53288
53435
|
const currConfig2 = patternIdxToConfig[j5];
|
|
@@ -53295,7 +53442,7 @@ var init_lexer_public = __esm({
|
|
|
53295
53442
|
} else if (currConfig2.isCustom === true) {
|
|
53296
53443
|
foundResyncPoint = currPattern.exec(orgText, offset2, matchedTokens, groups) !== null;
|
|
53297
53444
|
} else {
|
|
53298
|
-
|
|
53445
|
+
currPattern.lastIndex = offset2;
|
|
53299
53446
|
foundResyncPoint = currPattern.exec(text) !== null;
|
|
53300
53447
|
}
|
|
53301
53448
|
if (foundResyncPoint === true) {
|
|
@@ -53338,12 +53485,6 @@ var init_lexer_public = __esm({
|
|
|
53338
53485
|
push_mode.call(this, config.push);
|
|
53339
53486
|
}
|
|
53340
53487
|
}
|
|
53341
|
-
chopInput(text, length) {
|
|
53342
|
-
return text.substring(length);
|
|
53343
|
-
}
|
|
53344
|
-
updateLastIndex(regExp, newLastIndex) {
|
|
53345
|
-
regExp.lastIndex = newLastIndex;
|
|
53346
|
-
}
|
|
53347
53488
|
// TODO: decrease this under 600 characters? inspect stripping comments option in TSC compiler
|
|
53348
53489
|
updateTokenEndLineColumnLocation(newToken, group, lastLTIdx, numOfLTsInMatch, line, column, imageLength) {
|
|
53349
53490
|
let lastCharIsLT, fixForEndingInLT;
|
|
@@ -53406,16 +53547,19 @@ var init_lexer_public = __esm({
|
|
|
53406
53547
|
token.payload = payload2;
|
|
53407
53548
|
}
|
|
53408
53549
|
}
|
|
53409
|
-
|
|
53550
|
+
match(pattern, text, offset2) {
|
|
53410
53551
|
const found = pattern.test(text);
|
|
53411
53552
|
if (found === true) {
|
|
53412
53553
|
return text.substring(offset2, pattern.lastIndex);
|
|
53413
53554
|
}
|
|
53414
53555
|
return null;
|
|
53415
53556
|
}
|
|
53416
|
-
|
|
53417
|
-
const
|
|
53418
|
-
|
|
53557
|
+
matchLength(pattern, text, offset2) {
|
|
53558
|
+
const found = pattern.test(text);
|
|
53559
|
+
if (found === true) {
|
|
53560
|
+
return pattern.lastIndex - offset2;
|
|
53561
|
+
}
|
|
53562
|
+
return -1;
|
|
53419
53563
|
}
|
|
53420
53564
|
};
|
|
53421
53565
|
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.";
|
|
@@ -53607,12 +53751,20 @@ For Further details.`;
|
|
|
53607
53751
|
return errMsg;
|
|
53608
53752
|
},
|
|
53609
53753
|
buildAlternationAmbiguityError(options) {
|
|
53610
|
-
const pathMsg = map_default(options.prefixPath, (currtok) => tokenLabel2(currtok)).join(", ");
|
|
53611
53754
|
const occurrence = options.alternation.idx === 0 ? "" : options.alternation.idx;
|
|
53755
|
+
const isEmptyPath = options.prefixPath.length === 0;
|
|
53612
53756
|
let currMessage = `Ambiguous Alternatives Detected: <${options.ambiguityIndices.join(" ,")}> in <OR${occurrence}> inside <${options.topLevelRule.name}> Rule,
|
|
53613
|
-
<${pathMsg}> may appears as a prefix path in all these alternatives.
|
|
53614
53757
|
`;
|
|
53615
|
-
|
|
53758
|
+
if (isEmptyPath) {
|
|
53759
|
+
currMessage += `These alternatives are all empty (match no tokens), making them indistinguishable.
|
|
53760
|
+
Only the last alternative may be empty.
|
|
53761
|
+
`;
|
|
53762
|
+
} else {
|
|
53763
|
+
const pathMsg = map_default(options.prefixPath, (currtok) => tokenLabel2(currtok)).join(", ");
|
|
53764
|
+
currMessage += `<${pathMsg}> may appears as a prefix path in all these alternatives.
|
|
53765
|
+
`;
|
|
53766
|
+
}
|
|
53767
|
+
currMessage += `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
53616
53768
|
For Further details.`;
|
|
53617
53769
|
return currMessage;
|
|
53618
53770
|
},
|
|
@@ -60115,7 +60267,7 @@ function validateFlowchart(text, options = {}) {
|
|
|
60115
60267
|
const byLine = /* @__PURE__ */ new Map();
|
|
60116
60268
|
const collect = (arr) => {
|
|
60117
60269
|
for (const e5 of arr || []) {
|
|
60118
|
-
if (e5 && (e5.code === "FL-LABEL-PARENS-UNQUOTED" || e5.code === "FL-LABEL-AT-IN-UNQUOTED" || e5.code === "FL-LABEL-QUOTE-IN-UNQUOTED")) {
|
|
60270
|
+
if (e5 && (e5.code === "FL-LABEL-PARENS-UNQUOTED" || e5.code === "FL-LABEL-AT-IN-UNQUOTED" || e5.code === "FL-LABEL-QUOTE-IN-UNQUOTED" || e5.code === "FL-LABEL-SLASH-UNQUOTED")) {
|
|
60119
60271
|
const ln = e5.line ?? 0;
|
|
60120
60272
|
const col = e5.column ?? 1;
|
|
60121
60273
|
const list2 = byLine.get(ln) || [];
|
|
@@ -60198,6 +60350,7 @@ function validateFlowchart(text, options = {}) {
|
|
|
60198
60350
|
const hasAt = seg.includes("@");
|
|
60199
60351
|
const hasQuote = seg.includes('"');
|
|
60200
60352
|
const isSingleQuoted = /^'[^]*'$/.test(trimmed);
|
|
60353
|
+
const hasLeadingSlash = lsp === "/" || lsp === "\\";
|
|
60201
60354
|
if (!covered && !isQuoted && !isParenWrapped && hasParens) {
|
|
60202
60355
|
errs.push({ line: ln, column: startCol, severity: "error", code: "FL-LABEL-PARENS-UNQUOTED", message: "Parentheses inside an unquoted label are not supported by Mermaid.", hint: 'Wrap the label in quotes, e.g., A["Mark (X)"] \u2014 or replace ( and ) with HTML entities: ( and ).' });
|
|
60203
60356
|
existing.push({ start: startCol, end: endCol });
|
|
@@ -60208,6 +60361,11 @@ function validateFlowchart(text, options = {}) {
|
|
|
60208
60361
|
existing.push({ start: startCol, end: endCol });
|
|
60209
60362
|
byLine.set(ln, existing);
|
|
60210
60363
|
}
|
|
60364
|
+
if (!covered && !isQuoted && !isSlashPair && hasLeadingSlash) {
|
|
60365
|
+
errs.push({ line: ln, column: startCol, severity: "error", code: "FL-LABEL-SLASH-UNQUOTED", message: "Leading / or \\ inside an unquoted label is treated as a shape marker by Mermaid.", hint: 'Wrap the label in quotes, e.g., F["/dev/tty unavailable"], or use / / \ for literal slashes.' });
|
|
60366
|
+
existing.push({ start: startCol, end: endCol });
|
|
60367
|
+
byLine.set(ln, existing);
|
|
60368
|
+
}
|
|
60211
60369
|
if (!covered && !isQuoted && !isSlashPair && hasQuote && !isSingleQuoted) {
|
|
60212
60370
|
errs.push({ line: ln, column: startCol, severity: "error", code: "FL-LABEL-QUOTE-IN-UNQUOTED", message: "Quotes are not allowed inside unquoted node labels. Use " for quotes or wrap the entire label in quotes.", hint: 'Example: C["HTML Output: data-trigger-visibility="true""]' });
|
|
60213
60371
|
existing.push({ start: startCol, end: endCol });
|
|
@@ -63216,7 +63374,7 @@ function computeFixes(text, errors, level = "safe") {
|
|
|
63216
63374
|
}
|
|
63217
63375
|
continue;
|
|
63218
63376
|
}
|
|
63219
|
-
if (is("FL-LABEL-PARENS-UNQUOTED", e5) || is("FL-LABEL-AT-IN-UNQUOTED", e5)) {
|
|
63377
|
+
if (is("FL-LABEL-PARENS-UNQUOTED", e5) || is("FL-LABEL-AT-IN-UNQUOTED", e5) || is("FL-LABEL-SLASH-UNQUOTED", e5)) {
|
|
63220
63378
|
if (level === "safe" || level === "all") {
|
|
63221
63379
|
if (patchedLines.has(e5.line))
|
|
63222
63380
|
continue;
|
|
@@ -84511,6 +84669,7 @@ If the solution is clear, you can jump to implementation right away. If not, ask
|
|
|
84511
84669
|
- Avoid implementing special cases when a general approach works
|
|
84512
84670
|
- Never expose secrets, API keys, or credentials in generated code. Never log sensitive information.
|
|
84513
84671
|
- Do not surprise the user with unrequested changes. Do what was asked, including reasonable follow-up actions, but do not refactor surrounding code or add features that were not requested.
|
|
84672
|
+
- When editing files, keep edits focused and minimal. For changes spanning more than a few lines, prefer line-targeted editing (start_line/end_line) over text replacement (old_string) \u2014 it constrains scope and prevents accidental removal of adjacent content. Never include unrelated sections in an edit operation.
|
|
84514
84673
|
- After every significant change, verify the project still builds and passes linting. Do not wait until the end to discover breakage.
|
|
84515
84674
|
|
|
84516
84675
|
# After Implementation
|
|
@@ -84521,11 +84680,33 @@ If the solution is clear, you can jump to implementation right away. If not, ask
|
|
|
84521
84680
|
|
|
84522
84681
|
# GitHub Integration
|
|
84523
84682
|
- Use the \`gh\` CLI for all GitHub operations: issues, pull requests, checks, releases.
|
|
84524
|
-
- To create a pull request: commit your changes, push the branch, then use \`gh pr create --title "..." --body "..."\`.
|
|
84525
84683
|
- To view issues or PRs: \`gh issue view <number>\`, \`gh pr view <number>\`.
|
|
84526
84684
|
- If given a GitHub URL, use \`gh\` to fetch the relevant information rather than guessing.
|
|
84527
84685
|
- Always return the pull request URL to the user after creating one.
|
|
84528
|
-
- When checking GitHub Actions, only read logs of failed jobs \u2014 do not waste time on successful ones. Use \`gh run view <run-id> --log-failed\` to fetch only the relevant output
|
|
84686
|
+
- When checking GitHub Actions, only read logs of failed jobs \u2014 do not waste time on successful ones. Use \`gh run view <run-id> --log-failed\` to fetch only the relevant output.
|
|
84687
|
+
|
|
84688
|
+
# Pull Request Creation
|
|
84689
|
+
- Commit your changes, push the branch, then use \`gh pr create --title "..." --body "..."\`.
|
|
84690
|
+
- **PR title**: Keep it short (under 72 characters). Use imperative mood describing the change (e.g. "Add retry logic for API calls", "Fix race condition in cache invalidation"). Prefix with the type of change when useful: \`fix:\`, \`feat:\`, \`refactor:\`, \`docs:\`, \`test:\`, \`chore:\`.
|
|
84691
|
+
- **PR body**: MUST follow this structure:
|
|
84692
|
+
|
|
84693
|
+
\`\`\`
|
|
84694
|
+
## Problem / Task
|
|
84695
|
+
<What problem is being solved or what task was requested. If there is a linked issue, reference it with #number. Be specific about the root cause or motivation.>
|
|
84696
|
+
|
|
84697
|
+
## Changes
|
|
84698
|
+
<Concise list of what was actually changed. Describe each meaningful change \u2014 files modified, logic added/removed, and why. Do NOT just list filenames; explain what each change does.>
|
|
84699
|
+
|
|
84700
|
+
## Testing
|
|
84701
|
+
<What tests were added, modified, or run. Include:
|
|
84702
|
+
- New test names and what they verify
|
|
84703
|
+
- Whether existing tests still pass
|
|
84704
|
+
- Manual verification steps if applicable
|
|
84705
|
+
- Commands used to validate (e.g. \`make test\`, \`npm test\`)>
|
|
84706
|
+
\`\`\`
|
|
84707
|
+
|
|
84708
|
+
- If the task originated from a GitHub issue, always reference it in the PR body (e.g. "Fixes #123" or "Closes #123") so the issue is automatically closed on merge. If it originated from an external ticket system (Jira, Linear, etc.), include the ticket ID and link in the Problem / Task section (e.g. "Resolves PROJ-456").
|
|
84709
|
+
- Do not leave the PR body empty or vague. Every PR must clearly communicate what was done and why so reviewers can understand the change without reading every line of diff.`,
|
|
84529
84710
|
"support": `You are ProbeChat Support, a specialized AI assistant focused on helping developers troubleshoot issues and solve problems. Your primary function is to help users diagnose errors, understand unexpected behaviors, and find solutions using the provided code analysis tools.
|
|
84530
84711
|
|
|
84531
84712
|
When troubleshooting:
|
|
@@ -105256,6 +105437,122 @@ var init_bashPermissions = __esm({
|
|
|
105256
105437
|
});
|
|
105257
105438
|
|
|
105258
105439
|
// src/agent/bashExecutor.js
|
|
105440
|
+
function splitCommandComponents(command) {
|
|
105441
|
+
const parts = [];
|
|
105442
|
+
let current2 = "";
|
|
105443
|
+
let inQuote = false;
|
|
105444
|
+
let quoteChar = "";
|
|
105445
|
+
for (let i5 = 0; i5 < command.length; i5++) {
|
|
105446
|
+
const c5 = command[i5];
|
|
105447
|
+
const next = command[i5 + 1] || "";
|
|
105448
|
+
if (c5 === "\\" && !inQuote) {
|
|
105449
|
+
current2 += c5 + next;
|
|
105450
|
+
i5++;
|
|
105451
|
+
continue;
|
|
105452
|
+
}
|
|
105453
|
+
if (inQuote && quoteChar === '"' && c5 === "\\" && next) {
|
|
105454
|
+
current2 += c5 + next;
|
|
105455
|
+
i5++;
|
|
105456
|
+
continue;
|
|
105457
|
+
}
|
|
105458
|
+
if (!inQuote && (c5 === '"' || c5 === "'")) {
|
|
105459
|
+
inQuote = true;
|
|
105460
|
+
quoteChar = c5;
|
|
105461
|
+
current2 += c5;
|
|
105462
|
+
continue;
|
|
105463
|
+
}
|
|
105464
|
+
if (inQuote && c5 === quoteChar) {
|
|
105465
|
+
inQuote = false;
|
|
105466
|
+
current2 += c5;
|
|
105467
|
+
continue;
|
|
105468
|
+
}
|
|
105469
|
+
if (!inQuote) {
|
|
105470
|
+
if (c5 === "&" && next === "&" || c5 === "|" && next === "|") {
|
|
105471
|
+
if (current2.trim()) parts.push(current2.trim());
|
|
105472
|
+
current2 = "";
|
|
105473
|
+
i5++;
|
|
105474
|
+
continue;
|
|
105475
|
+
}
|
|
105476
|
+
if (c5 === "|" || c5 === ";") {
|
|
105477
|
+
if (current2.trim()) parts.push(current2.trim());
|
|
105478
|
+
current2 = "";
|
|
105479
|
+
continue;
|
|
105480
|
+
}
|
|
105481
|
+
}
|
|
105482
|
+
current2 += c5;
|
|
105483
|
+
}
|
|
105484
|
+
if (current2.trim()) parts.push(current2.trim());
|
|
105485
|
+
return parts;
|
|
105486
|
+
}
|
|
105487
|
+
function checkSingleCommandInteractive(command) {
|
|
105488
|
+
let effective = command.trim();
|
|
105489
|
+
while (/^\w+=\S*\s/.test(effective)) {
|
|
105490
|
+
effective = effective.replace(/^\w+=\S*\s+/, "");
|
|
105491
|
+
}
|
|
105492
|
+
const parts = effective.split(/\s+/);
|
|
105493
|
+
const base2 = parts[0];
|
|
105494
|
+
const args = parts.slice(1);
|
|
105495
|
+
if (["vi", "vim", "nvim", "nano", "emacs", "pico", "joe", "mcedit"].includes(base2)) {
|
|
105496
|
+
return `'${base2}' is an interactive editor and cannot run without a terminal. Use non-interactive file manipulation commands instead.`;
|
|
105497
|
+
}
|
|
105498
|
+
if (["less", "more"].includes(base2)) {
|
|
105499
|
+
return `'${base2}' is an interactive pager. Use 'cat', 'head', or 'tail' instead.`;
|
|
105500
|
+
}
|
|
105501
|
+
if (base2 === "git") {
|
|
105502
|
+
const sub = args[0];
|
|
105503
|
+
if (sub === "commit") {
|
|
105504
|
+
const hasNonInteractiveFlag = args.some(
|
|
105505
|
+
(a5) => a5 === "-m" || a5.startsWith("--message") || a5 === "-C" || a5 === "-c" || a5.startsWith("--fixup") || a5.startsWith("--squash") || a5 === "--allow-empty-message" || a5 === "--no-edit"
|
|
105506
|
+
);
|
|
105507
|
+
if (!hasNonInteractiveFlag) {
|
|
105508
|
+
return `Interactive command: 'git commit' opens an editor for the commit message. Use 'git commit -m "your message"' instead.`;
|
|
105509
|
+
}
|
|
105510
|
+
}
|
|
105511
|
+
if (sub === "rebase" && (args.includes("--continue") || args.includes("--skip"))) {
|
|
105512
|
+
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.";
|
|
105513
|
+
}
|
|
105514
|
+
if (sub === "rebase" && (args.includes("-i") || args.includes("--interactive"))) {
|
|
105515
|
+
return "Interactive command: 'git rebase -i' requires an interactive editor. Interactive rebase cannot run without a terminal.";
|
|
105516
|
+
}
|
|
105517
|
+
if (sub === "merge" && !args.includes("--no-edit") && !args.includes("--no-commit") && !args.includes("--ff-only")) {
|
|
105518
|
+
return "Interactive command: 'git merge' may open an editor for the merge commit message. Add '--no-edit' to accept the default message.";
|
|
105519
|
+
}
|
|
105520
|
+
if (sub === "cherry-pick" && !args.includes("--no-edit")) {
|
|
105521
|
+
return "Interactive command: 'git cherry-pick' may open an editor. Add '--no-edit' to accept the default message.";
|
|
105522
|
+
}
|
|
105523
|
+
if (sub === "revert" && !args.includes("--no-edit")) {
|
|
105524
|
+
return "Interactive command: 'git revert' opens an editor. Add '--no-edit' to accept the default message.";
|
|
105525
|
+
}
|
|
105526
|
+
if (sub === "tag" && args.includes("-a") && !args.some((a5) => a5 === "-m" || a5.startsWith("--message"))) {
|
|
105527
|
+
return `Interactive command: 'git tag -a' opens an editor for the tag message. Use 'git tag -a <name> -m "message"' instead.`;
|
|
105528
|
+
}
|
|
105529
|
+
if (sub === "add" && (args.includes("-i") || args.includes("--interactive") || args.includes("-p") || args.includes("--patch"))) {
|
|
105530
|
+
return "Interactive command: 'git add -i/-p' requires interactive input. Use 'git add <files>' to stage specific files instead.";
|
|
105531
|
+
}
|
|
105532
|
+
}
|
|
105533
|
+
if (["python", "python3", "node", "irb", "ghci", "lua", "R", "ruby"].includes(base2) && args.length === 0) {
|
|
105534
|
+
return `Interactive command: '${base2}' without arguments starts an interactive REPL. Provide a script file or use '-c'/'--eval' for inline code.`;
|
|
105535
|
+
}
|
|
105536
|
+
if (base2 === "mysql" && !args.some((a5) => a5 === "-e" || a5.startsWith("--execute"))) {
|
|
105537
|
+
return `Interactive command: 'mysql' without -e flag starts an interactive session. Use 'mysql -e "SQL QUERY"' instead.`;
|
|
105538
|
+
}
|
|
105539
|
+
if (base2 === "psql" && !args.some((a5) => a5 === "-c" || a5.startsWith("--command") || a5 === "-f" || a5.startsWith("--file"))) {
|
|
105540
|
+
return `Interactive command: 'psql' without -c flag starts an interactive session. Use 'psql -c "SQL QUERY"' instead.`;
|
|
105541
|
+
}
|
|
105542
|
+
if (["top", "htop", "btop", "nmon"].includes(base2)) {
|
|
105543
|
+
return `Interactive command: '${base2}' is an interactive TUI tool. Use 'ps aux' or 'top -b -n 1' for non-interactive process listing.`;
|
|
105544
|
+
}
|
|
105545
|
+
return null;
|
|
105546
|
+
}
|
|
105547
|
+
function checkInteractiveCommand(command) {
|
|
105548
|
+
if (!command || typeof command !== "string") return null;
|
|
105549
|
+
const components = splitCommandComponents(command.trim());
|
|
105550
|
+
for (const component of components) {
|
|
105551
|
+
const result = checkSingleCommandInteractive(component);
|
|
105552
|
+
if (result) return result;
|
|
105553
|
+
}
|
|
105554
|
+
return null;
|
|
105555
|
+
}
|
|
105259
105556
|
async function executeBashCommand(command, options = {}) {
|
|
105260
105557
|
const {
|
|
105261
105558
|
workingDirectory = process.cwd(),
|
|
@@ -105285,6 +105582,24 @@ async function executeBashCommand(command, options = {}) {
|
|
|
105285
105582
|
};
|
|
105286
105583
|
}
|
|
105287
105584
|
const startTime = Date.now();
|
|
105585
|
+
const interactiveError = checkInteractiveCommand(command);
|
|
105586
|
+
if (interactiveError) {
|
|
105587
|
+
if (debug) {
|
|
105588
|
+
console.log(`[BashExecutor] Blocked interactive command: "${command}"`);
|
|
105589
|
+
console.log(`[BashExecutor] Reason: ${interactiveError}`);
|
|
105590
|
+
}
|
|
105591
|
+
return {
|
|
105592
|
+
success: false,
|
|
105593
|
+
error: interactiveError,
|
|
105594
|
+
stdout: "",
|
|
105595
|
+
stderr: interactiveError,
|
|
105596
|
+
exitCode: 1,
|
|
105597
|
+
command,
|
|
105598
|
+
workingDirectory: cwd,
|
|
105599
|
+
duration: 0,
|
|
105600
|
+
interactive: true
|
|
105601
|
+
};
|
|
105602
|
+
}
|
|
105288
105603
|
if (debug) {
|
|
105289
105604
|
console.log(`[BashExecutor] Executing command: "${command}"`);
|
|
105290
105605
|
console.log(`[BashExecutor] Working directory: "${cwd}"`);
|
|
@@ -105295,6 +105610,8 @@ async function executeBashCommand(command, options = {}) {
|
|
|
105295
105610
|
...process.env,
|
|
105296
105611
|
...env
|
|
105297
105612
|
};
|
|
105613
|
+
if (!processEnv.GIT_EDITOR) processEnv.GIT_EDITOR = "true";
|
|
105614
|
+
if (!processEnv.GIT_TERMINAL_PROMPT) processEnv.GIT_TERMINAL_PROMPT = "0";
|
|
105298
105615
|
const isComplex = isComplexCommand(command);
|
|
105299
105616
|
let cmd, cmdArgs, useShell;
|
|
105300
105617
|
if (isComplex) {
|
|
@@ -105329,20 +105646,32 @@ async function executeBashCommand(command, options = {}) {
|
|
|
105329
105646
|
// stdin ignored, capture stdout/stderr
|
|
105330
105647
|
shell: useShell,
|
|
105331
105648
|
// false for security
|
|
105649
|
+
detached: true,
|
|
105650
|
+
// new session — no controlling terminal
|
|
105332
105651
|
windowsHide: true
|
|
105333
105652
|
});
|
|
105334
105653
|
let stdout = "";
|
|
105335
105654
|
let stderr = "";
|
|
105336
105655
|
let killed = false;
|
|
105337
105656
|
let timeoutHandle;
|
|
105657
|
+
const killProcessGroup = (signal) => {
|
|
105658
|
+
try {
|
|
105659
|
+
if (child.pid) process.kill(-child.pid, signal);
|
|
105660
|
+
} catch {
|
|
105661
|
+
try {
|
|
105662
|
+
child.kill(signal);
|
|
105663
|
+
} catch {
|
|
105664
|
+
}
|
|
105665
|
+
}
|
|
105666
|
+
};
|
|
105338
105667
|
if (timeout > 0) {
|
|
105339
105668
|
timeoutHandle = setTimeout(() => {
|
|
105340
105669
|
if (!killed) {
|
|
105341
105670
|
killed = true;
|
|
105342
|
-
|
|
105671
|
+
killProcessGroup("SIGTERM");
|
|
105343
105672
|
setTimeout(() => {
|
|
105344
105673
|
if (child.exitCode === null) {
|
|
105345
|
-
|
|
105674
|
+
killProcessGroup("SIGKILL");
|
|
105346
105675
|
}
|
|
105347
105676
|
}, 5e3);
|
|
105348
105677
|
}
|
|
@@ -105355,7 +105684,7 @@ async function executeBashCommand(command, options = {}) {
|
|
|
105355
105684
|
} else {
|
|
105356
105685
|
if (!killed) {
|
|
105357
105686
|
killed = true;
|
|
105358
|
-
|
|
105687
|
+
killProcessGroup("SIGTERM");
|
|
105359
105688
|
}
|
|
105360
105689
|
}
|
|
105361
105690
|
});
|
|
@@ -105366,7 +105695,7 @@ async function executeBashCommand(command, options = {}) {
|
|
|
105366
105695
|
} else {
|
|
105367
105696
|
if (!killed) {
|
|
105368
105697
|
killed = true;
|
|
105369
|
-
|
|
105698
|
+
killProcessGroup("SIGTERM");
|
|
105370
105699
|
}
|
|
105371
105700
|
}
|
|
105372
105701
|
});
|
|
@@ -110325,6 +110654,7 @@ Follow these instructions carefully:
|
|
|
110325
110654
|
* For rewriting entire functions/classes/methods, use the symbol parameter instead (no exact text matching needed).
|
|
110326
110655
|
* 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.' : ""}
|
|
110327
110656
|
* 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.
|
|
110657
|
+
* 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.
|
|
110328
110658
|
- Use 'create' for new files or complete file rewrites.
|
|
110329
110659
|
- If an edit fails, read the error message \u2014 it tells you exactly how to fix the call and retry.
|
|
110330
110660
|
- 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.` : ""}
|