@omnicross/core 0.2.0 → 0.3.0
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/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-NZYN7C3P.cjs → chunk-2RCCLQYV.cjs} +53 -53
- package/dist/{chunk-CDHS2QDC.js → chunk-4PFWFODB.js} +53 -53
- package/dist/{chunk-OST5RJOJ.cjs → chunk-4Z3ZLLC2.cjs} +13 -7
- package/dist/chunk-7RJI3NDI.cjs +236 -0
- package/dist/chunk-BTBEJRGL.cjs +781 -0
- package/dist/chunk-DBBR6RHF.js +236 -0
- package/dist/chunk-DXWFBBSK.js +781 -0
- package/dist/chunk-E4QHVXV5.cjs +118 -0
- package/dist/chunk-L7O2YQ5O.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-MZEGQSKQ.js +118 -0
- package/dist/chunk-PTU7SXM3.cjs +386 -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-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-5NCT3J3T.cjs +8 -0
- package/dist/runtime-JTHUWCBM.js +8 -0
- package/dist/runtime-t8AZacFF.d.cts +233 -0
- package/dist/runtime-t8AZacFF.d.ts +233 -0
- package/dist/search/api.cjs +766 -0
- package/dist/search/api.d.cts +385 -0
- package/dist/search/api.d.ts +385 -0
- package/dist/search/api.js +766 -0
- package/dist/search/http.cjs +37 -0
- package/dist/search/http.d.cts +323 -0
- package/dist/search/http.d.ts +323 -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 +6 -3
- package/dist/{chunk-6OC3ORW6.js → chunk-EUZRH544.js} +3 -3
- package/dist/{chunk-SQMAEDNE.cjs → chunk-POUTD5AM.cjs} +2 -2
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkKIQ2HA2Acjs = require('./chunk-KIQ2HA2A.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkNOITAVHAcjs = require('./chunk-NOITAVHA.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkQWNUOR7Fcjs = require('./chunk-QWNUOR7F.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkPOUTD5AMcjs = require('./chunk-POUTD5AM.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
var _chunkVXRTQZF2cjs = require('./chunk-VXRTQZF2.cjs');
|
|
@@ -19,7 +19,7 @@ var BuiltinTransformers = {
|
|
|
19
19
|
OpenAITransformer: _chunkQWNUOR7Fcjs.OpenAITransformer,
|
|
20
20
|
GeminiTransformer: _chunkKIQ2HA2Acjs.GeminiTransformer,
|
|
21
21
|
GeminiCodeAssistTransformer: _chunkVXRTQZF2cjs.GeminiCodeAssistTransformer,
|
|
22
|
-
AnthropicTransformer:
|
|
22
|
+
AnthropicTransformer: _chunkPOUTD5AMcjs.AnthropicTransformer,
|
|
23
23
|
OpenAIResponseTransformer: _chunkNOITAVHAcjs.OpenAIResponseTransformer
|
|
24
24
|
};
|
|
25
25
|
function getBuiltinTransformers() {
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk2RCCLQYVcjs = require('../chunk-2RCCLQYV.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.BuiltinToolExecutor =
|
|
12
|
+
exports.BuiltinToolExecutor = _chunk2RCCLQYVcjs.BuiltinToolExecutor; exports.convertBuiltinToolsToAnthropic = _chunk2RCCLQYVcjs.convertBuiltinToolsToAnthropic; exports.convertBuiltinToolsToOpenAI = _chunk2RCCLQYVcjs.convertBuiltinToolsToOpenAI; exports.getBuiltinSearchTools = _chunk2RCCLQYVcjs.getBuiltinSearchTools;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import '@omnicross/contracts/mcp-types';
|
|
2
2
|
import '../ports/web-search-backend.cjs';
|
|
3
|
-
|
|
3
|
+
import '../runtime-t8AZacFF.cjs';
|
|
4
|
+
export { B as BuiltinToolExecutor, c as convertBuiltinToolsToAnthropic, a as convertBuiltinToolsToOpenAI, g as getBuiltinSearchTools } from '../BuiltinToolExecutor-BHgH-EaZ.cjs';
|
|
4
5
|
import '@omnicross/contracts/websearch-types';
|
|
6
|
+
import '@omnicross/contracts/search-types';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import '@omnicross/contracts/mcp-types';
|
|
2
2
|
import '../ports/web-search-backend.js';
|
|
3
|
-
|
|
3
|
+
import '../runtime-t8AZacFF.js';
|
|
4
|
+
export { B as BuiltinToolExecutor, c as convertBuiltinToolsToAnthropic, a as convertBuiltinToolsToOpenAI, g as getBuiltinSearchTools } from '../BuiltinToolExecutor-Bi1LmiTP.js';
|
|
4
5
|
import '@omnicross/contracts/websearch-types';
|
|
6
|
+
import '@omnicross/contracts/search-types';
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkVSYQ6XYNcjs = require('../chunk-VSYQ6XYN.cjs');
|
|
4
|
+
require('../chunk-E4QHVXV5.cjs');
|
|
4
5
|
require('../chunk-HQP3K7PU.cjs');
|
|
5
6
|
require('../chunk-QVOB2DNX.cjs');
|
|
6
7
|
require('../chunk-7ZHBN75N.cjs');
|
|
8
|
+
require('../chunk-GBHYAGX3.cjs');
|
|
7
9
|
require('../chunk-3OPYJG76.cjs');
|
|
8
|
-
require('../chunk-
|
|
10
|
+
require('../chunk-ZAPN7XA6.cjs');
|
|
11
|
+
require('../chunk-KIQ2HA2A.cjs');
|
|
9
12
|
require('../chunk-NOITAVHA.cjs');
|
|
10
13
|
require('../chunk-QWNUOR7F.cjs');
|
|
11
|
-
require('../chunk-
|
|
12
|
-
require('../chunk-5RSZYQJH.cjs');
|
|
14
|
+
require('../chunk-POUTD5AM.cjs');
|
|
13
15
|
require('../chunk-6DDYNS2B.cjs');
|
|
14
|
-
require('../chunk-
|
|
16
|
+
require('../chunk-5RSZYQJH.cjs');
|
|
15
17
|
require('../chunk-32SRZFFP.cjs');
|
|
16
18
|
require('../chunk-2E42SAW3.cjs');
|
|
17
19
|
require('../chunk-5UK3KLE2.cjs');
|
|
18
|
-
require('../chunk-GBHYAGX3.cjs');
|
|
19
20
|
require('../chunk-MXI2PWIC.cjs');
|
|
20
21
|
require('../chunk-RPII3E6Z.cjs');
|
|
21
22
|
require('../chunk-6RPZADX3.cjs');
|
|
@@ -51,13 +52,13 @@ require('../chunk-VXRTQZF2.cjs');
|
|
|
51
52
|
require('../chunk-WX2E2G7H.cjs');
|
|
52
53
|
require('../chunk-77USGNRW.cjs');
|
|
53
54
|
require('../chunk-IUL4VWNU.cjs');
|
|
54
|
-
require('../chunk-
|
|
55
|
+
require('../chunk-4Z3ZLLC2.cjs');
|
|
55
56
|
require('../chunk-235MXAGX.cjs');
|
|
56
57
|
require('../chunk-HVBBDBS3.cjs');
|
|
57
58
|
require('../chunk-NKVZ6Z3Y.cjs');
|
|
58
|
-
require('../chunk-
|
|
59
|
+
require('../chunk-UPQIWJIE.cjs');
|
|
59
60
|
require('../chunk-G4CZIUIB.cjs');
|
|
60
|
-
require('../chunk-
|
|
61
|
+
require('../chunk-2RCCLQYV.cjs');
|
|
61
62
|
|
|
62
63
|
|
|
63
|
-
exports.CompletionService =
|
|
64
|
+
exports.CompletionService = _chunkVSYQ6XYNcjs.CompletionService;
|
|
@@ -3,10 +3,10 @@ import '@omnicross/contracts/llm-config';
|
|
|
3
3
|
import '../usage-event-sink-BX7FE1NL.cjs';
|
|
4
4
|
import '../logger-4GvQNzhE.cjs';
|
|
5
5
|
import '../ports/provider-config-source.cjs';
|
|
6
|
-
import '../types-
|
|
7
|
-
import '../BuiltinToolExecutor-
|
|
6
|
+
import '../types-BSIJdsyl.cjs';
|
|
7
|
+
import '../BuiltinToolExecutor-BHgH-EaZ.cjs';
|
|
8
8
|
export { C as CompletionOptions, a as CompletionResult, S as StreamCallbacks } from '../types-BScIHmPr.cjs';
|
|
9
|
-
export { C as CompletionService } from '../CompletionService-
|
|
9
|
+
export { C as CompletionService } from '../CompletionService-BniP7j88.cjs';
|
|
10
10
|
import './ApiKeyPoolService.cjs';
|
|
11
11
|
import '../transformer/types.cjs';
|
|
12
12
|
import '../transformer/TransformerService.cjs';
|
|
@@ -20,6 +20,9 @@ import '../pipeline/SubscriptionAuthSource.cjs';
|
|
|
20
20
|
import '../pipeline/SubscriptionAuthStrategy.cjs';
|
|
21
21
|
import '../ports/web-search-backend.cjs';
|
|
22
22
|
import '@omnicross/contracts/websearch-types';
|
|
23
|
+
import '../frontends-Doz0RaWu.cjs';
|
|
24
|
+
import '@omnicross/contracts/search-types';
|
|
25
|
+
import '../runtime-t8AZacFF.cjs';
|
|
23
26
|
import '@omnicross/contracts/image-generation-types';
|
|
24
27
|
import '@omnicross/contracts/mcp-types';
|
|
25
28
|
import '@omnicross/contracts/message-blocks';
|
|
@@ -3,10 +3,10 @@ import '@omnicross/contracts/llm-config';
|
|
|
3
3
|
import '../usage-event-sink-BX7FE1NL.js';
|
|
4
4
|
import '../logger-4GvQNzhE.js';
|
|
5
5
|
import '../ports/provider-config-source.js';
|
|
6
|
-
import '../types-
|
|
7
|
-
import '../BuiltinToolExecutor-
|
|
6
|
+
import '../types-By9Tg6-I.js';
|
|
7
|
+
import '../BuiltinToolExecutor-Bi1LmiTP.js';
|
|
8
8
|
export { C as CompletionOptions, a as CompletionResult, S as StreamCallbacks } from '../types-BScIHmPr.js';
|
|
9
|
-
export { C as CompletionService } from '../CompletionService-
|
|
9
|
+
export { C as CompletionService } from '../CompletionService-BqrKPwfA.js';
|
|
10
10
|
import './ApiKeyPoolService.js';
|
|
11
11
|
import '../transformer/types.js';
|
|
12
12
|
import '../transformer/TransformerService.js';
|
|
@@ -20,6 +20,9 @@ import '../pipeline/SubscriptionAuthSource.js';
|
|
|
20
20
|
import '../pipeline/SubscriptionAuthStrategy.js';
|
|
21
21
|
import '../ports/web-search-backend.js';
|
|
22
22
|
import '@omnicross/contracts/websearch-types';
|
|
23
|
+
import '../frontends-Doz0RaWu.js';
|
|
24
|
+
import '@omnicross/contracts/search-types';
|
|
25
|
+
import '../runtime-t8AZacFF.js';
|
|
23
26
|
import '@omnicross/contracts/image-generation-types';
|
|
24
27
|
import '@omnicross/contracts/mcp-types';
|
|
25
28
|
import '@omnicross/contracts/message-blocks';
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CompletionService
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-LKDAN4D7.js";
|
|
4
|
+
import "../chunk-MZEGQSKQ.js";
|
|
4
5
|
import "../chunk-VVEHS2LI.js";
|
|
5
6
|
import "../chunk-WTQMX2Q6.js";
|
|
6
7
|
import "../chunk-EYGBM2VC.js";
|
|
8
|
+
import "../chunk-MZNPGW5Q.js";
|
|
7
9
|
import "../chunk-DK4A7DLE.js";
|
|
8
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-2C3TTBS7.js";
|
|
11
|
+
import "../chunk-HN74IGEO.js";
|
|
9
12
|
import "../chunk-V53ZEFXC.js";
|
|
10
13
|
import "../chunk-7PIUVCKK.js";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-FU7EAR73.js";
|
|
14
|
+
import "../chunk-EUZRH544.js";
|
|
13
15
|
import "../chunk-LFEH7CEO.js";
|
|
14
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-FU7EAR73.js";
|
|
15
17
|
import "../chunk-QIIAMBTM.js";
|
|
16
18
|
import "../chunk-FXR6N3SR.js";
|
|
17
19
|
import "../chunk-AQDON6MB.js";
|
|
18
|
-
import "../chunk-MZNPGW5Q.js";
|
|
19
20
|
import "../chunk-ECZ3ZE2C.js";
|
|
20
21
|
import "../chunk-XTEI64OU.js";
|
|
21
22
|
import "../chunk-XX6NQJMA.js";
|
|
@@ -51,13 +52,13 @@ import "../chunk-4VVCXVB7.js";
|
|
|
51
52
|
import "../chunk-R4VCO2CB.js";
|
|
52
53
|
import "../chunk-WYVGULTQ.js";
|
|
53
54
|
import "../chunk-ZLNHPUFA.js";
|
|
54
|
-
import "../chunk-
|
|
55
|
+
import "../chunk-VL5TUDTM.js";
|
|
55
56
|
import "../chunk-3WD4HTR2.js";
|
|
56
57
|
import "../chunk-MKF46GNZ.js";
|
|
57
58
|
import "../chunk-GL6XM527.js";
|
|
58
|
-
import "../chunk-
|
|
59
|
+
import "../chunk-LQYS2N47.js";
|
|
59
60
|
import "../chunk-4JOU54M5.js";
|
|
60
|
-
import "../chunk-
|
|
61
|
+
import "../chunk-4PFWFODB.js";
|
|
61
62
|
export {
|
|
62
63
|
CompletionService
|
|
63
64
|
};
|
package/dist/completion.cjs
CHANGED
|
@@ -9,22 +9,23 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkVSYQ6XYNcjs = require('./chunk-VSYQ6XYN.cjs');
|
|
13
|
+
require('./chunk-E4QHVXV5.cjs');
|
|
13
14
|
require('./chunk-HQP3K7PU.cjs');
|
|
14
15
|
require('./chunk-QVOB2DNX.cjs');
|
|
15
16
|
require('./chunk-7ZHBN75N.cjs');
|
|
17
|
+
require('./chunk-GBHYAGX3.cjs');
|
|
16
18
|
require('./chunk-3OPYJG76.cjs');
|
|
17
|
-
require('./chunk-
|
|
19
|
+
require('./chunk-ZAPN7XA6.cjs');
|
|
20
|
+
require('./chunk-KIQ2HA2A.cjs');
|
|
18
21
|
require('./chunk-NOITAVHA.cjs');
|
|
19
22
|
require('./chunk-QWNUOR7F.cjs');
|
|
20
|
-
require('./chunk-
|
|
21
|
-
require('./chunk-5RSZYQJH.cjs');
|
|
23
|
+
require('./chunk-POUTD5AM.cjs');
|
|
22
24
|
require('./chunk-6DDYNS2B.cjs');
|
|
23
|
-
require('./chunk-
|
|
25
|
+
require('./chunk-5RSZYQJH.cjs');
|
|
24
26
|
require('./chunk-32SRZFFP.cjs');
|
|
25
27
|
require('./chunk-2E42SAW3.cjs');
|
|
26
28
|
require('./chunk-5UK3KLE2.cjs');
|
|
27
|
-
require('./chunk-GBHYAGX3.cjs');
|
|
28
29
|
require('./chunk-MXI2PWIC.cjs');
|
|
29
30
|
require('./chunk-RPII3E6Z.cjs');
|
|
30
31
|
require('./chunk-6RPZADX3.cjs');
|
|
@@ -78,16 +79,16 @@ require('./chunk-VXRTQZF2.cjs');
|
|
|
78
79
|
require('./chunk-WX2E2G7H.cjs');
|
|
79
80
|
require('./chunk-77USGNRW.cjs');
|
|
80
81
|
require('./chunk-IUL4VWNU.cjs');
|
|
81
|
-
require('./chunk-
|
|
82
|
+
require('./chunk-4Z3ZLLC2.cjs');
|
|
82
83
|
require('./chunk-235MXAGX.cjs');
|
|
83
84
|
require('./chunk-HVBBDBS3.cjs');
|
|
84
85
|
require('./chunk-NKVZ6Z3Y.cjs');
|
|
85
|
-
require('./chunk-
|
|
86
|
+
require('./chunk-UPQIWJIE.cjs');
|
|
86
87
|
require('./chunk-G4CZIUIB.cjs');
|
|
87
88
|
|
|
88
89
|
|
|
89
90
|
|
|
90
|
-
var
|
|
91
|
+
var _chunk2RCCLQYVcjs = require('./chunk-2RCCLQYV.cjs');
|
|
91
92
|
|
|
92
93
|
|
|
93
94
|
|
|
@@ -115,4 +116,4 @@ var _chunkNZYN7C3Pcjs = require('./chunk-NZYN7C3P.cjs');
|
|
|
115
116
|
|
|
116
117
|
|
|
117
118
|
|
|
118
|
-
exports.BuiltinToolExecutor =
|
|
119
|
+
exports.BuiltinToolExecutor = _chunk2RCCLQYVcjs.BuiltinToolExecutor; exports.CompletionService = _chunkVSYQ6XYNcjs.CompletionService; exports.NATIVE_SEARCH_TOOL_NAMES = _chunkGMMT7RVNcjs.NATIVE_SEARCH_TOOL_NAMES; exports.addOpenRouterProviderToRequest = _chunkVSYQ6XYNcjs.addOpenRouterProviderToRequest; exports.applyAugmentation = _chunkJMJBSACDcjs.applyAugmentation; exports.attachStreamEventBuffer = _chunkVSYQ6XYNcjs.attach; exports.buildAnthropicApiUrl = _chunkA2YMUCBTcjs.buildAnthropicApiUrl; exports.buildAzureOpenAIApiUrl = _chunkA2YMUCBTcjs.buildAzureOpenAIApiUrl; exports.buildGeminiApiUrl = _chunkA2YMUCBTcjs.buildGeminiApiUrl; exports.buildNativeSearchAugmentation = _chunkJMJBSACDcjs.buildNativeSearchAugmentation; exports.buildOpenAIApiUrl = _chunkA2YMUCBTcjs.buildOpenAIApiUrl; exports.buildOpenAIResponseApiUrl = _chunkA2YMUCBTcjs.buildOpenAIResponseApiUrl; exports.buildProviderApiUrl = _chunkA2YMUCBTcjs.buildProviderApiUrl; exports.convertMessageToAnthropic = _chunkVSYQ6XYNcjs.convertMessageToAnthropic; exports.convertMessageToGemini = _chunkVSYQ6XYNcjs.convertMessageToGemini; exports.convertMessageToOpenAI = _chunkVSYQ6XYNcjs.convertMessageToOpenAI; exports.detectNativeSearch = _chunkJMJBSACDcjs.detectNativeSearch; exports.emitStreamEvent = _chunkVSYQ6XYNcjs.emit; exports.getBuiltinSearchTools = _chunk2RCCLQYVcjs.getBuiltinSearchTools; exports.getOpenRouterProviderConfig = _chunkVSYQ6XYNcjs.getOpenRouterProviderConfig; exports.getProviderHeaders = _chunkOIKREZVQcjs.getProviderHeaders; exports.normalizeAzureEndpoint = _chunkA2YMUCBTcjs.normalizeAzureEndpoint; exports.registerStreamEventBuffer = _chunkVSYQ6XYNcjs.register; exports.releaseStreamEventBuffer = _chunkVSYQ6XYNcjs.release; exports.resolveApiFormat = _chunkA2YMUCBTcjs.resolveApiFormat; exports.resolveProviderEndpoint = _chunkA2YMUCBTcjs.resolveProviderEndpoint;
|
package/dist/completion.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { A as ApiFormat, C as CompletionOptions, a as CompletionResult, N as NATIVE_SEARCH_TOOL_NAMES, b as NativeSearchAugmentation, c as NativeSearchDetectionResult, d as NativeSearchProvider, e as NativeSearchUserConfig, S as StreamCallbacks } from './types-BScIHmPr.cjs';
|
|
2
|
-
export { C as CompletionService, V as VisionFallbackProvider } from './CompletionService-
|
|
2
|
+
export { C as CompletionService, V as VisionFallbackProvider } from './CompletionService-BniP7j88.cjs';
|
|
3
3
|
export { buildAnthropicApiUrl, buildAzureOpenAIApiUrl, buildGeminiApiUrl, buildOpenAIApiUrl, buildOpenAIResponseApiUrl, buildProviderApiUrl, normalizeAzureEndpoint, resolveApiFormat, resolveProviderEndpoint } from './completion/url-builder.cjs';
|
|
4
4
|
import { LLMProvider, OpenRouterProviderRouting } from '@omnicross/contracts/llm-config';
|
|
5
5
|
import { SimpleChatMessage, AnthropicMessage, OpenAIMessage } from '@omnicross/contracts/completion-types';
|
|
6
|
-
export { B as BuiltinToolExecutor, g as getBuiltinSearchTools } from './BuiltinToolExecutor-
|
|
6
|
+
export { B as BuiltinToolExecutor, g as getBuiltinSearchTools } from './BuiltinToolExecutor-BHgH-EaZ.cjs';
|
|
7
7
|
export { applyAugmentation, buildNativeSearchAugmentation, detectNativeSearch } from './completion/NativeSearchInjector.cjs';
|
|
8
8
|
import '@omnicross/contracts/message-blocks';
|
|
9
9
|
import './usage-event-sink-BX7FE1NL.cjs';
|
|
@@ -11,7 +11,7 @@ import './logger-4GvQNzhE.cjs';
|
|
|
11
11
|
import './ports/provider-config-source.cjs';
|
|
12
12
|
import './transformer/types.cjs';
|
|
13
13
|
import './transformer/TransformerService.cjs';
|
|
14
|
-
import './types-
|
|
14
|
+
import './types-BSIJdsyl.cjs';
|
|
15
15
|
import 'node:http';
|
|
16
16
|
import '@omnicross/contracts/usage-stats-types';
|
|
17
17
|
import '@omnicross/contracts/subscription-types';
|
|
@@ -23,6 +23,9 @@ import './pipeline/SubscriptionAuthSource.cjs';
|
|
|
23
23
|
import './pipeline/SubscriptionAuthStrategy.cjs';
|
|
24
24
|
import './ports/web-search-backend.cjs';
|
|
25
25
|
import '@omnicross/contracts/websearch-types';
|
|
26
|
+
import './frontends-Doz0RaWu.cjs';
|
|
27
|
+
import '@omnicross/contracts/search-types';
|
|
28
|
+
import './runtime-t8AZacFF.cjs';
|
|
26
29
|
import '@omnicross/contracts/image-generation-types';
|
|
27
30
|
import '@omnicross/contracts/mcp-types';
|
|
28
31
|
import '@omnicross/contracts/endpoint-resolver';
|
package/dist/completion.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { A as ApiFormat, C as CompletionOptions, a as CompletionResult, N as NATIVE_SEARCH_TOOL_NAMES, b as NativeSearchAugmentation, c as NativeSearchDetectionResult, d as NativeSearchProvider, e as NativeSearchUserConfig, S as StreamCallbacks } from './types-BScIHmPr.js';
|
|
2
|
-
export { C as CompletionService, V as VisionFallbackProvider } from './CompletionService-
|
|
2
|
+
export { C as CompletionService, V as VisionFallbackProvider } from './CompletionService-BqrKPwfA.js';
|
|
3
3
|
export { buildAnthropicApiUrl, buildAzureOpenAIApiUrl, buildGeminiApiUrl, buildOpenAIApiUrl, buildOpenAIResponseApiUrl, buildProviderApiUrl, normalizeAzureEndpoint, resolveApiFormat, resolveProviderEndpoint } from './completion/url-builder.js';
|
|
4
4
|
import { LLMProvider, OpenRouterProviderRouting } from '@omnicross/contracts/llm-config';
|
|
5
5
|
import { SimpleChatMessage, AnthropicMessage, OpenAIMessage } from '@omnicross/contracts/completion-types';
|
|
6
|
-
export { B as BuiltinToolExecutor, g as getBuiltinSearchTools } from './BuiltinToolExecutor-
|
|
6
|
+
export { B as BuiltinToolExecutor, g as getBuiltinSearchTools } from './BuiltinToolExecutor-Bi1LmiTP.js';
|
|
7
7
|
export { applyAugmentation, buildNativeSearchAugmentation, detectNativeSearch } from './completion/NativeSearchInjector.js';
|
|
8
8
|
import '@omnicross/contracts/message-blocks';
|
|
9
9
|
import './usage-event-sink-BX7FE1NL.js';
|
|
@@ -11,7 +11,7 @@ import './logger-4GvQNzhE.js';
|
|
|
11
11
|
import './ports/provider-config-source.js';
|
|
12
12
|
import './transformer/types.js';
|
|
13
13
|
import './transformer/TransformerService.js';
|
|
14
|
-
import './types-
|
|
14
|
+
import './types-By9Tg6-I.js';
|
|
15
15
|
import 'node:http';
|
|
16
16
|
import '@omnicross/contracts/usage-stats-types';
|
|
17
17
|
import '@omnicross/contracts/subscription-types';
|
|
@@ -23,6 +23,9 @@ import './pipeline/SubscriptionAuthSource.js';
|
|
|
23
23
|
import './pipeline/SubscriptionAuthStrategy.js';
|
|
24
24
|
import './ports/web-search-backend.js';
|
|
25
25
|
import '@omnicross/contracts/websearch-types';
|
|
26
|
+
import './frontends-Doz0RaWu.js';
|
|
27
|
+
import '@omnicross/contracts/search-types';
|
|
28
|
+
import './runtime-t8AZacFF.js';
|
|
26
29
|
import '@omnicross/contracts/image-generation-types';
|
|
27
30
|
import '@omnicross/contracts/mcp-types';
|
|
28
31
|
import '@omnicross/contracts/endpoint-resolver';
|
package/dist/completion.js
CHANGED
|
@@ -9,22 +9,23 @@ import {
|
|
|
9
9
|
getOpenRouterProviderConfig,
|
|
10
10
|
register,
|
|
11
11
|
release
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LKDAN4D7.js";
|
|
13
|
+
import "./chunk-MZEGQSKQ.js";
|
|
13
14
|
import "./chunk-VVEHS2LI.js";
|
|
14
15
|
import "./chunk-WTQMX2Q6.js";
|
|
15
16
|
import "./chunk-EYGBM2VC.js";
|
|
17
|
+
import "./chunk-MZNPGW5Q.js";
|
|
16
18
|
import "./chunk-DK4A7DLE.js";
|
|
17
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-2C3TTBS7.js";
|
|
20
|
+
import "./chunk-HN74IGEO.js";
|
|
18
21
|
import "./chunk-V53ZEFXC.js";
|
|
19
22
|
import "./chunk-7PIUVCKK.js";
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-FU7EAR73.js";
|
|
23
|
+
import "./chunk-EUZRH544.js";
|
|
22
24
|
import "./chunk-LFEH7CEO.js";
|
|
23
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-FU7EAR73.js";
|
|
24
26
|
import "./chunk-QIIAMBTM.js";
|
|
25
27
|
import "./chunk-FXR6N3SR.js";
|
|
26
28
|
import "./chunk-AQDON6MB.js";
|
|
27
|
-
import "./chunk-MZNPGW5Q.js";
|
|
28
29
|
import "./chunk-ECZ3ZE2C.js";
|
|
29
30
|
import "./chunk-XTEI64OU.js";
|
|
30
31
|
import "./chunk-XX6NQJMA.js";
|
|
@@ -78,16 +79,16 @@ import "./chunk-4VVCXVB7.js";
|
|
|
78
79
|
import "./chunk-R4VCO2CB.js";
|
|
79
80
|
import "./chunk-WYVGULTQ.js";
|
|
80
81
|
import "./chunk-ZLNHPUFA.js";
|
|
81
|
-
import "./chunk-
|
|
82
|
+
import "./chunk-VL5TUDTM.js";
|
|
82
83
|
import "./chunk-3WD4HTR2.js";
|
|
83
84
|
import "./chunk-MKF46GNZ.js";
|
|
84
85
|
import "./chunk-GL6XM527.js";
|
|
85
|
-
import "./chunk-
|
|
86
|
+
import "./chunk-LQYS2N47.js";
|
|
86
87
|
import "./chunk-4JOU54M5.js";
|
|
87
88
|
import {
|
|
88
89
|
BuiltinToolExecutor,
|
|
89
90
|
getBuiltinSearchTools
|
|
90
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-4PFWFODB.js";
|
|
91
92
|
export {
|
|
92
93
|
BuiltinToolExecutor,
|
|
93
94
|
CompletionService,
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { lookup } from 'node:dns';
|
|
2
|
+
import { SearchProviderId, SearchProviderError } from '@omnicross/contracts/search-types';
|
|
3
|
+
import { Dispatcher } from 'undici';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The SSRF egress policy every search network path runs through
|
|
7
|
+
* (plan hard-constraint 7).
|
|
8
|
+
*
|
|
9
|
+
* 阶段4 introduces the first attacker-influenceable network surface in the
|
|
10
|
+
* search tree: a custom `apiHost`. Until now every search request went to one
|
|
11
|
+
* of two fixed engines, so a URL built from configuration could not be aimed at
|
|
12
|
+
* an internal address. It can now, which is why this module exists and why it
|
|
13
|
+
* guards BOTH the API transport and the HTTP slice's redirect walk rather than
|
|
14
|
+
* living inside one adapter.
|
|
15
|
+
*
|
|
16
|
+
* Two layers, because one is not enough:
|
|
17
|
+
*
|
|
18
|
+
* 1. {@link validateEgressUrl} — a URL-level check applied to the initial URL
|
|
19
|
+
* and to EVERY redirect hop. It catches literal addresses and the named
|
|
20
|
+
* loopback/metadata hosts before a request is built.
|
|
21
|
+
* 2. {@link createEgressGuardedDispatcher} — a connection-time check of every
|
|
22
|
+
* address DNS resolves to. Layer 1 alone is a TOCTOU: `evil.example` passes
|
|
23
|
+
* the URL check as a public name and then resolves to `127.0.0.1`. Validating
|
|
24
|
+
* at the moment of use closes that rebinding window.
|
|
25
|
+
*
|
|
26
|
+
* The division of labour between them is worth stating, because it is the
|
|
27
|
+
* easiest thing to misread here: layer 1 can only judge what a URL SAYS, so it
|
|
28
|
+
* denies literal addresses and the two host names that are denied by name
|
|
29
|
+
* (`localhost`, `metadata.google.internal`). An ordinary internal name like
|
|
30
|
+
* `searx.internal.corp` carries no address and passes layer 1 exactly as a
|
|
31
|
+
* public name would — layer 2 is what asks where it actually points. Neither
|
|
32
|
+
* layer is redundant: layer 1 stops `http://169.254.169.254/` without a
|
|
33
|
+
* resolver, and layer 2 stops every name that lies.
|
|
34
|
+
*
|
|
35
|
+
* LIMITATION, stated here because it is a property of the design and not an
|
|
36
|
+
* oversight: layer 2 only applies to DIRECT connections. When a proxy
|
|
37
|
+
* dispatcher is in use the proxy resolves DNS, so the guarded lookup never
|
|
38
|
+
* runs; proxied paths keep layer 1 on every hop and nothing more. The
|
|
39
|
+
* precedence is asserted by a test rather than left to be discovered.
|
|
40
|
+
*
|
|
41
|
+
* Denial messages carry the HOSTNAME only. A search URL embeds the user's
|
|
42
|
+
* query and may carry userinfo credentials, and these errors are printed,
|
|
43
|
+
* logged, and returned to callers.
|
|
44
|
+
*
|
|
45
|
+
* @module search/egress
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The admin-level egress policy.
|
|
50
|
+
*
|
|
51
|
+
* Construction-level, never per-request: a per-request allowlist would let an
|
|
52
|
+
* attacker who can influence a search request also influence where it may go,
|
|
53
|
+
* which is the whole thing this module prevents.
|
|
54
|
+
*/
|
|
55
|
+
interface SearchEgressPolicy {
|
|
56
|
+
/**
|
|
57
|
+
* Hostnames permitted to resolve into an otherwise-denied address class.
|
|
58
|
+
*
|
|
59
|
+
* The escape hatch for an internal SearXNG deployment
|
|
60
|
+
* (`searx.internal.corp`). Matching is EXACT and case-insensitive — no
|
|
61
|
+
* wildcards, no suffix matching — because a suffix rule (`.corp`) is one
|
|
62
|
+
* attacker-registered subdomain away from admitting anything.
|
|
63
|
+
*/
|
|
64
|
+
allowedPrivateHosts?: string[];
|
|
65
|
+
}
|
|
66
|
+
/** Permit every public host; permit nothing private. The production default. */
|
|
67
|
+
declare const DEFAULT_SEARCH_EGRESS_POLICY: Readonly<SearchEgressPolicy>;
|
|
68
|
+
/** Why a host was denied. Stamped into `details.egressClass` for diagnostics. */
|
|
69
|
+
type EgressDenialReason = 'scheme' | 'malformed' | 'loopback' | 'unspecified' | 'link-local' | 'private' | 'unique-local' | 'metadata';
|
|
70
|
+
/**
|
|
71
|
+
* Validate one request target against the policy.
|
|
72
|
+
*
|
|
73
|
+
* @param url - the target. A relative or unparseable value is a denial, not a
|
|
74
|
+
* crash: a redirect `location` is attacker-controlled input.
|
|
75
|
+
* @returns the parsed URL, so callers can reuse it instead of re-parsing.
|
|
76
|
+
* @throws SearchProviderError code `policy_denied`, naming the hostname only.
|
|
77
|
+
*/
|
|
78
|
+
declare function validateEgressUrl(url: string | URL, policy?: SearchEgressPolicy, providerId?: SearchProviderId): URL;
|
|
79
|
+
/**
|
|
80
|
+
* Classify a resolved ADDRESS for a hostname that already passed
|
|
81
|
+
* {@link validateEgressUrl}.
|
|
82
|
+
*
|
|
83
|
+
* Separate from the URL check because this is the rebinding defense: the
|
|
84
|
+
* hostname was public, the address it resolved to may not be. Allowlisting is
|
|
85
|
+
* by hostname, so an allowlisted name's private address is admitted here too —
|
|
86
|
+
* that is exactly what the SearXNG escape hatch means.
|
|
87
|
+
*/
|
|
88
|
+
declare function assertEgressAddressAllowed(address: string, hostname: string, policy?: SearchEgressPolicy, providerId?: SearchProviderId): void;
|
|
89
|
+
/**
|
|
90
|
+
* The `policy_denied` error buried in a thrown value's `cause` chain, if any.
|
|
91
|
+
*
|
|
92
|
+
* undici reports a connect-time failure as a `TypeError: fetch failed` whose
|
|
93
|
+
* `cause` holds the real error, so a denial raised inside the guarded lookup
|
|
94
|
+
* reaches the caller wrapped. Without this the transport would classify a
|
|
95
|
+
* blocked rebinding attempt as `upstream_unavailable`.
|
|
96
|
+
*
|
|
97
|
+
* The depth cap assumes undici's wrapping stays SHALLOW — today it is two
|
|
98
|
+
* levels and this allows six. If a future undici (or an intermediate
|
|
99
|
+
* dispatcher) nests deeper, a blocked rebinding attempt would quietly
|
|
100
|
+
* reclassify as a transport failure: the request is still refused, but the
|
|
101
|
+
* security signal is lost. That is the failure mode to check if denials ever
|
|
102
|
+
* start reading as `upstream_unavailable`.
|
|
103
|
+
*/
|
|
104
|
+
declare function findEgressDenial(error: unknown): SearchProviderError | undefined;
|
|
105
|
+
/** Node's `dns.lookup` shape — the seam a test replaces. */
|
|
106
|
+
type EgressDnsLookup = typeof lookup;
|
|
107
|
+
/**
|
|
108
|
+
* Wrap a resolver so every address it returns is validated before use.
|
|
109
|
+
*
|
|
110
|
+
* Always resolves with `all: true` and re-shapes the answer to whatever the
|
|
111
|
+
* caller asked for. Node's `net.connect` passes `all: true` under
|
|
112
|
+
* `autoSelectFamily` and `all: false` otherwise; validating only the address a
|
|
113
|
+
* single-answer lookup happened to pick would leave the others unchecked on the
|
|
114
|
+
* hosts where it matters most.
|
|
115
|
+
*/
|
|
116
|
+
declare function createEgressGuardedLookup(policy?: SearchEgressPolicy, lookupImpl?: EgressDnsLookup): EgressDnsLookup;
|
|
117
|
+
/**
|
|
118
|
+
* An undici dispatcher that validates every resolved address before connecting.
|
|
119
|
+
*
|
|
120
|
+
* Cached per policy signature: a fresh `Agent` per request would leak
|
|
121
|
+
* connection pools. As in `search/http/proxy.ts`, a superseded dispatcher is
|
|
122
|
+
* never closed — a concurrent request may still be reading through it.
|
|
123
|
+
*/
|
|
124
|
+
declare function createEgressGuardedDispatcher(policy?: SearchEgressPolicy, lookupImpl?: EgressDnsLookup): Dispatcher;
|
|
125
|
+
|
|
126
|
+
export { DEFAULT_SEARCH_EGRESS_POLICY as D, type EgressDenialReason as E, type SearchEgressPolicy as S, type EgressDnsLookup as a, assertEgressAddressAllowed as b, createEgressGuardedDispatcher as c, createEgressGuardedLookup as d, findEgressDenial as f, validateEgressUrl as v };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { lookup } from 'node:dns';
|
|
2
|
+
import { SearchProviderId, SearchProviderError } from '@omnicross/contracts/search-types';
|
|
3
|
+
import { Dispatcher } from 'undici';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The SSRF egress policy every search network path runs through
|
|
7
|
+
* (plan hard-constraint 7).
|
|
8
|
+
*
|
|
9
|
+
* 阶段4 introduces the first attacker-influenceable network surface in the
|
|
10
|
+
* search tree: a custom `apiHost`. Until now every search request went to one
|
|
11
|
+
* of two fixed engines, so a URL built from configuration could not be aimed at
|
|
12
|
+
* an internal address. It can now, which is why this module exists and why it
|
|
13
|
+
* guards BOTH the API transport and the HTTP slice's redirect walk rather than
|
|
14
|
+
* living inside one adapter.
|
|
15
|
+
*
|
|
16
|
+
* Two layers, because one is not enough:
|
|
17
|
+
*
|
|
18
|
+
* 1. {@link validateEgressUrl} — a URL-level check applied to the initial URL
|
|
19
|
+
* and to EVERY redirect hop. It catches literal addresses and the named
|
|
20
|
+
* loopback/metadata hosts before a request is built.
|
|
21
|
+
* 2. {@link createEgressGuardedDispatcher} — a connection-time check of every
|
|
22
|
+
* address DNS resolves to. Layer 1 alone is a TOCTOU: `evil.example` passes
|
|
23
|
+
* the URL check as a public name and then resolves to `127.0.0.1`. Validating
|
|
24
|
+
* at the moment of use closes that rebinding window.
|
|
25
|
+
*
|
|
26
|
+
* The division of labour between them is worth stating, because it is the
|
|
27
|
+
* easiest thing to misread here: layer 1 can only judge what a URL SAYS, so it
|
|
28
|
+
* denies literal addresses and the two host names that are denied by name
|
|
29
|
+
* (`localhost`, `metadata.google.internal`). An ordinary internal name like
|
|
30
|
+
* `searx.internal.corp` carries no address and passes layer 1 exactly as a
|
|
31
|
+
* public name would — layer 2 is what asks where it actually points. Neither
|
|
32
|
+
* layer is redundant: layer 1 stops `http://169.254.169.254/` without a
|
|
33
|
+
* resolver, and layer 2 stops every name that lies.
|
|
34
|
+
*
|
|
35
|
+
* LIMITATION, stated here because it is a property of the design and not an
|
|
36
|
+
* oversight: layer 2 only applies to DIRECT connections. When a proxy
|
|
37
|
+
* dispatcher is in use the proxy resolves DNS, so the guarded lookup never
|
|
38
|
+
* runs; proxied paths keep layer 1 on every hop and nothing more. The
|
|
39
|
+
* precedence is asserted by a test rather than left to be discovered.
|
|
40
|
+
*
|
|
41
|
+
* Denial messages carry the HOSTNAME only. A search URL embeds the user's
|
|
42
|
+
* query and may carry userinfo credentials, and these errors are printed,
|
|
43
|
+
* logged, and returned to callers.
|
|
44
|
+
*
|
|
45
|
+
* @module search/egress
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The admin-level egress policy.
|
|
50
|
+
*
|
|
51
|
+
* Construction-level, never per-request: a per-request allowlist would let an
|
|
52
|
+
* attacker who can influence a search request also influence where it may go,
|
|
53
|
+
* which is the whole thing this module prevents.
|
|
54
|
+
*/
|
|
55
|
+
interface SearchEgressPolicy {
|
|
56
|
+
/**
|
|
57
|
+
* Hostnames permitted to resolve into an otherwise-denied address class.
|
|
58
|
+
*
|
|
59
|
+
* The escape hatch for an internal SearXNG deployment
|
|
60
|
+
* (`searx.internal.corp`). Matching is EXACT and case-insensitive — no
|
|
61
|
+
* wildcards, no suffix matching — because a suffix rule (`.corp`) is one
|
|
62
|
+
* attacker-registered subdomain away from admitting anything.
|
|
63
|
+
*/
|
|
64
|
+
allowedPrivateHosts?: string[];
|
|
65
|
+
}
|
|
66
|
+
/** Permit every public host; permit nothing private. The production default. */
|
|
67
|
+
declare const DEFAULT_SEARCH_EGRESS_POLICY: Readonly<SearchEgressPolicy>;
|
|
68
|
+
/** Why a host was denied. Stamped into `details.egressClass` for diagnostics. */
|
|
69
|
+
type EgressDenialReason = 'scheme' | 'malformed' | 'loopback' | 'unspecified' | 'link-local' | 'private' | 'unique-local' | 'metadata';
|
|
70
|
+
/**
|
|
71
|
+
* Validate one request target against the policy.
|
|
72
|
+
*
|
|
73
|
+
* @param url - the target. A relative or unparseable value is a denial, not a
|
|
74
|
+
* crash: a redirect `location` is attacker-controlled input.
|
|
75
|
+
* @returns the parsed URL, so callers can reuse it instead of re-parsing.
|
|
76
|
+
* @throws SearchProviderError code `policy_denied`, naming the hostname only.
|
|
77
|
+
*/
|
|
78
|
+
declare function validateEgressUrl(url: string | URL, policy?: SearchEgressPolicy, providerId?: SearchProviderId): URL;
|
|
79
|
+
/**
|
|
80
|
+
* Classify a resolved ADDRESS for a hostname that already passed
|
|
81
|
+
* {@link validateEgressUrl}.
|
|
82
|
+
*
|
|
83
|
+
* Separate from the URL check because this is the rebinding defense: the
|
|
84
|
+
* hostname was public, the address it resolved to may not be. Allowlisting is
|
|
85
|
+
* by hostname, so an allowlisted name's private address is admitted here too —
|
|
86
|
+
* that is exactly what the SearXNG escape hatch means.
|
|
87
|
+
*/
|
|
88
|
+
declare function assertEgressAddressAllowed(address: string, hostname: string, policy?: SearchEgressPolicy, providerId?: SearchProviderId): void;
|
|
89
|
+
/**
|
|
90
|
+
* The `policy_denied` error buried in a thrown value's `cause` chain, if any.
|
|
91
|
+
*
|
|
92
|
+
* undici reports a connect-time failure as a `TypeError: fetch failed` whose
|
|
93
|
+
* `cause` holds the real error, so a denial raised inside the guarded lookup
|
|
94
|
+
* reaches the caller wrapped. Without this the transport would classify a
|
|
95
|
+
* blocked rebinding attempt as `upstream_unavailable`.
|
|
96
|
+
*
|
|
97
|
+
* The depth cap assumes undici's wrapping stays SHALLOW — today it is two
|
|
98
|
+
* levels and this allows six. If a future undici (or an intermediate
|
|
99
|
+
* dispatcher) nests deeper, a blocked rebinding attempt would quietly
|
|
100
|
+
* reclassify as a transport failure: the request is still refused, but the
|
|
101
|
+
* security signal is lost. That is the failure mode to check if denials ever
|
|
102
|
+
* start reading as `upstream_unavailable`.
|
|
103
|
+
*/
|
|
104
|
+
declare function findEgressDenial(error: unknown): SearchProviderError | undefined;
|
|
105
|
+
/** Node's `dns.lookup` shape — the seam a test replaces. */
|
|
106
|
+
type EgressDnsLookup = typeof lookup;
|
|
107
|
+
/**
|
|
108
|
+
* Wrap a resolver so every address it returns is validated before use.
|
|
109
|
+
*
|
|
110
|
+
* Always resolves with `all: true` and re-shapes the answer to whatever the
|
|
111
|
+
* caller asked for. Node's `net.connect` passes `all: true` under
|
|
112
|
+
* `autoSelectFamily` and `all: false` otherwise; validating only the address a
|
|
113
|
+
* single-answer lookup happened to pick would leave the others unchecked on the
|
|
114
|
+
* hosts where it matters most.
|
|
115
|
+
*/
|
|
116
|
+
declare function createEgressGuardedLookup(policy?: SearchEgressPolicy, lookupImpl?: EgressDnsLookup): EgressDnsLookup;
|
|
117
|
+
/**
|
|
118
|
+
* An undici dispatcher that validates every resolved address before connecting.
|
|
119
|
+
*
|
|
120
|
+
* Cached per policy signature: a fresh `Agent` per request would leak
|
|
121
|
+
* connection pools. As in `search/http/proxy.ts`, a superseded dispatcher is
|
|
122
|
+
* never closed — a concurrent request may still be reading through it.
|
|
123
|
+
*/
|
|
124
|
+
declare function createEgressGuardedDispatcher(policy?: SearchEgressPolicy, lookupImpl?: EgressDnsLookup): Dispatcher;
|
|
125
|
+
|
|
126
|
+
export { DEFAULT_SEARCH_EGRESS_POLICY as D, type EgressDenialReason as E, type SearchEgressPolicy as S, type EgressDnsLookup as a, assertEgressAddressAllowed as b, createEgressGuardedDispatcher as c, createEgressGuardedLookup as d, findEgressDenial as f, validateEgressUrl as v };
|