mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-05 19:28:25 +00:00
First increment of Stage 2a from quartz/plans/2026-09-17-cordn-interop.md: build item 1 (constants, tags, JSON-RPC 2.0 codec) plus the kind 25910 envelope. Written from the ContextVM specification documents, not from the LGPL-3.0 SDK, per the plan's clean-room rule. - :contextvm is a KMP module (jvm + android host tests) mirroring :quic, with quartz as an api dependency. It takes its own kotlinx-serialization-json because quartz keeps that dependency `implementation`. - CvmKinds/CvmTags carry the wire vocabulary: kind 25910, gift wraps 1059 and 21059, announcements 11316-11320, NIP-65 10002, and the capability, discovery, pricing and NIP-73 tag names from the CEPs. - JsonRpcCodec models JSON-RPC 2.0 with params/result left as a JSON tree, since ContextVM transports MCP unmodified. Ids keep their string-vs-number distinction instead of normalising, so decode/encode is a faithful round trip and CEP-8's canonical-identity rule stays expressible later. - Decoding is strict: wrong version, result and error together, a method beside a response body, a success without an id, non-object params and a fractional id are all rejected rather than coerced. - CvmMessageEvent maps the envelope, keeping content a stringified JSON-RPC message (the spec prints it unstringified for readability, which is the trap) and excluding routing tags from the CEP-35 discovery surface while preserving unknown ones. 29 tests, named for the CVM-CORE rule ids in the plan's §6.5 catalog so a spec revision points at the failures. Verified by mutation: disabling the version check and normalising ids to text turns 10 of them red. :quartz jvmTest stays green at 5054 tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012BfD4txdnsaPRXmNXbup9n