@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
@@ -0,0 +1,196 @@
1
+ import * as _omnicross_contracts_image_generation_types from '@omnicross/contracts/image-generation-types';
2
+ import { ImageArtifactMetadata, ImageRequestOptions } from '@omnicross/contracts/image-generation-types';
3
+ import { I as ImageAsset, p as ImageReferenceLease, K as OpenAIOperationHandler, h as ImageOrchestrator, L as OpenAIOperationHandlerContext, s as ImageReferenceStore, u as ImageRetentionPolicy } from './types-By9Tg6-I.js';
4
+ import { FileHandle } from 'node:fs/promises';
5
+
6
+ type ResourceKind = 'input' | 'spool';
7
+ declare const IMAGE_REQUEST_DIRECTORY_MARKER_NAME = ".omnicross-images-owner.json";
8
+ declare const IMAGE_REQUEST_DIRECTORY_MARKER_CONTENT = "{\"schema\":\"omnicross-images-temporary\",\"version\":1}\n";
9
+ /** Internal request-scoped file. It deliberately has no path property or getter. */
10
+ declare class StagedTemporaryFile {
11
+ #private;
12
+ readonly byteLength: number;
13
+ constructor(scope: ImageRequestResourceScope, path: string, byteLength: number, kind: ResourceKind);
14
+ open(signal?: AbortSignal): Promise<ReadableStream<Uint8Array>>;
15
+ /** Internal validator seam; no path is returned or retained by the caller. */
16
+ inspect<T>(callback: (privatePath: string) => Promise<T>): Promise<T>;
17
+ dispose(): Promise<void>;
18
+ toImageAsset(metadata: Omit<ImageArtifactMetadata, 'artifactId' | 'byteLength' | 'independentlyDecodable'>): TemporaryImageAsset;
19
+ }
20
+ declare class TemporaryImageAsset implements ImageAsset {
21
+ #private;
22
+ readonly artifactId: _omnicross_contracts_image_generation_types.ImageArtifactId;
23
+ readonly mimeType: `image/${string}`;
24
+ readonly byteLength: number;
25
+ readonly width: number;
26
+ readonly height: number;
27
+ readonly hasAlpha: boolean | undefined;
28
+ readonly sha256: string | undefined;
29
+ readonly independentlyDecodable: true;
30
+ constructor(file: StagedTemporaryFile, metadata: Omit<ImageArtifactMetadata, 'artifactId' | 'byteLength' | 'independentlyDecodable'>);
31
+ open(options?: {
32
+ readonly signal?: AbortSignal;
33
+ }): Promise<ReadableStream<Uint8Array>>;
34
+ }
35
+ declare class RequestFileWriter {
36
+ #private;
37
+ constructor(options: {
38
+ scope: ImageRequestResourceScope;
39
+ handle: FileHandle;
40
+ path: string;
41
+ kind: ResourceKind;
42
+ maxBytes: number;
43
+ declaredBytes?: number;
44
+ });
45
+ get byteLength(): number;
46
+ write(chunk: Uint8Array, signal?: AbortSignal): Promise<void>;
47
+ finish(): Promise<StagedTemporaryFile>;
48
+ abort(): Promise<void>;
49
+ }
50
+ interface CreateImageRequestResourceScopeOptions {
51
+ readonly limits: ImageApiLimits;
52
+ readonly signal: AbortSignal;
53
+ readonly tempRoot?: string;
54
+ /** Trusted tenant identity; required whenever a shared budget is injected. */
55
+ readonly tenantId?: string;
56
+ readonly sharedBudget?: ImageTemporaryResourceBudget;
57
+ /** Write the fixed, content-free daemon ownership marker into the request directory. */
58
+ readonly ownedDirectoryMarker?: boolean;
59
+ /** Host-private lease hook used to keep recurring cleanup away from live scopes. */
60
+ readonly onDirectoryActive?: (privateDirectory: string) => () => void;
61
+ }
62
+ /** One active-scope reservation from the daemon's cross-request budget. */
63
+ interface ImageTemporaryResourceBudgetLease {
64
+ /** Atomically charge bytes before a write; a thrown call MUST charge nothing. */
65
+ reserve(bytes: number): void;
66
+ /** Infallibly release up to the bytes previously reserved by this lease. */
67
+ release(bytes: number): void;
68
+ /** Idempotently and infallibly release the active-scope reservation. */
69
+ releaseScope(): void;
70
+ }
71
+ /** Credential/content-blind shared temporary budget port. */
72
+ interface ImageTemporaryResourceBudget {
73
+ /** Atomically acquire one active scope for a trusted, non-empty tenant. */
74
+ acquireScope(tenantId: string): ImageTemporaryResourceBudgetLease;
75
+ }
76
+ interface ImageRequestResourceOwnership {
77
+ readonly tenantId: string;
78
+ readonly sharedBudget: ImageTemporaryResourceBudget;
79
+ readonly ownedDirectoryMarker?: boolean;
80
+ }
81
+ declare class ImageRequestResourceScope {
82
+ #private;
83
+ private constructor();
84
+ static create(options: CreateImageRequestResourceScopeOptions): Promise<ImageRequestResourceScope>;
85
+ assertActive(): void;
86
+ reserve(kind: ResourceKind, bytes: number): void;
87
+ unreserve(kind: ResourceKind, bytes: number): void;
88
+ writerFinished(writer: RequestFileWriter): void;
89
+ releaseSpool(privatePath: string, bytes: number): Promise<void>;
90
+ createWriter(options: {
91
+ readonly kind: ResourceKind;
92
+ readonly maxBytes: number;
93
+ readonly declaredBytes?: number;
94
+ }): Promise<RequestFileWriter>;
95
+ materialize(source: AsyncIterable<Uint8Array>, options?: {
96
+ readonly kind?: ResourceKind;
97
+ readonly maxBytes?: number;
98
+ readonly declaredBytes?: number;
99
+ readonly signal?: AbortSignal;
100
+ }): Promise<StagedTemporaryFile>;
101
+ addLease(lease: ImageReferenceLease): void;
102
+ cleanup(): Promise<void>;
103
+ }
104
+ declare function createImageRequestResourceScope(limits: ImageApiLimits, signal: AbortSignal, tempRoot?: string, ownership?: ImageRequestResourceOwnership): Promise<ImageRequestResourceScope>;
105
+
106
+ interface ImageApiLimits {
107
+ readonly maxJsonBytes: number;
108
+ readonly maxMultipartBytes: number;
109
+ readonly maxFileBytes: number;
110
+ readonly maxTotalInputBytes: number;
111
+ readonly maxFiles: number;
112
+ readonly maxFields: number;
113
+ readonly maxParts: number;
114
+ readonly maxHeaderPairs: number;
115
+ readonly maxFieldNameBytes: number;
116
+ readonly maxFieldValueBytes: number;
117
+ readonly maxPixels: number;
118
+ readonly maxRawBytes: number;
119
+ readonly maxOutputBytes: number;
120
+ readonly maxTotalOutputBytes: number;
121
+ readonly maxSpoolBytes: number;
122
+ readonly maxRedirects: number;
123
+ readonly maxRemoteUrlBytes: number;
124
+ readonly maxRemoteHeaderBytes: number;
125
+ readonly remoteConnectTimeoutMs: number;
126
+ readonly remoteTotalTimeoutMs: number;
127
+ }
128
+ declare const DEFAULT_IMAGE_API_LIMITS: ImageApiLimits;
129
+ declare function assertFiniteImageApiLimits(limits: ImageApiLimits): void;
130
+ interface ImageRemoteMaterializer {
131
+ materialize(source: AsyncIterable<Uint8Array>, declaredBytes: number | undefined, signal: AbortSignal): Promise<ImageAsset>;
132
+ }
133
+ interface RemoteImageAssetResolver {
134
+ resolve(input: {
135
+ readonly url: string;
136
+ readonly signal: AbortSignal;
137
+ readonly limits: ImageApiLimits;
138
+ readonly materializer: ImageRemoteMaterializer;
139
+ }): Promise<ImageAsset>;
140
+ }
141
+ interface ImageApiRuntime {
142
+ readonly tenantId: string;
143
+ readonly providerId: string;
144
+ readonly defaultModel: string;
145
+ readonly modelAliases: ReadonlyMap<string, string>;
146
+ readonly limits: ImageApiLimits;
147
+ readonly preferredAccountId?: string;
148
+ readonly preferredAccountGroup?: string;
149
+ readonly boundAccountFallbackPolicy?: 'strict' | 'pool';
150
+ readonly referenceStore?: ImageReferenceStore;
151
+ readonly remoteResolver?: RemoteImageAssetResolver;
152
+ readonly fingerprintUser?: (value: string) => string;
153
+ readonly retention?: ImageRetentionPolicy;
154
+ }
155
+ type ImageApiRuntimeResolver = (context: OpenAIOperationHandlerContext) => Promise<ImageApiRuntime> | ImageApiRuntime;
156
+ interface ImageApiAuditRecord {
157
+ readonly requestId: string;
158
+ readonly operationId: 'images.generate' | 'images.edit';
159
+ readonly providerId?: string;
160
+ readonly model?: string;
161
+ readonly options?: Pick<ImageRequestOptions, 'n' | 'quality' | 'background' | 'outputFormat' | 'stream' | 'partialImages'>;
162
+ readonly inputCount?: number;
163
+ readonly inputBytes?: number;
164
+ readonly referenceOutcomes?: {
165
+ readonly hits: number;
166
+ readonly notFound: number;
167
+ readonly expired: number;
168
+ readonly failed: number;
169
+ };
170
+ readonly cleanupOutcome?: 'completed' | 'failed';
171
+ readonly terminal: 'completed' | 'failed' | 'cancelled';
172
+ readonly errorCode?: string;
173
+ }
174
+ interface ImageApiContributionsDeps {
175
+ readonly orchestrator: ImageOrchestrator;
176
+ readonly resolveRuntime: ImageApiRuntimeResolver;
177
+ readonly createRequestId?: () => string;
178
+ readonly now?: () => number;
179
+ readonly createResourceScope?: (limits: ImageApiLimits, signal: AbortSignal, tenantId: string) => Promise<ImageRequestResourceScope>;
180
+ readonly audit?: (record: ImageApiAuditRecord) => void | Promise<void>;
181
+ }
182
+ interface ImageOpenAIOperationContribution {
183
+ readonly operationId: 'images.generate' | 'images.edit';
184
+ readonly handler: OpenAIOperationHandler;
185
+ }
186
+ interface ImageApiContributions {
187
+ readonly generate: ImageOpenAIOperationContribution & {
188
+ readonly operationId: 'images.generate';
189
+ };
190
+ readonly edit: ImageOpenAIOperationContribution & {
191
+ readonly operationId: 'images.edit';
192
+ };
193
+ readonly all: readonly ImageOpenAIOperationContribution[];
194
+ }
195
+
196
+ export { type CreateImageRequestResourceScopeOptions as C, DEFAULT_IMAGE_API_LIMITS as D, IMAGE_REQUEST_DIRECTORY_MARKER_CONTENT as I, type RemoteImageAssetResolver as R, IMAGE_REQUEST_DIRECTORY_MARKER_NAME as a, type ImageApiAuditRecord as b, type ImageApiContributions as c, type ImageApiContributionsDeps as d, type ImageApiLimits as e, type ImageApiRuntime as f, type ImageApiRuntimeResolver as g, type ImageOpenAIOperationContribution as h, type ImageRemoteMaterializer as i, type ImageRequestResourceOwnership as j, ImageRequestResourceScope as k, type ImageTemporaryResourceBudget as l, type ImageTemporaryResourceBudgetLease as m, assertFiniteImageApiLimits as n, createImageRequestResourceScope as o };
@@ -1,3 +1,4 @@
1
+ import { e as ImageApiLimits } from './types-Dm4_36V4.js';
1
2
  import { ProxyConfig } from '@omnicross/contracts/account-tokens-types';
