server

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 110 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

Index

Constants

View Source
const (
	// Places subagents may run, for /delegation
	ChoiceDelegation = "delegation"
	// Models of the provider the session runs on, for /model
	ChoiceModel = "model"
	// Providers of the profile, for /model --provider
	ChoiceProvider = "provider"
	// Accounts of the provider the session runs on, for /model --login
	ChoiceLogin = "login"
)

Kinds of values Choices gives

View Source
const (
	// Its reasoning stood as the answer, as the route's model answers in its reasoning
	BlankPromoted = "promoted"
	// The text that streamed of it stood as the answer
	BlankStreamed = "streamed"
	// The words of the reply before it, whose calls all kept the agent's own bookkeeping, stood as the answer
	BlankEarlier = "earlier"
	// The model was told to go on with the results of its tool calls
	BlankNudged = "nudged"
	// Its reasoning went back to the model to go on to its answer
	BlankPrefilled = "prefilled"
	// It was asked again
	BlankRetried = "retried"
	// The same request gave the same nothing twice, so no retry was spent
	BlankRepeated = "repeated"
	// A fallback model took over
	BlankFallback = "fallback"
	// Every way was spent and the reply ended with nothing
	BlankExhausted = "exhausted"
)

What becomes of a reply with nothing in it, as Blanked names it

View Source
const (
	FailureOverloaded = "overloaded"
	FailureOutage     = "outage"
	FailureLimited    = "limited"
	FailureUnreached  = "unreached"
)

Kinds of failure the agent waits out, as Outlasted names them

View Source
const (
	// The provider answered again
	OutcomeRecovered = "recovered"
	// icebath stopped waiting: its waits were spent, or what it may wait in all, or the provider takes requests again too late
	OutcomeGaveUp = "gave_up"
	// The person stopped the reply, steered it, sent another message or closed the session, or icebath stopped
	OutcomeStopped = "stopped"
)

Ways the waits for a failing provider end, as Outlasted names them

View Source
const (
	SpeedServed   = "served"
	SpeedStandard = "standard"
	SpeedRefused  = "refused"
)

How a request that asked for a faster tier was served, as Sped names it: at that tier, at the usual one without a word of why, or at the usual one after the provider refused the faster for the model on the account

View Source
const (
	NudgePromise  = "promise"
	NudgeTrailing = "trailing"
	NudgePlan     = "plan"
	NudgeFragment = "fragment"
	// Sent back to check the files the turn changed, and by a hook of pre_verify, such as a design pack's
	NudgeVerify = "verify"
	NudgeHook   = "pre_verify"
)

Kinds of reply sent back to work, as Nudged names them

Variables

View Source
var ErrNoSubagent = errors.New("No subagent of that id was started in this session by you, or it ended too long ago to be kept.")

No subagent of the id was started by that one in the session, or nothing of it is kept any more

View Source
var Fires = []hooks.Site{
	{Point: hooks.PreLLMCall, By: "the agent", When: "as a message is about to start a reply"},
	{Point: hooks.TransformLLMOutput, By: "the agent", When: "as the reply a turn ends with is about to be shown"},
	{Point: hooks.PostLLMCall, By: "the agent", When: "once a turn ended with a reply and was not stopped"},
	{Point: hooks.SessionEnd, By: "the agent", When: "as each turn ends, however it ended"},
	{Point: hooks.AgentLoopStopped, By: "the agent",
		When: "as a reply is stopped from outside before it ended: by you, a new message, a new session, a pause or icebath stopping"},
	{Point: hooks.StreamStart, By: "the agent", When: "as a reply begins to stream"},
	{Point: hooks.StreamDelta, By: "the agent", When: "on each piece of a reply as it streams"},
	{Point: hooks.StreamEnd, By: "the agent", When: "as a reply stops streaming"},
	{Point: hooks.InterimMessage, By: "the agent", When: "on what the agent says between its steps"},
	{Point: hooks.PreAPIRequest, By: "the agent", When: "before each request of a turn goes to the provider"},
	{Point: hooks.PostAPIRequest, By: "the agent", When: "as the provider answers a request of a turn"},
	{Point: hooks.APIRequestError, By: "the agent", When: "as a request of a turn to the provider fails"},
	{Point: hooks.TransformAPIErrorClassification, By: "the agent", When: "as a failed request is about to be classified"},
	{Point: hooks.SessionStart, By: "the agent", When: "as the prompt of a session is built for the first time"},
	{Point: hooks.SessionFinalize, By: "the agent", When: "as a session closes for good"},
	{Point: hooks.SessionReset, By: "the agent", When: "as a window or a chat leaves its session for a new one"},
	{Point: hooks.PostCompaction, By: "the agent", When: "once a summary of a long session is stored"},
	{Point: hooks.PreCommand, By: "the agent", When: "before a slash command typed in a session or a chat runs"},
	{Point: hooks.HumanInputRequest, By: "the agent", When: "as the agent asks you a question"},
	{Point: hooks.HumanInputResolved, By: "the agent", When: "once a question of the agent was answered or given up"},
	{Point: hooks.SubagentStart, By: "the agent", When: "as a subagent is about to start a task"},
	{Point: hooks.SubagentProgress, By: "the agent", When: "each time a subagent starts a tool call"},
	{Point: hooks.SubagentStop, By: "the agent", When: "as a subagent finishes its task"},
}

The moments of the agent the hook points hear of, which the hooks screen and Doctor say of each point

Functions

This section is empty.

Types

type Agent

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

func Register

func Register(
	registry *server.Registry,
	cfg *config.Config,
	providers *provider.Registry,
	transports *transport.Registry,
	creds *credentials.Registry,
	catalog *models.Registry,
	toolset *tools.Registry,
	stores *sessions.Registry,
	commands *slash.Registry,
	helpers *auxiliary.Registry,
	prompts *prompt.Registry,
	checks *approvals.Registry,
	searches *web.Registry,
	skillset *skills.Registry,
	engines *contexts.Registry,
	shells *terminal.Registry,
	trees *worktrees.Registry,
	backends *delegation.Registry,
	desktops *botdesktop.Registry,
	points *hooks.Registry,
	places *projects.Registry,
	kept *trajectories.Registry,
) *Agent

