zidane 5.10.2 → 5.10.4

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.
Files changed (71) hide show
  1. package/README.md +6 -4
  2. package/dist/{agent-Bt123Fdy.d.ts → agent-Dbhh2fr7.d.ts} +216 -3
  3. package/dist/agent-Dbhh2fr7.d.ts.map +1 -0
  4. package/dist/chat/pure.d.ts +3 -3
  5. package/dist/chat.d.ts +6 -6
  6. package/dist/chat.js +2 -2
  7. package/dist/eval.d.ts +2 -2
  8. package/dist/eval.js +179 -11
  9. package/dist/eval.js.map +1 -1
  10. package/dist/{headless-Cn6XXmr3.js → headless-WsGaqG1W.js} +5 -5
  11. package/dist/{headless-Cn6XXmr3.js.map → headless-WsGaqG1W.js.map} +1 -1
  12. package/dist/headless.d.ts +1 -1
  13. package/dist/headless.js +1 -1
  14. package/dist/{index-C7BvI1Hi.d.ts → index-CgsSvsR5.d.ts} +24 -3
  15. package/dist/index-CgsSvsR5.d.ts.map +1 -0
  16. package/dist/{index-BodGKXBV.d.ts → index-DbMQsGZP.d.ts} +2 -2
  17. package/dist/{index-BodGKXBV.d.ts.map → index-DbMQsGZP.d.ts.map} +1 -1
  18. package/dist/index.d.ts +4 -4
  19. package/dist/index.js +9 -9
  20. package/dist/{login-DoGslmKC.js → login-D-SWsD7j.js} +3 -3
  21. package/dist/{login-DoGslmKC.js.map → login-D-SWsD7j.js.map} +1 -1
  22. package/dist/{mcp-BdN9UjTO.js → mcp-BVuDO44W.js} +3 -3
  23. package/dist/{mcp-BdN9UjTO.js.map → mcp-BVuDO44W.js.map} +1 -1
  24. package/dist/mcp.d.ts +1 -1
  25. package/dist/mcp.js +1 -1
  26. package/dist/{messages-DdfOKKx_.js → messages-_E1RxSxV.js} +135 -13
  27. package/dist/messages-_E1RxSxV.js.map +1 -0
  28. package/dist/output/stream-json.d.ts +2 -2
  29. package/dist/output/stream-json.js +1 -1
  30. package/dist/output/terminal.d.ts +2 -2
  31. package/dist/{presets-DCrQmY3b.js → presets-9NpXoxzg.js} +2 -2
  32. package/dist/{presets-DCrQmY3b.js.map → presets-9NpXoxzg.js.map} +1 -1
  33. package/dist/presets.d.ts +2 -2
  34. package/dist/presets.js +1 -1
  35. package/dist/{providers-BxHepM_P.js → providers-B6M0Oer3.js} +68 -7
  36. package/dist/providers-B6M0Oer3.js.map +1 -0
  37. package/dist/providers.d.ts +2 -2
  38. package/dist/providers.js +3 -3
  39. package/dist/restate.d.ts +1 -1
  40. package/dist/session/sqlite.d.ts +1 -1
  41. package/dist/{session-C0uGIWm_.js → session-CZniOWFD.js} +2 -2
  42. package/dist/{session-C0uGIWm_.js.map → session-CZniOWFD.js.map} +1 -1
  43. package/dist/session.d.ts +1 -1
  44. package/dist/session.js +2 -2
  45. package/dist/skills.d.ts +2 -2
  46. package/dist/{tool-formatters-BuB31L-c.d.ts → tool-formatters-DkcN6HZt.d.ts} +2 -2
  47. package/dist/tool-formatters-DkcN6HZt.d.ts.map +1 -0
  48. package/dist/tools/fetch-url.d.ts +1 -1
  49. package/dist/tools/web-search.d.ts +1 -1
  50. package/dist/{tools-Bk9TqmCV.js → tools-BbVXIpFo.js} +256 -18
  51. package/dist/tools-BbVXIpFo.js.map +1 -0
  52. package/dist/tools.d.ts +2 -2
  53. package/dist/tools.js +1 -1
  54. package/dist/{transcript-anchors-Bkuspqgn.js → transcript-anchors-BtRC9WEQ.js} +6 -6
  55. package/dist/{transcript-anchors-Bkuspqgn.js.map → transcript-anchors-BtRC9WEQ.js.map} +1 -1
  56. package/dist/{transcript-anchors-DhVgKmEl.d.ts → transcript-anchors-DS8yTwq3.d.ts} +5 -5
  57. package/dist/{transcript-anchors-DhVgKmEl.d.ts.map → transcript-anchors-DS8yTwq3.d.ts.map} +1 -1
  58. package/dist/tui.d.ts +3 -3
  59. package/dist/tui.js +7 -7
  60. package/dist/{turn-operations-DYKtoVd9.d.ts → turn-operations-CTZwjdxD.d.ts} +3 -3
  61. package/dist/{turn-operations-DYKtoVd9.d.ts.map → turn-operations-CTZwjdxD.d.ts.map} +1 -1
  62. package/dist/types-BiobHM1D.js.map +1 -1
  63. package/dist/types.d.ts +2 -2
  64. package/package.json +1 -1
  65. package/scripts/eval.ts +18 -1
  66. package/dist/agent-Bt123Fdy.d.ts.map +0 -1
  67. package/dist/index-C7BvI1Hi.d.ts.map +0 -1
  68. package/dist/messages-DdfOKKx_.js.map +0 -1
  69. package/dist/providers-BxHepM_P.js.map +0 -1
  70. package/dist/tool-formatters-BuB31L-c.d.ts.map +0 -1
  71. package/dist/tools-Bk9TqmCV.js.map +0 -1