2
3
  import { AuditConfig } from '@omnicross/contracts/audit-types';
3
4
  import { BillingConfig } from '@omnicross/contracts/billing-types';
@@ -6,11 +7,52 @@ import { VoucherRecord, VoucherGrant, VoucherInfo, VoucherConfig } from '@omnicr
6
7
  import { WebhookConfig } from '@omnicross/contracts/webhook-types';
7
8
  import { L as Logger } from './logger-4GvQNzhE.js';
8
9
  import { ProviderConfigSource } from './ports/provider-config-source.js';
9
- import { P as ProviderProxy } from './ProviderProxy--ROec6VI.js';
10
- import { ProviderProxyDeps } from './provider-proxy/types.js';
10
+ import { P as ProviderProxy } from './ProviderProxy-Ckr6oTrE.js';
11
+ import { W as ProviderProxyDeps } from './types-By9Tg6-I.js';
11
12
  import { BoundAccountFallbackPolicy } from './pipeline/BoundAccountSelectionError.js';
13
+ import { S as SearchApiProviderConfigs } from './types-CbCZqLGg.js';
14
+ import { d as SearchFrontendModes } from './frontends-Doz0RaWu.js';
15
+ import { S as SearchRuntime } from './runtime-t8AZacFF.js';
12
16
  import { c as KeySpend } from './keyPolicy-zdWTu3CQ.js';
13
17
 
18
+ /**
19
+ * anthropicCountTokens — the `POST /v1/messages/count_tokens` handler
20
+ * (`claude-api-routing-errors`, R2 passthrough+reject subset).
21
+ *
22
+ * Before this module, the substring `/v1/messages` match routed count_tokens
23
+ * into the FULL generation pipeline — every context-stats call burned a real
24
+ * upstream inference (BYO money, subscription 5h-window quota) and returned a
25
+ * Message JSON instead of `{"input_tokens":N}` (audit F-1, P0).
26
+ *
27
+ * Strategies (portfolio-locked default: `'auto'`):
28
+ * - **passthrough** (Anthropic-wire upstream — `plan.sameFormat`): strip the
29
+ * generation-only fields the count_tokens endpoint rejects (`stream`,
30
+ * `max_tokens`), rewrite `model` to the resolved upstream model, and POST to
31
+ * `<upstream>/v1/messages/count_tokens` via the SAME same-format fetches the
32
+ * generation path uses (credential injection, beta merge, claude header
33
+ * baseline all inherited). The response — success OR failure — relays
34
+ * verbatim with its real status (an Anthropic-wire error body already IS
35
+ * the official shape; wrapping it would violate the verbatim moat).
36
+ * - **estimate** (Change B; explicit config, or `auto` on a translation
37
+ * upstream): a PURE-LOCAL heuristic estimate (`anthropicCountEstimate.ts`)
38
+ * answered as `{"input_tokens":N}` with the `x-omnicross-count-estimate:
39
+ * true` marker header — zero upstream calls, never recorded as usage.
40
+ * - **reject** (explicit config, or `passthrough` degraded on a translation
41
+ * upstream): a clean Anthropic 404 `not_found_error` with ZERO upstream
42
+ * calls — Claude Code treats it as "endpoint absent" and falls back to its
43
+ * local usage estimation.
44
+ *
45
+ * A free endpoint: no usage recording, no concurrency gate (the outbound face
46
+ * bypasses its gate before dispatch), single attempt — no 401 refresh retry,
47
+ * no subscription health marking (a failed count_tokens must not cool an
48
+ * account that serves inference; the inference path drives those itself).
49
+ *
50
+ * @module provider-proxy/ingress/anthropicCountTokens
51
+ */
52
+
53
+ /** The operator-facing strategy config (§10 `anthropic.countTokens.mode`). */
54
+ type CountTokensMode = 'auto' | 'passthrough' | 'estimate' | 'reject';
55
+
14
56
  /**
15
57
  * keySpendTracker — a cheap in-memory per-key accumulated-spend cache
16
58
  * (`outbound-key-policy`, design D3).
@@ -201,23 +243,104 @@ interface VoucherDb {
201
243
  voucherList(): Promise<VoucherRecord[]>;
202
244
  }
203
245
 
246
+ /** The four endpoints, 1:1 with the four wire-format ingress parsers. */
247
+ type OutboundEndpoint = 'chat' | 'responses' | 'messages' | 'gemini';
248
+ /** Named-key authorization vocabulary. Images is deliberately not a text route. */
249
+ type OutboundPermission = OutboundEndpoint | 'images';
204
250
  /**
205
- * Shared contract types for the outbound API server (`outbound-api-server`).
206
- *
207
- * The outbound server is a SEPARATE long-lived HTTP listener (distinct from the
208
- * resident loopback `ProviderProxy`) that authenticates external callers via
209
- * named API keys and routes their requests through the EXISTING `provider-proxy`
210
- * ingress parsers + transformer — there is exactly one conversion stack.
251
+ * The persisted `search` section (plan §6.3).
211
252
  *
212
- * These types are kept in their own module so the server, router, auth, rate
213
- * limiter, role detection, and route resolver can share shapes without circular
214
- * imports.
253
+ * Deliberately small. It carries the four things assembly cannot invent
254
+ * which keyed providers exist, where they may egress, who executes per
255
+ * frontend, and the runtime's default policy — and nothing else. The
256
+ * provider-config SHAPES stay core-local (`@omnicross/core/search/api`); the
257
+ * 阶段4 deferral of promoting them into `@omnicross/contracts` is left standing
258
+ * because assembly turned out not to need it.
215
259
  *
216
- * @module outbound-api/types
260
+ * **Secrets are values here, not references.** The
261
+ * `search-provider:<id>:apiKey` secret-ref scheme Elftia uses is host-side and
262
+ * belongs to the Phase-2 cutover; this phase reads what the config holds and
263
+ * never prints it.
217
264
  */