func (*Agent) AddGate

func (a *Agent) AddGate(ctx context.Context, id, command string) (string, *agentv1.Goal, error)

func (*Agent) AddSubgoal

func (a *Agent) AddSubgoal(ctx context.Context, id, text string) (string, *agentv1.Goal, error)

func (*Agent) Agents

func (a *Agent) Agents(ctx context.Context, id, argument string) (string, error)

What /agents says: the agents running, the background processes and delegations; or the spawn pause set, or how delegation stands

func (*Agent) Answer

func (a *Agent) Answer(id, set, question string, values []string) ([]string, error)

Locks the answer of one question of the set, values that are all blank skipping it, and settles the set when it was the last one waiting: the clarify tool hears of it, and the question a command asked has the command go on with the answer. Gives the questions still waiting

func (*Agent) Answers

func (a *Agent) Answers() Answers

The agent as what answers the prompts of the API's runs

func (*Agent) Approvals

func (a *Agent) Approvals(id, argument string) (string, error)

/approvals as the server runs it, for chat apps and icebath chat: alone it says When to ask and how the session stands against it; a mode is the shortcut to When to ask, and with --session, or --session alone, to Skip approvals in this chat. Each goes through the one function of its control and answers with its note

func (*Agent) Approve

func (a *Agent) Approve(id string, answer approvals.Answer) (int, error)

Answers the session's approval prompts yes, the oldest, the one named or all of them, giving how many were answered

func (*Agent) Aside

func (a *Agent) Aside(ctx context.Context, id, question, asker string, most int) (Side, error)

Answers a side question about the session's conversation as it stands, without touching it or what waits to be sent to it, its tokens counted to the session as a side question, of the asker when another than the person asks (btw:<asker>): first over the session's own last request with the question after it, which keeps the provider's prompt cache, tool calls refused and at most three rounds; else, or when that gives nothing, by the helper model of side questions over a transcript of it, its answer most tokens long (2048 for none). A session with no conversation yet says so as the answer

func (*Agent) Ask

func (a *Agent) Ask(ctx context.Context, id, from string, questions []tools.Question) (tools.Reply, error)

Asks the person of the session questions another than the agent puts, such as an extension, as the clarify tool asks them and shown as asked by from (the extension Foo) wherever the session is shown: the app, the chat it talks to, an editor, a run of the HTTP API. Questions the session waits on already are answered first, the wait counting against the context. Refused with an Unanswerable where nobody can answer: a run of one query, a scheduled job or another run nobody attends, a subagent's session, a session nothing shows

func (*Agent) Await

func (a *Agent) Await(ctx context.Context, session, by, id string) (Spawned, error)

Waits until the subagent by started in the session ended or the context did, then gives it as it stands

func (*Agent) Background

func (a *Agent) Background(ctx context.Context, id, prompt string) (string, error)

Starts the prompt through the runner host in a session of its own on the same profile, model and folder, which works on it without anyone watching: it waits for a place under the profile's limit of runs, shows in Runs while it goes and can be stopped there. When it ends its answer, or why it did not finish, is noted in this chat with the session to open for the rest

func (*Agent) Bind

func (a *Agent) Bind(ctx context.Context, cfg *config.Config, id, cwd, from string) (*tools.Env, func(), error)

Environment of a tool another than the agent runs in a session of the profile, such as an extension, as the agent's own call gets it there: the session's folder unless one is named, its approvals and rules deciding what the tool may do and asking the person where they would, its questions shown as asked by from, its helper models. With no session, the folder named under the settings given, where nobody is asked, so what would be asked is refused. Its second answer lets go of what the tools kept for the run, left to the reply of the session where one runs

func (*Agent) Blanking

func (a *Agent) Blanking(tell func(Blanked))

Hands over what hears of what became of each reply with nothing in it, such as what measures the agent

func (*Agent) BusyNow

func (a *Agent) BusyNow(id string) (string, error)

What /busy alone says outside this app: what enter does while the agent works in the session

func (*Agent) Chat

func (a *Agent) Chat(ctx context.Context, id, profile string) (*agentv1.ChatResponse, error)

What the session keeps for itself, with what is in effect for it; a session of another profile than the one asked about, the asking window's for none, is not found

func (*Agent) Chats

func (a *Agent) Chats() Chats

The agent as what answers in the chats of the chat apps

func (*Agent) Choices

func (a *Agent) Choices(ctx context.Context, cfg *config.Config, sessionID, kind string) []slash.Value

Values a hole of one of the agent's commands takes, as a person completes its line, by the kind asked: places subagents run, the models and the accounts of the provider the session runs on, of the model of new chats where the line names no session, and the providers of the profile. Read from what is kept, the catalog of models as last fetched

func (*Agent) ClearGates

func (a *Agent) ClearGates(ctx context.Context, id string) (string, *agentv1.Goal, error)

func (*Agent) ClearGoal

func (a *Agent) ClearGoal(ctx context.Context, id string) (string, error)

func (*Agent) ClearQueue

func (a *Agent) ClearQueue(_ context.Context, id string) (string, error)

Takes every message the person sent that the agent has not read out

func (*Agent) ClearSubgoals

func (a *Agent) ClearSubgoals(ctx context.Context, id string) (string, *agentv1.Goal, error)

func (*Agent) Close

func (a *Agent) Close() error

func (*Agent) Compact

func (a *Agent) Compact(ctx context.Context, id, argument string) (string, error)

Compresses the session's conversation now, as the session's next piece of work, or shows what that would do

func (*Agent) Confirm

func (a *Agent) Confirm(ctx context.Context, id, command, detail string) (bool, string, error)

Asks before a slash command that deletes or resets something: whether to go ahead, and what to add to its reply

func (*Agent) Context

func (a *Agent) Context(ctx context.Context, id, argument string) (string, error)

The context window of the session in detail: how full it is, when it compresses, what compressions did, what the calls took and what takes up the window; with all, what each toolset and skill costs

func (*Agent) Continue

func (a *Agent) Continue(ctx context.Context, id string) (string, error)

