@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/cli.mjs
CHANGED
|
@@ -94366,7 +94366,7 @@ function printStartupScreen() {
|
|
|
94366
94366
|
const sLen = ` ● ${sL} Ready — type /help to begin`.length;
|
|
94367
94367
|
out.push(boxRow(sRow, W2, sLen));
|
|
94368
94368
|
out.push(`${rgb(...BORDER)}╚${"═".repeat(W2 - 2)}╝${RESET}`);
|
|
94369
|
-
out.push(` ${DIM}${rgb(...DIMCOL)}opencow ${RESET}${rgb(...ACCENT)}v${"0.4.
|
|
94369
|
+
out.push(` ${DIM}${rgb(...DIMCOL)}opencow ${RESET}${rgb(...ACCENT)}v${"0.4.5"}${RESET}`);
|
|
94370
94370
|
out.push("");
|
|
94371
94371
|
process.stdout.write(out.join(`
|
|
94372
94372
|
`) + `
|
|
@@ -239649,26 +239649,41 @@ var init_permissionLogging = __esm(() => {
|
|
|
239649
239649
|
});
|
|
239650
239650
|
|
|
239651
239651
|
// src/lib/toolInputNullCoercion.ts
|
|
239652
|
-
function
|
|
239653
|
-
|
|
239654
|
-
|
|
239655
|
-
|
|
239656
|
-
|
|
239652
|
+
function containsNull(value) {
|
|
239653
|
+
if (value === null)
|
|
239654
|
+
return true;
|
|
239655
|
+
if (Array.isArray(value))
|
|
239656
|
+
return value.some(containsNull);
|
|
239657
|
+
if (typeof value === "object") {
|
|
239658
|
+
return Object.values(value).some(containsNull);
|
|
239657
239659
|
}
|
|
239658
|
-
return
|
|
239660
|
+
return false;
|
|
239661
|
+
}
|
|
239662
|
+
function deepOmitNullProps(value) {
|
|
239663
|
+
if (Array.isArray(value)) {
|
|
239664
|
+
return value.map(deepOmitNullProps);
|
|
239665
|
+
}
|
|
239666
|
+
if (value !== null && typeof value === "object") {
|
|
239667
|
+
const out = {};
|
|
239668
|
+
for (const [key, v] of Object.entries(value)) {
|
|
239669
|
+
if (v === null)
|
|
239670
|
+
continue;
|
|
239671
|
+
out[key] = deepOmitNullProps(v);
|
|
239672
|
+
}
|
|
239673
|
+
return out;
|
|
239674
|
+
}
|
|
239675
|
+
return value;
|
|
239659
239676
|
}
|
|
239660
239677
|
function safeParseToolInputWithNullCoercion(schema, input) {
|
|
239661
239678
|
const first = schema.safeParse(input);
|
|
239662
239679
|
if (first.success)
|
|
239663
239680
|
return first;
|
|
239664
|
-
if (input === null || typeof input !== "object"
|
|
239681
|
+
if (input === null || typeof input !== "object") {
|
|
239665
239682
|
return first;
|
|
239666
239683
|
}
|
|
239667
|
-
|
|
239668
|
-
const hasNull = Object.values(record3).some((value) => value === null);
|
|
239669
|
-
if (!hasNull)
|
|
239684
|
+
if (!containsNull(input))
|
|
239670
239685
|
return first;
|
|
239671
|
-
const retry = schema.safeParse(
|
|
239686
|
+
const retry = schema.safeParse(deepOmitNullProps(input));
|
|
239672
239687
|
return retry.success ? retry : first;
|
|
239673
239688
|
}
|
|
239674
239689
|
|
|
@@ -244160,7 +244175,7 @@ function getAnthropicEnvMetadata() {
|
|
|
244160
244175
|
function getBuildAgeMinutes() {
|
|
244161
244176
|
if (false)
|
|
244162
244177
|
;
|
|
244163
|
-
const buildTime = new Date("2026-06-
|
|
244178
|
+
const buildTime = new Date("2026-06-03T12:46:47.435Z").getTime();
|
|
244164
244179
|
if (isNaN(buildTime))
|
|
244165
244180
|
return;
|
|
244166
244181
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -257158,7 +257173,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
|
|
|
257158
257173
|
return {
|
|
257159
257174
|
behavior: "ask",
|
|
257160
257175
|
decisionReason: decisionReason2,
|
|
257161
|
-
message: createPermissionRequestMessage2(
|
|
257176
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
257162
257177
|
};
|
|
257163
257178
|
}
|
|
257164
257179
|
{
|
|
@@ -257184,7 +257199,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
|
|
|
257184
257199
|
return {
|
|
257185
257200
|
behavior: "ask",
|
|
257186
257201
|
decisionReason: decisionReason2,
|
|
257187
|
-
message: createPermissionRequestMessage2(
|
|
257202
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
257188
257203
|
};
|
|
257189
257204
|
}
|
|
257190
257205
|
}
|
|
@@ -257234,7 +257249,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
|
|
|
257234
257249
|
};
|
|
257235
257250
|
return {
|
|
257236
257251
|
behavior: "ask",
|
|
257237
|
-
message: createPermissionRequestMessage2(
|
|
257252
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
257238
257253
|
decisionReason,
|
|
257239
257254
|
suggestions: suggestions.length > 0 ? suggestions : undefined
|
|
257240
257255
|
};
|
|
@@ -257264,7 +257279,7 @@ async function bashToolCheckCommandOperatorPermissions(input, bashToolHasPermiss
|
|
|
257264
257279
|
};
|
|
257265
257280
|
return {
|
|
257266
257281
|
behavior: "ask",
|
|
257267
|
-
message: createPermissionRequestMessage2(
|
|
257282
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
257268
257283
|
decisionReason
|
|
257269
257284
|
};
|
|
257270
257285
|
}
|
|
@@ -260042,21 +260057,21 @@ function getFirstWordPrefix(command) {
|
|
|
260042
260057
|
function suggestionForExactCommand2(command) {
|
|
260043
260058
|
const heredocPrefix = extractPrefixBeforeHeredoc(command);
|
|
260044
260059
|
if (heredocPrefix) {
|
|
260045
|
-
return suggestionForPrefix(
|
|
260060
|
+
return suggestionForPrefix(BashTool.name, heredocPrefix);
|
|
260046
260061
|
}
|
|
260047
260062
|
if (command.includes(`
|
|
260048
260063
|
`)) {
|
|
260049
260064
|
const firstLine = command.split(`
|
|
260050
260065
|
`)[0].trim();
|
|
260051
260066
|
if (firstLine) {
|
|
260052
|
-
return suggestionForPrefix(
|
|
260067
|
+
return suggestionForPrefix(BashTool.name, firstLine);
|
|
260053
260068
|
}
|
|
260054
260069
|
}
|
|
260055
260070
|
const prefix = getSimpleCommandPrefix(command);
|
|
260056
260071
|
if (prefix) {
|
|
260057
|
-
return suggestionForPrefix(
|
|
260072
|
+
return suggestionForPrefix(BashTool.name, prefix);
|
|
260058
260073
|
}
|
|
260059
|
-
return suggestionForExactCommand(
|
|
260074
|
+
return suggestionForExactCommand(BashTool.name, command);
|
|
260060
260075
|
}
|
|
260061
260076
|
function extractPrefixBeforeHeredoc(command) {
|
|
260062
260077
|
if (!command.includes("<<"))
|
|
@@ -260085,7 +260100,7 @@ function extractPrefixBeforeHeredoc(command) {
|
|
|
260085
260100
|
return tokens.slice(i3, i3 + 2).join(" ") || null;
|
|
260086
260101
|
}
|
|
260087
260102
|
function suggestionForPrefix2(prefix) {
|
|
260088
|
-
return suggestionForPrefix(
|
|
260103
|
+
return suggestionForPrefix(BashTool.name, prefix);
|
|
260089
260104
|
}
|
|
260090
260105
|
function matchWildcardPattern2(pattern, command) {
|
|
260091
260106
|
return matchWildcardPattern(pattern, command);
|
|
@@ -260282,11 +260297,11 @@ function filterRulesByContentsMatchingInput(input, rules, matchMode, {
|
|
|
260282
260297
|
}).map(([, rule]) => rule);
|
|
260283
260298
|
}
|
|
260284
260299
|
function matchingRulesForInput(input, toolPermissionContext, matchMode, { skipCompoundCheck = false } = {}) {
|
|
260285
|
-
const denyRuleByContents = getRuleByContentsForTool(toolPermissionContext,
|
|
260300
|
+
const denyRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "deny");
|
|
260286
260301
|
const matchingDenyRules = filterRulesByContentsMatchingInput(input, denyRuleByContents, matchMode, { stripAllEnvVars: true, skipCompoundCheck: true });
|
|
260287
|
-
const askRuleByContents = getRuleByContentsForTool(toolPermissionContext,
|
|
260302
|
+
const askRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "ask");
|
|
260288
260303
|
const matchingAskRules = filterRulesByContentsMatchingInput(input, askRuleByContents, matchMode, { stripAllEnvVars: true, skipCompoundCheck: true });
|
|
260289
|
-
const allowRuleByContents = getRuleByContentsForTool(toolPermissionContext,
|
|
260304
|
+
const allowRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "allow");
|
|
260290
260305
|
const matchingAllowRules = filterRulesByContentsMatchingInput(input, allowRuleByContents, matchMode, { skipCompoundCheck });
|
|
260291
260306
|
return {
|
|
260292
260307
|
matchingDenyRules,
|
|
@@ -260312,7 +260327,7 @@ async function checkCommandAndSuggestRules(input, toolPermissionContext, command
|
|
|
260312
260327
|
};
|
|
260313
260328
|
return {
|
|
260314
260329
|
behavior: "ask",
|
|
260315
|
-
message: createPermissionRequestMessage2(
|
|
260330
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
260316
260331
|
decisionReason,
|
|
260317
260332
|
suggestions: []
|
|
260318
260333
|
};
|
|
@@ -260333,7 +260348,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
|
|
|
260333
260348
|
if (matchingDenyRules[0] !== undefined) {
|
|
260334
260349
|
return {
|
|
260335
260350
|
behavior: "deny",
|
|
260336
|
-
message: `Permission to use ${
|
|
260351
|
+
message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
|
|
260337
260352
|
decisionReason: {
|
|
260338
260353
|
type: "rule",
|
|
260339
260354
|
rule: matchingDenyRules[0]
|
|
@@ -260348,7 +260363,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
|
|
|
260348
260363
|
if (subResult.matchingDenyRules[0] !== undefined) {
|
|
260349
260364
|
return {
|
|
260350
260365
|
behavior: "deny",
|
|
260351
|
-
message: `Permission to use ${
|
|
260366
|
+
message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
|
|
260352
260367
|
decisionReason: {
|
|
260353
260368
|
type: "rule",
|
|
260354
260369
|
rule: subResult.matchingDenyRules[0]
|
|
@@ -260360,7 +260375,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
|
|
|
260360
260375
|
if (firstAskRule) {
|
|
260361
260376
|
return {
|
|
260362
260377
|
behavior: "ask",
|
|
260363
|
-
message: createPermissionRequestMessage2(
|
|
260378
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
260364
260379
|
decisionReason: {
|
|
260365
260380
|
type: "rule",
|
|
260366
260381
|
rule: firstAskRule
|
|
@@ -260371,7 +260386,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
|
|
|
260371
260386
|
if (matchingAskRules[0] !== undefined) {
|
|
260372
260387
|
return {
|
|
260373
260388
|
behavior: "ask",
|
|
260374
|
-
message: createPermissionRequestMessage2(
|
|
260389
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
260375
260390
|
decisionReason: {
|
|
260376
260391
|
type: "rule",
|
|
260377
260392
|
rule: matchingAskRules[0]
|
|
@@ -260408,7 +260423,7 @@ function checkEarlyExitDeny(input, toolPermissionContext) {
|
|
|
260408
260423
|
if (denyMatch !== undefined) {
|
|
260409
260424
|
return {
|
|
260410
260425
|
behavior: "deny",
|
|
260411
|
-
message: `Permission to use ${
|
|
260426
|
+
message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
|
|
260412
260427
|
decisionReason: { type: "rule", rule: denyMatch }
|
|
260413
260428
|
};
|
|
260414
260429
|
}
|
|
@@ -260423,7 +260438,7 @@ function checkSemanticsDeny(input, toolPermissionContext, commands) {
|
|
|
260423
260438
|
if (subDeny !== undefined) {
|
|
260424
260439
|
return {
|
|
260425
260440
|
behavior: "deny",
|
|
260426
|
-
message: `Permission to use ${
|
|
260441
|
+
message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
|
|
260427
260442
|
decisionReason: { type: "rule", rule: subDeny }
|
|
260428
260443
|
};
|
|
260429
260444
|
}
|
|
@@ -260513,7 +260528,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260513
260528
|
return {
|
|
260514
260529
|
behavior: "ask",
|
|
260515
260530
|
decisionReason: decisionReason2,
|
|
260516
|
-
message: createPermissionRequestMessage2(
|
|
260531
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
|
|
260517
260532
|
suggestions: [],
|
|
260518
260533
|
...{}
|
|
260519
260534
|
};
|
|
@@ -260531,7 +260546,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260531
260546
|
return {
|
|
260532
260547
|
behavior: "ask",
|
|
260533
260548
|
decisionReason: decisionReason2,
|
|
260534
|
-
message: createPermissionRequestMessage2(
|
|
260549
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
|
|
260535
260550
|
suggestions: []
|
|
260536
260551
|
};
|
|
260537
260552
|
}
|
|
@@ -260550,7 +260565,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260550
260565
|
return {
|
|
260551
260566
|
behavior: "ask",
|
|
260552
260567
|
decisionReason: decisionReason2,
|
|
260553
|
-
message: createPermissionRequestMessage2(
|
|
260568
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
260554
260569
|
};
|
|
260555
260570
|
}
|
|
260556
260571
|
}
|
|
@@ -260606,7 +260621,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260606
260621
|
}
|
|
260607
260622
|
return {
|
|
260608
260623
|
behavior: "ask",
|
|
260609
|
-
message: createPermissionRequestMessage2(
|
|
260624
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
260610
260625
|
decisionReason: {
|
|
260611
260626
|
type: "other",
|
|
260612
260627
|
reason: `Required by Bash prompt rule: "${askResult.matchedDescription}"`
|
|
@@ -260625,7 +260640,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260625
260640
|
appState = context4.getAppState();
|
|
260626
260641
|
return {
|
|
260627
260642
|
behavior: "ask",
|
|
260628
|
-
message: createPermissionRequestMessage2(
|
|
260643
|
+
message: createPermissionRequestMessage2(BashTool.name, {
|
|
260629
260644
|
type: "other",
|
|
260630
260645
|
reason: safetyResult.message ?? "Command contains patterns that require approval"
|
|
260631
260646
|
}),
|
|
@@ -260668,7 +260683,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260668
260683
|
};
|
|
260669
260684
|
return {
|
|
260670
260685
|
behavior: "ask",
|
|
260671
|
-
message: createPermissionRequestMessage2(
|
|
260686
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
|
|
260672
260687
|
decisionReason: decisionReason2,
|
|
260673
260688
|
suggestions: [],
|
|
260674
260689
|
...{}
|
|
@@ -260688,7 +260703,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260688
260703
|
};
|
|
260689
260704
|
return {
|
|
260690
260705
|
behavior: "ask",
|
|
260691
|
-
message: createPermissionRequestMessage2(
|
|
260706
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
|
|
260692
260707
|
decisionReason: decisionReason2
|
|
260693
260708
|
};
|
|
260694
260709
|
}
|
|
@@ -260701,7 +260716,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260701
260716
|
return {
|
|
260702
260717
|
behavior: "ask",
|
|
260703
260718
|
decisionReason: decisionReason2,
|
|
260704
|
-
message: createPermissionRequestMessage2(
|
|
260719
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
260705
260720
|
};
|
|
260706
260721
|
}
|
|
260707
260722
|
const compoundCommandHasCd = cdCommands.length > 0;
|
|
@@ -260715,7 +260730,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260715
260730
|
return {
|
|
260716
260731
|
behavior: "ask",
|
|
260717
260732
|
decisionReason: decisionReason2,
|
|
260718
|
-
message: createPermissionRequestMessage2(
|
|
260733
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
260719
260734
|
};
|
|
260720
260735
|
}
|
|
260721
260736
|
}
|
|
@@ -260725,7 +260740,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260725
260740
|
if (deniedSubresult !== undefined) {
|
|
260726
260741
|
return {
|
|
260727
260742
|
behavior: "deny",
|
|
260728
|
-
message: `Permission to use ${
|
|
260743
|
+
message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
|
|
260729
260744
|
decisionReason: {
|
|
260730
260745
|
type: "subcommandResults",
|
|
260731
260746
|
reasons: new Map(subcommandPermissionDecisions.map((result, i3) => [
|
|
@@ -260851,7 +260866,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260851
260866
|
] : undefined;
|
|
260852
260867
|
return {
|
|
260853
260868
|
behavior: askSubresult !== undefined ? "ask" : "passthrough",
|
|
260854
|
-
message: createPermissionRequestMessage2(
|
|
260869
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
260855
260870
|
decisionReason,
|
|
260856
260871
|
suggestions: suggestedUpdates,
|
|
260857
260872
|
...{}
|
|
@@ -260892,7 +260907,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260892
260907
|
if (matchingDenyRules[0] !== undefined) {
|
|
260893
260908
|
return {
|
|
260894
260909
|
behavior: "deny",
|
|
260895
|
-
message: `Permission to use ${
|
|
260910
|
+
message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
|
|
260896
260911
|
decisionReason: {
|
|
260897
260912
|
type: "rule",
|
|
260898
260913
|
rule: matchingDenyRules[0]
|
|
@@ -260902,7 +260917,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260902
260917
|
if (matchingAskRules[0] !== undefined) {
|
|
260903
260918
|
return {
|
|
260904
260919
|
behavior: "ask",
|
|
260905
|
-
message: createPermissionRequestMessage2(
|
|
260920
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
260906
260921
|
decisionReason: {
|
|
260907
260922
|
type: "rule",
|
|
260908
260923
|
rule: matchingAskRules[0]
|
|
@@ -260925,7 +260940,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260925
260940
|
};
|
|
260926
260941
|
return {
|
|
260927
260942
|
behavior: "passthrough",
|
|
260928
|
-
message: createPermissionRequestMessage2(
|
|
260943
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
260929
260944
|
decisionReason,
|
|
260930
260945
|
suggestions: suggestionForExactCommand2(command)
|
|
260931
260946
|
};
|
|
@@ -260941,7 +260956,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260941
260956
|
if (matchingDenyRules[0] !== undefined) {
|
|
260942
260957
|
return {
|
|
260943
260958
|
behavior: "deny",
|
|
260944
|
-
message: `Permission to use ${
|
|
260959
|
+
message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
|
|
260945
260960
|
decisionReason: {
|
|
260946
260961
|
type: "rule",
|
|
260947
260962
|
rule: matchingDenyRules[0]
|
|
@@ -260951,7 +260966,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260951
260966
|
if (matchingAskRules[0] !== undefined) {
|
|
260952
260967
|
return {
|
|
260953
260968
|
behavior: "ask",
|
|
260954
|
-
message: createPermissionRequestMessage2(
|
|
260969
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
260955
260970
|
decisionReason: {
|
|
260956
260971
|
type: "rule",
|
|
260957
260972
|
rule: matchingAskRules[0]
|
|
@@ -260983,7 +260998,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260983
260998
|
if (modeResult.behavior !== "passthrough") {
|
|
260984
260999
|
return modeResult;
|
|
260985
261000
|
}
|
|
260986
|
-
if (
|
|
261001
|
+
if (BashTool.isReadOnly(input)) {
|
|
260987
261002
|
return {
|
|
260988
261003
|
behavior: "allow",
|
|
260989
261004
|
updatedInput: input,
|
|
@@ -260999,7 +261014,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260999
261014
|
};
|
|
261000
261015
|
return {
|
|
261001
261016
|
behavior: "passthrough",
|
|
261002
|
-
message: createPermissionRequestMessage2(
|
|
261017
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
261003
261018
|
decisionReason,
|
|
261004
261019
|
suggestions: suggestionForExactCommand2(command)
|
|
261005
261020
|
};
|
|
@@ -273698,7 +273713,7 @@ function getReplPrimitiveTools() {
|
|
|
273698
273713
|
FileEditTool,
|
|
273699
273714
|
GlobTool,
|
|
273700
273715
|
GrepTool,
|
|
273701
|
-
|
|
273716
|
+
BashTool,
|
|
273702
273717
|
NotebookEditTool,
|
|
273703
273718
|
AgentTool
|
|
273704
273719
|
];
|
|
@@ -276982,7 +276997,7 @@ async function* runShellCommand({
|
|
|
276982
276997
|
}
|
|
276983
276998
|
}
|
|
276984
276999
|
var fileEditUserFacingName, getBackgroundHintJSX2, renderToolResultMessage10, renderToolUseErrorMessage8, renderToolUseMessage10, renderToolUseProgressMessage3, renderToolUseQueuedMessage, EOL = `
|
|
276985
|
-
`, 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, inputSchema13, COMMON_BACKGROUND_COMMANDS, outputSchema12,
|
|
277000
|
+
`, 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, inputSchema13, COMMON_BACKGROUND_COMMANDS, outputSchema12, BashTool;
|
|
276986
277001
|
var init_BashTool = __esm(() => {
|
|
276987
277002
|
init_v4();
|
|
276988
277003
|
init_state();
|
|
@@ -277105,7 +277120,7 @@ For commands that are harder to parse at a glance (piped commands, obscure flags
|
|
|
277105
277120
|
persistedOutputPath: exports_external.string().optional().describe("Path to the persisted full output in tool-results dir (set when output is too large for inline)"),
|
|
277106
277121
|
persistedOutputSize: exports_external.number().optional().describe("Total size of the output in bytes (set when output is too large for inline)")
|
|
277107
277122
|
}));
|
|
277108
|
-
|
|
277123
|
+
BashTool = buildToolRuntime({
|
|
277109
277124
|
name: BASH_TOOL_NAME2,
|
|
277110
277125
|
searchHint: "execute shell commands",
|
|
277111
277126
|
maxResultSizeChars: 30000,
|
|
@@ -283473,7 +283488,7 @@ var init_PowerShellTool = __esm(() => {
|
|
|
283473
283488
|
import { randomUUID as randomUUID14 } from "crypto";
|
|
283474
283489
|
async function executeShellCommandsInPrompt(text, context4, slashCommandName, shell) {
|
|
283475
283490
|
let result = text;
|
|
283476
|
-
const shellTool = shell === "powershell" && isPowerShellToolEnabled() ? getPowerShellTool() :
|
|
283491
|
+
const shellTool = shell === "powershell" && isPowerShellToolEnabled() ? getPowerShellTool() : BashTool;
|
|
283477
283492
|
const blockMatches = text.matchAll(BLOCK_PATTERN);
|
|
283478
283493
|
const inlineMatches = text.includes("!`") ? text.matchAll(INLINE_PATTERN) : [];
|
|
283479
283494
|
await Promise.all([...blockMatches, ...inlineMatches].map(async (match) => {
|
|
@@ -306573,8 +306588,8 @@ function normalizeToolInput(tool, input, agentId) {
|
|
|
306573
306588
|
persistFileSnapshotIfRemote();
|
|
306574
306589
|
return plan !== null ? { ...input, plan, planFilePath } : input;
|
|
306575
306590
|
}
|
|
306576
|
-
case
|
|
306577
|
-
const parsed =
|
|
306591
|
+
case BashTool.name: {
|
|
306592
|
+
const parsed = BashTool.inputSchema.parse(input);
|
|
306578
306593
|
const { command, timeout, description } = parsed;
|
|
306579
306594
|
const cwd = getCwd3();
|
|
306580
306595
|
let normalizedCommand = command.replace(`cd ${cwd} && `, "");
|
|
@@ -314098,6 +314113,7 @@ var init_messages4 = __esm(() => {
|
|
|
314098
314113
|
init_xml();
|
|
314099
314114
|
init_diagnostics2();
|
|
314100
314115
|
init_Tool();
|
|
314116
|
+
init_BashTool();
|
|
314101
314117
|
init_FileReadTool();
|
|
314102
314118
|
init_api3();
|
|
314103
314119
|
init_config2();
|
|
@@ -411614,7 +411630,7 @@ function usePermissionRequestLogging(toolUseConfirm, unaryEvent) {
|
|
|
411614
411630
|
});
|
|
411615
411631
|
if (process.env.USER_TYPE === "ant") {
|
|
411616
411632
|
const permissionResult = toolUseConfirm.permissionResult;
|
|
411617
|
-
if (toolUseConfirm.tool.name ===
|
|
411633
|
+
if (toolUseConfirm.tool.name === BashTool.name && permissionResult.behavior === "ask" && !hasRules(permissionResult.suggestions)) {
|
|
411618
411634
|
logEvent("tengu_internal_tool_use_permission_request_no_always_allow", {
|
|
411619
411635
|
messageID: toolUseConfirm.assistantMessage.message.id,
|
|
411620
411636
|
toolName: sanitizeToolNameForAnalytics(toolUseConfirm.tool.name),
|
|
@@ -411626,8 +411642,8 @@ function usePermissionRequestLogging(toolUseConfirm, unaryEvent) {
|
|
|
411626
411642
|
}
|
|
411627
411643
|
}
|
|
411628
411644
|
if (process.env.USER_TYPE === "ant") {
|
|
411629
|
-
const parsedInput =
|
|
411630
|
-
if (toolUseConfirm.tool.name ===
|
|
411645
|
+
const parsedInput = BashTool.inputSchema.safeParse(toolUseConfirm.input);
|
|
411646
|
+
if (toolUseConfirm.tool.name === BashTool.name && toolUseConfirm.permissionResult.behavior === "ask" && parsedInput.success) {
|
|
411631
411647
|
let split = [parsedInput.data.command];
|
|
411632
411648
|
try {
|
|
411633
411649
|
split = splitCommand_DEPRECATED(parsedInput.data.command);
|
|
@@ -415716,7 +415732,7 @@ function SedEditPermissionRequestInner(t0) {
|
|
|
415716
415732
|
let t4;
|
|
415717
415733
|
if ($2[11] !== filePath || $2[12] !== newContent) {
|
|
415718
415734
|
t4 = (input) => {
|
|
415719
|
-
const parsed =
|
|
415735
|
+
const parsed = BashTool.inputSchema.parse(input);
|
|
415720
415736
|
return {
|
|
415721
415737
|
...parsed,
|
|
415722
415738
|
_simulatedSedEdit: {
|
|
@@ -416285,7 +416301,7 @@ function BashPermissionRequest(props) {
|
|
|
416285
416301
|
({
|
|
416286
416302
|
command,
|
|
416287
416303
|
description
|
|
416288
|
-
} =
|
|
416304
|
+
} = BashTool.inputSchema.parse(toolUseConfirm.input));
|
|
416289
416305
|
t0 = parseSedEditCommand(command);
|
|
416290
416306
|
$2[0] = toolUseConfirm.input;
|
|
416291
416307
|
$2[1] = command;
|
|
@@ -416403,7 +416419,7 @@ function BashPermissionRequestInner({
|
|
|
416403
416419
|
const isCompound = toolUseConfirm.permissionResult.decisionReason?.type === "subcommandResults";
|
|
416404
416420
|
const [editablePrefix, setEditablePrefix] = import_react115.useState(() => {
|
|
416405
416421
|
if (isCompound) {
|
|
416406
|
-
const backendBashRules = extractRules("suggestions" in toolUseConfirm.permissionResult ? toolUseConfirm.permissionResult.suggestions : undefined).filter((r) => r.toolName ===
|
|
416422
|
+
const backendBashRules = extractRules("suggestions" in toolUseConfirm.permissionResult ? toolUseConfirm.permissionResult.suggestions : undefined).filter((r) => r.toolName === BashTool.name && r.ruleContent);
|
|
416407
416423
|
return backendBashRules.length === 1 ? backendBashRules[0].ruleContent : undefined;
|
|
416408
416424
|
}
|
|
416409
416425
|
const two = getSimpleCommandPrefix(command);
|
|
@@ -416423,7 +416439,7 @@ function BashPermissionRequestInner({
|
|
|
416423
416439
|
if (isCompound)
|
|
416424
416440
|
return;
|
|
416425
416441
|
let cancelled = false;
|
|
416426
|
-
getCompoundCommandPrefixesStatic(command, (subcmd) =>
|
|
416442
|
+
getCompoundCommandPrefixesStatic(command, (subcmd) => BashTool.isReadOnly({
|
|
416427
416443
|
command: subcmd
|
|
416428
416444
|
})).then((prefixes) => {
|
|
416429
416445
|
if (cancelled || hasUserEditedPrefix.current)
|
|
@@ -416506,7 +416522,7 @@ function BashPermissionRequestInner({
|
|
|
416506
416522
|
const prefixUpdates = [{
|
|
416507
416523
|
type: "addRules",
|
|
416508
416524
|
rules: [{
|
|
416509
|
-
toolName:
|
|
416525
|
+
toolName: BashTool.name,
|
|
416510
416526
|
ruleContent: trimmedPrefix
|
|
416511
416527
|
}],
|
|
416512
416528
|
behavior: "allow",
|
|
@@ -416567,7 +416583,7 @@ function BashPermissionRequestInner({
|
|
|
416567
416583
|
children: [
|
|
416568
416584
|
/* @__PURE__ */ jsx_dev_runtime156.jsxDEV(ThemedText, {
|
|
416569
416585
|
dimColor: explainerState.visible,
|
|
416570
|
-
children:
|
|
416586
|
+
children: BashTool.renderToolUseMessage({
|
|
416571
416587
|
command,
|
|
416572
416588
|
description
|
|
416573
416589
|
}, {
|
|
@@ -423767,7 +423783,7 @@ function permissionComponentForTool(tool) {
|
|
|
423767
423783
|
return FileEditPermissionRequest;
|
|
423768
423784
|
case FileWriteTool:
|
|
423769
423785
|
return FileWritePermissionRequest;
|
|
423770
|
-
case
|
|
423786
|
+
case BashTool:
|
|
423771
423787
|
return BashPermissionRequest;
|
|
423772
423788
|
case PowerShellTool:
|
|
423773
423789
|
return PowerShellPermissionRequest;
|
|
@@ -479299,7 +479315,7 @@ function buildPrimarySection() {
|
|
|
479299
479315
|
}, undefined, false, undefined, this);
|
|
479300
479316
|
return [{
|
|
479301
479317
|
label: "Version",
|
|
479302
|
-
value: "0.4.
|
|
479318
|
+
value: "0.4.5"
|
|
479303
479319
|
}, {
|
|
479304
479320
|
label: "Session name",
|
|
479305
479321
|
value: nameValue
|
|
@@ -514020,7 +514036,7 @@ function PermissionRuleDescription(t0) {
|
|
|
514020
514036
|
ruleValue
|
|
514021
514037
|
} = t0;
|
|
514022
514038
|
switch (ruleValue.toolName) {
|
|
514023
|
-
case
|
|
514039
|
+
case BashTool.name: {
|
|
514024
514040
|
if (ruleValue.ruleContent) {
|
|
514025
514041
|
if (ruleValue.ruleContent.endsWith(":*")) {
|
|
514026
514042
|
let t1;
|
|
@@ -514423,7 +514439,7 @@ function PermissionRuleInput(t0) {
|
|
|
514423
514439
|
/* @__PURE__ */ jsx_dev_runtime365.jsxDEV(ThemedText, {
|
|
514424
514440
|
bold: true,
|
|
514425
514441
|
children: permissionRuleValueToString({
|
|
514426
|
-
toolName:
|
|
514442
|
+
toolName: BashTool.name,
|
|
514427
514443
|
ruleContent: "ls:*"
|
|
514428
514444
|
})
|
|
514429
514445
|
}, undefined, false, undefined, this)
|
|
@@ -529746,7 +529762,7 @@ function getToolBuckets() {
|
|
|
529746
529762
|
},
|
|
529747
529763
|
EXECUTION: {
|
|
529748
529764
|
name: "Execution tools",
|
|
529749
|
-
toolNames: new Set([
|
|
529765
|
+
toolNames: new Set([BashTool.name, undefined].filter((n2) => n2 !== undefined))
|
|
529750
529766
|
},
|
|
529751
529767
|
MCP: {
|
|
529752
529768
|
name: "MCP tools",
|
|
@@ -535617,7 +535633,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
535617
535633
|
var call58 = async () => {
|
|
535618
535634
|
return {
|
|
535619
535635
|
type: "text",
|
|
535620
|
-
value: `${"99.0.0"} (built ${"2026-06-
|
|
535636
|
+
value: `${"99.0.0"} (built ${"2026-06-03T12:46:47.435Z"})`
|
|
535621
535637
|
};
|
|
535622
535638
|
}, version2, version_default;
|
|
535623
535639
|
var init_version = __esm(() => {
|
|
@@ -549409,7 +549425,7 @@ function _cliGetAllBaseTools() {
|
|
|
549409
549425
|
return [
|
|
549410
549426
|
AgentTool,
|
|
549411
549427
|
..._embeddedUITools,
|
|
549412
|
-
|
|
549428
|
+
BashTool,
|
|
549413
549429
|
...hasEmbeddedSearchTools() ? [] : [GlobTool, GrepTool],
|
|
549414
549430
|
ExitPlanModeV2Tool,
|
|
549415
549431
|
FileReadTool,
|
|
@@ -555217,7 +555233,7 @@ function BashModeProgress(t0) {
|
|
|
555217
555233
|
elapsedTimeSeconds: progress.elapsedTimeSeconds,
|
|
555218
555234
|
totalLines: progress.totalLines,
|
|
555219
555235
|
verbose
|
|
555220
|
-
}, undefined, false, undefined, this) :
|
|
555236
|
+
}, undefined, false, undefined, this) : BashTool.renderToolUseProgressMessage?.([], {
|
|
555221
555237
|
verbose,
|
|
555222
555238
|
tools: [],
|
|
555223
555239
|
terminalSize: undefined
|
|
@@ -555297,11 +555313,11 @@ async function processBashCommand(inputString, precedingInputBlocks, attachmentM
|
|
|
555297
555313
|
if (usePowerShell) {
|
|
555298
555314
|
PowerShellTool2 = (init_PowerShellTool(), __toCommonJS(exports_PowerShellTool)).PowerShellTool;
|
|
555299
555315
|
}
|
|
555300
|
-
const shellTool = PowerShellTool2 ??
|
|
555316
|
+
const shellTool = PowerShellTool2 ?? BashTool;
|
|
555301
555317
|
const response = PowerShellTool2 ? await PowerShellTool2.call({
|
|
555302
555318
|
command: inputString,
|
|
555303
555319
|
dangerouslyDisableSandbox: true
|
|
555304
|
-
}, bashModeContext, undefined, undefined, onProgress) : await
|
|
555320
|
+
}, bashModeContext, undefined, undefined, onProgress) : await BashTool.call({
|
|
555305
555321
|
command: inputString,
|
|
555306
555322
|
dangerouslyDisableSandbox: true
|
|
555307
555323
|
}, bashModeContext, undefined, undefined, onProgress);
|
|
@@ -557727,7 +557743,7 @@ function WelcomeV2() {
|
|
|
557727
557743
|
dimColor: true,
|
|
557728
557744
|
children: [
|
|
557729
557745
|
"v",
|
|
557730
|
-
"0.4.
|
|
557746
|
+
"0.4.5",
|
|
557731
557747
|
" "
|
|
557732
557748
|
]
|
|
557733
557749
|
}, undefined, true, undefined, this)
|
|
@@ -557927,7 +557943,7 @@ function WelcomeV2() {
|
|
|
557927
557943
|
dimColor: true,
|
|
557928
557944
|
children: [
|
|
557929
557945
|
"v",
|
|
557930
|
-
"0.4.
|
|
557946
|
+
"0.4.5",
|
|
557931
557947
|
" "
|
|
557932
557948
|
]
|
|
557933
557949
|
}, undefined, true, undefined, this)
|
|
@@ -558153,7 +558169,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
558153
558169
|
dimColor: true,
|
|
558154
558170
|
children: [
|
|
558155
558171
|
"v",
|
|
558156
|
-
"0.4.
|
|
558172
|
+
"0.4.5",
|
|
558157
558173
|
" "
|
|
558158
558174
|
]
|
|
558159
558175
|
}, undefined, true, undefined, this);
|
|
@@ -558407,7 +558423,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
558407
558423
|
dimColor: true,
|
|
558408
558424
|
children: [
|
|
558409
558425
|
"v",
|
|
558410
|
-
"0.4.
|
|
558426
|
+
"0.4.5",
|
|
558411
558427
|
" "
|
|
558412
558428
|
]
|
|
558413
558429
|
}, undefined, true, undefined, this);
|
|
@@ -579253,7 +579269,7 @@ Usage: claude --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
579253
579269
|
pendingHookMessages
|
|
579254
579270
|
}, renderAndRun);
|
|
579255
579271
|
}
|
|
579256
|
-
}).version("0.4.
|
|
579272
|
+
}).version("0.4.5 (OpenCow)", "-v, --version", "Output the version number");
|
|
579257
579273
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
579258
579274
|
program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
579259
579275
|
if (canUserConfigureAdvisor()) {
|
|
@@ -579899,7 +579915,7 @@ if (false) {}
|
|
|
579899
579915
|
async function main2() {
|
|
579900
579916
|
const args = process.argv.slice(2);
|
|
579901
579917
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
579902
|
-
console.log(`${"0.4.
|
|
579918
|
+
console.log(`${"0.4.5"} (OpenCow)`);
|
|
579903
579919
|
return;
|
|
579904
579920
|
}
|
|
579905
579921
|
if (args.includes("--provider")) {
|
|
@@ -580017,4 +580033,4 @@ async function main2() {
|
|
|
580017
580033
|
}
|
|
580018
580034
|
main2();
|
|
580019
580035
|
|
|
580020
|
-
//# debugId=
|
|
580036
|
+
//# debugId=A32EDDBB8A04BA5B64756E2164756E21
|