appsession

package
v1.5.83 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 59 Imported by: 1 module, 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 appsession is the UI-neutral controller behind the Golder desktop app. It owns one conversation at a time: the session file, the live run configuration, the agent loop, the approval channel and the transcript the view renders.

Nothing in this package imports a GUI toolkit. The MyGo view under gui/mygoui consumes the Controller through Snapshot, Commands and Events, which keeps the orchestration testable without a window and lets the CLI/TUI keep their own front-ends unchanged.

Index

Constants

View Source
const (
	ActionNewSession = "gui:new-session"
	ActionCompact    = "gui:compact"
	ActionCopyLast   = "gui:copy-last"
)

GUI-only action IDs. They are not slash commands: they exist because a window can do something a terminal cannot.

View Source
const DefaultProxyURL = "http://127.0.0.1:7897"

DefaultProxyURL is only a suggested Clash Verge mixed-port address until saved. Downloads then use it automatically; browser/provider routing stays opt-in.

Variables

View Source
var ErrBusy = errors.New("a turn is already running")

ErrBusy is returned by commands that cannot run while an agent turn is in flight.

View Source
var ErrClosed = errors.New("controller is closed")

ErrClosed is returned once Close has been called.

View Source
var ErrNotPending = errors.New("approval is no longer pending")

ErrNotPending is returned when an approval id is unknown: it was answered already, withdrawn when the run ended, or never issued.

View Source
var ErrReadOnly = errors.New("session is open read-only in this process")

ErrReadOnly is returned when a second frontend views a session whose writer lease is held by another live process.

Functions

func ModelForProvider

func ModelForProvider(providerName string) string

ModelForProvider returns the model a switch to providerName would start with.

func ParseDiffStat

func ParseDiffStat(patch string) (files, added, deleted int)

ParseDiffStat reads the summary line git prints after a diff, if present.

func PermissionModes

func PermissionModes() []string

PermissionModes lists the selectable modes in display order.

func ReadTranscriptImage added in v1.5.63

func ReadTranscriptImage(project, path string, limit int64) ([]byte, error)

ReadTranscriptImage reads a bounded project file for an automatic transcript preview. It never follows a path outside project, including through a raced symlink. Callers must independently validate the image's format and size.

func RegisterBrowserOperator added in v1.5.62

func RegisterBrowserOperator(socket string, operator BrowserOperator) func()

RegisterBrowserOperator installs a trusted host for GUI-originated input. Its cleanup removes only this registration, never a replacement host.

func RegisterSharedBrowser added in v1.5.67

func RegisterSharedBrowser(view *browserhost.RemoteView) func()

RegisterSharedBrowser retains the operator capability only in trusted GUI memory. Neither the automation socket nor transcript carries this authority.

func ResolveLaunchProject added in v1.5.64

func ResolveLaunchProject(cwd string, explicit bool) (string, bool, error)

ResolveLaunchProject avoids treating a graphical launcher's filesystem-root working directory as an intentionally chosen project. An explicit -cwd, including a root directory, always wins.

func SaveDisplaySettings added in v1.5.57

func SaveDisplaySettings(settings DisplaySettings) error

func ThinkingLevels

func ThinkingLevels() []string

ThinkingLevels lists the selectable reasoning levels.

Types

type Action

type Action struct {
	ID           string
	Label        string
	Category     string
	Description  string
	ArgumentHint string
	Source       string
}

Action is one runnable command surfaced by the command palette: a slash command, a GUI action, or a skill.

type ActionResult

type ActionResult struct {
	// Message is text to show in the transcript.
	Message string
	// Prompt, when non-empty, is a turn to run after Message.
	Prompt string
}

ActionResult is what running an action produced.

type Answer

type Answer int

Answer is the view's decision for one approval.

const (
	// AnswerDeny blocks the call.
	AnswerDeny Answer = iota
	// AnswerOnce approves this call only.
	AnswerOnce
	// AnswerSession approves this shape of call for the rest of the session.
	AnswerSession
)

type ApprovalView

type ApprovalView struct {
	ID string
	// ToolCallID and RunID identify the originating call for presentation only.
	ToolCallID string
	RunID      string
	// Kind is "consent" or "trust".
	Kind string
	Tool string
	// Summary is the call's one-line preview.
	Summary string
	// Rationale is the reviewer's explanation, already in the user's language.
	Rationale string
	// Source names the deciding layer (jev, local, llm, static).
	Source string
	// Level is the gate's grade (allow, confirm, contain, deny).
	Level string
	// Mode is the approval mode in force.
	Mode string
	// Needs lists the capabilities the call requires.
	Needs []string
	// TrustDir names the folder a trust question is about.
	TrustDir string
	// Origin names a sub-agent that asked, when it is not this conversation.
	Origin string
}

ApprovalView is one pending human decision. The controller owns the reply channel; the view only renders Require and answers with an Answer.

type BrowserChromeOperator added in v1.5.67

type BrowserChromeOperator interface {
	BrowserOperator
	ChromeAction(context.Context, string, any, browserctl.Target, time.Duration) (json.RawMessage, browserctl.Meta, error)
}

BrowserChromeOperator is a private, authenticated chrome-operation seam for shared-host surfaces. It is never handed to the model-facing browser tool.

type BrowserFrame added in v1.5.71

type BrowserFrame struct {
	PNG    []byte
	Target browserctl.Target
	Title  string
	URL    string
	Tabs   []BrowserTab
}

BrowserFrame keeps the pixels, chrome and input target from one capture together. Input must be pinned to the displayed frame, not a newer refresh.

type BrowserInput added in v1.5.49

type BrowserInput struct {
	Kind      BrowserInputKind
	X, Y      float64
	DX, DY    float64
	Button    int
	Clicks    int
	Text, Key string
}

BrowserInput carries viewport CSS coordinates. Text is committed IME input; Key is a non-printing browser key such as Enter or ArrowLeft.

type BrowserInputKind added in v1.5.49

type BrowserInputKind uint8

BrowserInputKind is one person-originated event for a native browser surface.

const (
	BrowserPointerDown BrowserInputKind = iota + 1
	BrowserPointerUp
	BrowserPointerMove
	BrowserScroll
	BrowserText
	BrowserKey
)

type BrowserOperator added in v1.5.62

type BrowserOperator interface {
	SendOperatorInput(context.Context, BrowserOperatorInput) error
}

BrowserOperator is the in-process, person-originated input seam of a native browser host. It is not available through a model-facing browser socket.

type BrowserOperatorInput added in v1.5.62

