Documentation
¶
Overview ¶
Package applink is the app link: the MCP server through which a persistent agent reaches the application that runs it, and nothing else. The gateway launches it on the runner image with no network and one bind, a socket the agent's supervisor serves; each tool call is forwarded over that socket as one request, and the supervisor's answer is returned as the tool's result. It holds no credential, and the tools it lists are a fixed set per agent: none of them changes what an agent is given, so an agent cannot widen its own grants through it.
This package is part of the embedded runner-image build context and therefore MUST remain stdlib-only.
Index ¶
Constants ¶
const ( SocketDir = "/run/agentry" SocketMount = SocketDir + "/app.sock" )
SocketMount is where the app link finds the supervisor's socket: the supervisor's own, bound by its exact path, or, where the engine's daemon runs in a VM, the relay's, in a volume mounted at SocketDir.
const ( SetMain = "main" SetAssistant = "assistant" )
The tool sets, by the agent they are for.
const ( TaskAdd = "task_add" TaskList = "task_list" TaskUpdate = "task_update" TaskRemove = "task_remove" )
The Assistant's task tools: the tasks its heartbeat fires, which it registers itself. A task is a turn at a time; it grants nothing.
const MaxLine = 4 << 20
MaxLine bounds a line either way, on the socket and on the relay's stdio.
const SelfConfigure = "self_configure"
SelfConfigure is the Assistant's tool for its own name and personality.
const ServerName = "agentry-applink"
ServerName is the app link's name in the gateway's catalog.
Variables ¶
var CallTimeout = 30 * time.Minute
CallTimeout bounds one call: a QuickAgent's run is answered once it is started, and a consent waits for the person.
Functions ¶
func Relay ¶
func Relay(ctx context.Context, cfg RelayConfig) error
Relay serves the socket until In ends or ctx is done.
Types ¶
type Frame ¶
type Frame struct {
ID uint64 `json:"id,omitempty"`
Ready bool `json:"ready,omitempty"`
Request *Request `json:"request,omitempty"`
Answer *Answer `json:"answer,omitempty"`
}
Frame is one line between the relay and the CLI: the relay's ready line, a call it carries out (ID and Request), or the answer carried back (ID and Answer).
type RelayConfig ¶
type RelayConfig struct {
// Listen is the socket's path.
Listen string
// Owner is the uid:gid the socket is given, the app link's user; empty
// leaves it the relay's.
Owner string
// In carries the answers from the CLI, Out the calls to it.
In io.Reader
Out io.Writer
// Log takes what goes wrong.
Log io.Writer
}
RelayConfig is what the relay serves.
type Request ¶
type Request struct {
Tool string `json:"tool"`
Arguments json.RawMessage `json:"arguments,omitempty"`
}
Request is one tool call as the app link sends it over the socket: one JSON line on a connection of its own.