@probelabs/probe 0.6.0-rc255 → 0.6.0-rc257
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/README.md +5 -5
- package/bin/binaries/probe-v0.6.0-rc257-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc257-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc257-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/{probe-v0.6.0-rc255-x86_64-pc-windows-msvc.zip → probe-v0.6.0-rc257-x86_64-pc-windows-msvc.zip} +0 -0
- package/bin/binaries/probe-v0.6.0-rc257-x86_64-unknown-linux-musl.tar.gz +0 -0
- package/build/agent/FallbackManager.js +4 -4
- package/build/agent/ProbeAgent.js +23 -17
- package/build/agent/bashDefaults.js +175 -97
- package/build/agent/bashPermissions.js +98 -45
- package/build/agent/index.js +335 -205
- package/build/agent/mcp/xmlBridge.js +3 -2
- package/build/agent/schemaUtils.js +127 -0
- package/build/tools/bash.js +2 -2
- package/build/tools/common.js +20 -3
- package/cjs/agent/ProbeAgent.cjs +343 -203
- package/cjs/index.cjs +343 -203
- package/package.json +1 -1
- package/src/agent/FallbackManager.js +4 -4
- package/src/agent/ProbeAgent.js +23 -17
- package/src/agent/bashDefaults.js +175 -97
- package/src/agent/bashPermissions.js +98 -45
- package/src/agent/index.js +4 -4
- package/src/agent/mcp/xmlBridge.js +3 -2
- package/src/agent/schemaUtils.js +127 -0
- package/src/tools/bash.js +2 -2
- package/src/tools/common.js +20 -3
- package/bin/binaries/probe-v0.6.0-rc255-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc255-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc255-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc255-x86_64-unknown-linux-musl.tar.gz +0 -0
package/cjs/index.cjs
CHANGED
|
@@ -3701,6 +3701,7 @@ var require_ChecksumStream = __commonJS({
|
|
|
3701
3701
|
checksum;
|
|
3702
3702
|
source;
|
|
3703
3703
|
base64Encoder;
|
|
3704
|
+
pendingCallback = null;
|
|
3704
3705
|
constructor({ expectedChecksum, checksum, source, checksumSourceLocation, base64Encoder }) {
|
|
3705
3706
|
super();
|
|
3706
3707
|
if (typeof source.pipe === "function") {
|
|
@@ -3715,11 +3716,20 @@ var require_ChecksumStream = __commonJS({
|
|
|
3715
3716
|
this.source.pipe(this);
|
|
3716
3717
|
}
|
|
3717
3718
|
_read(size) {
|
|
3719
|
+
if (this.pendingCallback) {
|
|
3720
|
+
const callback = this.pendingCallback;
|
|
3721
|
+
this.pendingCallback = null;
|
|
3722
|
+
callback();
|
|
3723
|
+
}
|
|
3718
3724
|
}
|
|
3719
3725
|
_write(chunk, encoding, callback) {
|
|
3720
3726
|
try {
|
|
3721
3727
|
this.checksum.update(chunk);
|
|
3722
|
-
this.push(chunk);
|
|
3728
|
+
const canPushMore = this.push(chunk);
|
|
3729
|
+
if (!canPushMore) {
|
|
3730
|
+
this.pendingCallback = callback;
|
|
3731
|
+
return;
|
|
3732
|
+
}
|
|
3723
3733
|
} catch (e5) {
|
|
3724
3734
|
return callback(e5);
|
|
3725
3735
|
}
|
|
@@ -39015,6 +39025,10 @@ function getValidParamsForTool(toolName) {
|
|
|
39015
39025
|
}
|
|
39016
39026
|
return [];
|
|
39017
39027
|
}
|
|
39028
|
+
function unescapeXmlEntities(str) {
|
|
39029
|
+
if (typeof str !== "string") return str;
|
|
39030
|
+
return str.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
39031
|
+
}
|
|
39018
39032
|
function parseXmlToolCall(xmlString, validTools = DEFAULT_VALID_TOOLS) {
|
|
39019
39033
|
let earliestToolName = null;
|
|
39020
39034
|
let earliestOpenIndex = Infinity;
|
|
@@ -39071,10 +39085,10 @@ function parseXmlToolCall(xmlString, validTools = DEFAULT_VALID_TOOLS) {
|
|
|
39071
39085
|
}
|
|
39072
39086
|
paramCloseIndex = nextTagIndex;
|
|
39073
39087
|
}
|
|
39074
|
-
let paramValue = innerContent.substring(
|
|
39088
|
+
let paramValue = unescapeXmlEntities(innerContent.substring(
|
|
39075
39089
|
paramOpenIndex + paramOpenTag.length,
|
|
39076
39090
|
paramCloseIndex
|
|
39077
|
-
).trim();
|
|
39091
|
+
).trim());
|
|
39078
39092
|
if (paramValue.toLowerCase() === "true") {
|
|
39079
39093
|
paramValue = true;
|
|
39080
39094
|
} else if (paramValue.toLowerCase() === "false") {
|
|
@@ -39088,7 +39102,7 @@ function parseXmlToolCall(xmlString, validTools = DEFAULT_VALID_TOOLS) {
|
|
|
39088
39102
|
params[paramName] = paramValue;
|
|
39089
39103
|
}
|
|
39090
39104
|
if (toolName === "attempt_completion") {
|
|
39091
|
-
params["result"] = innerContent.trim();
|
|
39105
|
+
params["result"] = unescapeXmlEntities(innerContent.trim());
|
|
39092
39106
|
if (params.command) {
|
|
39093
39107
|
delete params.command;
|
|
39094
39108
|
}
|
|
@@ -84467,6 +84481,7 @@ __export(schemaUtils_exports, {
|
|
|
84467
84481
|
replaceMermaidDiagramsInMarkdown: () => replaceMermaidDiagramsInMarkdown,
|
|
84468
84482
|
sanitizeMarkdownEscapesInJson: () => sanitizeMarkdownEscapesInJson,
|
|
84469
84483
|
tryAutoWrapForSimpleSchema: () => tryAutoWrapForSimpleSchema,
|
|
84484
|
+
tryExtractValidJsonPrefix: () => tryExtractValidJsonPrefix,
|
|
84470
84485
|
tryMaidAutoFix: () => tryMaidAutoFix,
|
|
84471
84486
|
validateAndFixMermaidResponse: () => validateAndFixMermaidResponse,
|
|
84472
84487
|
validateJsonResponse: () => validateJsonResponse,
|
|
@@ -84853,6 +84868,13 @@ function validateJsonResponse(response, options = {}) {
|
|
|
84853
84868
|
errorPosition = response.indexOf(problematicToken);
|
|
84854
84869
|
}
|
|
84855
84870
|
}
|
|
84871
|
+
const prefixResult = tryExtractValidJsonPrefix(responseToValidate, { schema, debug });
|
|
84872
|
+
if (prefixResult && prefixResult.isValid) {
|
|
84873
|
+
if (debug) {
|
|
84874
|
+
console.log(`[DEBUG] JSON validation: Recovered valid JSON prefix (${prefixResult.extracted.length} chars) from response with trailing content`);
|
|
84875
|
+
}
|
|
84876
|
+
return { isValid: true, parsed: prefixResult.parsed };
|
|
84877
|
+
}
|
|
84856
84878
|
let enhancedError = error2.message;
|
|
84857
84879
|
let errorContext = null;
|
|
84858
84880
|
if (errorPosition !== null && errorPosition >= 0 && response && response.length > 0) {
|
|
@@ -84903,6 +84925,84 @@ ${errorContext.pointer}`);
|
|
|
84903
84925
|
};
|
|
84904
84926
|
}
|
|
84905
84927
|
}
|
|
84928
|
+
function tryExtractValidJsonPrefix(response, options = {}) {
|
|
84929
|
+
const { schema = null, debug = false } = options;
|
|
84930
|
+
if (!response || typeof response !== "string") {
|
|
84931
|
+
return null;
|
|
84932
|
+
}
|
|
84933
|
+
const trimmed = response.trim();
|
|
84934
|
+
if (trimmed.length === 0) {
|
|
84935
|
+
return null;
|
|
84936
|
+
}
|
|
84937
|
+
const firstChar = trimmed[0];
|
|
84938
|
+
if (firstChar !== "{" && firstChar !== "[") {
|
|
84939
|
+
return null;
|
|
84940
|
+
}
|
|
84941
|
+
try {
|
|
84942
|
+
JSON.parse(trimmed);
|
|
84943
|
+
return null;
|
|
84944
|
+
} catch {
|
|
84945
|
+
}
|
|
84946
|
+
const openChar = firstChar;
|
|
84947
|
+
const closeChar = openChar === "{" ? "}" : "]";
|
|
84948
|
+
let depth = 0;
|
|
84949
|
+
let inString = false;
|
|
84950
|
+
let escapeNext = false;
|
|
84951
|
+
let endPos = -1;
|
|
84952
|
+
for (let i5 = 0; i5 < trimmed.length; i5++) {
|
|
84953
|
+
const char = trimmed[i5];
|
|
84954
|
+
if (escapeNext) {
|
|
84955
|
+
escapeNext = false;
|
|
84956
|
+
continue;
|
|
84957
|
+
}
|
|
84958
|
+
if (char === "\\" && inString) {
|
|
84959
|
+
escapeNext = true;
|
|
84960
|
+
continue;
|
|
84961
|
+
}
|
|
84962
|
+
if (char === '"') {
|
|
84963
|
+
inString = !inString;
|
|
84964
|
+
continue;
|
|
84965
|
+
}
|
|
84966
|
+
if (inString) {
|
|
84967
|
+
continue;
|
|
84968
|
+
}
|
|
84969
|
+
if (char === openChar) {
|
|
84970
|
+
depth++;
|
|
84971
|
+
} else if (char === closeChar) {
|
|
84972
|
+
depth--;
|
|
84973
|
+
if (depth === 0) {
|
|
84974
|
+
endPos = i5 + 1;
|
|
84975
|
+
break;
|
|
84976
|
+
}
|
|
84977
|
+
}
|
|
84978
|
+
}
|
|
84979
|
+
if (endPos <= 0 || endPos >= trimmed.length) {
|
|
84980
|
+
return null;
|
|
84981
|
+
}
|
|
84982
|
+
const remainder = trimmed.substring(endPos).trim();
|
|
84983
|
+
if (remainder.length === 0) {
|
|
84984
|
+
return null;
|
|
84985
|
+
}
|
|
84986
|
+
const prefix = trimmed.substring(0, endPos);
|
|
84987
|
+
try {
|
|
84988
|
+
const parsed = JSON.parse(prefix);
|
|
84989
|
+
if (debug) {
|
|
84990
|
+
console.log(`[DEBUG] tryExtractValidJsonPrefix: Extracted valid JSON prefix (${prefix.length} chars), stripped trailing content (${remainder.length} chars)`);
|
|
84991
|
+
}
|
|
84992
|
+
if (schema) {
|
|
84993
|
+
const schemaValidation = validateJsonResponse(prefix, { debug, schema });
|
|
84994
|
+
if (!schemaValidation.isValid) {
|
|
84995
|
+
if (debug) {
|
|
84996
|
+
console.log(`[DEBUG] tryExtractValidJsonPrefix: Prefix is valid JSON but fails schema validation: ${schemaValidation.error}`);
|
|
84997
|
+
}
|
|
84998
|
+
return null;
|
|
84999
|
+
}
|
|
85000
|
+
}
|
|
85001
|
+
return { isValid: true, parsed, extracted: prefix };
|
|
85002
|
+
} catch {
|
|
85003
|
+
return null;
|
|
85004
|
+
}
|
|
85005
|
+
}
|
|
84906
85006
|
function validateXmlResponse(response) {
|
|
84907
85007
|
const xmlPattern = /<\/?[\w\s="'.-]+>/g;
|
|
84908
85008
|
const tags = response.match(xmlPattern);
|
|
@@ -87004,7 +87104,7 @@ function parseXmlMcpToolCall(xmlString, mcpToolNames = []) {
|
|
|
87004
87104
|
let match2;
|
|
87005
87105
|
while ((match2 = paramPattern.exec(content)) !== null) {
|
|
87006
87106
|
const [, paramName, paramValue] = match2;
|
|
87007
|
-
params[paramName] = paramValue.trim();
|
|
87107
|
+
params[paramName] = unescapeXmlEntities(paramValue.trim());
|
|
87008
87108
|
}
|
|
87009
87109
|
}
|
|
87010
87110
|
return { toolName, params };
|
|
@@ -87054,7 +87154,7 @@ function parseNativeXmlTool(xmlString, toolName) {
|
|
|
87054
87154
|
while ((match2 = paramPattern.exec(content)) !== null) {
|
|
87055
87155
|
const [, paramName, paramValue] = match2;
|
|
87056
87156
|
if (paramName !== "params") {
|
|
87057
|
-
params[paramName] = paramValue.trim();
|
|
87157
|
+
params[paramName] = unescapeXmlEntities(paramValue.trim());
|
|
87058
87158
|
}
|
|
87059
87159
|
}
|
|
87060
87160
|
if (Object.keys(params).length > 0) {
|
|
@@ -87069,6 +87169,7 @@ var init_xmlBridge = __esm({
|
|
|
87069
87169
|
init_client2();
|
|
87070
87170
|
init_config();
|
|
87071
87171
|
init_xmlParsingUtils();
|
|
87172
|
+
init_common2();
|
|
87072
87173
|
MCPXmlBridge = class {
|
|
87073
87174
|
constructor(options = {}) {
|
|
87074
87175
|
this.debug = options.debug || false;
|
|
@@ -95282,10 +95383,10 @@ var init_FallbackManager = __esm({
|
|
|
95282
95383
|
// Use custom provider list
|
|
95283
95384
|
};
|
|
95284
95385
|
DEFAULT_MODELS = {
|
|
95285
|
-
anthropic: "claude-sonnet-4-
|
|
95286
|
-
openai: "gpt-
|
|
95287
|
-
google: "gemini-2.
|
|
95288
|
-
bedrock: "anthropic.claude-sonnet-4-
|
|
95386
|
+
anthropic: "claude-sonnet-4-6",
|
|
95387
|
+
openai: "gpt-5.2",
|
|
95388
|
+
google: "gemini-2.5-flash",
|
|
95389
|
+
bedrock: "anthropic.claude-sonnet-4-6"
|
|
95289
95390
|
};
|
|
95290
95391
|
FallbackManager = class {
|
|
95291
95392
|
/**
|
|
@@ -105702,95 +105803,102 @@ var init_bashDefaults = __esm({
|
|
|
105702
105803
|
"dir",
|
|
105703
105804
|
"pwd",
|
|
105704
105805
|
"cd",
|
|
105705
|
-
"cd:*",
|
|
105706
105806
|
// File reading commands
|
|
105707
105807
|
"cat",
|
|
105708
|
-
"cat:*",
|
|
105709
105808
|
"head",
|
|
105710
|
-
"head:*",
|
|
105711
105809
|
"tail",
|
|
105712
|
-
"tail:*",
|
|
105713
105810
|
"less",
|
|
105714
105811
|
"more",
|
|
105715
105812
|
"view",
|
|
105716
105813
|
// File information and metadata
|
|
105717
105814
|
"file",
|
|
105718
|
-
"file:*",
|
|
105719
105815
|
"stat",
|
|
105720
|
-
"stat:*",
|
|
105721
105816
|
"wc",
|
|
105722
|
-
"wc:*",
|
|
105723
105817
|
"du",
|
|
105724
|
-
"du:*",
|
|
105725
105818
|
"df",
|
|
105726
|
-
"df:*",
|
|
105727
105819
|
"realpath",
|
|
105728
|
-
|
|
105729
|
-
//
|
|
105820
|
+
// Search and find commands (read-only)
|
|
105821
|
+
// Note: bare 'find' allows all find variants; dangerous ones (find -exec) are blocked by deny list
|
|
105730
105822
|
"find",
|
|
105731
|
-
"find:-name:*",
|
|
105732
|
-
"find:-type:*",
|
|
105733
|
-
"find:-size:*",
|
|
105734
|
-
"find:-mtime:*",
|
|
105735
|
-
"find:-newer:*",
|
|
105736
|
-
"find:-path:*",
|
|
105737
|
-
"find:-iname:*",
|
|
105738
|
-
"find:-maxdepth:*",
|
|
105739
|
-
"find:-mindepth:*",
|
|
105740
|
-
"find:-print",
|
|
105741
105823
|
"grep",
|
|
105742
|
-
"grep:*",
|
|
105743
105824
|
"egrep",
|
|
105744
|
-
"egrep:*",
|
|
105745
105825
|
"fgrep",
|
|
105746
|
-
"fgrep:*",
|
|
105747
105826
|
"rg",
|
|
105748
|
-
"rg:*",
|
|
105749
105827
|
"ag",
|
|
105750
|
-
"ag:*",
|
|
105751
105828
|
"ack",
|
|
105752
|
-
"ack:*",
|
|
105753
105829
|
"which",
|
|
105754
|
-
"which:*",
|
|
105755
105830
|
"whereis",
|
|
105756
|
-
"whereis:*",
|
|
105757
105831
|
"locate",
|
|
105758
|
-
"locate:*",
|
|
105759
105832
|
"type",
|
|
105760
|
-
"type:*",
|
|
105761
105833
|
"command",
|
|
105762
|
-
"command:*",
|
|
105763
105834
|
// Tree and structure visualization
|
|
105764
105835
|
"tree",
|
|
105765
|
-
"tree:*",
|
|
105766
105836
|
// Git read-only operations
|
|
105767
105837
|
"git:status",
|
|
105768
105838
|
"git:log",
|
|
105769
|
-
"git:log:*",
|
|
105770
105839
|
"git:diff",
|
|
105771
|
-
"git:diff:*",
|
|
105772
105840
|
"git:show",
|
|
105773
|
-
"git:show:*",
|
|
105774
105841
|
"git:branch",
|
|
105775
|
-
"git:branch:*",
|
|
105776
105842
|
"git:tag",
|
|
105777
|
-
"git:tag:*",
|
|
105778
105843
|
"git:describe",
|
|
105779
|
-
"git:describe:*",
|
|
105780
105844
|
"git:remote",
|
|
105781
|
-
"git:
|
|
105782
|
-
"git:config:*",
|
|
105845
|
+
"git:config",
|
|
105783
105846
|
"git:blame",
|
|
105784
|
-
"git:blame:*",
|
|
105785
105847
|
"git:shortlog",
|
|
105786
105848
|
"git:reflog",
|
|
105787
105849
|
"git:ls-files",
|
|
105788
105850
|
"git:ls-tree",
|
|
105851
|
+
"git:ls-remote",
|
|
105789
105852
|
"git:rev-parse",
|
|
105790
105853
|
"git:rev-list",
|
|
105854
|
+
"git:cat-file",
|
|
105855
|
+
"git:diff-tree",
|
|
105856
|
+
"git:diff-files",
|
|
105857
|
+
"git:diff-index",
|
|
105858
|
+
"git:for-each-ref",
|
|
105859
|
+
"git:merge-base",
|
|
105860
|
+
"git:name-rev",
|
|
105861
|
+
"git:count-objects",
|
|
105862
|
+
"git:verify-commit",
|
|
105863
|
+
"git:verify-tag",
|
|
105864
|
+
"git:check-ignore",
|
|
105865
|
+
"git:check-attr",
|
|
105866
|
+
"git:stash:list",
|
|
105867
|
+
"git:stash:show",
|
|
105868
|
+
"git:worktree:list",
|
|
105869
|
+
"git:notes:list",
|
|
105870
|
+
"git:notes:show",
|
|
105791
105871
|
"git:--version",
|
|
105792
105872
|
"git:help",
|
|
105793
|
-
|
|
105873
|
+
// GitHub CLI (gh) read-only operations
|
|
105874
|
+
"gh:--version",
|
|
105875
|
+
"gh:help",
|
|
105876
|
+
"gh:status",
|
|
105877
|
+
"gh:auth:status",
|
|
105878
|
+
"gh:issue:list",
|
|
105879
|
+
"gh:issue:view",
|
|
105880
|
+
"gh:issue:status",
|
|
105881
|
+
"gh:pr:list",
|
|
105882
|
+
"gh:pr:view",
|
|
105883
|
+
"gh:pr:status",
|
|
105884
|
+
"gh:pr:diff",
|
|
105885
|
+
"gh:pr:checks",
|
|
105886
|
+
"gh:repo:list",
|
|
105887
|
+
"gh:repo:view",
|
|
105888
|
+
"gh:release:list",
|
|
105889
|
+
"gh:release:view",
|
|
105890
|
+
"gh:run:list",
|
|
105891
|
+
"gh:run:view",
|
|
105892
|
+
"gh:workflow:list",
|
|
105893
|
+
"gh:workflow:view",
|
|
105894
|
+
"gh:gist:list",
|
|
105895
|
+
"gh:gist:view",
|
|
105896
|
+
"gh:search:issues",
|
|
105897
|
+
"gh:search:prs",
|
|
105898
|
+
"gh:search:repos",
|
|
105899
|
+
"gh:search:code",
|
|
105900
|
+
"gh:search:commits",
|
|
105901
|
+
"gh:api",
|
|
105794
105902
|
// Package managers (information only)
|
|
105795
105903
|
"npm:list",
|
|
105796
105904
|
"npm:ls",
|
|
@@ -105851,7 +105959,6 @@ var init_bashDefaults = __esm({
|
|
|
105851
105959
|
"sqlite3:--version",
|
|
105852
105960
|
// System information
|
|
105853
105961
|
"uname",
|
|
105854
|
-
"uname:*",
|
|
105855
105962
|
"hostname",
|
|
105856
105963
|
"whoami",
|
|
105857
105964
|
"id",
|
|
@@ -105862,23 +105969,17 @@ var init_bashDefaults = __esm({
|
|
|
105862
105969
|
"w",
|
|
105863
105970
|
"users",
|
|
105864
105971
|
"sleep",
|
|
105865
|
-
"sleep:*",
|
|
105866
105972
|
// Environment and shell
|
|
105867
105973
|
"env",
|
|
105868
105974
|
"printenv",
|
|
105869
105975
|
"echo",
|
|
105870
|
-
"echo:*",
|
|
105871
105976
|
"printf",
|
|
105872
|
-
"printf:*",
|
|
105873
105977
|
"export",
|
|
105874
|
-
"export:*",
|
|
105875
105978
|
"set",
|
|
105876
105979
|
"unset",
|
|
105877
105980
|
// Process information (read-only)
|
|
105878
105981
|
"ps",
|
|
105879
|
-
"ps:*",
|
|
105880
105982
|
"pgrep",
|
|
105881
|
-
"pgrep:*",
|
|
105882
105983
|
"jobs",
|
|
105883
105984
|
"top:-n:1",
|
|
105884
105985
|
// Network information (read-only)
|
|
@@ -105893,39 +105994,24 @@ var init_bashDefaults = __esm({
|
|
|
105893
105994
|
// Text processing and utilities (awk removed - too powerful)
|
|
105894
105995
|
"sed:-n:*",
|
|
105895
105996
|
"cut",
|
|
105896
|
-
"cut:*",
|
|
105897
105997
|
"sort",
|
|
105898
|
-
"sort:*",
|
|
105899
105998
|
"uniq",
|
|
105900
|
-
"uniq:*",
|
|
105901
105999
|
"tr",
|
|
105902
|
-
"tr:*",
|
|
105903
106000
|
"column",
|
|
105904
|
-
"column:*",
|
|
105905
106001
|
"paste",
|
|
105906
|
-
"paste:*",
|
|
105907
106002
|
"join",
|
|
105908
|
-
"join:*",
|
|
105909
106003
|
"comm",
|
|
105910
|
-
"comm:*",
|
|
105911
106004
|
"diff",
|
|
105912
|
-
"diff:*",
|
|
105913
106005
|
"cmp",
|
|
105914
|
-
"cmp:*",
|
|
105915
106006
|
"patch:--dry-run:*",
|
|
105916
106007
|
// Hashing and encoding (read-only)
|
|
105917
106008
|
"md5sum",
|
|
105918
|
-
"md5sum:*",
|
|
105919
106009
|
"sha1sum",
|
|
105920
|
-
"sha1sum:*",
|
|
105921
106010
|
"sha256sum",
|
|
105922
|
-
"sha256sum:*",
|
|
105923
106011
|
"base64",
|
|
105924
106012
|
"base64:-d",
|
|
105925
106013
|
"od",
|
|
105926
|
-
"od:*",
|
|
105927
106014
|
"hexdump",
|
|
105928
|
-
"hexdump:*",
|
|
105929
106015
|
// Archive and compression (list/view only)
|
|
105930
106016
|
"tar:-tf:*",
|
|
105931
106017
|
"tar:-tzf:*",
|
|
@@ -105935,15 +106021,11 @@ var init_bashDefaults = __esm({
|
|
|
105935
106021
|
"gunzip:-l:*",
|
|
105936
106022
|
// Help and documentation
|
|
105937
106023
|
"man",
|
|
105938
|
-
"man:*",
|
|
105939
106024
|
"--help",
|
|
105940
106025
|
"help",
|
|
105941
106026
|
"info",
|
|
105942
|
-
"info:*",
|
|
105943
106027
|
"whatis",
|
|
105944
|
-
"whatis:*",
|
|
105945
106028
|
"apropos",
|
|
105946
|
-
"apropos:*",
|
|
105947
106029
|
// Make (dry run and info)
|
|
105948
106030
|
"make:-n",
|
|
105949
106031
|
"make:--dry-run",
|
|
@@ -105966,36 +106048,30 @@ var init_bashDefaults = __esm({
|
|
|
105966
106048
|
"rm:-rf",
|
|
105967
106049
|
"rm:-f:/",
|
|
105968
106050
|
"rm:/",
|
|
105969
|
-
"rm:-rf:*",
|
|
105970
106051
|
"rmdir",
|
|
105971
106052
|
"chmod:777",
|
|
105972
106053
|
"chmod:-R:777",
|
|
105973
106054
|
"chown",
|
|
105974
106055
|
"chgrp",
|
|
105975
106056
|
"dd",
|
|
105976
|
-
"dd:*",
|
|
105977
106057
|
"shred",
|
|
105978
|
-
"shred:*",
|
|
105979
106058
|
// Dangerous find operations that can execute arbitrary commands
|
|
105980
|
-
"find:-exec
|
|
105981
|
-
"find:*:-exec
|
|
105982
|
-
"find:-execdir
|
|
105983
|
-
"find:*:-execdir
|
|
105984
|
-
"find:-ok
|
|
105985
|
-
"find:*:-ok
|
|
105986
|
-
"find:-okdir
|
|
105987
|
-
"find:*:-okdir
|
|
106059
|
+
"find:-exec",
|
|
106060
|
+
"find:*:-exec",
|
|
106061
|
+
"find:-execdir",
|
|
106062
|
+
"find:*:-execdir",
|
|
106063
|
+
"find:-ok",
|
|
106064
|
+
"find:*:-ok",
|
|
106065
|
+
"find:-okdir",
|
|
106066
|
+
"find:*:-okdir",
|
|
105988
106067
|
// Powerful scripting tools that can execute arbitrary commands
|
|
105989
106068
|
"awk",
|
|
105990
|
-
"awk:*",
|
|
105991
106069
|
"perl",
|
|
105992
|
-
"perl:*",
|
|
105993
106070
|
"python:-c:*",
|
|
105994
106071
|
"node:-e:*",
|
|
105995
106072
|
// System administration and modification
|
|
105996
|
-
"sudo
|
|
106073
|
+
"sudo",
|
|
105997
106074
|
"su",
|
|
105998
|
-
"su:*",
|
|
105999
106075
|
"passwd",
|
|
106000
106076
|
"adduser",
|
|
106001
106077
|
"useradd",
|
|
@@ -106033,11 +106109,11 @@ var init_bashDefaults = __esm({
|
|
|
106033
106109
|
"composer:install",
|
|
106034
106110
|
"composer:update",
|
|
106035
106111
|
"composer:remove",
|
|
106036
|
-
"apt
|
|
106037
|
-
"apt-get
|
|
106038
|
-
"yum
|
|
106039
|
-
"dnf
|
|
106040
|
-
"zypper
|
|
106112
|
+
"apt",
|
|
106113
|
+
"apt-get",
|
|
106114
|
+
"yum",
|
|
106115
|
+
"dnf",
|
|
106116
|
+
"zypper",
|
|
106041
106117
|
"brew:install",
|
|
106042
106118
|
"brew:uninstall",
|
|
106043
106119
|
"brew:upgrade",
|
|
@@ -106045,11 +106121,11 @@ var init_bashDefaults = __esm({
|
|
|
106045
106121
|
"conda:remove",
|
|
106046
106122
|
"conda:update",
|
|
106047
106123
|
// Service and system control
|
|
106048
|
-
"systemctl
|
|
106049
|
-
"service
|
|
106050
|
-
"chkconfig
|
|
106051
|
-
"initctl
|
|
106052
|
-
"upstart
|
|
106124
|
+
"systemctl",
|
|
106125
|
+
"service",
|
|
106126
|
+
"chkconfig",
|
|
106127
|
+
"initctl",
|
|
106128
|
+
"upstart",
|
|
106053
106129
|
// Network operations that could be dangerous
|
|
106054
106130
|
"curl:-d:*",
|
|
106055
106131
|
"curl:--data:*",
|
|
@@ -106058,32 +106134,21 @@ var init_bashDefaults = __esm({
|
|
|
106058
106134
|
"wget:-O:/",
|
|
106059
106135
|
"wget:--post-data:*",
|
|
106060
106136
|
"ssh",
|
|
106061
|
-
"ssh:*",
|
|
106062
106137
|
"scp",
|
|
106063
|
-
"scp:*",
|
|
106064
106138
|
"sftp",
|
|
106065
|
-
"
|
|
106066
|
-
"rsync:*",
|
|
106139
|
+
"rsync",
|
|
106067
106140
|
"nc",
|
|
106068
|
-
"nc:*",
|
|
106069
106141
|
"netcat",
|
|
106070
|
-
"netcat:*",
|
|
106071
106142
|
"telnet",
|
|
106072
|
-
"telnet:*",
|
|
106073
106143
|
"ftp",
|
|
106074
|
-
"ftp:*",
|
|
106075
106144
|
// Process control and termination
|
|
106076
106145
|
"kill",
|
|
106077
|
-
"kill:*",
|
|
106078
106146
|
"killall",
|
|
106079
|
-
"killall:*",
|
|
106080
106147
|
"pkill",
|
|
106081
|
-
"
|
|
106082
|
-
"
|
|
106083
|
-
"disown:*",
|
|
106148
|
+
"nohup",
|
|
106149
|
+
"disown",
|
|
106084
106150
|
// System control and shutdown
|
|
106085
106151
|
"shutdown",
|
|
106086
|
-
"shutdown:*",
|
|
106087
106152
|
"reboot",
|
|
106088
106153
|
"halt",
|
|
106089
106154
|
"poweroff",
|
|
@@ -106091,50 +106156,92 @@ var init_bashDefaults = __esm({
|
|
|
106091
106156
|
"telinit",
|
|
106092
106157
|
// Kernel and module operations
|
|
106093
106158
|
"insmod",
|
|
106094
|
-
"insmod:*",
|
|
106095
106159
|
"rmmod",
|
|
106096
|
-
"rmmod:*",
|
|
106097
106160
|
"modprobe",
|
|
106098
|
-
"modprobe:*",
|
|
106099
106161
|
"sysctl:-w:*",
|
|
106100
106162
|
// Dangerous git operations
|
|
106101
106163
|
"git:push",
|
|
106102
|
-
"git:push:*",
|
|
106103
106164
|
"git:force",
|
|
106104
|
-
"git:reset
|
|
106105
|
-
"git:clean
|
|
106106
|
-
"git:rm
|
|
106165
|
+
"git:reset",
|
|
106166
|
+
"git:clean",
|
|
106167
|
+
"git:rm",
|
|
106107
106168
|
"git:commit",
|
|
106108
106169
|
"git:merge",
|
|
106109
106170
|
"git:rebase",
|
|
106110
106171
|
"git:cherry-pick",
|
|
106111
106172
|
"git:stash:drop",
|
|
106173
|
+
"git:stash:pop",
|
|
106174
|
+
"git:stash:push",
|
|
106175
|
+
"git:stash:clear",
|
|
106176
|
+
"git:branch:-d",
|
|
106177
|
+
"git:branch:-D",
|
|
106178
|
+
"git:branch:--delete",
|
|
106179
|
+
"git:tag:-d",
|
|
106180
|
+
"git:tag:--delete",
|
|
106181
|
+
"git:remote:remove",
|
|
106182
|
+
"git:remote:rm",
|
|
106183
|
+
"git:checkout:--force",
|
|
106184
|
+
"git:checkout:-f",
|
|
106185
|
+
"git:submodule:deinit",
|
|
106186
|
+
"git:notes:add",
|
|
106187
|
+
"git:notes:remove",
|
|
106188
|
+
"git:worktree:add",
|
|
106189
|
+
"git:worktree:remove",
|
|
106190
|
+
// Dangerous GitHub CLI (gh) write operations
|
|
106191
|
+
"gh:issue:create",
|
|
106192
|
+
"gh:issue:close",
|
|
106193
|
+
"gh:issue:delete",
|
|
106194
|
+
"gh:issue:edit",
|
|
106195
|
+
"gh:issue:reopen",
|
|
106196
|
+
"gh:issue:comment",
|
|
106197
|
+
"gh:pr:create",
|
|
106198
|
+
"gh:pr:close",
|
|
106199
|
+
"gh:pr:merge",
|
|
106200
|
+
"gh:pr:edit",
|
|
106201
|
+
"gh:pr:reopen",
|
|
106202
|
+
"gh:pr:review",
|
|
106203
|
+
"gh:pr:comment",
|
|
106204
|
+
"gh:repo:create",
|
|
106205
|
+
"gh:repo:delete",
|
|
106206
|
+
"gh:repo:fork",
|
|
106207
|
+
"gh:repo:rename",
|
|
106208
|
+
"gh:repo:archive",
|
|
106209
|
+
"gh:repo:clone",
|
|
106210
|
+
"gh:release:create",
|
|
106211
|
+
"gh:release:delete",
|
|
106212
|
+
"gh:release:edit",
|
|
106213
|
+
"gh:run:cancel",
|
|
106214
|
+
"gh:run:rerun",
|
|
106215
|
+
"gh:workflow:run",
|
|
106216
|
+
"gh:workflow:enable",
|
|
106217
|
+
"gh:workflow:disable",
|
|
106218
|
+
"gh:gist:create",
|
|
106219
|
+
"gh:gist:delete",
|
|
106220
|
+
"gh:gist:edit",
|
|
106221
|
+
"gh:secret:set",
|
|
106222
|
+
"gh:secret:delete",
|
|
106223
|
+
"gh:variable:set",
|
|
106224
|
+
"gh:variable:delete",
|
|
106225
|
+
"gh:label:create",
|
|
106226
|
+
"gh:label:delete",
|
|
106227
|
+
"gh:ssh-key:add",
|
|
106228
|
+
"gh:ssh-key:delete",
|
|
106112
106229
|
// File system mounting and partitioning
|
|
106113
106230
|
"mount",
|
|
106114
|
-
"mount:*",
|
|
106115
106231
|
"umount",
|
|
106116
|
-
"umount:*",
|
|
106117
106232
|
"fdisk",
|
|
106118
|
-
"fdisk:*",
|
|
106119
106233
|
"parted",
|
|
106120
|
-
"parted:*",
|
|
106121
106234
|
"mkfs",
|
|
106122
|
-
"mkfs:*",
|
|
106123
106235
|
"fsck",
|
|
106124
|
-
"fsck:*",
|
|
106125
106236
|
// Cron and scheduling
|
|
106126
106237
|
"crontab",
|
|
106127
|
-
"crontab:*",
|
|
106128
106238
|
"at",
|
|
106129
|
-
"at:*",
|
|
106130
106239
|
"batch",
|
|
106131
|
-
"batch:*",
|
|
106132
106240
|
// Compression with potential overwrite
|
|
106133
106241
|
"tar:-xf:*",
|
|
106134
106242
|
"unzip",
|
|
106135
|
-
"
|
|
106136
|
-
"
|
|
106137
|
-
"gunzip:*",
|
|
106243
|
+
"gzip",
|
|
106244
|
+
"gunzip",
|
|
106138
106245
|
// Build and compilation that might modify files
|
|
106139
106246
|
"make",
|
|
106140
106247
|
"make:install",
|
|
@@ -106147,11 +106254,8 @@ var init_bashDefaults = __esm({
|
|
|
106147
106254
|
"gradle:build",
|
|
106148
106255
|
// Docker operations that could modify state
|
|
106149
106256
|
"docker:run",
|
|
106150
|
-
"docker:run:*",
|
|
106151
106257
|
"docker:exec",
|
|
106152
|
-
"docker:exec:*",
|
|
106153
106258
|
"docker:build",
|
|
106154
|
-
"docker:build:*",
|
|
106155
106259
|
"docker:pull",
|
|
106156
106260
|
"docker:push",
|
|
106157
106261
|
"docker:rm",
|
|
@@ -106165,22 +106269,15 @@ var init_bashDefaults = __esm({
|
|
|
106165
106269
|
"mongo:--eval:*",
|
|
106166
106270
|
// Text editors that could modify files
|
|
106167
106271
|
"vi",
|
|
106168
|
-
"vi:*",
|
|
106169
106272
|
"vim",
|
|
106170
|
-
"vim:*",
|
|
106171
106273
|
"nano",
|
|
106172
|
-
"nano:*",
|
|
106173
106274
|
"emacs",
|
|
106174
|
-
"emacs:*",
|
|
106175
106275
|
"sed:-i:*",
|
|
106176
106276
|
"perl:-i:*",
|
|
106177
106277
|
// Potentially dangerous utilities
|
|
106178
106278
|
"eval",
|
|
106179
|
-
"eval:*",
|
|
106180
106279
|
"exec",
|
|
106181
|
-
"exec:*",
|
|
106182
106280
|
"source",
|
|
106183
|
-
"source:*",
|
|
106184
106281
|
"bash:-c:*",
|
|
106185
106282
|
"sh:-c:*",
|
|
106186
106283
|
"zsh:-c:*"
|
|
@@ -106459,9 +106556,19 @@ var init_bashPermissions = __esm({
|
|
|
106459
106556
|
BashPermissionChecker = class {
|
|
106460
106557
|
/**
|
|
106461
106558
|
* Create a permission checker
|
|
106559
|
+
*
|
|
106560
|
+
* Priority order (highest to lowest):
|
|
106561
|
+
* 1. Custom deny — always blocks (user explicitly blocked it)
|
|
106562
|
+
* 2. Custom allow — overrides default deny (user explicitly allowed it)
|
|
106563
|
+
* 3. Default deny — blocks by default
|
|
106564
|
+
* 4. Allow list — allows recognized safe commands
|
|
106565
|
+
*
|
|
106566
|
+
* This means `--bash-allow "git:push"` overrides the default deny for git:push
|
|
106567
|
+
* without requiring `--no-default-bash-deny`.
|
|
106568
|
+
*
|
|
106462
106569
|
* @param {Object} config - Configuration options
|
|
106463
|
-
* @param {string[]} [config.allow] - Additional allow patterns
|
|
106464
|
-
* @param {string[]} [config.deny] - Additional deny patterns
|
|
106570
|
+
* @param {string[]} [config.allow] - Additional allow patterns (override default deny)
|
|
106571
|
+
* @param {string[]} [config.deny] - Additional deny patterns (always win)
|
|
106465
106572
|
* @param {boolean} [config.disableDefaultAllow] - Disable default allow list
|
|
106466
106573
|
* @param {boolean} [config.disableDefaultDeny] - Disable default deny list
|
|
106467
106574
|
* @param {boolean} [config.debug] - Enable debug logging
|
|
@@ -106470,40 +106577,22 @@ var init_bashPermissions = __esm({
|
|
|
106470
106577
|
constructor(config = {}) {
|
|
106471
106578
|
this.debug = config.debug || false;
|
|
106472
106579
|
this.tracer = config.tracer || null;
|
|
106473
|
-
this.
|
|
106474
|
-
|
|
106475
|
-
|
|
106476
|
-
|
|
106477
|
-
|
|
106478
|
-
|
|
106479
|
-
}
|
|
106480
|
-
if (config.allow && Array.isArray(config.allow)) {
|
|
106481
|
-
this.allowPatterns.push(...config.allow);
|
|
106482
|
-
if (this.debug) {
|
|
106483
|
-
console.log(`[BashPermissions] Added ${config.allow.length} custom allow patterns:`, config.allow);
|
|
106484
|
-
}
|
|
106485
|
-
}
|
|
106486
|
-
this.denyPatterns = [];
|
|
106487
|
-
if (!config.disableDefaultDeny) {
|
|
106488
|
-
this.denyPatterns.push(...DEFAULT_DENY_PATTERNS);
|
|
106489
|
-
if (this.debug) {
|
|
106490
|
-
console.log(`[BashPermissions] Added ${DEFAULT_DENY_PATTERNS.length} default deny patterns`);
|
|
106491
|
-
}
|
|
106492
|
-
}
|
|
106493
|
-
if (config.deny && Array.isArray(config.deny)) {
|
|
106494
|
-
this.denyPatterns.push(...config.deny);
|
|
106495
|
-
if (this.debug) {
|
|
106496
|
-
console.log(`[BashPermissions] Added ${config.deny.length} custom deny patterns:`, config.deny);
|
|
106497
|
-
}
|
|
106498
|
-
}
|
|
106580
|
+
this.defaultAllowPatterns = config.disableDefaultAllow ? [] : [...DEFAULT_ALLOW_PATTERNS];
|
|
106581
|
+
this.customAllowPatterns = config.allow && Array.isArray(config.allow) ? [...config.allow] : [];
|
|
106582
|
+
this.allowPatterns = [...this.defaultAllowPatterns, ...this.customAllowPatterns];
|
|
106583
|
+
this.defaultDenyPatterns = config.disableDefaultDeny ? [] : [...DEFAULT_DENY_PATTERNS];
|
|
106584
|
+
this.customDenyPatterns = config.deny && Array.isArray(config.deny) ? [...config.deny] : [];
|
|
106585
|
+
this.denyPatterns = [...this.defaultDenyPatterns, ...this.customDenyPatterns];
|
|
106499
106586
|
if (this.debug) {
|
|
106587
|
+
console.log(`[BashPermissions] Default allow: ${this.defaultAllowPatterns.length}, Custom allow: ${this.customAllowPatterns.length}`);
|
|
106588
|
+
console.log(`[BashPermissions] Default deny: ${this.defaultDenyPatterns.length}, Custom deny: ${this.customDenyPatterns.length}`);
|
|
106500
106589
|
console.log(`[BashPermissions] Total patterns - Allow: ${this.allowPatterns.length}, Deny: ${this.denyPatterns.length}`);
|
|
106501
106590
|
}
|
|
106502
106591
|
this.recordBashEvent("permissions.initialized", {
|
|
106503
106592
|
allowPatternCount: this.allowPatterns.length,
|
|
106504
106593
|
denyPatternCount: this.denyPatterns.length,
|
|
106505
|
-
hasCustomAllowPatterns:
|
|
106506
|
-
hasCustomDenyPatterns:
|
|
106594
|
+
hasCustomAllowPatterns: this.customAllowPatterns.length > 0,
|
|
106595
|
+
hasCustomDenyPatterns: this.customDenyPatterns.length > 0,
|
|
106507
106596
|
disableDefaultAllow: !!config.disableDefaultAllow,
|
|
106508
106597
|
disableDefaultDeny: !!config.disableDefaultDeny
|
|
106509
106598
|
});
|
|
@@ -106573,8 +106662,11 @@ var init_bashPermissions = __esm({
|
|
|
106573
106662
|
console.log(`[BashPermissions] Checking simple command: "${command}"`);
|
|
106574
106663
|
console.log(`[BashPermissions] Parsed: ${parsed.command} with args: [${parsed.args.join(", ")}]`);
|
|
106575
106664
|
}
|
|
106576
|
-
if (matchesAnyPattern(parsed, this.
|
|
106577
|
-
const matchedPatterns = this.
|
|
106665
|
+
if (matchesAnyPattern(parsed, this.customDenyPatterns)) {
|
|
106666
|
+
const matchedPatterns = this.customDenyPatterns.filter((pattern) => matchesPattern(parsed, pattern));
|
|
106667
|
+
if (this.debug) {
|
|
106668
|
+
console.log(`[BashPermissions] DENIED - matches custom deny pattern: ${matchedPatterns[0]}`);
|
|
106669
|
+
}
|
|
106578
106670
|
const result2 = {
|
|
106579
106671
|
allowed: false,
|
|
106580
106672
|
reason: `Command matches deny pattern: ${matchedPatterns[0]}`,
|
|
@@ -106587,7 +106679,31 @@ var init_bashPermissions = __esm({
|
|
|
106587
106679
|
parsedCommand: parsed.command,
|
|
106588
106680
|
reason: "matches_deny_pattern",
|
|
106589
106681
|
matchedPattern: matchedPatterns[0],
|
|
106590
|
-
isComplex: false
|
|
106682
|
+
isComplex: false,
|
|
106683
|
+
isCustomDeny: true
|
|
106684
|
+
});
|
|
106685
|
+
return result2;
|
|
106686
|
+
}
|
|
106687
|
+
const matchesCustomAllow = matchesAnyPattern(parsed, this.customAllowPatterns);
|
|
106688
|
+
if (!matchesCustomAllow && matchesAnyPattern(parsed, this.defaultDenyPatterns)) {
|
|
106689
|
+
const matchedPatterns = this.defaultDenyPatterns.filter((pattern) => matchesPattern(parsed, pattern));
|
|
106690
|
+
if (this.debug) {
|
|
106691
|
+
console.log(`[BashPermissions] DENIED - matches default deny pattern: ${matchedPatterns[0]}`);
|
|
106692
|
+
}
|
|
106693
|
+
const result2 = {
|
|
106694
|
+
allowed: false,
|
|
106695
|
+
reason: `Command matches deny pattern: ${matchedPatterns[0]}`,
|
|
106696
|
+
command,
|
|
106697
|
+
parsed,
|
|
106698
|
+
matchedPatterns
|
|
106699
|
+
};
|
|
106700
|
+
this.recordBashEvent("permission.denied", {
|
|
106701
|
+
command,
|
|
106702
|
+
parsedCommand: parsed.command,
|
|
106703
|
+
reason: "matches_deny_pattern",
|
|
106704
|
+
matchedPattern: matchedPatterns[0],
|
|
106705
|
+
isComplex: false,
|
|
106706
|
+
isCustomDeny: false
|
|
106591
106707
|
});
|
|
106592
106708
|
return result2;
|
|
106593
106709
|
}
|
|
@@ -106612,15 +106728,21 @@ var init_bashPermissions = __esm({
|
|
|
106612
106728
|
allowed: true,
|
|
106613
106729
|
command,
|
|
106614
106730
|
parsed,
|
|
106615
|
-
isComplex: false
|
|
106731
|
+
isComplex: false,
|
|
106732
|
+
overriddenDeny: matchesCustomAllow && matchesAnyPattern(parsed, this.defaultDenyPatterns)
|
|
106616
106733
|
};
|
|
106617
106734
|
if (this.debug) {
|
|
106618
|
-
|
|
106735
|
+
if (result.overriddenDeny) {
|
|
106736
|
+
console.log(`[BashPermissions] ALLOWED - custom allow overrides default deny`);
|
|
106737
|
+
} else {
|
|
106738
|
+
console.log(`[BashPermissions] ALLOWED - command passed all checks`);
|
|
106739
|
+
}
|
|
106619
106740
|
}
|
|
106620
106741
|
this.recordBashEvent("permission.allowed", {
|
|
106621
106742
|
command,
|
|
106622
106743
|
parsedCommand: parsed.command,
|
|
106623
|
-
isComplex: false
|
|
106744
|
+
isComplex: false,
|
|
106745
|
+
overriddenDeny: result.overriddenDeny || false
|
|
106624
106746
|
});
|
|
106625
106747
|
return result;
|
|
106626
106748
|
}
|
|
@@ -106789,9 +106911,19 @@ var init_bashPermissions = __esm({
|
|
|
106789
106911
|
deniedReason = parsed.error || "Component contains nested complex constructs";
|
|
106790
106912
|
break;
|
|
106791
106913
|
}
|
|
106792
|
-
if (matchesAnyPattern(parsed, this.
|
|
106914
|
+
if (matchesAnyPattern(parsed, this.customDenyPatterns)) {
|
|
106915
|
+
if (this.debug) {
|
|
106916
|
+
console.log(`[BashPermissions] Component "${component}" matches custom deny pattern`);
|
|
106917
|
+
}
|
|
106918
|
+
allAllowed = false;
|
|
106919
|
+
deniedComponent = component;
|
|
106920
|
+
deniedReason = "Component matches deny pattern";
|
|
106921
|
+
break;
|
|
106922
|
+
}
|
|
106923
|
+
const componentMatchesCustomAllow = matchesAnyPattern(parsed, this.customAllowPatterns);
|
|
106924
|
+
if (!componentMatchesCustomAllow && matchesAnyPattern(parsed, this.defaultDenyPatterns)) {
|
|
106793
106925
|
if (this.debug) {
|
|
106794
|
-
console.log(`[BashPermissions] Component "${component}" matches deny pattern`);
|
|
106926
|
+
console.log(`[BashPermissions] Component "${component}" matches default deny pattern`);
|
|
106795
106927
|
}
|
|
106796
106928
|
allAllowed = false;
|
|
106797
106929
|
deniedComponent = component;
|
|
@@ -106871,6 +107003,10 @@ var init_bashPermissions = __esm({
|
|
|
106871
107003
|
return {
|
|
106872
107004
|
allowPatterns: this.allowPatterns.length,
|
|
106873
107005
|
denyPatterns: this.denyPatterns.length,
|
|
107006
|
+
customAllowPatterns: this.customAllowPatterns.length,
|
|
107007
|
+
customDenyPatterns: this.customDenyPatterns.length,
|
|
107008
|
+
defaultAllowPatterns: this.defaultAllowPatterns.length,
|
|
107009
|
+
defaultDenyPatterns: this.defaultDenyPatterns.length,
|
|
106874
107010
|
totalPatterns: this.allowPatterns.length + this.denyPatterns.length
|
|
106875
107011
|
};
|
|
106876
107012
|
}
|
|
@@ -107253,8 +107389,8 @@ Common reasons:
|
|
|
107253
107389
|
2. The command is not in the allow list (not a recognized safe command)
|
|
107254
107390
|
|
|
107255
107391
|
If you believe this command should be allowed, you can:
|
|
107256
|
-
- Use the --bash-allow option to add specific patterns
|
|
107257
|
-
|
|
107392
|
+
- Use the --bash-allow option to add specific patterns (overrides default deny list)
|
|
107393
|
+
Example: --bash-allow "git:push" allows git push while keeping all other deny rules
|
|
107258
107394
|
|
|
107259
107395
|
For code exploration, try these safe alternatives:
|
|
107260
107396
|
- ls, cat, head, tail for file operations
|
|
@@ -110278,7 +110414,7 @@ var init_ProbeAgent = __esm({
|
|
|
110278
110414
|
}
|
|
110279
110415
|
this.clientApiProvider = "claude-code";
|
|
110280
110416
|
this.provider = null;
|
|
110281
|
-
this.model = this.clientApiModel || "claude-
|
|
110417
|
+
this.model = this.clientApiModel || "claude-sonnet-4-6";
|
|
110282
110418
|
this.apiType = "claude-code";
|
|
110283
110419
|
} else if (codexAvailable) {
|
|
110284
110420
|
if (this.debug) {
|
|
@@ -110287,7 +110423,7 @@ var init_ProbeAgent = __esm({
|
|
|
110287
110423
|
}
|
|
110288
110424
|
this.clientApiProvider = "codex";
|
|
110289
110425
|
this.provider = null;
|
|
110290
|
-
this.model = this.clientApiModel || "gpt-
|
|
110426
|
+
this.model = this.clientApiModel || "gpt-5.2";
|
|
110291
110427
|
this.apiType = "codex";
|
|
110292
110428
|
} else {
|
|
110293
110429
|
throw new Error("No API key provided and neither claude nor codex command found. Please either:\n1. Set an API key: ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY, or AWS credentials\n2. Install claude command from https://docs.claude.com/en/docs/claude-code\n3. Install codex command from https://openai.com/codex");
|
|
@@ -110525,7 +110661,7 @@ var init_ProbeAgent = __esm({
|
|
|
110525
110661
|
}
|
|
110526
110662
|
if (this.clientApiProvider === "claude-code" || process.env.USE_CLAUDE_CODE === "true") {
|
|
110527
110663
|
this.provider = null;
|
|
110528
|
-
this.model = modelName || "claude-
|
|
110664
|
+
this.model = modelName || "claude-sonnet-4-6";
|
|
110529
110665
|
this.apiType = "claude-code";
|
|
110530
110666
|
if (this.debug) {
|
|
110531
110667
|
console.log("[DEBUG] Claude Code engine selected - will use built-in access if available");
|
|
@@ -110892,7 +111028,7 @@ var init_ProbeAgent = __esm({
|
|
|
110892
111028
|
apiKey,
|
|
110893
111029
|
...apiUrl && { baseURL: apiUrl }
|
|
110894
111030
|
});
|
|
110895
|
-
this.model = modelName || "claude-sonnet-4-
|
|
111031
|
+
this.model = modelName || "claude-sonnet-4-6";
|
|
110896
111032
|
this.apiType = "anthropic";
|
|
110897
111033
|
if (this.debug) {
|
|
110898
111034
|
console.log(`Using Anthropic API with model: ${this.model}${apiUrl ? ` (URL: ${apiUrl})` : ""}`);
|
|
@@ -110907,7 +111043,7 @@ var init_ProbeAgent = __esm({
|
|
|
110907
111043
|
apiKey,
|
|
110908
111044
|
...apiUrl && { baseURL: apiUrl }
|
|
110909
111045
|
});
|
|
110910
|
-
this.model = modelName || "gpt-5
|
|
111046
|
+
this.model = modelName || "gpt-5.2";
|
|
110911
111047
|
this.apiType = "openai";
|
|
110912
111048
|
if (this.debug) {
|
|
110913
111049
|
console.log(`Using OpenAI API with model: ${this.model}${apiUrl ? ` (URL: ${apiUrl})` : ""}`);
|
|
@@ -111011,7 +111147,7 @@ var init_ProbeAgent = __esm({
|
|
|
111011
111147
|
config.baseURL = baseURL;
|
|
111012
111148
|
}
|
|
111013
111149
|
this.provider = createAmazonBedrock(config);
|
|
111014
|
-
this.model = modelName || "anthropic.claude-sonnet-4-
|
|
111150
|
+
this.model = modelName || "anthropic.claude-sonnet-4-6";
|
|
111015
111151
|
this.apiType = "bedrock";
|
|
111016
111152
|
if (this.debug) {
|
|
111017
111153
|
const authMethod = apiKey ? "API Key" : "AWS Credentials";
|
|
@@ -111070,7 +111206,7 @@ var init_ProbeAgent = __esm({
|
|
|
111070
111206
|
allowedTools: this.allowedTools,
|
|
111071
111207
|
// Pass tool filtering configuration
|
|
111072
111208
|
model: this.model
|
|
111073
|
-
// Pass model name (e.g., gpt-
|
|
111209
|
+
// Pass model name (e.g., gpt-5.2, o3, etc.)
|
|
111074
111210
|
});
|
|
111075
111211
|
if (this.debug) {
|
|
111076
111212
|
console.log("[DEBUG] Using Codex CLI engine with Probe tools");
|
|
@@ -112166,8 +112302,8 @@ You are working with a workspace. Available paths: ${workspaceDesc}
|
|
|
112166
112302
|
let currentIteration = 0;
|
|
112167
112303
|
let completionAttempted = false;
|
|
112168
112304
|
let finalResult = "I was unable to complete your request due to reaching the maximum number of tool iterations.";
|
|
112169
|
-
const baseMaxIterations = this.maxIterations || MAX_TOOL_ITERATIONS;
|
|
112170
|
-
const maxIterations = options.schema ? baseMaxIterations + 4 : baseMaxIterations;
|
|
112305
|
+
const baseMaxIterations = options._maxIterationsOverride || this.maxIterations || MAX_TOOL_ITERATIONS;
|
|
112306
|
+
const maxIterations = options._maxIterationsOverride ? baseMaxIterations : options.schema ? baseMaxIterations + 4 : baseMaxIterations;
|
|
112171
112307
|
const isClaudeCode = this.clientApiProvider === "claude-code" || process.env.USE_CLAUDE_CODE === "true";
|
|
112172
112308
|
const isCodex = this.clientApiProvider === "codex" || process.env.USE_CODEX === "true";
|
|
112173
112309
|
if (isClaudeCode) {
|
|
@@ -112325,9 +112461,7 @@ You are working with a workspace. Available paths: ${workspaceDesc}
|
|
|
112325
112461
|
let maxResponseTokens = this.maxResponseTokens;
|
|
112326
112462
|
if (!maxResponseTokens) {
|
|
112327
112463
|
maxResponseTokens = 4e3;
|
|
112328
|
-
if (this.model && this.model.includes("opus") || this.model && this.model.includes("sonnet") || this.model && this.model.startsWith("gpt-4-")) {
|
|
112329
|
-
maxResponseTokens = 8192;
|
|
112330
|
-
} else if (this.model && this.model.startsWith("gpt-4o")) {
|
|
112464
|
+
if (this.model && this.model.includes("opus") || this.model && this.model.includes("sonnet") || this.model && this.model.startsWith("gpt-4") || this.model && this.model.startsWith("gpt-5")) {
|
|
112331
112465
|
maxResponseTokens = 8192;
|
|
112332
112466
|
} else if (this.model && this.model.startsWith("gemini")) {
|
|
112333
112467
|
maxResponseTokens = 32e3;
|
|
@@ -113404,13 +113538,16 @@ Convert your previous response content into actual JSON data that follows this s
|
|
|
113404
113538
|
options.schema,
|
|
113405
113539
|
0
|
|
113406
113540
|
);
|
|
113541
|
+
const { schema: _unusedSchema1, ...schemaDefCorrectionOptions } = options;
|
|
113407
113542
|
finalResult = await this.answer(schemaDefinitionPrompt, [], {
|
|
113408
|
-
...
|
|
113543
|
+
...schemaDefCorrectionOptions,
|
|
113409
113544
|
_schemaFormatted: true,
|
|
113410
113545
|
_skipValidation: true,
|
|
113411
113546
|
// Skip validation in recursive correction calls to prevent loops
|
|
113412
|
-
_completionPromptProcessed: true
|
|
113547
|
+
_completionPromptProcessed: true,
|
|
113413
113548
|
// Prevent cascading completion prompts in retry calls
|
|
113549
|
+
_maxIterationsOverride: 3
|
|
113550
|
+
// Correction should complete in 1-2 iterations (issue #447)
|
|
113414
113551
|
});
|
|
113415
113552
|
finalResult = cleanSchemaResponse(finalResult);
|
|
113416
113553
|
validation = validateJsonResponse(finalResult);
|
|
@@ -113458,15 +113595,18 @@ Convert your previous response content into actual JSON data that follows this s
|
|
|
113458
113595
|
retryCount
|
|
113459
113596
|
);
|
|
113460
113597
|
}
|
|
113598
|
+
const { schema: _unusedSchema2, ...correctionOptions } = options;
|
|
113461
113599
|
finalResult = await this.answer(correctionPrompt, [], {
|
|
113462
|
-
...
|
|
113600
|
+
...correctionOptions,
|
|
113463
113601
|
_schemaFormatted: true,
|
|
113464
113602
|
_skipValidation: true,
|
|
113465
113603
|
// Skip validation in recursive correction calls to prevent loops
|
|
113466
113604
|
_disableTools: true,
|
|
113467
113605
|
// Only allow attempt_completion - prevent AI from using search/query tools
|
|
113468
|
-
_completionPromptProcessed: true
|
|
113606
|
+
_completionPromptProcessed: true,
|
|
113469
113607
|
// Prevent cascading completion prompts in retry calls
|
|
113608
|
+
_maxIterationsOverride: 3
|
|
113609
|
+
// Correction should complete in 1-2 iterations (issue #447)
|
|
113470
113610
|
});
|
|
113471
113611
|
finalResult = cleanSchemaResponse(finalResult);
|
|
113472
113612
|
validation = validateJsonResponse(finalResult, { debug: this.debug });
|