@omnicross/core 0.1.3 → 0.1.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 (114) hide show
  1. package/LICENSE +21 -21
  2. package/NOTICE +57 -57
  3. package/README.md +15 -15
  4. package/dist/auth/GeminiCodeAssistProjectResolver.cjs +4 -4
  5. package/dist/auth/GeminiCodeAssistProjectResolver.js +3 -3
  6. package/dist/chunk-3QFXFCHG.js +33 -0
  7. package/dist/chunk-4YINUUKQ.cjs +33 -0
  8. package/dist/chunk-7Y47UCF2.js +142 -0
  9. package/dist/chunk-APYG5QD7.cjs +50 -0
  10. package/dist/{chunk-CWM2ZDU5.js → chunk-BPKCU575.js} +3 -10
  11. package/dist/{chunk-2FMI2B6V.cjs → chunk-DKPXN34V.cjs} +222 -448
  12. package/dist/chunk-E3UCVHLP.cjs +142 -0
  13. package/dist/chunk-FCR77GYM.cjs +33 -0
  14. package/dist/{chunk-N5QFKSDO.js → chunk-HRRYG2AX.js} +2 -1
  15. package/dist/{chunk-KUU2RNG6.cjs → chunk-HYN75H6G.cjs} +3 -0
  16. package/dist/{chunk-JO5NLTLY.js → chunk-IK3KE3AU.js} +3 -0
  17. package/dist/chunk-K5NM7VAH.js +33 -0
  18. package/dist/{chunk-Y6OM7EV7.cjs → chunk-KFI44N2R.cjs} +2 -1
  19. package/dist/{chunk-S6JGLF3G.cjs → chunk-OCEUVQHW.cjs} +27 -4
  20. package/dist/chunk-OE6TDIWW.js +22 -0
  21. package/dist/chunk-OZFM4X3S.js +18 -0
  22. package/dist/{chunk-4DECIFU7.js → chunk-QYTT6GE3.js} +62 -288
  23. package/dist/{chunk-FFALUUZZ.cjs → chunk-RGTR7CIO.cjs} +5 -5
  24. package/dist/{chunk-3QOSDDNI.cjs → chunk-SNYBEXLB.cjs} +6 -13
  25. package/dist/{chunk-2DCNB7DF.cjs → chunk-SU2GCLAC.cjs} +30 -10
  26. package/dist/{chunk-5HTVET6E.js → chunk-TIER4SUC.js} +24 -4
  27. package/dist/{chunk-CZHZGRU7.js → chunk-UHGVBFU3.js} +2 -0
  28. package/dist/chunk-UIBD2YY5.cjs +22 -0
  29. package/dist/{chunk-SVXC36MU.cjs → chunk-VACWOIRE.cjs} +2 -0
  30. package/dist/{chunk-MQNDWYPN.js → chunk-VPBAUQ2M.js} +4 -4
  31. package/dist/chunk-WLYIIEAF.js +50 -0
  32. package/dist/{chunk-BO4RFWBR.js → chunk-XK5CIRMQ.js} +24 -1
  33. package/dist/chunk-XSVNC2UD.cjs +18 -0
  34. package/dist/completion/CompletionService.cjs +22 -16
  35. package/dist/completion/CompletionService.js +21 -15
  36. package/dist/completion.cjs +24 -18
  37. package/dist/completion.js +23 -17
  38. package/dist/index.cjs +33 -24
  39. package/dist/index.d.cts +7 -3
  40. package/dist/index.d.ts +7 -3
  41. package/dist/index.js +42 -33
  42. package/dist/keyPolicy-Cp0FntZl.d.cts +90 -0
  43. package/dist/keyPolicy-Cp0FntZl.d.ts +90 -0
  44. package/dist/outbound-api/auditCapture.cjs +9 -0
  45. package/dist/outbound-api/auditCapture.d.cts +52 -0
  46. package/dist/outbound-api/auditCapture.d.ts +52 -0
  47. package/dist/outbound-api/auditCapture.js +9 -0
  48. package/dist/outbound-api/auditRedact.cjs +8 -0
  49. package/dist/outbound-api/auditRedact.d.cts +30 -0
  50. package/dist/outbound-api/auditRedact.d.ts +30 -0
  51. package/dist/outbound-api/auditRedact.js +8 -0
  52. package/dist/outbound-api/billingCapture.cjs +8 -0
  53. package/dist/outbound-api/billingCapture.d.cts +61 -0
  54. package/dist/outbound-api/billingCapture.d.ts +61 -0
  55. package/dist/outbound-api/billingCapture.js +8 -0
  56. package/dist/outbound-api/quotaWarn.cjs +12 -0
  57. package/dist/outbound-api/quotaWarn.d.cts +43 -0
  58. package/dist/outbound-api/quotaWarn.d.ts +43 -0
  59. package/dist/outbound-api/quotaWarn.js +12 -0
  60. package/dist/outbound-api/routeResolver.cjs +2 -2
  61. package/dist/outbound-api/routeResolver.d.cts +3 -2
  62. package/dist/outbound-api/routeResolver.d.ts +3 -2
  63. package/dist/outbound-api/routeResolver.js +1 -1
  64. package/dist/outbound-api/types.d.cts +2 -1
  65. package/dist/outbound-api/types.d.ts +2 -1
  66. package/dist/outbound-api.cjs +29 -20
  67. package/dist/outbound-api.d.cts +9 -140
  68. package/dist/outbound-api.d.ts +9 -140
  69. package/dist/outbound-api.js +28 -19
  70. package/dist/pipeline/AuthSource.d.cts +6 -0
  71. package/dist/pipeline/AuthSource.d.ts +6 -0
  72. package/dist/pipeline/SubscriptionAuthSource.cjs +2 -2
  73. package/dist/pipeline/SubscriptionAuthSource.js +1 -1
  74. package/dist/pipeline/SubscriptionAuthStrategy.d.cts +6 -0
  75. package/dist/pipeline/SubscriptionAuthStrategy.d.ts +6 -0
  76. package/dist/pipeline/auditUsageStash.cjs +10 -0
  77. package/dist/pipeline/auditUsageStash.d.cts +37 -0
  78. package/dist/pipeline/auditUsageStash.d.ts +37 -0
  79. package/dist/pipeline/auditUsageStash.js +10 -0
  80. package/dist/pipeline/executeProviderCall.cjs +2 -2
  81. package/dist/pipeline/executeProviderCall.js +1 -1
  82. package/dist/pipeline/upstreamFetch.cjs +14 -0
  83. package/dist/pipeline/upstreamFetch.d.cts +83 -0
  84. package/dist/pipeline/upstreamFetch.d.ts +83 -0
  85. package/dist/pipeline/upstreamFetch.js +14 -0
  86. package/dist/pipeline/webhookEmit.cjs +10 -0
  87. package/dist/pipeline/webhookEmit.d.cts +36 -0
  88. package/dist/pipeline/webhookEmit.d.ts +36 -0
  89. package/dist/pipeline/webhookEmit.js +10 -0
  90. package/dist/ports.d.cts +2 -1
  91. package/dist/ports.d.ts +2 -1
  92. package/dist/provider-proxy/ProviderProxy.cjs +22 -16
  93. package/dist/provider-proxy/ProviderProxy.js +21 -15
  94. package/dist/provider-proxy/ingress/providerProxyShared.cjs +22 -16
  95. package/dist/provider-proxy/ingress/providerProxyShared.js +21 -15
  96. package/dist/provider-proxy/types.d.cts +7 -0
  97. package/dist/provider-proxy/types.d.ts +7 -0
  98. package/dist/provider-proxy.cjs +22 -16
  99. package/dist/provider-proxy.js +21 -15
  100. package/dist/{routeResolver-B1NglTfe.d.ts → routeResolver-C4T7yClx.d.ts} +1 -1
  101. package/dist/{routeResolver-CbG5uBgm.d.cts → routeResolver-CB3tvJKy.d.cts} +1 -1
  102. package/dist/transformer/transformers/OpenAIResponseTransformer.cjs +2 -2
  103. package/dist/transformer/transformers/OpenAIResponseTransformer.js +1 -1
  104. package/dist/transformer/transformers.cjs +6 -6
  105. package/dist/transformer/transformers.js +5 -5
  106. package/dist/transformer.cjs +7 -7
  107. package/dist/transformer.js +6 -6
  108. package/dist/{types-aBFFXoBz.d.cts → types-B8Arpxn0.d.cts} +14 -90
  109. package/dist/{types-6OUY_xfA.d.ts → types-lgPYQuZS.d.ts} +14 -90
  110. package/dist/usage/usage-recorder.cjs +3 -2
  111. package/dist/usage/usage-recorder.js +2 -1
  112. package/dist/usage.cjs +3 -2
  113. package/dist/usage.js +2 -1
  114. package/package.json +64 -64
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  executeProviderCall
3
- } from "../chunk-JO5NLTLY.js";
3
+ } from "../chunk-IK3KE3AU.js";
4
4
  export {
5
5
  executeProviderCall
6
6
  };