type BrowserOperatorInput struct {
	BrowserID, TabID, TargetID string
	Kind                       string
	X, Y, DeltaY               float64
	Text, Key                  string
}

BrowserOperatorInput contains only an exact target and a bounded UI event.

type BrowserPreview

type BrowserPreview struct {
	Socket   string
	Browser  string
	TabID    string
	TargetID string
	URL      string
	Title    string
}

BrowserPreview is one live browser page the GUI can show.

func (BrowserPreview) Endpoint added in v1.5.71

func (p BrowserPreview) Endpoint() browserbinding.Endpoint

type BrowserSurface added in v1.5.49

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

BrowserSurface is a terminal-independent view of one controlled Chromium tab. Frames come from the target-scoped screenshot action; input is serialized onto the same typed action socket. kitty-browse remains the CDP owner.

func OpenBrowserSurface added in v1.5.49

func OpenBrowserSurface(ctx context.Context, preview BrowserPreview) (*BrowserSurface, error)

OpenBrowserSurface attaches to a browser already admitted by the owner-only socket and starts its serialized manual-input worker.

func (*BrowserSurface) ActivateTab added in v1.5.49

func (s *BrowserSurface) ActivateTab(ctx context.Context, id string) error

ActivateTab uses the host selection command, exactly as Agent and TUI do. Operator authentication remains separate from Agent automation permission.

func (*BrowserSurface) Back added in v1.5.49

func (s *BrowserSurface) Back(ctx context.Context) error

Back, Forward and Reload expose native browser chrome actions.

func (*BrowserSurface) Capture added in v1.5.71

func (s *BrowserSurface) Capture(ctx context.Context) (BrowserFrame, error)

Capture projects the host foreground and rechecks it at both ends of capture.

func (*BrowserSurface) Close added in v1.5.49

func (s *BrowserSurface) Close()

func (*BrowserSurface) CloseTab added in v1.5.49

func (s *BrowserSurface) CloseTab(ctx context.Context, id string) error

CloseTab closes one tab; kitty-browse chooses the next active tab.

func (*BrowserSurface) Forward added in v1.5.49

func (s *BrowserSurface) Forward(ctx context.Context) error

func (*BrowserSurface) Frame added in v1.5.49

func (s *BrowserSurface) Frame(ctx context.Context) ([]byte, error)

func (*BrowserSurface) Input added in v1.5.49

func (s *BrowserSurface) Input(event BrowserInput) bool

Input queues a person-originated event without blocking MyGo's main thread. It returns false and reports an error if a boundary event cannot be queued.

func (*BrowserSurface) InputTarget added in v1.5.71

func (s *BrowserSurface) InputTarget(target browserctl.Target, event BrowserInput) bool

InputTarget rejects input for pixels superseded by a host/manual selection.

func (*BrowserSurface) NativePointerAvailable added in v1.5.62

func (s *BrowserSurface) NativePointerAvailable() bool

NativePointerAvailable is a presentation fact, not permission to dispatch an Agent action through the in-process operator channel.

func (*BrowserSurface) Navigate added in v1.5.49

func (s *BrowserSurface) Navigate(ctx context.Context, rawURL string) error

Navigate loads a URL through kitty-browse's validated action path.

func (*BrowserSurface) NewTab added in v1.5.49

func (s *BrowserSurface) NewTab(ctx context.Context, rawURL string) error

NewTab opens and activates a new tab.

func (*BrowserSurface) Reload added in v1.5.49

func (s *BrowserSurface) Reload(ctx context.Context) error

func (*BrowserSurface) Resize added in v1.5.49

func (s *BrowserSurface) Resize(ctx context.Context, width, height int) error

Resize changes this surface's selected Chromium tab. Dimensions are CSS pixels.

func (*BrowserSurface) ResizeTarget added in v1.5.71

func (s *BrowserSurface) ResizeTarget(ctx context.Context, target browserctl.Target, width, height int) error

ResizeTarget keeps deferred resize work attached to the frame that requested it. A host selection change cannot resize a newly foregrounded tab by mistake.

func (*BrowserSurface) State added in v1.5.49

func (s *BrowserSurface) State() (title, rawURL string, err error)

State returns display metadata and the last input error, without exposing the control socket or any page content.

func (*BrowserSurface) Tabs added in v1.5.49

func (s *BrowserSurface) Tabs(ctx context.Context) ([]BrowserTab, error)

Tabs is a projection of the host foreground, not a second selection store. An older concurrent Info response must not overwrite a newer refresh.

type BrowserTab added in v1.5.49

type BrowserTab struct {
	ID     string
	Title  string
	URL    string
	Active bool
}

BrowserTab is safe native chrome metadata for one controlled tab.

type ChangeView added in v1.5.50

type ChangeView string

ChangeView selects which side of Git's index the review pane displays.

const (
	ChangesUnstaged ChangeView = "unstaged"
	ChangesStaged   ChangeView = "staged"
)

type Changes

type Changes struct {
	Files      []FileStatus
	View       ChangeView
	Project    string
	RepoRoot   string
	Branch     string
	TotalFiles int
	Added      int
	Deleted    int
	Truncated  bool
	NotGitRepo bool
}

Changes is the project's uncommitted work, for the changes drawer.

type Controller

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

Controller owns one conversation and the run in flight, if any.

func New

func New(opts Options) *Controller

New creates a controller. Open must be called before any other command.

func (*Controller) AddMCP added in v1.5.62

func (c *Controller) AddMCP(ctx context.Context, draft extensions.MCPDraft, enable bool) error

AddMCP registers an operator-reviewed source. Saving disabled never starts code or connects. The optional approval is specific to this exact source; business tool calls still go through their normal permission gates.

func (*Controller) AddProject added in v1.5.50

func (c *Controller) AddProject(path string) (ProjectFolder, error)

AddProject validates and canonically records one operator-selected directory. It does not start an Agent or create a Session.

func (*Controller) ArchiveSession added in v1.5.49

func (c *Controller) ArchiveSession(ctx context.Context, id string, archived bool) error

ArchiveSession hides or restores a non-current session.

func (*Controller) AttachComputer added in v1.5.57

func (c *Controller) AttachComputer(expectedSessionID string, s *computeruse.Session) error

AttachComputer installs a locally resolved target-bound session while idle. A model-provided identifier cannot call this frontend-owned entry point.

func (*Controller) AttachTTY added in v1.5.49

func (c *Controller) AttachTTY(id string) (io.ReadWriteCloser, error)

AttachTTY returns a detachable connection to one existing Agent bash PTY. Closing it never kills the process; the bash/write_stdin lifecycle remains authoritative.

func (*Controller) AuthorizeLark added in v1.5.49

func (c *Controller) AuthorizeLark(ctx context.Context, service string, show func(ExtensionSetupEvent)) error

AuthorizeLark runs the reviewed setup command and forwards only sanitized events. service is "lark" or the declared "project" variant.

func (*Controller) AuthorizeMCP added in v1.5.62

func (c *Controller) AuthorizeMCP(ctx context.Context, id string, open mcpauth.Open) error

AuthorizeMCP is available only while the GUI owns its private authorization guard, so no agent turn in this GUI can run alongside the login page.

func (*Controller) BrowserBinding added in v1.5.71

func (c *Controller) BrowserBinding() *browserbinding.Binding

BrowserBinding is the same object used by this controller's broker tools. A session change creates a new object, invalidating old GUI observations.

func (*Controller) BrowserContinuations added in v1.5.81

func (c *Controller) BrowserContinuations() []browsercontinuation.View

func (*Controller) BrowserSnapshot added in v1.5.71

func (c *Controller) BrowserSnapshot(ctx context.Context, binding *browserbinding.Binding) (browserbinding.Snapshot, []BrowserPreview)

BrowserSnapshot reconciles lifecycle only, not foreground selection. Tab selection belongs to the host, and an ambiguous inventory never switches it.

func (*Controller) Browsers

func (c *Controller) Browsers(ctx context.Context) []BrowserPreview

Browsers discovers Golder browser control sockets under the project. It is independent of tuios workspace discovery: a native GUI browser talks to the browser owner directly.

func (*Controller) Cancel

func (c *Controller) Cancel()

Cancel interrupts the run in flight. It is a no-op when nothing runs.

func (*Controller) ChangedFiles

func (c *Controller) ChangedFiles(ctx context.Context) ([]FileStatus, error)

ChangedFiles returns just the file list, for a cheap status refresh.

func (*Controller) Changes

func (c *Controller) Changes(ctx context.Context) (Changes, error)

Changes returns the project's unstaged status list. File patches are loaded separately through FileDiff so opening the drawer never builds every diff. A directory that is not a Git repository reports so instead of an error, because the drawer is always available.

func (*Controller) ChangesFor added in v1.5.50

func (c *Controller) ChangesFor(ctx context.Context, view ChangeView) (Changes, error)

ChangesFor returns either working-tree (unstaged) or index (staged) changes. Keeping those views separate mirrors Git and prevents a combined HEAD diff from making a file look accepted when it still has unstaged edits.

func (*Controller) CheckComputerLaunch added in v1.5.62

func (c *Controller) CheckComputerLaunch(expectedSessionID string) error

CheckComputerLaunch revalidates the owning conversation and live permission mode immediately before an asynchronous local application launch.

func (*Controller) CheckGUITerminalSession added in v1.5.62

func (c *Controller) CheckGUITerminalSession(sessionID, project string) (*permissions.State, error)

CheckGUITerminalSession pins a terminal tool to the controller incarnation, conversation and project that installed it. The returned permission state is live: a later /permissions change applies to the next call.

func (*Controller) Close

func (c *Controller) Close() error

Close ends the controller: a run in flight is cancelled and every pending approval is answered as unanswered, which the gates treat as fail-closed.

func (*Controller) Compact

func (c *Controller) Compact(ctx context.Context) (string, error)

Compact replaces the context with a fresh summary plus the recent tail.

func (*Controller) ComputerSession added in v1.5.62

func (c *Controller) ComputerSession() *computeruse.Session

ComputerSession returns this controller's current desktop session, if any.

func (*Controller) ConfigureLark added in v1.5.49

func (c *Controller) ConfigureLark(ctx context.Context, edit LarkExtensionEdit) error

ConfigureLark stores a new App Secret by name, writes a disabled source, then updates the live manager without granting trust or starting code.

func (*Controller) ContinueComputer added in v1.5.57

func (c *Controller) ContinueComputer(ctx context.Context, sessionID string, desktop *computeruse.Session) error

ContinueComputer resumes the original request only if the same conversation and target-bound desktop session are still current.

func (*Controller) DeleteSession added in v1.5.49

func (c *Controller) DeleteSession(ctx context.Context, id string) error

DeleteSession permanently removes a non-current session.

func (*Controller) DetachComputer added in v1.5.57

func (c *Controller) DetachComputer(expected *computeruse.Session)

DetachComputer revokes only the specified session; nil means the current one. This prevents a delayed UI callback from stopping a newer session.

func (*Controller) DetectLarkCLIs added in v1.5.57

func (c *Controller) DetectLarkCLIs(preferredLark, preferredProject string) (larkCLI, projectCLI string, larkFound, projectFound bool)

DetectLarkCLIs is DiscoverLarkCLIs with explicit match flags for UI feedback. A configured but invalid preferred path is preserved, but is not reported as detected.

func (*Controller) DisableLark added in v1.5.49

func (c *Controller) DisableLark() error

func (*Controller) DiscoverLarkCLIs added in v1.5.57

func (c *Controller) DiscoverLarkCLIs(preferredLark, preferredProject string) (larkCLI, projectCLI string)

DiscoverLarkCLIs performs bounded local discovery only. Script/npm wrappers are ignored; returned paths are resolved native executables.

func (*Controller) DisplayBrowserContinuation added in v1.5.81

func (c *Controller) DisplayBrowserContinuation(requestID string)

func (*Controller) Done added in v1.5.62

func (c *Controller) Done() <-chan struct{}

Done closes when this controller is closed, including a background session.

func (*Controller) EditQueued added in v1.5.68

func (c *Controller) EditQueued(id, text string) error

EditQueued replaces only the prompt text, retaining snapshotted attachments.

func (*Controller) EnableLark added in v1.5.49

func (c *Controller) EnableLark() error

EnableLark is the explicit review boundary. It fingerprints the helper and official CLI dependencies, remembers approval, persists enabled=true and only then admits the source to the current session.

func (*Controller) EnableReviewedMCP added in v1.5.62

func (c *Controller) EnableReviewedMCP(edit extensions.MCPEdit) error

func (*Controller) Events

func (c *Controller) Events() <-chan Event

Events returns the ordered event stream. The channel is never closed; Close ends delivery and unblocks the producer.

func (*Controller) Export

func (c *Controller) Export(format, path string) error

Export writes the session as JSONL or Markdown.

func (*Controller) ExportSession added in v1.5.49

func (c *Controller) ExportSession(id, format, path string) error

