@opencow-ai/opencow-agent-sdk 0.4.3 → 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 +340 -156
- package/dist/client.js +315 -131
- package/dist/lib/schemaSanitizer.d.ts +27 -6
- package/dist/lib/toolInputNullCoercion.d.ts +7 -4
- package/dist/providers/openai/capabilities.d.ts +8 -0
- package/dist/providers/openai/shim.d.ts +9 -2
- package/dist/sdk.js +315 -131
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -57406,12 +57406,12 @@ function getOpus46CostTier(fastMode) {
|
|
|
57406
57406
|
return COST_TIER_5_25;
|
|
57407
57407
|
}
|
|
57408
57408
|
function tokensToUSDCost(modelCosts, usage) {
|
|
57409
|
-
return usage
|
|
57409
|
+
return (usage?.input_tokens ?? 0) / 1e6 * modelCosts.inputTokens + (usage?.output_tokens ?? 0) / 1e6 * modelCosts.outputTokens + (usage?.cache_read_input_tokens ?? 0) / 1e6 * modelCosts.promptCacheReadTokens + (usage?.cache_creation_input_tokens ?? 0) / 1e6 * modelCosts.promptCacheWriteTokens + (usage?.server_tool_use?.web_search_requests ?? 0) * modelCosts.webSearchRequests;
|
|
57410
57410
|
}
|
|
57411
57411
|
function getModelCosts(model, usage) {
|
|
57412
57412
|
const shortName = getCanonicalName(model);
|
|
57413
57413
|
if (shortName === firstPartyNameToCanonical(CLAUDE_OPUS_4_6_CONFIG.firstParty)) {
|
|
57414
|
-
const isFastMode = usage
|
|
57414
|
+
const isFastMode = usage?.speed === "fast";
|
|
57415
57415
|
return getOpus46CostTier(isFastMode);
|
|
57416
57416
|
}
|
|
57417
57417
|
const costs = MODEL_COSTS[shortName];
|
|
@@ -84200,10 +84200,25 @@ function sanitizeTypeField(record2) {
|
|
|
84200
84200
|
record2.type = filtered;
|
|
84201
84201
|
}
|
|
84202
84202
|
}
|
|
84203
|
-
function makeSchemaNullable(schema) {
|
|
84203
|
+
function makeSchemaNullable(schema, style = "union") {
|
|
84204
84204
|
if ("enum" in schema || "const" in schema)
|
|
84205
84205
|
return schema;
|
|
84206
|
+
if (schema.nullable === true)
|
|
84207
|
+
return schema;
|
|
84206
84208
|
const raw = schema.type;
|
|
84209
|
+
if (style === "nullable") {
|
|
84210
|
+
if (typeof raw === "string") {
|
|
84211
|
+
if (raw === "null")
|
|
84212
|
+
return schema;
|
|
84213
|
+
return { ...schema, nullable: true };
|
|
84214
|
+
}
|
|
84215
|
+
if (Array.isArray(raw)) {
|
|
84216
|
+
if (raw.includes("null"))
|
|
84217
|
+
return schema;
|
|
84218
|
+
return { ...schema, nullable: true };
|
|
84219
|
+
}
|
|
84220
|
+
return schema;
|
|
84221
|
+
}
|
|
84207
84222
|
if (typeof raw === "string") {
|
|
84208
84223
|
if (raw === "null")
|
|
84209
84224
|
return schema;
|
|
@@ -84216,6 +84231,52 @@ function makeSchemaNullable(schema) {
|
|
|
84216
84231
|
}
|
|
84217
84232
|
return schema;
|
|
84218
84233
|
}
|
|
84234
|
+
function splitTypeArrayToAnyOf(schema) {
|
|
84235
|
+
if (!Array.isArray(schema.type) || schema.type.length < 2)
|
|
84236
|
+
return schema;
|
|
84237
|
+
const types = schema.type;
|
|
84238
|
+
const hasNull = types.includes("null");
|
|
84239
|
+
const nonNullTypes = types.filter((t) => t !== "null");
|
|
84240
|
+
if (hasNull && nonNullTypes.length === 1) {
|
|
84241
|
+
const { type: _type, ...rest } = schema;
|
|
84242
|
+
return { ...rest, type: nonNullTypes[0], nullable: true };
|
|
84243
|
+
}
|
|
84244
|
+
const ARRAY_KEYS = new Set(["items"]);
|
|
84245
|
+
const OBJECT_KEYS = new Set(["properties", "required", "additionalProperties"]);
|
|
84246
|
+
const TYPE_SPECIFIC_KEYS = new Set([...ARRAY_KEYS, ...OBJECT_KEYS]);
|
|
84247
|
+
const base2 = {};
|
|
84248
|
+
const structural = {};
|
|
84249
|
+
for (const [key, value] of Object.entries(schema)) {
|
|
84250
|
+
if (key === "type")
|
|
84251
|
+
continue;
|
|
84252
|
+
if (TYPE_SPECIFIC_KEYS.has(key)) {
|
|
84253
|
+
structural[key] = value;
|
|
84254
|
+
} else {
|
|
84255
|
+
base2[key] = value;
|
|
84256
|
+
}
|
|
84257
|
+
}
|
|
84258
|
+
const variants = nonNullTypes.map((t) => {
|
|
84259
|
+
const variant = { type: t };
|
|
84260
|
+
if (t === "array") {
|
|
84261
|
+
for (const k of ARRAY_KEYS) {
|
|
84262
|
+
if (k in structural)
|
|
84263
|
+
variant[k] = structural[k];
|
|
84264
|
+
}
|
|
84265
|
+
} else if (t === "object") {
|
|
84266
|
+
for (const k of OBJECT_KEYS) {
|
|
84267
|
+
if (k in structural)
|
|
84268
|
+
variant[k] = structural[k];
|
|
84269
|
+
}
|
|
84270
|
+
}
|
|
84271
|
+
return variant;
|
|
84272
|
+
});
|
|
84273
|
+
if (hasNull)
|
|
84274
|
+
base2.nullable = true;
|
|
84275
|
+
if (variants.length === 1) {
|
|
84276
|
+
return { ...base2, ...variants[0] };
|
|
84277
|
+
}
|
|
84278
|
+
return { ...base2, anyOf: variants };
|
|
84279
|
+
}
|
|
84219
84280
|
function sanitizeSchemaForOpenAICompat(schema) {
|
|
84220
84281
|
const stripped = stripSchemaKeywords(schema, OPENAI_INCOMPATIBLE_SCHEMA_KEYWORDS);
|
|
84221
84282
|
if (!isSchemaRecord(stripped)) {
|
|
@@ -85040,6 +85101,51 @@ var init_shim = __esm(() => {
|
|
|
85040
85101
|
init_schema();
|
|
85041
85102
|
});
|
|
85042
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
|
+
]);
|
|
85147
|
+
});
|
|
85148
|
+
|
|
85043
85149
|
// src/providers/openai/shim.ts
|
|
85044
85150
|
var exports_shim = {};
|
|
85045
85151
|
__export(exports_shim, {
|
|
@@ -85209,15 +85315,18 @@ function convertMessages(messages, system) {
|
|
|
85209
85315
|
}
|
|
85210
85316
|
}
|
|
85211
85317
|
if (otherContent.length > 0) {
|
|
85212
|
-
|
|
85213
|
-
|
|
85214
|
-
|
|
85215
|
-
|
|
85318
|
+
const converted = convertContentBlocks(otherContent);
|
|
85319
|
+
if (converted !== "") {
|
|
85320
|
+
result.push({
|
|
85321
|
+
role: "user",
|
|
85322
|
+
content: converted
|
|
85323
|
+
});
|
|
85324
|
+
}
|
|
85216
85325
|
}
|
|
85217
85326
|
} else {
|
|
85218
85327
|
result.push({
|
|
85219
85328
|
role: "user",
|
|
85220
|
-
content: convertContentBlocks(content)
|
|
85329
|
+
content: convertContentBlocks(content) || "."
|
|
85221
85330
|
});
|
|
85222
85331
|
}
|
|
85223
85332
|
} else if (role === "assistant") {
|
|
@@ -85229,7 +85338,8 @@ function convertMessages(messages, system) {
|
|
|
85229
85338
|
role: "assistant",
|
|
85230
85339
|
content: (() => {
|
|
85231
85340
|
const c5 = convertContentBlocks(textContent);
|
|
85232
|
-
|
|
85341
|
+
const text = typeof c5 === "string" ? c5 : Array.isArray(c5) ? c5.map((p) => p.text ?? "").join("") : "";
|
|
85342
|
+
return text || null;
|
|
85233
85343
|
})()
|
|
85234
85344
|
};
|
|
85235
85345
|
if (thinkingBlocks.length > 0) {
|
|
@@ -85252,26 +85362,28 @@ function convertMessages(messages, system) {
|
|
|
85252
85362
|
}
|
|
85253
85363
|
result.push(assistantMsg);
|
|
85254
85364
|
} else {
|
|
85365
|
+
const c5 = convertContentBlocks(content);
|
|
85366
|
+
const text = typeof c5 === "string" ? c5 : Array.isArray(c5) ? c5.map((p) => p.text ?? "").join("") : "";
|
|
85255
85367
|
result.push({
|
|
85256
85368
|
role: "assistant",
|
|
85257
|
-
content:
|
|
85258
|
-
const c5 = convertContentBlocks(content);
|
|
85259
|
-
return typeof c5 === "string" ? c5 : Array.isArray(c5) ? c5.map((p) => p.text ?? "").join("") : "";
|
|
85260
|
-
})()
|
|
85369
|
+
content: text || null
|
|
85261
85370
|
});
|
|
85262
85371
|
}
|
|
85263
85372
|
}
|
|
85264
85373
|
}
|
|
85265
85374
|
return result;
|
|
85266
85375
|
}
|
|
85267
|
-
function normalizeSchemaForOpenAI(schema, strict = true, topLevel = true) {
|
|
85268
|
-
|
|
85376
|
+
function normalizeSchemaForOpenAI(schema, strict = true, topLevel = true, geminiTarget = false) {
|
|
85377
|
+
let record2 = sanitizeSchemaForOpenAICompat(schema);
|
|
85378
|
+
if (geminiTarget) {
|
|
85379
|
+
record2 = splitTypeArrayToAnyOf(record2);
|
|
85380
|
+
}
|
|
85269
85381
|
if (record2.type === "object" && record2.properties) {
|
|
85270
85382
|
const properties = record2.properties;
|
|
85271
85383
|
const existingRequired = Array.isArray(record2.required) ? record2.required : [];
|
|
85272
85384
|
const normalizedProps = {};
|
|
85273
85385
|
for (const [key, value] of Object.entries(properties)) {
|
|
85274
|
-
normalizedProps[key] = normalizeSchemaForOpenAI(value, strict, false);
|
|
85386
|
+
normalizedProps[key] = normalizeSchemaForOpenAI(value, strict, false, geminiTarget);
|
|
85275
85387
|
}
|
|
85276
85388
|
record2.properties = normalizedProps;
|
|
85277
85389
|
if (strict) {
|
|
@@ -85279,9 +85391,10 @@ function normalizeSchemaForOpenAI(schema, strict = true, topLevel = true) {
|
|
|
85279
85391
|
record2.required = Array.from(new Set([...existingRequired, ...allKeys]));
|
|
85280
85392
|
record2.additionalProperties = false;
|
|
85281
85393
|
if (topLevel) {
|
|
85394
|
+
const style = geminiTarget ? "nullable" : "union";
|
|
85282
85395
|
for (const key of allKeys) {
|
|
85283
85396
|
if (!existingRequired.includes(key)) {
|
|
85284
|
-
normalizedProps[key] = makeSchemaNullable(normalizedProps[key]);
|
|
85397
|
+
normalizedProps[key] = makeSchemaNullable(normalizedProps[key], style);
|
|
85285
85398
|
}
|
|
85286
85399
|
}
|
|
85287
85400
|
}
|
|
@@ -85291,20 +85404,21 @@ function normalizeSchemaForOpenAI(schema, strict = true, topLevel = true) {
|
|
|
85291
85404
|
}
|
|
85292
85405
|
if ("items" in record2) {
|
|
85293
85406
|
if (Array.isArray(record2.items)) {
|
|
85294
|
-
record2.items = record2.items.map((item) => normalizeSchemaForOpenAI(item, strict, false));
|
|
85407
|
+
record2.items = record2.items.map((item) => normalizeSchemaForOpenAI(item, strict, false, geminiTarget));
|
|
85295
85408
|
} else {
|
|
85296
|
-
record2.items = normalizeSchemaForOpenAI(record2.items, strict, false);
|
|
85409
|
+
record2.items = normalizeSchemaForOpenAI(record2.items, strict, false, geminiTarget);
|
|
85297
85410
|
}
|
|
85298
85411
|
}
|
|
85299
85412
|
for (const key of ["anyOf", "oneOf", "allOf"]) {
|
|
85300
85413
|
if (key in record2 && Array.isArray(record2[key])) {
|
|
85301
|
-
record2[key] = record2[key].map((item) => normalizeSchemaForOpenAI(item, strict, false));
|
|
85414
|
+
record2[key] = record2[key].map((item) => normalizeSchemaForOpenAI(item, strict, false, geminiTarget));
|
|
85302
85415
|
}
|
|
85303
85416
|
}
|
|
85304
85417
|
return record2;
|
|
85305
85418
|
}
|
|
85306
|
-
function convertTools(tools) {
|
|
85419
|
+
function convertTools(tools, model = "") {
|
|
85307
85420
|
const isGemini = isEnvTruthy(getQueryEnvVar("CLAUDE_CODE_USE_GEMINI"));
|
|
85421
|
+
const geminiTarget = isGeminiTarget(model);
|
|
85308
85422
|
return tools.filter((t) => t.name !== "ToolSearchTool").map((t) => {
|
|
85309
85423
|
const schema = { ...t.input_schema ?? { type: "object", properties: {} } };
|
|
85310
85424
|
if (t.name === "Agent" && schema.properties) {
|
|
@@ -85322,7 +85436,7 @@ function convertTools(tools) {
|
|
|
85322
85436
|
function: {
|
|
85323
85437
|
name: t.name,
|
|
85324
85438
|
description: t.description ?? "",
|
|
85325
|
-
parameters: normalizeSchemaForOpenAI(schema, !isGemini)
|
|
85439
|
+
parameters: normalizeSchemaForOpenAI(schema, !isGemini, true, geminiTarget)
|
|
85326
85440
|
}
|
|
85327
85441
|
};
|
|
85328
85442
|
});
|
|
@@ -85343,8 +85457,63 @@ function convertChunkUsage(usage) {
|
|
|
85343
85457
|
function toOpenAIChatReasoningEffort(effort) {
|
|
85344
85458
|
return effort === "xhigh" ? "high" : effort;
|
|
85345
85459
|
}
|
|
85460
|
+
function getOpenAIChatProviderCapabilities(model) {
|
|
85461
|
+
return {
|
|
85462
|
+
supportsParallelToolCalls: openAICompatSupports("parallel-tool-calls", model)
|
|
85463
|
+
};
|
|
85464
|
+
}
|
|
85465
|
+
function collectAdjacentToolMessages(messages, startIndex) {
|
|
85466
|
+
const toolMessages = [];
|
|
85467
|
+
for (let i2 = startIndex;i2 < messages.length && messages[i2]?.role === "tool"; i2++) {
|
|
85468
|
+
toolMessages.push(messages[i2]);
|
|
85469
|
+
}
|
|
85470
|
+
return toolMessages;
|
|
85471
|
+
}
|
|
85472
|
+
function indexToolMessagesById(toolMessages) {
|
|
85473
|
+
const byId = new Map;
|
|
85474
|
+
for (const toolMessage of toolMessages) {
|
|
85475
|
+
if (typeof toolMessage.tool_call_id === "string") {
|
|
85476
|
+
byId.set(toolMessage.tool_call_id, toolMessage);
|
|
85477
|
+
}
|
|
85478
|
+
}
|
|
85479
|
+
return byId;
|
|
85480
|
+
}
|
|
85481
|
+
function splitParallelToolCallTurn(assistantMessage, toolCalls, toolMessagesById) {
|
|
85482
|
+
const serialized = [];
|
|
85483
|
+
toolCalls.forEach((toolCall, index) => {
|
|
85484
|
+
serialized.push({
|
|
85485
|
+
...assistantMessage,
|
|
85486
|
+
tool_calls: [toolCall],
|
|
85487
|
+
content: index === 0 ? assistantMessage.content : null
|
|
85488
|
+
});
|
|
85489
|
+
const toolResponse = toolMessagesById.get(toolCall.id);
|
|
85490
|
+
if (toolResponse)
|
|
85491
|
+
serialized.push(toolResponse);
|
|
85492
|
+
});
|
|
85493
|
+
return serialized;
|
|
85494
|
+
}
|
|
85495
|
+
function serializeParallelToolCalls(messages, capabilities) {
|
|
85496
|
+
if (capabilities.supportsParallelToolCalls)
|
|
85497
|
+
return messages;
|
|
85498
|
+
const result = [];
|
|
85499
|
+
for (let i2 = 0;i2 < messages.length; i2++) {
|
|
85500
|
+
const message = messages[i2];
|
|
85501
|
+
const toolCalls = message.tool_calls;
|
|
85502
|
+
const isParallelToolTurn = message.role === "assistant" && (toolCalls?.length ?? 0) > 1;
|
|
85503
|
+
if (!isParallelToolTurn || !toolCalls) {
|
|
85504
|
+
result.push(message);
|
|
85505
|
+
continue;
|
|
85506
|
+
}
|
|
85507
|
+
const toolMessages = collectAdjacentToolMessages(messages, i2 + 1);
|
|
85508
|
+
const toolMessagesById = indexToolMessagesById(toolMessages);
|
|
85509
|
+
result.push(...splitParallelToolCallTurn(message, toolCalls, toolMessagesById));
|
|
85510
|
+
i2 += toolMessages.length;
|
|
85511
|
+
}
|
|
85512
|
+
return result;
|
|
85513
|
+
}
|
|
85346
85514
|
function buildOpenAIRequestBody(params, ctx) {
|
|
85347
|
-
const
|
|
85515
|
+
const capabilities = getOpenAIChatProviderCapabilities(ctx.resolvedModel);
|
|
85516
|
+
const openaiMessages = serializeParallelToolCalls(convertMessages(params.messages, params.system), capabilities);
|
|
85348
85517
|
const body = {
|
|
85349
85518
|
model: ctx.resolvedModel,
|
|
85350
85519
|
messages: openaiMessages,
|
|
@@ -85372,9 +85541,12 @@ function buildOpenAIRequestBody(params, ctx) {
|
|
|
85372
85541
|
body.reasoning_effort = toOpenAIChatReasoningEffort(ctx.reasoning.effort);
|
|
85373
85542
|
}
|
|
85374
85543
|
if (params.tools && params.tools.length > 0) {
|
|
85375
|
-
const converted = convertTools(params.tools);
|
|
85544
|
+
const converted = convertTools(params.tools, ctx.resolvedModel);
|
|
85376
85545
|
if (converted.length > 0) {
|
|
85377
85546
|
body.tools = converted;
|
|
85547
|
+
if (!capabilities.supportsParallelToolCalls) {
|
|
85548
|
+
body.parallel_tool_calls = false;
|
|
85549
|
+
}
|
|
85378
85550
|
if (params.tool_choice) {
|
|
85379
85551
|
const tc = params.tool_choice;
|
|
85380
85552
|
if (tc.type === "auto") {
|
|
@@ -85470,7 +85642,13 @@ async function* openaiStreamToAnthropic(response, model) {
|
|
|
85470
85642
|
})}`);
|
|
85471
85643
|
}
|
|
85472
85644
|
}
|
|
85473
|
-
|
|
85645
|
+
let reasoningText = delta.reasoning_content ?? delta.reasoning;
|
|
85646
|
+
if (reasoningText == null && Array.isArray(delta.reasoning_details)) {
|
|
85647
|
+
const parts = delta.reasoning_details.map((d) => d.content ?? d.summary ?? "").filter(Boolean);
|
|
85648
|
+
if (parts.length > 0)
|
|
85649
|
+
reasoningText = parts.join("");
|
|
85650
|
+
}
|
|
85651
|
+
if (reasoningText != null) {
|
|
85474
85652
|
if (reasoningBlockIndex === null) {
|
|
85475
85653
|
reasoningBlockIndex = contentBlockIndex;
|
|
85476
85654
|
contentBlockIndex++;
|
|
@@ -85492,7 +85670,7 @@ async function* openaiStreamToAnthropic(response, model) {
|
|
|
85492
85670
|
index: reasoningBlockIndex,
|
|
85493
85671
|
delta: {
|
|
85494
85672
|
type: "thinking_delta",
|
|
85495
|
-
thinking:
|
|
85673
|
+
thinking: reasoningText
|
|
85496
85674
|
}
|
|
85497
85675
|
};
|
|
85498
85676
|
continue;
|
|
@@ -85855,6 +86033,22 @@ class OpenAIShimMessages {
|
|
|
85855
86033
|
function convertOpenAIResponseToAnthropic(data, model) {
|
|
85856
86034
|
const choice = data.choices?.[0];
|
|
85857
86035
|
const content = [];
|
|
86036
|
+
const msg = choice?.message;
|
|
86037
|
+
let reasoningText = msg?.reasoning_content ?? msg?.reasoning;
|
|
86038
|
+
if (reasoningText == null && Array.isArray(msg?.reasoning_details)) {
|
|
86039
|
+
const parts = msg.reasoning_details.map((d) => d.content ?? d.summary ?? "").filter(Boolean);
|
|
86040
|
+
if (parts.length > 0)
|
|
86041
|
+
reasoningText = parts.join(`
|
|
86042
|
+
`);
|
|
86043
|
+
}
|
|
86044
|
+
if (typeof reasoningText === "string" && reasoningText) {
|
|
86045
|
+
content.push({
|
|
86046
|
+
type: "thinking",
|
|
86047
|
+
thinking: reasoningText,
|
|
86048
|
+
signature: "",
|
|
86049
|
+
extra_content: { provenance: "openai-chat" }
|
|
86050
|
+
});
|
|
86051
|
+
}
|
|
85858
86052
|
const rawContent = choice?.message?.content;
|
|
85859
86053
|
if (typeof rawContent === "string" && rawContent) {
|
|
85860
86054
|
content.push({ type: "text", text: rawContent });
|
|
@@ -85958,6 +86152,7 @@ var init_shim2 = __esm(() => {
|
|
|
85958
86152
|
init_config3();
|
|
85959
86153
|
init_schemaSanitizer();
|
|
85960
86154
|
init_providerProfile();
|
|
86155
|
+
init_capabilities2();
|
|
85961
86156
|
OpenAIShimStream = class OpenAIShimStream {
|
|
85962
86157
|
generator;
|
|
85963
86158
|
controller = new AbortController;
|
|
@@ -86230,36 +86425,6 @@ var init_anthropic = __esm(() => {
|
|
|
86230
86425
|
init_errors5();
|
|
86231
86426
|
});
|
|
86232
86427
|
|
|
86233
|
-
// src/providers/openai/capabilities.ts
|
|
86234
|
-
function supportsReasoningEffort(model) {
|
|
86235
|
-
return /^(o\d|gpt-5|gpt-4\.5)/i.test(model);
|
|
86236
|
-
}
|
|
86237
|
-
function getOpenAICompatMaxOutputTokens(model) {
|
|
86238
|
-
const max = getOpenAIMaxOutputTokens(model);
|
|
86239
|
-
if (max === undefined)
|
|
86240
|
-
return null;
|
|
86241
|
-
return { default: max, upperLimit: max };
|
|
86242
|
-
}
|
|
86243
|
-
function getOpenAICompatContextWindow(model) {
|
|
86244
|
-
return getOpenAIContextWindow(model) ?? null;
|
|
86245
|
-
}
|
|
86246
|
-
function openAICompatSupports(feature, model) {
|
|
86247
|
-
if (feature === "reasoning-effort")
|
|
86248
|
-
return supportsReasoningEffort(model);
|
|
86249
|
-
return FEATURES_OPENAI_COMPAT.includes(feature);
|
|
86250
|
-
}
|
|
86251
|
-
var FEATURES_OPENAI_COMPAT;
|
|
86252
|
-
var init_capabilities2 = __esm(() => {
|
|
86253
|
-
init_openaiContextWindows();
|
|
86254
|
-
FEATURES_OPENAI_COMPAT = Object.freeze([
|
|
86255
|
-
"streaming",
|
|
86256
|
-
"tool-use",
|
|
86257
|
-
"image-input",
|
|
86258
|
-
"parallel-tool-calls",
|
|
86259
|
-
"system-message-top-level"
|
|
86260
|
-
]);
|
|
86261
|
-
});
|
|
86262
|
-
|
|
86263
86428
|
// src/providers/openai/errors.ts
|
|
86264
86429
|
function readErrorMessage(body) {
|
|
86265
86430
|
if (!body || typeof body !== "object")
|
|
@@ -94201,7 +94366,7 @@ function printStartupScreen() {
|
|
|
94201
94366
|
const sLen = ` ● ${sL} Ready — type /help to begin`.length;
|
|
94202
94367
|
out.push(boxRow(sRow, W2, sLen));
|
|
94203
94368
|
out.push(`${rgb(...BORDER)}╚${"═".repeat(W2 - 2)}╝${RESET}`);
|
|
94204
|
-
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}`);
|
|
94205
94370
|
out.push("");
|
|
94206
94371
|
process.stdout.write(out.join(`
|
|
94207
94372
|
`) + `
|
|
@@ -95356,10 +95521,10 @@ function getCLISyspromptPrefix(options) {
|
|
|
95356
95521
|
return DEFAULT_PREFIX;
|
|
95357
95522
|
}
|
|
95358
95523
|
function isAttributionHeaderEnabled() {
|
|
95359
|
-
if (
|
|
95360
|
-
return
|
|
95524
|
+
if (isEnvTruthy(resolveEnvVar("ATTRIBUTION_HEADER"))) {
|
|
95525
|
+
return true;
|
|
95361
95526
|
}
|
|
95362
|
-
return getFeatureValue_CACHED_MAY_BE_STALE("tengu_attribution_header",
|
|
95527
|
+
return getFeatureValue_CACHED_MAY_BE_STALE("tengu_attribution_header", false);
|
|
95363
95528
|
}
|
|
95364
95529
|
function getAttributionHeader(fingerprint) {
|
|
95365
95530
|
if (!isAttributionHeaderEnabled()) {
|
|
@@ -95370,7 +95535,7 @@ function getAttributionHeader(fingerprint) {
|
|
|
95370
95535
|
const cch = "";
|
|
95371
95536
|
const workload = getWorkload();
|
|
95372
95537
|
const workloadPair = workload ? ` cc_workload=${workload};` : "";
|
|
95373
|
-
const header = `x-
|
|
95538
|
+
const header = `x-opencow-billing-header: cc_version=${version2}; cc_entrypoint=${entrypoint};${cch}${workloadPair}`;
|
|
95374
95539
|
logForDebugging2(`attribution header ${header}`);
|
|
95375
95540
|
return header;
|
|
95376
95541
|
}
|
|
@@ -106296,7 +106461,7 @@ function getInitialAdvisorSetting() {
|
|
|
106296
106461
|
return getInitialSettings().advisorModel;
|
|
106297
106462
|
}
|
|
106298
106463
|
function getAdvisorUsage(usage) {
|
|
106299
|
-
const iterations = usage
|
|
106464
|
+
const iterations = usage?.iterations;
|
|
106300
106465
|
if (!iterations) {
|
|
106301
106466
|
return [];
|
|
106302
106467
|
}
|
|
@@ -106454,11 +106619,11 @@ function addToTotalModelUsage(cost, usage, model) {
|
|
|
106454
106619
|
contextWindow: 0,
|
|
106455
106620
|
maxOutputTokens: 0
|
|
106456
106621
|
};
|
|
106457
|
-
modelUsage.inputTokens += usage
|
|
106458
|
-
modelUsage.outputTokens += usage
|
|
106459
|
-
modelUsage.cacheReadInputTokens += usage
|
|
106460
|
-
modelUsage.cacheCreationInputTokens += usage
|
|
106461
|
-
modelUsage.webSearchRequests += usage
|
|
106622
|
+
modelUsage.inputTokens += usage?.input_tokens ?? 0;
|
|
106623
|
+
modelUsage.outputTokens += usage?.output_tokens ?? 0;
|
|
106624
|
+
modelUsage.cacheReadInputTokens += usage?.cache_read_input_tokens ?? 0;
|
|
106625
|
+
modelUsage.cacheCreationInputTokens += usage?.cache_creation_input_tokens ?? 0;
|
|
106626
|
+
modelUsage.webSearchRequests += usage?.server_tool_use?.web_search_requests ?? 0;
|
|
106462
106627
|
modelUsage.costUSD += cost;
|
|
106463
106628
|
modelUsage.contextWindow = getContextWindowForModel(model, getSdkBetas());
|
|
106464
106629
|
modelUsage.maxOutputTokens = getModelMaxOutputTokens(model).default;
|
|
@@ -106467,15 +106632,18 @@ function addToTotalModelUsage(cost, usage, model) {
|
|
|
106467
106632
|
function addToTotalSessionCost(cost, usage, model) {
|
|
106468
106633
|
const modelUsage = addToTotalModelUsage(cost, usage, model);
|
|
106469
106634
|
addToTotalCostState(cost, modelUsage, model);
|
|
106470
|
-
const attrs = isFastModeEnabled() && usage
|
|
106635
|
+
const attrs = isFastModeEnabled() && usage?.speed === "fast" ? { model, speed: "fast" } : { model };
|
|
106471
106636
|
getCostCounter()?.add(cost, attrs);
|
|
106472
|
-
getTokenCounter()?.add(usage
|
|
106473
|
-
getTokenCounter()?.add(usage
|
|
106474
|
-
|
|
106637
|
+
getTokenCounter()?.add(usage?.input_tokens ?? 0, { ...attrs, type: "input" });
|
|
106638
|
+
getTokenCounter()?.add(usage?.output_tokens ?? 0, {
|
|
106639
|
+
...attrs,
|
|
106640
|
+
type: "output"
|
|
106641
|
+
});
|
|
106642
|
+
getTokenCounter()?.add(usage?.cache_read_input_tokens ?? 0, {
|
|
106475
106643
|
...attrs,
|
|
106476
106644
|
type: "cacheRead"
|
|
106477
106645
|
});
|
|
106478
|
-
getTokenCounter()?.add(usage
|
|
106646
|
+
getTokenCounter()?.add(usage?.cache_creation_input_tokens ?? 0, {
|
|
106479
106647
|
...attrs,
|
|
106480
106648
|
type: "cacheCreation"
|
|
106481
106649
|
});
|
|
@@ -239481,26 +239649,41 @@ var init_permissionLogging = __esm(() => {
|
|
|
239481
239649
|
});
|
|
239482
239650
|
|
|
239483
239651
|
// src/lib/toolInputNullCoercion.ts
|
|
239484
|
-
function
|
|
239485
|
-
|
|
239486
|
-
|
|
239487
|
-
|
|
239488
|
-
|
|
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);
|
|
239489
239659
|
}
|
|
239490
|
-
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;
|
|
239491
239676
|
}
|
|
239492
239677
|
function safeParseToolInputWithNullCoercion(schema, input) {
|
|
239493
239678
|
const first = schema.safeParse(input);
|
|
239494
239679
|
if (first.success)
|
|
239495
239680
|
return first;
|
|
239496
|
-
if (input === null || typeof input !== "object"
|
|
239681
|
+
if (input === null || typeof input !== "object") {
|
|
239497
239682
|
return first;
|
|
239498
239683
|
}
|
|
239499
|
-
|
|
239500
|
-
const hasNull = Object.values(record3).some((value) => value === null);
|
|
239501
|
-
if (!hasNull)
|
|
239684
|
+
if (!containsNull(input))
|
|
239502
239685
|
return first;
|
|
239503
|
-
const retry = schema.safeParse(
|
|
239686
|
+
const retry = schema.safeParse(deepOmitNullProps(input));
|
|
239504
239687
|
return retry.success ? retry : first;
|
|
239505
239688
|
}
|
|
239506
239689
|
|
|
@@ -243992,7 +244175,7 @@ function getAnthropicEnvMetadata() {
|
|
|
243992
244175
|
function getBuildAgeMinutes() {
|
|
243993
244176
|
if (false)
|
|
243994
244177
|
;
|
|
243995
|
-
const buildTime = new Date("2026-
|
|
244178
|
+
const buildTime = new Date("2026-06-03T12:46:47.435Z").getTime();
|
|
243996
244179
|
if (isNaN(buildTime))
|
|
243997
244180
|
return;
|
|
243998
244181
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -256990,7 +257173,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
|
|
|
256990
257173
|
return {
|
|
256991
257174
|
behavior: "ask",
|
|
256992
257175
|
decisionReason: decisionReason2,
|
|
256993
|
-
message: createPermissionRequestMessage2(
|
|
257176
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
256994
257177
|
};
|
|
256995
257178
|
}
|
|
256996
257179
|
{
|
|
@@ -257016,7 +257199,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
|
|
|
257016
257199
|
return {
|
|
257017
257200
|
behavior: "ask",
|
|
257018
257201
|
decisionReason: decisionReason2,
|
|
257019
|
-
message: createPermissionRequestMessage2(
|
|
257202
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
257020
257203
|
};
|
|
257021
257204
|
}
|
|
257022
257205
|
}
|
|
@@ -257066,7 +257249,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
|
|
|
257066
257249
|
};
|
|
257067
257250
|
return {
|
|
257068
257251
|
behavior: "ask",
|
|
257069
|
-
message: createPermissionRequestMessage2(
|
|
257252
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
257070
257253
|
decisionReason,
|
|
257071
257254
|
suggestions: suggestions.length > 0 ? suggestions : undefined
|
|
257072
257255
|
};
|
|
@@ -257096,7 +257279,7 @@ async function bashToolCheckCommandOperatorPermissions(input, bashToolHasPermiss
|
|
|
257096
257279
|
};
|
|
257097
257280
|
return {
|
|
257098
257281
|
behavior: "ask",
|
|
257099
|
-
message: createPermissionRequestMessage2(
|
|
257282
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
257100
257283
|
decisionReason
|
|
257101
257284
|
};
|
|
257102
257285
|
}
|
|
@@ -259874,21 +260057,21 @@ function getFirstWordPrefix(command) {
|
|
|
259874
260057
|
function suggestionForExactCommand2(command) {
|
|
259875
260058
|
const heredocPrefix = extractPrefixBeforeHeredoc(command);
|
|
259876
260059
|
if (heredocPrefix) {
|
|
259877
|
-
return suggestionForPrefix(
|
|
260060
|
+
return suggestionForPrefix(BashTool.name, heredocPrefix);
|
|
259878
260061
|
}
|
|
259879
260062
|
if (command.includes(`
|
|
259880
260063
|
`)) {
|
|
259881
260064
|
const firstLine = command.split(`
|
|
259882
260065
|
`)[0].trim();
|
|
259883
260066
|
if (firstLine) {
|
|
259884
|
-
return suggestionForPrefix(
|
|
260067
|
+
return suggestionForPrefix(BashTool.name, firstLine);
|
|
259885
260068
|
}
|
|
259886
260069
|
}
|
|
259887
260070
|
const prefix = getSimpleCommandPrefix(command);
|
|
259888
260071
|
if (prefix) {
|
|
259889
|
-
return suggestionForPrefix(
|
|
260072
|
+
return suggestionForPrefix(BashTool.name, prefix);
|
|
259890
260073
|
}
|
|
259891
|
-
return suggestionForExactCommand(
|
|
260074
|
+
return suggestionForExactCommand(BashTool.name, command);
|
|
259892
260075
|
}
|
|
259893
260076
|
function extractPrefixBeforeHeredoc(command) {
|
|
259894
260077
|
if (!command.includes("<<"))
|
|
@@ -259917,7 +260100,7 @@ function extractPrefixBeforeHeredoc(command) {
|
|
|
259917
260100
|
return tokens.slice(i3, i3 + 2).join(" ") || null;
|
|
259918
260101
|
}
|
|
259919
260102
|
function suggestionForPrefix2(prefix) {
|
|
259920
|
-
return suggestionForPrefix(
|
|
260103
|
+
return suggestionForPrefix(BashTool.name, prefix);
|
|
259921
260104
|
}
|
|
259922
260105
|
function matchWildcardPattern2(pattern, command) {
|
|
259923
260106
|
return matchWildcardPattern(pattern, command);
|
|
@@ -260114,11 +260297,11 @@ function filterRulesByContentsMatchingInput(input, rules, matchMode, {
|
|
|
260114
260297
|
}).map(([, rule]) => rule);
|
|
260115
260298
|
}
|
|
260116
260299
|
function matchingRulesForInput(input, toolPermissionContext, matchMode, { skipCompoundCheck = false } = {}) {
|
|
260117
|
-
const denyRuleByContents = getRuleByContentsForTool(toolPermissionContext,
|
|
260300
|
+
const denyRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "deny");
|
|
260118
260301
|
const matchingDenyRules = filterRulesByContentsMatchingInput(input, denyRuleByContents, matchMode, { stripAllEnvVars: true, skipCompoundCheck: true });
|
|
260119
|
-
const askRuleByContents = getRuleByContentsForTool(toolPermissionContext,
|
|
260302
|
+
const askRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "ask");
|
|
260120
260303
|
const matchingAskRules = filterRulesByContentsMatchingInput(input, askRuleByContents, matchMode, { stripAllEnvVars: true, skipCompoundCheck: true });
|
|
260121
|
-
const allowRuleByContents = getRuleByContentsForTool(toolPermissionContext,
|
|
260304
|
+
const allowRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "allow");
|
|
260122
260305
|
const matchingAllowRules = filterRulesByContentsMatchingInput(input, allowRuleByContents, matchMode, { skipCompoundCheck });
|
|
260123
260306
|
return {
|
|
260124
260307
|
matchingDenyRules,
|
|
@@ -260144,7 +260327,7 @@ async function checkCommandAndSuggestRules(input, toolPermissionContext, command
|
|
|
260144
260327
|
};
|
|
260145
260328
|
return {
|
|
260146
260329
|
behavior: "ask",
|
|
260147
|
-
message: createPermissionRequestMessage2(
|
|
260330
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
260148
260331
|
decisionReason,
|
|
260149
260332
|
suggestions: []
|
|
260150
260333
|
};
|
|
@@ -260165,7 +260348,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
|
|
|
260165
260348
|
if (matchingDenyRules[0] !== undefined) {
|
|
260166
260349
|
return {
|
|
260167
260350
|
behavior: "deny",
|
|
260168
|
-
message: `Permission to use ${
|
|
260351
|
+
message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
|
|
260169
260352
|
decisionReason: {
|
|
260170
260353
|
type: "rule",
|
|
260171
260354
|
rule: matchingDenyRules[0]
|
|
@@ -260180,7 +260363,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
|
|
|
260180
260363
|
if (subResult.matchingDenyRules[0] !== undefined) {
|
|
260181
260364
|
return {
|
|
260182
260365
|
behavior: "deny",
|
|
260183
|
-
message: `Permission to use ${
|
|
260366
|
+
message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
|
|
260184
260367
|
decisionReason: {
|
|
260185
260368
|
type: "rule",
|
|
260186
260369
|
rule: subResult.matchingDenyRules[0]
|
|
@@ -260192,7 +260375,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
|
|
|
260192
260375
|
if (firstAskRule) {
|
|
260193
260376
|
return {
|
|
260194
260377
|
behavior: "ask",
|
|
260195
|
-
message: createPermissionRequestMessage2(
|
|
260378
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
260196
260379
|
decisionReason: {
|
|
260197
260380
|
type: "rule",
|
|
260198
260381
|
rule: firstAskRule
|
|
@@ -260203,7 +260386,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
|
|
|
260203
260386
|
if (matchingAskRules[0] !== undefined) {
|
|
260204
260387
|
return {
|
|
260205
260388
|
behavior: "ask",
|
|
260206
|
-
message: createPermissionRequestMessage2(
|
|
260389
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
260207
260390
|
decisionReason: {
|
|
260208
260391
|
type: "rule",
|
|
260209
260392
|
rule: matchingAskRules[0]
|
|
@@ -260240,7 +260423,7 @@ function checkEarlyExitDeny(input, toolPermissionContext) {
|
|
|
260240
260423
|
if (denyMatch !== undefined) {
|
|
260241
260424
|
return {
|
|
260242
260425
|
behavior: "deny",
|
|
260243
|
-
message: `Permission to use ${
|
|
260426
|
+
message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
|
|
260244
260427
|
decisionReason: { type: "rule", rule: denyMatch }
|
|
260245
260428
|
};
|
|
260246
260429
|
}
|
|
@@ -260255,7 +260438,7 @@ function checkSemanticsDeny(input, toolPermissionContext, commands) {
|
|
|
260255
260438
|
if (subDeny !== undefined) {
|
|
260256
260439
|
return {
|
|
260257
260440
|
behavior: "deny",
|
|
260258
|
-
message: `Permission to use ${
|
|
260441
|
+
message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
|
|
260259
260442
|
decisionReason: { type: "rule", rule: subDeny }
|
|
260260
260443
|
};
|
|
260261
260444
|
}
|
|
@@ -260345,7 +260528,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260345
260528
|
return {
|
|
260346
260529
|
behavior: "ask",
|
|
260347
260530
|
decisionReason: decisionReason2,
|
|
260348
|
-
message: createPermissionRequestMessage2(
|
|
260531
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
|
|
260349
260532
|
suggestions: [],
|
|
260350
260533
|
...{}
|
|
260351
260534
|
};
|
|
@@ -260363,7 +260546,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260363
260546
|
return {
|
|
260364
260547
|
behavior: "ask",
|
|
260365
260548
|
decisionReason: decisionReason2,
|
|
260366
|
-
message: createPermissionRequestMessage2(
|
|
260549
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
|
|
260367
260550
|
suggestions: []
|
|
260368
260551
|
};
|
|
260369
260552
|
}
|
|
@@ -260382,7 +260565,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260382
260565
|
return {
|
|
260383
260566
|
behavior: "ask",
|
|
260384
260567
|
decisionReason: decisionReason2,
|
|
260385
|
-
message: createPermissionRequestMessage2(
|
|
260568
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
260386
260569
|
};
|
|
260387
260570
|
}
|
|
260388
260571
|
}
|
|
@@ -260438,7 +260621,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260438
260621
|
}
|
|
260439
260622
|
return {
|
|
260440
260623
|
behavior: "ask",
|
|
260441
|
-
message: createPermissionRequestMessage2(
|
|
260624
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
260442
260625
|
decisionReason: {
|
|
260443
260626
|
type: "other",
|
|
260444
260627
|
reason: `Required by Bash prompt rule: "${askResult.matchedDescription}"`
|
|
@@ -260457,7 +260640,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260457
260640
|
appState = context4.getAppState();
|
|
260458
260641
|
return {
|
|
260459
260642
|
behavior: "ask",
|
|
260460
|
-
message: createPermissionRequestMessage2(
|
|
260643
|
+
message: createPermissionRequestMessage2(BashTool.name, {
|
|
260461
260644
|
type: "other",
|
|
260462
260645
|
reason: safetyResult.message ?? "Command contains patterns that require approval"
|
|
260463
260646
|
}),
|
|
@@ -260500,7 +260683,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260500
260683
|
};
|
|
260501
260684
|
return {
|
|
260502
260685
|
behavior: "ask",
|
|
260503
|
-
message: createPermissionRequestMessage2(
|
|
260686
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
|
|
260504
260687
|
decisionReason: decisionReason2,
|
|
260505
260688
|
suggestions: [],
|
|
260506
260689
|
...{}
|
|
@@ -260520,7 +260703,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260520
260703
|
};
|
|
260521
260704
|
return {
|
|
260522
260705
|
behavior: "ask",
|
|
260523
|
-
message: createPermissionRequestMessage2(
|
|
260706
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
|
|
260524
260707
|
decisionReason: decisionReason2
|
|
260525
260708
|
};
|
|
260526
260709
|
}
|
|
@@ -260533,7 +260716,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260533
260716
|
return {
|
|
260534
260717
|
behavior: "ask",
|
|
260535
260718
|
decisionReason: decisionReason2,
|
|
260536
|
-
message: createPermissionRequestMessage2(
|
|
260719
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
260537
260720
|
};
|
|
260538
260721
|
}
|
|
260539
260722
|
const compoundCommandHasCd = cdCommands.length > 0;
|
|
@@ -260547,7 +260730,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260547
260730
|
return {
|
|
260548
260731
|
behavior: "ask",
|
|
260549
260732
|
decisionReason: decisionReason2,
|
|
260550
|
-
message: createPermissionRequestMessage2(
|
|
260733
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
|
|
260551
260734
|
};
|
|
260552
260735
|
}
|
|
260553
260736
|
}
|
|
@@ -260557,7 +260740,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260557
260740
|
if (deniedSubresult !== undefined) {
|
|
260558
260741
|
return {
|
|
260559
260742
|
behavior: "deny",
|
|
260560
|
-
message: `Permission to use ${
|
|
260743
|
+
message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
|
|
260561
260744
|
decisionReason: {
|
|
260562
260745
|
type: "subcommandResults",
|
|
260563
260746
|
reasons: new Map(subcommandPermissionDecisions.map((result, i3) => [
|
|
@@ -260683,7 +260866,7 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
260683
260866
|
] : undefined;
|
|
260684
260867
|
return {
|
|
260685
260868
|
behavior: askSubresult !== undefined ? "ask" : "passthrough",
|
|
260686
|
-
message: createPermissionRequestMessage2(
|
|
260869
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
260687
260870
|
decisionReason,
|
|
260688
260871
|
suggestions: suggestedUpdates,
|
|
260689
260872
|
...{}
|
|
@@ -260724,7 +260907,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260724
260907
|
if (matchingDenyRules[0] !== undefined) {
|
|
260725
260908
|
return {
|
|
260726
260909
|
behavior: "deny",
|
|
260727
|
-
message: `Permission to use ${
|
|
260910
|
+
message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
|
|
260728
260911
|
decisionReason: {
|
|
260729
260912
|
type: "rule",
|
|
260730
260913
|
rule: matchingDenyRules[0]
|
|
@@ -260734,7 +260917,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260734
260917
|
if (matchingAskRules[0] !== undefined) {
|
|
260735
260918
|
return {
|
|
260736
260919
|
behavior: "ask",
|
|
260737
|
-
message: createPermissionRequestMessage2(
|
|
260920
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
260738
260921
|
decisionReason: {
|
|
260739
260922
|
type: "rule",
|
|
260740
260923
|
rule: matchingAskRules[0]
|
|
@@ -260757,7 +260940,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260757
260940
|
};
|
|
260758
260941
|
return {
|
|
260759
260942
|
behavior: "passthrough",
|
|
260760
|
-
message: createPermissionRequestMessage2(
|
|
260943
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
260761
260944
|
decisionReason,
|
|
260762
260945
|
suggestions: suggestionForExactCommand2(command)
|
|
260763
260946
|
};
|
|
@@ -260773,7 +260956,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260773
260956
|
if (matchingDenyRules[0] !== undefined) {
|
|
260774
260957
|
return {
|
|
260775
260958
|
behavior: "deny",
|
|
260776
|
-
message: `Permission to use ${
|
|
260959
|
+
message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
|
|
260777
260960
|
decisionReason: {
|
|
260778
260961
|
type: "rule",
|
|
260779
260962
|
rule: matchingDenyRules[0]
|
|
@@ -260783,7 +260966,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260783
260966
|
if (matchingAskRules[0] !== undefined) {
|
|
260784
260967
|
return {
|
|
260785
260968
|
behavior: "ask",
|
|
260786
|
-
message: createPermissionRequestMessage2(
|
|
260969
|
+
message: createPermissionRequestMessage2(BashTool.name),
|
|
260787
260970
|
decisionReason: {
|
|
260788
260971
|
type: "rule",
|
|
260789
260972
|
rule: matchingAskRules[0]
|
|
@@ -260815,7 +260998,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260815
260998
|
if (modeResult.behavior !== "passthrough") {
|
|
260816
260999
|
return modeResult;
|
|
260817
261000
|
}
|
|
260818
|
-
if (
|
|
261001
|
+
if (BashTool.isReadOnly(input)) {
|
|
260819
261002
|
return {
|
|
260820
261003
|
behavior: "allow",
|
|
260821
261004
|
updatedInput: input,
|
|
@@ -260831,7 +261014,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
|
|
|
260831
261014
|
};
|
|
260832
261015
|
return {
|
|
260833
261016
|
behavior: "passthrough",
|
|
260834
|
-
message: createPermissionRequestMessage2(
|
|
261017
|
+
message: createPermissionRequestMessage2(BashTool.name, decisionReason),
|
|
260835
261018
|
decisionReason,
|
|
260836
261019
|
suggestions: suggestionForExactCommand2(command)
|
|
260837
261020
|
};
|
|
@@ -273530,7 +273713,7 @@ function getReplPrimitiveTools() {
|
|
|
273530
273713
|
FileEditTool,
|
|
273531
273714
|
GlobTool,
|
|
273532
273715
|
GrepTool,
|
|
273533
|
-
|
|
273716
|
+
BashTool,
|
|
273534
273717
|
NotebookEditTool,
|
|
273535
273718
|
AgentTool
|
|
273536
273719
|
];
|
|
@@ -276814,7 +276997,7 @@ async function* runShellCommand({
|
|
|
276814
276997
|
}
|
|
276815
276998
|
}
|
|
276816
276999
|
var fileEditUserFacingName, getBackgroundHintJSX2, renderToolResultMessage10, renderToolUseErrorMessage8, renderToolUseMessage10, renderToolUseProgressMessage3, renderToolUseQueuedMessage, EOL = `
|
|
276817
|
-
`, 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;
|
|
276818
277001
|
var init_BashTool = __esm(() => {
|
|
276819
277002
|
init_v4();
|
|
276820
277003
|
init_state();
|
|
@@ -276937,7 +277120,7 @@ For commands that are harder to parse at a glance (piped commands, obscure flags
|
|
|
276937
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)"),
|
|
276938
277121
|
persistedOutputSize: exports_external.number().optional().describe("Total size of the output in bytes (set when output is too large for inline)")
|
|
276939
277122
|
}));
|
|
276940
|
-
|
|
277123
|
+
BashTool = buildToolRuntime({
|
|
276941
277124
|
name: BASH_TOOL_NAME2,
|
|
276942
277125
|
searchHint: "execute shell commands",
|
|
276943
277126
|
maxResultSizeChars: 30000,
|
|
@@ -283305,7 +283488,7 @@ var init_PowerShellTool = __esm(() => {
|
|
|
283305
283488
|
import { randomUUID as randomUUID14 } from "crypto";
|
|
283306
283489
|
async function executeShellCommandsInPrompt(text, context4, slashCommandName, shell) {
|
|
283307
283490
|
let result = text;
|
|
283308
|
-
const shellTool = shell === "powershell" && isPowerShellToolEnabled() ? getPowerShellTool() :
|
|
283491
|
+
const shellTool = shell === "powershell" && isPowerShellToolEnabled() ? getPowerShellTool() : BashTool;
|
|
283309
283492
|
const blockMatches = text.matchAll(BLOCK_PATTERN);
|
|
283310
283493
|
const inlineMatches = text.includes("!`") ? text.matchAll(INLINE_PATTERN) : [];
|
|
283311
283494
|
await Promise.all([...blockMatches, ...inlineMatches].map(async (match) => {
|
|
@@ -306219,7 +306402,7 @@ function splitSysPromptPrefix(systemPrompt, options2) {
|
|
|
306219
306402
|
continue;
|
|
306220
306403
|
if (prompt === SYSTEM_PROMPT_DYNAMIC_BOUNDARY)
|
|
306221
306404
|
continue;
|
|
306222
|
-
if (prompt.startsWith("x-
|
|
306405
|
+
if (prompt.startsWith("x-opencow-billing-header")) {
|
|
306223
306406
|
attributionHeader2 = prompt;
|
|
306224
306407
|
} else if (CLI_SYSPROMPT_PREFIXES.has(prompt)) {
|
|
306225
306408
|
systemPromptPrefix2 = prompt;
|
|
@@ -306253,7 +306436,7 @@ function splitSysPromptPrefix(systemPrompt, options2) {
|
|
|
306253
306436
|
const block2 = systemPrompt[i3];
|
|
306254
306437
|
if (!block2 || block2 === SYSTEM_PROMPT_DYNAMIC_BOUNDARY)
|
|
306255
306438
|
continue;
|
|
306256
|
-
if (block2.startsWith("x-
|
|
306439
|
+
if (block2.startsWith("x-opencow-billing-header")) {
|
|
306257
306440
|
attributionHeader2 = block2;
|
|
306258
306441
|
} else if (CLI_SYSPROMPT_PREFIXES.has(block2)) {
|
|
306259
306442
|
systemPromptPrefix2 = block2;
|
|
@@ -306296,7 +306479,7 @@ function splitSysPromptPrefix(systemPrompt, options2) {
|
|
|
306296
306479
|
for (const block2 of systemPrompt) {
|
|
306297
306480
|
if (!block2)
|
|
306298
306481
|
continue;
|
|
306299
|
-
if (block2.startsWith("x-
|
|
306482
|
+
if (block2.startsWith("x-opencow-billing-header")) {
|
|
306300
306483
|
attributionHeader = block2;
|
|
306301
306484
|
} else if (CLI_SYSPROMPT_PREFIXES.has(block2)) {
|
|
306302
306485
|
systemPromptPrefix = block2;
|
|
@@ -306405,8 +306588,8 @@ function normalizeToolInput(tool, input, agentId) {
|
|
|
306405
306588
|
persistFileSnapshotIfRemote();
|
|
306406
306589
|
return plan !== null ? { ...input, plan, planFilePath } : input;
|
|
306407
306590
|
}
|
|
306408
|
-
case
|
|
306409
|
-
const parsed =
|
|
306591
|
+
case BashTool.name: {
|
|
306592
|
+
const parsed = BashTool.inputSchema.parse(input);
|
|
306410
306593
|
const { command, timeout, description } = parsed;
|
|
306411
306594
|
const cwd = getCwd3();
|
|
306412
306595
|
let normalizedCommand = command.replace(`cd ${cwd} && `, "");
|
|
@@ -313930,6 +314113,7 @@ var init_messages4 = __esm(() => {
|
|
|
313930
314113
|
init_xml();
|
|
313931
314114
|
init_diagnostics2();
|
|
313932
314115
|
init_Tool();
|
|
314116
|
+
init_BashTool();
|
|
313933
314117
|
init_FileReadTool();
|
|
313934
314118
|
init_api3();
|
|
313935
314119
|
init_config2();
|
|
@@ -411446,7 +411630,7 @@ function usePermissionRequestLogging(toolUseConfirm, unaryEvent) {
|
|
|
411446
411630
|
});
|
|
411447
411631
|
if (process.env.USER_TYPE === "ant") {
|
|
411448
411632
|
const permissionResult = toolUseConfirm.permissionResult;
|
|
411449
|
-
if (toolUseConfirm.tool.name ===
|
|
411633
|
+
if (toolUseConfirm.tool.name === BashTool.name && permissionResult.behavior === "ask" && !hasRules(permissionResult.suggestions)) {
|
|
411450
411634
|
logEvent("tengu_internal_tool_use_permission_request_no_always_allow", {
|
|
411451
411635
|
messageID: toolUseConfirm.assistantMessage.message.id,
|
|
411452
411636
|
toolName: sanitizeToolNameForAnalytics(toolUseConfirm.tool.name),
|
|
@@ -411458,8 +411642,8 @@ function usePermissionRequestLogging(toolUseConfirm, unaryEvent) {
|
|
|
411458
411642
|
}
|
|
411459
411643
|
}
|
|
411460
411644
|
if (process.env.USER_TYPE === "ant") {
|
|
411461
|
-
const parsedInput =
|
|
411462
|
-
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) {
|
|
411463
411647
|
let split = [parsedInput.data.command];
|
|
411464
411648
|
try {
|
|
411465
411649
|
split = splitCommand_DEPRECATED(parsedInput.data.command);
|
|
@@ -415548,7 +415732,7 @@ function SedEditPermissionRequestInner(t0) {
|
|
|
415548
415732
|
let t4;
|
|
415549
415733
|
if ($2[11] !== filePath || $2[12] !== newContent) {
|
|
415550
415734
|
t4 = (input) => {
|
|
415551
|
-
const parsed =
|
|
415735
|
+
const parsed = BashTool.inputSchema.parse(input);
|
|
415552
415736
|
return {
|
|
415553
415737
|
...parsed,
|
|
415554
415738
|
_simulatedSedEdit: {
|
|
@@ -416117,7 +416301,7 @@ function BashPermissionRequest(props) {
|
|
|
416117
416301
|
({
|
|
416118
416302
|
command,
|
|
416119
416303
|
description
|
|
416120
|
-
} =
|
|
416304
|
+
} = BashTool.inputSchema.parse(toolUseConfirm.input));
|
|
416121
416305
|
t0 = parseSedEditCommand(command);
|
|
416122
416306
|
$2[0] = toolUseConfirm.input;
|
|
416123
416307
|
$2[1] = command;
|
|
@@ -416235,7 +416419,7 @@ function BashPermissionRequestInner({
|
|
|
416235
416419
|
const isCompound = toolUseConfirm.permissionResult.decisionReason?.type === "subcommandResults";
|
|
416236
416420
|
const [editablePrefix, setEditablePrefix] = import_react115.useState(() => {
|
|
416237
416421
|
if (isCompound) {
|
|
416238
|
-
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);
|
|
416239
416423
|
return backendBashRules.length === 1 ? backendBashRules[0].ruleContent : undefined;
|
|
416240
416424
|
}
|
|
416241
416425
|
const two = getSimpleCommandPrefix(command);
|
|
@@ -416255,7 +416439,7 @@ function BashPermissionRequestInner({
|
|
|
416255
416439
|
if (isCompound)
|
|
416256
416440
|
return;
|
|
416257
416441
|
let cancelled = false;
|
|
416258
|
-
getCompoundCommandPrefixesStatic(command, (subcmd) =>
|
|
416442
|
+
getCompoundCommandPrefixesStatic(command, (subcmd) => BashTool.isReadOnly({
|
|
416259
416443
|
command: subcmd
|
|
416260
416444
|
})).then((prefixes) => {
|
|
416261
416445
|
if (cancelled || hasUserEditedPrefix.current)
|
|
@@ -416338,7 +416522,7 @@ function BashPermissionRequestInner({
|
|
|
416338
416522
|
const prefixUpdates = [{
|
|
416339
416523
|
type: "addRules",
|
|
416340
416524
|
rules: [{
|
|
416341
|
-
toolName:
|
|
416525
|
+
toolName: BashTool.name,
|
|
416342
416526
|
ruleContent: trimmedPrefix
|
|
416343
416527
|
}],
|
|
416344
416528
|
behavior: "allow",
|
|
@@ -416399,7 +416583,7 @@ function BashPermissionRequestInner({
|
|
|
416399
416583
|
children: [
|
|
416400
416584
|
/* @__PURE__ */ jsx_dev_runtime156.jsxDEV(ThemedText, {
|
|
416401
416585
|
dimColor: explainerState.visible,
|
|
416402
|
-
children:
|
|
416586
|
+
children: BashTool.renderToolUseMessage({
|
|
416403
416587
|
command,
|
|
416404
416588
|
description
|
|
416405
416589
|
}, {
|
|
@@ -423599,7 +423783,7 @@ function permissionComponentForTool(tool) {
|
|
|
423599
423783
|
return FileEditPermissionRequest;
|
|
423600
423784
|
case FileWriteTool:
|
|
423601
423785
|
return FileWritePermissionRequest;
|
|
423602
|
-
case
|
|
423786
|
+
case BashTool:
|
|
423603
423787
|
return BashPermissionRequest;
|
|
423604
423788
|
case PowerShellTool:
|
|
423605
423789
|
return PowerShellPermissionRequest;
|
|
@@ -479131,7 +479315,7 @@ function buildPrimarySection() {
|
|
|
479131
479315
|
}, undefined, false, undefined, this);
|
|
479132
479316
|
return [{
|
|
479133
479317
|
label: "Version",
|
|
479134
|
-
value: "0.4.
|
|
479318
|
+
value: "0.4.5"
|
|
479135
479319
|
}, {
|
|
479136
479320
|
label: "Session name",
|
|
479137
479321
|
value: nameValue
|
|
@@ -513852,7 +514036,7 @@ function PermissionRuleDescription(t0) {
|
|
|
513852
514036
|
ruleValue
|
|
513853
514037
|
} = t0;
|
|
513854
514038
|
switch (ruleValue.toolName) {
|
|
513855
|
-
case
|
|
514039
|
+
case BashTool.name: {
|
|
513856
514040
|
if (ruleValue.ruleContent) {
|
|
513857
514041
|
if (ruleValue.ruleContent.endsWith(":*")) {
|
|
513858
514042
|
let t1;
|
|
@@ -514255,7 +514439,7 @@ function PermissionRuleInput(t0) {
|
|
|
514255
514439
|
/* @__PURE__ */ jsx_dev_runtime365.jsxDEV(ThemedText, {
|
|
514256
514440
|
bold: true,
|
|
514257
514441
|
children: permissionRuleValueToString({
|
|
514258
|
-
toolName:
|
|
514442
|
+
toolName: BashTool.name,
|
|
514259
514443
|
ruleContent: "ls:*"
|
|
514260
514444
|
})
|
|
514261
514445
|
}, undefined, false, undefined, this)
|
|
@@ -529578,7 +529762,7 @@ function getToolBuckets() {
|
|
|
529578
529762
|
},
|
|
529579
529763
|
EXECUTION: {
|
|
529580
529764
|
name: "Execution tools",
|
|
529581
|
-
toolNames: new Set([
|
|
529765
|
+
toolNames: new Set([BashTool.name, undefined].filter((n2) => n2 !== undefined))
|
|
529582
529766
|
},
|
|
529583
529767
|
MCP: {
|
|
529584
529768
|
name: "MCP tools",
|
|
@@ -535449,7 +535633,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
535449
535633
|
var call58 = async () => {
|
|
535450
535634
|
return {
|
|
535451
535635
|
type: "text",
|
|
535452
|
-
value: `${"99.0.0"} (built ${"2026-
|
|
535636
|
+
value: `${"99.0.0"} (built ${"2026-06-03T12:46:47.435Z"})`
|
|
535453
535637
|
};
|
|
535454
535638
|
}, version2, version_default;
|
|
535455
535639
|
var init_version = __esm(() => {
|
|
@@ -549241,7 +549425,7 @@ function _cliGetAllBaseTools() {
|
|
|
549241
549425
|
return [
|
|
549242
549426
|
AgentTool,
|
|
549243
549427
|
..._embeddedUITools,
|
|
549244
|
-
|
|
549428
|
+
BashTool,
|
|
549245
549429
|
...hasEmbeddedSearchTools() ? [] : [GlobTool, GrepTool],
|
|
549246
549430
|
ExitPlanModeV2Tool,
|
|
549247
549431
|
FileReadTool,
|
|
@@ -555049,7 +555233,7 @@ function BashModeProgress(t0) {
|
|
|
555049
555233
|
elapsedTimeSeconds: progress.elapsedTimeSeconds,
|
|
555050
555234
|
totalLines: progress.totalLines,
|
|
555051
555235
|
verbose
|
|
555052
|
-
}, undefined, false, undefined, this) :
|
|
555236
|
+
}, undefined, false, undefined, this) : BashTool.renderToolUseProgressMessage?.([], {
|
|
555053
555237
|
verbose,
|
|
555054
555238
|
tools: [],
|
|
555055
555239
|
terminalSize: undefined
|
|
@@ -555129,11 +555313,11 @@ async function processBashCommand(inputString, precedingInputBlocks, attachmentM
|
|
|
555129
555313
|
if (usePowerShell) {
|
|
555130
555314
|
PowerShellTool2 = (init_PowerShellTool(), __toCommonJS(exports_PowerShellTool)).PowerShellTool;
|
|
555131
555315
|
}
|
|
555132
|
-
const shellTool = PowerShellTool2 ??
|
|
555316
|
+
const shellTool = PowerShellTool2 ?? BashTool;
|
|
555133
555317
|
const response = PowerShellTool2 ? await PowerShellTool2.call({
|
|
555134
555318
|
command: inputString,
|
|
555135
555319
|
dangerouslyDisableSandbox: true
|
|
555136
|
-
}, bashModeContext, undefined, undefined, onProgress) : await
|
|
555320
|
+
}, bashModeContext, undefined, undefined, onProgress) : await BashTool.call({
|
|
555137
555321
|
command: inputString,
|
|
555138
555322
|
dangerouslyDisableSandbox: true
|
|
555139
555323
|
}, bashModeContext, undefined, undefined, onProgress);
|
|
@@ -557559,7 +557743,7 @@ function WelcomeV2() {
|
|
|
557559
557743
|
dimColor: true,
|
|
557560
557744
|
children: [
|
|
557561
557745
|
"v",
|
|
557562
|
-
"0.4.
|
|
557746
|
+
"0.4.5",
|
|
557563
557747
|
" "
|
|
557564
557748
|
]
|
|
557565
557749
|
}, undefined, true, undefined, this)
|
|
@@ -557759,7 +557943,7 @@ function WelcomeV2() {
|
|
|
557759
557943
|
dimColor: true,
|
|
557760
557944
|
children: [
|
|
557761
557945
|
"v",
|
|
557762
|
-
"0.4.
|
|
557946
|
+
"0.4.5",
|
|
557763
557947
|
" "
|
|
557764
557948
|
]
|
|
557765
557949
|
}, undefined, true, undefined, this)
|
|
@@ -557985,7 +558169,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
557985
558169
|
dimColor: true,
|
|
557986
558170
|
children: [
|
|
557987
558171
|
"v",
|
|
557988
|
-
"0.4.
|
|
558172
|
+
"0.4.5",
|
|
557989
558173
|
" "
|
|
557990
558174
|
]
|
|
557991
558175
|
}, undefined, true, undefined, this);
|
|
@@ -558239,7 +558423,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
558239
558423
|
dimColor: true,
|
|
558240
558424
|
children: [
|
|
558241
558425
|
"v",
|
|
558242
|
-
"0.4.
|
|
558426
|
+
"0.4.5",
|
|
558243
558427
|
" "
|
|
558244
558428
|
]
|
|
558245
558429
|
}, undefined, true, undefined, this);
|
|
@@ -579085,7 +579269,7 @@ Usage: claude --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
579085
579269
|
pendingHookMessages
|
|
579086
579270
|
}, renderAndRun);
|
|
579087
579271
|
}
|
|
579088
|
-
}).version("0.4.
|
|
579272
|
+
}).version("0.4.5 (OpenCow)", "-v, --version", "Output the version number");
|
|
579089
579273
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
579090
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.");
|
|
579091
579275
|
if (canUserConfigureAdvisor()) {
|
|
@@ -579731,7 +579915,7 @@ if (false) {}
|
|
|
579731
579915
|
async function main2() {
|
|
579732
579916
|
const args = process.argv.slice(2);
|
|
579733
579917
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
579734
|
-
console.log(`${"0.4.
|
|
579918
|
+
console.log(`${"0.4.5"} (OpenCow)`);
|
|
579735
579919
|
return;
|
|
579736
579920
|
}
|
|
579737
579921
|
if (args.includes("--provider")) {
|
|
@@ -579849,4 +580033,4 @@ async function main2() {
|
|
|
579849
580033
|
}
|
|
579850
580034
|
main2();
|
|
579851
580035
|
|
|
579852
|
-
//# debugId=
|
|
580036
|
+
//# debugId=A32EDDBB8A04BA5B64756E2164756E21
|