@@ -0,0 +1,14 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+ var _chunkOCEUVQHWcjs = require('../chunk-OCEUVQHW.cjs');
8
+
9
+
10
+
11
+
12
+
13
+
14
+ exports.__resetUpstreamProxyForTests = _chunkOCEUVQHWcjs.__resetUpstreamProxyForTests; exports.bumpUpstreamProxyGeneration = _chunkOCEUVQHWcjs.bumpUpstreamProxyGeneration; exports.fetchUpstream = _chunkOCEUVQHWcjs.fetchUpstream; exports.resolveUpstreamDispatcher = _chunkOCEUVQHWcjs.resolveUpstreamDispatcher; exports.setUpstreamProxyResolver = _chunkOCEUVQHWcjs.setUpstreamProxyResolver;
@@ -0,0 +1,83 @@
1
+ import { ProxyConfig } from '@omnicross/contracts/account-tokens-types';
2
+ import { Dispatcher } from 'undici';
3
+
4
+ /**
5
+ * upstreamFetch — the single proxy-aware egress seam for `@omnicross/core`
6
+ * (upstream-proxy).
7
+ *
8
+ * Every outbound UPSTREAM call (relay ingress `fetchFn` closures, the OAuth
9
+ * token-refresh `FetchLike`, the Gemini Code Assist handshake) routes through
10
+ * {@link fetchUpstream}. When a proxy resolves for the call it attaches an
11
+ * undici {@link Dispatcher} (`ProxyAgent` for http/https, an `Agent` with a
12
+ * socks5 connector for socks5); ABSENT any proxy it is a BARE `fetch` — the
13
+ * dispatcher option is never set, so behavior is byte-identical to the
14
+ * pre-change code (the zero-regression guarantee).
15
+ *
16
+ * Core stays config/account-agnostic: it only knows opaque `providerId` /
17
+ * `accountId` strings + a {@link ProxyConfig} descriptor. The daemon injects the
18
+ * layered lookup via {@link setUpstreamProxyResolver} — the same module-slot
19
+ * pattern as `setSubscriptionRegistryForOutbound`. Core never imports config or
20
+ * account material.
21
+ *
22
+ * Dispatchers are CACHED by resolved-proxy identity (one instance reused, not
23
+ * per-request, so keep-alive holds and sockets don't leak). A config change bumps
24
+ * a generation via {@link bumpUpstreamProxyGeneration} (also called by
25
+ * `setUpstreamProxyResolver`) which disposes the old dispatchers and rebuilds on
26
+ * next use.
27
+ *
28
+ * FROZEN SEAM: `#7` (client fingerprint) attaches per-account TLS/agent behavior
29
+ * at this SAME dispatcher point — do not fork a second egress path.
30
+ *
31
+ * @module @omnicross/core/pipeline/upstreamFetch
32
+ */
33
+
34
+ /** The opaque call context the resolver maps to a proxy (precedence input). */
35
+ interface UpstreamProxyContext {
36
+ /** The subscription provider id (`claude`/`codex`/`gemini`/`opencodego`) or `'byo'`. */
37
+ providerId?: string;
38
+ /** The selected pooled account id (per-account override input). */
39
+ accountId?: string;
40
+ /**
41
+ * The target upstream URL. Injected by {@link fetchUpstream} so the resolver can
42
+ * apply host-based bypass (loopback / `NO_PROXY`). Callers of the ingress helpers
43
+ * do NOT set this — it is filled from the fetch `url`.
44
+ */
45
+ url?: string;
46
+ }
47
+ /**
48
+ * The layered proxy lookup the daemon injects. Applies precedence
49
+ * account > provider > global > env and returns the WINNING `ProxyConfig`, or
50
+ * `undefined` for a direct (non-proxied) call.
51
+ */
52
+ type UpstreamProxyResolver = (ctx: UpstreamProxyContext) => ProxyConfig | undefined;
53
+ /**
54
+ * Inject (or clear, with `null`) the layered proxy resolver. Idempotent — last
55
+ * write wins. Bumps the dispatcher generation so a resolver swap (or a config
56
+ * edit that re-registers) rebuilds dispatchers from the new lookup and disposes
57
+ * the old ones.
58
+ */
59
+ declare function setUpstreamProxyResolver(fn: UpstreamProxyResolver | null): void;
60
+ /**
61
+ * Invalidate every cached dispatcher (config change / admin edit). Old
62
+ * dispatchers are `close()`d best-effort so in-flight sockets drain; new calls
63
+ * rebuild from the current resolver output.
64
+ */
65
+ declare function bumpUpstreamProxyGeneration(): void;
66
+ /**
67
+ * Resolve the dispatcher for one call. Returns `undefined` (⇒ bare fetch) when
68
+ * no resolver is registered, the resolver returns undefined, or the descriptor
69
+ * is malformed. A resolver throw is swallowed → direct call (egress never breaks
70
+ * on a proxy-lookup error).
71
+ */
72
+ declare function resolveUpstreamDispatcher(ctx: UpstreamProxyContext): Dispatcher | undefined;
73
+ /**
74
+ * Proxy-aware `fetch`. Attaches the resolved undici dispatcher ONLY when a proxy
75
+ * applies; otherwise it is a BARE `fetch(url, init)` — byte-identical to the
76
+ * pre-change egress (zero-regression). The `dispatcher` option is undici-specific
77
+ * (Node's global fetch IS undici); the cast threads it without a DOM-lib type.
78
+ */
79
+ declare function fetchUpstream(url: string, init: RequestInit, ctx?: UpstreamProxyContext): Promise<Response>;
80
+ /** TEST SEAM — clear the resolver + cache so a suite starts from the direct-fetch baseline. */
81
+ declare function __resetUpstreamProxyForTests(): void;
82
+
83
+ export { type UpstreamProxyContext, type UpstreamProxyResolver, __resetUpstreamProxyForTests, bumpUpstreamProxyGeneration, fetchUpstream, resolveUpstreamDispatcher, setUpstreamProxyResolver };
@@ -0,0 +1,83 @@
1
+ import { ProxyConfig } from '@omnicross/contracts/account-tokens-types';
2
+ import { Dispatcher } from 'undici';
3
+
4
+ /**
5
+ * upstreamFetch — the single proxy-aware egress seam for `@omnicross/core`
6
+ * (upstream-proxy).
7
+ *
8
+ * Every outbound UPSTREAM call (relay ingress `fetchFn` closures, the OAuth
9
+ * token-refresh `FetchLike`, the Gemini Code Assist handshake) routes through
10
+ * {@link fetchUpstream}. When a proxy resolves for the call it attaches an
11
+ * undici {@link Dispatcher} (`ProxyAgent` for http/https, an `Agent` with a
12
+ * socks5 connector for socks5); ABSENT any proxy it is a BARE `fetch` — the
13
+ * dispatcher option is never set, so behavior is byte-identical to the
14
+ * pre-change code (the zero-regression guarantee).
15
+ *
16
+ * Core stays config/account-agnostic: it only knows opaque `providerId` /
17
+ * `accountId` strings + a {@link ProxyConfig} descriptor. The daemon injects the
18
+ * layered lookup via {@link setUpstreamProxyResolver} — the same module-slot
19
+ * pattern as `setSubscriptionRegistryForOutbound`. Core never imports config or
20
+ * account material.
21
+ *
22
+ * Dispatchers are CACHED by resolved-proxy identity (one instance reused, not
23
+ * per-request, so keep-alive holds and sockets don't leak). A config change bumps
24
+ * a generation via {@link bumpUpstreamProxyGeneration} (also called by
25
+ * `setUpstreamProxyResolver`) which disposes the old dispatchers and rebuilds on
26
+ * next use.
27
+ *
28
+ * FROZEN SEAM: `#7` (client fingerprint) attaches per-account TLS/agent behavior
29
+ * at this SAME dispatcher point — do not fork a second egress path.
30
+ *
31
+ * @module @omnicross/core/pipeline/upstreamFetch
32
+ */
33
+
34
+ /** The opaque call context the resolver maps to a proxy (precedence input). */
35
+ interface UpstreamProxyContext {
36
+ /** The subscription provider id (`claude`/`codex`/`gemini`/`opencodego`) or `'byo'`. */
37
+ providerId?: string;
38
+ /** The selected pooled account id (per-account override input). */
39
+ accountId?: string;
40
+ /**
41
+ * The target upstream URL. Injected by {@link fetchUpstream} so the resolver can
42
+ * apply host-based bypass (loopback / `NO_PROXY`). Callers of the ingress helpers
43
+ * do NOT set this — it is filled from the fetch `url`.
44
+ */
45
+ url?: string;
46
+ }
47
+ /**
48
+ * The layered proxy lookup the daemon injects. Applies precedence
49
+ * account > provider > global > env and returns the WINNING `ProxyConfig`, or
50
+ * `undefined` for a direct (non-proxied) call.
51
+ */
52
+ type UpstreamProxyResolver = (ctx: UpstreamProxyContext) => ProxyConfig | undefined;
53
+ /**
54
+ * Inject (or clear, with `null`) the layered proxy resolver. Idempotent — last
55
+ * write wins. Bumps the dispatcher generation so a resolver swap (or a config
56
+ * edit that re-registers) rebuilds dispatchers from the new lookup and disposes
57
+ * the old ones.
58
+ */
59
+ declare function setUpstreamProxyResolver(fn: UpstreamProxyResolver | null): void;
60
+ /**
61
+ * Invalidate every cached dispatcher (config change / admin edit). Old
62
+ * dispatchers are `close()`d best-effort so in-flight sockets drain; new calls
63
+ * rebuild from the current resolver output.
64
+ */
65
+ declare function bumpUpstreamProxyGeneration(): void;
66
+ /**
67
+ * Resolve the dispatcher for one call. Returns `undefined` (⇒ bare fetch) when
68
+ * no resolver is registered, the resolver returns undefined, or the descriptor
69
+ * is malformed. A resolver throw is swallowed → direct call (egress never breaks
70
+ * on a proxy-lookup error).
71
+ */
72
+ declare function resolveUpstreamDispatcher(ctx: UpstreamProxyContext): Dispatcher | undefined;
73
+ /**
74
+ * Proxy-aware `fetch`. Attaches the resolved undici dispatcher ONLY when a proxy
75
+ * applies; otherwise it is a BARE `fetch(url, init)` — byte-identical to the
76
+ * pre-change egress (zero-regression). The `dispatcher` option is undici-specific
77
+ * (Node's global fetch IS undici); the cast threads it without a DOM-lib type.
78
+ */
79
+ declare function fetchUpstream(url: string, init: RequestInit, ctx?: UpstreamProxyContext): Promise<Response>;
80
+ /** TEST SEAM — clear the resolver + cache so a suite starts from the direct-fetch baseline. */
81
+ declare function __resetUpstreamProxyForTests(): void;
82
+
83
+ export { type UpstreamProxyContext, type UpstreamProxyResolver, __resetUpstreamProxyForTests, bumpUpstreamProxyGeneration, fetchUpstream, resolveUpstreamDispatcher, setUpstreamProxyResolver };
@@ -0,0 +1,14 @@
1
+ import {
2
+ __resetUpstreamProxyForTests,
3
+ bumpUpstreamProxyGeneration,
4
+ fetchUpstream,
5
+ resolveUpstreamDispatcher,
6
+ setUpstreamProxyResolver
7
+ } from "../chunk-XK5CIRMQ.js";
8
+ export {
9
+ __resetUpstreamProxyForTests,
10
+ bumpUpstreamProxyGeneration,
11
+ fetchUpstream,
12
+ resolveUpstreamDispatcher,
13
+ setUpstreamProxyResolver
14
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+ var _chunkUIBD2YY5cjs = require('../chunk-UIBD2YY5.cjs');
6
+
7
+
8
+
9
+
10
+ exports.__resetWebhookSinkForTests = _chunkUIBD2YY5cjs.__resetWebhookSinkForTests; exports.emitWebhookEvent = _chunkUIBD2YY5cjs.emitWebhookEvent; exports.setWebhookSink = _chunkUIBD2YY5cjs.setWebhookSink;
@@ -0,0 +1,36 @@
1
+ import { WebhookEvent } from '@omnicross/contracts/webhook-types';
2
+
3
+ /**
4
+ * webhookEmit — the module-slot emit port for `@omnicross/core`
5
+ * (webhook-notifications, design D2).
6
+ *
7
+ * Core SOURCES (the wire quota path in `outboundApiRouter`, the relay/dispatch
8
+ * error path) call {@link emitWebhookEvent}. The concrete `WebhookDispatcher`
9
+ * (config/secrets/HTTP/HMAC) lives in the DAEMON and registers itself as the
10
+ * sink at bootstrap via {@link setWebhookSink}. Core imports NOTHING from the
11
+ * daemon — exactly the `setSharedAccountHealth` / `setUpstreamProxyResolver`
12
+ * precedent.
13
+ *
14
+ * HARD CONTRACT (design D2 / risk "a webhook blocking the request path"):
15
+ * {@link emitWebhookEvent} NEVER throws and NEVER awaits. It hands the event to
16
+ * the sink (which enqueues and returns immediately) — a slow/failing/throwing
17
+ * sink can never affect the caller. Absent a sink it is a pure no-op, so a
18
+ * no-webhook-config daemon is byte-identical to before this change.
19
+ *
20
+ * @module @omnicross/core/pipeline/webhookEmit
21
+ */
22
+
23
+ /** The sink the daemon registers; it MUST enqueue-and-return (never block). */
24
+ type WebhookSink = (event: WebhookEvent) => void;
25
+ /** Install (or clear, with `null`) the webhook sink. Idempotent; last write wins. */
26
+ declare function setWebhookSink(fn: WebhookSink | null): void;
27
+ /**
28
+ * Emit a webhook event to the registered sink. A no-op when no sink is set
29
+ * (zero regression). NEVER throws (a misbehaving sink is swallowed) and NEVER
30
+ * awaits (the sink enqueues + returns) — so no request path is ever delayed.
31
+ */
32
+ declare function emitWebhookEvent(event: WebhookEvent): void;
33
+ /** TEST SEAM — clear the sink so a suite starts from the no-sink baseline. */
34
+ declare function __resetWebhookSinkForTests(): void;
35
+
36
+ export { type WebhookSink, __resetWebhookSinkForTests, emitWebhookEvent, setWebhookSink };
@@ -0,0 +1,36 @@
1
+ import { WebhookEvent } from '@omnicross/contracts/webhook-types';
2
+
3
+ /**
4
+ * webhookEmit — the module-slot emit port for `@omnicross/core`
5
+ * (webhook-notifications, design D2).
6
+ *
7
+ * Core SOURCES (the wire quota path in `outboundApiRouter`, the relay/dispatch
8
+ * error path) call {@link emitWebhookEvent}. The concrete `WebhookDispatcher`
9
+ * (config/secrets/HTTP/HMAC) lives in the DAEMON and registers itself as the
10
+ * sink at bootstrap via {@link setWebhookSink}. Core imports NOTHING from the
11
+ * daemon — exactly the `setSharedAccountHealth` / `setUpstreamProxyResolver`
12
+ * precedent.
13
+ *
14
+ * HARD CONTRACT (design D2 / risk "a webhook blocking the request path"):
15
+ * {@link emitWebhookEvent} NEVER throws and NEVER awaits. It hands the event to
16
+ * the sink (which enqueues and returns immediately) — a slow/failing/throwing
17
+ * sink can never affect the caller. Absent a sink it is a pure no-op, so a
18
+ * no-webhook-config daemon is byte-identical to before this change.
19
+ *
20
+ * @module @omnicross/core/pipeline/webhookEmit
21
+ */
22
+
23
+ /** The sink the daemon registers; it MUST enqueue-and-return (never block). */
24
+ type WebhookSink = (event: WebhookEvent) => void;
25
+ /** Install (or clear, with `null`) the webhook sink. Idempotent; last write wins. */
26
+ declare function setWebhookSink(fn: WebhookSink | null): void;
27
+ /**
28
+ * Emit a webhook event to the registered sink. A no-op when no sink is set
29
+ * (zero regression). NEVER throws (a misbehaving sink is swallowed) and NEVER
30
+ * awaits (the sink enqueues + returns) — so no request path is ever delayed.
31
+ */
32
+ declare function emitWebhookEvent(event: WebhookEvent): void;
33
+ /** TEST SEAM — clear the sink so a suite starts from the no-sink baseline. */
34
+ declare function __resetWebhookSinkForTests(): void;
35
+
36
+ export { type WebhookSink, __resetWebhookSinkForTests, emitWebhookEvent, setWebhookSink };
@@ -0,0 +1,10 @@
1
+ import {
2
+ __resetWebhookSinkForTests,
3
+ emitWebhookEvent,
4
+ setWebhookSink
5
+ } from "../chunk-OE6TDIWW.js";
6
+ export {
7
+ __resetWebhookSinkForTests,
8
+ emitWebhookEvent,
9
+ setWebhookSink
10
+ };
package/dist/ports.d.cts CHANGED
@@ -5,7 +5,7 @@ export { ProviderConfigSource } from './ports/provider-config-source.cjs';
5
5
  export { UsageEventStore } from './ports/usage-event-store.cjs';
6
6
  export { WebSearchBackend } from './ports/web-search-backend.cjs';
7
7
  export { UsageRecorderImport as UsageSink } from './provider-proxy/types.cjs';
8
- export { O as OutboundCredentialStore } from './types-aBFFXoBz.cjs';
8
+ export { O as OutboundCredentialStore } from './types-B8Arpxn0.cjs';
9
9
  import '@omnicross/contracts/pricing-types';
10
10
  import '@omnicross/contracts/llm-config';
11
11
  import './transformer/types.cjs';
@@ -27,3 +27,4 @@ import '@omnicross/contracts/health-logging-types';
27
27
  import '@omnicross/contracts/voucher-types';
28
28
  import '@omnicross/contracts/webhook-types';
29
29
  import './ProviderProxy-CnMQYN59.cjs';
30
+ import './keyPolicy-Cp0FntZl.cjs';
package/dist/ports.d.ts CHANGED
@@ -5,7 +5,7 @@ export { ProviderConfigSource } from './ports/provider-config-source.js';
5
5
  export { UsageEventStore } from './ports/usage-event-store.js';
6
6
  export { WebSearchBackend } from './ports/web-search-backend.js';
7
7
  export { UsageRecorderImport as UsageSink } from './provider-proxy/types.js';
8
- export { O as OutboundCredentialStore } from './types-6OUY_xfA.js';
8
+ export { O as OutboundCredentialStore } from './types-lgPYQuZS.js';
9
9
  import '@omnicross/contracts/pricing-types';
10
10
  import '@omnicross/contracts/llm-config';
11
11
  import './transformer/types.js';
@@ -27,3 +27,4 @@ import '@omnicross/contracts/health-logging-types';
27
27
  import '@omnicross/contracts/voucher-types';
28
28
  import '@omnicross/contracts/webhook-types';
29
29
  import './ProviderProxy-C-xqrkKi.js';
30
+ import './keyPolicy-Cp0FntZl.js';
@@ -1,42 +1,48 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunk2FMI2B6Vcjs = require('../chunk-2FMI2B6V.cjs');
4
+ var _chunkDKPXN34Vcjs = require('../chunk-DKPXN34V.cjs');
5
5
  require('../chunk-HQP3K7PU.cjs');
6
6
  require('../chunk-FZ46M34D.cjs');
7
- require('../chunk-46ZIFWYG.cjs');
8
7
  require('../chunk-3OPYJG76.cjs');
9
- require('../chunk-FFALUUZZ.cjs');
10
- require('../chunk-C72S6TTV.cjs');
8
+ require('../chunk-RGTR7CIO.cjs');
11
9
  require('../chunk-DWKQZ2SK.cjs');
12
10
  require('../chunk-4VAVYUZS.cjs');
13
11
  require('../chunk-7YN22L2H.cjs');
14
- require('../chunk-2DCNB7DF.cjs');
12
+ require('../chunk-SU2GCLAC.cjs');
13
+ require('../chunk-C72S6TTV.cjs');
15
14
  require('../chunk-EYZYXJTJ.cjs');
16
15
  require('../chunk-YMFAJFQT.cjs');
17
- require('../chunk-3QOSDDNI.cjs');
16
+ require('../chunk-SNYBEXLB.cjs');
17
+ require('../chunk-46ZIFWYG.cjs');
18
18
  require('../chunk-GBHYAGX3.cjs');
19
19
  require('../chunk-RPII3E6Z.cjs');
20
20
  require('../chunk-6RPZADX3.cjs');
21
21
  require('../chunk-QWBWGODS.cjs');
22
+ require('../chunk-UIBD2YY5.cjs');
23
+ require('../chunk-R3HK6R4B.cjs');
24
+ require('../chunk-HYN75H6G.cjs');
25
+ require('../chunk-Q27JY5RG.cjs');
26
+ require('../chunk-QXD4MV2X.cjs');
22
27
  require('../chunk-NYUNU75A.cjs');
23
28
  require('../chunk-VQY5W4YW.cjs');
24
- require('../chunk-Y6OM7EV7.cjs');
29
+ require('../chunk-KFI44N2R.cjs');
25
30
  require('../chunk-SVNDB62D.cjs');
26
- require('../chunk-R3HK6R4B.cjs');
27
- require('../chunk-AEOZIDEB.cjs');
31
+ require('../chunk-APYG5QD7.cjs');
28
32
  require('../chunk-L74VDN4A.cjs');
29
- require('../chunk-KUU2RNG6.cjs');
30
- require('../chunk-Q27JY5RG.cjs');
31
- require('../chunk-QXD4MV2X.cjs');
32
- require('../chunk-A2YMUCBT.cjs');
33
- require('../chunk-SVXC36MU.cjs');
33
+ require('../chunk-4YINUUKQ.cjs');
34
+ require('../chunk-VACWOIRE.cjs');
34
35
  require('../chunk-QBZJ7P2T.cjs');
35
36
  require('../chunk-4IH4EL7M.cjs');
37
+ require('../chunk-A2YMUCBT.cjs');
38
+ require('../chunk-E3UCVHLP.cjs');
39
+ require('../chunk-FCR77GYM.cjs');
40
+ require('../chunk-AEOZIDEB.cjs');
41
+ require('../chunk-XSVNC2UD.cjs');
36
42
  require('../chunk-SUEGJ75D.cjs');
37
- require('../chunk-S6JGLF3G.cjs');
38
43
  require('../chunk-RSJ3TWJQ.cjs');
39
44
  require('../chunk-YGXJGRFI.cjs');
45
+ require('../chunk-OCEUVQHW.cjs');
40
46
  require('../chunk-NZYN7C3P.cjs');
41
47
  require('../chunk-JMJBSACD.cjs');
42
48
  require('../chunk-GMMT7RVN.cjs');
@@ -44,4 +50,4 @@ require('../chunk-UNEFIWXI.cjs');
44
50
 
45
51
 
46
52
 
47
- exports.ProviderProxy = _chunk2FMI2B6Vcjs.ProviderProxy; exports.isLoopbackAddress = _chunk2FMI2B6Vcjs.isLoopbackAddress;
53
+ exports.ProviderProxy = _chunkDKPXN34Vcjs.ProviderProxy; exports.isLoopbackAddress = _chunkDKPXN34Vcjs.isLoopbackAddress;
@@ -1,42 +1,48 @@
1
1
  import {
2
2
  ProviderProxy,
3
3
  isLoopbackAddress
4
- } from "../chunk-4DECIFU7.js";
4
+ } from "../chunk-QYTT6GE3.js";
5
5
  import "../chunk-VVEHS2LI.js";