ExportSession writes any stored session as JSONL or Markdown.

func (*Controller) ExtensionSettings added in v1.5.49

func (c *Controller) ExtensionSettings() (LarkExtensionSettings, error)

ExtensionSettings returns package and live source state without starting an extension process.

func (*Controller) ExtensionSources added in v1.5.49

func (c *Controller) ExtensionSources() []ExtensionSourceView

ExtensionSources lists every configured source without executing it.

func (*Controller) FileDiff added in v1.5.50

func (c *Controller) FileDiff(ctx context.Context, view ChangeView, path string) (FileDiff, error)

FileDiff lazily loads one file only. It never builds a repository-wide patch, and the subprocess writer discards bytes beyond maxPatchBytes.

func (*Controller) InstallGUITerminalTool added in v1.5.62

func (c *Controller) InstallGUITerminalTool(sessionID, project string, tool agentcore.AgentTool) (*permissions.State, error)

InstallGUITerminalTool installs a session-bound frontend tool before a turn. It never enables tools in a --no-tools or read-only session and never replaces an unrelated extension under the same name.

func (*Controller) InstallLarkPackage added in v1.5.49

func (c *Controller) InstallLarkPackage(ctx context.Context, source, checksum, version string) error

InstallLarkPackage explicitly installs the signed GUI helper. It configures or executes nothing.

func (*Controller) InstallOfficialLarkCLI added in v1.5.57

func (c *Controller) InstallOfficialLarkCLI(ctx context.Context, project bool) (string, error)

InstallOfficialLarkCLI downloads one pinned official native distribution, verifies its release integrity and installs it without npm or Node.

func (*Controller) InstallOfficialLarkCLIWithProgress added in v1.5.74

func (c *Controller) InstallOfficialLarkCLIWithProgress(ctx context.Context, project bool, progress func(extensions.OfficialCLIInstallProgress)) (string, error)

InstallOfficialLarkCLIWithProgress reports transport and verification stages on the installing goroutine, without enabling or saving extension settings.

func (*Controller) InterruptTTY added in v1.5.49

func (c *Controller) InterruptTTY(id string) error

InterruptTTY sends the same first/second interrupt sequence write_stdin uses.

func (*Controller) IsRunning

func (c *Controller) IsRunning() bool

IsRunning reports whether a turn is in flight.

func (*Controller) ListActions

func (c *Controller) ListActions(ctx context.Context) []Action

ListActions returns every action the command palette can run: the session's slash commands plus the window-only actions.

func (*Controller) ListModels

func (c *Controller) ListModels(ctx context.Context) ([]ModelOption, error)

ListModels returns the models the live provider serves, newest families first. A failed catalog fetch falls back to the bundled floor for the provider, never to an empty picker.

func (*Controller) ListProjectFiles added in v1.5.57

func (c *Controller) ListProjectFiles(relative string) ([]ProjectFileEntry, error)

ListProjectFiles lists a directory without following symlinks or dotfiles.

func (*Controller) ListProjectFilesWithHidden added in v1.5.58

func (c *Controller) ListProjectFilesWithHidden(relative string, showHidden bool) ([]ProjectFileEntry, error)

ListProjectFilesWithHidden optionally includes dotfiles, still excluding large generated non-dot directories and never following symbolic links.

func (*Controller) ListProjects added in v1.5.50

func (c *Controller) ListProjects() ([]ProjectFolder, string, error)

ListProjects returns the explicit desktop project list, most recently opened first. It never derives rows from historical session Cwd values.

func (*Controller) ListSessions

func (c *Controller) ListSessions(ctx context.Context) ([]SessionSummary, error)

ListSessions returns the stored sessions, newest first, marking the current.

func (*Controller) LoadProviderSettings added in v1.5.49

func (c *Controller) LoadProviderSettings() (ProviderSettings, error)

LoadProviderSettings reads the shared config and derives a non-secret credential status for the launch default.

func (*Controller) LoadProviderSettingsFor added in v1.5.79

func (c *Controller) LoadProviderSettingsFor(name string) (ProviderSettings, error)

LoadProviderSettingsFor loads a specific provider's saved form. It does not switch the live session or carry credentials from the previously edited form.

func (*Controller) MCPTools added in v1.5.62

func (c *Controller) MCPTools(id string) []extensions.ToolView

MCPTools reads the existing safe catalog without connecting to the server.

func (*Controller) NewSession

func (c *Controller) NewSession(ctx context.Context) error

NewSession starts a fresh conversation in the same project.

func (*Controller) NewSessionInProject added in v1.5.50

func (c *Controller) NewSessionInProject(ctx context.Context, path string) error

NewSessionInProject starts a fresh conversation rooted at the explicitly selected desktop project, rebuilding every cwd-bound runtime component when the folder differs from the active Session.

func (*Controller) Open

func (c *Controller) Open(ctx context.Context) error

Open resolves the session (resume or fresh), assembles the live configuration and wires the slash commands and hooks. It is idempotent only in the sense that a second call reports an error instead of replacing a live session.

func (*Controller) PendingApprovals

func (c *Controller) PendingApprovals() []ApprovalView

PendingApprovals returns the approvals waiting for an answer.

func (*Controller) PollBrowserContinuations added in v1.5.81

func (c *Controller) PollBrowserContinuations(ctx context.Context) []browsercontinuation.View

PollBrowserContinuations is a trusted frontend subscription. Pane-origin resumes arrive here as checked host state, never as webpage text.

func (*Controller) PrepareMCPEdit added in v1.5.62

func (c *Controller) PrepareMCPEdit(id string) (extensions.MCPEdit, error)

PrepareMCPEdit obtains an operator-only snapshot for a subsequent edit or removal. Its configuration may contain legacy secrets and must not be logged.

func (*Controller) ProbeLarkAuthorization added in v1.5.78

func (c *Controller) ProbeLarkAuthorization(ctx context.Context) (extensions.LarkAuthorizationStatus, error)

ProbeLarkAuthorization checks the existing reviewed source without starting an authorization flow. It reserves the manager against concurrent mutations.

func (*Controller) Project

func (c *Controller) Project() string

Project returns the project directory.

func (*Controller) Providers

func (c *Controller) Providers() []string

Providers lists only configured conversation providers. The active provider remains visible even when its credentials are missing or it is custom.

func (*Controller) ReadProjectFile added in v1.5.57

func (c *Controller) ReadProjectFile(relative string) (ProjectFilePreview, error)

ReadProjectFile returns a bounded UTF-8 preview. Binary files are identified without rendering their bytes; symlinks and paths outside the project fail.

