@omnicross/core 0.3.1 → 0.4.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 (47) hide show
  1. package/dist/auth/GeminiCodeAssistProjectResolver.cjs +3 -3
  2. package/dist/auth/GeminiCodeAssistProjectResolver.js +2 -2
  3. package/dist/{chunk-FHXDUHVE.cjs → chunk-2T6D7LWE.cjs} +1 -1
  4. package/dist/{chunk-N5Q5PBV5.js → chunk-5DJSOFEP.js} +1 -1
  5. package/dist/{chunk-STENJNJU.js → chunk-5TEWZN5J.js} +6 -6
  6. package/dist/{chunk-T55Z77BR.cjs → chunk-BKXC4XM6.cjs} +3 -3
  7. package/dist/{chunk-YVBHFVTF.js → chunk-C3NPMQTK.js} +2 -2
  8. package/dist/{chunk-HOMUGKHR.js → chunk-GTDQCW3H.js} +29 -2
  9. package/dist/{chunk-T2VIZQT4.js → chunk-HDXSPXIN.js} +1 -1
  10. package/dist/{chunk-NJS2DZE6.js → chunk-PF7YQBKX.js} +1 -1
  11. package/dist/{chunk-EY3S7NJ3.cjs → chunk-QEOV6Y4E.cjs} +58 -58
  12. package/dist/{chunk-NRYLPGQB.js → chunk-QRXOLINS.js} +3 -1
  13. package/dist/{chunk-XGVPGH7V.cjs → chunk-TX3AEV6H.cjs} +2 -2
  14. package/dist/{chunk-OIKREZVQ.cjs → chunk-TX4UCSOP.cjs} +30 -3
  15. package/dist/{chunk-AKIOOFY3.cjs → chunk-YEVWA4C7.cjs} +3 -1
  16. package/dist/{chunk-RS773ZL3.cjs → chunk-ZSA44G7J.cjs} +3 -3
  17. package/dist/completion/CompletionService.cjs +8 -8
  18. package/dist/completion/CompletionService.js +7 -7
  19. package/dist/completion.cjs +14 -8
  20. package/dist/completion.d.cts +22 -1
  21. package/dist/completion.d.ts +22 -1
  22. package/dist/completion.js +14 -8
  23. package/dist/index.cjs +14 -8
  24. package/dist/index.d.cts +1 -1
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.js +14 -8
  27. package/dist/outbound-api/routeResolver.cjs +2 -2
  28. package/dist/outbound-api/routeResolver.js +1 -1
  29. package/dist/outbound-api.cjs +8 -8
  30. package/dist/outbound-api.js +7 -7
  31. package/dist/pipeline/AccountAllowanceScheduling.cjs +3 -3
  32. package/dist/pipeline/AccountAllowanceScheduling.js +2 -2
  33. package/dist/pipeline/AccountAllowanceStore.cjs +2 -2
  34. package/dist/pipeline/AccountAllowanceStore.js +1 -1
  35. package/dist/pipeline/LlmConfigProviderAuth.cjs +2 -2
  36. package/dist/pipeline/LlmConfigProviderAuth.js +1 -1
  37. package/dist/pipeline/SubscriptionAuthSource.cjs +4 -4
  38. package/dist/pipeline/SubscriptionAuthSource.js +3 -3
  39. package/dist/pipeline/upstreamFetch.cjs +3 -3
  40. package/dist/pipeline/upstreamFetch.js +2 -2
  41. package/dist/provider-proxy/ProviderProxy.cjs +8 -8
  42. package/dist/provider-proxy/ProviderProxy.js +7 -7
  43. package/dist/provider-proxy/ingress/providerProxyShared.cjs +8 -8
  44. package/dist/provider-proxy/ingress/providerProxyShared.js +7 -7
  45. package/dist/provider-proxy.cjs +8 -8
  46. package/dist/provider-proxy.js +7 -7
  47. package/package.json +2 -2
@@ -7,9 +7,9 @@ require('../chunk-77USGNRW.cjs');
7
7
  require('../chunk-IUL4VWNU.cjs');
8
8
 
9
9
 
10
- var _chunkRS773ZL3cjs = require('../chunk-RS773ZL3.cjs');
10
+ var _chunkZSA44G7Jcjs = require('../chunk-ZSA44G7J.cjs');
11
11
  require('../chunk-235MXAGX.cjs');
12
- require('../chunk-FHXDUHVE.cjs');
12
+ require('../chunk-2T6D7LWE.cjs');
13
13
  require('../chunk-NKVZ6Z3Y.cjs');
14
14
 
15
15
  // src/auth/GeminiCodeAssistProjectResolver.ts
@@ -30,7 +30,7 @@ var GeminiCodeAssistHandshakeError = class extends Error {
30
30
  var GeminiCodeAssistProjectResolver = (_class = class {
31
31
  // upstream-proxy: the Code Assist handshake is upstream egress → honor the
32
32
  // gemini proxy by default (still injectable for tests).
33
- constructor(fetchImpl = (url, init) => _chunkRS773ZL3cjs.fetchUpstream.call(void 0, url, init, { providerId: "gemini" })) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);
33
+ constructor(fetchImpl = (url, init) => _chunkZSA44G7Jcjs.fetchUpstream.call(void 0, url, init, { providerId: "gemini" })) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);
34
34
  this.fetchImpl = fetchImpl;
35
35
  }