/continue: the reply icebath was cut off in when it stopped goes on where it stopped, as it does on its own at start for a fresh one

func (*Agent) Counting

func (a *Agent) Counting(ctx context.Context, settings *config.Config, name, model string) string

How the tokens of a model of the profile are counted, a sentence: with its own tokenizer, named; estimated until its tokenizer is downloaded; or estimated, as none of it is published

func (*Agent) Counts

func (a *Agent) Counts(host *tokenizers.Tokenizers)

Takes the host that counts tokens with each model's own tokenizer

func (*Agent) Delegation

func (a *Agent) Delegation(id, argument string) (string, error)

What /delegation says: the methods that can run and the one in use, or with a name the method of the profile set to it, through the check every way of setting it goes through. The note the control gives

func (*Agent) Deny

func (a *Agent) Deny(id string, answer approvals.Answer) (int, error)

Answers the session's approval prompts no, with the reason the user gave cut to a line the agent reads

func (*Agent) Diff

func (a *Agent) Diff(ctx context.Context, id, argument string) (string, error)

Shows the changes of the session's folder: its git changes in the mode the words name, or with session everything changed since the oldest checkpoint the session keeps; --stat for the summary alone, and paths to show only those

func (*Agent) Dismiss

func (a *Agent) Dismiss(id, set string) error

Dismisses the questions of the set, keeping the answers locked so far; a command that asked one does nothing more

func (*Agent) Drives

func (a *Agent) Drives(host *runs.Runner) Driver

The agent as the driver of the host's runs, which /bg starts its background tasks through

func (*Agent) Edit

func (a *Agent) Edit(ctx context.Context, id string, message int64, text string, interrupted bool) (int, error)

Takes back a message the user sent and everything after it, then sends the text in its place, the model told when the person cut a spoken reply off first; how many messages were taken back

func (*Agent) EditQueued

func (a *Agent) EditQueued(_ context.Context, id string, n int, text string) (string, error)

Gives waiting message n, counting from 1, new text

func (*Agent) Editors

func (a *Agent) Editors() Editors

The agent as what answers in the sessions editors follow

func (*Agent) EffortNow

func (a *Agent) EffortNow(id string) (string, error)

What /reasoning alone says outside this app: the effort of the session and what can be chosen

func (*Agent) Fallbacks

func (a *Agent) Fallbacks(cfg *config.Config) []Fallback

Every entry of the fallback chain of the profile in its order, each routed as the chain routes it or with why the chain leaves it out

func (*Agent) Finalize

func (a *Agent) Finalize(ctx context.Context, ids []string, reason string) []string

Ends the sessions as their hooks know it, such as those of an app that exits: what the hooks have to tell the person

func (*Agent) Follow

func (a *Agent) Follow(ctx context.Context, cfg *config.Config, change provider.Change) ([]string, error)

Keeps what sessions hold of providers and accounts in step with them, as the provider host tells of each change: the provider and model a session picked for itself, the settings it runs with over its profile's, such as the account it is held to, and the retries armed for an account to reset. A session that named a provider or account removed drops that choice, one that named a renamed one takes the new name. What it changed, as phrases such as 2 sessions

func (*Agent) Footing

func (a *Agent) Footing(tell func(Footed))

Hands over what hears of each reply footed with failed edits, such as what measures the agent

func (*Agent) Gates

func (a *Agent) Gates(ctx context.Context, id string) (string, error)

The gates of the session's goal, numbered with how they did last

func (*Agent) GoalStatus

func (a *Agent) GoalStatus(ctx context.Context, id string) (string, error)

How the session's goal stands, in a line with the goal under it

func (*Agent) Goals

func (a *Agent) Goals(ctx context.Context, profile string, all bool) ([]*agentv1.Goal, error)

Goals of the sessions of the profile, the asking window's for none, newest first: those set and, with all, those reached or cleared too. The sessions are read in one listing, hidden ones among them, so every one of them is looked at however many the profile has, and none read for its preview, which no goal shows

func (*Agent) Halt

func (a *Agent) Halt(profile string) int

Stops the replies going on in the sessions of the profile, every profile's for an empty one, as /stop stops the reply of one session, as a stop of icebath comes into force; how many it stopped. The message each answered stays in its session

func (*Agent) Heard

func (a *Agent) Heard(_ context.Context, found prompt.Found)

Tells the session a finding of the scanner was made in of it, as a notice among its messages: a file the prompt was to carry, a project's words. The finding in a tool result is kept on the result itself, which the chat shows beside it and exports carry, so it is told no second time; a session this server does not hold hears nothing

func (*Agent) Hears

func (a *Agent) Hears(chats *gateway.Registry)

Hands over the chat apps, which say who wrote the message a turn of a chat answers, as the pre_llm_call hooks name the sender

func (*Agent) Holds

func (a *Agent) Holds(profile string) string

A reply being written on the profile holds its folder in place until it ends

func (*Agent) Init

func (a *Agent) Init(ctx context.Context, id, notes string) (string, error)

Runs the turn of /init: the agent studies the folder the session works in and writes its AGENTS.md, or updates the one there, the notes the person gave honored; once the turn ends the session's prompt is built again, so the instructions written are what it reads from its next message on. The transcript, the queue and the title show the command as typed, the model alone reads the rules of the turn

func (*Agent) Interrupt

func (a *Agent) Interrupt(ctx context.Context, session, id string) bool

Stops one subagent of the session's spawn tree; whether it still ran

func (*Agent) Live

func (a *Agent) Live(profile string) []*agentv1.LiveSession

Sessions of the profile the server holds open and what each is doing, by id

func (*Agent) LoadTree

func (a *Agent) LoadTree(profile, path string) (*agentv1.SpawnTree, error)

A kept spawn tree of the profile, refused when the path lies outside the profile's spawn trees

func (*Agent) MainRoute

func (a *Agent) MainRoute(cfg *config.Config) (provider.Route, error)

The model new chats of the profile answer with, routed as a reply routes it, or why no reply can reach it

func (*Agent) Message

func (a *Agent) Message(ctx context.Context, id, text string, voice, interrupted bool) error

