fix: convert agent-network.ts and self-improvement.ts to zod/v4
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.<type>().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.
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user