Documentation
¶
Overview ¶
Package agent builds the system prompt and relays a provider turn to the transport, buffering text deltas so the UI receives smooth, batched updates instead of a flood of tiny frames. It is plugin-agnostic: the prompt is assembled from the connection's protocol/title, the AI mode, and the tool names — never plugin-specific logic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateTitle ¶
func GenerateTitle(ctx context.Context, provider engine.Provider, model, userMessage, assistantReply string) string
GenerateTitle asks the model for a short conversation title from the first exchange. It returns "" on any failure so the caller can fall back.
func Relay ¶
func Relay(ctx context.Context, in <-chan engine.StreamEvent, sink func(engine.StreamEvent))
Relay forwards every event from in to sink, coalescing consecutive text deltas into batched frames. It returns when in closes or ctx is cancelled.
func SystemPrompt ¶
func SystemPrompt(in PromptInput) string
SystemPrompt assembles the agent's instructions for one connection.
Types ¶
type Composite ¶
type Composite struct {
// contains filtered or unexported fields
}
Composite dispatches tool calls to either route tools or subagents.
func NewComposite ¶
NewComposite combines the route tool set with subagents.
type PromptInput ¶
type PromptInput struct {
ConnectionTitle string
Protocol string
AIMode string
Tools []string
// RecentOps are pre-formatted recent audit lines for the user on this
// connection, so the agent can explain a just-failed action.
RecentOps []string
// HasSubagent indicates an investigate subagent is available.
HasSubagent bool
}
PromptInput is the dynamic context the system prompt is built from.
type Subagent ¶
type Subagent struct {
// contains filtered or unexported fields
}
Subagent runs a nested, read-only turn and returns a concise summary.
func NewSubagent ¶
func NewSubagent(name string, provider engine.Provider, model string, ro toolExecutor, protocol string) *Subagent
NewSubagent builds the investigation subagent over a read-only tool set.