@opencow-ai/opencow-agent-sdk 0.4.4 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.js CHANGED
@@ -95053,7 +95053,8 @@ function sanitizeSchemaForOpenAICompat(schema) {
95053
95053
  }
95054
95054
  }
95055
95055
  if (Array.isArray(record3.required) && isSchemaRecord(record3.properties)) {
95056
- record3.required = record3.required.filter((value) => typeof value === "string" && (value in record3.properties));
95056
+ const properties = record3.properties;
95057
+ record3.required = record3.required.filter((value) => typeof value === "string" && (value in properties));
95057
95058
  }
95058
95059
  const schemaWithoutEnum = { ...record3 };
95059
95060
  delete schemaWithoutEnum.enum;
@@ -95072,6 +95073,77 @@ function sanitizeSchemaForOpenAICompat(schema) {
95072
95073
  }
95073
95074
  return record3;
95074
95075
  }
95076
+ function isEmptyStrictObject(schema) {
95077
+ if (schema.type !== "object" || schema.additionalProperties !== false) {
95078
+ return false;
95079
+ }
95080
+ const props = schema.properties;
95081
+ return !props || isSchemaRecord(props) && Object.keys(props).length === 0;
95082
+ }
95083
+ function strictifySchemaNode(schema, options, topLevel) {
95084
+ const {
95085
+ gemini = false,
95086
+ strict = true,
95087
+ stripUriFormat = false,
95088
+ dropEmptyObjectProperties = false,
95089
+ normalizeBareObjects = false
95090
+ } = options;
95091
+ let record3 = sanitizeSchemaForOpenAICompat(schema);
95092
+ if (gemini) {
95093
+ record3 = splitTypeArrayToAnyOf(record3);
95094
+ }
95095
+ if (stripUriFormat && record3.format === "uri") {
95096
+ delete record3.format;
95097
+ }
95098
+ if (record3.type === "object") {
95099
+ const props = isSchemaRecord(record3.properties) ? record3.properties : null;
95100
+ if (props) {
95101
+ const originalRequired = Array.isArray(record3.required) ? record3.required.filter((key) => typeof key === "string") : [];
95102
+ const enforcedProps = {};
95103
+ for (const [key, value] of Object.entries(props)) {
95104
+ const strictValue = strictifySchemaNode(value, options, false);
95105
+ if (dropEmptyObjectProperties && isEmptyStrictObject(strictValue)) {
95106
+ continue;
95107
+ }
95108
+ enforcedProps[key] = strictValue;
95109
+ }
95110
+ record3.properties = enforcedProps;
95111
+ if (strict) {
95112
+ record3.additionalProperties = false;
95113
+ record3.required = Object.keys(enforcedProps);
95114
+ if (topLevel) {
95115
+ const style = gemini ? "nullable" : "union";
95116
+ for (const key of Object.keys(enforcedProps)) {
95117
+ if (!originalRequired.includes(key)) {
95118
+ enforcedProps[key] = makeSchemaNullable(enforcedProps[key], style);
95119
+ }
95120
+ }
95121
+ }
95122
+ } else {
95123
+ record3.required = originalRequired.filter((key) => (key in enforcedProps));
95124
+ }
95125
+ } else if (normalizeBareObjects) {
95126
+ record3.additionalProperties = false;
95127
+ record3.required = [];
95128
+ }
95129
+ }
95130
+ if ("items" in record3) {
95131
+ if (Array.isArray(record3.items)) {
95132
+ record3.items = record3.items.map((item) => strictifySchemaNode(item, options, false));
95133
+ } else {
95134
+ record3.items = strictifySchemaNode(record3.items, options, false);
95135
+ }
95136
+ }
95137
+ for (const key of ["anyOf", "oneOf", "allOf"]) {
95138
+ if (key in record3 && Array.isArray(record3[key])) {
95139
+ record3[key] = record3[key].map((item) => strictifySchemaNode(item, options, false));
95140
+ }
95141
+ }
95142
+ return record3;
95143
+ }
95144
+ function strictifyJsonSchema(schema, options = {}) {
95145
+ return strictifySchemaNode(schema, options, true);
95146
+ }
95075
95147
  var OPENAI_INCOMPATIBLE_SCHEMA_KEYWORDS;