A message the person sent: a command run, else queued, steering or stopping the reply as the settings say. Spoken in voice mode its turn runs on the voice chat model; sent after the person cut a spoken reply off, the next message queued tells the model so

func (*Agent) MixtureMessage

func (a *Agent) MixtureMessage(ctx context.Context, id, text string) (string, error)

Sends one message through the default mixture, the chat's own model answering again after it: the mixture /moa names, else the first that is on and has an acting model. One that could not answer it is refused before the message is queued

func (*Agent) Mixtures

func (a *Agent) Mixtures(id string) (string, error)

The mixtures of the session's profile, each with its acting model and its advisers, the one the session's replies go through marked, as /moa alone lists them

func (*Agent) ModelNow

func (a *Agent) ModelNow(ctx context.Context, id string) (string, error)

What /model alone says outside this app: the model in effect for the session and the models its provider offers

func (*Agent) MoveQueued

func (a *Agent) MoveQueued(_ context.Context, id string, n, to int) (string, error)

Puts waiting message n at place to, both counting from 1 as /queue list numbers the messages

func (*Agent) NewChats

func (a *Agent) NewChats(cfg *config.Config) (provider.Instance, provider.Route, error)

The model new chats of the profile answer with as it would be routed now, read from what is kept alone: nothing renewed, probed or written, so the first run looks at it without sending anything anywhere

func (*Agent) Nudging

func (a *Agent) Nudging(tell func(Nudged))

Hands over what hears of each reply the agent sends back to work, such as what measures the agent

func (*Agent) Onces

func (a *Agent) Onces(profile string) []Picked

Models picked for one reply in the sessions of the profile the agent holds open, by session

func (*Agent) Outages

func (a *Agent) Outages(profile string) []Outage

Sessions of the profile that wait for a failing provider now, every profile's for none, the longest waiting first

func (*Agent) Outlasting

func (a *Agent) Outlasting(tell func(Outlasted))

Hands over what hears of how each session's waits for a failing provider ended, such as what measures the agent

func (*Agent) PauseGoal

func (a *Agent) PauseGoal(ctx context.Context, id string) (string, *agentv1.Goal, error)

func (*Agent) Pausing

func (a *Agent) Pausing(held func(profile string) string)

Hands over the emergency stop: why the replies of a profile may not start while icebath is paused, the notice of the stop; empty while nothing holds the profile

func (*Agent) Personality

func (a *Agent) Personality(id, name string) (string, error)

Lists the personalities outside this app, or sets the one every session of the profile speaks with from its next message on, saying what its row under Agent says

func (*Agent) PickEffort

func (a *Agent) PickEffort(ctx context.Context, id string) (string, error)

/reasoning alone in a chat app: asks how hard the session's model thinks, the effort of new chats among the choices, and sets the one picked. What /reasoning alone says elsewhere where a question waits already

func (*Agent) PickModel

func (a *Agent) PickModel(ctx context.Context, id string) (string, error)

/model alone in a chat app: asks which of the providers of the profile that are ready answers, then which of its models, and holds the session to the model picked; a provider alone goes straight to its models. What /model alone says elsewhere where nothing can be picked or a question waits already

func (*Agent) PickPersonality

func (a *Agent) PickPersonality(ctx context.Context, id string) (string, error)

/personality alone in a chat app: asks which personality every session of the profile speaks with, none among them, and sets the one picked. What /personality alone says elsewhere where a question waits already

func (*Agent) PickSpeed

func (a *Agent) PickSpeed(ctx context.Context, id string) (string, error)

/fast alone in a chat app: asks how fast the session's model answers, among the speeds its model has and the speed of new chats, and sets the one picked. What /fast alone says elsewhere where the model has no faster speed or a question waits already

func (*Agent) Ping

func (a *Agent) Ping(ctx context.Context, cfg *config.Config, route provider.Route) (time.Duration, error)

Asks the model of the route for one word and waits for the first words of its reply, as a check that it answers: how long they took to come, or why they did not

func (*Agent) Pinnable

func (a *Agent) Pinnable(settings *config.Config, name string) string

Why a profile can't start on a model of the provider named, empty when it can: the provider is none the profile has, nor a kind a plugin sets up

func (*Agent) Plan

func (a *Agent) Plan(ctx context.Context, id, task string) (string, error)

Runs a planning turn: the agent writes a markdown plan of the task, or of what the conversation is working toward, and does nothing else. The transcript, the queue and the title show the command as typed, the model alone reads the rules of the turn

func (*Agent) Preview

func (a *Agent) Preview(ctx context.Context, settings *config.Config, directory, surface string) (*prompt.Env, map[string]string, error)

What a new session of the profile of the settings, in the directory and shown on the surface, would be sent, for prompt-size

func (*Agent) Profile

func (a *Agent) Profile(id, name string) (string, error)

Shows the profile the session runs on, or runs it on another from now on. The provider, model and effort it picked and the accounts it was held to are forgotten, since they were those of the profile it ran on

func (*Agent) QueueList

func (a *Agent) QueueList(id string) (string, error)

The waiting messages as numbered lines of a note

func (*Agent) QueueMessage

func (a *Agent) QueueMessage(ctx context.Context, id, text string) (string, error)

Queues the message for after the reply running whatever enter does while the agent works, starting it now when none runs

func (*Agent) Queued

func (a *Agent) Queued(id string) ([]*agentv1.Pending, string, error)

The messages the person sent that the agent has not read yet, in the order they go, and why those held wait

func (*Agent) Quicks

func (a *Agent) Quicks(cfg *config.Config) []slash.Command

Quick commands of the profile of the settings as commands of the person's own, so a session lists and runs those of its own profile and none of them shadows another command

func (*Agent) Refers

func (a *Agent) Refers(host *references.References)

Hands the agent what expands the @ references of the messages people write, through which every message reaching a turn attaches what its references name

func (*Agent) Refresh

func (a *Agent) Refresh(ctx context.Context, settings *config.Config, id string) error

Builds the prompt the session holds again on its next turn, the session found among those of the profile of the settings alone

func (*Agent) RefreshModels

