remote

package
v1.187.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0

* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0

* ChatCLI - Remote Plugin Implementation * client/remote/remote_plugin.go * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client implements llm/client.LLMClient by delegating to a remote ChatCLI gRPC server.

func NewClient

func NewClient(ctx context.Context, cfg Config, logger *zap.Logger) (*Client, error)

NewClient creates a new remote gRPC client that implements LLMClient.

func (*Client) AppendEvent added in v1.123.0

AppendEvent appends one dialog turn to the shared conversation and returns the stored event (with its server-assigned Seq).

func (*Client) Close

func (c *Client) Close() error

Close closes the gRPC connection.

func (*Client) DeleteSession added in v1.65.0

func (c *Client) DeleteSession(ctx context.Context, name string) error

DeleteSession deletes a session from the remote server.

func (*Client) DownloadPlugin added in v1.60.0

func (c *Client) DownloadPlugin(ctx context.Context, pluginName, targetDir string) (string, error)

DownloadPlugin downloads a plugin binary from the server to the specified directory.

func (*Client) ExecuteRemotePlugin added in v1.60.0

func (c *Client) ExecuteRemotePlugin(ctx context.Context, pluginName string, args []string) (string, error)

ExecuteRemotePlugin executes a plugin on the remote server.

func (*Client) GetAgentDefinition added in v1.60.0

func (c *Client) GetAgentDefinition(ctx context.Context, name string) (*RemoteAgentInfo, error)

GetAgentDefinition fetches the full definition of a remote agent.

func (*Client) GetModelName

func (c *Client) GetModelName() string

GetModelName returns the remote server's model name. This satisfies the LLMClient interface.

func (*Client) GetProvider

func (c *Client) GetProvider() string

GetProvider returns the remote server's provider.

func (*Client) GetServerInfo

func (c *Client) GetServerInfo(ctx context.Context) (*ServerInfo, error)

GetServerInfo fetches server metadata including watcher status.

func (*Client) GetSkillContent added in v1.60.0

func (c *Client) GetSkillContent(ctx context.Context, name string) (*RemoteSkillInfo, error)

GetSkillContent fetches the full content of a remote skill.

func (*Client) GetWatcherStatus

func (c *Client) GetWatcherStatus(ctx context.Context) (*WatcherStatus, error)

GetWatcherStatus fetches the K8s watcher status from the server.

func (*Client) Health

func (c *Client) Health(ctx context.Context) (bool, string, error)

Health checks if the remote server is healthy.

func (*Client) ListBindings added in v1.123.0

func (c *Client) ListBindings(ctx context.Context, principal string) ([]models.HubBinding, error)

ListBindings returns channel→principal bindings (empty principal = all the caller is allowed to see).

func (*Client) ListRemoteAgents added in v1.60.0

func (c *Client) ListRemoteAgents(ctx context.Context) ([]RemoteAgentInfo, error)

ListRemoteAgents lists all agents available on the server.

func (*Client) ListRemotePlugins added in v1.60.0

func (c *Client) ListRemotePlugins(ctx context.Context) ([]RemotePluginInfo, error)

ListRemotePlugins lists all plugins available on the server.

func (*Client) ListRemoteSkills added in v1.60.0

func (c *Client) ListRemoteSkills(ctx context.Context) ([]RemoteSkillInfo, error)

ListRemoteSkills lists all skills available on the server.

func (*Client) ListSessions

func (c *Client) ListSessions(ctx context.Context) ([]string, error)

ListSessions lists sessions from the remote server.

func (*Client) LoadSession

func (c *Client) LoadSession(ctx context.Context, name string) ([]models.Message, error)

LoadSession loads a session from the remote server.

func (*Client) LoadSessionV2 added in v1.65.2

func (c *Client) LoadSessionV2(ctx context.Context, name string) (*models.SessionData, error)

LoadSessionV2 loads a full v2 session from the remote server. Falls back to v1 (chat history only) if the server doesn't support v2.

func (*Client) NewConversation added in v1.123.0

func (c *Client) NewConversation(ctx context.Context, principal string) (string, error)

NewConversation rotates the principal's active conversation to a fresh thread.

func (*Client) ReadConversation added in v1.123.0

func (c *Client) ReadConversation(ctx context.Context, convID string, sinceSeq int64, limit int) ([]models.ConversationEvent, error)

ReadConversation returns events with Seq > sinceSeq (limit <= 0 = all).

func (*Client) ResolveActiveConversation added in v1.123.0

func (c *Client) ResolveActiveConversation(ctx context.Context, principal string) (convID, resolvedPrincipal string, err error)

ResolveActiveConversation returns the principal's current shared conversation (creating one on first contact). principal may be empty to use the authenticated identity.

func (*Client) SaveSession

func (c *Client) SaveSession(ctx context.Context, name string, history []models.Message) error

SaveSession saves a session to the remote server.

func (*Client) SaveSessionV2 added in v1.65.2

func (c *Client) SaveSessionV2(ctx context.Context, name string, sd *models.SessionData) error

SaveSessionV2 saves a full v2 session (with scoped histories) to the remote server. It also populates the v1 messages field for backward compatibility with older servers.

