zidane 3.3.5 → 3.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-UXA7PPI5.js → chunk-7GQ7P6DM.js} +69 -1
- package/dist/{chunk-VC3PM4QB.js → chunk-CZQGCVMH.js} +1 -1
- package/dist/{chunk-ZCJZIZZV.js → chunk-OAIKGCZX.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/mcp.js +1 -1
- package/dist/presets.js +3 -3
- package/dist/tools.js +2 -2
- package/package.json +1 -1
|
@@ -8,6 +8,73 @@ import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
|
8
8
|
import { getDefaultEnvironment, StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
9
9
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
10
10
|
|
|
11
|
+
// src/mcp/sse-to-json-fetch.ts
|
|
12
|
+
function isBunRuntime() {
|
|
13
|
+
return typeof globalThis.Bun !== "undefined";
|
|
14
|
+
}
|
|
15
|
+
function sseToJsonFetchIfNeeded() {
|
|
16
|
+
return isBunRuntime() ? sseToJsonFetch() : void 0;
|
|
17
|
+
}
|
|
18
|
+
function sseToJsonFetch(baseFetch = fetch) {
|
|
19
|
+
return async function sseToJsonWrappedFetch(input, init) {
|
|
20
|
+
const response = await baseFetch(input, init);
|
|
21
|
+
const method = (init?.method ?? "GET").toString().toUpperCase();
|
|
22
|
+
if (method !== "POST")
|
|
23
|
+
return response;
|
|
24
|
+
const contentType = response.headers.get("content-type");
|
|
25
|
+
if (!contentType || !contentType.includes("text/event-stream"))
|
|
26
|
+
return response;
|
|
27
|
+
if (!response.body)
|
|
28
|
+
return response;
|
|
29
|
+
let raw;
|
|
30
|
+
try {
|
|
31
|
+
raw = await response.text();
|
|
32
|
+
} catch {
|
|
33
|
+
return response;
|
|
34
|
+
}
|
|
35
|
+
const events = parseSseDataEvents(raw);
|
|
36
|
+
const payload = events.length === 1 ? events[0] : events;
|
|
37
|
+
return synthesizeJsonResponse(response, payload);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function parseSseDataEvents(raw) {
|
|
41
|
+
const events = [];
|
|
42
|
+
for (const block of raw.split(/\r?\n\r?\n/)) {
|
|
43
|
+
if (!block.trim())
|
|
44
|
+
continue;
|
|
45
|
+
const dataLines = [];
|
|
46
|
+
let isMessageEvent = true;
|
|
47
|
+
for (const line of block.split(/\r?\n/)) {
|
|
48
|
+
if (line.startsWith(":"))
|
|
49
|
+
continue;
|
|
50
|
+
if (line.startsWith("event:")) {
|
|
51
|
+
const eventType = line.slice("event:".length).trim();
|
|
52
|
+
if (eventType && eventType !== "message")
|
|
53
|
+
isMessageEvent = false;
|
|
54
|
+
} else if (line.startsWith("data:")) {
|
|
55
|
+
const value = line.slice("data:".length);
|
|
56
|
+
dataLines.push(value.startsWith(" ") ? value.slice(1) : value);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (!isMessageEvent || dataLines.length === 0)
|
|
60
|
+
continue;
|
|
61
|
+
try {
|
|
62
|
+
events.push(JSON.parse(dataLines.join("\n")));
|
|
63
|
+
} catch {
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return events;
|
|
67
|
+
}
|
|
68
|
+
function synthesizeJsonResponse(original, payload) {
|
|
69
|
+
const headers = new Headers(original.headers);
|
|
70
|
+
headers.set("content-type", "application/json");
|
|
71
|
+
return new Response(JSON.stringify(payload), {
|
|
72
|
+
status: original.status,
|
|
73
|
+
statusText: original.statusText,
|
|
74
|
+
headers
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
11
78
|
// src/mcp/tolerant-client.ts
|
|
12
79
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
13
80
|
import { Protocol } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
@@ -206,7 +273,8 @@ function createTransport(config) {
|
|
|
206
273
|
});
|
|
207
274
|
case "streamable-http":
|
|
208
275
|
return new StreamableHTTPClientTransport(new URL(config.url), {
|
|
209
|
-
requestInit: config.headers ? { headers: config.headers } : void 0
|
|
276
|
+
requestInit: config.headers ? { headers: config.headers } : void 0,
|
|
277
|
+
fetch: sseToJsonFetchIfNeeded()
|
|
210
278
|
});
|
|
211
279
|
default:
|
|
212
280
|
throw new Error(`Unknown MCP transport: ${config.transport}`);
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
basicTools,
|
|
12
12
|
basic_default,
|
|
13
13
|
definePreset
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CZQGCVMH.js";
|
|
15
15
|
import {
|
|
16
16
|
createAgent,
|
|
17
17
|
createInteractionTool,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
grep,
|
|
25
25
|
multiEdit,
|
|
26
26
|
validateToolArgs
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-OAIKGCZX.js";
|
|
28
28
|
import {
|
|
29
29
|
IMPLICITLY_ALLOWED_SKILL_TOOLS,
|
|
30
30
|
buildCatalog,
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
normalizeMcpBlocks,
|
|
54
54
|
normalizeMcpServers,
|
|
55
55
|
resultToString
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-7GQ7P6DM.js";
|
|
57
57
|
import {
|
|
58
58
|
toolOutputByteLength,
|
|
59
59
|
toolResultToText
|
package/dist/mcp.js
CHANGED
package/dist/presets.js
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
basicTools,
|
|
3
3
|
basic_default,
|
|
4
4
|
definePreset
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-CZQGCVMH.js";
|
|
6
|
+
import "./chunk-OAIKGCZX.js";
|
|
7
7
|
import "./chunk-X3VOTPVM.js";
|
|
8
8
|
import "./chunk-UD25QF3H.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-7GQ7P6DM.js";
|
|
10
10
|
import "./chunk-JH6IAAFA.js";
|
|
11
11
|
import "./chunk-LNN5UTS2.js";
|
|
12
12
|
export {
|
package/dist/tools.js
CHANGED
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
shell,
|
|
14
14
|
validateToolArgs,
|
|
15
15
|
writeFile
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-OAIKGCZX.js";
|
|
17
17
|
import "./chunk-X3VOTPVM.js";
|
|
18
18
|
import "./chunk-UD25QF3H.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-7GQ7P6DM.js";
|
|
20
20
|
import "./chunk-JH6IAAFA.js";
|
|
21
21
|
import "./chunk-LNN5UTS2.js";
|
|
22
22
|
export {
|