Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeName ¶
NormalizeName strips the suffix the server appends to tool names.
func Refused ¶ added in v1.7.0
Refused reports whether result is what Handle returned for a call that did not run: denied, interrupted at the prompt, or not approvable.
func RunShell ¶ added in v1.7.0
RunShell runs a command the user typed in the chat ("!cmd"), shown with show like the agent's commands but without asking and without a time limit. It returns the output and exit status, for the model, and whether the command succeeded (exit 0).
func ToolDefinitions ¶
ToolDefinitions returns the tool schemas to send in chat completion requests. timeout is the default a command gets, in seconds.
Types ¶
type Session ¶ added in v1.7.0
type Session struct {
AutoApprove bool // run every call unasked: --auto-approve, "Always approve", /approve
Timeout time.Duration // per command or read
UI UI // stderr when nil
// contains filtered or unexported fields
}
Session runs the model's tool calls for one chat session or ask run. Approval is the only gate: every command and write is shown and asked about, unless AutoApprove is set or the user chose "Always allow" for it earlier in the session. Reads ask only outside the working directory or for files that may hold secrets (readReason).
type UI ¶ added in v1.7.0
type UI interface {
// Open starts the block of a call; another Open before Close ends
// the first as it is (a command the user edited).
Open(title, note string)
Lines(lines []string) // preview lines, safe already
Output() io.Writer // a running command's output, until Close
Close(ok bool, status string)
Choose(items []ui.Item) (string, error) // ui.ErrCancelled on Esc or Ctrl+C
Edit(title, value string) (string, error)
}
UI shows tool calls and asks the user about them: on stderr by default (ask), in the transcript and panel of the chat's screen there.