stitchkit 0.136.2 → 0.136.4
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/CHANGELOG.md +14 -0
- package/dist/browser/http-fetch.d.ts +6 -0
- package/dist/browser/http-fetch.d.ts.map +1 -1
- package/dist/browser/http-helpers.d.ts +21 -0
- package/dist/browser/http-helpers.d.ts.map +1 -1
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/browser/socket-io-client.d.ts.map +1 -1
- package/dist/browser/socket-io-connection.d.ts +18 -15
- package/dist/browser/socket-io-connection.d.ts.map +1 -1
- package/dist/browser/socket-io-contract.d.ts +26 -13
- package/dist/browser/socket-io-contract.d.ts.map +1 -1
- package/dist/browser/socket-io-default-peer.d.ts +1 -1
- package/dist/browser/socket-io-default-peer.d.ts.map +1 -1
- package/dist/browser/socket-io-explicit-peer.d.ts.map +1 -1
- package/dist/browser/socket-io-peer.d.ts +10 -0
- package/dist/browser/socket-io-peer.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor/codex.js +2 -2
- package/dist/entrypoints/agent-executor/testing.js +2 -2
- package/dist/entrypoints/agent-runtime/harness.js +4 -4
- package/dist/entrypoints/agent-runtime/sandbox.js +1 -1
- package/dist/entrypoints/agent-runtime.js +4 -4
- package/dist/entrypoints/cli.js +3 -3
- package/dist/entrypoints/files.js +1 -1
- package/dist/entrypoints/handler.js +4 -4
- package/dist/entrypoints/http.js +6 -6
- package/dist/entrypoints/index.js +6 -5
- package/dist/entrypoints/node.js +3 -3
- package/dist/entrypoints/react.js +1 -1
- package/dist/entrypoints/realtime.js +3 -2
- package/dist/entrypoints/remote.js +2 -2
- package/dist/entrypoints/server.js +3 -3
- package/dist/entrypoints/sync.js +3 -3
- package/dist/entrypoints/testing.js +2 -2
- package/dist/entrypoints/tools/agent.js +3 -3
- package/dist/entrypoints/tools/invoker.js +2 -2
- package/dist/entrypoints/tools/mcp.js +3 -3
- package/dist/entrypoints/tools/toolkit.js +5 -5
- package/dist/entrypoints/tools.js +4 -4
- package/dist/{index-63ctzjp4.js → index-18qdpbcq.js} +2 -2
- package/dist/{index-8cnfgwg8.js → index-2331y2tf.js} +2 -2
- package/dist/{index-c7fj4yw9.js → index-2tgmggcm.js} +1 -1
- package/dist/{index-bjrcbcn2.js → index-2zrx0nzv.js} +1 -1
- package/dist/{index-yjx5jna7.js → index-3shdhzt6.js} +1 -1
- package/dist/{index-f0dzyskg.js → index-6f4fjygr.js} +1 -1
- package/dist/{index-y6wzzk2e.js → index-9fzjgg86.js} +1 -1
- package/dist/{index-ta0e2daw.js → index-cmqvf0dz.js} +2 -2
- package/dist/{index-cgjtj8zh.js → index-d01akj5n.js} +134 -25
- package/dist/{index-252den5a.js → index-ezwsqyad.js} +2 -2
- package/dist/{index-n2t87ggz.js → index-rr94xcj6.js} +137 -34
- package/dist/{index-k5azb3v3.js → index-vwg0n3e6.js} +2 -2
- package/llms/server.2.txt +1 -1
- package/llms/server.3.txt +18 -55
- package/llms/server.4.txt +56 -1
- package/llms/server.5.txt +1 -1
- package/llms/server.txt +1 -1
- package/llms/stitchkit.txt +10 -2
- package/llms-full.txt +27 -5
- package/llms.txt +2 -2
- package/package.json +1 -1
- package/dist/{index-b9mj31q7.js → index-9118dw8d.js} +0 -0
- package/dist/{index-kp1j7cc8.js → index-ca1v40d3.js} +3 -3
- /package/dist/{index-h08xqfw9.js → index-qqd979f7.js} +0 -0
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
createSocketIOServer2,
|
|
50
50
|
socketIoLane2,
|
|
51
51
|
createUnixClientTransport2
|
|
52
|
-
} from "../index-
|
|
52
|
+
} from "../index-cmqvf0dz.js";
|
|
53
53
|
import"../index-ha1tv70k.js";
|
|
54
54
|
import {
|
|
55
55
|
toJsonSchema,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
assertPrivateUnixSocketDirectory,
|
|
70
70
|
publishStagedUnixSocket,
|
|
71
71
|
bindUnixSocket2
|
|
72
|
-
} from "../index-
|
|
72
|
+
} from "../index-ca1v40d3.js";
|
|
73
73
|
import {
|
|
74
74
|
bindRealtimeServer2
|
|
75
75
|
} from "../index-y68gavb5.js";
|
|
@@ -86,7 +86,7 @@ import {
|
|
|
86
86
|
ndjsonRoute2,
|
|
87
87
|
sseRoute2,
|
|
88
88
|
createHandler2
|
|
89
|
-
} from "../index-
|
|
89
|
+
} from "../index-qqd979f7.js";
|
|
90
90
|
import {
|
|
91
91
|
secretsEqual
|
|
92
92
|
} from "../index-apv5xfef.js";
|
package/dist/entrypoints/sync.js
CHANGED
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
utf8ByteLength
|
|
7
7
|
} from "../index-f16b7rze.js";
|
|
8
|
+
import {
|
|
9
|
+
randomHex
|
|
10
|
+
} from "../index-c9d05kvt.js";
|
|
8
11
|
import {
|
|
9
12
|
assertPositiveSafeInteger,
|
|
10
13
|
assertNonNegativeSafeInteger
|
|
11
14
|
} from "../index-gr0kxymw.js";
|
|
12
|
-
import {
|
|
13
|
-
randomHex
|
|
14
|
-
} from "../index-c9d05kvt.js";
|
|
15
15
|
import {
|
|
16
16
|
assertTimerMs
|
|
17
17
|
} from "../index-e1y74yra.js";
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
} from "../index-m38ej7e5.js";
|
|
4
4
|
import"../index-q46b16xz.js";
|
|
5
5
|
import"../index-yrhw10ef.js";
|
|
6
|
-
import"../index-
|
|
6
|
+
import"../index-d01akj5n.js";
|
|
7
7
|
import {
|
|
8
8
|
createClient2,
|
|
9
9
|
createClients2
|
|
10
|
-
} from "../index-
|
|
10
|
+
} from "../index-6f4fjygr.js";
|
|
11
11
|
import"../index-5xsxvk2x.js";
|
|
12
12
|
import {
|
|
13
13
|
createApplication2
|
|
@@ -7,7 +7,7 @@ import"../../index-d1pdv8qc.js";
|
|
|
7
7
|
import"../../index-dsa676h8.js";
|
|
8
8
|
import"../../index-dm50x3by.js";
|
|
9
9
|
import"../../index-qj0sq69b.js";
|
|
10
|
-
import"../../index-
|
|
10
|
+
import"../../index-9118dw8d.js";
|
|
11
11
|
import"../../index-yt1gg11x.js";
|
|
12
12
|
import"../../index-edpkm3k7.js";
|
|
13
13
|
import"../../index-werjqesf.js";
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
} from "../../index-125ks2ec.js";
|
|
17
17
|
import {
|
|
18
18
|
buildAgentTools
|
|
19
|
-
} from "../../index-
|
|
20
|
-
import"../../index-
|
|
19
|
+
} from "../../index-vwg0n3e6.js";
|
|
20
|
+
import"../../index-2zrx0nzv.js";
|
|
21
21
|
import"../../index-7csn6pva.js";
|
|
22
22
|
import {
|
|
23
23
|
isRecord
|
|
@@ -3,12 +3,12 @@ import"../../index-ha1tv70k.js";
|
|
|
3
3
|
import"../../index-d1pdv8qc.js";
|
|
4
4
|
import"../../index-dm50x3by.js";
|
|
5
5
|
import"../../index-qj0sq69b.js";
|
|
6
|
-
import"../../index-
|
|
6
|
+
import"../../index-9118dw8d.js";
|
|
7
7
|
import"../../index-yt1gg11x.js";
|
|
8
8
|
import"../../index-edpkm3k7.js";
|
|
9
9
|
import {
|
|
10
10
|
createToolInvoker2
|
|
11
|
-
} from "../../index-
|
|
11
|
+
} from "../../index-3shdhzt6.js";
|
|
12
12
|
export {
|
|
13
13
|
createToolInvoker2 as createToolInvoker
|
|
14
14
|
};
|
|
@@ -4,7 +4,7 @@ import"../../index-ha1tv70k.js";
|
|
|
4
4
|
import"../../index-d1pdv8qc.js";
|
|
5
5
|
import"../../index-dm50x3by.js";
|
|
6
6
|
import"../../index-qj0sq69b.js";
|
|
7
|
-
import"../../index-
|
|
7
|
+
import"../../index-9118dw8d.js";
|
|
8
8
|
import"../../index-yt1gg11x.js";
|
|
9
9
|
import"../../index-edpkm3k7.js";
|
|
10
10
|
import"../../index-0x4mnwg5.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
createMcpHandler2,
|
|
21
21
|
createMcpHttpRoute2,
|
|
22
22
|
createStdioMcpServer2
|
|
23
|
-
} from "../../index-
|
|
23
|
+
} from "../../index-ezwsqyad.js";
|
|
24
24
|
import {
|
|
25
25
|
DEFAULT_PROCESS_SIGNALS,
|
|
26
26
|
defaultSignalSource,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
mcpCatalogMeta2,
|
|
35
35
|
readMcpCatalogStamp2
|
|
36
36
|
} from "../../index-5t4fpdct.js";
|
|
37
|
-
import"../../index-
|
|
37
|
+
import"../../index-2zrx0nzv.js";
|
|
38
38
|
import"../../index-7csn6pva.js";
|
|
39
39
|
// src/tools/mcp/stdio-signals.ts
|
|
40
40
|
var bound = new WeakSet;
|
|
@@ -3,13 +3,13 @@ import"../../index-d1pdv8qc.js";
|
|
|
3
3
|
import"../../index-dsa676h8.js";
|
|
4
4
|
import"../../index-dm50x3by.js";
|
|
5
5
|
import"../../index-qj0sq69b.js";
|
|
6
|
-
import"../../index-
|
|
6
|
+
import"../../index-9118dw8d.js";
|
|
7
7
|
import"../../index-yt1gg11x.js";
|
|
8
8
|
import"../../index-edpkm3k7.js";
|
|
9
9
|
import"../../index-werjqesf.js";
|
|
10
10
|
import {
|
|
11
11
|
createCli2
|
|
12
|
-
} from "../../index-
|
|
12
|
+
} from "../../index-18qdpbcq.js";
|
|
13
13
|
import"../../index-0x4mnwg5.js";
|
|
14
14
|
import"../../index-6kec3b14.js";
|
|
15
15
|
import"../../index-gy9x38a2.js";
|
|
@@ -20,15 +20,15 @@ import {
|
|
|
20
20
|
buildMcpServer2,
|
|
21
21
|
createMcpHandler2,
|
|
22
22
|
createStdioMcpServer2
|
|
23
|
-
} from "../../index-
|
|
23
|
+
} from "../../index-ezwsqyad.js";
|
|
24
24
|
import"../../index-efbzm2se.js";
|
|
25
25
|
import"../../index-a09r9ff0.js";
|
|
26
26
|
import {
|
|
27
27
|
mountAgentTools2
|
|
28
|
-
} from "../../index-
|
|
28
|
+
} from "../../index-vwg0n3e6.js";
|
|
29
29
|
import"../../index-rjs94dny.js";
|
|
30
30
|
import"../../index-xrgn784x.js";
|
|
31
|
-
import"../../index-
|
|
31
|
+
import"../../index-2zrx0nzv.js";
|
|
32
32
|
import"../../index-7csn6pva.js";
|
|
33
33
|
|
|
34
34
|
// src/tools/toolkit.ts
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
ToolExecutionControlError2,
|
|
19
19
|
isToolExecutionControlError2,
|
|
20
20
|
collectTools2
|
|
21
|
-
} from "../index-
|
|
21
|
+
} from "../index-9118dw8d.js";
|
|
22
22
|
import {
|
|
23
23
|
ALL_TRANSPORTS2,
|
|
24
24
|
TOOL_TRANSPORTS2
|
|
@@ -81,14 +81,14 @@ import {
|
|
|
81
81
|
import {
|
|
82
82
|
defineAgentTool2,
|
|
83
83
|
mountAgentTools2
|
|
84
|
-
} from "../index-
|
|
84
|
+
} from "../index-vwg0n3e6.js";
|
|
85
85
|
import {
|
|
86
86
|
AgentToolError2,
|
|
87
87
|
isAgentToolError2
|
|
88
88
|
} from "../index-1psbyyhj.js";
|
|
89
89
|
import {
|
|
90
90
|
createToolInvoker2
|
|
91
|
-
} from "../index-
|
|
91
|
+
} from "../index-3shdhzt6.js";
|
|
92
92
|
import {
|
|
93
93
|
WaitTimeoutError,
|
|
94
94
|
runWaitOperation,
|
|
@@ -101,7 +101,7 @@ import {
|
|
|
101
101
|
} from "../index-dz6tstcp.js";
|
|
102
102
|
import {
|
|
103
103
|
collectToolSurface
|
|
104
|
-
} from "../index-
|
|
104
|
+
} from "../index-2zrx0nzv.js";
|
|
105
105
|
import {
|
|
106
106
|
getTraceId2
|
|
107
107
|
} from "../index-q4tr9vnf.js";
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
toolCauseFromResult,
|
|
33
33
|
createToolRunner,
|
|
34
34
|
formatToolError
|
|
35
|
-
} from "./index-
|
|
35
|
+
} from "./index-9118dw8d.js";
|
|
36
36
|
import {
|
|
37
37
|
isRepeatableRead
|
|
38
38
|
} from "./index-0x4mnwg5.js";
|
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
} from "./index-9vj869rx.js";
|
|
68
68
|
import {
|
|
69
69
|
collectToolSurface
|
|
70
|
-
} from "./index-
|
|
70
|
+
} from "./index-2zrx0nzv.js";
|
|
71
71
|
import {
|
|
72
72
|
validateDeclaredOutput
|
|
73
73
|
} from "./index-dwq6a6sq.js";
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
import {
|
|
47
47
|
ToolExecutionControlError2,
|
|
48
48
|
isToolExecutionControlError2
|
|
49
|
-
} from "./index-
|
|
49
|
+
} from "./index-9118dw8d.js";
|
|
50
50
|
import {
|
|
51
51
|
AGENT_TOOL_PROGRESS_MESSAGE_MAX2,
|
|
52
52
|
agentDurableEventId2
|
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
} from "./index-fatke81t.js";
|
|
97
97
|
import {
|
|
98
98
|
finalizeAgentToolOutput
|
|
99
|
-
} from "./index-
|
|
99
|
+
} from "./index-vwg0n3e6.js";
|
|
100
100
|
import {
|
|
101
101
|
AgentToolError2,
|
|
102
102
|
isAgentToolError2
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
assertUnixSocketPathLength,
|
|
6
6
|
assertExpectedOwnerUid,
|
|
7
7
|
assertUnixSocketClientTarget
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-ca1v40d3.js";
|
|
9
9
|
import {
|
|
10
10
|
DEFAULT_REQUEST_BODY_BYTES
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-qqd979f7.js";
|
|
12
12
|
import {
|
|
13
13
|
secretsEqual
|
|
14
14
|
} from "./index-apv5xfef.js";
|
|
@@ -14,11 +14,15 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
utf8ByteLength
|
|
16
16
|
} from "./index-f16b7rze.js";
|
|
17
|
+
import {
|
|
18
|
+
assertNonNegativeSafeInteger
|
|
19
|
+
} from "./index-gr0kxymw.js";
|
|
17
20
|
import {
|
|
18
21
|
assertTimerMs
|
|
19
22
|
} from "./index-e1y74yra.js";
|
|
20
23
|
import {
|
|
21
24
|
abortReason,
|
|
25
|
+
untilAborted,
|
|
22
26
|
linkAbortSignals
|
|
23
27
|
} from "./index-rptj3qnc.js";
|
|
24
28
|
import {
|
|
@@ -30,6 +34,87 @@ import {
|
|
|
30
34
|
} from "./index-ps3djm8d.js";
|
|
31
35
|
|
|
32
36
|
// src/browser/http-fetch.ts
|
|
37
|
+
function buildMaterializedInit(input, init, headers, signal, body, unix) {
|
|
38
|
+
const materialized = {
|
|
39
|
+
...init,
|
|
40
|
+
...unix !== undefined && { unix },
|
|
41
|
+
method: init?.method ?? input.method,
|
|
42
|
+
headers,
|
|
43
|
+
...body !== undefined && { body },
|
|
44
|
+
cache: init?.cache ?? input.cache,
|
|
45
|
+
credentials: init?.credentials ?? input.credentials,
|
|
46
|
+
integrity: init?.integrity ?? input.integrity,
|
|
47
|
+
keepalive: init?.keepalive ?? input.keepalive,
|
|
48
|
+
mode: init?.mode ?? input.mode,
|
|
49
|
+
redirect: init?.redirect ?? input.redirect,
|
|
50
|
+
referrer: init?.referrer ?? input.referrer,
|
|
51
|
+
referrerPolicy: init?.referrerPolicy ?? input.referrerPolicy,
|
|
52
|
+
...signal !== undefined && { signal }
|
|
53
|
+
};
|
|
54
|
+
if (init?.body === undefined && "duplex" in materialized) {
|
|
55
|
+
Reflect.deleteProperty(materialized, "duplex");
|
|
56
|
+
}
|
|
57
|
+
return materialized;
|
|
58
|
+
}
|
|
59
|
+
function concatChunks(chunks, totalBytes) {
|
|
60
|
+
if (totalBytes === 0)
|
|
61
|
+
return new ArrayBuffer(0);
|
|
62
|
+
if (chunks.length === 1) {
|
|
63
|
+
const [only] = chunks;
|
|
64
|
+
if (only) {
|
|
65
|
+
if (only.byteOffset === 0 && only.byteLength === only.buffer.byteLength && only.buffer instanceof ArrayBuffer) {
|
|
66
|
+
return only.buffer;
|
|
67
|
+
}
|
|
68
|
+
return only.slice().buffer;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const merged = new Uint8Array(totalBytes);
|
|
72
|
+
let offset = 0;
|
|
73
|
+
for (const chunk of chunks) {
|
|
74
|
+
merged.set(chunk, offset);
|
|
75
|
+
offset += chunk.byteLength;
|
|
76
|
+
}
|
|
77
|
+
return merged.buffer;
|
|
78
|
+
}
|
|
79
|
+
async function readRequestBodyBytes(input, signal) {
|
|
80
|
+
if (!signal || !input.body)
|
|
81
|
+
return input.arrayBuffer();
|
|
82
|
+
const reader = input.body.getReader();
|
|
83
|
+
const chunks = [];
|
|
84
|
+
let totalBytes = 0;
|
|
85
|
+
let cancelled = false;
|
|
86
|
+
try {
|
|
87
|
+
for (;; ) {
|
|
88
|
+
const outcome = await untilAborted(reader.read(), signal);
|
|
89
|
+
if (outcome.aborted) {
|
|
90
|
+
cancelled = true;
|
|
91
|
+
reader.cancel(abortReason(signal)).catch(() => {
|
|
92
|
+
return;
|
|
93
|
+
}).finally(() => {
|
|
94
|
+
try {
|
|
95
|
+
reader.releaseLock();
|
|
96
|
+
} catch {}
|
|
97
|
+
});
|
|
98
|
+
throw abortReason(signal);
|
|
99
|
+
}
|
|
100
|
+
if (outcome.value.done)
|
|
101
|
+
return concatChunks(chunks, totalBytes);
|
|
102
|
+
chunks.push(outcome.value.value);
|
|
103
|
+
totalBytes += outcome.value.value.byteLength;
|
|
104
|
+
}
|
|
105
|
+
} finally {
|
|
106
|
+
if (!cancelled) {
|
|
107
|
+
try {
|
|
108
|
+
reader.releaseLock();
|
|
109
|
+
} catch {}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async function dispatchMaterializedBody(runtimeFetch, input, init, signal, unix) {
|
|
114
|
+
const headers = init?.headers !== undefined ? new Headers(init.headers) : new Headers(input.headers);
|
|
115
|
+
const body = await readRequestBodyBytes(input, signal);
|
|
116
|
+
return runtimeFetch(input.url, buildMaterializedInit(input, init, headers, signal, body, unix));
|
|
117
|
+
}
|
|
33
118
|
function createRetryAwareFetch(transportFetch, unix) {
|
|
34
119
|
const runtimeFetch = transportFetch;
|
|
35
120
|
let attempt = 0;
|
|
@@ -44,24 +129,15 @@ function createRetryAwareFetch(transportFetch, unix) {
|
|
|
44
129
|
const unixInit = { ...init, unix };
|
|
45
130
|
return runtimeFetch(input, unixInit);
|
|
46
131
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
integrity: input.integrity,
|
|
57
|
-
keepalive: input.keepalive,
|
|
58
|
-
mode: input.mode,
|
|
59
|
-
redirect: input.redirect,
|
|
60
|
-
referrer: input.referrer,
|
|
61
|
-
referrerPolicy: input.referrerPolicy,
|
|
62
|
-
signal: input.signal
|
|
63
|
-
};
|
|
64
|
-
return runtimeFetch(input.url, materialized);
|
|
132
|
+
if (unix === undefined && input.body === undefined) {
|
|
133
|
+
return runtimeFetch(input, init);
|
|
134
|
+
}
|
|
135
|
+
const signal = init?.signal !== undefined ? init.signal : input.signal;
|
|
136
|
+
if (init?.body === undefined && input.body !== null && input.body !== undefined && !signal?.aborted) {
|
|
137
|
+
return dispatchMaterializedBody(runtimeFetch, input, init, signal, unix);
|
|
138
|
+
}
|
|
139
|
+
const headers = init?.headers !== undefined ? new Headers(init.headers) : new Headers(input.headers);
|
|
140
|
+
return runtimeFetch(input.url, buildMaterializedInit(input, init, headers, signal, undefined, unix));
|
|
65
141
|
};
|
|
66
142
|
}
|
|
67
143
|
function searchParamsOf(params) {
|
|
@@ -220,6 +296,37 @@ function responseTraceId(response) {
|
|
|
220
296
|
}
|
|
221
297
|
|
|
222
298
|
// src/browser/http-helpers.ts
|
|
299
|
+
var DEFAULT_RETRY_METHODS = ["get", "head"];
|
|
300
|
+
function normalizeClientRetryConfig(retry) {
|
|
301
|
+
if (retry !== undefined && (typeof retry !== "object" || retry === null || Array.isArray(retry))) {
|
|
302
|
+
throw new TypeError("HttpClientConfig.retry must be an object");
|
|
303
|
+
}
|
|
304
|
+
assertNonNegativeSafeInteger("HttpClientConfig.retry.limit", retry?.limit);
|
|
305
|
+
const limit = retry?.limit ?? 2;
|
|
306
|
+
const rawMethods = retry?.methods ?? DEFAULT_RETRY_METHODS;
|
|
307
|
+
if (!Array.isArray(rawMethods) || !rawMethods.every((entry) => typeof entry === "string")) {
|
|
308
|
+
throw new TypeError("HttpClientConfig.retry.methods must be an array of strings");
|
|
309
|
+
}
|
|
310
|
+
const methods = rawMethods.map((entry) => entry.toLowerCase());
|
|
311
|
+
const rawStatusCodes = retry?.statusCodes ?? [];
|
|
312
|
+
if (!Array.isArray(rawStatusCodes) || !rawStatusCodes.every((code) => Number.isSafeInteger(code))) {
|
|
313
|
+
throw new TypeError("HttpClientConfig.retry.statusCodes must be an array of integers");
|
|
314
|
+
}
|
|
315
|
+
return {
|
|
316
|
+
limit,
|
|
317
|
+
methods,
|
|
318
|
+
methodSet: new Set(methods),
|
|
319
|
+
statusCodes: [...rawStatusCodes]
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
function resolveCallRetry(retry, method, idempotent) {
|
|
323
|
+
const methodRetries = idempotent ?? retry.methodSet.has(method);
|
|
324
|
+
if (!methodRetries)
|
|
325
|
+
return { limit: 0 };
|
|
326
|
+
if (idempotent === true)
|
|
327
|
+
return { methods: [method] };
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
223
330
|
function assertTransportChoice(config) {
|
|
224
331
|
if (config.fetch && config.unix) {
|
|
225
332
|
throw new TypeError("HttpClientConfig.fetch and unix are mutually exclusive");
|
|
@@ -564,6 +671,7 @@ function resolveOutboundDeadlineAt(options, config, effectiveTimeoutMs) {
|
|
|
564
671
|
function createHttpClient2(config) {
|
|
565
672
|
assertTransportChoice(config);
|
|
566
673
|
assertTimerMs("HTTP client timeout", config.timeout);
|
|
674
|
+
const retryConfig = normalizeClientRetryConfig(config.retry);
|
|
567
675
|
let ssrCookies = null;
|
|
568
676
|
let isLoggedOut = false;
|
|
569
677
|
const listeners = new Set;
|
|
@@ -581,9 +689,9 @@ function createHttpClient2(config) {
|
|
|
581
689
|
credentials: config.credentials ?? "include",
|
|
582
690
|
timeout: false,
|
|
583
691
|
retry: {
|
|
584
|
-
limit:
|
|
585
|
-
methods:
|
|
586
|
-
statusCodes:
|
|
692
|
+
limit: retryConfig.limit,
|
|
693
|
+
methods: [...retryConfig.methods],
|
|
694
|
+
statusCodes: [...retryConfig.statusCodes],
|
|
587
695
|
shouldRetry: ({ error }) => shouldRetryBunNetworkError(error)
|
|
588
696
|
},
|
|
589
697
|
hooks: {
|
|
@@ -653,20 +761,21 @@ function createHttpClient2(config) {
|
|
|
653
761
|
throw cause;
|
|
654
762
|
});
|
|
655
763
|
};
|
|
764
|
+
const isFormData = typeof FormData === "function" && data instanceof FormData;
|
|
765
|
+
const callRetry = resolveCallRetry(retryConfig, method, options.idempotent);
|
|
656
766
|
const kyOptions = {
|
|
657
767
|
fetch: createRetryAwareFetch(options.onUploadProgress ? withUploadProgress(transport, options.onUploadProgress, {
|
|
658
768
|
route: uploadProgressRoute(config.fetch !== undefined || config.unix !== undefined),
|
|
659
|
-
nativeBody:
|
|
769
|
+
nativeBody: isFormData ? data : jsonBodyOf(data),
|
|
660
770
|
responseType: options.responseType
|
|
661
771
|
}) : transport, config.unix),
|
|
662
772
|
timeout: false,
|
|
663
|
-
...
|
|
664
|
-
...options.idempotent === false && { retry: { limit: 0 } }
|
|
773
|
+
...callRetry !== undefined && { retry: callRetry }
|
|
665
774
|
};
|
|
666
775
|
const searchParams = options.params ? searchParamsOf(options.params) : undefined;
|
|
667
776
|
if (searchParams)
|
|
668
777
|
kyOptions.searchParams = searchParams;
|
|
669
|
-
if (
|
|
778
|
+
if (isFormData) {
|
|
670
779
|
kyOptions.body = data;
|
|
671
780
|
} else if (data !== undefined) {
|
|
672
781
|
kyOptions.json = data;
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
collectTools2,
|
|
14
14
|
createToolRunner,
|
|
15
15
|
formatToolError
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-9118dw8d.js";
|
|
17
17
|
import {
|
|
18
18
|
toolSurfaceOutputSchema,
|
|
19
19
|
presentationMetadata
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
} from "./index-9vj869rx.js";
|
|
52
52
|
import {
|
|
53
53
|
collectToolSurface
|
|
54
|
-
} from "./index-
|
|
54
|
+
} from "./index-2zrx0nzv.js";
|
|
55
55
|
import {
|
|
56
56
|
runWithRequestContext2,
|
|
57
57
|
getRequestContext2
|