218
-
219
- /** The four endpoints, 1:1 with the four wire-format ingress parsers. */
220
- type OutboundEndpoint = 'chat' | 'responses' | 'messages' | 'gemini';
265
+ interface SearchServerConfig {
266
+ /**
267
+ * Per-frontend execution modes. Always total after normalization.
268
+ *
269
+ * **These do not all apply at the same moment.** `modes.codex` is read from
270
+ * the live config on every request, so an admin PUT takes effect at once;
271
+ * `modes.responses` / `modes.anthropic` are captured into the proxy deps at
272
+ * bootstrap, as are `providers`, `egress` and `policy` (they build the ONE
273
+ * runtime), so changing those requires a daemon restart. `doctor search`
274
+ * prints this distinction rather than leaving an operator to discover it.
275
+ */
276
+ modes: SearchFrontendModes;
277
+ /** Configured API providers. A provider absent here is UNCONFIGURED, not broken. */
278
+ providers: SearchApiProviderConfigs;
279
+ /** SSRF egress policy knobs. */
280
+ egress: {
281
+ /**
282
+ * Hostnames allowed to resolve into an otherwise-denied address class —
283
+ * the internal-SearXNG escape hatch. Exact, case-insensitive matching.
284
+ */
285
+ allowedPrivateHosts: string[];
286
+ };
287
+ /**
288
+ * The runtime's DEFAULT policy. These are 阶段3's existing knobs surfaced as
289
+ * configuration; no new orchestration semantics are introduced here.
290
+ */
291
+ policy: {
292
+ preferred?: string;
293
+ allowed?: string[];
294
+ fallbackEnabled: boolean;
295
+ maxAttempts?: number;
296
+ };
297
+ }
298
+ interface ImagesServerConfig {
299
+ enabled: boolean;
300
+ provider: 'codex-subscription';
301
+ defaultModel: string;
302
+ modelAliases: Record<string, string>;
303
+ account: {
304
+ id?: string;
305
+ group?: string;
306
+ fallback: 'strict' | 'pool';
307
+ };
308
+ queue: {
309
+ maxConcurrentJobsPerAccount: number;
310
+ maxQueuedJobs: number;
311
+ queueTimeoutMs: number;
312
+ generationTimeoutMs: number;
313
+ };
314
+ temporary: {
315
+ maxActiveScopes: number;
316
+ maxTotalBytes: number;
317
+ maxTenantBytes: number;
318
+ staleAfterMs: number;
319
+ cleanupIntervalMs: number;
320
+ };
321
+ limits: ImageApiLimits;
322
+ references: {
323
+ ttlMs: number;
324
+ maxArtifactBytes: number;
325
+ maxTotalBytes: number;
326
+ maxTenantBytes: number;
327
+ maxEntries: number;
328
+ maxCalls: number;
329
+ maxResponses: number;
330
+ maxTombstones: number;
331
+ tombstoneTtlMs: number;
332
+ cleanupIntervalMs: number;
333
+ storageRoot?: string;
334
+ };
335
+ remote: {
336
+ enabled: boolean;
337
+ };
338
+ evidenceTtlMs: number;
339
+ }
340
+ /** Non-consuming, account-bound image model discovery injected by the daemon. */
341
+ interface ImageModelCatalogReader {
342
+ listAvailableModels(apiKeyId: string): Promise<readonly string[]>;
343
+ }
221
344
  /** A `"providerId,modelId"` model reference (mirrors `RouterConfig` vocab). */