36
36
 
@@ -7,9 +7,9 @@ import "../chunk-WYVGULTQ.js";
7
7
  import "../chunk-ZLNHPUFA.js";
8
8
  import {
9
9
  fetchUpstream
10
- } from "../chunk-N5Q5PBV5.js";
10
+ } from "../chunk-5DJSOFEP.js";
11
11
  import "../chunk-3WD4HTR2.js";
12
- import "../chunk-NJS2DZE6.js";
12
+ import "../chunk-PF7YQBKX.js";
13
13
  import "../chunk-GL6XM527.js";
14
14
 
15
15
  // src/auth/GeminiCodeAssistProjectResolver.ts
@@ -56,7 +56,7 @@ function normalizedInstant(value) {
56
56
  return Number.isFinite(parsed) ? new Date(parsed).toISOString() : void 0;
57
57
  }
58
58
  function isAllowanceProvider(value) {
59
- return value === "claude" || value === "codex" || value === "gemini" || value === "opencodego" || value === "kimi";
59
+ return value === "claude" || value === "codex" || value === "gemini" || value === "opencodego" || value === "kimi" || value === "grok" || value === "copilot";
60
60
  }
61
61
  function isWindowState(value) {
62
62
  return value === "fresh" || value === "stale" || value === "unavailable" || value === "unsupported";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-3WD4HTR2.js";
7
7
  import {
8
8
  getSharedAccountAllowanceStore
9
- } from "./chunk-NJS2DZE6.js";
9
+ } from "./chunk-PF7YQBKX.js";
10
10
  import {
11
11
  getSharedAccountRouteActivity
12
12
  } from "./chunk-GL6XM527.js";
@@ -62,7 +62,7 @@ import {
62
62
  import {
63
63
  LlmConfigProviderAuth,
64
64
  getProviderHeaders
65
- } from "./chunk-HOMUGKHR.js";
65
+ } from "./chunk-GTDQCW3H.js";
66
66
  import {
67
67
  resolveProviderChain
68
68
  } from "./chunk-JWC6APFQ.js";
@@ -78,13 +78,13 @@ import {
78
78
  } from "./chunk-V2UKUTJ3.js";
79
79
  import {
80
80
  SubscriptionAuthSource
81
- } from "./chunk-T2VIZQT4.js";
81
+ } from "./chunk-HDXSPXIN.js";
82
82
  import {
83
83
  serializeError
84
84
  } from "./chunk-AVYJ4YBN.js";
85
85
  import {
86
86
  isAccountAllowanceExhaustedError
87
- } from "./chunk-YVBHFVTF.js";
87
+ } from "./chunk-C3NPMQTK.js";
88
88
  import {
89
89
  boundAccountSelectionMessage,
90
90
  isBoundAccountSelectionError
@@ -109,7 +109,7 @@ import {
109
109
  parseModelRef,
110
110
  resolvePrefixTarget,
111
111
  resolveRoute
112
- } from "./chunk-NRYLPGQB.js";
112
+ } from "./chunk-QRXOLINS.js";
113
113
  import {
114
114
  getSubscriptionRegistryForOutbound
115
115
  } from "./chunk-AQ5TNQB7.js";
@@ -137,10 +137,10 @@ import {
137
137
  } from "./chunk-ZLNHPUFA.js";
138
138
  import {
139
139
  fetchUpstream
140
- } from "./chunk-N5Q5PBV5.js";
140
+ } from "./chunk-5DJSOFEP.js";
141
141
  import {
142
142
  getSharedAccountAllowanceStore
143
- } from "./chunk-NJS2DZE6.js";
143
+ } from "./chunk-PF7YQBKX.js";
144
144
  import {
145
145
  getSharedAccountRouteActivity
146
146
  } from "./chunk-GL6XM527.js";
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class; var _class2;
2
2
 
3
- var _chunkFHXDUHVEcjs = require('./chunk-FHXDUHVE.cjs');
3
+ var _chunk2T6D7LWEcjs = require('./chunk-2T6D7LWE.cjs');
4
4
 
5
5
  // src/pipeline/AccountAllowanceScheduling.ts