func (*Controller) RefreshBrowserContinuation added in v1.5.81

func (c *Controller) RefreshBrowserContinuation(ctx context.Context, sessionID, requestID string) error

func (*Controller) RemoveMCP added in v1.5.62

func (c *Controller) RemoveMCP(ctx context.Context, edit extensions.MCPEdit) error

func (*Controller) RemoveProject added in v1.5.50

func (c *Controller) RemoveProject(path string) error

RemoveProject removes one sidebar row only. Session files and project files are untouched.

func (*Controller) RemoveQueued added in v1.5.68

func (c *Controller) RemoveQueued(id string) error

RemoveQueued removes an input only while it remains in the pending FIFO.

func (*Controller) RenameSession added in v1.5.49

func (c *Controller) RenameSession(ctx context.Context, id, title string) error

RenameSession writes a display-name override. Renaming the active in-memory session works before its first message creates a file; the name is persisted with that first turn.

func (*Controller) ResetComputerRequest added in v1.5.57

func (c *Controller) ResetComputerRequest()

func (*Controller) ResetLark added in v1.5.49

func (c *Controller) ResetLark() error

func (*Controller) RespondApproval

func (c *Controller) RespondApproval(id string, a Answer) error

RespondApproval answers one pending approval.

func (*Controller) Resume

func (c *Controller) Resume(ctx context.Context, id string) error

Resume switches to a stored session after saving the current one.

func (*Controller) ResumeBrowser added in v1.5.81

func (c *Controller) ResumeBrowser(ctx context.Context, sessionID, requestID string, keep bool) error

ResumeBrowser is for a real local UI event. Remote submit and Agent tools do not call it. An expired or replaced request cannot select a new target.

func (*Controller) RunAction

func (c *Controller) RunAction(ctx context.Context, id, args string) (ActionResult, error)

RunAction runs one action by ID. A prompt-producing command is submitted as the next turn; an action command's status line is returned as Message.

func (*Controller) SaveProjectFile added in v1.5.58

func (c *Controller) SaveProjectFile(expectedProject, relative, expectedDigest, text string) (string, error)

SaveProjectFile is a direct operator action, not an agent tool call. It uses normal OS permissions and refuses to overwrite a file changed since preview. The opened root confines path resolution even if a directory is replaced.

func (*Controller) SaveProviderSettings added in v1.5.49

func (c *Controller) SaveProviderSettings(ctx context.Context, edit ProviderSettingsEdit, apply bool) (ProviderSettings, error)

SaveProviderSettings writes a named credential first, then atomically updates config.toml to reference it. A failed credential write therefore never leaves a config reference to a value that was not saved.

func (*Controller) SeedPromptHistory added in v1.5.67

func (c *Controller) SeedPromptHistory(path string)

SeedPromptHistory includes existing sessions when prompt history is first browsed, using the same bounded, one-time backfill as the TUI.

func (*Controller) SelectBrowser added in v1.5.71

func (c *Controller) SelectBrowser(ctx context.Context, binding *browserbinding.Binding, preview BrowserPreview) error

SelectBrowser revalidates the session and live identity before changing the shared binding. A stale GUI row is never authority to attach another session.

func (*Controller) SelectModel

func (c *Controller) SelectModel(ctx context.Context, providerName, model string, thinking agentcore.ThinkingLevel) error

SelectModel switches the live model (and provider, when the id belongs to another gateway).

func (*Controller) SelectProject added in v1.5.50

func (c *Controller) SelectProject(path string) error

SelectProject changes the sidebar/new-session target without mutating the currently open conversation.

func (*Controller) SelectProvider added in v1.5.62

func (c *Controller) SelectProvider(ctx context.Context, name string) error

SelectProvider switches this session to a configured provider and its saved default model. Overrides from the old gateway must never follow the switch.

func (*Controller) SessionID

func (c *Controller) SessionID() string

SessionID returns the active session id.

func (*Controller) SetAllStaged added in v1.5.50

func (c *Controller) SetAllStaged(ctx context.Context, staged bool) error

SetAllStaged stages or unstages every path in the active repository without modifying working-tree contents.

func (*Controller) SetExtensionEnabled added in v1.5.49

func (c *Controller) SetExtensionEnabled(kind, id string, enabled bool) error

SetExtensionEnabled is the generic explicit enable/disable action for an already-configured source. Enabling fingerprints and remembers approval.

func (*Controller) SetFileStaged added in v1.5.50

func (c *Controller) SetFileStaged(ctx context.Context, path string, staged bool) error

SetFileStaged stages or unstages one status path from the active repository.

func (*Controller) SetPermissionMode

func (c *Controller) SetPermissionMode(ctx context.Context, name string) error

SetPermissionMode switches the live approval mode.

func (*Controller) SetThinking

func (c *Controller) SetThinking(level agentcore.ThinkingLevel) error

SetThinking changes the reasoning level for the next turn.

func (*Controller) Snapshot

func (c *Controller) Snapshot() Snapshot

Snapshot returns the complete current state.

func (*Controller) StartQueued added in v1.5.67

func (c *Controller) StartQueued(ctx context.Context) error

StartQueued sends the oldest pending input when a frontend handoff has ended. Normal running turns drain the same FIFO automatically.

func (*Controller) StatusSnapshot added in v1.5.62

func (c *Controller) StatusSnapshot() Status

StatusSnapshot reads the current session status without copying transcript items.

func (*Controller) StopComputer added in v1.5.57

func (c *Controller) StopComputer()

StopComputer revokes desktop access immediately, even during a turn. The tool is removed from future provider requests once the run is idle.

func (*Controller) Submit

func (c *Controller) Submit(ctx context.Context, text string) error

Submit starts a new turn, or queues the prompt for the active turn's next steering boundary.

func (*Controller) SubmitAttachments added in v1.5.50

func (c *Controller) SubmitAttachments(ctx context.Context, text string, attachments []UserAttachment) error

SubmitAttachments sends or queues a prompt with operator-selected local files.

func (*Controller) SubmitRemote added in v1.5.78

func (c *Controller) SubmitRemote(ctx context.Context, sessionID, text string) error

SubmitRemote binds acceptance to the original controller session under the same lock that reserves the turn. It never queues behind a running turn.

func (*Controller) TTYSessions added in v1.5.49

func (c *Controller) TTYSessions() []TTYSummary

TTYSessions lists the interactive bash sessions backing the current tool set. Pipe-only commands are intentionally absent.

func (*Controller) TerminalEligible added in v1.5.62