222
345
  type ModelRef = string;
223
346
  /** The detected request role; precedence background > default. */
@@ -513,6 +636,69 @@ interface FingerprintConfig {
513
636
  /** Operator UA baseline for un-captured accounts (piece 4). Absent ⇒ none. */
514
637
  ua?: string;
515
638
  }
639
+ /**
640
+ * count_tokens strategy mode (§10 `anthropic.countTokens.mode`). ONE canonical
641
+ * union lives with the handler (`provider-proxy/ingress/anthropicCountTokens`);
642
+ * this alias re-exports it so the config-segment types and the runtime
643
+ * resolver can never drift apart (review B-M2).
644
+ */
645
+ type AnthropicCountTokensMode = CountTokensMode;
646
+ /** `GET /v1/models` response shape selector (§10 `anthropic.modelsShape`). */
647
+ type AnthropicModelsShape = 'auto' | 'anthropic' | 'openai';
648
+ /**
649
+ * Anthropic-protocol tuning segment (`claude-api-protocol-fidelity`, §10
650
+ * skeleton — count_tokens strategy/budget, /v1/models shape, synthetic-SSE
651
+ * heartbeat). Persisted + normalized like the other segments; read live per
652
+ * request (count_tokens/models) or hot-applied via the module setter
653
+ * (heartbeat). `proxyOauthUsage` / `apiHello` land in the follow-up change.
654
+ */
655
+ interface AnthropicConfigSegment {
656
+ /**
657
+ * `/v1/messages/count_tokens` strategy. `mode` absent ⇒ `'auto'`
658
+ * (Anthropic-wire upstream → passthrough; translation upstream → local
659
+ * estimate). `estimateBudgetMs` bounds the local estimator walk (default
660
+ * 2000; a pathological input degrades to a coarser estimate, never fails).
661
+ */
662
+ countTokens?: {
663
+ mode?: AnthropicCountTokensMode;
664
+ estimateBudgetMs?: number;
665
+ };
666
+ /**
667
+ * `GET /v1/models` response shape. `'auto'` (default): a key authorized for
668
+ * the messages endpoint gets the Anthropic list shape, everyone else keeps
669
+ * the OpenAI shape; `'anthropic'` / `'openai'` force one shape (escape
670
+ * hatch for dual-protocol consumers).
671
+ */
672
+ modelsShape?: AnthropicModelsShape;
673
+ /**
674
+ * Synthetic-SSE ping heartbeat interval (ms) for the TRANSLATION path only.
675
+ * Default 20000; ≤0 disables. Hot-applied at `applyConfig` — in-flight
676
+ * streams pick the new value at their next timer arm.
677
+ */
678
+ heartbeatIntervalMs?: number;
679
+ /**
680
+ * Translate-path PDF text extraction budget (`claude-api-transform-fidelity`,
681
+ * R7). `budgetMs` default 2000 — bounds the synchronous zero-dependency
682
+ * text-layer walk; over-budget documents 400 explicitly (never silently
683
+ * dropped, never unbounded work).
684
+ */
685
+ pdfTextExtraction?: {
686
+ budgetMs?: number;
687
+ };
688
+ /**
689
+ * Serve `GET /api/oauth/usage` on the outbound listener as a PURE-CACHE read
690
+ * of the shared Claude allowance store (R9). Default FALSE — off, the path
691
+ * keeps its current generic 404 byte-for-byte. When on, a messages-authorized
692
+ * key bound to a Claude subscription receives the api.anthropic.com usage
693
+ * wire shape; NO upstream call or refresh is ever triggered by the query.
694
+ */
695
+ proxyOauthUsage?: boolean;
696
+ /**
697
+ * Answer `HEAD /api/hello` with a bare 200 at the listener level (R10 —
698
+ * clients probe "can this endpoint be safely rejected"). Default TRUE.
699
+ */
700
+ apiHello?: boolean;
701
+ }
516
702
  /**
517
703
  * Layered upstream-proxy segment (upstream-proxy). Global + per-provider proxy
518
704
  * config for outbound EGRESS to upstreams (NOT the inbound listener). Resolved
@@ -627,6 +813,21 @@ interface OutboundApiServerConfig {
627
813
  * byte-identical zero regression, purely additive on the #4 key-policy.
628
814
  */
629
815
  voucher?: VoucherConfig;
