@roomle/embedding-lib 0.0.0-dev-20f436f → 0.0.0-dev-d66646c

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 (74) hide show
  1. package/THIRD-PARTY-NOTICES.txt +2 -2
  2. package/ai.js +8 -8
  3. package/ai.min.js +7 -6
  4. package/{browser-D6M-d6y5.mjs → browser-Cys-y5Hy.mjs} +1 -2
  5. package/chat-model-DooKwd8I.mjs +117 -0
  6. package/chat-model-KHuz1Ej9.mjs +118 -0
  7. package/coerce-CuLRCRlo.mjs +6 -0
  8. package/coerce-Dup0o-HR.mjs +7 -0
  9. package/{comlink-CG3f9q6z.mjs → comlink-7u13Z2ZH.mjs} +2 -3
  10. package/{comlink-hSUzCx9j.mjs → comlink-DKhvPU0o.mjs} +1 -1
  11. package/configurator.js +3 -4
  12. package/configurator.min.js +2 -2
  13. package/construction.js +387 -31
  14. package/construction.min.js +395 -36
  15. package/continuation-COcMrXyj.mjs +14 -0
  16. package/continuation-D2hsmYf1.mjs +13 -0
  17. package/{dist-Cm3aF4sf.mjs → dist-7-X7Xqsl.mjs} +851 -919
  18. package/{dist-BQaw78-_.mjs → dist-BMxyw-Zs.mjs} +411 -405
  19. package/{dist-0WZWTj8T.mjs → dist-BU022PnG.mjs} +4 -9
  20. package/{dist-DkR6G9Kj.mjs → dist-BY8OLJ2p.mjs} +1 -1
  21. package/{dist-6TznX-Ae.mjs → dist-BZSd56sr.mjs} +3850 -3942
  22. package/{dist-70R0b5Mq.mjs → dist-Ba3J8AjB.mjs} +400 -390
  23. package/{dist-CTS0DDwt.mjs → dist-CbQKC1xX.mjs} +1590 -1616
  24. package/{dist-BmOBP9h9.mjs → dist-CiybWJvs.mjs} +44 -41
  25. package/{dist-CPG4atmb.mjs → dist-CkZuNdCU.mjs} +6 -4
  26. package/{dist-Bt1FopV4.mjs → dist-D2ZAAHGn.mjs} +1058 -1042
  27. package/{dist-BWNv7qW9.mjs → dist-DjsS42rR.mjs} +916 -962
  28. package/{dist-9UI7dzwc.mjs → dist-Jcq_kKKT.mjs} +403 -393
  29. package/{dist-D0XFfKEL.mjs → dist-S9sLSjZ4.mjs} +3112 -3104
  30. package/{dist-BV-32IEX.mjs → dist-XECXrV5Q.mjs} +1497 -1558
  31. package/{dist-Bc2s-kJZ.mjs → dist-a5_BIeaS.mjs} +45 -51
  32. package/{dist-Crrp-Bno.mjs → dist-bQAJDeYc.mjs} +698 -748
  33. package/{drag-ghost-BpIDzSdK.mjs → drag-ghost-QZelgA-_.mjs} +2 -3
  34. package/{drag-ghost-Bhb0_67G.mjs → drag-ghost-VmgSWLva.mjs} +5 -7
  35. package/{drag-in-mE_ozj_Q.mjs → drag-in-Cd_67tzS.mjs} +4 -5
  36. package/{drag-in-CGBG4wEk.mjs → drag-in-DlDsgY4T.mjs} +3 -3
  37. package/embedding-plugins.js +1 -2
  38. package/embedding-plugins.min.js +1 -2
  39. package/{experimental-evaluation-FzKFGoye.mjs → experimental-evaluation-B4hKMgFH.mjs} +19 -38
  40. package/{experimental-evaluation-DczxmJme.mjs → experimental-evaluation-DmqghFSx.mjs} +1 -1
  41. package/{from-custom-view-B3fIWMox.mjs → from-custom-view-6HMD_sPe.mjs} +5 -4
  42. package/{from-custom-view-B3HCOhdT.mjs → from-custom-view-BRFynafo.mjs} +16 -16
  43. package/{from-website-DaTahmvJ.mjs → from-website-Dl1VN4h7.mjs} +5 -6
  44. package/{from-website-DUQ9USj1.mjs → from-website-iZzauH4C.mjs} +3 -3
  45. package/hi.js +228 -233
  46. package/hi.min.js +207 -204
  47. package/mcp-tools-C6O2gQZW.mjs +41 -0
  48. package/mcp-tools-m_3IX0vB.mjs +40 -0
  49. package/package.json +1 -1
  50. package/packages/embedding-lib/src/homag-intelligence/hi-planning-assistant.d.ts +3 -0
  51. package/packages/embedding-lib/src/homag-intelligence/hi-planning-usage.d.ts +0 -6
  52. package/packages/web-sdk/packages/assistant.d.ts +3 -1
  53. package/packages/web-sdk/packages/common-core/src/planning-assistant/chat-recovery.d.ts +5 -1
  54. package/packages/web-sdk/packages/common-core/src/planning-assistant/continuation.d.ts +5 -3
  55. package/packages/web-sdk/packages/common-core/src/planning-assistant/runtime.d.ts +4 -1
  56. package/packages/web-sdk/packages/common-core/src/planning-assistant/types.d.ts +2 -0
  57. package/packages/web-sdk/packages/common-core/src/planning-assistant/usage.d.ts +16 -0
  58. package/packages/web-sdk/packages/common-core/src/planning-assistant.d.ts +19 -1
  59. package/rolldown-runtime--db92txo.mjs +10 -0
  60. package/rolldown-runtime-CyjYJMBa.mjs +11 -0
  61. package/roomle-embedding-lib.js +25 -34
  62. package/roomle-embedding-lib.min.js +3 -3
  63. package/sbom.cdx.json +5 -5
  64. package/usage-CgXarvBY.mjs +16 -0
  65. package/usage-c8evaONq.mjs +17 -0
  66. package/{utils-BwWn6Fw4.mjs → utils-CJnKZceY.mjs} +3 -4
  67. package/{utils-BoELtcEK.mjs → utils-DdNhTbJr.mjs} +6 -6
  68. package/chat-model-C1ov616e.mjs +0 -377
  69. package/chat-model-CifTV-8H.mjs +0 -373
  70. package/coerce-CqJod_GZ.mjs +0 -8
  71. package/coerce-CsI42_k0.mjs +0 -6
  72. package/mcp-tools-CC8DTfZA.mjs +0 -2
  73. package/mcp-tools-CfJ_ue_2.mjs +0 -2
  74. /package/{browser-BjtSrqbu.mjs → browser-CzLpXYFF.mjs} +0 -0
@@ -1,7 +1,7 @@
1
1
 
