Documentation
¶
Index ¶
- Constants
- Variables
- func CheckImages(images []Image) error
- type AuthInfo
- type AuthMethod
- type CatalogPlugin
- type Event
- type FlowInfo
- type FlowRun
- type FlowStat
- type Image
- type LogEntry
- type MCPInfo
- type MCPToolInfo
- type MarketInfo
- type Pending
- type PluginInfo
- type PreviewSection
- type ProviderInfo
- type SessionInfo
- type SessionLog
- type SessionUsage
- type Settings
- type SkillsInfo
- type TryTarget
- type TurnUsage
Constants ¶
const ( EventToken = "token" EventTurnStart = "turn.start" EventTurnEnd = "turn.end" EventToolStart = "tool.start" EventToolEnd = "tool.end" EventApprovalRequested = "approval.requested" EventApprovalResolved = "approval.resolved" EventReviewRequested = "review.requested" EventReviewResolved = "review.resolved" // A flow's question (ADR 0003): Pending has it, and its options. EventQuestionRequested = "question.requested" EventQuestionResolved = "question.resolved" // A flow ran on (ADR 0003): Flow is its chart and its calls' states. EventFlow = "flow" )
Kinds of Event.
const ( FlowRunOK = "ok" FlowRunFailed = "failed" FlowRunBroken = "broken" // the script could not run FlowRunCancelled = "cancelled" FlowRunRunning = "running" )
Flow runs' statuses, besides running.
const ( FromCommand = "command" // /flow <name> FromHook = "hook" // a hook (turn.end, tool.after, session.start) FromAgent = "agent" // an agent's workflow: )
How a flow came to run.
const ( FlowRunning = "running" FlowDone = "done" FlowFailed = "failed" FlowWaiting = "waiting" // for the user: an approval, a review, a question )
States of a call of a flow, as its chart shows them.
const ( AuthSignedIn = "signed-in" AuthNeeded = "needed" AuthUnknown = "unknown" )
Sign-in states of a provider (ADR 0015, 追記).
const FailedNote = "" /* 138-byte string literal not displayed */
FailedNote is put before the first message of a session forked from one that failed (ADR 0021): the turn cut short may have changed files.
const KindQuestion = "question"
KindQuestion is a Pending that is a flow's question.
const ReviewQuestion = "Cut off while it ran — did it take effect?"
ReviewQuestion is what a review asks of a call cut off while it ran (invariant 4): whether it took effect.
const StoppedCancelled = "cancelled"
StoppedCancelled is why a turn the user stopped ended, as clients are told it (a turn's Stopped).
Variables ¶
var ( ErrNotAFlow = errors.New("this call writes no flow to try") ErrTrying = errors.New("it is being tried: answer it, or wait for the try to end") )
ErrNotAFlow: a request to try what is not a flow's write; ErrTrying: one while a try of it is under way.
var ( ErrNoForkPoint = errors.New("no finished turn to fork from") ErrNoSnapshot = errors.New("there is no snapshot of the files after that turn, to put them back as they were") ErrForkWhileRunning = errors.New("a turn of the session is running in its files: fork with --files once it ends") )
ErrNoForkPoint: the session has no finished turn to fork from there. ErrNoSnapshot: there is no record of the files after it, to put back. ErrForkWhileRunning: the files are not put back while a turn of the session runs in them.
var ( ErrNoProvider = errors.New("no such provider") ErrNotInstalled = errors.New("not installed") )
ErrNoProvider: no such provider. ErrNotInstalled: an agent of the registry not installed (yet).
var ErrAnswered = errors.New("already answered, or no longer waiting")
ErrAnswered: the request was answered already (by another client), or waits no more.
var ErrBadImage = errors.New("image not taken")
ErrBadImage: an image is not taken (its kind, its size, how many).
var ErrClosing = errors.New("the daemon is closing: tell the next")
ErrClosing: the runtime is closing; what it is told, the next is to be.
var ErrNoCommand = errors.New("no such command")
ErrNoCommand: the session has no command of that name.
var ErrNoFlow = errors.New("this session has run no flow")
ErrNoFlow: the session has run no flow.
var ErrNoFlowName = errors.New("/flow needs a flow's name: /flow <name> [what to give it]")
ErrNoFlowName: /flow was given no name.
var ErrNoFlowRequest = errors.New("/flow new needs what the flow is to do: /flow new <what it does>")
ErrNoFlowRequest: /flow new was given nothing to make a flow of.
var ErrNoFlowRun = errors.New("no flow run of that id (kept runs: kairocode flow runs)")
ErrNoFlowRun: no flow's run of that id, running or kept.
var ErrNoTurnToCancel = errors.New("no turn is running")
ErrNoTurnToCancel: the session's last turn has ended (or none was sent).
var ErrNoUndo = errors.New("this session started before undo existed: start a new session to undo")
ErrNoUndo: the session started before undo existed (version 3 or older): it would take an undo for a message.
var ErrQuestion = errors.New("not an answer to this question")
ErrQuestion: a flow's question was given a yes or no, or an answer that is not one of its options.
var ErrSessionFailed = errors.New("this session stopped on an error and takes no more messages")
ErrSessionFailed: the session stopped on an error (a store's, say: kairo-gap #16) and takes no more messages. It goes on in a session forked from its last finished turn (ADR 0021).
ErrUnavailable: the provider cannot run here.
var Modes = []string{workflows.ModeManual, workflows.ModeAuto, workflows.ModePlan}
Modes are the modes a session can be in (ADR 0016).
Functions ¶
func CheckImages ¶
CheckImages refuses, before anything is stored, what the model would: a kind it does not read, more than MaxImageBytes, more than MaxImages. The bytes must be of the kind said. Errors name no content.
Types ¶
type AuthInfo ¶
type AuthInfo struct {
State string `json:"state"`
Methods []AuthMethod `json:"methods,omitempty"`
}
AuthInfo is a provider's sign-in: its state and the ways to sign in.
type AuthMethod ¶
type AuthMethod struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Command []string `json:"command,omitempty"`
Agent bool `json:"agent,omitempty"`
}
AuthMethod is a way to sign in to a provider: a command the user runs in the terminal (Command), or one the agent carries out itself through ACP's authenticate (Agent).
type CatalogPlugin ¶
type CatalogPlugin struct {
Name string `json:"name"`
Marketplace string `json:"marketplace"`
Description string `json:"description,omitempty"`
Installed bool `json:"installed,omitempty"` // one of the user's has its name
// Unsupported: why it cannot be installed.
Unsupported string `json:"unsupported,omitempty"`
}
CatalogPlugin is a plugin of a marketplace, as /plugin shows it.
type Event ¶
type Event struct {
// Seq orders a session's events while this process runs.
Seq int64 `json:"seq"`
Type string `json:"type"`
// Turn is the turn's run id; N its number (turn.start, turn.end).
Turn string `json:"turn,omitempty"`
N int `json:"n"`
// Call names a tool call: the model's tool_use id, or the MCP call's run
// id (ADR 0007).
Call string `json:"call,omitempty"`
Tool string `json:"tool,omitempty"`
Input json.RawMessage `json:"input,omitempty"`
Output string `json:"output,omitempty"`
IsError bool `json:"is_error,omitempty"`
// Text is a token's text.
Text string `json:"text,omitempty"`
// Pending is what waits (approval.requested, review.requested); Key
// what was answered (approval.resolved, review.resolved), and OK the
// answer when it was given in this process: the call may run, or (a
// review) it took effect.
Pending *Pending `json:"pending,omitempty"`
Key string `json:"key,omitempty"`
OK *bool `json:"ok,omitempty"`
// turn.end
Reply string `json:"reply,omitempty"`
Steps int `json:"steps,omitempty"`
Stopped string `json:"stopped,omitempty"`
Usage *msg.Usage `json:"usage,omitempty"`
Error string `json:"error,omitempty"`
// Flow: a flow's chart and how far it has gone (flow).
Flow *flowchart.View `json:"flow,omitempty"`
}
Event is something that happened in a session, told to those who watch it (issue #1). Events are not records: they are made from the records and the runtime's observations as things happen, and carry nothing that is not recorded (invariant 6). They come from this process's observations, so they tell of what runs here: all of it while one daemon drives the data directory (ADR 0008). A watcher that misses some (it joined late, was too slow, or the daemon restarted) is told first what waits for a person when it watches again; the rest it reads from the records.
type FlowInfo ¶
type FlowInfo struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
// Draft: a draft, which runs only as a try (/flow <name> --draft, ADR
// 0030).
Draft bool `json:"draft,omitempty"`
// Args: what it is to be given (its ARGS).
Args string `json:"args,omitempty"`
}
FlowInfo is a flow a session can run.
type FlowRun ¶
type FlowRun struct {
ID string `json:"id"` // the flow's run (kairo's)
Session string `json:"session"`
Turn int `json:"turn"`
Dir string `json:"dir"`
Name string `json:"name"`
Args string `json:"args,omitempty"`
From string `json:"from"` // FromCommand, FromAgent, FromHook
// Try: a try of the flow before it was written (ADR 0017): what it
// would have done, kept apart from its runs.
Try bool `json:"try,omitempty"`
Hook string `json:"hook,omitempty"` // the hook that ran it
Started time.Time `json:"started"`
Ended time.Time `json:"ended,omitzero"`
Status string `json:"status"`
Message string `json:"message,omitempty"` // what the flow said it did
Agents int `json:"agents,omitempty"`
Usage msg.Usage `json:"usage"`
// View and Steps: not in a list (FlowRuns).
View *flowchart.View `json:"view,omitempty"`
Steps []LogEntry `json:"steps,omitempty"`
}
FlowRun is a flow's run: where it ran and from what, how it ended, its chart with each step's state, and its steps with their times.
type FlowStat ¶
type FlowStat struct {
Name string `json:"name"`
Runs int `json:"runs"`
OK int `json:"ok"`
Failed int `json:"failed"` // said no, could not run, failed or was cancelled
// Runs that are neither OK, Failed nor Running ended in a way that is no
// longer kept.
Running int `json:"running"`
From map[string]int `json:"from,omitempty"`
Last time.Time `json:"last,omitzero"`
// Defined: the project has its script now.
Defined bool `json:"defined"`
}
FlowStat is what the records say of one flow of a project: how often it ran, from where, and how it ended. A flow of the project that never ran has no runs.
type LogEntry ¶
type LogEntry struct {
At time.Time `json:"at"`
End time.Time `json:"end,omitzero"`
Kind string `json:"kind"` // turn, model, tool, permission, wait, workflow, step
Name string `json:"name"`
Status string `json:"status"`
Text string `json:"text,omitempty"`
Usage *msg.Usage `json:"usage,omitempty"`
Runs []LogEntry `json:"runs,omitempty"`
}
LogEntry is a run of the record: a turn, a call, a wait, a child workflow (with its own runs).
type MCPInfo ¶
type MCPInfo struct {
Kind string `json:"kind"` // mcp, tool, codex
Name string `json:"name"`
Source string `json:"source"`
Project bool `json:"project,omitempty"`
State string `json:"state"` // what it is now, in a few words
Tools []MCPToolInfo `json:"tools,omitempty"`
}
MCPInfo is what /mcp shows of an MCP server, a custom tool, or a server of codex's own settings (ADR 0022).
type MCPToolInfo ¶
MCPToolInfo is a tool and its effect as KairoCode runs it.
type MarketInfo ¶
type MarketInfo struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Source string `json:"source,omitempty"` // "" built in
Commit string `json:"commit,omitempty"`
BuiltIn bool `json:"builtIn,omitempty"`
Claude bool `json:"claude,omitempty"` // Claude Code's
Plugins int `json:"plugins"`
}
MarketInfo is a marketplace, as /plugin shows it.
type Pending ¶
type Pending struct {
Kind string `json:"kind"`
// Key names the request: give it to Approve, or a question's to
// Answer.
Key string `json:"key"`
Turn string `json:"turn"`
Tool string `json:"tool"`
Subject string `json:"subject"`
Rule string `json:"rule"`
Options []string `json:"options,omitempty"`
// Preview is what the call would do (a flow's shape), to show; and in
// its sections, for a client that shows them apart.
Preview string `json:"preview,omitempty"`
Sections []PreviewSection `json:"sections,omitempty"`
// Try, for a flow's write: the flow, to try it first (ADR 0017).
// Trying: a try of it is under way; an answer given now is taken when
// it ends.
Try *TryTarget `json:"try,omitempty"`
Trying bool `json:"trying,omitempty"`
}
Pending is what waits for the user: a tool call, for approval before it runs (Kind "approval") or, cut off while it ran, to be told whether it took effect (Kind "review", invariant 4); or a flow's question (Kind "question": Subject is the question, Options its answers, ADR 0003).
type PluginInfo ¶
type PluginInfo struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Version string `json:"version,omitempty"`
Source string `json:"source"`
Project bool `json:"project,omitempty"`
Auth string `json:"auth"` // none, key, oauth
State string `json:"state"`
Tools []MCPToolInfo `json:"tools,omitempty"`
Skills []string `json:"skills,omitempty"`
// Unused: what of a Claude Code plugin KairoCode does not use
// (commands, subagents, hooks…; ADR 0027).
Unused []string `json:"unused,omitempty"`
}
PluginInfo is what /plugin shows of a plugin.
type PreviewSection ¶
type PreviewSection struct {
Name string `json:"name"`
Text string `json:"text"`
Refs [][2]int `json:"refs,omitempty"`
Details []string `json:"details,omitempty"`
Chart json.RawMessage `json:"chart,omitempty"`
}
PreviewSection is a named part of what a call would do: Overview, Flow, Changes, Script, Try. Refs: for each line of Text, the script's lines it is ({0, 0} for none), to show them; Details: for each line, more to show of it ("" for none: a change's before and after). Chart: the flow's chart (flowchart.Chart), for a client that draws it (Text is its tree).
type ProviderInfo ¶
type ProviderInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Kind string `json:"kind"` // "api", "cli" or "acp"
Description string `json:"description,omitempty"`
// Available: it can run here now. Else Installable says the user can
// install it (Version from Source); else Reason says why not.
Available bool `json:"available"`
Installable bool `json:"installable,omitempty"`
Version string `json:"version,omitempty"`
Source string `json:"source,omitempty"`
Reason string `json:"reason,omitempty"`
// Auth is its sign-in, for one that runs here.
Auth *AuthInfo `json:"auth,omitempty"`
}
ProviderInfo is a provider a session can switch to (ADR 0014, 0015): who runs the model loop, whether it can here, and, for an agent of ACP's registry not installed yet, what installing it fetches.
type SessionInfo ¶
type SessionInfo struct {
ID string `json:"id"` // the run's: s/<id>
Dir string `json:"dir"`
Title string `json:"title"` // its first message, on a line
Turns int `json:"turns"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"` // its last turn's last change
Closed bool `json:"closed,omitempty"`
From string `json:"from,omitempty"` // forked from (s/<id>)
// Waiting is what its turns under way wait for from a person
// (approvals, questions); Jobs, its commands in the background not
// ended (ADR 0028). What a client shows as going on.
Waiting int `json:"waiting,omitempty"`
Jobs int `json:"jobs,omitempty"`
}
SessionInfo is a session as a list of them shows it (kairocode sessions, /resume, ACP's session/list).
type SessionLog ¶
type SessionLog struct {
Session string `json:"session"`
Dir string `json:"dir"`
Engine string `json:"engine,omitempty"`
From *workflows.ForkRef `json:"from,omitempty"`
Usage msg.Usage `json:"usage"`
Turns []LogEntry `json:"turns"`
}
SessionLog is a session's record.
type SessionUsage ¶
type SessionUsage struct {
Session string `json:"session"`
Turns []TurnUsage `json:"turns"`
Total msg.Usage `json:"total"`
}
SessionUsage is what a session's model calls used, as they recorded it.
type Settings ¶
type Settings struct {
Provider string `json:"provider"`
Model string `json:"model"`
Effort string `json:"effort,omitempty"` // "": the provider's default
Mode string `json:"mode"` // manual, plan (ADR 0016)
}
Settings are a session's provider and model: those its next turn runs with. Model "" is the provider's default.
type SkillsInfo ¶
type SkillsInfo struct {
Skills []opencode.Skill `json:"skills"`
Problems []opencode.SkillProblem `json:"problems,omitempty"`
}
SkillsInfo are a session's skills, by name, and the SKILL.md files not taken, and why (/skills).