From 8a42acad8f48664a1f12c104ae35ef10b99a1d05 Mon Sep 17 00:00:00 2001 From: FilipBl4gojevic <84703395+FilipBl4gojevic@users.noreply.github.com> Date: Mon, 27 Jul 2026 16:57:31 +0200 Subject: [PATCH] fix: convert agent-network.ts and self-improvement.ts to zod/v4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both files carry @ts-nocheck, so there's no type-inference benefit here (that was vector.ts's problem, fixed separately). This is purely about making the runtime JSON Schema serializer uniform across all 23 tools: the MCP SDK routes Zod v3 schemas through the vendored zod-to-json-schema and Zod v4 schemas through Zod's own native toJSONSchema, and the two disagree on `additionalProperties` for object schemas. Converting vector.ts alone left the surface split 11 "open" (v4, additionalProperties absent) / 12 "closed" (v3, additionalProperties: false). Plain import swaps — neither file uses z.record, so no signature changes were needed. Both files use z.().default(...) on several fields (agent-network.ts: limit; self-improvement.ts: proposalOutputIndex, priority, focus); verified via the SDK's own zod-compat safeParseAsync/objectFromShape helpers that omitting each of those fields still resolves to its default under zod/v4, exactly as under v3. Also verified live: a missing required argument is still rejected (schema-validation error, not a handler crash) on one tool from each of the three files. Confirmed post-conversion: all 23 tools report additionalProperties consistently (0 false / 23 absent — uniform), typecheck stays clean (these files are excluded from it), and build + unit tests pass. --- src/vector/agent-network.ts | 2 +- src/vector/self-improvement.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vector/agent-network.ts b/src/vector/agent-network.ts index 90981ac..c2ddc19 100644 --- a/src/vector/agent-network.ts +++ b/src/vector/agent-network.ts @@ -1,7 +1,7 @@ // @ts-nocheck // Agent network tools: register, discover, message, get_profile, update, deregister, transfer -import { z } from "zod"; +import { z } from "zod/v4"; import { Lucid, fromText, toText, Data, Constr, validatorToAddress, validatorToScriptHash, getAddressDetails, credentialToAddress } from '@lucid-evolution/lucid'; import { blake2b } from '@noble/hashes/blake2b'; import { OgmiosProvider } from './ogmios-provider.js'; diff --git a/src/vector/self-improvement.ts b/src/vector/self-improvement.ts index 1c7d5b4..ea03207 100644 --- a/src/vector/self-improvement.ts +++ b/src/vector/self-improvement.ts @@ -2,7 +2,7 @@ // Self-Improvement Module tools: submit proposal, critique, endorse, browse, analyze metrics // Game 6 of the Vector game theory ecosystem -import { z } from "zod"; +import { z } from "zod/v4"; import { Lucid, fromText, toText, Data, Constr, credentialToAddress, getAddressDetails, SLOT_CONFIG_NETWORK } from '@lucid-evolution/lucid'; // Vector slot config - resolved from chain via Ogmios queryNetwork/startTime