Documentation
¶
Index ¶
Constants ¶
const ( // PairPath accepts POST with a JSON PairRequest and answers 201 Created with a PairResponse. // Any other status means pairing failed; the error body is implementation specific. PairPath = "/v1/nodes/pair" // ConnectPath is the WebSocket upgrade endpoint (ws/wss matching the endpoint scheme). // The upgrade request carries "Authorization: Bearer <device_token>". After the upgrade the // node sends MessageNodeHello first and the server answers MessageNodeReady. ConnectPath = "/v1/nodes/connect" )
Node pairing and connection are the only HTTP surfaces a node uses before the Bridge WebSocket is established. Both paths are relative to the Nexus endpoint the node was configured with; a node never discovers or selects anything beyond that endpoint.
const ( MessageNodeHello = "node.hello" MessageNodeReady = "node.ready" MessageNodeHeartbeat = "node.heartbeat" MessageToolInvoke = "tool.invoke" MessageToolResult = "tool.result" MessageToolError = "tool.error" MessageToolCancel = "tool.cancel" )
const ( OperationRuntimeRequest = "runtime.request" OperationContextLocal = "context.local" OperationToolCall = "tool.call" OperationResourceRead = "resource.read" OperationArtifactRead = "artifact.read" )
const ( // CapabilitiesNegotiationCapability marks a node that uses explicit Bridge feature negotiation. // Nodes without this marker are legacy v2 nodes and retain the historical optional-operation behavior. CapabilitiesNegotiationCapability = "bridge.capabilities.v1" // ContextLocalCapability advertises support for context.local. ContextLocalCapability = "bridge.context.local.v1" // RuntimeRequestCapability advertises support for runtime.request. RuntimeRequestCapability = "bridge.runtime.request.v1" // ResourceReadCapability advertises support for resource.read. ResourceReadCapability = "bridge.resource.read.v1" // 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 )
const ( ContextUIResourceURI = "ui://agentdock/context" WorkspaceUIResourceURI = "ui://agentdock/workspace-context" // LegacyTaskProgressUIResourceURI identifies the original one-shot task renderer. // Keep it known so NexusDock can relay old AgentDock nodes during rolling upgrades. LegacyTaskProgressUIResourceURI = "ui://agentdock/task-progress" TaskProgressUIResourceURI = "ui://agentdock/task-progress/v2" 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" ACPPromptUIResourceURI = "ui://agentdock/acp-prompt" ImageUIResourceURI = "ui://agentdock/view-image/v1.html" )
const ( ContextUIContract = "agentdock.context.fleet.v1" WorkspaceUIContract = "agentdock.workspace-context.v1" LegacyTaskProgressUIContract = "agentdock.task-progress.v1" TaskProgressUIContract = "agentdock.task-progress.v2" 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" ACPPromptUIContract = "agentdock.acp-prompt.v1" ImageUIContract = "agentdock.view-image.v1" )
const AgentDockUIResourcePrefix = "ui://agentdock/"
const ConnectionProtocolVersion = "2"
const MCPAppMIMEType = "text/html;profile=mcp-app"
const (
// MaxNodeNameRunes bounds PairRequest.Name after trimming surrounding whitespace.
MaxNodeNameRunes = 100
)
Variables ¶
This section is empty.
Functions ¶
func UIResourceContract ¶
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.
func ValidDeviceID ¶ added in v0.9.0
ValidDeviceID reports whether a node-generated device ID is acceptable on the wire.
func ValidNodeName ¶ added in v0.9.0
ValidNodeName reports whether a trimmed node display name is acceptable on the wire.
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"`
Traceparent string `json:"traceparent,omitempty"`
Tracestate string `json:"tracestate,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"`
// PublicURL is set on MessageNodeReady: the server's public HTTPS origin without a path.
// Nodes derive server callback URLs from it, so servers must not require an extra path prefix.
PublicURL string `json:"public_url,omitempty"`
}
Message is the AgentDock ↔ NexusDock WebSocket envelope.
type PairRequest ¶ added in v0.9.0
type PairRequest struct {
Code string `json:"code"`
DeviceID string `json:"device_id"`
Name string `json:"name"`
}
PairRequest exchanges a short-lived single-use pairing code for a device token.
DeviceID is generated by the node for every pairing and must satisfy ValidDeviceID. The same DeviceID is later sent in Hello.DeviceID, and servers reject a connection whose Hello.DeviceID differs from the DeviceID recorded at pairing.
type PairResponse ¶ added in v0.9.0
type PairResponse struct {
Node PairedNode `json:"node"`
DeviceToken string `json:"device_token"`
WebSocketEndpoint string `json:"websocket_endpoint,omitempty"`
}
PairResponse is the 201 Created body of PairPath. Servers may add fields; nodes must ignore fields they do not know.
type PairedNode ¶ added in v0.9.0
type PairedNode struct {
ID string `json:"id"`
}
PairedNode identifies the node record created by pairing.
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.