diff --git a/claude-code-channel/dist/bin.bundle.mjs b/claude-code-channel/dist/bin.bundle.mjs index d2a3957..aacade9 100755 --- a/claude-code-channel/dist/bin.bundle.mjs +++ b/claude-code-channel/dist/bin.bundle.mjs @@ -18261,16 +18261,7 @@ var Server = class extends Protocol { if (!methodSchema) { throw new Error("Schema is missing a method literal"); } - let methodValue; - if (isZ4Schema(methodSchema)) { - const v4Schema = methodSchema; - const v4Def = v4Schema._zod?.def; - methodValue = v4Def?.value ?? v4Schema.value; - } else { - const v3Schema = methodSchema; - const legacyDef = v3Schema._def; - methodValue = legacyDef?.value ?? v3Schema.value; - } + const methodValue = getLiteralValue(methodSchema); if (typeof methodValue !== "string") { throw new Error("Schema method literal must be a string"); } @@ -18579,8 +18570,17 @@ var Server = class extends Protocol { import process2 from "node:process"; // node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js +var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024; var ReadBuffer = class { + constructor(options) { + this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE; + } append(chunk) { + const newSize = (this._buffer?.length ?? 0) + chunk.length; + if (newSize > this._maxBufferSize) { + this.clear(); + throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`); + } this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk; } readMessage() { @@ -18608,18 +18608,24 @@ function serializeMessage(message) { // node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js var StdioServerTransport = class { - constructor(_stdin = process2.stdin, _stdout = process2.stdout) { + constructor(_stdin = process2.stdin, _stdout = process2.stdout, options) { this._stdin = _stdin; this._stdout = _stdout; - this._readBuffer = new ReadBuffer(); this._started = false; this._ondata = (chunk) => { - this._readBuffer.append(chunk); - this.processReadBuffer(); + try { + this._readBuffer.append(chunk); + this.processReadBuffer(); + } catch (error2) { + this.onerror?.(error2); + this.close().catch(() => { + }); + } }; this._onerror = (error2) => { this.onerror?.(error2); }; + this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize }); } /** * Starts listening for messages on stdin. diff --git a/claude-code-channel/package-lock.json b/claude-code-channel/package-lock.json index 8753bcb..1e9ac22 100644 --- a/claude-code-channel/package-lock.json +++ b/claude-code-channel/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0-alpha.2", "license": "Apache-2.0", "dependencies": { - "@modelcontextprotocol/sdk": "^1.29.0", + "@modelcontextprotocol/sdk": "^1.31.0", "@world2agent/sdk": "^0.1.0-alpha.0" }, "bin": { @@ -479,12 +479,12 @@ } }, "node_modules/@modelcontextprotocol/sdk": { - "version": "1.29.0", - "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.29.0.tgz", - "integrity": "sha512-zo37mZA9hJWpULgkRpowewez1y6ML5GsXJPY8FI0tBBCd77HEvza4jDqRKOXgHNn867PVGCyTdzqpz0izu5ZjQ==", + "version": "1.31.0", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.31.0.tgz", + "integrity": "sha512-UvTMgnNlnIBO/22ob2RcVGDlcvOslQs8T59+FTGdA0L27a39fdGF/EDETNtDVK4DZGpwomlsYpRdA8UXcVL/pw==", "license": "MIT", "dependencies": { - "@hono/node-server": "^1.19.9", + "@hono/node-server": "^1.19.9 || ^2.0.5", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", "content-type": "^1.0.5", diff --git a/claude-code-channel/package.json b/claude-code-channel/package.json index f50c624..af7c6ef 100644 --- a/claude-code-channel/package.json +++ b/claude-code-channel/package.json @@ -37,7 +37,7 @@ "prepublishOnly": "pnpm run clean && pnpm run build" }, "dependencies": { - "@modelcontextprotocol/sdk": "^1.29.0", + "@modelcontextprotocol/sdk": "^1.31.0", "@world2agent/sdk": "^0.1.0-alpha.0" }, "devDependencies": {