func (c *Controller) TerminalEligible() bool

TerminalEligible reports whether a live GUI controller can receive a terminal capability. It does not itself grant access to any pane.

func (*Controller) TestExtension added in v1.5.49

func (c *Controller) TestExtension(ctx context.Context, kind, id string) error

func (*Controller) TestLark added in v1.5.49

func (c *Controller) TestLark(ctx context.Context) error

func (*Controller) TestProviderSettings added in v1.5.49

func (c *Controller) TestProviderSettings(ctx context.Context, edit ProviderSettingsEdit) error

TestProviderSettings resolves the same provider and credential a save would use, then asks its catalog endpoint for a model list. It is the only settings action that performs network I/O.

func (*Controller) UninstallLark added in v1.5.49

func (c *Controller) UninstallLark() error

UninstallLark removes source configuration and the managed helper, but keeps server-side consent and named App Secret. Reset and credential removal are separate explicit destructive operations.

func (*Controller) UpdateLarkPackage added in v1.5.55

func (c *Controller) UpdateLarkPackage(ctx context.Context, source, checksum, version string) error

UpdateLarkPackage installs the verified bundled helper and rebuilds the existing Source around that exact package. Existing non-secret settings, named credential references and source-scoped login HOME are preserved; the replacement Source is disabled and must be explicitly approved again.

func (*Controller) UpdateMCP added in v1.5.62

func (c *Controller) UpdateMCP(ctx context.Context, edit extensions.MCPEdit, draft extensions.MCPDraft, enable bool) error

func (*Controller) Version added in v1.5.49

func (c *Controller) Version() string

Version returns the desktop/core build version supplied by the command.

type CredentialView added in v1.5.49

type CredentialView struct {
	Available bool
	Source    string
	Name      string
	EnvVar    string
}

CredentialView is safe settings metadata. It never contains the credential.

type DisplaySettings added in v1.5.57

type DisplaySettings struct {
	Version   int     `json:"version"`
	Theme     string  `json:"theme"`
	FontScale float32 `json:"font_scale"`
}

func DefaultDisplaySettings added in v1.5.57

func DefaultDisplaySettings() DisplaySettings

func LoadDisplaySettings added in v1.5.57

func LoadDisplaySettings() (DisplaySettings, error)

type Event

type Event struct {
	Seq      uint64
	Session  string
	Kind     EventKind
	Item     *Item
	ID       string
	Approval *ApprovalView
	Status   *Status
	Error    string
}

Event is one ordered controller notification. Seq increases monotonically for the controller's lifetime, so a view can detect a missed event and re-read Snapshot.

type EventKind

type EventKind string

EventKind classifies a controller event.

const (
	// EventItemAddressed means Item was appended.
	EventItemAdded EventKind = "item_added"
	// EventItemUpdated means the item of Item.ID changed.
	EventItemUpdated EventKind = "item_updated"
	// EventApproval means a new approval is pending.
	EventApproval EventKind = "approval_requested"
	// EventApprovalDone means the approval of ID was answered or withdrawn.
	EventApprovalDone EventKind = "approval_resolved"
	// EventStatus means the live configuration or run state changed.
	EventStatus EventKind = "status"
	// EventRunEnd means the run ended; Error carries a failure.
	EventRunEnd EventKind = "run_end"
	// EventComputerRequest asks the local view to resolve an application request.
	EventComputerRequest EventKind = "computer_request"
)

type ExtensionPackageView added in v1.5.49

type ExtensionPackageView struct {
	ID               string
	Name             string
	Description      string
	Installed        bool
	Configured       bool
	Enabled          bool
	Trusted          bool
	Version          string
	BundledVersion   string
	InstalledVersion string
	ActiveVersion    string
	ActiveManaged    bool
	UpdateAvailable  bool
	State            string
	Authentication   string
	LastError        string
}

ExtensionPackageView is the compact package/source state the native Settings page renders. It contains no environment values, credentials or setup URLs.

type ExtensionSetupEvent added in v1.5.49

type ExtensionSetupEvent struct {
	Type            string
	Service         string
	Message         string
	VerificationURL string
	UserCode        string
	Authenticated   bool
	Phase           string
	Code            string
	Retryable       bool
}

ExtensionSetupEvent is the already-sanitized operator event the GUI may show.

type ExtensionSourceView added in v1.5.49

type ExtensionSourceView struct {
	Kind           string
	ID             string
	Type           string
	Enabled        bool
	Trusted        bool
	State          string
	Authentication string
	Version        string
	LastError      string
	Endpoint       string
	Network        bool
	StateDir       bool
	Executables    int
	Tools          int
}

ExtensionSourceView is one configured MCP/CLI/RPC source in the manager.

type FileDiff added in v1.5.50

type FileDiff struct {
	Path      string
	Patch     string
	Added     int
	Deleted   int
	Truncated bool
}

FileDiff is one lazily loaded, size-bounded file patch.

type FileStatus

type FileStatus struct {
	Path    string
	Status  string
	Added   int
	Deleted int
}

FileStatus is one changed file in the project.

type Item

type Item struct {
	ID   string
	Kind ItemKind
	Text string
	// Images retains user image blocks for both live and restored transcripts.
	Images []agentcore.ImageContent
	// Done is true once the item can no longer change. Streaming assistant text
	// and a running tool are open.
	Done bool
	// Tool holds the structured call for ItemTool.
	Tool *ToolState
	// Note holds the verdict for ItemNote.
	Note *NoteState
	// Failed marks a tool error, a denied call or a failed run.
	Failed bool
	// Time is when the item first appeared.
	Time time.Time
}

Item is one row of the transcript. The view renders it and never mutates it; a change arrives as an Event that replaces the item of the same ID.

type ItemKind

type ItemKind string

ItemKind classifies one transcript entry.

const (
	// ItemUser is a message the person sent.
	ItemUser ItemKind = "user"
	// ItemAssistant is model text: streaming while Done is false.
	ItemAssistant ItemKind = "assistant"
	// ItemThinking is reasoning text, shown collapsed by the view.
	ItemThinking ItemKind = "thinking"
	// ItemTool is one tool call and its (bounded) result.
	ItemTool ItemKind = "tool"
	// ItemNote is a permission-gate verdict (approval, denial, sandbox routing).
	ItemNote ItemKind = "note"
	// ItemNotice is a controller-level announcement (compaction, provider retry,
	// interrupt, persistence failure).
	ItemNotice ItemKind = "notice"
)

type LarkExtensionEdit added in v1.5.49

