Documentation
¶
Index ¶
- Constants
- func CompareVersions(a, b string) (int, bool)
- func CompatibilityGuidance(code, client, server, minimum string) string
- func IsAdminSender(name string) bool
- func ProjectRefusalStatus(code string) int
- func RecipientExpectation(raw []byte) (*string, error)
- func SafeHandoverReason(reason string) string
- func SupportsAttachment(capabilities []string) bool
- func SupportsMessageAck(capabilities []string) bool
- func SupportsMessageSentAt(capabilities []string) bool
- func ValidReceiverHolder(h *ReceiverHolder) bool
- func ValidRecipientExpectation(id *string) bool
- func ValidRegistrationID(id string) bool
- func ValidRuntimeLabel(s string, limit int) bool
- func ValidateAnnouncement(body, recipient, registrationID string) error
- func VersionLine(v string) string
- type Activity
- type ActivitySnapshot
- type ActivityState
- type AttachRejection
- type AttachRequest
- type Attachment
- type ClaudeCleanupTarget
- type ClaudeIdentity
- type ClaudeWakeRequest
- type ClaudeWakeResult
- type ClientCompatibility
- type CompatibilityManifest
- type DeliveredMessage
- type DeliveryState
- type HandoverAudit
- type HandoverFrom
- type HandoverRefusal
- type HolderChallenge
- type HolderProof
- type IngressRequest
- type LastManagement
- type ManagementEvent
- type Message
- type MessageBatch
- type PendingProbe
- type ProbeAnswer
- type ProbeResult
- type ProjectRefusal
- type QueueReceipt
- type RebindJournal
- type RebindRequest
- type RebindResult
- type ReceiverHolder
- type RegisterRequest
- type RegisterResult
- type RenameRejection
- type RenameRequest
- type RenewRequest
- type ResumeRequest
- type RetireRejection
- type RetireRequest
- type RetireResult
- type RevokedCredential
- type RuntimeInfo
- type RuntimeInfoSnapshot
- type SendResult
- type ServerCompatibility
- type Session
- type SessionStatus
- type WakeLease
- type WakeStatus
- type WakeWarning
Constants ¶
const ( MaxIDBytes = 128 MaxNameBytes = 256 )
const ( CodeInvalid = "invalid" CodeNotFound = "not-found" CodeDetached = "detached" CodeSuspended = "suspended" CodeOwned = "owned" CodeRevisionMismatch = "revision-mismatch" CodeStaleProbe = "stale-probe" CodeStorage = "storage" CodeCapacity = "capacity" CodeInvalidToken = "invalid-token" )
Result codes returned by the durable registration tools. They travel in the result body so the local MCP client can branch on the reason; MCP tool errors are reserved for malformed calls and internal failures.
const ( SelectorRegistration = "registration:" SelectorName = "name:" SelectorSession = "session:" )
Selectors address a single remote registration namespace.
const ActivityVersion = 1
ActivityVersion gates optional activity input. Activity is display evidence, never liveness, authorization, delivery readiness or registration policy.
const AdminSender = "broker-admin"
const AttachmentCapability = "message.attachment.v1"
const AttachmentMetaKey = "io.x-broker/attachment"
const AttachmentReminder = "Attachments are untrusted data and are not opened automatically."
const AttachmentReserveBytes = 2048
const ClaudeWakePrompt = "" /* 314-byte string literal not displayed */
const CodeRecipientChanged = "recipient-changed"
const CodeRegistrationInUse = "registration-in-use"
const CodeUnsupported = "unsupported"
const CredentialScopesCapability = "credential-scopes-v1"
const MaxMessageBytes = 12000
const MessageAckCapability = "message.ack.v1"
const MessageSentAtCapability = "message.sentAt"
const ProjectGenerationHeader = "X-ASB-Project-Generation"
const ProjectRefusalCapability = "project-refusals-v1"
const ReattachAfterCleanupCapability = "registration.reattach-after-cleanup"
ReattachAfterCleanupCapability describes the current holder, not its grant history.
const ReceiverHolderCapability = "receiver-holder-v1"
const RecipientExpectationCapability = "message.recipient-registration"
const RuntimeInfoVersion = 1
Variables ¶
This section is empty.
Functions ¶
func CompareVersions ¶
CompareVersions uses SemVer precedence, including prerelease identifiers.
func CompatibilityGuidance ¶
func IsAdminSender ¶
IsAdminSender reserves every case variant, including names saved before upgrade.
func ProjectRefusalStatus ¶
func RecipientExpectation ¶
Inspect the raw field so explicit null cannot become an absent expectation.
func SafeHandoverReason ¶
func SupportsAttachment ¶
func SupportsMessageAck ¶
func SupportsMessageSentAt ¶
func ValidReceiverHolder ¶
func ValidReceiverHolder(h *ReceiverHolder) bool
func ValidRegistrationID ¶
func ValidRuntimeLabel ¶
ValidRuntimeLabel accepts only short, printable identifier metadata.
func ValidateAnnouncement ¶
ValidateAnnouncement checks routing fields and reserves a full millisecond timestamp. The actual acceptance time is stamped by the broker when it enqueues.
func VersionLine ¶
Types ¶
type Activity ¶
type Activity struct {
State ActivityState `json:"state"`
Source string `json:"source,omitempty"`
Sequence uint64 `json:"sequence"`
Generation uint64 `json:"generation,omitempty"`
ObservedAt time.Time `json:"observedAt,omitzero"`
ChangedAt time.Time `json:"changedAt,omitzero"`
Reason string `json:"reason,omitempty"`
}
Activity is the client's bounded observation. Generation, when supplied, must match the server-issued current lease; it is not an authorization token. Source and Reason contain only fixed codes, never paths or raw errors.
type ActivitySnapshot ¶
type ActivitySnapshot struct {
Activity
ReceivedAt time.Time `json:"receivedAt,omitzero"`
ExpiresAt time.Time `json:"expiresAt,omitzero"`
}
ActivitySnapshot is a copy of volatile server state. Only server receipt time determines freshness; client timestamps cannot extend it.
type ActivityState ¶
type ActivityState string
const ( ActivityWorking ActivityState = "working" ActivityIdle ActivityState = "idle" ActivityUnknown ActivityState = "unknown" )
type AttachRejection ¶
AttachRejection contains only an allowlisted reason and a fixed user guide. Consumers must rebuild it from Code rather than trusting a remote Message.
func SafeAttachRejection ¶
func SafeAttachRejection(code string) AttachRejection
func (AttachRejection) Error ¶
func (e AttachRejection) Error() string
type AttachRequest ¶
type AttachRequest struct {
Capabilities []string `json:"capabilities,omitempty" jsonschema:"optional delivery capabilities supported by this receiver on this lease"`
ChannelID string `` /* 147-byte string literal not displayed */
Harness string `json:"harness,omitempty" jsonschema:"claude (default) or codex"`
Name string `` /* 148-byte string literal not displayed */
SessionID string `json:"sessionId"`
PID int `json:"pid"`
CWD string `json:"cwd"`
}
AttachRequest connects an existing session without owning its process.
type Attachment ¶
type Attachment struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Size int64 `json:"size,omitempty"`
SHA256 string `json:"sha256,omitempty"`
Path string `json:"path,omitempty"`
Error string `json:"error,omitempty"`
}
func LocalAttachment ¶
func LocalAttachment(a *Attachment) *Attachment
LocalAttachment strips wire-only references at every model projection.
type ClaudeCleanupTarget ¶
type ClaudeIdentity ¶
type ClaudeWakeRequest ¶
type ClaudeWakeRequest struct {
BrokerURL string
Name string
Old ClaudeIdentity
}
type ClaudeWakeResult ¶
type ClaudeWakeResult struct {
OldStopped bool
OldActive bool
Metered bool
New ClaudeIdentity
}
type ClientCompatibility ¶
func ClientPolicy ¶
func ClientPolicy(version string) (ClientCompatibility, bool)
type CompatibilityManifest ¶
type CompatibilityManifest struct {
Schema int `json:"schema"`
Servers []ServerCompatibility `json:"servers"`
Clients []ClientCompatibility `json:"clients"`
}
func ParseCompatibility ¶
func ParseCompatibility(data []byte) (CompatibilityManifest, error)
func (CompatibilityManifest) Client ¶
func (m CompatibilityManifest) Client(version string) (ClientCompatibility, bool)
func (CompatibilityManifest) Server ¶
func (m CompatibilityManifest) Server(version string) (ServerCompatibility, bool)
Unlisted server versions inherit the nearest preceding line, or the oldest entry if they predate the manifest. Dev builds use the newest line. The release guard, rather than an indiscriminate denial, requires an exact release entry.
type DeliveredMessage ¶
type DeliveredMessage struct {
Attachment *Attachment `json:"attachment,omitempty"`
DeliverySequence uint64 `json:"deliverySequence,omitempty"`
FromRegistrationID string `json:"fromRegistrationId,omitempty"`
SentAt time.Time `` /* 128-byte string literal not displayed */
From string `json:"from"`
To string `json:"to"`
Body string `json:"body"`
}
type DeliveryState ¶
type DeliveryState string
const ( DeliveryUnclaimed DeliveryState = "unclaimed" DeliveryClaimedUnknown DeliveryState = "claimed-unknown" DeliveryClaimed DeliveryState = "claimed" )
type HandoverAudit ¶
type HandoverFrom ¶
type HandoverRefusal ¶
type HandoverRefusal struct {
Reason string
HolderChallenge *HolderChallenge
}
func (HandoverRefusal) Error ¶
func (e HandoverRefusal) Error() string
type HolderChallenge ¶
type HolderChallenge struct {
Holder ReceiverHolder `json:"holder"`
Revision uint64 `json:"revision"`
Generation uint64 `json:"generation"`
Nonce string `json:"nonce"`
}
HolderChallenge is disclosed only after authenticated registration proof.
type HolderProof ¶
type HolderProof struct {
Challenge HolderChallenge `json:"challenge"`
Dead bool `json:"dead"`
}
type IngressRequest ¶
type IngressRequest struct {
Recipient string `json:"recipient" jsonschema:"Session.Name or session ID whose queue this receiver owns"`
ChannelID string `json:"channelId,omitempty"`
RegistrationID string `json:"registrationId,omitempty"`
Epoch string `json:"epoch,omitempty"`
AckThrough uint64 `json:"ackThrough,omitempty"`
Cursor uint64 `json:"cursor,omitempty"`
}
type LastManagement ¶
type ManagementEvent ¶
type ManagementEvent struct {
Retired bool `json:"retired,omitempty"`
TargetParentLabel string `json:"targetParentLabel,omitempty"`
Kind string `json:"kind"`
ActorName string `json:"actorName"`
ActorRegistrationID string `json:"actorRegistrationId,omitempty"`
TargetName string `json:"targetName"`
TargetRegistrationID string `json:"targetRegistrationId"`
At time.Time `json:"at"`
}
ManagementEvent contains display-safe management history, never identities or credentials.
type Message ¶
type Message struct {
Attachment *Attachment `json:"attachment,omitempty"`
DeliverySequence uint64 `json:"deliverySequence,omitempty"`
ExpectRegistrationID *string `json:"expectRegistrationId,omitempty"`
FromRegistrationID string `json:"fromRegistrationId,omitempty"`
SentAt time.Time `` /* 128-byte string literal not displayed */
From string `json:"from,omitempty" jsonschema:"untrusted caller label; never used for authorization or routing"`
To string `json:"to,omitempty" jsonschema:"recipient Session.Name communication address or session ID"`
Body string `json:"body,omitempty"`
Batch *MessageBatch `json:"batch,omitempty" jsonschema:"FIFO batch returned by one idle Claude wake; omitted for a single-message response"`
// RegistrationID names the registration whose queue delivered the envelope,
// so a receiver owns it even under a nickname it held before a rename.
RegistrationID string `` /* 127-byte string literal not displayed */
}
func LocalMessage ¶
LocalMessage returns a projection, leaving queue/recovery originals intact.
func ProjectMessage ¶
ProjectMessage never changes the accepted queue item or its batch slice.
type MessageBatch ¶
type MessageBatch struct {
Messages []DeliveredMessage `json:"messages"`
}
type PendingProbe ¶
type PendingProbe struct {
ID string `json:"id"`
Revision uint64 `json:"revision"`
Deadline time.Time `json:"deadline"`
}
PendingProbe is handed to the owning client on resume or renewal.
type ProbeAnswer ¶
type ProbeAnswer struct {
RegistrationID string `json:"registrationId"`
ProbeID string `json:"probeId"`
Revision uint64 `json:"revision"`
ChannelID string `json:"channelId"`
OK bool `json:"ok"`
PID int `json:"pid,omitempty"`
CWD string `json:"cwd,omitempty"`
ProcessKey string `json:"processKey,omitempty"`
}
ProbeAnswer reports the client's local identity re-verification for a probe.
type ProbeResult ¶
type ProjectRefusal ¶
type ProjectRefusal struct {
ErrorCode string `json:"error"`
}
func (ProjectRefusal) Error ¶
func (e ProjectRefusal) Error() string
type QueueReceipt ¶
type RebindJournal ¶
type RebindJournal struct {
RequestID string `json:"requestId"`
TokenID string `json:"tokenId"`
SourceDigest string `json:"sourceDigest"`
RegistrationID string `json:"registrationId"`
ExpectedRevision uint64 `json:"expectedRevision"`
TemporaryNickname string `json:"temporaryNickname"`
Name string `json:"name"`
}
RebindJournal contains only server-observed proof metadata, not resume secrets or raw identities. It is never an MCP tool argument or output.
type RebindRequest ¶
type RebindRequest struct {
Holder *ReceiverHolder `json:"holder,omitempty"`
HolderProof *HolderProof `json:"holderProof,omitempty"`
RegistrationID string `json:"registrationId"`
Harness string `json:"harness"`
SessionID string `json:"sessionId"`
ClientID string `json:"clientId"`
PID int `json:"pid"`
CWD string `json:"cwd"`
ProcessKey string `json:"processKey,omitempty"`
Secret string `json:"secret"`
RequestID string `json:"requestId"`
ExpectedRevision uint64 `json:"expectedRevision"`
}
RebindRequest is an internal, explicitly approved conversation handover. It creates no registration and carries no project token.
func (RebindRequest) RegistrationRequest ¶
func (r RebindRequest) RegistrationRequest() RegisterRequest
type RebindResult ¶
type RebindResult struct {
HolderChallenge *HolderChallenge `json:"holderChallenge,omitempty"`
RegistrationID string `json:"registrationId,omitempty"`
Name string `json:"name,omitempty"`
Revision uint64 `json:"revision,omitempty"`
HandoverFrom *HandoverFrom `json:"handoverFrom,omitempty"`
Reason string `json:"reason,omitempty"`
}
type ReceiverHolder ¶
type ReceiverHolder struct {
DeviceID string `json:"deviceId"`
PID int `json:"pid"`
Incarnation string `json:"incarnation"`
}
ReceiverHolder identifies the receiving client, never its parent harness. Incarnation and DeviceID are domain-separated opaque HMACs, not machine IDs.
type RegisterRequest ¶
type RegisterRequest struct {
Holder *ReceiverHolder `json:"holder,omitempty"`
HolderProof *HolderProof `json:"holderProof,omitempty"`
Capabilities []string `json:"capabilities,omitempty" jsonschema:"optional delivery capabilities supported by this receiver on this lease"`
Harness string `json:"harness"`
SessionID string `json:"sessionId"`
PID int `json:"pid"`
CWD string `json:"cwd"`
ClientID string `json:"clientId" jsonschema:"Stable per-PC client identity generated by the local MCP client"`
Name string `json:"name,omitempty" jsonschema:"Requested communication name; ignored when an admission grant assigns one"`
Token string `json:"token,omitempty" jsonschema:"Optional admission token for token-protected projects; never used for resume"`
ChannelID string `json:"channelId" jsonschema:"Fresh ingress lease for this receiver"`
IngressPending bool `json:"ingressPending,omitempty" jsonschema:"Registration is connected but its local delivery channel has not been activated"`
Secret string `json:"secret" jsonschema:"Client-generated resume secret; the server stores only its hash"`
RequestID string `json:"requestId" jsonschema:"Idempotency key for retries"`
ExpectedRevision uint64 `` /* 179-byte string literal not displayed */
ProcessKey string `json:"processKey,omitempty"`
MAC string `json:"mac,omitempty"`
}
RegisterRequest is the explicit registration issued by the local MCP client when the model calls attach_session. It creates, revives or renames the registration owned by (harness, session UUID, client id).
type RegisterResult ¶
type RegisterResult struct {
ServerVersion string `json:"serverVersion,omitempty"`
MessageAckVersion int `json:"messageAckVersion,omitempty"`
CredentialScopes []string `json:"credentialScopes,omitempty"`
HolderChallenge *HolderChallenge `json:"holderChallenge,omitempty"`
RuntimeInfoVersion int `json:"runtimeInfoVersion,omitempty"`
ActivityVersion int `json:"activityVersion,omitempty"`
Code string `json:"code,omitempty"`
Session Session `json:"session"`
Warning string `json:"warning,omitempty"`
PendingProbe *PendingProbe `json:"pendingProbe,omitempty"`
}
type RenameRejection ¶
type RenameRejection struct {
Code string `json:"code"`
Holder string `json:"holder"`
HolderRegistrationID string `json:"holderRegistrationId,omitempty"`
}
func (RenameRejection) Error ¶
func (e RenameRejection) Error() string
type RenameRequest ¶
type RenameRequest struct {
Name string `json:"name" jsonschema:"New communication nickname for this connected session; duplicates are rejected"`
RegistrationID string `json:"registrationId"`
ChannelID string `json:"channelId"`
}
RenameRequest is the client-to-server request. The local client supplies the registration and lease; the model only chooses Name.
type RenewRequest ¶
type RenewRequest struct {
Epoch string `json:"epoch,omitempty"`
AckThrough uint64 `json:"ackThrough,omitempty"`
RuntimeInfo json.RawMessage `json:"runtimeInfo,omitempty"`
Activity json.RawMessage `json:"activity,omitempty"`
RegistrationID string `json:"registrationId"`
ChannelID string `json:"channelId"`
IngressPending bool `json:"ingressPending,omitempty"`
}
RenewRequest is the heartbeat. It carries the lease, never the secret. Activity is raw optional JSON so invalid observations cannot fail a valid heartbeat in schema validation before authorization and bounded decoding.
type ResumeRequest ¶
type ResumeRequest struct {
Holder *ReceiverHolder `json:"holder,omitempty"`
HolderProof *HolderProof `json:"holderProof,omitempty"`
Capabilities []string `json:"capabilities,omitempty" jsonschema:"optional delivery capabilities supported by this receiver on this lease"`
RegistrationID string `json:"registrationId"`
Harness string `json:"harness"`
SessionID string `json:"sessionId"`
PID int `json:"pid"`
CWD string `json:"cwd"`
ClientID string `json:"clientId"`
ChannelID string `json:"channelId"`
IngressPending bool `json:"ingressPending,omitempty"`
Secret string `json:"secret"`
RequestID string `json:"requestId"`
ProcessKey string `json:"processKey,omitempty"`
ExpectedRevision uint64 `` /* 137-byte string literal not displayed */
}
ResumeRequest restores an existing registration after a client or server restart. It never creates a registration and is rejected after an explicit detach.
type RetireRejection ¶
type RetireRejection struct {
Code string `json:"code"`
Message string `json:"message"`
RegistrationID string `json:"registrationId,omitempty"`
HolderRegistrationID string `json:"holderRegistrationId,omitempty"`
}
func RejectRetire ¶
func RejectRetire(code string) RetireRejection
func (RetireRejection) Error ¶
func (e RetireRejection) Error() string
type RetireRequest ¶
type RetireResult ¶
type RevokedCredential ¶
type RuntimeInfo ¶
type RuntimeInfo struct {
Model string `json:"model,omitempty"`
Effort string `json:"effort,omitempty"`
Sequence uint64 `json:"sequence"`
Generation uint64 `json:"generation"`
ObservedAt time.Time `json:"observedAt"`
}
RuntimeInfo is display-only runtime metadata, deliberately absent from Session.
type RuntimeInfoSnapshot ¶
type RuntimeInfoSnapshot struct {
RuntimeInfo
ReceivedAt time.Time `json:"receivedAt"`
ExpiresAt time.Time `json:"expiresAt"`
}
type SendResult ¶
type SendResult struct {
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
CurrentRegistrationID string `json:"currentRegistrationId,omitempty"`
OK bool `json:"ok"`
Accepted bool `json:"accepted"`
DeliverySequence uint64 `json:"deliverySequence,omitempty"`
MeteredWake bool `json:"meteredWake"`
SessionID string `json:"sessionId,omitempty"`
WakeStatus WakeStatus `json:"wakeStatus"`
Warning WakeWarning `json:"warning,omitempty"`
WarningMessage string `json:"warningMessage,omitempty"`
}
type ServerCompatibility ¶
func ServerPolicy ¶
func ServerPolicy(version string) (ServerCompatibility, bool)
func (ServerCompatibility) Accepts ¶
func (s ServerCompatibility) Accepts(version string) bool
type Session ¶
type Session struct {
HandoverFrom *HandoverFrom `json:"handoverFrom,omitempty"`
LastManagement *LastManagement `json:"lastManagement,omitempty"`
Activity *ActivitySnapshot `json:"activity,omitempty"`
AutomaticDeliveryReady bool `json:"automaticDeliveryReady,omitempty"`
ExternallyManaged bool `json:"externallyManaged,omitempty"`
PendingMessages int `json:"pendingMessages,omitempty"`
ErrorCode string `json:"errorCode,omitempty"`
ID string `json:"id"`
Name string `json:"name" jsonschema:"Session.Name communication address used by other sessions"`
Harness string `json:"harness"`
Status SessionStatus `json:"status"`
PID int `json:"pid,omitempty"`
StartedAt time.Time `json:"startedAt,omitempty"`
Generation uint64 `json:"generation,omitempty"`
DeliverySequence uint64 `json:"deliverySequence,omitempty"`
DeliveryState DeliveryState `json:"deliveryState,omitempty"`
RecoveryID string `json:"recoveryId,omitempty"`
// Durable remote registration fields. Epoch changes on every server start so
// a client can tell a restart from a lease expiry.
RegistrationID string `json:"registrationId,omitempty"`
Suspended bool `json:"suspended,omitempty"`
ClientID string `json:"clientId,omitempty"`
Revision uint64 `json:"revision,omitempty"`
Epoch string `json:"epoch,omitempty"`
RequestedName string `json:"requestedName,omitempty" jsonschema:"Name the client asked for when a UUID nickname was assigned instead"`
ProbePending bool `json:"probePending,omitempty"`
ProbeDeadline time.Time `json:"probeDeadline,omitzero"`
}
type SessionStatus ¶
type SessionStatus string
const ( StatusAlive SessionStatus = "alive" StatusWorking SessionStatus = "working" StatusIdle SessionStatus = "idle" StatusMissing SessionStatus = "missing" StatusSuspended SessionStatus = "suspended" StatusStalled SessionStatus = "stalled" StatusStarting SessionStatus = "starting" StatusStopping SessionStatus = "stopping" StatusWaking SessionStatus = "waking" StatusDegraded SessionStatus = "degraded" )
type WakeStatus ¶
type WakeStatus string
const ( WakeNotNeeded WakeStatus = "not-needed" WakeConfirmed WakeStatus = "confirmed" WakeFailed WakeStatus = "failed" WakeDegraded WakeStatus = "degraded" )
type WakeWarning ¶
type WakeWarning string
const ( WakeWarningStopFailed WakeWarning = "stop-failed" WakeWarningResumeFailed WakeWarning = "resume-failed" WakeWarningRosterMismatch WakeWarning = "roster-mismatch" WakeWarningIdentityCommit WakeWarning = "identity-commit-failed" WakeWarningQueueRekey WakeWarning = "queue-rekey-failed" WakeWarningClaimUnconfirmed WakeWarning = "claim-unconfirmed" WakeWarningRestartRecovery WakeWarning = "restart-recovery-required" )