func (a *Agent) RefreshModels(ctx context.Context, id string) error

Fetches the online model catalog again and forgets the model lists kept for the session's provider, so the next listing reads them anew

func (*Agent) ReleaseQueue

func (a *Agent) ReleaseQueue(_ context.Context, id string) (string, error)

Sends the held messages now

func (*Agent) Reload

func (a *Agent) Reload(_ context.Context, id string) (string, error)

Answer of /reload: the profile's .env as it reads now, which icebath reads again whenever the file changes, with the variables it sets by name, their values left out

func (*Agent) RemoveGate

func (a *Agent) RemoveGate(ctx context.Context, id string, n int) (string, *agentv1.Goal, error)

func (*Agent) RemoveQueued

func (a *Agent) RemoveQueued(_ context.Context, id string, n int) (string, error)

Takes waiting message n out, counting from 1

func (*Agent) RemoveSubgoal

func (a *Agent) RemoveSubgoal(ctx context.Context, id string, n int) (string, *agentv1.Goal, error)

func (*Agent) Rename

func (a *Agent) Rename(old, renamed string) error

Runs of a renamed profile's sessions go on under its new name, as the store moved the sessions there

func (*Agent) ResumeGoal

func (a *Agent) ResumeGoal(ctx context.Context, id string) (string, *agentv1.Goal, error)

func (*Agent) Retry

func (a *Agent) Retry(id string) error

Sends the last message the user sent again, the replies to it taken back

func (*Agent) Review

func (a *Agent) Review(ctx context.Context, id, instructions string) (string, error)

Starts an independent subagent reviewing the work the conversation just discussed, its review re-entering the conversation once done; what the user is told

func (*Agent) SaveTree

func (a *Agent) SaveTree(session string, tree *agentv1.SpawnTree) (string, error)

Keeps a finished spawn tree of the session, a tree kept again under its time keeping its one index entry

func (*Agent) Send

func (a *Agent) Send(ctx context.Context, id, text string) error

func (*Agent) SetBusy

func (a *Agent) SetBusy(ctx context.Context, id, mode string, clear bool) (string, error)

Sets what a message sent while the session's agent works does, or with clear lets it take the choice of new chats again. The note the control gives

func (*Agent) SetEffort

func (a *Agent) SetEffort(ctx context.Context, id, effort string, clear bool) (string, error)

Sets how hard the session's model thinks, or with clear lets it take the effort of new chats again. The note the control gives

func (*Agent) SetGoal

func (a *Agent) SetGoal(ctx context.Context, id, text string, draft, keep bool) (string, *agentv1.Goal, error)

func (*Agent) SetLogin

func (a *Agent) SetLogin(ctx context.Context, id, name, login, onExhausted string, retry, clear bool) (*agentv1.SetLoginResponse, error)

Holds the session to one login of a provider, or its rotation, and sets what it does once that login runs out, or drops the session's own choice; sends the last turn again on it when asked

func (*Agent) SetMixture

func (a *Agent) SetMixture(ctx context.Context, id, name string, clear bool) (string, error)

Sends the session's replies through the mixture of the name, or with none through no mixture, or with clear lets the session take the mixture of new chats again. The note the control gives

func (*Agent) SetModel

func (a *Agent) SetModel(ctx context.Context, id, name, model string, clear bool) (string, error)

Holds the session to a model: one of the provider named, a model shortcut, which says where it runs, or with no provider one of the provider in effect; none takes the provider's default model. With clear the session takes the model of new chats again. The note the control gives

func (*Agent) SetModelEffort

func (a *Agent) SetModelEffort(ctx context.Context, id, effort string, clear bool) (string, error)

Sets how hard the model the session runs on thinks in every chat of the profile, as Reasoning by model keeps it, in the entry that names the model already whatever spelling it writes, else under the model's id; with clear the model thinks as Reasoning effort says again, every entry that names it let go of. The note the control gives

func (*Agent) SetProfileSpeed

func (a *Agent) SetProfileSpeed(ctx context.Context, id, speed string, clear bool) (string, error)

Sets the speed of new chats of the session's profile, as Speed keeps it; with clear new chats run at normal speed again. The note the control gives, which says so when the chat keeps its own

func (*Agent) SetSpeed

func (a *Agent) SetSpeed(ctx context.Context, id, speed string, clear bool) (string, error)

Sets how fast the session's model is asked to answer, normal, fast or ultrafast, or with clear lets it take the speed of new chats again. The note the control gives

func (*Agent) ShowGoal

func (a *Agent) ShowGoal(ctx context.Context, id string) (string, error)

The session's goal whole: how it stands, its contract, subgoals and gates and what the judge said last

func (*Agent) Shut

func (a *Agent) Shut(id string) error

Closes a session the server holds open, stopping its turn; it stays stored, ended as the person closed it

func (*Agent) SideQuestion

func (a *Agent) SideQuestion(ctx context.Context, id, question string) (string, error)

Answers a side question about the conversation without tools and without touching it: the answer is shown in the chat once it comes, while the agent's own reply goes on

func (*Agent) Slowed

func (a *Agent) Slowed(profile string) []Slowed

Models whose provider refused the faster tier in the sessions of the profile the agent holds open, by session and model

func (*Agent) Spawn

func (a *Agent) Spawn(ctx context.Context, cfg *config.Config, session, by, from string, s Spawning) (Spawned, error)

Starts a subagent for a session of the profile on behalf of by (the extension foo), its questions and approvals shown as from's, through the delegation's own door: its pause, depth and budget, the placement of its route on the profile's providers, the session's approvals and rules, never a tool the session is not offered. It runs in the background: its result goes into the session too when Report asks, and stays with the one who started it in any case, which Subagent and Await read. Refused in the delegation's words

func (*Agent) SpeedNow

func (a *Agent) SpeedNow(id string) (string, error)

The speed the chat runs at and whether its model has it, as /fast alone says: for automatic and first reply speed how long the window lasts and whether it is open now; a model whose provider refused the faster tier for the account, until when; where the speed comes from

func (*Agent) Speeding

func (a *Agent) Speeding(tell func(Sped))