6
6
  import "../chunk-46RLHI7D.js";
7
- import "../chunk-G2UTNSGU.js";
8
7
  import "../chunk-DK4A7DLE.js";
9
- import "../chunk-MQNDWYPN.js";
10
- import "../chunk-Z7LUNECE.js";
8
+ import "../chunk-VPBAUQ2M.js";
11
9
  import "../chunk-ZJZAOKI7.js";
12
10
  import "../chunk-FTQ7IQUC.js";
13
11
  import "../chunk-C7PSERMH.js";
14
- import "../chunk-5HTVET6E.js";
12
+ import "../chunk-TIER4SUC.js";
13
+ import "../chunk-Z7LUNECE.js";
15
14
  import "../chunk-7VU7V2E4.js";
16
15
  import "../chunk-ZLX3KGXX.js";
17
- import "../chunk-CWM2ZDU5.js";
16
+ import "../chunk-BPKCU575.js";
17
+ import "../chunk-G2UTNSGU.js";
18
18
  import "../chunk-MZNPGW5Q.js";
19
19
  import "../chunk-XTEI64OU.js";
20
20
  import "../chunk-XX6NQJMA.js";
21
21
  import "../chunk-IAXWICZU.js";
22
+ import "../chunk-OE6TDIWW.js";
23
+ import "../chunk-DRWHTIIZ.js";
24
+ import "../chunk-IK3KE3AU.js";
25
+ import "../chunk-ZY6KU6P3.js";
26
+ import "../chunk-JWC6APFQ.js";
22
27
  import "../chunk-5ERIZW3D.js";
