pi2dsh 0.13.0 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -26
- package/README.zh.md +30 -21
- package/dist/{analyzer-CXNbeBAe.mjs → analyzer-CJFwQlSG.mjs} +2 -2
- package/dist/{analyzer-CXNbeBAe.mjs.map → analyzer-CJFwQlSG.mjs.map} +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/compat/pi-ai.d.mts +2281 -5
- package/dist/compat/pi-ai.d.mts.map +1 -1
- package/dist/compat/pi-ai.mjs +2 -2
- package/dist/compat/pi-coding-agent.mjs +1 -1
- package/dist/{credentials-oauth-BakY-0PA.mjs → credentials-oauth-Txs6oew8.mjs} +13 -6
- package/dist/credentials-oauth-Txs6oew8.mjs.map +1 -0
- package/dist/credentials-oauth.mjs +1 -1
- package/dist/host.mjs +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +18 -4
- package/dist/index.mjs.map +1 -1
- package/dist/{mcp-config-CZepacin.mjs → mcp-config-_idn-pzI.mjs} +8 -7
- package/dist/mcp-config-_idn-pzI.mjs.map +1 -0
- package/dist/pi-ai-D7PqVeWs.mjs +11717 -0
- package/dist/pi-ai-D7PqVeWs.mjs.map +1 -0
- package/dist/{pi-coding-agent-D9skobb6.mjs → pi-coding-agent-BVZu0dHG.mjs} +0 -0
- package/dist/{pi-coding-agent-D9skobb6.mjs.map → pi-coding-agent-BVZu0dHG.mjs.map} +1 -1
- package/dist/{runtime-B-SlR8mJ.mjs → runtime-DEjs_Qlf.mjs} +143 -18
- package/dist/runtime-DEjs_Qlf.mjs.map +1 -0
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +1 -1
- package/package.json +30 -32
- package/dist/credentials-oauth-BakY-0PA.mjs.map +0 -1
- package/dist/mcp-config-CZepacin.mjs.map +0 -1
- package/dist/pi-ai-BA3V_J0V.mjs +0 -3104
- package/dist/pi-ai-BA3V_J0V.mjs.map +0 -1
- package/dist/runtime-B-SlR8mJ.mjs.map +0 -1
package/dist/compat/pi-ai.d.mts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
import {
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { a as TextContent, c as ToolResultMessage, i as Message$1, l as Usage$1, n as AssistantMessage, o as ThinkingContent, r as ImageContent, s as ToolCallContent, t as AgentMessage, u as UserMessage } from "../pi-types-KazmR2O5.mjs";
|
|
4
|
+
import { URL as URL$1, URLSearchParams as URLSearchParams$1 } from "node:url";
|
|
5
|
+
import { EventEmitter } from "node:events";
|
|
6
|
+
import { Static as Static$1, TSchema, TSchema as TSchema$1, Type } from "typebox";
|
|
7
|
+
import { Duplex, Readable, Writable } from "node:stream";
|
|
8
|
+
import { Blob as Blob$1, File as File$1 } from "node:buffer";
|
|
9
|
+
import { ConnectionOptions, TLSSocket } from "node:tls";
|
|
10
|
+
import { IpcNetConnectOpts, Socket, TcpNetConnectOpts } from "node:net";
|
|
11
|
+
import { SessionOptions } from "node:http2";
|
|
4
12
|
//#region src/compat/vendor/pi-ai-overflow.d.ts
|
|
5
13
|
/**
|
|
6
14
|
* Check if an assistant message represents a context overflow error.
|
|
@@ -106,7 +114,7 @@ declare function createProvider(input: any): {
|
|
|
106
114
|
};
|
|
107
115
|
//#endregion
|
|
108
116
|
//#region src/compat/vendor/pi-ai-event-stream.d.ts
|
|
109
|
-
declare class EventStream {
|
|
117
|
+
declare class EventStream$1 {
|
|
110
118
|
queue: never[];
|
|
111
119
|
waiting: never[];
|
|
112
120
|
done: boolean;
|
|
@@ -120,7 +128,7 @@ declare class EventStream {
|
|
|
120
128
|
[Symbol.asyncIterator](): AsyncGenerator<any, void, unknown>;
|
|
121
129
|
result(): Promise<unknown>;
|
|
122
130
|
}
|
|
123
|
-
declare class AssistantMessageEventStream extends EventStream {
|
|
131
|
+
declare class AssistantMessageEventStream extends EventStream$1 {
|
|
124
132
|
constructor();
|
|
125
133
|
}
|
|
126
134
|
//#endregion
|
|
@@ -136,6 +144,2274 @@ declare function lazyApi(load: any, capabilities: any): {
|
|
|
136
144
|
streamSimple: (model: any, context: any, options: any) => AssistantMessageEventStream;
|
|
137
145
|
};
|
|
138
146
|
//#endregion
|
|
147
|
+
//#region node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/utility.d.ts
|
|
148
|
+
type AutocompletePrimitiveBaseType$1<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : never;
|
|
149
|
+
type Autocomplete$1<T> = T | (AutocompletePrimitiveBaseType$1<T> & Record<never, never>);
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/header.d.ts
|
|
152
|
+
/**
|
|
153
|
+
* The header type declaration of `undici`.
|
|
154
|
+
*/
|
|
155
|
+
type IncomingHttpHeaders$1 = Record<string, string | string[] | undefined>;
|
|
156
|
+
type HeaderNames$1 = Autocomplete$1<'Accept' | 'Accept-CH' | 'Accept-Charset' | 'Accept-Encoding' | 'Accept-Language' | 'Accept-Patch' | 'Accept-Post' | 'Accept-Ranges' | 'Access-Control-Allow-Credentials' | 'Access-Control-Allow-Headers' | 'Access-Control-Allow-Methods' | 'Access-Control-Allow-Origin' | 'Access-Control-Expose-Headers' | 'Access-Control-Max-Age' | 'Access-Control-Request-Headers' | 'Access-Control-Request-Method' | 'Age' | 'Allow' | 'Alt-Svc' | 'Alt-Used' | 'Authorization' | 'Cache-Control' | 'Clear-Site-Data' | 'Connection' | 'Content-Disposition' | 'Content-Encoding' | 'Content-Language' | 'Content-Length' | 'Content-Location' | 'Content-Range' | 'Content-Security-Policy' | 'Content-Security-Policy-Report-Only' | 'Content-Type' | 'Cookie' | 'Cross-Origin-Embedder-Policy' | 'Cross-Origin-Opener-Policy' | 'Cross-Origin-Resource-Policy' | 'Date' | 'Device-Memory' | 'ETag' | 'Expect' | 'Expect-CT' | 'Expires' | 'Forwarded' | 'From' | 'Host' | 'If-Match' | 'If-Modified-Since' | 'If-None-Match' | 'If-Range' | 'If-Unmodified-Since' | 'Keep-Alive' | 'Last-Modified' | 'Link' | 'Location' | 'Max-Forwards' | 'Origin' | 'Permissions-Policy' | 'Priority' | 'Proxy-Authenticate' | 'Proxy-Authorization' | 'Range' | 'Referer' | 'Referrer-Policy' | 'Retry-After' | 'Sec-Fetch-Dest' | 'Sec-Fetch-Mode' | 'Sec-Fetch-Site' | 'Sec-Fetch-User' | 'Sec-Purpose' | 'Sec-WebSocket-Accept' | 'Server' | 'Server-Timing' | 'Service-Worker-Navigation-Preload' | 'Set-Cookie' | 'SourceMap' | 'Strict-Transport-Security' | 'TE' | 'Timing-Allow-Origin' | 'Trailer' | 'Transfer-Encoding' | 'Upgrade' | 'Upgrade-Insecure-Requests' | 'User-Agent' | 'Vary' | 'Via' | 'WWW-Authenticate' | 'X-Content-Type-Options' | 'X-Frame-Options'>;
|
|
157
|
+
type IANARegisteredMimeType$1 = Autocomplete$1<'audio/aac' | 'video/x-msvideo' | 'image/avif' | 'video/av1' | 'application/octet-stream' | 'image/bmp' | 'text/css' | 'text/csv' | 'application/vnd.ms-fontobject' | 'application/epub+zip' | 'image/gif' | 'application/gzip' | 'text/html' | 'image/x-icon' | 'text/calendar' | 'image/jpeg' | 'text/javascript' | 'application/json' | 'application/ld+json' | 'audio/x-midi' | 'audio/mpeg' | 'video/mp4' | 'video/mpeg' | 'audio/ogg' | 'video/ogg' | 'application/ogg' | 'audio/opus' | 'font/otf' | 'application/pdf' | 'image/png' | 'application/rtf' | 'image/svg+xml' | 'image/tiff' | 'video/mp2t' | 'font/ttf' | 'text/plain' | 'application/wasm' | 'video/webm' | 'audio/webm' | 'image/webp' | 'font/woff' | 'font/woff2' | 'application/xhtml+xml' | 'application/xml' | 'application/zip' | 'video/3gpp' | 'video/3gpp2' | 'model/gltf+json' | 'model/gltf-binary'>;
|
|
158
|
+
type KnownHeaderValues$1 = {
|
|
159
|
+
'content-type': IANARegisteredMimeType$1;
|
|
160
|
+
};
|
|
161
|
+
type HeaderRecord$1 = { [K in HeaderNames$1 | Lowercase<HeaderNames$1>]?: Lowercase<K> extends keyof KnownHeaderValues$1 ? KnownHeaderValues$1[Lowercase<K>] : string; };
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/readable.d.ts
|
|
164
|
+
declare class BodyReadable$1 extends Readable {
|
|
165
|
+
constructor(opts: {
|
|
166
|
+
resume: (this: Readable, size: number) => void | null;
|
|
167
|
+
abort: () => void | null;
|
|
168
|
+
contentType?: string;
|
|
169
|
+
contentLength?: number;
|
|
170
|
+
highWaterMark?: number;
|
|
171
|
+
});
|
|
172
|
+
/** Consumes and returns the body as a string
|
|
173
|
+
* https://fetch.spec.whatwg.org/#dom-body-text
|
|
174
|
+
*/
|
|
175
|
+
text(): Promise<string>;
|
|
176
|
+
/** Consumes and returns the body as a JavaScript Object
|
|
177
|
+
* https://fetch.spec.whatwg.org/#dom-body-json
|
|
178
|
+
*/
|
|
179
|
+
json(): Promise<unknown>;
|
|
180
|
+
/** Consumes and returns the body as a Blob
|
|
181
|
+
* https://fetch.spec.whatwg.org/#dom-body-blob
|
|
182
|
+
*/
|
|
183
|
+
blob(): Promise<Blob$1>;
|
|
184
|
+
/** Consumes and returns the body as an Uint8Array
|
|
185
|
+
* https://fetch.spec.whatwg.org/#dom-body-bytes
|
|
186
|
+
*/
|
|
187
|
+
bytes(): Promise<Uint8Array>;
|
|
188
|
+
/** Consumes and returns the body as an ArrayBuffer
|
|
189
|
+
* https://fetch.spec.whatwg.org/#dom-body-arraybuffer
|
|
190
|
+
*/
|
|
191
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
192
|
+
/** Not implemented
|
|
193
|
+
*
|
|
194
|
+
* https://fetch.spec.whatwg.org/#dom-body-formdata
|
|
195
|
+
*/
|
|
196
|
+
formData(): Promise<never>;
|
|
197
|
+
/** Returns true if the body is not null and the body has been consumed
|
|
198
|
+
*
|
|
199
|
+
* Otherwise, returns false
|
|
200
|
+
*
|
|
201
|
+
* https://fetch.spec.whatwg.org/#dom-body-bodyused
|
|
202
|
+
*/
|
|
203
|
+
readonly bodyUsed: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* If body is null, it should return null as the body
|
|
206
|
+
*
|
|
207
|
+
* If body is not null, should return the body as a ReadableStream
|
|
208
|
+
*
|
|
209
|
+
* https://fetch.spec.whatwg.org/#dom-body-body
|
|
210
|
+
*/
|
|
211
|
+
readonly body: never | undefined;
|
|
212
|
+
/** Dumps the response body by reading `limit` number of bytes.
|
|
213
|
+
* @param opts.limit Number of bytes to read (optional) - Default: 131072
|
|
214
|
+
* @param opts.signal AbortSignal to cancel the operation (optional)
|
|
215
|
+
*/
|
|
216
|
+
dump(opts?: {
|
|
217
|
+
limit: number;
|
|
218
|
+
signal?: AbortSignal;
|
|
219
|
+
}): Promise<void>;
|
|
220
|
+
}
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/fetch.d.ts
|
|
223
|
+
type BodyInit$1 = ArrayBuffer | AsyncIterable<Uint8Array> | Blob$1 | FormData$2 | Iterable<Uint8Array> | NodeJS.ArrayBufferView | URLSearchParams$1 | null | string;
|
|
224
|
+
interface SpecIterator$1<T, TReturn = any, TNext = undefined> {
|
|
225
|
+
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
|
|
226
|
+
}
|
|
227
|
+
interface SpecIterableIterator$1<T> extends SpecIterator$1<T> {
|
|
228
|
+
[Symbol.iterator](): SpecIterableIterator$1<T>;
|
|
229
|
+
}
|
|
230
|
+
interface SpecIterable$1<T> {
|
|
231
|
+
[Symbol.iterator](): SpecIterator$1<T>;
|
|
232
|
+
}
|
|
233
|
+
type HeadersInit$1 = [string, string][] | HeaderRecord$1 | Headers$2;
|
|
234
|
+
declare class Headers$2 implements SpecIterable$1<[string, string]> {
|
|
235
|
+
constructor(init?: HeadersInit$1);
|
|
236
|
+
readonly append: (name: string, value: string) => void;
|
|
237
|
+
readonly delete: (name: string) => void;
|
|
238
|
+
readonly get: (name: string) => string | null;
|
|
239
|
+
readonly has: (name: string) => boolean;
|
|
240
|
+
readonly set: (name: string, value: string) => void;
|
|
241
|
+
readonly getSetCookie: () => string[];
|
|
242
|
+
readonly forEach: (callbackfn: (value: string, key: string, iterable: Headers$2) => void, thisArg?: unknown) => void;
|
|
243
|
+
readonly keys: () => SpecIterableIterator$1<string>;
|
|
244
|
+
readonly values: () => SpecIterableIterator$1<string>;
|
|
245
|
+
readonly entries: () => SpecIterableIterator$1<[string, string]>;
|
|
246
|
+
readonly [Symbol.iterator]: () => SpecIterableIterator$1<[string, string]>;
|
|
247
|
+
}
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/formdata.d.ts
|
|
250
|
+
/**
|
|
251
|
+
* A `string` or `File` that represents a single value from a set of `FormData` key-value pairs.
|
|
252
|
+
*/
|
|
253
|
+
declare type FormDataEntryValue$1 = string | File$1;
|
|
254
|
+
/**
|
|
255
|
+
* Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using fetch().
|
|
256
|
+
*/
|
|
257
|
+
declare class FormData$2 {
|
|
258
|
+
/**
|
|
259
|
+
* Appends a new value onto an existing key inside a FormData object,
|
|
260
|
+
* or adds the key if it does not already exist.
|
|
261
|
+
*
|
|
262
|
+
* The difference between `set()` and `append()` is that if the specified key already exists, `set()` will overwrite all existing values with the new one, whereas `append()` will append the new value onto the end of the existing set of values.
|
|
263
|
+
*
|
|
264
|
+
* @param name The name of the field whose data is contained in `value`.
|
|
265
|
+
* @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
|
|
266
|
+
or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string.
|
|
267
|
+
* @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.
|
|
268
|
+
*/
|
|
269
|
+
append(name: string, value: unknown, fileName?: string): void;
|
|
270
|
+
/**
|
|
271
|
+
* Set a new value for an existing key inside FormData,
|
|
272
|
+
* or add the new field if it does not already exist.
|
|
273
|
+
*
|
|
274
|
+
* @param name The name of the field whose data is contained in `value`.
|
|
275
|
+
* @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
|
|
276
|
+
or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string.
|
|
277
|
+
* @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.
|
|
278
|
+
*
|
|
279
|
+
*/
|
|
280
|
+
set(name: string, value: unknown, fileName?: string): void;
|
|
281
|
+
/**
|
|
282
|
+
* Returns the first value associated with a given key from within a `FormData` object.
|
|
283
|
+
* If you expect multiple values and want all of them, use the `getAll()` method instead.
|
|
284
|
+
*
|
|
285
|
+
* @param {string} name A name of the value you want to retrieve.
|
|
286
|
+
*
|
|
287
|
+
* @returns A `FormDataEntryValue` containing the value. If the key doesn't exist, the method returns null.
|
|
288
|
+
*/
|
|
289
|
+
get(name: string): FormDataEntryValue$1 | null;
|
|
290
|
+
/**
|
|
291
|
+
* Returns all the values associated with a given key from within a `FormData` object.
|
|
292
|
+
*
|
|
293
|
+
* @param {string} name A name of the value you want to retrieve.
|
|
294
|
+
*
|
|
295
|
+
* @returns An array of `FormDataEntryValue` whose key matches the value passed in the `name` parameter. If the key doesn't exist, the method returns an empty list.
|
|
296
|
+
*/
|
|
297
|
+
getAll(name: string): FormDataEntryValue$1[];
|
|
298
|
+
/**
|
|
299
|
+
* Returns a boolean stating whether a `FormData` object contains a certain key.
|
|
300
|
+
*
|
|
301
|
+
* @param name A string representing the name of the key you want to test for.
|
|
302
|
+
*
|
|
303
|
+
* @return A boolean value.
|
|
304
|
+
*/
|
|
305
|
+
has(name: string): boolean;
|
|
306
|
+
/**
|
|
307
|
+
* Deletes a key and its value(s) from a `FormData` object.
|
|
308
|
+
*
|
|
309
|
+
* @param name The name of the key you want to delete.
|
|
310
|
+
*/
|
|
311
|
+
delete(name: string): void;
|
|
312
|
+
/**
|
|
313
|
+
* Executes given callback function for each field of the FormData instance
|
|
314
|
+
*/
|
|
315
|
+
forEach: (callbackfn: (value: FormDataEntryValue$1, key: string, iterable: FormData$2) => void, thisArg?: unknown) => void;
|
|
316
|
+
/**
|
|
317
|
+
* Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all keys contained in this `FormData` object.
|
|
318
|
+
* Each key is a `string`.
|
|
319
|
+
*/
|
|
320
|
+
keys: () => SpecIterableIterator$1<string>;
|
|
321
|
+
/**
|
|
322
|
+
* Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all values contained in this object `FormData` object.
|
|
323
|
+
* Each value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
|
|
324
|
+
*/
|
|
325
|
+
values: () => SpecIterableIterator$1<FormDataEntryValue$1>;
|
|
326
|
+
/**
|
|
327
|
+
* Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through the `FormData` key/value pairs.
|
|
328
|
+
* The key of each pair is a string; the value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
|
|
329
|
+
*/
|
|
330
|
+
entries: () => SpecIterableIterator$1<[string, FormDataEntryValue$1]>;
|
|
331
|
+
/**
|
|
332
|
+
* An alias for FormData#entries()
|
|
333
|
+
*/
|
|
334
|
+
[Symbol.iterator]: () => SpecIterableIterator$1<[string, FormDataEntryValue$1]>;
|
|
335
|
+
readonly [Symbol.toStringTag]: string;
|
|
336
|
+
}
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/connector.d.ts
|
|
339
|
+
declare function buildConnector$1(options?: buildConnector$1.BuildOptions): buildConnector$1.connector;
|
|
340
|
+
declare namespace buildConnector$1 {
|
|
341
|
+
export type BuildOptions = (ConnectionOptions | TcpNetConnectOpts | IpcNetConnectOpts) & {
|
|
342
|
+
allowH2?: boolean;
|
|
343
|
+
maxCachedSessions?: number | null;
|
|
344
|
+
socketPath?: string | null;
|
|
345
|
+
timeout?: number | null;
|
|
346
|
+
port?: number;
|
|
347
|
+
keepAlive?: boolean | null;
|
|
348
|
+
keepAliveInitialDelay?: number | null;
|
|
349
|
+
};
|
|
350
|
+
export interface Options {
|
|
351
|
+
hostname: string;
|
|
352
|
+
host?: string;
|
|
353
|
+
protocol: string;
|
|
354
|
+
port: string;
|
|
355
|
+
servername?: string;
|
|
356
|
+
localAddress?: string | null;
|
|
357
|
+
httpSocket?: Socket;
|
|
358
|
+
}
|
|
359
|
+
export type Callback = (...args: CallbackArgs) => void;
|
|
360
|
+
type CallbackArgs = [null, Socket | TLSSocket] | [Error, null];
|
|
361
|
+
export interface connector {
|
|
362
|
+
(options: buildConnector$1.Options, callback: buildConnector$1.Callback): void;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
//#endregion
|
|
366
|
+
//#region node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/client-stats.d.ts
|
|
367
|
+
declare class ClientStats$1 {
|
|
368
|
+
constructor(pool: Client$1);
|
|
369
|
+
/** If socket has open connection. */
|
|
370
|
+
connected: boolean;
|
|
371
|
+
/** Number of open socket connections in this client that do not have an active request. */
|
|
372
|
+
pending: number;
|
|
373
|
+
/** Number of currently active requests of this client. */
|
|
374
|
+
running: number;
|
|
375
|
+
/** Number of active, pending, or queued requests of this client. */
|
|
376
|
+
size: number;
|
|
377
|
+
}
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/client.d.ts
|
|
380
|
+
type ClientConnectOptions$1 = Omit<Dispatcher$1.ConnectOptions, 'origin'>;
|
|
381
|
+
/**
|
|
382
|
+
* A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default.
|
|
383
|
+
*/
|
|
384
|
+
declare class Client$1 extends Dispatcher$1 {
|
|
385
|
+
constructor(url: string | URL$1, options?: Client$1.Options);
|
|
386
|
+
/** Property to get and set the pipelining factor. */
|
|
387
|
+
pipelining: number;
|
|
388
|
+
/** `true` after `client.close()` has been called. */
|
|
389
|
+
closed: boolean;
|
|
390
|
+
/** `true` after `client.destroyed()` has been called or `client.close()` has been called and the client shutdown has completed. */
|
|
391
|
+
destroyed: boolean;
|
|
392
|
+
/** Aggregate stats for a Client. */
|
|
393
|
+
readonly stats: ClientStats$1;
|
|
394
|
+
// Override dispatcher APIs.
|
|
395
|
+
override connect(options: ClientConnectOptions$1): Promise<Dispatcher$1.ConnectData>;
|
|
396
|
+
override connect(options: ClientConnectOptions$1, callback: (err: Error | null, data: Dispatcher$1.ConnectData) => void): void;
|
|
397
|
+
}
|
|
398
|
+
declare namespace Client$1 {
|
|
399
|
+
export interface OptionsInterceptors {
|
|
400
|
+
Client: readonly Dispatcher$1.DispatchInterceptor[];
|
|
401
|
+
}
|
|
402
|
+
export interface Options {
|
|
403
|
+
/** TODO */
|
|
404
|
+
interceptors?: OptionsInterceptors;
|
|
405
|
+
/** The maximum length of request headers in bytes. Default: Node.js' `--max-http-header-size` or `16384` (16KiB). */
|
|
406
|
+
maxHeaderSize?: number;
|
|
407
|
+
/** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */
|
|
408
|
+
headersTimeout?: number;
|
|
409
|
+
/** @deprecated unsupported socketTimeout, use headersTimeout & bodyTimeout instead */
|
|
410
|
+
socketTimeout?: never;
|
|
411
|
+
/** @deprecated unsupported requestTimeout, use headersTimeout & bodyTimeout instead */
|
|
412
|
+
requestTimeout?: never;
|
|
413
|
+
/** TODO */
|
|
414
|
+
connectTimeout?: number;
|
|
415
|
+
/** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Default: `300e3` milliseconds (300s). */
|
|
416
|
+
bodyTimeout?: number;
|
|
417
|
+
/** @deprecated unsupported idleTimeout, use keepAliveTimeout instead */
|
|
418
|
+
idleTimeout?: never;
|
|
419
|
+
/** @deprecated unsupported keepAlive, use pipelining=0 instead */
|
|
420
|
+
keepAlive?: never;
|
|
421
|
+
/** the timeout, in milliseconds, after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */
|
|
422
|
+
keepAliveTimeout?: number;
|
|
423
|
+
/** @deprecated unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead */
|
|
424
|
+
maxKeepAliveTimeout?: never;
|
|
425
|
+
/** the maximum allowed `idleTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */
|
|
426
|
+
keepAliveMaxTimeout?: number;
|
|
427
|
+
/** A number of milliseconds subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */
|
|
428
|
+
keepAliveTimeoutThreshold?: number;
|
|
429
|
+
/** TODO */
|
|
430
|
+
socketPath?: string;
|
|
431
|
+
/** The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Default: `1`. */
|
|
432
|
+
pipelining?: number;
|
|
433
|
+
/** @deprecated use the connect option instead */
|
|
434
|
+
tls?: never;
|
|
435
|
+
/** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */
|
|
436
|
+
strictContentLength?: boolean;
|
|
437
|
+
/** TODO */
|
|
438
|
+
maxCachedSessions?: number;
|
|
439
|
+
/** TODO */
|
|
440
|
+
connect?: Partial<buildConnector$1.BuildOptions> | buildConnector$1.connector;
|
|
441
|
+
/** TODO */
|
|
442
|
+
maxRequestsPerClient?: number;
|
|
443
|
+
/** TODO */
|
|
444
|
+
localAddress?: string;
|
|
445
|
+
/** Max response body size in bytes, -1 is disabled */
|
|
446
|
+
maxResponseSize?: number;
|
|
447
|
+
/** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */
|
|
448
|
+
autoSelectFamily?: boolean;
|
|
449
|
+
/** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */
|
|
450
|
+
autoSelectFamilyAttemptTimeout?: number;
|
|
451
|
+
/**
|
|
452
|
+
* @description Enables support for H2 if the server has assigned bigger priority to it through ALPN negotiation.
|
|
453
|
+
* @default false
|
|
454
|
+
*/
|
|
455
|
+
allowH2?: boolean;
|
|
456
|
+
/**
|
|
457
|
+
* @description Dictates the maximum number of concurrent streams for a single H2 session. It can be overridden by a SETTINGS remote frame.
|
|
458
|
+
* @default 100
|
|
459
|
+
*/
|
|
460
|
+
maxConcurrentStreams?: number;
|
|
461
|
+
}
|
|
462
|
+
export interface SocketInfo {
|
|
463
|
+
localAddress?: string;
|
|
464
|
+
localPort?: number;
|
|
465
|
+
remoteAddress?: string;
|
|
466
|
+
remotePort?: number;
|
|
467
|
+
remoteFamily?: string;
|
|
468
|
+
timeout?: number;
|
|
469
|
+
bytesWritten?: number;
|
|
470
|
+
bytesRead?: number;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
//#endregion
|
|
474
|
+
//#region node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/errors.d.ts
|
|
475
|
+
declare namespace Errors$1 {
|
|
476
|
+
export class UndiciError extends Error {
|
|
477
|
+
name: string;
|
|
478
|
+
code: string;
|
|
479
|
+
}
|
|
480
|
+
/** Connect timeout error. */
|
|
481
|
+
export class ConnectTimeoutError extends UndiciError {
|
|
482
|
+
name: 'ConnectTimeoutError';
|
|
483
|
+
code: 'UND_ERR_CONNECT_TIMEOUT';
|
|
484
|
+
}
|
|
485
|
+
/** A header exceeds the `headersTimeout` option. */
|
|
486
|
+
export class HeadersTimeoutError extends UndiciError {
|
|
487
|
+
name: 'HeadersTimeoutError';
|
|
488
|
+
code: 'UND_ERR_HEADERS_TIMEOUT';
|
|
489
|
+
}
|
|
490
|
+
/** Headers overflow error. */
|
|
491
|
+
export class HeadersOverflowError extends UndiciError {
|
|
492
|
+
name: 'HeadersOverflowError';
|
|
493
|
+
code: 'UND_ERR_HEADERS_OVERFLOW';
|
|
494
|
+
}
|
|
495
|
+
/** A body exceeds the `bodyTimeout` option. */
|
|
496
|
+
export class BodyTimeoutError extends UndiciError {
|
|
497
|
+
name: 'BodyTimeoutError';
|
|
498
|
+
code: 'UND_ERR_BODY_TIMEOUT';
|
|
499
|
+
}
|
|
500
|
+
export class ResponseError extends UndiciError {
|
|
501
|
+
constructor(message: string, code: number, options: {
|
|
502
|
+
headers?: IncomingHttpHeaders$1 | string[] | null;
|
|
503
|
+
body?: null | Record<string, any> | string;
|
|
504
|
+
});
|
|
505
|
+
name: 'ResponseError';
|
|
506
|
+
code: 'UND_ERR_RESPONSE';
|
|
507
|
+
statusCode: number;
|
|
508
|
+
body: null | Record<string, any> | string;
|
|
509
|
+
headers: IncomingHttpHeaders$1 | string[] | null;
|
|
510
|
+
}
|
|
511
|
+
/** Passed an invalid argument. */
|
|
512
|
+
export class InvalidArgumentError extends UndiciError {
|
|
513
|
+
name: 'InvalidArgumentError';
|
|
514
|
+
code: 'UND_ERR_INVALID_ARG';
|
|
515
|
+
}
|
|
516
|
+
/** Returned an invalid value. */
|
|
517
|
+
export class InvalidReturnValueError extends UndiciError {
|
|
518
|
+
name: 'InvalidReturnValueError';
|
|
519
|
+
code: 'UND_ERR_INVALID_RETURN_VALUE';
|
|
520
|
+
}
|
|
521
|
+
/** The request has been aborted by the user. */
|
|
522
|
+
export class RequestAbortedError extends UndiciError {
|
|
523
|
+
name: 'AbortError';
|
|
524
|
+
code: 'UND_ERR_ABORTED';
|
|
525
|
+
}
|
|
526
|
+
/** Expected error with reason. */
|
|
527
|
+
export class InformationalError extends UndiciError {
|
|
528
|
+
name: 'InformationalError';
|
|
529
|
+
code: 'UND_ERR_INFO';
|
|
530
|
+
}
|
|
531
|
+
/** Request body length does not match content-length header. */
|
|
532
|
+
export class RequestContentLengthMismatchError extends UndiciError {
|
|
533
|
+
name: 'RequestContentLengthMismatchError';
|
|
534
|
+
code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH';
|
|
535
|
+
}
|
|
536
|
+
/** Response body length does not match content-length header. */
|
|
537
|
+
export class ResponseContentLengthMismatchError extends UndiciError {
|
|
538
|
+
name: 'ResponseContentLengthMismatchError';
|
|
539
|
+
code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH';
|
|
540
|
+
}
|
|
541
|
+
/** Trying to use a destroyed client. */
|
|
542
|
+
export class ClientDestroyedError extends UndiciError {
|
|
543
|
+
name: 'ClientDestroyedError';
|
|
544
|
+
code: 'UND_ERR_DESTROYED';
|
|
545
|
+
}
|
|
546
|
+
/** Trying to use a closed client. */
|
|
547
|
+
export class ClientClosedError extends UndiciError {
|
|
548
|
+
name: 'ClientClosedError';
|
|
549
|
+
code: 'UND_ERR_CLOSED';
|
|
550
|
+
}
|
|
551
|
+
/** There is an error with the socket. */
|
|
552
|
+
export class SocketError extends UndiciError {
|
|
553
|
+
name: 'SocketError';
|
|
554
|
+
code: 'UND_ERR_SOCKET';
|
|
555
|
+
socket: Client$1.SocketInfo | null;
|
|
556
|
+
}
|
|
557
|
+
/** Encountered unsupported functionality. */
|
|
558
|
+
export class NotSupportedError extends UndiciError {
|
|
559
|
+
name: 'NotSupportedError';
|
|
560
|
+
code: 'UND_ERR_NOT_SUPPORTED';
|
|
561
|
+
}
|
|
562
|
+
/** No upstream has been added to the BalancedPool. */
|
|
563
|
+
export class BalancedPoolMissingUpstreamError extends UndiciError {
|
|
564
|
+
name: 'MissingUpstreamError';
|
|
565
|
+
code: 'UND_ERR_BPL_MISSING_UPSTREAM';
|
|
566
|
+
}
|
|
567
|
+
export class HTTPParserError extends UndiciError {
|
|
568
|
+
name: 'HTTPParserError';
|
|
569
|
+
code: string;
|
|
570
|
+
}
|
|
571
|
+
/** The response exceed the length allowed. */
|
|
572
|
+
export class ResponseExceededMaxSizeError extends UndiciError {
|
|
573
|
+
name: 'ResponseExceededMaxSizeError';
|
|
574
|
+
code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE';
|
|
575
|
+
}
|
|
576
|
+
export class RequestRetryError extends UndiciError {
|
|
577
|
+
constructor(message: string, statusCode: number, headers?: IncomingHttpHeaders$1 | string[] | null, body?: null | Record<string, any> | string);
|
|
578
|
+
name: 'RequestRetryError';
|
|
579
|
+
code: 'UND_ERR_REQ_RETRY';
|
|
580
|
+
statusCode: number;
|
|
581
|
+
data: {
|
|
582
|
+
count: number;
|
|
583
|
+
};
|
|
584
|
+
headers: Record<string, string | string[]>;
|
|
585
|
+
}
|
|
586
|
+
export class SecureProxyConnectionError extends UndiciError {
|
|
587
|
+
constructor(cause?: Error, message?: string, options?: Record<any, any>);
|
|
588
|
+
name: 'SecureProxyConnectionError';
|
|
589
|
+
code: 'UND_ERR_PRX_TLS';
|
|
590
|
+
}
|
|
591
|
+
class MaxOriginsReachedError extends UndiciError {
|
|
592
|
+
name: 'MaxOriginsReachedError';
|
|
593
|
+
code: 'UND_ERR_MAX_ORIGINS_REACHED';
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
//#endregion
|
|
597
|
+
//#region node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/dispatcher.d.ts
|
|
598
|
+
type AbortSignal$1 = unknown;
|
|
599
|
+
type UndiciHeaders$1 = Record<string, string | string[]> | IncomingHttpHeaders$1 | string[] | Iterable<[string, string | string[] | undefined]> | null;
|
|
600
|
+
/** Dispatcher is the core API used to dispatch requests. */
|
|
601
|
+
declare class Dispatcher$1 extends EventEmitter {
|
|
602
|
+
/** Dispatches a request. This API is expected to evolve through semver-major versions and is less stable than the preceding higher level APIs. It is primarily intended for library developers who implement higher level APIs on top of this. */
|
|
603
|
+
dispatch(options: Dispatcher$1.DispatchOptions, handler: Dispatcher$1.DispatchHandler): boolean;
|
|
604
|
+
/** Starts two-way communications with the requested resource. */
|
|
605
|
+
connect<TOpaque = null>(options: Dispatcher$1.ConnectOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher$1.ConnectData<TOpaque>) => void): void;
|
|
606
|
+
connect<TOpaque = null>(options: Dispatcher$1.ConnectOptions<TOpaque>): Promise<Dispatcher$1.ConnectData<TOpaque>>;
|
|
607
|
+
/** Compose a chain of dispatchers */
|
|
608
|
+
compose(dispatchers: Dispatcher$1.DispatcherComposeInterceptor[]): Dispatcher$1.ComposedDispatcher;
|
|
609
|
+
compose(...dispatchers: Dispatcher$1.DispatcherComposeInterceptor[]): Dispatcher$1.ComposedDispatcher;
|
|
610
|
+
/** Performs an HTTP request. */
|
|
611
|
+
request<TOpaque = null>(options: Dispatcher$1.RequestOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher$1.ResponseData<TOpaque>) => void): void;
|
|
612
|
+
request<TOpaque = null>(options: Dispatcher$1.RequestOptions<TOpaque>): Promise<Dispatcher$1.ResponseData<TOpaque>>;
|
|
613
|
+
/** For easy use with `stream.pipeline`. */
|
|
614
|
+
pipeline<TOpaque = null>(options: Dispatcher$1.PipelineOptions<TOpaque>, handler: Dispatcher$1.PipelineHandler<TOpaque>): Duplex;
|
|
615
|
+
/** A faster version of `Dispatcher.request`. */
|
|
616
|
+
stream<TOpaque = null>(options: Dispatcher$1.RequestOptions<TOpaque>, factory: Dispatcher$1.StreamFactory<TOpaque>, callback: (err: Error | null, data: Dispatcher$1.StreamData<TOpaque>) => void): void;
|
|
617
|
+
stream<TOpaque = null>(options: Dispatcher$1.RequestOptions<TOpaque>, factory: Dispatcher$1.StreamFactory<TOpaque>): Promise<Dispatcher$1.StreamData<TOpaque>>;
|
|
618
|
+
/** Upgrade to a different protocol. */
|
|
619
|
+
upgrade(options: Dispatcher$1.UpgradeOptions, callback: (err: Error | null, data: Dispatcher$1.UpgradeData) => void): void;
|
|
620
|
+
upgrade(options: Dispatcher$1.UpgradeOptions): Promise<Dispatcher$1.UpgradeData>;
|
|
621
|
+
/** Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided). */
|
|
622
|
+
close(callback: () => void): void;
|
|
623
|
+
close(): Promise<void>;
|
|
624
|
+
/** Destroy the client abruptly with the given err. All the pending and running requests will be asynchronously aborted and error. Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided). Since this operation is asynchronously dispatched there might still be some progress on dispatched requests. */
|
|
625
|
+
destroy(err: Error | null, callback: () => void): void;
|
|
626
|
+
destroy(callback: () => void): void;
|
|
627
|
+
destroy(err: Error | null): Promise<void>;
|
|
628
|
+
destroy(): Promise<void>;
|
|
629
|
+
on(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher$1[]) => void): this;
|
|
630
|
+
on(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void): this;
|
|
631
|
+
on(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void): this;
|
|
632
|
+
on(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
633
|
+
once(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher$1[]) => void): this;
|
|
634
|
+
once(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void): this;
|
|
635
|
+
once(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void): this;
|
|
636
|
+
once(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
637
|
+
off(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher$1[]) => void): this;
|
|
638
|
+
off(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void): this;
|
|
639
|
+
off(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void): this;
|
|
640
|
+
off(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
641
|
+
addListener(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher$1[]) => void): this;
|
|
642
|
+
addListener(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void): this;
|
|
643
|
+
addListener(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void): this;
|
|
644
|
+
addListener(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
645
|
+
removeListener(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher$1[]) => void): this;
|
|
646
|
+
removeListener(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void): this;
|
|
647
|
+
removeListener(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void): this;
|
|
648
|
+
removeListener(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
649
|
+
prependListener(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher$1[]) => void): this;
|
|
650
|
+
prependListener(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void): this;
|
|
651
|
+
prependListener(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void): this;
|
|
652
|
+
prependListener(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
653
|
+
prependOnceListener(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher$1[]) => void): this;
|
|
654
|
+
prependOnceListener(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void): this;
|
|
655
|
+
prependOnceListener(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void): this;
|
|
656
|
+
prependOnceListener(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
657
|
+
listeners(eventName: 'connect'): ((origin: URL$1, targets: readonly Dispatcher$1[]) => void)[];
|
|
658
|
+
listeners(eventName: 'disconnect'): ((origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void)[];
|
|
659
|
+
listeners(eventName: 'connectionError'): ((origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void)[];
|
|
660
|
+
listeners(eventName: 'drain'): ((origin: URL$1) => void)[];
|
|
661
|
+
rawListeners(eventName: 'connect'): ((origin: URL$1, targets: readonly Dispatcher$1[]) => void)[];
|
|
662
|
+
rawListeners(eventName: 'disconnect'): ((origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void)[];
|
|
663
|
+
rawListeners(eventName: 'connectionError'): ((origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError) => void)[];
|
|
664
|
+
rawListeners(eventName: 'drain'): ((origin: URL$1) => void)[];
|
|
665
|
+
emit(eventName: 'connect', origin: URL$1, targets: readonly Dispatcher$1[]): boolean;
|
|
666
|
+
emit(eventName: 'disconnect', origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError): boolean;
|
|
667
|
+
emit(eventName: 'connectionError', origin: URL$1, targets: readonly Dispatcher$1[], error: Errors$1.UndiciError): boolean;
|
|
668
|
+
emit(eventName: 'drain', origin: URL$1): boolean;
|
|
669
|
+
}
|
|
670
|
+
declare namespace Dispatcher$1 {
|
|
671
|
+
export interface ComposedDispatcher extends Dispatcher$1 {}
|
|
672
|
+
export type Dispatch = Dispatcher$1['dispatch'];
|
|
673
|
+
export type DispatcherComposeInterceptor = (dispatch: Dispatch) => Dispatch;
|
|
674
|
+
export interface DispatchOptions {
|
|
675
|
+
origin?: string | URL$1;
|
|
676
|
+
path: string;
|
|
677
|
+
method: HttpMethod;
|
|
678
|
+
/** Default: `null` */
|
|
679
|
+
body?: string | Buffer | Uint8Array | Readable | null | FormData$2;
|
|
680
|
+
/** Default: `null` */
|
|
681
|
+
headers?: UndiciHeaders$1;
|
|
682
|
+
/** Query string params to be embedded in the request URL. Default: `null` */
|
|
683
|
+
query?: Record<string, any>;
|
|
684
|
+
/** Whether the requests can be safely retried or not. If `false` the request won't be sent until all preceding requests in the pipeline have completed. Default: `true` if `method` is `HEAD` or `GET`. */
|
|
685
|
+
idempotent?: boolean;
|
|
686
|
+
/** Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received. Defaults to `method !== 'HEAD'`. */
|
|
687
|
+
blocking?: boolean;
|
|
688
|
+
/** Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`. Default: `method === 'CONNECT' || null`. */
|
|
689
|
+
upgrade?: boolean | string | null;
|
|
690
|
+
/** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. */
|
|
691
|
+
headersTimeout?: number | null;
|
|
692
|
+
/** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use 0 to disable it entirely. Defaults to 300 seconds. */
|
|
693
|
+
bodyTimeout?: number | null;
|
|
694
|
+
/** Whether the request should stablish a keep-alive or not. Default `false` */
|
|
695
|
+
reset?: boolean;
|
|
696
|
+
/** Whether Undici should throw an error upon receiving a 4xx or 5xx response from the server. Defaults to false */
|
|
697
|
+
throwOnError?: boolean;
|
|
698
|
+
/** For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server */
|
|
699
|
+
expectContinue?: boolean;
|
|
700
|
+
}
|
|
701
|
+
export interface ConnectOptions<TOpaque = null> {
|
|
702
|
+
origin: string | URL$1;
|
|
703
|
+
path: string;
|
|
704
|
+
/** Default: `null` */
|
|
705
|
+
headers?: UndiciHeaders$1;
|
|
706
|
+
/** Default: `null` */
|
|
707
|
+
signal?: AbortSignal$1 | EventEmitter | null;
|
|
708
|
+
/** This argument parameter is passed through to `ConnectData` */
|
|
709
|
+
opaque?: TOpaque;
|
|
710
|
+
/** Default: false */
|
|
711
|
+
redirectionLimitReached?: boolean;
|
|
712
|
+
/** Default: `null` */
|
|
713
|
+
responseHeaders?: 'raw' | null;
|
|
714
|
+
}
|
|
715
|
+
export interface RequestOptions<TOpaque = null> extends DispatchOptions {
|
|
716
|
+
/** Default: `null` */
|
|
717
|
+
opaque?: TOpaque;
|
|
718
|
+
/** Default: `null` */
|
|
719
|
+
signal?: AbortSignal$1 | EventEmitter | null;
|
|
720
|
+
/** Default: false */
|
|
721
|
+
redirectionLimitReached?: boolean;
|
|
722
|
+
/** Default: `null` */
|
|
723
|
+
onInfo?: (info: {
|
|
724
|
+
statusCode: number;
|
|
725
|
+
headers: Record<string, string | string[]>;
|
|
726
|
+
}) => void;
|
|
727
|
+
/** Default: `null` */
|
|
728
|
+
responseHeaders?: 'raw' | null;
|
|
729
|
+
/** Default: `64 KiB` */
|
|
730
|
+
highWaterMark?: number;
|
|
731
|
+
}
|
|
732
|
+
export interface PipelineOptions<TOpaque = null> extends RequestOptions<TOpaque> {
|
|
733
|
+
/** `true` if the `handler` will return an object stream. Default: `false` */
|
|
734
|
+
objectMode?: boolean;
|
|
735
|
+
}
|
|
736
|
+
export interface UpgradeOptions {
|
|
737
|
+
path: string;
|
|
738
|
+
/** Default: `'GET'` */
|
|
739
|
+
method?: string;
|
|
740
|
+
/** Default: `null` */
|
|
741
|
+
headers?: UndiciHeaders$1;
|
|
742
|
+
/** A string of comma separated protocols, in descending preference order. Default: `'Websocket'` */
|
|
743
|
+
protocol?: string;
|
|
744
|
+
/** Default: `null` */
|
|
745
|
+
signal?: AbortSignal$1 | EventEmitter | null;
|
|
746
|
+
/** Default: false */
|
|
747
|
+
redirectionLimitReached?: boolean;
|
|
748
|
+
/** Default: `null` */
|
|
749
|
+
responseHeaders?: 'raw' | null;
|
|
750
|
+
}
|
|
751
|
+
export interface ConnectData<TOpaque = null> {
|
|
752
|
+
statusCode: number;
|
|
753
|
+
headers: IncomingHttpHeaders$1;
|
|
754
|
+
socket: Duplex;
|
|
755
|
+
opaque: TOpaque;
|
|
756
|
+
}
|
|
757
|
+
export interface ResponseData<TOpaque = null> {
|
|
758
|
+
statusCode: number;
|
|
759
|
+
headers: IncomingHttpHeaders$1;
|
|
760
|
+
body: BodyReadable$1 & BodyMixin;
|
|
761
|
+
trailers: Record<string, string>;
|
|
762
|
+
opaque: TOpaque;
|
|
763
|
+
context: object;
|
|
764
|
+
}
|
|
765
|
+
export interface PipelineHandlerData<TOpaque = null> {
|
|
766
|
+
statusCode: number;
|
|
767
|
+
headers: IncomingHttpHeaders$1;
|
|
768
|
+
opaque: TOpaque;
|
|
769
|
+
body: BodyReadable$1;
|
|
770
|
+
context: object;
|
|
771
|
+
}
|
|
772
|
+
export interface StreamData<TOpaque = null> {
|
|
773
|
+
opaque: TOpaque;
|
|
774
|
+
trailers: Record<string, string>;
|
|
775
|
+
}
|
|
776
|
+
export interface UpgradeData<TOpaque = null> {
|
|
777
|
+
headers: IncomingHttpHeaders$1;
|
|
778
|
+
socket: Duplex;
|
|
779
|
+
opaque: TOpaque;
|
|
780
|
+
}
|
|
781
|
+
export interface StreamFactoryData<TOpaque = null> {
|
|
782
|
+
statusCode: number;
|
|
783
|
+
headers: IncomingHttpHeaders$1;
|
|
784
|
+
opaque: TOpaque;
|
|
785
|
+
context: object;
|
|
786
|
+
}
|
|
787
|
+
export type StreamFactory<TOpaque = null> = (data: StreamFactoryData<TOpaque>) => Writable;
|
|
788
|
+
export interface DispatchController {
|
|
789
|
+
get aborted(): boolean;
|
|
790
|
+
get paused(): boolean;
|
|
791
|
+
get reason(): Error | null;
|
|
792
|
+
abort(reason: Error): void;
|
|
793
|
+
pause(): void;
|
|
794
|
+
resume(): void;
|
|
795
|
+
}
|
|
796
|
+
export interface DispatchHandler {
|
|
797
|
+
onRequestStart?(controller: DispatchController, context: any): void;
|
|
798
|
+
onRequestUpgrade?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders$1, socket: Duplex): void;
|
|
799
|
+
onResponseStart?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders$1, statusMessage?: string): void;
|
|
800
|
+
onResponseData?(controller: DispatchController, chunk: Buffer): void;
|
|
801
|
+
onResponseEnd?(controller: DispatchController, trailers: IncomingHttpHeaders$1): void;
|
|
802
|
+
onResponseError?(controller: DispatchController, error: Error): void;
|
|
803
|
+
/** Invoked before request is dispatched on socket. May be invoked multiple times when a request is retried when the request at the head of the pipeline fails. */
|
|
804
|
+
/** @deprecated */
|
|
805
|
+
onConnect?(abort: (err?: Error) => void): void;
|
|
806
|
+
/** Invoked when an error has occurred. */
|
|
807
|
+
/** @deprecated */
|
|
808
|
+
onError?(err: Error): void;
|
|
809
|
+
/** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */
|
|
810
|
+
/** @deprecated */
|
|
811
|
+
onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void;
|
|
812
|
+
/** Invoked when response is received, before headers have been read. **/
|
|
813
|
+
/** @deprecated */
|
|
814
|
+
onResponseStarted?(): void;
|
|
815
|
+
/** Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. */
|
|
816
|
+
/** @deprecated */
|
|
817
|
+
onHeaders?(statusCode: number, headers: Buffer[], resume: () => void, statusText: string): boolean;
|
|
818
|
+
/** Invoked when response payload data is received. */
|
|
819
|
+
/** @deprecated */
|
|
820
|
+
onData?(chunk: Buffer): boolean;
|
|
821
|
+
/** Invoked when response payload and trailers have been received and the request has completed. */
|
|
822
|
+
/** @deprecated */
|
|
823
|
+
onComplete?(trailers: string[] | null): void;
|
|
824
|
+
/** Invoked when a body chunk is sent to the server. May be invoked multiple times for chunked requests */
|
|
825
|
+
/** @deprecated */
|
|
826
|
+
onBodySent?(chunkSize: number, totalBytesSent: number): void;
|
|
827
|
+
}
|
|
828
|
+
export type PipelineHandler<TOpaque = null> = (data: PipelineHandlerData<TOpaque>) => Readable;
|
|
829
|
+
export type HttpMethod = Autocomplete$1<'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'>;
|
|
830
|
+
/**
|
|
831
|
+
* @link https://fetch.spec.whatwg.org/#body-mixin
|
|
832
|
+
*/
|
|
833
|
+
interface BodyMixin {
|
|
834
|
+
readonly body?: never;
|
|
835
|
+
readonly bodyUsed: boolean;
|
|
836
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
837
|
+
blob(): Promise<Blob$1>;
|
|
838
|
+
bytes(): Promise<Uint8Array>;
|
|
839
|
+
formData(): Promise<never>;
|
|
840
|
+
json(): Promise<unknown>;
|
|
841
|
+
text(): Promise<string>;
|
|
842
|
+
}
|
|
843
|
+
export interface DispatchInterceptor {
|
|
844
|
+
(dispatch: Dispatch): Dispatch;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
//#endregion
|
|
848
|
+
//#region node_modules/.pnpm/undici-types@7.18.2/node_modules/undici-types/mock-interceptor.d.ts
|
|
849
|
+
/** The scope associated with a mock dispatch. */
|
|
850
|
+
declare class MockScope$1<TData extends object = object> {
|
|
851
|
+
constructor(mockDispatch: MockInterceptor$1.MockDispatch<TData>);
|
|
852
|
+
/** Delay a reply by a set amount of time in ms. */
|
|
853
|
+
delay(waitInMs: number): MockScope$1<TData>;
|
|
854
|
+
/** Persist the defined mock data for the associated reply. It will return the defined mock data indefinitely. */
|
|
855
|
+
persist(): MockScope$1<TData>;
|
|
856
|
+
/** Define a reply for a set amount of matching requests. */
|
|
857
|
+
times(repeatTimes: number): MockScope$1<TData>;
|
|
858
|
+
}
|
|
859
|
+
/** The interceptor for a Mock. */
|
|
860
|
+
declare class MockInterceptor$1 {
|
|
861
|
+
constructor(options: MockInterceptor$1.Options, mockDispatches: MockInterceptor$1.MockDispatch[]);
|
|
862
|
+
/** Mock an undici request with the defined reply. */
|
|
863
|
+
reply<TData extends object = object>(replyOptionsCallback: MockInterceptor$1.MockReplyOptionsCallback<TData>): MockScope$1<TData>;
|
|
864
|
+
reply<TData extends object = object>(statusCode: number, data?: TData | Buffer | string | MockInterceptor$1.MockResponseDataHandler<TData>, responseOptions?: MockInterceptor$1.MockResponseOptions): MockScope$1<TData>;
|
|
865
|
+
/** Mock an undici request by throwing the defined reply error. */
|
|
866
|
+
replyWithError<TError extends Error = Error>(error: TError): MockScope$1;
|
|
867
|
+
/** Set default reply headers on the interceptor for subsequent mocked replies. */
|
|
868
|
+
defaultReplyHeaders(headers: IncomingHttpHeaders$1): MockInterceptor$1;
|
|
869
|
+
/** Set default reply trailers on the interceptor for subsequent mocked replies. */
|
|
870
|
+
defaultReplyTrailers(trailers: Record<string, string>): MockInterceptor$1;
|
|
871
|
+
/** Set automatically calculated content-length header on subsequent mocked replies. */
|
|
872
|
+
replyContentLength(): MockInterceptor$1;
|
|
873
|
+
}
|
|
874
|
+
declare namespace MockInterceptor$1 {
|
|
875
|
+
/** MockInterceptor options. */
|
|
876
|
+
export interface Options {
|
|
877
|
+
/** Path to intercept on. */
|
|
878
|
+
path: string | RegExp | ((path: string) => boolean);
|
|
879
|
+
/** Method to intercept on. Defaults to GET. */
|
|
880
|
+
method?: string | RegExp | ((method: string) => boolean);
|
|
881
|
+
/** Body to intercept on. */
|
|
882
|
+
body?: string | RegExp | ((body: string) => boolean);
|
|
883
|
+
/** Headers to intercept on. */
|
|
884
|
+
headers?: Record<string, string | RegExp | ((body: string) => boolean)> | ((headers: Record<string, string>) => boolean);
|
|
885
|
+
/** Query params to intercept on */
|
|
886
|
+
query?: Record<string, any>;
|
|
887
|
+
}
|
|
888
|
+
export interface MockDispatch<TData extends object = object, TError extends Error = Error> extends Options {
|
|
889
|
+
times: number | null;
|
|
890
|
+
persist: boolean;
|
|
891
|
+
consumed: boolean;
|
|
892
|
+
data: MockDispatchData<TData, TError>;
|
|
893
|
+
}
|
|
894
|
+
export interface MockDispatchData<TData extends object = object, TError extends Error = Error> extends MockResponseOptions {
|
|
895
|
+
error: TError | null;
|
|
896
|
+
statusCode?: number;
|
|
897
|
+
data?: TData | string;
|
|
898
|
+
}
|
|
899
|
+
export interface MockResponseOptions {
|
|
900
|
+
headers?: IncomingHttpHeaders$1;
|
|
901
|
+
trailers?: Record<string, string>;
|
|
902
|
+
}
|
|
903
|
+
export interface MockResponseCallbackOptions {
|
|
904
|
+
path: string;
|
|
905
|
+
method: string;
|
|
906
|
+
headers?: Headers$2 | Record<string, string>;
|
|
907
|
+
origin?: string;
|
|
908
|
+
body?: BodyInit$1 | Dispatcher$1.DispatchOptions['body'] | null;
|
|
909
|
+
}
|
|
910
|
+
export type MockResponseDataHandler<TData extends object = object> = (opts: MockResponseCallbackOptions) => TData | Buffer | string;
|
|
911
|
+
export type MockReplyOptionsCallback<TData extends object = object> = (opts: MockResponseCallbackOptions) => {
|
|
912
|
+
statusCode: number;
|
|
913
|
+
data?: TData | Buffer | string;
|
|
914
|
+
responseOptions?: MockResponseOptions;
|
|
915
|
+
};
|
|
916
|
+
}
|
|
917
|
+
//#endregion
|
|
918
|
+
//#region node_modules/.pnpm/undici@8.10.0/node_modules/undici/types/utility.d.ts
|
|
919
|
+
type AutocompletePrimitiveBaseType<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : never;
|
|
920
|
+
type Autocomplete<T> = T | (AutocompletePrimitiveBaseType<T> & Record<never, never>);
|
|
921
|
+
//#endregion
|
|
922
|
+
//#region node_modules/.pnpm/undici@8.10.0/node_modules/undici/types/header.d.ts
|
|
923
|
+
/**
|
|
924
|
+
* The header type declaration of `undici`.
|
|
925
|
+
*/
|
|
926
|
+
type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
|
|
927
|
+
/**
|
|
928
|
+
* The header type declaration of `undici` for outgoing requests.
|
|
929
|
+
*/
|
|
930
|
+
type OutgoingHttpHeaders = Record<string, number | string | string[] | undefined>;
|
|
931
|
+
type HeaderNames = Autocomplete<'Accept' | 'Accept-CH' | 'Accept-Charset' | 'Accept-Encoding' | 'Accept-Language' | 'Accept-Patch' | 'Accept-Post' | 'Accept-Ranges' | 'Access-Control-Allow-Credentials' | 'Access-Control-Allow-Headers' | 'Access-Control-Allow-Methods' | 'Access-Control-Allow-Origin' | 'Access-Control-Expose-Headers' | 'Access-Control-Max-Age' | 'Access-Control-Request-Headers' | 'Access-Control-Request-Method' | 'Age' | 'Allow' | 'Alt-Svc' | 'Alt-Used' | 'Authorization' | 'Cache-Control' | 'Clear-Site-Data' | 'Connection' | 'Content-Disposition' | 'Content-Encoding' | 'Content-Language' | 'Content-Length' | 'Content-Location' | 'Content-Range' | 'Content-Security-Policy' | 'Content-Security-Policy-Report-Only' | 'Content-Type' | 'Cookie' | 'Cross-Origin-Embedder-Policy' | 'Cross-Origin-Opener-Policy' | 'Cross-Origin-Resource-Policy' | 'Date' | 'Device-Memory' | 'ETag' | 'Expect' | 'Expect-CT' | 'Expires' | 'Forwarded' | 'From' | 'Host' | 'If-Match' | 'If-Modified-Since' | 'If-None-Match' | 'If-Range' | 'If-Unmodified-Since' | 'Keep-Alive' | 'Last-Modified' | 'Link' | 'Location' | 'Max-Forwards' | 'Origin' | 'Permissions-Policy' | 'Priority' | 'Proxy-Authenticate' | 'Proxy-Authorization' | 'Range' | 'Referer' | 'Referrer-Policy' | 'Retry-After' | 'Sec-Fetch-Dest' | 'Sec-Fetch-Mode' | 'Sec-Fetch-Site' | 'Sec-Fetch-User' | 'Sec-Purpose' | 'Sec-WebSocket-Accept' | 'Server' | 'Server-Timing' | 'Service-Worker-Navigation-Preload' | 'Set-Cookie' | 'SourceMap' | 'Strict-Transport-Security' | 'TE' | 'Timing-Allow-Origin' | 'Trailer' | 'Transfer-Encoding' | 'Upgrade' | 'Upgrade-Insecure-Requests' | 'User-Agent' | 'Vary' | 'Via' | 'WWW-Authenticate' | 'X-Content-Type-Options' | 'X-Frame-Options'>;
|
|
932
|
+
type IANARegisteredMimeType = Autocomplete<'audio/aac' | 'video/x-msvideo' | 'image/avif' | 'video/av1' | 'application/octet-stream' | 'image/bmp' | 'text/css' | 'text/csv' | 'application/vnd.ms-fontobject' | 'application/epub+zip' | 'image/gif' | 'application/gzip' | 'text/html' | 'image/x-icon' | 'text/calendar' | 'image/jpeg' | 'text/javascript' | 'application/json' | 'application/ld+json' | 'audio/x-midi' | 'audio/mpeg' | 'video/mp4' | 'video/mpeg' | 'audio/ogg' | 'video/ogg' | 'application/ogg' | 'audio/opus' | 'font/otf' | 'application/pdf' | 'image/png' | 'application/rtf' | 'image/svg+xml' | 'image/tiff' | 'video/mp2t' | 'font/ttf' | 'text/plain' | 'application/wasm' | 'video/webm' | 'audio/webm' | 'image/webp' | 'font/woff' | 'font/woff2' | 'application/xhtml+xml' | 'application/xml' | 'application/zip' | 'video/3gpp' | 'video/3gpp2' | 'model/gltf+json' | 'model/gltf-binary'>;
|
|
933
|
+
type KnownHeaderValues = {
|
|
934
|
+
'content-type': IANARegisteredMimeType;
|
|
935
|
+
};
|
|
936
|
+
type HeaderRecord = { [K in HeaderNames | Lowercase<HeaderNames>]?: Lowercase<K> extends keyof KnownHeaderValues ? KnownHeaderValues[Lowercase<K>] : string; };
|
|
937
|
+
//#endregion
|
|
938
|
+
//#region node_modules/.pnpm/undici@8.10.0/node_modules/undici/types/readable.d.ts
|
|
939
|
+
declare class BodyReadable extends Readable {
|
|
940
|
+
constructor(opts: {
|
|
941
|
+
resume: (this: Readable, size: number) => void | null;
|
|
942
|
+
abort: () => void | null;
|
|
943
|
+
contentType?: string;
|
|
944
|
+
contentLength?: number;
|
|
945
|
+
highWaterMark?: number;
|
|
946
|
+
});
|
|
947
|
+
/** Consumes and returns the body as a string
|
|
948
|
+
* https://fetch.spec.whatwg.org/#dom-body-text
|
|
949
|
+
*/
|
|
950
|
+
text(): Promise<string>;
|
|
951
|
+
/** Consumes and returns the body as a JavaScript Object
|
|
952
|
+
* https://fetch.spec.whatwg.org/#dom-body-json
|
|
953
|
+
*/
|
|
954
|
+
json(): Promise<unknown>;
|
|
955
|
+
/** Consumes and returns the body as a Blob
|
|
956
|
+
* https://fetch.spec.whatwg.org/#dom-body-blob
|
|
957
|
+
*/
|
|
958
|
+
blob(): Promise<Blob$1>;
|
|
959
|
+
/** Consumes and returns the body as an Uint8Array
|
|
960
|
+
* https://fetch.spec.whatwg.org/#dom-body-bytes
|
|
961
|
+
*/
|
|
962
|
+
bytes(): Promise<Uint8Array>;
|
|
963
|
+
/** Consumes and returns the body as an ArrayBuffer
|
|
964
|
+
* https://fetch.spec.whatwg.org/#dom-body-arraybuffer
|
|
965
|
+
*/
|
|
966
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
967
|
+
/** Not implemented
|
|
968
|
+
*
|
|
969
|
+
* https://fetch.spec.whatwg.org/#dom-body-formdata
|
|
970
|
+
*/
|
|
971
|
+
formData(): Promise<never>;
|
|
972
|
+
/** Returns true if the body is not null and the body has been consumed
|
|
973
|
+
*
|
|
974
|
+
* Otherwise, returns false
|
|
975
|
+
*
|
|
976
|
+
* https://fetch.spec.whatwg.org/#dom-body-bodyused
|
|
977
|
+
*/
|
|
978
|
+
readonly bodyUsed: boolean;
|
|
979
|
+
/**
|
|
980
|
+
* If body is null, it should return null as the body
|
|
981
|
+
*
|
|
982
|
+
* If body is not null, should return the body as a ReadableStream
|
|
983
|
+
*
|
|
984
|
+
* https://fetch.spec.whatwg.org/#dom-body-body
|
|
985
|
+
*/
|
|
986
|
+
readonly body: never | undefined;
|
|
987
|
+
/** Dumps the response body by reading `limit` number of bytes.
|
|
988
|
+
* @param opts.limit Number of bytes to read (optional) - Default: 131072
|
|
989
|
+
* @param opts.signal AbortSignal to cancel the operation (optional)
|
|
990
|
+
*/
|
|
991
|
+
dump(opts?: {
|
|
992
|
+
limit: number;
|
|
993
|
+
signal?: AbortSignal;
|
|
994
|
+
}): Promise<void>;
|
|
995
|
+
}
|
|
996
|
+
//#endregion
|
|
997
|
+
//#region node_modules/.pnpm/undici@8.10.0/node_modules/undici/types/fetch.d.ts
|
|
998
|
+
type BodyInit = ArrayBuffer | AsyncIterable<Uint8Array> | Blob$1 | FormData$1 | Iterable<Uint8Array> | NodeJS.ArrayBufferView | URLSearchParams$1 | null | string;
|
|
999
|
+
interface SpecIterator<T, TReturn = any, TNext = undefined> {
|
|
1000
|
+
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
|
|
1001
|
+
}
|
|
1002
|
+
interface SpecIteratorObject<T, TReturn = undefined, TNext = unknown> extends SpecIterator<T, TReturn, TNext> {
|
|
1003
|
+
[Symbol.iterator](): SpecIteratorObject<T, TReturn, TNext>;
|
|
1004
|
+
map<U>(callbackfn: (value: T, index: number) => U): SpecIteratorObject<U>;
|
|
1005
|
+
filter<S extends T>(predicate: (value: T, index: number) => value is S): SpecIteratorObject<S>;
|
|
1006
|
+
filter(predicate: (value: T, index: number) => unknown): SpecIteratorObject<T>;
|
|
1007
|
+
take(limit: number): SpecIteratorObject<T>;
|
|
1008
|
+
drop(count: number): SpecIteratorObject<T>;
|
|
1009
|
+
flatMap<U>(callbackfn: (value: T, index: number) => Iterator<U> | Iterable<U>): SpecIteratorObject<U>;
|
|
1010
|
+
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T): T;
|
|
1011
|
+
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T, initialValue: T): T;
|
|
1012
|
+
reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number) => U, initialValue: U): U;
|
|
1013
|
+
toArray(): T[];
|
|
1014
|
+
forEach(callbackfn: (value: T, index: number) => void): void;
|
|
1015
|
+
some(predicate: (value: T, index: number) => unknown): boolean;
|
|
1016
|
+
every(predicate: (value: T, index: number) => unknown): boolean;
|
|
1017
|
+
find<S extends T>(predicate: (value: T, index: number) => value is S): S | undefined;
|
|
1018
|
+
find(predicate: (value: T, index: number) => unknown): T | undefined;
|
|
1019
|
+
readonly [Symbol.toStringTag]: string;
|
|
1020
|
+
}
|
|
1021
|
+
interface SpecIterableIterator<T> extends SpecIteratorObject<T> {
|
|
1022
|
+
[Symbol.iterator](): SpecIterableIterator<T>;
|
|
1023
|
+
}
|
|
1024
|
+
interface SpecIterable<T> {
|
|
1025
|
+
[Symbol.iterator](): SpecIterableIterator<T>;
|
|
1026
|
+
}
|
|
1027
|
+
type HeadersInit = [string, string][] | HeaderRecord | Headers$1;
|
|
1028
|
+
declare class Headers$1 implements SpecIterable<[string, string]> {
|
|
1029
|
+
constructor(init?: HeadersInit);
|
|
1030
|
+
readonly append: (name: string, value: string) => void;
|
|
1031
|
+
readonly delete: (name: string) => void;
|
|
1032
|
+
readonly get: (name: string) => string | null;
|
|
1033
|
+
readonly has: (name: string) => boolean;
|
|
1034
|
+
readonly set: (name: string, value: string) => void;
|
|
1035
|
+
readonly getSetCookie: () => string[];
|
|
1036
|
+
readonly forEach: (callbackfn: (value: string, key: string, iterable: Headers$1) => void, thisArg?: unknown) => void;
|
|
1037
|
+
readonly keys: () => SpecIterableIterator<string>;
|
|
1038
|
+
readonly values: () => SpecIterableIterator<string>;
|
|
1039
|
+
readonly entries: () => SpecIterableIterator<[string, string]>;
|
|
1040
|
+
readonly [Symbol.iterator]: () => SpecIterableIterator<[string, string]>;
|
|
1041
|
+
}
|
|
1042
|
+
//#endregion
|
|
1043
|
+
//#region node_modules/.pnpm/undici@8.10.0/node_modules/undici/types/formdata.d.ts
|
|
1044
|
+
/**
|
|
1045
|
+
* A `string` or `File` that represents a single value from a set of `FormData` key-value pairs.
|
|
1046
|
+
*/
|
|
1047
|
+
declare type FormDataEntryValue = string | File$1;
|
|
1048
|
+
/**
|
|
1049
|
+
* Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using fetch().
|
|
1050
|
+
*/
|
|
1051
|
+
declare class FormData$1 {
|
|
1052
|
+
/**
|
|
1053
|
+
* Appends a new value onto an existing key inside a FormData object,
|
|
1054
|
+
* or adds the key if it does not already exist.
|
|
1055
|
+
*
|
|
1056
|
+
* The difference between `set()` and `append()` is that if the specified key already exists, `set()` will overwrite all existing values with the new one, whereas `append()` will append the new value onto the end of the existing set of values.
|
|
1057
|
+
*
|
|
1058
|
+
* @param name The name of the field whose data is contained in `value`.
|
|
1059
|
+
* @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
|
|
1060
|
+
or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string.
|
|
1061
|
+
* @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.
|
|
1062
|
+
*/
|
|
1063
|
+
append(name: string, value: unknown, fileName?: string): void;
|
|
1064
|
+
/**
|
|
1065
|
+
* Set a new value for an existing key inside FormData,
|
|
1066
|
+
* or add the new field if it does not already exist.
|
|
1067
|
+
*
|
|
1068
|
+
* @param name The name of the field whose data is contained in `value`.
|
|
1069
|
+
* @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
|
|
1070
|
+
or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string.
|
|
1071
|
+
* @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.
|
|
1072
|
+
*
|
|
1073
|
+
*/
|
|
1074
|
+
set(name: string, value: unknown, fileName?: string): void;
|
|
1075
|
+
/**
|
|
1076
|
+
* Returns the first value associated with a given key from within a `FormData` object.
|
|
1077
|
+
* If you expect multiple values and want all of them, use the `getAll()` method instead.
|
|
1078
|
+
*
|
|
1079
|
+
* @param {string} name A name of the value you want to retrieve.
|
|
1080
|
+
*
|
|
1081
|
+
* @returns A `FormDataEntryValue` containing the value. If the key doesn't exist, the method returns null.
|
|
1082
|
+
*/
|
|
1083
|
+
get(name: string): FormDataEntryValue | null;
|
|
1084
|
+
/**
|
|
1085
|
+
* Returns all the values associated with a given key from within a `FormData` object.
|
|
1086
|
+
*
|
|
1087
|
+
* @param {string} name A name of the value you want to retrieve.
|
|
1088
|
+
*
|
|
1089
|
+
* @returns An array of `FormDataEntryValue` whose key matches the value passed in the `name` parameter. If the key doesn't exist, the method returns an empty list.
|
|
1090
|
+
*/
|
|
1091
|
+
getAll(name: string): FormDataEntryValue[];
|
|
1092
|
+
/**
|
|
1093
|
+
* Returns a boolean stating whether a `FormData` object contains a certain key.
|
|
1094
|
+
*
|
|
1095
|
+
* @param name A string representing the name of the key you want to test for.
|
|
1096
|
+
*
|
|
1097
|
+
* @return A boolean value.
|
|
1098
|
+
*/
|
|
1099
|
+
has(name: string): boolean;
|
|
1100
|
+
/**
|
|
1101
|
+
* Deletes a key and its value(s) from a `FormData` object.
|
|
1102
|
+
*
|
|
1103
|
+
* @param name The name of the key you want to delete.
|
|
1104
|
+
*/
|
|
1105
|
+
delete(name: string): void;
|
|
1106
|
+
/**
|
|
1107
|
+
* Executes given callback function for each field of the FormData instance
|
|
1108
|
+
*/
|
|
1109
|
+
forEach: (callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData$1) => void, thisArg?: unknown) => void;
|
|
1110
|
+
/**
|
|
1111
|
+
* Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all keys contained in this `FormData` object.
|
|
1112
|
+
* Each key is a `string`.
|
|
1113
|
+
*/
|
|
1114
|
+
keys: () => SpecIterableIterator<string>;
|
|
1115
|
+
/**
|
|
1116
|
+
* Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all values contained in this object `FormData` object.
|
|
1117
|
+
* Each value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
|
|
1118
|
+
*/
|
|
1119
|
+
values: () => SpecIterableIterator<FormDataEntryValue>;
|
|
1120
|
+
/**
|
|
1121
|
+
* Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through the `FormData` key/value pairs.
|
|
1122
|
+
* The key of each pair is a string; the value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
|
|
1123
|
+
*/
|
|
1124
|
+
entries: () => SpecIterableIterator<[string, FormDataEntryValue]>;
|
|
1125
|
+
/**
|
|
1126
|
+
* An alias for FormData#entries()
|
|
1127
|
+
*/
|
|
1128
|
+
[Symbol.iterator]: () => SpecIterableIterator<[string, FormDataEntryValue]>;
|
|
1129
|
+
readonly [Symbol.toStringTag]: string;
|
|
1130
|
+
}
|
|
1131
|
+
//#endregion
|
|
1132
|
+
//#region node_modules/.pnpm/undici@8.10.0/node_modules/undici/types/connector.d.ts
|
|
1133
|
+
declare function buildConnector(options?: buildConnector.BuildOptions): buildConnector.connector;
|
|
1134
|
+
declare namespace buildConnector {
|
|
1135
|
+
export type BuildOptions = (ConnectionOptions | TcpNetConnectOpts | IpcNetConnectOpts) & {
|
|
1136
|
+
allowH2?: boolean;
|
|
1137
|
+
preferH2?: boolean;
|
|
1138
|
+
maxCachedSessions?: number | null;
|
|
1139
|
+
socketPath?: string | null;
|
|
1140
|
+
timeout?: number | null;
|
|
1141
|
+
port?: number;
|
|
1142
|
+
keepAlive?: boolean | null;
|
|
1143
|
+
keepAliveInitialDelay?: number | null;
|
|
1144
|
+
typeOfService?: number | null;
|
|
1145
|
+
};
|
|
1146
|
+
export interface Options {
|
|
1147
|
+
hostname: string;
|
|
1148
|
+
host?: string;
|
|
1149
|
+
protocol: string;
|
|
1150
|
+
port: string;
|
|
1151
|
+
servername?: string;
|
|
1152
|
+
localAddress?: string | null;
|
|
1153
|
+
socketPath?: string | null;
|
|
1154
|
+
httpSocket?: Socket;
|
|
1155
|
+
}
|
|
1156
|
+
export type Callback = (...args: CallbackArgs) => void;
|
|
1157
|
+
type CallbackArgs = [null, Socket | TLSSocket] | [Error, null];
|
|
1158
|
+
export interface connector {
|
|
1159
|
+
(options: buildConnector.Options, callback: buildConnector.Callback): void;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
//#endregion
|
|
1163
|
+
//#region node_modules/.pnpm/undici@8.10.0/node_modules/undici/types/client-stats.d.ts
|
|
1164
|
+
declare class ClientStats {
|
|
1165
|
+
constructor(pool: Client);
|
|
1166
|
+
/** If socket has open connection. */
|
|
1167
|
+
connected: boolean;
|
|
1168
|
+
/** Number of open socket connections in this client that do not have an active request. */
|
|
1169
|
+
pending: number;
|
|
1170
|
+
/** Number of currently active requests of this client. */
|
|
1171
|
+
running: number;
|
|
1172
|
+
/** Number of active, pending, or queued requests of this client. */
|
|
1173
|
+
size: number;
|
|
1174
|
+
}
|
|
1175
|
+
//#endregion
|
|
1176
|
+
//#region node_modules/.pnpm/undici@8.10.0/node_modules/undici/types/client.d.ts
|
|
1177
|
+
type ClientConnectOptions<TOpaque = null> = Omit<Dispatcher.ConnectOptions<TOpaque>, 'origin'>;
|
|
1178
|
+
// TODO: Pendings
|
|
1179
|
+
// 1. Reflect this on Client instantiation
|
|
1180
|
+
// 2. Client H2 should use this namespaced options instead.
|
|
1181
|
+
/**
|
|
1182
|
+
* A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default.
|
|
1183
|
+
*/
|
|
1184
|
+
declare class Client extends Dispatcher {
|
|
1185
|
+
constructor(url: string | URL$1, options?: Client.Options);
|
|
1186
|
+
/** Property to get and set the pipelining factor. */
|
|
1187
|
+
pipelining: number;
|
|
1188
|
+
/** `true` after `client.close()` has been called. */
|
|
1189
|
+
closed: boolean;
|
|
1190
|
+
/** `true` after `client.destroyed()` has been called or `client.close()` has been called and the client shutdown has completed. */
|
|
1191
|
+
destroyed: boolean;
|
|
1192
|
+
/** Aggregate stats for a Client. */
|
|
1193
|
+
readonly stats: ClientStats;
|
|
1194
|
+
// Override dispatcher APIs.
|
|
1195
|
+
override connect<TOpaque = null>(options: ClientConnectOptions<TOpaque>): Promise<Dispatcher.ConnectData<TOpaque>>;
|
|
1196
|
+
override connect<TOpaque = null>(options: ClientConnectOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ConnectData<TOpaque>) => void): void;
|
|
1197
|
+
}
|
|
1198
|
+
declare namespace Client {
|
|
1199
|
+
export interface Options {
|
|
1200
|
+
/** The maximum length of request headers in bytes. Default: Node.js' `--max-http-header-size` or `16384` (16KiB). */
|
|
1201
|
+
maxHeaderSize?: number;
|
|
1202
|
+
/** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). HTTP/1.1 parser timeouts are not guaranteed to fire with exact millisecond precision: delays up to 1000ms use native timers, while larger delays use lower-overhead fast timers with a target resolution around 500ms. */
|
|
1203
|
+
headersTimeout?: number;
|
|
1204
|
+
/** @deprecated unsupported socketTimeout, use headersTimeout & bodyTimeout instead */
|
|
1205
|
+
socketTimeout?: never;
|
|
1206
|
+
/** @deprecated unsupported requestTimeout, use headersTimeout & bodyTimeout instead */
|
|
1207
|
+
requestTimeout?: never;
|
|
1208
|
+
/** The timeout for establishing a socket connection, in milliseconds. Use `0` to disable it entirely. Default: `10e3` milliseconds (10s). */
|
|
1209
|
+
connectTimeout?: number;
|
|
1210
|
+
/** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Default: `300e3` milliseconds (300s). HTTP/1.1 parser timeouts are not guaranteed to fire with exact millisecond precision: delays up to 1000ms use native timers, while larger delays use lower-overhead fast timers with a target resolution around 500ms. */
|
|
1211
|
+
bodyTimeout?: number;
|
|
1212
|
+
/** @deprecated unsupported idleTimeout, use keepAliveTimeout instead */
|
|
1213
|
+
idleTimeout?: never;
|
|
1214
|
+
/** @deprecated unsupported keepAlive, use pipelining=0 instead */
|
|
1215
|
+
keepAlive?: never;
|
|
1216
|
+
/** the timeout, in milliseconds, after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */
|
|
1217
|
+
keepAliveTimeout?: number;
|
|
1218
|
+
/** @deprecated unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead */
|
|
1219
|
+
maxKeepAliveTimeout?: never;
|
|
1220
|
+
/** the maximum allowed `idleTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */
|
|
1221
|
+
keepAliveMaxTimeout?: number;
|
|
1222
|
+
/** A number of milliseconds subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */
|
|
1223
|
+
keepAliveTimeoutThreshold?: number;
|
|
1224
|
+
/** An IPC endpoint, either a Unix domain socket or Windows named pipe. Default: `null`. */
|
|
1225
|
+
socketPath?: string;
|
|
1226
|
+
/** The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Only enable values greater than `1` when the remote server is trusted. Default: `1`. */
|
|
1227
|
+
pipelining?: number;
|
|
1228
|
+
/** @deprecated use the connect option instead */
|
|
1229
|
+
tls?: never;
|
|
1230
|
+
/** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */
|
|
1231
|
+
strictContentLength?: boolean;
|
|
1232
|
+
/** Maximum number of TLS cached sessions used by the built-in connector. Use `0` to disable TLS session caching. Default: `100`. */
|
|
1233
|
+
maxCachedSessions?: number;
|
|
1234
|
+
/** Connector options passed to `buildConnector`, or a custom connector function. Default: `null`. */
|
|
1235
|
+
connect?: Partial<buildConnector.BuildOptions> | buildConnector.connector;
|
|
1236
|
+
/** The maximum number of requests to send over a single connection before it is reset. Use `0` to disable this limit. Default: `null`. */
|
|
1237
|
+
maxRequestsPerClient?: number;
|
|
1238
|
+
/** Local IP address the socket should connect from. */
|
|
1239
|
+
localAddress?: string;
|
|
1240
|
+
/** Max response body size in bytes, -1 is disabled */
|
|
1241
|
+
maxResponseSize?: number;
|
|
1242
|
+
/** WebSocket-specific options */
|
|
1243
|
+
webSocket?: Client.WebSocketOptions;
|
|
1244
|
+
/** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */
|
|
1245
|
+
autoSelectFamily?: boolean;
|
|
1246
|
+
/** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */
|
|
1247
|
+
autoSelectFamilyAttemptTimeout?: number;
|
|
1248
|
+
/**
|
|
1249
|
+
* @description Enables support for H2 if the server has assigned bigger priority to it through ALPN negotiation.
|
|
1250
|
+
* @default true
|
|
1251
|
+
*/
|
|
1252
|
+
allowH2?: boolean;
|
|
1253
|
+
/**
|
|
1254
|
+
* @description Dictates the maximum number of concurrent streams for a single H2 session. It can be overridden by a SETTINGS remote frame.
|
|
1255
|
+
* @default 100
|
|
1256
|
+
* @deprecated Use h2Options.maxConcurrentStreams instead
|
|
1257
|
+
*/
|
|
1258
|
+
maxConcurrentStreams?: number;
|
|
1259
|
+
/**
|
|
1260
|
+
* @description Sets the HTTP/2 stream-level flow-control window size (SETTINGS_INITIAL_WINDOW_SIZE).
|
|
1261
|
+
* @default 262144
|
|
1262
|
+
* @deprecated Use h2Options.settings.initialWindowSize instead
|
|
1263
|
+
*/
|
|
1264
|
+
initialWindowSize?: number;
|
|
1265
|
+
/**
|
|
1266
|
+
* @description Sets the HTTP/2 connection-level flow-control window size (ClientHttp2Session.setLocalWindowSize).
|
|
1267
|
+
* @default 524288
|
|
1268
|
+
* @deprecated Use h2Options.connectionWindowSize instead
|
|
1269
|
+
*/
|
|
1270
|
+
connectionWindowSize?: number;
|
|
1271
|
+
/**
|
|
1272
|
+
* @description Time interval between PING frames dispatch
|
|
1273
|
+
* @default 60000
|
|
1274
|
+
* @deprecated Use h2Options.connectionWindowSize instead
|
|
1275
|
+
*/
|
|
1276
|
+
pingInterval?: number;
|
|
1277
|
+
/**
|
|
1278
|
+
* @description HTTP/2 configuration options
|
|
1279
|
+
*/
|
|
1280
|
+
h2Options?: Client.H2Options;
|
|
1281
|
+
}
|
|
1282
|
+
export interface SocketInfo {
|
|
1283
|
+
localAddress?: string;
|
|
1284
|
+
localPort?: number;
|
|
1285
|
+
remoteAddress?: string;
|
|
1286
|
+
remotePort?: number;
|
|
1287
|
+
remoteFamily?: string;
|
|
1288
|
+
timeout?: number;
|
|
1289
|
+
bytesWritten?: number;
|
|
1290
|
+
bytesRead?: number;
|
|
1291
|
+
}
|
|
1292
|
+
export interface WebSocketOptions {
|
|
1293
|
+
/**
|
|
1294
|
+
* Maximum number of fragments in a message. Set to 0 to disable the limit.
|
|
1295
|
+
* @default 131072
|
|
1296
|
+
*/
|
|
1297
|
+
maxFragments?: number;
|
|
1298
|
+
/**
|
|
1299
|
+
* Maximum allowed payload size in bytes for WebSocket messages.
|
|
1300
|
+
* Applied to uncompressed messages, compressed frame payloads, and decompressed (permessage-deflate) messages.
|
|
1301
|
+
* Set to 0 to disable the limit.
|
|
1302
|
+
* @default 134217728 (128 MB)
|
|
1303
|
+
*/
|
|
1304
|
+
maxPayloadSize?: number;
|
|
1305
|
+
}
|
|
1306
|
+
export interface H2Options extends Omit<SessionOptions, keyof buildConnector.BuildOptions> {
|
|
1307
|
+
/**
|
|
1308
|
+
* @description Sets the HTTP/2 connection-level flow-control window size (ClientHttp2Session.setLocalWindowSize).
|
|
1309
|
+
* @default 524288
|
|
1310
|
+
*/
|
|
1311
|
+
connectionWindowSize?: number;
|
|
1312
|
+
/**
|
|
1313
|
+
* @description Time interval between PING frames dispatch
|
|
1314
|
+
* @default 60000
|
|
1315
|
+
*/
|
|
1316
|
+
pingInterval?: number;
|
|
1317
|
+
/**
|
|
1318
|
+
* @description Dictates the maximum number of concurrent streams for a single H2 session. It can be overridden by a SETTINGS remote frame.
|
|
1319
|
+
* @default 100
|
|
1320
|
+
*/
|
|
1321
|
+
maxConcurrentStreams?: number;
|
|
1322
|
+
/**
|
|
1323
|
+
* @description Enable support for H2C (plain text)
|
|
1324
|
+
* @default false
|
|
1325
|
+
*/
|
|
1326
|
+
useH2c?: boolean;
|
|
1327
|
+
/**
|
|
1328
|
+
* @description SETTINGS frame object. Default to 'node:http2' defaults
|
|
1329
|
+
*/
|
|
1330
|
+
settings?: Omit<SessionOptions['settings'], 'enablePush' | 'maxConcurrentStreams' | 'enableConnectProtocol'>;
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
//#endregion
|
|
1334
|
+
//#region node_modules/.pnpm/undici@8.10.0/node_modules/undici/types/errors.d.ts
|
|
1335
|
+
declare namespace Errors {
|
|
1336
|
+
export class UndiciError extends Error {
|
|
1337
|
+
name: string;
|
|
1338
|
+
code: string;
|
|
1339
|
+
}
|
|
1340
|
+
/** Connect timeout error. */
|
|
1341
|
+
export class ConnectTimeoutError extends UndiciError {
|
|
1342
|
+
name: 'ConnectTimeoutError';
|
|
1343
|
+
code: 'UND_ERR_CONNECT_TIMEOUT';
|
|
1344
|
+
}
|
|
1345
|
+
/** A header exceeds the `headersTimeout` option. */
|
|
1346
|
+
export class HeadersTimeoutError extends UndiciError {
|
|
1347
|
+
name: 'HeadersTimeoutError';
|
|
1348
|
+
code: 'UND_ERR_HEADERS_TIMEOUT';
|
|
1349
|
+
}
|
|
1350
|
+
/** Headers overflow error. */
|
|
1351
|
+
export class HeadersOverflowError extends UndiciError {
|
|
1352
|
+
name: 'HeadersOverflowError';
|
|
1353
|
+
code: 'UND_ERR_HEADERS_OVERFLOW';
|
|
1354
|
+
}
|
|
1355
|
+
/** A body exceeds the `bodyTimeout` option. */
|
|
1356
|
+
export class BodyTimeoutError extends UndiciError {
|
|
1357
|
+
name: 'BodyTimeoutError';
|
|
1358
|
+
code: 'UND_ERR_BODY_TIMEOUT';
|
|
1359
|
+
}
|
|
1360
|
+
export class ResponseError extends UndiciError {
|
|
1361
|
+
constructor(message: string, code: number, options: {
|
|
1362
|
+
headers?: IncomingHttpHeaders | string[] | null;
|
|
1363
|
+
body?: null | Record<string, any> | string;
|
|
1364
|
+
});
|
|
1365
|
+
name: 'ResponseError';
|
|
1366
|
+
code: 'UND_ERR_RESPONSE';
|
|
1367
|
+
statusCode: number;
|
|
1368
|
+
body: null | Record<string, any> | string;
|
|
1369
|
+
headers: IncomingHttpHeaders | string[] | null;
|
|
1370
|
+
}
|
|
1371
|
+
/** Passed an invalid argument. */
|
|
1372
|
+
export class InvalidArgumentError extends UndiciError {
|
|
1373
|
+
name: 'InvalidArgumentError';
|
|
1374
|
+
code: 'UND_ERR_INVALID_ARG';
|
|
1375
|
+
}
|
|
1376
|
+
/** Returned an invalid value. */
|
|
1377
|
+
export class InvalidReturnValueError extends UndiciError {
|
|
1378
|
+
name: 'InvalidReturnValueError';
|
|
1379
|
+
code: 'UND_ERR_INVALID_RETURN_VALUE';
|
|
1380
|
+
}
|
|
1381
|
+
/** The request has been aborted by the user. */
|
|
1382
|
+
export class RequestAbortedError extends UndiciError {
|
|
1383
|
+
name: 'AbortError';
|
|
1384
|
+
code: 'UND_ERR_ABORTED';
|
|
1385
|
+
}
|
|
1386
|
+
/** Expected error with reason. */
|
|
1387
|
+
export class InformationalError extends UndiciError {
|
|
1388
|
+
name: 'InformationalError';
|
|
1389
|
+
code: 'UND_ERR_INFO';
|
|
1390
|
+
}
|
|
1391
|
+
/** Request body length does not match content-length header. */
|
|
1392
|
+
export class RequestContentLengthMismatchError extends UndiciError {
|
|
1393
|
+
name: 'RequestContentLengthMismatchError';
|
|
1394
|
+
code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH';
|
|
1395
|
+
}
|
|
1396
|
+
/** Response body length does not match content-length header. */
|
|
1397
|
+
export class ResponseContentLengthMismatchError extends UndiciError {
|
|
1398
|
+
name: 'ResponseContentLengthMismatchError';
|
|
1399
|
+
code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH';
|
|
1400
|
+
}
|
|
1401
|
+
/** Trying to use a destroyed client. */
|
|
1402
|
+
export class ClientDestroyedError extends UndiciError {
|
|
1403
|
+
name: 'ClientDestroyedError';
|
|
1404
|
+
code: 'UND_ERR_DESTROYED';
|
|
1405
|
+
}
|
|
1406
|
+
/** Trying to use a closed client. */
|
|
1407
|
+
export class ClientClosedError extends UndiciError {
|
|
1408
|
+
name: 'ClientClosedError';
|
|
1409
|
+
code: 'UND_ERR_CLOSED';
|
|
1410
|
+
}
|
|
1411
|
+
/** There is an error with the socket. */
|
|
1412
|
+
export class SocketError extends UndiciError {
|
|
1413
|
+
name: 'SocketError';
|
|
1414
|
+
code: 'UND_ERR_SOCKET';
|
|
1415
|
+
socket: Client.SocketInfo | null;
|
|
1416
|
+
}
|
|
1417
|
+
/** Encountered unsupported functionality. */
|
|
1418
|
+
export class NotSupportedError extends UndiciError {
|
|
1419
|
+
name: 'NotSupportedError';
|
|
1420
|
+
code: 'UND_ERR_NOT_SUPPORTED';
|
|
1421
|
+
}
|
|
1422
|
+
/** No upstream has been added to the BalancedPool. */
|
|
1423
|
+
export class BalancedPoolMissingUpstreamError extends UndiciError {
|
|
1424
|
+
name: 'MissingUpstreamError';
|
|
1425
|
+
code: 'UND_ERR_BPL_MISSING_UPSTREAM';
|
|
1426
|
+
}
|
|
1427
|
+
export class HTTPParserError extends UndiciError {
|
|
1428
|
+
name: 'HTTPParserError';
|
|
1429
|
+
code: string;
|
|
1430
|
+
}
|
|
1431
|
+
/** The response exceed the length allowed. */
|
|
1432
|
+
export class ResponseExceededMaxSizeError extends UndiciError {
|
|
1433
|
+
name: 'ResponseExceededMaxSizeError';
|
|
1434
|
+
code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE';
|
|
1435
|
+
}
|
|
1436
|
+
export class RequestRetryError extends UndiciError {
|
|
1437
|
+
constructor(message: string, statusCode: number, headers?: IncomingHttpHeaders | string[] | null, body?: null | Record<string, any> | string);
|
|
1438
|
+
name: 'RequestRetryError';
|
|
1439
|
+
code: 'UND_ERR_REQ_RETRY';
|
|
1440
|
+
statusCode: number;
|
|
1441
|
+
data: {
|
|
1442
|
+
count: number;
|
|
1443
|
+
};
|
|
1444
|
+
headers: Record<string, string | string[]>;
|
|
1445
|
+
}
|
|
1446
|
+
export class SecureProxyConnectionError extends UndiciError {
|
|
1447
|
+
constructor(cause?: Error, message?: string, options?: Record<any, any>);
|
|
1448
|
+
name: 'SecureProxyConnectionError';
|
|
1449
|
+
code: 'UND_ERR_PRX_TLS';
|
|
1450
|
+
}
|
|
1451
|
+
export class ProxyConnectionError extends UndiciError {
|
|
1452
|
+
constructor(cause?: Error, message?: string, options?: Record<any, any>);
|
|
1453
|
+
name: 'ProxyConnectionError';
|
|
1454
|
+
code: 'UND_ERR_PRX_CONN';
|
|
1455
|
+
}
|
|
1456
|
+
export class MaxOriginsReachedError extends UndiciError {
|
|
1457
|
+
name: 'MaxOriginsReachedError';
|
|
1458
|
+
code: 'UND_ERR_MAX_ORIGINS_REACHED';
|
|
1459
|
+
}
|
|
1460
|
+
/** SOCKS5 proxy related error. */
|
|
1461
|
+
export class Socks5ProxyError extends UndiciError {
|
|
1462
|
+
constructor(message?: string, code?: string);
|
|
1463
|
+
name: 'Socks5ProxyError';
|
|
1464
|
+
code: string;
|
|
1465
|
+
}
|
|
1466
|
+
/** WebSocket decompressed message exceeded maximum size. */
|
|
1467
|
+
export class MessageSizeExceededError extends UndiciError {
|
|
1468
|
+
name: 'MessageSizeExceededError';
|
|
1469
|
+
code: 'UND_ERR_WS_MESSAGE_SIZE_EXCEEDED';
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
//#endregion
|
|
1473
|
+
//#region node_modules/.pnpm/undici@8.10.0/node_modules/undici/types/dispatcher.d.ts
|
|
1474
|
+
type UndiciHeaders = OutgoingHttpHeaders | string[] | Iterable<[string, string | string[] | undefined]> | null;
|
|
1475
|
+
/** Dispatcher is the core API used to dispatch requests. */
|
|
1476
|
+
declare class Dispatcher extends EventEmitter {
|
|
1477
|
+
/** Dispatches a request. This API is expected to evolve through semver-major versions and is less stable than the preceding higher level APIs. It is primarily intended for library developers who implement higher level APIs on top of this. */
|
|
1478
|
+
dispatch(options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean;
|
|
1479
|
+
/** Starts two-way communications with the requested resource. */
|
|
1480
|
+
connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ConnectData<TOpaque>) => void): void;
|
|
1481
|
+
connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>): Promise<Dispatcher.ConnectData<TOpaque>>;
|
|
1482
|
+
/** Compose a chain of dispatchers */
|
|
1483
|
+
compose(dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher;
|
|
1484
|
+
compose(...dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher;
|
|
1485
|
+
/** Performs an HTTP request. */
|
|
1486
|
+
request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ResponseData<TOpaque>) => void): void;
|
|
1487
|
+
request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>): Promise<Dispatcher.ResponseData<TOpaque>>;
|
|
1488
|
+
/** For easy use with `stream.pipeline`. */
|
|
1489
|
+
pipeline<TOpaque = null>(options: Dispatcher.PipelineOptions<TOpaque>, handler: Dispatcher.PipelineHandler<TOpaque>): Duplex;
|
|
1490
|
+
/** A faster version of `Dispatcher.request`. */
|
|
1491
|
+
stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>, callback: (err: Error | null, data: Dispatcher.StreamData<TOpaque>) => void): void;
|
|
1492
|
+
stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>): Promise<Dispatcher.StreamData<TOpaque>>;
|
|
1493
|
+
/** Upgrade to a different protocol. */
|
|
1494
|
+
upgrade(options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void;
|
|
1495
|
+
upgrade(options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>;
|
|
1496
|
+
/** Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided). */
|
|
1497
|
+
close(callback: () => void): void;
|
|
1498
|
+
close(): Promise<void>;
|
|
1499
|
+
/** Destroy the client abruptly with the given err. All the pending and running requests will be asynchronously aborted and error. Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided). Since this operation is asynchronously dispatched there might still be some progress on dispatched requests. */
|
|
1500
|
+
destroy(err: Error | null, callback: () => void): void;
|
|
1501
|
+
destroy(callback: () => void): void;
|
|
1502
|
+
destroy(err: Error | null): Promise<void>;
|
|
1503
|
+
destroy(): Promise<void>;
|
|
1504
|
+
on(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
|
|
1505
|
+
on(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1506
|
+
on(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1507
|
+
on(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
1508
|
+
once(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
|
|
1509
|
+
once(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1510
|
+
once(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1511
|
+
once(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
1512
|
+
off(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
|
|
1513
|
+
off(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1514
|
+
off(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1515
|
+
off(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
1516
|
+
addListener(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
|
|
1517
|
+
addListener(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1518
|
+
addListener(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1519
|
+
addListener(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
1520
|
+
removeListener(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
|
|
1521
|
+
removeListener(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1522
|
+
removeListener(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1523
|
+
removeListener(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
1524
|
+
prependListener(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
|
|
1525
|
+
prependListener(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1526
|
+
prependListener(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1527
|
+
prependListener(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
1528
|
+
prependOnceListener(eventName: 'connect', callback: (origin: URL$1, targets: readonly Dispatcher[]) => void): this;
|
|
1529
|
+
prependOnceListener(eventName: 'disconnect', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1530
|
+
prependOnceListener(eventName: 'connectionError', callback: (origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
1531
|
+
prependOnceListener(eventName: 'drain', callback: (origin: URL$1) => void): this;
|
|
1532
|
+
listeners(eventName: 'connect'): ((origin: URL$1, targets: readonly Dispatcher[]) => void)[];
|
|
1533
|
+
listeners(eventName: 'disconnect'): ((origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
1534
|
+
listeners(eventName: 'connectionError'): ((origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
1535
|
+
listeners(eventName: 'drain'): ((origin: URL$1) => void)[];
|
|
1536
|
+
rawListeners(eventName: 'connect'): ((origin: URL$1, targets: readonly Dispatcher[]) => void)[];
|
|
1537
|
+
rawListeners(eventName: 'disconnect'): ((origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
1538
|
+
rawListeners(eventName: 'connectionError'): ((origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
1539
|
+
rawListeners(eventName: 'drain'): ((origin: URL$1) => void)[];
|
|
1540
|
+
emit(eventName: 'connect', origin: URL$1, targets: readonly Dispatcher[]): boolean;
|
|
1541
|
+
emit(eventName: 'disconnect', origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
|
|
1542
|
+
emit(eventName: 'connectionError', origin: URL$1, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
|
|
1543
|
+
emit(eventName: 'drain', origin: URL$1): boolean;
|
|
1544
|
+
}
|
|
1545
|
+
declare namespace Dispatcher {
|
|
1546
|
+
export interface ComposedDispatcher extends Dispatcher {}
|
|
1547
|
+
export type Dispatch = Dispatcher['dispatch'];
|
|
1548
|
+
export type DispatcherComposeInterceptor = (dispatch: Dispatch) => Dispatch;
|
|
1549
|
+
export interface DispatchOptions {
|
|
1550
|
+
origin?: string | URL$1;
|
|
1551
|
+
path: string;
|
|
1552
|
+
method: HttpMethod;
|
|
1553
|
+
/** Default: `null` */
|
|
1554
|
+
body?: string | Buffer | Uint8Array | Readable | null | FormData$1;
|
|
1555
|
+
/** Default: `null` */
|
|
1556
|
+
headers?: UndiciHeaders;
|
|
1557
|
+
/** Query string params to be embedded in the request URL. Default: `null` */
|
|
1558
|
+
query?: Record<string, any>;
|
|
1559
|
+
/** Whether the requests can be safely retried or not. If `false` the request won't be sent until all preceding requests in the pipeline have completed. Default: `true` if `method` is `HEAD` or `GET`. */
|
|
1560
|
+
idempotent?: boolean;
|
|
1561
|
+
/** Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received. Defaults to `method !== 'HEAD'`. */
|
|
1562
|
+
blocking?: boolean;
|
|
1563
|
+
/** The IP Type of Service (ToS) value for the request socket. Must be an integer between 0 and 255. */
|
|
1564
|
+
typeOfService?: number | null;
|
|
1565
|
+
/** Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`. Default: `method === 'CONNECT' || null`. */
|
|
1566
|
+
upgrade?: boolean | string | null;
|
|
1567
|
+
/** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. HTTP/1.1 parser timeouts are not guaranteed to fire with exact millisecond precision: delays up to 1000ms use native timers, while larger delays use lower-overhead fast timers with a target resolution around 500ms. */
|
|
1568
|
+
headersTimeout?: number | null;
|
|
1569
|
+
/** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use 0 to disable it entirely. Defaults to 300 seconds. HTTP/1.1 parser timeouts are not guaranteed to fire with exact millisecond precision: delays up to 1000ms use native timers, while larger delays use lower-overhead fast timers with a target resolution around 500ms. */
|
|
1570
|
+
bodyTimeout?: number | null;
|
|
1571
|
+
/** Whether the request should stablish a keep-alive or not. Default `false` */
|
|
1572
|
+
reset?: boolean;
|
|
1573
|
+
/** For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server */
|
|
1574
|
+
expectContinue?: boolean;
|
|
1575
|
+
}
|
|
1576
|
+
export interface ConnectOptions<TOpaque = null> {
|
|
1577
|
+
origin: string | URL$1;
|
|
1578
|
+
path: string;
|
|
1579
|
+
/** Default: `null` */
|
|
1580
|
+
headers?: UndiciHeaders;
|
|
1581
|
+
/** Default: `null` */
|
|
1582
|
+
signal?: AbortSignal | EventEmitter | null;
|
|
1583
|
+
/** This argument parameter is passed through to `ConnectData` */
|
|
1584
|
+
opaque?: TOpaque;
|
|
1585
|
+
/** Default: `null` */
|
|
1586
|
+
responseHeaders?: 'raw' | null;
|
|
1587
|
+
}
|
|
1588
|
+
export interface RequestOptions<TOpaque = null> extends DispatchOptions {
|
|
1589
|
+
/** Default: `null` */
|
|
1590
|
+
opaque?: TOpaque;
|
|
1591
|
+
/** Default: `null` */
|
|
1592
|
+
signal?: AbortSignal | EventEmitter | null;
|
|
1593
|
+
/** Default: `null` */
|
|
1594
|
+
onInfo?: (info: {
|
|
1595
|
+
statusCode: number;
|
|
1596
|
+
headers: Record<string, string | string[]>;
|
|
1597
|
+
}) => void;
|
|
1598
|
+
/** Default: `null` */
|
|
1599
|
+
responseHeaders?: 'raw' | null;
|
|
1600
|
+
/** Default: `64 KiB` */
|
|
1601
|
+
highWaterMark?: number;
|
|
1602
|
+
}
|
|
1603
|
+
export interface PipelineOptions<TOpaque = null> extends RequestOptions<TOpaque> {
|
|
1604
|
+
/** `true` if the `handler` will return an object stream. Default: `false` */
|
|
1605
|
+
objectMode?: boolean;
|
|
1606
|
+
}
|
|
1607
|
+
export interface UpgradeOptions {
|
|
1608
|
+
path: string;
|
|
1609
|
+
/** Default: `'GET'` */
|
|
1610
|
+
method?: string;
|
|
1611
|
+
/** Default: `null` */
|
|
1612
|
+
headers?: UndiciHeaders;
|
|
1613
|
+
/** A string of comma separated protocols, in descending preference order. Default: `'Websocket'` */
|
|
1614
|
+
protocol?: string;
|
|
1615
|
+
/** Default: `null` */
|
|
1616
|
+
signal?: AbortSignal | EventEmitter | null;
|
|
1617
|
+
/** Default: `null` */
|
|
1618
|
+
responseHeaders?: 'raw' | null;
|
|
1619
|
+
}
|
|
1620
|
+
export interface ConnectData<TOpaque = null> {
|
|
1621
|
+
statusCode: number;
|
|
1622
|
+
headers: IncomingHttpHeaders;
|
|
1623
|
+
socket: Duplex;
|
|
1624
|
+
opaque: TOpaque;
|
|
1625
|
+
}
|
|
1626
|
+
export interface ResponseData<TOpaque = null> {
|
|
1627
|
+
statusCode: number;
|
|
1628
|
+
statusText: string;
|
|
1629
|
+
headers: IncomingHttpHeaders;
|
|
1630
|
+
body: BodyReadable & BodyMixin;
|
|
1631
|
+
trailers: Record<string, string>;
|
|
1632
|
+
opaque: TOpaque;
|
|
1633
|
+
context: object;
|
|
1634
|
+
}
|
|
1635
|
+
export interface PipelineHandlerData<TOpaque = null> {
|
|
1636
|
+
statusCode: number;
|
|
1637
|
+
headers: IncomingHttpHeaders;
|
|
1638
|
+
opaque: TOpaque;
|
|
1639
|
+
body: BodyReadable;
|
|
1640
|
+
context: object;
|
|
1641
|
+
}
|
|
1642
|
+
export interface StreamData<TOpaque = null> {
|
|
1643
|
+
opaque: TOpaque;
|
|
1644
|
+
trailers: Record<string, string>;
|
|
1645
|
+
}
|
|
1646
|
+
export interface UpgradeData<TOpaque = null> {
|
|
1647
|
+
headers: IncomingHttpHeaders;
|
|
1648
|
+
socket: Duplex;
|
|
1649
|
+
opaque: TOpaque;
|
|
1650
|
+
}
|
|
1651
|
+
export interface StreamFactoryData<TOpaque = null> {
|
|
1652
|
+
statusCode: number;
|
|
1653
|
+
headers: IncomingHttpHeaders;
|
|
1654
|
+
opaque: TOpaque;
|
|
1655
|
+
context: object;
|
|
1656
|
+
}
|
|
1657
|
+
export type StreamFactory<TOpaque = null> = (data: StreamFactoryData<TOpaque>) => Writable;
|
|
1658
|
+
export interface DispatchController {
|
|
1659
|
+
get aborted(): boolean;
|
|
1660
|
+
get paused(): boolean;
|
|
1661
|
+
get reason(): Error | null;
|
|
1662
|
+
rawHeaders?: Buffer[] | string[] | IncomingHttpHeaders | null;
|
|
1663
|
+
rawTrailers?: Buffer[] | string[] | IncomingHttpHeaders | null;
|
|
1664
|
+
abort(reason: Error): void;
|
|
1665
|
+
pause(): void;
|
|
1666
|
+
resume(): void;
|
|
1667
|
+
}
|
|
1668
|
+
export interface DispatchHandler {
|
|
1669
|
+
onRequestStart?(controller: DispatchController, context: any): void;
|
|
1670
|
+
onRequestUpgrade?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders, socket: Duplex): void;
|
|
1671
|
+
onResponseStart?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders, statusMessage?: string): void;
|
|
1672
|
+
onResponseData?(controller: DispatchController, chunk: Buffer): void;
|
|
1673
|
+
onResponseEnd?(controller: DispatchController, trailers: IncomingHttpHeaders): void;
|
|
1674
|
+
onResponseError?(controller: DispatchController, error: Error): void;
|
|
1675
|
+
/** Invoked when response is received, before headers have been read. **/
|
|
1676
|
+
onResponseStarted?(): void;
|
|
1677
|
+
/** Invoked when a body chunk is sent to the server. May be invoked multiple times for chunked requests */
|
|
1678
|
+
onBodySent?(chunk: Buffer): void;
|
|
1679
|
+
/** Invoked after the request body is fully sent. */
|
|
1680
|
+
onRequestSent?(): void;
|
|
1681
|
+
}
|
|
1682
|
+
export type PipelineHandler<TOpaque = null> = (data: PipelineHandlerData<TOpaque>) => Readable;
|
|
1683
|
+
export type HttpMethod = Autocomplete<'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'>;
|
|
1684
|
+
/**
|
|
1685
|
+
* @link https://fetch.spec.whatwg.org/#body-mixin
|
|
1686
|
+
*/
|
|
1687
|
+
interface BodyMixin {
|
|
1688
|
+
readonly body?: never;
|
|
1689
|
+
readonly bodyUsed: boolean;
|
|
1690
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
1691
|
+
blob(): Promise<Blob$1>;
|
|
1692
|
+
bytes(): Promise<Uint8Array>;
|
|
1693
|
+
formData(): Promise<never>;
|
|
1694
|
+
json(): Promise<unknown>;
|
|
1695
|
+
text(): Promise<string>;
|
|
1696
|
+
}
|
|
1697
|
+
export interface DispatchInterceptor {
|
|
1698
|
+
(dispatch: Dispatch): Dispatch;
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
//#endregion
|
|
1702
|
+
//#region node_modules/.pnpm/undici@8.10.0/node_modules/undici/types/mock-interceptor.d.ts
|
|
1703
|
+
/** The scope associated with a mock dispatch. */
|
|
1704
|
+
declare class MockScope<TData extends object = object> {
|
|
1705
|
+
constructor(mockDispatch: MockInterceptor.MockDispatch<TData>);
|
|
1706
|
+
/** Delay a reply by a set amount of time in ms. */
|
|
1707
|
+
delay(waitInMs: number): MockScope<TData>;
|
|
1708
|
+
/** Persist the defined mock data for the associated reply. It will return the defined mock data indefinitely. */
|
|
1709
|
+
persist(): MockScope<TData>;
|
|
1710
|
+
/** Define a reply for a set amount of matching requests. */
|
|
1711
|
+
times(repeatTimes: number): MockScope<TData>;
|
|
1712
|
+
}
|
|
1713
|
+
/** The interceptor for a Mock. */
|
|
1714
|
+
declare class MockInterceptor {
|
|
1715
|
+
constructor(options: MockInterceptor.Options, mockDispatches: MockInterceptor.MockDispatch[]);
|
|
1716
|
+
/** Mock an undici request with the defined reply. */
|
|
1717
|
+
reply<TData extends object = object>(replyOptionsCallback: MockInterceptor.MockReplyOptionsCallback<TData>): MockScope<TData>;
|
|
1718
|
+
reply<TData extends object = object>(statusCode: number, data?: TData | Buffer | string | MockInterceptor.MockResponseDataHandler<TData>, responseOptions?: MockInterceptor.MockResponseOptions): MockScope<TData>;
|
|
1719
|
+
/** Mock an undici request by throwing the defined reply error. */
|
|
1720
|
+
replyWithError<TError extends Error = Error>(error: TError): MockScope;
|
|
1721
|
+
/** Set default reply headers on the interceptor for subsequent mocked replies. */
|
|
1722
|
+
defaultReplyHeaders(headers: IncomingHttpHeaders): MockInterceptor;
|
|
1723
|
+
/** Set default reply trailers on the interceptor for subsequent mocked replies. */
|
|
1724
|
+
defaultReplyTrailers(trailers: Record<string, string>): MockInterceptor;
|
|
1725
|
+
/** Set automatically calculated content-length header on subsequent mocked replies. */
|
|
1726
|
+
replyContentLength(): MockInterceptor;
|
|
1727
|
+
}
|
|
1728
|
+
declare namespace MockInterceptor {
|
|
1729
|
+
/** MockInterceptor options. */
|
|
1730
|
+
export interface Options {
|
|
1731
|
+
/** Path to intercept on. */
|
|
1732
|
+
path: string | RegExp | ((path: string) => boolean);
|
|
1733
|
+
/** Method to intercept on. Defaults to GET. */
|
|
1734
|
+
method?: string | RegExp | ((method: string) => boolean);
|
|
1735
|
+
/** Body to intercept on. */
|
|
1736
|
+
body?: string | RegExp | ((body: string) => boolean);
|
|
1737
|
+
/** Headers to intercept on. */
|
|
1738
|
+
headers?: Record<string, string | RegExp | ((body: string) => boolean)> | ((headers: Record<string, string>) => boolean);
|
|
1739
|
+
/** Query params to intercept on */
|
|
1740
|
+
query?: Record<string, any>;
|
|
1741
|
+
}
|
|
1742
|
+
export interface MockDispatch<TData extends object = object, TError extends Error = Error> extends Options {
|
|
1743
|
+
times: number | null;
|
|
1744
|
+
persist: boolean;
|
|
1745
|
+
consumed: boolean;
|
|
1746
|
+
data: MockDispatchData<TData, TError>;
|
|
1747
|
+
}
|
|
1748
|
+
export interface MockDispatchData<TData extends object = object, TError extends Error = Error> extends MockResponseOptions {
|
|
1749
|
+
error: TError | null;
|
|
1750
|
+
statusCode?: number;
|
|
1751
|
+
data?: TData | string;
|
|
1752
|
+
}
|
|
1753
|
+
export interface MockResponseOptions {
|
|
1754
|
+
headers?: IncomingHttpHeaders;
|
|
1755
|
+
trailers?: Record<string, string>;
|
|
1756
|
+
}
|
|
1757
|
+
export interface MockResponseCallbackOptions {
|
|
1758
|
+
path: string;
|
|
1759
|
+
method: string;
|
|
1760
|
+
headers?: Headers$1 | Record<string, string>;
|
|
1761
|
+
origin?: string;
|
|
1762
|
+
body?: BodyInit | Dispatcher.DispatchOptions['body'] | null;
|
|
1763
|
+
}
|
|
1764
|
+
export type MockResponseDataHandler<TData extends object = object> = (opts: MockResponseCallbackOptions) => TData | Buffer | string;
|
|
1765
|
+
export type MockReplyOptions<TData extends object = object> = {
|
|
1766
|
+
statusCode: number;
|
|
1767
|
+
data?: TData | Buffer | string;
|
|
1768
|
+
responseOptions?: MockResponseOptions;
|
|
1769
|
+
};
|
|
1770
|
+
export type MockReplyOptionsCallback<TData extends object = object> = (opts: MockResponseCallbackOptions) => MockReplyOptions<TData> | Promise<MockReplyOptions<TData>>;
|
|
1771
|
+
}
|
|
1772
|
+
//#endregion
|
|
1773
|
+
//#region node_modules/.pnpm/@earendil-works+pi-telemetry@0.84.1/node_modules/@earendil-works/pi-telemetry/dist/index.d.ts
|
|
1774
|
+
type AttributeValue = string | number | boolean | readonly string[] | readonly number[] | readonly boolean[];
|
|
1775
|
+
interface SpanAttributes {
|
|
1776
|
+
[name: string]: AttributeValue | undefined;
|
|
1777
|
+
}
|
|
1778
|
+
interface SpanOptions {
|
|
1779
|
+
name: string;
|
|
1780
|
+
attributes?: SpanAttributes;
|
|
1781
|
+
}
|
|
1782
|
+
type SpanStatus = {
|
|
1783
|
+
status: "ok";
|
|
1784
|
+
} | {
|
|
1785
|
+
status: "error";
|
|
1786
|
+
error?: {
|
|
1787
|
+
name: string;
|
|
1788
|
+
message: string;
|
|
1789
|
+
};
|
|
1790
|
+
};
|
|
1791
|
+
interface TelemetryContext {
|
|
1792
|
+
startSpan<T>(options: SpanOptions, callback: (span: TelemetrySpan) => T | Promise<T>): Promise<T>;
|
|
1793
|
+
}
|
|
1794
|
+
interface TelemetrySpan extends TelemetryContext {
|
|
1795
|
+
addEvent(name: string, attributes?: SpanAttributes): void;
|
|
1796
|
+
setAttributes(attributes: SpanAttributes): void;
|
|
1797
|
+
setStatus(status: SpanStatus): void;
|
|
1798
|
+
}
|
|
1799
|
+
//#endregion
|
|
1800
|
+
//#region node_modules/.pnpm/@earendil-works+pi-ai@0.84.1_ws@8.21.3_zod@4.4.3/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.d.ts
|
|
1801
|
+
interface DiagnosticErrorInfo {
|
|
1802
|
+
name?: string;
|
|
1803
|
+
message: string;
|
|
1804
|
+
stack?: string;
|
|
1805
|
+
code?: string | number;
|
|
1806
|
+
}
|
|
1807
|
+
interface AssistantMessageDiagnostic {
|
|
1808
|
+
type: string;
|
|
1809
|
+
timestamp: number;
|
|
1810
|
+
error?: DiagnosticErrorInfo;
|
|
1811
|
+
details?: Record<string, unknown>;
|
|
1812
|
+
}
|
|
1813
|
+
//#endregion
|
|
1814
|
+
//#region node_modules/.pnpm/@earendil-works+pi-ai@0.84.1_ws@8.21.3_zod@4.4.3/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts
|
|
1815
|
+
declare class EventStream<T, R = T> implements AsyncIterable<T> {
|
|
1816
|
+
private queue;
|
|
1817
|
+
private waiting;
|
|
1818
|
+
private done;
|
|
1819
|
+
private finalResultPromise;
|
|
1820
|
+
private resolveFinalResult;
|
|
1821
|
+
private isComplete;
|
|
1822
|
+
private extractResult;
|
|
1823
|
+
constructor(isComplete: (event: T) => boolean, extractResult: (event: T) => R);
|
|
1824
|
+
push(event: T): void;
|
|
1825
|
+
end(result?: R): void;
|
|
1826
|
+
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
1827
|
+
result(): Promise<R>;
|
|
1828
|
+
}
|
|
1829
|
+
declare class AssistantMessageEventStream$1 extends EventStream<AssistantMessageEvent, AssistantMessage$1> {
|
|
1830
|
+
constructor();
|
|
1831
|
+
}
|
|
1832
|
+
//#endregion
|
|
1833
|
+
//#region node_modules/.pnpm/@earendil-works+pi-ai@0.84.1_ws@8.21.3_zod@4.4.3/node_modules/@earendil-works/pi-ai/dist/types.d.ts
|
|
1834
|
+
type KnownApi = "openai-completions" | "mistral-conversations" | "openai-responses" | "azure-openai-responses" | "openai-codex-responses" | "anthropic-messages" | "bedrock-converse-stream" | "google-generative-ai" | "google-vertex" | "pi-messages";
|
|
1835
|
+
type Api$1 = KnownApi | (string & {});
|
|
1836
|
+
type KnownProvider = "amazon-bedrock" | "ant-ling" | "anthropic" | "google" | "google-vertex" | "openai" | "azure-openai-responses" | "openai-codex" | "radius" | "nvidia" | "deepseek" | "github-copilot" | "xai" | "groq" | "cerebras" | "openrouter" | "vercel-ai-gateway" | "zai" | "zai-coding-cn" | "mistral" | "minimax" | "minimax-cn" | "moonshotai" | "moonshotai-cn" | "huggingface" | "fireworks" | "together" | "baseten" | "opencode" | "opencode-go" | "kimi-coding" | "cloudflare-workers-ai" | "cloudflare-ai-gateway" | "qwen-token-plan" | "qwen-token-plan-cn" | "qwen-token-plan-individual" | "xiaomi" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-sgp";
|
|
1837
|
+
type ProviderId = KnownProvider | string;
|
|
1838
|
+
type ThinkingLevel$1 = "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
1839
|
+
type ModelThinkingLevel$1 = "off" | ThinkingLevel$1;
|
|
1840
|
+
type ThinkingLevelMap$1 = Partial<Record<ModelThinkingLevel$1, string | null>>;
|
|
1841
|
+
type ChatTemplateKwargValue = string | number | boolean | null | {
|
|
1842
|
+
$var: "thinking.enabled" | "thinking.effort";
|
|
1843
|
+
omitWhenOff?: boolean;
|
|
1844
|
+
};
|
|
1845
|
+
/** Token budgets for each thinking level (token-based providers only) */
|
|
1846
|
+
interface ThinkingBudgets {
|
|
1847
|
+
minimal?: number;
|
|
1848
|
+
low?: number;
|
|
1849
|
+
medium?: number;
|
|
1850
|
+
high?: number;
|
|
1851
|
+
}
|
|
1852
|
+
type CacheRetention = "none" | "short" | "long";
|
|
1853
|
+
type Transport = "sse" | "websocket" | "websocket-cached" | "auto";
|
|
1854
|
+
/** Provider-scoped environment overrides. Values take precedence over process.env. */
|
|
1855
|
+
type ProviderEnv = Record<string, string>;
|
|
1856
|
+
type ProviderHeaders = Record<string, string | null>;
|
|
1857
|
+
type FetchFunction = typeof globalThis.fetch;
|
|
1858
|
+
type SessionAffinityFormat = "openai" | "openai-nosession" | "openrouter";
|
|
1859
|
+
interface ProviderResponse {
|
|
1860
|
+
status: number;
|
|
1861
|
+
headers: Record<string, string>;
|
|
1862
|
+
}
|
|
1863
|
+
/** Authentication, HTTP transport, and lifecycle callbacks shared by provider requests. */
|
|
1864
|
+
interface ProviderRequestOptions<TModel = Model$1<Api$1>> {
|
|
1865
|
+
signal?: AbortSignal;
|
|
1866
|
+
/** Explicit parent context for telemetry produced by this logical request. */
|
|
1867
|
+
telemetryContext?: TelemetryContext;
|
|
1868
|
+
apiKey?: string;
|
|
1869
|
+
/**
|
|
1870
|
+
* Optional fetch implementation for provider HTTP requests.
|
|
1871
|
+
* Defaults to `globalThis.fetch`. Provider adapters that cannot inject a custom implementation may reject it.
|
|
1872
|
+
* This does not affect WebSocket transports.
|
|
1873
|
+
*/
|
|
1874
|
+
fetch?: FetchFunction;
|
|
1875
|
+
/**
|
|
1876
|
+
* Provider-scoped environment values. These take precedence over process.env for
|
|
1877
|
+
* provider configuration such as regional settings, endpoint placeholders, and
|
|
1878
|
+
* proxy variables.
|
|
1879
|
+
*/
|
|
1880
|
+
env?: ProviderEnv;
|
|
1881
|
+
/**
|
|
1882
|
+
* Optional callback for inspecting or replacing provider payloads before sending.
|
|
1883
|
+
* Return undefined to keep the payload unchanged.
|
|
1884
|
+
*/
|
|
1885
|
+
onPayload?: (payload: unknown, model: TModel) => unknown | undefined | Promise<unknown | undefined>;
|
|
1886
|
+
/**
|
|
1887
|
+
* Optional callback invoked after an HTTP response is received.
|
|
1888
|
+
*/
|
|
1889
|
+
onResponse?: (response: ProviderResponse, model: TModel) => void | Promise<void>;
|
|
1890
|
+
/**
|
|
1891
|
+
* Optional custom HTTP headers to include in API requests.
|
|
1892
|
+
* Merged with provider defaults; caller values override default headers.
|
|
1893
|
+
* On AWS Bedrock these are injected via a Smithy `build`-step middleware so
|
|
1894
|
+
* they are covered by SigV4 signing; reserved headers (`x-amz-*`,
|
|
1895
|
+
* `authorization`, `host`) are silently ignored to preserve SigV4 / bearer auth.
|
|
1896
|
+
* A null value suppresses a provider/API default header with the same name.
|
|
1897
|
+
*/
|
|
1898
|
+
headers?: ProviderHeaders;
|
|
1899
|
+
/**
|
|
1900
|
+
* HTTP request timeout in milliseconds for providers/SDKs that support it.
|
|
1901
|
+
* For example, OpenAI and Anthropic SDK clients default to 10 minutes.
|
|
1902
|
+
*/
|
|
1903
|
+
timeoutMs?: number;
|
|
1904
|
+
/**
|
|
1905
|
+
* Maximum retry attempts for providers/SDKs that support client-side retries.
|
|
1906
|
+
* For example, OpenAI and Anthropic SDK clients default to 2.
|
|
1907
|
+
*/
|
|
1908
|
+
maxRetries?: number;
|
|
1909
|
+
/**
|
|
1910
|
+
* Maximum delay in milliseconds to wait for a retry when the server requests a long wait.
|
|
1911
|
+
* If the server's requested delay exceeds this value, the request fails immediately
|
|
1912
|
+
* with an error containing the requested delay, allowing higher-level retry logic
|
|
1913
|
+
* to handle it with user visibility.
|
|
1914
|
+
* Default: 60000 (60 seconds). Set to 0 to disable the cap.
|
|
1915
|
+
*/
|
|
1916
|
+
maxRetryDelayMs?: number;
|
|
1917
|
+
}
|
|
1918
|
+
interface StreamOptions extends ProviderRequestOptions<Model$1<Api$1>> {
|
|
1919
|
+
/**
|
|
1920
|
+
* Optional callback invoked after an HTTP response is received and before
|
|
1921
|
+
* its body stream is consumed.
|
|
1922
|
+
*/
|
|
1923
|
+
onResponse?: (response: ProviderResponse, model: Model$1<Api$1>) => void | Promise<void>;
|
|
1924
|
+
temperature?: number;
|
|
1925
|
+
/**
|
|
1926
|
+
* Arbitrary sampling parameters merged into the request body as-is, after the named request
|
|
1927
|
+
* fields, so keys here override them. Lets custom OpenAI-compatible servers (llama.cpp, vLLM,
|
|
1928
|
+
* SGLang, ...) receive parameters pi does not model, e.g. `top_p`, `top_k`, `min_p`,
|
|
1929
|
+
* `repetition_penalty`. Merged over `Model.samplingParams` per key. Only applied by
|
|
1930
|
+
* OpenAI-compatible adapters (completions, responses, Azure responses); other APIs ignore it.
|
|
1931
|
+
*/
|
|
1932
|
+
samplingParams?: Record<string, unknown>;
|
|
1933
|
+
maxTokens?: number;
|
|
1934
|
+
/**
|
|
1935
|
+
* Preferred transport for providers that support multiple transports.
|
|
1936
|
+
* Providers that do not support this option ignore it.
|
|
1937
|
+
*/
|
|
1938
|
+
transport?: Transport;
|
|
1939
|
+
/**
|
|
1940
|
+
* Prompt cache retention preference. Providers map this to their supported values.
|
|
1941
|
+
* Default: "short".
|
|
1942
|
+
*/
|
|
1943
|
+
cacheRetention?: CacheRetention;
|
|
1944
|
+
/**
|
|
1945
|
+
* Optional session identifier for providers that support session-based caching.
|
|
1946
|
+
* Providers can use this to enable prompt caching, request routing, or other
|
|
1947
|
+
* session-aware features. Ignored by providers that don't support it.
|
|
1948
|
+
*/
|
|
1949
|
+
sessionId?: string;
|
|
1950
|
+
/**
|
|
1951
|
+
* WebSocket connect timeout in milliseconds for providers that support
|
|
1952
|
+
* WebSocket transports. This covers the connection/open handshake only;
|
|
1953
|
+
* stream idleness after connection uses timeoutMs.
|
|
1954
|
+
*/
|
|
1955
|
+
websocketConnectTimeoutMs?: number;
|
|
1956
|
+
/**
|
|
1957
|
+
* Optional metadata to include in API requests.
|
|
1958
|
+
* Providers extract the fields they understand and ignore the rest.
|
|
1959
|
+
* For example, Anthropic uses `user_id` for abuse tracking and rate limiting.
|
|
1960
|
+
*/
|
|
1961
|
+
metadata?: Record<string, unknown>;
|
|
1962
|
+
}
|
|
1963
|
+
interface SimpleStreamOptions extends StreamOptions {
|
|
1964
|
+
reasoning?: ThinkingLevel$1;
|
|
1965
|
+
/** Ask a capable provider to return a durable handle and continue the request asynchronously. */
|
|
1966
|
+
deferred?: boolean | {
|
|
1967
|
+
window?: "15m" | "1h" | "24h";
|
|
1968
|
+
};
|
|
1969
|
+
/** Custom token budgets for thinking levels (token-based providers only) */
|
|
1970
|
+
thinkingBudgets?: ThinkingBudgets;
|
|
1971
|
+
}
|
|
1972
|
+
type StreamFunction<TApi extends Api$1 = Api$1, TOptions extends StreamOptions = StreamOptions> = (model: Model$1<TApi>, context: Context, options?: TOptions) => AssistantMessageEventStream$1;
|
|
1973
|
+
interface TextContent$1 {
|
|
1974
|
+
type: "text";
|
|
1975
|
+
text: string;
|
|
1976
|
+
textSignature?: string;
|
|
1977
|
+
}
|
|
1978
|
+
interface ThinkingContent$1 {
|
|
1979
|
+
type: "thinking";
|
|
1980
|
+
thinking: string;
|
|
1981
|
+
thinkingSignature?: string;
|
|
1982
|
+
/** When true, the thinking content was redacted by safety filters. The opaque
|
|
1983
|
+
* encrypted payload is stored in `thinkingSignature` so it can be passed back
|
|
1984
|
+
* to the API for multi-turn continuity. */
|
|
1985
|
+
redacted?: boolean;
|
|
1986
|
+
}
|
|
1987
|
+
interface ImageContent$1 {
|
|
1988
|
+
type: "image";
|
|
1989
|
+
data: string;
|
|
1990
|
+
mimeType: string;
|
|
1991
|
+
}
|
|
1992
|
+
interface ToolCall$1 {
|
|
1993
|
+
type: "toolCall";
|
|
1994
|
+
id: string;
|
|
1995
|
+
name: string;
|
|
1996
|
+
arguments: Record<string, any>;
|
|
1997
|
+
thoughtSignature?: string;
|
|
1998
|
+
}
|
|
1999
|
+
interface Usage$2 {
|
|
2000
|
+
input: number;
|
|
2001
|
+
output: number;
|
|
2002
|
+
cacheRead: number;
|
|
2003
|
+
cacheWrite: number;
|
|
2004
|
+
/** Subset of `cacheWrite` written with 1h retention. Only Anthropic reports this split. */
|
|
2005
|
+
cacheWrite1h?: number;
|
|
2006
|
+
/**
|
|
2007
|
+
* Reasoning/thinking tokens, when the provider reports them. This is a subset of
|
|
2008
|
+
* `output`: `output` already includes these tokens. Set to a number (possibly 0) by
|
|
2009
|
+
* providers that expose a reasoning breakdown; left undefined by providers that don't.
|
|
2010
|
+
*/
|
|
2011
|
+
reasoning?: number;
|
|
2012
|
+
totalTokens: number;
|
|
2013
|
+
cost: {
|
|
2014
|
+
input: number;
|
|
2015
|
+
output: number;
|
|
2016
|
+
cacheRead: number;
|
|
2017
|
+
cacheWrite: number;
|
|
2018
|
+
total: number;
|
|
2019
|
+
};
|
|
2020
|
+
}
|
|
2021
|
+
type StopReason = "pending" | "stop" | "length" | "toolUse" | "error" | "aborted" | "deferred";
|
|
2022
|
+
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
2023
|
+
[key: string]: JsonValue;
|
|
2024
|
+
};
|
|
2025
|
+
interface DeferredHandle {
|
|
2026
|
+
provider: string;
|
|
2027
|
+
modelId: string;
|
|
2028
|
+
api: string;
|
|
2029
|
+
/** Provider token, such as a response id or batch id plus row id. */
|
|
2030
|
+
id: string;
|
|
2031
|
+
expiresAt?: number;
|
|
2032
|
+
pollAfterMs?: number;
|
|
2033
|
+
/** Provider conversion data required to reconstruct the final assistant message. */
|
|
2034
|
+
data?: JsonValue;
|
|
2035
|
+
}
|
|
2036
|
+
interface UserMessage$1 {
|
|
2037
|
+
role: "user";
|
|
2038
|
+
content: string | (TextContent$1 | ImageContent$1)[];
|
|
2039
|
+
timestamp: number;
|
|
2040
|
+
}
|
|
2041
|
+
interface AssistantMessage$1 {
|
|
2042
|
+
role: "assistant";
|
|
2043
|
+
content: (TextContent$1 | ThinkingContent$1 | ToolCall$1)[];
|
|
2044
|
+
api: Api$1;
|
|
2045
|
+
provider: ProviderId;
|
|
2046
|
+
model: string;
|
|
2047
|
+
responseModel?: string;
|
|
2048
|
+
responseId?: string;
|
|
2049
|
+
diagnostics?: AssistantMessageDiagnostic[];
|
|
2050
|
+
usage: Usage$2;
|
|
2051
|
+
stopReason: StopReason;
|
|
2052
|
+
deferred?: DeferredHandle;
|
|
2053
|
+
errorMessage?: string;
|
|
2054
|
+
rawStopReason?: string;
|
|
2055
|
+
timestamp: number;
|
|
2056
|
+
}
|
|
2057
|
+
interface ToolResultMessage$1<TDetails = any> {
|
|
2058
|
+
role: "toolResult";
|
|
2059
|
+
toolCallId: string;
|
|
2060
|
+
toolName: string;
|
|
2061
|
+
content: (TextContent$1 | ImageContent$1)[];
|
|
2062
|
+
details?: TDetails;
|
|
2063
|
+
/** Usage from the tool execution itself, if available. Not part of main LLM context accounting. */
|
|
2064
|
+
usage?: Usage$2;
|
|
2065
|
+
/**
|
|
2066
|
+
* Names from `Context.tools` that became available after this result.
|
|
2067
|
+
* Providers with native deferred tool loading use this as the load point;
|
|
2068
|
+
* other providers ignore it and use `Context.tools` normally.
|
|
2069
|
+
*/
|
|
2070
|
+
addedToolNames?: string[];
|
|
2071
|
+
isError: boolean;
|
|
2072
|
+
timestamp: number;
|
|
2073
|
+
}
|
|
2074
|
+
type Message$2 = UserMessage$1 | AssistantMessage$1 | ToolResultMessage$1;
|
|
2075
|
+
/** OpenAI grammar variants for constrained sampling. */
|
|
2076
|
+
type GrammarFormat = "openai_lark" | "openai_regex";
|
|
2077
|
+
type GrammarVariants = Partial<Record<GrammarFormat, string>>;
|
|
2078
|
+
/**
|
|
2079
|
+
* Optional provider-side constrained sampling configs for a tool.
|
|
2080
|
+
*
|
|
2081
|
+
* The `json_schema` value roughly maps to the concept of `strict` in APIs which is
|
|
2082
|
+
* implemented as json-schema constrained sampling by APIs. Grammar variants let
|
|
2083
|
+
* callers provide provider-specific encodings of the same intended language.
|
|
2084
|
+
*/
|
|
2085
|
+
type ConstrainedSamplingConfig = {
|
|
2086
|
+
type: "json_schema";
|
|
2087
|
+
strict: "prefer" | "require";
|
|
2088
|
+
} | {
|
|
2089
|
+
type: "grammar";
|
|
2090
|
+
variants: GrammarVariants;
|
|
2091
|
+
};
|
|
2092
|
+
interface Tool<TParameters extends TSchema$1 = TSchema$1> {
|
|
2093
|
+
name: string;
|
|
2094
|
+
description: string;
|
|
2095
|
+
parameters: TParameters;
|
|
2096
|
+
constrainedSampling?: false | ConstrainedSamplingConfig;
|
|
2097
|
+
}
|
|
2098
|
+
interface Context {
|
|
2099
|
+
systemPrompt?: string;
|
|
2100
|
+
messages: Message$2[];
|
|
2101
|
+
tools?: Tool[];
|
|
2102
|
+
}
|
|
2103
|
+
/**
|
|
2104
|
+
* Event protocol for AssistantMessageEventStream.
|
|
2105
|
+
*
|
|
2106
|
+
* Streams should emit `start` before partial updates, then terminate with either:
|
|
2107
|
+
* - `done` carrying the final successful AssistantMessage, or
|
|
2108
|
+
* - `error` carrying the final AssistantMessage with stopReason "error" or "aborted"
|
|
2109
|
+
* and errorMessage.
|
|
2110
|
+
*/
|
|
2111
|
+
type AssistantMessageEvent = {
|
|
2112
|
+
type: "start";
|
|
2113
|
+
partial: AssistantMessage$1;
|
|
2114
|
+
} | {
|
|
2115
|
+
type: "text_start";
|
|
2116
|
+
contentIndex: number;
|
|
2117
|
+
partial: AssistantMessage$1;
|
|
2118
|
+
} | {
|
|
2119
|
+
type: "text_delta";
|
|
2120
|
+
contentIndex: number;
|
|
2121
|
+
delta: string;
|
|
2122
|
+
partial: AssistantMessage$1;
|
|
2123
|
+
} | {
|
|
2124
|
+
type: "text_end";
|
|
2125
|
+
contentIndex: number;
|
|
2126
|
+
content: string;
|
|
2127
|
+
partial: AssistantMessage$1;
|
|
2128
|
+
} | {
|
|
2129
|
+
type: "thinking_start";
|
|
2130
|
+
contentIndex: number;
|
|
2131
|
+
partial: AssistantMessage$1;
|
|
2132
|
+
} | {
|
|
2133
|
+
type: "thinking_delta";
|
|
2134
|
+
contentIndex: number;
|
|
2135
|
+
delta: string;
|
|
2136
|
+
partial: AssistantMessage$1;
|
|
2137
|
+
} | {
|
|
2138
|
+
type: "thinking_end";
|
|
2139
|
+
contentIndex: number;
|
|
2140
|
+
content: string;
|
|
2141
|
+
partial: AssistantMessage$1;
|
|
2142
|
+
} | {
|
|
2143
|
+
type: "toolcall_start";
|
|
2144
|
+
contentIndex: number;
|
|
2145
|
+
partial: AssistantMessage$1;
|
|
2146
|
+
} | {
|
|
2147
|
+
type: "toolcall_delta";
|
|
2148
|
+
contentIndex: number;
|
|
2149
|
+
delta: string;
|
|
2150
|
+
partial: AssistantMessage$1;
|
|
2151
|
+
} | {
|
|
2152
|
+
type: "toolcall_end";
|
|
2153
|
+
contentIndex: number;
|
|
2154
|
+
toolCall: ToolCall$1;
|
|
2155
|
+
partial: AssistantMessage$1;
|
|
2156
|
+
} | {
|
|
2157
|
+
type: "done";
|
|
2158
|
+
reason: Extract<StopReason, "stop" | "length" | "toolUse" | "deferred">;
|
|
2159
|
+
message: AssistantMessage$1;
|
|
2160
|
+
} | {
|
|
2161
|
+
type: "error";
|
|
2162
|
+
reason: Extract<StopReason, "aborted" | "error">;
|
|
2163
|
+
error: AssistantMessage$1;
|
|
2164
|
+
};
|
|
2165
|
+
/**
|
|
2166
|
+
* Compatibility settings for OpenAI-compatible completions APIs.
|
|
2167
|
+
* Use this to override URL-based auto-detection for custom providers.
|
|
2168
|
+
*/
|
|
2169
|
+
interface OpenAICompletionsCompat {
|
|
2170
|
+
/** Whether the provider supports the `store` field. Default: auto-detected from URL. */
|
|
2171
|
+
supportsStore?: boolean;
|
|
2172
|
+
/** Whether the provider supports the `developer` role (vs `system`). Default: auto-detected from URL. */
|
|
2173
|
+
supportsDeveloperRole?: boolean;
|
|
2174
|
+
/** Whether the provider supports `reasoning_effort`. Default: auto-detected from URL. */
|
|
2175
|
+
supportsReasoningEffort?: boolean;
|
|
2176
|
+
/** Whether the provider supports `stream_options: { include_usage: true }` for token usage in streaming responses. Default: true. */
|
|
2177
|
+
supportsUsageInStreaming?: boolean;
|
|
2178
|
+
/** Whether streamed responses include `finish_reason`. When false, pi infers `stop` or `toolUse` when the stream ends. Default: true. */
|
|
2179
|
+
supportsFinishReason?: boolean;
|
|
2180
|
+
/** Which field to use for max tokens. Default: auto-detected from URL. */
|
|
2181
|
+
maxTokensField?: "max_completion_tokens" | "max_tokens";
|
|
2182
|
+
/** Whether tool results require the `name` field. Default: auto-detected from URL. */
|
|
2183
|
+
requiresToolResultName?: boolean;
|
|
2184
|
+
/** Whether a user message after tool results requires an assistant message in between. Default: auto-detected from URL. */
|
|
2185
|
+
requiresAssistantAfterToolResult?: boolean;
|
|
2186
|
+
/** Whether thinking blocks must be converted to text blocks with <thinking> delimiters. Default: auto-detected from URL. */
|
|
2187
|
+
requiresThinkingAsText?: boolean;
|
|
2188
|
+
/** Whether all replayed assistant messages must include an empty reasoning_content field when reasoning is enabled. Default: auto-detected from URL. */
|
|
2189
|
+
requiresReasoningContentOnAssistantMessages?: boolean;
|
|
2190
|
+
/** Format for reasoning/thinking parameter. "openai" uses reasoning_effort, "openrouter" uses reasoning: { effort }, "deepseek" uses thinking: { type } plus reasoning_effort when supported, "together" uses reasoning: { enabled } plus reasoning_effort when supported, "baseten" uses configurable chat_template_args plus reasoning_effort when supported, "zai" uses thinking: { type }, "qwen" uses top-level enable_thinking: boolean, "qwen-chat-template" uses chat_template_kwargs.enable_thinking and preserve_thinking, "chat-template" uses configurable chat_template_kwargs, "string-thinking" uses top-level thinking: string, and "ant-ling" uses reasoning: { effort } only when the mapped effort is non-null. Default: "openai". */
|
|
2191
|
+
thinkingFormat?: "openai" | "openrouter" | "deepseek" | "together" | "baseten" | "zai" | "qwen" | "chat-template" | "qwen-chat-template" | "string-thinking" | "ant-ling";
|
|
2192
|
+
/** Kwargs to send as `chat_template_kwargs` when `thinkingFormat` is `chat-template`. Use `{ "$var": "thinking.enabled" }` or `{ "$var": "thinking.effort" }` for pi-controlled thinking values. */
|
|
2193
|
+
chatTemplateKwargs?: Record<string, ChatTemplateKwargValue>;
|
|
2194
|
+
/** Arguments to send as `chat_template_args` when `thinkingFormat` is `baseten`. Use `{ "$var": "thinking.enabled" }` or `{ "$var": "thinking.effort" }` for pi-controlled thinking values. */
|
|
2195
|
+
chatTemplateArgs?: Record<string, ChatTemplateKwargValue>;
|
|
2196
|
+
/** OpenRouter-compatible routing preferences sent as the `provider` request field. */
|
|
2197
|
+
openRouterRouting?: OpenRouterRouting;
|
|
2198
|
+
/** Vercel AI Gateway routing preferences. Only used when baseUrl points to Vercel AI Gateway. */
|
|
2199
|
+
vercelGatewayRouting?: VercelGatewayRouting;
|
|
2200
|
+
/** Whether z.ai supports top-level `tool_stream: true` for streaming tool call deltas. Default: false. */
|
|
2201
|
+
zaiToolStream?: boolean;
|
|
2202
|
+
/** Whether the provider supports top-level `thinking_token_budget` to cap reasoning tokens (vLLM). Reasoning and the answer share `max_tokens` on these endpoints, so without a budget a reasoning-heavy turn can consume the whole response and emit no answer. Default: false. */
|
|
2203
|
+
supportsThinkingTokenBudget?: boolean;
|
|
2204
|
+
/** Whether the provider supports OpenAI custom tools with Lark/regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. Default: false; the generated model catalog enables it for capable models. */
|
|
2205
|
+
supportsOpenAIGrammarTools?: boolean;
|
|
2206
|
+
/** Whether the provider supports the `strict` field in tool definitions. Default: true. */
|
|
2207
|
+
supportsStrictMode?: boolean;
|
|
2208
|
+
/** Cache control convention for prompt caching. "anthropic" applies Anthropic-style `cache_control` markers to the system prompt, last tool definition, and last user, assistant, or tool-result text content. */
|
|
2209
|
+
cacheControlFormat?: "anthropic";
|
|
2210
|
+
/** Whether to send session-affinity data from `options.sessionId`. Default: false. */
|
|
2211
|
+
sendSessionAffinityHeaders?: boolean;
|
|
2212
|
+
/** Provider-specific deferred tool serialization mode. */
|
|
2213
|
+
deferredToolsMode?: "kimi";
|
|
2214
|
+
/** Session-affinity header format: `openai` sends `session_id`, `x-client-request-id`, and `x-session-affinity`; `openai-nosession` sends `x-client-request-id` and `x-session-affinity`; `openrouter` sends `x-session-id`. Does not affect the `prompt_cache_key` body param, which is governed by cache retention. Default: auto-detected. */
|
|
2215
|
+
sessionAffinityFormat?: SessionAffinityFormat;
|
|
2216
|
+
/** Whether the provider supports long prompt cache retention (`prompt_cache_retention: "24h"` or Anthropic-style `cache_control.ttl: "1h"`, depending on format). Default: true. */
|
|
2217
|
+
supportsLongCacheRetention?: boolean;
|
|
2218
|
+
}
|
|
2219
|
+
/** Compatibility settings for OpenAI Responses APIs. */
|
|
2220
|
+
interface OpenAIResponsesCompat {
|
|
2221
|
+
/** Whether the provider supports the `developer` role (vs `system`). Default: true. */
|
|
2222
|
+
supportsDeveloperRole?: boolean;
|
|
2223
|
+
/** Session-affinity header format: `openai` sends `session_id` and `x-client-request-id`; `openai-nosession` sends `x-client-request-id`; `openrouter` sends `x-session-id`. Does not affect the `prompt_cache_key` body param, which is governed by cache retention. Default: auto-detected. */
|
|
2224
|
+
sessionAffinityFormat?: SessionAffinityFormat;
|
|
2225
|
+
/** Whether the provider supports `prompt_cache_retention: "24h"`. Default: true. */
|
|
2226
|
+
supportsLongCacheRetention?: boolean;
|
|
2227
|
+
/** Whether the provider supports strict JSON-schema function tools. Defaults are API-specific; generated OpenAI models enable it explicitly. */
|
|
2228
|
+
supportsStrictMode?: boolean;
|
|
2229
|
+
/** Whether to emit OpenAI custom tools with Lark/regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. Default: false; the generated model catalog enables it for capable models. */
|
|
2230
|
+
supportsOpenAIGrammarTools?: boolean;
|
|
2231
|
+
/** Whether the model supports client-executed tool search for deferred tools. Default: false. */
|
|
2232
|
+
supportsToolSearch?: boolean;
|
|
2233
|
+
/** Whether the model accepts `prompt_cache_options` (OpenAI GPT-5.6+ explicit prompt caching). Older OpenAI models reject the parameter. Default: false. */
|
|
2234
|
+
supportsExplicitPromptCacheMode?: boolean;
|
|
2235
|
+
}
|
|
2236
|
+
/** Compatibility settings for Anthropic Messages-compatible APIs. */
|
|
2237
|
+
interface AnthropicMessagesCompat {
|
|
2238
|
+
/**
|
|
2239
|
+
* Whether the provider accepts per-tool `eager_input_streaming`.
|
|
2240
|
+
* When false, the Anthropic provider omits `tools[].eager_input_streaming`
|
|
2241
|
+
* and sends the legacy `fine-grained-tool-streaming-2025-05-14` beta header
|
|
2242
|
+
* for tool-enabled requests.
|
|
2243
|
+
* Default: true.
|
|
2244
|
+
*/
|
|
2245
|
+
supportsEagerToolInputStreaming?: boolean;
|
|
2246
|
+
/** Whether the provider supports Anthropic long cache retention (`cache_control.ttl: "1h"`). Default: true. */
|
|
2247
|
+
supportsLongCacheRetention?: boolean;
|
|
2248
|
+
/**
|
|
2249
|
+
* Whether to send the `x-session-affinity` header from `options.sessionId`
|
|
2250
|
+
* when caching is enabled. Required for providers like Fireworks that use
|
|
2251
|
+
* session affinity for prompt cache routing (requests to the same replica
|
|
2252
|
+
* maximize cache hits).
|
|
2253
|
+
* Default: false.
|
|
2254
|
+
*/
|
|
2255
|
+
sendSessionAffinityHeaders?: boolean;
|
|
2256
|
+
/**
|
|
2257
|
+
* Whether the provider supports Anthropic-style `cache_control` markers on
|
|
2258
|
+
* tool definitions. When false, `cache_control` is omitted from tool params.
|
|
2259
|
+
* Some Anthropic-compatible providers (e.g., Fireworks) do not support this
|
|
2260
|
+
* field on tools and may reject or ignore it.
|
|
2261
|
+
* Default: true.
|
|
2262
|
+
*/
|
|
2263
|
+
supportsCacheControlOnTools?: boolean;
|
|
2264
|
+
/**
|
|
2265
|
+
* Whether the model accepts the Anthropic `temperature` request field.
|
|
2266
|
+
* Claude Opus 4.7+ rejects non-default temperature values.
|
|
2267
|
+
* Default: true.
|
|
2268
|
+
*/
|
|
2269
|
+
supportsTemperature?: boolean;
|
|
2270
|
+
/**
|
|
2271
|
+
* Whether to force adaptive thinking (`thinking.type: "adaptive"` plus
|
|
2272
|
+
* `output_config.effort`) regardless of the model id. Built-in models that
|
|
2273
|
+
* require adaptive thinking set this in generated metadata. Custom
|
|
2274
|
+
* Anthropic-compatible providers can set this to `true` for any model whose
|
|
2275
|
+
* upstream requires the adaptive format. Set to `false` to
|
|
2276
|
+
* opt out on overridden built-in models.
|
|
2277
|
+
* Default: false.
|
|
2278
|
+
*/
|
|
2279
|
+
forceAdaptiveThinking?: boolean;
|
|
2280
|
+
/** Whether to replay empty thinking signatures as `signature: ""` instead of converting thinking to text. Default: false. */
|
|
2281
|
+
allowEmptySignature?: boolean;
|
|
2282
|
+
/** Whether the provider supports Anthropic strict tool schemas. Default: false; generated Anthropic models enable it explicitly. */
|
|
2283
|
+
supportsStrictTools?: boolean;
|
|
2284
|
+
/**
|
|
2285
|
+
* Whether the provider supports deferred tools loaded by `tool_reference`
|
|
2286
|
+
* blocks in tool results. Default: true for first-party Anthropic models
|
|
2287
|
+
* except Haiku and models older than Claude 4.5; false for other providers.
|
|
2288
|
+
*/
|
|
2289
|
+
supportsToolReferences?: boolean;
|
|
2290
|
+
}
|
|
2291
|
+
/** Compatibility settings for Amazon Bedrock models. */
|
|
2292
|
+
interface BedrockCompat {
|
|
2293
|
+
/** Whether the model supports Bedrock strict tool schemas. Default: false. */
|
|
2294
|
+
supportsStrictMode?: boolean;
|
|
2295
|
+
}
|
|
2296
|
+
/**
|
|
2297
|
+
* OpenRouter provider routing preferences.
|
|
2298
|
+
* Controls which upstream providers OpenRouter routes requests to.
|
|
2299
|
+
* Sent as the `provider` field in the OpenRouter API request body.
|
|
2300
|
+
* @see https://openrouter.ai/docs/guides/routing/provider-selection
|
|
2301
|
+
*/
|
|
2302
|
+
interface OpenRouterRouting {
|
|
2303
|
+
/** Whether to allow backup providers to serve requests. Default: true. */
|
|
2304
|
+
allow_fallbacks?: boolean;
|
|
2305
|
+
/** Whether to filter providers to only those that support all parameters in the request. Default: false. */
|
|
2306
|
+
require_parameters?: boolean;
|
|
2307
|
+
/** Data collection setting. "allow" (default): allow providers that may store/train on data. "deny": only use providers that don't collect user data. */
|
|
2308
|
+
data_collection?: "deny" | "allow";
|
|
2309
|
+
/** Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. */
|
|
2310
|
+
zdr?: boolean;
|
|
2311
|
+
/** Whether to restrict routing to only models that allow text distillation. */
|
|
2312
|
+
enforce_distillable_text?: boolean;
|
|
2313
|
+
/** An ordered list of provider names/slugs to try in sequence, falling back to the next if unavailable. */
|
|
2314
|
+
order?: string[];
|
|
2315
|
+
/** List of provider names/slugs to exclusively allow for this request. */
|
|
2316
|
+
only?: string[];
|
|
2317
|
+
/** List of provider names/slugs to skip for this request. */
|
|
2318
|
+
ignore?: string[];
|
|
2319
|
+
/** A list of quantization levels to filter providers by (e.g., ["fp16", "bf16", "fp8", "fp6", "int8", "int4", "fp4", "fp32"]). */
|
|
2320
|
+
quantizations?: string[];
|
|
2321
|
+
/** Sorting strategy. Can be a string (e.g., "price", "throughput", "latency") or an object with `by` and `partition`. */
|
|
2322
|
+
sort?: string | {
|
|
2323
|
+
/** The sorting metric: "price", "throughput", "latency". */
|
|
2324
|
+
by?: string;
|
|
2325
|
+
/** Partitioning strategy: "model" (default) or "none". */
|
|
2326
|
+
partition?: string | null;
|
|
2327
|
+
};
|
|
2328
|
+
/** Maximum price per million tokens (USD). */
|
|
2329
|
+
max_price?: {
|
|
2330
|
+
/** Price per million prompt tokens. */
|
|
2331
|
+
prompt?: number | string;
|
|
2332
|
+
/** Price per million completion tokens. */
|
|
2333
|
+
completion?: number | string;
|
|
2334
|
+
/** Price per image. */
|
|
2335
|
+
image?: number | string;
|
|
2336
|
+
/** Price per audio unit. */
|
|
2337
|
+
audio?: number | string;
|
|
2338
|
+
/** Price per request. */
|
|
2339
|
+
request?: number | string;
|
|
2340
|
+
};
|
|
2341
|
+
/** Preferred minimum throughput (tokens/second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */
|
|
2342
|
+
preferred_min_throughput?: number | {
|
|
2343
|
+
/** Minimum tokens/second at the 50th percentile. */
|
|
2344
|
+
p50?: number;
|
|
2345
|
+
/** Minimum tokens/second at the 75th percentile. */
|
|
2346
|
+
p75?: number;
|
|
2347
|
+
/** Minimum tokens/second at the 90th percentile. */
|
|
2348
|
+
p90?: number;
|
|
2349
|
+
/** Minimum tokens/second at the 99th percentile. */
|
|
2350
|
+
p99?: number;
|
|
2351
|
+
};
|
|
2352
|
+
/** Preferred maximum latency (seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */
|
|
2353
|
+
preferred_max_latency?: number | {
|
|
2354
|
+
/** Maximum latency in seconds at the 50th percentile. */
|
|
2355
|
+
p50?: number;
|
|
2356
|
+
/** Maximum latency in seconds at the 75th percentile. */
|
|
2357
|
+
p75?: number;
|
|
2358
|
+
/** Maximum latency in seconds at the 90th percentile. */
|
|
2359
|
+
p90?: number;
|
|
2360
|
+
/** Maximum latency in seconds at the 99th percentile. */
|
|
2361
|
+
p99?: number;
|
|
2362
|
+
};
|
|
2363
|
+
}
|
|
2364
|
+
/**
|
|
2365
|
+
* Vercel AI Gateway routing preferences.
|
|
2366
|
+
* Controls which upstream providers the gateway routes requests to.
|
|
2367
|
+
* @see https://vercel.com/docs/ai-gateway/models-and-providers/provider-options
|
|
2368
|
+
*/
|
|
2369
|
+
interface VercelGatewayRouting {
|
|
2370
|
+
/** List of provider slugs to exclusively use for this request (e.g., ["bedrock", "anthropic"]). */
|
|
2371
|
+
only?: string[];
|
|
2372
|
+
/** List of provider slugs to try in order (e.g., ["anthropic", "openai"]). */
|
|
2373
|
+
order?: string[];
|
|
2374
|
+
}
|
|
2375
|
+
interface ModelCostRates {
|
|
2376
|
+
input: number;
|
|
2377
|
+
output: number;
|
|
2378
|
+
cacheRead: number;
|
|
2379
|
+
cacheWrite: number;
|
|
2380
|
+
}
|
|
2381
|
+
interface ModelCostTier extends ModelCostRates {
|
|
2382
|
+
/** Use this tier for requests whose total input usage exceeds this token count. */
|
|
2383
|
+
inputTokensAbove: number;
|
|
2384
|
+
}
|
|
2385
|
+
interface ModelCost extends ModelCostRates {
|
|
2386
|
+
/** Request-wide pricing tiers. The highest matching input threshold applies to the full request. */
|
|
2387
|
+
tiers?: ModelCostTier[];
|
|
2388
|
+
}
|
|
2389
|
+
interface Model$1<TApi extends Api$1> {
|
|
2390
|
+
id: string;
|
|
2391
|
+
name: string;
|
|
2392
|
+
api: TApi;
|
|
2393
|
+
provider: ProviderId;
|
|
2394
|
+
baseUrl: string;
|
|
2395
|
+
reasoning: boolean;
|
|
2396
|
+
/**
|
|
2397
|
+
* Maps pi thinking levels to provider/model-specific values.
|
|
2398
|
+
* Missing keys use provider defaults. null marks a level as unsupported.
|
|
2399
|
+
*/
|
|
2400
|
+
thinkingLevelMap?: ThinkingLevelMap$1;
|
|
2401
|
+
input: ("text" | "image")[];
|
|
2402
|
+
cost: ModelCost;
|
|
2403
|
+
contextWindow: number;
|
|
2404
|
+
maxTokens: number;
|
|
2405
|
+
/** Default sampling parameters for this model. See {@link StreamOptions.samplingParams}; per-request keys override these. */
|
|
2406
|
+
samplingParams?: Record<string, unknown>;
|
|
2407
|
+
headers?: Record<string, string>;
|
|
2408
|
+
/** Compatibility overrides for OpenAI-compatible APIs. If not set, auto-detected from baseUrl. */
|
|
2409
|
+
compat?: TApi extends "openai-completions" ? OpenAICompletionsCompat : TApi extends "openai-responses" | "azure-openai-responses" | "openai-codex-responses" ? OpenAIResponsesCompat : TApi extends "anthropic-messages" ? AnthropicMessagesCompat : TApi extends "bedrock-converse-stream" ? BedrockCompat : never;
|
|
2410
|
+
}
|
|
2411
|
+
//#endregion
|
|
2412
|
+
//#region node_modules/.pnpm/@earendil-works+pi-ai@0.84.1_ws@8.21.3_zod@4.4.3/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts
|
|
2413
|
+
declare const streamSimple: StreamFunction<"openai-responses", SimpleStreamOptions>;
|
|
2414
|
+
//#endregion
|
|
139
2415
|
//#region src/compat/vendor/pi-oauth-flows/openai-codex.d.ts
|
|
140
2416
|
declare const openaiCodexOAuth: {
|
|
141
2417
|
name: string;
|
|
@@ -357,5 +2633,5 @@ declare function StringEnum<T extends readonly string[]>(values: T, options?: St
|
|
|
357
2633
|
default?: T[number];
|
|
358
2634
|
};
|
|
359
2635
|
//#endregion
|
|
360
|
-
export { type AgentMessage, Api, type AssistantMessage, AssistantMessageEventStream, type ImageContent, type Message, Model, ModelThinkingLevel, ModelsError, type Static, StringEnum, StringEnumOptions, type TSchema, type TextContent, type ThinkingContent, ThinkingLevel, ThinkingLevelMap, type ToolCallContent, type ToolResultMessage, Type, type Usage, type UserMessage, __getPiAiLlmBridge, __setPiAiLlmBridge, anthropicMessagesApi, anthropicOAuth, azureOpenAIResponsesApi, bedrockConverseStreamApi, builtinProviders, clampThinkingLevel, complete, contentText, createProvider, generatePKCE, getApiProvider, getApiProviders, getBuiltinModel, getBuiltinModels, getBuiltinProviders, getModel, getModels, getProvider, getProviders, getSupportedThinkingLevels, githubCopilotOAuth, googleGenerativeAIApi, googleVertexApi, isContextOverflow, isRecoverableLength, isRetryableAssistantError, kimiCodingOAuth, lazyApi, lazyStream, loadAnthropicOAuth, loadGitHubCopilotOAuth, loadKimiCodingOAuth, loadOpenAICodexOAuth, mistralConversationsApi, modelsAreEqual, openAICodexResponsesApi, openAICompletionsApi, openAIResponsesApi, openaiCodexOAuth, piMessagesApi, pollOAuthDeviceCodeFlow, registerApiProvider, registerProvider, stream, unregisterApiProviders, uuidv7 };
|
|
2636
|
+
export { type AgentMessage, Api, type AssistantMessage, AssistantMessageEventStream, type ImageContent, type Message$1 as Message, Model, ModelThinkingLevel, ModelsError, type Static$1 as Static, StringEnum, StringEnumOptions, type TSchema, type TextContent, type ThinkingContent, ThinkingLevel, ThinkingLevelMap, type ToolCallContent, type ToolResultMessage, Type, type Usage$1 as Usage, type UserMessage, __getPiAiLlmBridge, __setPiAiLlmBridge, anthropicMessagesApi, anthropicOAuth, azureOpenAIResponsesApi, bedrockConverseStreamApi, builtinProviders, clampThinkingLevel, complete, contentText, createProvider, generatePKCE, getApiProvider, getApiProviders, getBuiltinModel, getBuiltinModels, getBuiltinProviders, getModel, getModels, getProvider, getProviders, getSupportedThinkingLevels, githubCopilotOAuth, googleGenerativeAIApi, googleVertexApi, isContextOverflow, isRecoverableLength, isRetryableAssistantError, kimiCodingOAuth, lazyApi, lazyStream, loadAnthropicOAuth, loadGitHubCopilotOAuth, loadKimiCodingOAuth, loadOpenAICodexOAuth, mistralConversationsApi, modelsAreEqual, openAICodexResponsesApi, openAICompletionsApi, openAIResponsesApi, openaiCodexOAuth, piMessagesApi, pollOAuthDeviceCodeFlow, registerApiProvider, registerProvider, stream, streamSimple as streamSimpleOpenAIResponses, unregisterApiProviders, uuidv7 };
|
|
361
2637
|
//# sourceMappingURL=pi-ai.d.mts.map
|