95076
95148
  var init_schemaSanitizer = __esm(() => {
95077
95149
  OPENAI_INCOMPATIBLE_SCHEMA_KEYWORDS = new Set([
@@ -95100,6 +95172,51 @@ var init_schema = __esm(() => {
95100
95172
  init_schemaSanitizer();
95101
95173
  });
95102
95174
 
95175
+ // src/providers/openai/capabilities.ts
95176
+ function supportsReasoningEffort(model) {
95177
+ return /^(o\d|gpt-5|gpt-4\.5)/i.test(model);
95178
+ }
95179
+ function isGeminiLikeModel(model) {
95180
+ const normalized = (model ?? "").trim().toLowerCase();
95181
+ return normalized.startsWith("gemini-") || normalized.includes("/gemini-");
95182
+ }
95183
+ function isGeminiTarget(model) {
95184
+ if (isEnvTruthy(getQueryEnvVar("CLAUDE_CODE_USE_GEMINI")))
95185
+ return true;
95186
+ return isGeminiLikeModel(model);
95187
+ }
95188
+ function supportsParallelToolCalls(model) {
95189
+ return !isGeminiTarget(model);
95190
+ }
95191
+ function getOpenAICompatMaxOutputTokens(model) {
95192
+ const max = getOpenAIMaxOutputTokens(model);
95193
+ if (max === undefined)
95194
+ return null;
95195
+ return { default: max, upperLimit: max };
95196
+ }
95197
+ function getOpenAICompatContextWindow(model) {
95198
+ return getOpenAIContextWindow(model) ?? null;
95199
+ }
95200
+ function openAICompatSupports(feature, model) {
95201
+ if (feature === "reasoning-effort")
95202
+ return supportsReasoningEffort(model);
95203
+ if (feature === "parallel-tool-calls")
95204
+ return supportsParallelToolCalls(model);
95205
+ return FEATURES_OPENAI_COMPAT.includes(feature);
95206
+ }
95207
+ var FEATURES_OPENAI_COMPAT;
95208
+ var init_capabilities2 = __esm(() => {
95209
+ init_openaiContextWindows();
95210
+ init_envUtils();
95211
+ init_state2();
95212
+ FEATURES_OPENAI_COMPAT = Object.freeze([
95213
+ "streaming",
95214
+ "tool-use",
95215
+ "image-input",
95216
+ "system-message-top-level"
95217
+ ]);
95218
+ });
95219
+
95103
95220
  // src/providers/codex/shim.ts
95104
95221
  function parseSseChunk(chunk) {
95105
95222
  const lines = chunk.split(`
@@ -95342,58 +95459,23 @@ function convertAnthropicMessagesToResponsesInput(messages) {
95342
95459
  }
95343
95460
  return items.filter((item) => item.type !== "message" || item.content.length > 0);
95344
95461
  }
95345
- function enforceStrictSchema(schema, topLevel = true) {
95346
- const record3 = sanitizeSchemaForOpenAICompat(schema);
95347
- if (record3.format === "uri") {
95348
- delete record3.format;
95349
- }
95350
- if (record3.type === "object") {
95351
- record3.additionalProperties = false;
95352
- if (record3.properties && typeof record3.properties === "object" && !Array.isArray(record3.properties)) {
95353
- const props = record3.properties;
95354
- const originalRequired = Array.isArray(record3.required) ? record3.required.filter((key) => typeof key === "string") : [];
95355
- const enforcedProps = {};
95356
- for (const [key, value] of Object.entries(props)) {
95357
- const strictValue = enforceStrictSchema(value, false);
95358
- if (strictValue && typeof strictValue === "object" && strictValue.type === "object" && strictValue.additionalProperties === false && (!strictValue.properties || Object.keys(strictValue.properties).length === 0)) {
95359
- continue;
95360
- }
95361
- enforcedProps[key] = strictValue;
95362
- }
95363
- record3.properties = enforcedProps;
95364
- record3.required = Object.keys(enforcedProps);
95365
- if (topLevel) {
95366
- for (const key of Object.keys(enforcedProps)) {
95367
- if (!originalRequired.includes(key)) {
95368
- enforcedProps[key] = makeSchemaNullable(enforcedProps[key]);
95369
- }
95370
- }
95371
- }
95372
- } else {
95373
- record3.required = [];
95374
- }
95375
- }
95376
- if ("items" in record3) {
95377
- if (Array.isArray(record3.items)) {
95378
- record3.items = record3.items.map((item) => enforceStrictSchema(item, false));
95379
- } else {
95380
- record3.items = enforceStrictSchema(record3.items, false);
95381
- }
95382
- }
95383
- for (const key of ["anyOf", "oneOf", "allOf"]) {
95384
- if (key in record3 && Array.isArray(record3[key])) {
95385
- record3[key] = record3[key].map((item) => enforceStrictSchema(item, false));
95386
- }
95387
- }
95388
- return record3;
95462
+ function toResponsesParameters(schema, geminiTarget) {
95463
+ return strictifyJsonSchema(schema, {
95464
+ strict: true,
95465
+ gemini: geminiTarget,
95466
+ stripUriFormat: true,
95467
+ dropEmptyObjectProperties: true,
95468
+ normalizeBareObjects: true
95469
+ });
95389
95470
  }
95390
- function convertToolsToResponsesTools(tools) {
95471
+ function convertToolsToResponsesTools(tools, model = "") {
95472
+ const geminiTarget = isGeminiTarget(model);
95391
95473
  return tools.flatMap((tool) => {
95392
95474
  if (tool.input_schema && (!tool.type || tool.type === "function")) {
95393
95475
  if (!tool.name || tool.name === "ToolSearchTool")
95394
95476
  return [];
95395
95477
  const rawParameters = tool.input_schema ?? { type: "object", properties: {} };
95396
- const parameters = enforceStrictSchema(rawParameters);
95478
+ const parameters = toResponsesParameters(rawParameters, geminiTarget);
95397
95479
  return [
95398
95480
  {
95399
95481
  type: "function",
@@ -95408,7 +95490,7 @@ function convertToolsToResponsesTools(tools) {
95408
95490
  return [tool];
95409
95491
  }
95410
95492
  if (tool.name && tool.name !== "ToolSearchTool" && (!tool.type || tool.type === "function")) {
95411
- const parameters = enforceStrictSchema({ type: "object", properties: {} });
95493
+ const parameters = toResponsesParameters({ type: "object", properties: {} }, geminiTarget);
95412
95494
  return [
95413
95495
  {
95414
95496
  type: "function",
@@ -95475,10 +95557,10 @@ async function performCodexRequest(options) {
95475
95557
  body.tool_choice = toolChoice;
95476
95558
  }
95477
95559
  if (options.params.tools && options.params.tools.length > 0) {
95478
- const convertedTools = convertToolsToResponsesTools(options.params.tools);
95560
+ const convertedTools = convertToolsToResponsesTools(options.params.tools, options.request.resolvedModel);
95479
95561
  if (convertedTools.length > 0) {
95480
95562
  body.tools = convertedTools;
95481
- body.parallel_tool_calls = true;
95563
+ body.parallel_tool_calls = !isGeminiTarget(options.request.resolvedModel);
95482
95564
  body.tool_choice ??= "auto";
95483
95565
  }
95484
95566
  }
@@ -95848,6 +95930,7 @@ function convertCodexResponseToAnthropicMessage(data, model) {
95848
95930
  var init_shim = __esm(() => {
95849
95931
  init_sdk();
95850
95932
  init_schema();
95933
+ init_capabilities2();
95851
95934
  });
95852
95935
 
95853
95936
  // src/providers/shared/providerRecommendation.ts
@@ -95925,51 +96008,6 @@ var init_providerProfile = __esm(() => {
95925
96008
  ];
95926
96009
  });
95927
96010
 
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
-
95973
96011
  // src/providers/openai/shim.ts
95974
96012
  var exports_shim = {};
95975
96013
  __export(exports_shim, {
@@ -96197,49 +96235,6 @@ function convertMessages(messages, system) {
96197
96235
  }
96198
96236
  return result;
96199
96237
  }
96200
- function normalizeSchemaForOpenAI(schema, strict = true, topLevel = true, geminiTarget = false) {
96201
- let record3 = sanitizeSchemaForOpenAICompat(schema);
96202
- if (geminiTarget) {
96203
- record3 = splitTypeArrayToAnyOf(record3);
96204
- }
96205
- if (record3.type === "object" && record3.properties) {
96206
- const properties = record3.properties;
96207
- const existingRequired = Array.isArray(record3.required) ? record3.required : [];
96208
- const normalizedProps = {};
96209
- for (const [key, value] of Object.entries(properties)) {
96210
- normalizedProps[key] = normalizeSchemaForOpenAI(value, strict, false, geminiTarget);
96211
- }
96212
- record3.properties = normalizedProps;
96213
- if (strict) {
96214
- const allKeys = Object.keys(normalizedProps);
96215
- record3.required = Array.from(new Set([...existingRequired, ...allKeys]));
96216
- record3.additionalProperties = false;
96217
- if (topLevel) {
96218
- const style = geminiTarget ? "nullable" : "union";
96219
- for (const key of allKeys) {
96220
- if (!existingRequired.includes(key)) {
96221
- normalizedProps[key] = makeSchemaNullable(normalizedProps[key], style);
96222
- }
96223
- }
96224
- }
96225
- } else {
96226
- record3.required = existingRequired.filter((k) => (k in normalizedProps));
96227
- }
96228
- }
96229
- if ("items" in record3) {
96230
- if (Array.isArray(record3.items)) {
96231
- record3.items = record3.items.map((item) => normalizeSchemaForOpenAI(item, strict, false, geminiTarget));
96232
- } else {
96233
- record3.items = normalizeSchemaForOpenAI(record3.items, strict, false, geminiTarget);
96234
- }
96235
- }
96236
- for (const key of ["anyOf", "oneOf", "allOf"]) {
96237
- if (key in record3 && Array.isArray(record3[key])) {
96238
- record3[key] = record3[key].map((item) => normalizeSchemaForOpenAI(item, strict, false, geminiTarget));
96239
- }
96240
- }
96241
- return record3;
96242
- }
96243
96238
  function convertTools(tools, model = "") {
96244
96239
  const isGemini = isEnvTruthy(getQueryEnvVar("CLAUDE_CODE_USE_GEMINI"));
96245
96240
  const geminiTarget = isGeminiTarget(model);
@@ -96260,7 +96255,7 @@ function convertTools(tools, model = "") {
96260
96255
  function: {
96261
96256
  name: t.name,
96262
96257
  description: t.description ?? "",
96263
- parameters: normalizeSchemaForOpenAI(schema, !isGemini, true, geminiTarget)
96258
+ parameters: strictifyJsonSchema(schema, { strict: !isGemini, gemini: geminiTarget })
96264
96259
  }
96265
96260
  };
96266
96261
  });
@@ -223806,26 +223801,41 @@ var init_permissionLogging = __esm(() => {
223806
223801
  });
223807
223802
 
223808
223803
  // src/lib/toolInputNullCoercion.ts
223809
- function omitNullProps(input) {
223810
- const out = {};
223811
- for (const [key, value] of Object.entries(input)) {
223812
- if (value !== null)
223813
- out[key] = value;
223804
+ function containsNull(value) {
223805
+ if (value === null)
223806
+ return true;
223807
+ if (Array.isArray(value))
223808
+ return value.some(containsNull);
223809
+ if (typeof value === "object") {
223810
+ return Object.values(value).some(containsNull);
223814
223811
  }
223815
- return out;
223812
+ return false;
223813
+ }
223814
+ function deepOmitNullProps(value) {
223815
+ if (Array.isArray(value)) {
223816
+ return value.map(deepOmitNullProps);
223817
+ }
223818
+ if (value !== null && typeof value === "object") {
223819
+ const out = {};
223820
+ for (const [key, v] of Object.entries(value)) {
223821
+ if (v === null)
223822
+ continue;
223823
+ out[key] = deepOmitNullProps(v);
223824
+ }
223825
+ return out;
223826
+ }
223827
+ return value;
223816
223828
  }
223817
223829
  function safeParseToolInputWithNullCoercion(schema, input) {
223818
223830
  const first = schema.safeParse(input);
223819
223831
  if (first.success)
223820
223832
  return first;
223821
- if (input === null || typeof input !== "object" || Array.isArray(input)) {
223833
+ if (input === null || typeof input !== "object") {
223822
223834
  return first;
223823
223835
  }
223824
- const record3 = input;
223825
- const hasNull = Object.values(record3).some((value) => value === null);
223826
- if (!hasNull)
223836
+ if (!containsNull(input))
223827
223837
  return first;
223828
- const retry = schema.safeParse(omitNullProps(record3));
223838
+ const retry = schema.safeParse(deepOmitNullProps(input));
223829
223839
  return retry.success ? retry : first;
223830
223840
  }
223831
223841
 
@@ -243763,7 +243773,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
243763
243773
  return {
243764
243774
  behavior: "ask",
243765
243775
  decisionReason: decisionReason2,
243766
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2)
243776
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
243767
243777
  };
243768
243778
  }
243769
243779
  {
@@ -243789,7 +243799,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
243789
243799
  return {
243790
243800
  behavior: "ask",
243791
243801
  decisionReason: decisionReason2,
243792
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2)
243802
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
243793
243803
  };
243794
243804
  }
243795
243805
  }
@@ -243839,7 +243849,7 @@ async function segmentedCommandPermissionResult(input, segments, bashToolHasPerm
243839
243849
  };
243840
243850
  return {
243841
243851
  behavior: "ask",
243842
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason),
243852
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason),
243843
243853
  decisionReason,
243844
243854
  suggestions: suggestions.length > 0 ? suggestions : undefined
243845
243855
  };
@@ -243869,7 +243879,7 @@ async function bashToolCheckCommandOperatorPermissions(input, bashToolHasPermiss
243869
243879
  };
243870
243880
  return {
243871
243881
  behavior: "ask",
243872
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason),
243882
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason),
243873
243883
  decisionReason
243874
243884
  };
243875
243885
  }
@@ -246591,21 +246601,21 @@ function getSimpleCommandPrefix(command) {
246591
246601
  function suggestionForExactCommand2(command) {
246592
246602
  const heredocPrefix = extractPrefixBeforeHeredoc(command);
246593
246603
  if (heredocPrefix) {
246594
- return suggestionForPrefix(BashTool2.name, heredocPrefix);
246604
+ return suggestionForPrefix(BashTool.name, heredocPrefix);
246595
246605
  }
246596
246606
  if (command.includes(`
246597
246607
  `)) {
246598
246608
  const firstLine = command.split(`
246599
246609
  `)[0].trim();
246600
246610
  if (firstLine) {
246601
- return suggestionForPrefix(BashTool2.name, firstLine);
246611
+ return suggestionForPrefix(BashTool.name, firstLine);
246602
246612
  }
246603
246613
  }
246604
246614
  const prefix = getSimpleCommandPrefix(command);
246605
246615
  if (prefix) {
246606
- return suggestionForPrefix(BashTool2.name, prefix);
246616
+ return suggestionForPrefix(BashTool.name, prefix);
246607
246617
  }
246608
- return suggestionForExactCommand(BashTool2.name, command);
246618
+ return suggestionForExactCommand(BashTool.name, command);
246609
246619
  }
246610
246620
  function extractPrefixBeforeHeredoc(command) {
246611
246621
  if (!command.includes("<<"))
@@ -246634,7 +246644,7 @@ function extractPrefixBeforeHeredoc(command) {
246634
246644
  return tokens.slice(i3, i3 + 2).join(" ") || null;
246635
246645
  }
246636
246646
  function suggestionForPrefix2(prefix) {
246637
- return suggestionForPrefix(BashTool2.name, prefix);
246647
+ return suggestionForPrefix(BashTool.name, prefix);
246638
246648
  }
246639
246649
  function matchWildcardPattern2(pattern, command) {
246640
246650
  return matchWildcardPattern(pattern, command);
@@ -246785,11 +246795,11 @@ function filterRulesByContentsMatchingInput(input, rules, matchMode, {
246785
246795
  }).map(([, rule]) => rule);
246786
246796
  }
246787
246797
  function matchingRulesForInput(input, toolPermissionContext, matchMode, { skipCompoundCheck = false } = {}) {
246788
- const denyRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool2, "deny");
246798
+ const denyRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "deny");
246789
246799
  const matchingDenyRules = filterRulesByContentsMatchingInput(input, denyRuleByContents, matchMode, { stripAllEnvVars: true, skipCompoundCheck: true });
246790
- const askRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool2, "ask");
246800
+ const askRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "ask");
246791
246801
  const matchingAskRules = filterRulesByContentsMatchingInput(input, askRuleByContents, matchMode, { stripAllEnvVars: true, skipCompoundCheck: true });
246792
- const allowRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool2, "allow");
246802
+ const allowRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "allow");
246793
246803
  const matchingAllowRules = filterRulesByContentsMatchingInput(input, allowRuleByContents, matchMode, { skipCompoundCheck });
246794
246804
  return {
246795
246805
  matchingDenyRules,
@@ -246815,7 +246825,7 @@ async function checkCommandAndSuggestRules(input, toolPermissionContext, command
246815
246825
  };
246816
246826
  return {
246817
246827
  behavior: "ask",
246818
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason),
246828
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason),
246819
246829
  decisionReason,
246820
246830
  suggestions: []
246821
246831
  };
@@ -246836,7 +246846,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
246836
246846
  if (matchingDenyRules[0] !== undefined) {
246837
246847
  return {
246838
246848
  behavior: "deny",
246839
- message: `Permission to use ${BashTool2.name} with command ${command} has been denied.`,
246849
+ message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
246840
246850
  decisionReason: {
246841
246851
  type: "rule",
246842
246852
  rule: matchingDenyRules[0]
@@ -246851,7 +246861,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
246851
246861
  if (subResult.matchingDenyRules[0] !== undefined) {
246852
246862
  return {
246853
246863
  behavior: "deny",
246854
- message: `Permission to use ${BashTool2.name} with command ${command} has been denied.`,
246864
+ message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
246855
246865
  decisionReason: {
246856
246866
  type: "rule",
246857
246867
  rule: subResult.matchingDenyRules[0]
@@ -246863,7 +246873,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
246863
246873
  if (firstAskRule) {
246864
246874
  return {
246865
246875
  behavior: "ask",
246866
- message: createPermissionRequestMessage2(BashTool2.name),
246876
+ message: createPermissionRequestMessage2(BashTool.name),
246867
246877
  decisionReason: {
246868
246878
  type: "rule",
246869
246879
  rule: firstAskRule
@@ -246874,7 +246884,7 @@ function checkSandboxAutoAllow(input, toolPermissionContext) {
246874
246884
  if (matchingAskRules[0] !== undefined) {
246875
246885
  return {
246876
246886
  behavior: "ask",
246877
- message: createPermissionRequestMessage2(BashTool2.name),
246887
+ message: createPermissionRequestMessage2(BashTool.name),
246878
246888
  decisionReason: {
246879
246889
  type: "rule",
246880
246890
  rule: matchingAskRules[0]
@@ -246911,7 +246921,7 @@ function checkEarlyExitDeny(input, toolPermissionContext) {
246911
246921
  if (denyMatch !== undefined) {
246912
246922
  return {
246913
246923
  behavior: "deny",
246914
- message: `Permission to use ${BashTool2.name} with command ${input.command} has been denied.`,
246924
+ message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
246915
246925
  decisionReason: { type: "rule", rule: denyMatch }
246916
246926
  };
246917
246927
  }
@@ -246926,7 +246936,7 @@ function checkSemanticsDeny(input, toolPermissionContext, commands) {
246926
246936
  if (subDeny !== undefined) {
246927
246937
  return {
246928
246938
  behavior: "deny",
246929
- message: `Permission to use ${BashTool2.name} with command ${input.command} has been denied.`,
246939
+ message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
246930
246940
  decisionReason: { type: "rule", rule: subDeny }
246931
246941
  };
246932
246942
  }
@@ -246958,7 +246968,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
246958
246968
  return {
246959
246969
  behavior: "ask",
246960
246970
  decisionReason: decisionReason2,
246961
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2),
246971
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
246962
246972
  suggestions: [],
246963
246973
  ...{}
246964
246974
  };
@@ -246976,7 +246986,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
246976
246986
  return {
246977
246987
  behavior: "ask",
246978
246988
  decisionReason: decisionReason2,
246979
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2),
246989
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
246980
246990
  suggestions: []
246981
246991
  };
246982
246992
  }
@@ -246995,7 +247005,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
246995
247005
  return {
246996
247006
  behavior: "ask",
246997
247007
  decisionReason: decisionReason2,
246998
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2)
247008
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
246999
247009
  };
247000
247010
  }
247001
247011
  }
@@ -247051,7 +247061,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
247051
247061
  }
247052
247062
  return {
247053
247063
  behavior: "ask",
247054
- message: createPermissionRequestMessage2(BashTool2.name),
247064
+ message: createPermissionRequestMessage2(BashTool.name),
247055
247065
  decisionReason: {
247056
247066
  type: "other",
247057
247067
  reason: `Required by Bash prompt rule: "${askResult.matchedDescription}"`
@@ -247070,7 +247080,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
247070
247080
  appState = context3.getAppState();
247071
247081
  return {
247072
247082
  behavior: "ask",
247073
- message: createPermissionRequestMessage2(BashTool2.name, {
247083
+ message: createPermissionRequestMessage2(BashTool.name, {
247074
247084
  type: "other",
247075
247085
  reason: safetyResult.message ?? "Command contains patterns that require approval"
247076
247086
  }),
@@ -247113,7 +247123,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
247113
247123
  };
247114
247124
  return {
247115
247125
  behavior: "ask",
247116
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2),
247126
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
247117
247127
  decisionReason: decisionReason2,
247118
247128
  suggestions: [],
247119
247129
  ...{}
@@ -247133,7 +247143,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
247133
247143
  };
247134
247144
  return {
247135
247145
  behavior: "ask",
247136
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2),
247146
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2),
247137
247147
  decisionReason: decisionReason2
247138
247148
  };
247139
247149
  }
@@ -247146,7 +247156,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
247146
247156
  return {
247147
247157
  behavior: "ask",
247148
247158
  decisionReason: decisionReason2,
247149
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2)
247159
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
247150
247160
  };
247151
247161
  }
247152
247162
  const compoundCommandHasCd = cdCommands.length > 0;
@@ -247160,7 +247170,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
247160
247170
  return {
247161
247171
  behavior: "ask",
247162
247172
  decisionReason: decisionReason2,
247163
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason2)
247173
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason2)
247164
247174
  };
247165
247175
  }
247166
247176
  }
@@ -247170,7 +247180,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
247170
247180
  if (deniedSubresult !== undefined) {
247171
247181
  return {
247172
247182
  behavior: "deny",
247173
- message: `Permission to use ${BashTool2.name} with command ${input.command} has been denied.`,
247183
+ message: `Permission to use ${BashTool.name} with command ${input.command} has been denied.`,
247174
247184
  decisionReason: {
247175
247185
  type: "subcommandResults",
247176
247186
  reasons: new Map(subcommandPermissionDecisions.map((result, i3) => [
@@ -247296,7 +247306,7 @@ async function bashToolHasPermission(input, context3, getCommandSubcommandPrefix
247296
247306
  ] : undefined;
247297
247307
  return {
247298
247308
  behavior: askSubresult !== undefined ? "ask" : "passthrough",
247299
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason),
247309
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason),
247300
247310
  decisionReason,
247301
247311
  suggestions: suggestedUpdates,
247302
247312
  ...{}
@@ -247337,7 +247347,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
247337
247347
  if (matchingDenyRules[0] !== undefined) {
247338
247348
  return {
247339
247349
  behavior: "deny",
247340
- message: `Permission to use ${BashTool2.name} with command ${command} has been denied.`,
247350
+ message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
247341
247351
  decisionReason: {
247342
247352
  type: "rule",
247343
247353
  rule: matchingDenyRules[0]
@@ -247347,7 +247357,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
247347
247357
  if (matchingAskRules[0] !== undefined) {
247348
247358
  return {
247349
247359
  behavior: "ask",
247350
- message: createPermissionRequestMessage2(BashTool2.name),
247360
+ message: createPermissionRequestMessage2(BashTool.name),
247351
247361
  decisionReason: {
247352
247362
  type: "rule",
247353
247363
  rule: matchingAskRules[0]
@@ -247370,7 +247380,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
247370
247380
  };
247371
247381
  return {
247372
247382
  behavior: "passthrough",
247373
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason),
247383
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason),
247374
247384
  decisionReason,
247375
247385
  suggestions: suggestionForExactCommand2(command)
247376
247386
  };
@@ -247386,7 +247396,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
247386
247396
  if (matchingDenyRules[0] !== undefined) {
247387
247397
  return {
247388
247398
  behavior: "deny",
247389
- message: `Permission to use ${BashTool2.name} with command ${command} has been denied.`,
247399
+ message: `Permission to use ${BashTool.name} with command ${command} has been denied.`,
247390
247400
  decisionReason: {
247391
247401
  type: "rule",
247392
247402
  rule: matchingDenyRules[0]
@@ -247396,7 +247406,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
247396
247406
  if (matchingAskRules[0] !== undefined) {
247397
247407
  return {
247398
247408
  behavior: "ask",
247399
- message: createPermissionRequestMessage2(BashTool2.name),
247409
+ message: createPermissionRequestMessage2(BashTool.name),
247400
247410
  decisionReason: {
247401
247411
  type: "rule",
247402
247412
  rule: matchingAskRules[0]
@@ -247428,7 +247438,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
247428
247438
  if (modeResult.behavior !== "passthrough") {
247429
247439
  return modeResult;
247430
247440
  }
247431
- if (BashTool2.isReadOnly(input)) {
247441
+ if (BashTool.isReadOnly(input)) {
247432
247442
  return {
247433
247443
  behavior: "allow",
247434
247444
  updatedInput: input,
@@ -247444,7 +247454,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, MAX_SUBCOMMANDS_FOR
247444
247454
  };
247445
247455
  return {
247446
247456
  behavior: "passthrough",
247447
- message: createPermissionRequestMessage2(BashTool2.name, decisionReason),
247457
+ message: createPermissionRequestMessage2(BashTool.name, decisionReason),
247448
247458
  decisionReason,
247449
247459
  suggestions: suggestionForExactCommand2(command)
247450
247460
  };
@@ -256617,7 +256627,7 @@ function getReplPrimitiveTools() {
256617
256627
  FileEditTool,
256618
256628
  GlobTool,
256619
256629
  GrepTool,
256620
- BashTool2,
256630
+ BashTool,
256621
256631
  NotebookEditTool,
256622
256632
  AgentTool
256623
256633
  ];
@@ -258856,7 +258866,7 @@ async function* runShellCommand({
258856
258866
  }
258857
258867
  }
258858
258868
  var fileEditUserFacingName, getBackgroundHintJSX2, renderToolResultMessage9, renderToolUseErrorMessage7, renderToolUseMessage9, renderToolUseProgressMessage3, renderToolUseQueuedMessage, EOL = `
258859
- `, PROGRESS_THRESHOLD_MS2 = 2000, ASSISTANT_BLOCKING_BUDGET_MS = 15000, BASH_SEARCH_COMMANDS, BASH_READ_COMMANDS, BASH_LIST_COMMANDS, BASH_SEMANTIC_NEUTRAL_COMMANDS, BASH_SILENT_COMMANDS, DISALLOWED_AUTO_BACKGROUND_COMMANDS, isBackgroundTasksDisabled2, fullInputSchema2, inputSchema12, COMMON_BACKGROUND_COMMANDS, outputSchema11, BashTool2;
258869
+ `, PROGRESS_THRESHOLD_MS2 = 2000, ASSISTANT_BLOCKING_BUDGET_MS = 15000, BASH_SEARCH_COMMANDS, BASH_READ_COMMANDS, BASH_LIST_COMMANDS, BASH_SEMANTIC_NEUTRAL_COMMANDS, BASH_SILENT_COMMANDS, DISALLOWED_AUTO_BACKGROUND_COMMANDS, isBackgroundTasksDisabled2, fullInputSchema2, inputSchema12, COMMON_BACKGROUND_COMMANDS, outputSchema11, BashTool;
258860
258870
  var init_BashTool = __esm(() => {
258861
258871
  init_v4();
258862
258872
  init_state();
@@ -258979,7 +258989,7 @@ For commands that are harder to parse at a glance (piped commands, obscure flags
258979
258989
  persistedOutputPath: exports_external2.string().optional().describe("Path to the persisted full output in tool-results dir (set when output is too large for inline)"),
258980
258990
  persistedOutputSize: exports_external2.number().optional().describe("Total size of the output in bytes (set when output is too large for inline)")
258981
258991
  }));
258982
- BashTool2 = buildToolRuntime({
258992
+ BashTool = buildToolRuntime({
258983
258993
  name: BASH_TOOL_NAME2,
258984
258994
  searchHint: "execute shell commands",
258985
258995
  maxResultSizeChars: 30000,
@@ -265347,7 +265357,7 @@ var init_PowerShellTool = __esm(() => {
265347
265357
  import { randomUUID as randomUUID8 } from "crypto";
265348
265358
  async function executeShellCommandsInPrompt(text, context3, slashCommandName, shell) {
265349
265359
  let result = text;
265350
- const shellTool = shell === "powershell" && isPowerShellToolEnabled() ? getPowerShellTool() : BashTool2;
265360
+ const shellTool = shell === "powershell" && isPowerShellToolEnabled() ? getPowerShellTool() : BashTool;
265351
265361
  const blockMatches = text.matchAll(BLOCK_PATTERN);
265352
265362
  const inlineMatches = text.includes("!`") ? text.matchAll(INLINE_PATTERN) : [];
265353
265363
  await Promise.all([...blockMatches, ...inlineMatches].map(async (match) => {
@@ -282256,7 +282266,7 @@ function getAnthropicEnvMetadata() {
282256
282266
  function getBuildAgeMinutes() {
282257
282267
  if (false)
282258
282268
  ;
282259
- const buildTime = new Date("2026-06-03T08:42:39.310Z").getTime();
282269
+ const buildTime = new Date("2026-06-03T14:42:10.545Z").getTime();
282260
282270
  if (isNaN(buildTime))
282261
282271
  return;
282262
282272
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -292669,8 +292679,8 @@ function normalizeToolInput(tool, input, agentId) {
292669
292679
  persistFileSnapshotIfRemote();
292670
292680
  return plan !== null ? { ...input, plan, planFilePath } : input;
292671
292681
  }
292672
- case BashTool2.name: {
292673
- const parsed = BashTool2.inputSchema.parse(input);
292682
+ case BashTool.name: {
292683
+ const parsed = BashTool.inputSchema.parse(input);
292674
292684
  const { command, timeout, description } = parsed;
292675
292685
  const cwd = getCwd3();
292676
292686
  let normalizedCommand = command.replace(`cd ${cwd} && `, "");
@@ -298760,6 +298770,7 @@ var init_messages4 = __esm(() => {
298760
298770
  init_xml();
298761
298771
  init_diagnostics2();
298762
298772
  init_Tool();
298773
+ init_BashTool();
298763
298774
  init_FileReadTool();
298764
298775
  init_api3();
298765
298776
  init_config3();
@@ -334726,7 +334737,7 @@ var getSendMessageTool = () => (init_SendMessageTool(), __toCommonJS(exports_Sen
334726
334737
  function getSDKBuiltInTools() {
334727
334738
  return [
334728
334739
  AgentTool,
334729
- BashTool2,
334740
+ BashTool,
334730
334741
  GlobTool,
334731
334742
  GrepTool,
334732
334743
  FileReadTool,
@@ -335436,4 +335447,4 @@ export {
335436
335447
  AbortError2 as AbortError
335437
335448
  };
335438
335449
 
335439
- //# debugId=5C1C50C89C84EDAD64756E2164756E21
335450
+ //# debugId=43217E45406B3AFE64756E2164756E21