@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/sdk.js CHANGED
@@ -68866,12 +68866,12 @@ function getOpus46CostTier(fastMode) {
68866
68866
  return COST_TIER_5_25;
68867
68867
  }
68868
68868
  function tokensToUSDCost(modelCosts, usage) {
68869
- return usage.input_tokens / 1e6 * modelCosts.inputTokens + usage.output_tokens / 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;
68869
+ 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;
68870
68870
  }
68871
68871
  function getModelCosts(model, usage) {
68872
68872
  const shortName = getCanonicalName(model);
68873
68873
  if (shortName === firstPartyNameToCanonical(CLAUDE_OPUS_4_6_CONFIG.firstParty)) {
68874
- const isFastMode = usage.speed === "fast";
68874
+ const isFastMode = usage?.speed === "fast";
68875
68875
  return getOpus46CostTier(isFastMode);
68876
68876
  }
68877
68877
  const costs = MODEL_COSTS[shortName];
@@ -94949,10 +94949,25 @@ function sanitizeTypeField(record3) {
94949
94949
  record3.type = filtered;
94950
94950
  }
94951
94951
  }
94952
- function makeSchemaNullable(schema) {
94952
+ function makeSchemaNullable(schema, style = "union") {
94953
94953
  if ("enum" in schema || "const" in schema)
94954
94954
  return schema;
94955
+ if (schema.nullable === true)
94956
+ return schema;
94955
94957
  const raw = schema.type;
94958
+ if (style === "nullable") {
94959
+ if (typeof raw === "string") {
94960
+ if (raw === "null")
94961
+ return schema;
94962
+ return { ...schema, nullable: true };
94963
+ }
94964
+ if (Array.isArray(raw)) {
94965
+ if (raw.includes("null"))
94966
+ return schema;
94967
+ return { ...schema, nullable: true };
94968
+ }
94969
+ return schema;
94970
+ }
94956
94971
  if (typeof raw === "string") {
94957
94972
  if (raw === "null")
94958
94973
  return schema;
@@ -94965,6 +94980,52 @@ function makeSchemaNullable(schema) {
94965
94980
  }
94966
94981
  return schema;
94967
94982
  }
94983
+ function splitTypeArrayToAnyOf(schema) {
94984
+ if (!Array.isArray(schema.type) || schema.type.length < 2)
94985
+ return schema;
94986
+ const types2 = schema.type;
94987
+ const hasNull = types2.includes("null");
94988
+ const nonNullTypes = types2.filter((t) => t !== "null");
94989
+ if (hasNull && nonNullTypes.length === 1) {
94990
+ const { type: _type, ...rest } = schema;
94991
+ return { ...rest, type: nonNullTypes[0], nullable: true };
94992
+ }
94993
+ const ARRAY_KEYS = new Set(["items"]);
94994
+ const OBJECT_KEYS = new Set(["properties", "required", "additionalProperties"]);
94995
+ const TYPE_SPECIFIC_KEYS = new Set([...ARRAY_KEYS, ...OBJECT_KEYS]);
94996
+ const base2 = {};
94997
+ const structural = {};
94998
+ for (const [key, value] of Object.entries(schema)) {
94999
+ if (key === "type")
95000
+ continue;
95001
+ if (TYPE_SPECIFIC_KEYS.has(key)) {
95002
+ structural[key] = value;
95003
+ } else {
95004
+ base2[key] = value;
95005
+ }
95006
+ }
95007
+ const variants = nonNullTypes.map((t) => {
95008
+ const variant = { type: t };
95009
+ if (t === "array") {
95010
+ for (const k of ARRAY_KEYS) {
95011
+ if (k in structural)
95012
+ variant[k] = structural[k];
95013
+ }
95014
+ } else if (t === "object") {
95015
+ for (const k of OBJECT_KEYS) {
95016
+ if (k in structural)
95017
+ variant[k] = structural[k];
95018
+ }
95019
+ }
95020
+ return variant;
95021
+ });
95022
+ if (hasNull)
95023
+ base2.nullable = true;
95024
+ if (variants.length === 1) {
95025
+ return { ...base2, ...variants[0] };
95026
+ }
95027
+ return { ...base2, anyOf: variants };
95028
+ }
94968
95029
  function sanitizeSchemaForOpenAICompat(schema) {
94969
95030
  const stripped = stripSchemaKeywords(schema, OPENAI_INCOMPATIBLE_SCHEMA_KEYWORDS);
94970
95031
  if (!isSchemaRecord(stripped)) {
@@ -95864,6 +95925,51 @@ var init_providerProfile = __esm(() => {
95864
95925
  ];
95865
95926
  });
95866
95927
 
95928
+ // src/providers/openai/capabilities.ts
95929
+ function supportsReasoningEffort(model) {
95930
+ return /^(o\d|gpt-5|gpt-4\.5)/i.test(model);
95931
+ }
95932
+ function isGeminiLikeModel(model) {
95933
+ const normalized = (model ?? "").trim().toLowerCase();
95934
+ return normalized.startsWith("gemini-") || normalized.includes("/gemini-");
95935
+ }
95936
+ function isGeminiTarget(model) {
95937
+ if (isEnvTruthy(getQueryEnvVar("CLAUDE_CODE_USE_GEMINI")))
95938
+ return true;
95939
+ return isGeminiLikeModel(model);
95940
+ }
95941
+ function supportsParallelToolCalls(model) {
95942
+ return !isGeminiTarget(model);
95943
+ }
95944
+ function getOpenAICompatMaxOutputTokens(model) {
95945
+ const max = getOpenAIMaxOutputTokens(model);
95946
+ if (max === undefined)
95947
+ return null;
95948
+ return { default: max, upperLimit: max };
95949
+ }
95950
+ function getOpenAICompatContextWindow(model) {
95951
+ return getOpenAIContextWindow(model) ?? null;
95952
+ }
95953
+ function openAICompatSupports(feature, model) {
95954
+ if (feature === "reasoning-effort")
95955
+ return supportsReasoningEffort(model);
95956
+ if (feature === "parallel-tool-calls")
95957
+ return supportsParallelToolCalls(model);
95958
+ return FEATURES_OPENAI_COMPAT.includes(feature);
95959
+ }
95960
+ var FEATURES_OPENAI_COMPAT;
95961
+ var init_capabilities2 = __esm(() => {
95962
+ init_openaiContextWindows();
95963
+ init_envUtils();
95964
+ init_state2();
95965
+ FEATURES_OPENAI_COMPAT = Object.freeze([
95966
+ "streaming",
95967
+ "tool-use",
95968
+ "image-input",
95969
+ "system-message-top-level"
95970
+ ]);
95971
+ });
95972
+
95867
95973
  // src/providers/openai/shim.ts
95868
95974
  var exports_shim = {};
95869
95975
  __export(exports_shim, {
@@ -96033,15 +96139,18 @@ function convertMessages(messages, system) {
96033
96139
  }
96034
96140
  }
96035
96141
  if (otherContent.length > 0) {
96036
- result.push({
96037
- role: "user",
96038
- content: convertContentBlocks(otherContent)
96039
- });
96142
+ const converted = convertContentBlocks(otherContent);
96143
+ if (converted !== "") {
96144
+ result.push({
96145
+ role: "user",
96146
+ content: converted
96147
+ });
96148
+ }
96040
96149
  }
96041
96150
  } else {
96042
96151
  result.push({
96043
96152
  role: "user",
96044
- content: convertContentBlocks(content)
96153
+ content: convertContentBlocks(content) || "."
96045
96154
  });
96046
96155
  }
96047
96156
  } else if (role === "assistant") {
@@ -96053,7 +96162,8 @@ function convertMessages(messages, system) {
96053
96162
  role: "assistant",
96054
96163
  content: (() => {
96055
96164
  const c5 = convertContentBlocks(textContent);
96056
- return typeof c5 === "string" ? c5 : Array.isArray(c5) ? c5.map((p) => p.text ?? "").join("") : "";
96165
+ const text = typeof c5 === "string" ? c5 : Array.isArray(c5) ? c5.map((p) => p.text ?? "").join("") : "";
96166
+ return text || null;
96057
96167
  })()
96058
96168
  };
96059
96169
  if (thinkingBlocks.length > 0) {
@@ -96076,26 +96186,28 @@ function convertMessages(messages, system) {
96076
96186
  }
96077
96187
  result.push(assistantMsg);
96078
96188
  } else {
96189
+ const c5 = convertContentBlocks(content);
96190
+ const text = typeof c5 === "string" ? c5 : Array.isArray(c5) ? c5.map((p) => p.text ?? "").join("") : "";
96079
96191
  result.push({
96080
96192
  role: "assistant",
96081
- content: (() => {
96082
- const c5 = convertContentBlocks(content);
96083
- return typeof c5 === "string" ? c5 : Array.isArray(c5) ? c5.map((p) => p.text ?? "").join("") : "";
96084
- })()
96193
+ content: text || null
96085
96194
  });
96086
96195
  }
96087
96196
  }
96088
96197
  }
96089
96198
  return result;
96090
96199
  }