23
28
  import "../chunk-5ENKBSWO.js";
24
- import "../chunk-N5QFKSDO.js";
29
+ import "../chunk-HRRYG2AX.js";
25
30
  import "../chunk-AVYJ4YBN.js";
26
- import "../chunk-DRWHTIIZ.js";
27
- import "../chunk-WNY4WMRF.js";
31
+ import "../chunk-WLYIIEAF.js";
28
32
  import "../chunk-TKJMZBAH.js";
29
- import "../chunk-JO5NLTLY.js";
30
- import "../chunk-ZY6KU6P3.js";
31
- import "../chunk-JWC6APFQ.js";
32
- import "../chunk-H5JUT3KV.js";
33
- import "../chunk-CZHZGRU7.js";
33
+ import "../chunk-3QFXFCHG.js";
34
+ import "../chunk-UHGVBFU3.js";
34
35
  import "../chunk-AQ5TNQB7.js";
35
36
  import "../chunk-XEKD23J5.js";
37
+ import "../chunk-H5JUT3KV.js";
38
+ import "../chunk-7Y47UCF2.js";
39
+ import "../chunk-K5NM7VAH.js";
40
+ import "../chunk-WNY4WMRF.js";
41
+ import "../chunk-OZFM4X3S.js";
36
42
  import "../chunk-5ZQBEOMD.js";
