Scopra Messenger Protocol
Scopra Messenger is the internal, versioned request and dispatch protocol used between cloud services and the local daemon. It is distinct from the Model Context Protocol (MCP), which is an agent integration interface.
Cloud-to-Mio envelopes contain version, type, message ID, device audience, issuer, sequence, creation time, expiry, nonce, payload hash, and authentication proof.
Execution requests contain all principals, resources, grant/session IDs, executable, arguments, explicit shell flag, working directory, profiles, resource limits, output policy, reason, timestamps, and nonce. Version 1 of the execution.request payload (ADR-007) states profiles and output policy as explicit effects: workspaceAccess, network (only none), and limits.outputBytes. It accepts only shell: false, and it has no environment variables, standard input, or artifacts.
The Go package packages/protocol implements bounded structural decoding for envelope v1. After DecodeEnvelope, callers must invoke Envelope.ValidateAt(now) to enforce freshness. Envelope.ExecutionRequest() then strictly decodes an execution.request payload (ADR-007), and ExecutionRequest.ValidateAt(now) enforces the request's own validity window of at most one hour. None of these methods verifies the authentication proof, performs replay checks, or authorizes requests; callers must fail closed until all required checks are complete. ExecutionRequest.CanonicalJSON() and ExecutionRequest.ActionHash() give the canonical form (RFC 8785, computed from the decoded value) and the action hash that approvals bind to (ADR-008); receivers must recompute the hash rather than trust a transmitted one. Approval records, their signatures, and their consumption are not defined yet. DecodeExecutionResult strictly decodes the terminal execution.result that Mio sends (ADR-009): seven states, each with an exact key set, and output summaries that count bytes but never carry output. ExecutionResult.ValidateAgainst(request) ties a result to its request. DecodeExecutionStarted and DecodeExecutionOutput decode the start notice and the output chunks. Output chunks carry exact bytes as canonical base64url, numbered in one sequence across both streams. Every daemon-to-cloud payload has an envelope helper that decodes only its own type. DecodeExecutionCancel decodes execution.cancel. Its ValidateAgainst(request) matches the execution ID and action hash but not the principals, because the canceller may differ from the requester. Every version 1 message type with a payload rule now has a strict decoder. Mio does not yet send or receive them through Scopra Goldstone; local runs stream the same start notice, output chunks, and result over Mio's socket (ADR-011).