live

package
v0.0.1-dev2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 22 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 live contains the small amount of plumbing shared by the runnable examples.

Index

Constants

View Source
const ProjectMemoryPath = "projects/release-conventions.md"

Variables

This section is empty.

Functions

func ChooseModel

func ChooseModel(configured string, enabled []string) (string, error)

func Execute

func Execute(c Config, scenario Scenario) int

func Explain

func Explain(err error, pat string) string

func HistoryMessage

func HistoryMessage(raw string) (role, text string, err error)

HistoryMessage extracts only user and assistant text, excluding tool inputs, results and other event payloads from the conversation transcript.

func Marker

func Marker() string

func Name

func Name(prefix string) string

func Pause

func Pause(ctx context.Context) error

func ReadEnv

func ReadEnv(path string) (map[string]string, error)

ReadEnv reads assignments as data, never as shell commands. Existing environment variables take precedence; callers can use either separate PATs or one shared PAT.

func Safe

func Safe(err error) string

Safe hides response bodies, tokens and signed URLs, even through wrapped errors.

func Status

func Status(status string) string

Types

type Config

type Config struct {
	BaseURL, PAT, Model   string
	Mode, EnvFile, Output string
	Timeout               time.Duration
}

func Load

func Load(mode string) (Config, error)

func (Config) Options

func (c Config) Options() []option.RequestOption

type MessagePreview

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

MessagePreview tracks text by event ID and content-block index. A final agent.message replaces its preview, including when some deltas were missed.

func (*MessagePreview) Observe

func (p *MessagePreview) Observe(raw string) (*PreviewUpdate, error)

type PreviewUpdate

type PreviewUpdate struct {
	ID, Text string
	Final    bool
}

type ProjectMemory

type ProjectMemory struct {
	Project, ReleaseTime, Contact, RollbackVersion string
}

ProjectMemory keeps the remembered facts separate from the question. Varying the facts on each run prevents a plausible stock answer from passing.

func NewProjectMemory

func NewProjectMemory() ProjectMemory

func (ProjectMemory) Content

func (m ProjectMemory) Content() string

func (ProjectMemory) Index

func (m ProjectMemory) Index() string

The runtime loads MEMORY.md as an index. Keep the facts in the linked entry so the Agent must actually retrieve the project memory to answer.

func (ProjectMemory) Prompt

func (m ProjectMemory) Prompt() string

func (ProjectMemory) Verify

func (m ProjectMemory) Verify(r *Run, result TurnResult) error

type Run

type Run struct {
	Name string
	// contains filtered or unexported fields
}

func (*Run) Log

func (r *Run) Log(event, detail string)

func (*Run) Message

func (r *Run) Message(role, text string)

func (*Run) ObserveTurn

func (r *Run) ObserveTurn(result *TurnResult, raw string) error

func (*Run) RetainResources

func (r *Run) RetainResources()

RetainResources transfers cleanup responsibility to the caller after a successful conversation that explicitly requested -keep-session.

func (*Run) Step

func (r *Run) Step(description string)

func (*Run) Track

func (r *Run) Track(kind, id string, fn func(context.Context) error)

func (*Run) Wait

func (r *Run) Wait(description string) func()

Wait keeps a long SSE stream or asynchronous job visibly active. The returned function stops and joins its heartbeat before the next step or cleanup begins.

type Scenario

type Scenario struct {
	Name, Description string
	Run               func(context.Context, *Run) error
}

type TurnResult

type TurnResult struct {
	Text     string
	LastID   string
	ToolUsed bool
	Complete bool
}

TurnResult only accepts assistant output followed by a terminal idle event. User messages and tool output cannot satisfy the result assertion.

func (*TurnResult) Observe

func (r *TurnResult) Observe(raw string) error

func (TurnResult) Verify

func (r TurnResult) Verify(expected []string, requireTool bool) error

Jump to

Keyboard shortcuts

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