@opencow-ai/opencow-agent-sdk 0.4.4 → 0.4.5
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/dist/cli.mjs +98 -82
- package/dist/client.js +73 -57
- package/dist/lib/toolInputNullCoercion.d.ts +7 -4
- package/dist/sdk.js +73 -57
- package/package.json +1 -1
package/dist/sdk.js
CHANGED
|
@@ -223806,26 +223806,41 @@ var init_permissionLogging = __esm(() => {
|
|
|
223806
223806
|
});
|
|
223807
223807
|
|
|
223808
223808
|
// src/lib/toolInputNullCoercion.ts
|
|
223809
|
-
function
|
|
223810
|
-
|
|
223811
|
-
|
|
223812
|
-
|
|
223813
|
-
|
|
223809
|
+
function containsNull(value) {
|
|
223810
|
+
if (value === null)
|
|
223811
|
+
return true;
|
|
223812
|
+
if (Array.isArray(value))
|
|
223813
|
+
return value.some(containsNull);
|
|
223814
|
+
if (typeof value === "object") {
|
|
223815
|
+
return Object.values(value).some(containsNull);
|
|
223814
223816
|
}
|
|
223815
|
-
return
|
|
223817
|
+
return false;
|
|
223818
|
+
}
|
|
223819
|
+
function deepOmitNullProps(value) {
|
|
223820
|
+
if (Array.isArray(value)) {
|
|
223821
|
+
return value.map(deepOmitNullProps);
|
|
223822
|
+
}
|
|
223823
|
+
if (value !== null && typeof value === "object") {
|
|
223824
|
+
const out = {};
|
|
223825
|
+
for (const [key, v] of Object.entries(value)) {
|
|
223826
|
+
if (v === null)
|
|
223827
|
+
continue;
|
|
223828
|
+
out[key] = deepOmitNullProps(v);
|
|
223829
|
+
}
|
|
223830
|
+
return out;
|
|
223831
|
+
}
|
|
223832
|
+
return value;
|
|
223816
223833
|
}
|
|
223817
223834
|
function safeParseToolInputWithNullCoercion(schema, input) {
|
|
223818
223835
|
const first = schema.safeParse(input);
|
|
223819
223836
|
if (first.success)
|
|
223820
223837
|
return first;
|
|
223821
|
-
if (input === null || typeof input !== "object"
|
|
223838
|
+
if (input === null || typeof input !== "object") {
|
|
223822
223839
|
return first;
|
|
223823
223840
|
}
|
|
223824
|
-
|
|
223825
|
-
const hasNull = Object.values(record3).some((value) => value === null);
|
|
223826
|
-
if (!hasNull)
|
|
223841
|
+
if (!containsNull(input))
|
|
223827
223842
|
return first;
|
|
223828
|
-
const retry = schema.safeParse(
|
|
223843
|
+
const retry = schema.safeParse(deepOmitNullProps(input));
|
|
223829
223844
|
return retry.success ? retry : first;
|
|
223830
223845
|
}
|
|
223831
223846
|
|
|
@@ -243763,7 +243778,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
|
|
|
243763
243778
|
return {
|
|
243764
243779
|
behavior: "ask",
|
|
243765
243780
|
decisionReason: decisionReason2,
|
|
243766
|
-
message: createPermissionRequestMessage2(
|
|
243781
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
243767
243782
|
};
|
|
243768
243783
|
}
|
|
243769
243784
|
{
|
|
@@ -243789,7 +243804,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
|
|
|
243789
243804
|
return {
|
|
243790
243805
|
behavior: "ask",
|
|
243791
243806
|
decisionReason: decisionReason2,
|
|
243792
|
-
message: createPermissionRequestMessage2(
|
|
243807
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
243793
243808
|
};
|
|
243794
243809
|
}
|
|
243795
243810
|
}
|
|
@@ -243839,7 +243854,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
|
|
|
243839
243854
|
};
|
|
243840
243855
|
return {
|
|
243841
243856
|
behavior: "ask",
|
|
243842
|
-
message: createPermissionRequestMessage2(
|
|
243857
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
243843
243858
|
decisionReason,
|
|
243844
243859
|
suggestions: suggestions.length > 0 ? suggestions : undefined
|
|
243845
243860
|
};
|
|
@@ -243869,7 +243884,7 @@ async function bashToolCheckCommandOperatorPermissions(input, bashToolHasPermiss
|
|
|
243869
243884
|
};
|
|
243870
243885
|
return {
|
|
243871
243886
|
behavior: "ask",
|
|
243872
|
-
message: createPermissionRequestMessage2(
|
|
243887
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
243873
243888
|
decisionReason
|
|
243874
243889
|
};
|
|
243875
243890
|
}
|
|
@@ -246591,21 +246606,21 @@ function getSimpleCommandPrefix(command) {
|
|
|
246591
246606
|
function suggestionForExactCommand2(command) {
|
|
246592
246607
|
const heredocPrefix = extractPrefixBeforeHeredoc(command);
|
|
246593
246608
|
if (heredocPrefix) {
|
|
246594
|
-
return suggestionForPrefix(
|
|
246609
|
+
return suggestionForPrefix(BashTool.name, heredocPrefix);
|
|
246595
246610
|
}
|
|
246596
246611
|
if (command.includes(`
|
|
246597
246612
|
`)) {
|
|
246598
246613
|
const firstLine = command.split(`
|
|
246599
246614
|
`)[0].trim();
|
|
246600
246615
|
if (firstLine) {
|
|
246601
|
-
return suggestionForPrefix(
|
|
246616
|
+
return suggestionForPrefix(BashTool.name, firstLine);
|
|
246602
246617
|
}
|
|
246603
246618
|
}
|
|
246604
246619
|
const prefix = getSimpleCommandPrefix(command);
|
|
246605
246620
|
if (prefix) {
|
|
246606
|
-
return suggestionForPrefix(
|
|
246621
|
+
return suggestionForPrefix(BashTool.name, prefix);
|
|
246607
246622
|
}
|
|
246608
|
-
return suggestionForExactCommand(
|
|
246623
|
+
return suggestionForExactCommand(BashTool.name, command);
|
|
246609
246624
|
}
|
|
246610
246625
|
function extractPrefixBeforeHeredoc(command) {
|
|
246611
246626
|
if (!command.includes("<<"))
|
|
@@ -246634,7 +246649,7 @@ function extractPrefixBeforeHeredoc(command) {
|
|
|
246634
246649
|
return tokens.slice(i3, i3 + 2).join(" ") || null;
|
|
246635
246650
|
}
|
|
246636
246651
|
function suggestionForPrefix2(prefix) {
|
|
246637
|
-
return suggestionForPrefix(
|
|
246652
|
+
return suggestionForPrefix(BashTool.name, prefix);
|
|
246638
246653
|
}
|
|
246639
246654
|
function matchWildcardPattern2(pattern, command) {
|
|
246640
246655
|
return matchWildcardPattern(pattern, command);
|
|
@@ -246785,11 +246800,11 @@ function filterRulesByContentsMatchingInput(input, rules, matchMode, {
|
|
|
246785
246800
|
}).map(([, rule]) => rule);
|
|
246786
246801
|
}
|
|
246787
246802
|
function matchingRulesForInput(input, toolPermissionContext, matchMode, { skipCompoundCheck = false } = {}) {
|
|
246788
|
-
const denyRuleByContents = getRuleByContentsForTool(toolPermissionContext,
|
|
246803
|
+
const denyRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "deny");
|
|
246789
246804
|
const matchingDenyRules = filterRulesByContentsMatchingInput(input, denyRuleByContents, matchMode, { stripAllEnvVars: true, skipCompoundCheck: true });
|
|
246790
|
-
const askRuleByContents = getRuleByContentsForTool(toolPermissionContext,
|
|
246805
|
+
const askRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "ask");
|
|
246791
246806
|
const matchingAskRules = filterRulesByContentsMatchingInput(input, askRuleByContents, matchMode, { stripAllEnvVars: true, skipCompoundCheck: true });
|
|
246792
|
-
const allowRuleByContents = getRuleByContentsForTool(toolPermissionContext,
|
|
246807
|
+
const allowRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "allow");
|
|
246793
246808
|
const matchingAllowRules = filterRulesByContentsMatchingInput(input, allowRuleByContents, matchMode, { skipCompoundCheck });
|
|
246794
246809
|
return {
|
|
246795
246810
|
matchingDenyRules,
|
|
@@ -246815,7 +246830,7 @@ async function checkCommandAndSuggestRules(input, toolPermissionContext, command
|
|
|
246815
246830
|
};
|
|
246816
246831
|
return {
|
|
246817
246832
|
behavior: "ask",
|
|
246818
|
-
message: createPermissionRequestMessage2(
|
|
246833
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
246819
246834
|
decisionReason,
|
|
246820
246835
|
suggestions: []
|
|
246821
246836
|
};
|
|
@@ -246836,7 +246851,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
|
|
|
246836
246851
|
if (matchingDenyRules[0] !== undefined) {
|
|
246837
246852
|
return {
|
|
246838
246853
|
behavior: "deny",
|
|
246839
|
-
message: `Permission to use ${
|
|
246854
|
+
message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
|
|
246840
246855
|
decisionReason: {
|
|
246841
246856
|
type: "rule",
|
|
246842
246857
|
rule: matchingDenyRules[0]
|
|
@@ -246851,7 +246866,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
|
|
|
246851
246866
|
if (subResult.matchingDenyRules[0] !== undefined) {
|
|
246852
246867
|
return {
|
|
246853
246868
|
behavior: "deny",
|
|
246854
|
-
message: `Permission to use ${
|
|
246869
|
+
message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
|
|
246855
246870
|
decisionReason: {
|
|
246856
246871
|
type: "rule",
|
|
246857
246872
|
rule: subResult.matchingDenyRules[0]
|
|
@@ -246863,7 +246878,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
|
|
|
246863
246878
|
if (firstAskRule) {
|
|
246864
246879
|
return {
|
|
246865
246880
|
behavior: "ask",
|
|
246866
|
-
message: createPermissionRequestMessage2(
|
|
246881
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
246867
246882
|
decisionReason: {
|
|
246868
246883
|
type: "rule",
|
|
246869
246884
|
rule: firstAskRule
|
|
@@ -246874,7 +246889,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
|
|
|
246874
246889
|
if (matchingAskRules[0] !== undefined) {
|
|
246875
246890
|
return {
|
|
246876
246891
|
behavior: "ask",
|
|
246877
|
-
message: createPermissionRequestMessage2(
|
|
246892
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
246878
246893
|
decisionReason: {
|
|
246879
246894
|
type: "rule",
|
|
246880
246895
|
rule: matchingAskRules[0]
|
|
@@ -246911,7 +246926,7 @@ function checkEarlyExitDeny(input, toolPermissionContext) {
|
|
|
246911
246926
|
if (denyMatch !== undefined) {
|
|
246912
246927
|
return {
|
|
246913
246928
|
behavior: "deny",
|
|
246914
|
-
message: `Permission to use ${
|
|
246929
|
+
message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
|
|
246915
246930
|
decisionReason: { type: "rule", rule: denyMatch }
|
|
246916
246931
|
};
|
|
246917
246932
|
}
|
|
@@ -246926,7 +246941,7 @@ function checkSemanticsDeny(input, toolPermissionContext, commands) {
|
|
|
246926
246941
|
if (subDeny !== undefined) {
|
|
246927
246942
|
return {
|
|
246928
246943
|
behavior: "deny",
|
|
246929
|
-
message: `Permission to use ${
|
|
246944
|
+
message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
|
|
246930
246945
|
decisionReason: { type: "rule", rule: subDeny }
|
|
246931
246946
|
};
|
|
246932
246947
|
}
|
|
@@ -246958,7 +246973,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
|
|
|
246958
246973
|
return {
|
|
246959
246974
|
behavior: "ask",
|
|
246960
246975
|
decisionReason: decisionReason2,
|
|
246961
|
-
message: createPermissionRequestMessage2(
|
|
246976
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
|
|
246962
246977
|
suggestions: [],
|
|
246963
246978
|
...{}
|
|
246964
246979
|
};
|
|
@@ -246976,7 +246991,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
|
|
|
246976
246991
|
return {
|
|
246977
246992
|
behavior: "ask",
|
|
246978
246993
|
decisionReason: decisionReason2,
|
|
246979
|
-
message: createPermissionRequestMessage2(
|
|
246994
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
|
|
246980
246995
|
suggestions: []
|
|
246981
246996
|
};
|
|
246982
246997
|
}
|
|
@@ -246995,7 +247010,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
|
|
|
246995
247010
|
return {
|
|
246996
247011
|
behavior: "ask",
|
|
246997
247012
|
decisionReason: decisionReason2,
|
|
246998
|
-
message: createPermissionRequestMessage2(
|
|
247013
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
246999
247014
|
};
|
|
247000
247015
|
}
|
|
247001
247016
|
}
|
|
@@ -247051,7 +247066,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
|
|
|
247051
247066
|
}
|
|
247052
247067
|
return {
|
|
247053
247068
|
behavior: "ask",
|
|
247054
|
-
message: createPermissionRequestMessage2(
|
|
247069
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
247055
247070
|
decisionReason: {
|
|
247056
247071
|
type: "other",
|
|
247057
247072
|
reason: `Required by Bash prompt rule: "${askResult.matchedDescription}"`
|
|
@@ -247070,7 +247085,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
|
|
|
247070
247085
|
appState = context3.getAppState();
|
|
247071
247086
|
return {
|
|
247072
247087
|
behavior: "ask",
|
|
247073
|
-
message: createPermissionRequestMessage2(
|
|
247088
|
+
message: createPermissionRequestMessage2(BashTool.name, {
|
|
247074
247089
|
type: "other",
|
|
247075
247090
|
reason: safetyResult.message ?? "Command contains patterns that require approval"
|
|
247076
247091
|
}),
|
|
@@ -247113,7 +247128,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
|
|
|
247113
247128
|
};
|
|
247114
247129
|
return {
|
|
247115
247130
|
behavior: "ask",
|
|
247116
|
-
message: createPermissionRequestMessage2(
|
|
247131
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
|
|
247117
247132
|
decisionReason: decisionReason2,
|
|
247118
247133
|
suggestions: [],
|
|
247119
247134
|
...{}
|
|
@@ -247133,7 +247148,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
|
|
|
247133
247148
|
};
|
|
247134
247149
|
return {
|
|
247135
247150
|
behavior: "ask",
|
|
247136
|
-
message: createPermissionRequestMessage2(
|
|
247151
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
|
|
247137
247152
|
decisionReason: decisionReason2
|
|
247138
247153
|
};
|
|
247139
247154
|
}
|
|
@@ -247146,7 +247161,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
|
|
|
247146
247161
|
return {
|
|
247147
247162
|
behavior: "ask",
|
|
247148
247163
|
decisionReason: decisionReason2,
|
|
247149
|
-
message: createPermissionRequestMessage2(
|
|
247164
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
247150
247165
|
};
|
|
247151
247166
|
}
|
|
247152
247167
|
const compoundCommandHasCd = cdCommands.length > 0;
|
|
@@ -247160,7 +247175,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
|
|
|
247160
247175
|
return {
|
|
247161
247176
|
behavior: "ask",
|
|
247162
247177
|
decisionReason: decisionReason2,
|
|
247163
|
-
message: createPermissionRequestMessage2(
|
|
247178
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
247164
247179
|
};
|
|
247165
247180
|
}
|
|
247166
247181
|
}
|
|
@@ -247170,7 +247185,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
|
|
|
247170
247185
|
if (deniedSubresult !== undefined) {
|
|
247171
247186
|
return {
|
|
247172
247187
|
behavior: "deny",
|
|
247173
|
-
message: `Permission to use ${
|
|
247188
|
+
message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
|
|
247174
247189
|
decisionReason: {
|
|
247175
247190
|
type: "subcommandResults",
|
|
247176
247191
|
reasons: new Map(subcommandPermissionDecisions.map((result, i3) => [
|
|
@@ -247296,7 +247311,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
|
|
|
247296
247311
|
] : undefined;
|
|
247297
247312
|
return {
|
|
247298
247313
|
behavior: askSubresult !== undefined ? "ask" : "passthrough",
|
|
247299
|
-
message: createPermissionRequestMessage2(
|
|
247314
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
247300
247315
|
decisionReason,
|
|
247301
247316
|
suggestions: suggestedUpdates,
|
|
247302
247317
|
...{}
|
|
@@ -247337,7 +247352,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
247337
247352
|
if (matchingDenyRules[0] !== undefined) {
|
|
247338
247353
|
return {
|
|
247339
247354
|
behavior: "deny",
|
|
247340
|
-
message: `Permission to use ${
|
|
247355
|
+
message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
|
|
247341
247356
|
decisionReason: {
|
|
247342
247357
|
type: "rule",
|
|
247343
247358
|
rule: matchingDenyRules[0]
|
|
@@ -247347,7 +247362,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
247347
247362
|
if (matchingAskRules[0] !== undefined) {
|
|
247348
247363
|
return {
|
|
247349
247364
|
behavior: "ask",
|
|
247350
|
-
message: createPermissionRequestMessage2(
|
|
247365
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
247351
247366
|
decisionReason: {
|
|
247352
247367
|
type: "rule",
|
|
247353
247368
|
rule: matchingAskRules[0]
|
|
@@ -247370,7 +247385,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
247370
247385
|
};
|
|
247371
247386
|
return {
|
|
247372
247387
|
behavior: "passthrough",
|
|
247373
|
-
message: createPermissionRequestMessage2(
|
|
247388
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
247374
247389
|
decisionReason,
|
|
247375
247390
|
suggestions: suggestionForExactCommand2(command)
|
|
247376
247391
|
};
|
|
@@ -247386,7 +247401,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
247386
247401
|
if (matchingDenyRules[0] !== undefined) {
|
|
247387
247402
|
return {
|
|
247388
247403
|
behavior: "deny",
|
|
247389
|
-
message: `Permission to use ${
|
|
247404
|
+
message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
|
|
247390
247405
|
decisionReason: {
|
|
247391
247406
|
type: "rule",
|
|
247392
247407
|
rule: matchingDenyRules[0]
|
|
@@ -247396,7 +247411,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
247396
247411
|
if (matchingAskRules[0] !== undefined) {
|
|
247397
247412
|
return {
|
|
247398
247413
|
behavior: "ask",
|
|
247399
|
-
message: createPermissionRequestMessage2(
|
|
247414
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
247400
247415
|
decisionReason: {
|
|
247401
247416
|
type: "rule",
|
|
247402
247417
|
rule: matchingAskRules[0]
|
|
@@ -247428,7 +247443,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
247428
247443
|
if (modeResult.behavior !== "passthrough") {
|
|
247429
247444
|
return modeResult;
|
|
247430
247445
|
}
|
|
247431
|
-
if (
|
|
247446
|
+
if (BashTool.isReadOnly(input)) {
|
|
247432
247447
|
return {
|
|
247433
247448
|
behavior: "allow",
|
|
247434
247449
|
updatedInput: input,
|
|
@@ -247444,7 +247459,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
247444
247459
|
};
|
|
247445
247460
|
return {
|
|
247446
247461
|
behavior: "passthrough",
|
|
247447
|
-
message: createPermissionRequestMessage2(
|
|
247462
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
247448
247463
|
decisionReason,
|
|
247449
247464
|
suggestions: suggestionForExactCommand2(command)
|
|
247450
247465
|
};
|
|
@@ -256617,7 +256632,7 @@ function getReplPrimitiveTools() {
|
|
|
256617
256632
|
FileEditTool,
|
|
256618
256633
|
GlobTool,
|
|
256619
256634
|
GrepTool,
|
|
256620
|
-
|
|
256635
|
+
BashTool,
|
|
256621
256636
|
NotebookEditTool,
|
|
256622
256637
|
AgentTool
|
|
256623
256638
|
];
|
|
@@ -258856,7 +258871,7 @@ async function* runShellCommand({
|
|
|
258856
258871
|
}
|
|
258857
258872
|
}
|
|
258858
258873
|
var fileEditUserFacingName, getBackgroundHintJSX2, renderToolResultMessage9, renderToolUseErrorMessage7, renderToolUseMessage9, renderToolUseProgressMessage3, renderToolUseQueuedMessage, EOL = `
|
|
258859
|
-
`, PROGRESS_THRESHOLD_MS2 = 2000, ASSISTANT_BLOCKING_BUDGET_MS = 15000, BASH_SEARCH_COMMANDS, BASH_READ_COMMANDS, BASH_LIST_COMMANDS, BASH_SEMANTIC_NEUTRAL_COMMANDS, BASH_SILENT_COMMANDS, DISALLOWED_AUTO_BACKGROUND_COMMANDS, isBackgroundTasksDisabled2, fullInputSchema2, inputSchema12, COMMON_BACKGROUND_COMMANDS, outputSchema11,
|
|
258874
|
+
`, PROGRESS_THRESHOLD_MS2 = 2000, ASSISTANT_BLOCKING_BUDGET_MS = 15000, BASH_SEARCH_COMMANDS, BASH_READ_COMMANDS, BASH_LIST_COMMANDS, BASH_SEMANTIC_NEUTRAL_COMMANDS, BASH_SILENT_COMMANDS, DISALLOWED_AUTO_BACKGROUND_COMMANDS, isBackgroundTasksDisabled2, fullInputSchema2, inputSchema12, COMMON_BACKGROUND_COMMANDS, outputSchema11, BashTool;
|
|
258860
258875
|
var init_BashTool = __esm(() => {
|
|
258861
258876
|
init_v4();
|
|
258862
258877
|
init_state();
|
|
@@ -258979,7 +258994,7 @@ For commands that are harder to parse at a glance (piped commands, obscure flags
|
|
|
258979
258994
|
persistedOutputPath: exports_external2.string().optional().describe("Path to the persisted full output in tool-results dir (set when output is too large for inline)"),
|
|
258980
258995
|
persistedOutputSize: exports_external2.number().optional().describe("Total size of the output in bytes (set when output is too large for inline)")
|
|
258981
258996
|
}));
|
|
258982
|
-
|
|
258997
|
+
BashTool = buildToolRuntime({
|
|
258983
258998
|
name: BASH_TOOL_NAME2,
|
|
258984
258999
|
searchHint: "execute shell commands",
|
|
258985
259000
|
maxResultSizeChars: 30000,
|
|
@@ -265347,7 +265362,7 @@ var init_PowerShellTool = __esm(() => {
|
|
|
265347
265362
|
import { randomUUID as randomUUID8 } from "crypto";
|
|
265348
265363
|
async function executeShellCommandsInPrompt(text, context3, slashCommandName, shell) {
|
|
265349
265364
|
let result = text;
|
|
265350
|
-
const shellTool = shell === "powershell" && isPowerShellToolEnabled() ? getPowerShellTool() :
|
|
265365
|
+
const shellTool = shell === "powershell" && isPowerShellToolEnabled() ? getPowerShellTool() : BashTool;
|
|
265351
265366
|
const blockMatches = text.matchAll(BLOCK_PATTERN);
|
|
265352
265367
|
const inlineMatches = text.includes("!`") ? text.matchAll(INLINE_PATTERN) : [];
|
|
265353
265368
|
await Promise.all([...blockMatches, ...inlineMatches].map(async (match) => {
|
|
@@ -282256,7 +282271,7 @@ function getAnthropicEnvMetadata() {
|
|
|
282256
282271
|
function getBuildAgeMinutes() {
|
|
282257
282272
|
if (false)
|
|
282258
282273
|
;
|
|
282259
|
-
const buildTime = new Date("2026-06-
|
|
282274
|
+
const buildTime = new Date("2026-06-03T12:46:47.435Z").getTime();
|
|
282260
282275
|
if (isNaN(buildTime))
|
|
282261
282276
|
return;
|
|
282262
282277
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -292669,8 +292684,8 @@ function normalizeToolInput(tool, input, agentId) {
|
|
|
292669
292684
|
persistFileSnapshotIfRemote();
|
|
292670
292685
|
return plan !== null ? { ...input, plan, planFilePath } : input;
|
|
292671
292686
|
}
|
|
292672
|
-
case
|
|
292673
|
-
const parsed =
|
|
292687
|
+
case BashTool.name: {
|
|
292688
|
+
const parsed = BashTool.inputSchema.parse(input);
|
|
292674
292689
|
const { command, timeout, description } = parsed;
|
|
292675
292690
|
const cwd = getCwd3();
|
|
292676
292691
|
let normalizedCommand = command.replace(`cd ${cwd} && `, "");
|
|
@@ -298760,6 +298775,7 @@ var init_messages4 = __esm(() => {
|
|
|
298760
298775
|
init_xml();
|
|
298761
298776
|
init_diagnostics2();
|
|
298762
298777
|
init_Tool();
|
|
298778
|
+
init_BashTool();
|
|
298763
298779
|
init_FileReadTool();
|
|
298764
298780
|
init_api3();
|
|
298765
298781
|
init_config3();
|
|
@@ -334726,7 +334742,7 @@ var getSendMessageTool = () => (init_SendMessageTool(), __toCommonJS(exports_Sen
|
|
|
334726
334742
|
function getSDKBuiltInTools() {
|
|
334727
334743
|
return [
|
|
334728
334744
|
AgentTool,
|
|
334729
|
-
|
|
334745
|
+
BashTool,
|
|
334730
334746
|
GlobTool,
|
|
334731
334747
|
GrepTool,
|
|
334732
334748
|
FileReadTool,
|
|
@@ -335436,4 +335452,4 @@ export {
|
|
|
335436
335452
|
AbortError2 as AbortError
|
|
335437
335453
|
};
|
|
335438
335454
|
|
|
335439
|
-
//# debugId=
|
|
335455
|
+
//# debugId=0D97A1D470E3660864756E2164756E21
|