6
6
  var DEFAULT_POLICY = {
@@ -34,7 +34,7 @@ function freshWorstWindow(snapshot) {
34
34
  return snapshot.windows.filter((window) => window.state === "fresh" && typeof window.usedPercent === "number").sort((left, right) => (_nullishCoalesce(right.usedPercent, () => ( -1))) - (_nullishCoalesce(left.usedPercent, () => ( -1))))[0];
35
35
  }
36
36
  var AccountAllowanceScheduling = (_class2 = class {
37
- constructor(store = _chunkFHXDUHVEcjs.getSharedAccountAllowanceStore.call(void 0, ), now = Date.now) {;_class2.prototype.__init3.call(this);_class2.prototype.__init4.call(this);_class2.prototype.__init5.call(this);
37
+ constructor(store = _chunk2T6D7LWEcjs.getSharedAccountAllowanceStore.call(void 0, ), now = Date.now) {;_class2.prototype.__init3.call(this);_class2.prototype.__init4.call(this);_class2.prototype.__init5.call(this);
38
38
  this.store = store;
39
39
  this.now = now;
40
40
  }
@@ -73,7 +73,7 @@ var AccountAllowanceScheduling = (_class2 = class {
73
73
  decidedAt
74
74
  };
75
75
  if (!this.config.enabled) return { ...base, action: "ignore", reason: "policy-disabled" };
76
- if (providerId !== "claude" && providerId !== "codex" && providerId !== "kimi" && providerId !== "opencodego") {
76
+ if (providerId !== "claude" && providerId !== "codex" && providerId !== "kimi" && providerId !== "opencodego" && providerId !== "grok" && providerId !== "copilot") {
77
77
  return { ...base, action: "ignore", reason: "provider-unsupported" };
78
78
  }
79
79
  const snapshot = this.store.get(providerId, accountId, now);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getSharedAccountAllowanceStore
3
- } from "./chunk-NJS2DZE6.js";
3
+ } from "./chunk-PF7YQBKX.js";
4
4
 
5
5
  // src/pipeline/AccountAllowanceScheduling.ts
6
6
  var DEFAULT_POLICY = {
@@ -73,7 +73,7 @@ var AccountAllowanceScheduling = class {
73
73
  decidedAt
74
74
  };
75
75
  if (!this.config.enabled) return { ...base, action: "ignore", reason: "policy-disabled" };
76
- if (providerId !== "claude" && providerId !== "codex" && providerId !== "kimi" && providerId !== "opencodego") {
76
+ if (providerId !== "claude" && providerId !== "codex" && providerId !== "kimi" && providerId !== "opencodego" && providerId !== "grok" && providerId !== "copilot") {
77
77
  return { ...base, action: "ignore", reason: "provider-unsupported" };
78
78
  }
79
79
  const snapshot = this.store.get(providerId, accountId, now);
@@ -45,10 +45,34 @@ function getProviderHeaders(provider, apiKey) {
45
45
  };
46
46
  break;
47
47
  }
48
+ const withExtra = mergeExtraHeaders(headers, provider.extraHeaders);
48
49
  if (isOpenRouterProvider(provider)) {
49
- return { ...headers, ...OPENROUTER_APP_HEADERS };
50
+ return { ...withExtra, ...OPENROUTER_APP_HEADERS };
50
51
  }
51
- return headers;
52
+ return withExtra;
53
+ }
54
+ function expandHeaderPlaceholder(value) {
55
+ return value.includes("{{platform}}") ? value.replaceAll("{{platform}}", process.platform) : value;
56
+ }
57
+ var EXTRA_HEADER_RESERVED_NAMES = /* @__PURE__ */ new Set([
58
+ "authorization",
59
+ "x-api-key",
60
+ "x-goog-api-key",
61
+ "api-key",
62
+ "cookie",
63
+ "content-type",
64
+ "content-length"
65
+ ]);
66
+ function mergeExtraHeaders(base, extra) {
67
+ if (!extra) return base;
68
+ const entries = Object.entries(extra);
69
+ if (entries.length === 0) return base;
70
+ const merged = { ...base };
71
+ for (const [name, value] of entries) {
72
+ if (EXTRA_HEADER_RESERVED_NAMES.has(name.toLowerCase())) continue;
73
+ merged[name] = expandHeaderPlaceholder(value);
74
+ }
75
+ return merged;
52
76
  }
53
77
 
54
78
  // src/pipeline/LlmConfigProviderAuth.ts
@@ -125,5 +149,8 @@ var LlmConfigProviderAuth = class {
125
149
 
126
150
  export {
127
151
  getProviderHeaders,
152
+ expandHeaderPlaceholder,
153
+ EXTRA_HEADER_RESERVED_NAMES,
154
+ mergeExtraHeaders,
128
155
  LlmConfigProviderAuth
129
156
  };
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-AVYJ4YBN.js";
4
4
  import {
5
5
  isAccountAllowanceExhaustedError
6
- } from "./chunk-YVBHFVTF.js";
6
+ } from "./chunk-C3NPMQTK.js";
7
7
  import {
8
8
  isBoundAccountSelectionError
9
9
  } from "./chunk-2JYRIADS.js";
@@ -56,7 +56,7 @@ function normalizedInstant(value) {
56
56
  return Number.isFinite(parsed) ? new Date(parsed).toISOString() : void 0;
57
57
  }
58
58
  function isAllowanceProvider(value) {
59
- return value === "claude" || value === "codex" || value === "gemini" || value === "opencodego" || value === "kimi";
59
+ return value === "claude" || value === "codex" || value === "gemini" || value === "opencodego" || value === "kimi" || value === "grok" || value === "copilot";
60
60
  }
61
61
  function isWindowState(value) {
62
62
  return value === "fresh" || value === "stale" || value === "unavailable" || value === "unsupported";