8 months ago
dd4e62bReplace ad-hoc validation with reusable zod helpers and per-type schemas in protocolParser. Introduces helper validators (required/optional strings, booleans, numbers, sessionId), schemaWithType/session helpers, and superRefine usage for custom checks (provider auth, MCP server payload, set_config, harness context, etc.). Switch from a discriminatedUnion options array to a lookup map and update safeParseClientMessage to select schema by type. Refactor structured input parsing to use a zod transform/pipe for JSON parsing and validation, simplify parseStructuredToolInput, and add tests for structured input. Tests updated to assert protocol error code and source fields.
Parentcf8f1a9