feat(core): add CEP-15 common schema helpers#37
feat(core): add CEP-15 common schema helpers#37abhayguptas wants to merge 5 commits intoContextVM:masterfrom
Conversation
|
Hi @ContextVM-org, I started with a small first PR for CEP-15 that only covers the core compatibility primitives. This PR adds schema normalization and schema-hash helpers, along with focused tests for the updated normalization rules in the CEP. The goal was to make sure the hashing behavior is clear and validated before moving on to transport-layer integration such as injecting Focused tests are passing locally. The next step I am planning is to wire these helpers into the server transport/announcement flow. |
ContextVM-org
left a comment
There was a problem hiding this comment.
Looks good, but the current implementation needs a few changes to stay consistent with upstream. We just merged #35 and are already using noble‑hashes there. We also need an RFC 8785 compliant library (or reimplement it ourselves) to canonicalize JSON schemas before hashing.
So far, the best candidates are:
Let’s choose the one you think is best. ‘canonicalize’ appears more lightweight.
|
Thanks, I updated the CEP-15 helper implementation to align with upstream. I chose I also replaced Node Current changes in this update:
Verification:
|
b3b5f0a to
c378208
Compare
c378208 to
06dfd3f
Compare
Summary
This PR adds the first CEP-15 implementation building blocks to the SDK.
It introduces helpers for schema normalization and deterministic common-schema hash generation, following the updated CEP-15 draft. The normalization logic recursively removes JSON Schema
titleanddescriptionfields before hashing, so providers with equivalent schemas but different documentation text can still produce the same schema hash.Changes
normalizeSchema()helper for CEP-15 schema normalizationcomputeCommonSchemaHash()helper for deterministic schema hashingTests
bun test src/core/utils/common-schema.test.tsNotes
This PR intentionally keeps the scope small and focused on the core compatibility primitives.
It does not yet:
_meta["io.contextvm/common-schema"].schemaHashintotools/listi/kdiscovery tags to11317announcement eventsThose changes are planned for the next step once the normalization and hashing behavior is established.