@omnicross/core 0.2.0 → 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/LICENSE +21 -21
- package/NOTICE +57 -57
- package/README.md +22 -22
- 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-BiJqftc-.d.cts → CompletionService-BniP7j88.d.cts} +2 -2
- package/dist/{CompletionService-NXN_Av5W.d.ts → CompletionService-BqrKPwfA.d.ts} +2 -2
- package/dist/{ProviderProxy-CgIcCVwk.d.cts → ProviderProxy-Bz_nkOwq.d.cts} +1 -1
- package/dist/{ProviderProxy-DYoY5XoT.d.ts → ProviderProxy-Ckr6oTrE.d.ts} +1 -1
- package/dist/auth/GeminiCodeAssistProjectResolver.cjs +2 -2
- package/dist/auth/GeminiCodeAssistProjectResolver.js +1 -1
- package/dist/{chunk-FJNKXOWE.js → chunk-2C3TTBS7.js} +4 -4
- package/dist/{chunk-OST5RJOJ.cjs → chunk-4Z3ZLLC2.cjs} +13 -7
- package/dist/chunk-7RJI3NDI.cjs +236 -0
- package/dist/chunk-D4WNI6BR.cjs +386 -0
- package/dist/chunk-DBBR6RHF.js +236 -0
- package/dist/chunk-E4QHVXV5.cjs +118 -0
- package/dist/chunk-HL2YSPL7.cjs +673 -0
- package/dist/chunk-LFPQ2OVH.js +386 -0
- package/dist/{chunk-WSJE42SG.js → chunk-LKDAN4D7.js} +3684 -2462
- package/dist/{chunk-DEIUR2TH.js → chunk-LQYS2N47.js} +12 -8
- package/dist/{chunk-NZYN7C3P.cjs → chunk-MPXOKQJP.cjs} +53 -53
- package/dist/chunk-MZEGQSKQ.js +118 -0
- package/dist/chunk-NLUOTJWB.js +673 -0
- package/dist/{chunk-CTKM773J.cjs → chunk-UPQIWJIE.cjs} +12 -8
- package/dist/{chunk-CFSGYFOZ.js → chunk-VL5TUDTM.js} +7 -1
- package/dist/{chunk-7B56AJBB.cjs → chunk-VSYQ6XYN.cjs} +2233 -1011
- package/dist/{chunk-CDHS2QDC.js → chunk-Y4CRNHJO.js} +53 -53
- package/dist/{chunk-TVYA5JSQ.cjs → chunk-ZAPN7XA6.cjs} +5 -5
- 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 +11 -10
- package/dist/completion/CompletionService.d.cts +6 -3
- package/dist/completion/CompletionService.d.ts +6 -3
- package/dist/completion/CompletionService.js +10 -9
- package/dist/completion.cjs +11 -10
- package/dist/completion.d.cts +6 -3
- package/dist/completion.d.ts +6 -3
- package/dist/completion.js +10 -9
- 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 +2 -2
- package/dist/image-generation.d.cts +7 -4
- package/dist/image-generation.d.ts +7 -4
- package/dist/image-generation.js +1 -1
- package/dist/index.cjs +25 -10
- package/dist/index.d.cts +12 -8
- package/dist/index.d.ts +12 -8
- package/dist/index.js +24 -9
- package/dist/openai-operation.d.cts +4 -1
- package/dist/openai-operation.d.ts +4 -1
- package/dist/outbound-api/routeResolver.d.cts +9 -5
- package/dist/outbound-api/routeResolver.d.ts +9 -5
- package/dist/outbound-api/subscriptionRegistryPort.d.cts +4 -1
- package/dist/outbound-api/subscriptionRegistryPort.d.ts +4 -1
- package/dist/outbound-api/types.d.cts +8 -4
- package/dist/outbound-api/types.d.ts +8 -4
- package/dist/outbound-api.cjs +25 -10
- package/dist/outbound-api.d.cts +117 -8
- package/dist/outbound-api.d.ts +117 -8
- package/dist/outbound-api.js +24 -9
- package/dist/pipeline/AccountAllowanceScheduling.d.cts +8 -4
- package/dist/pipeline/AccountAllowanceScheduling.d.ts +8 -4
- package/dist/pipeline/upstreamFetch.cjs +2 -2
- package/dist/pipeline/upstreamFetch.js +1 -1
- package/dist/ports.d.cts +8 -4
- package/dist/ports.d.ts +8 -4
- package/dist/provider-proxy/ProviderProxy.cjs +11 -10
- package/dist/provider-proxy/ProviderProxy.d.cts +5 -2
- package/dist/provider-proxy/ProviderProxy.d.ts +5 -2
- package/dist/provider-proxy/ProviderProxy.js +10 -9
- package/dist/provider-proxy/ingress/providerProxyShared.cjs +13 -10
- package/dist/provider-proxy/ingress/providerProxyShared.d.cts +22 -3
- package/dist/provider-proxy/ingress/providerProxyShared.d.ts +22 -3
- package/dist/provider-proxy/ingress/providerProxyShared.js +12 -9
- package/dist/provider-proxy/types.d.cts +4 -1
- package/dist/provider-proxy/types.d.ts +4 -1
- package/dist/provider-proxy.cjs +11 -10
- package/dist/provider-proxy.d.cts +10 -6
- package/dist/provider-proxy.d.ts +10 -6
- package/dist/provider-proxy.js +10 -9
- package/dist/proxy-UZTtjPZx.d.cts +18 -0
- package/dist/proxy-UZTtjPZx.d.ts +18 -0
- package/dist/{routeResolver-rpKQLyDO.d.cts → routeResolver-Da0yvkL1.d.cts} +2 -2
- package/dist/{routeResolver-CTCcSHWu.d.ts → routeResolver-STwMz_G4.d.ts} +2 -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/transformers/AnthropicTransformer.cjs +3 -3
- package/dist/transformer/transformers/AnthropicTransformer.js +2 -2
- package/dist/transformer/transformers.cjs +7 -7
- package/dist/transformer/transformers.js +6 -6
- package/dist/transformer.cjs +6 -6
- package/dist/transformer.js +5 -5
- package/dist/{types-DsHBBk3h.d.cts → types-BSIJdsyl.d.cts} +15 -0
- package/dist/{types-CbglB73l.d.cts → types-Be-yt_6T.d.cts} +1 -1
- package/dist/{types-CVRge76p.d.ts → types-By9Tg6-I.d.ts} +15 -0
- package/dist/types-CbCZqLGg.d.cts +127 -0
- package/dist/types-CbCZqLGg.d.ts +127 -0
- package/dist/{types-jjU24eYG.d.cts → types-D-oHYusb.d.cts} +73 -4
- package/dist/{types-Bd72H4SB.d.ts → types-Dm4_36V4.d.ts} +1 -1
- package/dist/{types-5T223WYQ.d.ts → types-Dvlpjn0d.d.ts} +73 -4
- package/package.json +5 -3
- package/dist/{chunk-6OC3ORW6.js → chunk-EUZRH544.js} +3 -3
- package/dist/{chunk-SQMAEDNE.cjs → chunk-POUTD5AM.cjs} +2 -2
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import { e as ImageApiLimits } from './types-
|
|
1
|
+
import { e as ImageApiLimits } from './types-Be-yt_6T.cjs';
|
|
2
2
|
import { ProxyConfig } from '@omnicross/contracts/account-tokens-types';
|
|
3
3
|
import { AuditConfig } from '@omnicross/contracts/audit-types';
|
|
4
4
|
import { BillingConfig } from '@omnicross/contracts/billing-types';
|
|
@@ -7,9 +7,12 @@ import { VoucherRecord, VoucherGrant, VoucherInfo, VoucherConfig } from '@omnicr
|
|
|
7
7
|
import { WebhookConfig } from '@omnicross/contracts/webhook-types';
|
|
8
8
|
import { L as Logger } from './logger-4GvQNzhE.cjs';
|
|
9
9
|
import { ProviderConfigSource } from './ports/provider-config-source.cjs';
|
|
10
|
-
import { P as ProviderProxy } from './ProviderProxy-
|
|
11
|
-
import { W as ProviderProxyDeps } from './types-
|
|
10
|
+
import { P as ProviderProxy } from './ProviderProxy-Bz_nkOwq.cjs';
|
|
11
|
+
import { W as ProviderProxyDeps } from './types-BSIJdsyl.cjs';
|
|
12
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';
|
|
13
16
|
import { c as KeySpend } from './keyPolicy-zdWTu3CQ.cjs';
|
|
14
17
|
|
|
15
18
|
/**
|
|
@@ -244,6 +247,54 @@ interface VoucherDb {
|
|
|
244
247
|
type OutboundEndpoint = 'chat' | 'responses' | 'messages' | 'gemini';
|
|
245
248
|
/** Named-key authorization vocabulary. Images is deliberately not a text route. */
|
|
246
249
|
type OutboundPermission = OutboundEndpoint | 'images';
|
|
250
|
+
/**
|
|
251
|
+
* The persisted `search` section (plan §6.3).
|
|
252
|
+
*
|
|
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.
|
|
259
|
+
*
|
|
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.
|
|
264
|
+
*/
|
|
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
|
+
}
|
|
247
298
|
interface ImagesServerConfig {
|
|
248
299
|
enabled: boolean;
|
|
249
300
|
provider: 'codex-subscription';
|
|
@@ -770,6 +821,13 @@ interface OutboundApiServerConfig {
|
|
|
770
821
|
anthropic?: AnthropicConfigSegment;
|
|
771
822
|
/** Default-off Images serving policy; capability still requires fresh evidence. */
|
|
772
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;
|
|
773
831
|
}
|
|
774
832
|
/** A live status snapshot the Settings tab renders. */
|
|
775
833
|
interface OutboundApiServerStatus {
|
|
@@ -1075,6 +1133,17 @@ interface OutboundApiDeps {
|
|
|
1075
1133
|
* embedders/tests that do not wire it).
|
|
1076
1134
|
*/
|
|
1077
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;
|
|
1078
1147
|
}
|
|
1079
1148
|
|
|
1080
|
-
export { type
|
|
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 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _omnicross_contracts_image_generation_types from '@omnicross/contracts/image-generation-types';
|
|
2
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-
|
|
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
4
|
import { FileHandle } from 'node:fs/promises';
|
|
5
5
|
|
|
6
6
|
type ResourceKind = 'input' | 'spool';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as ImageApiLimits } from './types-
|
|
1
|
+
import { e as ImageApiLimits } from './types-Dm4_36V4.js';
|
|
2
2
|
import { ProxyConfig } from '@omnicross/contracts/account-tokens-types';
|
|
3
3
|
import { AuditConfig } from '@omnicross/contracts/audit-types';
|
|
4
4
|
import { BillingConfig } from '@omnicross/contracts/billing-types';
|
|
@@ -7,9 +7,12 @@ import { VoucherRecord, VoucherGrant, VoucherInfo, VoucherConfig } from '@omnicr
|
|
|
7
7
|
import { WebhookConfig } from '@omnicross/contracts/webhook-types';
|
|
8
8
|
import { L as Logger } from './logger-4GvQNzhE.js';
|
|
9
9
|
import { ProviderConfigSource } from './ports/provider-config-source.js';
|
|
10
|
-
import { P as ProviderProxy } from './ProviderProxy-
|
|
11
|
-
import { W as ProviderProxyDeps } from './types-
|
|
10
|
+
import { P as ProviderProxy } from './ProviderProxy-Ckr6oTrE.js';
|
|
11
|
+
import { W as ProviderProxyDeps } from './types-By9Tg6-I.js';
|
|
12
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';
|
|
13
16
|
import { c as KeySpend } from './keyPolicy-zdWTu3CQ.js';
|
|
14
17
|
|
|
15
18
|
/**
|
|
@@ -244,6 +247,54 @@ interface VoucherDb {
|
|
|
244
247
|
type OutboundEndpoint = 'chat' | 'responses' | 'messages' | 'gemini';
|
|
245
248
|
/** Named-key authorization vocabulary. Images is deliberately not a text route. */
|
|
246
249
|
type OutboundPermission = OutboundEndpoint | 'images';
|
|
250
|
+
/**
|
|
251
|
+
* The persisted `search` section (plan §6.3).
|
|
252
|
+
*
|
|
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.
|
|
259
|
+
*
|
|
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.
|
|
264
|
+
*/
|
|
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
|
+
}
|
|
247
298
|
interface ImagesServerConfig {
|
|
248
299
|
enabled: boolean;
|
|
249
300
|
provider: 'codex-subscription';
|
|
@@ -770,6 +821,13 @@ interface OutboundApiServerConfig {
|
|
|
770
821
|
anthropic?: AnthropicConfigSegment;
|
|
771
822
|
/** Default-off Images serving policy; capability still requires fresh evidence. */
|
|
772
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;
|
|
773
831
|
}
|
|
774
832
|
/** A live status snapshot the Settings tab renders. */
|
|
775
833
|
interface OutboundApiServerStatus {
|
|
@@ -1075,6 +1133,17 @@ interface OutboundApiDeps {
|
|
|
1075
1133
|
* embedders/tests that do not wire it).
|
|
1076
1134
|
*/
|
|
1077
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;
|
|
1078
1147
|
}
|
|
1079
1148
|
|
|
1080
|
-
export { type
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnicross/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Omnicross LLM serving core — provider dispatch, completion pipeline, transformers, and the provider proxy.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sayo (https://github.com/Dumoedss)",
|
|
@@ -50,13 +50,15 @@
|
|
|
50
50
|
"README.md"
|
|
51
51
|
],
|
|
52
52
|
"scripts": {
|
|
53
|
-
"build": "tsup",
|
|
53
|
+
"build": "tsup && node scripts/check-exports.mjs",
|
|
54
|
+
"check:exports": "node scripts/check-exports.mjs",
|
|
54
55
|
"typecheck": "tsc -p tsconfig.typecheck.json --noEmit"
|
|
55
56
|
},
|
|
56
57
|
"dependencies": {
|
|
57
58
|
"@mozilla/readability": "^0.6.0",
|
|
58
|
-
"@omnicross/contracts": "^0.2.
|
|
59
|
+
"@omnicross/contracts": "^0.2.1",
|
|
59
60
|
"busboy": "^1.6.0",
|
|
61
|
+
"entities": "^6.0.1",
|
|
60
62
|
"jsdom": "^24.1.3",
|
|
61
63
|
"sharp": "^0.35.4",
|
|
62
64
|
"socks": "^2.8.3",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
anthropicUsageToChatUsage
|
|
3
|
-
} from "./chunk-FU7EAR73.js";
|
|
4
1
|
import {
|
|
5
2
|
convertOpenAIStreamToAnthropic
|
|
6
3
|
} from "./chunk-LFEH7CEO.js";
|
|
4
|
+
import {
|
|
5
|
+
anthropicUsageToChatUsage
|
|
6
|
+
} from "./chunk-FU7EAR73.js";
|
|
7
7
|
import {
|
|
8
8
|
flattenToolResultContent,
|
|
9
9
|
formatBase64,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk6DDYNS2Bcjs = require('./chunk-6DDYNS2B.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk5RSZYQJHcjs = require('./chunk-5RSZYQJH.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|