37
- import "../chunk-BO4RFWBR.js";
38
43
  import "../chunk-Z7Y2NPHY.js";
39
44
  import "../chunk-S4WBV25P.js";
45
+ import "../chunk-XK5CIRMQ.js";
40
46
  import "../chunk-CDHS2QDC.js";
41
47
  import "../chunk-Y7FO65VT.js";
42
48
  import "../chunk-FMOBD2OQ.js";
@@ -7,42 +7,48 @@
7
7
 
8
8
 
9
9
 
10
- var _chunk2FMI2B6Vcjs = require('../../chunk-2FMI2B6V.cjs');
10
+ var _chunkDKPXN34Vcjs = require('../../chunk-DKPXN34V.cjs');
11
11
  require('../../chunk-HQP3K7PU.cjs');
12
12
  require('../../chunk-FZ46M34D.cjs');
13
- require('../../chunk-46ZIFWYG.cjs');
14
13
  require('../../chunk-3OPYJG76.cjs');
15
- require('../../chunk-FFALUUZZ.cjs');
16
- require('../../chunk-C72S6TTV.cjs');
14
+ require('../../chunk-RGTR7CIO.cjs');
17
15
  require('../../chunk-DWKQZ2SK.cjs');
18
16
  require('../../chunk-4VAVYUZS.cjs');
