@opencow-ai/opencow-agent-sdk 0.4.4 → 0.4.6
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 +232 -221
- package/dist/client.js +207 -196
- package/dist/lib/schemaSanitizer.d.ts +43 -0
- package/dist/lib/toolInputNullCoercion.d.ts +7 -4
- package/dist/providers/codex/shim.d.ts +1 -1
- package/dist/providers/openai/schema.d.ts +1 -1
- package/dist/providers/openai/wire.d.ts +1 -1
- package/dist/sdk.js +207 -196
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -84304,7 +84304,8 @@ function sanitizeSchemaForOpenAICompat(schema) {
|
|
|
84304
84304
|
}
|
|
84305
84305
|
}
|
|
84306
84306
|
if (Array.isArray(record2.required) && isSchemaRecord(record2.properties)) {
|
|
84307
|
-
|
|
84307
|
+
const properties = record2.properties;
|
|
84308
|
+
record2.required = record2.required.filter((value) => typeof value === "string" && (value in properties));
|
|
84308
84309
|
}
|
|
84309
84310
|
const schemaWithoutEnum = { ...record2 };
|
|
84310
84311
|
delete schemaWithoutEnum.enum;
|
|
@@ -84323,6 +84324,77 @@ function sanitizeSchemaForOpenAICompat(schema) {
|
|
|
84323
84324
|
}
|
|
84324
84325
|
return record2;
|
|
84325
84326
|
}
|
|
84327
|
+
function isEmptyStrictObject(schema) {
|
|
84328
|
+
if (schema.type !== "object" || schema.additionalProperties !== false) {
|
|
84329
|
+
return false;
|
|
84330
|
+
}
|
|
84331
|
+
const props = schema.properties;
|
|
84332
|
+
return !props || isSchemaRecord(props) && Object.keys(props).length === 0;
|
|
84333
|
+
}
|
|
84334
|
+
function strictifySchemaNode(schema, options, topLevel) {
|
|
84335
|
+
const {
|
|
84336
|
+
gemini = false,
|
|
84337
|
+
strict = true,
|
|
84338
|
+
stripUriFormat = false,
|
|
84339
|
+
dropEmptyObjectProperties = false,
|
|
84340
|
+
normalizeBareObjects = false
|
|
84341
|
+
} = options;
|
|
84342
|
+
let record2 = sanitizeSchemaForOpenAICompat(schema);
|
|
84343
|
+
if (gemini) {
|
|
84344
|
+
record2 = splitTypeArrayToAnyOf(record2);
|
|
84345
|
+
}
|
|
84346
|
+
if (stripUriFormat && record2.format === "uri") {
|
|
84347
|
+
delete record2.format;
|
|
84348
|
+
}
|
|
84349
|
+
if (record2.type === "object") {
|
|
84350
|
+
const props = isSchemaRecord(record2.properties) ? record2.properties : null;
|
|
84351
|
+
if (props) {
|
|
84352
|
+
const originalRequired = Array.isArray(record2.required) ? record2.required.filter((key) => typeof key === "string") : [];
|
|
84353
|
+
const enforcedProps = {};
|
|
84354
|
+
for (const [key, value] of Object.entries(props)) {
|
|
84355
|
+
const strictValue = strictifySchemaNode(value, options, false);
|
|
84356
|
+
if (dropEmptyObjectProperties && isEmptyStrictObject(strictValue)) {
|
|
84357
|
+
continue;
|
|
84358
|
+
}
|
|
84359
|
+
enforcedProps[key] = strictValue;
|
|
84360
|
+
}
|
|
84361
|
+
record2.properties = enforcedProps;
|
|
84362
|
+
if (strict) {
|
|
84363
|
+
record2.additionalProperties = false;
|
|
84364
|
+
record2.required = Object.keys(enforcedProps);
|
|
84365
|
+
if (topLevel) {
|
|
84366
|
+
const style = gemini ? "nullable" : "union";
|
|
84367
|
+
for (const key of Object.keys(enforcedProps)) {
|
|
84368
|
+
if (!originalRequired.includes(key)) {
|
|
84369
|
+
enforcedProps[key] = makeSchemaNullable(enforcedProps[key], style);
|
|
84370
|
+
}
|
|
84371
|
+
}
|
|
84372
|
+
}
|
|
84373
|
+
} else {
|
|
84374
|
+
record2.required = originalRequired.filter((key) => (key in enforcedProps));
|
|
84375
|
+
}
|
|
84376
|
+
} else if (normalizeBareObjects) {
|
|
84377
|
+
record2.additionalProperties = false;
|
|
84378
|
+
record2.required = [];
|
|
84379
|
+
}
|
|
84380
|
+
}
|
|
84381
|
+
if ("items" in record2) {
|
|
84382
|
+
if (Array.isArray(record2.items)) {
|
|
84383
|
+
record2.items = record2.items.map((item) => strictifySchemaNode(item, options, false));
|
|
84384
|
+
} else {
|
|
84385
|
+
record2.items = strictifySchemaNode(record2.items, options, false);
|
|
84386
|
+
}
|
|
84387
|
+
}
|
|
84388
|
+
for (const key of ["anyOf", "oneOf", "allOf"]) {
|
|
84389
|
+
if (key in record2 && Array.isArray(record2[key])) {
|
|
84390
|
+
record2[key] = record2[key].map((item) => strictifySchemaNode(item, options, false));
|
|
84391
|
+
}
|
|
84392
|
+
}
|
|
84393
|
+
return record2;
|
|
84394
|
+
}
|
|
84395
|
+
function strictifyJsonSchema(schema, options = {}) {
|
|
84396
|
+
return strictifySchemaNode(schema, options, true);
|
|
84397
|
+
}
|
|
84326
84398
|
var OPENAI_INCOMPATIBLE_SCHEMA_KEYWORDS;
|
|
84327
84399
|
var init_schemaSanitizer = __esm(() => {
|
|
84328
84400
|
OPENAI_INCOMPATIBLE_SCHEMA_KEYWORDS = new Set([
|
|
@@ -84351,6 +84423,51 @@ var init_schema = __esm(() => {
|
|
|
84351
84423
|
init_schemaSanitizer();
|
|
84352
84424
|
});
|
|
84353
84425
|
|
|
84426
|
+
// src/providers/openai/capabilities.ts
|
|
84427
|
+
function supportsReasoningEffort(model) {
|
|
84428
|
+
return /^(o\d|gpt-5|gpt-4\.5)/i.test(model);
|
|
84429
|
+
}
|
|
84430
|
+
function isGeminiLikeModel(model) {
|
|
84431
|
+
const normalized = (model ?? "").trim().toLowerCase();
|
|
84432
|
+
return normalized.startsWith("gemini-") || normalized.includes("/gemini-");
|
|
84433
|
+
}
|
|
84434
|
+
function isGeminiTarget(model) {
|
|
84435
|
+
if (isEnvTruthy(getQueryEnvVar("CLAUDE_CODE_USE_GEMINI")))
|
|
84436
|
+
return true;
|
|
84437
|
+
return isGeminiLikeModel(model);
|
|
84438
|
+
}
|
|
84439
|
+
function supportsParallelToolCalls(model) {
|
|
84440
|
+
return !isGeminiTarget(model);
|
|
84441
|
+
}
|
|
84442
|
+
function getOpenAICompatMaxOutputTokens(model) {
|
|
84443
|
+
const max = getOpenAIMaxOutputTokens(model);
|
|
84444
|
+
if (max === undefined)
|
|
84445
|
+
return null;
|
|
84446
|
+
return { default: max, upperLimit: max };
|
|
84447
|
+
}
|
|
84448
|
+
function getOpenAICompatContextWindow(model) {
|
|
84449
|
+
return getOpenAIContextWindow(model) ?? null;
|
|
84450
|
+
}
|
|
84451
|
+
function openAICompatSupports(feature, model) {
|
|
84452
|
+
if (feature === "reasoning-effort")
|
|
84453
|
+
return supportsReasoningEffort(model);
|
|
84454
|
+
if (feature === "parallel-tool-calls")
|
|
84455
|
+
return supportsParallelToolCalls(model);
|
|
84456
|
+
return FEATURES_OPENAI_COMPAT.includes(feature);
|
|
84457
|
+
}
|
|
84458
|
+
var FEATURES_OPENAI_COMPAT;
|
|
84459
|
+
var init_capabilities2 = __esm(() => {
|
|
84460
|
+
init_openaiContextWindows();
|
|
84461
|
+
init_envUtils();
|
|
84462
|
+
init_state2();
|
|
84463
|
+
FEATURES_OPENAI_COMPAT = Object.freeze([
|
|
84464
|
+
"streaming",
|
|
84465
|
+
"tool-use",
|
|
84466
|
+
"image-input",
|
|
84467
|
+
"system-message-top-level"
|
|
84468
|
+
]);
|
|
84469
|
+
});
|
|
84470
|
+
|
|
84354
84471
|
// src/providers/codex/shim.ts
|
|
84355
84472
|
function parseSseChunk(chunk) {
|
|
84356
84473
|
const lines = chunk.split(`
|
|
@@ -84593,58 +84710,23 @@ function convertAnthropicMessagesToResponsesInput(messages) {
|
|
|
84593
84710
|
}
|
|
84594
84711
|
return items.filter((item) => item.type !== "message" || item.content.length > 0);
|
|
84595
84712
|
}
|
|
84596
|
-
function
|
|
84597
|
-
|
|
84598
|
-
|
|
84599
|
-
|
|
84600
|
-
|
|
84601
|
-
|
|
84602
|
-
|
|
84603
|
-
|
|
84604
|
-
const props = record2.properties;
|
|
84605
|
-
const originalRequired = Array.isArray(record2.required) ? record2.required.filter((key) => typeof key === "string") : [];
|
|
84606
|
-
const enforcedProps = {};
|
|
84607
|
-
for (const [key, value] of Object.entries(props)) {
|
|
84608
|
-
const strictValue = enforceStrictSchema(value, false);
|
|
84609
|
-
if (strictValue && typeof strictValue === "object" && strictValue.type === "object" && strictValue.additionalProperties === false && (!strictValue.properties || Object.keys(strictValue.properties).length === 0)) {
|
|
84610
|
-
continue;
|
|
84611
|
-
}
|
|
84612
|
-
enforcedProps[key] = strictValue;
|
|
84613
|
-
}
|
|
84614
|
-
record2.properties = enforcedProps;
|
|
84615
|
-
record2.required = Object.keys(enforcedProps);
|
|
84616
|
-
if (topLevel) {
|
|
84617
|
-
for (const key of Object.keys(enforcedProps)) {
|
|
84618
|
-
if (!originalRequired.includes(key)) {
|
|
84619
|
-
enforcedProps[key] = makeSchemaNullable(enforcedProps[key]);
|
|
84620
|
-
}
|
|
84621
|
-
}
|
|
84622
|
-
}
|
|
84623
|
-
} else {
|
|
84624
|
-
record2.required = [];
|
|
84625
|
-
}
|
|
84626
|
-
}
|
|
84627
|
-
if ("items" in record2) {
|
|
84628
|
-
if (Array.isArray(record2.items)) {
|
|
84629
|
-
record2.items = record2.items.map((item) => enforceStrictSchema(item, false));
|
|
84630
|
-
} else {
|
|
84631
|
-
record2.items = enforceStrictSchema(record2.items, false);
|
|
84632
|
-
}
|
|
84633
|
-
}
|
|
84634
|
-
for (const key of ["anyOf", "oneOf", "allOf"]) {
|
|
84635
|
-
if (key in record2 && Array.isArray(record2[key])) {
|
|
84636
|
-
record2[key] = record2[key].map((item) => enforceStrictSchema(item, false));
|
|
84637
|
-
}
|
|
84638
|
-
}
|
|
84639
|
-
return record2;
|
|
84713
|
+
function toResponsesParameters(schema, geminiTarget) {
|
|
84714
|
+
return strictifyJsonSchema(schema, {
|
|
84715
|
+
strict: true,
|
|
84716
|
+
gemini: geminiTarget,
|
|
84717
|
+
stripUriFormat: true,
|
|
84718
|
+
dropEmptyObjectProperties: true,
|
|
84719
|
+
normalizeBareObjects: true
|
|
84720
|
+
});
|
|
84640
84721
|
}
|
|
84641
|
-
function convertToolsToResponsesTools(tools) {
|
|
84722
|
+
function convertToolsToResponsesTools(tools, model = "") {
|
|
84723
|
+
const geminiTarget = isGeminiTarget(model);
|
|
84642
84724
|
return tools.flatMap((tool) => {
|
|
84643
84725
|
if (tool.input_schema && (!tool.type || tool.type === "function")) {
|
|
84644
84726
|
if (!tool.name || tool.name === "ToolSearchTool")
|
|
84645
84727
|
return [];
|
|
84646
84728
|
const rawParameters = tool.input_schema ?? { type: "object", properties: {} };
|
|
84647
|
-
const parameters =
|
|
84729
|
+
const parameters = toResponsesParameters(rawParameters, geminiTarget);
|
|
84648
84730
|
return [
|
|
84649
84731
|
{
|
|
84650
84732
|
type: "function",
|
|
@@ -84659,7 +84741,7 @@ function convertToolsToResponsesTools(tools) {
|
|
|
84659
84741
|
return [tool];
|
|
84660
84742
|
}
|
|
84661
84743
|
if (tool.name && tool.name !== "ToolSearchTool" && (!tool.type || tool.type === "function")) {
|
|
84662
|
-
const parameters =
|
|
84744
|
+
const parameters = toResponsesParameters({ type: "object", properties: {} }, geminiTarget);
|
|
84663
84745
|
return [
|
|
84664
84746
|
{
|
|
84665
84747
|
type: "function",
|
|
@@ -84726,10 +84808,10 @@ async function performCodexRequest(options) {
|
|
|
84726
84808
|
body.tool_choice = toolChoice;
|
|
84727
84809
|
}
|
|
84728
84810
|
if (options.params.tools && options.params.tools.length > 0) {
|
|
84729
|
-
const convertedTools = convertToolsToResponsesTools(options.params.tools);
|
|
84811
|
+
const convertedTools = convertToolsToResponsesTools(options.params.tools, options.request.resolvedModel);
|
|
84730
84812
|
if (convertedTools.length > 0) {
|
|
84731
84813
|
body.tools = convertedTools;
|
|
84732
|
-
body.parallel_tool_calls =
|
|
84814
|
+
body.parallel_tool_calls = !isGeminiTarget(options.request.resolvedModel);
|
|
84733
84815
|
body.tool_choice ??= "auto";
|
|
84734
84816
|
}
|
|
84735
84817
|
}
|
|
@@ -85099,51 +85181,7 @@ function convertCodexResponseToAnthropicMessage(data, model) {
|
|
|
85099
85181
|
var init_shim = __esm(() => {
|
|
85100
85182
|
init_sdk();
|
|
85101
85183
|
init_schema();
|
|
85102
|
-
|
|
85103
|
-
|
|
85104
|
-
// src/providers/openai/capabilities.ts
|
|
85105
|
-
function supportsReasoningEffort(model) {
|
|
85106
|
-
return /^(o\d|gpt-5|gpt-4\.5)/i.test(model);
|
|
85107
|
-
}
|
|
85108
|
-
function isGeminiLikeModel(model) {
|
|
85109
|
-
const normalized = (model ?? "").trim().toLowerCase();
|
|
85110
|
-
return normalized.startsWith("gemini-") || normalized.includes("/gemini-");
|
|
85111
|
-
}
|
|
85112
|
-
function isGeminiTarget(model) {
|
|
85113
|
-
if (isEnvTruthy(getQueryEnvVar("CLAUDE_CODE_USE_GEMINI")))
|
|
85114
|
-
return true;
|
|
85115
|
-
return isGeminiLikeModel(model);
|
|
85116
|
-
}
|
|
85117
|
-
function supportsParallelToolCalls(model) {
|
|
85118
|
-
return !isGeminiTarget(model);
|
|
85119
|
-
}
|
|
85120
|
-
function getOpenAICompatMaxOutputTokens(model) {
|
|
85121
|
-
const max = getOpenAIMaxOutputTokens(model);
|
|
85122
|
-
if (max === undefined)
|
|
85123
|
-
return null;
|
|
85124
|
-
return { default: max, upperLimit: max };
|
|
85125
|
-
}
|
|
85126
|
-
function getOpenAICompatContextWindow(model) {
|
|
85127
|
-
return getOpenAIContextWindow(model) ?? null;
|
|
85128
|
-
}
|
|
85129
|
-
function openAICompatSupports(feature, model) {
|
|
85130
|
-
if (feature === "reasoning-effort")
|
|
85131
|
-
return supportsReasoningEffort(model);
|
|
85132
|
-
if (feature === "parallel-tool-calls")
|
|
85133
|
-
return supportsParallelToolCalls(model);
|
|
85134
|
-
return FEATURES_OPENAI_COMPAT.includes(feature);
|
|
85135
|
-
}
|
|
85136
|
-
var FEATURES_OPENAI_COMPAT;
|
|
85137
|
-
var init_capabilities2 = __esm(() => {
|
|
85138
|
-
init_openaiContextWindows();
|
|
85139
|
-
init_envUtils();
|
|
85140
|
-
init_state2();
|
|
85141
|
-
FEATURES_OPENAI_COMPAT = Object.freeze([
|
|
85142
|
-
"streaming",
|
|
85143
|
-
"tool-use",
|
|
85144
|
-
"image-input",
|
|
85145
|
-
"system-message-top-level"
|
|
85146
|
-
]);
|
|
85184
|
+
init_capabilities2();
|
|
85147
85185
|
});
|
|
85148
85186
|
|
|
85149
85187
|
// src/providers/openai/shim.ts
|
|
@@ -85373,49 +85411,6 @@ function convertMessages(messages, system) {
|
|
|
85373
85411
|
}
|
|
85374
85412
|
return result;
|
|
85375
85413
|
}
|
|
85376
|
-
function normalizeSchemaForOpenAI(schema, strict = true, topLevel = true, geminiTarget = false) {
|
|
85377
|
-
let record2 = sanitizeSchemaForOpenAICompat(schema);
|
|
85378
|
-
if (geminiTarget) {
|
|
85379
|
-
record2 = splitTypeArrayToAnyOf(record2);
|
|
85380
|
-
}
|
|
85381
|
-
if (record2.type === "object" && record2.properties) {
|
|
85382
|
-
const properties = record2.properties;
|
|
85383
|
-
const existingRequired = Array.isArray(record2.required) ? record2.required : [];
|
|
85384
|
-
const normalizedProps = {};
|
|
85385
|
-
for (const [key, value] of Object.entries(properties)) {
|
|
85386
|
-
normalizedProps[key] = normalizeSchemaForOpenAI(value, strict, false, geminiTarget);
|
|
85387
|
-
}
|
|
85388
|
-
record2.properties = normalizedProps;
|
|
85389
|
-
if (strict) {
|
|
85390
|
-
const allKeys = Object.keys(normalizedProps);
|
|
85391
|
-
record2.required = Array.from(new Set([...existingRequired, ...allKeys]));
|
|
85392
|
-
record2.additionalProperties = false;
|
|
85393
|
-
if (topLevel) {
|
|
85394
|
-
const style = geminiTarget ? "nullable" : "union";
|
|
85395
|
-
for (const key of allKeys) {
|
|
85396
|
-
if (!existingRequired.includes(key)) {
|
|
85397
|
-
normalizedProps[key] = makeSchemaNullable(normalizedProps[key], style);
|
|
85398
|
-
}
|
|
85399
|
-
}
|
|
85400
|
-
}
|
|
85401
|
-
} else {
|
|
85402
|
-
record2.required = existingRequired.filter((k) => (k in normalizedProps));
|
|
85403
|
-
}
|
|
85404
|
-
}
|
|
85405
|
-
if ("items" in record2) {
|
|
85406
|
-
if (Array.isArray(record2.items)) {
|
|
85407
|
-
record2.items = record2.items.map((item) => normalizeSchemaForOpenAI(item, strict, false, geminiTarget));
|
|
85408
|
-
} else {
|
|
85409
|
-
record2.items = normalizeSchemaForOpenAI(record2.items, strict, false, geminiTarget);
|
|
85410
|
-
}
|
|
85411
|
-
}
|
|
85412
|
-
for (const key of ["anyOf", "oneOf", "allOf"]) {
|
|
85413
|
-
if (key in record2 && Array.isArray(record2[key])) {
|
|
85414
|
-
record2[key] = record2[key].map((item) => normalizeSchemaForOpenAI(item, strict, false, geminiTarget));
|
|
85415
|
-
}
|
|
85416
|
-
}
|
|
85417
|
-
return record2;
|
|
85418
|
-
}
|
|
85419
85414
|
function convertTools(tools, model = "") {
|
|
85420
85415
|
const isGemini = isEnvTruthy(getQueryEnvVar("CLAUDE_CODE_USE_GEMINI"));
|
|
85421
85416
|
const geminiTarget = isGeminiTarget(model);
|
|
@@ -85436,7 +85431,7 @@ function convertTools(tools, model = "") {
|
|
|
85436
85431
|
function: {
|
|
85437
85432
|
name: t.name,
|
|
85438
85433
|
description: t.description ?? "",
|
|
85439
|
-
parameters:
|
|
85434
|
+
parameters: strictifyJsonSchema(schema, { strict: !isGemini, gemini: geminiTarget })
|
|
85440
85435
|
}
|
|
85441
85436
|
};
|
|
85442
85437
|
});
|
|
@@ -94366,7 +94361,7 @@ function printStartupScreen() {
|
|
|
94366
94361
|
const sLen = ` ● ${sL} Ready — type /help to begin`.length;
|
|
94367
94362
|
out.push(boxRow(sRow, W2, sLen));
|
|
94368
94363
|
out.push(`${rgb(...BORDER)}╚${"═".repeat(W2 - 2)}╝${RESET}`);
|
|
94369
|
-
out.push(` ${DIM}${rgb(...DIMCOL)}opencow ${RESET}${rgb(...ACCENT)}v${"0.4.
|
|
94364
|
+
out.push(` ${DIM}${rgb(...DIMCOL)}opencow ${RESET}${rgb(...ACCENT)}v${"0.4.6"}${RESET}`);
|
|
94370
94365
|
out.push("");
|
|
94371
94366
|
process.stdout.write(out.join(`
|
|
94372
94367
|
`) + `
|
|
@@ -239649,26 +239644,41 @@ var init_permissionLogging = __esm(() => {
|
|
|
239649
239644
|
});
|
|
239650
239645
|
|
|
239651
239646
|
// src/lib/toolInputNullCoercion.ts
|
|
239652
|
-
function
|
|
239653
|
-
|
|
239654
|
-
|
|
239655
|
-
|
|
239656
|
-
|
|
239647
|
+
function containsNull(value) {
|
|
239648
|
+
if (value === null)
|
|
239649
|
+
return true;
|
|
239650
|
+
if (Array.isArray(value))
|
|
239651
|
+
return value.some(containsNull);
|
|
239652
|
+
if (typeof value === "object") {
|
|
239653
|
+
return Object.values(value).some(containsNull);
|
|
239657
239654
|
}
|
|
239658
|
-
return
|
|
239655
|
+
return false;
|
|
239656
|
+
}
|
|
239657
|
+
function deepOmitNullProps(value) {
|
|
239658
|
+
if (Array.isArray(value)) {
|
|
239659
|
+
return value.map(deepOmitNullProps);
|
|
239660
|
+
}
|
|
239661
|
+
if (value !== null && typeof value === "object") {
|
|
239662
|
+
const out = {};
|
|
239663
|
+
for (const [key, v] of Object.entries(value)) {
|
|
239664
|
+
if (v === null)
|
|
239665
|
+
continue;
|
|
239666
|
+
out[key] = deepOmitNullProps(v);
|
|
239667
|
+
}
|
|
239668
|
+
return out;
|
|
239669
|
+
}
|
|
239670
|
+
return value;
|
|
239659
239671
|
}
|
|
239660
239672
|
function safeParseToolInputWithNullCoercion(schema, input) {
|
|
239661
239673
|
const first = schema.safeParse(input);
|
|
239662
239674
|
if (first.success)
|
|
239663
239675
|
return first;
|
|
239664
|
-
if (input === null || typeof input !== "object"
|
|
239676
|
+
if (input === null || typeof input !== "object") {
|
|
239665
239677
|
return first;
|
|
239666
239678
|
}
|
|
239667
|
-
|
|
239668
|
-
const hasNull = Object.values(record3).some((value) => value === null);
|
|
239669
|
-
if (!hasNull)
|
|
239679
|
+
if (!containsNull(input))
|
|
239670
239680
|
return first;
|
|
239671
|
-
const retry = schema.safeParse(
|
|
239681
|
+
const retry = schema.safeParse(deepOmitNullProps(input));
|
|
239672
239682
|
return retry.success ? retry : first;
|
|
239673
239683
|
}
|
|
239674
239684
|
|
|
@@ -244160,7 +244170,7 @@ function getAnthropicEnvMetadata() {
|
|
|
244160
244170
|
function getBuildAgeMinutes() {
|
|
244161
244171
|
if (false)
|
|
244162
244172
|
;
|
|
244163
|
-
const buildTime = new Date("2026-06-
|
|
244173
|
+
const buildTime = new Date("2026-06-03T14:42:10.545Z").getTime();
|
|
244164
244174
|
if (isNaN(buildTime))
|
|
244165
244175
|
return;
|
|
244166
244176
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -257158,7 +257168,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
|
|
|
257158
257168
|
return {
|
|
257159
257169
|
behavior: "ask",
|
|
257160
257170
|
decisionReason: decisionReason2,
|
|
257161
|
-
message: createPermissionRequestMessage2(
|
|
257171
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
257162
257172
|
};
|
|
257163
257173
|
}
|
|
257164
257174
|
{
|
|
@@ -257184,7 +257194,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
|
|
|
257184
257194
|
return {
|
|
257185
257195
|
behavior: "ask",
|
|
257186
257196
|
decisionReason: decisionReason2,
|
|
257187
|
-
message: createPermissionRequestMessage2(
|
|
257197
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
257188
257198
|
};
|
|
257189
257199
|
}
|
|
257190
257200
|
}
|
|
@@ -257234,7 +257244,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
|
|
|
257234
257244
|
};
|
|
257235
257245
|
return {
|
|
257236
257246
|
behavior: "ask",
|
|
257237
|
-
message: createPermissionRequestMessage2(
|
|
257247
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
257238
257248
|
decisionReason,
|
|
257239
257249
|
suggestions: suggestions.length > 0 ? suggestions : undefined
|
|
257240
257250
|
};
|
|
@@ -257264,7 +257274,7 @@ async function bashToolCheckCommandOperatorPermissions(input, bashToolHasPermiss
|
|
|
257264
257274
|
};
|
|
257265
257275
|
return {
|
|
257266
257276
|
behavior: "ask",
|
|
257267
|
-
message: createPermissionRequestMessage2(
|
|
257277
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
257268
257278
|
decisionReason
|
|
257269
257279
|
};
|
|
257270
257280
|
}
|
|
@@ -260042,21 +260052,21 @@ function getFirstWordPrefix(command) {
|
|
|
260042
260052
|
function suggestionForExactCommand2(command) {
|
|
260043
260053
|
const heredocPrefix = extractPrefixBeforeHeredoc(command);
|
|
260044
260054
|
if (heredocPrefix) {
|
|
260045
|
-
return suggestionForPrefix(
|
|
260055
|
+
return suggestionForPrefix(BashTool.name, heredocPrefix);
|
|
260046
260056
|
}
|
|
260047
260057
|
if (command.includes(`
|
|
260048
260058
|
`)) {
|
|
260049
260059
|
const firstLine = command.split(`
|
|
260050
260060
|
`)[0].trim();
|
|
260051
260061
|
if (firstLine) {
|
|
260052
|
-
return suggestionForPrefix(
|
|
260062
|
+
return suggestionForPrefix(BashTool.name, firstLine);
|
|
260053
260063
|
}
|
|
260054
260064
|
}
|
|
260055
260065
|
const prefix = getSimpleCommandPrefix(command);
|
|
260056
260066
|
if (prefix) {
|
|
260057
|
-
return suggestionForPrefix(
|
|
260067
|
+
return suggestionForPrefix(BashTool.name, prefix);
|
|
260058
260068
|
}
|
|
260059
|
-
return suggestionForExactCommand(
|
|
260069
|
+
return suggestionForExactCommand(BashTool.name, command);
|
|
260060
260070
|
}
|
|
260061
260071
|
function extractPrefixBeforeHeredoc(command) {
|
|
260062
260072
|
if (!command.includes("<<"))
|
|
@@ -260085,7 +260095,7 @@ function extractPrefixBeforeHeredoc(command) {
|
|
|
260085
260095
|
return tokens.slice(i3, i3 + 2).join(" ") || null;
|
|
260086
260096
|
}
|
|
260087
260097
|
function suggestionForPrefix2(prefix) {
|
|
260088
|
-
return suggestionForPrefix(
|
|
260098
|
+
return suggestionForPrefix(BashTool.name, prefix);
|
|
260089
260099
|
}
|
|
260090
260100
|
function matchWildcardPattern2(pattern, command) {
|
|
260091
260101
|
return matchWildcardPattern(pattern, command);
|
|
@@ -260282,11 +260292,11 @@ function filterRulesByContentsMatchingInput(input, rules, matchMode, {
|
|
|
260282
260292
|
}).map(([, rule]) => rule);
|
|
260283
260293
|
}
|
|
260284
260294
|
function matchingRulesForInput(input, toolPermissionContext, matchMode, { skipCompoundCheck = false } = {}) {
|
|
260285
|
-
const denyRuleByContents = getRuleByContentsForTool(toolPermissionContext,
|
|
260295
|
+
const denyRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "deny");
|
|
260286
260296
|
const matchingDenyRules = filterRulesByContentsMatchingInput(input, denyRuleByContents, matchMode, { stripAllEnvVars: true, skipCompoundCheck: true });
|
|
260287
|
-
const askRuleByContents = getRuleByContentsForTool(toolPermissionContext,
|
|
260297
|
+
const askRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "ask");
|
|
260288
260298
|
const matchingAskRules = filterRulesByContentsMatchingInput(input, askRuleByContents, matchMode, { stripAllEnvVars: true, skipCompoundCheck: true });
|
|
260289
|
-
const allowRuleByContents = getRuleByContentsForTool(toolPermissionContext,
|
|
260299
|
+
const allowRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "allow");
|
|
260290
260300
|
const matchingAllowRules = filterRulesByContentsMatchingInput(input, allowRuleByContents, matchMode, { skipCompoundCheck });
|
|
260291
260301
|
return {
|
|
260292
260302
|
matchingDenyRules,
|
|
@@ -260312,7 +260322,7 @@ async function checkCommandAndSuggestRules(input, toolPermissionContext, command
|
|
|
260312
260322
|
};
|
|
260313
260323
|
return {
|
|
260314
260324
|
behavior: "ask",
|
|
260315
|
-
message: createPermissionRequestMessage2(
|
|
260325
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
260316
260326
|
decisionReason,
|
|
260317
260327
|
suggestions: []
|
|
260318
260328
|
};
|
|
@@ -260333,7 +260343,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
|
|
|
260333
260343
|
if (matchingDenyRules[0] !== undefined) {
|
|
260334
260344
|
return {
|
|
260335
260345
|
behavior: "deny",
|
|
260336
|
-
message: `Permission to use ${
|
|
260346
|
+
message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
|
|
260337
260347
|
decisionReason: {
|
|
260338
260348
|
type: "rule",
|
|
260339
260349
|
rule: matchingDenyRules[0]
|
|
@@ -260348,7 +260358,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
|
|
|
260348
260358
|
if (subResult.matchingDenyRules[0] !== undefined) {
|
|
260349
260359
|
return {
|
|
260350
260360
|
behavior: "deny",
|
|
260351
|
-
message: `Permission to use ${
|
|
260361
|
+
message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
|
|
260352
260362
|
decisionReason: {
|
|
260353
260363
|
type: "rule",
|
|
260354
260364
|
rule: subResult.matchingDenyRules[0]
|
|
@@ -260360,7 +260370,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
|
|
|
260360
260370
|
if (firstAskRule) {
|
|
260361
260371
|
return {
|
|
260362
260372
|
behavior: "ask",
|
|
260363
|
-
message: createPermissionRequestMessage2(
|
|
260373
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
260364
260374
|
decisionReason: {
|
|
260365
260375
|
type: "rule",
|
|
260366
260376
|
rule: firstAskRule
|
|
@@ -260371,7 +260381,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
|
|
|
260371
260381
|
if (matchingAskRules[0] !== undefined) {
|
|
260372
260382
|
return {
|
|
260373
260383
|
behavior: "ask",
|
|
260374
|
-
message: createPermissionRequestMessage2(
|
|
260384
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
260375
260385
|
decisionReason: {
|
|
260376
260386
|
type: "rule",
|
|
260377
260387
|
rule: matchingAskRules[0]
|
|
@@ -260408,7 +260418,7 @@ function checkEarlyExitDeny(input, toolPermissionContext) {
|
|
|
260408
260418
|
if (denyMatch !== undefined) {
|
|
260409
260419
|
return {
|
|
260410
260420
|
behavior: "deny",
|
|
260411
|
-
message: `Permission to use ${
|
|
260421
|
+
message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
|
|
260412
260422
|
decisionReason: { type: "rule", rule: denyMatch }
|
|
260413
260423
|
};
|
|
260414
260424
|
}
|
|
@@ -260423,7 +260433,7 @@ function checkSemanticsDeny(input, toolPermissionContext, commands) {
|
|
|
260423
260433
|
if (subDeny !== undefined) {
|
|
260424
260434
|
return {
|
|
260425
260435
|
behavior: "deny",
|
|
260426
|
-
message: `Permission to use ${
|
|
260436
|
+
message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
|
|
260427
260437
|
decisionReason: { type: "rule", rule: subDeny }
|
|
260428
260438
|
};
|
|
260429
260439
|
}
|
|
@@ -260513,7 +260523,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260513
260523
|
return {
|
|
260514
260524
|
behavior: "ask",
|
|
260515
260525
|
decisionReason: decisionReason2,
|
|
260516
|
-
message: createPermissionRequestMessage2(
|
|
260526
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
|
|
260517
260527
|
suggestions: [],
|
|
260518
260528
|
...{}
|
|
260519
260529
|
};
|
|
@@ -260531,7 +260541,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260531
260541
|
return {
|
|
260532
260542
|
behavior: "ask",
|
|
260533
260543
|
decisionReason: decisionReason2,
|
|
260534
|
-
message: createPermissionRequestMessage2(
|
|
260544
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
|
|
260535
260545
|
suggestions: []
|
|
260536
260546
|
};
|
|
260537
260547
|
}
|
|
@@ -260550,7 +260560,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260550
260560
|
return {
|
|
260551
260561
|
behavior: "ask",
|
|
260552
260562
|
decisionReason: decisionReason2,
|
|
260553
|
-
message: createPermissionRequestMessage2(
|
|
260563
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
260554
260564
|
};
|
|
260555
260565
|
}
|
|
260556
260566
|
}
|
|
@@ -260606,7 +260616,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260606
260616
|
}
|
|
260607
260617
|
return {
|
|
260608
260618
|
behavior: "ask",
|
|
260609
|
-
message: createPermissionRequestMessage2(
|
|
260619
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
260610
260620
|
decisionReason: {
|
|
260611
260621
|
type: "other",
|
|
260612
260622
|
reason: `Required by Bash prompt rule: "${askResult.matchedDescription}"`
|
|
@@ -260625,7 +260635,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260625
260635
|
appState = context4.getAppState();
|
|
260626
260636
|
return {
|
|
260627
260637
|
behavior: "ask",
|
|
260628
|
-
message: createPermissionRequestMessage2(
|
|
260638
|
+
message: createPermissionRequestMessage2(BashTool.name, {
|
|
260629
260639
|
type: "other",
|
|
260630
260640
|
reason: safetyResult.message ?? "Command contains patterns that require approval"
|
|
260631
260641
|
}),
|
|
@@ -260668,7 +260678,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260668
260678
|
};
|
|
260669
260679
|
return {
|
|
260670
260680
|
behavior: "ask",
|
|
260671
|
-
message: createPermissionRequestMessage2(
|
|
260681
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
|
|
260672
260682
|
decisionReason: decisionReason2,
|
|
260673
260683
|
suggestions: [],
|
|
260674
260684
|
...{}
|
|
@@ -260688,7 +260698,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260688
260698
|
};
|
|
260689
260699
|
return {
|
|
260690
260700
|
behavior: "ask",
|
|
260691
|
-
message: createPermissionRequestMessage2(
|
|
260701
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
|
|
260692
260702
|
decisionReason: decisionReason2
|
|
260693
260703
|
};
|
|
260694
260704
|
}
|
|
@@ -260701,7 +260711,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260701
260711
|
return {
|
|
260702
260712
|
behavior: "ask",
|
|
260703
260713
|
decisionReason: decisionReason2,
|
|
260704
|
-
message: createPermissionRequestMessage2(
|
|
260714
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
260705
260715
|
};
|
|
260706
260716
|
}
|
|
260707
260717
|
const compoundCommandHasCd = cdCommands.length > 0;
|
|
@@ -260715,7 +260725,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260715
260725
|
return {
|
|
260716
260726
|
behavior: "ask",
|
|
260717
260727
|
decisionReason: decisionReason2,
|
|
260718
|
-
message: createPermissionRequestMessage2(
|
|
260728
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
260719
260729
|
};
|
|
260720
260730
|
}
|
|
260721
260731
|
}
|
|
@@ -260725,7 +260735,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260725
260735
|
if (deniedSubresult !== undefined) {
|
|
260726
260736
|
return {
|
|
260727
260737
|
behavior: "deny",
|
|
260728
|
-
message: `Permission to use ${
|
|
260738
|
+
message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
|
|
260729
260739
|
decisionReason: {
|
|
260730
260740
|
type: "subcommandResults",
|
|
260731
260741
|
reasons: new Map(subcommandPermissionDecisions.map((result, i3) => [
|
|
@@ -260851,7 +260861,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260851
260861
|
] : undefined;
|
|
260852
260862
|
return {
|
|
260853
260863
|
behavior: askSubresult !== undefined ? "ask" : "passthrough",
|
|
260854
|
-
message: createPermissionRequestMessage2(
|
|
260864
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
260855
260865
|
decisionReason,
|
|
260856
260866
|
suggestions: suggestedUpdates,
|
|
260857
260867
|
...{}
|
|
@@ -260892,7 +260902,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260892
260902
|
if (matchingDenyRules[0] !== undefined) {
|
|
260893
260903
|
return {
|
|
260894
260904
|
behavior: "deny",
|
|
260895
|
-
message: `Permission to use ${
|
|
260905
|
+
message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
|
|
260896
260906
|
decisionReason: {
|
|
260897
260907
|
type: "rule",
|
|
260898
260908
|
rule: matchingDenyRules[0]
|
|
@@ -260902,7 +260912,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260902
260912
|
if (matchingAskRules[0] !== undefined) {
|
|
260903
260913
|
return {
|
|
260904
260914
|
behavior: "ask",
|
|
260905
|
-
message: createPermissionRequestMessage2(
|
|
260915
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
260906
260916
|
decisionReason: {
|
|
260907
260917
|
type: "rule",
|
|
260908
260918
|
rule: matchingAskRules[0]
|
|
@@ -260925,7 +260935,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260925
260935
|
};
|
|
260926
260936
|
return {
|
|
260927
260937
|
behavior: "passthrough",
|
|
260928
|
-
message: createPermissionRequestMessage2(
|
|
260938
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
260929
260939
|
decisionReason,
|
|
260930
260940
|
suggestions: suggestionForExactCommand2(command)
|
|
260931
260941
|
};
|
|
@@ -260941,7 +260951,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260941
260951
|
if (matchingDenyRules[0] !== undefined) {
|
|
260942
260952
|
return {
|
|
260943
260953
|
behavior: "deny",
|
|
260944
|
-
message: `Permission to use ${
|
|
260954
|
+
message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
|
|
260945
260955
|
decisionReason: {
|
|
260946
260956
|
type: "rule",
|
|
260947
260957
|
rule: matchingDenyRules[0]
|
|
@@ -260951,7 +260961,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260951
260961
|
if (matchingAskRules[0] !== undefined) {
|
|
260952
260962
|
return {
|
|
260953
260963
|
behavior: "ask",
|
|
260954
|
-
message: createPermissionRequestMessage2(
|
|
260964
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
260955
260965
|
decisionReason: {
|
|
260956
260966
|
type: "rule",
|
|
260957
260967
|
rule: matchingAskRules[0]
|
|
@@ -260983,7 +260993,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260983
260993
|
if (modeResult.behavior !== "passthrough") {
|
|
260984
260994
|
return modeResult;
|
|
260985
260995
|
}
|
|
260986
|
-
if (
|
|
260996
|
+
if (BashTool.isReadOnly(input)) {
|
|
260987
260997
|
return {
|
|
260988
260998
|
behavior: "allow",
|
|
260989
260999
|
updatedInput: input,
|
|
@@ -260999,7 +261009,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260999
261009
|
};
|
|
261000
261010
|
return {
|
|
261001
261011
|
behavior: "passthrough",
|
|
261002
|
-
message: createPermissionRequestMessage2(
|
|
261012
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
261003
261013
|
decisionReason,
|
|
261004
261014
|
suggestions: suggestionForExactCommand2(command)
|
|
261005
261015
|
};
|
|
@@ -273698,7 +273708,7 @@ function getReplPrimitiveTools() {
|
|
|
273698
273708
|
FileEditTool,
|
|
273699
273709
|
GlobTool,
|
|
273700
273710
|
GrepTool,
|
|
273701
|
-
|
|
273711
|
+
BashTool,
|
|
273702
273712
|
NotebookEditTool,
|
|
273703
273713
|
AgentTool
|
|
273704
273714
|
];
|
|
@@ -276982,7 +276992,7 @@ async function* runShellCommand({
|
|
|
276982
276992
|
}
|
|
276983
276993
|
}
|
|
276984
276994
|
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,
|
|
276995
|
+
`, 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
276996
|
var init_BashTool = __esm(() => {
|
|
276987
276997
|
init_v4();
|
|
276988
276998
|
init_state();
|
|
@@ -277105,7 +277115,7 @@ For commands that are harder to parse at a glance (piped commands, obscure flags
|
|
|
277105
277115
|
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
277116
|
persistedOutputSize: exports_external.number().optional().describe("Total size of the output in bytes (set when output is too large for inline)")
|
|
277107
277117
|
}));
|
|
277108
|
-
|
|
277118
|
+
BashTool = buildToolRuntime({
|
|
277109
277119
|
name: BASH_TOOL_NAME2,
|
|
277110
277120
|
searchHint: "execute shell commands",
|
|
277111
277121
|
maxResultSizeChars: 30000,
|
|
@@ -283473,7 +283483,7 @@ var init_PowerShellTool = __esm(() => {
|
|
|
283473
283483
|
import { randomUUID as randomUUID14 } from "crypto";
|
|
283474
283484
|
async function executeShellCommandsInPrompt(text, context4, slashCommandName, shell) {
|
|
283475
283485
|
let result = text;
|
|
283476
|
-
const shellTool = shell === "powershell" && isPowerShellToolEnabled() ? getPowerShellTool() :
|
|
283486
|
+
const shellTool = shell === "powershell" && isPowerShellToolEnabled() ? getPowerShellTool() : BashTool;
|
|
283477
283487
|
const blockMatches = text.matchAll(BLOCK_PATTERN);
|
|
283478
283488
|
const inlineMatches = text.includes("!`") ? text.matchAll(INLINE_PATTERN) : [];
|
|
283479
283489
|
await Promise.all([...blockMatches, ...inlineMatches].map(async (match) => {
|
|
@@ -306573,8 +306583,8 @@ function normalizeToolInput(tool, input, agentId) {
|
|
|
306573
306583
|
persistFileSnapshotIfRemote();
|
|
306574
306584
|
return plan !== null ? { ...input, plan, planFilePath } : input;
|
|
306575
306585
|
}
|
|
306576
|
-
case
|
|
306577
|
-
const parsed =
|
|
306586
|
+
case BashTool.name: {
|
|
306587
|
+
const parsed = BashTool.inputSchema.parse(input);
|
|
306578
306588
|
const { command, timeout, description } = parsed;
|
|
306579
306589
|
const cwd = getCwd3();
|
|
306580
306590
|
let normalizedCommand = command.replace(`cd ${cwd} && `, "");
|
|
@@ -314098,6 +314108,7 @@ var init_messages4 = __esm(() => {
|
|
|
314098
314108
|
init_xml();
|
|
314099
314109
|
init_diagnostics2();
|
|
314100
314110
|
init_Tool();
|
|
314111
|
+
init_BashTool();
|
|
314101
314112
|
init_FileReadTool();
|
|
314102
314113
|
init_api3();
|
|
314103
314114
|
init_config2();
|
|
@@ -411614,7 +411625,7 @@ function usePermissionRequestLogging(toolUseConfirm, unaryEvent) {
|
|
|
411614
411625
|
});
|
|
411615
411626
|
if (process.env.USER_TYPE === "ant") {
|
|
411616
411627
|
const permissionResult = toolUseConfirm.permissionResult;
|
|
411617
|
-
if (toolUseConfirm.tool.name ===
|
|
411628
|
+
if (toolUseConfirm.tool.name === BashTool.name && permissionResult.behavior === "ask" && !hasRules(permissionResult.suggestions)) {
|
|
411618
411629
|
logEvent("tengu_internal_tool_use_permission_request_no_always_allow", {
|
|
411619
411630
|
messageID: toolUseConfirm.assistantMessage.message.id,
|
|
411620
411631
|
toolName: sanitizeToolNameForAnalytics(toolUseConfirm.tool.name),
|
|
@@ -411626,8 +411637,8 @@ function usePermissionRequestLogging(toolUseConfirm, unaryEvent) {
|
|
|
411626
411637
|
}
|
|
411627
411638
|
}
|
|
411628
411639
|
if (process.env.USER_TYPE === "ant") {
|
|
411629
|
-
const parsedInput =
|
|
411630
|
-
if (toolUseConfirm.tool.name ===
|
|
411640
|
+
const parsedInput = BashTool.inputSchema.safeParse(toolUseConfirm.input);
|
|
411641
|
+
if (toolUseConfirm.tool.name === BashTool.name && toolUseConfirm.permissionResult.behavior === "ask" && parsedInput.success) {
|
|
411631
411642
|
let split = [parsedInput.data.command];
|
|
411632
411643
|
try {
|
|
411633
411644
|
split = splitCommand_DEPRECATED(parsedInput.data.command);
|
|
@@ -415716,7 +415727,7 @@ function SedEditPermissionRequestInner(t0) {
|
|
|
415716
415727
|
let t4;
|
|
415717
415728
|
if ($2[11] !== filePath || $2[12] !== newContent) {
|
|
415718
415729
|
t4 = (input) => {
|
|
415719
|
-
const parsed =
|
|
415730
|
+
const parsed = BashTool.inputSchema.parse(input);
|
|
415720
415731
|
return {
|
|
415721
415732
|
...parsed,
|
|
415722
415733
|
_simulatedSedEdit: {
|
|
@@ -416285,7 +416296,7 @@ function BashPermissionRequest(props) {
|
|
|
416285
416296
|
({
|
|
416286
416297
|
command,
|
|
416287
416298
|
description
|
|
416288
|
-
} =
|
|
416299
|
+
} = BashTool.inputSchema.parse(toolUseConfirm.input));
|
|
416289
416300
|
t0 = parseSedEditCommand(command);
|
|
416290
416301
|
$2[0] = toolUseConfirm.input;
|
|
416291
416302
|
$2[1] = command;
|
|
@@ -416403,7 +416414,7 @@ function BashPermissionRequestInner({
|
|
|
416403
416414
|
const isCompound = toolUseConfirm.permissionResult.decisionReason?.type === "subcommandResults";
|
|
416404
416415
|
const [editablePrefix, setEditablePrefix] = import_react115.useState(() => {
|
|
416405
416416
|
if (isCompound) {
|
|
416406
|
-
const backendBashRules = extractRules("suggestions" in toolUseConfirm.permissionResult ? toolUseConfirm.permissionResult.suggestions : undefined).filter((r) => r.toolName ===
|
|
416417
|
+
const backendBashRules = extractRules("suggestions" in toolUseConfirm.permissionResult ? toolUseConfirm.permissionResult.suggestions : undefined).filter((r) => r.toolName === BashTool.name && r.ruleContent);
|
|
416407
416418
|
return backendBashRules.length === 1 ? backendBashRules[0].ruleContent : undefined;
|
|
416408
416419
|
}
|
|
416409
416420
|
const two = getSimpleCommandPrefix(command);
|
|
@@ -416423,7 +416434,7 @@ function BashPermissionRequestInner({
|
|
|
416423
416434
|
if (isCompound)
|
|
416424
416435
|
return;
|
|
416425
416436
|
let cancelled = false;
|
|
416426
|
-
getCompoundCommandPrefixesStatic(command, (subcmd) =>
|
|
416437
|
+
getCompoundCommandPrefixesStatic(command, (subcmd) => BashTool.isReadOnly({
|
|
416427
416438
|
command: subcmd
|
|
416428
416439
|
})).then((prefixes) => {
|
|
416429
416440
|
if (cancelled || hasUserEditedPrefix.current)
|
|
@@ -416506,7 +416517,7 @@ function BashPermissionRequestInner({
|
|
|
416506
416517
|
const prefixUpdates = [{
|
|
416507
416518
|
type: "addRules",
|
|
416508
416519
|
rules: [{
|
|
416509
|
-
toolName:
|
|
416520
|
+
toolName: BashTool.name,
|
|
416510
416521
|
ruleContent: trimmedPrefix
|
|
416511
416522
|
}],
|
|
416512
416523
|
behavior: "allow",
|
|
@@ -416567,7 +416578,7 @@ function BashPermissionRequestInner({
|
|
|
416567
416578
|
children: [
|
|
416568
416579
|
/* @__PURE__ */ jsx_dev_runtime156.jsxDEV(ThemedText, {
|
|
416569
416580
|
dimColor: explainerState.visible,
|
|
416570
|
-
children:
|
|
416581
|
+
children: BashTool.renderToolUseMessage({
|
|
416571
416582
|
command,
|
|
416572
416583
|
description
|
|
416573
416584
|
}, {
|
|
@@ -423767,7 +423778,7 @@ function permissionComponentForTool(tool) {
|
|
|
423767
423778
|
return FileEditPermissionRequest;
|
|
423768
423779
|
case FileWriteTool:
|
|
423769
423780
|
return FileWritePermissionRequest;
|
|
423770
|
-
case
|
|
423781
|
+
case BashTool:
|
|
423771
423782
|
return BashPermissionRequest;
|
|
423772
423783
|
case PowerShellTool:
|
|
423773
423784
|
return PowerShellPermissionRequest;
|
|
@@ -479299,7 +479310,7 @@ function buildPrimarySection() {
|
|
|
479299
479310
|
}, undefined, false, undefined, this);
|
|
479300
479311
|
return [{
|
|
479301
479312
|
label: "Version",
|
|
479302
|
-
value: "0.4.
|
|
479313
|
+
value: "0.4.6"
|
|
479303
479314
|
}, {
|
|
479304
479315
|
label: "Session name",
|
|
479305
479316
|
value: nameValue
|
|
@@ -514020,7 +514031,7 @@ function PermissionRuleDescription(t0) {
|
|
|
514020
514031
|
ruleValue
|
|
514021
514032
|
} = t0;
|
|
514022
514033
|
switch (ruleValue.toolName) {
|
|
514023
|
-
case
|
|
514034
|
+
case BashTool.name: {
|
|
514024
514035
|
if (ruleValue.ruleContent) {
|
|
514025
514036
|
if (ruleValue.ruleContent.endsWith(":*")) {
|
|
514026
514037
|
let t1;
|
|
@@ -514423,7 +514434,7 @@ function PermissionRuleInput(t0) {
|
|
|
514423
514434
|
/* @__PURE__ */ jsx_dev_runtime365.jsxDEV(ThemedText, {
|
|
514424
514435
|
bold: true,
|
|
514425
514436
|
children: permissionRuleValueToString({
|
|
514426
|
-
toolName:
|
|
514437
|
+
toolName: BashTool.name,
|
|
514427
514438
|
ruleContent: "ls:*"
|
|
514428
514439
|
})
|
|
514429
514440
|
}, undefined, false, undefined, this)
|
|
@@ -529746,7 +529757,7 @@ function getToolBuckets() {
|
|
|
529746
529757
|
},
|
|
529747
529758
|
EXECUTION: {
|
|
529748
529759
|
name: "Execution tools",
|
|
529749
|
-
toolNames: new Set([
|
|
529760
|
+
toolNames: new Set([BashTool.name, undefined].filter((n2) => n2 !== undefined))
|
|
529750
529761
|
},
|
|
529751
529762
|
MCP: {
|
|
529752
529763
|
name: "MCP tools",
|
|
@@ -535617,7 +535628,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
535617
535628
|
var call58 = async () => {
|
|
535618
535629
|
return {
|
|
535619
535630
|
type: "text",
|
|
535620
|
-
value: `${"99.0.0"} (built ${"2026-06-
|
|
535631
|
+
value: `${"99.0.0"} (built ${"2026-06-03T14:42:10.545Z"})`
|
|
535621
535632
|
};
|
|
535622
535633
|
}, version2, version_default;
|
|
535623
535634
|
var init_version = __esm(() => {
|
|
@@ -549409,7 +549420,7 @@ function _cliGetAllBaseTools() {
|
|
|
549409
549420
|
return [
|
|
549410
549421
|
AgentTool,
|
|
549411
549422
|
..._embeddedUITools,
|
|
549412
|
-
|
|
549423
|
+
BashTool,
|
|
549413
549424
|
...hasEmbeddedSearchTools() ? [] : [GlobTool, GrepTool],
|
|
549414
549425
|
ExitPlanModeV2Tool,
|
|
549415
549426
|
FileReadTool,
|
|
@@ -555217,7 +555228,7 @@ function BashModeProgress(t0) {
|
|
|
555217
555228
|
elapsedTimeSeconds: progress.elapsedTimeSeconds,
|
|
555218
555229
|
totalLines: progress.totalLines,
|
|
555219
555230
|
verbose
|
|
555220
|
-
}, undefined, false, undefined, this) :
|
|
555231
|
+
}, undefined, false, undefined, this) : BashTool.renderToolUseProgressMessage?.([], {
|
|
555221
555232
|
verbose,
|
|
555222
555233
|
tools: [],
|
|
555223
555234
|
terminalSize: undefined
|
|
@@ -555297,11 +555308,11 @@ async function processBashCommand(inputString, precedingInputBlocks, attachmentM
|
|
|
555297
555308
|
if (usePowerShell) {
|
|
555298
555309
|
PowerShellTool2 = (init_PowerShellTool(), __toCommonJS(exports_PowerShellTool)).PowerShellTool;
|
|
555299
555310
|
}
|
|
555300
|
-
const shellTool = PowerShellTool2 ??
|
|
555311
|
+
const shellTool = PowerShellTool2 ?? BashTool;
|
|
555301
555312
|
const response = PowerShellTool2 ? await PowerShellTool2.call({
|
|
555302
555313
|
command: inputString,
|
|
555303
555314
|
dangerouslyDisableSandbox: true
|
|
555304
|
-
}, bashModeContext, undefined, undefined, onProgress) : await
|
|
555315
|
+
}, bashModeContext, undefined, undefined, onProgress) : await BashTool.call({
|
|
555305
555316
|
command: inputString,
|
|
555306
555317
|
dangerouslyDisableSandbox: true
|
|
555307
555318
|
}, bashModeContext, undefined, undefined, onProgress);
|
|
@@ -557727,7 +557738,7 @@ function WelcomeV2() {
|
|
|
557727
557738
|
dimColor: true,
|
|
557728
557739
|
children: [
|
|
557729
557740
|
"v",
|
|
557730
|
-
"0.4.
|
|
557741
|
+
"0.4.6",
|
|
557731
557742
|
" "
|
|
557732
557743
|
]
|
|
557733
557744
|
}, undefined, true, undefined, this)
|
|
@@ -557927,7 +557938,7 @@ function WelcomeV2() {
|
|
|
557927
557938
|
dimColor: true,
|
|
557928
557939
|
children: [
|
|
557929
557940
|
"v",
|
|
557930
|
-
"0.4.
|
|
557941
|
+
"0.4.6",
|
|
557931
557942
|
" "
|
|
557932
557943
|
]
|
|
557933
557944
|
}, undefined, true, undefined, this)
|
|
@@ -558153,7 +558164,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
558153
558164
|
dimColor: true,
|
|
558154
558165
|
children: [
|
|
558155
558166
|
"v",
|
|
558156
|
-
"0.4.
|
|
558167
|
+
"0.4.6",
|
|
558157
558168
|
" "
|
|
558158
558169
|
]
|
|
558159
558170
|
}, undefined, true, undefined, this);
|
|
@@ -558407,7 +558418,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
558407
558418
|
dimColor: true,
|
|
558408
558419
|
children: [
|
|
558409
558420
|
"v",
|
|
558410
|
-
"0.4.
|
|
558421
|
+
"0.4.6",
|
|
558411
558422
|
" "
|
|
558412
558423
|
]
|
|
558413
558424
|
}, undefined, true, undefined, this);
|
|
@@ -579253,7 +579264,7 @@ Usage: claude --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
579253
579264
|
pendingHookMessages
|
|
579254
579265
|
}, renderAndRun);
|
|
579255
579266
|
}
|
|
579256
|
-
}).version("0.4.
|
|
579267
|
+
}).version("0.4.6 (OpenCow)", "-v, --version", "Output the version number");
|
|
579257
579268
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
579258
579269
|
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
579270
|
if (canUserConfigureAdvisor()) {
|
|
@@ -579899,7 +579910,7 @@ if (false) {}
|
|
|
579899
579910
|
async function main2() {
|
|
579900
579911
|
const args = process.argv.slice(2);
|
|
579901
579912
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
579902
|
-
console.log(`${"0.4.
|
|
579913
|
+
console.log(`${"0.4.6"} (OpenCow)`);
|
|
579903
579914
|
return;
|
|
579904
579915
|
}
|
|
579905
579916
|
if (args.includes("--provider")) {
|
|
@@ -580017,4 +580028,4 @@ async function main2() {
|
|
|
580017
580028
|
}
|
|
580018
580029
|
main2();
|
|
580019
580030
|
|
|
580020
|
-
//# debugId=
|
|
580031
|
+
//# debugId=6B8704627517D02B64756E2164756E21
|