@@ -240,6 +240,40 @@ const EXTRA_COST_RATES = {
240
240
  "arcee:trinity-mini": {
241
241
  input: .045,
242
242
  output: .15
243
+ },
244
+ "baseten:zai-org/GLM-5": {
245
+ input: .95,
246
+ output: 3.15,
247
+ cacheRead: .2
248
+ },
249
+ "baseten:zai-org/GLM-4.7": {
250
+ input: .6,
251
+ output: 2.2,
252
+ cacheRead: .12
253
+ },
254
+ "baseten:moonshotai/Kimi-K2.6": {
255
+ input: 1,
256
+ output: 3.9,
257
+ cacheRead: .2
258
+ },
259
+ "baseten:moonshotai/Kimi-K2.5": {
260
+ input: .6,
261
+ output: 3,
262
+ cacheRead: .12
263
+ },
264
+ "baseten:deepseek-ai/DeepSeek-V4-Pro": {
265
+ input: 1.74,
266
+ output: 3.48,
267
+ cacheRead: .145
268
+ },
269
+ "baseten:nvidia/Nemotron-120B-A12B": {
270
+ input: .3,
271
+ output: .75,
272
+ cacheRead: .06
273
+ },
274
+ "baseten:openai/gpt-oss-120b": {
275
+ input: .1,
276
+ output: .5
243
277
  }
244
278
  };
245
279
  /**
@@ -649,6 +683,7 @@ async function consumeSSE(response, callbacks, signal) {
649
683
  output: 0
650
684
  };
651
685
  const tcMap = /* @__PURE__ */ new Map();
686
+ const idNonce = Math.random().toString(36).slice(2, 10);
652
687
  const reasoningMap = /* @__PURE__ */ new Map();
653
688
  let sawReasoningDetails = false;
