Documentation
¶
Overview ¶
Package clientcmd is the agent's side of lockfile, shared by the CLI and the MCP server: it calls a running console and turns every answer into a value of the closed list of docs/security-model.md. Nothing the console sends is passed on as text: results are decoded into typed values, and every error becomes a registered refusal or a fixed message chosen here.
Index ¶
- Variables
- func Answers(ctx context.Context, profile, handle string) (answers.Result, error)
- func HeartbeatEvery(q time.Duration) time.Duration
- func Plan(ctx context.Context, profile string, p rpc.PlanParams) (rpc.PlanResult, error)
- func PlanAndRun(ctx context.Context, profile string, p rpc.PlanParams) (answers.Result, error)
- func Plugins(ctx context.Context, profile string) ([]rpc.PluginInfo, error)
- func Quantum(ctx context.Context, profile string) time.Duration
- func Release(ctx context.Context, profile, handle string) (rpc.Released, error)
- func ReleasedText(handle string, r rpc.Released) string
- func Resolve(pinned, arg string) (string, error)
- func Run(ctx context.Context, profile, id string, who ipc.Requester) (answers.Result, error)
- func SourceNames() ([]string, error)
- func Sources(ctx context.Context) ([]rpc.Source, error)
- func StartCommand(profile string) string
- func StatusLines(out []StatusEntry) []string
- func StatusProfile(pinned, arg string) (string, error)
- type Error
- type Kind
- type PendingError
- type Status
- type StatusEntry
Constants ¶
This section is empty.
Variables ¶
var NoConsoleText = "no lockfile console is running: ask the user to start one in the lockfile account (" + StartCommand("NAME") + ")"
NoConsoleText says that no console runs and how to start one.
Functions ¶
func HeartbeatEvery ¶ added in v0.3.0
HeartbeatEvery is the interval of a run's progress notifications for quantum q: q itself, or q divided into equal parts under the 10 s that lockkit's mcpkit.Progress accepts, so that a heartbeat falls on every quantum boundary. 0 (unknown q) leaves lockkit's default.
func Plan ¶
func Plan(ctx context.Context, profile string, p rpc.PlanParams) (rpc.PlanResult, error)
Plan asks the human to approve a plan. In hub mode it answers a *PendingError: the human decides on the hub, and the ticket runs then.
func PlanAndRun ¶
PlanAndRun plans, then runs the plan once approved, on one connection.
func Quantum ¶ added in v0.3.0
Quantum is profile's approved answer quantum as its console reports it, or 0 when it does not answer within the probe timeout.
func ReleasedText ¶ added in v0.3.0
ReleasedText is a release's outcome as text.
func Resolve ¶
Resolve picks the profile of a call: pinned (MCP --profile), given, or the only running console's, probing the consoles once. A given profile no console serves is the unknown_profile refusal naming its start command.
func Run ¶
Run runs an approved plan, or in hub mode a ticket (id is either): a ticket not decided yet answers a *PendingError.
func SourceNames ¶
SourceNames lists the profiles of the running consoles.
func Sources ¶
Sources lists the profiles of the running consoles, sorted. A socket nobody answers on is left out.
func StartCommand ¶
StartCommand is the command that starts profile's console.
func StatusLines ¶
func StatusLines(out []StatusEntry) []string
StatusLines is a status report as text.
func StatusProfile ¶ added in v0.3.0
StatusProfile is the profile a status call reports on: a pinned server's (the argument may only repeat it), else arg ("" for every running console).
Types ¶
type Error ¶
Error is an error as the agent reads it: Msg is a closed code or a fixed text, Refusal the structured refusal when there is one.
type PendingError ¶ added in v0.4.0
type PendingError struct{ Ticket, Lock, Instance string }
PendingError is a plan or run waiting for a decision on the approval hub: run Ticket once it is decided.
func (*PendingError) Error ¶ added in v0.4.0
func (e *PendingError) Error() string
type Status ¶
type Status struct {
Profile string `json:"profile"`
Production bool `json:"production"`
AutoApprove bool `json:"auto_approve"`
Level int `json:"level"`
IdleTimeoutInS int `json:"idle_timeout_in_s"`
SessionEndsInS int `json:"session_ends_in_s"`
Product rpc.Status `json:"product"`
}
Status is a console's state as the agent sees it: console fields of lockkit's status and lockfile's part, nothing else.
type StatusEntry ¶
type StatusEntry struct {
Profile string `json:"profile"`
Console *Status `json:"console,omitempty"`
// Busy: the console is serving another request (waiting for the human
// on a plan, or a run until its quantum) and did not answer in time.
Busy bool `json:"busy,omitempty"`
Error string `json:"error,omitempty"`
Hint string `json:"hint,omitempty"`
}
StatusEntry is one profile's line of a status report: its console's status, or why there is none.