@omnicross/core 0.1.10 → 0.2.1

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 (204) hide show
  1. package/README.md +7 -0
  2. package/dist/{BuiltinToolExecutor-CS2WpXhM.d.cts → BuiltinToolExecutor-BHgH-EaZ.d.cts} +25 -2
  3. package/dist/{BuiltinToolExecutor-BluWyeob.d.ts → BuiltinToolExecutor-Bi1LmiTP.d.ts} +25 -2
  4. package/dist/{CompletionService-kNA17cfI.d.cts → CompletionService-BniP7j88.d.cts} +2 -2
  5. package/dist/{CompletionService-C3BX0Ovy.d.ts → CompletionService-BqrKPwfA.d.ts} +2 -2
  6. package/dist/{ProviderProxy-QdwNV6l1.d.cts → ProviderProxy-Bz_nkOwq.d.cts} +1 -1
  7. package/dist/{ProviderProxy--ROec6VI.d.ts → ProviderProxy-Ckr6oTrE.d.ts} +1 -1
  8. package/dist/auth/GeminiCodeAssistProjectResolver.cjs +6 -6
  9. package/dist/auth/GeminiCodeAssistProjectResolver.js +4 -4
  10. package/dist/{chunk-NGYOO5TO.js → chunk-2C3TTBS7.js} +7 -7
  11. package/dist/{chunk-QUSEZNYS.cjs → chunk-32SRZFFP.cjs} +4 -1
  12. package/dist/chunk-4JOU54M5.js +200 -0
  13. package/dist/{chunk-2UTGX6FM.js → chunk-4VVCXVB7.js} +1 -1
  14. package/dist/{chunk-RJUONLUQ.cjs → chunk-4Z3ZLLC2.cjs} +14 -8
  15. package/dist/chunk-6DDYNS2B.cjs +384 -0
  16. package/dist/{chunk-GXEZ2R3E.js → chunk-6OKXH2TW.js} +18 -7
  17. package/dist/{chunk-YWL7YZWS.cjs → chunk-7LRTPNFL.cjs} +5 -0
  18. package/dist/{chunk-CCVRRJOX.js → chunk-7PIUVCKK.js} +9 -2
  19. package/dist/chunk-7RJI3NDI.cjs +236 -0
  20. package/dist/{chunk-IIRPUVPH.cjs → chunk-7ZHBN75N.cjs} +3 -1
  21. package/dist/chunk-D4WNI6BR.cjs +386 -0
  22. package/dist/chunk-DBBR6RHF.js +236 -0
  23. package/dist/chunk-E4QHVXV5.cjs +118 -0
  24. package/dist/{chunk-HKB656B4.js → chunk-EUZRH544.js} +55 -287
  25. package/dist/{chunk-WNKWAEUR.js → chunk-EYGBM2VC.js} +3 -1
  26. package/dist/{chunk-UWDW6PN3.cjs → chunk-FX325I5Q.cjs} +20 -9
  27. package/dist/chunk-G4CZIUIB.cjs +200 -0
  28. package/dist/chunk-HCOQQAZE.cjs +123 -0
  29. package/dist/chunk-HL2YSPL7.cjs +673 -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-LFPQ2OVH.js +386 -0
  37. package/dist/{chunk-FEBAQI5A.js → chunk-LKDAN4D7.js} +6363 -1350
  38. package/dist/chunk-LQYS2N47.js +3923 -0
  39. package/dist/{chunk-NZYN7C3P.cjs → chunk-MPXOKQJP.cjs} +53 -53
  40. package/dist/chunk-MZEGQSKQ.js +118 -0
  41. package/dist/chunk-N76KU6F5.js +123 -0
  42. package/dist/chunk-NLUOTJWB.js +673 -0
  43. package/dist/{chunk-CMVXX7ON.cjs → chunk-NOITAVHA.cjs} +114 -58
  44. package/dist/{chunk-Q27JY5RG.cjs → chunk-OIKREZVQ.cjs} +7 -4
  45. package/dist/{chunk-ZQQUD66M.cjs → chunk-POUTD5AM.cjs} +63 -295
  46. package/dist/{chunk-6D4W22P4.js → chunk-QIIAMBTM.js} +4 -1
  47. package/dist/{chunk-56QD3YW6.cjs → chunk-QWNUOR7F.cjs} +11 -4
  48. package/dist/{chunk-S3DYFEBE.js → chunk-R4VCO2CB.js} +10 -1
  49. package/dist/{chunk-4VZX5F4T.cjs → chunk-T6NWPIYZ.cjs} +5 -2
  50. package/dist/{chunk-EBLFCNPY.js → chunk-U47LQXPB.js} +5 -2
  51. package/dist/chunk-UPQIWJIE.cjs +3923 -0
  52. package/dist/{chunk-N7OOJI5V.js → chunk-V2UKUTJ3.js} +5 -0
  53. package/dist/{chunk-45FHEOKW.js → chunk-V53ZEFXC.js} +92 -36
  54. package/dist/{chunk-RJ5ZGNI3.js → chunk-VL5TUDTM.js} +8 -2
  55. package/dist/{chunk-TIT74RIL.cjs → chunk-VSYQ6XYN.cjs} +6837 -1824
  56. package/dist/{chunk-OC6DOOFX.cjs → chunk-VXRTQZF2.cjs} +5 -5
  57. package/dist/{chunk-RICPANBY.cjs → chunk-WX2E2G7H.cjs} +13 -4
  58. package/dist/{chunk-DE2SRBFZ.js → chunk-X335TJNS.js} +4 -3
  59. package/dist/{chunk-CDHS2QDC.js → chunk-Y4CRNHJO.js} +53 -53
  60. package/dist/{chunk-P7EM6BND.cjs → chunk-ZAPN7XA6.cjs} +10 -10
  61. package/dist/{chunk-N2EIM2XJ.js → chunk-ZLNHPUFA.js} +22 -1
  62. package/dist/completion/BuiltinToolExecutor.cjs +2 -2
  63. package/dist/completion/BuiltinToolExecutor.d.cts +3 -1
  64. package/dist/completion/BuiltinToolExecutor.d.ts +3 -1
  65. package/dist/completion/BuiltinToolExecutor.js +1 -1
  66. package/dist/completion/CompletionService.cjs +32 -28
  67. package/dist/completion/CompletionService.d.cts +7 -3
  68. package/dist/completion/CompletionService.d.ts +7 -3
  69. package/dist/completion/CompletionService.js +31 -27
  70. package/dist/completion.cjs +40 -36
  71. package/dist/completion.d.cts +7 -3
  72. package/dist/completion.d.ts +7 -3
  73. package/dist/completion.js +39 -35
  74. package/dist/egress-I46O_p5L.d.cts +126 -0
  75. package/dist/egress-I46O_p5L.d.ts +126 -0
  76. package/dist/frontends-Doz0RaWu.d.cts +97 -0
  77. package/dist/frontends-Doz0RaWu.d.ts +97 -0
  78. package/dist/image-generation.cjs +52 -0
  79. package/dist/image-generation.d.cts +96 -0
  80. package/dist/image-generation.d.ts +96 -0
  81. package/dist/image-generation.js +52 -0
  82. package/dist/index.cjs +142 -32
  83. package/dist/index.d.cts +16 -8
  84. package/dist/index.d.ts +16 -8
  85. package/dist/index.js +159 -49
  86. package/dist/openai-operation.cjs +18 -0
  87. package/dist/openai-operation.d.cts +22 -0
  88. package/dist/openai-operation.d.ts +22 -0
  89. package/dist/openai-operation.js +18 -0
  90. package/dist/outbound-api/auditCapture.cjs +3 -3
  91. package/dist/outbound-api/auditCapture.d.cts +13 -2
  92. package/dist/outbound-api/auditCapture.d.ts +13 -2
  93. package/dist/outbound-api/auditCapture.js +2 -2
  94. package/dist/outbound-api/auditRedact.cjs +2 -2
  95. package/dist/outbound-api/auditRedact.js +1 -1
  96. package/dist/outbound-api/routeResolver.cjs +2 -2
  97. package/dist/outbound-api/routeResolver.d.cts +11 -4
  98. package/dist/outbound-api/routeResolver.d.ts +11 -4
  99. package/dist/outbound-api/routeResolver.js +1 -1
  100. package/dist/outbound-api/subscriptionRegistryPort.d.cts +5 -1
  101. package/dist/outbound-api/subscriptionRegistryPort.d.ts +5 -1
  102. package/dist/outbound-api/types.d.cts +10 -3
  103. package/dist/outbound-api/types.d.ts +10 -3
  104. package/dist/outbound-api.cjs +65 -33
  105. package/dist/outbound-api.d.cts +205 -10
  106. package/dist/outbound-api.d.ts +205 -10
  107. package/dist/outbound-api.js +64 -32
  108. package/dist/pipeline/AccountAllowanceScheduling.d.cts +22 -15
  109. package/dist/pipeline/AccountAllowanceScheduling.d.ts +22 -15
  110. package/dist/pipeline/LlmConfigProviderAuth.cjs +3 -3
  111. package/dist/pipeline/LlmConfigProviderAuth.js +2 -2
  112. package/dist/pipeline/SubscriptionAccountHealth.cjs +2 -2
  113. package/dist/pipeline/SubscriptionAccountHealth.d.cts +7 -0
  114. package/dist/pipeline/SubscriptionAccountHealth.d.ts +7 -0
  115. package/dist/pipeline/SubscriptionAccountHealth.js +1 -1
  116. package/dist/pipeline/executeProviderCall.cjs +2 -2
  117. package/dist/pipeline/executeProviderCall.d.cts +11 -6
  118. package/dist/pipeline/executeProviderCall.d.ts +11 -6
  119. package/dist/pipeline/executeProviderCall.js +1 -1
  120. package/dist/pipeline/upstreamFetch.cjs +2 -2
  121. package/dist/pipeline/upstreamFetch.d.cts +5 -0
  122. package/dist/pipeline/upstreamFetch.d.ts +5 -0
  123. package/dist/pipeline/upstreamFetch.js +1 -1
  124. package/dist/ports.d.cts +10 -3
  125. package/dist/ports.d.ts +10 -3
  126. package/dist/provider-proxy/ProviderProxy.cjs +32 -28
  127. package/dist/provider-proxy/ProviderProxy.d.cts +6 -2
  128. package/dist/provider-proxy/ProviderProxy.d.ts +6 -2
  129. package/dist/provider-proxy/ProviderProxy.js +31 -27
  130. package/dist/provider-proxy/identity/codexCliHeaders.cjs +4 -2
  131. package/dist/provider-proxy/identity/codexCliHeaders.d.cts +26 -6
  132. package/dist/provider-proxy/identity/codexCliHeaders.d.ts +26 -6
  133. package/dist/provider-proxy/identity/codexCliHeaders.js +5 -3
  134. package/dist/provider-proxy/ingress/providerProxyShared.cjs +36 -28
  135. package/dist/provider-proxy/ingress/providerProxyShared.d.cts +41 -9
  136. package/dist/provider-proxy/ingress/providerProxyShared.d.ts +41 -9
  137. package/dist/provider-proxy/ingress/providerProxyShared.js +35 -27
  138. package/dist/provider-proxy/types.d.cts +17 -483
  139. package/dist/provider-proxy/types.d.ts +17 -483
  140. package/dist/provider-proxy.cjs +46 -28
  141. package/dist/provider-proxy.d.cts +34 -8
  142. package/dist/provider-proxy.d.ts +34 -8
  143. package/dist/provider-proxy.js +45 -27
  144. package/dist/proxy-UZTtjPZx.d.cts +18 -0
  145. package/dist/proxy-UZTtjPZx.d.ts +18 -0
  146. package/dist/{routeResolver-CVFE8KKe.d.cts → routeResolver-Da0yvkL1.d.cts} +4 -2
  147. package/dist/{routeResolver-C0mkkZaM.d.ts → routeResolver-STwMz_G4.d.ts} +4 -2
  148. package/dist/runtime-6QXNU526.cjs +8 -0
  149. package/dist/runtime-M5WXLD2R.js +8 -0
  150. package/dist/runtime-t8AZacFF.d.cts +233 -0
  151. package/dist/runtime-t8AZacFF.d.ts +233 -0
  152. package/dist/search/api.cjs +761 -0
  153. package/dist/search/api.d.cts +370 -0
  154. package/dist/search/api.d.ts +370 -0
  155. package/dist/search/api.js +761 -0
  156. package/dist/search/http.cjs +37 -0
  157. package/dist/search/http.d.cts +269 -0
  158. package/dist/search/http.d.ts +269 -0
  159. package/dist/search/http.js +37 -0
  160. package/dist/search.cjs +57 -0
  161. package/dist/search.d.cts +113 -0
  162. package/dist/search.d.ts +113 -0
  163. package/dist/search.js +57 -0
  164. package/dist/transformer/TransformerChainExecutor.cjs +2 -2
  165. package/dist/transformer/TransformerChainExecutor.d.cts +2 -2
  166. package/dist/transformer/TransformerChainExecutor.d.ts +2 -2
  167. package/dist/transformer/TransformerChainExecutor.js +1 -1
  168. package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.cjs +16 -0
  169. package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.d.cts +53 -0
  170. package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.d.ts +53 -0
  171. package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.js +16 -0
  172. package/dist/transformer/transformers/AnthropicTransformer.cjs +4 -3
  173. package/dist/transformer/transformers/AnthropicTransformer.js +3 -2
  174. package/dist/transformer/transformers/GeminiCodeAssistTransformer.cjs +4 -4
  175. package/dist/transformer/transformers/GeminiCodeAssistTransformer.js +3 -3
  176. package/dist/transformer/transformers/GeminiTransformer.cjs +4 -4
  177. package/dist/transformer/transformers/GeminiTransformer.js +3 -3
  178. package/dist/transformer/transformers/OpenAIResponseTransformer.cjs +3 -3
  179. package/dist/transformer/transformers/OpenAIResponseTransformer.js +2 -2
  180. package/dist/transformer/transformers/OpenAITransformer.cjs +3 -3
  181. package/dist/transformer/transformers/OpenAITransformer.js +2 -2
  182. package/dist/transformer/transformers.cjs +11 -10
  183. package/dist/transformer/transformers.js +12 -11
  184. package/dist/transformer/types.d.cts +39 -4
  185. package/dist/transformer/types.d.ts +39 -4
  186. package/dist/transformer.cjs +14 -13
  187. package/dist/transformer.js +13 -12
  188. package/dist/types-BSIJdsyl.d.cts +1130 -0
  189. package/dist/types-Be-yt_6T.d.cts +196 -0
  190. package/dist/types-By9Tg6-I.d.ts +1130 -0
  191. package/dist/types-CbCZqLGg.d.cts +127 -0
  192. package/dist/types-CbCZqLGg.d.ts +127 -0
  193. package/dist/{types-C2MwkLah.d.cts → types-D-oHYusb.d.cts} +250 -21
  194. package/dist/types-Dm4_36V4.d.ts +196 -0
  195. package/dist/{types-BB8pxk_3.d.ts → types-Dvlpjn0d.d.ts} +250 -21
  196. package/dist/usage.cjs +2 -2
  197. package/dist/usage.d.cts +6 -1
  198. package/dist/usage.d.ts +6 -1
  199. package/dist/usage.js +1 -1
  200. package/package.json +71 -64
  201. package/dist/chunk-FCR77GYM.cjs +0 -33
  202. package/dist/chunk-K5NM7VAH.js +0 -33
  203. /package/dist/{chunk-XXFYLL7R.js → chunk-ECZ3ZE2C.js} +0 -0
  204. /package/dist/{chunk-3SCOLIPT.cjs → chunk-MXI2PWIC.cjs} +0 -0
