Skip to content

feat(transport): add CEP-15 i/k discovery tags#44

Open
abhayguptas wants to merge 11 commits intoContextVM:masterfrom
abhayguptas:feat/cep-15-common-schema-discovery-tags
Open

feat(transport): add CEP-15 i/k discovery tags#44
abhayguptas wants to merge 11 commits intoContextVM:masterfrom
abhayguptas:feat/cep-15-common-schema-discovery-tags

Conversation

@abhayguptas
Copy link
Copy Markdown

Summary

This PR is the next stacked CEP-15 step on top of #38.

It adds the NIP-73 discovery tags described in CEP-15 to public kind:11317 tools/list announcements. For opted-in common-schema tools, the SDK now publishes:

  • ["i", schemaHash, toolName] for each implemented common schema
  • ["k", "io.contextvm/common-schema"] once per event

This complements the _meta.schemaHash work from #38 by making common-schema providers discoverable directly through announcement tags.

Changes

  • extend withCommonToolSchemas() with a pure CEP-15 i/k tag producer
  • add a generic list-tools announcement tag seam in NostrServerTransport
  • attach those tags to public tools/list announcement events in AnnouncementManager
  • add unit tests for i/k tag generation
  • extend the transport integration test to verify the outer announcement tags

Tests

  • bun test src/transport/server-transport-common-schemas.test.ts src/transport/nostr-server-transport.test.ts
  • bun run typecheck

Notes

This PR is intentionally scoped to outer announcement discovery tags only.

It builds on:

@abhayguptas
Copy link
Copy Markdown
Author

cc - @ContextVM-org

@ContextVM-org
Copy link
Copy Markdown
Contributor

ContextVM-org commented Apr 7, 2026

The main improvement I would suggest is in server-transport-common-schemas.ts: the schema hash is currently recomputed in both createCommonSchemaToolsResultTransformer() and createCommonSchemaAnnouncementTagsProducer(). It is not a big issue, but it does feel like a bit of duplicated work and duplicated logic inside the same helper module, so I would consider extracting that into one small shared internal helper. I also think it would be nice to make sure the no‑op path in the transformer stays cheap, since right now it looks like it may still allocate metadata objects even when the schema hash is already present.

@abhayguptas
Copy link
Copy Markdown
Author

Thanks, agreed. I extracted the schema-hash access into a small shared internal helper in server-transport-common-schemas.ts and updated the announcement tag producer to reuse that path instead of duplicating the inline hash logic.

I also kept the transformer no-op path cheap and added focused coverage for both the already-present schemaHash case and the announcement-tag reuse path.

@ContextVM-org
Copy link
Copy Markdown
Contributor

How would you like to proceed with your prs? Should we just merge one by one or merge them all in #44 and merge them all together?

@abhayguptas
Copy link
Copy Markdown
Author

We can merge them one by one in stack order. #44 contains the earlier commits in its history, but I think the separate PRs are easier to review and reason about since each one stays focused on a single step.

@ContextVM-org
Copy link
Copy Markdown
Contributor

For this time is ok, but I think that for scoped prs like this one is better to keep them in a single pr, because currently there are some comments that are sparsed between different prs and makes this a bit awkward to track

@abhayguptas
Copy link
Copy Markdown
Author

That makes sense, agreed. For this round we can keep the scoped CEP-15 changes consolidated here so the review stays easier to follow, and from next time I’ll avoid splitting work like this across multiple PRs unless it is really necessary.

@ContextVM-org
Copy link
Copy Markdown
Contributor

Last thing before merge this pr, add a changeset

@abhayguptas
Copy link
Copy Markdown
Author

@ContextVM-org hi, I have added the changeset. Please review it and if everything looks good then we can merge those PR's.

@abhayguptas abhayguptas force-pushed the feat/cep-15-common-schema-discovery-tags branch 3 times, most recently from ba2eaaa to 2e27fe9 Compare May 2, 2026 05:41
@abhayguptas abhayguptas force-pushed the feat/cep-15-common-schema-discovery-tags branch from 2e27fe9 to 864257f Compare May 2, 2026 05:58
Copy link
Copy Markdown
Contributor

@ContextVM-org ContextVM-org left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor comments before merge.

Comment thread src/core/utils/common-schema.ts Outdated
Comment thread src/transport/server-transport-common-schemas.ts Outdated
Comment thread src/core/utils/common-schema.ts Outdated
@abhayguptas abhayguptas force-pushed the feat/cep-15-common-schema-discovery-tags branch from 17033c2 to 2f30fda Compare May 2, 2026 15:17
@abhayguptas
Copy link
Copy Markdown
Author

Just some minor comments before merge.

fixed, please review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants