Protocol Package Guide
Use this guide when you are developing packages/protocol.
What this module owns
packages/protocol is the pure protocol layer. It owns:
- message schema
- capability descriptors
- serialized error shape
- guards and validation helpers
Build and test
Use the package-scoped commands first:
bash
pnpm --filter @modeldriveprotocol/protocol build
pnpm --filter @modeldriveprotocol/protocol testCommon development workflow
Start here when the change affects protocol contract rather than runtime behavior.
Typical loop:
- update
src/models.ts,src/messages.ts,src/errors.ts, orsrc/guards.ts - update focused guard or contract tests under
packages/protocol/test - rebuild the package
- only then update server or client code that consumes the contract
Debugging expectations
This package has no runtime process to launch. Debugging is mostly:
- reading the resulting types and message shape
- running the protocol package tests
- verifying downstream compile and unit-test impact in
packages/clientandpackages/server
If a protocol change crosses layers, validate in this order:
bash
pnpm --filter @modeldriveprotocol/protocol test
pnpm --filter @modeldriveprotocol/client test
pnpm --filter @modeldriveprotocol/server test
pnpm test