Hands over what hears of each model request that asked for a faster tier, such as what measures the agent

func (*Agent) Status

func (a *Agent) Status(id string) (string, error)

func (*Agent) Steer

func (a *Agent) Steer(ctx context.Context, session, id, text string) (bool, string)

Sends the person's guidance to the reply running: read at the next step of the session's agent and every subagent running under it, or of one subagent of its spawn tree; why it was not taken when it was not

func (*Agent) SteerMessage

func (a *Agent) SteerMessage(ctx context.Context, id, text string) (string, error)

What /steer says: the text sent to the reply running, read at the next step of the agent and of every subagent running under it, or sent as the next message when no reply runs; the queue shows where it is until it is read

func (*Agent) SteerQueued

func (a *Agent) SteerQueued(ctx context.Context, id string, n int) (string, error)

Has the agent read waiting message n, counting from 1, at the next step of the reply running

func (*Agent) SteerSubagent

func (a *Agent) SteerSubagent(session, by, id, text string) (bool, string)

Sends guidance to the subagent by started in the session, which it reads at its next step; why it was not taken when it was not

func (*Agent) Stop

func (a *Agent) Stop(id string) error

func (*Agent) StopSubagent

func (a *Agent) StopSubagent(session, by, from, id string) bool

Stops the subagent by started in the session, what it did so far kept as its result; whether it still ran

func (*Agent) Subagent

func (a *Agent) Subagent(session, by, id string) (Spawned, error)

A subagent by started in the session, as it stands: running, or ended with what it came to as the ledger of delegations keeps it

func (*Agent) Subagents

func (a *Agent) Subagents(ctx context.Context, session string) (*agentv1.SubagentsResponse, error)

Live subagents of the session's spawn tree with the pause, the limits and the session's failed background delegations

func (*Agent) Subgoals

func (a *Agent) Subgoals(ctx context.Context, id string) (string, error)

The subgoals of the session's goal, numbered

func (*Agent) Submit

func (a *Agent) Submit(ctx context.Context, id, text, display string) error

Sends the text to the model as the user's next message of the session, queued behind a reply in progress; display is what the user typed, which the session's title and transcript show in place of the text

func (*Agent) SwitchModel

func (a *Agent) SwitchModel(ctx context.Context, id, name, model, effort, to string) (string, error)

Switches the session's model as far as the reach says, the reach of the profile's settings for none: the chat's, the profile's (new chats and this chat, a confirmed pick counting as accepted for good), or the person's next reply alone, after which the chat goes back to the model, provider and effort it held. The effort the pick comes with reaches as far, none leaving the effort as it is. Every reach is weighed by the guards of the models host first, a pick for one reply as much as any. The note the control gives: what changed and how far, what the guards had to say, and the summary the next message runs first where the new model's window can't hold what the chat holds

func (*Agent) Switching

func (a *Agent) Switching(tell func(Switched))

Hands over what hears of each pick of a model a person made, such as what measures the agent

func (*Agent) Tail

func (a *Agent) Tail(ctx context.Context, session, id string) (string, bool, bool, error)

Newest part of the transcript of a subagent the session's spawn tree runs or ran, false when it left none

func (*Agent) Title

func (a *Agent) Title(id, title string) (string, error)

Shows the session's title, or sets one the user chose

func (*Agent) ToggleSpeed

func (a *Agent) ToggleSpeed(ctx context.Context, id string, global bool) (string, error)

Switches the session's speed, or with global the speed of new chats of its profile, to fast, or back to normal from fast or ultrafast, as alpha's toggle does. The note the control gives

func (*Agent) Tool

func (a *Agent) Tool(ctx context.Context, cfg *config.Config, id, cwd, from, name, args string) string

Runs a tool for a session of the profile as the agent's own call would run in it, for another than the agent, such as an extension, in the environment Bind gives

func (*Agent) Trees

func (a *Agent) Trees(session string, every bool, limit int) ([]*agentv1.SpawnTree, []int32, error)

Spawn trees kept for the session, or every session of its profile, newest first, with the subagents each holds

func (*Agent) TryNewChats

func (a *Agent) TryNewChats(ctx context.Context, cfg *config.Config) (Tried, error)

Asks the model new chats of the profile answer with for one word and waits for the whole reply, as a try the person asked for: how long it took, the model that served it and the tokens it took, which the cost of the try is made of

func (*Agent) Undo

func (a *Agent) Undo(id string, count int) (string, error)

Takes back the last messages the user sent and the replies to them: the line naming the files the undone turns changed, which /rollback restores, empty when they changed none or snapshots don't serve the session

func (*Agent) UnwaitGoal

func (a *Agent) UnwaitGoal(ctx context.Context, id string) (string, *agentv1.Goal, error)

func (*Agent) Usage

func (a *Agent) Usage(ctx context.Context, id, argument string) (string, error)

Token usage of the session, its cost and the rate limits the provider stated, then what the provider says the account may still spend; reset spends a banked reset of the account's limits where its kind has them

func (*Agent) WaitGoal

func (a *Agent) WaitGoal(ctx context.Context, id string, pid int, reason string) (string, error)

Parks the session's goal until the process of the pid exits where the session's commands run, for the reason given: one of its background processes is waited on by its record, so a watch pattern that fires ends the wait too

func (*Agent) WaitLogin

func (a *Agent) WaitLogin(ctx context.Context, id, name string, now, cancel bool) (*agentv1.WaitLoginResponse, error)

Sends the session's last turn again once the login it is held to resets, or at once, or drops the retry armed

func (*Agent) Watch

func (a *Agent) Watch(ctx context.Context, id, client string, deliver func(*agentv1.WatchResponse) error) error

func (*Agent) Yolo

func (a *Agent) Yolo(id string) (string, error)

Flips Skip approvals in this chat for the session, through the one function of that switch, with the note it gives

type Answers

type Answers struct {
	Agent *Agent
}

The agent as programs that reach it over the HTTP API see it: what answers the prompts of the runs they start, takes their guidance, and holds a session to the model a program names for it

func (Answers) Answer

func (n Answers) Answer(ctx context.Context, session, set, question string, values []string) error