type LarkExtensionEdit struct {
	LarkCLI        string
	ProjectCLI     string
	AppID          string
	CredentialName string
	NewAppSecret   string
	Domains        []string
	ProjectHost    string
}

LarkExtensionEdit carries one configuration save. NewAppSecret is write-only and never returned by ExtensionSettings.

type LarkExtensionSettings added in v1.5.49

type LarkExtensionSettings struct {
	ExtensionPackageView
	LarkCLI             string
	ProjectCLI          string
	SavedLarkCLI        string
	SavedProjectCLI     string
	SavedProjectHost    string
	AppID               string
	CredentialName      string
	CredentialAvailable bool
	Domains             []string
	ProjectHost         string
}

LarkExtensionSettings is the non-secret editable Lark configuration.

type MobileAdapter added in v1.5.78

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

MobileAdapter projects one controller without consuming its event channel. Full snapshots are taken under the controller lock, so the GUI's existing SessionHub remains the sole consumer of Controller.Events.

func NewMobileAdapter added in v1.5.78

func NewMobileAdapter(c *Controller) (*MobileAdapter, error)

func (*MobileAdapter) Answer added in v1.5.78

func (a *MobileAdapter) Answer(ctx context.Context, id, choice string) error

func (*MobileAdapter) Disconnected added in v1.5.78

func (a *MobileAdapter) Disconnected()

func (*MobileAdapter) Done added in v1.5.78

func (a *MobileAdapter) Done() <-chan struct{}

func (*MobileAdapter) Snapshot added in v1.5.78

func (*MobileAdapter) Submit added in v1.5.78

func (a *MobileAdapter) Submit(ctx context.Context, text string) error

type ModelOption

type ModelOption struct {
	ID       string
	Provider string
	// Current marks the model in use.
	Current bool
	// Default marks the model a new session would start with.
	Default bool
}

ModelOption is one choice in the model picker.

type NoteState

type NoteState struct {
	Tool       string
	ToolCallID string
	RunID      string
	Origin     string
	Kind       int
	Level      string
	Summary    string
	Source     string
	Rationale  string
	Mode       string
	// Granted is true for approvals that let a call proceed.
	Granted bool
	// Failure is true for denials and blocks.
	Failure bool
}

NoteState is one permission-gate announcement.

type Options

type Options struct {
	Model        string
	ProviderName string
	Provider     provider.Provider
	BaseURL      string
	APIKey       string
	Protocol     string
	// Credentials is the shared resolver assembled by run.SetupEnv. APIKey is a
	// fallback for embedders that construct Options directly.
	Credentials *provider.CredentialStore
	Version     string

	ThinkingLevel agentcore.ThinkingLevel
	Tools         []agentcore.AgentTool
	SysPrompt     string
	Prompt        runtime.PromptInputs

	// ResumeID loads an existing session instead of creating one.
	ResumeID string
	// Approve grants the launch directory session trust up front.
	Approve bool

	Skills        []*runtime.Skill
	Extensions    *extensions.Manager
	ConfigPrompts []string
	CliPrompts    []string
	// NoPromptTemplates disables prompt-template discovery.
	NoPromptTemplates bool

	Permissions *permissions.State
	ReviewNotes *run.ReviewNotes
	Budget      *contextbudget.State
	MaxContext  config.MaxContext
	Memory      *memory.Store

	// ProjectFactory is required to create or resume a session in a folder other
	// than the launch directory. CLI/TUI embedders may leave it nil.
	ProjectFactory ProjectEnvironmentFactory
	// GUI omits commands specific to the separate tuios frontend.
	GUI bool

	// Cwd is the project directory. Empty means the process working directory.
	Cwd string
	// Store overrides the shared session store (tests).
	Store *session.Store
	// Warn receives non-fatal setup warnings; nil discards them.
	Warn io.Writer
}

Options is the assembled run environment the GUI controller starts from. The command builds it with run.SetupEnv, exactly as the CLI/TUI do, so the GUI shares provider resolution, tool construction, skills and the system prompt.

type ProjectEnvironmentFactory added in v1.5.50

type ProjectEnvironmentFactory func(ctx context.Context, cwd string, setup ProjectSetup) (run.Env, error)

ProjectEnvironmentFactory assembles the project-rooted tools, prompt, extensions and memory resources for one explicit desktop project folder.

type ProjectFileEntry added in v1.5.57

type ProjectFileEntry struct {
	Name    string
	Path    string
	Dir     bool
	Symlink bool
	Size    int64
}

type ProjectFilePreview added in v1.5.57

type ProjectFilePreview struct {
	Path      string
	Text      string
	Digest    string
	Binary    bool
	Truncated bool
}

type ProjectFolder added in v1.5.50

type ProjectFolder struct {
	Path       string    `json:"path"`
	Name       string    `json:"name"`
	AddedAt    time.Time `json:"added_at"`
	LastOpened time.Time `json:"last_opened"`
}

ProjectFolder is one folder the person explicitly added to the desktop sidebar. Sessions do not create project rows implicitly.

type ProjectSetup added in v1.5.50

type ProjectSetup struct {
	Model        string
	ProviderName string
	BaseURL      string
	Protocol     string
	APIKey       string
}

ProjectSetup is the live provider state a project environment factory needs. APIKey is launch-only secret material and must not be displayed or persisted.

type ProviderSettings added in v1.5.49

type ProviderSettings struct {
	Provider      string
	Model         string
	BaseURL       string
	Protocol      string
	Credential    CredentialView
	ThinkingLevel string
	Providers     []string
	Protocols     []string
}

ProviderSettings is the global provider defaults shown by Settings.

type ProviderSettingsEdit added in v1.5.49

type ProviderSettingsEdit struct {
	Provider         string
	Model            string
	BaseURL          string
	Protocol         string
	CredentialName   string
	NewCredential    string
	RemoveCredential bool
	ThinkingLevel    string
}

ProviderSettingsEdit is one settings save. NewCredential is write-only: it is consumed immediately and is never returned by a load or event.

func (ProviderSettingsEdit) AutomaticProtocolLabel added in v1.5.79

func (edit ProviderSettingsEdit) AutomaticProtocolLabel() string

AutomaticProtocolLabel previews the same wire selection as the TUI banner without constructing a provider or starting a network probe.

type ProxyProvider added in v1.5.63

type ProxyProvider struct {
	Name    string
	Enabled bool
}

type ProxySettings added in v1.5.63

type ProxySettings struct {
	URL          string
	EffectiveURL string
	EnvOverride  bool
	Browser      bool
	Providers    []ProxyProvider
	// contains filtered or unexported fields
}