654
689
  try {
@@ -726,7 +761,7 @@ async function consumeSSE(response, callbacks, signal) {
726
761
  existing.name ||= tc.function?.name ?? "";
727
762
  if (tc.function?.arguments) existing.args += tc.function.arguments;
728
763
  } else tcMap.set(tc.index, {
729
- id: tc.id || `call_${tc.index}`,
764
+ id: tc.id || `call_${tc.index}_${idNonce}`,
730
765
  name: tc.function?.name || "",
731
766
  args: tc.function?.arguments || ""
732
767
  });
@@ -1334,8 +1369,14 @@ function openaiCompat(params) {
1334
1369
  const shouldCache = cacheBreakpointsEnabled && options.cache !== false;
1335
1370
  if (shouldCache) applyOAICacheBreakpoints(messages, options.system);
1336
1371
  const maxTokens = options.thinkingBudget ? options.thinkingBudget + options.maxTokens : options.maxTokens;
1372
+ const reasoningBody = params.planReasoningRequest?.({
1373
+ model: modelId,
1374
+ thinking: options.thinking,
1375
+ thinkingBudget: options.thinkingBudget
1376
+ });
1337
1377
  const body = {
1338
1378
  ...params.extraBodyParams ?? {},
1379
+ ...reasoningBody ?? {},
1339
1380
  model: modelId,
1340
1381
  messages,
1341
1382
  max_tokens: maxTokens,
@@ -1699,6 +1740,10 @@ function fromOpenAI(msg) {
1699
1740
  output: r.content ?? ""
1700
1741
  });
1701
1742
  }
1743
+ if (typeof tagged.text === "string" && tagged.text) content.push({
1744
+ type: "text",
1745
+ text: tagged.text
1746
+ });
1702
1747
  return {
1703
1748
  role,
1704
1749
  content
@@ -1810,16 +1855,20 @@ function toOpenAI(msg) {
1810
1855
  const textBlocks = msg.content.filter((b) => b.type === "text");
1811
1856
  const imageBlocks = msg.content.filter((b) => b.type === "image");
1812
1857
  const documentBlocks = msg.content.filter((b) => b.type === "document");
1813
- if (toolResults.length > 0) return {
1814
- role: msg.role,
1815
- content: {
1816
- _tag: TOOL_RESULTS_TAG,
1817
- results: toolResults.map((tr) => ({
1818
- tool_call_id: tr.callId,
1819
- content: tr.output
1820
- }))
1821
- }
1822
- };
1858
+ if (toolResults.length > 0) {
1859
+ const siblingText = textBlocks.map((b) => b.text).join("\n");
1860
+ return {
1861
+ role: msg.role,
1862
+ content: {
1863
+ _tag: TOOL_RESULTS_TAG,
1864
+ results: toolResults.map((tr) => ({
1865
+ tool_call_id: tr.callId,
1866
+ content: tr.output
1867
+ })),
1868
+ ...siblingText ? { text: siblingText } : {}
1869
+ }
1870
+ };
1871
+ }
1823
1872
  if (toolCalls.length > 0) {
1824
1873
  const textContent = textBlocks.length > 0 ? textBlocks[0].text : null;
1825
1874
  return {
@@ -2130,6 +2179,79 @@ function processUserMessage(args) {
2130
2179
  content: finalContent
2131
2180
  });
2132
2181
  }
2182
+ /**
2183
+ * Re-mint tool-call ids that collide with ids already present in the
2184
+ * transcript (or with an earlier sibling in the same turn), BEFORE the turn
2185
+ * is persisted and its tools dispatched.
2186
+ *
2187
+ * Why this exists: some providers/serving stacks emit non-globally-unique
2188
+ * tool_use ids (per-turn counters like `call_0`, retry-replay duplicates,
2189
+ * Kimi-K2.6 on Fireworks). The wire-time pairing pass
2190
+ * ({@link ensureToolResultPairing}) can only STRIP such duplicates — which
2191
+ * erases the model's tool calls and results from the wire view, stalls
2192
+ * progress, and re-accumulates repairs quadratically because the persisted
2193
+ * session keeps the corrupted ids. Re-minting at persist time keeps the
2194
+ * pairing intact instead: the call, its execution, and its tool_result all
2195
+ * carry the fresh id, so the pairing pass has nothing to strip on any later
2196
+ * turn.
2197
+ *
2198
+ * Fresh ids are `${oldId}_r{n}` with `n` bumped until unique — deterministic
2199
+ * shape, Anthropic-wire-safe charset (given a safe input id), and visibly
2200
+ * traceable back to the original.
2201
+ *
2202
+ * Alignment contract: `toolCalls` and the `tool_call` blocks inside
2203
+ * `content` are two views of the same emission and MUST be in the same
2204
+ * order (true for every provider — both are built from one source array).
2205
+ * Occurrences are matched positionally per old id so intra-turn duplicates
2206
+ * map to distinct fresh ids on both views.
2207
+ *
2208
+ * Pure: returns the input references unchanged when no id collides.
2209
+ */
2210
+ function remintDuplicateToolCallIds(toolCalls, content, priorIds) {
2211
+ const seen = new Set(priorIds);
2212
+ const reminted = [];
2213
+ const finalIdQueues = /* @__PURE__ */ new Map();
2214
+ let changed = false;
2215
+ const outCalls = toolCalls.map((tc) => {
2216
+ let finalId = tc.id;
2217
+ if (seen.has(tc.id)) {
2218
+ let n = 1;
2219
+ while (seen.has(`${tc.id}_r${n}`)) n++;
2220
+ finalId = `${tc.id}_r${n}`;
2221
+ reminted.push({
2222
+ oldId: tc.id,
2223
+ newId: finalId
2224
+ });
2225
+ changed = true;
2226
+ }
2227
+ seen.add(finalId);
2228
+ const queue = finalIdQueues.get(tc.id);
2229
+ if (queue) queue.push(finalId);
2230
+ else finalIdQueues.set(tc.id, [finalId]);
2231
+ return finalId === tc.id ? tc : {
2232
+ ...tc,
2233
+ id: finalId
2234
+ };
2235
+ });
2236
+ if (!changed) return {
2237
+ toolCalls,
2238
+ content,
2239
+ reminted
2240
+ };
2241
+ return {
2242
+ toolCalls: outCalls,
2243
+ content: content.map((block) => {
2244
+ if (block.type !== "tool_call") return block;
2245
+ const finalId = finalIdQueues.get(block.id)?.shift();
2246
+ if (finalId === void 0 || finalId === block.id) return block;
2247
+ return {
2248
+ ...block,
2249
+ id: finalId
2250
+ };
2251
+ }),
2252
+ reminted
2253
+ };
2254
+ }
2133
2255
  function syntheticResultBlock(callId) {
2134
2256
  return {
2135
2257
  type: "tool_result",
@@ -2324,6 +2446,6 @@ function autoDetectAndConvert(msg) {
2324
2446
  return fromAnthropic(msg);
2325
2447
  }
2326
2448
  //#endregion
2327
- export { replaceDynamicSection as A, fillEstimatedCost as C, hasSystemPromptBoundary as D, appendStaticSection as E, joinSystemPrompt as O, sanitizeToolSpecs as S, appendDynamicSection as T, mapOAIFinishReason as _, detectTurnInterruption as a, userMessage as b, filterUnresolvedToolUses as c, toAnthropic as d, toOpenAI as f, classifyOpenAICompatError as g, assistantMessage as h, autoDetectAndConvert as i, splitSystemPrompt as j, renderSystemForWire as k, fromAnthropic as l, OpenAICompatHttpError as m, SYNTHETIC_TOOL_RESULT_PLACEHOLDER as n, ensureEndsWithUserMessage as o, toWireMessages as p, TOOL_USE_INTERRUPTED_MARKER as r, ensureToolResultPairing as s, ORPHANED_TOOL_RESULT_MARKER as t, fromOpenAI as u, openaiCompat as v, SYSTEM_PROMPT_BOUNDARY as w, sanitizeToolSchema as x, toolResultsMessage as y };
2449
+ export { renderSystemForWire as A, sanitizeToolSpecs as C, appendStaticSection as D, appendDynamicSection as E, splitSystemPrompt as M, hasSystemPromptBoundary as O, sanitizeToolSchema as S, SYSTEM_PROMPT_BOUNDARY as T, classifyOpenAICompatError as _, detectTurnInterruption as a, toolResultsMessage as b, filterUnresolvedToolUses as c, remintDuplicateToolCallIds as d, toAnthropic as f, assistantMessage as g, OpenAICompatHttpError as h, autoDetectAndConvert as i, replaceDynamicSection as j, joinSystemPrompt as k, fromAnthropic as l, toWireMessages as m, SYNTHETIC_TOOL_RESULT_PLACEHOLDER as n, ensureEndsWithUserMessage as o, toOpenAI as p, TOOL_USE_INTERRUPTED_MARKER as r, ensureToolResultPairing as s, ORPHANED_TOOL_RESULT_MARKER as t, fromOpenAI as u, mapOAIFinishReason as v, fillEstimatedCost as w, userMessage as x, openaiCompat as y };
2328
2450
 
2329
- //# sourceMappingURL=messages-DdfOKKx_.js.map
2451
+ //# sourceMappingURL=messages-_E1RxSxV.js.map