@omnicross/core 0.4.2 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/auth/GeminiCodeAssistProjectResolver.cjs +11 -184
  2. package/dist/auth/GeminiCodeAssistProjectResolver.d.cts +41 -3
  3. package/dist/auth/GeminiCodeAssistProjectResolver.d.ts +41 -3
  4. package/dist/auth/GeminiCodeAssistProjectResolver.js +12 -185
  5. package/dist/{chunk-POUTD5AM.cjs → chunk-47E3I5PF.cjs} +10 -3
  6. package/dist/chunk-4LSZ7NFM.js +50 -0
  7. package/dist/{chunk-WX2E2G7H.cjs → chunk-4NAMH4UE.cjs} +79 -51
  8. package/dist/{chunk-LQYS2N47.js → chunk-4RM22ETG.js} +14 -2
  9. package/dist/{chunk-YEVWA4C7.cjs → chunk-57Y2EA2G.cjs} +6 -5
  10. package/dist/chunk-6I4SAWCN.js +24 -0
  11. package/dist/{chunk-KIQ2HA2A.cjs → chunk-BTSADEX4.cjs} +5 -5
  12. package/dist/chunk-CGEZQC2G.cjs +67 -0
  13. package/dist/chunk-E5RCCGE7.cjs +95 -0
  14. package/dist/chunk-EE7VP4O3.js +230 -0
  15. package/dist/chunk-F6P4DIBL.js +95 -0
  16. package/dist/{chunk-BKXC4XM6.cjs → chunk-FORICQ5U.cjs} +15 -11
  17. package/dist/{chunk-PF7YQBKX.js → chunk-FYPKKMB3.js} +6 -2
  18. package/dist/chunk-GWC7HCZI.cjs +44 -0
  19. package/dist/{chunk-LFEH7CEO.js → chunk-IDPMD4B7.js} +22 -0
  20. package/dist/{chunk-UPQIWJIE.cjs → chunk-INY54AYX.cjs} +14 -2
  21. package/dist/{chunk-C3NPMQTK.js → chunk-JHJRZ75C.js} +14 -10
  22. package/dist/chunk-K6J2RIEX.js +67 -0
  23. package/dist/chunk-KSMK45RD.cjs +45 -0
  24. package/dist/chunk-LL3MZ7O5.cjs +24 -0
  25. package/dist/{chunk-PAXJGABW.js → chunk-MPFOC7AT.js} +10 -5
  26. package/dist/{chunk-DKBXDV5U.cjs → chunk-N3MGNLCU.cjs} +49 -44
  27. package/dist/chunk-NCZDUBC2.js +44 -0
  28. package/dist/chunk-NDIBVTBZ.cjs +230 -0
  29. package/dist/{chunk-5DJSOFEP.js → chunk-NTF7TLT7.js} +1 -1
  30. package/dist/chunk-ONTTXSRL.js +32 -0
  31. package/dist/{chunk-HN74IGEO.js → chunk-OXBGNEYR.js} +1 -1
  32. package/dist/{chunk-5GXOYVLB.js → chunk-QSOHEDKO.js} +44 -39
  33. package/dist/{chunk-QEOV6Y4E.cjs → chunk-RX3BCX53.cjs} +359 -170
  34. package/dist/{chunk-TX3AEV6H.cjs → chunk-RXMF7GNF.cjs} +4 -3
  35. package/dist/chunk-SQU2FGXI.cjs +50 -0
  36. package/dist/{chunk-EUZRH544.js → chunk-TKZ3DZS5.js} +10 -3
  37. package/dist/{chunk-MXI2PWIC.cjs → chunk-UKQHBK4Q.cjs} +1 -32
  38. package/dist/{chunk-3XVDFRCQ.cjs → chunk-UOOLU64V.cjs} +13 -8
  39. package/dist/{chunk-ZSA44G7J.cjs → chunk-VFFCV4J6.cjs} +3 -3
  40. package/dist/{chunk-6DDYNS2B.cjs → chunk-VGBJPHHD.cjs} +36 -14
  41. package/dist/{chunk-2T6D7LWE.cjs → chunk-VYOBVPNB.cjs} +6 -2
  42. package/dist/chunk-X6GHTNDL.cjs +482 -0
  43. package/dist/chunk-XBQTVRMK.js +45 -0
  44. package/dist/{chunk-R4VCO2CB.js → chunk-YEHQ5FXZ.js} +28 -0
  45. package/dist/{chunk-5TEWZN5J.js → chunk-YV4JSBPA.js} +278 -89
  46. package/dist/{chunk-HDXSPXIN.js → chunk-ZBDDPWVQ.js} +4 -3
  47. package/dist/chunk-ZJJBITUN.js +482 -0
  48. package/dist/{chunk-QRXOLINS.js → chunk-ZMERU7D3.js} +3 -2
  49. package/dist/completion/CompletionService.cjs +29 -22
  50. package/dist/completion/CompletionService.js +28 -21
  51. package/dist/completion.cjs +29 -22
  52. package/dist/completion.js +28 -21
  53. package/dist/image-generation.cjs +2 -2
  54. package/dist/image-generation.d.cts +2 -2
  55. package/dist/image-generation.d.ts +2 -2
  56. package/dist/image-generation.js +1 -1
  57. package/dist/index.cjs +40 -29
  58. package/dist/index.d.cts +6 -3
  59. package/dist/index.d.ts +6 -3
  60. package/dist/index.js +40 -29
  61. package/dist/outbound-api/routeResolver.cjs +3 -3
  62. package/dist/outbound-api/routeResolver.d.cts +3 -3
  63. package/dist/outbound-api/routeResolver.d.ts +3 -3
  64. package/dist/outbound-api/routeResolver.js +2 -2
  65. package/dist/outbound-api/types.cjs +6 -2
  66. package/dist/outbound-api/types.d.cts +2 -2
  67. package/dist/outbound-api/types.d.ts +2 -2
  68. package/dist/outbound-api/types.js +7 -3
  69. package/dist/outbound-api.cjs +33 -22
  70. package/dist/outbound-api.d.cts +4 -4
  71. package/dist/outbound-api.d.ts +4 -4
  72. package/dist/outbound-api.js +33 -22
  73. package/dist/pipeline/AccountAllowanceScheduling.cjs +4 -3
  74. package/dist/pipeline/AccountAllowanceScheduling.d.cts +4 -4
  75. package/dist/pipeline/AccountAllowanceScheduling.d.ts +4 -4
  76. package/dist/pipeline/AccountAllowanceScheduling.js +3 -2
  77. package/dist/pipeline/AccountAllowanceStore.cjs +2 -2
  78. package/dist/pipeline/AccountAllowanceStore.js +1 -1
  79. package/dist/pipeline/AuthSource.d.cts +6 -0
  80. package/dist/pipeline/AuthSource.d.ts +6 -0
  81. package/dist/pipeline/SubscriptionAuthSource.cjs +5 -4
  82. package/dist/pipeline/SubscriptionAuthSource.js +4 -3
  83. package/dist/pipeline/SubscriptionAuthStrategy.d.cts +7 -0
  84. package/dist/pipeline/SubscriptionAuthStrategy.d.ts +7 -0
  85. package/dist/pipeline/antigravityQuotaFamily.cjs +16 -0
  86. package/dist/pipeline/antigravityQuotaFamily.d.cts +52 -0
  87. package/dist/pipeline/antigravityQuotaFamily.d.ts +52 -0
  88. package/dist/pipeline/antigravityQuotaFamily.js +16 -0
  89. package/dist/pipeline/upstreamFetch.cjs +3 -3
  90. package/dist/pipeline/upstreamFetch.js +2 -2
  91. package/dist/ports.d.cts +2 -2
  92. package/dist/ports.d.ts +2 -2
  93. package/dist/provider-proxy/ProviderProxy.cjs +29 -22
  94. package/dist/provider-proxy/ProviderProxy.js +28 -21
  95. package/dist/provider-proxy/identity/codexCliHeaders.cjs +8 -2
  96. package/dist/provider-proxy/identity/codexCliHeaders.d.cts +36 -7
  97. package/dist/provider-proxy/identity/codexCliHeaders.d.ts +36 -7
  98. package/dist/provider-proxy/identity/codexCliHeaders.js +7 -1
  99. package/dist/provider-proxy/identity/openCodeGoHeaders.cjs +17 -0
  100. package/dist/provider-proxy/identity/openCodeGoHeaders.d.cts +71 -0
  101. package/dist/provider-proxy/identity/openCodeGoHeaders.d.ts +71 -0
  102. package/dist/provider-proxy/identity/openCodeGoHeaders.js +17 -0
  103. package/dist/provider-proxy/ingress/providerProxyShared.cjs +29 -22
  104. package/dist/provider-proxy/ingress/providerProxyShared.js +28 -21
  105. package/dist/provider-proxy.cjs +29 -22
  106. package/dist/provider-proxy.d.cts +2 -2
  107. package/dist/provider-proxy.d.ts +2 -2
  108. package/dist/provider-proxy.js +28 -21
  109. package/dist/{routeResolver-STwMz_G4.d.ts → routeResolver-BLTleO4H.d.ts} +1 -1
  110. package/dist/{routeResolver-Da0yvkL1.d.cts → routeResolver-C2z0pp-q.d.cts} +1 -1
  111. package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.cjs +2 -2
  112. package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.js +1 -1
  113. package/dist/transformer/transformers/AnthropicTransformer.cjs +3 -3
  114. package/dist/transformer/transformers/AnthropicTransformer.js +2 -2
  115. package/dist/transformer/transformers/AntigravityTransformer.cjs +31 -0
  116. package/dist/transformer/transformers/AntigravityTransformer.d.cts +104 -0
  117. package/dist/transformer/transformers/AntigravityTransformer.d.ts +104 -0
  118. package/dist/transformer/transformers/AntigravityTransformer.js +31 -0
  119. package/dist/transformer/transformers/GeminiCodeAssistTransformer.cjs +3 -3
  120. package/dist/transformer/transformers/GeminiCodeAssistTransformer.d.cts +2 -1
  121. package/dist/transformer/transformers/GeminiCodeAssistTransformer.d.ts +2 -1
  122. package/dist/transformer/transformers/GeminiCodeAssistTransformer.js +2 -2
  123. package/dist/transformer/transformers/GeminiTransformer.cjs +3 -3
  124. package/dist/transformer/transformers/GeminiTransformer.js +2 -2
  125. package/dist/transformer/transformers/antigravityFailover.cjs +30 -0
  126. package/dist/transformer/transformers/antigravityFailover.d.cts +52 -0
  127. package/dist/transformer/transformers/antigravityFailover.d.ts +52 -0
  128. package/dist/transformer/transformers/antigravityFailover.js +30 -0
  129. package/dist/transformer/transformers/antigravityIdentity.cjs +24 -0
  130. package/dist/transformer/transformers/antigravityIdentity.d.cts +76 -0
  131. package/dist/transformer/transformers/antigravityIdentity.d.ts +76 -0
  132. package/dist/transformer/transformers/antigravityIdentity.js +24 -0
  133. package/dist/transformer/transformers.cjs +61 -9
  134. package/dist/transformer/transformers.d.cts +7 -2
  135. package/dist/transformer/transformers.d.ts +7 -2
  136. package/dist/transformer/transformers.js +61 -9
  137. package/dist/transformer/types.d.cts +11 -0
  138. package/dist/transformer/types.d.ts +11 -0
  139. package/dist/transformer.cjs +21 -12
  140. package/dist/transformer.d.cts +3 -0
  141. package/dist/transformer.d.ts +3 -0
  142. package/dist/transformer.js +20 -11
  143. package/dist/{types-Be-yt_6T.d.cts → types-BVwJQ9ZS.d.cts} +3 -0
  144. package/dist/{types-D-oHYusb.d.cts → types-C6m-Db26.d.cts} +25 -4
  145. package/dist/{types-Dvlpjn0d.d.ts → types-Da735j2d.d.ts} +25 -4
  146. package/dist/{types-Dm4_36V4.d.ts → types-VAHRysdP.d.ts} +3 -0
  147. package/package.json +2 -2
  148. package/dist/chunk-4IH4EL7M.cjs +0 -9
  149. package/dist/chunk-ECZ3ZE2C.js +0 -63
  150. package/dist/chunk-XEKD23J5.js +0 -9
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-3WD4HTR2.js";
7
7
  import {
8
8
  getSharedAccountAllowanceStore
9
- } from "./chunk-PF7YQBKX.js";
9
+ } from "./chunk-FYPKKMB3.js";
10
10
  import {
11
11
  getSharedAccountRouteActivity
12
12
  } from "./chunk-GL6XM527.js";
