runner

package
v0.1.54 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package runner drives a single turn: it builds the TurnInput (session id for resume, the agent's own settings, auth env), invokes the adapter's streaming run, publishes the unified events to the SSE hub, and persists the agent's session id.

All per-agent state flows through the namespaced CredView, never the raw store: Config is the agent's non-secret settings (prefix stripped), Env is its auth. Session ids are keyed per (agent, chat) so adapters can't collide on a shared chatId.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runner

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

func New

func New(store *session.Store, adapter agent.Adapter, auth agent.AuthModule, creds agent.CredStore, hub *stream.Hub, cwd string) *Runner

func (*Runner) RunCompact

func (r *Runner) RunCompact(ctx context.Context, t Turn) (agent.TurnResult, []agent.Part, bool)

RunCompact drives an on-demand compaction through the SAME streaming + transcript-accumulation path as RunTurn (via the adapter's CompactModule), so the compaction boundary lands in history and the SSE stream exactly as an auto-compaction does. The bool reports whether the adapter implements CompactModule — false ⇒ the agent can't compact (the API route is gated on the same assertion, but the runner stays honest if it's reached directly).

func (*Runner) RunTurn

func (r *Runner) RunTurn(ctx context.Context, t Turn) (agent.TurnResult, []agent.Part)

RunTurn executes one turn, streaming unified events to the hub under t.RunID and persisting the agent's session id. Returns the final result plus the accumulated rich transcript.

type Turn

type Turn struct {
	// NativeRun joins an existing owner; its auth, environment and settings stay
	// with that process. Only ordinary sends use this optional supervisor hook.
	NativeRun     func(context.Context, agent.TurnInput, agent.Emit) (agent.TurnResult, error)
	ChatID        string
	Message       string
	RunID         string
	CWD           string // run this turn in a specific dir (a project workdir); empty = daemon default
	Options       agent.TurnOptions
	Environment   map[string]string // private service credentials, never turn API input
	AttachEmitter func(agent.Emit) func()
	// Inbound is the user's mid-turn ingress channel (approval answers, follow-up input, interrupts),
	// owned by the supervisor. Receive-only for the adapter; nil for a one-shot turn.
	Inbound <-chan agent.Inbound
	Voice   *agent.VoiceBridge
	// Register requests before publishing them, so a fast client can answer immediately.
	BeforePublish agent.Emit
	// The supervisor commits completion only after settling follow-up receipts.
	// Native result events still reach the driver/parser and the local reducer.
	DeferResult bool
}

Turn is one turn's request as assembled by the supervisor and handed to the runner. Bundled so the signature doesn't grow per-field as per-turn options expand.

Jump to

Keyboard shortcuts

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