19
17
  require('../../chunk-7YN22L2H.cjs');
20
- require('../../chunk-2DCNB7DF.cjs');
18
+ require('../../chunk-SU2GCLAC.cjs');
19
+ require('../../chunk-C72S6TTV.cjs');
21
20
  require('../../chunk-EYZYXJTJ.cjs');
22
21
  require('../../chunk-YMFAJFQT.cjs');
23
- require('../../chunk-3QOSDDNI.cjs');
22
+ require('../../chunk-SNYBEXLB.cjs');
23
+ require('../../chunk-46ZIFWYG.cjs');
24
24
  require('../../chunk-GBHYAGX3.cjs');
25
25
  require('../../chunk-RPII3E6Z.cjs');
26
26
  require('../../chunk-6RPZADX3.cjs');
27
27
  require('../../chunk-QWBWGODS.cjs');
28
+ require('../../chunk-UIBD2YY5.cjs');
29
+ require('../../chunk-R3HK6R4B.cjs');
30
+ require('../../chunk-HYN75H6G.cjs');
31
+ require('../../chunk-Q27JY5RG.cjs');
32
+ require('../../chunk-QXD4MV2X.cjs');
28
33
  require('../../chunk-NYUNU75A.cjs');
29
34
  require('../../chunk-VQY5W4YW.cjs');
30
- require('../../chunk-Y6OM7EV7.cjs');
35
+ require('../../chunk-KFI44N2R.cjs');
31
36
  require('../../chunk-SVNDB62D.cjs');
32
- require('../../chunk-R3HK6R4B.cjs');
33
- require('../../chunk-AEOZIDEB.cjs');
37
+ require('../../chunk-APYG5QD7.cjs');
34
38
  require('../../chunk-L74VDN4A.cjs');
35
- require('../../chunk-KUU2RNG6.cjs');
36
- require('../../chunk-Q27JY5RG.cjs');
37
- require('../../chunk-QXD4MV2X.cjs');
38
- require('../../chunk-A2YMUCBT.cjs');
39
- require('../../chunk-SVXC36MU.cjs');
39
+ require('../../chunk-4YINUUKQ.cjs');
40
+ require('../../chunk-VACWOIRE.cjs');
40
41
  require('../../chunk-QBZJ7P2T.cjs');
41
42
  require('../../chunk-4IH4EL7M.cjs');
43
+ require('../../chunk-A2YMUCBT.cjs');
44
+ require('../../chunk-E3UCVHLP.cjs');
45
+ require('../../chunk-FCR77GYM.cjs');
46
+ require('../../chunk-AEOZIDEB.cjs');
47
+ require('../../chunk-XSVNC2UD.cjs');
42
48
  require('../../chunk-SUEGJ75D.cjs');
43
- require('../../chunk-S6JGLF3G.cjs');
44
49
  require('../../chunk-RSJ3TWJQ.cjs');
45
50
  require('../../chunk-YGXJGRFI.cjs');
51
+ require('../../chunk-OCEUVQHW.cjs');
46
52
  require('../../chunk-NZYN7C3P.cjs');
47
53
  require('../../chunk-JMJBSACD.cjs');
48
54
  require('../../chunk-GMMT7RVN.cjs');
@@ -56,4 +62,4 @@ require('../../chunk-UNEFIWXI.cjs');
56
62
 
57
63
 
58
64
 
59
- exports.getAnthropicEndpointTransformer = _chunk2FMI2B6Vcjs.getAnthropicEndpointTransformer; exports.getGeminiEndpointTransformer = _chunk2FMI2B6Vcjs.getGeminiEndpointTransformer; exports.getResponsesEndpointTransformer = _chunk2FMI2B6Vcjs.getResponsesEndpointTransformer; exports.getSharedExecutor = _chunk2FMI2B6Vcjs.getSharedExecutor; exports.readBody = _chunk2FMI2B6Vcjs.readBody; exports.relayResponse = _chunk2FMI2B6Vcjs.relayResponse; exports.resolvePoolBoundKey = _chunk2FMI2B6Vcjs.resolvePoolBoundKey; exports.writeError = _chunk2FMI2B6Vcjs.writeError;
65
+ exports.getAnthropicEndpointTransformer = _chunkDKPXN34Vcjs.getAnthropicEndpointTransformer; exports.getGeminiEndpointTransformer = _chunkDKPXN34Vcjs.getGeminiEndpointTransformer; exports.getResponsesEndpointTransformer = _chunkDKPXN34Vcjs.getResponsesEndpointTransformer; exports.getSharedExecutor = _chunkDKPXN34Vcjs.getSharedExecutor; exports.readBody = _chunkDKPXN34Vcjs.readBody; exports.relayResponse = _chunkDKPXN34Vcjs.relayResponse; exports.resolvePoolBoundKey = _chunkDKPXN34Vcjs.resolvePoolBoundKey; exports.writeError = _chunkDKPXN34Vcjs.writeError;
@@ -7,42 +7,48 @@ import {
7
7
  relayResponse,
8
8
  resolvePoolBoundKey,
9
9
  writeError
10
- } from "../../chunk-4DECIFU7.js";
10
+ } from "../../chunk-QYTT6GE3.js";
11
11
  import "../../chunk-VVEHS2LI.js";