func (*Client) SendPrompt

func (c *Client) SendPrompt(ctx context.Context, prompt string, history []models.Message, maxTokens int) (string, error)

SendPrompt sends a prompt to the remote server and returns the response. This satisfies the LLMClient interface.

func (*Client) SetBinding added in v1.123.0

func (c *Client) SetBinding(ctx context.Context, platform, userID, principal string) error

SetBinding maps a channel identity to a principal (empty principal = self).

func (*Client) SubscribeConversation added in v1.123.0

func (c *Client) SubscribeConversation(ctx context.Context, convID string, sinceSeq int64) (<-chan models.ConversationEvent, error)

SubscribeConversation live-tails a conversation: it returns a channel that first yields the backlog after sinceSeq, then live events. The channel closes when ctx is canceled or the server ends the stream (e.g. an overflow resync signal); callers should resubscribe from the last Seq they saw to catch up.

type Config

type Config struct {
	Address        string            // server address (host:port)
	Token          string            // auth token for gRPC server authentication
	TLS            bool              // use TLS
	CertFile       string            // CA certificate file for TLS (optional)
	ClientAPIKey   string            // optional: client's own LLM API key/OAuth token (forwarded to server)
	Provider       string            // optional: override server's default provider (e.g., "GOOGLEAI")
	Model          string            // optional: override server's default model (e.g., "gemini-2.0-flash")
	ProviderConfig map[string]string // optional: provider-specific config (StackSpot, Ollama, etc.)
}

Config holds remote client configuration.

type RemoteAgentInfo added in v1.60.0

type RemoteAgentInfo struct {
	Name        string
	Description string
	Skills      []string
	Plugins     []string
	Model       string
	Content     string
	Effort      string
	Category    string
	Version     string
	Author      string
	Tags        []string
}

RemoteAgentInfo holds agent metadata from the server.

Mirrors the advanced frontmatter supported by persona.Agent so remote custom agents inherit the same model/effort routing as local ones. When the server is older and does not populate these fields they arrive as zero values — clients treat that the same as "inherit user active provider/model and send no effort hint".

type RemotePlugin added in v1.60.0

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

RemotePlugin implements the plugins.Plugin interface by delegating execution to a remote ChatCLI server via gRPC.

func NewRemotePlugin added in v1.60.0

func NewRemotePlugin(info *pb.PluginInfo, client *Client) *RemotePlugin

NewRemotePlugin creates a RemotePlugin from server-provided metadata.

func NewRemotePluginFromInfo added in v1.60.0

func NewRemotePluginFromInfo(info RemotePluginInfo, client *Client) *RemotePlugin

NewRemotePluginFromInfo creates a RemotePlugin from a RemotePluginInfo struct.

func (*RemotePlugin) Description added in v1.60.0

func (p *RemotePlugin) Description() string

func (*RemotePlugin) Execute added in v1.60.0

func (p *RemotePlugin) Execute(ctx context.Context, args []string) (string, error)

Execute runs the plugin on the remote server.

func (*RemotePlugin) ExecuteWithStream added in v1.60.0

func (p *RemotePlugin) ExecuteWithStream(ctx context.Context, args []string, onOutput func(string)) (string, error)

ExecuteWithStream runs the plugin on the remote server with optional output callback.

func (*RemotePlugin) IsRemote added in v1.60.0

func (p *RemotePlugin) IsRemote() bool

IsRemote returns true to indicate this is a remote plugin.

func (*RemotePlugin) Name added in v1.60.0

func (p *RemotePlugin) Name() string

func (*RemotePlugin) Path added in v1.60.0

func (p *RemotePlugin) Path() string

func (*RemotePlugin) Schema added in v1.60.0

func (p *RemotePlugin) Schema() string

func (*RemotePlugin) Usage added in v1.60.0

func (p *RemotePlugin) Usage() string

func (*RemotePlugin) Version added in v1.60.0

func (p *RemotePlugin) Version() string

type RemotePluginInfo added in v1.60.0

type RemotePluginInfo struct {
	Name        string
	Description string
	Usage       string
	Version     string
	Schema      string
}

RemotePluginInfo holds plugin metadata from the server.

type RemoteSkillInfo added in v1.60.0

type RemoteSkillInfo struct {
	Name         string
	Description  string
	Content      string
	AllowedTools []string
	Subskills    map[string]string
	Scripts      map[string]string
}

RemoteSkillInfo holds skill metadata from the server.

type ServerInfo

type ServerInfo struct {
	Version            string
	Provider           string
	Model              string
	AvailableProviders []string
	WatcherActive      bool
	WatcherTarget      string
	PluginCount        int32
	AgentCount         int32
	SkillCount         int32
}

ServerInfo holds server metadata returned by GetServerInfo.

type WatcherStatus

type WatcherStatus struct {
	Active        bool
	Deployment    string
	Namespace     string
	StatusSummary string
	AlertCount    int
	SnapshotCount int
	PodCount      int
}

WatcherStatus holds the K8s watcher status from the server.

Jump to

Keyboard shortcuts

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