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.
@@ -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}`);
@@ -6,7 +6,7 @@ import {
6
6
  readFile,
7
7
  shell,
8
8
  writeFile
9
- } from "./chunk-ZCJZIZZV.js";
9
+ } from "./chunk-OAIKGCZX.js";
10
10
 
11
11
  // src/presets/basic.ts
12
12
  var basicTools = { shell, readFile, writeFile, listFiles, edit, multiEdit };
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-UD25QF3H.js";
12
12
  import {
13
13
  connectMcpServers
14
- } from "./chunk-UXA7PPI5.js";
14
+ } from "./chunk-7GQ7P6DM.js";
15
15
  import {
16
16
  toolOutputByteLength
17
17
  } from "./chunk-JH6IAAFA.js";
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  basicTools,
12
12
  basic_default,
13
13
  definePreset
14
- } from "./chunk-VC3PM4QB.js";
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-ZCJZIZZV.js";
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-UXA7PPI5.js";
56
+ } from "./chunk-7GQ7P6DM.js";
57
57
  import {
58
58
  toolOutputByteLength,
59
59
  toolResultToText
package/dist/mcp.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  normalizeMcpBlocks,
4
4
  normalizeMcpServers,
5
5
  resultToString
6
- } from "./chunk-UXA7PPI5.js";
6
+ } from "./chunk-7GQ7P6DM.js";
7
7
  import "./chunk-JH6IAAFA.js";
8
8
  export {
9
9
  connectMcpServers,
package/dist/presets.js CHANGED
@@ -2,11 +2,11 @@ import {
2
2
  basicTools,
3
3
  basic_default,
4
4
  definePreset
5
- } from "./chunk-VC3PM4QB.js";
6
- import "./chunk-ZCJZIZZV.js";
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-UXA7PPI5.js";
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-ZCJZIZZV.js";
16
+ } from "./chunk-OAIKGCZX.js";
17
17
  import "./chunk-X3VOTPVM.js";
18
18
  import "./chunk-UD25QF3H.js";
19
- import "./chunk-UXA7PPI5.js";
19
+ import "./chunk-7GQ7P6DM.js";
20
20
  import "./chunk-JH6IAAFA.js";
21
21
  import "./chunk-LNN5UTS2.js";
22
22
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zidane",
3
- "version": "3.3.5",
3
+ "version": "3.3.6",
4
4
  "description": "an agent that goes straight to the goal",
5
5
  "type": "module",
6
6
  "private": false,