Answers one question of the set the agent asked

func (Answers) Approve

func (n Answers) Approve(ctx context.Context, session, id, choice string) error

Answers the approval prompt of the id with one of the choices it takes

func (Answers) Held

func (n Answers) Held(session *sessionsv1.Session) api.Hold

What the session's own settings hold it to

func (Answers) Hold

func (n Answers) Hold(ctx context.Context, session string, to api.Hold) error

Holds the session to the model of the provider, and to the effort and the speed where the hold names them, one it does not name being let go of. With neither a provider nor a model the session lets go of all of it

func (Answers) Main

func (n Answers) Main(cfg *config.Config) (string, string)

The provider and the model the agent of the profile answers with while nothing names another, as a program is told them: the provider by its name in the profile, and the model as the settings write it, every ${NAME} kept; both as the settings write them where they name nothing that can answer, the provider by its name where the profile has it

func (Answers) Routes

func (Answers) Routes() []api.Route

Serves no routes of its own, the API's answering through it

func (Answers) Steer

func (n Answers) Steer(ctx context.Context, session, text string) error

Has the reply the session writes take the guidance into account

type Blanked

type Blanked struct {
	Profile, Kind string
}

What became of a reply with nothing in it

type Chats

type Chats struct {
	Agent *Agent
}

The agent as the chat apps see it: what answers the people who write there. It holds the agent rather than embedding it, so the host of the chat apps closing its registrants never closes the agent, which the server it serves closes

func (Chats) Answer

func (c Chats) Answer(_ context.Context, session, set, question string, values []string) error

Answers one question of the set the agent asked

func (Chats) Approve

func (c Chats) Approve(_ context.Context, session, id, choice string) error

Answers the approval prompt of the id with one of the choices it takes

func (Chats) Follow

func (c Chats) Follow(ctx context.Context, session string, hold bool) (<-chan gateway.Event, error)

Tells what the session does from now on: what the agent writes, what the person is told and asked, when a reply starts and ends. The channel closes once the context ends, the agent lets go of the session or the listener falls too far behind. A session the agent does not hold is taken up when hold says so, and gives no channel otherwise

func (Chats) Leave

func (c Chats) Leave(ctx context.Context, left, next, reason string) error

Ends the session a chat leaves for the next: its reply stops, it ends for the reason given as its hooks know it, what they have to say is told in the next, and on_session_reset hears of both

func (Chats) Length

func (c Chats) Length(ctx context.Context, session string) (gateway.Length, error)

How long the session is, as the host of the chat apps weighs whether to shorten it before a reply: the messages the model is sent, the tokens they take by the provider's own count where one holds, the window of its model, whether it works now, and whether long sessions are shortened for it, which they are not where the profile turned that off, nothing summarizes here, or the provider keeps the conversation itself and compacts it on its own side

func (Chats) Platforms

func (Chats) Platforms(*config.Config) []gateway.Platform

The agent brings no chat apps of its own

func (Chats) Retract

func (c Chats) Retract(ctx context.Context, session, id string, reworded map[string]string) error

Takes back a message a person sent the session from a chat app, by the id the app knows it by. One that still waits, in the queue or as a steer of the reply, is taken out before the agent reads it. One the agent read keeps its place, and what it said and carried is replaced by a line saying it was taken back, in the session and in every copy of it, which the windows of the session then show. Reworded names lines the session was shown of the message as part of other messages, each with what takes its place there

func (Chats) Send

func (c Chats) Send(ctx context.Context, session string, said gateway.Said) error

Sends what a person wrote in a chat into its session, as a window's message goes: a command runs, anything else is queued, steers the reply or stops it as the session's settings say. The images it carried go to the model with it, a command that lists the commands lists those the person may run in the chat alone, the ones the chat answers itself among them, and a command typed bare that sets something the person picks, such as /model, asks it as a question of the chat

func (Chats) Stop

func (c Chats) Stop(_ context.Context, session string) error

Stops the reply running in the session; one the agent does not hold has none

func (Chats) Tidy

func (c Chats) Tidy(_ context.Context, session string, limits gateway.Limits) (<-chan gateway.Tidied, error)

Summarizes the older messages of the session in their place beside whatever else the session does, within the limits, and sends what came of it once it ended. It runs in the background, where Close waits for it; no channel once the agent is closing

func (Chats) Tune

func (c Chats) Tune(ctx context.Context, session string, tuning gateway.Tuning) error

Has the session of a chat follow what the rules of its chat say from now on. The instructions are kept as the session's own setting and added to what the agent is told from the next reply on, and the skills are the ones its prompt loads, each taking the place of what the rules said before. The session is held to the model of the rules when they name another than they last did, and takes the model of new sessions again once they name none, so a model the person picks in the chat holds until the rules change. A model that cannot be used leaves the session's model as it is and is returned as the error, the rest of the rules still followed

type Driver

type Driver struct {
	Agent *Agent
}

The agent as the runner host sees it: what drives the sessions nobody types into, and the source of the background tasks /bg starts. It holds the agent rather than embedding it, so the runner host closing its registrants never closes the agent, which the server it serves closes

func (Driver) Drive

func (d Driver) Drive(ctx context.Context, job *runs.Run) (runs.Reply, error)

Sends the run's text into its session, one made for it with the run's settings when it names none, and follows the reply to its end: the last text the agent wrote, why it failed, whether it was stopped or left waiting on an answer nobody gives

func (Driver) Idle

func (d Driver) Idle(session string) bool

Whether the session has no reply running and none about to, what waits being held for the person; true for one the agent does not hold

func (Driver) Judge

func (d Driver) Judge(ctx context.Context, _ *config.Config, session, condition, reply string) (runs.Verdict, error)

What the goal judge decides of the session's reply against a stop condition, on the session's helper model: done, blocked, or neither when the reply has not met it yet; an error saying why when the judge could not be reached, so no caller takes that for a ruling

func (Driver) Note

func (d Driver) Note(ctx context.Context, session, text string) error

Adds the text to the session's transcript as a message of the agent once its reply running is over, shown at once to the windows watching it

func (Driver) Owns