ProxySettings is a local editor for the shared /proxy configuration. The original snapshot detects changes made before saving without exposing credentials.

func LoadProxySettings added in v1.5.63

func LoadProxySettings() (ProxySettings, error)

func SaveProxySettings added in v1.5.63

func SaveProxySettings(edit ProxySettings) (ProxySettings, error)

type QueuedMessage added in v1.5.68

type QueuedMessage struct {
	ID      string
	Text    string
	Display string
}

type SessionEvent added in v1.5.62

type SessionEvent struct {
	Controller *Controller
	Event      Event
}

SessionEvent identifies the controller that produced an event. A view must not apply an event to a different session after switching conversations.

type SessionHub added in v1.5.62

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

SessionHub owns independent controllers so turns, tools, approvals and persistence remain attached to their originating session while the view switches between conversations.

func NewSessionHub added in v1.5.62

func NewSessionHub(initial *Controller) *SessionHub

func (*SessionHub) ArchiveSession added in v1.5.62

func (h *SessionHub) ArchiveSession(ctx context.Context, id string, archived bool) error

func (*SessionHub) BeginPrivateAuthorization added in v1.5.62

func (h *SessionHub) BeginPrivateAuthorization() (func(), error)

BeginPrivateAuthorization prevents every controller owned by this GUI from starting an agent turn while the operator is interacting with a login page. It refuses to start while any existing turn is active. The returned release must be called after the browser has fully closed.

func (*SessionHub) ClearComputerRequest added in v1.5.62

func (h *SessionHub) ClearComputerRequest(controller *Controller)

func (*SessionHub) Close added in v1.5.62

func (h *SessionHub) Close() error

Close revokes all controllers, including background runs and pending grants.

func (*SessionHub) Current added in v1.5.62

func (h *SessionHub) Current() *Controller

func (*SessionHub) DeleteSession added in v1.5.62

func (h *SessionHub) DeleteSession(ctx context.Context, id string) error

func (*SessionHub) Done added in v1.5.62

func (h *SessionHub) Done() <-chan struct{}

func (*SessionHub) Events added in v1.5.62

func (h *SessionHub) Events() <-chan SessionEvent

func (*SessionHub) ExportSession added in v1.5.62

func (h *SessionHub) ExportSession(id, format, path string) error

func (*SessionHub) ListSessions added in v1.5.62

func (h *SessionHub) ListSessions(ctx context.Context) ([]SessionSummary, error)

ListSessions merges stored history with all live controllers, including unsaved new sessions and background approvals/completions.

func (*SessionHub) NewSession added in v1.5.62

func (h *SessionHub) NewSession(ctx context.Context, project string) (*Controller, error)

NewSession creates a fresh independent controller for the chosen project.

func (*SessionHub) ParkComputerRequest added in v1.5.62

func (h *SessionHub) ParkComputerRequest(controller *Controller, request string)

ParkComputerRequest keeps an in-progress local picker tied to its original conversation if the view switches before the person finishes selecting.

func (*SessionHub) RenameSession added in v1.5.62

func (h *SessionHub) RenameSession(ctx context.Context, id, title string) error

RenameSession routes owned sessions to their own controller so their writer lock and in-memory title stay authoritative.

func (*SessionHub) Resume added in v1.5.62

func (h *SessionHub) Resume(ctx context.Context, id string) (*Controller, error)

Resume selects an already-owned live controller or opens an independent peer for a saved session. It never cancels the previously selected controller.

func (*SessionHub) TakeComputerRequest added in v1.5.62

func (h *SessionHub) TakeComputerRequest(controller *Controller) string

TakeComputerRequest retrieves a background request only after its turn has ended. It remains tied to its originating controller and is never acted on while another conversation is visible.

type SessionSummary

type SessionSummary struct {
	ID            string
	Title         string
	Model         string
	Provider      string
	Cwd           string
	UpdatedAt     time.Time
	Current       bool
	Archived      bool
	Running       bool
	NeedsApproval bool
	Unread        bool
	Failed        bool
}

SessionSummary is one row of the session sidebar.

type SessionWriterView added in v1.5.57

type SessionWriterView struct {
	Frontend string
	PID      int
	Since    time.Time
}

type Snapshot

type Snapshot struct {
	Status
	Project string
	// Seq is the last event sequence represented by this snapshot.
	Seq uint64
	// Items is the transcript in display order.
	Items []Item
	// Pending are the approvals waiting for an answer, oldest first.
	Pending []ApprovalView
}

Snapshot is a complete view of the controller, taken at one instant. A view builds from it and then applies Events.

type Status

type Status struct {
	Model        string
	Provider     string
	Thinking     agentcore.ThinkingLevel
	Permission   string
	Running      bool
	RunID        string
	SessionID    string
	Title        string
	ContextUsed  int
	ContextLimit int
	ReadOnly     bool
	Writer       SessionWriterView
	// QueuedMessages are operator inputs waiting for the running turn to accept
	// them. They are session-local and leave this list when actually delivered.
	QueuedMessages []string
	// QueuedDetails carries stable identifiers and editable text for pending input.
	QueuedDetails []QueuedMessage
	// Error is the last controller error worth showing, "" when none.
	Error string
}

Status is the live state the composer footer shows.

type TTYSummary added in v1.5.49

type TTYSummary struct {
	ID       string
	Command  string
	Running  bool
	ExitCode int
}

TTYSummary is one interactive bash session available for terminal takeover.

type ToolState

type ToolState struct {
	ID     string
	Name   string
	Input  map[string]any
	Output string
	// Details is structured tool metadata (for example bash_id). It is not
	// rendered wholesale; views pick known non-secret fields.
	Details map[string]any
	// Running is true until the executor reports the end.
	Running bool
	// AwaitingStart distinguishes an announced call from one already executing.
	AwaitingStart bool
	// Error is the executor's failure flag, not a parse result.
	Error bool
}

ToolState is one tool invocation, as the view shows it.

type UserAttachment added in v1.5.50

type UserAttachment struct {
	Path     string
	Name     string
	ImagePNG []byte
}

UserAttachment is either a selected local file or an in-memory clipboard PNG. Images become multimodal blocks; small text files are inlined.

func NewClipboardImage added in v1.5.68

func NewClipboardImage(name string, data []byte) (UserAttachment, error)

NewClipboardImage validates and snapshots clipboard PNG data without writing private image contents to disk. The same 20 MiB limit applies to file images.

Jump to

Keyboard shortcuts

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