@axlsdk/axl 0.17.7 → 0.17.9

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/index.js CHANGED
@@ -1367,7 +1367,8 @@ var GEMINI_PRICING = {
1367
1367
  "gemini-3-flash-preview": [5e-7, 3e-6],
1368
1368
  "gemini-3.1-pro-preview": [2e-6, 12e-6],
1369
1369
  "gemini-3.1-flash-lite": [25e-8, 15e-7],
1370
- "gemini-3.1-flash-lite-preview": [25e-8, 15e-7]
1370
+ "gemini-3.1-flash-lite-preview": [25e-8, 15e-7],
1371
+ "gemini-3.5-flash": [15e-7, 9e-6]
1371
1372
  };
1372
1373
  var GEMINI_PRICING_KEYS_BY_LENGTH = Object.keys(GEMINI_PRICING).sort(
1373
1374
  (a, b) => b.length - a.length
@@ -1607,12 +1608,21 @@ var GeminiProvider = class {
1607
1608
  */
1608
1609
  mapMessages(messages) {
1609
1610
  const toolCallIdToName = /* @__PURE__ */ new Map();
1611
+ const geminiNativeIds = /* @__PURE__ */ new Set();
1610
1612
  for (const msg of messages) {
1611
1613
  if (msg.role === "assistant" && msg.tool_calls) {
1612
1614
  for (const tc of msg.tool_calls) {
1613
1615
  toolCallIdToName.set(tc.id, tc.function.name);
1614
1616
  }
1615
1617
  }
1618
+ if (msg.role === "assistant") {
1619
+ const rawParts = msg.providerMetadata?.geminiParts;
1620
+ if (rawParts) {
1621
+ for (const p of rawParts) {
1622
+ if (p.functionCall?.id) geminiNativeIds.add(p.functionCall.id);
1623
+ }
1624
+ }
1625
+ }
1616
1626
  }
1617
1627
  const result = [];
1618
1628
  for (const msg of messages) {
@@ -1653,16 +1663,16 @@ var GeminiProvider = class {
1653
1663
  } catch {
1654
1664
  responseData = { result: msg.content };
1655
1665
  }
1666
+ const functionResponse = {
1667
+ name: functionName,
1668
+ response: responseData
1669
+ };
1670
+ if (msg.tool_call_id && geminiNativeIds.has(msg.tool_call_id)) {
1671
+ functionResponse.id = msg.tool_call_id;
1672
+ }
1656
1673
  result.push({
1657
1674
  role: "user",
1658
- parts: [
1659
- {
1660
- functionResponse: {
1661
- name: functionName,
1662
- response: responseData
1663
- }
1664
- }
1665
- ]
1675
+ parts: [{ functionResponse }]
1666
1676
  });
1667
1677
  } else if (msg.role === "user") {
1668
1678
  result.push({ role: "user", parts: [{ text: msg.content }] });
@@ -1730,7 +1740,7 @@ var GeminiProvider = class {
1730
1740
  content += part.text;
1731
1741
  } else if (part.functionCall) {
1732
1742
  toolCalls.push({
1733
- id: `call_${this.callCounter++}`,
1743
+ id: part.functionCall.id || `call_${this.callCounter++}`,
1734
1744
  type: "function",
1735
1745
  function: {
1736
1746
  name: part.functionCall.name,
@@ -1810,7 +1820,7 @@ var GeminiProvider = class {
1810
1820
  } else if (part.functionCall) {
1811
1821
  yield {
1812
1822
  type: "tool_call_delta",
1813
- id: `call_${this.callCounter++}`,
1823
+ id: part.functionCall.id || `call_${this.callCounter++}`,
1814
1824
  name: part.functionCall.name,
1815
1825
  arguments: JSON.stringify(part.functionCall.args)
1816
1826
  };