@@ -0,0 +1,32 @@
1
+ // src/provider-proxy/identity/headerMerge.ts
2
+ function fillMissingHeaders(headers, source) {
3
+ const present = new Set(Object.keys(headers).map((k) => k.toLowerCase()));
4
+ for (const [key, value] of Object.entries(source)) {
5
+ const lower = key.toLowerCase();
6
+ if (present.has(lower)) continue;
7
+ headers[lower] = value;
8
+ present.add(lower);
9
+ }
10
+ }
11
+ function flattenHeaderValue(raw) {
12
+ if (raw === void 0) return void 0;
13
+ const value = Array.isArray(raw) ? raw.filter((v) => typeof v === "string").join(", ") : raw;
14
+ return typeof value === "string" && value.length > 0 ? value : void 0;
15
+ }
16
+ var NEVER_FORWARD_HEADERS = /* @__PURE__ */ new Set([
17
+ "authorization",
18
+ "x-api-key",
19
+ "cookie",
20
+ "proxy-authorization",
21
+ "host",
22
+ "connection",
23
+ "content-length",
24
+ "content-type",
25
+ "accept-encoding"
26
+ ]);
27
+
28
+ export {
29
+ fillMissingHeaders,
30
+ flattenHeaderValue,
31
+ NEVER_FORWARD_HEADERS
32
+ };
@@ -3,7 +3,7 @@ import {
3
3
  transformRequestOut,
4
4
  transformResponseIn,
5
5
  transformResponseOut
6
- } from "./chunk-R4VCO2CB.js";
6
+ } from "./chunk-YEHQ5FXZ.js";
7
7
 
