@omnicross/core 0.1.9 → 0.2.0

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 (176) hide show
  1. package/LICENSE +21 -21
  2. package/NOTICE +57 -57
  3. package/README.md +22 -15
  4. package/dist/{CompletionService-kNA17cfI.d.cts → CompletionService-BiJqftc-.d.cts} +1 -1
  5. package/dist/{CompletionService-C3BX0Ovy.d.ts → CompletionService-NXN_Av5W.d.ts} +1 -1
  6. package/dist/{ProviderProxy-QdwNV6l1.d.cts → ProviderProxy-CgIcCVwk.d.cts} +1 -1
  7. package/dist/{ProviderProxy--ROec6VI.d.ts → ProviderProxy-DYoY5XoT.d.ts} +1 -1
  8. package/dist/auth/GeminiCodeAssistProjectResolver.cjs +6 -6
  9. package/dist/auth/GeminiCodeAssistProjectResolver.js +4 -4
  10. package/dist/chunk-32SRZFFP.cjs +153 -0
  11. package/dist/chunk-4JOU54M5.js +200 -0
  12. package/dist/{chunk-2UTGX6FM.js → chunk-4VVCXVB7.js} +1 -1
  13. package/dist/{chunk-EPN67EGP.cjs → chunk-5UK3KLE2.cjs} +9 -1
  14. package/dist/chunk-6DDYNS2B.cjs +384 -0
  15. package/dist/{chunk-HKB656B4.js → chunk-6OC3ORW6.js} +55 -287
  16. package/dist/chunk-6OKXH2TW.js +320 -0
  17. package/dist/{chunk-XELFM7KL.cjs → chunk-7B56AJBB.cjs} +6275 -2421
  18. package/dist/{chunk-YWL7YZWS.cjs → chunk-7LRTPNFL.cjs} +5 -0
  19. package/dist/{chunk-CCVRRJOX.js → chunk-7PIUVCKK.js} +9 -2
  20. package/dist/{chunk-IIRPUVPH.cjs → chunk-7ZHBN75N.cjs} +3 -1
  21. package/dist/{chunk-UAPBLNN2.js → chunk-AQDON6MB.js} +8 -0
  22. package/dist/{chunk-RJ5ZGNI3.js → chunk-CFSGYFOZ.js} +1 -1
  23. package/dist/chunk-CTKM773J.cjs +3919 -0
  24. package/dist/chunk-DEIUR2TH.js +3919 -0
  25. package/dist/{chunk-WNKWAEUR.js → chunk-EYGBM2VC.js} +3 -1
  26. package/dist/{chunk-NGYOO5TO.js → chunk-FJNKXOWE.js} +9 -9
  27. package/dist/chunk-FX325I5Q.cjs +320 -0
  28. package/dist/chunk-G4CZIUIB.cjs +200 -0
  29. package/dist/chunk-HCOQQAZE.cjs +123 -0
  30. package/dist/{chunk-55FMGZ3L.js → chunk-HN74IGEO.js} +1 -1
  31. package/dist/{chunk-ZY6KU6P3.js → chunk-HOMUGKHR.js} +8 -5
  32. package/dist/{chunk-AOFWNWLT.cjs → chunk-IUL4VWNU.cjs} +22 -1
  33. package/dist/{chunk-5LNYGCIW.cjs → chunk-KIQ2HA2A.cjs} +5 -5
  34. package/dist/{chunk-MUHWHQVM.cjs → chunk-KQBLZMP6.cjs} +4 -3
  35. package/dist/chunk-LFEH7CEO.js +384 -0
  36. package/dist/chunk-N76KU6F5.js +123 -0
  37. package/dist/{chunk-CMVXX7ON.cjs → chunk-NOITAVHA.cjs} +114 -58
  38. package/dist/{chunk-Q27JY5RG.cjs → chunk-OIKREZVQ.cjs} +7 -4
  39. package/dist/{chunk-RJUONLUQ.cjs → chunk-OST5RJOJ.cjs} +1 -1
  40. package/dist/chunk-QIIAMBTM.js +153 -0
  41. package/dist/{chunk-56QD3YW6.cjs → chunk-QWNUOR7F.cjs} +11 -4
  42. package/dist/{chunk-S3DYFEBE.js → chunk-R4VCO2CB.js} +10 -1
  43. package/dist/{chunk-ZQQUD66M.cjs → chunk-SQMAEDNE.cjs} +63 -295
  44. package/dist/{chunk-4VZX5F4T.cjs → chunk-T6NWPIYZ.cjs} +5 -2
  45. package/dist/{chunk-P7EM6BND.cjs → chunk-TVYA5JSQ.cjs} +10 -10
  46. package/dist/{chunk-EBLFCNPY.js → chunk-U47LQXPB.js} +5 -2
  47. package/dist/{chunk-N7OOJI5V.js → chunk-V2UKUTJ3.js} +5 -0
  48. package/dist/{chunk-45FHEOKW.js → chunk-V53ZEFXC.js} +92 -36
  49. package/dist/{chunk-OC6DOOFX.cjs → chunk-VXRTQZF2.cjs} +5 -5
  50. package/dist/{chunk-CQIJCPMF.js → chunk-WSJE42SG.js} +5149 -1295
  51. package/dist/{chunk-RICPANBY.cjs → chunk-WX2E2G7H.cjs} +13 -4
  52. package/dist/{chunk-DE2SRBFZ.js → chunk-X335TJNS.js} +4 -3
  53. package/dist/{chunk-N2EIM2XJ.js → chunk-ZLNHPUFA.js} +22 -1
  54. package/dist/completion/CompletionService.cjs +30 -27
  55. package/dist/completion/CompletionService.d.cts +3 -2
  56. package/dist/completion/CompletionService.d.ts +3 -2
  57. package/dist/completion/CompletionService.js +29 -26
  58. package/dist/completion.cjs +38 -35
  59. package/dist/completion.d.cts +3 -2
  60. package/dist/completion.d.ts +3 -2
  61. package/dist/completion.js +37 -34
  62. package/dist/image-generation.cjs +52 -0
  63. package/dist/image-generation.d.cts +93 -0
  64. package/dist/image-generation.d.ts +93 -0
  65. package/dist/image-generation.js +52 -0
  66. package/dist/index.cjs +126 -31
  67. package/dist/index.d.cts +11 -7
  68. package/dist/index.d.ts +11 -7
  69. package/dist/index.js +143 -48
  70. package/dist/openai-operation.cjs +18 -0
  71. package/dist/openai-operation.d.cts +19 -0
  72. package/dist/openai-operation.d.ts +19 -0
  73. package/dist/openai-operation.js +18 -0
  74. package/dist/outbound-api/auditCapture.cjs +3 -3
  75. package/dist/outbound-api/auditCapture.d.cts +19 -2
  76. package/dist/outbound-api/auditCapture.d.ts +19 -2
  77. package/dist/outbound-api/auditCapture.js +2 -2
  78. package/dist/outbound-api/auditRedact.cjs +2 -2
  79. package/dist/outbound-api/auditRedact.js +1 -1
  80. package/dist/outbound-api/routeResolver.cjs +2 -2
  81. package/dist/outbound-api/routeResolver.d.cts +7 -4
  82. package/dist/outbound-api/routeResolver.d.ts +7 -4
  83. package/dist/outbound-api/routeResolver.js +1 -1
  84. package/dist/outbound-api/subscriptionRegistryPort.d.cts +2 -1
  85. package/dist/outbound-api/subscriptionRegistryPort.d.ts +2 -1
  86. package/dist/outbound-api/types.d.cts +6 -3
  87. package/dist/outbound-api/types.d.ts +6 -3
  88. package/dist/outbound-api.cjs +49 -32
  89. package/dist/outbound-api.d.cts +97 -10
  90. package/dist/outbound-api.d.ts +97 -10
  91. package/dist/outbound-api.js +48 -31
  92. package/dist/pipeline/AccountAllowanceScheduling.d.cts +18 -15
  93. package/dist/pipeline/AccountAllowanceScheduling.d.ts +18 -15
  94. package/dist/pipeline/LlmConfigProviderAuth.cjs +3 -3
  95. package/dist/pipeline/LlmConfigProviderAuth.js +2 -2
  96. package/dist/pipeline/SubscriptionAccountHealth.cjs +2 -2
  97. package/dist/pipeline/SubscriptionAccountHealth.d.cts +7 -0
  98. package/dist/pipeline/SubscriptionAccountHealth.d.ts +7 -0
  99. package/dist/pipeline/SubscriptionAccountHealth.js +1 -1
  100. package/dist/pipeline/executeProviderCall.cjs +2 -2
  101. package/dist/pipeline/executeProviderCall.d.cts +11 -6
  102. package/dist/pipeline/executeProviderCall.d.ts +11 -6
  103. package/dist/pipeline/executeProviderCall.js +1 -1
  104. package/dist/pipeline/upstreamFetch.cjs +2 -2
  105. package/dist/pipeline/upstreamFetch.d.cts +5 -0
  106. package/dist/pipeline/upstreamFetch.d.ts +5 -0
  107. package/dist/pipeline/upstreamFetch.js +1 -1
  108. package/dist/ports.d.cts +6 -3
  109. package/dist/ports.d.ts +6 -3
  110. package/dist/provider-proxy/ProviderProxy.cjs +30 -27
  111. package/dist/provider-proxy/ProviderProxy.d.cts +3 -2
  112. package/dist/provider-proxy/ProviderProxy.d.ts +3 -2
  113. package/dist/provider-proxy/ProviderProxy.js +29 -26
  114. package/dist/provider-proxy/identity/codexCliHeaders.cjs +4 -2
  115. package/dist/provider-proxy/identity/codexCliHeaders.d.cts +26 -6
  116. package/dist/provider-proxy/identity/codexCliHeaders.d.ts +26 -6
  117. package/dist/provider-proxy/identity/codexCliHeaders.js +5 -3
  118. package/dist/provider-proxy/ingress/providerProxyShared.cjs +32 -27
  119. package/dist/provider-proxy/ingress/providerProxyShared.d.cts +21 -8
  120. package/dist/provider-proxy/ingress/providerProxyShared.d.ts +21 -8
  121. package/dist/provider-proxy/ingress/providerProxyShared.js +31 -26
  122. package/dist/provider-proxy/types.d.cts +14 -483
  123. package/dist/provider-proxy/types.d.ts +14 -483
  124. package/dist/provider-proxy.cjs +44 -27
  125. package/dist/provider-proxy.d.cts +30 -8
  126. package/dist/provider-proxy.d.ts +30 -8
  127. package/dist/provider-proxy.js +43 -26
  128. package/dist/{routeResolver-C0mkkZaM.d.ts → routeResolver-CTCcSHWu.d.ts} +4 -2
  129. package/dist/{routeResolver-CVFE8KKe.d.cts → routeResolver-rpKQLyDO.d.cts} +4 -2
  130. package/dist/transformer/TransformerChainExecutor.cjs +2 -2
  131. package/dist/transformer/TransformerChainExecutor.d.cts +2 -2
  132. package/dist/transformer/TransformerChainExecutor.d.ts +2 -2
  133. package/dist/transformer/TransformerChainExecutor.js +1 -1
  134. package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.cjs +16 -0
  135. package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.d.cts +53 -0
  136. package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.d.ts +53 -0
  137. package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.js +16 -0
  138. package/dist/transformer/transformers/AnthropicTransformer.cjs +4 -3
  139. package/dist/transformer/transformers/AnthropicTransformer.js +3 -2
  140. package/dist/transformer/transformers/GeminiCodeAssistTransformer.cjs +4 -4
  141. package/dist/transformer/transformers/GeminiCodeAssistTransformer.js +3 -3
  142. package/dist/transformer/transformers/GeminiTransformer.cjs +4 -4
  143. package/dist/transformer/transformers/GeminiTransformer.js +3 -3
  144. package/dist/transformer/transformers/OpenAIResponseTransformer.cjs +3 -3
  145. package/dist/transformer/transformers/OpenAIResponseTransformer.js +2 -2
  146. package/dist/transformer/transformers/OpenAITransformer.cjs +3 -3
  147. package/dist/transformer/transformers/OpenAITransformer.js +2 -2
  148. package/dist/transformer/transformers.cjs +10 -9
  149. package/dist/transformer/transformers.js +13 -12
  150. package/dist/transformer/types.d.cts +39 -4
  151. package/dist/transformer/types.d.ts +39 -4
  152. package/dist/transformer.cjs +14 -13
  153. package/dist/transformer.js +14 -13
  154. package/dist/{types-BB8pxk_3.d.ts → types-5T223WYQ.d.ts} +183 -23
  155. package/dist/types-Bd72H4SB.d.ts +196 -0
  156. package/dist/types-CVRge76p.d.ts +1115 -0
  157. package/dist/types-CbglB73l.d.cts +196 -0
  158. package/dist/types-DsHBBk3h.d.cts +1115 -0
  159. package/dist/{types-C2MwkLah.d.cts → types-jjU24eYG.d.cts} +183 -23
  160. package/dist/usage/usage-recorder.cjs +2 -2
  161. package/dist/usage/usage-recorder.d.cts +12 -2
  162. package/dist/usage/usage-recorder.d.ts +12 -2
  163. package/dist/usage/usage-recorder.js +1 -1
  164. package/dist/usage.cjs +20 -3
  165. package/dist/usage.d.cts +154 -0
  166. package/dist/usage.d.ts +154 -0
  167. package/dist/usage.js +20 -3
  168. package/package.json +69 -64
  169. package/dist/chunk-7C7DET6S.js +0 -154
  170. package/dist/chunk-7VU7V2E4.js +0 -0
  171. package/dist/chunk-EYZYXJTJ.cjs +0 -1
  172. package/dist/chunk-FCR77GYM.cjs +0 -33
  173. package/dist/chunk-K5NM7VAH.js +0 -33
  174. package/dist/chunk-XPIOJQS2.cjs +0 -154
  175. /package/dist/{chunk-XXFYLL7R.js → chunk-ECZ3ZE2C.js} +0 -0
  176. /package/dist/{chunk-3SCOLIPT.cjs → chunk-MXI2PWIC.cjs} +0 -0
