@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.
- package/README.md +7 -0
- package/dist/{BuiltinToolExecutor-CS2WpXhM.d.cts → BuiltinToolExecutor-BHgH-EaZ.d.cts} +25 -2
- package/dist/{BuiltinToolExecutor-BluWyeob.d.ts → BuiltinToolExecutor-Bi1LmiTP.d.ts} +25 -2
- package/dist/{CompletionService-kNA17cfI.d.cts → CompletionService-BniP7j88.d.cts} +2 -2
- package/dist/{CompletionService-C3BX0Ovy.d.ts → CompletionService-BqrKPwfA.d.ts} +2 -2
- package/dist/{ProviderProxy-QdwNV6l1.d.cts → ProviderProxy-Bz_nkOwq.d.cts} +1 -1
- package/dist/{ProviderProxy--ROec6VI.d.ts → ProviderProxy-Ckr6oTrE.d.ts} +1 -1
- package/dist/auth/GeminiCodeAssistProjectResolver.cjs +6 -6
- package/dist/auth/GeminiCodeAssistProjectResolver.js +4 -4
- package/dist/{chunk-NGYOO5TO.js → chunk-2C3TTBS7.js} +7 -7
- package/dist/{chunk-QUSEZNYS.cjs → chunk-32SRZFFP.cjs} +4 -1
- package/dist/chunk-4JOU54M5.js +200 -0
- package/dist/{chunk-2UTGX6FM.js → chunk-4VVCXVB7.js} +1 -1
- package/dist/{chunk-RJUONLUQ.cjs → chunk-4Z3ZLLC2.cjs} +14 -8
- package/dist/chunk-6DDYNS2B.cjs +384 -0
- package/dist/{chunk-GXEZ2R3E.js → chunk-6OKXH2TW.js} +18 -7
- package/dist/{chunk-YWL7YZWS.cjs → chunk-7LRTPNFL.cjs} +5 -0
- package/dist/{chunk-CCVRRJOX.js → chunk-7PIUVCKK.js} +9 -2
- package/dist/chunk-7RJI3NDI.cjs +236 -0
- package/dist/{chunk-IIRPUVPH.cjs → chunk-7ZHBN75N.cjs} +3 -1
- package/dist/chunk-D4WNI6BR.cjs +386 -0
- package/dist/chunk-DBBR6RHF.js +236 -0
- package/dist/chunk-E4QHVXV5.cjs +118 -0
- package/dist/{chunk-HKB656B4.js → chunk-EUZRH544.js} +55 -287
- package/dist/{chunk-WNKWAEUR.js → chunk-EYGBM2VC.js} +3 -1
- package/dist/{chunk-UWDW6PN3.cjs → chunk-FX325I5Q.cjs} +20 -9
- package/dist/chunk-G4CZIUIB.cjs +200 -0
- package/dist/chunk-HCOQQAZE.cjs +123 -0
- package/dist/chunk-HL2YSPL7.cjs +673 -0
- package/dist/{chunk-55FMGZ3L.js → chunk-HN74IGEO.js} +1 -1
- package/dist/{chunk-ZY6KU6P3.js → chunk-HOMUGKHR.js} +8 -5
- package/dist/{chunk-AOFWNWLT.cjs → chunk-IUL4VWNU.cjs} +22 -1
- package/dist/{chunk-5LNYGCIW.cjs → chunk-KIQ2HA2A.cjs} +5 -5
- package/dist/{chunk-MUHWHQVM.cjs → chunk-KQBLZMP6.cjs} +4 -3
- package/dist/chunk-LFEH7CEO.js +384 -0
- package/dist/chunk-LFPQ2OVH.js +386 -0
- package/dist/{chunk-FEBAQI5A.js → chunk-LKDAN4D7.js} +6363 -1350
- package/dist/chunk-LQYS2N47.js +3923 -0
- package/dist/{chunk-NZYN7C3P.cjs → chunk-MPXOKQJP.cjs} +53 -53
- package/dist/chunk-MZEGQSKQ.js +118 -0
- package/dist/chunk-N76KU6F5.js +123 -0
- package/dist/chunk-NLUOTJWB.js +673 -0
- package/dist/{chunk-CMVXX7ON.cjs → chunk-NOITAVHA.cjs} +114 -58
- package/dist/{chunk-Q27JY5RG.cjs → chunk-OIKREZVQ.cjs} +7 -4
- package/dist/{chunk-ZQQUD66M.cjs → chunk-POUTD5AM.cjs} +63 -295
- package/dist/{chunk-6D4W22P4.js → chunk-QIIAMBTM.js} +4 -1
- package/dist/{chunk-56QD3YW6.cjs → chunk-QWNUOR7F.cjs} +11 -4
- package/dist/{chunk-S3DYFEBE.js → chunk-R4VCO2CB.js} +10 -1
- package/dist/{chunk-4VZX5F4T.cjs → chunk-T6NWPIYZ.cjs} +5 -2
- package/dist/{chunk-EBLFCNPY.js → chunk-U47LQXPB.js} +5 -2
- package/dist/chunk-UPQIWJIE.cjs +3923 -0
- package/dist/{chunk-N7OOJI5V.js → chunk-V2UKUTJ3.js} +5 -0
- package/dist/{chunk-45FHEOKW.js → chunk-V53ZEFXC.js} +92 -36
- package/dist/{chunk-RJ5ZGNI3.js → chunk-VL5TUDTM.js} +8 -2
- package/dist/{chunk-TIT74RIL.cjs → chunk-VSYQ6XYN.cjs} +6837 -1824
- package/dist/{chunk-OC6DOOFX.cjs → chunk-VXRTQZF2.cjs} +5 -5
- package/dist/{chunk-RICPANBY.cjs → chunk-WX2E2G7H.cjs} +13 -4
- package/dist/{chunk-DE2SRBFZ.js → chunk-X335TJNS.js} +4 -3
- package/dist/{chunk-CDHS2QDC.js → chunk-Y4CRNHJO.js} +53 -53
- package/dist/{chunk-P7EM6BND.cjs → chunk-ZAPN7XA6.cjs} +10 -10
- package/dist/{chunk-N2EIM2XJ.js → chunk-ZLNHPUFA.js} +22 -1
- package/dist/completion/BuiltinToolExecutor.cjs +2 -2
- package/dist/completion/BuiltinToolExecutor.d.cts +3 -1
- package/dist/completion/BuiltinToolExecutor.d.ts +3 -1
- package/dist/completion/BuiltinToolExecutor.js +1 -1
- package/dist/completion/CompletionService.cjs +32 -28
- package/dist/completion/CompletionService.d.cts +7 -3
- package/dist/completion/CompletionService.d.ts +7 -3
- package/dist/completion/CompletionService.js +31 -27
- package/dist/completion.cjs +40 -36
- package/dist/completion.d.cts +7 -3
- package/dist/completion.d.ts +7 -3
- package/dist/completion.js +39 -35
- package/dist/egress-I46O_p5L.d.cts +126 -0
- package/dist/egress-I46O_p5L.d.ts +126 -0
- package/dist/frontends-Doz0RaWu.d.cts +97 -0
- package/dist/frontends-Doz0RaWu.d.ts +97 -0
- package/dist/image-generation.cjs +52 -0
- package/dist/image-generation.d.cts +96 -0
- package/dist/image-generation.d.ts +96 -0
- package/dist/image-generation.js +52 -0
- package/dist/index.cjs +142 -32
- package/dist/index.d.cts +16 -8
- package/dist/index.d.ts +16 -8
- package/dist/index.js +159 -49
- package/dist/openai-operation.cjs +18 -0
- package/dist/openai-operation.d.cts +22 -0
- package/dist/openai-operation.d.ts +22 -0
- package/dist/openai-operation.js +18 -0
- package/dist/outbound-api/auditCapture.cjs +3 -3
- package/dist/outbound-api/auditCapture.d.cts +13 -2
- package/dist/outbound-api/auditCapture.d.ts +13 -2
- package/dist/outbound-api/auditCapture.js +2 -2
- package/dist/outbound-api/auditRedact.cjs +2 -2
- package/dist/outbound-api/auditRedact.js +1 -1
- package/dist/outbound-api/routeResolver.cjs +2 -2
- package/dist/outbound-api/routeResolver.d.cts +11 -4
- package/dist/outbound-api/routeResolver.d.ts +11 -4
- package/dist/outbound-api/routeResolver.js +1 -1
- package/dist/outbound-api/subscriptionRegistryPort.d.cts +5 -1
- package/dist/outbound-api/subscriptionRegistryPort.d.ts +5 -1
- package/dist/outbound-api/types.d.cts +10 -3
- package/dist/outbound-api/types.d.ts +10 -3
- package/dist/outbound-api.cjs +65 -33
- package/dist/outbound-api.d.cts +205 -10
- package/dist/outbound-api.d.ts +205 -10
- package/dist/outbound-api.js +64 -32
- package/dist/pipeline/AccountAllowanceScheduling.d.cts +22 -15
- package/dist/pipeline/AccountAllowanceScheduling.d.ts +22 -15
- package/dist/pipeline/LlmConfigProviderAuth.cjs +3 -3
- package/dist/pipeline/LlmConfigProviderAuth.js +2 -2
- package/dist/pipeline/SubscriptionAccountHealth.cjs +2 -2
- package/dist/pipeline/SubscriptionAccountHealth.d.cts +7 -0
- package/dist/pipeline/SubscriptionAccountHealth.d.ts +7 -0
- package/dist/pipeline/SubscriptionAccountHealth.js +1 -1
- package/dist/pipeline/executeProviderCall.cjs +2 -2
- package/dist/pipeline/executeProviderCall.d.cts +11 -6
- package/dist/pipeline/executeProviderCall.d.ts +11 -6
- package/dist/pipeline/executeProviderCall.js +1 -1
- package/dist/pipeline/upstreamFetch.cjs +2 -2
- package/dist/pipeline/upstreamFetch.d.cts +5 -0
- package/dist/pipeline/upstreamFetch.d.ts +5 -0
- package/dist/pipeline/upstreamFetch.js +1 -1
- package/dist/ports.d.cts +10 -3
- package/dist/ports.d.ts +10 -3
- package/dist/provider-proxy/ProviderProxy.cjs +32 -28
- package/dist/provider-proxy/ProviderProxy.d.cts +6 -2
- package/dist/provider-proxy/ProviderProxy.d.ts +6 -2
- package/dist/provider-proxy/ProviderProxy.js +31 -27
- package/dist/provider-proxy/identity/codexCliHeaders.cjs +4 -2
- package/dist/provider-proxy/identity/codexCliHeaders.d.cts +26 -6
- package/dist/provider-proxy/identity/codexCliHeaders.d.ts +26 -6
- package/dist/provider-proxy/identity/codexCliHeaders.js +5 -3
- package/dist/provider-proxy/ingress/providerProxyShared.cjs +36 -28
- package/dist/provider-proxy/ingress/providerProxyShared.d.cts +41 -9
- package/dist/provider-proxy/ingress/providerProxyShared.d.ts +41 -9
- package/dist/provider-proxy/ingress/providerProxyShared.js +35 -27
- package/dist/provider-proxy/types.d.cts +17 -483
- package/dist/provider-proxy/types.d.ts +17 -483
- package/dist/provider-proxy.cjs +46 -28
- package/dist/provider-proxy.d.cts +34 -8
- package/dist/provider-proxy.d.ts +34 -8
- package/dist/provider-proxy.js +45 -27
- package/dist/proxy-UZTtjPZx.d.cts +18 -0
- package/dist/proxy-UZTtjPZx.d.ts +18 -0
- package/dist/{routeResolver-CVFE8KKe.d.cts → routeResolver-Da0yvkL1.d.cts} +4 -2
- package/dist/{routeResolver-C0mkkZaM.d.ts → routeResolver-STwMz_G4.d.ts} +4 -2
- package/dist/runtime-6QXNU526.cjs +8 -0
- package/dist/runtime-M5WXLD2R.js +8 -0
- package/dist/runtime-t8AZacFF.d.cts +233 -0
- package/dist/runtime-t8AZacFF.d.ts +233 -0
- package/dist/search/api.cjs +761 -0
- package/dist/search/api.d.cts +370 -0
- package/dist/search/api.d.ts +370 -0
- package/dist/search/api.js +761 -0
- package/dist/search/http.cjs +37 -0
- package/dist/search/http.d.cts +269 -0
- package/dist/search/http.d.ts +269 -0
- package/dist/search/http.js +37 -0
- package/dist/search.cjs +57 -0
- package/dist/search.d.cts +113 -0
- package/dist/search.d.ts +113 -0
- package/dist/search.js +57 -0
- package/dist/transformer/TransformerChainExecutor.cjs +2 -2
- package/dist/transformer/TransformerChainExecutor.d.cts +2 -2
- package/dist/transformer/TransformerChainExecutor.d.ts +2 -2
- package/dist/transformer/TransformerChainExecutor.js +1 -1
- package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.cjs +16 -0
- package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.d.cts +53 -0
- package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.d.ts +53 -0
- package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.js +16 -0
- package/dist/transformer/transformers/AnthropicTransformer.cjs +4 -3
- package/dist/transformer/transformers/AnthropicTransformer.js +3 -2
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.cjs +4 -4
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.js +3 -3
- package/dist/transformer/transformers/GeminiTransformer.cjs +4 -4
- package/dist/transformer/transformers/GeminiTransformer.js +3 -3
- package/dist/transformer/transformers/OpenAIResponseTransformer.cjs +3 -3
- package/dist/transformer/transformers/OpenAIResponseTransformer.js +2 -2
- package/dist/transformer/transformers/OpenAITransformer.cjs +3 -3
- package/dist/transformer/transformers/OpenAITransformer.js +2 -2
- package/dist/transformer/transformers.cjs +11 -10
- package/dist/transformer/transformers.js +12 -11
- package/dist/transformer/types.d.cts +39 -4
- package/dist/transformer/types.d.ts +39 -4
- package/dist/transformer.cjs +14 -13
- package/dist/transformer.js +13 -12
- package/dist/types-BSIJdsyl.d.cts +1130 -0
- package/dist/types-Be-yt_6T.d.cts +196 -0
- package/dist/types-By9Tg6-I.d.ts +1130 -0
- package/dist/types-CbCZqLGg.d.cts +127 -0
- package/dist/types-CbCZqLGg.d.ts +127 -0
- package/dist/{types-C2MwkLah.d.cts → types-D-oHYusb.d.cts} +250 -21
- package/dist/types-Dm4_36V4.d.ts +196 -0
- package/dist/{types-BB8pxk_3.d.ts → types-Dvlpjn0d.d.ts} +250 -21
- package/dist/usage.cjs +2 -2
- package/dist/usage.d.cts +6 -1
- package/dist/usage.d.ts +6 -1
- package/dist/usage.js +1 -1
- package/package.json +71 -64
- package/dist/chunk-FCR77GYM.cjs +0 -33
- package/dist/chunk-K5NM7VAH.js +0 -33
- /package/dist/{chunk-XXFYLL7R.js → chunk-ECZ3ZE2C.js} +0 -0
- /package/dist/{chunk-3SCOLIPT.cjs → chunk-MXI2PWIC.cjs} +0 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { SearchProviderId } from '@omnicross/contracts/search-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Shared vocabulary for the API search slice (plan 阶段4).
|
|
5
|
+
*
|
|
6
|
+
* Config shapes, the transport seams, and the failure-stage vocabulary, in one
|
|
7
|
+
* place so the four adapters, the shared transport, the contributions factory
|
|
8
|
+
* and the doctor can agree on names without importing each other.
|
|
9
|
+
*
|
|
10
|
+
* The config shapes stay CORE-LOCAL rather than moving into
|
|
11
|
+
* `@omnicross/contracts`: their only consumers are in this package until
|
|
12
|
+
* 阶段5's daemon assembles real configuration, and promoting them then — with
|
|
13
|
+
* whatever that assembly actually needs — beats freezing a guess now. Recorded
|
|
14
|
+
* as an explicit deferral in the change's design.
|
|
15
|
+
*
|
|
16
|
+
* @module search/api/types
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The transport identity stamped on every failure this slice throws.
|
|
21
|
+
*
|
|
22
|
+
* Same client as the HTTP slice, declared separately rather than imported: the
|
|
23
|
+
* two subpaths are independent, and a shared constant would couple them for a
|
|
24
|
+
* five-character string.
|
|
25
|
+
*/
|
|
26
|
+
declare const SEARCH_API_TRANSPORT_ID = "undici";
|
|
27
|
+
/**
|
|
28
|
+
* Which phase of an API search failed (plan §11.4).
|
|
29
|
+
*
|
|
30
|
+
* - `config` — a required key or host is absent; nothing was sent.
|
|
31
|
+
* - `egress` — the policy refused the target or a redirect hop.
|
|
32
|
+
* - `connect` — the request never produced a response (DNS, TCP, TLS).
|
|
33
|
+
* - `fetch` — a response arrived but its status is unusable.
|
|
34
|
+
* - `redirect` — the redirect chain exceeded its cap.
|
|
35
|
+
* - `body-cap` — the response body outgrew its byte cap mid-stream.
|
|
36
|
+
* - `parse` — the body is not the JSON shape this API documents.
|
|
37
|
+
*/
|
|
38
|
+
type SearchApiStage = 'config' | 'egress' | 'connect' | 'fetch' | 'redirect' | 'body-cap' | 'parse';
|
|
39
|
+
/** Tavily: key required, host overridable. */
|
|
40
|
+
interface TavilyProviderConfig {
|
|
41
|
+
/** API key. Comma-separated values rotate round-robin. */
|
|
42
|
+
apiKey: string;
|
|
43
|
+
/** Override for `https://api.tavily.com`. */
|
|
44
|
+
apiHost?: string;
|
|
45
|
+
}
|
|
46
|
+
/** Jina: key OPTIONAL — the search endpoint works unauthenticated (rate-limited). */
|
|
47
|
+
interface JinaProviderConfig {
|
|
48
|
+
/** API key. Comma-separated values rotate round-robin. Omit to run keyless. */
|
|
49
|
+
apiKey?: string;
|
|
50
|
+
/** Override for `https://s.jina.ai`. */
|
|
51
|
+
apiHost?: string;
|
|
52
|
+
}
|
|
53
|
+
/** SearXNG: the HOST is the required setting; there is no API key. */
|
|
54
|
+
interface SearxngProviderConfig {
|
|
55
|
+
/** Base URL of the SearXNG instance. Required — this is its "configured" signal. */
|
|
56
|
+
apiHost: string;
|
|
57
|
+
/** Basic-auth user. Sent only when both user and password are present. */
|
|
58
|
+
basicAuthUsername?: string;
|
|
59
|
+
/** Basic-auth password. Sent only when both user and password are present. */
|
|
60
|
+
basicAuthPassword?: string;
|
|
61
|
+
}
|
|
62
|
+
/** Zhipu and Z.AI: one wire contract, two ids, two default hosts. */
|
|
63
|
+
interface ZhipuProviderConfig {
|
|
64
|
+
/** API key. Comma-separated values rotate round-robin. */
|
|
65
|
+
apiKey: string;
|
|
66
|
+
/** Override for the per-id default host; normalized onto `/web_search`. */
|
|
67
|
+
apiHost?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Per-provider configuration, keyed by provider id.
|
|
71
|
+
*
|
|
72
|
+
* A provider absent from this object is UNCONFIGURED, not broken: it produces
|
|
73
|
+
* no contribution at all, so capability discovery never advertises something
|
|
74
|
+
* that cannot run.
|
|
75
|
+
*/
|
|
76
|
+
interface SearchApiProviderConfigs {
|
|
77
|
+
tavily?: TavilyProviderConfig;
|
|
78
|
+
jina?: JinaProviderConfig;
|
|
79
|
+
searxng?: SearxngProviderConfig;
|
|
80
|
+
zhipu?: ZhipuProviderConfig;
|
|
81
|
+
'z.ai'?: ZhipuProviderConfig;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* One API request, as the shared transport takes it.
|
|
85
|
+
*
|
|
86
|
+
* `secrets` is the redaction input: every value listed is stripped out of any
|
|
87
|
+
* upstream text before it can reach an error message or a diagnostic. Tavily
|
|
88
|
+
* transmits its key in the request BODY, so an upstream 4xx that echoes the
|
|
89
|
+
* request would otherwise put the key straight into a log.
|
|
90
|
+
*/
|
|
91
|
+
interface SearchApiRequest {
|
|
92
|
+
/** Absolute request URL. Validated against the egress policy before use. */
|
|
93
|
+
url: string;
|
|
94
|
+
/** HTTP method. */
|
|
95
|
+
method: 'GET' | 'POST';
|
|
96
|
+
/** Request headers. Never logged, never echoed into an error. */
|
|
97
|
+
headers?: Record<string, string>;
|
|
98
|
+
/** Body to serialize as JSON. Omit for GET. */
|
|
99
|
+
jsonBody?: unknown;
|
|
100
|
+
/** Stamped onto every thrown error. */
|
|
101
|
+
providerId: SearchProviderId;
|
|
102
|
+
/** Human-readable provider name for failure messages (never the query). */
|
|
103
|
+
label: string;
|
|
104
|
+
/** Hard budget for this request in milliseconds. */
|
|
105
|
+
timeoutMs?: number;
|
|
106
|
+
/** Caller cancellation. Aborting surfaces as `cancelled`, never `timeout`. */
|
|
107
|
+
signal?: AbortSignal;
|
|
108
|
+
/** Credential values to redact from any upstream text. */
|
|
109
|
+
secrets?: ReadonlyArray<string | undefined>;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The seam every adapter calls: a request in, parsed JSON out.
|
|
113
|
+
*
|
|
114
|
+
* Deliberately `unknown` rather than generic. The transport cannot know an
|
|
115
|
+
* API's shape, and a generic here would be a promise it cannot keep — each
|
|
116
|
+
* adapter validates its own response and raises `parse_failed` itself, which is
|
|
117
|
+
* where that failure actually belongs.
|
|
118
|
+
*/
|
|
119
|
+
type SearchApiTransport = (request: SearchApiRequest) => Promise<unknown>;
|
|
120
|
+
/**
|
|
121
|
+
* The low-level fetch primitive the shared transport drives — undici's `fetch`
|
|
122
|
+
* by default. Separate from {@link SearchApiTransport} so redirect, status and
|
|
123
|
+
* redaction behavior can be unit-tested without a network.
|
|
124
|
+
*/
|
|
125
|
+
type SearchApiFetch = (url: string, init: RequestInit) => Promise<Response>;
|
|
126
|
+
|
|
127
|
+
export { type JinaProviderConfig as J, type SearchApiProviderConfigs as S, type TavilyProviderConfig as T, type ZhipuProviderConfig as Z, type SearchApiFetch as a, type SearchApiTransport as b, type SearxngProviderConfig as c, SEARCH_API_TRANSPORT_ID as d, type SearchApiRequest as e, type SearchApiStage as f };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { SearchProviderId } from '@omnicross/contracts/search-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Shared vocabulary for the API search slice (plan 阶段4).
|
|
5
|
+
*
|
|
6
|
+
* Config shapes, the transport seams, and the failure-stage vocabulary, in one
|
|
7
|
+
* place so the four adapters, the shared transport, the contributions factory
|
|
8
|
+
* and the doctor can agree on names without importing each other.
|
|
9
|
+
*
|
|
10
|
+
* The config shapes stay CORE-LOCAL rather than moving into
|
|
11
|
+
* `@omnicross/contracts`: their only consumers are in this package until
|
|
12
|
+
* 阶段5's daemon assembles real configuration, and promoting them then — with
|
|
13
|
+
* whatever that assembly actually needs — beats freezing a guess now. Recorded
|
|
14
|
+
* as an explicit deferral in the change's design.
|
|
15
|
+
*
|
|
16
|
+
* @module search/api/types
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The transport identity stamped on every failure this slice throws.
|
|
21
|
+
*
|
|
22
|
+
* Same client as the HTTP slice, declared separately rather than imported: the
|
|
23
|
+
* two subpaths are independent, and a shared constant would couple them for a
|
|
24
|
+
* five-character string.
|
|
25
|
+
*/
|
|
26
|
+
declare const SEARCH_API_TRANSPORT_ID = "undici";
|
|
27
|
+
/**
|
|
28
|
+
* Which phase of an API search failed (plan §11.4).
|
|
29
|
+
*
|
|
30
|
+
* - `config` — a required key or host is absent; nothing was sent.
|
|
31
|
+
* - `egress` — the policy refused the target or a redirect hop.
|
|
32
|
+
* - `connect` — the request never produced a response (DNS, TCP, TLS).
|
|
33
|
+
* - `fetch` — a response arrived but its status is unusable.
|
|
34
|
+
* - `redirect` — the redirect chain exceeded its cap.
|
|
35
|
+
* - `body-cap` — the response body outgrew its byte cap mid-stream.
|
|
36
|
+
* - `parse` — the body is not the JSON shape this API documents.
|
|
37
|
+
*/
|
|
38
|
+
type SearchApiStage = 'config' | 'egress' | 'connect' | 'fetch' | 'redirect' | 'body-cap' | 'parse';
|
|
39
|
+
/** Tavily: key required, host overridable. */
|
|
40
|
+
interface TavilyProviderConfig {
|
|
41
|
+
/** API key. Comma-separated values rotate round-robin. */
|
|
42
|
+
apiKey: string;
|
|
43
|
+
/** Override for `https://api.tavily.com`. */
|
|
44
|
+
apiHost?: string;
|
|
45
|
+
}
|
|
46
|
+
/** Jina: key OPTIONAL — the search endpoint works unauthenticated (rate-limited). */
|
|
47
|
+
interface JinaProviderConfig {
|
|
48
|
+
/** API key. Comma-separated values rotate round-robin. Omit to run keyless. */
|
|
49
|
+
apiKey?: string;
|
|
50
|
+
/** Override for `https://s.jina.ai`. */
|
|
51
|
+
apiHost?: string;
|
|
52
|
+
}
|
|
53
|
+
/** SearXNG: the HOST is the required setting; there is no API key. */
|
|
54
|
+
interface SearxngProviderConfig {
|
|
55
|
+
/** Base URL of the SearXNG instance. Required — this is its "configured" signal. */
|
|
56
|
+
apiHost: string;
|
|
57
|
+
/** Basic-auth user. Sent only when both user and password are present. */
|
|
58
|
+
basicAuthUsername?: string;
|
|
59
|
+
/** Basic-auth password. Sent only when both user and password are present. */
|
|
60
|
+
basicAuthPassword?: string;
|
|
61
|
+
}
|
|
62
|
+
/** Zhipu and Z.AI: one wire contract, two ids, two default hosts. */
|
|
63
|
+
interface ZhipuProviderConfig {
|
|
64
|
+
/** API key. Comma-separated values rotate round-robin. */
|
|
65
|
+
apiKey: string;
|
|
66
|
+
/** Override for the per-id default host; normalized onto `/web_search`. */
|
|
67
|
+
apiHost?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Per-provider configuration, keyed by provider id.
|
|
71
|
+
*
|
|
72
|
+
* A provider absent from this object is UNCONFIGURED, not broken: it produces
|
|
73
|
+
* no contribution at all, so capability discovery never advertises something
|
|
74
|
+
* that cannot run.
|
|
75
|
+
*/
|
|
76
|
+
interface SearchApiProviderConfigs {
|
|
77
|
+
tavily?: TavilyProviderConfig;
|
|
78
|
+
jina?: JinaProviderConfig;
|
|
79
|
+
searxng?: SearxngProviderConfig;
|
|
80
|
+
zhipu?: ZhipuProviderConfig;
|
|
81
|
+
'z.ai'?: ZhipuProviderConfig;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* One API request, as the shared transport takes it.
|
|
85
|
+
*
|
|
86
|
+
* `secrets` is the redaction input: every value listed is stripped out of any
|
|
87
|
+
* upstream text before it can reach an error message or a diagnostic. Tavily
|
|
88
|
+
* transmits its key in the request BODY, so an upstream 4xx that echoes the
|
|
89
|
+
* request would otherwise put the key straight into a log.
|
|
90
|
+
*/
|
|
91
|
+
interface SearchApiRequest {
|
|
92
|
+
/** Absolute request URL. Validated against the egress policy before use. */
|
|
93
|
+
url: string;
|
|
94
|
+
/** HTTP method. */
|
|
95
|
+
method: 'GET' | 'POST';
|
|
96
|
+
/** Request headers. Never logged, never echoed into an error. */
|
|
97
|
+
headers?: Record<string, string>;
|
|
98
|
+
/** Body to serialize as JSON. Omit for GET. */
|
|
99
|
+
jsonBody?: unknown;
|
|
100
|
+
/** Stamped onto every thrown error. */
|
|
101
|
+
providerId: SearchProviderId;
|
|
102
|
+
/** Human-readable provider name for failure messages (never the query). */
|
|
103
|
+
label: string;
|
|
104
|
+
/** Hard budget for this request in milliseconds. */
|
|
105
|
+
timeoutMs?: number;
|
|
106
|
+
/** Caller cancellation. Aborting surfaces as `cancelled`, never `timeout`. */
|
|
107
|
+
signal?: AbortSignal;
|
|
108
|
+
/** Credential values to redact from any upstream text. */
|
|
109
|
+
secrets?: ReadonlyArray<string | undefined>;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The seam every adapter calls: a request in, parsed JSON out.
|
|
113
|
+
*
|
|
114
|
+
* Deliberately `unknown` rather than generic. The transport cannot know an
|
|
115
|
+
* API's shape, and a generic here would be a promise it cannot keep — each
|
|
116
|
+
* adapter validates its own response and raises `parse_failed` itself, which is
|
|
117
|
+
* where that failure actually belongs.
|
|
118
|
+
*/
|
|
119
|
+
type SearchApiTransport = (request: SearchApiRequest) => Promise<unknown>;
|
|
120
|
+
/**
|
|
121
|
+
* The low-level fetch primitive the shared transport drives — undici's `fetch`
|
|
122
|
+
* by default. Separate from {@link SearchApiTransport} so redirect, status and
|
|
123
|
+
* redaction behavior can be unit-tested without a network.
|
|
124
|
+
*/
|
|
125
|
+
type SearchApiFetch = (url: string, init: RequestInit) => Promise<Response>;
|
|
126
|
+
|
|
127
|
+
export { type JinaProviderConfig as J, type SearchApiProviderConfigs as S, type TavilyProviderConfig as T, type ZhipuProviderConfig as Z, type SearchApiFetch as a, type SearchApiTransport as b, type SearxngProviderConfig as c, SEARCH_API_TRANSPORT_ID as d, type SearchApiRequest as e, type SearchApiStage as f };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { e as ImageApiLimits } from './types-Be-yt_6T.cjs';
|
|
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.cjs';
|
|
8
9
|
import { ProviderConfigSource } from './ports/provider-config-source.cjs';
|
|
9
|
-
import { P as ProviderProxy } from './ProviderProxy-
|
|
10
|
-
import { ProviderProxyDeps } from './
|
|
10
|
+
import { P as ProviderProxy } from './ProviderProxy-Bz_nkOwq.cjs';
|
|
11
|
+
import { W as ProviderProxyDeps } from './types-BSIJdsyl.cjs';
|
|
11
12
|
import { BoundAccountFallbackPolicy } from './pipeline/BoundAccountSelectionError.cjs';
|
|
13
|
+
import { S as SearchApiProviderConfigs } from './types-CbCZqLGg.cjs';
|
|
14
|
+
import { d as SearchFrontendModes } from './frontends-Doz0RaWu.cjs';
|
|
15
|
+
import { S as SearchRuntime } from './runtime-t8AZacFF.cjs';
|
|
12
16
|
import { c as KeySpend } from './keyPolicy-zdWTu3CQ.cjs';
|
|
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
|
-
*
|
|
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
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
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
|
-
*
|
|
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
|
-
/**
|
|
220
|
-
|
|
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
|
-
/**
|
|
671
|
-
allowedEndpoints
|
|
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
|
-
/**
|
|
777
|
-
allowedEndpoints?:
|
|
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?:
|
|
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,
|
|
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 };
|