@rnby/racp-codec
v0.1.0
Published
Language-neutral RACP v1 binary envelope codec.
Downloads
220
Maintainers
Readme
@rnby/racp-codec
Strict, dependency-free RACP v1 binary envelope codec with SHA-256 integrity,
bounded fields, and byte-oriented pack, unpack, and conversion helpers.
npm install @rnby/racp-codecThe language-neutral golden vectors live in the
rnby-ai/racp repository.
import { RACP_INTENT_CODES, pack, unpack } from "@rnby/racp-codec";
const { envelope } = await pack({
intentCode: RACP_INTENT_CODES.QUERY,
fromAgent: "@planner",
toAgent: "@reviewer",
sentAtMillis: Date.now(),
payload: new TextEncoder().encode("Review this change."),
});
const decoded = await unpack(envelope);
console.log(decoded.fromAgent, decoded.toAgent, decoded.intent);unpack() validates the complete payload SHA-256 and throws a typed
RacpCodecError on malformed input. Use tryUnpack() at untrusted boundaries
that should return a result instead of throwing.