@@ -1,18 +1,22 @@
1
1
  import { VoucherConfig } from '@omnicross/contracts/voucher-types';
2
- import { c as EndpointRoutingConfig, G as GatewayBinding, U as UserMessageQueueConfig, b as ConcurrencyQueueConfig, n as OutboundApiDeps, r as OutboundApiServerStatus, t as OutboundFormatUrls, A as AccountProbeConfig, a as AllowanceSchedulingConfig, F as FingerprintConfig, q as OutboundApiServerConfig, m as ModelPrefixTargets, x as OutboundProxyConfig, s as OutboundEndpoint, R as RequestRole, Q as ModelRef, k as KindMappedEndpoint, l as ModelKind, O as OutboundKeyDb, o as OutboundApiKeyCreated } from './types-C2MwkLah.cjs';
3
- export { C as ChatDispatchMode, E as ENDPOINT_MODEL_KINDS, d as GatewayBindingFallback, e as GatewayBindingKeyScope, f as GatewayBindingModelMode, g as GatewayBindingTarget, h as GatewayModelMapping, K as KeySpendReader, i as KeySpendSeeder, j as KeySpendTracker, M as MessagesModelKind, p as OutboundApiKeyInfo, u as OutboundKeyActivationMode, v as OutboundKeyDbRow, w as OutboundKeyPolicy, y as ResponsesModelKind, V as VoucherCreateInput, z as VoucherDb, B as computeVoucherGrant, D as generateVoucherCode, H as hashVoucherCode, I as newVoucherId, J as startOfLocalDay, L as startOfLocalWeek, N as toVoucherInfo, P as voucherCodePrefix } from './types-C2MwkLah.cjs';
2
+ import { c as EndpointRoutingConfig, G as GatewayBinding, U as UserMessageQueueConfig, b as ConcurrencyQueueConfig, X as AnthropicConfigSegment, S as SearchServerConfig, n as OutboundApiDeps, r as OutboundApiServerStatus, t as OutboundFormatUrls, A as AccountProbeConfig, a as AllowanceSchedulingConfig, F as FingerprintConfig, q as OutboundApiServerConfig, m as ModelPrefixTargets, y as OutboundProxyConfig, I as ImagesServerConfig, s as OutboundEndpoint, R as RequestRole, W as ModelRef, k as KindMappedEndpoint, l as ModelKind, x as OutboundPermission, O as OutboundKeyDb, o as OutboundApiKeyCreated } from './types-D-oHYusb.cjs';
3
+ export { C as ChatDispatchMode, E as ENDPOINT_MODEL_KINDS, d as GatewayBindingFallback, e as GatewayBindingKeyScope, f as GatewayBindingModelMode, g as GatewayBindingTarget, h as GatewayModelMapping, K as KeySpendReader, i as KeySpendSeeder, j as KeySpendTracker, M as MessagesModelKind, p as OutboundApiKeyInfo, u as OutboundKeyActivationMode, v as OutboundKeyDbRow, w as OutboundKeyPolicy, z as ResponsesModelKind, V as VoucherCreateInput, B as VoucherDb, D as computeVoucherGrant, H as generateVoucherCode, J as hashVoucherCode, L as newVoucherId, N as startOfLocalDay, P as startOfLocalWeek, Q as toVoucherInfo, T as voucherCodePrefix } from './types-D-oHYusb.cjs';
4
4
  import { ProxyConfig } from '@omnicross/contracts/account-tokens-types';
