Documentation
¶
Index ¶
- Constants
- func IsKnownProviderName(name string) bool
- func KnownProviderNames() []string
- func RecordDirFromEnv() string
- func ReplayDirFromEnv() string
- func RequiresAPIKey(name string) bool
- func SupportsTools(p Provider) bool
- type AgenticProvider
- func NewAgenticProvider(cfg config.Config) AgenticProvider
- func NewOpenAIAgenticProvider(cfg config.Config) AgenticProvider
- func NewRecording(inner AgenticProvider, dir string) (AgenticProvider, error)
- func NewReplay(dir string) AgenticProvider
- func WithPaneOverride(base AgenticProvider, o *PaneOverride) AgenticProvider
- func WithSessionDefaults(inner AgenticProvider, defaults *SessionDefaults) AgenticProvider
- type AgenticResponse
- type Capabilities
- type ClaudeAPI
- type ClaudeAgenticProvider
- type ClaudeCLI
- type ClaudeCLIAgentic
- func (c *ClaudeCLIAgentic) Caps() Capabilities
- func (c *ClaudeCLIAgentic) Complete(ctx context.Context, prompt string) (string, error)
- func (c *ClaudeCLIAgentic) CompleteWithTools(ctx context.Context, conversation []ConversationTurn, _ []ToolSpec, ...) (*AgenticResponse, error)
- func (c *ClaudeCLIAgentic) Name() string
- type ConversationTurn
- type PaneOverride
- type Provider
- type Reporter
- type SessionDefaults
- type StaticProvider
- type StopReason
- type TextBlock
- type ToolCallRequest
- type ToolSpec
- type Usage
Constants ¶
const ( RecordDirEnv = "RYSH_RECORD_DIR" ReplayDirEnv = "RYSH_REPLAY_DIR" )
RecordDirEnv / ReplayDirEnv carry the record/replay directory from the `rysh run` / `rysh eval` process into the spawned session daemon (which constructs the provider). Set by run/eval from --record / --replay flags.
const GeminiAPIURL = "https://generativelanguage.googleapis.com/v1beta/openai"
GeminiAPIURL is Gemini's OpenAI-compatible Chat Completions surface. It speaks the same dialect (Bearer auth, /chat/completions, function tools) as OpenAI and Ollama, so the one shared adapter covers all three (design 002 §3.2) and Gemini needs no dedicated HTTP client.
const TranscriptFileName = "transcript.jsonl"
TranscriptFileName is the transcript file inside a record/replay directory.
Variables ¶
This section is empty.
Functions ¶
func IsKnownProviderName ¶
IsKnownProviderName reports whether name selects a real provider through NewAgenticProvider/New. Unknown names still construct (they fall to the Claude default branch), but runtime selection surfaces (##pane provider, ##humanoid provider) must reject them so a typo cannot silently pin a pane to the wrong provider.
func KnownProviderNames ¶
func KnownProviderNames() []string
KnownProviderNames lists the selectable provider names — the canonical spellings shown in errors and help (IsKnownProviderName additionally accepts the Claude-family aliases). Keep sorted.
func RecordDirFromEnv ¶
func RecordDirFromEnv() string
RecordDirFromEnv returns the active record directory ("" when recording is not requested).
func ReplayDirFromEnv ¶
func ReplayDirFromEnv() string
ReplayDirFromEnv returns the active replay directory ("" when replay is not requested). The daemon consults this at provider-construction time.
func RequiresAPIKey ¶
RequiresAPIKey reports whether the named provider needs an API key before it can serve real completions.
Local providers (ollama) talk to a loopback endpoint and are authenticated by nothing at all — requiring a key for them is what silently demoted the air-gapped path to the mock provider (design 002 §3.5). claude-cli is keyless for a different reason: the `claude` binary carries its own login. Callers must consult this instead of testing cfg.APIKey directly.
func SupportsTools ¶
SupportsTools is the question almost every caller actually has.
Types ¶
type AgenticProvider ¶
type AgenticProvider = sharedprovider.AgenticProvider
Type aliases — these ARE the rysh-shared/provider types. ClaudeAgenticProvider satisfies AgenticProvider via structural typing.
func NewAgenticProvider ¶
func NewAgenticProvider(cfg config.Config) AgenticProvider
NewAgenticProvider selects the agentic provider by cfg.ProviderName: openai/ollama/gemini → OpenAI-compatible; claude-cli → the Complete-only CLI adapter (Caps().Tools=false); anything else (default) → Claude API. This is the single seam the agentic setup uses so a new provider needs no orchestrator changes.
func NewOpenAIAgenticProvider ¶
func NewOpenAIAgenticProvider(cfg config.Config) AgenticProvider
NewOpenAIAgenticProvider builds an OpenAI-compatible agentic provider from CLI config (design 002). Covers OpenAI, local Ollama (air-gapped mode) and Gemini (via its OpenAI-compat endpoint); the dialect is translated at the edge so the agentic loop stays neutral.
func NewRecording ¶
func NewRecording(inner AgenticProvider, dir string) (AgenticProvider, error)
NewRecording wraps inner so every successful provider call is appended to dir's transcript. The directory is created; a pre-existing transcript is truncated (a recording is one run, not an accumulation).
func NewReplay ¶
func NewReplay(dir string) AgenticProvider
NewReplay builds a replay provider over dir's transcript.
func WithPaneOverride ¶
func WithPaneOverride(base AgenticProvider, o *PaneOverride) AgenticProvider
WithPaneOverride wraps base so every call resolves the pane override first. Identity when the holder is nil.
func WithSessionDefaults ¶
func WithSessionDefaults(inner AgenticProvider, defaults *SessionDefaults) AgenticProvider
WithSessionDefaults wraps an agentic provider so every call resolves the session default at request time. Identity when the provider cannot override models (the static mock) or defaults is nil.
type AgenticResponse ¶
type AgenticResponse = sharedprovider.AgenticResponse
type Capabilities ¶
type Capabilities struct {
Tools bool // can accept tool specs and emit tool calls
ParallelTools bool // can emit multiple tool calls in one turn
Vision bool // accepts image content blocks
Streaming bool // supports incremental delivery
MaxContextTokens int
MaxOutputTokens int
ToolChoiceModes []string // e.g. auto, any, none
}
Capabilities describes what a provider can do. Fields follow design 002 §3.3. Zero value = "knows nothing", which is the safe reading everywhere it is consulted: no tools, no streaming, no declared limits.
func Caps ¶
func Caps(p Provider) Capabilities
Caps reports what p can do.
Resolution order:
- p declares its own capabilities (Reporter) — believed verbatim.
- p is a decorator (unwrapper) — recurse into what it wraps.
- structural: tool support iff p implements CompleteWithTools, plus streaming iff it implements CompleteWithToolsStream (the legacy StreamingProvider seam) OR it is a ChatProvider whose ChatStreamSupported self-report says it streams — so ChatProvider-native implementations (design 002 A2) are recognized without having to also carry the legacy interface.
A nil provider reports the zero value, so callers never need a nil check before asking.
type ClaudeAPI ¶
type ClaudeAPI struct {
// contains filtered or unexported fields
}
ClaudeAPI calls the Anthropic Messages API directly over HTTP.
func NewClaudeAPI ¶
NewClaudeAPI creates a ClaudeAPI provider from the given config.
type ClaudeAgenticProvider ¶
type ClaudeAgenticProvider = sharedprovider.ClaudeAgenticProvider
func NewClaudeAgenticProvider ¶
func NewClaudeAgenticProvider(cfg config.Config) *ClaudeAgenticProvider
NewClaudeAgenticProvider creates a provider from CLI config, adapting the config struct to the shared provider's constructor signature.
type ClaudeCLI ¶
type ClaudeCLI struct {
// contains filtered or unexported fields
}
type ClaudeCLIAgentic ¶
type ClaudeCLIAgentic struct {
// contains filtered or unexported fields
}
ClaudeCLIAgentic adapts the Complete-only ClaudeCLI to the AgenticProvider surface the pane executor requires.
func NewClaudeCLIAgenticProvider ¶
func NewClaudeCLIAgenticProvider(cfg config.Config) *ClaudeCLIAgentic
NewClaudeCLIAgenticProvider builds the CLI adapter from config. Model "" leaves the CLI's own default in charge.
func (*ClaudeCLIAgentic) Caps ¶
func (c *ClaudeCLIAgentic) Caps() Capabilities
Caps declares the honest capability row: no tool calls, no streaming. The structural default in Caps() would report Tools=true because CompleteWithTools exists below; the Reporter declaration wins (resolution order in capabilities.go), so tool-dependent consumers — e.g. design 006 §4.4 human-governed humanoids — degrade loudly instead of waiting for tool calls that can never come.
func (*ClaudeCLIAgentic) CompleteWithTools ¶
func (c *ClaudeCLIAgentic) CompleteWithTools( ctx context.Context, conversation []ConversationTurn, _ []ToolSpec, systemPrompt string, ) (*AgenticResponse, error)
CompleteWithTools satisfies the executor's AgenticProvider seam. Tool specs are dropped — Caps().Tools == false announces that — and the conversation is flattened to a single prompt; the CLI's text answer comes back as an end-turn response, never a fabricated tool call. The orchestrator's system prompt is forwarded so the assembled prompt (project memory, env block) is not silently replaced by the static file Complete() loads; only when the orchestrator sends none does the configured file apply.
func (*ClaudeCLIAgentic) Name ¶
func (c *ClaudeCLIAgentic) Name() string
Name distinguishes the CLI from the HTTP "claude" provider in pane snapshots and usage attribution.
type ConversationTurn ¶
type ConversationTurn = sharedprovider.ConversationTurn
type PaneOverride ¶
type PaneOverride struct {
// contains filtered or unexported fields
}
PaneOverride holds one pane's runtime provider override. Set/Get are atomic: Set runs on the pane's actor goroutine, Get on the executor's.
func NewPaneOverride ¶
func NewPaneOverride() *PaneOverride
NewPaneOverride returns an empty holder (no override — base provider rules).
func (*PaneOverride) Get ¶
func (o *PaneOverride) Get() AgenticProvider
Get returns the current override, or nil when none is set.
func (*PaneOverride) Set ¶
func (o *PaneOverride) Set(p AgenticProvider)
Set installs the override provider; nil clears it.
type Provider ¶
type Provider interface {
Name() string
Complete(ctx context.Context, prompt string) (string, error)
}
func New ¶
New builds the simple completion provider (the legacy Complete()-only seam, used by the loop-engineering judge seat).
Its selector MIRRORS NewAgenticProvider deliberately. The two used to be inverted: the agentic selector treated everything except openai/ollama as Claude, while this one matched only the exact string "claude" and sent everything else — including "anthropic", the name the onboarding flow writes, and the empty default — to a StaticProvider that returned canned text as a SUCCESSFUL completion. The judge seat therefore scored loop iterations against a mock string under ollama, under openai, and under "anthropic", with no error and no log. Any divergence between these two switches reintroduces that bug, so keep them in lockstep.
func NewOverride ¶
NewOverride builds the simple completion provider with per-use model and effort overrides — the seam behind the loop-engineering judge seat (loop.while.model / loop.while.effort). Empty overrides keep the session defaults; effort applies to the HTTP API provider only (the CLI adapter has no effort control and ignores it).
func NewSanitized ¶
NewSanitized wraps a simple Provider so every outbound prompt passes through sanitize before leaving the process — the SecretNAT / ReSet seam for the single-turn provider path (judge/loop seats). The response is returned as-is: single-turn callers have no tool execution, so nothing needs restoring. Identity when either argument is nil.
type Reporter ¶
type Reporter interface {
Caps() Capabilities
}
Reporter is the optional interface a provider implements when it wants to declare its own capabilities instead of accepting the structural defaults.
type SessionDefaults ¶
type SessionDefaults struct {
// contains filtered or unexported fields
}
SessionDefaults is the runtime-mutable session-wide model/effort default behind the ##llm command. One instance lives on the agentic Setup; the session provider decorator (WithSessionDefaults) consults it PER CALL, so a ##llm switch takes effect on the next request of every already-running pane/agent/humanoid — no restart, no new actors.
Precedence stays: explicit seats (recipe/config step & judge models, which arrive via WithModelEffort) > this session default > the provider's configured model (rysh.config.yaml provider.model > built-in).
func NewSessionDefaults ¶
func NewSessionDefaults() *SessionDefaults
NewSessionDefaults returns an empty holder (no session override).
func (*SessionDefaults) Get ¶
func (s *SessionDefaults) Get() (model, effort string)
Get returns the current session default ("" when unset).
func (*SessionDefaults) Set ¶
func (s *SessionDefaults) Set(model, effort string)
Set installs the session default. Empty strings clear the respective field; Set("", "") clears the override entirely.
type StaticProvider ¶
type StaticProvider struct {
// contains filtered or unexported fields
}
func (*StaticProvider) Name ¶
func (s *StaticProvider) Name() string
type StopReason ¶
type StopReason = sharedprovider.StopReason
const ( StopReasonEndTurn StopReason = sharedprovider.StopReasonEndTurn StopReasonToolUse StopReason = sharedprovider.StopReasonToolUse StopReasonMaxTokens StopReason = sharedprovider.StopReasonMaxTokens StopReasonStopSeq StopReason = sharedprovider.StopReasonStopSeq )
StopReason constants re-declared (Go constants cannot be type-aliased).
type TextBlock ¶
type TextBlock = sharedprovider.TextBlock
type ToolCallRequest ¶
type ToolCallRequest = sharedprovider.ToolCallRequest
type ToolSpec ¶
type ToolSpec = sharedprovider.ToolSpec
type Usage ¶
type Usage = sharedprovider.Usage