Documentation
¶
Overview ¶
Package rpc holds the wire types of lockfile's console methods, shared by the console's backend and its clients (CLI and MCP). Every result is built from the closed list of docs/security-model.md.
Index ¶
Constants ¶
const ( MethodPlugins = "file.plugins" MethodPlan = "file.plan" MethodRun = "file.run" MethodAnswers = "file.answers" MethodRelease = "file.release" )
Method names. lockkit serves hello, status, change.request and logout.
const ( MsgPlanParams = "invalid params: give exactly one of key and handle, 1 or more distinct plugins, an intent of at most 200 bytes" MsgParams = "invalid params" MsgNoSuchPlan = "unknown, used or expired plan, or the policy changed since it was approved: plan again" MsgConnLost = "the console lost its connection to the source; the human must restart or reconnect it" MsgPending = "a policy change awaits the human in the console" MsgClosed = "the console closed the connection" MsgInternal = "console error" // MsgNoInstanceDir names a leftover --instance or <PREFIX>INSTANCE // whose lock directory is not mounted here; it never carries the name. MsgNoInstanceDir = "no lock directory for the instance set by --instance or LOCKFILE_INSTANCE: no lock of that name is mounted here" // MsgRunTicket refuses a run by plan id: the console is hub-attached, // and only the ticket file.plan answered runs. MsgRunTicket = "in hub mode, run the ticket file.plan answered" )
Fixed texts of the errors that are not refusals: none carries anything the agent did not send. Clients print these, never the console's text.
const MaxIntent = 200
MaxIntent bounds the agent's one-line reason shown on the approval screen, in bytes.
const MaxQuantumMS = 3_600_000
MaxQuantumMS bounds the answer quantum a client accepts from a status.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandleParams ¶
type HandleParams struct {
Handle string `json:"handle"`
}
HandleParams names a fetched file.
type PlanParams ¶
type PlanParams struct {
Key string `json:"key,omitempty"`
Handle string `json:"handle,omitempty"`
Plugins []string `json:"plugins"`
Intent string `json:"intent,omitempty"`
// Requester is the agent behind the request (mcpkit.RequesterFromEnv):
// in hub mode the plan is bound to its token.
Requester ipc.Requester `json:"requester,omitzero"`
}
PlanParams asks the human to approve a plan: a fetch of Key, or a follow-up on Handle (exactly one), and the plugins to run on it.
type PlanResult ¶
type PlanResult struct {
PlanID string `json:"plan_id"`
// Answers is how many answers the plan reveals at most.
Answers int `json:"answers"`
// In hub mode the plan waits for a decision on the hub: Status is
// "pending" and Ticket names the ticket to run once it is decided
// (console.PendingResp; no PlanID).
Status string `json:"status,omitempty"`
Ticket string `json:"ticket,omitempty"`
Lock string `json:"lock,omitempty"`
Instance string `json:"instance,omitempty"`
}
PlanResult names an approved plan, run once with file.run.
type PluginInfo ¶
type PluginInfo struct {
Plugin string `json:"plugin"`
Version string `json:"version"`
Marketplace string `json:"marketplace"`
Official bool `json:"official"`
Warning string `json:"warning,omitempty"`
Question string `json:"question"`
One string `json:"one"`
Zero string `json:"zero"`
}
PluginInfo is an installed, approved plugin as its signed manifest describes it.
type Released ¶
type Released struct {
Released bool `json:"released"`
}
Released answers file.release.
type RunParams ¶
type RunParams struct {
PlanID string `json:"plan_id,omitempty"`
Ticket string `json:"ticket,omitempty"`
Requester ipc.Requester `json:"requester,omitzero"`
}
RunParams runs an approved plan, or in hub mode the plan of a decided ticket.
type Source ¶
type Source struct {
Profile string `json:"profile"`
Production bool `json:"production"`
// Busy: the console is serving another request (a plan waiting for the
// human, or a run until its quantum), so Production is not known yet.
Busy bool `json:"busy,omitempty"`
}
Source is a running console's profile.
type Status ¶
type Status struct {
Protocol int `json:"protocol"`
Sandbox string `json:"sandbox"` // "ok" or "unavailable"
// AnswerQuantumMS is the approved answer_quantum, in milliseconds (0:
// unknown). Clients pace their run heartbeats on it.
AnswerQuantumMS int64 `json:"answer_quantum_ms,omitempty"`
}
Status is lockfile's part of the status method.