@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,113 @@
|
|
|
1
|
+
export { D as DEFAULT_SEARCH_EGRESS_POLICY, E as EgressDenialReason, a as EgressDnsLookup, S as SearchEgressPolicy, b as assertEgressAddressAllowed, c as createEgressGuardedDispatcher, d as createEgressGuardedLookup, f as findEgressDenial, v as validateEgressUrl } from './egress-I46O_p5L.cjs';
|
|
2
|
+
export { D as DEFAULT_SEARCH_FRONTEND_MODES, S as SEARCH_FRONTEND_MODES, a as SEARCH_FRONTEND_NAMES, b as SEARCH_UNSUPPORTED_CAPABILITY_CODE, c as SearchFrontendMode, d as SearchFrontendModes, e as SearchFrontendName, i as isSearchFrontendMode, n as normalizeSearchFrontendModes, s as searchErrorHttpStatus, v as validateSearchFrontendModes } from './frontends-Doz0RaWu.cjs';
|
|
3
|
+
import { SearchResult } from '@omnicross/contracts/search-types';
|
|
4
|
+
import { S as SearchRuntime } from './runtime-t8AZacFF.cjs';
|
|
5
|
+
export { a as SearchOrchestrator, b as SearchOrchestratorOptions, c as SearchProviderRegistry, d as SearchProviderRegistryOptions, e as SearchRegistryError, f as SearchRuntimeEventListener, g as SearchRuntimeOptions, h as createSearchRuntime, i as hashSearchQuery } from './runtime-t8AZacFF.cjs';
|
|
6
|
+
import { WebSearchBackend } from './ports/web-search-backend.cjs';
|
|
7
|
+
import 'node:dns';
|
|
8
|
+
import 'undici';
|
|
9
|
+
import '@omnicross/contracts/websearch-types';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Result normalization — the baseline's safety checks, ported.
|
|
13
|
+
*
|
|
14
|
+
* A search result is untrusted input: it is produced by a page or an API the
|
|
15
|
+
* user does not control, and it is handed straight to a model that may follow
|
|
16
|
+
* the URL. The baseline (`elftia-search-baseline.md` §6.3/§6.4) filtered three
|
|
17
|
+
* things before letting results out of the orchestrator, and all three are kept
|
|
18
|
+
* here: a result needs a title, its URL must be a DIRECT result rather than a
|
|
19
|
+
* search-engine redirect, and the set must not repeat itself.
|
|
20
|
+
*
|
|
21
|
+
* One baseline behavior is deliberately NOT ported: **duplicate-only
|
|
22
|
+
* invalidation** — the rule that turned "exactly one survivor out of more than
|
|
23
|
+
* one structurally usable item" into `Provider returned only duplicate results`.
|
|
24
|
+
* It existed to catch a scrape that collapsed to a single repeated link, and
|
|
25
|
+
* 阶段2's HTTP providers now detect that themselves and raise `parse_failed`.
|
|
26
|
+
* For an API or host provider, one deduplicated result is a legitimate answer,
|
|
27
|
+
* not a failure. Recorded as an allowed difference for 阶段5's comparison.
|
|
28
|
+
*
|
|
29
|
+
* Normalization NEVER fails: it filters. Whether a search succeeded is the
|
|
30
|
+
* provider's answer, decided before these results get here — turning "every
|
|
31
|
+
* item was filtered" back into an error would hand the fallback policy a third
|
|
32
|
+
* outcome to interpret, which is exactly the conflation 阶段2 removed.
|
|
33
|
+
*
|
|
34
|
+
* @module search/normalize
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/** Results returned when the caller expresses no preference (baseline parity). */
|
|
38
|
+
declare const DEFAULT_NORMALIZED_MAX_RESULTS = 5;
|
|
39
|
+
/**
|
|
40
|
+
* Whether a URL points at a result rather than back at a search engine.
|
|
41
|
+
*
|
|
42
|
+
* Accepts only `http:`/`https:`; an unparseable URL is rejected. This is the
|
|
43
|
+
* check that keeps a SERP-redirect link — which re-runs a search instead of
|
|
44
|
+
* opening a page — out of a result set.
|
|
45
|
+
*/
|
|
46
|
+
declare function isDirectResultUrl(rawUrl: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* How many results to keep.
|
|
49
|
+
*
|
|
50
|
+
* `Math.max(1, …)` with no upper clamp, per baseline §4.4 — a provider's own
|
|
51
|
+
* limit is the provider's business, and imposing a second ceiling here would
|
|
52
|
+
* silently contradict whatever it declared in its capabilities.
|
|
53
|
+
*
|
|
54
|
+
* Non-finite input falls back to the default rather than propagating: 阶段2's
|
|
55
|
+
* `clampMaxResults` left `NaN` at baseline parity on purpose and named the
|
|
56
|
+
* runtime that owns option handling — this one — as where it should be
|
|
57
|
+
* normalized. Without this, a `NaN` reaches `slice(0, NaN)` and silently
|
|
58
|
+
* discards every result.
|
|
59
|
+
*/
|
|
60
|
+
declare function normalizedResultLimit(maxResults: number | undefined): number;
|
|
61
|
+
/**
|
|
62
|
+
* Apply the baseline's safety checks to one provider's results.
|
|
63
|
+
*
|
|
64
|
+
* Order is preserved; trimming happens before every comparison, so dedupe sees
|
|
65
|
+
* the same URL string a consumer will.
|
|
66
|
+
*/
|
|
67
|
+
declare function normalizeSearchResults(results: readonly SearchResult[], maxResults?: number): SearchResult[];
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* A legacy `WebSearchBackend` backed by the new runtime — migration scaffolding.
|
|
71
|
+
*
|
|
72
|
+
* **Nothing in Omnicross uses this yet, on purpose.** It exists so 阶段5 can
|
|
73
|
+
* move the remaining `WebSearchBackend` consumers (the Anthropic ingress
|
|
74
|
+
* `webSearchService` hint, anything a host passes in) onto the runtime one at a
|
|
75
|
+
* time instead of in a flag day. Like `@omnicross/contracts/search-compat`, it
|
|
76
|
+
* is Phase-1 debt with a scheduled deletion (阶段8) and is meant to be
|
|
77
|
+
* grep-able as such.
|
|
78
|
+
*
|
|
79
|
+
* The port TYPE stays exactly where it is — Elftia imports
|
|
80
|
+
* `@omnicross/core/ports/web-search-backend` directly — and this module only
|
|
81
|
+
* adds an implementation of it.
|
|
82
|
+
*
|
|
83
|
+
* The legacy conversions are NOT re-derived here: `toLegacyWebSearchResponse`
|
|
84
|
+
* and `searchErrorToLegacyWebSearchResponse` are child 2's single, tested
|
|
85
|
+
* mapping, and having a second one is how the two vocabularies would start to
|
|
86
|
+
* drift.
|
|
87
|
+
*
|
|
88
|
+
* @module search/webSearchBackendCompat
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
/** Optional capabilities the runtime itself does not provide. */
|
|
92
|
+
interface SearchRuntimeBackendOptions {
|
|
93
|
+
/**
|
|
94
|
+
* URL reading delegate.
|
|
95
|
+
*
|
|
96
|
+
* The runtime orchestrates `search` only — reading a URL stays with
|
|
97
|
+
* `web_fetch`'s own path until the reader story settles (阶段4+). Without a
|
|
98
|
+
* delegate, `readUrl` answers with a legacy failure response naming the
|
|
99
|
+
* missing capability rather than pretending to have read anything.
|
|
100
|
+
*/
|
|
101
|
+
readUrl?: WebSearchBackend['readUrl'];
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Present a {@link SearchRuntime} through the legacy port interface.
|
|
105
|
+
*
|
|
106
|
+
* `search` PINS the runtime to the requested provider: a legacy caller naming a
|
|
107
|
+
* provider is making an explicit choice, and quietly answering from a different
|
|
108
|
+
* one would both surprise it and send its query somewhere it did not ask for.
|
|
109
|
+
* Legacy callers that want fallback get it by looping, exactly as they do today.
|
|
110
|
+
*/
|
|
111
|
+
declare function searchRuntimeAsWebSearchBackend(runtime: SearchRuntime, options?: SearchRuntimeBackendOptions): WebSearchBackend;
|
|
112
|
+
|
|
113
|
+
export { DEFAULT_NORMALIZED_MAX_RESULTS, SearchRuntime, type SearchRuntimeBackendOptions, isDirectResultUrl, normalizeSearchResults, normalizedResultLimit, searchRuntimeAsWebSearchBackend };
|
package/dist/search.d.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export { D as DEFAULT_SEARCH_EGRESS_POLICY, E as EgressDenialReason, a as EgressDnsLookup, S as SearchEgressPolicy, b as assertEgressAddressAllowed, c as createEgressGuardedDispatcher, d as createEgressGuardedLookup, f as findEgressDenial, v as validateEgressUrl } from './egress-I46O_p5L.js';
|
|
2
|
+
export { D as DEFAULT_SEARCH_FRONTEND_MODES, S as SEARCH_FRONTEND_MODES, a as SEARCH_FRONTEND_NAMES, b as SEARCH_UNSUPPORTED_CAPABILITY_CODE, c as SearchFrontendMode, d as SearchFrontendModes, e as SearchFrontendName, i as isSearchFrontendMode, n as normalizeSearchFrontendModes, s as searchErrorHttpStatus, v as validateSearchFrontendModes } from './frontends-Doz0RaWu.js';
|
|
3
|
+
import { SearchResult } from '@omnicross/contracts/search-types';
|
|
4
|
+
import { S as SearchRuntime } from './runtime-t8AZacFF.js';
|
|
5
|
+
export { a as SearchOrchestrator, b as SearchOrchestratorOptions, c as SearchProviderRegistry, d as SearchProviderRegistryOptions, e as SearchRegistryError, f as SearchRuntimeEventListener, g as SearchRuntimeOptions, h as createSearchRuntime, i as hashSearchQuery } from './runtime-t8AZacFF.js';
|
|
6
|
+
import { WebSearchBackend } from './ports/web-search-backend.js';
|
|
7
|
+
import 'node:dns';
|
|
8
|
+
import 'undici';
|
|
9
|
+
import '@omnicross/contracts/websearch-types';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Result normalization — the baseline's safety checks, ported.
|
|
13
|
+
*
|
|
14
|
+
* A search result is untrusted input: it is produced by a page or an API the
|
|
15
|
+
* user does not control, and it is handed straight to a model that may follow
|
|
16
|
+
* the URL. The baseline (`elftia-search-baseline.md` §6.3/§6.4) filtered three
|
|
17
|
+
* things before letting results out of the orchestrator, and all three are kept
|
|
18
|
+
* here: a result needs a title, its URL must be a DIRECT result rather than a
|
|
19
|
+
* search-engine redirect, and the set must not repeat itself.
|
|
20
|
+
*
|
|
21
|
+
* One baseline behavior is deliberately NOT ported: **duplicate-only
|
|
22
|
+
* invalidation** — the rule that turned "exactly one survivor out of more than
|
|
23
|
+
* one structurally usable item" into `Provider returned only duplicate results`.
|
|
24
|
+
* It existed to catch a scrape that collapsed to a single repeated link, and
|
|
25
|
+
* 阶段2's HTTP providers now detect that themselves and raise `parse_failed`.
|
|
26
|
+
* For an API or host provider, one deduplicated result is a legitimate answer,
|
|
27
|
+
* not a failure. Recorded as an allowed difference for 阶段5's comparison.
|
|
28
|
+
*
|
|
29
|
+
* Normalization NEVER fails: it filters. Whether a search succeeded is the
|
|
30
|
+
* provider's answer, decided before these results get here — turning "every
|
|
31
|
+
* item was filtered" back into an error would hand the fallback policy a third
|
|
32
|
+
* outcome to interpret, which is exactly the conflation 阶段2 removed.
|
|
33
|
+
*
|
|
34
|
+
* @module search/normalize
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/** Results returned when the caller expresses no preference (baseline parity). */
|
|
38
|
+
declare const DEFAULT_NORMALIZED_MAX_RESULTS = 5;
|
|
39
|
+
/**
|
|
40
|
+
* Whether a URL points at a result rather than back at a search engine.
|
|
41
|
+
*
|
|
42
|
+
* Accepts only `http:`/`https:`; an unparseable URL is rejected. This is the
|
|
43
|
+
* check that keeps a SERP-redirect link — which re-runs a search instead of
|
|
44
|
+
* opening a page — out of a result set.
|
|
45
|
+
*/
|
|
46
|
+
declare function isDirectResultUrl(rawUrl: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* How many results to keep.
|
|
49
|
+
*
|
|
50
|
+
* `Math.max(1, …)` with no upper clamp, per baseline §4.4 — a provider's own
|
|
51
|
+
* limit is the provider's business, and imposing a second ceiling here would
|
|
52
|
+
* silently contradict whatever it declared in its capabilities.
|
|
53
|
+
*
|
|
54
|
+
* Non-finite input falls back to the default rather than propagating: 阶段2's
|
|
55
|
+
* `clampMaxResults` left `NaN` at baseline parity on purpose and named the
|
|
56
|
+
* runtime that owns option handling — this one — as where it should be
|
|
57
|
+
* normalized. Without this, a `NaN` reaches `slice(0, NaN)` and silently
|
|
58
|
+
* discards every result.
|
|
59
|
+
*/
|
|
60
|
+
declare function normalizedResultLimit(maxResults: number | undefined): number;
|
|
61
|
+
/**
|
|
62
|
+
* Apply the baseline's safety checks to one provider's results.
|
|
63
|
+
*
|
|
64
|
+
* Order is preserved; trimming happens before every comparison, so dedupe sees
|
|
65
|
+
* the same URL string a consumer will.
|
|
66
|
+
*/
|
|
67
|
+
declare function normalizeSearchResults(results: readonly SearchResult[], maxResults?: number): SearchResult[];
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* A legacy `WebSearchBackend` backed by the new runtime — migration scaffolding.
|
|
71
|
+
*
|
|
72
|
+
* **Nothing in Omnicross uses this yet, on purpose.** It exists so 阶段5 can
|
|
73
|
+
* move the remaining `WebSearchBackend` consumers (the Anthropic ingress
|
|
74
|
+
* `webSearchService` hint, anything a host passes in) onto the runtime one at a
|
|
75
|
+
* time instead of in a flag day. Like `@omnicross/contracts/search-compat`, it
|
|
76
|
+
* is Phase-1 debt with a scheduled deletion (阶段8) and is meant to be
|
|
77
|
+
* grep-able as such.
|
|
78
|
+
*
|
|
79
|
+
* The port TYPE stays exactly where it is — Elftia imports
|
|
80
|
+
* `@omnicross/core/ports/web-search-backend` directly — and this module only
|
|
81
|
+
* adds an implementation of it.
|
|
82
|
+
*
|
|
83
|
+
* The legacy conversions are NOT re-derived here: `toLegacyWebSearchResponse`
|
|
84
|
+
* and `searchErrorToLegacyWebSearchResponse` are child 2's single, tested
|
|
85
|
+
* mapping, and having a second one is how the two vocabularies would start to
|
|
86
|
+
* drift.
|
|
87
|
+
*
|
|
88
|
+
* @module search/webSearchBackendCompat
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
/** Optional capabilities the runtime itself does not provide. */
|
|
92
|
+
interface SearchRuntimeBackendOptions {
|
|
93
|
+
/**
|
|
94
|
+
* URL reading delegate.
|
|
95
|
+
*
|
|
96
|
+
* The runtime orchestrates `search` only — reading a URL stays with
|
|
97
|
+
* `web_fetch`'s own path until the reader story settles (阶段4+). Without a
|
|
98
|
+
* delegate, `readUrl` answers with a legacy failure response naming the
|
|
99
|
+
* missing capability rather than pretending to have read anything.
|
|
100
|
+
*/
|
|
101
|
+
readUrl?: WebSearchBackend['readUrl'];
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Present a {@link SearchRuntime} through the legacy port interface.
|
|
105
|
+
*
|
|
106
|
+
* `search` PINS the runtime to the requested provider: a legacy caller naming a
|
|
107
|
+
* provider is making an explicit choice, and quietly answering from a different
|
|
108
|
+
* one would both surprise it and send its query somewhere it did not ask for.
|
|
109
|
+
* Legacy callers that want fallback get it by looping, exactly as they do today.
|
|
110
|
+
*/
|
|
111
|
+
declare function searchRuntimeAsWebSearchBackend(runtime: SearchRuntime, options?: SearchRuntimeBackendOptions): WebSearchBackend;
|
|
112
|
+
|
|
113
|
+
export { DEFAULT_NORMALIZED_MAX_RESULTS, SearchRuntime, type SearchRuntimeBackendOptions, isDirectResultUrl, normalizeSearchResults, normalizedResultLimit, searchRuntimeAsWebSearchBackend };
|
package/dist/search.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_NORMALIZED_MAX_RESULTS,
|
|
3
|
+
SearchOrchestrator,
|
|
4
|
+
SearchProviderRegistry,
|
|
5
|
+
SearchRegistryError,
|
|
6
|
+
createSearchRuntime,
|
|
7
|
+
hashSearchQuery,
|
|
8
|
+
isDirectResultUrl,
|
|
9
|
+
normalizeSearchResults,
|
|
10
|
+
normalizedResultLimit
|
|
11
|
+
} from "./chunk-LFPQ2OVH.js";
|
|
12
|
+
import "./chunk-NLUOTJWB.js";
|
|
13
|
+
import {
|
|
14
|
+
DEFAULT_SEARCH_EGRESS_POLICY,
|
|
15
|
+
assertEgressAddressAllowed,
|
|
16
|
+
createEgressGuardedDispatcher,
|
|
17
|
+
createEgressGuardedLookup,
|
|
18
|
+
findEgressDenial,
|
|
19
|
+
validateEgressUrl
|
|
20
|
+
} from "./chunk-DBBR6RHF.js";
|
|
21
|
+
import {
|
|
22
|
+
DEFAULT_SEARCH_FRONTEND_MODES,
|
|
23
|
+
SEARCH_FRONTEND_MODES,
|
|
24
|
+
SEARCH_FRONTEND_NAMES,
|
|
25
|
+
SEARCH_UNSUPPORTED_CAPABILITY_CODE,
|
|
26
|
+
isSearchFrontendMode,
|
|
27
|
+
normalizeSearchFrontendModes,
|
|
28
|
+
searchErrorHttpStatus,
|
|
29
|
+
searchRuntimeAsWebSearchBackend,
|
|
30
|
+
validateSearchFrontendModes
|
|
31
|
+
} from "./chunk-MZEGQSKQ.js";
|
|
32
|
+
export {
|
|
33
|
+
DEFAULT_NORMALIZED_MAX_RESULTS,
|
|
34
|
+
DEFAULT_SEARCH_EGRESS_POLICY,
|
|
35
|
+
DEFAULT_SEARCH_FRONTEND_MODES,
|
|
36
|
+
SEARCH_FRONTEND_MODES,
|
|
37
|
+
SEARCH_FRONTEND_NAMES,
|
|
38
|
+
SEARCH_UNSUPPORTED_CAPABILITY_CODE,
|
|
39
|
+
SearchOrchestrator,
|
|
40
|
+
SearchProviderRegistry,
|
|
41
|
+
SearchRegistryError,
|
|
42
|
+
assertEgressAddressAllowed,
|
|
43
|
+
createEgressGuardedDispatcher,
|
|
44
|
+
createEgressGuardedLookup,
|
|
45
|
+
createSearchRuntime,
|
|
46
|
+
findEgressDenial,
|
|
47
|
+
hashSearchQuery,
|
|
48
|
+
isDirectResultUrl,
|
|
49
|
+
isSearchFrontendMode,
|
|
50
|
+
normalizeSearchFrontendModes,
|
|
51
|
+
normalizeSearchResults,
|
|
52
|
+
normalizedResultLimit,
|
|
53
|
+
searchErrorHttpStatus,
|
|
54
|
+
searchRuntimeAsWebSearchBackend,
|
|
55
|
+
validateEgressUrl,
|
|
56
|
+
validateSearchFrontendModes
|
|
57
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-5RSZYQJH.cjs');
|
|
3
|
+
var _chunkPOUTD5AMcjs = require('../../chunk-POUTD5AM.cjs');
|
|
5
4
|
require('../../chunk-6DDYNS2B.cjs');
|
|
5
|
+
require('../../chunk-5RSZYQJH.cjs');
|
|
6
6
|
require('../../chunk-77USGNRW.cjs');
|
|
7
7
|
require('../../chunk-IUL4VWNU.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.AnthropicTransformer =
|
|
10
|
+
exports.AnthropicTransformer = _chunkPOUTD5AMcjs.AnthropicTransformer;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AnthropicTransformer
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-FU7EAR73.js";
|
|
3
|
+
} from "../../chunk-EUZRH544.js";
|
|
5
4
|
import "../../chunk-LFEH7CEO.js";
|
|
5
|
+
import "../../chunk-FU7EAR73.js";
|
|
6
6
|
import "../../chunk-WYVGULTQ.js";
|
|
7
7
|
import "../../chunk-ZLNHPUFA.js";
|
|
8
8
|
export {
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkZAPN7XA6cjs = require('../chunk-ZAPN7XA6.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkKIQ2HA2Acjs = require('../chunk-KIQ2HA2A.cjs');
|
|
7
10
|
|
|
8
11
|
|
|
9
12
|
var _chunkNOITAVHAcjs = require('../chunk-NOITAVHA.cjs');
|
|
@@ -12,12 +15,9 @@ var _chunkNOITAVHAcjs = require('../chunk-NOITAVHA.cjs');
|
|
|
12
15
|
var _chunkQWNUOR7Fcjs = require('../chunk-QWNUOR7F.cjs');
|
|
13
16
|
|
|
14
17
|
|
|
15
|
-
var
|
|
16
|
-
require('../chunk-5RSZYQJH.cjs');
|
|
18
|
+
var _chunkPOUTD5AMcjs = require('../chunk-POUTD5AM.cjs');
|
|
17
19
|
require('../chunk-6DDYNS2B.cjs');
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var _chunkKIQ2HA2Acjs = require('../chunk-KIQ2HA2A.cjs');
|
|
20
|
+
require('../chunk-5RSZYQJH.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
var _chunkVXRTQZF2cjs = require('../chunk-VXRTQZF2.cjs');
|
|
@@ -34,4 +34,4 @@ require('../chunk-IUL4VWNU.cjs');
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
exports.AnthropicTransformer =
|
|
37
|
+
exports.AnthropicTransformer = _chunkPOUTD5AMcjs.AnthropicTransformer; exports.BUILTIN_TRANSFORMER_NAMES = _chunkZAPN7XA6cjs.BUILTIN_TRANSFORMER_NAMES; exports.BuiltinTransformers = _chunkZAPN7XA6cjs.BuiltinTransformers; exports.GeminiCodeAssistTransformer = _chunkVXRTQZF2cjs.GeminiCodeAssistTransformer; exports.GeminiTransformer = _chunkKIQ2HA2Acjs.GeminiTransformer; exports.OpenAIResponseTransformer = _chunkNOITAVHAcjs.OpenAIResponseTransformer; exports.OpenAITransformer = _chunkQWNUOR7Fcjs.OpenAITransformer; exports.getBuiltinTransformers = _chunkZAPN7XA6cjs.getBuiltinTransformers; exports.registerBuiltinTransformers = _chunkZAPN7XA6cjs.registerBuiltinTransformers;
|
|
@@ -3,7 +3,10 @@ import {
|
|
|
3
3
|
BuiltinTransformers,
|
|
4
4
|
getBuiltinTransformers,
|
|
5
5
|
registerBuiltinTransformers
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-2C3TTBS7.js";
|
|
7
|
+
import {
|
|
8
|
+
GeminiTransformer
|
|
9
|
+
} from "../chunk-HN74IGEO.js";
|
|
7
10
|
import {
|
|
8
11
|
OpenAIResponseTransformer
|
|
9
12
|
} from "../chunk-V53ZEFXC.js";
|
|
@@ -12,12 +15,9 @@ import {
|
|
|
12
15
|
} from "../chunk-7PIUVCKK.js";
|
|
13
16
|
import {
|
|
14
17
|
AnthropicTransformer
|
|
15
|
-
} from "../chunk-
|
|
16
|
-
import "../chunk-FU7EAR73.js";
|
|
18
|
+
} from "../chunk-EUZRH544.js";
|
|
17
19
|
import "../chunk-LFEH7CEO.js";
|
|
18
|
-
import
|
|
19
|
-
GeminiTransformer
|
|
20
|
-
} from "../chunk-HN74IGEO.js";
|
|
20
|
+
import "../chunk-FU7EAR73.js";
|
|
21
21
|
import {
|
|
22
22
|
GeminiCodeAssistTransformer
|
|
23
23
|
} from "../chunk-4VVCXVB7.js";
|
package/dist/transformer.cjs
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
var _chunk7ZHBN75Ncjs = require('./chunk-7ZHBN75N.cjs');
|
|
5
|
+
require('./chunk-GBHYAGX3.cjs');
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
var _chunk3OPYJG76cjs = require('./chunk-3OPYJG76.cjs');
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
var
|
|
11
|
+
var _chunkZAPN7XA6cjs = require('./chunk-ZAPN7XA6.cjs');
|
|
12
|
+
require('./chunk-KIQ2HA2A.cjs');
|
|
11
13
|
require('./chunk-NOITAVHA.cjs');
|
|
12
14
|
require('./chunk-QWNUOR7F.cjs');
|
|
13
|
-
require('./chunk-
|
|
14
|
-
require('./chunk-5RSZYQJH.cjs');
|
|
15
|
+
require('./chunk-POUTD5AM.cjs');
|
|
15
16
|
require('./chunk-6DDYNS2B.cjs');
|
|
16
|
-
require('./chunk-
|
|
17
|
-
require('./chunk-GBHYAGX3.cjs');
|
|
17
|
+
require('./chunk-5RSZYQJH.cjs');
|
|
18
18
|
require('./chunk-VXRTQZF2.cjs');
|
|
19
19
|
require('./chunk-WX2E2G7H.cjs');
|
|
20
20
|
require('./chunk-77USGNRW.cjs');
|
|
@@ -40,4 +40,4 @@ var _chunkIUL4VWNUcjs = require('./chunk-IUL4VWNU.cjs');
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
exports.THINK_LEVELS = _chunkIUL4VWNUcjs.THINK_LEVELS; exports.TransformerChainExecutor = _chunk7ZHBN75Ncjs.TransformerChainExecutor; exports.TransformerService = _chunk3OPYJG76cjs.TransformerService; exports.extractReasoningIntent = _chunkIUL4VWNUcjs.extractReasoningIntent; exports.normalizeThinkLevel = _chunkIUL4VWNUcjs.normalizeThinkLevel; exports.registerBuiltinTransformers =
|
|
43
|
+
exports.THINK_LEVELS = _chunkIUL4VWNUcjs.THINK_LEVELS; exports.TransformerChainExecutor = _chunk7ZHBN75Ncjs.TransformerChainExecutor; exports.TransformerService = _chunk3OPYJG76cjs.TransformerService; exports.extractReasoningIntent = _chunkIUL4VWNUcjs.extractReasoningIntent; exports.normalizeThinkLevel = _chunkIUL4VWNUcjs.normalizeThinkLevel; exports.registerBuiltinTransformers = _chunkZAPN7XA6cjs.registerBuiltinTransformers; exports.resolveReasoningEffort = _chunkIUL4VWNUcjs.resolveReasoningEffort; exports.resolveReasoningPlan = _chunkIUL4VWNUcjs.resolveReasoningPlan; exports.resolveReasoningTokenLimit = _chunkIUL4VWNUcjs.resolveReasoningTokenLimit; exports.resolveRequestReasoning = _chunkIUL4VWNUcjs.resolveRequestReasoning; exports.resolveTargetModelCapabilities = _chunkIUL4VWNUcjs.resolveTargetModelCapabilities;
|
package/dist/transformer.js
CHANGED
|
@@ -2,19 +2,19 @@ import "./chunk-WTQMX2Q6.js";
|
|
|
2
2
|
import {
|
|
3
3
|
TransformerChainExecutor
|
|
4
4
|
} from "./chunk-EYGBM2VC.js";
|
|
5
|
+
import "./chunk-MZNPGW5Q.js";
|
|
5
6
|
import {
|
|
6
7
|
TransformerService
|
|
7
8
|
} from "./chunk-DK4A7DLE.js";
|
|
8
9
|
import {
|
|
9
10
|
registerBuiltinTransformers
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-2C3TTBS7.js";
|
|
12
|
+
import "./chunk-HN74IGEO.js";
|
|
11
13
|
import "./chunk-V53ZEFXC.js";
|
|
12
14
|
import "./chunk-7PIUVCKK.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-FU7EAR73.js";
|
|
15
|
+
import "./chunk-EUZRH544.js";
|
|
15
16
|
import "./chunk-LFEH7CEO.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-MZNPGW5Q.js";
|
|
17
|
+
import "./chunk-FU7EAR73.js";
|
|
18
18
|
import "./chunk-4VVCXVB7.js";
|
|
19
19
|
import "./chunk-R4VCO2CB.js";
|
|
20
20
|
import "./chunk-WYVGULTQ.js";
|
|
@@ -10,6 +10,8 @@ import { SubscriptionAuthProfile } from './pipeline/SubscriptionAuthSource.cjs';
|
|
|
10
10
|
import { AuthStrategy } from './pipeline/SubscriptionAuthStrategy.cjs';
|
|
11
11
|
import { ProviderConfigSource } from './ports/provider-config-source.cjs';
|
|
12
12
|
import { WebSearchBackend } from './ports/web-search-backend.cjs';
|
|
13
|
+
import { d as SearchFrontendModes } from './frontends-Doz0RaWu.cjs';
|
|
14
|
+
import { S as SearchRuntime } from './runtime-t8AZacFF.cjs';
|
|
13
15
|
import { ImageArtifactMetadata, SensitiveOpaqueImageReference, ImageReferenceMetadata, ImageReferenceId, ImageAction, ImageQuality, ImageBackground, ImageOutputFormat, ImageGenerationErrorCode, ImageUsage, ImageArtifactId, ImageCapabilities, NormalizedImageRequest, ImageProviderEvent, ImageSize, ImageGenerationPublicError } from '@omnicross/contracts/image-generation-types';
|
|
14
16
|
import { ApiFormat } from '@omnicross/contracts/llm-config';
|
|
15
17
|
|
|
@@ -1064,6 +1066,19 @@ interface ProviderProxyDeps {
|
|
|
1064
1066
|
* ingress responds 502 (the factory is a hard dependency of THAT path only).
|
|
1065
1067
|
*/
|
|
1066
1068
|
readonly anthropicIngressHandlerFactory?: AnthropicIngressHandlerFactory | null;
|
|
1069
|
+
/**
|
|
1070
|
+
* The ONE shared search runtime (plan 阶段5). Consumed by the managed
|
|
1071
|
+
* Responses and Anthropic lanes; the same instance the outbound Codex route
|
|
1072
|
+
* and `doctor search` see. Optional so embedders that never enable a managed
|
|
1073
|
+
* mode compile and behave unchanged.
|
|
1074
|
+
*/
|
|
1075
|
+
readonly searchRuntime?: SearchRuntime | null;
|
|
1076
|
+
/**
|
|
1077
|
+
* Per-frontend search modes, resolved ONCE per request from this snapshot
|
|
1078
|
+
* before any wire bytes are emitted. Absent ⇒ the behavior-preserving
|
|
1079
|
+
* defaults (`native` for both protocol frontends).
|
|
1080
|
+
*/
|
|
1081
|
+
readonly searchFrontendModes?: SearchFrontendModes | null;
|
|
1067
1082
|
}
|
|
1068
1083
|
/**
|
|
1069
1084
|
* Structural port for the usage recorder — only the `record` method.
|
|
@@ -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-BSIJdsyl.cjs';
|
|
4
4
|
import { FileHandle } from 'node:fs/promises';
|
|
5
5
|
|
|
6
6
|
type ResourceKind = 'input' | 'spool';
|
|
@@ -10,6 +10,8 @@ import { SubscriptionAuthProfile } from './pipeline/SubscriptionAuthSource.js';
|
|
|
10
10
|
import { AuthStrategy } from './pipeline/SubscriptionAuthStrategy.js';
|
|
11
11
|
import { ProviderConfigSource } from './ports/provider-config-source.js';
|
|
12
12
|
import { WebSearchBackend } from './ports/web-search-backend.js';
|
|
13
|
+
import { d as SearchFrontendModes } from './frontends-Doz0RaWu.js';
|
|
14
|
+
import { S as SearchRuntime } from './runtime-t8AZacFF.js';
|
|
13
15
|
import { ImageArtifactMetadata, SensitiveOpaqueImageReference, ImageReferenceMetadata, ImageReferenceId, ImageAction, ImageQuality, ImageBackground, ImageOutputFormat, ImageGenerationErrorCode, ImageUsage, ImageArtifactId, ImageCapabilities, NormalizedImageRequest, ImageProviderEvent, ImageSize, ImageGenerationPublicError } from '@omnicross/contracts/image-generation-types';
|
|
14
16
|
import { ApiFormat } from '@omnicross/contracts/llm-config';
|
|
15
17
|
|
|
@@ -1064,6 +1066,19 @@ interface ProviderProxyDeps {
|
|
|
1064
1066
|
* ingress responds 502 (the factory is a hard dependency of THAT path only).
|
|
1065
1067
|
*/
|
|
1066
1068
|
readonly anthropicIngressHandlerFactory?: AnthropicIngressHandlerFactory | null;
|
|
1069
|
+
/**
|
|
1070
|
+
* The ONE shared search runtime (plan 阶段5). Consumed by the managed
|
|
1071
|
+
* Responses and Anthropic lanes; the same instance the outbound Codex route
|
|
1072
|
+
* and `doctor search` see. Optional so embedders that never enable a managed
|
|
1073
|
+
* mode compile and behave unchanged.
|
|
1074
|
+
*/
|
|
1075
|
+
readonly searchRuntime?: SearchRuntime | null;
|
|
1076
|
+
/**
|
|
1077
|
+
* Per-frontend search modes, resolved ONCE per request from this snapshot
|
|
1078
|
+
* before any wire bytes are emitted. Absent ⇒ the behavior-preserving
|
|
1079
|
+
* defaults (`native` for both protocol frontends).
|
|
1080
|
+
*/
|
|
1081
|
+
readonly searchFrontendModes?: SearchFrontendModes | null;
|
|
1067
1082
|
}
|
|
1068
1083
|
/**
|
|
1069
1084
|
* Structural port for the usage recorder — only the `record` method.
|
|
@@ -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 };
|