Documentation
¶
Overview ¶
Package pluginremote is the remote.Source of a service plugin that declares remote_source: Send / Receive / Done go to the plugin's internal /_wick/remote/* paths over its unix socket, and events arrive as SSE in the v1 event schema, so nothing is converted.
Index ¶
- Constants
- Variables
- func OpenValues(codec Codec, values map[string]string) (map[string]string, error)
- func SaveSessionOptions(dir string, opts map[string]string) error
- func SealValues(codec Codec, decl []wickentity.Config, values map[string]string) (map[string]string, error)
- func SessionOptions(dir string) (opts map[string]string, locked bool)
- type Codec
- type Config
- type Source
- func (s *Source) Cancel(ctx context.Context, h remote.Handle) error
- func (s *Source) Describe(ctx context.Context) (remote.Description, error)
- func (s *Source) End(h remote.Handle)
- func (s *Source) Inject(ctx context.Context, h remote.Handle, turn remote.Turn) error
- func (s *Source) Kind() string
- func (s *Source) Label() string
- func (s *Source) Limits() remote.Limits
- func (s *Source) Listen() []remote.ListenMode
- func (s *Source) Receive(ctx context.Context, h remote.Handle) (<-chan remote.Event, error)
- func (s *Source) ResumeID(dir string) string
- func (s *Source) Send(ctx context.Context, turn remote.Turn) (remote.Handle, error)
- func (s *Source) SessionFields(ctx context.Context) ([]wickplugin.SessionField, error)
- func (s *Source) Test(ctx context.Context) remote.TestResult
- type Store
- type Transport
Constants ¶
const ( Kind = "plugin-remote" AdapterKind = "plugin" ProviderKey = "plugin-remote/plugin-remote" RowType = "plugin-remote" )
Persona kind, adapter kind, provider key, and agent_channels row type.
const UsageByMention = "mention"
UsageByMention marks a plugin remote agent whose mention policy decides who may reach it.
Variables ¶
var ErrSessionStarted = errors.New("the remote session has started; start a new chat to change these values")
ErrSessionStarted is returned by SaveSessionOptions once the remote session exists: its values can no longer change (start a new chat).
Functions ¶
func OpenValues ¶
OpenValues decrypts stored values for the plugin; a token that is not encrypted passes through.
func SaveSessionOptions ¶
SaveSessionOptions keeps opts (empty values dropped) as the answers the session's first turn sends, until the remote session exists.
func SealValues ¶
func SealValues(codec Codec, decl []wickentity.Config, values map[string]string) (map[string]string, error)
SealValues encrypts the values of the secret keys of decl.
Types ¶
type Codec ¶
type Codec interface {
EncryptSecret(plain string) (string, error)
DecryptSecret(token string) (string, error)
}
Codec encrypts secret values at rest — the configs codec connector secrets use.
type Config ¶
type Config struct {
AgentID string `json:"agent_id"`
OwnerUserID string `json:"owner_user_id"`
PluginKey string `json:"plugin_key"`
// Usage is UsageByMention once the agent's mention policy decides who
// may reach it; "" for a row saved before, which took no agent's turn.
Usage string `json:"usage,omitempty"`
// Values are the agent's RemoteConfigs answers by key. A secret's value
// is stored encrypted (wick_cenc_); see SealValues / OpenValues.
Values map[string]string `json:"values,omitempty"`
}
Config is a plugin remote agent's settings row.
type Source ¶
type Source struct {
Key string
// AgentID and Config ride on every turn: the remote agent and its
// per-agent config in plaintext. Set them before the first Send.
AgentID string
Config map[string]string
// contains filtered or unexported fields
}
Source is one agent's plugin adapter.
func (*Source) Cancel ¶
Cancel stops h's turn on the remote's side (Stop in wick), when the plugin's describe says "cancel": true; otherwise there is nothing to call and the remote may keep working.
func (*Source) Listen ¶
func (s *Source) Listen() []remote.ListenMode
func (*Source) Send ¶
Send posts the turn (with the conversation id of earlier turns) and keeps the id the plugin answers with.
func (*Source) SessionFields ¶
func (s *Source) SessionFields(ctx context.Context) ([]wickplugin.SessionField, error)
SessionFields asks the plugin which values a new session of this agent takes (defaults resolved from the agent's Config); nil when the plugin declares none.