@ariaflowagents/voice-protocol
v0.2.0
Published
Canonical client-server wire protocol for AriaFlow voice transports. Pure TypeScript types + optional Zod schemas, zero runtime.
Downloads
49
Maintainers
Readme
@ariaflowagents/voice-protocol
Canonical client-server wire protocol for AriaFlow voice transports.
Pure TypeScript types plus an optional Zod schema subpath. Zero runtime.
This package is a verbatim lift of the protocol types from
@cloudflare/voice
(see NOTICE for Apache-2.0 attribution). Publishing them here
makes the wire protocol a formal AriaFlow contract: every transport
(Cloudflare DO, Node WS, LiveKit, SIP, Twilio, SMARTPBX) can emit identical
frames, and a single client library — useVoiceAgent from
@cloudflare/voice/react — consumes all of them unmodified.
Install
pnpm add @ariaflowagents/voice-protocol
# optional, only if you import the /zod subpath
pnpm add zodMain export
import {
VOICE_PROTOCOL_VERSION,
type VoiceClientMessage,
type VoiceServerMessage,
type VoiceStatus,
type VoiceRole,
type VoiceAudioFormat,
type VoicePipelineMetrics,
type TranscriptMessage,
type VoiceAudioInput,
type VoiceTransport,
} from "@ariaflowagents/voice-protocol";
// Current wire protocol version. Sent by the server in the initial
// `welcome` frame so clients can detect version mismatches.
VOICE_PROTOCOL_VERSION; // 1Zod subpath
import {
VoiceClientMessageSchema,
VoiceServerMessageSchema,
} from "@ariaflowagents/voice-protocol/zod";
const parsed = VoiceClientMessageSchema.safeParse(frameFromWire);
if (!parsed.success) {
// reject malformed frame
}zod is declared as an optional peer dependency; install it only if you
use this subpath.
Versioning
VOICE_PROTOCOL_VERSION is the wire-format version. The package's own
semver tracks the TypeScript surface. A major package bump does not
imply a wire-protocol break; a wire-protocol break bumps the constant.
License
MIT. Portions of the types were lifted from @cloudflare/voice; see
NOTICE for full Apache-2.0 attribution.
