// Package envelope declares the selected-root v1 gRPC envelope constants.
//
// It deliberately contains no server options, interceptors, stats handlers, or
// other transport-host runtime. nexuscrm-api-host and P3 own enforcement using
// these shared facts.
package envelope

const (
	// Use one conventional private unary envelope. Capability-specific semantic
	// validators remain the tighter authority, and mutation chunks retain their
	// independent 120 KiB ceiling below.
	MaxRequestWireBytes  = 4 * 1024 * 1024
	MaxResponseWireBytes = 4 * 1024 * 1024
	CompressionEnabled   = false
	// MaxMutationChunkDataBytes leaves protobuf framing headroom while keeping
	// every client-streaming mutation message inside MaxRequestWireBytes.
	MaxMutationChunkDataBytes = 120 * 1024
	// MaxMutationEncodedCommandBytes bounds complete stream reassembly without
	// weakening the per-message receive cap. The semantic contract proves that
	// its 25 MiB caller-content bound plus the closed 200-operation / 512-field
	// structural wrapper remains below this transport-owned ceiling.
	MaxMutationEncodedCommandBytes = 32 * 1024 * 1024
	ProtocolMajorMetadataKey       = "x-nexuscrm-protocol-major"
	ProtocolMinorMetadataKey       = "x-nexuscrm-protocol-minor"
	CapabilityMetadataKey          = "x-nexuscrm-required-capability"
	// RuntimeDelegationMetadataKey carries one ASCII compact JWS. Workload
	// identity remains transport-authenticated and is never taken from this
	// metadata value alone.
	RuntimeDelegationMetadataKey = "x-nexuscrm-runtime-delegation"
)
