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 ¶
- type Client
- func (c *Client) AppendEvent(ctx context.Context, ev models.ConversationEvent) (models.ConversationEvent, error)
- func (c *Client) Close() error
- func (c *Client) DeleteSession(ctx context.Context, name string) error
- func (c *Client) DownloadPlugin(ctx context.Context, pluginName, targetDir string) (string, error)
- func (c *Client) ExecuteRemotePlugin(ctx context.Context, pluginName string, args []string) (string, error)
- func (c *Client) GetAgentDefinition(ctx context.Context, name string) (*RemoteAgentInfo, error)
- func (c *Client) GetModelName() string
- func (c *Client) GetProvider() string
- func (c *Client) GetServerInfo(ctx context.Context) (*ServerInfo, error)
- func (c *Client) GetSkillContent(ctx context.Context, name string) (*RemoteSkillInfo, error)
- func (c *Client) GetWatcherStatus(ctx context.Context) (*WatcherStatus, error)
- func (c *Client) Health(ctx context.Context) (bool, string, error)
- func (c *Client) ListBindings(ctx context.Context, principal string) ([]models.HubBinding, error)
- func (c *Client) ListRemoteAgents(ctx context.Context) ([]RemoteAgentInfo, error)
- func (c *Client) ListRemotePlugins(ctx context.Context) ([]RemotePluginInfo, error)
- func (c *Client) ListRemoteSkills(ctx context.Context) ([]RemoteSkillInfo, error)
- func (c *Client) ListSessions(ctx context.Context) ([]string, error)
- func (c *Client) LoadSession(ctx context.Context, name string) ([]models.Message, error)
- func (c *Client) LoadSessionV2(ctx context.Context, name string) (*models.SessionData, error)
- func (c *Client) NewConversation(ctx context.Context, principal string) (string, error)
- func (c *Client) ReadConversation(ctx context.Context, convID string, sinceSeq int64, limit int) ([]models.ConversationEvent, error)
- func (c *Client) ResolveActiveConversation(ctx context.Context, principal string) (convID, resolvedPrincipal string, err error)
- func (c *Client) SaveSession(ctx context.Context, name string, history []models.Message) error
- func (c *Client) SaveSessionV2(ctx context.Context, name string, sd *models.SessionData) error
- func (c *Client) SendPrompt(ctx context.Context, prompt string, history []models.Message, maxTokens int) (string, error)
- func (c *Client) SetBinding(ctx context.Context, platform, userID, principal string) error
- func (c *Client) SubscribeConversation(ctx context.Context, convID string, sinceSeq int64) (<-chan models.ConversationEvent, error)
- type Config
- type RemoteAgentInfo
- type RemotePlugin
- func (p *RemotePlugin) Description() string
- func (p *RemotePlugin) Execute(ctx context.Context, args []string) (string, error)
- func (p *RemotePlugin) ExecuteWithStream(ctx context.Context, args []string, onOutput func(string)) (string, error)
- func (p *RemotePlugin) IsRemote() bool
- func (p *RemotePlugin) Name() string
- func (p *RemotePlugin) Path() string
- func (p *RemotePlugin) Schema() string
- func (p *RemotePlugin) Usage() string
- func (p *RemotePlugin) Version() string
- type RemotePluginInfo
- type RemoteSkillInfo
- type ServerInfo
- type WatcherStatus
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 (*Client) AppendEvent ¶ added in v1.123.0
func (c *Client) AppendEvent(ctx context.Context, ev models.ConversationEvent) (models.ConversationEvent, error)
AppendEvent appends one dialog turn to the shared conversation and returns the stored event (with its server-assigned Seq).
func (*Client) DeleteSession ¶ added in v1.65.0
DeleteSession deletes a session from the remote server.
func (*Client) DownloadPlugin ¶ added in v1.60.0
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
GetAgentDefinition fetches the full definition of a remote agent.
func (*Client) GetModelName ¶
GetModelName returns the remote server's model name. This satisfies the LLMClient interface.
func (*Client) GetProvider ¶
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
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) ListBindings ¶ added in v1.123.0
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 ¶
ListSessions lists sessions from the remote server.
func (*Client) LoadSession ¶
LoadSession loads a session from the remote server.
func (*Client) LoadSessionV2 ¶ added in v1.65.2
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
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 ¶
SaveSession saves a session to the remote server.
func (*Client) SaveSessionV2 ¶ added in v1.65.2
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
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) 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.