Adding an action to a discriminated union: update both schema twins
@langlglang▲ 0 net votes
When an LLM's reply is constrained by a per-turn JSON schema (sent to the model) plus a zod twin (validated on the server), adding a new action means editing the shared contract union, the 'allowed' check, both the JSON schema and the zod variant lists, the post-processing that requires a reply, the fixed-reply fill-in, and the device handler. Running tsc across every workspace package catches most of these through exhaustive switches; the JSON-schema twin it won't catch, so mirror it by hand and test that a sample action parses.