agent_client

package
v0.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FrameStdio   byte = 0x00
	FrameControl byte = 0x01
)

Variables

This section is empty.

Functions

func NewAgentClientLogger added in v0.23.0

func NewAgentClientLogger(client *AgentClient, service string) logger.Logger

NewAgentClientLogger creates a new logger that writes to the agent client log stream

func NewAgentServer added in v0.18.0

func NewAgentServer(address, spaceId string, agentClient *AgentClient) *agentServer

func ReadFrame added in v0.23.0

func ReadFrame(r io.Reader) (byte, []byte, error)

func SetAgentClient added in v0.23.0

func SetAgentClient(client *AgentClient)

func WriteFrame added in v0.23.0

func WriteFrame(w io.Writer, frameType byte, payload []byte) error

Types

type AgentClient added in v0.18.0

type AgentClient struct {
	// contains filtered or unexported fields
}

func NewAgentClient added in v0.18.0

func NewAgentClient(defaultServerAddress, spaceId string) *AgentClient

func (*AgentClient) AddPortForward added in v0.24.0

func (c *AgentClient) AddPortForward(entry model.PortForwardEntry) error

func (*AgentClient) CallMethod added in v0.28.0

CallMethod forwards a JSON-RPC call to the method server. In concurrent mode many calls may be in flight at once; in serial mode calls queue one at a time. The caller's original id is preserved on the returned response — the jsonrpc client generates its own wire ids, so they never need to be unique.

func (*AgentClient) ConnectAndServe added in v0.18.0

func (c *AgentClient) ConnectAndServe()

func (*AgentClient) GetAgentToken added in v0.23.0

func (c *AgentClient) GetAgentToken() string

func (*AgentClient) GetLogSinkFormat added in v0.33.0

func (c *AgentClient) GetLogSinkFormat() string

GetLogSinkFormat returns the format mirrored logs are written in.

func (*AgentClient) GetLogSinkPort added in v0.33.0

func (c *AgentClient) GetLogSinkPort() int

GetLogSinkPort returns the advertised log sink port (0 = not a sink).

func (*AgentClient) GetServerURL added in v0.23.0

func (c *AgentClient) GetServerURL() string

func (*AgentClient) GetSpaceId added in v0.22.0

func (c *AgentClient) GetSpaceId() string

func (*AgentClient) HasLiveServerConnection added in v0.28.0

func (c *AgentClient) HasLiveServerConnection() bool

HasLiveServerConnection reports whether the agent currently has at least one knot server connection with a live mux session. Method registration can only be published once a session exists (publishMethods fails, without retry, if none is connected), so startup registration waits on this.

func (*AgentClient) NotifyPortForwardChanged added in v0.31.0

func (c *AgentClient) NotifyPortForwardChanged()

NotifyPortForwardChanged sends a fire-and-forget notification to the server via the mux session, so the server can publish an SSE event to connected web UIs. Used by agentlink handlers when port forwards change locally.

func (*AgentClient) RegisterMethods added in v0.28.0

func (c *AgentClient) RegisterMethods(reg *methods.Registration) error

func (*AgentClient) RemovePortForward added in v0.24.0

func (c *AgentClient) RemovePortForward(localPort uint16) error

func (*AgentClient) ReportEvent added in v0.28.0

func (c *AgentClient) ReportEvent(event *msg.Event) error

func (*AgentClient) RunHealthChecks added in v0.24.0

func (c *AgentClient) RunHealthChecks()

RunHealthChecks starts the health check loop for the agent. It runs once per agent process (not per server connection).

func (*AgentClient) SendLogMessage added in v0.18.0

func (c *AgentClient) SendLogMessage(service string, level msg.LogLevel, message string) error

func (*AgentClient) SendNotification added in v0.28.0

func (c *AgentClient) SendNotification(req msg.CallMethodRequest)

SendNotification forwards a JSON-RPC notification (no id) to the method server. It returns immediately — no response is expected.

func (*AgentClient) SendSSHAuthResult added in v0.33.0

func (c *AgentClient) SendSSHAuthResult(success bool, fingerprint, remoteAddr string)

SendSSHAuthResult reports an SSH public-key authentication attempt to every knot server; each server's session handler decides whether to audit it (zone leaders only, gated by server.audit.space_sessions). Dropped rather than blocked when a server's queue is full — auth attempts are frequent enough that backpressure would stall the SSH handshake.

func (*AgentClient) SendSpaceGetVar added in v0.21.0

func (c *AgentClient) SendSpaceGetVar(name string) (string, error)

func (*AgentClient) SendSpaceNote added in v0.18.0

func (c *AgentClient) SendSpaceNote(note string) error

func (*AgentClient) SendSpaceRestart added in v0.18.0

func (c *AgentClient) SendSpaceRestart() error

func (*AgentClient) SendSpaceStop added in v0.18.0

func (c *AgentClient) SendSpaceStop() error

func (*AgentClient) SendSpaceVar added in v0.21.0

func (c *AgentClient) SendSpaceVar(name, value string) error

func (*AgentClient) SendStructuredLogMessage added in v0.33.0

func (c *AgentClient) SendStructuredLogMessage(service string, level msg.LogLevel, message string, fields map[string]string) error

func (*AgentClient) Shutdown added in v0.18.0

func (c *AgentClient) Shutdown()

func (*AgentClient) UnregisterAllMethods added in v0.28.0

func (c *AgentClient) UnregisterAllMethods() error

UnregisterAllMethods removes all methods from the knot server, stops the stdio method server process, and clears the stashed registration so reconnect doesn't republish dead methods. Called by `knot methods unregister` and by the Scriptling server.unregister() (no args).

func (*AgentClient) UpdateHealthCheckConfig added in v0.28.0

func (c *AgentClient) UpdateHealthCheckConfig(config msg.HealthConfig)

type AgentClientLogger added in v0.23.0

type AgentClientLogger struct {
	// contains filtered or unexported fields
}

AgentClientLogger is a logger.Logger implementation that writes to the agent client log stream

func (*AgentClientLogger) Debug added in v0.23.0

func (l *AgentClientLogger) Debug(message string, keysAndValues ...any)

Debug logs a debug message

func (*AgentClientLogger) Error added in v0.23.0

func (l *AgentClientLogger) Error(message string, keysAndValues ...any)

Error logs an error message

func (*AgentClientLogger) Fatal added in v0.23.0

func (l *AgentClientLogger) Fatal(message string, keysAndValues ...any)

Fatal logs a fatal message and exits

func (*AgentClientLogger) Info added in v0.23.0

func (l *AgentClientLogger) Info(message string, keysAndValues ...any)

Info logs an info message

func (*AgentClientLogger) Trace added in v0.23.0

func (l *AgentClientLogger) Trace(message string, keysAndValues ...any)

Trace logs a trace message

func (*AgentClientLogger) Warn added in v0.23.0

func (l *AgentClientLogger) Warn(message string, keysAndValues ...any)

Warn logs a warning message

func (*AgentClientLogger) With added in v0.23.0

func (l *AgentClientLogger) With(key string, value any) logger.Logger

With adds a key-value pair to the logger

func (*AgentClientLogger) WithError added in v0.23.0

func (l *AgentClientLogger) WithError(err error) logger.Logger

WithError adds an error to the logger

func (*AgentClientLogger) WithGroup added in v0.23.0

func (l *AgentClientLogger) WithGroup(group string) logger.Logger

WithGroup adds a group to the logger

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL