@standardagents/builder 0.25.1 → 0.25.2

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.
@@ -245,7 +245,7 @@ function resolveModelPricing(modelDef, providerName) {
245
245
  source: "model"
246
246
  };
247
247
  }
248
- if (providerName === "anthropic" || providerName === "cerebras" || providerName === "cloudflare" || providerName === "google" || providerName === "groq" || providerName === "openai" || providerName === "xai") {
248
+ if (providerName === "anthropic" || providerName === "baseten" || providerName === "cerebras" || providerName === "cloudflare" || providerName === "google" || providerName === "groq" || providerName === "novita" || providerName === "openai" || providerName === "xai") {
249
249
  return getFallbackPricing(providerName, modelDef.model);
250
250
  }
251
251
  return null;
@@ -56019,6 +56019,36 @@ function transformChatMessages4(messages) {
56019
56019
  }
56020
56020
  return result;
56021
56021
  }
56022
+ function stripServerToolHistory(messages, serverToolNames) {
56023
+ if (serverToolNames.size === 0) return messages;
56024
+ const strippedCallIds = /* @__PURE__ */ new Set();
56025
+ const result = [];
56026
+ for (const message of messages) {
56027
+ if (message.role === "assistant" && message.tool_calls?.length) {
56028
+ const kept = message.tool_calls.filter((call) => {
56029
+ if (!serverToolNames.has(call.function.name)) return true;
56030
+ strippedCallIds.add(call.id);
56031
+ return false;
56032
+ });
56033
+ if (kept.length !== message.tool_calls.length) {
56034
+ const next = { ...message };
56035
+ if (kept.length > 0) {
56036
+ next.tool_calls = kept;
56037
+ } else {
56038
+ delete next.tool_calls;
56039
+ if (!next.content) next.content = "[requested a provider-executed server tool]";
56040
+ }
56041
+ result.push(next);
56042
+ continue;
56043
+ }
56044
+ }
56045
+ if (message.role === "tool" && strippedCallIds.has(message.tool_call_id)) {
56046
+ continue;
56047
+ }
56048
+ result.push(message);
56049
+ }
56050
+ return result;
56051
+ }
56022
56052
  function isRecord22(value) {
56023
56053
  return !!value && typeof value === "object" && !Array.isArray(value);
56024
56054
  }
@@ -56416,6 +56446,10 @@ function buildChatParams4(request) {
56416
56446
  };
56417
56447
  if (request.tools && request.tools.length > 0) {
56418
56448
  params.tools = transformChatTools3(request.tools, request.providerOptions);
56449
+ const serverToolNames = new Set(
56450
+ request.tools.filter(isOpenRouterProviderTool).map((tool3) => tool3.function.name)
56451
+ );
56452
+ params.messages = stripServerToolHistory(messages, serverToolNames);
56419
56453
  const toolChoice = transformChatToolChoice4(request.toolChoice);
56420
56454
  if (toolChoice !== void 0) {
56421
56455
  params.tool_choice = toolChoice;