96091
- function normalizeSchemaForOpenAI(schema, strict = true, topLevel = true) {
96092
- const record3 = sanitizeSchemaForOpenAICompat(schema);
96200
+ function normalizeSchemaForOpenAI(schema, strict = true, topLevel = true, geminiTarget = false) {
96201
+ let record3 = sanitizeSchemaForOpenAICompat(schema);
96202
+ if (geminiTarget) {
96203
+ record3 = splitTypeArrayToAnyOf(record3);
96204
+ }
96093
96205
  if (record3.type === "object" && record3.properties) {
96094
96206
  const properties = record3.properties;
96095
96207
  const existingRequired = Array.isArray(record3.required) ? record3.required : [];
96096
96208
  const normalizedProps = {};
96097
96209
  for (const [key, value] of Object.entries(properties)) {
96098
- normalizedProps[key] = normalizeSchemaForOpenAI(value, strict, false);
96210
+ normalizedProps[key] = normalizeSchemaForOpenAI(value, strict, false, geminiTarget);
96099
96211
  }
96100
96212
  record3.properties = normalizedProps;
96101
96213
  if (strict) {
@@ -96103,9 +96215,10 @@ function normalizeSchemaForOpenAI(schema, strict = true, topLevel = true) {
96103
96215
  record3.required = Array.from(new Set([...existingRequired, ...allKeys]));
96104
96216
  record3.additionalProperties = false;
96105
96217
  if (topLevel) {
96218
+ const style = geminiTarget ? "nullable" : "union";
96106
96219
  for (const key of allKeys) {
96107
96220
  if (!existingRequired.includes(key)) {
96108
- normalizedProps[key] = makeSchemaNullable(normalizedProps[key]);
96221
+ normalizedProps[key] = makeSchemaNullable(normalizedProps[key], style);
96109
96222
  }
96110
96223
  }
96111
96224
  }
@@ -96115,20 +96228,21 @@ function normalizeSchemaForOpenAI(schema, strict = true, topLevel = true) {
96115
96228
  }
96116
96229
  if ("items" in record3) {
96117
96230
  if (Array.isArray(record3.items)) {
96118
- record3.items = record3.items.map((item) => normalizeSchemaForOpenAI(item, strict, false));
96231
+ record3.items = record3.items.map((item) => normalizeSchemaForOpenAI(item, strict, false, geminiTarget));
96119
96232
  } else {
96120
- record3.items = normalizeSchemaForOpenAI(record3.items, strict, false);
96233
+ record3.items = normalizeSchemaForOpenAI(record3.items, strict, false, geminiTarget);
96121
96234
  }
96122
96235
  }
96123
96236
  for (const key of ["anyOf", "oneOf", "allOf"]) {
96124
96237
  if (key in record3 && Array.isArray(record3[key])) {
96125
- record3[key] = record3[key].map((item) => normalizeSchemaForOpenAI(item, strict, false));
96238
+ record3[key] = record3[key].map((item) => normalizeSchemaForOpenAI(item, strict, false, geminiTarget));
96126
96239
  }
96127
96240
  }
96128
96241
  return record3;
96129
96242
  }
96130
- function convertTools(tools) {
96243
+ function convertTools(tools, model = "") {
96131
96244
  const isGemini = isEnvTruthy(getQueryEnvVar("CLAUDE_CODE_USE_GEMINI"));
96245
+ const geminiTarget = isGeminiTarget(model);
96132
96246
  return tools.filter((t) => t.name !== "ToolSearchTool").map((t) => {
96133
96247
  const schema = { ...t.input_schema ?? { type: "object", properties: {} } };
96134
96248
  if (t.name === "Agent" && schema.properties) {
@@ -96146,7 +96260,7 @@ function convertTools(tools) {
96146
96260
  function: {
96147
96261
  name: t.name,
96148
96262
  description: t.description ?? "",
96149
- parameters: normalizeSchemaForOpenAI(schema, !isGemini)
96263
+ parameters: normalizeSchemaForOpenAI(schema, !isGemini, true, geminiTarget)
96150
96264
  }
96151
96265
  };
96152
96266
  });
@@ -96167,8 +96281,63 @@ function convertChunkUsage(usage) {
96167
96281
  function toOpenAIChatReasoningEffort(effort) {
96168
96282
  return effort === "xhigh" ? "high" : effort;
96169
96283
  }
96284
+ function getOpenAIChatProviderCapabilities(model) {
96285
+ return {
96286
+ supportsParallelToolCalls: openAICompatSupports("parallel-tool-calls", model)
96287
+ };
96288
+ }
96289
+ function collectAdjacentToolMessages(messages, startIndex) {
96290
+ const toolMessages = [];
96291
+ for (let i2 = startIndex;i2 < messages.length && messages[i2]?.role === "tool"; i2++) {
96292
+ toolMessages.push(messages[i2]);
96293
+ }
96294
+ return toolMessages;
96295
+ }
96296
+ function indexToolMessagesById(toolMessages) {
96297
+ const byId = new Map;
96298
+ for (const toolMessage of toolMessages) {
96299
+ if (typeof toolMessage.tool_call_id === "string") {
96300
+ byId.set(toolMessage.tool_call_id, toolMessage);
96301
+ }
96302
+ }
96303
+ return byId;
96304
+ }
96305
+ function splitParallelToolCallTurn(assistantMessage, toolCalls, toolMessagesById) {
96306
+ const serialized = [];
96307
+ toolCalls.forEach((toolCall, index) => {
96308
+ serialized.push({
96309
+ ...assistantMessage,
96310
+ tool_calls: [toolCall],
96311
+ content: index === 0 ? assistantMessage.content : null
96312
+ });
96313
+ const toolResponse = toolMessagesById.get(toolCall.id);
96314
+ if (toolResponse)
96315
+ serialized.push(toolResponse);
96316
+ });
96317
+ return serialized;
96318
+ }
96319
+ function serializeParallelToolCalls(messages, capabilities) {
96320
+ if (capabilities.supportsParallelToolCalls)
96321
+ return messages;
96322
+ const result = [];
96323
+ for (let i2 = 0;i2 < messages.length; i2++) {
96324
+ const message = messages[i2];
96325
+ const toolCalls = message.tool_calls;
96326
+ const isParallelToolTurn = message.role === "assistant" && (toolCalls?.length ?? 0) > 1;
96327
+ if (!isParallelToolTurn || !toolCalls) {
96328
+ result.push(message);
96329
+ continue;
96330
+ }
96331
+ const toolMessages = collectAdjacentToolMessages(messages, i2 + 1);
96332
+ const toolMessagesById = indexToolMessagesById(toolMessages);
96333
+ result.push(...splitParallelToolCallTurn(message, toolCalls, toolMessagesById));
96334
+ i2 += toolMessages.length;
96335
+ }
96336
+ return result;
96337
+ }
96170
96338
  function buildOpenAIRequestBody(params, ctx) {
96171
- const openaiMessages = convertMessages(params.messages, params.system);
96339
+ const capabilities = getOpenAIChatProviderCapabilities(ctx.resolvedModel);
96340
+ const openaiMessages = serializeParallelToolCalls(convertMessages(params.messages, params.system), capabilities);
96172
96341
  const body = {
96173
96342
  model: ctx.resolvedModel,
96174
96343
  messages: openaiMessages,
@@ -96196,9 +96365,12 @@ function buildOpenAIRequestBody(params, ctx) {
96196
96365
  body.reasoning_effort = toOpenAIChatReasoningEffort(ctx.reasoning.effort);
96197
96366
  }
96198
96367
  if (params.tools && params.tools.length > 0) {
96199
- const converted = convertTools(params.tools);
96368
+ const converted = convertTools(params.tools, ctx.resolvedModel);
96200
96369
  if (converted.length > 0) {
96201
96370
  body.tools = converted;
96371
+ if (!capabilities.supportsParallelToolCalls) {
96372
+ body.parallel_tool_calls = false;
96373
+ }
96202
96374
  if (params.tool_choice) {
96203
96375
  const tc = params.tool_choice;
96204
96376
  if (tc.type === "auto") {
@@ -96294,7 +96466,13 @@ async function* openaiStreamToAnthropic(response, model) {
96294
96466
  })}`);
96295
96467
  }
96296
96468
  }
96297
- if (delta.reasoning_content != null) {
96469
+ let reasoningText = delta.reasoning_content ?? delta.reasoning;
96470
+ if (reasoningText == null && Array.isArray(delta.reasoning_details)) {
96471
+ const parts = delta.reasoning_details.map((d) => d.content ?? d.summary ?? "").filter(Boolean);
96472
+ if (parts.length > 0)
96473
+ reasoningText = parts.join("");
96474
+ }
96475
+ if (reasoningText != null) {
96298
96476
  if (reasoningBlockIndex === null) {
96299
96477
  reasoningBlockIndex = contentBlockIndex;
96300
96478
  contentBlockIndex++;
@@ -96316,7 +96494,7 @@ async function* openaiStreamToAnthropic(response, model) {
96316
96494
  index: reasoningBlockIndex,
96317
96495
  delta: {
96318
96496
  type: "thinking_delta",
96319
- thinking: delta.reasoning_content
96497
+ thinking: reasoningText
96320
96498
  }
96321
96499
  };
96322
96500
  continue;
@@ -96679,6 +96857,22 @@ class OpenAIShimMessages {
96679
96857
  function convertOpenAIResponseToAnthropic(data, model) {
96680
96858
  const choice = data.choices?.[0];
96681
96859
  const content = [];
96860
+ const msg = choice?.message;
96861
+ let reasoningText = msg?.reasoning_content ?? msg?.reasoning;
96862
+ if (reasoningText == null && Array.isArray(msg?.reasoning_details)) {
96863
+ const parts = msg.reasoning_details.map((d) => d.content ?? d.summary ?? "").filter(Boolean);
96864
+ if (parts.length > 0)
96865
+ reasoningText = parts.join(`
96866
+ `);
96867
+ }
96868
+ if (typeof reasoningText === "string" && reasoningText) {
96869
+ content.push({
96870
+ type: "thinking",
96871
+ thinking: reasoningText,
96872
+ signature: "",
96873
+ extra_content: { provenance: "openai-chat" }
96874
+ });
96875
+ }
96682
96876
  const rawContent = choice?.message?.content;
96683
96877
  if (typeof rawContent === "string" && rawContent) {
96684
96878
  content.push({ type: "text", text: rawContent });
@@ -96782,6 +96976,7 @@ var init_shim2 = __esm(() => {
96782
96976
  init_config2();
96783
96977
  init_schemaSanitizer();
96784
96978
  init_providerProfile();
96979
+ init_capabilities2();
96785
96980
  OpenAIShimStream = class OpenAIShimStream {
96786
96981
  generator;
96787
96982
  controller = new AbortController;
@@ -97054,36 +97249,6 @@ var init_anthropic = __esm(() => {
97054
97249
  init_errors6();
97055
97250
  });
97056
97251
 
97057
- // src/providers/openai/capabilities.ts
97058
- function supportsReasoningEffort(model) {
97059
- return /^(o\d|gpt-5|gpt-4\.5)/i.test(model);
97060
- }
97061
- function getOpenAICompatMaxOutputTokens(model) {
97062
- const max = getOpenAIMaxOutputTokens(model);
97063
- if (max === undefined)
97064
- return null;
97065
- return { default: max, upperLimit: max };
97066
- }
97067
- function getOpenAICompatContextWindow(model) {
97068
- return getOpenAIContextWindow(model) ?? null;
97069
- }
97070
- function openAICompatSupports(feature, model) {
97071
- if (feature === "reasoning-effort")
97072
- return supportsReasoningEffort(model);
97073
- return FEATURES_OPENAI_COMPAT.includes(feature);
97074
- }
97075
- var FEATURES_OPENAI_COMPAT;
97076
- var init_capabilities2 = __esm(() => {
97077
- init_openaiContextWindows();
97078
- FEATURES_OPENAI_COMPAT = Object.freeze([
97079
- "streaming",
97080
- "tool-use",
97081
- "image-input",
97082
- "parallel-tool-calls",
97083
- "system-message-top-level"
97084
- ]);
97085
- });
97086
-
97087
97252
  // src/providers/openai/errors.ts
97088
97253
  function readErrorMessage(body) {
97089
97254
  if (!body || typeof body !== "object")
@@ -106603,7 +106768,7 @@ function isValidAdvisorModel(model) {
106603
106768
  return m.includes("opus-4-6") || m.includes("sonnet-4-6") || process.env.USER_TYPE === "ant";
106604
106769
  }
106605
106770
  function getAdvisorUsage(usage) {
106606
- const iterations = usage.iterations;
106771
+ const iterations = usage?.iterations;
106607
106772
  if (!iterations) {
106608
106773
  return [];
106609
106774
  }
@@ -106644,11 +106809,11 @@ function addToTotalModelUsage(cost, usage, model) {
106644
106809
  contextWindow: 0,
106645
106810
  maxOutputTokens: 0
106646
106811
  };
106647
- modelUsage.inputTokens += usage.input_tokens;
106648
- modelUsage.outputTokens += usage.output_tokens;
106649
- modelUsage.cacheReadInputTokens += usage.cache_read_input_tokens ?? 0;
106650
- modelUsage.cacheCreationInputTokens += usage.cache_creation_input_tokens ?? 0;
106651
- modelUsage.webSearchRequests += usage.server_tool_use?.web_search_requests ?? 0;
106812
+ modelUsage.inputTokens += usage?.input_tokens ?? 0;
106813
+ modelUsage.outputTokens += usage?.output_tokens ?? 0;
106814
+ modelUsage.cacheReadInputTokens += usage?.cache_read_input_tokens ?? 0;
106815
+ modelUsage.cacheCreationInputTokens += usage?.cache_creation_input_tokens ?? 0;
106816
+ modelUsage.webSearchRequests += usage?.server_tool_use?.web_search_requests ?? 0;
106652
106817
  modelUsage.costUSD += cost;
106653
106818
  modelUsage.contextWindow = getContextWindowForModel(model, getSdkBetas());
106654
106819
  modelUsage.maxOutputTokens = getModelMaxOutputTokens(model).default;
@@ -106657,15 +106822,18 @@ function addToTotalModelUsage(cost, usage, model) {
106657
106822
  function addToTotalSessionCost(cost, usage, model) {
106658
106823
  const modelUsage = addToTotalModelUsage(cost, usage, model);
106659
106824
  addToTotalCostState(cost, modelUsage, model);
106660
- const attrs = isFastModeEnabled() && usage.speed === "fast" ? { model, speed: "fast" } : { model };
106825
+ const attrs = isFastModeEnabled() && usage?.speed === "fast" ? { model, speed: "fast" } : { model };
106661
106826
  getCostCounter()?.add(cost, attrs);
106662
- getTokenCounter()?.add(usage.input_tokens, { ...attrs, type: "input" });
106663
- getTokenCounter()?.add(usage.output_tokens, { ...attrs, type: "output" });
106664
- getTokenCounter()?.add(usage.cache_read_input_tokens ?? 0, {
106827
+ getTokenCounter()?.add(usage?.input_tokens ?? 0, { ...attrs, type: "input" });
106828
+ getTokenCounter()?.add(usage?.output_tokens ?? 0, {
106829
+ ...attrs,
106830
+ type: "output"
106831
+ });
106832
+ getTokenCounter()?.add(usage?.cache_read_input_tokens ?? 0, {
106665
106833
  ...attrs,
106666
106834
  type: "cacheRead"
106667
106835
  });
106668
- getTokenCounter()?.add(usage.cache_creation_input_tokens ?? 0, {
106836
+ getTokenCounter()?.add(usage?.cache_creation_input_tokens ?? 0, {
106669
106837
  ...attrs,
106670
106838
  type: "cacheCreation"
106671
106839
  });
@@ -106944,10 +107112,10 @@ function getCLISyspromptPrefix(options) {
106944
107112
  return DEFAULT_PREFIX;
106945
107113
  }
106946
107114
  function isAttributionHeaderEnabled() {
106947
- if (isEnvDefinedFalsy(resolveEnvVar("ATTRIBUTION_HEADER"))) {
106948
- return false;
107115
+ if (isEnvTruthy(resolveEnvVar("ATTRIBUTION_HEADER"))) {
107116
+ return true;
106949
107117
  }
106950
- return getFeatureValue_CACHED_MAY_BE_STALE("tengu_attribution_header", true);
107118
+ return getFeatureValue_CACHED_MAY_BE_STALE("tengu_attribution_header", false);
106951
107119
  }
106952
107120
  function getAttributionHeader(fingerprint) {
106953
107121
  if (!isAttributionHeaderEnabled()) {
@@ -106958,7 +107126,7 @@ function getAttributionHeader(fingerprint) {
106958
107126
  const cch = "";
106959
107127
  const workload = getWorkload();
106960
107128
  const workloadPair = workload ? ` cc_workload=${workload};` : "";
106961
- const header = `x-anthropic-billing-header: cc_version=${version2}; cc_entrypoint=${entrypoint};${cch}${workloadPair}`;
107129
+ const header = `x-opencow-billing-header: cc_version=${version2}; cc_entrypoint=${entrypoint};${cch}${workloadPair}`;
106962
107130
  logForDebugging(`attribution header ${header}`);
106963
107131
  return header;
106964
107132
  }
@@ -223638,26 +223806,41 @@ var init_permissionLogging = __esm(() => {
223638
223806
  });
223639
223807
 
223640
223808
  // src/lib/toolInputNullCoercion.ts
223641
- function omitNullProps(input) {
223642
- const out = {};
223643
- for (const [key, value] of Object.entries(input)) {
223644
- if (value !== null)
223645
- out[key] = value;
223809
+ function containsNull(value) {
223810
+ if (value === null)
223811
+ return true;
223812
+ if (Array.isArray(value))
223813
+ return value.some(containsNull);
223814
+ if (typeof value === "object") {
223815
+ return Object.values(value).some(containsNull);
223646
223816
  }
223647
- return out;
223817
+ return false;
223818
+ }
223819
+ function deepOmitNullProps(value) {
223820
+ if (Array.isArray(value)) {
223821
+ return value.map(deepOmitNullProps);
223822
+ }
223823
+ if (value !== null && typeof value === "object") {
223824
+ const out = {};
223825
+ for (const [key, v] of Object.entries(value)) {
223826
+ if (v === null)
223827
+ continue;
223828
+ out[key] = deepOmitNullProps(v);
223829
+ }
223830
+ return out;
223831
+ }
223832
+ return value;
223648
223833
  }
223649
223834
  function safeParseToolInputWithNullCoercion(schema, input) {
223650
223835
  const first = schema.safeParse(input);
223651
223836
  if (first.success)
223652
223837
  return first;
223653
- if (input === null || typeof input !== "object" || Array.isArray(input)) {
223838
+ if (input === null || typeof input !== "object") {
223654
223839
  return first;
223655
223840
  }
223656
- const record3 = input;
223657
- const hasNull = Object.values(record3).some((value) => value === null);
223658
- if (!hasNull)
223841
+ if (!containsNull(input))
223659
223842
  return first;
223660
- const retry = schema.safeParse(omitNullProps(record3));
223843
+ const retry = schema.safeParse(deepOmitNullProps(input));
223661
223844
  return retry.success ? retry : first;
223662
223845
  }
223663
223846
 
@@ -243595,7 +243778,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
243595
243778
  return {
243596
243779
  behavior: "ask",
243597
243780
  decisionReason: decisionReason2,
243598
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2)
243781
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
243599
243782
  };
243600
243783
  }
243601
243784
  {
@@ -243621,7 +243804,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
243621
243804
  return {
243622
243805
  behavior: "ask",
243623
243806
  decisionReason: decisionReason2,
243624
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2)
243807
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
243625
243808
  };
243626
243809
  }
243627
243810
  }
@@ -243671,7 +243854,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
243671
243854
  };
243672
243855
  return {
243673
243856
  behavior: "ask",
243674
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason),
243857
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason),
243675
243858
  decisionReason,
243676
243859
  suggestions: suggestions.length > 0 ? suggestions : undefined
243677
243860
  };
@@ -243701,7 +243884,7 @@ async function bashToolCheckCommandOperatorPermissions(input, bashToolHasPermiss
243701
243884
  };
243702
243885
  return {
243703
243886
  behavior: "ask",
243704
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason),
243887
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason),
243705
243888
  decisionReason
243706
243889
  };
243707
243890
  }
@@ -246423,21 +246606,21 @@ function getSimpleCommandPrefix(command) {
246423
246606
  function suggestionForExactCommand2(command) {
246424
246607
  const heredocPrefix = extractPrefixBeforeHeredoc(command);
246425
246608
  if (heredocPrefix) {
246426
- return suggestionForPrefix(BashTool2.name, heredocPrefix);
246609
+ return suggestionForPrefix(BashTool.name, heredocPrefix);
246427
246610
  }
246428
246611
  if (command.includes(`
246429
246612
  `)) {
246430
246613
  const firstLine = command.split(`
246431
246614
  `)[0].trim();
246432
246615
  if (firstLine) {
246433
- return suggestionForPrefix(BashTool2.name, firstLine);
246616
+ return suggestionForPrefix(BashTool.name, firstLine);
246434
246617
  }
246435
246618
  }
246436
246619
  const prefix = getSimpleCommandPrefix(command);
246437
246620
  if (prefix) {
246438
- return suggestionForPrefix(BashTool2.name, prefix);
246621
+ return suggestionForPrefix(BashTool.name, prefix);
246439
246622
  }
246440
- return suggestionForExactCommand(BashTool2.name, command);
246623
+ return suggestionForExactCommand(BashTool.name, command);
246441
246624
  }
246442
246625
  function extractPrefixBeforeHeredoc(command) {
246443
246626
  if (!command.includes("<<"))
@@ -246466,7 +246649,7 @@ function extractPrefixBeforeHeredoc(command) {
246466
246649
  return tokens.slice(i3, i3 + 2).join(" ") || null;
246467
246650
  }
246468
246651
  function suggestionForPrefix2(prefix) {
246469
- return suggestionForPrefix(BashTool2.name, prefix);
246652
+ return suggestionForPrefix(BashTool.name, prefix);
246470
246653
  }
246471
246654
  function matchWildcardPattern2(pattern, command) {
246472
246655
  return matchWildcardPattern(pattern, command);
@@ -246617,11 +246800,11 @@ function filterRulesByContentsMatchingInput(input, rules, matchMode, {
246617
246800
  }).map(([, rule]) => rule);
246618
246801
  }
246619
246802
  function matchingRulesForInput(input, toolPermissionContext, matchMode, { skipCompoundCheck = false } = {}) {
246620
- const denyRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool2, "deny");
246803
+ const denyRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "deny");
246621
246804
  const matchingDenyRules = filterRulesByContentsMatchingInput(input, denyRuleByContents, matchMode, { stripAllEnvVars: true, skipCompoundCheck: true });
246622
- const askRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool2, "ask");
246805
+ const askRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "ask");
246623
246806
  const matchingAskRules = filterRulesByContentsMatchingInput(input, askRuleByContents, matchMode, { stripAllEnvVars: true, skipCompoundCheck: true });
246624
- const allowRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool2, "allow");
246807
+ const allowRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "allow");
246625
246808
  const matchingAllowRules = filterRulesByContentsMatchingInput(input, allowRuleByContents, matchMode, { skipCompoundCheck });
246626
246809
  return {
246627
246810
  matchingDenyRules,
@@ -246647,7 +246830,7 @@ async function checkCommandAndSuggestRules(input, toolPermissionContext, command
246647
246830
  };
246648
246831
  return {
246649
246832
  behavior: "ask",
246650
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason),
246833
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason),
246651
246834
  decisionReason,
246652
246835
  suggestions: []
246653
246836
  };
@@ -246668,7 +246851,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
246668
246851
  if (matchingDenyRules[0] !== undefined) {
246669
246852
  return {
246670
246853
  behavior: "deny",
246671
- message: `Permission to use ${BashTool2.name} with command ${command} has been denied.`,
246854
+ message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
246672
246855
  decisionReason: {
246673
246856
  type: "rule",
246674
246857
  rule: matchingDenyRules[0]
@@ -246683,7 +246866,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
246683
246866
  if (subResult.matchingDenyRules[0] !== undefined) {
246684
246867
  return {
246685
246868
  behavior: "deny",
246686
- message: `Permission to use ${BashTool2.name} with command ${command} has been denied.`,
246869
+ message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
246687
246870
  decisionReason: {
246688
246871
  type: "rule",
246689
246872
  rule: subResult.matchingDenyRules[0]
@@ -246695,7 +246878,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
246695
246878
  if (firstAskRule) {
246696
246879
  return {
246697
246880
  behavior: "ask",
246698
- message: createPermissionRequestMessage2(BashTool2.name),
246881
+ message: createPermissionRequestMessage2(BashTool.name),
246699
246882
  decisionReason: {
246700
246883
  type: "rule",
246701
246884
  rule: firstAskRule
@@ -246706,7 +246889,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
246706
246889
  if (matchingAskRules[0] !== undefined) {
246707
246890
  return {
246708
246891
  behavior: "ask",
246709
- message: createPermissionRequestMessage2(BashTool2.name),
246892
+ message: createPermissionRequestMessage2(BashTool.name),
246710
246893
  decisionReason: {
246711
246894
  type: "rule",
246712
246895
  rule: matchingAskRules[0]
@@ -246743,7 +246926,7 @@ function checkEarlyExitDeny(input, toolPermissionContext) {
246743
246926
  if (denyMatch !== undefined) {
246744
246927
  return {
246745
246928
  behavior: "deny",
246746
- message: `Permission to use ${BashTool2.name} with command ${input.command} has been denied.`,
246929
+ message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
246747
246930
  decisionReason: { type: "rule", rule: denyMatch }
246748
246931
  };
246749
246932
  }
@@ -246758,7 +246941,7 @@ function checkSemanticsDeny(input, toolPermissionContext, commands) {
246758
246941
  if (subDeny !== undefined) {
246759
246942
  return {
246760
246943
  behavior: "deny",
246761
- message: `Permission to use ${BashTool2.name} with command ${input.command} has been denied.`,
246944
+ message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
246762
246945
  decisionReason: { type: "rule", rule: subDeny }
246763
246946
  };
246764
246947
  }
@@ -246790,7 +246973,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
246790
246973
  return {
246791
246974
  behavior: "ask",
246792
246975
  decisionReason: decisionReason2,
246793
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2),
246976
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
246794
246977
  suggestions: [],
246795
246978
  ...{}
246796
246979
  };
@@ -246808,7 +246991,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
246808
246991
  return {
246809
246992
  behavior: "ask",
246810
246993
  decisionReason: decisionReason2,
246811
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2),
246994
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
246812
246995
  suggestions: []
246813
246996
  };
246814
246997
  }
@@ -246827,7 +247010,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
246827
247010
  return {
246828
247011
  behavior: "ask",
246829
247012
  decisionReason: decisionReason2,
246830
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2)
247013
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
246831
247014
  };
246832
247015
  }
246833
247016
  }
@@ -246883,7 +247066,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
246883
247066
  }
246884
247067
  return {
246885
247068
  behavior: "ask",
246886
- message: createPermissionRequestMessage2(BashTool2.name),
247069
+ message: createPermissionRequestMessage2(BashTool.name),
246887
247070
  decisionReason: {
246888
247071
  type: "other",
246889
247072
  reason: `Required by Bash prompt rule: "${askResult.matchedDescription}"`
@@ -246902,7 +247085,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
246902
247085
  appState = context3.getAppState();
246903
247086
  return {
246904
247087
  behavior: "ask",
246905
- message: createPermissionRequestMessage2(BashTool2.name, {
247088
+ message: createPermissionRequestMessage2(BashTool.name, {
246906
247089
  type: "other",
246907
247090
  reason: safetyResult.message ?? "Command contains patterns that require approval"
246908
247091
  }),
@@ -246945,7 +247128,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
246945
247128
  };
246946
247129
  return {
246947
247130
  behavior: "ask",
246948
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2),
247131
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
246949
247132
  decisionReason: decisionReason2,
246950
247133
  suggestions: [],
246951
247134
  ...{}
@@ -246965,7 +247148,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
246965
247148
  };
246966
247149
  return {
246967
247150
  behavior: "ask",
246968
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2),
247151
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
246969
247152
  decisionReason: decisionReason2
246970
247153
  };
246971
247154
  }
@@ -246978,7 +247161,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
246978
247161
  return {
246979
247162
  behavior: "ask",
246980
247163
  decisionReason: decisionReason2,
246981
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2)
247164
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
246982
247165
  };
246983
247166
  }
246984
247167
  const compoundCommandHasCd = cdCommands.length > 0;
@@ -246992,7 +247175,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
246992
247175
  return {
246993
247176
  behavior: "ask",
246994
247177
  decisionReason: decisionReason2,
246995
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2)
247178
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
246996
247179
  };
246997
247180
  }
246998
247181
  }
@@ -247002,7 +247185,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
247002
247185
  if (deniedSubresult !== undefined) {
247003
247186
  return {
247004
247187
  behavior: "deny",
247005
- message: `Permission to use ${BashTool2.name} with command ${input.command} has been denied.`,
247188
+ message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
247006
247189
  decisionReason: {
247007
247190
  type: "subcommandResults",
247008
247191
  reasons: new Map(subcommandPermissionDecisions.map((result, i3) => [
@@ -247128,7 +247311,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
247128
247311
  ] : undefined;
247129
247312
  return {
247130
247313
  behavior: askSubresult !== undefined ? "ask" : "passthrough",
247131
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason),
247314
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason),
247132
247315
  decisionReason,
247133
247316
  suggestions: suggestedUpdates,
247134
247317
  ...{}
@@ -247169,7 +247352,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
247169
247352
  if (matchingDenyRules[0] !== undefined) {
247170
247353
  return {
247171
247354
  behavior: "deny",
247172
- message: `Permission to use ${BashTool2.name} with command ${command} has been denied.`,
247355
+ message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
247173
247356
  decisionReason: {
247174
247357
  type: "rule",
247175
247358
  rule: matchingDenyRules[0]
@@ -247179,7 +247362,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
247179
247362
  if (matchingAskRules[0] !== undefined) {
247180
247363
  return {
247181
247364
  behavior: "ask",
247182
- message: createPermissionRequestMessage2(BashTool2.name),
247365
+ message: createPermissionRequestMessage2(BashTool.name),
247183
247366
  decisionReason: {
247184
247367
  type: "rule",
247185
247368
  rule: matchingAskRules[0]
@@ -247202,7 +247385,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
247202
247385
  };
247203
247386
  return {
247204
247387
  behavior: "passthrough",
247205
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason),
247388
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason),
247206
247389
  decisionReason,
247207
247390
  suggestions: suggestionForExactCommand2(command)
247208
247391
  };
@@ -247218,7 +247401,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
247218
247401
  if (matchingDenyRules[0] !== undefined) {
247219
247402
  return {
247220
247403
  behavior: "deny",
247221
- message: `Permission to use ${BashTool2.name} with command ${command} has been denied.`,
247404
+ message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
247222
247405
  decisionReason: {
247223
247406
  type: "rule",
247224
247407
  rule: matchingDenyRules[0]
@@ -247228,7 +247411,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
247228
247411
  if (matchingAskRules[0] !== undefined) {
247229
247412
  return {
247230
247413
  behavior: "ask",
247231
- message: createPermissionRequestMessage2(BashTool2.name),
247414
+ message: createPermissionRequestMessage2(BashTool.name),
247232
247415
  decisionReason: {
247233
247416
  type: "rule",
247234
247417
  rule: matchingAskRules[0]
@@ -247260,7 +247443,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
247260
247443
  if (modeResult.behavior !== "passthrough") {
247261
247444
  return modeResult;
247262
247445
  }
247263
- if (BashTool2.isReadOnly(input)) {
247446
+ if (BashTool.isReadOnly(input)) {
247264
247447
  return {
247265
247448
  behavior: "allow",
247266
247449
  updatedInput: input,
@@ -247276,7 +247459,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
247276
247459
  };
247277
247460
  return {
247278
247461
  behavior: "passthrough",
247279
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason),
247462
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason),
247280
247463
  decisionReason,
247281
247464
  suggestions: suggestionForExactCommand2(command)
247282
247465
  };
@@ -256449,7 +256632,7 @@ function getReplPrimitiveTools() {
256449
256632
  FileEditTool,
256450
256633
  GlobTool,
256451
256634
  GrepTool,
256452
- BashTool2,
256635
+ BashTool,
256453
256636
  NotebookEditTool,
256454
256637
  AgentTool
256455
256638
  ];
@@ -258688,7 +258871,7 @@ async function* runShellCommand({
258688
258871
  }
258689
258872
  }
258690
258873
  var fileEditUserFacingName, getBackgroundHintJSX2, renderToolResultMessage9, renderToolUseErrorMessage7, renderToolUseMessage9, renderToolUseProgressMessage3, renderToolUseQueuedMessage, EOL = `
258691
- `, PROGRESS_THRESHOLD_MS2 = 2000, ASSISTANT_BLOCKING_BUDGET_MS = 15000, BASH_SEARCH_COMMANDS, BASH_READ_COMMANDS, BASH_LIST_COMMANDS, BASH_SEMANTIC_NEUTRAL_COMMANDS, BASH_SILENT_COMMANDS, DISALLOWED_AUTO_BACKGROUND_COMMANDS, isBackgroundTasksDisabled2, fullInputSchema2, inputSchema12, COMMON_BACKGROUND_COMMANDS, outputSchema11, BashTool2;
258874
+ `, PROGRESS_THRESHOLD_MS2 = 2000, ASSISTANT_BLOCKING_BUDGET_MS = 15000, BASH_SEARCH_COMMANDS, BASH_READ_COMMANDS, BASH_LIST_COMMANDS, BASH_SEMANTIC_NEUTRAL_COMMANDS, BASH_SILENT_COMMANDS, DISALLOWED_AUTO_BACKGROUND_COMMANDS, isBackgroundTasksDisabled2, fullInputSchema2, inputSchema12, COMMON_BACKGROUND_COMMANDS, outputSchema11, BashTool;
258692
258875
  var init_BashTool = __esm(() => {
258693
258876
  init_v4();
258694
258877
  init_state();
@@ -258811,7 +258994,7 @@ For commands that are harder to parse at a glance (piped commands, obscure flags
258811
258994
  persistedOutputPath: exports_external2.string().optional().describe("Path to the persisted full output in tool-results dir (set when output is too large for inline)"),
258812
258995
  persistedOutputSize: exports_external2.number().optional().describe("Total size of the output in bytes (set when output is too large for inline)")
258813
258996
  }));
258814
- BashTool2 = buildToolRuntime({
258997
+ BashTool = buildToolRuntime({
258815
258998
  name: BASH_TOOL_NAME2,
258816
258999
  searchHint: "execute shell commands",
258817
259000
  maxResultSizeChars: 30000,
@@ -265179,7 +265362,7 @@ var init_PowerShellTool = __esm(() => {
265179
265362
  import { randomUUID as randomUUID8 } from "crypto";
265180
265363
  async function executeShellCommandsInPrompt(text, context3, slashCommandName, shell) {
265181
265364
  let result = text;
265182
- const shellTool = shell === "powershell" && isPowerShellToolEnabled() ? getPowerShellTool() : BashTool2;
265365
+ const shellTool = shell === "powershell" && isPowerShellToolEnabled() ? getPowerShellTool() : BashTool;
265183
265366
  const blockMatches = text.matchAll(BLOCK_PATTERN);
265184
265367
  const inlineMatches = text.includes("!`") ? text.matchAll(INLINE_PATTERN) : [];
265185
265368
  await Promise.all([...blockMatches, ...inlineMatches].map(async (match) => {
@@ -282088,7 +282271,7 @@ function getAnthropicEnvMetadata() {
282088
282271
  function getBuildAgeMinutes() {
282089
282272
  if (false)
282090
282273
  ;
282091
- const buildTime = new Date("2026-05-25T12:12:24.294Z").getTime();
282274
+ const buildTime = new Date("2026-06-03T12:46:47.435Z").getTime();
282092
282275
  if (isNaN(buildTime))
282093
282276
  return;
282094
282277
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -292368,7 +292551,7 @@ function splitSysPromptPrefix(systemPrompt, options2) {
292368
292551
  continue;
292369
292552
  if (prompt === SYSTEM_PROMPT_DYNAMIC_BOUNDARY)
292370
292553
  continue;
292371
- if (prompt.startsWith("x-anthropic-billing-header")) {
292554
+ if (prompt.startsWith("x-opencow-billing-header")) {
292372
292555
  attributionHeader2 = prompt;
292373
292556
  } else if (CLI_SYSPROMPT_PREFIXES.has(prompt)) {
292374
292557
  systemPromptPrefix2 = prompt;
@@ -292402,7 +292585,7 @@ function splitSysPromptPrefix(systemPrompt, options2) {
292402
292585
  const block2 = systemPrompt[i3];
292403
292586
  if (!block2 || block2 === SYSTEM_PROMPT_DYNAMIC_BOUNDARY)
292404
292587
  continue;
292405
- if (block2.startsWith("x-anthropic-billing-header")) {
292588
+ if (block2.startsWith("x-opencow-billing-header")) {
292406
292589
  attributionHeader2 = block2;
292407
292590
  } else if (CLI_SYSPROMPT_PREFIXES.has(block2)) {
292408
292591
  systemPromptPrefix2 = block2;
@@ -292445,7 +292628,7 @@ function splitSysPromptPrefix(systemPrompt, options2) {
292445
292628
  for (const block2 of systemPrompt) {
292446
292629
  if (!block2)
292447
292630
  continue;
292448
- if (block2.startsWith("x-anthropic-billing-header")) {
292631
+ if (block2.startsWith("x-opencow-billing-header")) {
292449
292632
  attributionHeader = block2;
292450
292633
  } else if (CLI_SYSPROMPT_PREFIXES.has(block2)) {
292451
292634
  systemPromptPrefix = block2;
@@ -292501,8 +292684,8 @@ function normalizeToolInput(tool, input, agentId) {
292501
292684
  persistFileSnapshotIfRemote();
292502
292685
  return plan !== null ? { ...input, plan, planFilePath } : input;
292503
292686
  }
292504
- case BashTool2.name: {
292505
- const parsed = BashTool2.inputSchema.parse(input);
292687
+ case BashTool.name: {
292688
+ const parsed = BashTool.inputSchema.parse(input);
292506
292689
  const { command, timeout, description } = parsed;
292507
292690
  const cwd = getCwd3();
292508
292691
  let normalizedCommand = command.replace(`cd ${cwd} && `, "");
@@ -298592,6 +298775,7 @@ var init_messages4 = __esm(() => {
298592
298775
  init_xml();
298593
298776
  init_diagnostics2();
298594
298777
  init_Tool();
298778
+ init_BashTool();
298595
298779
  init_FileReadTool();
298596
298780
  init_api3();
298597
298781
  init_config3();
@@ -334558,7 +334742,7 @@ var getSendMessageTool = () => (init_SendMessageTool(), __toCommonJS(exports_Sen
334558
334742
  function getSDKBuiltInTools() {
334559
334743
  return [
334560
334744
  AgentTool,
334561
- BashTool2,
334745
+ BashTool,
334562
334746
  GlobTool,
334563
334747
  GrepTool,
334564
334748
  FileReadTool,
@@ -335268,4 +335452,4 @@ export {
335268
335452
  AbortError2 as AbortError
335269
335453
  };
335270
335454
 
335271
- //# debugId=532222AFD20CE11464756E2164756E21
335455
+ //# debugId=0D97A1D470E3660864756E2164756E21