@omnicross/core 0.1.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 (114) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +57 -0
  3. package/README.md +15 -0
  4. package/dist/ApiKeyPoolService-BmMkau07.d.cts +170 -0
  5. package/dist/ApiKeyPoolService-BmMkau07.d.ts +170 -0
  6. package/dist/ProviderProxy-f_8ziIhW.d.cts +120 -0
  7. package/dist/ProviderProxy-vjt8sQQk.d.ts +120 -0
  8. package/dist/SubscriptionAuthSource-Cr4fVEYY.d.cts +264 -0
  9. package/dist/SubscriptionAuthSource-D89zmiSS.d.ts +264 -0
  10. package/dist/auth/GeminiCodeAssistProjectResolver.cjs +218 -0
  11. package/dist/auth/GeminiCodeAssistProjectResolver.d.cts +68 -0
  12. package/dist/auth/GeminiCodeAssistProjectResolver.d.ts +68 -0
  13. package/dist/auth/GeminiCodeAssistProjectResolver.js +189 -0
  14. package/dist/completion/ApiKeyPoolService.cjs +331 -0
  15. package/dist/completion/ApiKeyPoolService.d.cts +2 -0
  16. package/dist/completion/ApiKeyPoolService.d.ts +2 -0
  17. package/dist/completion/ApiKeyPoolService.js +306 -0
  18. package/dist/completion.cjs +4027 -0
  19. package/dist/completion.d.cts +17 -0
  20. package/dist/completion.d.ts +17 -0
  21. package/dist/completion.js +3983 -0
  22. package/dist/index-BTSmc9Sm.d.ts +645 -0
  23. package/dist/index-DXazdTzZ.d.cts +645 -0
  24. package/dist/index.cjs +10428 -0
  25. package/dist/index.d.cts +128 -0
  26. package/dist/index.d.ts +128 -0
  27. package/dist/index.js +10339 -0
  28. package/dist/outbound-api/subscriptionRegistryPort.cjs +38 -0
  29. package/dist/outbound-api/subscriptionRegistryPort.d.cts +73 -0
  30. package/dist/outbound-api/subscriptionRegistryPort.d.ts +73 -0
  31. package/dist/outbound-api/subscriptionRegistryPort.js +12 -0
  32. package/dist/outbound-api.cjs +5264 -0
  33. package/dist/outbound-api.d.cts +320 -0
  34. package/dist/outbound-api.d.ts +320 -0
  35. package/dist/outbound-api.js +5218 -0
  36. package/dist/pipeline/SubscriptionAuthSource.cjs +131 -0
  37. package/dist/pipeline/SubscriptionAuthSource.d.cts +3 -0
  38. package/dist/pipeline/SubscriptionAuthSource.d.ts +3 -0
  39. package/dist/pipeline/SubscriptionAuthSource.js +103 -0
  40. package/dist/pipeline/SubscriptionAuthStrategy.cjs +18 -0
  41. package/dist/pipeline/SubscriptionAuthStrategy.d.cts +61 -0
  42. package/dist/pipeline/SubscriptionAuthStrategy.d.ts +61 -0
  43. package/dist/pipeline/SubscriptionAuthStrategy.js +0 -0
  44. package/dist/ports/gemini-code-assist-resolver.cjs +38 -0
  45. package/dist/ports/gemini-code-assist-resolver.d.cts +26 -0
  46. package/dist/ports/gemini-code-assist-resolver.d.ts +26 -0
  47. package/dist/ports/gemini-code-assist-resolver.js +12 -0
  48. package/dist/ports.cjs +18 -0
  49. package/dist/ports.d.cts +15 -0
  50. package/dist/ports.d.ts +15 -0
  51. package/dist/ports.js +0 -0
  52. package/dist/provider-proxy/ingress/providerProxyShared.cjs +2958 -0
  53. package/dist/provider-proxy/ingress/providerProxyShared.d.cts +77 -0
  54. package/dist/provider-proxy/ingress/providerProxyShared.d.ts +77 -0
  55. package/dist/provider-proxy/ingress/providerProxyShared.js +2925 -0
  56. package/dist/provider-proxy/matchText.cjs +73 -0
  57. package/dist/provider-proxy/matchText.d.cts +47 -0
  58. package/dist/provider-proxy/matchText.d.ts +47 -0
  59. package/dist/provider-proxy/matchText.js +45 -0
  60. package/dist/provider-proxy/types.cjs +18 -0
  61. package/dist/provider-proxy/types.d.cts +12 -0
  62. package/dist/provider-proxy/types.d.ts +12 -0
  63. package/dist/provider-proxy/types.js +0 -0
  64. package/dist/provider-proxy.cjs +4667 -0
  65. package/dist/provider-proxy.d.cts +69 -0
  66. package/dist/provider-proxy.d.ts +69 -0
  67. package/dist/provider-proxy.js +4636 -0
  68. package/dist/serializeError.cjs +82 -0
  69. package/dist/serializeError.d.cts +24 -0
  70. package/dist/serializeError.d.ts +24 -0
  71. package/dist/serializeError.js +57 -0
  72. package/dist/sse-parser.cjs +456 -0
  73. package/dist/sse-parser.d.cts +143 -0
  74. package/dist/sse-parser.d.ts +143 -0
  75. package/dist/sse-parser.js +430 -0
  76. package/dist/transformer/TransformerChainExecutor.cjs +321 -0
  77. package/dist/transformer/TransformerChainExecutor.d.cts +104 -0
  78. package/dist/transformer/TransformerChainExecutor.d.ts +104 -0
  79. package/dist/transformer/TransformerChainExecutor.js +294 -0
  80. package/dist/transformer/TransformerService.cjs +290 -0
  81. package/dist/transformer/TransformerService.d.cts +138 -0
  82. package/dist/transformer/TransformerService.d.ts +138 -0
  83. package/dist/transformer/TransformerService.js +265 -0
  84. package/dist/transformer/transformers/GeminiCodeAssistTransformer.cjs +1115 -0
  85. package/dist/transformer/transformers/GeminiCodeAssistTransformer.d.cts +102 -0
  86. package/dist/transformer/transformers/GeminiCodeAssistTransformer.d.ts +102 -0
  87. package/dist/transformer/transformers/GeminiCodeAssistTransformer.js +1085 -0
  88. package/dist/transformer/transformers/GeminiTransformer.cjs +1013 -0
  89. package/dist/transformer/transformers/GeminiTransformer.d.cts +70 -0
  90. package/dist/transformer/transformers/GeminiTransformer.d.ts +70 -0
  91. package/dist/transformer/transformers/GeminiTransformer.js +986 -0
  92. package/dist/transformer/transformers/OpenAIResponseTransformer.cjs +538 -0
  93. package/dist/transformer/transformers/OpenAIResponseTransformer.d.cts +53 -0
  94. package/dist/transformer/transformers/OpenAIResponseTransformer.d.ts +53 -0
  95. package/dist/transformer/transformers/OpenAIResponseTransformer.js +513 -0
  96. package/dist/transformer/transformers/OpenCodeGoTransformer.cjs +73 -0
  97. package/dist/transformer/transformers/OpenCodeGoTransformer.d.cts +51 -0
  98. package/dist/transformer/transformers/OpenCodeGoTransformer.d.ts +51 -0
  99. package/dist/transformer/transformers/OpenCodeGoTransformer.js +48 -0
  100. package/dist/transformer/types.cjs +18 -0
  101. package/dist/transformer/types.d.cts +405 -0
  102. package/dist/transformer/types.d.ts +405 -0
  103. package/dist/transformer/types.js +0 -0
  104. package/dist/transformer.cjs +3736 -0
  105. package/dist/transformer.d.cts +33 -0
  106. package/dist/transformer.d.ts +33 -0
  107. package/dist/transformer.js +3712 -0
  108. package/dist/types-CGGrKqC_.d.cts +142 -0
  109. package/dist/types-CbCN2NQP.d.ts +142 -0
  110. package/dist/types-DCzHkhJt.d.ts +467 -0
  111. package/dist/types-DZIQbgp0.d.cts +467 -0
  112. package/dist/usage-event-sink-BX7FE1NL.d.cts +59 -0
  113. package/dist/usage-event-sink-BX7FE1NL.d.ts +59 -0
  114. package/package.json +62 -0
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/outbound-api/subscriptionRegistryPort.ts
21
+ var subscriptionRegistryPort_exports = {};
22
+ __export(subscriptionRegistryPort_exports, {
23
+ getSubscriptionRegistryForOutbound: () => getSubscriptionRegistryForOutbound,
24
+ setSubscriptionRegistryForOutbound: () => setSubscriptionRegistryForOutbound
25
+ });
26
+ module.exports = __toCommonJS(subscriptionRegistryPort_exports);
27
+ var _registry = null;
28
+ function setSubscriptionRegistryForOutbound(registry) {
29
+ _registry = registry;
30
+ }
31
+ function getSubscriptionRegistryForOutbound() {
32
+ return _registry;
33
+ }
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ getSubscriptionRegistryForOutbound,
37
+ setSubscriptionRegistryForOutbound
38
+ });
@@ -0,0 +1,73 @@
1
+ import { S as SubscriptionDispatchProfile } from '../types-DZIQbgp0.cjs';
2
+ import 'node:http';
3
+ import '@omnicross/contracts/completion-types';
4
+ import '@omnicross/contracts/subscription-types';
5
+ import '@omnicross/contracts/usage-types';
6
+ import '../ApiKeyPoolService-BmMkau07.cjs';
7
+ import '@omnicross/contracts/llm-config';
8
+ import '../SubscriptionAuthSource-Cr4fVEYY.cjs';
9
+ import '../pipeline/SubscriptionAuthStrategy.cjs';
10
+ import '../transformer/types.cjs';
11
+ import '../transformer/TransformerService.cjs';
12
+ import '@omnicross/contracts/websearch-types';
13
+
14
+ /**
15
+ * subscriptionRegistryPort — the serving-core seam for subscription dispatch
16
+ * profile lookups used by the outbound API server.
17
+ *
18
+ * `routeResolver` + `subscriptionSupport` need to ask "is this provider id
19
+ * subscription-backed, and what is its dispatch profile?". That answer lives in
20
+ * the `SubscriptionProviderRegistry` one layer up (the subscriptions package).
21
+ * Importing that registry UP from core is a layering inversion, so this
22
+ * module exposes a NARROW port (`SubscriptionRegistryLike`) + a module-level
23
+ * slot fed at bootstrap FROM that registry.
24
+ *
25
+ * The slot mirrors the registry's own `setSubscriptionProviderRegistry` global
26
+ * pattern; bootstrap copies the registry into this serving-core slot once at
27
+ * startup (correct direction). The upstream global stays alive so the existing
28
+ * test wiring (which calls `setSubscriptionProviderRegistry`) is unchanged —
29
+ * those tests feed the upstream global, and the bootstrap path feeds this
30
+ * slot.
31
+ *
32
+ * @module outbound-api/subscriptionRegistryPort
33
+ */
34
+
35
+ /**
36
+ * The narrow surface `routeResolver` / `subscriptionSupport` use — the
37
+ * `getProfile` lookup plus an OPTIONAL per-account OpenCodeGo config reader. A
38
+ * `null` `getProfile` return means "unknown id; fall back to the legacy LLM
39
+ * provider DB lookup" (same contract as the upstream registry's `getProfile`).
40
+ */
41
+ interface SubscriptionRegistryLike {
42
+ getProfile(providerId: string): SubscriptionDispatchProfile | null;
43
+ /**
44
+ * OPTIONAL — read the currently-stored per-account OpenCodeGo config so the
45
+ * route resolver can stamp it OPAQUELY onto `RouteContext.subscriptionConfig`
46
+ * for the built-in `/v1/messages` plan builder.
47
+ *
48
+ * Core returns `unknown` ON PURPOSE: it must NEVER name the concrete
49
+ * `OpenCodeGoTokenConfig` type from `@omnicross/subscriptions` (the cross-layer
50
+ * litmus stays 0). The registry's concrete
51
+ * `getOpenCodeGoConfig(): Promise<OpenCodeGoTokenConfig | undefined>` is
52
+ * structurally ASSIGNABLE to `() => Promise<unknown>`, so the registry
53
+ * satisfies this slot without any cast.
54
+ *
55
+ * Optional so BYO-only test registries / gemini-resolver-style narrow fakes
56
+ * (which only implement `getProfile`) still satisfy the port — a missing getter
57
+ * leaves `route.subscriptionConfig` `undefined`.
58
+ */
59
+ getOpenCodeGoConfig?(): Promise<unknown>;
60
+ }
61
+ /**
62
+ * Inject the subscription registry the outbound layer resolves through. Called
63
+ * once at bootstrap with the upstream `getSubscriptionProviderRegistry()`
64
+ * result. Idempotent — last write wins.
65
+ */
66
+ declare function setSubscriptionRegistryForOutbound(registry: SubscriptionRegistryLike | null): void;
67
+ /**
68
+ * Read the injected subscription registry, or `null` when none has been wired
69
+ * (e.g. before bootstrap, or in unit tests that exercise only BYO routes).
70
+ */
71
+ declare function getSubscriptionRegistryForOutbound(): SubscriptionRegistryLike | null;
72
+
73
+ export { type SubscriptionRegistryLike, getSubscriptionRegistryForOutbound, setSubscriptionRegistryForOutbound };
@@ -0,0 +1,73 @@
1
+ import { S as SubscriptionDispatchProfile } from '../types-DCzHkhJt.js';
2
+ import 'node:http';
3
+ import '@omnicross/contracts/completion-types';
4
+ import '@omnicross/contracts/subscription-types';
5
+ import '@omnicross/contracts/usage-types';
6
+ import '../ApiKeyPoolService-BmMkau07.js';
7
+ import '@omnicross/contracts/llm-config';
8
+ import '../SubscriptionAuthSource-D89zmiSS.js';
9
+ import '../pipeline/SubscriptionAuthStrategy.js';
10
+ import '../transformer/types.js';
11
+ import '../transformer/TransformerService.js';
12
+ import '@omnicross/contracts/websearch-types';
13
+
14
+ /**
15
+ * subscriptionRegistryPort — the serving-core seam for subscription dispatch
16
+ * profile lookups used by the outbound API server.
17
+ *
18
+ * `routeResolver` + `subscriptionSupport` need to ask "is this provider id
19
+ * subscription-backed, and what is its dispatch profile?". That answer lives in
20
+ * the `SubscriptionProviderRegistry` one layer up (the subscriptions package).
21
+ * Importing that registry UP from core is a layering inversion, so this
22
+ * module exposes a NARROW port (`SubscriptionRegistryLike`) + a module-level
23
+ * slot fed at bootstrap FROM that registry.
24
+ *
25
+ * The slot mirrors the registry's own `setSubscriptionProviderRegistry` global
26
+ * pattern; bootstrap copies the registry into this serving-core slot once at
27
+ * startup (correct direction). The upstream global stays alive so the existing
28
+ * test wiring (which calls `setSubscriptionProviderRegistry`) is unchanged —
29
+ * those tests feed the upstream global, and the bootstrap path feeds this
30
+ * slot.
31
+ *
32
+ * @module outbound-api/subscriptionRegistryPort
33
+ */
34
+
35
+ /**
36
+ * The narrow surface `routeResolver` / `subscriptionSupport` use — the
37
+ * `getProfile` lookup plus an OPTIONAL per-account OpenCodeGo config reader. A
38
+ * `null` `getProfile` return means "unknown id; fall back to the legacy LLM
39
+ * provider DB lookup" (same contract as the upstream registry's `getProfile`).
40
+ */
41
+ interface SubscriptionRegistryLike {
42
+ getProfile(providerId: string): SubscriptionDispatchProfile | null;
43
+ /**
44
+ * OPTIONAL — read the currently-stored per-account OpenCodeGo config so the
45
+ * route resolver can stamp it OPAQUELY onto `RouteContext.subscriptionConfig`
46
+ * for the built-in `/v1/messages` plan builder.
47
+ *
48
+ * Core returns `unknown` ON PURPOSE: it must NEVER name the concrete
49
+ * `OpenCodeGoTokenConfig` type from `@omnicross/subscriptions` (the cross-layer
50
+ * litmus stays 0). The registry's concrete
51
+ * `getOpenCodeGoConfig(): Promise<OpenCodeGoTokenConfig | undefined>` is
52
+ * structurally ASSIGNABLE to `() => Promise<unknown>`, so the registry
53
+ * satisfies this slot without any cast.
54
+ *
55
+ * Optional so BYO-only test registries / gemini-resolver-style narrow fakes
56
+ * (which only implement `getProfile`) still satisfy the port — a missing getter
57
+ * leaves `route.subscriptionConfig` `undefined`.
58
+ */
59
+ getOpenCodeGoConfig?(): Promise<unknown>;
60
+ }
61
+ /**
62
+ * Inject the subscription registry the outbound layer resolves through. Called
63
+ * once at bootstrap with the upstream `getSubscriptionProviderRegistry()`
64
+ * result. Idempotent — last write wins.
65
+ */
66
+ declare function setSubscriptionRegistryForOutbound(registry: SubscriptionRegistryLike | null): void;
67
+ /**
68
+ * Read the injected subscription registry, or `null` when none has been wired
69
+ * (e.g. before bootstrap, or in unit tests that exercise only BYO routes).
70
+ */
71
+ declare function getSubscriptionRegistryForOutbound(): SubscriptionRegistryLike | null;
72
+
73
+ export { type SubscriptionRegistryLike, getSubscriptionRegistryForOutbound, setSubscriptionRegistryForOutbound };
@@ -0,0 +1,12 @@
1
+ // src/outbound-api/subscriptionRegistryPort.ts
2
+ var _registry = null;
3
+ function setSubscriptionRegistryForOutbound(registry) {
4
+ _registry = registry;
5
+ }
6
+ function getSubscriptionRegistryForOutbound() {
7
+ return _registry;
8
+ }
9
+ export {
10
+ getSubscriptionRegistryForOutbound,
11
+ setSubscriptionRegistryForOutbound
12
+ };