func (d Driver) Owns(ctx context.Context, session string) bool

Whether a standing goal drives the session now: set, not paused, and not parked waiting on something

func (Driver) Sources

func (Driver) Sources() []runs.Source

func (Driver) Steer

func (d Driver) Steer(ctx context.Context, session, text string) (bool, error)

Sends the text to the reply running in the session, read at the next step of its agent and of every subagent under it; false when no reply runs there. A session this process does not hold runs no reply, so it is not taken up to be told

func (Driver) TakeUp

func (d Driver) TakeUp(ctx context.Context, _ *config.Config, cut runs.Cut) runs.Taking

What becomes of a background task an icebath left cut off: as icebath stops, it ends as stopped, which the chat that started it is told as it ends; found cut off by an icebath that ended, the chat that started it is told here, with the session that holds what the task did, and it is not run again, as alpha leaves a background task whose process died

type Editors

type Editors struct {
	Agent *Agent
}

The agent as code editors see it: what answers the people who write in the sessions an editor follows, and what holds such a session to the model and the effort its person picks there. It holds the agent rather than embedding it, so the host of the editors never closes the agent, which the server it serves closes

func (Editors) Keep

func (e Editors) Keep(ctx context.Context, session string, values map[string]any) error

Keeps the values as the session's own settings over its profile's, a nil value letting go of its key

func (Editors) Options

func (e Editors) Options(cfg *config.Config, session *sessionsv1.Session) []acp.Option

What a person sets on a session from their editor that the agent decides: the model that answers it, among those the providers of the profile that are ready offer as the model picker lists them, and how hard that model thinks

func (Editors) Watch

func (e Editors) Watch(ctx context.Context, session, editor string) (acp.Window, acp.Shown, error)

Shows the session to an editor as a window of the app is shown it: the editor is counted among the windows that hold the session open, given what the session showed as the window opened, told how the session stands and what waits on a person there, and from then on everything the session does

type Fallback

type Fallback struct {
	// The entry as the settings hold it, provider:model
	Entry string
	Route provider.Route
	Err   error
}

One entry of the fallback chain of a profile as the chain reads it: its route, or why the chain leaves it out

type Footed

type Footed struct {
	// Profile of the session
	Profile string
	// Files whose edits failed
	Files int
}

A reply footed with the edits of its turn that failed and were never made good

type Nudged

type Nudged struct {
	// Profile of the session
	Profile string
	// Why: it only promised work (promise), ended on a next step it announced (trailing), gave a plan in its reasoning alone (plan), ended
	// the work on a fragment (fragment), changed files with no fresh passing check (verify) or a pre_verify hook sent it back (pre_verify)
	Kind string
}

A reply the agent sent back to work rather than let it end the reply

type Outage

type Outage struct {
	Session, Profile string
	// What failed, as a person reads it: "OpenRouter is overloaded"
	Failure string
	// Wait it is in, counted from 1, and the waits it may take
	Wait, Waits int
	// When its waiting began, and when the request is tried again
	Since, Next time.Time
}

A session that waits for its failing provider to take requests again

type Outlasted

type Outlasted struct {
	Profile string
	// What failed last, one of the Failure names, and how it ended, one of the Outcome names
	Failure, Outcome string
	// Waits taken, and how long they took in all
	Waits  int
	Waited time.Duration
}

How the waits of a session for its failing provider ended

type Picked

type Picked struct {
	Session, Model string
	Running        bool
}

A model picked for one reply in a session the agent holds open: the reply running answers with it, or the person's next will

type Side

type Side struct {
	Text string
	// It was answered over the session's own last request, which keeps the provider's prompt cache, rather than over a transcript
	Forked bool
	// Tokens it took, every round of it
	Usage provider.Usage
}

What a side question came to

type Slowed

type Slowed struct {
	Session, Model string
	Until          time.Time
}

A model whose provider refused the faster tier for the account in a session the agent holds open, left out of its requests until Until

type Spawned

type Spawned struct {
	// Its id, the delegation it is of, its own session while it runs, its goal, role and model
	ID, Delegation, Session, Goal, Role, Model string
	// queued, running, completed, failed, error, timeout or interrupted
	State string
	// Tool calls it started, the one it runs now and what it does, while it runs
	Calls       int
	Tool, Doing string
	Started     time.Time
	// It ended, and what it came to: its own final report or why it failed, its model calls, seconds, tokens and dollars
	Done          bool
	Summary       string
	Error         string
	APICalls      int
	Duration      float64
	Input, Output int64
	Cost          *float64
}

A subagent another than the agent started, as it stands

type Spawning

type Spawning struct {
	Goal, Context string
	// Toolsets it may use, of those the session is offered; every one a subagent may use for none
	Toolsets []string
	// Provider of the profile and model it runs on, the delegation's own placement for neither
	Provider, Model string
	// leaf, or orchestrator to start subagents of its own where the settings allow
	Role string
	// JSON Schema its final answer must satisfy, nil for free text
	Schema map[string]any
	// Its result goes into the session too, as the agent's own background subagents' results do, so the agent goes on from it; to the one
	// who started it alone otherwise
	Report bool
}

What another than the agent, such as an extension, asks of a subagent it starts in a session

type Sped

type Sped struct {
	Profile string
	// The tier asked for, fast or ultrafast; and how the request was served, one of the Speed outcomes
	Tier, Outcome string
}

A model request that asked for a faster tier

type Switched

type Switched struct {
	Profile string
	// How far it reached: session, global or once
	Reach string
}

What hears of each pick of a model a person made, such as what measures the agent

type Tried

type Tried struct {
	Instance provider.Instance
	Route    provider.Route
	// How long the whole reply took
	Took time.Duration
	// Model the provider says served it, which a router may pick other than the one asked for
	Served string
	// What it answered, and the tokens it took; nil when the provider said nothing of them
	Text  string
	Usage *provider.Usage
}

What a try of the model new chats answer with came to

type Unanswerable

type Unanswerable string

Why nobody can answer questions in a session, a whole sentence a person reads

func (Unanswerable) Error

func (u Unanswerable) Error() string

Jump to

Keyboard shortcuts

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