ai 5.1.0-beta.9 → 6.0.0-beta.100
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 +690 -0
- package/README.md +130 -45
- package/dist/index.d.mts +2863 -2355
- package/dist/index.d.ts +2863 -2355
- package/dist/index.js +4429 -3541
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4378 -3508
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +7 -7
- package/dist/internal/index.d.ts +7 -7
- package/dist/internal/index.js +180 -73
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +180 -73
- package/dist/internal/index.mjs.map +1 -1
- package/dist/test/index.d.mts +52 -36
- package/dist/test/index.d.ts +52 -36
- package/dist/test/index.js +51 -17
- package/dist/test/index.js.map +1 -1
- package/dist/test/index.mjs +47 -14
- package/dist/test/index.mjs.map +1 -1
- package/package.json +12 -15
- package/dist/mcp-stdio/index.d.mts +0 -89
- package/dist/mcp-stdio/index.d.ts +0 -89
- package/dist/mcp-stdio/index.js +0 -349
- package/dist/mcp-stdio/index.js.map +0 -1
- package/dist/mcp-stdio/index.mjs +0 -322
- package/dist/mcp-stdio/index.mjs.map +0 -1
- package/mcp-stdio.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-beta.100",
|
|
4
4
|
"description": "AI SDK by Vercel - The AI Toolkit for TypeScript and JavaScript",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dist/**/*",
|
|
12
12
|
"CHANGELOG.md",
|
|
13
13
|
"internal.d.ts",
|
|
14
|
-
"
|
|
14
|
+
"README.md",
|
|
15
15
|
"test.d.ts"
|
|
16
16
|
],
|
|
17
17
|
"exports": {
|
|
@@ -32,34 +32,30 @@
|
|
|
32
32
|
"import": "./dist/test/index.mjs",
|
|
33
33
|
"module": "./dist/test/index.mjs",
|
|
34
34
|
"require": "./dist/test/index.js"
|
|
35
|
-
},
|
|
36
|
-
"./mcp-stdio": {
|
|
37
|
-
"types": "./dist/mcp-stdio/index.d.ts",
|
|
38
|
-
"import": "./dist/mcp-stdio/index.mjs",
|
|
39
|
-
"module": "./dist/mcp-stdio/index.mjs",
|
|
40
|
-
"require": "./dist/mcp-stdio/index.js"
|
|
41
35
|
}
|
|
42
36
|
},
|
|
43
37
|
"dependencies": {
|
|
44
38
|
"@opentelemetry/api": "1.9.0",
|
|
45
|
-
"@ai-sdk/
|
|
46
|
-
"@ai-sdk/
|
|
47
|
-
"@ai-sdk/provider": "
|
|
48
|
-
"@ai-sdk/provider-utils": "3.1.0-beta.3"
|
|
39
|
+
"@ai-sdk/gateway": "2.0.0-beta.52",
|
|
40
|
+
"@ai-sdk/provider": "3.0.0-beta.16",
|
|
41
|
+
"@ai-sdk/provider-utils": "4.0.0-beta.33"
|
|
49
42
|
},
|
|
50
43
|
"devDependencies": {
|
|
51
44
|
"@edge-runtime/vm": "^5.0.0",
|
|
52
45
|
"@types/json-schema": "7.0.15",
|
|
53
46
|
"@types/node": "20.17.24",
|
|
47
|
+
"esbuild": "^0.24.2",
|
|
54
48
|
"eslint": "8.57.1",
|
|
55
49
|
"tsup": "^7.2.0",
|
|
50
|
+
"tsx": "^4.19.2",
|
|
56
51
|
"typescript": "5.8.3",
|
|
57
52
|
"zod": "3.25.76",
|
|
53
|
+
"@ai-sdk/test-server": "1.0.0-beta.1",
|
|
58
54
|
"@vercel/ai-tsconfig": "0.0.0",
|
|
59
55
|
"eslint-config-vercel-ai": "0.0.0"
|
|
60
56
|
},
|
|
61
57
|
"peerDependencies": {
|
|
62
|
-
"zod": "^3.25.76 || ^4"
|
|
58
|
+
"zod": "^3.25.76 || ^4.1.8"
|
|
63
59
|
},
|
|
64
60
|
"engines": {
|
|
65
61
|
"node": ">=18"
|
|
@@ -96,7 +92,7 @@
|
|
|
96
92
|
"scripts": {
|
|
97
93
|
"build": "pnpm clean && tsup --tsconfig tsconfig.build.json",
|
|
98
94
|
"build:watch": "pnpm clean && tsup --watch --tsconfig tsconfig.build.json",
|
|
99
|
-
"clean": "
|
|
95
|
+
"clean": "del-cli dist *.tsbuildinfo",
|
|
100
96
|
"lint": "eslint \"./**/*.ts*\"",
|
|
101
97
|
"type-check": "tsc --build",
|
|
102
98
|
"prettier-check": "prettier --check \"./**/*.ts*\"",
|
|
@@ -104,6 +100,7 @@
|
|
|
104
100
|
"test:update": "pnpm test:node -u",
|
|
105
101
|
"test:watch": "vitest --config vitest.node.config.js",
|
|
106
102
|
"test:edge": "vitest --config vitest.edge.config.js --run",
|
|
107
|
-
"test:node": "vitest --config vitest.node.config.js --run"
|
|
103
|
+
"test:node": "vitest --config vitest.node.config.js --run",
|
|
104
|
+
"check-bundle-size": "tsx scripts/check-bundle-size.ts"
|
|
108
105
|
}
|
|
109
106
|
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { IOType } from 'node:child_process';
|
|
2
|
-
import { Stream } from 'node:stream';
|
|
3
|
-
import { z } from 'zod/v4';
|
|
4
|
-
|
|
5
|
-
declare const JSONRPCMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
6
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
7
|
-
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
8
|
-
method: z.ZodString;
|
|
9
|
-
params: z.ZodOptional<z.ZodObject<{
|
|
10
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
11
|
-
}, z.core.$loose>>;
|
|
12
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
13
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
14
|
-
method: z.ZodString;
|
|
15
|
-
params: z.ZodOptional<z.ZodObject<{
|
|
16
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
17
|
-
}, z.core.$loose>>;
|
|
18
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
19
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
20
|
-
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
21
|
-
result: z.ZodObject<{
|
|
22
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
23
|
-
}, z.core.$loose>;
|
|
24
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
25
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
26
|
-
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
27
|
-
error: z.ZodObject<{
|
|
28
|
-
code: z.ZodNumber;
|
|
29
|
-
message: z.ZodString;
|
|
30
|
-
data: z.ZodOptional<z.ZodUnknown>;
|
|
31
|
-
}, z.core.$strip>;
|
|
32
|
-
}, z.core.$strict>]>;
|
|
33
|
-
type JSONRPCMessage = z.infer<typeof JSONRPCMessageSchema>;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Transport interface for MCP (Model Context Protocol) communication.
|
|
37
|
-
* Maps to the `Transport` interface in the MCP spec.
|
|
38
|
-
*/
|
|
39
|
-
interface MCPTransport {
|
|
40
|
-
/**
|
|
41
|
-
* Initialize and start the transport
|
|
42
|
-
*/
|
|
43
|
-
start(): Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* Send a JSON-RPC message through the transport
|
|
46
|
-
* @param message The JSON-RPC message to send
|
|
47
|
-
*/
|
|
48
|
-
send(message: JSONRPCMessage): Promise<void>;
|
|
49
|
-
/**
|
|
50
|
-
* Clean up and close the transport
|
|
51
|
-
*/
|
|
52
|
-
close(): Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* Event handler for transport closure
|
|
55
|
-
*/
|
|
56
|
-
onclose?: () => void;
|
|
57
|
-
/**
|
|
58
|
-
* Event handler for transport errors
|
|
59
|
-
*/
|
|
60
|
-
onerror?: (error: Error) => void;
|
|
61
|
-
/**
|
|
62
|
-
* Event handler for received messages
|
|
63
|
-
*/
|
|
64
|
-
onmessage?: (message: JSONRPCMessage) => void;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
interface StdioConfig {
|
|
68
|
-
command: string;
|
|
69
|
-
args?: string[];
|
|
70
|
-
env?: Record<string, string>;
|
|
71
|
-
stderr?: IOType | Stream | number;
|
|
72
|
-
cwd?: string;
|
|
73
|
-
}
|
|
74
|
-
declare class StdioMCPTransport implements MCPTransport {
|
|
75
|
-
private process?;
|
|
76
|
-
private abortController;
|
|
77
|
-
private readBuffer;
|
|
78
|
-
private serverParams;
|
|
79
|
-
onclose?: () => void;
|
|
80
|
-
onerror?: (error: unknown) => void;
|
|
81
|
-
onmessage?: (message: JSONRPCMessage) => void;
|
|
82
|
-
constructor(server: StdioConfig);
|
|
83
|
-
start(): Promise<void>;
|
|
84
|
-
private processReadBuffer;
|
|
85
|
-
close(): Promise<void>;
|
|
86
|
-
send(message: JSONRPCMessage): Promise<void>;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export { StdioMCPTransport as Experimental_StdioMCPTransport, StdioConfig };
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { IOType } from 'node:child_process';
|
|
2
|
-
import { Stream } from 'node:stream';
|
|
3
|
-
import { z } from 'zod/v4';
|
|
4
|
-
|
|
5
|
-
declare const JSONRPCMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
6
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
7
|
-
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
8
|
-
method: z.ZodString;
|
|
9
|
-
params: z.ZodOptional<z.ZodObject<{
|
|
10
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
11
|
-
}, z.core.$loose>>;
|
|
12
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
13
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
14
|
-
method: z.ZodString;
|
|
15
|
-
params: z.ZodOptional<z.ZodObject<{
|
|
16
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
17
|
-
}, z.core.$loose>>;
|
|
18
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
19
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
20
|
-
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
21
|
-
result: z.ZodObject<{
|
|
22
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
23
|
-
}, z.core.$loose>;
|
|
24
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
25
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
26
|
-
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
27
|
-
error: z.ZodObject<{
|
|
28
|
-
code: z.ZodNumber;
|
|
29
|
-
message: z.ZodString;
|
|
30
|
-
data: z.ZodOptional<z.ZodUnknown>;
|
|
31
|
-
}, z.core.$strip>;
|
|
32
|
-
}, z.core.$strict>]>;
|
|
33
|
-
type JSONRPCMessage = z.infer<typeof JSONRPCMessageSchema>;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Transport interface for MCP (Model Context Protocol) communication.
|
|
37
|
-
* Maps to the `Transport` interface in the MCP spec.
|
|
38
|
-
*/
|
|
39
|
-
interface MCPTransport {
|
|
40
|
-
/**
|
|
41
|
-
* Initialize and start the transport
|
|
42
|
-
*/
|
|
43
|
-
start(): Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* Send a JSON-RPC message through the transport
|
|
46
|
-
* @param message The JSON-RPC message to send
|
|
47
|
-
*/
|
|
48
|
-
send(message: JSONRPCMessage): Promise<void>;
|
|
49
|
-
/**
|
|
50
|
-
* Clean up and close the transport
|
|
51
|
-
*/
|
|
52
|
-
close(): Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* Event handler for transport closure
|
|
55
|
-
*/
|
|
56
|
-
onclose?: () => void;
|
|
57
|
-
/**
|
|
58
|
-
* Event handler for transport errors
|
|
59
|
-
*/
|
|
60
|
-
onerror?: (error: Error) => void;
|
|
61
|
-
/**
|
|
62
|
-
* Event handler for received messages
|
|
63
|
-
*/
|
|
64
|
-
onmessage?: (message: JSONRPCMessage) => void;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
interface StdioConfig {
|
|
68
|
-
command: string;
|
|
69
|
-
args?: string[];
|
|
70
|
-
env?: Record<string, string>;
|
|
71
|
-
stderr?: IOType | Stream | number;
|
|
72
|
-
cwd?: string;
|
|
73
|
-
}
|
|
74
|
-
declare class StdioMCPTransport implements MCPTransport {
|
|
75
|
-
private process?;
|
|
76
|
-
private abortController;
|
|
77
|
-
private readBuffer;
|
|
78
|
-
private serverParams;
|
|
79
|
-
onclose?: () => void;
|
|
80
|
-
onerror?: (error: unknown) => void;
|
|
81
|
-
onmessage?: (message: JSONRPCMessage) => void;
|
|
82
|
-
constructor(server: StdioConfig);
|
|
83
|
-
start(): Promise<void>;
|
|
84
|
-
private processReadBuffer;
|
|
85
|
-
close(): Promise<void>;
|
|
86
|
-
send(message: JSONRPCMessage): Promise<void>;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export { StdioMCPTransport as Experimental_StdioMCPTransport, StdioConfig };
|
package/dist/mcp-stdio/index.js
DELETED
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name2 in all)
|
|
8
|
-
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// mcp-stdio/index.ts
|
|
21
|
-
var mcp_stdio_exports = {};
|
|
22
|
-
__export(mcp_stdio_exports, {
|
|
23
|
-
Experimental_StdioMCPTransport: () => StdioMCPTransport
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(mcp_stdio_exports);
|
|
26
|
-
|
|
27
|
-
// src/tool/mcp/json-rpc-message.ts
|
|
28
|
-
var import_v42 = require("zod/v4");
|
|
29
|
-
|
|
30
|
-
// src/tool/mcp/types.ts
|
|
31
|
-
var import_v4 = require("zod/v4");
|
|
32
|
-
var ClientOrServerImplementationSchema = import_v4.z.looseObject({
|
|
33
|
-
name: import_v4.z.string(),
|
|
34
|
-
version: import_v4.z.string()
|
|
35
|
-
});
|
|
36
|
-
var BaseParamsSchema = import_v4.z.looseObject({
|
|
37
|
-
_meta: import_v4.z.optional(import_v4.z.object({}).loose())
|
|
38
|
-
});
|
|
39
|
-
var ResultSchema = BaseParamsSchema;
|
|
40
|
-
var RequestSchema = import_v4.z.object({
|
|
41
|
-
method: import_v4.z.string(),
|
|
42
|
-
params: import_v4.z.optional(BaseParamsSchema)
|
|
43
|
-
});
|
|
44
|
-
var ServerCapabilitiesSchema = import_v4.z.looseObject({
|
|
45
|
-
experimental: import_v4.z.optional(import_v4.z.object({}).loose()),
|
|
46
|
-
logging: import_v4.z.optional(import_v4.z.object({}).loose()),
|
|
47
|
-
prompts: import_v4.z.optional(
|
|
48
|
-
import_v4.z.looseObject({
|
|
49
|
-
listChanged: import_v4.z.optional(import_v4.z.boolean())
|
|
50
|
-
})
|
|
51
|
-
),
|
|
52
|
-
resources: import_v4.z.optional(
|
|
53
|
-
import_v4.z.looseObject({
|
|
54
|
-
subscribe: import_v4.z.optional(import_v4.z.boolean()),
|
|
55
|
-
listChanged: import_v4.z.optional(import_v4.z.boolean())
|
|
56
|
-
})
|
|
57
|
-
),
|
|
58
|
-
tools: import_v4.z.optional(
|
|
59
|
-
import_v4.z.looseObject({
|
|
60
|
-
listChanged: import_v4.z.optional(import_v4.z.boolean())
|
|
61
|
-
})
|
|
62
|
-
)
|
|
63
|
-
});
|
|
64
|
-
var InitializeResultSchema = ResultSchema.extend({
|
|
65
|
-
protocolVersion: import_v4.z.string(),
|
|
66
|
-
capabilities: ServerCapabilitiesSchema,
|
|
67
|
-
serverInfo: ClientOrServerImplementationSchema,
|
|
68
|
-
instructions: import_v4.z.optional(import_v4.z.string())
|
|
69
|
-
});
|
|
70
|
-
var PaginatedResultSchema = ResultSchema.extend({
|
|
71
|
-
nextCursor: import_v4.z.optional(import_v4.z.string())
|
|
72
|
-
});
|
|
73
|
-
var ToolSchema = import_v4.z.object({
|
|
74
|
-
name: import_v4.z.string(),
|
|
75
|
-
description: import_v4.z.optional(import_v4.z.string()),
|
|
76
|
-
inputSchema: import_v4.z.object({
|
|
77
|
-
type: import_v4.z.literal("object"),
|
|
78
|
-
properties: import_v4.z.optional(import_v4.z.object({}).loose())
|
|
79
|
-
}).loose()
|
|
80
|
-
}).loose();
|
|
81
|
-
var ListToolsResultSchema = PaginatedResultSchema.extend({
|
|
82
|
-
tools: import_v4.z.array(ToolSchema)
|
|
83
|
-
});
|
|
84
|
-
var TextContentSchema = import_v4.z.object({
|
|
85
|
-
type: import_v4.z.literal("text"),
|
|
86
|
-
text: import_v4.z.string()
|
|
87
|
-
}).loose();
|
|
88
|
-
var ImageContentSchema = import_v4.z.object({
|
|
89
|
-
type: import_v4.z.literal("image"),
|
|
90
|
-
data: import_v4.z.base64(),
|
|
91
|
-
mimeType: import_v4.z.string()
|
|
92
|
-
}).loose();
|
|
93
|
-
var ResourceContentsSchema = import_v4.z.object({
|
|
94
|
-
/**
|
|
95
|
-
* The URI of this resource.
|
|
96
|
-
*/
|
|
97
|
-
uri: import_v4.z.string(),
|
|
98
|
-
/**
|
|
99
|
-
* The MIME type of this resource, if known.
|
|
100
|
-
*/
|
|
101
|
-
mimeType: import_v4.z.optional(import_v4.z.string())
|
|
102
|
-
}).loose();
|
|
103
|
-
var TextResourceContentsSchema = ResourceContentsSchema.extend({
|
|
104
|
-
text: import_v4.z.string()
|
|
105
|
-
});
|
|
106
|
-
var BlobResourceContentsSchema = ResourceContentsSchema.extend({
|
|
107
|
-
blob: import_v4.z.base64()
|
|
108
|
-
});
|
|
109
|
-
var EmbeddedResourceSchema = import_v4.z.object({
|
|
110
|
-
type: import_v4.z.literal("resource"),
|
|
111
|
-
resource: import_v4.z.union([TextResourceContentsSchema, BlobResourceContentsSchema])
|
|
112
|
-
}).loose();
|
|
113
|
-
var CallToolResultSchema = ResultSchema.extend({
|
|
114
|
-
content: import_v4.z.array(
|
|
115
|
-
import_v4.z.union([TextContentSchema, ImageContentSchema, EmbeddedResourceSchema])
|
|
116
|
-
),
|
|
117
|
-
isError: import_v4.z.boolean().default(false).optional()
|
|
118
|
-
}).or(
|
|
119
|
-
ResultSchema.extend({
|
|
120
|
-
toolResult: import_v4.z.unknown()
|
|
121
|
-
})
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
// src/tool/mcp/json-rpc-message.ts
|
|
125
|
-
var JSONRPC_VERSION = "2.0";
|
|
126
|
-
var JSONRPCRequestSchema = import_v42.z.object({
|
|
127
|
-
jsonrpc: import_v42.z.literal(JSONRPC_VERSION),
|
|
128
|
-
id: import_v42.z.union([import_v42.z.string(), import_v42.z.number().int()])
|
|
129
|
-
}).merge(RequestSchema).strict();
|
|
130
|
-
var JSONRPCResponseSchema = import_v42.z.object({
|
|
131
|
-
jsonrpc: import_v42.z.literal(JSONRPC_VERSION),
|
|
132
|
-
id: import_v42.z.union([import_v42.z.string(), import_v42.z.number().int()]),
|
|
133
|
-
result: ResultSchema
|
|
134
|
-
}).strict();
|
|
135
|
-
var JSONRPCErrorSchema = import_v42.z.object({
|
|
136
|
-
jsonrpc: import_v42.z.literal(JSONRPC_VERSION),
|
|
137
|
-
id: import_v42.z.union([import_v42.z.string(), import_v42.z.number().int()]),
|
|
138
|
-
error: import_v42.z.object({
|
|
139
|
-
code: import_v42.z.number().int(),
|
|
140
|
-
message: import_v42.z.string(),
|
|
141
|
-
data: import_v42.z.optional(import_v42.z.unknown())
|
|
142
|
-
})
|
|
143
|
-
}).strict();
|
|
144
|
-
var JSONRPCNotificationSchema = import_v42.z.object({
|
|
145
|
-
jsonrpc: import_v42.z.literal(JSONRPC_VERSION)
|
|
146
|
-
}).merge(
|
|
147
|
-
import_v42.z.object({
|
|
148
|
-
method: import_v42.z.string(),
|
|
149
|
-
params: import_v42.z.optional(BaseParamsSchema)
|
|
150
|
-
})
|
|
151
|
-
).strict();
|
|
152
|
-
var JSONRPCMessageSchema = import_v42.z.union([
|
|
153
|
-
JSONRPCRequestSchema,
|
|
154
|
-
JSONRPCNotificationSchema,
|
|
155
|
-
JSONRPCResponseSchema,
|
|
156
|
-
JSONRPCErrorSchema
|
|
157
|
-
]);
|
|
158
|
-
|
|
159
|
-
// src/error/mcp-client-error.ts
|
|
160
|
-
var import_provider = require("@ai-sdk/provider");
|
|
161
|
-
var name = "AI_MCPClientError";
|
|
162
|
-
var marker = `vercel.ai.error.${name}`;
|
|
163
|
-
var symbol = Symbol.for(marker);
|
|
164
|
-
var _a;
|
|
165
|
-
var MCPClientError = class extends import_provider.AISDKError {
|
|
166
|
-
constructor({
|
|
167
|
-
name: name2 = "MCPClientError",
|
|
168
|
-
message,
|
|
169
|
-
cause
|
|
170
|
-
}) {
|
|
171
|
-
super({ name: name2, message, cause });
|
|
172
|
-
this[_a] = true;
|
|
173
|
-
}
|
|
174
|
-
static isInstance(error) {
|
|
175
|
-
return import_provider.AISDKError.hasMarker(error, marker);
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
_a = symbol;
|
|
179
|
-
|
|
180
|
-
// mcp-stdio/create-child-process.ts
|
|
181
|
-
var import_node_child_process = require("child_process");
|
|
182
|
-
|
|
183
|
-
// mcp-stdio/get-environment.ts
|
|
184
|
-
function getEnvironment(customEnv) {
|
|
185
|
-
const DEFAULT_INHERITED_ENV_VARS = globalThis.process.platform === "win32" ? [
|
|
186
|
-
"APPDATA",
|
|
187
|
-
"HOMEDRIVE",
|
|
188
|
-
"HOMEPATH",
|
|
189
|
-
"LOCALAPPDATA",
|
|
190
|
-
"PATH",
|
|
191
|
-
"PROCESSOR_ARCHITECTURE",
|
|
192
|
-
"SYSTEMDRIVE",
|
|
193
|
-
"SYSTEMROOT",
|
|
194
|
-
"TEMP",
|
|
195
|
-
"USERNAME",
|
|
196
|
-
"USERPROFILE"
|
|
197
|
-
] : ["HOME", "LOGNAME", "PATH", "SHELL", "TERM", "USER"];
|
|
198
|
-
const env = customEnv ? { ...customEnv } : {};
|
|
199
|
-
for (const key of DEFAULT_INHERITED_ENV_VARS) {
|
|
200
|
-
const value = globalThis.process.env[key];
|
|
201
|
-
if (value === void 0) {
|
|
202
|
-
continue;
|
|
203
|
-
}
|
|
204
|
-
if (value.startsWith("()")) {
|
|
205
|
-
continue;
|
|
206
|
-
}
|
|
207
|
-
env[key] = value;
|
|
208
|
-
}
|
|
209
|
-
return env;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// mcp-stdio/create-child-process.ts
|
|
213
|
-
function createChildProcess(config, signal) {
|
|
214
|
-
var _a2, _b;
|
|
215
|
-
return (0, import_node_child_process.spawn)(config.command, (_a2 = config.args) != null ? _a2 : [], {
|
|
216
|
-
env: getEnvironment(config.env),
|
|
217
|
-
stdio: ["pipe", "pipe", (_b = config.stderr) != null ? _b : "inherit"],
|
|
218
|
-
shell: false,
|
|
219
|
-
signal,
|
|
220
|
-
windowsHide: globalThis.process.platform === "win32" && isElectron(),
|
|
221
|
-
cwd: config.cwd
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
function isElectron() {
|
|
225
|
-
return "type" in globalThis.process;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// mcp-stdio/mcp-stdio-transport.ts
|
|
229
|
-
var StdioMCPTransport = class {
|
|
230
|
-
constructor(server) {
|
|
231
|
-
this.abortController = new AbortController();
|
|
232
|
-
this.readBuffer = new ReadBuffer();
|
|
233
|
-
this.serverParams = server;
|
|
234
|
-
}
|
|
235
|
-
async start() {
|
|
236
|
-
if (this.process) {
|
|
237
|
-
throw new MCPClientError({
|
|
238
|
-
message: "StdioMCPTransport already started."
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
return new Promise((resolve, reject) => {
|
|
242
|
-
var _a2, _b, _c, _d;
|
|
243
|
-
try {
|
|
244
|
-
const process = createChildProcess(
|
|
245
|
-
this.serverParams,
|
|
246
|
-
this.abortController.signal
|
|
247
|
-
);
|
|
248
|
-
this.process = process;
|
|
249
|
-
this.process.on("error", (error) => {
|
|
250
|
-
var _a3, _b2;
|
|
251
|
-
if (error.name === "AbortError") {
|
|
252
|
-
(_a3 = this.onclose) == null ? void 0 : _a3.call(this);
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
reject(error);
|
|
256
|
-
(_b2 = this.onerror) == null ? void 0 : _b2.call(this, error);
|
|
257
|
-
});
|
|
258
|
-
this.process.on("spawn", () => {
|
|
259
|
-
resolve();
|
|
260
|
-
});
|
|
261
|
-
this.process.on("close", (_code) => {
|
|
262
|
-
var _a3;
|
|
263
|
-
this.process = void 0;
|
|
264
|
-
(_a3 = this.onclose) == null ? void 0 : _a3.call(this);
|
|
265
|
-
});
|
|
266
|
-
(_a2 = this.process.stdin) == null ? void 0 : _a2.on("error", (error) => {
|
|
267
|
-
var _a3;
|
|
268
|
-
(_a3 = this.onerror) == null ? void 0 : _a3.call(this, error);
|
|
269
|
-
});
|
|
270
|
-
(_b = this.process.stdout) == null ? void 0 : _b.on("data", (chunk) => {
|
|
271
|
-
this.readBuffer.append(chunk);
|
|
272
|
-
this.processReadBuffer();
|
|
273
|
-
});
|
|
274
|
-
(_c = this.process.stdout) == null ? void 0 : _c.on("error", (error) => {
|
|
275
|
-
var _a3;
|
|
276
|
-
(_a3 = this.onerror) == null ? void 0 : _a3.call(this, error);
|
|
277
|
-
});
|
|
278
|
-
} catch (error) {
|
|
279
|
-
reject(error);
|
|
280
|
-
(_d = this.onerror) == null ? void 0 : _d.call(this, error);
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
processReadBuffer() {
|
|
285
|
-
var _a2, _b;
|
|
286
|
-
while (true) {
|
|
287
|
-
try {
|
|
288
|
-
const message = this.readBuffer.readMessage();
|
|
289
|
-
if (message === null) {
|
|
290
|
-
break;
|
|
291
|
-
}
|
|
292
|
-
(_a2 = this.onmessage) == null ? void 0 : _a2.call(this, message);
|
|
293
|
-
} catch (error) {
|
|
294
|
-
(_b = this.onerror) == null ? void 0 : _b.call(this, error);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
async close() {
|
|
299
|
-
this.abortController.abort();
|
|
300
|
-
this.process = void 0;
|
|
301
|
-
this.readBuffer.clear();
|
|
302
|
-
}
|
|
303
|
-
send(message) {
|
|
304
|
-
return new Promise((resolve) => {
|
|
305
|
-
var _a2;
|
|
306
|
-
if (!((_a2 = this.process) == null ? void 0 : _a2.stdin)) {
|
|
307
|
-
throw new MCPClientError({
|
|
308
|
-
message: "StdioClientTransport not connected"
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
const json = serializeMessage(message);
|
|
312
|
-
if (this.process.stdin.write(json)) {
|
|
313
|
-
resolve();
|
|
314
|
-
} else {
|
|
315
|
-
this.process.stdin.once("drain", resolve);
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
var ReadBuffer = class {
|
|
321
|
-
append(chunk) {
|
|
322
|
-
this.buffer = this.buffer ? Buffer.concat([this.buffer, chunk]) : chunk;
|
|
323
|
-
}
|
|
324
|
-
readMessage() {
|
|
325
|
-
if (!this.buffer)
|
|
326
|
-
return null;
|
|
327
|
-
const index = this.buffer.indexOf("\n");
|
|
328
|
-
if (index === -1) {
|
|
329
|
-
return null;
|
|
330
|
-
}
|
|
331
|
-
const line = this.buffer.toString("utf8", 0, index);
|
|
332
|
-
this.buffer = this.buffer.subarray(index + 1);
|
|
333
|
-
return deserializeMessage(line);
|
|
334
|
-
}
|
|
335
|
-
clear() {
|
|
336
|
-
this.buffer = void 0;
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
function serializeMessage(message) {
|
|
340
|
-
return JSON.stringify(message) + "\n";
|
|
341
|
-
}
|
|
342
|
-
function deserializeMessage(line) {
|
|
343
|
-
return JSONRPCMessageSchema.parse(JSON.parse(line));
|
|
344
|
-
}
|
|
345
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
346
|
-
0 && (module.exports = {
|
|
347
|
-
Experimental_StdioMCPTransport
|
|
348
|
-
});
|
|
349
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../mcp-stdio/index.ts","../../src/tool/mcp/json-rpc-message.ts","../../src/tool/mcp/types.ts","../../src/error/mcp-client-error.ts","../../mcp-stdio/create-child-process.ts","../../mcp-stdio/get-environment.ts","../../mcp-stdio/mcp-stdio-transport.ts"],"sourcesContent":["export {\n StdioMCPTransport as Experimental_StdioMCPTransport,\n type StdioConfig,\n} from './mcp-stdio-transport';\n","import { z } from 'zod/v4';\nimport { BaseParamsSchema, RequestSchema, ResultSchema } from './types';\n\nconst JSONRPC_VERSION = '2.0';\n\nconst JSONRPCRequestSchema = z\n .object({\n jsonrpc: z.literal(JSONRPC_VERSION),\n id: z.union([z.string(), z.number().int()]),\n })\n .merge(RequestSchema)\n .strict();\n\nexport type JSONRPCRequest = z.infer<typeof JSONRPCRequestSchema>;\n\nconst JSONRPCResponseSchema = z\n .object({\n jsonrpc: z.literal(JSONRPC_VERSION),\n id: z.union([z.string(), z.number().int()]),\n result: ResultSchema,\n })\n .strict();\n\nexport type JSONRPCResponse = z.infer<typeof JSONRPCResponseSchema>;\n\nconst JSONRPCErrorSchema = z\n .object({\n jsonrpc: z.literal(JSONRPC_VERSION),\n id: z.union([z.string(), z.number().int()]),\n error: z.object({\n code: z.number().int(),\n message: z.string(),\n data: z.optional(z.unknown()),\n }),\n })\n .strict();\n\nexport type JSONRPCError = z.infer<typeof JSONRPCErrorSchema>;\n\nconst JSONRPCNotificationSchema = z\n .object({\n jsonrpc: z.literal(JSONRPC_VERSION),\n })\n .merge(\n z.object({\n method: z.string(),\n params: z.optional(BaseParamsSchema),\n }),\n )\n .strict();\n\nexport type JSONRPCNotification = z.infer<typeof JSONRPCNotificationSchema>;\n\nexport const JSONRPCMessageSchema = z.union([\n JSONRPCRequestSchema,\n JSONRPCNotificationSchema,\n JSONRPCResponseSchema,\n JSONRPCErrorSchema,\n]);\n\nexport type JSONRPCMessage = z.infer<typeof JSONRPCMessageSchema>;\n","import { z } from 'zod/v4';\nimport { JSONObject } from '@ai-sdk/provider';\nimport { FlexibleSchema, Tool } from '@ai-sdk/provider-utils';\n\nexport const LATEST_PROTOCOL_VERSION = '2025-06-18';\nexport const SUPPORTED_PROTOCOL_VERSIONS = [\n LATEST_PROTOCOL_VERSION,\n '2025-03-26',\n '2024-11-05',\n];\n\nexport type ToolSchemas =\n | Record<string, { inputSchema: FlexibleSchema<JSONObject | unknown> }>\n | 'automatic'\n | undefined;\n\nexport type McpToolSet<TOOL_SCHEMAS extends ToolSchemas = 'automatic'> =\n TOOL_SCHEMAS extends Record<string, { inputSchema: FlexibleSchema<any> }>\n ? {\n [K in keyof TOOL_SCHEMAS]: TOOL_SCHEMAS[K] extends {\n inputSchema: FlexibleSchema<infer INPUT>;\n }\n ? Tool<INPUT, CallToolResult> &\n Required<Pick<Tool<INPUT, CallToolResult>, 'execute'>>\n : never;\n }\n : McpToolSet<Record<string, { inputSchema: FlexibleSchema<unknown> }>>;\n\nconst ClientOrServerImplementationSchema = z.looseObject({\n name: z.string(),\n version: z.string(),\n});\n\nexport type Configuration = z.infer<typeof ClientOrServerImplementationSchema>;\n\nexport const BaseParamsSchema = z.looseObject({\n _meta: z.optional(z.object({}).loose()),\n});\ntype BaseParams = z.infer<typeof BaseParamsSchema>;\nexport const ResultSchema = BaseParamsSchema;\n\nexport const RequestSchema = z.object({\n method: z.string(),\n params: z.optional(BaseParamsSchema),\n});\nexport type Request = z.infer<typeof RequestSchema>;\nexport type RequestOptions = {\n signal?: AbortSignal;\n timeout?: number;\n maxTotalTimeout?: number;\n};\n\nexport type Notification = z.infer<typeof RequestSchema>;\n\nconst ServerCapabilitiesSchema = z.looseObject({\n experimental: z.optional(z.object({}).loose()),\n logging: z.optional(z.object({}).loose()),\n prompts: z.optional(\n z.looseObject({\n listChanged: z.optional(z.boolean()),\n }),\n ),\n resources: z.optional(\n z.looseObject({\n subscribe: z.optional(z.boolean()),\n listChanged: z.optional(z.boolean()),\n }),\n ),\n tools: z.optional(\n z.looseObject({\n listChanged: z.optional(z.boolean()),\n }),\n ),\n});\n\nexport type ServerCapabilities = z.infer<typeof ServerCapabilitiesSchema>;\n\nexport const InitializeResultSchema = ResultSchema.extend({\n protocolVersion: z.string(),\n capabilities: ServerCapabilitiesSchema,\n serverInfo: ClientOrServerImplementationSchema,\n instructions: z.optional(z.string()),\n});\nexport type InitializeResult = z.infer<typeof InitializeResultSchema>;\n\nexport type PaginatedRequest = Request & {\n params?: BaseParams & {\n cursor?: string;\n };\n};\n\nconst PaginatedResultSchema = ResultSchema.extend({\n nextCursor: z.optional(z.string()),\n});\n\nconst ToolSchema = z\n .object({\n name: z.string(),\n description: z.optional(z.string()),\n inputSchema: z\n .object({\n type: z.literal('object'),\n properties: z.optional(z.object({}).loose()),\n })\n .loose(),\n })\n .loose();\nexport type MCPTool = z.infer<typeof ToolSchema>;\nexport const ListToolsResultSchema = PaginatedResultSchema.extend({\n tools: z.array(ToolSchema),\n});\nexport type ListToolsResult = z.infer<typeof ListToolsResultSchema>;\n\nconst TextContentSchema = z\n .object({\n type: z.literal('text'),\n text: z.string(),\n })\n .loose();\nconst ImageContentSchema = z\n .object({\n type: z.literal('image'),\n data: z.base64(),\n mimeType: z.string(),\n })\n .loose();\nconst ResourceContentsSchema = z\n .object({\n /**\n * The URI of this resource.\n */\n uri: z.string(),\n /**\n * The MIME type of this resource, if known.\n */\n mimeType: z.optional(z.string()),\n })\n .loose();\nconst TextResourceContentsSchema = ResourceContentsSchema.extend({\n text: z.string(),\n});\nconst BlobResourceContentsSchema = ResourceContentsSchema.extend({\n blob: z.base64(),\n});\nconst EmbeddedResourceSchema = z\n .object({\n type: z.literal('resource'),\n resource: z.union([TextResourceContentsSchema, BlobResourceContentsSchema]),\n })\n .loose();\n\nexport const CallToolResultSchema = ResultSchema.extend({\n content: z.array(\n z.union([TextContentSchema, ImageContentSchema, EmbeddedResourceSchema]),\n ),\n isError: z.boolean().default(false).optional(),\n}).or(\n ResultSchema.extend({\n toolResult: z.unknown(),\n }),\n);\nexport type CallToolResult = z.infer<typeof CallToolResultSchema>;\n","import { AISDKError } from '@ai-sdk/provider';\n\nconst name = 'AI_MCPClientError';\nconst marker = `vercel.ai.error.${name}`;\nconst symbol = Symbol.for(marker);\n\n/**\n * An error occurred with the MCP client.\n */\nexport class MCPClientError extends AISDKError {\n private readonly [symbol] = true;\n\n constructor({\n name = 'MCPClientError',\n message,\n cause,\n }: {\n name?: string;\n message: string;\n cause?: unknown;\n }) {\n super({ name, message, cause });\n }\n\n static isInstance(error: unknown): error is MCPClientError {\n return AISDKError.hasMarker(error, marker);\n }\n}\n","import { ChildProcess, spawn } from 'node:child_process';\nimport { getEnvironment } from './get-environment';\nimport { StdioConfig } from './mcp-stdio-transport';\n\nexport function createChildProcess(\n config: StdioConfig,\n signal: AbortSignal,\n): ChildProcess {\n return spawn(config.command, config.args ?? [], {\n env: getEnvironment(config.env),\n stdio: ['pipe', 'pipe', config.stderr ?? 'inherit'],\n shell: false,\n signal,\n windowsHide: globalThis.process.platform === 'win32' && isElectron(),\n cwd: config.cwd,\n });\n}\n\nfunction isElectron() {\n return 'type' in globalThis.process;\n}\n","/**\n * Constructs the environment variables for the child process.\n *\n * @param customEnv - Custom environment variables to merge with default environment variables.\n * @returns The environment variables for the child process.\n */\nexport function getEnvironment(\n customEnv?: Record<string, string>,\n): Record<string, string> {\n const DEFAULT_INHERITED_ENV_VARS =\n globalThis.process.platform === 'win32'\n ? [\n 'APPDATA',\n 'HOMEDRIVE',\n 'HOMEPATH',\n 'LOCALAPPDATA',\n 'PATH',\n 'PROCESSOR_ARCHITECTURE',\n 'SYSTEMDRIVE',\n 'SYSTEMROOT',\n 'TEMP',\n 'USERNAME',\n 'USERPROFILE',\n ]\n : ['HOME', 'LOGNAME', 'PATH', 'SHELL', 'TERM', 'USER'];\n\n const env: Record<string, string> = customEnv ? { ...customEnv } : {};\n\n for (const key of DEFAULT_INHERITED_ENV_VARS) {\n const value = globalThis.process.env[key];\n if (value === undefined) {\n continue;\n }\n\n if (value.startsWith('()')) {\n continue;\n }\n\n env[key] = value;\n }\n\n return env;\n}\n","import type { ChildProcess, IOType } from 'node:child_process';\nimport { Stream } from 'node:stream';\nimport {\n JSONRPCMessage,\n JSONRPCMessageSchema,\n} from '../src/tool/mcp/json-rpc-message';\nimport { MCPTransport } from '../src/tool/mcp/mcp-transport';\nimport { MCPClientError } from '../src/error/mcp-client-error';\nimport { createChildProcess } from './create-child-process';\n\nexport interface StdioConfig {\n command: string;\n args?: string[];\n env?: Record<string, string>;\n stderr?: IOType | Stream | number;\n cwd?: string;\n}\n\nexport class StdioMCPTransport implements MCPTransport {\n private process?: ChildProcess;\n private abortController: AbortController = new AbortController();\n private readBuffer: ReadBuffer = new ReadBuffer();\n private serverParams: StdioConfig;\n\n onclose?: () => void;\n onerror?: (error: unknown) => void;\n onmessage?: (message: JSONRPCMessage) => void;\n\n constructor(server: StdioConfig) {\n this.serverParams = server;\n }\n\n async start(): Promise<void> {\n if (this.process) {\n throw new MCPClientError({\n message: 'StdioMCPTransport already started.',\n });\n }\n\n return new Promise((resolve, reject) => {\n try {\n const process = createChildProcess(\n this.serverParams,\n this.abortController.signal,\n );\n\n this.process = process;\n\n this.process.on('error', error => {\n if (error.name === 'AbortError') {\n this.onclose?.();\n return;\n }\n\n reject(error);\n this.onerror?.(error);\n });\n\n this.process.on('spawn', () => {\n resolve();\n });\n\n this.process.on('close', _code => {\n this.process = undefined;\n this.onclose?.();\n });\n\n this.process.stdin?.on('error', error => {\n this.onerror?.(error);\n });\n\n this.process.stdout?.on('data', chunk => {\n this.readBuffer.append(chunk);\n this.processReadBuffer();\n });\n\n this.process.stdout?.on('error', error => {\n this.onerror?.(error);\n });\n } catch (error) {\n reject(error);\n this.onerror?.(error);\n }\n });\n }\n\n private processReadBuffer() {\n while (true) {\n try {\n const message = this.readBuffer.readMessage();\n if (message === null) {\n break;\n }\n\n this.onmessage?.(message);\n } catch (error) {\n this.onerror?.(error as Error);\n }\n }\n }\n\n async close(): Promise<void> {\n this.abortController.abort();\n this.process = undefined;\n this.readBuffer.clear();\n }\n\n send(message: JSONRPCMessage): Promise<void> {\n return new Promise(resolve => {\n if (!this.process?.stdin) {\n throw new MCPClientError({\n message: 'StdioClientTransport not connected',\n });\n }\n\n const json = serializeMessage(message);\n if (this.process.stdin.write(json)) {\n resolve();\n } else {\n this.process.stdin.once('drain', resolve);\n }\n });\n }\n}\n\nclass ReadBuffer {\n private buffer?: Buffer;\n\n append(chunk: Buffer): void {\n this.buffer = this.buffer ? Buffer.concat([this.buffer, chunk]) : chunk;\n }\n\n readMessage(): JSONRPCMessage | null {\n if (!this.buffer) return null;\n\n const index = this.buffer.indexOf('\\n');\n if (index === -1) {\n return null;\n }\n\n const line = this.buffer.toString('utf8', 0, index);\n this.buffer = this.buffer.subarray(index + 1);\n return deserializeMessage(line);\n }\n\n clear(): void {\n this.buffer = undefined;\n }\n}\n\nfunction serializeMessage(message: JSONRPCMessage): string {\n return JSON.stringify(message) + '\\n';\n}\n\nexport function deserializeMessage(line: string): JSONRPCMessage {\n return JSONRPCMessageSchema.parse(JSON.parse(line));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,aAAkB;;;ACAlB,gBAAkB;AA4BlB,IAAM,qCAAqC,YAAE,YAAY;AAAA,EACvD,MAAM,YAAE,OAAO;AAAA,EACf,SAAS,YAAE,OAAO;AACpB,CAAC;AAIM,IAAM,mBAAmB,YAAE,YAAY;AAAA,EAC5C,OAAO,YAAE,SAAS,YAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC;AACxC,CAAC;AAEM,IAAM,eAAe;AAErB,IAAM,gBAAgB,YAAE,OAAO;AAAA,EACpC,QAAQ,YAAE,OAAO;AAAA,EACjB,QAAQ,YAAE,SAAS,gBAAgB;AACrC,CAAC;AAUD,IAAM,2BAA2B,YAAE,YAAY;AAAA,EAC7C,cAAc,YAAE,SAAS,YAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC;AAAA,EAC7C,SAAS,YAAE,SAAS,YAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC;AAAA,EACxC,SAAS,YAAE;AAAA,IACT,YAAE,YAAY;AAAA,MACZ,aAAa,YAAE,SAAS,YAAE,QAAQ,CAAC;AAAA,IACrC,CAAC;AAAA,EACH;AAAA,EACA,WAAW,YAAE;AAAA,IACX,YAAE,YAAY;AAAA,MACZ,WAAW,YAAE,SAAS,YAAE,QAAQ,CAAC;AAAA,MACjC,aAAa,YAAE,SAAS,YAAE,QAAQ,CAAC;AAAA,IACrC,CAAC;AAAA,EACH;AAAA,EACA,OAAO,YAAE;AAAA,IACP,YAAE,YAAY;AAAA,MACZ,aAAa,YAAE,SAAS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