@nuvin/agent-core 0.0.0-rc.19 → 0.0.0-rc.20
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/VERSION +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/chunk-FFIZ6TKW.js +1 -1
- package/dist/chunk-HRU363DY.js +1 -1
- package/dist/chunk-NHBKADBW.js +1 -1
- package/dist/chunk-NYZR4XKO.js +1 -1
- package/dist/chunk-QDOE7NWO.js +1 -1
- package/dist/chunk-X7VAACWY.js +1 -1
- package/dist/formats/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/models/index.js +1 -1
- package/dist/models/openai-model.d.ts +8 -1
- package/dist/shared/index.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/safe-fetch.d.ts +36 -0
- package/dist/tools/web-fetch-tool.d.ts +3 -0
- package/dist/tools/web-search-tool.d.ts +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves a hostname to its IP addresses. Mirrors the shape of
|
|
3
|
+
* `node:dns/promises` `lookup(host, { all: true })` but is injectable so the
|
|
4
|
+
* SSRF guard can be tested without real DNS.
|
|
5
|
+
*/
|
|
6
|
+
export type SafeFetchLookup = (hostname: string) => Promise<Array<{
|
|
7
|
+
address: string;
|
|
8
|
+
family: number;
|
|
9
|
+
}>>;
|
|
10
|
+
export interface SafeFetchOptions {
|
|
11
|
+
lookup?: SafeFetchLookup;
|
|
12
|
+
fetchImpl?: typeof fetch;
|
|
13
|
+
maxRedirects?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare const defaultLookup: SafeFetchLookup;
|
|
16
|
+
/**
|
|
17
|
+
* True when an IP literal points at a non-public destination (loopback,
|
|
18
|
+
* private, link-local, CGNAT, multicast, reserved). Fails closed on anything
|
|
19
|
+
* unparseable so a bypass cannot slip through as "not blocked".
|
|
20
|
+
*/
|
|
21
|
+
export declare function isBlockedAddress(ip: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Validate that a URL is safe for the server to fetch: http(s) only, no
|
|
24
|
+
* embedded credentials, and a destination that does not resolve to a private
|
|
25
|
+
* or otherwise non-public address. Literal IPs are range-checked directly;
|
|
26
|
+
* hostnames are resolved and rejected if ANY resolved address is non-public.
|
|
27
|
+
* Throws ToolExecutionError on rejection; returns the parsed URL on success.
|
|
28
|
+
*/
|
|
29
|
+
export declare function assertPublicUrl(value: string, options?: SafeFetchOptions): Promise<URL>;
|
|
30
|
+
/**
|
|
31
|
+
* SSRF-hardened fetch: validates the target (and every redirect hop) against
|
|
32
|
+
* {@link assertPublicUrl} before connecting, following redirects manually so a
|
|
33
|
+
* 30x into a private/metadata address cannot be transparently followed.
|
|
34
|
+
*/
|
|
35
|
+
export declare function safeFetch(value: string, init?: RequestInit, options?: SafeFetchOptions): Promise<Response>;
|
|
36
|
+
//# sourceMappingURL=safe-fetch.d.ts.map
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { type SafeFetchLookup } from "./safe-fetch.ts";
|
|
1
2
|
export interface WebFetchToolOptions {
|
|
2
3
|
timeoutMs?: number;
|
|
3
4
|
name?: string;
|
|
5
|
+
/** DNS resolver used by the SSRF guard. Injectable for tests. */
|
|
6
|
+
lookup?: SafeFetchLookup;
|
|
4
7
|
}
|
|
5
8
|
export declare function createWebFetchTool(options?: WebFetchToolOptions): import("../shared/types.ts").ToolDefinition<{
|
|
6
9
|
url: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SafeFetchLookup } from "./safe-fetch.ts";
|
|
1
2
|
export interface GoogleCseEngineOptions {
|
|
2
3
|
googleCseKey: string;
|
|
3
4
|
googleCseCx: string;
|
|
@@ -14,6 +15,8 @@ export type WebSearchEngine = GoogleCseEngineOptions | OllamaEngineOptions | Tav
|
|
|
14
15
|
export interface WebSearchToolOptions {
|
|
15
16
|
engines: WebSearchEngine[];
|
|
16
17
|
name?: string;
|
|
18
|
+
/** DNS resolver used by the SSRF guard when hydrating result pages. Injectable for tests. */
|
|
19
|
+
lookup?: SafeFetchLookup;
|
|
17
20
|
}
|
|
18
21
|
export declare function createWebSearchTool(options: WebSearchToolOptions): import("../shared/types.ts").ToolDefinition<{
|
|
19
22
|
query: string;
|