5
5
  import { AuditConfig } from '@omnicross/contracts/audit-types';
6
6
  import { BillingConfig } from '@omnicross/contracts/billing-types';
7
7
  import { WebhookDestination, WebhookConfig } from '@omnicross/contracts/webhook-types';
8
+ import { e as ImageApiLimits } from './types-Be-yt_6T.cjs';
9
+ import { S as SearchApiProviderConfigs } from './types-CbCZqLGg.cjs';
10
+ import http from 'node:http';
11
+ import { c as SearchFrontendMode } from './frontends-Doz0RaWu.cjs';
12
+ import { S as SearchRuntime } from './runtime-t8AZacFF.cjs';
8
13
  export { AUDIT_REDACTED, redactAuditText } from './outbound-api/auditRedact.cjs';
9
14
  export { AuditCaptureContext, beginAuditCapture } from './outbound-api/auditCapture.cjs';
10
15
  export { BillingCaptureContext, beginBillingCapture } from './outbound-api/billingCapture.cjs';
11
16
  import { K as KeyCostLimits, M as ModelRestriction } from './keyPolicy-zdWTu3CQ.cjs';
12
17
  export { a as KeyExpiryInput, b as KeyExpiryResult, c as KeySpend, Q as QuotaDecision, d as checkKeyQuota, e as computeKeyExpiry } from './keyPolicy-zdWTu3CQ.cjs';
13
- import http from 'node:http';
14
- import { IngressFormat } from './provider-proxy/types.cjs';
15
- export { S as SUBSCRIPTION_PROVIDER_IDS, e as endpointSupportsSubscription, i as isSubscriptionProviderId, p as parseModelRef, a as pickModelRefFromList, r as resolveRoute } from './routeResolver-CVFE8KKe.cjs';
18
+ import { D as IngressFormat } from './types-BSIJdsyl.cjs';
19
+ export { S as SUBSCRIPTION_PROVIDER_IDS, e as endpointSupportsSubscription, i as isSubscriptionProviderId, p as parseModelRef, a as pickModelRefFromList, r as resolveRoute } from './routeResolver-Da0yvkL1.cjs';
16
20
  export { BoundAccountFallbackPolicy, BoundAccountSelectionError, BoundAccountSelectionFailureReason, boundAccountSelectionMessage, isBoundAccountSelectionError } from './pipeline/BoundAccountSelectionError.cjs';
17
21
  import '@omnicross/contracts/health-logging-types';
18
22
  import './logger-4GvQNzhE.cjs';
@@ -21,7 +25,10 @@ import '@omnicross/contracts/llm-config';
21
25
  import './transformer/types.cjs';
22
26
  import '@omnicross/contracts/completion-types';
23
27
  import './transformer/TransformerService.cjs';
24
- import './ProviderProxy-QdwNV6l1.cjs';
28
+ import './ProviderProxy-Bz_nkOwq.cjs';
29
+ import '@omnicross/contracts/image-generation-types';
30
+ import 'node:fs/promises';
31
+ import '@omnicross/contracts/search-types';
25
32
  import '@omnicross/contracts/usage-stats-types';
26
33
  import '@omnicross/contracts/subscription-types';
27
34
  import '@omnicross/contracts/usage-types';
@@ -62,6 +69,8 @@ declare const DEFAULT_OUTBOUND_PORT = 8765;
62
69
  interface ApplyConfigInput {
63
70
  enabled: boolean;
64
71
  networkBinding: boolean;
72
+ /** Additive Images URL publication; serving still depends on runtime capability. */
73
+ imagesEnabled?: boolean;
65
74
  endpoints: EndpointRoutingConfig[];
66
75
  /** Independent resource bindings; absent preserves legacy endpoint routing. */
67
76
  bindings?: GatewayBinding[];
@@ -73,6 +82,20 @@ interface ApplyConfigInput {
73
82
  /** Voucher segment (voucher-redemption #9). Read live per request; absent ⇒
74
83
  * disabled ⇒ the `/redeem` endpoint is inert (zero regression). */
75
84
  voucher?: VoucherConfig;
85
+ /** Anthropic-protocol segment (claude-api-protocol-fidelity, §10). Read live
86
+ * per request; the heartbeat value is hot-applied to the stream synthesizer. */
87
+ anthropic?: AnthropicConfigSegment;
88
+ /**
89
+ * Search assembly segment (plan 阶段5). Read live per request for the Codex
90
+ * frontend's mode; the runtime itself is wired once through `deps`.
91
+ */
92
+ search?: SearchServerConfig;
93
+ }
94
+ /** Prepared listener/config publication used by the daemon's settings transaction. */
95
+ interface PreparedOutboundApiConfig {
96
+ publish(): Promise<void>;
97
+ rollback(): Promise<void>;
98
+ dispose(): Promise<void>;
76
99
  }
77
100
  declare class OutboundApiServer {
78
101
  private readonly deps;
@@ -86,6 +109,11 @@ declare class OutboundApiServer {
86
109
  private userMessageQueue;
87
110
  private concurrencyQueue;
88
111
  private voucherConfig;
112
+ private anthropicConfig;
113
+ private searchConfig;
114
+ private imagesEnabled;
115
+ /** R10 `/api/hello` switch (§10 `anthropic.apiHello`, default true). */
116
+ private apiHelloEnabled;
89
117
  private readonly rateLimiter;
90
118
  /**
91
119
  * Redeem-attempt limiter (voucher-redemption #9, design D6) — a SEPARATE bucket
@@ -111,12 +139,35 @@ declare class OutboundApiServer {
111
139
  * in place (read live per request — no restart).
112
140
  */
113
141
  applyConfig(input: ApplyConfigInput): Promise<void>;
142
+ /**
143
+ * Prepare any new listener before persistence when the target can coexist with
144
+ * the current socket. A live fixed-port address-only change cannot be made
145
+ * failure-atomic on every supported platform because the replacement cannot
146
+ * coexist with the old socket, so reject it before persistence instead of
147
+ * performing a fallible close-then-bind during publication.
148
+ */
149
+ prepareConfig(input: ApplyConfigInput): Promise<PreparedOutboundApiConfig>;
114
150
  /** Start the listener on `bindAddr:port`, falling back on EADDRINUSE. */
115
151
  start(bindAddr: string, port: number): Promise<number>;
116
152
  /** Bind once; on EADDRINUSE retry with an ephemeral port (port 0). */
117
- private listen;
153
+ private listenDetached;
154
+ private createHttpServer;
155
+ private installConfigSnapshot;
156
+ private captureRuntimeSnapshot;
157
+ private installRuntimeSnapshot;
158
+ private restoreRuntimeSnapshot;
159
+ private closeServer;
160
+ /** Publication already swapped the authoritative pointer; retirement cannot fail it. */
161
+ private closePublishedServer;
162
+ private announcePublishedListener;
118
163
  /** Per-request handler. Auth is enforced on EVERY request (incl. loopback). */
119
164
  private onRequest;
165
+ /**
166
+ * Serve `HEAD /api/hello` (exact path, query tolerated) with a bare 200 —
167
+ * returning true when it handled the request. Unauthenticated by design and
168
+ * gated on `anthropic.apiHello` (default true).
169
+ */
170
+ private tryServeApiHello;
120
171
  /**
121
172
  * Serve `GET|HEAD /health` (+ `/healthz`) from the injected provider, returning
122
173
  * true when it handled the request. 200 when `ok`, else 503; secret-free body.
@@ -321,6 +372,142 @@ declare function saveServerConfig(store: ApiServerSettingsStore, config: Outboun
321
372
  /** Apply a partial patch to a config, returning the merged whole. */
322
373
  declare function mergeServerConfig(current: OutboundApiServerConfig, patch: Partial<OutboundApiServerConfig>): OutboundApiServerConfig;
323
374
 
375
+ /** Immutable upper bounds used by both tolerant reads and strict admin writes. */
376
+ declare const IMAGE_SERVER_HARD_CEILINGS: Readonly<{
377
+ queue: Readonly<{
378
+ maxConcurrentJobsPerAccount: 8;
379
+ maxQueuedJobs: 1000;
380
+ queueTimeoutMs: number;
381
+ generationTimeoutMs: number;
382
+ }>;
383
+ temporary: Readonly<{
384
+ maxActiveScopes: 256;
385
+ maxTotalBytes: number;
386
+ maxTenantBytes: number;
387
+ staleAfterMs: number;
388
+ cleanupIntervalMs: number;
389
+ }>;
390
+ limits: Readonly<ImageApiLimits>;
391
+ references: Readonly<{
392
+ ttlMs: number;
393
+ maxArtifactBytes: number;
394
+ maxTotalBytes: number;
395
+ maxTenantBytes: number;
396
+ maxEntries: 1000000;
397
+ maxCalls: 2000000;
398
+ maxResponses: 1000000;
399
+ maxTombstones: 2000000;
400
+ tombstoneTtlMs: number;
401
+ cleanupIntervalMs: number;
402
+ }>;
403
+ evidenceTtlMs: number;
404
+ }>;
405
+ /** Migration-safe default: configured off, finite everywhere, and remote-disabled. */
406
+ declare const DEFAULT_IMAGES_SERVER_CONFIG: Readonly<ImagesServerConfig>;
407
+ /** Tolerant read normalization: malformed members fall back or clamp, never throw. */
408
+ declare function normalizeImagesServerConfig(value: unknown): ImagesServerConfig;
409
+ /** Strict structural/range validation. Daemon validation adds filesystem and resolver policy. */
410
+ declare function validateImagesServerConfig(value: unknown): string[];
411
+
412
+ /**
413
+ * The persisted `search` config section — tolerant read, strict report.
414
+ *
415
+ * Two functions over the same shape, exactly as the Images section does it:
416
+ * {@link normalizeSearchServerConfig} never throws (a malformed member falls
417
+ * back or is dropped, so a bad config cannot take the daemon down), and
418
+ * {@link validateSearchServerConfig} says what was unusable so an operator can
419
+ * fix it.
420
+ *
421
+ * **Nothing here ever echoes a configured VALUE.** Every validation message
422
+ * names a FIELD. An API key, a Basic-auth password and an internal hostname are
423
+ * all things a validation log must not leak, and the cheapest way to guarantee
424
+ * that is a rule with no exceptions rather than a per-field judgement call.
425
+ *
426
+ * @module outbound-api/searchServerConfig
427
+ */
428
+
429
+ /** The frozen defaults, for comparison and for callers with no config at all. */
430
+ declare const DEFAULT_SEARCH_SERVER_CONFIG: Readonly<SearchServerConfig>;
431
+ /** Tolerant read: unusable members are DROPPED, which leaves them unconfigured. */
432
+ declare function normalizeSearchApiProviderConfigs(value: unknown): SearchApiProviderConfigs;
433
+ /** Tolerant read of the whole section. Never throws; an absent section is the default. */
434
+ declare function normalizeSearchServerConfig(value: unknown): SearchServerConfig;
435
+ /**
436
+ * Report what a `search` section got wrong, field by field.
437
+ *
438
+ * Returns `[]` for a valid (or absent) section. Callers surface the list the
439
+ * way the Images config's errors are surfaced — reported, not thrown — because
440
+ * a search misconfiguration must not prevent the gateway from serving text.
441
+ */
442
+ declare function validateSearchServerConfig(value: unknown, path?: string): string[];
443
+
444
+ /**
445
+ * The Codex search route — `POST /v1/alpha/search`.
446
+ *
447
+ * ## Compatibility source
448
+ *
449
+ * From `docs/design/search-baseline/wire-baseline.md` §1, over 11 real audit
450
+ * records produced by `codex-tui` 0.151.0 and 0.152.0:
451
+ *
452
+ * The request and response contracts are pinned from the Codex 0.152.0 typed
453
+ * API definitions and standalone-search integration fixtures. Codex sends text
454
+ * queries under `commands.search_query[].q` and requires a string `output` in
455
+ * the JSON response; structured `results` are optional opaque DTOs.
456
+ *
457
+ * ## What this route does about that
458
+ *
459
+ * The default mode is `off`, and `off` answers with a structured
460
+ * `unsupported_capability` error instead of the generic 404 (plan §15). That is
461
+ * strictly more informative than today's behavior and claims nothing.
462
+ *
463
+ * Enabling `managed` accepts Codex text-search commands plus the legacy flat
464
+ * query spellings used by early Omnicross clients. Other Codex command kinds
465
+ * are rejected because the shared runtime currently exposes text search only.
466
+ *
467
+ * ## The designed side effect
468
+ *
469
+ * A dispatched request reaches route resolution and is given a `sessionKey`, so
470
+ * the audit body store finally persists `/v1/alpha/search` exchanges. The
471
+ * capture that 阶段0 proved impossible becomes possible when a real client talks
472
+ * to an enabled route.
473
+ *
474
+ * @module outbound-api/searchRoute
475
+ */
476
+
477
+ /** The path observed on every one of the 11 baselined records. */
478
+ declare const codexSearchRoutePath = "/v1/alpha/search";
479
+ /** Everything the handler needs, injected so it is testable without a daemon. */
480
+ interface CodexSearchRouteDeps {
481
+ /** Resolved ONCE per request by the caller, before any wire bytes. */
482
+ readonly mode: SearchFrontendMode;
483
+ /**
484
+ * The single shared runtime. Absent behaves exactly like mode `off`.
485
+ *
486
+ * Selection and fallback policy live INSIDE it (阶段3): this route never
487
+ * builds a candidate list, and adding a per-request policy override here
488
+ * would be the second fallback order the extraction exists to prevent.
489
+ */
490
+ readonly runtime?: SearchRuntime | null;
491
+ /** Cancellation, wired to the client connection by the caller. */
492
+ readonly signal?: AbortSignal;
493
+ /**
494
+ * Audit hook. The route calls this with the raw body and the parsed object so
495
+ * the caller can stash the body and derive the session key — the mechanism
496
+ * that unblocks `/v1/alpha/search` body capture (see the module note).
497
+ */
498
+ readonly onRequestBody?: (raw: string, parsed: Record<string, unknown>) => void;
499
+ }
500
+ /** `POST` + a path ending in `/alpha/search`. Nothing else is this route. */
501
+ declare function isCodexSearchRequest(method: string | undefined, url: string | undefined): boolean;
502
+ /**
503
+ * Serve one `POST /v1/alpha/search`.
504
+ *
505
+ * Always answers: a structured JSON error or a structured JSON result, never a
506
+ * hang, never a bare 404. The caller has already authenticated the request and
507
+ * resolved `deps.mode`.
508
+ */
509
+ declare function handleCodexSearchRequest(req: http.IncomingMessage, res: http.ServerResponse, deps: CodexSearchRouteDeps): Promise<void>;
510
+
324
511
  /**
325
512
  * Either the winning route projected to the resolver shape, or `none` — no
326
513
  * enabled route for this key/endpoint could serve the request. There is no
@@ -690,7 +877,15 @@ declare function createNamedKey(db: OutboundKeyDb, name: string): Promise<Outbou
690
877
  * Mint the local gateway key used by native CLI configuration adapters. Unlike
691
878
  * a user-distributed key it is explicitly loopback-only and endpoint-scoped.
692
879
  */
693
- declare function createIntegrationKey(db: OutboundKeyDb, name: string, allowedEndpoints?: OutboundEndpoint[]): Promise<OutboundApiKeyCreated>;
880
+ declare function createIntegrationKey(db: OutboundKeyDb, name: string, allowedEndpoints?: OutboundPermission[]): Promise<OutboundApiKeyCreated>;
881
+ declare const LEGACY_OUTBOUND_PERMISSIONS: readonly OutboundPermission[];
882
+ /** Strict write-edge validator. Stored-row reads use fail-closed interpretation below. */
883
+ declare function validateOutboundPermissions(value: unknown): OutboundPermission[];
884
+ /**
885
+ * Authoritative legacy interpretation. Absence preserves only the four historic
886
+ * families; malformed persisted data denies all instead of widening access.
887
+ */
888
+ declare function effectiveOutboundPermissions(value: unknown): readonly OutboundPermission[];
694
889
  /**
695
890
  * A verified key + the enforcement inputs carried from the row so the wire layer
696
891
  * runs its policy checks WITHOUT a second DB read (mirrors `maxConcurrency`).
@@ -698,7 +893,7 @@ declare function createIntegrationKey(db: OutboundKeyDb, name: string, allowedEn
698
893
  interface VerifiedKey {
699
894
  id: string;
700
895
  kind?: 'client' | 'integration';
701
- allowedEndpoints?: OutboundEndpoint[];
896
+ allowedEndpoints: OutboundPermission[];
702
897
  loopbackOnly?: boolean;
703
898
  /**
704
899
  * The key's per-key concurrency ceiling, carried from the row so the wire
@@ -920,4 +1115,4 @@ declare function getOutboundApiServer(deps?: OutboundApiDeps, onPortChange?: (po
920
1115
  /** Reset the singleton (tests / teardown only). */
921
1116
  declare function __resetOutboundApiServerForTests(): void;
922
1117
 
923
- export { AccountProbeConfig, AllowanceSchedulingConfig, type ApiServerSettingsStore, type ApplyConfigInput, ConcurrencyQueueConfig, ConcurrencyQueueFullError, ConcurrencyWaitCancelledError, ConcurrencyWaitTimeoutError, DEFAULT_ACCOUNT_PROBE, DEFAULT_ALLOWANCE_SCHEDULING, DEFAULT_CONCURRENCY_QUEUE, DEFAULT_FINGERPRINT, DEFAULT_OUTBOUND_PORT, DEFAULT_USER_MESSAGE_QUEUE, EndpointRoutingConfig, FingerprintConfig, type GateAcquireOptions, type GateAcquisition, type GateSlot, type GateStatusEntry, GatewayBinding, type GatewayBindingResolution, KeyCostLimits, type KeyVerification, KeyedMutex, KindMappedEndpoint, ModelKind, type ModelPrefixKind, ModelPrefixTargets, OUTBOUND_API_SERVER_CONFIG_KEY, OutboundApiDeps, OutboundApiKeyCreated, OutboundApiServer, OutboundApiServerConfig, OutboundApiServerStatus, OutboundConcurrencyGate, OutboundEndpoint, OutboundFormatUrls, OutboundKeyDb, OutboundProxyConfig, OutboundRateLimiter, RequestRole, type ResolveGatewayBindingInput, type SerialAcquireOptions, type SerialQueueStatusEntry, SerialQueueTimeoutError, type SerialSlot, UserMessageQueueConfig, UserMessageSerialQueue, type VerifiedKey, __resetOutboundApiServerForTests, candidateBackgroundModelIds, candidateGatewayBindings, classifyModelPrefix, createIntegrationKey, createNamedKey, defaultServerConfig, detectModelKind, detectRequestRole, endpointToIngressFormat, formatUrls, gatewayBindingToEndpointConfig, getOutboundApiServer, handleVoucherRedeem, hashKey, isConcurrencyRejection, isKindMappedEndpoint, isRedeemRequest, isSerialQueueTimeout, isUserMessageRequest, legacyEndpointsToBindings, loadServerConfig, mergeServerConfig, modelKindsForEndpoint, normalizeAccountProbe, normalizeAllowanceScheduling, normalizeAudit, normalizeBilling, normalizeFingerprint, normalizeGatewayBindings, normalizePrefixTargets, normalizeProxyConfig, normalizeProxySegment, normalizeQueueSegments, normalizeServerConfig, normalizeVoucher, normalizeWebhookDestination, normalizeWebhookSegment, randomBase62, resolveGatewayBinding, resolvePrefixTarget, saveServerConfig, validateEndpointModelConfig, verifyKey, verifyPresentedKey };
1118
+ export { AccountProbeConfig, AllowanceSchedulingConfig, type ApiServerSettingsStore, type ApplyConfigInput, type CodexSearchRouteDeps, ConcurrencyQueueConfig, ConcurrencyQueueFullError, ConcurrencyWaitCancelledError, ConcurrencyWaitTimeoutError, DEFAULT_ACCOUNT_PROBE, DEFAULT_ALLOWANCE_SCHEDULING, DEFAULT_CONCURRENCY_QUEUE, DEFAULT_FINGERPRINT, DEFAULT_IMAGES_SERVER_CONFIG, DEFAULT_OUTBOUND_PORT, DEFAULT_SEARCH_SERVER_CONFIG, DEFAULT_USER_MESSAGE_QUEUE, EndpointRoutingConfig, FingerprintConfig, type GateAcquireOptions, type GateAcquisition, type GateSlot, type GateStatusEntry, GatewayBinding, type GatewayBindingResolution, IMAGE_SERVER_HARD_CEILINGS, ImagesServerConfig, KeyCostLimits, type KeyVerification, KeyedMutex, KindMappedEndpoint, LEGACY_OUTBOUND_PERMISSIONS, ModelKind, type ModelPrefixKind, ModelPrefixTargets, OUTBOUND_API_SERVER_CONFIG_KEY, OutboundApiDeps, OutboundApiKeyCreated, OutboundApiServer, OutboundApiServerConfig, OutboundApiServerStatus, OutboundConcurrencyGate, OutboundEndpoint, OutboundFormatUrls, OutboundKeyDb, OutboundPermission, OutboundProxyConfig, OutboundRateLimiter, type PreparedOutboundApiConfig, RequestRole, type ResolveGatewayBindingInput, SearchServerConfig, type SerialAcquireOptions, type SerialQueueStatusEntry, SerialQueueTimeoutError, type SerialSlot, UserMessageQueueConfig, UserMessageSerialQueue, type VerifiedKey, __resetOutboundApiServerForTests, candidateBackgroundModelIds, candidateGatewayBindings, classifyModelPrefix, codexSearchRoutePath, createIntegrationKey, createNamedKey, defaultServerConfig, detectModelKind, detectRequestRole, effectiveOutboundPermissions, endpointToIngressFormat, formatUrls, gatewayBindingToEndpointConfig, getOutboundApiServer, handleCodexSearchRequest, handleVoucherRedeem, hashKey, isCodexSearchRequest, isConcurrencyRejection, isKindMappedEndpoint, isRedeemRequest, isSerialQueueTimeout, isUserMessageRequest, legacyEndpointsToBindings, loadServerConfig, mergeServerConfig, modelKindsForEndpoint, normalizeAccountProbe, normalizeAllowanceScheduling, normalizeAudit, normalizeBilling, normalizeFingerprint, normalizeGatewayBindings, normalizeImagesServerConfig, normalizePrefixTargets, normalizeProxyConfig, normalizeProxySegment, normalizeQueueSegments, normalizeSearchApiProviderConfigs, normalizeSearchServerConfig, normalizeServerConfig, normalizeVoucher, normalizeWebhookDestination, normalizeWebhookSegment, randomBase62, resolveGatewayBinding, resolvePrefixTarget, saveServerConfig, validateEndpointModelConfig, validateImagesServerConfig, validateOutboundPermissions, validateSearchServerConfig, verifyKey, verifyPresentedKey };
@@ -1,18 +1,22 @@
1
1
  import { VoucherConfig } from '@omnicross/contracts/voucher-types';
2
- import { c as EndpointRoutingConfig, G as GatewayBinding, U as UserMessageQueueConfig, b as ConcurrencyQueueConfig, n as OutboundApiDeps, r as OutboundApiServerStatus, t as OutboundFormatUrls, A as AccountProbeConfig, a as AllowanceSchedulingConfig, F as FingerprintConfig, q as OutboundApiServerConfig, m as ModelPrefixTargets, x as OutboundProxyConfig, s as OutboundEndpoint, R as RequestRole, Q as ModelRef, k as KindMappedEndpoint, l as ModelKind, O as OutboundKeyDb, o as OutboundApiKeyCreated } from './types-BB8pxk_3.js';
3
- export { C as ChatDispatchMode, E as ENDPOINT_MODEL_KINDS, d as GatewayBindingFallback, e as GatewayBindingKeyScope, f as GatewayBindingModelMode, g as GatewayBindingTarget, h as GatewayModelMapping, K as KeySpendReader, i as KeySpendSeeder, j as KeySpendTracker, M as MessagesModelKind, p as OutboundApiKeyInfo, u as OutboundKeyActivationMode, v as OutboundKeyDbRow, w as OutboundKeyPolicy, y as ResponsesModelKind, V as VoucherCreateInput, z as VoucherDb, B as computeVoucherGrant, D as generateVoucherCode, H as hashVoucherCode, I as newVoucherId, J as startOfLocalDay, L as startOfLocalWeek, N as toVoucherInfo, P as voucherCodePrefix } from './types-BB8pxk_3.js';
2
+ import { c as EndpointRoutingConfig, G as GatewayBinding, U as UserMessageQueueConfig, b as ConcurrencyQueueConfig, X as AnthropicConfigSegment, S as SearchServerConfig, n as OutboundApiDeps, r as OutboundApiServerStatus, t as OutboundFormatUrls, A as AccountProbeConfig, a as AllowanceSchedulingConfig, F as FingerprintConfig, q as OutboundApiServerConfig, m as ModelPrefixTargets, y as OutboundProxyConfig, I as ImagesServerConfig, s as OutboundEndpoint, R as RequestRole, W as ModelRef, k as KindMappedEndpoint, l as ModelKind, x as OutboundPermission, O as OutboundKeyDb, o as OutboundApiKeyCreated } from './types-Dvlpjn0d.js';
3
+ export { C as ChatDispatchMode, E as ENDPOINT_MODEL_KINDS, d as GatewayBindingFallback, e as GatewayBindingKeyScope, f as GatewayBindingModelMode, g as GatewayBindingTarget, h as GatewayModelMapping, K as KeySpendReader, i as KeySpendSeeder, j as KeySpendTracker, M as MessagesModelKind, p as OutboundApiKeyInfo, u as OutboundKeyActivationMode, v as OutboundKeyDbRow, w as OutboundKeyPolicy, z as ResponsesModelKind, V as VoucherCreateInput, B as VoucherDb, D as computeVoucherGrant, H as generateVoucherCode, J as hashVoucherCode, L as newVoucherId, N as startOfLocalDay, P as startOfLocalWeek, Q as toVoucherInfo, T as voucherCodePrefix } from './types-Dvlpjn0d.js';
4
4
  import { ProxyConfig } from '@omnicross/contracts/account-tokens-types';
5
5
  import { AuditConfig } from '@omnicross/contracts/audit-types';
6
6
  import { BillingConfig } from '@omnicross/contracts/billing-types';
7
7
  import { WebhookDestination, WebhookConfig } from '@omnicross/contracts/webhook-types';
8
+ import { e as ImageApiLimits } from './types-Dm4_36V4.js';
9
+ import { S as SearchApiProviderConfigs } from './types-CbCZqLGg.js';
10
+ import http from 'node:http';
11
+ import { c as SearchFrontendMode } from './frontends-Doz0RaWu.js';
12
+ import { S as SearchRuntime } from './runtime-t8AZacFF.js';
8
13
  export { AUDIT_REDACTED, redactAuditText } from './outbound-api/auditRedact.js';
9
14
  export { AuditCaptureContext, beginAuditCapture } from './outbound-api/auditCapture.js';
10
15
  export { BillingCaptureContext, beginBillingCapture } from './outbound-api/billingCapture.js';
11
16
  import { K as KeyCostLimits, M as ModelRestriction } from './keyPolicy-zdWTu3CQ.js';
12
17
  export { a as KeyExpiryInput, b as KeyExpiryResult, c as KeySpend, Q as QuotaDecision, d as checkKeyQuota, e as computeKeyExpiry } from './keyPolicy-zdWTu3CQ.js';
13
- import http from 'node:http';
14
- import { IngressFormat } from './provider-proxy/types.js';
15
- export { S as SUBSCRIPTION_PROVIDER_IDS, e as endpointSupportsSubscription, i as isSubscriptionProviderId, p as parseModelRef, a as pickModelRefFromList, r as resolveRoute } from './routeResolver-C0mkkZaM.js';
18
+ import { D as IngressFormat } from './types-By9Tg6-I.js';
19
+ export { S as SUBSCRIPTION_PROVIDER_IDS, e as endpointSupportsSubscription, i as isSubscriptionProviderId, p as parseModelRef, a as pickModelRefFromList, r as resolveRoute } from './routeResolver-STwMz_G4.js';
16
20
  export { BoundAccountFallbackPolicy, BoundAccountSelectionError, BoundAccountSelectionFailureReason, boundAccountSelectionMessage, isBoundAccountSelectionError } from './pipeline/BoundAccountSelectionError.js';
17
21
  import '@omnicross/contracts/health-logging-types';
18
22
  import './logger-4GvQNzhE.js';
@@ -21,7 +25,10 @@ import '@omnicross/contracts/llm-config';
21
25
  import './transformer/types.js';
22
26
  import '@omnicross/contracts/completion-types';
23
27
  import './transformer/TransformerService.js';
24
- import './ProviderProxy--ROec6VI.js';
28
+ import './ProviderProxy-Ckr6oTrE.js';
29
+ import '@omnicross/contracts/image-generation-types';
30
+ import 'node:fs/promises';
31
+ import '@omnicross/contracts/search-types';
25
32
  import '@omnicross/contracts/usage-stats-types';
26
33
  import '@omnicross/contracts/subscription-types';
27
34
  import '@omnicross/contracts/usage-types';
@@ -62,6 +69,8 @@ declare const DEFAULT_OUTBOUND_PORT = 8765;
62
69
  interface ApplyConfigInput {
63
70
  enabled: boolean;
64
71
  networkBinding: boolean;
72
+ /** Additive Images URL publication; serving still depends on runtime capability. */
73
+ imagesEnabled?: boolean;
65
74
  endpoints: EndpointRoutingConfig[];
66
75
  /** Independent resource bindings; absent preserves legacy endpoint routing. */
67
76
  bindings?: GatewayBinding[];
@@ -73,6 +82,20 @@ interface ApplyConfigInput {
73
82
  /** Voucher segment (voucher-redemption #9). Read live per request; absent ⇒
74
83
  * disabled ⇒ the `/redeem` endpoint is inert (zero regression). */
75
84
  voucher?: VoucherConfig;
85
+ /** Anthropic-protocol segment (claude-api-protocol-fidelity, §10). Read live
86
+ * per request; the heartbeat value is hot-applied to the stream synthesizer. */
87
+ anthropic?: AnthropicConfigSegment;
88
+ /**
89
+ * Search assembly segment (plan 阶段5). Read live per request for the Codex
90
+ * frontend's mode; the runtime itself is wired once through `deps`.
91
+ */
92
+ search?: SearchServerConfig;
93
+ }
94
+ /** Prepared listener/config publication used by the daemon's settings transaction. */
95
+ interface PreparedOutboundApiConfig {
96
+ publish(): Promise<void>;
97
+ rollback(): Promise<void>;
98
+ dispose(): Promise<void>;
76
99
  }
77
100
  declare class OutboundApiServer {
78
101
  private readonly deps;
@@ -86,6 +109,11 @@ declare class OutboundApiServer {
86
109
  private userMessageQueue;
87
110
  private concurrencyQueue;
88
111
  private voucherConfig;
112
+ private anthropicConfig;
113
+ private searchConfig;
114
+ private imagesEnabled;
115
+ /** R10 `/api/hello` switch (§10 `anthropic.apiHello`, default true). */
116
+ private apiHelloEnabled;
89
117
  private readonly rateLimiter;
90
118
  /**
91
119
  * Redeem-attempt limiter (voucher-redemption #9, design D6) — a SEPARATE bucket
@@ -111,12 +139,35 @@ declare class OutboundApiServer {
111
139
  * in place (read live per request — no restart).
112
140
  */
113
141
  applyConfig(input: ApplyConfigInput): Promise<void>;
142
+ /**
143
+ * Prepare any new listener before persistence when the target can coexist with
144
+ * the current socket. A live fixed-port address-only change cannot be made
145
+ * failure-atomic on every supported platform because the replacement cannot
146
+ * coexist with the old socket, so reject it before persistence instead of
147
+ * performing a fallible close-then-bind during publication.
148
+ */
149
+ prepareConfig(input: ApplyConfigInput): Promise<PreparedOutboundApiConfig>;
114
150
  /** Start the listener on `bindAddr:port`, falling back on EADDRINUSE. */
115
151
  start(bindAddr: string, port: number): Promise<number>;
116
152
  /** Bind once; on EADDRINUSE retry with an ephemeral port (port 0). */
117
- private listen;
153
+ private listenDetached;
154
+ private createHttpServer;
155
+ private installConfigSnapshot;
156
+ private captureRuntimeSnapshot;
157
+ private installRuntimeSnapshot;
158
+ private restoreRuntimeSnapshot;
159
+ private closeServer;
160
+ /** Publication already swapped the authoritative pointer; retirement cannot fail it. */
161
+ private closePublishedServer;
162
+ private announcePublishedListener;
118
163
  /** Per-request handler. Auth is enforced on EVERY request (incl. loopback). */
119
164
  private onRequest;
165
+ /**
166
+ * Serve `HEAD /api/hello` (exact path, query tolerated) with a bare 200 —
167
+ * returning true when it handled the request. Unauthenticated by design and
168
+ * gated on `anthropic.apiHello` (default true).
169
+ */
170
+ private tryServeApiHello;
120
171
  /**
121
172
  * Serve `GET|HEAD /health` (+ `/healthz`) from the injected provider, returning
122
173
  * true when it handled the request. 200 when `ok`, else 503; secret-free body.
@@ -321,6 +372,142 @@ declare function saveServerConfig(store: ApiServerSettingsStore, config: Outboun
321
372
  /** Apply a partial patch to a config, returning the merged whole. */
322
373
  declare function mergeServerConfig(current: OutboundApiServerConfig, patch: Partial<OutboundApiServerConfig>): OutboundApiServerConfig;
323
374
 
375
+ /** Immutable upper bounds used by both tolerant reads and strict admin writes. */
376
+ declare const IMAGE_SERVER_HARD_CEILINGS: Readonly<{
377
+ queue: Readonly<{
378
+ maxConcurrentJobsPerAccount: 8;
379
+ maxQueuedJobs: 1000;
380
+ queueTimeoutMs: number;
381
+ generationTimeoutMs: number;
382
+ }>;
383
+ temporary: Readonly<{
384
+ maxActiveScopes: 256;
385
+ maxTotalBytes: number;
386
+ maxTenantBytes: number;
387
+ staleAfterMs: number;
388
+ cleanupIntervalMs: number;
389
+ }>;
390
+ limits: Readonly<ImageApiLimits>;
391
+ references: Readonly<{
392
+ ttlMs: number;
393
+ maxArtifactBytes: number;
394
+ maxTotalBytes: number;
395
+ maxTenantBytes: number;
396
+ maxEntries: 1000000;
397
+ maxCalls: 2000000;
398
+ maxResponses: 1000000;
399
+ maxTombstones: 2000000;
400
+ tombstoneTtlMs: number;
401
+ cleanupIntervalMs: number;
402
+ }>;
403
+ evidenceTtlMs: number;
404
+ }>;
405
+ /** Migration-safe default: configured off, finite everywhere, and remote-disabled. */
406
+ declare const DEFAULT_IMAGES_SERVER_CONFIG: Readonly<ImagesServerConfig>;
407
+ /** Tolerant read normalization: malformed members fall back or clamp, never throw. */
408
+ declare function normalizeImagesServerConfig(value: unknown): ImagesServerConfig;
409
+ /** Strict structural/range validation. Daemon validation adds filesystem and resolver policy. */
410
+ declare function validateImagesServerConfig(value: unknown): string[];
411
+
412
+ /**
413
+ * The persisted `search` config section — tolerant read, strict report.
414
+ *
415
+ * Two functions over the same shape, exactly as the Images section does it:
416
+ * {@link normalizeSearchServerConfig} never throws (a malformed member falls
417
+ * back or is dropped, so a bad config cannot take the daemon down), and
418
+ * {@link validateSearchServerConfig} says what was unusable so an operator can
419
+ * fix it.
420
+ *
421
+ * **Nothing here ever echoes a configured VALUE.** Every validation message
422
+ * names a FIELD. An API key, a Basic-auth password and an internal hostname are
423
+ * all things a validation log must not leak, and the cheapest way to guarantee
424
+ * that is a rule with no exceptions rather than a per-field judgement call.
425
+ *
426
+ * @module outbound-api/searchServerConfig
427
+ */
428
+
429
+ /** The frozen defaults, for comparison and for callers with no config at all. */
430
+ declare const DEFAULT_SEARCH_SERVER_CONFIG: Readonly<SearchServerConfig>;
431
+ /** Tolerant read: unusable members are DROPPED, which leaves them unconfigured. */
432
+ declare function normalizeSearchApiProviderConfigs(value: unknown): SearchApiProviderConfigs;
433
+ /** Tolerant read of the whole section. Never throws; an absent section is the default. */
434
+ declare function normalizeSearchServerConfig(value: unknown): SearchServerConfig;
435
+ /**
436
+ * Report what a `search` section got wrong, field by field.
437
+ *
438
+ * Returns `[]` for a valid (or absent) section. Callers surface the list the
439
+ * way the Images config's errors are surfaced — reported, not thrown — because
440
+ * a search misconfiguration must not prevent the gateway from serving text.
441
+ */
442
+ declare function validateSearchServerConfig(value: unknown, path?: string): string[];
443
+
444
+ /**
445
+ * The Codex search route — `POST /v1/alpha/search`.
446
+ *
447
+ * ## Compatibility source
448
+ *
449
+ * From `docs/design/search-baseline/wire-baseline.md` §1, over 11 real audit
450
+ * records produced by `codex-tui` 0.151.0 and 0.152.0:
451
+ *
452
+ * The request and response contracts are pinned from the Codex 0.152.0 typed
453
+ * API definitions and standalone-search integration fixtures. Codex sends text
454
+ * queries under `commands.search_query[].q` and requires a string `output` in
455
+ * the JSON response; structured `results` are optional opaque DTOs.
456
+ *
457
+ * ## What this route does about that
458
+ *
459
+ * The default mode is `off`, and `off` answers with a structured
460
+ * `unsupported_capability` error instead of the generic 404 (plan §15). That is
461
+ * strictly more informative than today's behavior and claims nothing.
462
+ *
463
+ * Enabling `managed` accepts Codex text-search commands plus the legacy flat
464
+ * query spellings used by early Omnicross clients. Other Codex command kinds
465
+ * are rejected because the shared runtime currently exposes text search only.
466
+ *
467
+ * ## The designed side effect
468
+ *
469
+ * A dispatched request reaches route resolution and is given a `sessionKey`, so
470
+ * the audit body store finally persists `/v1/alpha/search` exchanges. The
471
+ * capture that 阶段0 proved impossible becomes possible when a real client talks
472
+ * to an enabled route.
473
+ *
474
+ * @module outbound-api/searchRoute
475
+ */
476
+
477
+ /** The path observed on every one of the 11 baselined records. */
478
+ declare const codexSearchRoutePath = "/v1/alpha/search";
479
+ /** Everything the handler needs, injected so it is testable without a daemon. */
480
+ interface CodexSearchRouteDeps {
481
+ /** Resolved ONCE per request by the caller, before any wire bytes. */
482
+ readonly mode: SearchFrontendMode;
483
+ /**
484
+ * The single shared runtime. Absent behaves exactly like mode `off`.
485
+ *
486
+ * Selection and fallback policy live INSIDE it (阶段3): this route never
487
+ * builds a candidate list, and adding a per-request policy override here
488
+ * would be the second fallback order the extraction exists to prevent.
489
+ */
490
+ readonly runtime?: SearchRuntime | null;
491
+ /** Cancellation, wired to the client connection by the caller. */
492
+ readonly signal?: AbortSignal;
493
+ /**
494
+ * Audit hook. The route calls this with the raw body and the parsed object so
495
+ * the caller can stash the body and derive the session key — the mechanism
496
+ * that unblocks `/v1/alpha/search` body capture (see the module note).
497
+ */
498
+ readonly onRequestBody?: (raw: string, parsed: Record<string, unknown>) => void;
499
+ }
500
+ /** `POST` + a path ending in `/alpha/search`. Nothing else is this route. */
501
+ declare function isCodexSearchRequest(method: string | undefined, url: string | undefined): boolean;
502
+ /**
503
+ * Serve one `POST /v1/alpha/search`.
504
+ *
505
+ * Always answers: a structured JSON error or a structured JSON result, never a
506
+ * hang, never a bare 404. The caller has already authenticated the request and
507
+ * resolved `deps.mode`.
508
+ */
509
+ declare function handleCodexSearchRequest(req: http.IncomingMessage, res: http.ServerResponse, deps: CodexSearchRouteDeps): Promise<void>;
510
+
324
511
  /**
325
512
  * Either the winning route projected to the resolver shape, or `none` — no
326
513
  * enabled route for this key/endpoint could serve the request. There is no
@@ -690,7 +877,15 @@ declare function createNamedKey(db: OutboundKeyDb, name: string): Promise<Outbou
690
877
  * Mint the local gateway key used by native CLI configuration adapters. Unlike
691
878
  * a user-distributed key it is explicitly loopback-only and endpoint-scoped.
692
879
  */
693
- declare function createIntegrationKey(db: OutboundKeyDb, name: string, allowedEndpoints?: OutboundEndpoint[]): Promise<OutboundApiKeyCreated>;
880
+ declare function createIntegrationKey(db: OutboundKeyDb, name: string, allowedEndpoints?: OutboundPermission[]): Promise<OutboundApiKeyCreated>;
881
+ declare const LEGACY_OUTBOUND_PERMISSIONS: readonly OutboundPermission[];
882
+ /** Strict write-edge validator. Stored-row reads use fail-closed interpretation below. */
883
+ declare function validateOutboundPermissions(value: unknown): OutboundPermission[];
884
+ /**
885
+ * Authoritative legacy interpretation. Absence preserves only the four historic
886
+ * families; malformed persisted data denies all instead of widening access.
887
+ */
888
+ declare function effectiveOutboundPermissions(value: unknown): readonly OutboundPermission[];
694
889
  /**
695
890
  * A verified key + the enforcement inputs carried from the row so the wire layer
696
891
  * runs its policy checks WITHOUT a second DB read (mirrors `maxConcurrency`).
@@ -698,7 +893,7 @@ declare function createIntegrationKey(db: OutboundKeyDb, name: string, allowedEn
698
893
  interface VerifiedKey {
699
894
  id: string;
700
895
  kind?: 'client' | 'integration';
701
- allowedEndpoints?: OutboundEndpoint[];
896
+ allowedEndpoints: OutboundPermission[];
702
897
  loopbackOnly?: boolean;
703
898
  /**
704
899
  * The key's per-key concurrency ceiling, carried from the row so the wire
@@ -920,4 +1115,4 @@ declare function getOutboundApiServer(deps?: OutboundApiDeps, onPortChange?: (po
920
1115
  /** Reset the singleton (tests / teardown only). */
921
1116
  declare function __resetOutboundApiServerForTests(): void;
922
1117
 
923
- export { AccountProbeConfig, AllowanceSchedulingConfig, type ApiServerSettingsStore, type ApplyConfigInput, ConcurrencyQueueConfig, ConcurrencyQueueFullError, ConcurrencyWaitCancelledError, ConcurrencyWaitTimeoutError, DEFAULT_ACCOUNT_PROBE, DEFAULT_ALLOWANCE_SCHEDULING, DEFAULT_CONCURRENCY_QUEUE, DEFAULT_FINGERPRINT, DEFAULT_OUTBOUND_PORT, DEFAULT_USER_MESSAGE_QUEUE, EndpointRoutingConfig, FingerprintConfig, type GateAcquireOptions, type GateAcquisition, type GateSlot, type GateStatusEntry, GatewayBinding, type GatewayBindingResolution, KeyCostLimits, type KeyVerification, KeyedMutex, KindMappedEndpoint, ModelKind, type ModelPrefixKind, ModelPrefixTargets, OUTBOUND_API_SERVER_CONFIG_KEY, OutboundApiDeps, OutboundApiKeyCreated, OutboundApiServer, OutboundApiServerConfig, OutboundApiServerStatus, OutboundConcurrencyGate, OutboundEndpoint, OutboundFormatUrls, OutboundKeyDb, OutboundProxyConfig, OutboundRateLimiter, RequestRole, type ResolveGatewayBindingInput, type SerialAcquireOptions, type SerialQueueStatusEntry, SerialQueueTimeoutError, type SerialSlot, UserMessageQueueConfig, UserMessageSerialQueue, type VerifiedKey, __resetOutboundApiServerForTests, candidateBackgroundModelIds, candidateGatewayBindings, classifyModelPrefix, createIntegrationKey, createNamedKey, defaultServerConfig, detectModelKind, detectRequestRole, endpointToIngressFormat, formatUrls, gatewayBindingToEndpointConfig, getOutboundApiServer, handleVoucherRedeem, hashKey, isConcurrencyRejection, isKindMappedEndpoint, isRedeemRequest, isSerialQueueTimeout, isUserMessageRequest, legacyEndpointsToBindings, loadServerConfig, mergeServerConfig, modelKindsForEndpoint, normalizeAccountProbe, normalizeAllowanceScheduling, normalizeAudit, normalizeBilling, normalizeFingerprint, normalizeGatewayBindings, normalizePrefixTargets, normalizeProxyConfig, normalizeProxySegment, normalizeQueueSegments, normalizeServerConfig, normalizeVoucher, normalizeWebhookDestination, normalizeWebhookSegment, randomBase62, resolveGatewayBinding, resolvePrefixTarget, saveServerConfig, validateEndpointModelConfig, verifyKey, verifyPresentedKey };
1118
+ export { AccountProbeConfig, AllowanceSchedulingConfig, type ApiServerSettingsStore, type ApplyConfigInput, type CodexSearchRouteDeps, ConcurrencyQueueConfig, ConcurrencyQueueFullError, ConcurrencyWaitCancelledError, ConcurrencyWaitTimeoutError, DEFAULT_ACCOUNT_PROBE, DEFAULT_ALLOWANCE_SCHEDULING, DEFAULT_CONCURRENCY_QUEUE, DEFAULT_FINGERPRINT, DEFAULT_IMAGES_SERVER_CONFIG, DEFAULT_OUTBOUND_PORT, DEFAULT_SEARCH_SERVER_CONFIG, DEFAULT_USER_MESSAGE_QUEUE, EndpointRoutingConfig, FingerprintConfig, type GateAcquireOptions, type GateAcquisition, type GateSlot, type GateStatusEntry, GatewayBinding, type GatewayBindingResolution, IMAGE_SERVER_HARD_CEILINGS, ImagesServerConfig, KeyCostLimits, type KeyVerification, KeyedMutex, KindMappedEndpoint, LEGACY_OUTBOUND_PERMISSIONS, ModelKind, type ModelPrefixKind, ModelPrefixTargets, OUTBOUND_API_SERVER_CONFIG_KEY, OutboundApiDeps, OutboundApiKeyCreated, OutboundApiServer, OutboundApiServerConfig, OutboundApiServerStatus, OutboundConcurrencyGate, OutboundEndpoint, OutboundFormatUrls, OutboundKeyDb, OutboundPermission, OutboundProxyConfig, OutboundRateLimiter, type PreparedOutboundApiConfig, RequestRole, type ResolveGatewayBindingInput, SearchServerConfig, type SerialAcquireOptions, type SerialQueueStatusEntry, SerialQueueTimeoutError, type SerialSlot, UserMessageQueueConfig, UserMessageSerialQueue, type VerifiedKey, __resetOutboundApiServerForTests, candidateBackgroundModelIds, candidateGatewayBindings, classifyModelPrefix, codexSearchRoutePath, createIntegrationKey, createNamedKey, defaultServerConfig, detectModelKind, detectRequestRole, effectiveOutboundPermissions, endpointToIngressFormat, formatUrls, gatewayBindingToEndpointConfig, getOutboundApiServer, handleCodexSearchRequest, handleVoucherRedeem, hashKey, isCodexSearchRequest, isConcurrencyRejection, isKindMappedEndpoint, isRedeemRequest, isSerialQueueTimeout, isUserMessageRequest, legacyEndpointsToBindings, loadServerConfig, mergeServerConfig, modelKindsForEndpoint, normalizeAccountProbe, normalizeAllowanceScheduling, normalizeAudit, normalizeBilling, normalizeFingerprint, normalizeGatewayBindings, normalizeImagesServerConfig, normalizePrefixTargets, normalizeProxyConfig, normalizeProxySegment, normalizeQueueSegments, normalizeSearchApiProviderConfigs, normalizeSearchServerConfig, normalizeServerConfig, normalizeVoucher, normalizeWebhookDestination, normalizeWebhookSegment, randomBase62, resolveGatewayBinding, resolvePrefixTarget, saveServerConfig, validateEndpointModelConfig, validateImagesServerConfig, validateOutboundPermissions, validateSearchServerConfig, verifyKey, verifyPresentedKey };