2
- import { $ as e, A as t, Bt as n, D as r, E as i, Et as a, H as o, Ht as s, It as c, Jt as l, K as u, Kt as d, L as f, Lt as p, M as m, Mt as h, N as g, O as _, Ot as v, Pn as y, Qt as b, Rt as x, S, Sn as C, Tt as w, Vt as T, Wt as E, X as D, Yt as O, Zt as k, _ as A, _n as j, _t as M, an as N, b as P, bn as ee, bt as F, cn as te, dn as I, dt as ne, en as L, f as R, fn as z, ft as B, h as V, ht as re, i as ie, in as H, j as U, jn as W, jt as G, k as ae, kn as oe, ln as K, lt as se, mt as ce, nn as le, nt as ue, o as de, ot as q, p as fe, qt as pe, sn as J, st as me, tn as Y, v as he, w as ge, xn as _e, yt as ve, zt as ye } from "./dist-BV-32IEX.mjs";
3
- import { t as be } from "./coerce-CqJod_GZ.mjs";
4
- //#region node_modules/@ai-sdk/openai/dist/internal/index.js
2
+ import { $ as e, A as t, Bt as n, D as r, E as i, Et as a, H as o, Ht as s, It as c, Jt as l, K as u, Kt as d, L as f, Lt as p, M as m, Mt as h, N as g, O as _, Ot as v, Pn as y, Qt as b, Rt as x, S, Sn as C, Tt as w, Vt as T, Wt as E, X as D, Yt as O, Zt as k, _ as A, _n as j, _t as M, an as N, b as P, bn as ee, bt as F, cn as te, dn as I, dt as ne, en as L, f as R, fn as z, ft as B, h as V, ht as re, i as ie, in as H, j as U, jn as W, jt as G, k as ae, kn as oe, ln as K, lt as se, mt as ce, nn as le, nt as ue, o as de, ot as q, p as fe, qt as pe, sn as J, st as me, tn as Y, v as he, w as ge, xn as _e, yt as ve, zt as ye } from "./dist-XECXrV5Q.mjs";
3
+ import { t as be } from "./coerce-Dup0o-HR.mjs";
4
+ // node_modules/@ai-sdk/openai/dist/internal/index.js
5
5
  var xe = N({ error: N({
6
6
  message: K(),
7
7
  type: K().nullish(),
@@ -332,16 +332,14 @@ function Be({ prompt: e, systemMessageMode: t = "system" }) {
332
332
  }), r ||= i != null;
333
333
  break;
334
334
  }
335
- case "tool-call":
336
- i.push({
337
- id: n.toolCallId,
338
- type: "function",
339
- function: {
340
- name: n.toolName,
341
- arguments: ze(n.input)
342
- }
343
- });
344
- break;
335
+ case "tool-call": i.push({
336
+ id: n.toolCallId,
337
+ type: "function",
338
+ function: {
339
+ name: n.toolName,
340
+ arguments: ze(n.input)
341
+ }
342
+ });
345
343
  }
346
344
  n.push({
347
345
  role: "assistant",
@@ -364,9 +362,7 @@ function Be({ prompt: e, systemMessageMode: t = "system" }) {
364
362
  break;
365
363
  case "content":
366
364
  case "json":
367
- case "error-json":
368
- i = JSON.stringify(t.value);
369
- break;
365
+ case "error-json": i = JSON.stringify(t.value);
370
366
  }
371
367
  n.push({
372
368
  role: "tool",
@@ -618,23 +614,11 @@ function qe(e) {
618
614
  let t = !1, n = !1;
619
615
  for (let r = 0; r < e.length; r++) {
620
616
  let i = e[r];
621
- if (t) {
622
- t = !1;
623
- continue;
624
- }
625
- if (i === "\\") {
626
- t = !0;
627
- continue;
628
- }
629
- if (i === "[") {
630
- n = !0;
631
- continue;
632
- }
633
- if (i === "]") {
634
- n = !1;
635
- continue;
636
- }
637
- if (!n && i === "(" && e[r + 1] === "?") {
617
+ if (t) t = !1;
618
+ else if (i === "\\") t = !0;
619
+ else if (i === "[") n = !0;
620
+ else if (i === "]") n = !1;
621
+ else if (!n && i === "(" && e[r + 1] === "?") {
638
622
  let t = e[r + 2];
639
623
  if (t === "=" || t === "!" || t === "<" && (e[r + 3] === "=" || e[r + 3] === "!")) return !0;
640
624
  }
@@ -664,12 +648,10 @@ function Je({ tools: e, toolChoice: t }) {
664
648
  });
665
649
  break;
666
650
  }
667
- default:
668
- n.push({
669
- type: "unsupported",
670
- feature: `tool type: ${t.type}`
671
- });
672
- break;
651
+ default: n.push({
652
+ type: "unsupported",
653
+ feature: `tool type: ${t.type}`
654
+ });
673
655
  }
674
656
  if (t == null) return {
675
657
  tools: r,
@@ -738,7 +720,7 @@ var Ye = class e {
738
720
  let C = {
739
721
  model: this.modelId,
740
722
  logit_bias: h.logitBias,
741
- logprobs: h.logprobs === !0 || typeof h.logprobs == "number" ? !0 : void 0,
723
+ logprobs: h.logprobs === !0 || typeof h.logprobs == "number" || void 0,
742
724
  top_logprobs: typeof h.logprobs == "number" ? h.logprobs : typeof h.logprobs == "boolean" && h.logprobs ? 0 : void 0,
743
725
  user: h.user,
744
726
  parallel_tool_calls: h.parallelToolCalls,
@@ -775,7 +757,7 @@ var Ye = class e {
775
757
  type: "unsupported",
776
758
  feature: "promptCacheRetention",
777
759
  details: "promptCacheRetention is not supported by GPT-6 and later models; use promptCacheOptions instead"
778
- })), v ? ((_ !== "none" || !g.supportsNonReasoningParameters) && (C.temperature != null && (C.temperature = void 0, m.push({
760
+ })), v ? (_ === "none" && g.supportsNonReasoningParameters || (C.temperature != null && (C.temperature = void 0, m.push({
779
761
  type: "unsupported",
780
762
  feature: "temperature",
781
763
  details: "temperature is not supported for reasoning models"
@@ -808,7 +790,7 @@ var Ye = class e {
808
790
  type: "unsupported",
809
791
  feature: "serviceTier",
810
792
  details: "flex processing is only available for o3, o4-mini, and gpt-5 models"
811
- }), C.service_tier = void 0), (h.serviceTier === "priority" || h.serviceTier === "fast") && !g.supportsPriorityProcessing && (m.push({
793
+ }), C.service_tier = void 0), h.serviceTier !== "priority" && h.serviceTier !== "fast" || g.supportsPriorityProcessing || (m.push({
812
794
  type: "unsupported",
813
795
  feature: "serviceTier",
814
796
  details: "priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"
@@ -1025,9 +1007,7 @@ function Qe({ prompt: e, user: t = "user", assistant: n = "assistant" }) {
1025
1007
  });
1026
1008
  case "user": {
1027
1009
  let e = a.map((e) => {
1028
- switch (e.type) {
1029
- case "text": return e.text;
1030
- }
1010
+ if (e.type === "text") return e.text;
1031
1011
  }).filter(Boolean).join("");
1032
1012
  r += `${t}:
1033
1013
  ${e}
@@ -1463,7 +1443,7 @@ var ht = q(() => n(mt.extend({
1463
1443
  "gpt-image-2.5-sunburst",
1464
1444
  "gpt-image-2.5-sunburst-2026-09-08",
1465
1445
  "chatgpt-image-latest"
1466
- ].includes(this.modelId) ? !0 : this.modelId === "dall-e-3" ? !1 : void 0 : this.config.imageInputCapabilities.supportsFileInputs;
1446
+ ].includes(this.modelId) ? !0 : this.modelId !== "dall-e-3" && void 0 : this.config.imageInputCapabilities.supportsFileInputs;
1467
1447
  }
1468
1448
  get supportsMaskInputs() {
1469
1449
  return this.config.imageInputCapabilities == null ? this.supportsFileInputs : this.config.imageInputCapabilities.supportsMaskInputs;
@@ -1761,8 +1741,10 @@ var Ct = {
1761
1741
  temperature: i.temperature,
1762
1742
  timestamp_granularities: i.timestampGranularities
1763
1743
  };
1764
- for (let [e, n] of Object.entries(t)) if (n != null) if (Array.isArray(n)) for (let t of n) a.append(`${e}[]`, String(t));
1765
- else a.append(e, String(n));
1744
+ for (let [e, n] of Object.entries(t)) if (n != null) {
1745
+ if (Array.isArray(n)) for (let t of n) a.append(`${e}[]`, String(t));
1746
+ else a.append(e, String(n));
1747
+ }
1766
1748
  } else c && a.append("response_format", "diarized_json");
1767
1749
  return l != null && a.append("chunking_strategy", typeof l == "string" ? l : JSON.stringify({
1768
1750
  type: l.type,
@@ -1930,9 +1912,7 @@ function Tt({ webSocket: e, url: t, headers: n, sessionUpdate: r, language: i, w
1930
1912
  case "conversation.item.input_audio_transcription.completed":
1931
1913
  _(n.transcript ?? "", n.item_id);
1932
1914
  break;
1933
- case "error":
1934
- g(Error(n.error?.message ?? "OpenAI realtime error"));
1935
- break;
1915
+ case "error": g(Error(n.error?.message ?? "OpenAI realtime error"));
1936
1916
  }
1937
1917
  },
1938
1918
  onSocketError: () => {
@@ -2543,19 +2523,11 @@ function cn({ prompt: t, providerOptionsName: n }) {
2543
2523
  });
2544
2524
  if (e == null) continue;
2545
2525
  let i = r.get(e.toolCallId);
2546
- if (i == null) {
2547
- r.set(e.toolCallId, {
2548
- metadata: e,
2549
- results: /* @__PURE__ */ new Map([[e.index, t]]),
2550
- invalid: !1
2551
- });
2552
- continue;
2553
- }
2554
- if (!sn(i.metadata, e) || i.results.has(e.index)) {
2555
- i.invalid = !0;
2556
- continue;
2557
- }
2558
- i.results.set(e.index, t);
2526
+ i == null ? r.set(e.toolCallId, {
2527
+ metadata: e,
2528
+ results: /* @__PURE__ */ new Map([[e.index, t]]),
2529
+ invalid: !1
2530
+ }) : !sn(i.metadata, e) || i.results.has(e.index) ? i.invalid = !0 : i.results.set(e.index, t);
2559
2531
  }
2560
2532
  let i = /* @__PURE__ */ new Map();
2561
2533
  for (let [t, n] of r) {
@@ -3051,25 +3023,23 @@ async function dn({ prompt: t, toolNameMapping: n, systemMessageMode: r, provide
3051
3023
  }
3052
3024
  break;
3053
3025
  }
3054
- case "custom":
3055
- if (t.kind === "openai.compaction") {
3056
- let e = t.providerOptions?.[i], n = e?.itemId;
3057
- if (f && n != null) break;
3058
- if (d && n != null) {
3059
- S.push({
3060
- type: "item_reference",
3061
- id: n
3062
- });
3063
- break;
3064
- }
3065
- let r = e?.encryptedContent;
3066
- n != null && S.push({
3067
- type: "compaction",
3068
- id: n,
3069
- encrypted_content: r
3026
+ case "custom": if (t.kind === "openai.compaction") {
3027
+ let e = t.providerOptions?.[i], n = e?.itemId;
3028
+ if (f && n != null) break;
3029
+ if (d && n != null) {
3030
+ S.push({
3031
+ type: "item_reference",
3032
+ id: n
3070
3033
  });
3034
+ break;
3071
3035
  }
3072
- break;
3036
+ let r = e?.encryptedContent;
3037
+ n != null && S.push({
3038
+ type: "compaction",
3039
+ id: n,
3040
+ encrypted_content: r
3041
+ });
3042
+ }
3073
3043
  }
3074
3044
  break;
3075
3045
  }
@@ -3511,7 +3481,7 @@ var mn = L(() => I([
3511
3481
  "web_search_call"
3512
3482
  ]);
3513
3483
  function On(e) {
3514
- return typeof e.type != "string" || !En.has(e.type) ? !1 : e.type !== "response.output_item.added" && e.type !== "response.output_item.done" || !ue(e.item) || typeof e.item.type != "string" ? !0 : Dn.has(e.item.type);
3484
+ return typeof e.type != "string" || !En.has(e.type) ? !1 : e.type !== "response.output_item.added" && e.type !== "response.output_item.done" || !ue(e.item) || typeof e.item.type != "string" || Dn.has(e.item.type);
3515
3485
  }
3516
3486
  var kn = q(() => n(I([
3517
3487
  N({
@@ -4426,11 +4396,11 @@ var kn = q(() => n(I([
4426
4396
  "1536x1024",
4427
4397
  "auto"
4428
4398
  ]), K().regex(/^\d+x\d+$/)]).optional()
4429
- }).strict())), Hn = U({
4399
+ }).strict())), Hn = q(() => n(N({}))), Un = q(() => n(N({ result: K() }))), Wn = U({
4430
4400
  id: "openai.image_generation",
4431
- inputSchema: q(() => n(N({}))),
4432
- outputSchema: q(() => n(N({ result: K() })))
4433
- }), Un = (e = {}) => Hn(e), Wn = q(() => n(N({
4401
+ inputSchema: Hn,
4402
+ outputSchema: Un
4403
+ }), Gn = (e = {}) => Wn(e), Kn = q(() => n(N({
4434
4404
  description: K().optional(),
4435
4405
  async: O().optional(),
4436
4406
  format: I([N({
@@ -4438,19 +4408,19 @@ var kn = q(() => n(I([
4438
4408
  syntax: E(["regex", "lark"]),
4439
4409
  definition: K()
4440
4410
  }), N({ type: Y("text") })]).optional()
4441
- })));
4411
+ }))), qn = q(() => n(K()));
4442
4412
  ae({
4443
4413
  id: "openai.custom",
4444
- inputSchema: q(() => n(K()))
4414
+ inputSchema: qn
4445
4415
  });
4446
- var Gn = L(() => I([
4416
+ var Jn = L(() => I([
4447
4417
  K(),
4448
4418
  H(),
4449
4419
  O(),
4450
4420
  d(),
4451
- l(Gn),
4452
- J(K(), Gn)
4453
- ])), Kn = q(() => n(N({
4421
+ l(Jn),
4422
+ J(K(), Jn)
4423
+ ])), Yn = q(() => n(N({
4454
4424
  serverLabel: K(),
4455
4425
  allowedTools: I([l(K()), N({
4456
4426
  readOnly: O().optional(),
@@ -4462,20 +4432,20 @@ var Gn = L(() => I([
4462
4432
  requireApproval: I([E(["always", "never"]), N({ never: N({ toolNames: l(K()).optional() }).optional() })]).optional(),
4463
4433
  serverDescription: K().optional(),
4464
4434
  serverUrl: K().optional()
4465
- }).refine((e) => e.serverUrl != null || e.connectorId != null, "One of serverUrl or connectorId must be provided.")));
4435
+ }).refine((e) => e.serverUrl != null || e.connectorId != null, "One of serverUrl or connectorId must be provided."))), Xn = q(() => n(N({}))), Zn = q(() => n(N({
4436
+ type: Y("call"),
4437
+ serverLabel: K(),
4438
+ name: K(),
4439
+ arguments: K(),
4440
+ output: K().nullish(),
4441
+ error: I([K(), Jn]).optional()
4442
+ })));
4466
4443
  U({
4467
4444
  id: "openai.mcp",
4468
- inputSchema: q(() => n(N({}))),
4469
- outputSchema: q(() => n(N({
4470
- type: Y("call"),
4471
- serverLabel: K(),
4472
- name: K(),
4473
- arguments: K(),
4474
- output: K().nullish(),
4475
- error: I([K(), Gn]).optional()
4476
- })))
4445
+ inputSchema: Xn,
4446
+ outputSchema: Zn
4477
4447
  });
4478
- var qn = q(() => n(N({
4448
+ var Qn = q(() => n(N({
4479
4449
  externalWebAccess: O().optional(),
4480
4450
  filters: N({
4481
4451
  allowedDomains: l(K()).optional(),
@@ -4493,35 +4463,35 @@ var qn = q(() => n(N({
4493
4463
  region: K().optional(),
4494
4464
  timezone: K().optional()
4495
4465
  }).optional()
4496
- }))), Jn = U({
4466
+ }))), $n = q(() => n(N({}))), er = q(() => n(N({
4467
+ action: k("type", [
4468
+ N({
4469
+ type: Y("search"),
4470
+ query: K().optional(),
4471
+ queries: l(K()).optional()
4472
+ }),
4473
+ N({
4474
+ type: Y("openPage"),
4475
+ url: K().nullish()
4476
+ }),
4477
+ N({
4478
+ type: Y("findInPage"),
4479
+ url: K().nullish(),
4480
+ pattern: K().nullish()
4481
+ })
4482
+ ]).optional(),
4483
+ sources: l(k("type", [N({
4484
+ type: Y("url"),
4485
+ url: K()
4486
+ }), N({
4487
+ type: Y("api"),
4488
+ name: K()
4489
+ })])).optional()
4490
+ }))), tr = U({
4497
4491
  id: "openai.web_search",
4498
- inputSchema: q(() => n(N({}))),
4499
- outputSchema: q(() => n(N({
4500
- action: k("type", [
4501
- N({
4502
- type: Y("search"),
4503
- query: K().optional(),
4504
- queries: l(K()).optional()
4505
- }),
4506
- N({
4507
- type: Y("openPage"),
4508
- url: K().nullish()
4509
- }),
4510
- N({
4511
- type: Y("findInPage"),
4512
- url: K().nullish(),
4513
- pattern: K().nullish()
4514
- })
4515
- ]).optional(),
4516
- sources: l(k("type", [N({
4517
- type: Y("url"),
4518
- url: K()
4519
- }), N({
4520
- type: Y("api"),
4521
- name: K()
4522
- })])).optional()
4523
- })))
4524
- }), Yn = (e = {}) => Jn(e), Xn = q(() => n(N({
4492
+ inputSchema: $n,
4493
+ outputSchema: er
4494
+ }), nr = (e = {}) => tr(e), rr = q(() => n(N({
4525
4495
  searchContextSize: E([
4526
4496
  "low",
4527
4497
  "medium",
@@ -4534,26 +4504,26 @@ var qn = q(() => n(N({
4534
4504
  region: K().optional(),
4535
4505
  timezone: K().optional()
4536
4506
  }).optional()
4537
- }))), Zn = U({
4507
+ }))), ir = q(() => n(N({}))), ar = q(() => n(N({ action: k("type", [
4508
+ N({
4509
+ type: Y("search"),
4510
+ query: K().optional()
4511
+ }),
4512
+ N({
4513
+ type: Y("openPage"),
4514
+ url: K().nullish()
4515
+ }),
4516
+ N({
4517
+ type: Y("findInPage"),
4518
+ url: K().nullish(),
4519
+ pattern: K().nullish()
4520
+ })
4521
+ ]).optional() }))), or = U({
4538
4522
  id: "openai.web_search_preview",
4539
- inputSchema: q(() => n(N({}))),
4540
- outputSchema: q(() => n(N({ action: k("type", [
4541
- N({
4542
- type: Y("search"),
4543
- query: K().optional()
4544
- }),
4545
- N({
4546
- type: Y("openPage"),
4547
- url: K().nullish()
4548
- }),
4549
- N({
4550
- type: Y("findInPage"),
4551
- url: K().nullish(),
4552
- pattern: K().nullish()
4553
- })
4554
- ]).optional() })))
4523
+ inputSchema: ir,
4524
+ outputSchema: ar
4555
4525
  });
4556
- async function Qn({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r, customProviderToolNames: i, outputSchemaToolNames: a, supportsAsyncToolCalling: o = !0 }) {
4526
+ async function sr({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r, customProviderToolNames: i, outputSchemaToolNames: a, supportsAsyncToolCalling: o = !0 }) {
4557
4527
  e = e?.length ? e : void 0;
4558
4528
  let s = [];
4559
4529
  if (e == null) return {
@@ -4564,17 +4534,17 @@ async function Qn({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
4564
4534
  let l = [], u = /* @__PURE__ */ new Map(), d = i ?? /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = (e, t, n) => {
4565
4535
  if (f.set(e, t), n == null || n === e) return;
4566
4536
  let r = p.get(n);
4567
- r == null ? p.set(n, t) : r !== "ambiguous" && !er(r, t) && p.set(n, "ambiguous");
4537
+ r == null ? p.set(n, t) : r !== "ambiguous" && !lr(r, t) && p.set(n, "ambiguous");
4568
4538
  };
4569
4539
  for (let t of e) switch (t.type) {
4570
4540
  case "function": {
4571
4541
  let e = t.providerOptions?.openai;
4572
4542
  e?.outputSchema != null && a?.add(t.name);
4573
- let n = nr({
4543
+ let n = dr({
4574
4544
  tool: t,
4575
4545
  options: e,
4576
4546
  toolWarnings: s,
4577
- async: rr({
4547
+ async: fr({
4578
4548
  value: e?.async,
4579
4549
  supportsAsyncToolCalling: o,
4580
4550
  toolName: t.name,
@@ -4638,7 +4608,7 @@ async function Qn({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
4638
4608
  });
4639
4609
  l.push({
4640
4610
  type: "shell",
4641
- ...e.environment && { environment: ir(e.environment) }
4611
+ ...e.environment && { environment: pr(e.environment) }
4642
4612
  });
4643
4613
  break;
4644
4614
  }
@@ -4651,7 +4621,7 @@ async function Qn({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
4651
4621
  case "openai.web_search_preview": {
4652
4622
  let e = await c({
4653
4623
  value: t.args,
4654
- schema: Xn
4624
+ schema: rr
4655
4625
  });
4656
4626
  l.push({
4657
4627
  type: "web_search_preview",
@@ -4663,7 +4633,7 @@ async function Qn({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
4663
4633
  case "openai.web_search": {
4664
4634
  let e = await c({
4665
4635
  value: t.args,
4666
- schema: qn
4636
+ schema: Qn
4667
4637
  });
4668
4638
  l.push({
4669
4639
  type: "web_search",
@@ -4721,7 +4691,7 @@ async function Qn({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
4721
4691
  case "openai.mcp": {
4722
4692
  let e = await c({
4723
4693
  value: t.args,
4724
- schema: Kn
4694
+ schema: Yn
4725
4695
  }), n = (e) => ({ tool_names: e.toolNames }), r = e.requireApproval, i = r == null ? void 0 : typeof r == "string" ? r : r.never == null ? void 0 : { never: n(r.never) };
4726
4696
  l.push({
4727
4697
  type: "mcp",
@@ -4742,13 +4712,13 @@ async function Qn({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
4742
4712
  case "openai.custom": {
4743
4713
  let e = await c({
4744
4714
  value: t.args,
4745
- schema: Wn
4715
+ schema: Kn
4746
4716
  });
4747
4717
  l.push({
4748
4718
  type: "custom",
4749
4719
  name: t.name,
4750
4720
  description: e.description,
4751
- ...rr({
4721
+ ...fr({
4752
4722
  value: e.async,
4753
4723
  supportsAsyncToolCalling: o,
4754
4724
  toolName: t.name,
@@ -4777,53 +4747,39 @@ async function Qn({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
4777
4747
  }
4778
4748
  if (l.length > e) {
4779
4749
  let n = l[e];
4780
- m(t.name, tr(n), r?.toProviderToolName(t.name));
4750
+ m(t.name, ur(n), r?.toProviderToolName(t.name));
4781
4751
  }
4782
4752
  break;
4783
4753
  }
4784
- default:
4785
- s.push({
4786
- type: "unsupported",
4787
- feature: `function tool ${t}`
4788
- });
4789
- break;
4754
+ default: s.push({
4755
+ type: "unsupported",
4756
+ feature: `function tool ${t}`
4757
+ });
4790
4758
  }
4791
4759
  if (n != null) {
4792
4760
  let e = [], t = [];
4793
4761
  for (let i of n.toolNames) {
4794
4762
  let n = f.get(i), a = n ?? p.get(i);
4795
- if (n != null && p.has(i) && s.push({
4763
+ n != null && p.has(i) && s.push({
4796
4764
  type: "unsupported",
4797
4765
  feature: `allowedTools entry "${i}"`,
4798
4766
  details: "this name is both a tool name and the provider tool name of another tool in this request; the tool with this name is allowed"
4799
- }), a === "ambiguous") {
4800
- s.push({
4801
- type: "unsupported",
4802
- feature: `allowedTools entry "${i}"`,
4803
- details: "several tools in this request share this provider tool name; use the tool name from the tools for this request instead"
4804
- }), t.push(i);
4805
- continue;
4806
- }
4807
- if (a == null) {
4808
- s.push({
4809
- type: "unsupported",
4810
- feature: `allowedTools entry "${i}"`,
4811
- details: "the tool is not part of the tools for this request and is sent as a function tool"
4812
- }), e.push({
4813
- type: "function",
4814
- name: r?.toProviderToolName(i) ?? i
4815
- });
4816
- continue;
4817
- }
4818
- if (!a.supported) {
4819
- s.push({
4820
- type: "unsupported",
4821
- feature: `allowedTools entry "${i}"`,
4822
- details: `${a.reason}; the tool is removed from the allowed tools`
4823
- }), t.push(i);
4824
- continue;
4825
- }
4826
- e.push(a.entry);
4767
+ }), a === "ambiguous" ? (s.push({
4768
+ type: "unsupported",
4769
+ feature: `allowedTools entry "${i}"`,
4770
+ details: "several tools in this request share this provider tool name; use the tool name from the tools for this request instead"
4771
+ }), t.push(i)) : a == null ? (s.push({
4772
+ type: "unsupported",
4773
+ feature: `allowedTools entry "${i}"`,
4774
+ details: "the tool is not part of the tools for this request and is sent as a function tool"
4775
+ }), e.push({
4776
+ type: "function",
4777
+ name: r?.toProviderToolName(i) ?? i
4778
+ })) : a.supported ? e.push(a.entry) : (s.push({
4779
+ type: "unsupported",
4780
+ feature: `allowedTools entry "${i}"`,
4781
+ details: `${a.reason}; the tool is removed from the allowed tools`
4782
+ }), t.push(i));
4827
4783
  }
4828
4784
  if (e.length === 0) throw new W({ functionality: `allowedTools with only tools that cannot be allow-listed (${t.join(", ")})` });
4829
4785
  return {
@@ -4867,7 +4823,7 @@ async function Qn({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
4867
4823
  default: throw new W({ functionality: `tool choice type: ${h}` });
4868
4824
  }
4869
4825
  }
4870
- function $n(e) {
4826
+ function cr(e) {
4871
4827
  switch (e.type) {
4872
4828
  case "mcp": return `mcp:${e.server_label}`;
4873
4829
  case "function":
@@ -4875,10 +4831,10 @@ function $n(e) {
4875
4831
  default: return e.type;
4876
4832
  }
4877
4833
  }
4878
- function er(e, t) {
4879
- return e.supported && t.supported ? $n(e.entry) === $n(t.entry) : !e.supported && !t.supported ? e.reason === t.reason : !1;
4834
+ function lr(e, t) {
4835
+ return e.supported && t.supported ? cr(e.entry) === cr(t.entry) : !e.supported && !t.supported && e.reason === t.reason;
4880
4836
  }
4881
- function tr(e) {
4837
+ function ur(e) {
4882
4838
  switch (e.type) {
4883
4839
  case "custom": return {
4884
4840
  supported: !0,
@@ -4913,7 +4869,7 @@ function tr(e) {
4913
4869
  };
4914
4870
  }
4915
4871
  }
4916
- function nr({ tool: e, options: t, toolWarnings: n, async: r }) {
4872
+ function dr({ tool: e, options: t, toolWarnings: n, async: r }) {
4917
4873
  let i = t?.deferLoading, a = Ke(e.inputSchema), o = t?.outputSchema == null ? void 0 : Ke(t.outputSchema);
4918
4874
  return n.push(...a.warnings, ...o?.warnings ?? []), {
4919
4875
  type: "function",
@@ -4927,7 +4883,7 @@ function nr({ tool: e, options: t, toolWarnings: n, async: r }) {
4927
4883
  ...t?.outputSchema == null ? {} : { output_schema: o?.schema }
4928
4884
  };
4929
4885
  }
4930
- function rr({ value: e, supportsAsyncToolCalling: t, toolName: n, toolWarnings: r }) {
4886
+ function fr({ value: e, supportsAsyncToolCalling: t, toolName: n, toolWarnings: r }) {
4931
4887
  if (e !== !0 || t) return e;
4932
4888
  r.push({
4933
4889
  type: "unsupported",
@@ -4935,7 +4891,7 @@ function rr({ value: e, supportsAsyncToolCalling: t, toolName: n, toolWarnings:
4935
4891
  details: "Async tool calling is only supported by GPT-6 and later models."
4936
4892
  });
4937
4893
  }
4938
- function ir(e) {
4894
+ function pr(e) {
4939
4895
  if (e.type === "containerReference") return {
4940
4896
  type: "container_reference",
4941
4897
  container_id: e.containerId
@@ -4951,7 +4907,7 @@ function ir(e) {
4951
4907
  allowed_domains: t.networkPolicy.allowedDomains,
4952
4908
  domain_secrets: t.networkPolicy.domainSecrets
4953
4909
  },
4954
- skills: ar(t.skills)
4910
+ skills: mr(t.skills)
4955
4911
  };
4956
4912
  }
4957
4913
  return {
@@ -4959,7 +4915,7 @@ function ir(e) {
4959
4915
  skills: e.skills
4960
4916
  };
4961
4917
  }
4962
- function ar(e) {
4918
+ function mr(e) {
4963
4919
  return e?.map((e) => e.type === "skillReference" ? {
4964
4920
  type: "skill_reference",
4965
4921
  skill_id: a({
@@ -4978,7 +4934,7 @@ function ar(e) {
4978
4934
  }
4979
4935
  });
4980
4936
  }
4981
- function or(e) {
4937
+ function hr(e) {
4982
4938
  let t = {};
4983
4939
  for (let n of e) if (n.role === "assistant") for (let e of n.content) {
4984
4940
  if (e.type !== "tool-call") continue;
@@ -4987,7 +4943,7 @@ function or(e) {
4987
4943
  }
4988
4944
  return t;
4989
4945
  }
4990
- function sr(e) {
4946
+ function gr(e) {
4991
4947
  switch (e.type) {
4992
4948
  case "click": return {
4993
4949
  type: "click",
@@ -5027,9 +4983,9 @@ function sr(e) {
5027
4983
  case "wait": return e;
5028
4984
  }
5029
4985
  }
5030
- function cr({ action: e, actions: t, pending_safety_checks: n, status: r }) {
4986
+ function _r({ action: e, actions: t, pending_safety_checks: n, status: r }) {
5031
4987
  return {
5032
- actions: (t ?? (e == null ? [] : [e])).map(sr),
4988
+ actions: (t ?? (e == null ? [] : [e])).map(gr),
5033
4989
  pendingSafetyChecks: n?.map((e) => ({
5034
4990
  id: e.id,
5035
4991
  ...e.code != null && { code: e.code },
@@ -5038,17 +4994,17 @@ function cr({ action: e, actions: t, pending_safety_checks: n, status: r }) {
5038
4994
  status: r
5039
4995
  };
5040
4996
  }
5041
- var lr = {
4997
+ var vr = {
5042
4998
  "image/*": [/^https?:\/\/.*$/],
5043
4999
  "application/pdf": [/^https?:\/\/.*$/]
5044
5000
  };
5045
- function ur({ modelCapabilities: e, options: t }) {
5001
+ function yr({ modelCapabilities: e, options: t }) {
5046
5002
  if (!e.supportsConfigurationUpdate) return "reasoningEffortUpdate is only supported by GPT-6 and later models";
5047
5003
  if (t?.reasoningMode === "pro" || t?.contextManagement != null || t?.truncation === "auto") return "reasoningEffortUpdate requires standard reasoning mode without automatic compaction or automatic truncation";
5048
5004
  }
5049
- var dr = class e {
5005
+ var br = class e {
5050
5006
  constructor(e, t) {
5051
- this.specificationVersion = "v4", this.supportedUrls = lr, this.modelId = e, this.config = t;
5007
+ this.specificationVersion = "v4", this.supportedUrls = vr, this.modelId = e, this.config = t;
5052
5008
  }
5053
5009
  static [s](e) {
5054
5010
  return G({
@@ -5118,7 +5074,7 @@ var dr = class e {
5118
5074
  "openai.tool_search": "tool_search",
5119
5075
  "openai.programmatic_tool_calling": "programmatic_tool_calling"
5120
5076
  }
5121
- }), T = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Set(), { tools: O, toolChoice: k, toolWarnings: A } = await Qn({
5077
+ }), T = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Set(), { tools: O, toolChoice: k, toolWarnings: A } = await sr({
5122
5078
  tools: p,
5123
5079
  toolChoice: m,
5124
5080
  allowedTools: b?.allowedTools ?? void 0,
@@ -5126,7 +5082,7 @@ var dr = class e {
5126
5082
  customProviderToolNames: T,
5127
5083
  outputSchemaToolNames: E,
5128
5084
  supportsAsyncToolCalling: v.supportsAsyncToolCalling
5129
- }), j = ur({
5085
+ }), j = yr({
5130
5086
  modelCapabilities: v,
5131
5087
  options: b
5132
5088
  }), { input: N, warnings: P } = await dn({
@@ -5277,7 +5233,7 @@ var dr = class e {
5277
5233
  type: "unsupported",
5278
5234
  feature: "serviceTier",
5279
5235
  details: "flex processing is only available for o3, o4-mini, and gpt-5 models"
5280
- }), delete H.service_tier), (b?.serviceTier === "priority" || b?.serviceTier === "fast") && !v.supportsPriorityProcessing && (_.push({
5236
+ }), delete H.service_tier), b?.serviceTier !== "priority" && b?.serviceTier !== "fast" || v.supportsPriorityProcessing || (_.push({
5281
5237
  type: "unsupported",
5282
5238
  feature: "serviceTier",
5283
5239
  details: "priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"
@@ -5308,7 +5264,7 @@ var dr = class e {
5308
5264
  let { args: t, warnings: n, webSearchToolName: r, toolNameMapping: a, providerOptionsName: s, isShellProviderExecuted: c } = await this.getArgs(e), l = this.config.url({
5309
5265
  path: "/responses",
5310
5266
  modelId: this.modelId
5311
- }), u = or(e.prompt), { responseHeaders: d, value: f, rawValue: p } = await F({
5267
+ }), u = hr(e.prompt), { responseHeaders: d, value: f, rawValue: p } = await F({
5312
5268
  url: l,
5313
5269
  headers: R(this.config.headers?.(), e.headers),
5314
5270
  body: t,
@@ -5570,7 +5526,7 @@ var dr = class e {
5570
5526
  type: "tool-result",
5571
5527
  toolCallId: t.id,
5572
5528
  toolName: a.toCustomToolName(r ?? "web_search"),
5573
- result: Mr(t.action)
5529
+ result: Vr(t.action)
5574
5530
  });
5575
5531
  break;
5576
5532
  case "mcp_call": {
@@ -5640,7 +5596,7 @@ var dr = class e {
5640
5596
  type: "tool-call",
5641
5597
  toolCallId: t.call_id,
5642
5598
  toolName: e,
5643
- input: JSON.stringify(cr(t)),
5599
+ input: JSON.stringify(_r(t)),
5644
5600
  providerMetadata: { [s]: { itemId: t.id } }
5645
5601
  });
5646
5602
  break;
@@ -5697,17 +5653,15 @@ var dr = class e {
5697
5653
  providerMetadata: { [s]: { itemId: t.id } }
5698
5654
  });
5699
5655
  break;
5700
- case "compaction":
5701
- m.push({
5702
- type: "custom",
5703
- kind: "openai.compaction",
5704
- providerMetadata: { [s]: {
5705
- type: "compaction",
5706
- itemId: t.id,
5707
- encryptedContent: t.encrypted_content
5708
- } }
5709
- });
5710
- break;
5656
+ case "compaction": m.push({
5657
+ type: "custom",
5658
+ kind: "openai.compaction",
5659
+ providerMetadata: { [s]: {
5660
+ type: "compaction",
5661
+ itemId: t.id,
5662
+ encryptedContent: t.encrypted_content
5663
+ } }
5664
+ });
5711
5665
  }
5712
5666
  let y = { [s]: {
5713
5667
  responseId: f.id,
@@ -5754,13 +5708,13 @@ var dr = class e {
5754
5708
  fetch: this.config.fetch
5755
5709
  }), f = await Ee({
5756
5710
  stream: d,
5757
- getError: (e) => kr(e) || vr(e) && e.response.error != null ? e : void 0,
5758
- isOutputChunk: jr,
5759
- isAcceptedChunk: Ar,
5711
+ getError: (e) => Rr(e) || Dr(e) && e.response.error != null ? e : void 0,
5712
+ isOutputChunk: Br,
5713
+ isAcceptedChunk: zr,
5760
5714
  url: l,
5761
5715
  requestBodyValues: t,
5762
5716
  responseHeaders: u
5763
- }), p = this, m = or(e.prompt), h = e.tools?.filter((e) => e.type === "function") ?? [], g = /* @__PURE__ */ new Map(), _ = {
5717
+ }), p = this, m = hr(e.prompt), h = e.tools?.filter((e) => e.type === "function") ?? [], g = /* @__PURE__ */ new Map(), _ = {
5764
5718
  unified: "other",
5765
5719
  raw: void 0
5766
5720
  }, v, y = [], b = null, x = {}, C = [], w, T = !1, E = {}, D = {}, O = ({ itemId: e, outputIndex: t }) => t == null ? e : D[t] ?? e, k, A, j = [], M = !1;
@@ -5777,7 +5731,7 @@ var dr = class e {
5777
5731
  type: "raw",
5778
5732
  rawValue: n.rawValue
5779
5733
  }), !n.success) {
5780
- let e = pr(n.rawValue) ? mr({
5734
+ let e = Sr(n.rawValue) ? Cr({
5781
5735
  value: n.rawValue,
5782
5736
  cause: n.error,
5783
5737
  url: l,
@@ -5794,7 +5748,7 @@ var dr = class e {
5794
5748
  return;
5795
5749
  }
5796
5750
  let f = n.value;
5797
- if (Dr(f)) {
5751
+ if (Ir(f)) {
5798
5752
  if (f.item.type === "function_call") {
5799
5753
  let e = tn({
5800
5754
  toolName: f.item.name,
@@ -5890,439 +5844,439 @@ var dr = class e {
5890
5844
  toolName: t,
5891
5845
  providerExecuted: !0
5892
5846
  });
5893
- } else if (f.item.type !== "tool_search_output" && !(f.item.type === "mcp_call" || f.item.type === "mcp_list_tools" || f.item.type === "mcp_approval_request")) if (f.item.type === "apply_patch_call") {
5894
- let { call_id: e, operation: t } = f.item;
5895
- if (x[f.output_index] = {
5896
- toolName: i.toCustomToolName("apply_patch"),
5897
- toolCallId: e,
5898
- applyPatch: {
5899
- hasDiff: t.type === "delete_file",
5900
- endEmitted: t.type === "delete_file"
5901
- }
5902
- }, d.enqueue({
5903
- type: "tool-input-start",
5904
- id: e,
5905
- toolName: i.toCustomToolName("apply_patch")
5906
- }), t.type === "delete_file") {
5907
- let n = JSON.stringify({
5908
- callId: e,
5909
- operation: t
5910
- });
5911
- d.enqueue({
5847
+ } else if (f.item.type !== "tool_search_output" && f.item.type !== "mcp_call" && f.item.type !== "mcp_list_tools" && f.item.type !== "mcp_approval_request") {
5848
+ if (f.item.type === "apply_patch_call") {
5849
+ let { call_id: e, operation: t } = f.item;
5850
+ if (x[f.output_index] = {
5851
+ toolName: i.toCustomToolName("apply_patch"),
5852
+ toolCallId: e,
5853
+ applyPatch: {
5854
+ hasDiff: t.type === "delete_file",
5855
+ endEmitted: t.type === "delete_file"
5856
+ }
5857
+ }, d.enqueue({
5858
+ type: "tool-input-start",
5859
+ id: e,
5860
+ toolName: i.toCustomToolName("apply_patch")
5861
+ }), t.type === "delete_file") {
5862
+ let n = JSON.stringify({
5863
+ callId: e,
5864
+ operation: t
5865
+ });
5866
+ d.enqueue({
5867
+ type: "tool-input-delta",
5868
+ id: e,
5869
+ delta: n
5870
+ }), d.enqueue({
5871
+ type: "tool-input-end",
5872
+ id: e
5873
+ });
5874
+ } else d.enqueue({
5912
5875
  type: "tool-input-delta",
5913
5876
  id: e,
5914
- delta: n
5915
- }), d.enqueue({
5916
- type: "tool-input-end",
5917
- id: e
5877
+ delta: `{"callId":"${$(e)}","operation":{"type":"${$(t.type)}","path":"${$(t.path)}","diff":"`
5918
5878
  });
5919
- } else d.enqueue({
5920
- type: "tool-input-delta",
5921
- id: e,
5922
- delta: `{"callId":"${$(e)}","operation":{"type":"${$(t.type)}","path":"${$(t.path)}","diff":"`
5923
- });
5924
- } else f.item.type === "shell_call" ? x[f.output_index] = {
5925
- toolName: i.toCustomToolName("shell"),
5926
- toolCallId: f.item.call_id
5927
- } : f.item.type === "shell_call_output" || (f.item.type === "message" ? (D[f.output_index] = f.item.id, C.splice(0), w = f.item.phase ?? void 0, d.enqueue({
5928
- type: "text-start",
5929
- id: f.item.id,
5930
- providerMetadata: { [s]: {
5931
- itemId: f.item.id,
5932
- ...f.item.phase != null && { phase: f.item.phase }
5933
- } }
5934
- })) : Dr(f) && f.item.type === "reasoning" && (D[f.output_index] = f.item.id, E[f.item.id] = {
5935
- encryptedContent: f.item.encrypted_content,
5936
- summaryParts: { 0: "active" }
5937
- }, d.enqueue({
5938
- type: "reasoning-start",
5939
- id: `${f.item.id}:0`,
5940
- providerMetadata: { [s]: {
5879
+ } else f.item.type === "shell_call" ? x[f.output_index] = {
5880
+ toolName: i.toCustomToolName("shell"),
5881
+ toolCallId: f.item.call_id
5882
+ } : f.item.type === "shell_call_output" || (f.item.type === "message" ? (D[f.output_index] = f.item.id, C.splice(0), w = f.item.phase ?? void 0, d.enqueue({
5883
+ type: "text-start",
5884
+ id: f.item.id,
5885
+ providerMetadata: { [s]: {
5886
+ itemId: f.item.id,
5887
+ ...f.item.phase != null && { phase: f.item.phase }
5888
+ } }
5889
+ })) : Ir(f) && f.item.type === "reasoning" && (D[f.output_index] = f.item.id, E[f.item.id] = {
5890
+ encryptedContent: f.item.encrypted_content,
5891
+ summaryParts: { 0: "active" }
5892
+ }, d.enqueue({
5893
+ type: "reasoning-start",
5894
+ id: `${f.item.id}:0`,
5895
+ providerMetadata: { [s]: {
5896
+ itemId: f.item.id,
5897
+ reasoningEncryptedContent: f.item.encrypted_content ?? null
5898
+ } }
5899
+ })));
5900
+ }
5901
+ } else if (Tr(f)) {
5902
+ if (f.item.type === "message") {
5903
+ let e = O({
5941
5904
  itemId: f.item.id,
5942
- reasoningEncryptedContent: f.item.encrypted_content ?? null
5943
- } }
5944
- })));
5945
- } else if (gr(f)) if (f.item.type === "message") {
5946
- let e = O({
5947
- itemId: f.item.id,
5948
- outputIndex: f.output_index
5949
- }), t = f.item.phase ?? w;
5950
- w = void 0, d.enqueue({
5951
- type: "text-end",
5952
- id: e,
5953
- providerMetadata: { [s]: {
5954
- itemId: e,
5955
- ...t != null && { phase: t },
5956
- ...C.length > 0 && { annotations: C }
5957
- } }
5958
- }), D[f.output_index] = void 0;
5959
- } else if (f.item.type === "function_call") {
5960
- let e = f.item, t = x[f.output_index];
5961
- x[f.output_index] = void 0, T = !0;
5962
- let n = t?.suppressInputStreaming ?? tn({
5963
- toolName: e.name,
5964
- tools: h
5965
- }), r = () => {
5966
- if (n) {
5905
+ outputIndex: f.output_index
5906
+ }), t = f.item.phase ?? w;
5907
+ w = void 0, d.enqueue({
5908
+ type: "text-end",
5909
+ id: e,
5910
+ providerMetadata: { [s]: {
5911
+ itemId: e,
5912
+ ...t != null && { phase: t },
5913
+ ...C.length > 0 && { annotations: C }
5914
+ } }
5915
+ }), D[f.output_index] = void 0;
5916
+ } else if (f.item.type === "function_call") {
5917
+ let e = f.item, t = x[f.output_index];
5918
+ x[f.output_index] = void 0, T = !0;
5919
+ let n = t?.suppressInputStreaming ?? tn({
5920
+ toolName: e.name,
5921
+ tools: h
5922
+ }), r = () => {
5923
+ if (n) {
5924
+ d.enqueue({
5925
+ type: "tool-input-start",
5926
+ id: e.call_id,
5927
+ toolName: e.name
5928
+ });
5929
+ let n = t?.bufferedInputDeltas ?? [];
5930
+ if (n.length > 0) for (let t of n) d.enqueue({
5931
+ type: "tool-input-delta",
5932
+ id: e.call_id,
5933
+ delta: t
5934
+ });
5935
+ else e.arguments.length > 0 && d.enqueue({
5936
+ type: "tool-input-delta",
5937
+ id: e.call_id,
5938
+ delta: e.arguments
5939
+ });
5940
+ }
5967
5941
  d.enqueue({
5968
- type: "tool-input-start",
5969
- id: e.call_id,
5970
- toolName: e.name
5971
- });
5972
- let n = t?.bufferedInputDeltas ?? [];
5973
- if (n.length > 0) for (let t of n) d.enqueue({
5974
- type: "tool-input-delta",
5975
- id: e.call_id,
5976
- delta: t
5977
- });
5978
- else e.arguments.length > 0 && d.enqueue({
5979
- type: "tool-input-delta",
5942
+ type: "tool-input-end",
5980
5943
  id: e.call_id,
5981
- delta: e.arguments
5944
+ ...e.namespace != null && { providerMetadata: { [s]: { namespace: e.namespace } } }
5945
+ }), d.enqueue({
5946
+ type: "tool-call",
5947
+ toolCallId: e.call_id,
5948
+ toolName: e.name,
5949
+ input: e.arguments,
5950
+ providerMetadata: { [s]: {
5951
+ itemId: e.id,
5952
+ ...e.async == null ? t?.async == null ? {} : { async: t.async } : { async: e.async },
5953
+ ...e.namespace != null && { namespace: e.namespace },
5954
+ ...e.caller != null && { caller: e.caller.type === "program" ? {
5955
+ type: "program",
5956
+ callerId: e.caller.caller_id
5957
+ } : e.caller }
5958
+ } }
5982
5959
  });
5960
+ };
5961
+ if (!n) {
5962
+ r();
5963
+ return;
5983
5964
  }
5965
+ return nn({
5966
+ toolCall: {
5967
+ toolCallId: e.call_id,
5968
+ toolName: e.name,
5969
+ input: e.arguments
5970
+ },
5971
+ tools: h,
5972
+ providerOptionsName: s,
5973
+ itemId: e.id
5974
+ }).then((e) => {
5975
+ if (e == null) r();
5976
+ else for (let t of e) d.enqueue({
5977
+ type: "tool-input-start",
5978
+ id: t.toolCallId,
5979
+ toolName: t.toolName
5980
+ }), d.enqueue({
5981
+ type: "tool-input-delta",
5982
+ id: t.toolCallId,
5983
+ delta: t.input
5984
+ }), d.enqueue({
5985
+ type: "tool-input-end",
5986
+ id: t.toolCallId
5987
+ }), d.enqueue(t);
5988
+ });
5989
+ } else if (f.item.type === "program") d.enqueue({
5990
+ type: "tool-call",
5991
+ toolCallId: f.item.call_id,
5992
+ toolName: i.toCustomToolName("programmatic_tool_calling"),
5993
+ input: JSON.stringify({
5994
+ code: f.item.code,
5995
+ fingerprint: f.item.fingerprint
5996
+ }),
5997
+ providerExecuted: !0,
5998
+ providerMetadata: { [s]: { itemId: f.item.id } }
5999
+ });
6000
+ else if (f.item.type === "program_output") d.enqueue({
6001
+ type: "tool-result",
6002
+ toolCallId: f.item.call_id,
6003
+ toolName: i.toCustomToolName("programmatic_tool_calling"),
6004
+ result: {
6005
+ result: f.item.result,
6006
+ status: f.item.status
6007
+ },
6008
+ providerMetadata: { [s]: { itemId: f.item.id } }
6009
+ });
6010
+ else if (f.item.type === "custom_tool_call") {
6011
+ let e = x[f.output_index];
6012
+ x[f.output_index] = void 0, T = !0;
6013
+ let t = i.toCustomToolName(f.item.name);
5984
6014
  d.enqueue({
5985
6015
  type: "tool-input-end",
5986
- id: e.call_id,
5987
- ...e.namespace != null && { providerMetadata: { [s]: { namespace: e.namespace } } }
6016
+ id: f.item.call_id
5988
6017
  }), d.enqueue({
5989
6018
  type: "tool-call",
5990
- toolCallId: e.call_id,
5991
- toolName: e.name,
5992
- input: e.arguments,
6019
+ toolCallId: f.item.call_id,
6020
+ toolName: t,
6021
+ input: JSON.stringify(f.item.input),
5993
6022
  providerMetadata: { [s]: {
5994
- itemId: e.id,
5995
- ...e.async == null ? t?.async == null ? {} : { async: t.async } : { async: e.async },
5996
- ...e.namespace != null && { namespace: e.namespace },
5997
- ...e.caller != null && { caller: e.caller.type === "program" ? {
5998
- type: "program",
5999
- callerId: e.caller.caller_id
6000
- } : e.caller }
6023
+ itemId: f.item.id,
6024
+ ...f.item.async == null ? e?.async == null ? {} : { async: e.async } : { async: f.item.async }
6001
6025
  } }
6002
6026
  });
6003
- };
6004
- if (!n) {
6005
- r();
6006
- return;
6007
- }
6008
- return nn({
6009
- toolCall: {
6010
- toolCallId: e.call_id,
6011
- toolName: e.name,
6012
- input: e.arguments
6013
- },
6014
- tools: h,
6015
- providerOptionsName: s,
6016
- itemId: e.id
6017
- }).then((e) => {
6018
- if (e == null) {
6019
- r();
6027
+ } else if (f.item.type === "web_search_call") x[f.output_index] = void 0, d.enqueue({
6028
+ type: "tool-result",
6029
+ toolCallId: f.item.id,
6030
+ toolName: i.toCustomToolName(r ?? "web_search"),
6031
+ result: Vr(f.item.action)
6032
+ });
6033
+ else if (f.item.type === "computer_call") {
6034
+ if (x[f.output_index] = void 0, f.item.call_id == null) {
6035
+ d.enqueue({
6036
+ type: "tool-input-end",
6037
+ id: f.item.id
6038
+ }), d.enqueue({
6039
+ type: "tool-call",
6040
+ toolCallId: f.item.id,
6041
+ toolName: i.toCustomToolName("computer_use"),
6042
+ input: "",
6043
+ providerExecuted: !0
6044
+ }), d.enqueue({
6045
+ type: "tool-result",
6046
+ toolCallId: f.item.id,
6047
+ toolName: i.toCustomToolName("computer_use"),
6048
+ result: {
6049
+ type: "computer_use_tool_result",
6050
+ status: f.item.status
6051
+ }
6052
+ });
6020
6053
  return;
6021
6054
  }
6022
- for (let t of e) d.enqueue({
6023
- type: "tool-input-start",
6024
- id: t.toolCallId,
6025
- toolName: t.toolName
6026
- }), d.enqueue({
6055
+ T = !0;
6056
+ let e = i.toCustomToolName("computer"), t = JSON.stringify(_r(f.item));
6057
+ d.enqueue({
6027
6058
  type: "tool-input-delta",
6028
- id: t.toolCallId,
6029
- delta: t.input
6059
+ id: f.item.call_id,
6060
+ delta: t
6030
6061
  }), d.enqueue({
6031
6062
  type: "tool-input-end",
6032
- id: t.toolCallId
6033
- }), d.enqueue(t);
6063
+ id: f.item.call_id
6064
+ }), d.enqueue({
6065
+ type: "tool-call",
6066
+ toolCallId: f.item.call_id,
6067
+ toolName: e,
6068
+ input: t,
6069
+ providerMetadata: { [s]: { itemId: f.item.id } }
6070
+ });
6071
+ } else if (f.item.type === "file_search_call") x[f.output_index] = void 0, d.enqueue({
6072
+ type: "tool-result",
6073
+ toolCallId: f.item.id,
6074
+ toolName: i.toCustomToolName("file_search"),
6075
+ result: {
6076
+ queries: f.item.queries,
6077
+ results: f.item.results?.map((e) => ({
6078
+ attributes: e.attributes,
6079
+ fileId: e.file_id,
6080
+ filename: e.filename,
6081
+ score: e.score,
6082
+ text: e.text
6083
+ })) ?? null
6084
+ }
6034
6085
  });
6035
- } else if (f.item.type === "program") d.enqueue({
6036
- type: "tool-call",
6037
- toolCallId: f.item.call_id,
6038
- toolName: i.toCustomToolName("programmatic_tool_calling"),
6039
- input: JSON.stringify({
6040
- code: f.item.code,
6041
- fingerprint: f.item.fingerprint
6042
- }),
6043
- providerExecuted: !0,
6044
- providerMetadata: { [s]: { itemId: f.item.id } }
6045
- });
6046
- else if (f.item.type === "program_output") d.enqueue({
6047
- type: "tool-result",
6048
- toolCallId: f.item.call_id,
6049
- toolName: i.toCustomToolName("programmatic_tool_calling"),
6050
- result: {
6051
- result: f.item.result,
6052
- status: f.item.status
6053
- },
6054
- providerMetadata: { [s]: { itemId: f.item.id } }
6055
- });
6056
- else if (f.item.type === "custom_tool_call") {
6057
- let e = x[f.output_index];
6058
- x[f.output_index] = void 0, T = !0;
6059
- let t = i.toCustomToolName(f.item.name);
6060
- d.enqueue({
6061
- type: "tool-input-end",
6062
- id: f.item.call_id
6063
- }), d.enqueue({
6064
- type: "tool-call",
6065
- toolCallId: f.item.call_id,
6066
- toolName: t,
6067
- input: JSON.stringify(f.item.input),
6068
- providerMetadata: { [s]: {
6069
- itemId: f.item.id,
6070
- ...f.item.async == null ? e?.async == null ? {} : { async: e.async } : { async: f.item.async }
6071
- } }
6086
+ else if (f.item.type === "code_interpreter_call") x[f.output_index] = void 0, d.enqueue({
6087
+ type: "tool-result",
6088
+ toolCallId: f.item.id,
6089
+ toolName: i.toCustomToolName("code_interpreter"),
6090
+ result: { outputs: f.item.outputs }
6072
6091
  });
6073
- } else if (f.item.type === "web_search_call") x[f.output_index] = void 0, d.enqueue({
6074
- type: "tool-result",
6075
- toolCallId: f.item.id,
6076
- toolName: i.toCustomToolName(r ?? "web_search"),
6077
- result: Mr(f.item.action)
6078
- });
6079
- else if (f.item.type === "computer_call") {
6080
- if (x[f.output_index] = void 0, f.item.call_id == null) {
6092
+ else if (f.item.type === "image_generation_call") d.enqueue({
6093
+ type: "tool-result",
6094
+ toolCallId: f.item.id,
6095
+ toolName: i.toCustomToolName("image_generation"),
6096
+ result: { result: f.item.result }
6097
+ });
6098
+ else if (f.item.type === "tool_search_call") {
6099
+ let e = x[f.output_index], t = f.item.execution === "server";
6100
+ if (e != null) {
6101
+ let n = t ? e.toolCallId : f.item.call_id ?? f.item.id;
6102
+ t ? j.push(n) : d.enqueue({
6103
+ type: "tool-input-start",
6104
+ id: n,
6105
+ toolName: e.toolName
6106
+ }), d.enqueue({
6107
+ type: "tool-input-end",
6108
+ id: n
6109
+ }), d.enqueue({
6110
+ type: "tool-call",
6111
+ toolCallId: n,
6112
+ toolName: e.toolName,
6113
+ input: JSON.stringify({
6114
+ arguments: f.item.arguments,
6115
+ call_id: t ? null : n
6116
+ }),
6117
+ ...t ? { providerExecuted: !0 } : {},
6118
+ providerMetadata: { [s]: { itemId: f.item.id } }
6119
+ });
6120
+ }
6121
+ x[f.output_index] = void 0;
6122
+ } else if (f.item.type === "tool_search_output") {
6123
+ let e = f.item.call_id ?? j.shift() ?? f.item.id;
6124
+ d.enqueue({
6125
+ type: "tool-result",
6126
+ toolCallId: e,
6127
+ toolName: i.toCustomToolName("tool_search"),
6128
+ result: { tools: f.item.tools },
6129
+ providerMetadata: { [s]: { itemId: f.item.id } }
6130
+ });
6131
+ } else if (f.item.type === "mcp_call") {
6132
+ x[f.output_index] = void 0;
6133
+ let e = f.item.approval_request_id ?? void 0, t = e == null ? f.item.id : g.get(e) ?? m[e] ?? f.item.id, n = `mcp.${f.item.name}`;
6081
6134
  d.enqueue({
6082
- type: "tool-input-end",
6083
- id: f.item.id
6084
- }), d.enqueue({
6085
6135
  type: "tool-call",
6086
- toolCallId: f.item.id,
6087
- toolName: i.toCustomToolName("computer_use"),
6088
- input: "",
6089
- providerExecuted: !0
6136
+ toolCallId: t,
6137
+ toolName: n,
6138
+ input: f.item.arguments,
6139
+ providerExecuted: !0,
6140
+ dynamic: !0
6090
6141
  }), d.enqueue({
6091
6142
  type: "tool-result",
6092
- toolCallId: f.item.id,
6093
- toolName: i.toCustomToolName("computer_use"),
6143
+ toolCallId: t,
6144
+ toolName: n,
6094
6145
  result: {
6095
- type: "computer_use_tool_result",
6096
- status: f.item.status
6097
- }
6146
+ type: "call",
6147
+ serverLabel: f.item.server_label,
6148
+ name: f.item.name,
6149
+ arguments: f.item.arguments,
6150
+ ...f.item.output == null ? {} : { output: f.item.output },
6151
+ ...f.item.error == null ? {} : { error: f.item.error }
6152
+ },
6153
+ providerMetadata: { [s]: { itemId: f.item.id } }
6098
6154
  });
6099
- return;
6100
- }
6101
- T = !0;
6102
- let e = i.toCustomToolName("computer"), t = JSON.stringify(cr(f.item));
6103
- d.enqueue({
6104
- type: "tool-input-delta",
6105
- id: f.item.call_id,
6106
- delta: t
6107
- }), d.enqueue({
6108
- type: "tool-input-end",
6109
- id: f.item.call_id
6110
- }), d.enqueue({
6111
- type: "tool-call",
6112
- toolCallId: f.item.call_id,
6113
- toolName: e,
6114
- input: t,
6115
- providerMetadata: { [s]: { itemId: f.item.id } }
6116
- });
6117
- } else if (f.item.type === "file_search_call") x[f.output_index] = void 0, d.enqueue({
6118
- type: "tool-result",
6119
- toolCallId: f.item.id,
6120
- toolName: i.toCustomToolName("file_search"),
6121
- result: {
6122
- queries: f.item.queries,
6123
- results: f.item.results?.map((e) => ({
6124
- attributes: e.attributes,
6125
- fileId: e.file_id,
6126
- filename: e.filename,
6127
- score: e.score,
6128
- text: e.text
6129
- })) ?? null
6130
- }
6131
- });
6132
- else if (f.item.type === "code_interpreter_call") x[f.output_index] = void 0, d.enqueue({
6133
- type: "tool-result",
6134
- toolCallId: f.item.id,
6135
- toolName: i.toCustomToolName("code_interpreter"),
6136
- result: { outputs: f.item.outputs }
6137
- });
6138
- else if (f.item.type === "image_generation_call") d.enqueue({
6139
- type: "tool-result",
6140
- toolCallId: f.item.id,
6141
- toolName: i.toCustomToolName("image_generation"),
6142
- result: { result: f.item.result }
6143
- });
6144
- else if (f.item.type === "tool_search_call") {
6145
- let e = x[f.output_index], t = f.item.execution === "server";
6146
- if (e != null) {
6147
- let n = t ? e.toolCallId : f.item.call_id ?? f.item.id;
6148
- t ? j.push(n) : d.enqueue({
6149
- type: "tool-input-start",
6150
- id: n,
6151
- toolName: e.toolName
6155
+ } else if (f.item.type === "mcp_list_tools") x[f.output_index] = void 0;
6156
+ else if (f.item.type === "apply_patch_call") {
6157
+ let e = x[f.output_index];
6158
+ e?.applyPatch && !e.applyPatch.endEmitted && f.item.operation.type !== "delete_file" && (e.applyPatch.hasDiff || d.enqueue({
6159
+ type: "tool-input-delta",
6160
+ id: e.toolCallId,
6161
+ delta: $(f.item.operation.diff)
6152
6162
  }), d.enqueue({
6153
- type: "tool-input-end",
6154
- id: n
6163
+ type: "tool-input-delta",
6164
+ id: e.toolCallId,
6165
+ delta: "\"}}"
6155
6166
  }), d.enqueue({
6167
+ type: "tool-input-end",
6168
+ id: e.toolCallId
6169
+ }), e.applyPatch.endEmitted = !0), e && f.item.status === "completed" && (T = !0, d.enqueue({
6156
6170
  type: "tool-call",
6157
- toolCallId: n,
6158
- toolName: e.toolName,
6171
+ toolCallId: e.toolCallId,
6172
+ toolName: i.toCustomToolName("apply_patch"),
6159
6173
  input: JSON.stringify({
6160
- arguments: f.item.arguments,
6161
- call_id: t ? null : n
6174
+ callId: f.item.call_id,
6175
+ operation: f.item.operation
6162
6176
  }),
6163
- ...t ? { providerExecuted: !0 } : {},
6164
6177
  providerMetadata: { [s]: { itemId: f.item.id } }
6178
+ })), x[f.output_index] = void 0;
6179
+ } else if (f.item.type === "mcp_approval_request") {
6180
+ x[f.output_index] = void 0;
6181
+ let e = p.config.generateId?.() ?? o(), t = f.item.approval_request_id ?? f.item.id;
6182
+ g.set(t, e);
6183
+ let n = `mcp.${f.item.name}`;
6184
+ d.enqueue({
6185
+ type: "tool-call",
6186
+ toolCallId: e,
6187
+ toolName: n,
6188
+ input: f.item.arguments,
6189
+ providerExecuted: !0,
6190
+ dynamic: !0
6191
+ }), d.enqueue({
6192
+ type: "tool-approval-request",
6193
+ approvalId: t,
6194
+ toolCallId: e
6165
6195
  });
6166
- }
6167
- x[f.output_index] = void 0;
6168
- } else if (f.item.type === "tool_search_output") {
6169
- let e = f.item.call_id ?? j.shift() ?? f.item.id;
6170
- d.enqueue({
6171
- type: "tool-result",
6172
- toolCallId: e,
6173
- toolName: i.toCustomToolName("tool_search"),
6174
- result: { tools: f.item.tools },
6175
- providerMetadata: { [s]: { itemId: f.item.id } }
6176
- });
6177
- } else if (f.item.type === "mcp_call") {
6178
- x[f.output_index] = void 0;
6179
- let e = f.item.approval_request_id ?? void 0, t = e == null ? f.item.id : g.get(e) ?? m[e] ?? f.item.id, n = `mcp.${f.item.name}`;
6180
- d.enqueue({
6196
+ } else if (f.item.type === "local_shell_call") x[f.output_index] = void 0, d.enqueue({
6181
6197
  type: "tool-call",
6182
- toolCallId: t,
6183
- toolName: n,
6184
- input: f.item.arguments,
6185
- providerExecuted: !0,
6186
- dynamic: !0
6187
- }), d.enqueue({
6188
- type: "tool-result",
6189
- toolCallId: t,
6190
- toolName: n,
6191
- result: {
6192
- type: "call",
6193
- serverLabel: f.item.server_label,
6194
- name: f.item.name,
6195
- arguments: f.item.arguments,
6196
- ...f.item.output == null ? {} : { output: f.item.output },
6197
- ...f.item.error == null ? {} : { error: f.item.error }
6198
- },
6198
+ toolCallId: f.item.call_id,
6199
+ toolName: i.toCustomToolName("local_shell"),
6200
+ input: JSON.stringify({ action: {
6201
+ type: "exec",
6202
+ command: f.item.action.command,
6203
+ timeoutMs: f.item.action.timeout_ms,
6204
+ user: f.item.action.user,
6205
+ workingDirectory: f.item.action.working_directory,
6206
+ env: f.item.action.env
6207
+ } }),
6199
6208
  providerMetadata: { [s]: { itemId: f.item.id } }
6200
6209
  });
6201
- } else if (f.item.type === "mcp_list_tools") x[f.output_index] = void 0;
6202
- else if (f.item.type === "apply_patch_call") {
6203
- let e = x[f.output_index];
6204
- e?.applyPatch && !e.applyPatch.endEmitted && f.item.operation.type !== "delete_file" && (e.applyPatch.hasDiff || d.enqueue({
6205
- type: "tool-input-delta",
6206
- id: e.toolCallId,
6207
- delta: $(f.item.operation.diff)
6208
- }), d.enqueue({
6209
- type: "tool-input-delta",
6210
- id: e.toolCallId,
6211
- delta: "\"}}"
6212
- }), d.enqueue({
6213
- type: "tool-input-end",
6214
- id: e.toolCallId
6215
- }), e.applyPatch.endEmitted = !0), e && f.item.status === "completed" && (T = !0, d.enqueue({
6210
+ else if (f.item.type === "shell_call") x[f.output_index] = void 0, d.enqueue({
6216
6211
  type: "tool-call",
6217
- toolCallId: e.toolCallId,
6218
- toolName: i.toCustomToolName("apply_patch"),
6219
- input: JSON.stringify({
6220
- callId: f.item.call_id,
6221
- operation: f.item.operation
6222
- }),
6212
+ toolCallId: f.item.call_id,
6213
+ toolName: i.toCustomToolName("shell"),
6214
+ input: JSON.stringify({ action: { commands: f.item.action.commands } }),
6215
+ ...c && { providerExecuted: !0 },
6223
6216
  providerMetadata: { [s]: { itemId: f.item.id } }
6224
- })), x[f.output_index] = void 0;
6225
- } else if (f.item.type === "mcp_approval_request") {
6226
- x[f.output_index] = void 0;
6227
- let e = p.config.generateId?.() ?? o(), t = f.item.approval_request_id ?? f.item.id;
6228
- g.set(t, e);
6229
- let n = `mcp.${f.item.name}`;
6230
- d.enqueue({
6231
- type: "tool-call",
6232
- toolCallId: e,
6233
- toolName: n,
6234
- input: f.item.arguments,
6235
- providerExecuted: !0,
6236
- dynamic: !0
6237
- }), d.enqueue({
6238
- type: "tool-approval-request",
6239
- approvalId: t,
6240
- toolCallId: e
6241
6217
  });
6242
- } else if (f.item.type === "local_shell_call") x[f.output_index] = void 0, d.enqueue({
6243
- type: "tool-call",
6244
- toolCallId: f.item.call_id,
6245
- toolName: i.toCustomToolName("local_shell"),
6246
- input: JSON.stringify({ action: {
6247
- type: "exec",
6248
- command: f.item.action.command,
6249
- timeoutMs: f.item.action.timeout_ms,
6250
- user: f.item.action.user,
6251
- workingDirectory: f.item.action.working_directory,
6252
- env: f.item.action.env
6253
- } }),
6254
- providerMetadata: { [s]: { itemId: f.item.id } }
6255
- });
6256
- else if (f.item.type === "shell_call") x[f.output_index] = void 0, d.enqueue({
6257
- type: "tool-call",
6258
- toolCallId: f.item.call_id,
6259
- toolName: i.toCustomToolName("shell"),
6260
- input: JSON.stringify({ action: { commands: f.item.action.commands } }),
6261
- ...c && { providerExecuted: !0 },
6262
- providerMetadata: { [s]: { itemId: f.item.id } }
6263
- });
6264
- else if (f.item.type === "shell_call_output") d.enqueue({
6265
- type: "tool-result",
6266
- toolCallId: f.item.call_id,
6267
- toolName: i.toCustomToolName("shell"),
6268
- result: { output: f.item.output.map((e) => ({
6269
- stdout: e.stdout,
6270
- stderr: e.stderr,
6271
- outcome: e.outcome.type === "exit" ? {
6272
- type: "exit",
6273
- exitCode: e.outcome.exit_code
6274
- } : { type: "timeout" }
6275
- })) }
6276
- });
6277
- else if (f.item.type === "reasoning") {
6278
- let e = O({
6279
- itemId: f.item.id,
6280
- outputIndex: f.output_index
6281
- }), t = E[e];
6282
- if (t != null) {
6283
- let n = Object.entries(t.summaryParts).filter(([e, t]) => t === "active" || t === "can-conclude").map(([e]) => e);
6284
- for (let t of n) d.enqueue({
6285
- type: "reasoning-end",
6286
- id: `${e}:${t}`,
6287
- providerMetadata: { [s]: {
6288
- itemId: e,
6289
- reasoningEncryptedContent: f.item.encrypted_content ?? null
6290
- } }
6291
- });
6292
- delete E[e];
6293
- }
6294
- D[f.output_index] = void 0;
6295
- } else f.item.type === "compaction" && d.enqueue({
6296
- type: "custom",
6297
- kind: "openai.compaction",
6298
- providerMetadata: { [s]: {
6299
- type: "compaction",
6300
- itemId: f.item.id,
6301
- encryptedContent: f.item.encrypted_content
6302
- } }
6303
- });
6304
- else if (br(f)) {
6218
+ else if (f.item.type === "shell_call_output") d.enqueue({
6219
+ type: "tool-result",
6220
+ toolCallId: f.item.call_id,
6221
+ toolName: i.toCustomToolName("shell"),
6222
+ result: { output: f.item.output.map((e) => ({
6223
+ stdout: e.stdout,
6224
+ stderr: e.stderr,
6225
+ outcome: e.outcome.type === "exit" ? {
6226
+ type: "exit",
6227
+ exitCode: e.outcome.exit_code
6228
+ } : { type: "timeout" }
6229
+ })) }
6230
+ });
6231
+ else if (f.item.type === "reasoning") {
6232
+ let e = O({
6233
+ itemId: f.item.id,
6234
+ outputIndex: f.output_index
6235
+ }), t = E[e];
6236
+ if (t != null) {
6237
+ let n = Object.entries(t.summaryParts).filter(([e, t]) => t === "active" || t === "can-conclude").map(([e]) => e);
6238
+ for (let t of n) d.enqueue({
6239
+ type: "reasoning-end",
6240
+ id: `${e}:${t}`,
6241
+ providerMetadata: { [s]: {
6242
+ itemId: e,
6243
+ reasoningEncryptedContent: f.item.encrypted_content ?? null
6244
+ } }
6245
+ });
6246
+ delete E[e];
6247
+ }
6248
+ D[f.output_index] = void 0;
6249
+ } else f.item.type === "compaction" && d.enqueue({
6250
+ type: "custom",
6251
+ kind: "openai.compaction",
6252
+ providerMetadata: { [s]: {
6253
+ type: "compaction",
6254
+ itemId: f.item.id,
6255
+ encryptedContent: f.item.encrypted_content
6256
+ } }
6257
+ });
6258
+ } else if (kr(f)) {
6305
6259
  let e = x[f.output_index];
6306
6260
  e != null && (e.suppressInputStreaming ? e.bufferedInputDeltas?.push(f.delta) : d.enqueue({
6307
6261
  type: "tool-input-delta",
6308
6262
  id: e.toolCallId,
6309
6263
  delta: f.delta
6310
6264
  }));
6311
- } else if (xr(f)) {
6265
+ } else if (Ar(f)) {
6312
6266
  let e = x[f.output_index];
6313
6267
  e != null && d.enqueue({
6314
6268
  type: "tool-input-delta",
6315
6269
  id: e.toolCallId,
6316
6270
  delta: f.delta
6317
6271
  });
6318
- } else if (Tr(f)) {
6272
+ } else if (Pr(f)) {
6319
6273
  let e = x[f.output_index];
6320
6274
  e?.applyPatch && (d.enqueue({
6321
6275
  type: "tool-input-delta",
6322
6276
  id: e.toolCallId,
6323
6277
  delta: $(f.delta)
6324
6278
  }), e.applyPatch.hasDiff = !0);
6325
- } else if (Er(f)) {
6279
+ } else if (Fr(f)) {
6326
6280
  let e = x[f.output_index];
6327
6281
  e?.applyPatch && !e.applyPatch.endEmitted && (e.applyPatch.hasDiff || (d.enqueue({
6328
6282
  type: "tool-input-delta",
@@ -6336,21 +6290,21 @@ var dr = class e {
6336
6290
  type: "tool-input-end",
6337
6291
  id: e.toolCallId
6338
6292
  }), e.applyPatch.endEmitted = !0);
6339
- } else if (Sr(f)) d.enqueue({
6293
+ } else if (jr(f)) d.enqueue({
6340
6294
  type: "tool-result",
6341
6295
  toolCallId: f.item_id,
6342
6296
  toolName: i.toCustomToolName("image_generation"),
6343
6297
  result: { result: f.partial_image_b64 },
6344
6298
  preliminary: !0
6345
6299
  });
6346
- else if (Cr(f)) {
6300
+ else if (Mr(f)) {
6347
6301
  let e = x[f.output_index];
6348
6302
  e != null && d.enqueue({
6349
6303
  type: "tool-input-delta",
6350
6304
  id: e.toolCallId,
6351
6305
  delta: $(f.delta)
6352
6306
  });
6353
- } else if (wr(f)) {
6307
+ } else if (Nr(f)) {
6354
6308
  let e = x[f.output_index];
6355
6309
  e != null && (d.enqueue({
6356
6310
  type: "tool-input-delta",
@@ -6369,13 +6323,13 @@ var dr = class e {
6369
6323
  }),
6370
6324
  providerExecuted: !0
6371
6325
  }));
6372
- } else if (yr(f)) b = f.response.id, d.enqueue({
6326
+ } else if (Or(f)) b = f.response.id, d.enqueue({
6373
6327
  type: "response-metadata",
6374
6328
  id: f.response.id,
6375
6329
  timestamp: /* @__PURE__ */ new Date(f.response.created_at * 1e3),
6376
6330
  modelId: f.response.model
6377
6331
  });
6378
- else if (fr(f)) {
6332
+ else if (xr(f)) {
6379
6333
  let t = O({
6380
6334
  itemId: f.item_id,
6381
6335
  outputIndex: f.output_index
@@ -6430,14 +6384,14 @@ var dr = class e {
6430
6384
  id: `${e}:${f.summary_index}`,
6431
6385
  providerMetadata: { [s]: { itemId: e } }
6432
6386
  }), t.summaryParts[f.summary_index] = "concluded") : t.summaryParts[f.summary_index] = "can-conclude");
6433
- } else if (_r(f)) M || (_ = {
6387
+ } else if (Er(f)) M || (_ = {
6434
6388
  unified: pn({
6435
6389
  finishReason: f.response.incomplete_details?.reason,
6436
6390
  hasFunctionCall: T
6437
6391
  }),
6438
6392
  raw: f.response.incomplete_details?.reason ?? void 0
6439
6393
  }), v = f.response.usage ?? void 0, typeof f.response.service_tier == "string" && (k = f.response.service_tier), f.response.reasoning?.context != null && (A = f.response.reasoning.context);
6440
- else if (vr(f)) {
6394
+ else if (Dr(f)) {
6441
6395
  let e = f.response.incomplete_details?.reason;
6442
6396
  if (_ = {
6443
6397
  unified: e ? pn({
@@ -6461,7 +6415,7 @@ var dr = class e {
6461
6415
  error: Te(e) ?? e
6462
6416
  });
6463
6417
  }
6464
- } else Or(f) ? (C.push(f.annotation), f.annotation.type === "url_citation" ? d.enqueue({
6418
+ } else Lr(f) ? (C.push(f.annotation), f.annotation.type === "url_citation" ? d.enqueue({
6465
6419
  type: "source",
6466
6420
  sourceType: "url",
6467
6421
  id: p.config.generateId?.() ?? o(),
@@ -6503,7 +6457,7 @@ var dr = class e {
6503
6457
  fileId: f.annotation.file_id,
6504
6458
  index: f.annotation.index
6505
6459
  } }
6506
- })) : kr(f) && (M = !0, _ = {
6460
+ })) : Rr(f) && (M = !0, _ = {
6507
6461
  unified: "error",
6508
6462
  raw: "error"
6509
6463
  }, d.enqueue({
@@ -6543,14 +6497,14 @@ var dr = class e {
6543
6497
  };
6544
6498
  }
6545
6499
  };
6546
- function fr(e) {
6500
+ function xr(e) {
6547
6501
  return e.type === "response.output_text.delta";
6548
6502
  }
6549
- function pr(e) {
6550
- let t = hr(e);
6503
+ function Sr(e) {
6504
+ let t = wr(e);
6551
6505
  return t != null && Array.isArray(t.choices) && typeof t.type != "string";
6552
6506
  }
6553
- function mr({ value: e, cause: t, url: n, requestBodyValues: r, responseHeaders: i }) {
6507
+ function Cr({ value: e, cause: t, url: n, requestBodyValues: r, responseHeaders: i }) {
6554
6508
  return new j({
6555
6509
  message: "Received a Chat Completions stream while using the OpenAI Responses API. The default OpenAI provider model uses the Responses API. If your custom baseURL targets a Chat Completions-compatible endpoint, use openai.chat('model-id') or createOpenAI(...).chat('model-id') instead. You can also use @ai-sdk/openai-compatible for OpenAI-compatible providers.",
6556
6510
  url: n,
@@ -6562,58 +6516,58 @@ function mr({ value: e, cause: t, url: n, requestBodyValues: r, responseHeaders:
6562
6516
  isRetryable: !1
6563
6517
  });
6564
6518
  }
6565
- function hr(e) {
6519
+ function wr(e) {
6566
6520
  return typeof e == "object" && e ? e : void 0;
6567
6521
  }
6568
- function gr(e) {
6522
+ function Tr(e) {
6569
6523
  return e.type === "response.output_item.done";
6570
6524
  }
6571
- function _r(e) {
6525
+ function Er(e) {
6572
6526
  return e.type === "response.completed" || e.type === "response.incomplete";
6573
6527
  }
6574
- function vr(e) {
6528
+ function Dr(e) {
6575
6529
  return e.type === "response.failed";
6576
6530
  }
6577
- function yr(e) {
6531
+ function Or(e) {
6578
6532
  return e.type === "response.created";
6579
6533
  }
6580
- function br(e) {
6534
+ function kr(e) {
6581
6535
  return e.type === "response.function_call_arguments.delta";
6582
6536
  }
6583
- function xr(e) {
6537
+ function Ar(e) {
6584
6538
  return e.type === "response.custom_tool_call_input.delta";
6585
6539
  }
6586
- function Sr(e) {
6540
+ function jr(e) {
6587
6541
  return e.type === "response.image_generation_call.partial_image";
6588
6542
  }
6589
- function Cr(e) {
6543
+ function Mr(e) {
6590
6544
  return e.type === "response.code_interpreter_call_code.delta";
6591
6545
  }
6592
- function wr(e) {
6546
+ function Nr(e) {
6593
6547
  return e.type === "response.code_interpreter_call_code.done";
6594
6548
  }
6595
- function Tr(e) {
6549
+ function Pr(e) {
6596
6550
  return e.type === "response.apply_patch_call_operation_diff.delta";
6597
6551
  }
6598
- function Er(e) {
6552
+ function Fr(e) {
6599
6553
  return e.type === "response.apply_patch_call_operation_diff.done";
6600
6554
  }
6601
- function Dr(e) {
6555
+ function Ir(e) {
6602
6556
  return e.type === "response.output_item.added";
6603
6557
  }
6604
- function Or(e) {
6558
+ function Lr(e) {
6605
6559
  return e.type === "response.output_text.annotation.added";
6606
6560
  }
6607
- function kr(e) {
6561
+ function Rr(e) {
6608
6562
  return e.type === "error";
6609
6563
  }
6610
- function Ar(e) {
6564
+ function zr(e) {
6611
6565
  return e.type === "response.in_progress";
6612
6566
  }
6613
- function jr(e) {
6614
- return !(e.type === "response.created" || e.type === "response.in_progress" || e.type === "response.failed" || e.type === "error" || e.type === "unknown_chunk");
6567
+ function Br(e) {
6568
+ return e.type !== "response.created" && e.type !== "response.in_progress" && e.type !== "response.failed" && e.type !== "error" && e.type !== "unknown_chunk";
6615
6569
  }
6616
- function Mr(e) {
6570
+ function Vr(e) {
6617
6571
  if (e == null) return {};
6618
6572
  switch (e.type) {
6619
6573
  case "search": return {
@@ -6638,9 +6592,8 @@ function Mr(e) {
6638
6592
  function $(e) {
6639
6593
  return JSON.stringify(e).slice(1, -1);
6640
6594
  }
6641
- //#endregion
6642
- //#region node_modules/@ai-sdk/deepseek/dist/internal/index.js
6643
- var Nr = N({
6595
+ // node_modules/@ai-sdk/deepseek/dist/internal/index.js
6596
+ var Hr = N({
6644
6597
  imageDetail: E([
6645
6598
  "low",
6646
6599
  "high",
@@ -6648,7 +6601,7 @@ var Nr = N({
6648
6601
  "auto"
6649
6602
  ]).optional(),
6650
6603
  fileData: Y(!0).optional()
6651
- }), Pr = N({
6604
+ }), Ur = N({
6652
6605
  logprobs: O().optional(),
6653
6606
  topLogprobs: H().int().min(0).max(20).optional(),
6654
6607
  userId: K().regex(/^[a-zA-Z0-9_-]+$/, "userId must match /^[a-zA-Z0-9_-]+$/").max(512, "userId must be at most 512 characters long").optional(),
@@ -6665,33 +6618,33 @@ var Nr = N({
6665
6618
  "max"
6666
6619
  ]).optional(),
6667
6620
  strictJsonSchema: O().optional()
6668
- }), Fr = N({ name: K().optional() }).extend({ prefix: Y(!0).optional() });
6669
- function Ir(e) {
6621
+ }), Wr = N({ name: K().optional() }).extend({ prefix: Y(!0).optional() });
6622
+ function Gr(e) {
6670
6623
  return e.includes("deepseek-v4") || e.startsWith("deepseek-flash") || e.startsWith("deepseek-pro");
6671
6624
  }
6672
- var Lr = /* @__PURE__ */ new Set([
6625
+ var Kr = /* @__PURE__ */ new Set([
6673
6626
  "image/gif",
6674
6627
  "image/jpeg",
6675
6628
  "image/jpg",
6676
6629
  "image/png",
6677
6630
  "image/webp"
6678
6631
  ]);
6679
- function Rr(e) {
6632
+ function qr(e) {
6680
6633
  let t = w({ part: e });
6681
- if (!Lr.has(t)) throw new W({
6634
+ if (!Kr.has(t)) throw new W({
6682
6635
  functionality: `DeepSeek image media type ${t}`,
6683
6636
  message: "DeepSeek supports JPEG, PNG, GIF, and WebP image inputs."
6684
6637
  });
6685
6638
  return t;
6686
6639
  }
6687
- function zr({ url: e, prompt: t }) {
6640
+ function Jr({ url: e, prompt: t }) {
6688
6641
  if (e.length > 8192) throw new _e({
6689
6642
  prompt: t,
6690
6643
  message: "DeepSeek image URLs must not exceed 8192 characters."
6691
6644
  });
6692
6645
  }
6693
- async function Br({ prompt: e, responseFormat: t, modelId: n, providerOptionsName: r = "deepseek", supportsAssistantPrefixCompletion: i = !1, supportsStructuredOutputs: o = !1 }) {
6694
- let s = Ir(n), c = [], l = [];
6646
+ async function Yr({ prompt: e, responseFormat: t, modelId: n, providerOptionsName: r = "deepseek", supportsAssistantPrefixCompletion: i = !1, supportsStructuredOutputs: o = !1 }) {
6647
+ let s = Gr(n), c = [], l = [];
6695
6648
  t?.type === "json" && (t.schema == null ? c.push({
6696
6649
  role: "system",
6697
6650
  content: "Return JSON."
@@ -6714,7 +6667,7 @@ async function Br({ prompt: e, responseFormat: t, modelId: n, providerOptionsNam
6714
6667
  let p = await M({
6715
6668
  provider: r,
6716
6669
  providerOptions: o,
6717
- schema: Fr
6670
+ schema: Wr
6718
6671
  });
6719
6672
  if (p?.prefix === !0 && t !== "assistant") throw new _e({
6720
6673
  prompt: e,
@@ -6751,7 +6704,7 @@ async function Br({ prompt: e, responseFormat: t, modelId: n, providerOptionsNam
6751
6704
  let n = await M({
6752
6705
  provider: r,
6753
6706
  providerOptions: i.providerOptions,
6754
- schema: Nr
6707
+ schema: Hr
6755
6708
  });
6756
6709
  if (i.data.type === "reference") t.push({
6757
6710
  type: "file",
@@ -6761,10 +6714,10 @@ async function Br({ prompt: e, responseFormat: t, modelId: n, providerOptionsNam
6761
6714
  })
6762
6715
  });
6763
6716
  else if (i.data.type === "url" || i.data.type === "data") {
6764
- let r = Rr(i);
6717
+ let r = qr(i);
6765
6718
  if (i.data.type === "url") {
6766
6719
  let r = i.data.url.toString();
6767
- if (zr({
6720
+ if (Jr({
6768
6721
  url: r,
6769
6722
  prompt: e
6770
6723
  }), n?.fileData === !0) throw new _e({
@@ -6833,16 +6786,14 @@ async function Br({ prompt: e, responseFormat: t, modelId: n, providerOptionsNam
6833
6786
  if (f <= d && !s) break;
6834
6787
  r == null ? r = e.text : r += e.text;
6835
6788
  break;
6836
- case "tool-call":
6837
- a.push({
6838
- id: e.toolCallId,
6839
- type: "function",
6840
- function: {
6841
- name: e.toolName,
6842
- arguments: JSON.stringify(e.input)
6843
- }
6844
- });
6845
- break;
6789
+ case "tool-call": a.push({
6790
+ id: e.toolCallId,
6791
+ type: "function",
6792
+ function: {
6793
+ name: e.toolName,
6794
+ arguments: JSON.stringify(e.input)
6795
+ }
6796
+ });
6846
6797
  }
6847
6798
  c.push({
6848
6799
  role: "assistant",
@@ -6898,9 +6849,9 @@ async function Br({ prompt: e, responseFormat: t, modelId: n, providerOptionsNam
6898
6849
  let n = await M({
6899
6850
  provider: r,
6900
6851
  providerOptions: t.providerOptions,
6901
- schema: Nr
6902
- }), o = Rr(t), s;
6903
- t.data.type === "url" ? (s = t.data.url.toString(), zr({
6852
+ schema: Hr
6853
+ }), o = qr(t), s;
6854
+ t.data.type === "url" ? (s = t.data.url.toString(), Jr({
6904
6855
  url: s,
6905
6856
  prompt: e
6906
6857
  })) : s = `data:${o === "image/jpg" ? "image/jpeg" : o};base64,${A(t.data.data)}`, i.push({
@@ -6914,7 +6865,6 @@ async function Br({ prompt: e, responseFormat: t, modelId: n, providerOptionsNam
6914
6865
  type: "unsupported",
6915
6866
  feature: `tool result content part type: ${t.type}`
6916
6867
  });
6917
- break;
6918
6868
  }
6919
6869
  c.push({
6920
6870
  role: "tool",
@@ -6923,12 +6873,10 @@ async function Br({ prompt: e, responseFormat: t, modelId: n, providerOptionsNam
6923
6873
  });
6924
6874
  }
6925
6875
  break;
6926
- default:
6927
- l.push({
6928
- type: "unsupported",
6929
- feature: `message role: ${t}`
6930
- });
6931
- break;
6876
+ default: l.push({
6877
+ type: "unsupported",
6878
+ feature: `message role: ${t}`
6879
+ });
6932
6880
  }
6933
6881
  }
6934
6882
  return {
@@ -6936,7 +6884,7 @@ async function Br({ prompt: e, responseFormat: t, modelId: n, providerOptionsNam
6936
6884
  warnings: l
6937
6885
  };
6938
6886
  }
6939
- function Vr(e) {
6887
+ function Xr(e) {
6940
6888
  if (e == null) return _();
6941
6889
  let t = e.prompt_tokens ?? 0, n = e.completion_tokens ?? 0, r = e.prompt_cache_hit_tokens ?? 0, i = e.completion_tokens_details?.reasoning_tokens ?? 0;
6942
6890
  return {
@@ -6954,7 +6902,7 @@ function Vr(e) {
6954
6902
  raw: e
6955
6903
  };
6956
6904
  }
6957
- var Hr = le({
6905
+ var Zr = le({
6958
6906
  prompt_tokens: H().nullish(),
6959
6907
  completion_tokens: H().nullish(),
6960
6908
  prompt_cache_hit_tokens: H().nullish(),
@@ -6962,12 +6910,12 @@ var Hr = le({
6962
6910
  total_tokens: H().nullish(),
6963
6911
  prompt_tokens_details: le({ cached_tokens: H().nullish() }).nullish(),
6964
6912
  completion_tokens_details: le({ reasoning_tokens: H().nullish() }).nullish()
6965
- }).nullish(), Ur = N({ error: N({
6913
+ }).nullish(), Qr = N({ error: N({
6966
6914
  message: K(),
6967
6915
  type: K().nullish(),
6968
6916
  param: pe().nullish(),
6969
6917
  code: I([K(), H()]).nullish()
6970
- }) }), Wr = N({
6918
+ }) }), $r = N({
6971
6919
  token: K(),
6972
6920
  logprob: H(),
6973
6921
  bytes: l(H()).nullable(),
@@ -6976,10 +6924,10 @@ var Hr = le({
6976
6924
  logprob: H(),
6977
6925
  bytes: l(H()).nullable()
6978
6926
  }))
6979
- }), Gr = N({
6980
- content: l(Wr).nullish(),
6981
- reasoning_content: l(Wr).nullish()
6982
- }).nullish(), Kr = N({
6927
+ }), ei = N({
6928
+ content: l($r).nullish(),
6929
+ reasoning_content: l($r).nullish()
6930
+ }).nullish(), ti = N({
6983
6931
  id: K().nullish(),
6984
6932
  created: H().nullish(),
6985
6933
  model: K().nullish(),
@@ -7000,11 +6948,11 @@ var Hr = le({
7000
6948
  })
7001
6949
  })).nullish()
7002
6950
  }),
7003
- logprobs: Gr,
6951
+ logprobs: ei,
7004
6952
  finish_reason: K().nullish()
7005
6953
  })),
7006
- usage: Hr
7007
- }), qr = q(() => n(I([N({
6954
+ usage: Zr
6955
+ }), ni = q(() => n(I([N({
7008
6956
  id: K().nullish(),
7009
6957
  created: H().nullish(),
7010
6958
  model: K().nullish(),
@@ -7026,12 +6974,12 @@ var Hr = le({
7026
6974
  })
7027
6975
  })).nullish()
7028
6976
  }).nullish(),
7029
- logprobs: Gr,
6977
+ logprobs: ei,
7030
6978
  finish_reason: K().nullish()
7031
6979
  })),
7032
- usage: Hr
7033
- }), Ur])));
7034
- function Jr({ tools: e, toolChoice: t, supportsStrictToolCalls: n }) {
6980
+ usage: Zr
6981
+ }), Qr])));
6982
+ function ri({ tools: e, toolChoice: t, supportsStrictToolCalls: n }) {
7035
6983
  e = e?.length ? e : void 0;
7036
6984
  let r = [];
7037
6985
  if (e == null) return {
@@ -7093,7 +7041,7 @@ function Jr({ tools: e, toolChoice: t, supportsStrictToolCalls: n }) {
7093
7041
  };
7094
7042
  }
7095
7043
  }
7096
- function Yr(e) {
7044
+ function ii(e) {
7097
7045
  switch (e) {
7098
7046
  case "stop": return "stop";
7099
7047
  case "length": return "length";
@@ -7103,8 +7051,8 @@ function Yr(e) {
7103
7051
  default: return "other";
7104
7052
  }
7105
7053
  }
7106
- function Xr(e, t) {
7107
- let n = Zr(e);
7054
+ function ai(e, t) {
7055
+ let n = oi(e);
7108
7056
  return m({
7109
7057
  message: e.message,
7110
7058
  type: e.type ?? void 0,
@@ -7113,15 +7061,15 @@ function Xr(e, t) {
7113
7061
  data: t
7114
7062
  });
7115
7063
  }
7116
- function Zr(e) {
7064
+ function oi(e) {
7117
7065
  if (e.code === "insufficient_quota" || e.type === "insufficient_quota") return {
7118
7066
  statusCode: 429,
7119
7067
  isRetryable: !1
7120
7068
  };
7121
- let t = Qr(e.code);
7069
+ let t = si(e.code);
7122
7070
  if (t != null) return {
7123
7071
  statusCode: t,
7124
- isRetryable: $r(t)
7072
+ isRetryable: ci(t)
7125
7073
  };
7126
7074
  for (let t of [e.code, e.type]) switch (t) {
7127
7075
  case "rate_limit_exceeded":
@@ -7168,14 +7116,14 @@ function Zr(e) {
7168
7116
  }
7169
7117
  return {};
7170
7118
  }
7171
- function Qr(e) {
7119
+ function si(e) {
7172
7120
  let t = typeof e == "string" && /^\d{3}$/.test(e) ? Number(e) : e;
7173
7121
  return typeof t == "number" && Number.isInteger(t) && t >= 400 && t <= 599 ? t : void 0;
7174
7122
  }
7175
- function $r(e) {
7123
+ function ci(e) {
7176
7124
  return e === 408 || e === 409 || e === 429 || e >= 500;
7177
7125
  }
7178
- function ei({ reasoningEffort: e, warnings: t }) {
7126
+ function li({ reasoningEffort: e, warnings: t }) {
7179
7127
  let n = e === "medium" ? "high" : e === "xhigh" ? "max" : e;
7180
7128
  return n !== e && t.push({
7181
7129
  type: "compatibility",
@@ -7183,10 +7131,10 @@ function ei({ reasoningEffort: e, warnings: t }) {
7183
7131
  details: `reasoningEffort "${e}" is not a canonical DeepSeek value. mapped to "${n}".`
7184
7132
  }), n;
7185
7133
  }
7186
- var ti = class e {
7134
+ var ui = class e {
7187
7135
  constructor(e, t) {
7188
7136
  this.specificationVersion = "v4", this.supportedUrls = { "image/*": [/^https?:\/\/.*$/] }, this.modelId = e, this.config = t, this.failedResponseHandler = ge({
7189
- errorSchema: Ur,
7137
+ errorSchema: Qr,
7190
7138
  errorToMessage: (e) => e.error.message
7191
7139
  });
7192
7140
  }
@@ -7209,8 +7157,8 @@ var ti = class e {
7209
7157
  let m = await M({
7210
7158
  provider: this.providerOptionsName,
7211
7159
  providerOptions: c,
7212
- schema: Pr
7213
- }) ?? {}, h = this.config.supportsStructuredOutputs === !0, g = this.config.supportsPenaltySampling === !0, { messages: _, warnings: v } = await Br({
7160
+ schema: Ur
7161
+ }) ?? {}, h = this.config.supportsStructuredOutputs === !0, g = this.config.supportsPenaltySampling === !0, { messages: _, warnings: v } = await Yr({
7214
7162
  prompt: e,
7215
7163
  responseFormat: u,
7216
7164
  modelId: this.modelId,
@@ -7233,7 +7181,7 @@ var ti = class e {
7233
7181
  setting: "presencePenalty",
7234
7182
  message: "presencePenalty is deprecated by DeepSeek and has been omitted. Remove presencePenalty from the request."
7235
7183
  });
7236
- let { tools: b, toolChoice: x, toolWarnings: S } = Jr({
7184
+ let { tools: b, toolChoice: x, toolWarnings: S } = ri({
7237
7185
  tools: p,
7238
7186
  toolChoice: f,
7239
7187
  supportsStrictToolCalls: this.config.supportsStrictToolCalls
@@ -7243,7 +7191,7 @@ var ti = class e {
7243
7191
  feature: "thinking.type",
7244
7192
  details: "thinking.type \"adaptive\" is not a canonical DeepSeek value. mapped to \"enabled\"."
7245
7193
  });
7246
- let w = this.config.supportsThinking === !1 ? void 0 : C == null ? D(s) ? { type: s === "none" ? "disabled" : "enabled" } : void 0 : { type: C === "adaptive" ? "enabled" : C }, T = this.config.supportsThinking !== !1 && w?.type !== "disabled" && (w != null || this.modelId === "deepseek-reasoner" || Ir(this.modelId));
7194
+ let w = this.config.supportsThinking === !1 ? void 0 : C == null ? D(s) ? { type: s === "none" ? "disabled" : "enabled" } : void 0 : { type: C === "adaptive" ? "enabled" : C }, T = this.config.supportsThinking !== !1 && w?.type !== "disabled" && (w != null || this.modelId === "deepseek-reasoner" || Gr(this.modelId));
7247
7195
  T && n != null && y.push({
7248
7196
  type: "unsupported",
7249
7197
  feature: "temperature",
@@ -7263,7 +7211,7 @@ var ti = class e {
7263
7211
  xhigh: "max"
7264
7212
  },
7265
7213
  warnings: y
7266
- }) : void 0 : ei({
7214
+ }) : void 0 : li({
7267
7215
  reasoningEffort: m.reasoningEffort,
7268
7216
  warnings: y
7269
7217
  });
@@ -7306,7 +7254,7 @@ var ti = class e {
7306
7254
  headers: R(this.config.headers?.(), e.headers),
7307
7255
  body: t,
7308
7256
  failedResponseHandler: this.failedResponseHandler,
7309
- successfulResponseHandler: i(Kr),
7257
+ successfulResponseHandler: i(ti),
7310
7258
  abortSignal: e.abortSignal,
7311
7259
  fetch: this.config.fetch
7312
7260
  }), l = s.choices[0];
@@ -7331,10 +7279,10 @@ var ti = class e {
7331
7279
  }), {
7332
7280
  content: u,
7333
7281
  finishReason: {
7334
- unified: Yr(l.finish_reason),
7282
+ unified: ii(l.finish_reason),
7335
7283
  raw: l.finish_reason ?? void 0
7336
7284
  },
7337
- usage: Vr(s.usage),
7285
+ usage: Xr(s.usage),
7338
7286
  providerMetadata: { [this.providerOptionsName]: {
7339
7287
  promptCacheHitTokens: s.usage?.prompt_cache_hit_tokens,
7340
7288
  promptCacheMissTokens: s.usage?.prompt_cache_miss_tokens,
@@ -7367,7 +7315,7 @@ var ti = class e {
7367
7315
  headers: R(this.config.headers?.(), e.headers),
7368
7316
  body: i,
7369
7317
  failedResponseHandler: this.failedResponseHandler,
7370
- successfulResponseHandler: S(qr),
7318
+ successfulResponseHandler: S(ni),
7371
7319
  abortSignal: e.abortSignal,
7372
7320
  fetch: this.config.fetch
7373
7321
  }), c, l = {
@@ -7403,7 +7351,7 @@ var ti = class e {
7403
7351
  raw: void 0
7404
7352
  }, n.enqueue({
7405
7353
  type: "error",
7406
- error: Xr(i.error, i)
7354
+ error: ai(i.error, i)
7407
7355
  });
7408
7356
  return;
7409
7357
  }
@@ -7413,7 +7361,7 @@ var ti = class e {
7413
7361
  })), i.usage != null && (u = i.usage), i.object != null && (g = i.object), i.system_fingerprint != null && (d = i.system_fingerprint);
7414
7362
  let a = i.choices[0];
7415
7363
  if (a?.index != null && (_ = a.index), a?.finish_reason != null && (l = {
7416
- unified: Yr(a.finish_reason),
7364
+ unified: ii(a.finish_reason),
7417
7365
  raw: a.finish_reason
7418
7366
  }), a?.logprobs?.content != null && b.push(...a.logprobs.content), a?.logprobs?.reasoning_content != null && x.push(...a.logprobs.reasoning_content), a?.delta == null) return;
7419
7367
  let o = a.delta;
@@ -7454,7 +7402,7 @@ var ti = class e {
7454
7402
  }), c.flush(), e.enqueue({
7455
7403
  type: "finish",
7456
7404
  finishReason: l,
7457
- usage: Vr(u),
7405
+ usage: Xr(u),
7458
7406
  providerMetadata: { [p]: {
7459
7407
  promptCacheHitTokens: u?.prompt_cache_hit_tokens ?? void 0,
7460
7408
  promptCacheMissTokens: u?.prompt_cache_miss_tokens ?? void 0,
@@ -7475,13 +7423,13 @@ var ti = class e {
7475
7423
  response: { headers: a }
7476
7424
  };
7477
7425
  }
7478
- }, ni = {
7426
+ }, di = {
7479
7427
  codeInterpreter: Fn,
7480
7428
  fileSearch: Bn,
7481
- imageGeneration: Un,
7482
- webSearch: Yn,
7483
- webSearchPreview: Zn
7484
- }, ri = () => ({
7429
+ imageGeneration: Gn,
7430
+ webSearch: nr,
7431
+ webSearchPreview: or
7432
+ }, fi = () => ({
7485
7433
  timestamps: E([
7486
7434
  "word",
7487
7435
  "segment",
@@ -7492,15 +7440,15 @@ var ti = class e {
7492
7440
  diarization: te({ enabled: O() }).optional(),
7493
7441
  phraseList: te({ phrases: l(K()) }).optional()
7494
7442
  });
7495
- q(() => n(te(ri())));
7496
- var ii = q(() => n(te({
7443
+ q(() => n(te(fi())));
7444
+ var pi = q(() => n(te({
7497
7445
  api: E(["openai", "speech"]).optional(),
7498
- ...ri()
7446
+ ...fi()
7499
7447
  })));
7500
- function ai(e) {
7448
+ function mi(e) {
7501
7449
  return e.toLowerCase() === "mai-transcribe-2";
7502
7450
  }
7503
- var oi = class {
7451
+ var hi = class {
7504
7452
  constructor(e, t) {
7505
7453
  this.modelId = e, this.config = t, this.specificationVersion = "v4", this.provider = "azure.transcription";
7506
7454
  }
@@ -7509,7 +7457,7 @@ var oi = class {
7509
7457
  r.append("audio", new Blob([typeof e.audio == "string" ? V(e.audio) : e.audio], { type: e.mediaType }), `audio.${B(e.mediaType)}`), r.append("definition", JSON.stringify({
7510
7458
  enhancedMode: {
7511
7459
  enabled: !0,
7512
- model: ai(this.modelId) ? "MAI-Transcribe-2" : this.modelId,
7460
+ model: mi(this.modelId) ? "MAI-Transcribe-2" : this.modelId,
7513
7461
  modelOptions: {
7514
7462
  timestamps: t.timestamps ?? "segment",
7515
7463
  transcribeStyle: t.transcribeStyle
@@ -7529,7 +7477,7 @@ var oi = class {
7529
7477
  errorSchema: I([N({ error: N({ message: K() }) }), N({ message: K() })]),
7530
7478
  errorToMessage: (e) => "error" in e ? e.error.message : e.message
7531
7479
  }),
7532
- successfulResponseHandler: i(si)
7480
+ successfulResponseHandler: i(gi)
7533
7481
  }), c = a.phrases ?? [], l = new Set(c.flatMap((e) => e.locale ? [e.locale.split("-")[0].toLowerCase()] : [])), [u] = l, d = l.size === 1 && /^[a-z]{2}$/.test(u) ? u : void 0;
7534
7482
  return {
7535
7483
  text: a.combinedPhrases.map((e) => e.text).join(" "),
@@ -7550,7 +7498,7 @@ var oi = class {
7550
7498
  }
7551
7499
  };
7552
7500
  }
7553
- }, si = N({
7501
+ }, gi = N({
7554
7502
  combinedPhrases: l(N({ text: K() })),
7555
7503
  durationMilliseconds: H().nullish(),
7556
7504
  phrases: l(N({
@@ -7566,8 +7514,8 @@ var oi = class {
7566
7514
  durationMilliseconds: H().nullish()
7567
7515
  })).nullish()
7568
7516
  })).nullish()
7569
- }), ci = "4.0.85";
7570
- function li(e) {
7517
+ }), _i = "4.0.85";
7518
+ function vi(e) {
7571
7519
  if (e == null) return {
7572
7520
  isAzureOpenAI: !0,
7573
7521
  isFoundryProject: !1,
@@ -7580,20 +7528,23 @@ function li(e) {
7580
7528
  isVersioned: r && i.toLowerCase().endsWith("/openai/v1")
7581
7529
  };
7582
7530
  }
7583
- function ui(e = {}) {
7531
+ function yi(e = {}) {
7584
7532
  let t = e.tokenProvider;
7585
7533
  if (e.apiKey && t) throw new ee({
7586
7534
  argument: "apiKey/tokenProvider",
7587
7535
  message: "Both apiKey and tokenProvider were provided. Please use only one authentication method."
7588
7536
  });
7589
- let n = (n = "openai") => x({
7590
- ...t ? {} : { [n === "speech" ? "Ocp-Apim-Subscription-Key" : "api-key"]: me({
7537
+ let n = (n = "openai") => {
7538
+ let r = t ? {} : { [n === "speech" ? "Ocp-Apim-Subscription-Key" : "api-key"]: me({
7591
7539
  apiKey: e.apiKey,
7592
7540
  environmentVariableName: "AZURE_API_KEY",
7593
7541
  description: n === "speech" ? "Azure Speech" : "Azure OpenAI"
7594
- }) },
7595
- ...e.headers
7596
- }, `ai-sdk-azure/${ci}`), r = t ? async (n, r) => {
7542
+ }) };
7543
+ return x({
7544
+ ...r,
7545
+ ...e.headers
7546
+ }, `ai-sdk-azure/${_i}`);
7547
+ }, r = t ? async (n, r) => {
7597
7548
  let i = ce(r?.headers);
7598
7549
  return i.authorization ??= `Bearer ${await t()}`, (e.fetch ?? globalThis.fetch)(n, {
7599
7550
  ...r,
@@ -7611,7 +7562,7 @@ function ui(e = {}) {
7611
7562
  message: "Invalid Azure resource name. Expected a single DNS label (letters, digits, and hyphens). Use `baseURL` for custom endpoints."
7612
7563
  });
7613
7564
  return t;
7614
- }, a = e.apiVersion ?? "v1", { isAzureOpenAI: o, isFoundryProject: s, isVersioned: c } = li(e.baseURL), l = ({ path: t, modelId: n }) => {
7565
+ }, a = e.apiVersion ?? "v1", { isAzureOpenAI: o, isFoundryProject: s, isVersioned: c } = vi(e.baseURL), l = ({ path: t, modelId: n }) => {
7615
7566
  let r = ye(e.baseURL ?? `https://${i()}.openai.azure.com/openai`), l;
7616
7567
  return l = e.useDeploymentBasedUrls ? new URL(`${r}/deployments/${n}${t}`) : !o || c ? new URL(`${r}${t}`) : new URL(`${r}/v1${t}`), (e.useDeploymentBasedUrls || o && !c && !s) && l.searchParams.set("api-version", a), l.toString();
7617
7568
  }, u = (e) => new Ye(e, {
@@ -7619,7 +7570,7 @@ function ui(e = {}) {
7619
7570
  url: l,
7620
7571
  headers: n,
7621
7572
  fetch: r
7622
- }), d = (e) => new ti(e, {
7573
+ }), d = (e) => new ui(e, {
7623
7574
  provider: "azure.deepseek",
7624
7575
  url: l,
7625
7576
  headers: n,
@@ -7637,7 +7588,7 @@ function ui(e = {}) {
7637
7588
  headers: n,
7638
7589
  url: l,
7639
7590
  fetch: r
7640
- }), m = (e) => new dr(e, {
7591
+ }), m = (e) => new br(e, {
7641
7592
  provider: "azure.responses",
7642
7593
  url: l,
7643
7594
  headers: n,
@@ -7653,12 +7604,12 @@ function ui(e = {}) {
7653
7604
  supportsFileInputs: void 0,
7654
7605
  supportsMaskInputs: void 0
7655
7606
  }
7656
- }), g = (t) => new di(t, e, new wt(t, {
7607
+ }), g = (t) => new bi(t, e, new wt(t, {
7657
7608
  provider: "azure.transcription",
7658
7609
  url: l,
7659
7610
  headers: n,
7660
7611
  fetch: r
7661
- }), new oi(t, {
7612
+ }), new hi(t, {
7662
7613
  url: () => `${ye(e.speechBaseURL) ?? `https://${i()}.cognitiveservices.azure.com`}/speechtotext/transcriptions:transcribe?api-version=2025-10-15`,
7663
7614
  headers: () => n("speech"),
7664
7615
  fetch: r
@@ -7671,10 +7622,10 @@ function ui(e = {}) {
7671
7622
  if (new.target) throw Error("The Azure OpenAI model function cannot be called with the new keyword.");
7672
7623
  return m(e);
7673
7624
  };
7674
- return v.specificationVersion = "v4", v.languageModel = m, v.chat = u, v.deepseek = d, v.completion = f, v.embedding = p, v.embeddingModel = p, v.textEmbedding = p, v.textEmbeddingModel = p, v.image = h, v.imageModel = h, v.responses = m, v.transcription = g, v.transcriptionModel = g, v.speech = _, v.tools = ni, v;
7625
+ return v.specificationVersion = "v4", v.languageModel = m, v.chat = u, v.deepseek = d, v.completion = f, v.embedding = p, v.embeddingModel = p, v.textEmbedding = p, v.textEmbeddingModel = p, v.image = h, v.imageModel = h, v.responses = m, v.transcription = g, v.transcriptionModel = g, v.speech = _, v.tools = di, v;
7675
7626
  }
7676
- ui();
7677
- var di = class {
7627
+ yi();
7628
+ var bi = class {
7678
7629
  constructor(e, t, n, r) {
7679
7630
  this.modelId = e, this.config = t, this.openai = n, this.speech = r, this.specificationVersion = "v4", this.provider = "azure.transcription";
7680
7631
  }
@@ -7685,7 +7636,7 @@ var di = class {
7685
7636
  });
7686
7637
  }
7687
7638
  static [T](e) {
7688
- return ui(e.config).transcription(e.modelId);
7639
+ return yi(e.config).transcription(e.modelId);
7689
7640
  }
7690
7641
  async doGenerate(e) {
7691
7642
  let { api: t, ...n } = await this.getOptions(e.providerOptions);
@@ -7709,13 +7660,12 @@ var di = class {
7709
7660
  let t = await M({
7710
7661
  provider: "azure",
7711
7662
  providerOptions: e,
7712
- schema: ii
7663
+ schema: pi
7713
7664
  });
7714
7665
  return {
7715
7666
  ...t,
7716
- api: t?.api ?? (ai(this.modelId) ? "speech" : "openai")
7667
+ api: t?.api ?? (mi(this.modelId) ? "speech" : "openai")
7717
7668
  };
7718
7669
  }
7719
7670
  };
7720
- //#endregion
7721
- export { ui as createAzure };
7671
+ export { yi as createAzure };