8
8
  // src/transformer/transformers/GeminiTransformer.ts
9
9
  var GeminiTransformer = class {
@@ -3,48 +3,16 @@ import {
3
3
  transformRequestOut,
4
4
  transformResponseIn,
5
5
  transformResponseOut
6
- } from "./chunk-R4VCO2CB.js";
6
+ } from "./chunk-YEHQ5FXZ.js";
7
7
 
8
- // src/transformer/transformers/GeminiCodeAssistTransformer.ts
9
- var DEFAULT_CODE_ASSIST_ENDPOINT = "https://cloudcode-pa.googleapis.com";
10
- var DEFAULT_CODE_ASSIST_API_VERSION = "v1internal";
11
- function resolveCodeAssistEndpoint() {
12
- return (process.env.CODE_ASSIST_ENDPOINT || DEFAULT_CODE_ASSIST_ENDPOINT).replace(/\/+$/, "");
13
- }
14
- function resolveCodeAssistApiVersion() {
15
- return process.env.CODE_ASSIST_API_VERSION || DEFAULT_CODE_ASSIST_API_VERSION;
16
- }
17
- var DEFAULT_GEMINI_CLI_VERSION = "0.46.0";
18
- function getGeminiCliUserAgent(modelId = "gemini-3.1-pro-preview") {
19
- const version = process.env.GEMINI_CLI_VERSION || DEFAULT_GEMINI_CLI_VERSION;
20
- const platform = process.platform === "win32" ? "win32" : process.platform;
21
- const arch = process.arch === "x64" ? "x64" : process.arch;
22
- return `GeminiCLI/${version}/${modelId} (${platform}; ${arch}; terminal)`;
23
- }
24
- function getGeminiCliIdentityHeaders(modelId) {
25
- return {
26
- "User-Agent": getGeminiCliUserAgent(modelId),
27
- "Client-Metadata": "ideType=IDE_UNSPECIFIED,platform=PLATFORM_UNSPECIFIED,pluginType=GEMINI"
28
- };
29
- }
30
- function buildCodeAssistUrl(stream) {
31
- const base = resolveCodeAssistEndpoint();
32
- const version = resolveCodeAssistApiVersion();
33
- const method = stream ? "streamGenerateContent?alt=sse" : "generateContent";
34
- return `${base}/${version}:${method}`;
35
- }
36
- function generateUserPromptId() {
37
- const c = globalThis.crypto;
38
- if (c?.randomUUID) return c.randomUUID();
39
- return `omnicross-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
40
- }
41
- function peelResponseEnvelope(parsed) {
8
+ // src/transformer/transformers/ccaEnvelope.ts
9
+ function peelCcaResponseEnvelope(parsed) {
42
10
  if (parsed && typeof parsed === "object" && "response" in parsed) {
43
11
  return parsed.response;
44
12
  }
45
13
  return parsed;
46
14
  }
47
- async function unwrapCodeAssistResponse(response) {
15
+ async function unwrapCcaResponse(response) {
48
16
  const contentType = response.headers.get("Content-Type") ?? "";
49
17
  if (contentType.includes("stream") || contentType.includes("text/event-stream")) {
50
18
  const sourceBody = response.body;
@@ -69,7 +37,7 @@ async function unwrapCodeAssistResponse(response) {
69
37
  }
70
38
  try {
71
39
  const parsed = JSON.parse(payload);
72
- const inner2 = peelResponseEnvelope(parsed);
40
+ const inner2 = peelCcaResponseEnvelope(parsed);
73
41
  controller.enqueue(encoder.encode(`data: ${JSON.stringify(inner2)}
74
42
  `));
75
43
  } catch {
@@ -103,13 +71,48 @@ async function unwrapCodeAssistResponse(response) {
103
71
  });
104
72
  }
105
73
  const raw = await response.json().catch(() => null);
106
- const inner = peelResponseEnvelope(raw);
74
+ const inner = peelCcaResponseEnvelope(raw);
107
75
  return new Response(JSON.stringify(inner), {
108
76
  status: response.status,
109
77
  statusText: response.statusText,
110
78
  headers: response.headers
111
79
  });
112
80
  }
81
+ function buildCcaMethodUrl(base, version, stream) {
82
+ const method = stream ? "streamGenerateContent?alt=sse" : "generateContent";
83
+ return `${base}/${version}:${method}`;
84
+ }
85
+
86
+ // src/transformer/transformers/GeminiCodeAssistTransformer.ts
87
+ var DEFAULT_CODE_ASSIST_ENDPOINT = "https://cloudcode-pa.googleapis.com";
88
+ var DEFAULT_CODE_ASSIST_API_VERSION = "v1internal";
89
+ function resolveCodeAssistEndpoint() {
90
+ return (process.env.CODE_ASSIST_ENDPOINT || DEFAULT_CODE_ASSIST_ENDPOINT).replace(/\/+$/, "");
91
+ }
92
+ function resolveCodeAssistApiVersion() {
93
+ return process.env.CODE_ASSIST_API_VERSION || DEFAULT_CODE_ASSIST_API_VERSION;
94
+ }
95
+ var DEFAULT_GEMINI_CLI_VERSION = "0.46.0";
96
+ function getGeminiCliUserAgent(modelId = "gemini-3.1-pro-preview") {
97
+ const version = process.env.GEMINI_CLI_VERSION || DEFAULT_GEMINI_CLI_VERSION;
98
+ const platform = process.platform === "win32" ? "win32" : process.platform;
99
+ const arch = process.arch === "x64" ? "x64" : process.arch;
100
+ return `GeminiCLI/${version}/${modelId} (${platform}; ${arch}; terminal)`;
101
+ }
102
+ function getGeminiCliIdentityHeaders(modelId) {
103
+ return {
104
+ "User-Agent": getGeminiCliUserAgent(modelId),
105
+ "Client-Metadata": "ideType=IDE_UNSPECIFIED,platform=PLATFORM_UNSPECIFIED,pluginType=GEMINI"
106
+ };
107
+ }
108
+ function buildCodeAssistUrl(stream) {
109
+ return buildCcaMethodUrl(resolveCodeAssistEndpoint(), resolveCodeAssistApiVersion(), stream);
110
+ }
111
+ function generateUserPromptId() {
112
+ const c = globalThis.crypto;
113
+ if (c?.randomUUID) return c.randomUUID();
114
+ return `omnicross-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
115
+ }
113
116
  var GeminiCodeAssistTransformer = class {
114
117
  static TransformerName = "gemini-code-assist";
115
118
  name = "gemini-code-assist";
@@ -168,7 +171,7 @@ var GeminiCodeAssistTransformer = class {
168
171
  * the body / each SSE chunk, then DELEGATE to the existing gemini parser.
169
172
  */
170
173
  async transformResponseOut(response, _context) {
171
- const unwrapped = await unwrapCodeAssistResponse(response);
174
+ const unwrapped = await unwrapCcaResponse(response);
172
175
  return transformResponseOut(unwrapped, this.name, this.logger);
173
176
  }
174
177
  /**
@@ -193,6 +196,8 @@ var GeminiCodeAssistTransformer = class {
193
196
  };
194
197
 
195
198
  export {
199
+ unwrapCcaResponse,
200
+ buildCcaMethodUrl,
196
201
  resolveCodeAssistEndpoint,
197
202
  resolveCodeAssistApiVersion,
198
203
  getGeminiCliUserAgent,