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
- Variables
- func Compose(names ...string) string
- func Has(set, part string) bool
- func IsMeetingTool(tool string) bool
- func IsSubagentTool(tool string) bool
- func ParseMeetingCancel(raw json.RawMessage) (string, error)
- func Parts() []string
- func Relay(ctx context.Context, cfg RelayConfig) error
- func Serve(ctx context.Context, in io.Reader, out, logw io.Writer, set, socket string) error
- func SetParts(set string) []string
- func Tools(set string) []string
- type Answer
- type Frame
- type MeetingArmArgs
- type RelayConfig
- type Request
- type Tool
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 ( PartSelf = "self" PartTasks = "tasks" PartRecall = "recall" PartHelper = "helper" PartMeetings = "meetings" )
The parts a tool set is composed of, each the tools of one capability the agent declares: its own name and persona (PartSelf), its tasks (PartTasks), the search of its earlier conversations (PartRecall), Agentry's helper tools (PartHelper), the meeting tools (PartMeetings) and the subagent tools (PartSubagents, subagents.go). A set is the parts it has, in this order, joined by commas (Compose).
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 ( MeetingArm = "meeting_arm" MeetingList = "meeting_list" MeetingCancel = "meeting_cancel" )
The Assistant's meeting tools: it arms Agentry Desktop to record a call during a meeting the person asked it to record, lists what is armed and cancels a window. The application answers them; an armed window records only a call the application detects inside it, so a meeting nobody joins records nothing.
An armed window opens ArmLead before the meeting starts and closes ArmTail after it ends. A window that would open more than ArmAhead from now is refused: arming is done close to the meeting, so a calendar read hours earlier never holds a recording open for a meeting that moved.
const ( MaxMeetingLength = 12 * time.Hour MaxMeetingTitle = 200 MaxMeetingAttendee = 200 MaxMeetingAttendees = 100 MaxMeetingAppHint = 64 MaxMeetingWindowID = 64 )
The bounds of meeting_arm's arguments.
const ( SubagentList = "subagent_list" SubagentRun = "subagent_run" SubagentResult = "subagent_result" )
The subagent tools: a persistent agent starts runs of the QuickAgents its roster names as subagents, each an ordinary autonomous run of the version its roster pins, in a sandbox of its own under its own contract. The agent names only a subagent its roster has on, and it can add none.
const MaxLine = 4 << 20
MaxLine bounds a line either way, on the socket and on the relay's stdio.
const MaxSubagentFiles = 20
MaxSubagentFiles bounds the files one subagent_run takes.
const PartSubagents = "subagents"
PartSubagents is the part of an agent with subagents: given by the subagents its release declares or the person adds, not by a key.
const Recall = "recall"
Recall is the Assistant's search of its own earlier conversations: it reads what was said, and changes nothing.
const RecallMaxLimit = 20
RecallMaxLimit bounds the turns one recall answers with.
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 ( SetMain = Compose(PartHelper) SetAssistant = Compose(PartSelf, PartTasks, PartRecall, PartHelper, PartMeetings) )
The built-ins' sets: Agentry Helper's is the helper tools, the Assistant's every part.
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 Compose ¶ added in v0.6.1017
Compose is the set of the parts named, in the parts' own order whatever the order given; "" for none. A name that is not a part is left out, so a set never names one (Valid).
func IsMeetingTool ¶ added in v0.6.999
IsMeetingTool says tool is one of the meeting tools.
func IsSubagentTool ¶ added in v0.7.1
IsSubagentTool says tool is one of the subagent tools.
func ParseMeetingCancel ¶ added in v0.6.999
func ParseMeetingCancel(raw json.RawMessage) (string, error)
ParseMeetingCancel reads meeting_cancel's argument, the window's id.
func Parts ¶ added in v0.6.1017
func Parts() []string
Parts are the parts there are, in the order a set lists them.
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 MeetingArmArgs ¶ added in v0.6.999
type MeetingArmArgs struct {
Start time.Time `json:"start"`
End time.Time `json:"end"`
Title string `json:"title"`
Attendees []string `json:"attendees,omitempty"`
App string `json:"app,omitempty"`
}
MeetingArmArgs are meeting_arm's arguments.
func ParseMeetingArm ¶ added in v0.6.999
func ParseMeetingArm(raw json.RawMessage, now time.Time) (MeetingArmArgs, error)
ParseMeetingArm reads meeting_arm's arguments and holds them to its rules at now: two times with their offsets, the end after the start and still to come, the window opening within ArmAhead, a title, and each text within its bound. An argument it does not know refuses the call.
func (MeetingArmArgs) Closes ¶ added in v0.6.999
func (a MeetingArmArgs) Closes() time.Time
Closes is when the armed window closes.
func (MeetingArmArgs) Opens ¶ added in v0.6.999
func (a MeetingArmArgs) Opens() time.Time
Opens is when the armed window opens.
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.