816
+ /**
817
+ * Anthropic-protocol tuning segment (claude-api-protocol-fidelity, §10).
818
+ * Optional in the persisted shape; `normalizeServerConfig` always fills it
819
+ * with the frozen defaults (auto/auto/20000).
820
+ */
821
+ anthropic?: AnthropicConfigSegment;
822
+ /** Default-off Images serving policy; capability still requires fresh evidence. */
823
+ images?: ImagesServerConfig;
824
+ /**
825
+ * Search assembly (plan 阶段5/§6.3): which API providers exist, where they may
826
+ * egress, which frontend runs in which mode, and the runtime's default policy.
827
+ * Absent yields {@link DEFAULT_SEARCH_SERVER_CONFIG} — HTTP-only providers,
828
+ * modes `off`/`native`/`native`, public-only egress.
829
+ */
830
+ search?: SearchServerConfig;
630
831
  }
631
832
  /** A live status snapshot the Settings tab renders. */
632
833
  interface OutboundApiServerStatus {
@@ -641,6 +842,15 @@ interface OutboundApiServerStatus {
641
842
  formats: OutboundFormatUrls | null;
642
843
  /** The four format endpoint URLs over the LAN (only when network binding on). */
643
844
  lanFormats: OutboundFormatUrls | null;
845
+ /** Additive Images endpoints; absent while Images is disabled. */
846
+ images?: {
847
+ generations: string;
848
+ edits: string;
849
+ } | null;
850
+ lanImages?: {
851
+ generations: string;
852
+ edits: string;
853
+ } | null;
644
854
  }
645
855
  /** The four format endpoint URLs for one base. */
646
856
  interface OutboundFormatUrls {
@@ -667,8 +877,10 @@ interface OutboundApiKeyInfo {
667
877
  revoked: boolean;
668
878
  /** Intended consumer. Existing rows default to a general client key. */
669
879
  kind?: 'client' | 'integration';
670
- /** Optional endpoint allow-list. Absent means every outbound endpoint. */
671
- allowedEndpoints?: OutboundEndpoint[];
880
+ /** Exact effective permission list; legacy absent rows project to text-only permissions. */
881
+ allowedEndpoints: OutboundPermission[];
882
+ /** True when the stored row omitted permissions and compatibility defaults were projected. */
883
+ legacyPermissions: boolean;
672
884
  /** When true the key is rejected unless the TCP peer is loopback. */
673
885
  loopbackOnly?: boolean;
674
886
  /**
@@ -746,6 +958,8 @@ interface OutboundApiKeyCreated {
746
958
  name: string;
747
959
  keyPrefix: string;
748
960
  createdAt: number;
961
+ /** Exact effective permission list assigned to the new key. */
962
+ allowedEndpoints: OutboundPermission[];
749
963
  plaintextOnce: string;
750
964
  }
751
965
  /**
@@ -773,8 +987,8 @@ interface OutboundKeyDbRow {
773
987
  revokedAt: number | null;
774
988
  /** Intended consumer. Existing rows without this field remain client keys. */
775
989
  kind?: 'client' | 'integration';
776
- /** Optional endpoint allow-list for least-privilege integration keys. */
777
- allowedEndpoints?: OutboundEndpoint[];
990
+ /** Persisted exact permission list. Absent is a legacy text-only row. */
991
+ allowedEndpoints?: OutboundPermission[];
778
992
  /** Restrict use to requests whose direct socket peer is loopback. */
779
993
  loopbackOnly?: boolean;
780
994
  /**
@@ -817,7 +1031,7 @@ interface OutboundKeyDb {
817
1031
  keyPrefix: string;
818
1032
  createdAt?: number;
819
1033
  kind?: 'client' | 'integration';
820
- allowedEndpoints?: OutboundEndpoint[];
1034
+ allowedEndpoints?: OutboundPermission[];
821
1035
  loopbackOnly?: boolean;
822
1036
  /**
823
1037
  * The generated plaintext secret. When the DB holds a `SecretBox` it
@@ -831,6 +1045,8 @@ interface OutboundKeyDb {
831
1045
  outboundApiKeysRevoke(id: string): Promise<boolean>;
832
1046
  outboundApiKeysTouchLastUsed(id: string): Promise<boolean>;
833
1047
  outboundApiKeysSetEnabled(id: string, enabled: boolean): Promise<boolean>;
1048
+ /** Atomically replace the exact key permission list. */
1049
+ outboundApiKeysSetPermissions(id: string, permissions: OutboundPermission[]): Promise<boolean>;
834
1050
  /**
835
1051
  * Set (or clear) a key's per-key concurrency ceiling. `null` clears the field
836
1052
  * → unlimited (gate bypassed). Mirrors `outboundApiKeysSetEnabled`; returns
@@ -890,6 +1106,8 @@ interface OutboundApiDeps {
890
1106
  readonly providerProxy: ProviderProxy;
891
1107
  /** The proxy's app-session deps (reused verbatim for `routeRequest`). */
892
1108
  readonly proxyDeps: ProviderProxyDeps;
1109
+ /** Optional fail-closed Images catalog; absent means no image model is advertised. */
1110
+ readonly imageModelCatalog?: ImageModelCatalogReader;
893
1111
  /**
894
1112
  * OPTIONAL unauthenticated `/health` provider (daemon-health-endpoint, D1
895
1113
  * secondary mount). When wired (by the daemon bootstrap — core NEVER imports
@@ -915,6 +1133,17 @@ interface OutboundApiDeps {
915
1133
  * embedders/tests that do not wire it).
916
1134
  */
917
1135
  readonly logger?: Logger;
1136
+ /**
1137
+ * OPTIONAL shared search runtime (plan 阶段5). When wired by the daemon
1138
+ * bootstrap, `POST /v1/alpha/search` executes through it in managed mode.
1139
+ * Absent ⇒ the route behaves exactly as mode `off`: a structured
1140
+ * `unsupported_capability`, never a generic 404.
1141
+ *
1142
+ * There is exactly ONE of these per daemon, shared with both managed protocol
1143
+ * frontends and with `doctor search`. A second instance anywhere would be a
1144
+ * second provider order, which is what the whole extraction removes.
1145
+ */
1146
+ readonly searchRuntime?: SearchRuntime | null;
918
1147
  }
919
1148
 
920
- export { type AccountProbeConfig as A, computeVoucherGrant as B, type ChatDispatchMode as C, generateVoucherCode as D, ENDPOINT_MODEL_KINDS as E, type FingerprintConfig as F, type GatewayBinding as G, hashVoucherCode as H, newVoucherId as I, startOfLocalDay as J, type KeySpendReader as K, startOfLocalWeek as L, type MessagesModelKind as M, toVoucherInfo as N, type OutboundKeyDb as O, voucherCodePrefix as P, type ModelRef as Q, type RequestRole as R, type AccountHealthConfig as S, type OutboundKeyModelRestrictionMode as T, type UserMessageQueueConfig as U, type VoucherCreateInput as V, type AllowanceSchedulingConfig as a, type ConcurrencyQueueConfig as b, type EndpointRoutingConfig as c, type GatewayBindingFallback as d, type GatewayBindingKeyScope as e, type GatewayBindingModelMode as f, type GatewayBindingTarget as g, type GatewayModelMapping as h, type KeySpendSeeder as i, KeySpendTracker as j, type KindMappedEndpoint as k, type ModelKind as l, type ModelPrefixTargets as m, type OutboundApiDeps as n, type OutboundApiKeyCreated as o, type OutboundApiKeyInfo as p, type OutboundApiServerConfig as q, type OutboundApiServerStatus as r, type OutboundEndpoint as s, type OutboundFormatUrls as t, type OutboundKeyActivationMode as u, type OutboundKeyDbRow as v, type OutboundKeyPolicy as w, type OutboundProxyConfig as x, type ResponsesModelKind as y, type VoucherDb as z };
1149
+ export { type ImageModelCatalogReader as $, type AccountProbeConfig as A, type VoucherDb as B, type ChatDispatchMode as C, computeVoucherGrant as D, ENDPOINT_MODEL_KINDS as E, type FingerprintConfig as F, type GatewayBinding as G, generateVoucherCode as H, type ImagesServerConfig as I, hashVoucherCode as J, type KeySpendReader as K, newVoucherId as L, type MessagesModelKind as M, startOfLocalDay as N, type OutboundKeyDb as O, startOfLocalWeek as P, toVoucherInfo as Q, type RequestRole as R, type SearchServerConfig as S, voucherCodePrefix as T, type UserMessageQueueConfig as U, type VoucherCreateInput as V, type ModelRef as W, type AnthropicConfigSegment as X, type AccountHealthConfig as Y, type AnthropicCountTokensMode as Z, type AnthropicModelsShape as _, type AllowanceSchedulingConfig as a, type OutboundKeyModelRestrictionMode as a0, type ConcurrencyQueueConfig as b, type EndpointRoutingConfig as c, type GatewayBindingFallback as d, type GatewayBindingKeyScope as e, type GatewayBindingModelMode as f, type GatewayBindingTarget as g, type GatewayModelMapping as h, type KeySpendSeeder as i, KeySpendTracker as j, type KindMappedEndpoint as k, type ModelKind as l, type ModelPrefixTargets as m, type OutboundApiDeps as n, type OutboundApiKeyCreated as o, type OutboundApiKeyInfo as p, type OutboundApiServerConfig as q, type OutboundApiServerStatus as r, type OutboundEndpoint as s, type OutboundFormatUrls as t, type OutboundKeyActivationMode as u, type OutboundKeyDbRow as v, type OutboundKeyPolicy as w, type OutboundPermission as x, type OutboundProxyConfig as y, type ResponsesModelKind as z };
package/dist/usage.cjs CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
 
10
- var _chunkQUSEZNYScjs = require('./chunk-QUSEZNYS.cjs');
10
+ var _chunk32SRZFFPcjs = require('./chunk-32SRZFFP.cjs');
11
11
 
12
12
 
13
13
  var _chunk2E42SAW3cjs = require('./chunk-2E42SAW3.cjs');
@@ -26,4 +26,4 @@ require('./chunk-XSVNC2UD.cjs');
26
26
 
27
27
 
28
28
 
29
- exports.PricingEngine = _chunk2E42SAW3cjs.PricingEngine; exports.THROUGHPUT_BUCKET_COUNT = _chunkQUSEZNYScjs.THROUGHPUT_BUCKET_COUNT; exports.THROUGHPUT_RETENTION_MS = _chunkQUSEZNYScjs.THROUGHPUT_RETENTION_MS; exports.THROUGHPUT_SAMPLE_LIMIT = _chunkQUSEZNYScjs.THROUGHPUT_SAMPLE_LIMIT; exports.THROUGHPUT_WINDOWS_MS = _chunkQUSEZNYScjs.THROUGHPUT_WINDOWS_MS; exports.UsageRecorder = _chunk5UK3KLE2cjs.UsageRecorder; exports.UsageThroughputTracker = _chunkQUSEZNYScjs.UsageThroughputTracker; exports.__resetSharedUsageThroughputTrackerForTests = _chunkQUSEZNYScjs.__resetSharedUsageThroughputTrackerForTests; exports.getSharedUsageThroughputTracker = _chunkQUSEZNYScjs.getSharedUsageThroughputTracker; exports.setSharedUsageThroughputTracker = _chunkQUSEZNYScjs.setSharedUsageThroughputTracker;
29
+ exports.PricingEngine = _chunk2E42SAW3cjs.PricingEngine; exports.THROUGHPUT_BUCKET_COUNT = _chunk32SRZFFPcjs.THROUGHPUT_BUCKET_COUNT; exports.THROUGHPUT_RETENTION_MS = _chunk32SRZFFPcjs.THROUGHPUT_RETENTION_MS; exports.THROUGHPUT_SAMPLE_LIMIT = _chunk32SRZFFPcjs.THROUGHPUT_SAMPLE_LIMIT; exports.THROUGHPUT_WINDOWS_MS = _chunk32SRZFFPcjs.THROUGHPUT_WINDOWS_MS; exports.UsageRecorder = _chunk5UK3KLE2cjs.UsageRecorder; exports.UsageThroughputTracker = _chunk32SRZFFPcjs.UsageThroughputTracker; exports.__resetSharedUsageThroughputTrackerForTests = _chunk32SRZFFPcjs.__resetSharedUsageThroughputTrackerForTests; exports.getSharedUsageThroughputTracker = _chunk32SRZFFPcjs.getSharedUsageThroughputTracker; exports.setSharedUsageThroughputTracker = _chunk32SRZFFPcjs.setSharedUsageThroughputTracker;
package/dist/usage.d.cts CHANGED
@@ -82,10 +82,12 @@ interface UsageThroughputWindow {
82
82
  totalTokens: number;
83
83
  costUsd: number;
84
84
  requestsPerMinute: number;
85
- /** The headline TPM: `totalTokens` per minute over `windowMs`. */
85
+ /** `totalTokens` per minute over `windowMs`. */
86
86
  tokensPerMinute: number;
87
87
  inputTokensPerMinute: number;
88
88
  outputTokensPerMinute: number;
89
+ /** cacheRead + cacheCreation per minute over `windowMs`. */
90
+ cacheTokensPerMinute: number;
89
91
  costUsdPerMinute: number;
90
92
  /**
91
93
  * False when the sample cap evicted events that fall inside this window, so
@@ -98,7 +100,10 @@ interface UsageThroughputBucket {
98
100
  /** Epoch-ms of the bucket's (grid-aligned) start. */
99
101
  startTs: number;
100
102
  requests: number;
103
+ /** input + output + cacheRead + cacheCreation (same basis as `totalTokens`). */
101
104
  tokens: number;
105
+ /** Output tokens alone, so a card headlining output can trend in step. */
106
+ outputTokens: number;
102
107
  }
103
108
  /** The `GET /admin/api/usage/throughput` payload. */
104
109
  interface UsageThroughputSnapshot {
package/dist/usage.d.ts CHANGED
@@ -82,10 +82,12 @@ interface UsageThroughputWindow {
82
82
  totalTokens: number;
83
83
  costUsd: number;
84
84
  requestsPerMinute: number;
85
- /** The headline TPM: `totalTokens` per minute over `windowMs`. */
85
+ /** `totalTokens` per minute over `windowMs`. */
86
86
  tokensPerMinute: number;
87
87
  inputTokensPerMinute: number;
88
88
  outputTokensPerMinute: number;
89
+ /** cacheRead + cacheCreation per minute over `windowMs`. */
90
+ cacheTokensPerMinute: number;
89
91
  costUsdPerMinute: number;
90
92
  /**
91
93
  * False when the sample cap evicted events that fall inside this window, so
@@ -98,7 +100,10 @@ interface UsageThroughputBucket {
98
100
  /** Epoch-ms of the bucket's (grid-aligned) start. */
99
101
  startTs: number;
100
102
  requests: number;
103
+ /** input + output + cacheRead + cacheCreation (same basis as `totalTokens`). */
101
104
  tokens: number;
105
+ /** Output tokens alone, so a card headlining output can trend in step. */
106
+ outputTokens: number;
102
107
  }
103
108
  /** The `GET /admin/api/usage/throughput` payload. */
104
109
  interface UsageThroughputSnapshot {
package/dist/usage.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  __resetSharedUsageThroughputTrackerForTests,
8
8
  getSharedUsageThroughputTracker,
9
9
  setSharedUsageThroughputTracker
10
- } from "./chunk-6D4W22P4.js";
10
+ } from "./chunk-QIIAMBTM.js";
11
11
  import {
12
12
  PricingEngine
13
13
  } from "./chunk-FXR6N3SR.js";