12
12
  import "../../chunk-46RLHI7D.js";
13
- import "../../chunk-G2UTNSGU.js";
14
13
  import "../../chunk-DK4A7DLE.js";
15
- import "../../chunk-MQNDWYPN.js";
16
- import "../../chunk-Z7LUNECE.js";
14
+ import "../../chunk-VPBAUQ2M.js";
17
15
  import "../../chunk-ZJZAOKI7.js";
18
16
  import "../../chunk-FTQ7IQUC.js";
19
17
  import "../../chunk-C7PSERMH.js";
20
- import "../../chunk-5HTVET6E.js";
18
+ import "../../chunk-TIER4SUC.js";
19
+ import "../../chunk-Z7LUNECE.js";
21
20
  import "../../chunk-7VU7V2E4.js";
22
21
  import "../../chunk-ZLX3KGXX.js";
23
- import "../../chunk-CWM2ZDU5.js";
22
+ import "../../chunk-BPKCU575.js";
23
+ import "../../chunk-G2UTNSGU.js";
24
24
  import "../../chunk-MZNPGW5Q.js";
25
25
  import "../../chunk-XTEI64OU.js";
26
26
  import "../../chunk-XX6NQJMA.js";
27
27
  import "../../chunk-IAXWICZU.js";
28
+ import "../../chunk-OE6TDIWW.js";
29
+ import "../../chunk-DRWHTIIZ.js";
30
+ import "../../chunk-IK3KE3AU.js";
31
+ import "../../chunk-ZY6KU6P3.js";
32
+ import "../../chunk-JWC6APFQ.js";
28
33
  import "../../chunk-5ERIZW3D.js";
29
34
  import "../../chunk-5ENKBSWO.js";
30
- import "../../chunk-N5QFKSDO.js";
35
+ import "../../chunk-HRRYG2AX.js";
31
36
  import "../../chunk-AVYJ4YBN.js";
32
- import "../../chunk-DRWHTIIZ.js";
33
- import "../../chunk-WNY4WMRF.js";
37
+ import "../../chunk-WLYIIEAF.js";
34
38
  import "../../chunk-TKJMZBAH.js";
35
- import "../../chunk-JO5NLTLY.js";
36
- import "../../chunk-ZY6KU6P3.js";
37
- import "../../chunk-JWC6APFQ.js";
38
- import "../../chunk-H5JUT3KV.js";
39
- import "../../chunk-CZHZGRU7.js";
39
+ import "../../chunk-3QFXFCHG.js";
40
+ import "../../chunk-UHGVBFU3.js";
40
41
  import "../../chunk-AQ5TNQB7.js";
41
42
  import "../../chunk-XEKD23J5.js";
43
+ import "../../chunk-H5JUT3KV.js";
44
+ import "../../chunk-7Y47UCF2.js";
45
+ import "../../chunk-K5NM7VAH.js";
46
+ import "../../chunk-WNY4WMRF.js";
47
+ import "../../chunk-OZFM4X3S.js";
42
48
  import "../../chunk-5ZQBEOMD.js";
43
- import "../../chunk-BO4RFWBR.js";
44
49
  import "../../chunk-Z7Y2NPHY.js";
45
50
  import "../../chunk-S4WBV25P.js";
51
+ import "../../chunk-XK5CIRMQ.js";
46
52
  import "../../chunk-CDHS2QDC.js";
47
53
  import "../../chunk-Y7FO65VT.js";
48
54
  import "../../chunk-FMOBD2OQ.js";
@@ -335,6 +335,13 @@ interface RouteContext {
335
335
  * `anthropicSdkHints.subscriptionProfile` and ignores this field.
336
336
  */
337
337
  readonly subscriptionProfile?: SubscriptionAuthProfile | null;
338
+ /**
339
+ * Per-request preferred subscription account id (provider/subscription
340
+ * duality). Stamped by the outbound `resolveRoute` from
341
+ * `EndpointRoutingConfig.boundAccountId`; the account picker prefers it when
342
+ * schedulable (else falls back to the pool). Undefined ⇒ pool auto-schedule.
343
+ */
344
+ readonly preferredAccountId?: string;
338
345
  /**
339
346
  * OPAQUE per-account subscription config (opencodego-only). Populated by the
340
347
  * route resolver from the subscription registry's `getOpenCodeGoConfig()`
@@ -335,6 +335,13 @@ interface RouteContext {
335
335
  * `anthropicSdkHints.subscriptionProfile` and ignores this field.
336
336
  */
337
337
  readonly subscriptionProfile?: SubscriptionAuthProfile | null;
338
+ /**
339
+ * Per-request preferred subscription account id (provider/subscription
340
+ * duality). Stamped by the outbound `resolveRoute` from
341
+ * `EndpointRoutingConfig.boundAccountId`; the account picker prefers it when
342
+ * schedulable (else falls back to the pool). Undefined ⇒ pool auto-schedule.
343
+ */
344
+ readonly preferredAccountId?: string;
338
345
  /**
339
346
  * OPAQUE per-account subscription config (opencodego-only). Populated by the
340
347
  * route resolver from the subscription registry's `getOpenCodeGoConfig()`