Help us shape the future of Go! Take the 2026 Go Developer Survey

protocol

package module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

README

agentdock-protocol

Shared contracts used by AgentDock and NexusDock.

The repository intentionally has two logical layers:

  • the root protocol package owns only the AgentDock ↔ NexusDock Bridge wire protocol: envelopes, Hello capabilities, operations, and MCP App resource identities/contracts;
  • mcpcontract owns only the canonical model-facing MCP contracts shared by the two entrypoints: input/output schemas, annotations, and bounded behavior vectors.

Neither package owns AgentDock runtime behavior, NexusDock stores, renderer HTML, Recall persistence, Workflow persistence, or HTTP handlers. Those remain in their application repositories.

Documentation

Index

Constants

View Source
const (
	MessageNodeHello     = "node.hello"
	MessageNodeReady     = "node.ready"
	MessageNodeHeartbeat = "node.heartbeat"
	MessageToolInvoke    = "tool.invoke"
	MessageToolResult    = "tool.result"
	MessageToolError     = "tool.error"
	MessageToolCancel    = "tool.cancel"
)
View Source
const (
	OperationRuntimeRequest = "runtime.request"
	OperationContextLocal   = "context.local"
	OperationToolCall       = "tool.call"
	OperationResourceRead   = "resource.read"
	OperationArtifactRead   = "artifact.read"
)
View Source
const (
	// ArtifactReadCapability is the frozen Bridge capability token for private Artifact reads.
	ArtifactReadCapability = "bridge.artifact.read.v1"
	// MaxArtifactChunkBytes bounds one raw Artifact chunk before JSON/base64 encoding on the Bridge.
	MaxArtifactChunkBytes = 512 << 10
)
View Source
const (
	ContextUIResourceURI      = "ui://agentdock/context"
	TaskProgressUIResourceURI = "ui://agentdock/task-progress"
	FileChangeUIResourceURI   = "ui://agentdock/file-change"
	RecallUIResourceURI       = "ui://agentdock/recall"
	WorkflowUIResourceURI     = "ui://agentdock/workflow"
	DynamicMCPUIResourceURI   = "ui://agentdock/dynamic-mcp"
	ArtifactUIResourceURI     = "ui://agentdock/artifact"
	ACPStatusUIResourceURI    = "ui://agentdock/acp-status"
)
View Source
const (
	ContextUIContract      = "agentdock.context.fleet.v1"
	TaskProgressUIContract = "agentdock.task-progress.v1"
	FileChangeUIContract   = "agentdock.file-change.v1"
	RecallUIContract       = "agentdock.recall.v1"
	WorkflowUIContract     = "agentdock.workflow.v1"
	DynamicMCPUIContract   = "agentdock.dynamic-mcp.v1"
	ArtifactUIContract     = "agentdock.artifact.v1"
	ACPStatusUIContract    = "agentdock.acp-status.v1"
)
View Source
const AgentDockUIResourcePrefix = "ui://agentdock/"
View Source
const ConnectionProtocolVersion = "2"
View Source
const MCPAppMIMEType = "text/html;profile=mcp-app"

Variables

This section is empty.

Functions

func UIResourceContract

func UIResourceContract(uri string) (string, bool)

UIResourceContract returns the renderer contract bound to one AgentDock MCP App URI. URIs identify resources and remain stable; renderer compatibility evolves through the contract string.

Types

type Hello

type Hello struct {
	DeviceID           string                 `json:"device_id"`
	Version            string                 `json:"version"`
	ProtocolVersion    string                 `json:"protocol_version"`
	OS                 string                 `json:"os"`
	Arch               string                 `json:"arch"`
	Capabilities       []string               `json:"capabilities"`
	BridgeCapabilities []string               `json:"bridge_capabilities,omitempty"`
	ToolContractHash   string                 `json:"tool_contract_hash"`
	Tools              []ToolDescriptor       `json:"tools"`
	UIResources        []UIResourceCapability `json:"ui_resources"`
}

Hello is the complete node capability snapshot sent at connection time.

type Message

type Message struct {
	Type            string          `json:"type"`
	RequestID       string          `json:"request_id,omitempty"`
	Operation       string          `json:"operation,omitempty"`
	Arguments       json.RawMessage `json:"arguments,omitempty"`
	Result          json.RawMessage `json:"result,omitempty"`
	Error           *RemoteError    `json:"error,omitempty"`
	Hello           *Hello          `json:"hello,omitempty"`
	ProtocolVersion string          `json:"protocol_version,omitempty"`
	HeartbeatMS     int             `json:"heartbeat_ms,omitempty"`
}

Message is the AgentDock ↔ NexusDock WebSocket envelope.

type RemoteError

type RemoteError struct {
	Code      string         `json:"code"`
	Message   string         `json:"message"`
	Category  string         `json:"category,omitempty"`
	Retryable bool           `json:"retryable,omitempty"`
	Details   map[string]any `json:"details,omitempty"`
}

func (*RemoteError) Error

func (e *RemoteError) Error() string

type ToolDescriptor

type ToolDescriptor struct {
	Name         string         `json:"name"`
	Title        string         `json:"title,omitempty"`
	Description  string         `json:"description,omitempty"`
	InputSchema  map[string]any `json:"inputSchema"`
	OutputSchema map[string]any `json:"outputSchema,omitempty"`
	Meta         map[string]any `json:"_meta,omitempty"`
	Annotations  map[string]any `json:"annotations,omitempty"`
}

ToolDescriptor is the Bridge projection of an MCP tool descriptor. UI resource capability is deliberately absent: per-tool _meta.ui is presentation binding only.

type UIResourceCapability

type UIResourceCapability struct {
	URI      string `json:"uri"`
	Contract string `json:"contract"`
	MIMEType string `json:"mime_type"`
}

UIResourceCapability advertises a resource the node can actually serve through resource.read.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL