@axlsdk/axl 0.17.7 → 0.17.8

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.cjs CHANGED
@@ -1535,7 +1535,8 @@ var GEMINI_PRICING = {
1535
1535
  "gemini-3-flash-preview": [5e-7, 3e-6],
1536
1536
  "gemini-3.1-pro-preview": [2e-6, 12e-6],
1537
1537
  "gemini-3.1-flash-lite": [25e-8, 15e-7],
1538
- "gemini-3.1-flash-lite-preview": [25e-8, 15e-7]
1538
+ "gemini-3.1-flash-lite-preview": [25e-8, 15e-7],
1539
+ "gemini-3.5-flash": [15e-7, 9e-6]
1539
1540
  };
1540
1541
  var GEMINI_PRICING_KEYS_BY_LENGTH = Object.keys(GEMINI_PRICING).sort(
1541
1542
  (a, b) => b.length - a.length
@@ -1775,12 +1776,21 @@ var GeminiProvider = class {
1775
1776
  */
1776
1777
  mapMessages(messages) {
1777
1778
  const toolCallIdToName = /* @__PURE__ */ new Map();
1779
+ const geminiNativeIds = /* @__PURE__ */ new Set();
1778
1780
  for (const msg of messages) {
1779
1781
  if (msg.role === "assistant" && msg.tool_calls) {
1780
1782
  for (const tc of msg.tool_calls) {
1781
1783
  toolCallIdToName.set(tc.id, tc.function.name);
1782
1784
  }
1783
1785
  }
1786
+ if (msg.role === "assistant") {
1787
+ const rawParts = msg.providerMetadata?.geminiParts;
1788
+ if (rawParts) {
1789
+ for (const p of rawParts) {
1790
+ if (p.functionCall?.id) geminiNativeIds.add(p.functionCall.id);
1791
+ }
1792
+ }
1793
+ }
1784
1794
  }
1785
1795
  const result = [];
1786
1796
  for (const msg of messages) {
@@ -1821,16 +1831,16 @@ var GeminiProvider = class {
1821
1831
  } catch {
1822
1832
  responseData = { result: msg.content };
1823
1833
  }
1834
+ const functionResponse = {
1835
+ name: functionName,
1836
+ response: responseData
1837
+ };
1838
+ if (msg.tool_call_id && geminiNativeIds.has(msg.tool_call_id)) {
1839
+ functionResponse.id = msg.tool_call_id;
1840
+ }
1824
1841
  result.push({
1825
1842
  role: "user",
1826
- parts: [
1827
- {
1828
- functionResponse: {
1829
- name: functionName,
1830
- response: responseData
1831
- }
1832
- }
1833
- ]
1843
+ parts: [{ functionResponse }]
1834
1844
  });
1835
1845
  } else if (msg.role === "user") {
1836
1846
  result.push({ role: "user", parts: [{ text: msg.content }] });
@@ -1898,7 +1908,7 @@ var GeminiProvider = class {
1898
1908
  content += part.text;
1899
1909
  } else if (part.functionCall) {
1900
1910
  toolCalls.push({
1901
- id: `call_${this.callCounter++}`,
1911
+ id: part.functionCall.id || `call_${this.callCounter++}`,
1902
1912
  type: "function",
1903
1913
  function: {
1904
1914
  name: part.functionCall.name,
@@ -1978,7 +1988,7 @@ var GeminiProvider = class {
1978
1988
  } else if (part.functionCall) {
1979
1989
  yield {
1980
1990
  type: "tool_call_delta",
1981
- id: `call_${this.callCounter++}`,
1991
+ id: part.functionCall.id || `call_${this.callCounter++}`,
1982
1992
  name: part.functionCall.name,
1983
1993
  arguments: JSON.stringify(part.functionCall.args)
1984
1994
  };