@@ -5,8 +5,9 @@ import {
5
5
  import {
6
6
  extractReasoningIntent,
7
7
  normalizeThinkLevel,
8
+ recordDroppedField,
8
9
  resolveReasoningPlan
9
- } from "./chunk-N2EIM2XJ.js";
10
+ } from "./chunk-ZLNHPUFA.js";
10
11
 
11
12
  // src/transformer/transformers/OpenAIResponseTransformer.ts
12
13
  var OpenAIResponseTransformer = class {
@@ -33,6 +34,7 @@ var OpenAIResponseTransformer = class {
33
34
  */
34
35
  async transformRequestIn(request, provider, context) {
35
36
  const input = [];
37
+ const codexTools = request.meta?.codexTools;
36
38
  for (const msg of request.messages) {
37
39
  if (msg.role === "system") {
38
40
  const sysText = typeof msg.content === "string" ? msg.content : flattenContent(msg.content);
@@ -41,9 +43,10 @@ var OpenAIResponseTransformer = class {
41
43
  content: [{ type: "input_text", text: sysText }]
42
44
  });
43
45
  } else if (msg.role === "tool") {
46
+ const callId = msg.tool_call_id;
44
47
  input.push({
45
- type: "function_call_output",
46
- call_id: msg.tool_call_id,
48
+ type: codexTools?.customToolCallIds?.includes(callId ?? "") ? "custom_tool_call_output" : "function_call_output",
49
+ call_id: callId,
47
50
  output: typeof msg.content === "string" ? msg.content : ""
48
51
  });
49
52
  } else {
@@ -56,14 +59,13 @@ var OpenAIResponseTransformer = class {
56
59
  input.push(entry);
57
60
  for (const tc of msg.tool_calls) {
58
61
  const callId = tc.id;
59
- const itemId = callId.startsWith("fc_") ? callId : `fc_${callId.replace(/^(call_|fc_)/, "")}`;
60
- input.push({
61
- type: "function_call",
62
- id: itemId,
63
- call_id: callId,
64
- name: tc.function.name,
65
- arguments: tc.function.arguments
66
- });
62
+ input.push(encodeToolCallItem(
63
+ callId,
64
+ tc.function.name,
65
+ tc.function.arguments,
66
+ "completed",
67
+ codexTools
68
+ ));
67
69
  }
68
70
  continue;
69
71
  }
@@ -77,16 +79,25 @@ var OpenAIResponseTransformer = class {
77
79
  // set to true" otherwise). Always force it; a non-streaming CLIENT is
78
80
  // served by aggregating the SSE upstream of the wire (the ingress buffers
79
81
  // it into a single message), not by asking codex for a non-streaming reply.
80
- stream: true,
82
+ stream: context.responsesSourceFormat === this.name ? request.stream : true,
81
83
  // `store:false` is required by the codex backend and accepted by the
82
84
  // public Responses API (which defaults to store:true). Always set it so
83
85
  // codex relays (no discoverable url token) work without configuration.
84
86
  store: false,
85
- // `max_output_tokens` is intentionally omitted: the codex backend rejects
86
- // it, and the public API falls back to its default when absent. If a
87
- // public provider ever needs it honored, gate that on an opt-out flag.
88
- ...request.temperature !== void 0 ? { temperature: request.temperature } : {}
87
+ // `max_output_tokens`: the codex backend REJECTS it, so it maps only when
88
+ // the client already speaks the Responses wire (public providers); the
89
+ // public API falls back to its default when absent.
90
+ ...request.temperature !== void 0 ? { temperature: request.temperature } : {},
91
+ // R7 (claude-api-transform-fidelity): the Responses wire HAS `top_p`, so
92
+ // the decoded hub value maps through — conditionally (absent ⇒ absent).
93
+ ...request.top_p !== void 0 ? { top_p: request.top_p } : {},
94
+ ...context.responsesSourceFormat === this.name && request.max_tokens !== void 0 ? { max_output_tokens: request.max_tokens } : {}
89
95
  };
96
+ if (request.stop !== void 0) recordDroppedField(request, "stop", "openai-responses");
97
+ if (request.top_k !== void 0) recordDroppedField(request, "top_k", "openai-responses");
98
+ if (request.metadata_user_id !== void 0) {
99
+ recordDroppedField(request, "metadata_user_id", "openai-responses");
100
+ }
90
101
  const reasoningPlan = resolveReasoningPlan({
91
102
  intent: extractReasoningIntent(request),
92
103
  model: request.model,
@@ -96,15 +107,22 @@ var OpenAIResponseTransformer = class {
96
107
  preserveNativeEffort: context.reasoningSourceFormat === this.name
97
108
  });
98
109
  if (reasoningPlan?.kind === "level" && reasoningPlan.enabled) {
99
- body.reasoning = { effort: reasoningPlan.effort, summary: "auto" };
110
+ body.reasoning = {
111
+ effort: reasoningPlan.effort,
112
+ summary: typeof context.responsesReasoningSummary === "string" ? context.responsesReasoningSummary : "auto"
113
+ };
100
114
  }
101
115
  if (request.tools?.length) {
102
- body.tools = request.tools.map((tool) => ({
116
+ body.tools = request.tools.map((tool) => codexTools?.customToolNames?.includes(tool.function.name) ? {
117
+ type: "custom",
118
+ name: tool.function.name,
119
+ description: tool.function.description
120
+ } : {
103
121
  type: "function",
104
122
  name: tool.function.name,
105
123
  description: tool.function.description,
106
124
  parameters: tool.function.parameters
107
- }));
125
+ });
108
126
  }
109
127
  if (request.tool_choice) {
110
128
  if (typeof request.tool_choice === "string") {
@@ -122,7 +140,11 @@ var OpenAIResponseTransformer = class {
122
140
  async transformRequestOut(request, context) {
123
141
  const req = request;
124
142
  const messages = [];
125
- let codexTools = null;
143
+ let codexTools = collectCodexTools({ tools: req.tools });
144
+ context.responsesSourceFormat = this.name;
145
+ if (typeof req.reasoning?.summary === "string") {
146
+ context.responsesReasoningSummary = req.reasoning.summary;
147
+ }
126
148
  const instructions = typeof req.instructions === "string" ? req.instructions.trim() : "";
127
149
  if (instructions) {
128
150
  messages.push({ role: "system", content: instructions });
@@ -133,10 +155,11 @@ var OpenAIResponseTransformer = class {
133
155
  const itemType = typeof entry.type === "string" ? entry.type : void 0;
134
156
  if (itemType && SKIPPED_INPUT_ITEM_TYPES.has(itemType)) continue;
135
157
  if (itemType === "additional_tools") {
136
- codexTools = collectCodexTools(entry);
158
+ codexTools = mergeCodexTools(codexTools, collectCodexTools(entry));
137
159
  continue;
138
160
  }
139
161
  if (itemType === "custom_tool_call_output") {
162
+ rememberCustomCall(codexTools, entry.call_id);
140
163
  messages.push({
141
164
  role: "tool",
142
165
  content: flattenContent(entry.output),
@@ -145,6 +168,7 @@ var OpenAIResponseTransformer = class {
145
168
  continue;
146
169
  }
147
170
  if (itemType === "custom_tool_call") {
171
+ rememberCustomCall(codexTools, entry.call_id ?? entry.id, entry.name);
148
172
  const toolCall = {
149
173
  id: (entry.call_id ?? entry.id) || "",
150
174
  type: "function",
@@ -172,6 +196,7 @@ var OpenAIResponseTransformer = class {
172
196
  continue;
173
197
  }
174
198
  if (itemType === "function_call") {
199
+ rememberToolNamespace(codexTools, entry.name, entry.namespace);
175
200
  const toolCall = {
176
201
  id: (entry.call_id ?? entry.id) || "",
177
202
  type: "function",
@@ -214,28 +239,17 @@ var OpenAIResponseTransformer = class {
214
239
  };
215
240
  }
216
241
  const tools = [];
217
- if (req.tools?.length) {
218
- tools.push(
219
- ...req.tools.filter((t) => t.type === "function").map((t) => ({
220
- type: "function",
221
- function: {
222
- name: t.name || "",
223
- description: t.description || "",
224
- parameters: t.parameters || {}
225
- }
226
- }))
227
- );
228
- }
229
- if (codexTools?.tools.length) {
242
+ if (codexTools.tools.length) {
230
243
  const declared = new Set(tools.map((t) => t.function.name));
231
244
  tools.push(...codexTools.tools.filter((t) => !declared.has(t.function.name)));
232
245
  }
233
246
  if (tools.length) result.tools = tools;
234
- if (codexTools?.customToolNames.length || Object.keys(codexTools?.toolNamespaces ?? {}).length) {
247
+ if (codexTools.customToolNames.length || codexTools.customToolCallIds.length || Object.keys(codexTools.toolNamespaces).length) {
235
248
  result.meta = {
236
249
  ...result.meta,
237
250
  codexTools: {
238
251
  ...codexTools.customToolNames.length ? { customToolNames: codexTools.customToolNames } : {},
252
+ ...codexTools.customToolCallIds.length ? { customToolCallIds: codexTools.customToolCallIds } : {},
239
253
  ...Object.keys(codexTools.toolNamespaces).length ? { toolNamespaces: codexTools.toolNamespaces } : {}
240
254
  }
241
255
  };
@@ -346,7 +360,12 @@ function encodeToolCallItem(callId, name, argumentsJson, status, codexTools) {
346
360
  };
347
361
  }
348
362
  function collectCodexTools(entry) {
349
- const result = { tools: [], customToolNames: [], toolNamespaces: {} };
363
+ const result = {
364
+ tools: [],
365
+ customToolNames: [],
366
+ customToolCallIds: [],
367
+ toolNamespaces: {}
368
+ };
350
369
  const visit = (declarations, namespace) => {
351
370
  if (!Array.isArray(declarations)) return;
352
371
  for (const raw of declarations) {
@@ -387,6 +406,32 @@ function collectCodexTools(entry) {
387
406
  visit(entry.tools);
388
407
  return result;
389
408
  }
409
+ function mergeCodexTools(left, right) {
410
+ const tools = [...left.tools];
411
+ const names = new Set(tools.map((tool) => tool.function.name));
412
+ for (const tool of right.tools) {
413
+ if (!names.has(tool.function.name)) tools.push(tool);
414
+ }
415
+ return {
416
+ tools,
417
+ customToolNames: [.../* @__PURE__ */ new Set([...left.customToolNames, ...right.customToolNames])],
418
+ customToolCallIds: [.../* @__PURE__ */ new Set([...left.customToolCallIds, ...right.customToolCallIds])],
419
+ toolNamespaces: { ...left.toolNamespaces, ...right.toolNamespaces }
420
+ };
421
+ }
422
+ function rememberCustomCall(state, rawCallId, rawName) {
423
+ if (typeof rawCallId === "string" && rawCallId && !state.customToolCallIds.includes(rawCallId)) {
424
+ state.customToolCallIds.push(rawCallId);
425
+ }
426
+ if (typeof rawName === "string" && rawName && !state.customToolNames.includes(rawName)) {
427
+ state.customToolNames.push(rawName);
428
+ }
429
+ }
430
+ function rememberToolNamespace(state, rawName, rawNamespace) {
431
+ if (typeof rawName === "string" && rawName && typeof rawNamespace === "string" && rawNamespace) {
432
+ state.toolNamespaces[rawName] = rawNamespace;
433
+ }
434
+ }
390
435
  function flattenContent(content) {
391
436
  if (typeof content === "string") return content;
392
437
  if (!content) return "";
@@ -613,6 +658,17 @@ function convertResponseApiStreamToOpenAI(responseApiStream) {
613
658
  finish_reason: "stop"
614
659
  }]);
615
660
  break;
661
+ case "response.failed": {
662
+ safeEnqueue(
663
+ `data: ${JSON.stringify({
664
+ error: event.response?.error ?? { message: "response.failed" }
665
+ })}
666
+
667
+ `
668
+ );
669
+ safeEnqueue("data: [DONE]\n\n");
670
+ break;
671
+ }
616
672
  default:
617
673
  break;
618
674
  }
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkRICPANBYcjs = require('./chunk-RICPANBY.cjs');
6
+ var _chunkWX2E2G7Hcjs = require('./chunk-WX2E2G7H.cjs');
7
7
 
8
8
  // src/transformer/transformers/GeminiCodeAssistTransformer.ts
9
9
  var DEFAULT_CODE_ASSIST_ENDPOINT = "https://cloudcode-pa.googleapis.com";
@@ -117,7 +117,7 @@ var GeminiCodeAssistTransformer = (_class = class {constructor() { _class.protot
117
117
  * openaiResponsesIngress). `undefined` is the valid fresh free-tier value.
118
118
  */
119
119
  async transformRequestIn(request, provider, _context) {
120
- const inner = _chunkRICPANBYcjs.buildRequestBody.call(void 0, request, provider);
120
+ const inner = _chunkWX2E2G7Hcjs.buildRequestBody.call(void 0, request, provider);
121
121
  const envelope = {
122
122
  model: request.model,
123
123
  project: provider.geminiProject,
@@ -147,7 +147,7 @@ var GeminiCodeAssistTransformer = (_class = class {constructor() { _class.protot
147
147
  if (inner && typeof inner === "object" && !("model" in inner) && "model" in r) {
148
148
  inner.model = r.model;
149
149
  }
150
- return _chunkRICPANBYcjs.transformRequestOut.call(void 0, inner);
150
+ return _chunkWX2E2G7Hcjs.transformRequestOut.call(void 0, inner);
151
151
  }
152
152
  /**
153
153
  * Code Assist response → OpenAI-compatible. PEEL the `.response` envelope from
@@ -155,7 +155,7 @@ var GeminiCodeAssistTransformer = (_class = class {constructor() { _class.protot
155
155
  */
156
156
  async transformResponseOut(response, _context) {
157
157
  const unwrapped = await unwrapCodeAssistResponse(response);
158
- return _chunkRICPANBYcjs.transformResponseOut.call(void 0, unwrapped, this.name, this.logger);
158
+ return _chunkWX2E2G7Hcjs.transformResponseOut.call(void 0, unwrapped, this.name, this.logger);
159
159
  }
160
160
  /**
161
161
  * OpenAI-compatible response → Code Assist (endpoint-encode parity). Re-wraps
@@ -164,7 +164,7 @@ var GeminiCodeAssistTransformer = (_class = class {constructor() { _class.protot
164
164
  * `transformResponseOut`'s peel.
165
165
  */
166
166
  async transformResponseIn(response, _context) {
167
- const geminiResponse = await _chunkRICPANBYcjs.transformResponseIn.call(void 0, response, this.logger);
167
+ const geminiResponse = await _chunkWX2E2G7Hcjs.transformResponseIn.call(void 0, response, this.logger);
168
168
  const contentType = _nullishCoalesce(geminiResponse.headers.get("Content-Type"), () => ( ""));
169
169
  if (contentType.includes("text/event-stream")) {
170
170
  return geminiResponse;