engine

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 93 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 engine is Blitz without a user interface: it opens a workspace (registries, tools, sessions, the model and the engine) and exposes what a front end needs as an api.Backend. The service and the CLI's --local mode run it; none of it prints (spec_018_workspace).

Index

Constants

View Source
const (
	RunRunning = "running"
	RunWaiting = "waiting" // paused on a human task or a timer
	RunDone    = "done"
	RunFailed  = "failed"
	RunStopped = "stopped"
)

A run's status, beside the steps' (api.StepRunning, …).

View Source
const (
	LanguageReady     = lsp.StateReady
	LanguageStarting  = lsp.StateStarting
	LanguageMissing   = lsp.StateMissing
	LanguageFailed    = lsp.StateFailed
	LanguageIdle      = lsp.StateIdle
	LanguageNone      = lsp.StateNone
	LanguageUntrusted = lsp.StateUntrusted
)

The states of a language server.

View Source
const DefaultPicturesFolder = "pictures"

DefaultPicturesFolder is where pictures are saved without images folder.

View Source
const DefaultStyle = "default"

DefaultStyle adds nothing.

View Source
const MaxStoredRead = 32 << 20

MaxStoredRead is the largest stored file ReadStoredFile reads (a page shows it, or saves it, whole).

View Source
const MaxUpload = 4 << 30

MaxUpload bounds a file uploaded with UploadFile.

View Source
const MaxUserShellOutput = 1 << 20

MaxUserShellOutput bounds what RunUserShell passes on of a command's output; the rest is dropped, and said to be.

View Source
const SQLSkill = "sql-query"

SQLSkill is the skill that writes the queries: the built-in one, or the workspace's own of that name.

Variables

View Source
var (
	// ErrNoBranch is a branch that doesn't exist, locally or on a remote.
	ErrNoBranch = errors.New("there's no such branch")
	// ErrBranchExists is creating a branch whose name is taken.
	ErrBranchExists = errors.New("a branch with that name already exists")
	// ErrBadBranchName is a name git doesn't accept for a branch.
	ErrBadBranchName = errors.New("that isn't a valid branch name")
	// ErrLocalChanges is a switch that would overwrite uncommitted changes.
	ErrLocalChanges = errors.New("uncommitted changes would be overwritten: commit or stash them first")
	// ErrMergeSelf is merging the current branch into itself.
	ErrMergeSelf = errors.New("that's the current branch")
)
View Source
var (
	// ErrNoRemote is a push from a repository with no remote.
	ErrNoRemote = errors.New("the repository has no remote")
	// ErrNoUpstream is a pull on a branch that doesn't track a remote one.
	ErrNoUpstream = errors.New("the branch doesn't track a remote branch")
	// ErrPushRejected is a push the remote refused because it has commits
	// the branch doesn't: pull first.
	ErrPushRejected = errors.New("the remote has commits this branch doesn't have: pull them first")
	// ErrRemoteAuth is a fetch, pull or push the remote refused for want of
	// credentials.
	ErrRemoteAuth = errors.New("the remote wants credentials Blitz doesn't have: sign in with git in a terminal (or set up a credential helper or an SSH key), then try again")
	// ErrInProgress is a pull or push while a merge or rebase waits.
	ErrInProgress = errors.New("a merge or rebase is in progress: complete or abort it first")
	// ErrNoOperation is completing or aborting with no merge or rebase in
	// progress.
	ErrNoOperation = errors.New("no merge or rebase is in progress")
	// ErrConflictsRemain is completing a merge or rebase with files still in
	// conflict.
	ErrConflictsRemain = errors.New("some files are still in conflict")
	// ErrMarkersRemain is marking a file resolved that still has conflict
	// markers.
	ErrMarkersRemain = errors.New("the file still has conflict markers")
	// ErrNotConflicted is resolving a file that isn't in conflict.
	ErrNotConflicted = errors.New("the file isn't in conflict")
)
View Source
var (
	// ErrUnknownDocument means no open document has the ID.
	ErrUnknownDocument = lsp.ErrUnknownDocument
	// ErrStaleDocument means a request was about another version of the
	// document than the server has.
	ErrStaleDocument = lsp.ErrStale
	// ErrNoLanguageServer means no server is configured for a language.
	ErrNoLanguageServer = lsp.ErrNoServer
)

Errors of the editor's language requests.

View Source
var (
	ErrNoPictureSession = errors.New("no such picture session")
	ErrNoPicture        = errors.New("no such picture")
	ErrPictureRequest   = errors.New("the model doesn't take that")
)

Pictures' errors (spec_058_pictures).

View Source
var ErrBadPath = errors.New("not a path in the workspace")

ErrBadPath means the path is outside the workspace, or in .git.

View Source
var ErrBadRevision = errors.New("not a revision in the history")

ErrBadRevision is a revision that isn't a commit hash of the history's.

View Source
var ErrBadTableFilter = table.ErrBadFilter

ErrBadTableFilter is returned for a column filter that can't be read.

View Source
var ErrEmptyMessage = errors.New("a commit needs a message")

ErrEmptyMessage is Commit's error without a message.

View Source
var ErrGlobalConnector = errors.New("a global connection is changed in Settings, not in a workspace")

ErrGlobalConnector is a change to a global connection asked of a workspace: Settings changes those (CON-18).

View Source
var ErrHealthCheckRunning = errors.New("a health check of this workspace is running")

ErrHealthCheckRunning means a check of the workspace is going already.

View Source
var ErrNoBrowserWindow = errors.New("no desktop window to browse in")

ErrNoBrowserWindow means no desktop window is watching the workspace.

View Source
var ErrNoCapability = errors.New("its kind can't")

ErrNoCapability is a connection whose kind can't do what's asked (a custom file, or a kind without the capability).

View Source
var ErrNoGit = errors.New("git isn't installed: it isn't on the Blitz service's PATH")

ErrNoGit is GitInit's error without git on PATH.

View Source
var ErrNoInstructions = errors.New("write what the worker should do first")

ErrNoInstructions is a rewrite of a worker with no instructions yet.

View Source
var ErrNoPreview = errors.New("no preview")

ErrNoPreview means the file has no preview: ReadPreview shows only images, PDFs, sound and video, up to 32 MB, and Word documents as Markdown.

View Source
var ErrNoPrompt = errors.New("a prompt is needed to try the skill")

ErrNoPrompt is a try without a prompt.

View Source
var ErrNoQueryBuilder = fmt.Errorf("%w draft queries", ErrNoCapability)

ErrNoQueryBuilder is a connection whose kind can't draft queries.

View Source
var ErrNoRecipe = errors.New("the composer can't make that kind of component")

ErrNoRecipe means the composer can't make that kind (yet).

View Source
var ErrNoRun = errors.New("no such workflow run")

ErrNoRun is a run with no receipt.

View Source
var ErrNoTask = errors.New("no such task: it may have been answered already")

ErrNoTask means there's no such paused run or task.

View Source
var ErrNoUpload = errors.New("no such upload")

ErrNoUpload means an upload id isn't one in progress: never started, finished, failed, or dropped after uploadIdle without a chunk.

View Source
var ErrNotARepository = errors.New("the workspace isn't in a git repository")

ErrNotARepository is a git action outside a git repository.

View Source
var ErrNotASpec = errors.New("not a spec: a Markdown file in " + specdoc.Dir)

ErrNotASpec means a path that isn't a Markdown file in the specs folder.

View Source
var ErrNotAnswerable = errors.New("a timer isn't answered: its run goes on at its time")

ErrNotAnswerable is a task that isn't answered: a timer.

View Source
var ErrNotInTrash = errors.New("it's no longer in the workspace's trash")

ErrNotInTrash means a restore names nothing the trash holds (it was emptied, or never there).

View Source
var ErrNotTable = errors.New("not a table (CSV or TSV)")

ErrNotTable is returned for a file the table viewer doesn't read.

View Source
var ErrNothingStaged = errors.New("nothing is staged to commit")

ErrNothingStaged is Commit's error when the index matches HEAD.

View Source
var ErrSpecNotReady = errors.New("the spec isn't ready to approve")

ErrSpecNotReady means a spec approved without force has errors or open questions.

View Source
var ErrUntrusted = errors.New("the project's settings aren't trusted: language servers run its code, so they start once you trust it")

ErrUntrusted means the workspace's project settings aren't trusted, so no language server starts for the editor (VE-43).

View Source
var ErrUntrustedConnector = errors.New("save and trust it first")

ErrUntrustedConnector is a workspace connection the person hasn't trusted, which can't be made global until they save it (CON-19).

View Source
var ErrUploadTooLarge = fmt.Errorf("file over %d GiB", MaxUpload>>30)

ErrUploadTooLarge means an upload went over MaxUpload.

View Source
var MaxSchemaText = 48 << 10

MaxSchemaText bounds the schema the model is given, in bytes.

View Source
var SchemaTTL = 5 * time.Minute

SchemaTTL is how long a schema read for the query builder is reused: several drafts in a row read it once (BigQuery's is up to about 60 calls).

Functions

func AddedNote added in v0.7.0

func AddedNote(blocks []api.ContextBlock) string

AddedNote is what the transcript records of the content added to a prompt, after its text (as AttachmentNote is for images): each block's title, or its URL.

func AttachmentNote

func AttachmentNote(imgs []*images.Image) string

AttachmentNote is what the transcript records for images sent with a prompt: their names.

func DataTable added in v0.9.7

func DataTable(t datatable.Table) (api.DataTable, error)

DataTable is t as the API carries it, its values and Markdown masked as the service masks them (DAT-25).

func DisplayPrompt

func DisplayPrompt(text string) string

DisplayPrompt is a prompt as the user wrote it: without the note about their edits (withUserEdits), which is for the agent.

func DueTimers added in v0.7.1

func DueTimers(dir string, now time.Time) map[string]FlowRecord

DueTimers are the paused runs in dir with a timer due by now: each with that timer's task ID.

func ExportSession

func ExportSession(cfg *config.Config, id string) (string, error)

ExportSession is a stored session as Markdown (spec_027_parity PAR-SES-11): its prompts, answers and tool calls (arguments and results in brief) with their times, from the event log (else the transcript), with configured secrets masked. It reads the files only, so the session's workspace needn't be open.

func FileVersion

func FileVersion(data []byte) string

FileVersion is the version of content: its SHA-256.

func FindBrowser added in v0.8.4

func FindBrowser(path string) (string, error)

FindBrowser is the system's Chrome, Chromium, Edge or Brave (path when set), for opening a browser profile to sign in by hand (BP-05).

func FlowReceiptsDir added in v0.7.1

func FlowReceiptsDir(storageDir string) string

FlowReceiptsDir is where runs' receipts are kept, under the session storage.

func FlowRecordsDir added in v0.7.1

func FlowRecordsDir(storageDir string) string

FlowRecordsDir is where paused runs are recorded, under the session storage (shared by every workspace, so the service and the tray list every task).

func ForgetProjectTrust

func ForgetProjectTrust(cfg *config.Config) error

ForgetProjectTrust removes the decision for cfg's workspace, so it's asked again.

func GuardrailDirs added in v0.9.1

func GuardrailDirs(cfg *config.Config, dir string) []string

GuardrailDirs are the folders a workspace at dir reads its guardrails from, with cfg's organization (Workspace.Guardrails; blitz doctor checks the same files).

func ModelErrorSummary

func ModelErrorSummary(err error, cfg *config.Config) string

ModelErrorSummary makes a model error safe and readable: some SDK errors embed their whole client config, including the API key, and most need only their first line. A quota error is kept whole, on one line: Google's message names the quota to raise.

func PreviewSchedule added in v0.8.4

func PreviewSchedule(text, tz string, n int, now time.Time) (api.SchedulePreview, error)

PreviewSchedule is how text is understood as a schedule in the time zone tz ("" for the service machine's): its cron form and its next n runs after now (at most 20), for the schedule picker (spec_023_workers WK-72) and create_job. A schedule it can't read is the parser's error.

func PreviewType

func PreviewType(p string) string

PreviewType is the media type the preview shows p as ("" when it has none).

func ReviewProject

func ReviewProject(cfg *config.Config) (api.ProjectSettings, error)

ReviewProject is what the project files of cfg's workspace (cfg.Tools.WorkspaceDir, loaded with config.LoadWorkspace) say, and the trust decision for them, without opening the workspace: the CLI asks before it opens one.

func SecretRedactor

func SecretRedactor(cfg *config.Config) *redact.Redactor

SecretRedactor masks configured credentials, the values of scrubbed environment variables and MCP servers' values in audit entries, logs and telemetry (observability.SecretRedactor).

func SetupLocale

func SetupLocale(cfg *config.Config, warn func(string)) *i18n.Bundle

SetupLocale loads translation catalogs (built in, then ui.locales_dir) and activates ui.locale for the process.

func SetupNetwork

func SetupNetwork(cfg *config.Config) error

SetupNetwork trusts [network] ca_file's certificate authorities besides the system's, in every client built from Go's default transport (the model SDKs, MCP, web search) and in web_fetch (spec_027_parity PAR-MOD-05). Proxies come from the environment already.

func StartObservability

func StartObservability(ctx context.Context, cfg *config.Config, version string, warn func(string)) func()

StartObservability opens the diagnostic log and, when enabled, OpenTelemetry export (observability.StartProcess).

func StopFlowRun added in v0.7.1

func StopFlowRun(run string) bool

StopFlowRun stops a run this process is running.

func StylesDir

func StylesDir() string

StylesDir is where the user's styles are.

func TrustCredentialHelper added in v0.9.0

func TrustCredentialHelper(helper string)

TrustCredentialHelper lets a repository's own config name helper, a credential helper exactly as given (Blitz's own git-credential), for any host: the helper answers only for the organization's service.

func TrustProject

func TrustProject(cfg *config.Config, hash string, trusted bool) error

TrustProject records the decision for cfg's workspace's project settings, whose hash the person was shown (api.ErrProjectChanged if they have changed since).

Types

type AnswerError added in v0.7.1

type AnswerError struct{ Problems []a2ui.Problem }

AnswerError is an answer a human task's form doesn't accept (WF-18): its problems, each a component's failing check or what's wrong with the action.

func (*AnswerError) Error added in v0.7.1

func (e *AnswerError) Error() string

Error lists the problems.

type Branch added in v0.6.5

type Branch struct {
	// Name is the branch's short name: "main", or "origin/feature" for a
	// remote one.
	Name string
	// Remote is a remote's branch that no local branch tracks: switching to
	// it makes a local one that does.
	Remote bool
	// Current is the branch checked out.
	Current bool
	// Upstream is a local branch's remote one, such as "origin/main".
	Upstream string
	// Subject and Time are its last commit's.
	Subject string
	Time    time.Time
}

Branch is a branch the workspace can switch to or merge.

type CodeBlock added in v0.5.0

type CodeBlock struct {
	Extension string
	ID        string
}

CodeBlock is a code block opened as a document (spec_037_visual_editor §7): its language as a file extension, and the client's ID for it.

type CommitDraft added in v0.3.1

type CommitDraft struct {
	Files   []CommitFile
	Message string
	Problem string
}

CommitDraft is what the commit dialog shows: the staged files and a message the model drafted from their diff ("" with Problem saying why when it couldn't).

type CommitFile added in v0.3.1

type CommitFile struct {
	Status string
	Path   string
}

CommitFile is one staged file: its git status letter (A, M, D, R, …) and workspace-relative path.

type CompletionList added in v0.5.0

type CompletionList = lsp.CompletionList

CompletionList is what Complete returns.

type ConflictChoice added in v0.6.4

type ConflictChoice string

ConflictChoice is how ResolveConflict settles a file.

const (
	// KeepMine keeps the branch's version (the one from before the pull).
	KeepMine ConflictChoice = "mine"
	// TakeTheirs takes the remote's version.
	TakeTheirs ConflictChoice = "theirs"
	// MarkResolved stages the file as edited by hand.
	MarkResolved ConflictChoice = "resolved"
)

type ConnectorSet added in v0.8.0

type ConnectorSet interface {
	// Dirs is where its connections are (secrets are kept by them).
	Dirs() connectors.Dirs
	Catalog() connectors.Catalog
	List() []connectors.Connection
	Save(ctx context.Context, c connectors.Connection, values map[string]string, previous string) (connectors.Connection, []string, error)
	Delete(ctx context.Context, r connectors.Ref) error
	Test(ctx context.Context, c connectors.Connection, values map[string]string) ([]connectors.ToolInfo, error)
	Try(ctx context.Context, c connectors.Connection, values map[string]string, tool string, args map[string]any) (string, bool, error)
	ReadSchema(ctx context.Context, c connectors.Connection, values map[string]string) ([]connectors.Table, error)
	DraftQuery(ctx context.Context, c connectors.Connection, values map[string]string, request string) (QueryDraft, error)
}

ConnectorSet is a set of connections the API serves alike: a workspace's in Studio (Workspace.ConnectorSet; the global ones listed, not changed), or the global ones in Settings (GlobalConnectors).

type Diagram added in v0.6.0

type Diagram struct {
	PNG   []byte
	Width int
}

Diagram is a ```mermaid block drawn as a PNG by the caller, at Width pixels.

type DiffAgainst added in v0.6.0

type DiffAgainst int

DiffAgainst is what a revision is compared with.

const (
	// AgainstNow compares the revision with the working copy.
	AgainstNow DiffAgainst = iota
	// AgainstParent shows what the revision changed.
	AgainstParent
	// AgainstOther compares the revision with another one.
	AgainstOther
)

type DirListing

type DirListing struct {
	Entries   []FileEntry
	Truncated bool
	// Repo means the workspace is in a git repository.
	Repo bool
}

DirListing is a folder's entries.

type DocumentDiagnostics added in v0.5.0

type DocumentDiagnostics = lsp.DocumentDiagnostics

DocumentDiagnostics are a document's diagnostics for a version.

type DocumentInfo added in v0.5.0

type DocumentInfo = lsp.DocumentInfo

DocumentInfo is what opening an editor document says.

type DraftRequest added in v0.7.1

type DraftRequest struct {
	Kind        string
	Name        string
	Description string
	Current     string
	Request     string
	Language    string
}

DraftRequest is what a draft is asked for: the kind and field, the item's name and description, its text now, what the user asks ("" to improve it), and for a script its language.

type EvalDraft added in v0.7.1

type EvalDraft struct {
	Cases   []evals.Case
	Problem string
}

EvalDraft is the cases drafted, or why there are none.

type FileChangedError

type FileChangedError struct {
	Path string
	// Current is the file's version now ("" when it doesn't exist).
	Current string
}

FileChangedError reports that a write's version doesn't match the file's (it was changed since it was read, or it exists when it was expected not to).

func (*FileChangedError) Error

func (e *FileChangedError) Error() string

Error says the file changed, or was deleted, since it was opened.

type FileContent

type FileContent struct {
	Path      string
	Text      string
	Version   string
	Size      int64
	Binary    bool
	TooLarge  bool
	AgentRule string
}

FileContent is a file as the editor opens it.

type FileEntry

type FileEntry struct {
	Name     string
	Path     string
	Kind     FileKind
	Size     int64
	Modified time.Time
	// Git is the entry's git status ("modified", "added", "renamed",
	// "untracked", "conflicted"; "changed" for a folder with changes
	// under it), "" when clean or outside a repository.
	Git string
	// Staged says how much of a file's change is in git's index: "all"
	// (staged), "some" (staged, then changed again), or "" (none, or a
	// folder).
	Staged string
	// Hidden says why the entry is hidden by default: "blocked" (the
	// agent's blocked paths), "ignored" (git), "dot", "agent" (an agent
	// instruction file such as AGENTS.md, memory.files), or "".
	Hidden string
	// Ignored says git ignores it, whatever Hidden says (a dotfile git
	// ignores is hidden as "dot").
	Ignored bool
	// AgentRule is the agent's rule for the path: "blocked", "read_only"
	// or "".
	AgentRule string
}

FileEntry is one entry of a folder.

type FileKind

type FileKind string

FileKind is what a directory entry is.

const (
	KindFile    FileKind = "file"
	KindFolder  FileKind = "folder"
	KindSymlink FileKind = "symlink"
)

The kinds of entry ListDir reports; a symlink to a folder in the workspace is reported as a folder.

type FlowReceipt added in v0.7.1

type FlowReceipt struct {
	Run       string `json:"run"`
	Workspace string `json:"workspace"`
	Workflow  string `json:"workflow"`
	// Origin is chat, background or worker; Session the chat its agent
	// steps are turns in.
	Origin  string `json:"origin"`
	Session string `json:"session"`
	Input   string `json:"input"`
	// Mode is the permission mode its steps ran in (WF-21).
	Mode    string    `json:"mode,omitempty"`
	Started time.Time `json:"started"`
	Ended   time.Time `json:"ended,omitzero"`
	Status  string    `json:"status"`
	Error   string    `json:"error,omitempty"`
	// Output is what the run produced (the start of it).
	Output string `json:"output,omitempty"`
	// Usage is the steps' together; Models every model they used.
	Usage  api.Usage      `json:"usage"`
	Models []string       `json:"models,omitempty"`
	Steps  []StepReceipt  `json:"steps"`
	Events []ReceiptEvent `json:"events,omitempty"`
}

FlowReceipt is a workflow run's receipt.

func FlowReceiptOf added in v0.7.1

func FlowReceiptOf(storageDir, run string) (FlowReceipt, int, error)

FlowReceiptOf is run's receipt as it is now, and a version that changes with it while it runs (0 for one that isn't running here).

func FlowReceipts added in v0.7.1

func FlowReceipts(storageDir, workspace, workflow string) []FlowReceipt

FlowReceipts are the receipts kept in storageDir, newest first: one workspace's ("" every one's), one workflow's ("" every one's). A running run's is as it is now; one that says running that this process isn't running and that hasn't been written for a while was lost (the service stopped while it ran), and says so.

func RecentFlowReceipts added in v0.7.1

func RecentFlowReceipts(storageDir, workspace string, since time.Time) []FlowReceipt

RecentFlowReceipts are the receipts in storageDir of runs going (or waiting) and of those written since, newest first: one workspace's ("" every one's). It reads only those files.

func (FlowReceipt) Running added in v0.7.1

func (r FlowReceipt) Running() bool

Running says whether the receipt is of a run that hasn't ended.

func (FlowReceipt) Summary added in v0.7.1

func (r FlowReceipt) Summary() FlowReceipt

Summary is the receipt without its events and the steps' text.

type FlowRecord added in v0.7.1

type FlowRecord struct {
	Run       string `json:"run"`
	Workspace string `json:"workspace"`
	Workflow  string `json:"workflow"`
	Hash      string `json:"hash"`
	// Session is the chat its agent steps are turns in; Origin is chat,
	// background or worker.
	Session string     `json:"session"`
	Origin  string     `json:"origin"`
	Input   string     `json:"input"`
	Started time.Time  `json:"started"`
	Tasks   []FlowTask `json:"tasks"`
	// Done are the steps that finished before it paused, replayed as it
	// resumes.
	Done map[string]Replayed `json:"done,omitempty"`
}

FlowRecord is a paused run.

func ListFlowRecords added in v0.7.1

func ListFlowRecords(dir, workspace string) []FlowRecord

ListFlowRecords are the paused runs recorded in dir (FlowRecordsDir), oldest first; workspace "" is every workspace's.

type FlowTask added in v0.7.1

type FlowTask struct {
	// ID is the task's (the run's ID and the step's).
	ID    string `json:"id"`
	Step  string `json:"step"`
	Title string `json:"title"`
	// Kind is human_task or timer.
	Kind string `json:"kind"`
	// Message (a human task's instructions) and Form are what's shown.
	Message string      `json:"message,omitempty"`
	Form    *flows.Form `json:"form,omitempty"`
	// FireAt is when a timer resumes the run.
	FireAt  time.Time `json:"fire_at,omitzero"`
	Created time.Time `json:"created"`
}

FlowTask is what a paused run waits on.

type FolderChanges added in v0.9.7

type FolderChanges struct {
	Folders []string
	Polling bool
}

FolderChanges is what WatchFolders reports (spec_029_files FIL-33b): the folders whose entries changed (an entry added, removed, renamed or written), to list again; or, with Polling, that some folders can't be watched (the system's limit), so the caller lists them on a timer.

type GitAction

type GitAction string

GitAction is what GitFileAction does to a file or folder.

const (
	// GitStage adds it to the index (a folder: everything changed under it).
	GitStage GitAction = "stage"
	// GitUnstage takes it out of the index, keeping the working copy.
	GitUnstage GitAction = "unstage"
	// GitDiscard puts it back as it was in the last commit.
	GitDiscard GitAction = "discard"
	// GitIgnore adds a line for it to the workspace's .gitignore.
	GitIgnore GitAction = "ignore"
	// GitUnignore takes the line GitIgnore added out of .gitignore.
	GitUnignore GitAction = "unignore"
)

type GlobalConnectors added in v0.8.0

type GlobalConnectors struct {
	// Config is the global settings (config.Load).
	Config *config.Config
	// NewModel makes the query builder's model (nil: runtime.NewModel).
	NewModel func(ctx context.Context, cfg *config.Config, name string) (model.LLM, error)
}

GlobalConnectors are the person's own connections, every workspace's (spec_047_connectors CON-18): Settings › Connectors changes them, never a workspace's Studio. They're read with no workspace: the built-in and global descriptors only, the global secrets, and the built-in sql-query skill.

func (GlobalConnectors) Catalog added in v0.8.0

func (g GlobalConnectors) Catalog() connectors.Catalog

Catalog is the built-in and global descriptors, with any problem.

func (GlobalConnectors) Delete added in v0.8.0

Delete removes a global connection and its secrets (connectors.ErrUnknown when it isn't there), and what each workspace chose for it.

func (GlobalConnectors) Dirs added in v0.8.0

func (g GlobalConnectors) Dirs() connectors.Dirs

Dirs is where the global connections are.

func (GlobalConnectors) DraftQuery added in v0.8.0

func (g GlobalConnectors) DraftQuery(ctx context.Context, c connectors.Connection, values map[string]string, request string) (QueryDraft, error)

DraftQuery is the query builder for a global connection (Workspace.DraftConnectorQuery), with the built-in sql-query skill.

func (GlobalConnectors) List added in v0.8.0

List is the global connections, every category's; each is the person's own, so trusted.

func (GlobalConnectors) ReadSchema added in v0.8.0

func (g GlobalConnectors) ReadSchema(ctx context.Context, c connectors.Connection, values map[string]string) ([]connectors.Table, error)

ReadSchema reads a global connection's tables and their columns, as written: connectors.ErrNoTables when it can read none.

func (GlobalConnectors) Save added in v0.8.0

Save writes a global connection, in place of previous ("" for a new one), keeping the secret values given as global secrets; problems, with nothing written, when it can't be saved. A rename keeps whether it's on in each workspace.

func (GlobalConnectors) Test added in v0.8.0

Test connects to a global connection as written and lists its tools.

func (GlobalConnectors) Try added in v0.8.0

func (g GlobalConnectors) Try(ctx context.Context, c connectors.Connection, values map[string]string, tool string, args map[string]any) (string, bool, error)

Try runs one of a global connection's tools, as written, with args.

type GuardrailSpec added in v0.7.1

type GuardrailSpec = gates.GuardrailSpec

GuardrailSpec is what Studio's guardrail form saves.

type HealthCheck added in v0.7.1

type HealthCheck struct {
	// Kinds and Items (kind/name keys) narrow it; empty: every item.
	Kinds []string
	Items []string
	// Force judges items whose verdict is current too.
	Force bool
	// Starting, when set, hears of each item as its judging starts.
	Starting func(item string, index, total int)
}

HealthCheck says which items a check judges.

type HealthProgress added in v0.7.1

type HealthProgress struct {
	Item  string
	Index int
	Total int
	// Verdict is the item's new verdict; Error why it couldn't be judged.
	Verdict *health.Verdict
	Error   string
	CostUSD float64
}

HealthProgress is one step of a check.

type HealthReport added in v0.7.1

type HealthReport struct {
	health.Facts
	Verdicts map[string]health.Verdict
	// History are each item's overall scores, oldest first (the latest
	// included), by key.
	History map[string][]float64
	Overall float64
	ByKind  map[string]float64
	// PreviousOverall is the workspace's score before the last check.
	PreviousOverall float64
	State           health.State
	// Model judges; Schedule is when checks run ("" or "off": by hand).
	Model, Schedule string
	MaxCostUSD      float64
	// Next is when the schedule runs next (zero: it doesn't).
	Next time.Time
	// The reflection's schedule and cost limit ([harness]), and why the
	// last scheduled one didn't run or stopped.
	ReflectSchedule, ReflectSkipped string
	ReflectMaxCostUSD               float64
	ReflectThreshold                int
}

HealthReport is the dashboard: the facts, each item's latest verdict and its earlier scores, and the scores.

type IgnoredElsewhereError added in v0.6.0

type IgnoredElsewhereError struct {
	Path    string
	Pattern string // as written, such as "*.log"
	Source  string // where, such as ".gitignore:12"
}

IgnoredElsewhereError is an unignore of a path that some other rule ignores (a pattern, another .gitignore): Blitz doesn't rewrite those.

func (*IgnoredElsewhereError) Error added in v0.6.0

func (e *IgnoredElsewhereError) Error() string

Error says which rule ignores the path, in the user's language.

type LanguageServerStatus added in v0.5.0

type LanguageServerStatus = lsp.ServerStatus

LanguageServerStatus is a language's server, for the status list.

type LanguageState added in v0.5.0

type LanguageState = lsp.State

LanguageState is how a document's language server is.

type ManifestDraft added in v0.7.1

type ManifestDraft struct {
	Text    string
	Changes []string
	Problem string
}

ManifestDraft is the model's draft of a manifest field (an agent's instructions, a skill's, a script): the text, what changed, or why there's none. Nothing is saved: the editor offers it.

type MergeResult added in v0.6.5

type MergeResult struct {
	// Outcome is PullUpToDate, PullFastForward, PullMerged or PullConflicts
	// (the merge waits for ResolveConflict and CompleteMerge, or AbortMerge).
	Outcome PullOutcome
	Commits int // commits brought in from the branch
	Status  api.GitStatus
}

MergeResult is what MergeBranch did, and the repository's state after it.

type Options

type Options struct {
	// Streaming asks the model for partial responses as they are generated.
	Streaming bool
	// AppendSystemPrompt is added to the agent's instructions for this run
	// (--append-system-prompt).
	AppendSystemPrompt string
	// Warn receives problems that don't stop the workspace from opening.
	Warn func(string)
	// Model replaces the model built from the configuration (tests use a
	// mock). Agents with their own model still get theirs.
	Model model.LLM
	// Workers records which workers are enabled; one store serves every
	// workspace in a process (nil: ~/.blitz/workers.json).
	Workers *workers.Store
	// NewModel builds models by name for /model, pins and agents' own
	// models (nil: runtime.NewModel).
	NewModel func(ctx context.Context, cfg *config.Config, name string) (model.LLM, error)
	// TrustProject loads the project settings that need trust for this
	// run, without recording a decision (--trust-project).
	TrustProject bool
}

Options configure Open.

type PictureEstimate added in v0.9.4

type PictureEstimate struct {
	CostUSD float64
	Priced  bool
}

PictureEstimate is what a turn would cost, about.

type PictureFile added in v0.9.4

type PictureFile struct {
	ID      string   `json:"id"`
	File    string   `json:"file"`
	MIME    string   `json:"mime"`
	Saved   []string `json:"saved,omitempty"`
	Deleted bool     `json:"deleted,omitempty"`
}

PictureFile is a picture made, and where it was saved in the workspace. A deleted one keeps its place (the model's turn counts its pictures in order) without its file.

type PictureModel added in v0.9.4

type PictureModel struct {
	Ref           string // provider/model
	Info          images.Model
	InputPerMTok  float64
	OutputPerMTok float64
	Default       bool
	// Organization: through the organization's service (fewer controls).
	Organization bool
}

PictureModel is a model Pictures offers: what it can do, its price per million tokens (Gemini) and whether it's the images model.

type PictureRef added in v0.9.4

type PictureRef struct {
	Path    string
	Picture string
	Data    []byte
	MIME    string
	Name    string
	Role    string
}

PictureRef is a reference picture for a turn: a workspace file (Path), a picture of the session (Picture), or one added from the computer (Data); with its role.

type PictureRequest added in v0.9.4

type PictureRequest struct {
	// Session is the session to add to ("" for a new one).
	Session      string
	Model        string
	Prompt       string
	References   []PictureRef
	Count        int
	AspectRatio  string
	Size         string
	Thinking     string
	Search       bool
	SearchImages bool
	Avoid        string
	People       string
	Seed         int32
	UseSeed      bool
	Enhance      bool
	Format       string
	Quality      int
	// StartFrom is the session's picture the turn refines ("" for none).
	StartFrom string
}

PictureRequest is one turn asked of Pictures.

type PictureSession added in v0.9.4

type PictureSession struct {
	ID        string        `json:"id"`
	Name      string        `json:"name"`
	Workspace string        `json:"workspace"`
	Created   time.Time     `json:"created"`
	Updated   time.Time     `json:"updated"`
	Turns     []PictureTurn `json:"turns"`
}

PictureSession is a Pictures session: its turns, in order.

type PictureTurn added in v0.9.4

type PictureTurn struct {
	ID          string                  `json:"id"`
	At          time.Time               `json:"at"`
	Model       string                  `json:"model"`
	Kind        string                  `json:"kind"`
	Prompt      string                  `json:"prompt"`
	References  []PictureTurnRef        `json:"references,omitempty"`
	Count       int                     `json:"count,omitempty"`
	AspectRatio string                  `json:"aspect_ratio,omitempty"`
	Size        string                  `json:"size,omitempty"`
	Thinking    string                  `json:"thinking,omitempty"`
	Search      string                  `json:"search,omitempty"`
	Avoid       string                  `json:"avoid,omitempty"`
	People      string                  `json:"people,omitempty"`
	Seed        *int32                  `json:"seed,omitempty"`
	Format      string                  `json:"format,omitempty"`
	StartFrom   string                  `json:"start_from,omitempty"`
	Pictures    []PictureFile           `json:"pictures,omitempty"`
	Text        string                  `json:"text,omitempty"`
	Thoughts    string                  `json:"thoughts,omitempty"`
	Sources     []runtime.PictureSource `json:"sources,omitempty"`
	Problem     string                  `json:"problem,omitempty"`
	CostUSD     float64                 `json:"cost_usd,omitempty"`
	// Answer is the model's turn with its pictures' data left out (they're
	// the Pictures, in order), for the conversation (Gemini).
	Answer *genai.Content `json:"answer,omitempty"`
}

PictureTurn is one turn: what was asked, what came, and what it cost.

type PictureTurnRef added in v0.9.4

type PictureTurnRef struct {
	File string `json:"file"`
	MIME string `json:"mime"`
	Name string `json:"name"`
	Path string `json:"path,omitempty"`
	Role string `json:"role,omitempty"`
}

PictureTurnRef is a reference as kept: its copy in the session, where it came from, and its role.

type PullOutcome added in v0.6.4

type PullOutcome string

PullOutcome is how a pull went.

const (
	// PullUpToDate brought nothing new.
	PullUpToDate PullOutcome = "up_to_date"
	// PullFastForward moved the branch to the remote's.
	PullFastForward PullOutcome = "fast_forward"
	// PullMerged made a merge commit.
	PullMerged PullOutcome = "merged"
	// PullRebased replayed the branch's commits on the remote's.
	PullRebased PullOutcome = "rebased"
	// PullConflicts stopped on conflicts: a merge or rebase is in progress.
	PullConflicts PullOutcome = "conflicts"
)

type PullResult added in v0.6.4

type PullResult struct {
	Outcome PullOutcome
	Commits int // commits brought in from the remote
	Status  api.GitStatus
}

PullResult is what Pull did, and the repository's state after it.

type QueryDraft added in v0.8.0

type QueryDraft struct {
	Query   connectors.Query
	Notes   []string
	Tables  int
	Problem string
}

QueryDraft is the query builder's draft: the query, the assumptions it made, how many tables it read, or why there's none.

type ReceiptEvent added in v0.7.1

type ReceiptEvent struct {
	At time.Time `json:"at"`
	// Step is the step it's about, if any.
	Step string `json:"step,omitempty"`
	// Kind is run (started, resumed, ended), step, tool or notice.
	Kind  string `json:"kind"`
	Text  string `json:"text"`
	Error bool   `json:"error,omitempty"`
}

ReceiptEvent is something that happened in a run.

type Replayed added in v0.7.1

type Replayed struct {
	Result flows.Result `json:"result"`
	// Caught is a failure its error link took.
	Caught bool `json:"caught,omitempty"`
}

Replayed is a finished step's result, kept with a paused run.

type RepoConfigError added in v0.6.4

type RepoConfigError struct {
	Key string // such as "core.sshcommand"
}

RepoConfigError is a remote action refused because the repository's own git config (which the agent can write) sets something that runs a command.

func (*RepoConfigError) Error added in v0.6.4

func (e *RepoConfigError) Error() string

Error says which setting, and what to do, in the user's language.

type RestoredFile added in v0.6.0

type RestoredFile struct {
	Path      string // workspace-relative, with "/"
	Recreated bool
}

RestoredFile is a file a folder's restore puts back: changed since (restored), or deleted since (recreated).

type Revision added in v0.6.0

type Revision struct {
	Commit  string // the full hash
	Short   string // the abbreviated hash
	Parents []string
	Author  string
	Email   string
	When    time.Time
	Subject string
	// Path is a file's path at that commit, from the repository's root (it
	// differs from today's when the file was renamed since); "" for a
	// folder's history.
	Path string
	// Added and Removed are the lines it changed in the file or folder,
	// in Files files (binary files count as files, not lines).
	Added, Removed, Files int
}

Revision is one commit in a history.

type RuleSpec added in v0.7.1

type RuleSpec = gates.Spec

RuleSpec is what Studio's rule form saves (gates.Spec, by name).

type RunOptions

type RunOptions struct {
	// Manual means the run started on request rather than by the schedule.
	Manual bool
	// OnStart receives the run's record as it starts (its ID and session).
	OnStart func(api.Run)
	// OnEvent receives the turn's events.
	OnEvent func(api.Event)
	// OnRequest decides what the worker's permissions don't allow (a job
	// on the organization's service pauses for its owner's approval,
	// spec_053 EN-43); nil refuses it (WK-42). A refusal is recorded either
	// way.
	OnRequest func(ctx context.Context, req api.ApprovalRequest) (api.Decision, error)
	// Session goes on in a saved session, a paused run's, with Prompt
	// (the answer to what it asked) in place of the worker's own.
	Session, Prompt string
}

RunOptions configure RunWorker.

type ServerNotInstalledError added in v0.5.0

type ServerNotInstalledError = lsp.NotInstalledError

ServerNotInstalledError is a server whose command isn't installed.

type SourceLocation added in v0.5.0

type SourceLocation struct {
	lsp.Location
	Outside bool
}

SourceLocation is a definition or reference, outside marking a file outside the workspace.

type StepReceipt added in v0.7.1

type StepReceipt struct {
	ID      string    `json:"id"`
	Title   string    `json:"title,omitempty"`
	Type    string    `json:"type"`
	Status  string    `json:"status"`
	Started time.Time `json:"started,omitzero"`
	Ended   time.Time `json:"ended,omitzero"`
	// Attempts is how many times it was tried (its retry).
	Attempts int `json:"attempts,omitempty"`
	// Agent is an agent step's; Models are the models its calls used
	// (its turns', a rule's judge, an extract step's).
	Agent  string    `json:"agent,omitempty"`
	Models []string  `json:"models,omitempty"`
	Usage  api.Usage `json:"usage"`
	Output string    `json:"output,omitempty"`
	// Stream is the text its turns streamed as they went (the start of it).
	Stream string `json:"stream,omitempty"`
	Error  string `json:"error,omitempty"`
}

StepReceipt is one run of a step (a step a loop goes back to runs again, each run its own).

type TableColumn added in v0.3.0

type TableColumn struct {
	Name     string
	Kind     string
	Empty    int
	Min, Max float64
	Intent   string
}

TableColumn is a table's column: its name, what its first rows look like (kind, empty cells, a number column's range), and what a model said it holds (search.enrich), if it has.

type TablePage added in v0.3.0

type TablePage struct {
	Columns []TableColumn
	Rows    []table.Row
	Matched int
	Total   int
	Sorted  bool
	Latin1  bool
}

TablePage is a page of a table: its columns, the rows asked for (each with its number, 1-based), how many matched and how many there are. Sorted is false when a sort was asked for but too many rows matched.

type TableQuery added in v0.3.0

type TableQuery struct {
	Path       string
	Search     string
	Filters    map[int]string
	SortColumn int
	Desc       bool
	Offset     int
	Limit      int
}

TableQuery asks for a page of a table file's rows: those with Search in a cell and passing each column's filter, sorted by a column (SortColumn 1-based; 0: file order), from Offset, up to Limit (0: 100).

type TextEdit added in v0.5.0

type TextEdit = lsp.TextEdit

TextEdit is a range of a document replaced by text.

type TextPosition added in v0.5.0

type TextPosition = lsp.Position

TextPosition is a 1-based line and column, in characters.

type WorkerRewrite added in v0.6.4

type WorkerRewrite struct {
	Prompt      string
	Permissions []string // "kind:pattern", each valid
	Changes     []string // what changed and why, a line each
	Problem     string
}

WorkerRewrite is a worker's instructions as the model rewrote them, the permissions they need, and what changed. A model that fails leaves it empty with Problem saying why: the user's own instructions stand.

type Workspace

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

Workspace is a folder opened in Blitz: everything a session needs.

func Open

func Open(ctx context.Context, cfg *config.Config, o Options) (*Workspace, error)

Open wires registries, tools, the model and the engine for the workspace cfg.Tools.WorkspaceDir names. The workspace owns cfg from then on and changes it (the model, pins, settings), so each workspace needs its own copy. Open also activates cfg's interface language for the process.

func (*Workspace) AbortMerge added in v0.6.4

func (w *Workspace) AbortMerge(ctx context.Context) (api.GitStatus, error)

AbortMerge gives up the merge or rebase a pull started, putting the branch and the uncommitted changes back as they were.

func (*Workspace) AcceptedMedia added in v0.2.1

func (w *Workspace) AcceptedMedia() []runtime.Accept

AcceptedMedia is what the active agent's model takes as attachments (spec_011_images), for the front ends to offer only those.

func (*Workspace) ActiveAgent

func (w *Workspace) ActiveAgent() api.AgentInfo

ActiveAgent describes the agent that answers prompts.

func (*Workspace) ActiveAgentTools

func (w *Workspace) ActiveAgentTools() api.AgentTools

ActiveAgentTools returns what the active agent can use: its built-in tools and the MCP servers offered to it.

func (*Workspace) ActiveSession

func (w *Workspace) ActiveSession() (api.SessionInfo, bool)

ActiveSession returns the session prompts go to, with its messages.

func (*Workspace) AddImage

func (w *Workspace) AddImage(name string, data []byte) (*images.Image, error)

AddImage stores image data (e.g. pasted from the clipboard) for a prompt.

func (*Workspace) AddMemory

func (w *Workspace) AddMemory(ctx context.Context, text string) (string, error)

AddMemory appends text to the last project instruction file (BLITZ.md when none is configured), reloads memory, and returns the file's path.

func (*Workspace) AddPermissionRule

func (w *Workspace) AddPermissionRule(effect, rule string, save api.Scope) (api.PermissionChange, error)

AddPermissionRule adds a rule for this session and, with a scope, to that settings file's [permissions]: global, or the workspace's own. It applies at once, except read rules, which need saving and apply from the next start.

func (*Workspace) AgentBrowserReply added in v0.8.4

func (w *Workspace) AgentBrowserReply(id string, messages []string, closed bool, reason string) error

AgentBrowserReply is what a window says of a view it hosts: DevTools messages from it (replies and events, in order), that it's closed (closed; why in reason), or that it couldn't open it.

func (*Workspace) Agents

func (w *Workspace) Agents() *agents.Registry

Agents returns the agent registry.

func (*Workspace) AllModelSettings

func (w *Workspace) AllModelSettings() map[string]config.ModelSettings

AllModelSettings returns every model's settings, by model name.

func (*Workspace) AllTools

func (w *Workspace) AllTools() []api.ToolInfo

AllTools describes every tool an agent can be given, by name.

func (*Workspace) AnswerCompose added in v0.7.1

func (w *Workspace) AnswerCompose(ctx context.Context, id, answer string) (*compose.Session, error)

AnswerCompose gives session id the user's answer (or a change to its draft) and runs the composer's next turn.

func (*Workspace) AnswerTaskRequest

func (w *Workspace) AnswerTaskRequest(id string, decision api.Decision, answer string) error

AnswerTaskRequest answers one: decision for an approval, answer for a question.

func (*Workspace) AnyProcessOutput added in v0.8.5

func (w *Workspace) AnyProcessOutput(id int) (string, api.ProcessInfo, error)

AnyProcessOutput is background process id's captured output and status, whichever session started it: the user's own look (spec_052_processes).

func (*Workspace) ApproveSpec added in v0.9.4

func (w *Workspace) ApproveSpec(ctx context.Context, p string, force bool) (api.SpecApproved, error)

ApproveSpec approves the saved spec at p (SDD-11): its Status: line says approved, its text is kept as the baseline, and the ledger records each requirement's fingerprint; when it was approved before with another text, a diff of the change is kept in the ledger's diffs. Without force, a spec with errors or open questions isn't approved (ErrSpecNotReady).

func (*Workspace) Audit

func (w *Workspace) Audit() *audit.Logger

Audit returns the audit log (nil when disabled; its methods accept nil).

func (*Workspace) AuditShell

func (w *Workspace) AuditShell(command string, exitCode int, startErr error)

AuditShell records a command the user ran directly.

func (*Workspace) AvailableLocales

func (w *Workspace) AvailableLocales() (list []api.LocaleInfo, customDir string)

AvailableLocales returns the interface languages with a catalog, and the directory custom catalogs are read from ("" if none is configured).

func (*Workspace) Branches added in v0.6.5

func (w *Workspace) Branches(ctx context.Context) ([]Branch, error)

Branches lists the local branches, then the remotes' branches no local branch tracks, each newest commit first.

func (*Workspace) Busy

func (w *Workspace) Busy() bool

Busy reports whether a turn is running in any of the workspace's sessions.

func (*Workspace) ChangeDocument added in v0.5.0

func (w *Workspace) ChangeDocument(ctx context.Context, id string, version int64, text string) error

ChangeDocument replaces an editor document's text.

func (*Workspace) CheckAnswer added in v0.7.1

func (w *Workspace) CheckAnswer(taskID string, action, data []byte) (map[string]any, error)

CheckAnswer checks a client's answer to a human task (WF-18), so no client is trusted to have checked it: action is A2UI's action message (from one of the form's buttons), data the surface's data model as the client had it (empty: the form's own, with the action's values). It returns the answer the run gets, or an *AnswerError.

func (*Workspace) CheckHealth added in v0.7.1

func (w *Workspace) CheckHealth(ctx context.Context, c HealthCheck, progress func(HealthProgress)) (judged int, costUSD float64, err error)

CheckHealth judges the check's items that are due, one at a time, saying how each went; a verdict is kept as it comes. Stopping ctx stops it after the item being judged.

func (*Workspace) ClearApprovals

func (w *Workspace) ClearApprovals() (int, error)

ClearApprovals revokes every approval and returns how many there were, with RevokeApprovals' error.

func (*Workspace) ClearGoal

func (w *Workspace) ClearGoal() error

ClearGoal removes the active session's goal.

func (*Workspace) Close

func (w *Workspace) Close() error

Close kills background processes and MCP servers, flushes the audit log and releases the workspace.

func (*Workspace) CloseDocument added in v0.5.0

func (w *Workspace) CloseDocument(id string) error

CloseDocument closes an editor document.

func (*Workspace) Commit added in v0.3.1

func (w *Workspace) Commit(ctx context.Context, message string) (hash, subject string, err error)

Commit commits what's staged with message (git commit -F -, the repository's hooks run) and returns the new commit's short hash and subject.

func (*Workspace) Compact

func (w *Workspace) Compact(ctx context.Context, focus string) (api.CompactResult, error)

Compact summarises the active session's older turns, keeping the latest, to shrink the model's context. focus steers what the summary keeps.

func (*Workspace) Complete added in v0.5.0

func (w *Workspace) Complete(ctx context.Context, id string, version int64, line, col int, trigger string) (lsp.CompletionList, error)

Complete is the completion at (line, col) of an editor document.

func (*Workspace) CompleteMerge added in v0.6.4

func (w *Workspace) CompleteMerge(ctx context.Context) (api.GitStatus, error)

CompleteMerge finishes the merge or rebase a pull started once no file is in conflict: the merge commit with git's message, or the rebase's next commits (which may stop on conflicts of their own: the status says so).

func (*Workspace) Config

func (w *Workspace) Config() *config.Config

Config returns the workspace's configuration.

func (*Workspace) ConnectorCatalog added in v0.8.0

func (w *Workspace) ConnectorCatalog() connectors.Catalog

ConnectorCatalog is the categories and kinds of connectors there are for the workspace, with any descriptor's problem.

func (*Workspace) ConnectorSet added in v0.8.0

func (w *Workspace) ConnectorSet() ConnectorSet

ConnectorSet is the workspace's connections as the API serves them.

func (*Workspace) ConnectorState added in v0.8.0

func (w *Workspace) ConnectorState(category connectors.Category) tools.MCPState

ConnectorState is how a category's server is doing: idle (not used yet), connected, failed (Error says why), or "" when it has no connections.

func (*Workspace) Connectors added in v0.8.0

func (w *Workspace) Connectors() []connectors.Connection

Connectors are the workspace's connections, every category's, the global ones first, each saying whether the person trusted it and whether it's on here.

func (*Workspace) Context

func (w *Workspace) Context(parts bool) (api.ContextInfo, error)

Context returns the active session's context size and compaction setting, with its breakdown by category when parts is set (it reads the session's events).

func (*Workspace) CopyFile added in v0.9.7

func (w *Workspace) CopyFile(ctx context.Context, from, to string) error

CopyFile copies from (a file, or a folder with everything in it) to to; to must not exist (FIL-38).

func (*Workspace) CopySkill added in v0.7.1

func (w *Workspace) CopySkill(from, name string) (api.SkillFile, []string, error)

CopySkill copies any skill the workspace sees (a built-in, the user's, a registry's, another of the workspace's) into .agents/skills as name, its files and all, to edit as the workspace's own.

func (*Workspace) CreateBranch added in v0.6.5

func (w *Workspace) CreateBranch(ctx context.Context, name string) (api.GitStatus, error)

CreateBranch makes branch name at the current commit and switches to it, keeping uncommitted changes.

func (*Workspace) CreateFolder

func (w *Workspace) CreateFolder(p string) error

CreateFolder creates the folder p.

func (*Workspace) CreateWorker

func (w *Workspace) CreateWorker(spec api.WorkerSpec) (api.WorkerInfo, []string, error)

CreateWorker writes a new worker, in the first of workers.paths (.agents/workers/<name>/WORKER.md by default), once the file it makes loads as a valid worker. Otherwise it writes nothing and returns why. A new worker is disabled until it's reviewed and enabled.

func (*Workspace) DataConnections added in v0.9.7

func (w *Workspace) DataConnections(context.Context) ([]api.DataConnection, error)

DataConnections are the workspace's database connections and their saved queries, by name, one of each name (the workspace's over a global one), as a chat finds them (spec_059_data DAT-45).

func (*Workspace) DeleteConnector added in v0.8.0

func (w *Workspace) DeleteConnector(ctx context.Context, category, scope, name string) error

DeleteConnector removes one of the workspace's connections, its secrets, whether it's on here and its trust (connectors.ErrUnknown when it isn't there; ErrGlobalConnector for a global one).

func (*Workspace) DeleteEval added in v0.7.1

func (w *Workspace) DeleteEval(name string) error

DeleteEval removes an eval from .agents/evals.

func (*Workspace) DeleteFile

func (w *Workspace) DeleteFile(ctx context.Context, p string) error

DeleteFile deletes p, a folder with everything in it.

func (*Workspace) DeleteGuardrail added in v0.7.1

func (w *Workspace) DeleteGuardrail(name string) error

DeleteGuardrail removes a guardrail from .agents/guardrails (a built-in's: back to its defaults).

func (*Workspace) DeletePicture added in v0.9.4

func (w *Workspace) DeletePicture(id, picture string) (PictureSession, error)

DeletePicture removes a picture from session id (its saved copies stay).

func (*Workspace) DeletePictureSession added in v0.9.4

func (w *Workspace) DeletePictureSession(id string) error

DeletePictureSession deletes session id and its pictures (not what was saved into the workspace).

func (*Workspace) DeleteRule added in v0.7.1

func (w *Workspace) DeleteRule(name string) error

DeleteRule removes a rule from .agents/rules.

func (*Workspace) DeleteSession

func (w *Workspace) DeleteSession(ctx context.Context, id string) error

DeleteSession deletes saved session id, which may be another workspace's: its transcript and history. The active session, or one a background run uses, is refused (api.ErrSessionOpen).

func (*Workspace) DeleteSkill added in v0.7.1

func (w *Workspace) DeleteSkill(name string) error

DeleteSkill deletes a skill of the workspace's: its folder.

func (*Workspace) DeleteSkillFile added in v0.7.1

func (w *Workspace) DeleteSkillFile(name, rel string) (api.SkillFile, error)

DeleteSkillFile removes one of a workspace skill's files.

func (*Workspace) DeleteSkillScenario added in v0.8.0

func (w *Workspace) DeleteSkillScenario(skill, name string) error

DeleteSkillScenario removes one of a workspace skill's scenarios.

func (*Workspace) DeleteWorker

func (w *Workspace) DeleteWorker(name string) error

DeleteWorker deletes a worker: its directory (WORKER.md and anything beside it) and whether it was enabled. Its past runs stay in the run log. The caller makes sure it isn't running.

func (*Workspace) DeleteWorkflow added in v0.7.1

func (w *Workspace) DeleteWorkflow(name string) error

DeleteWorkflow removes a workflow from .agents/workflows.

func (*Workspace) Dir

func (w *Workspace) Dir() string

Dir is the workspace directory.

func (*Workspace) DisableWorker

func (w *Workspace) DisableWorker(name string) (api.WorkerInfo, error)

DisableWorker stops a worker from running.

func (*Workspace) DocumentDefinition added in v0.5.0

func (w *Workspace) DocumentDefinition(ctx context.Context, id string, version int64, line, col int) ([]SourceLocation, error)

DocumentDefinition is where the symbol at (line, col) is defined.

func (*Workspace) DocumentHover added in v0.5.0

func (w *Workspace) DocumentHover(ctx context.Context, id string, version int64, line, col int) (string, error)

DocumentHover is what the server says about the symbol at (line, col).

func (*Workspace) DocumentReferences added in v0.5.0

func (w *Workspace) DocumentReferences(ctx context.Context, id string, version int64, line, col int) ([]SourceLocation, error)

DocumentReferences are where the symbol at (line, col) is used.

func (*Workspace) DraftCommit added in v0.3.1

func (w *Workspace) DraftCommit(ctx context.Context, stageAll bool) (CommitDraft, error)

DraftCommit lists what's staged (all of the workspace's changes staged first with stageAll, as git add --all) and has the model draft a commit message from the diff, secrets redacted. With nothing staged it returns no files and asks nothing; a model that fails leaves the message empty, with Problem saying why, so the user can still write one.

func (*Workspace) DraftConnectorQuery added in v0.8.0

func (w *Workspace) DraftConnectorQuery(ctx context.Context, c connectors.Connection, values map[string]string, request string) (QueryDraft, error)

DraftConnectorQuery has the sql-query skill write a query for c, as written, from what the user is looking for (request) and c's schema. A schema that can't be read, or holds no table, is the draft's problem; so is a model that fails.

func (*Workspace) DraftEvalCases added in v0.7.1

func (w *Workspace) DraftEvalCases(ctx context.Context, agent, request string, existing []evals.Case) (EvalDraft, error)

DraftEvalCases has the suggestions model propose cases for agent, beside those it has (existing) and as request asks (optional). The cases aren't saved; one the model got wrong is left out. An unknown agent is an error; a model that fails is the draft's problem.

func (*Workspace) DraftManifest added in v0.7.1

func (w *Workspace) DraftManifest(ctx context.Context, r DraftRequest) (ManifestDraft, error)

DraftManifest has the suggestions model (else the reviewer's, else the main one) write or improve a manifest field. A model that fails leaves the draft empty with Problem saying why.

func (*Workspace) DraftWorker added in v0.8.4

func (w *Workspace) DraftWorker(spec api.WorkerSpec) (string, []byte, []string, error)

DraftWorker is what CreateWorker would write for spec, without writing it: the worker's folder, its WORKER.md, and what keeps it from loading as a valid worker (create_job shows it before asking).

func (*Workspace) DropCompose added in v0.7.1

func (w *Workspace) DropCompose(id string)

DropCompose forgets session id.

func (*Workspace) EnableWorker

func (w *Workspace) EnableWorker(name, hash string) (api.WorkerInfo, error)

EnableWorker lets a worker run on its schedule, pinned to hash: the one the caller reviewed, which must still be current (api.ErrHashMismatch otherwise). An invalid worker can't be enabled.

func (*Workspace) Engine

func (w *Workspace) Engine() *runtime.Engine

Engine returns the agent engine.

func (*Workspace) EstimateHealthCheck added in v0.7.1

func (w *Workspace) EstimateHealthCheck(ctx context.Context, c HealthCheck) (items int, costUSD float64, priced bool)

EstimateHealthCheck says how many items a check would judge and what it would cost, estimated from the prompts' size.

func (*Workspace) EvalRuns added in v0.7.1

func (w *Workspace) EvalRuns(name string, limit int) ([]api.EvalRun, error)

EvalRuns are an eval's recorded runs, newest first ("skill:<name>": a skill's scenario runs).

func (*Workspace) Evals added in v0.7.1

func (w *Workspace) Evals() []evals.Eval

Evals are the workspace's evals, read afresh, by name.

func (*Workspace) ExportSession

func (w *Workspace) ExportSession(id string) (string, error)

ExportSession is session id (the active one when "") as Markdown.

func (*Workspace) Fetch added in v0.6.4

func (w *Workspace) Fetch(ctx context.Context) (api.GitStatus, error)

Fetch brings the remote's branches up to date (the upstream's remote, else every remote), for the ahead and behind counts.

func (*Workspace) FindFiles

func (w *Workspace) FindFiles(ctx context.Context, query string, limit int) ([]string, error)

FindFiles returns up to limit files whose path matches query, best first. Hidden files are left out.

func (*Workspace) FindPaths

func (w *Workspace) FindPaths(ctx context.Context, query string, limit int, folders bool, extensions ...string) ([]string, error)

FindPaths is FindFiles, with folders also the folders the files are in ("src/cart/", with a trailing slash), matched the same way. With extensions ("png", any case), only files that have one of them (and no folders).

func (*Workspace) FlowTasks added in v0.7.1

func (w *Workspace) FlowTasks() []FlowRecord

FlowTasks are the tasks the workspace's paused runs wait on, with their runs, oldest first.

func (*Workspace) ForgetNote

func (w *Workspace) ForgetNote(name string) error

ForgetNote deletes the note name (or the only one whose name starts so); the agent's instructions lose it at the next reload or session.

func (*Workspace) ForgetProjectTrust added in v0.3.1

func (w *Workspace) ForgetProjectTrust() error

ForgetProjectTrust forgets the decision about the workspace's project settings: they wait for trust again.

func (*Workspace) ForkSession

func (w *Workspace) ForkSession(ctx context.Context, turn int) (api.SessionInfo, error)

ForkSession starts a new session copied from the active one up to and including its prompt turn (1 the first; 0 or more than there are: all of it), in the transcript and the event log, and makes it active; the source is unchanged (spec_026_backlog BL-SES-01, spec_027_parity PAR-SES-10).

func (*Workspace) GetSkillFile added in v0.7.1

func (w *Workspace) GetSkillFile(name string) (api.SkillFile, error)

GetSkillFile returns a skill as Studio edits it: any skill the workspace sees, editable when it's the workspace's own.

func (*Workspace) GetWorkerSpec

func (w *Workspace) GetWorkerSpec(name string) (api.WorkerSpec, string, error)

GetWorkerSpec returns a worker's WORKER.md as written, for editing, and the hash UpdateWorker needs. The worker needn't be valid.

func (*Workspace) GitDiff

func (w *Workspace) GitDiff(ctx context.Context, color bool) (string, error)

GitDiff is every change in the workspace since the last commit (stat and patch): staged and not, and the files git doesn't track yet as new files (at most maxUntrackedDiffs of them). Before the first commit, it's everything staged and not. color keeps git's terminal colours. On failure the output holds git's message.

The agent can write the repository's .git/config, and git diff would run commands named there (fsmonitor, external diff, textconv and filter drivers) outside the sandbox. They are all switched off.

func (*Workspace) GitFileAction

func (w *Workspace) GitFileAction(ctx context.Context, p string, action GitAction) error

GitFileAction runs action on p, a workspace-relative file or folder.

func (*Workspace) GitInit

func (w *Workspace) GitInit(ctx context.Context) (api.GitStatus, error)

GitInit makes the workspace a git repository (git init), unless it's in one already, and returns its git status.

func (*Workspace) GitStatus

func (w *Workspace) GitStatus(ctx context.Context) (api.GitStatus, error)

GitStatus reads the workspace's branch and changed files, its remote and upstream with the ahead and behind counts, and a merge or rebase in progress with its conflicts.

func (*Workspace) Goal

func (w *Workspace) Goal() (api.Goal, error)

Goal is the active session's goal (api.ErrNoGoal).

func (*Workspace) Guardrails added in v0.7.1

func (w *Workspace) Guardrails() []gates.Guardrail

Guardrails are the workspace's guardrails, read afresh: the built-in ones (with their defaults when they have no file) but those the organization's policy switches off (spec_053 EN-31), then custom ones.

func (*Workspace) HarnessEvidence added in v0.8.3

func (w *Workspace) HarnessEvidence(since time.Time) harness.Evidence

HarnessEvidence is what went wrong in the workspace's sessions since then (HE-02): from the audit log, its chats', jobs' and detached runs' (not evals' cases or snapshots), with the health judge's latest fixes for the items involved. No model is called.

func (*Workspace) HarnessMissing

func (w *Workspace) HarnessMissing() bool

HarnessMissing reports whether the workspace has no agent instructions: none of .agents/AGENTS.md, AGENTS.md, CLAUDE.md, GEMINI.md or BLITZ.md.

func (*Workspace) HarnessStale added in v0.5.3

func (w *Workspace) HarnessStale() bool

HarnessStale reports whether the specification changed after the skills and agents: a spec in .agents/specs/ is newer than every file under .agents/skills/ and .agents/agents/, and there is at least one of those.

func (*Workspace) Health added in v0.7.1

func (w *Workspace) Health(ctx context.Context) HealthReport

Health is the dashboard: the facts and the verdicts.

func (*Workspace) HealthDue added in v0.7.1

func (w *Workspace) HealthDue(now time.Time) bool

HealthDue reports whether the schedule wants a check now.

func (*Workspace) HealthFacts added in v0.7.1

func (w *Workspace) HealthFacts(ctx context.Context) health.Facts

HealthFacts are the dashboard's facts, read now.

func (*Workspace) History added in v0.6.0

func (w *Workspace) History(ctx context.Context, p string, limit, skip int) (revs []Revision, more bool, err error)

History returns the commits that changed p (a file, following renames; a folder, anything under it; "" the workspace), newest first: limit of them (100 when 0, at most 500) after the first skip. more says older ones follow.

func (*Workspace) ImagesEnabled

func (w *Workspace) ImagesEnabled() bool

ImagesEnabled reports whether images can be attached.

func (*Workspace) ImpactSpec added in v0.9.4

func (w *Workspace) ImpactSpec(ctx context.Context, p string, judge, estimate bool) (api.SpecImpact, error)

ImpactSpec scans what the saved spec at p's changes since its approval reach in the work (SDD-20) without a model; with judge, the suggestions model writes the report (a summary, the steps to fix it, the conflicts: SDD-21), kept in the ledger's impact folder; with estimate, only what that would cost, nothing written.

func (*Workspace) InstallSecretHook added in v0.8.4

func (w *Workspace) InstallSecretHook(ctx context.Context) (secretscan.Result, error)

InstallSecretHook adds the pre-commit hook that stops commits adding API keys and other secrets to the workspace's repository (spec_051_secret_hooks): .githooks/pre-commit, versioned, and core.hooksPath. A repository with other hooks is left alone.

func (*Workspace) JudgeRule added in v0.7.1

func (w *Workspace) JudgeRule(ctx context.Context, r gates.Rule, subject string) (gates.Verdict, error)

JudgeRule judges subject against a rule as written (Studio's Try it): a prompt for a before-agent rule, an answer for an after-agent one.

func (*Workspace) KeepDocuments added in v0.5.0

func (w *Workspace) KeepDocuments(client string) []string

KeepDocuments keeps client's documents open, returning those still open.

func (*Workspace) KillProcess

func (w *Workspace) KillProcess(sessions []string, id int) (api.ProcessInfo, error)

KillProcess stops background process id and its descendants, when one of sessions started it (else api.ErrUnknownProcess).

func (*Workspace) LanguageStatus added in v0.5.0

func (w *Workspace) LanguageStatus() []lsp.ServerStatus

LanguageStatus lists the workspace's language servers.

func (*Workspace) LanguageTrusted added in v0.5.0

func (w *Workspace) LanguageTrusted() bool

LanguageTrusted reports whether language servers may start for the editor: the project's settings are trusted, or none need trust.

func (*Workspace) ListAgents

func (w *Workspace) ListAgents() []api.AgentInfo

ListAgents returns every agent, in registry order.

func (*Workspace) ListApprovals

func (w *Workspace) ListApprovals() []api.Approval

ListApprovals returns this session's approvals, then saved ones.

func (*Workspace) ListCheckpoints

func (w *Workspace) ListCheckpoints() []api.Checkpoint

ListCheckpoints returns the turns that changed files, newest first.

func (*Workspace) ListCommands

func (w *Workspace) ListCommands() []api.CommandInfo

ListCommands returns the custom slash commands, by name. Files that don't parse are reported through the workspace's warnings.

func (*Workspace) ListDir

func (w *Workspace) ListDir(ctx context.Context, p string, showHidden bool) (DirListing, error)

ListDir lists the folder p (the workspace for ""), folders first, at most maxListed of them. Hidden entries are left out unless showHidden.

func (*Workspace) ListDirUpTo added in v0.9.7

func (w *Workspace) ListDirUpTo(ctx context.Context, p string, showHidden bool, limit int) (DirListing, error)

ListDirUpTo is ListDir listing at most limit entries (maxListed for 0): the tree's "Show more" lists a big folder further (FIL-39).

func (*Workspace) ListEnvs

func (w *Workspace) ListEnvs() ([]api.Env, error)

ListEnvs returns the script environments.

func (*Workspace) ListHooks

func (w *Workspace) ListHooks() []api.HookInfo

ListHooks are the configured hooks, with their sources and recent failures (spec_027_parity PAR-HK-13).

func (*Workspace) ListMCPServers

func (w *Workspace) ListMCPServers() []api.MCPServer

ListMCPServers returns the configured MCP servers, the disabled ones marked, each with how it's doing (State: disabled, idle, connected or failed).

func (*Workspace) ListModels added in v0.9.6

func (w *Workspace) ListModels(ctx context.Context, refresh bool) (api.ModelList, error)

ListModels is every chat model of every provider the workspace's settings set up, grouped by provider (spec_061_models MOD-01..06), kept for modelsFresh unless refresh.

func (*Workspace) ListNotes

func (w *Workspace) ListNotes() ([]api.Note, error)

ListNotes are the notes the agent saved in this workspace with its remember tool, newest first (spec_027_parity PAR-MEM-11).

func (*Workspace) ListPermissionRules

func (w *Workspace) ListPermissionRules() []api.PermissionRule

ListPermissionRules returns the rules in force: deny, then ask, then allow. A rule from the settings is labelled with the file it's in: global, or the workspace's.

func (*Workspace) ListProcesses

func (w *Workspace) ListProcesses(sessions []string) []api.ProcessInfo

ListProcesses are the background processes started in any of sessions' turns, ordered by ID: a client's, which it accounts for when it exits.

func (*Workspace) ListSessions

func (w *Workspace) ListSessions(all bool) ([]api.SessionInfo, error)

ListSessions returns this workspace's sessions, or with all every saved session, newest first. Messages are left out.

func (*Workspace) ListSkills

func (w *Workspace) ListSkills() []api.SkillInfo

ListSkills returns every skill found.

func (*Workspace) ListSpecs added in v0.9.4

func (w *Workspace) ListSpecs() ([]api.SpecSummary, error)

ListSpecs is the project's specification, in order, each with its status and what the checks found (spec_057_spec_driven SDD-01).

func (*Workspace) ListStyles

func (w *Workspace) ListStyles() []api.StyleInfo

ListStyles are the output styles, by name, with which is in use.

func (*Workspace) ListTasks

func (w *Workspace) ListTasks() []api.TaskInfo

ListTasks are the workspace's background tasks, oldest first.

func (*Workspace) ListTasksIn

func (w *Workspace) ListTasksIn(sessions []string) []api.TaskInfo

ListTasksIn are the tasks sessions started, oldest first.

func (*Workspace) ListWorkers

func (w *Workspace) ListWorkers() ([]api.WorkerInfo, error)

ListWorkers returns the workspace's workers, by name.

func (*Workspace) LoadAttachments

func (w *Workspace) LoadAttachments(paths []string, prompt string, warn func(string)) ([]*images.Image, error)

LoadAttachments loads image and PDF files (failures are errors naming the path) and @image or @paper.pdf mentions in prompt (failures are warnings: the prompt may be piped text that merely contains an @path) through the workspace sandbox. Identical files are attached once.

func (*Workspace) LoadImage

func (w *Workspace) LoadImage(path string) (*images.Image, error)

LoadImage reads an image from the workspace for a prompt.

func (*Workspace) LoadSession

func (w *Workspace) LoadSession(ref string) (s api.SessionInfo, branched bool, err error)

LoadSession makes the session ref names active: an ID, or the name of a snapshot, which starts a new session copied from it (branched). A session from another workspace can be loaded by ID.

func (*Workspace) Locales

func (w *Workspace) Locales() *i18n.Bundle

Locales returns the loaded translation catalogs.

func (*Workspace) MakeConnectorGlobal added in v0.8.0

func (w *Workspace) MakeConnectorGlobal(ctx context.Context, category, name string) (connectors.Connection, []string, error)

MakeConnectorGlobal moves one of the workspace's connections, with its secrets, to the global folder, so every workspace has it (CON-19): problems, with nothing moved, when it can't be; ErrUntrustedConnector when the person hasn't trusted it (a clone's file mustn't reach the global secrets). Whether it's on here goes with it.

func (*Workspace) MakePicture added in v0.9.4

func (w *Workspace) MakePicture(ctx context.Context, r PictureRequest, estimate bool) (PictureSession, PictureEstimate, error)

MakePicture makes r's turn (spec_058 §6): checked against the model's catalog entry first (PIC-62), sent with the session's conversation for a Gemini model (PIC-41), kept with the session (PIC-50). A turn the model answers without a picture is kept too, with its Problem. With estimate, it says only what the turn would cost (PIC-70) and keeps nothing.

func (*Workspace) MemoryFiles

func (w *Workspace) MemoryFiles() []string

MemoryFiles are the project instruction file names looked for, in order.

func (*Workspace) MergeBranch added in v0.6.5

func (w *Workspace) MergeBranch(ctx context.Context, name string) (MergeResult, error)

MergeBranch merges branch name (local or a remote's) into the current one: a fast-forward when it can, else a merge commit with git's message, keeping uncommitted changes (--autostash). A merge that stops on conflicts isn't an error: its outcome is PullConflicts, and it waits for ResolveConflict and CompleteMerge (or AbortMerge).

func (*Workspace) Model

func (w *Workspace) Model() api.ModelInfo

Model returns the model the active agent runs on.

func (*Workspace) ModelErr

func (w *Workspace) ModelErr() error

ModelErr is why the configured model failed to initialise (nil if it didn't). The workspace then runs on a placeholder model.

func (*Workspace) ModelSettings

func (w *Workspace) ModelSettings(ref string) (api.ModelSettingsInfo, error)

ModelSettings returns ref's settings ("provider/" optional).

func (*Workspace) MoveSession

func (w *Workspace) MoveSession(id string) (api.SessionInfo, error)

MoveSession carries session id here from the workspace it was in and makes it active (/cd, PAR-SES-40): --continue here finds it, rewind stops at the move, and the agent's next prompt says the workspace changed.

func (*Workspace) MoveToService added in v0.9.0

func (w *Workspace) MoveToService(name string, force bool) (problems []string, info api.WorkerInfo, moved bool, err error)

MoveToService makes the job name run on the organization's service (runs_on: service, spec_053 EN-40), all else as written: unless force, only when nothing keeps it from running there (ServiceProblems, which it returns either way). moved says whether it was.

func (*Workspace) NewSession

func (w *Workspace) NewSession() (api.SessionInfo, error)

NewSession starts a new session for the active agent and makes it active. It is named after its first prompt.

func (*Workspace) OnSettingsChanged

func (w *Workspace) OnSettingsChanged(f func()) (stop func())

OnSettingsChanged calls f after the rules or approvals changed on disk and were applied, until the returned function is called.

func (*Workspace) OpenDocument added in v0.5.0

func (w *Workspace) OpenDocument(ctx context.Context, client, p, text string, version int64, block *CodeBlock) (lsp.DocumentInfo, error)

OpenDocument opens the workspace file p (relative) for client's editor, with its text as the editor has it; or, with block, a code block in the Markdown file p, as a file of its own that's never written. In an untrusted workspace the document isn't opened: the state says why.

func (*Workspace) OpenSession

func (w *Workspace) OpenSession(resume string, cont bool) (api.SessionInfo, bool, error)

OpenSession picks the session to use and points the audit log at it: the session resume names (an ID, or a snapshot to start a new session from), the most recent one in this workspace when cont is set or resume is "latest", or else a new session. It reports whether a session was resumed.

func (*Workspace) OpenTerminal added in v0.9.7

func (w *Workspace) OpenTerminal(dir string, cols, rows uint16, version string) (*terminal.Terminal, error)

OpenTerminal starts the person's shell in dir, a folder in the workspace ("" for the workspace itself), at cols×rows (TRM-01, TRM-04). version is Blitz's, for TERM_PROGRAM_VERSION.

func (*Workspace) PendingTaskRequests

func (w *Workspace) PendingTaskRequests() []api.TaskRequest

PendingTaskRequests are the background tasks' approval requests and questions waiting for an answer.

func (*Workspace) PendingTaskRequestsIn

func (w *Workspace) PendingTaskRequestsIn(sessions []string) []api.TaskRequest

PendingTaskRequestsIn are those of sessions' tasks.

func (*Workspace) PermissionsProblem added in v0.3.0

func (w *Workspace) PermissionsProblem() error

PermissionsProblem is why some of the settings' permission rules were left out at the last reload, or nil when all apply. Until they're fixed those rules aren't enforced, and the workspace won't open with them at the next start.

func (*Workspace) PictureModels added in v0.9.4

func (w *Workspace) PictureModels(ctx context.Context) []PictureModel

PictureModels are the models Pictures offers (PIC-04): the images model first (whichever it is), then the catalog's with the Gemini provider's credentials.

func (*Workspace) PictureSession added in v0.9.4

func (w *Workspace) PictureSession(id string) (PictureSession, error)

PictureSession is session id.

func (*Workspace) PictureSessions added in v0.9.4

func (w *Workspace) PictureSessions() ([]PictureSession, error)

PictureSessions are the workspace's picture sessions, newest first.

func (*Workspace) PicturesFolder added in v0.9.4

func (w *Workspace) PicturesFolder() string

PicturesFolder is where pictures are saved: images folder, else pictures.

func (*Workspace) PinModel

func (w *Workspace) PinModel(ctx context.Context, agent, ref string) (api.PinResult, error)

PinModel runs agent on ref from now on and saves the pin in the workspace's own settings (over any global pin).

func (*Workspace) PlanSpec added in v0.9.4

func (w *Workspace) PlanSpec(p string) (api.SpecPlan, error)

PlanSpec is how the saved spec at p would be implemented (SDD-30): its requirements not implemented yet (by the ledger's last verification), the dependencies not done it waits for, and the prompt for an agent: tests first from Done when, each requirement's ID cited where it's done.

func (*Workspace) PreviewSessionModel added in v0.9.2

func (w *Workspace) PreviewSessionModel(ctx context.Context, id, ref string) (api.ModelPreview, error)

PreviewSessionModel says what moving session id to ref would mean, without moving it: what the next turn reads again and costs, whether the conversation is compacted first, and what the model can't do.

func (*Workspace) ProcessOutput

func (w *Workspace) ProcessOutput(sessions []string, id int) (string, api.ProcessInfo, error)

ProcessOutput is the captured output and status of background process id, when one of sessions started it (else api.ErrUnknownProcess).

func (*Workspace) Processes

func (w *Workspace) Processes() api.Processes

Processes are the workspace's background processes.

func (*Workspace) ProjectAgentsDir

func (w *Workspace) ProjectAgentsDir() string

ProjectAgentsDir is the folder of the workspace's own agents.

func (*Workspace) ProjectEvalsDir added in v0.7.1

func (w *Workspace) ProjectEvalsDir() string

ProjectEvalsDir is where the workspace's evals are: .agents/evals.

func (*Workspace) ProjectGuardrailsDir added in v0.7.1

func (w *Workspace) ProjectGuardrailsDir() string

ProjectGuardrailsDir is where Studio writes the workspace's guardrails: .agents/guardrails.

func (*Workspace) ProjectRulesDir added in v0.7.1

func (w *Workspace) ProjectRulesDir() string

ProjectRulesDir is where Studio writes the workspace's rules: .agents/rules.

func (*Workspace) ProjectSettings

func (w *Workspace) ProjectSettings() api.ProjectSettings

ProjectSettings are the workspace's project settings, as they were when it opened, with the trust decision as it is now.

func (*Workspace) ProjectSkillsDir added in v0.7.1

func (w *Workspace) ProjectSkillsDir() string

ProjectSkillsDir is where Studio writes a new skill of the workspace's: .agents/skills.

func (*Workspace) ProjectWorkflowsDir added in v0.7.1

func (w *Workspace) ProjectWorkflowsDir() string

ProjectWorkflowsDir is where the workspace's workflows are: .agents/workflows.

func (*Workspace) PruneEnvs

func (w *Workspace) PruneEnvs() (api.PruneResult, error)

PruneEnvs removes environments no script the policy lets run needs, and incomplete ones.

func (*Workspace) Pull added in v0.6.4

func (w *Workspace) Pull(ctx context.Context) (PullResult, error)

Pull brings the upstream's commits into the branch as the repository's git config says (pull.rebase, pull.ff; a merge when neither is set), keeping uncommitted changes (--autostash). A pull that stops on conflicts isn't an error: its outcome is PullConflicts, and the merge or rebase waits for ResolveConflict and CompleteMerge (or AbortMerge).

func (*Workspace) Push added in v0.6.4

func (w *Workspace) Push(ctx context.Context) (string, api.GitStatus, error)

Push sends the branch's commits to its upstream; a branch without one is published to the remote ("origin", or the only one) under its own name, and tracks it from then on. It returns where it pushed, as "remote/branch".

func (*Workspace) ReadConnectorSchema added in v0.8.0

func (w *Workspace) ReadConnectorSchema(ctx context.Context, c connectors.Connection, values map[string]string) ([]connectors.Table, error)

ReadConnectorSchema reads a connection's tables and their columns, as written: connectors.ErrNoTables when it can read none.

func (*Workspace) ReadFile

func (w *Workspace) ReadFile(p string) (FileContent, error)

ReadFile opens the file p for the editor: binary files and files over the editor's limit come without their text.

func (*Workspace) ReadPicture added in v0.9.4

func (w *Workspace) ReadPicture(id, picture string) ([]byte, string, error)

ReadPicture is a picture of session id: one it made, or a reference kept with it (by its file name).

func (*Workspace) ReadPreview

func (w *Workspace) ReadPreview(p string) (string, []byte, error)

ReadPreview returns an image, PDF, sound or video file's bytes and media type, for the editor to show or play (FIL-54); a Word document's, its text as Markdown.

func (*Workspace) ReadSkillFile added in v0.7.1

func (w *Workspace) ReadSkillFile(name, rel string) ([]byte, error)

ReadSkillFile returns one of a skill's files (references/…, scripts/…, or one beside SKILL.md), for any skill the workspace sees.

func (*Workspace) ReadStoredFile added in v0.9.2

func (w *Workspace) ReadStoredFile(uri string) ([]byte, string, error)

ReadStoredFile reads a file in the attachment store by its reference (a file a model made: spec_056 CA-71): its bytes and type. fs.ErrNotExist when it isn't there; ErrUploadTooLarge over MaxStoredRead.

func (*Workspace) ReadTable added in v0.3.0

func (w *Workspace) ReadTable(ctx context.Context, q TableQuery) (TablePage, error)

ReadTable reads a page of a CSV or TSV file in the workspace (the table viewer, spec_029_files): streamed, so a file of any size can be paged, searched, filtered and sorted.

func (*Workspace) RecordSpecChange added in v0.9.4

func (w *Workspace) RecordSpecChange(ctx context.Context, p string) (api.SpecRecorded, error)

RecordSpecChange records the saved change to the approved spec at p (spec_057_spec_driven SDD-20): its Status: line says changed, and a diff from the approved text is kept in the ledger's diffs (not again when it's the same as the last one kept). A spec never approved, or unchanged since, records nothing.

func (*Workspace) ReflectDue added in v0.8.3

func (w *Workspace) ReflectDue(now time.Time) bool

ReflectDue reports whether the reflection schedule (harness reflect_schedule) wants a reflection now: its next time after the last reflection, scheduled or not. The schedule counts from when it's first seen, so turning it on doesn't reflect at once.

func (*Workspace) Reflection added in v0.8.3

func (w *Workspace) Reflection() (api.Reflection, error)

Reflection is what the harness has to learn, for the welcome screens (HE-05): the patterns since the last reflection, counted without a model (again only when the audit log changed), and the proposals waiting. It's empty without .agents/AGENTS.md or the audit log; the error is always nil (it's the remote's).

func (*Workspace) RefreshAgents

func (w *Workspace) RefreshAgents(ctx context.Context)

RefreshAgents loads the agents again if a file in their folders was added, changed or removed since they were loaded: a new agent is offered, an edited one's prompt, tools and model apply from the next turn, and a removed one is gone (the active agent falls back to blitz). Files that don't load are warnings.

func (*Workspace) Reindex added in v0.3.0

func (w *Workspace) Reindex() error

Reindex starts a scan for search and returns at once.

func (*Workspace) Reload added in v0.6.5

func (w *Workspace) Reload(ctx context.Context) (api.ReloadResult, error)

Reload reads the agents, skills, instruction files and rules again whether or not they look changed (/reload), rebuilds the agent with them, and says what it loaded and what didn't load. MCP servers and the project's settings aren't reloaded: opening the workspace again does.

func (*Workspace) ReloadConnectors added in v0.8.0

func (w *Workspace) ReloadConnectors(ctx context.Context) error

ReloadConnectors serves the connection files as they are now: each category's server starts, restarts with the changed files or secrets, or stops when there are none.

func (*Workspace) ReloadMCP added in v0.7.1

func (w *Workspace) ReloadMCP(ctx context.Context, cfg *config.Config) error

ReloadMCP applies cfg's MCP servers in place of the running ones, after a settings change: unchanged servers keep running, changed ones restart, disabled and removed ones stop, and the agents are built again so the next turn offers what's there now.

func (*Workspace) ReloadMemory

func (w *Workspace) ReloadMemory(ctx context.Context) ([]string, error)

ReloadMemory re-reads project instruction files into the engine and returns their paths.

func (*Workspace) ReloadPermissions

func (w *Workspace) ReloadPermissions(cfg *config.Config) error

ReloadPermissions applies cfg's [permissions] (global and the workspace's, and the built-in read-only rules if on) in place of the ones from the settings: after a settings change while a session runs. Session and flag rules stay; read rules apply from the next start. Rules that can't be read are left out, and PermissionsProblem says why until a reload applies them all.

func (*Workspace) ReloadProviders

func (w *Workspace) ReloadProviders(ctx context.Context, cfg *config.Config) error

ReloadProviders applies the provider settings (keys, endpoints, provider) of cfg, a fresh load of this workspace's settings, and rebuilds the model: a key set in the settings takes effect without reopening the workspace. It returns why the model still can't be built, if it can't.

func (*Workspace) ReloadSearch added in v0.3.0

func (w *Workspace) ReloadSearch(cfg *config.Config)

ReloadSearch applies cfg's search settings while the workspace is open: changed, the index is closed and opened again with them (an embedding model or the describer started or stopped); the same, nothing happens.

func (*Workspace) ReloadWorkerPolicy added in v0.7.1

func (w *Workspace) ReloadWorkerPolicy(cfg *config.Config)

ReloadWorkerPolicy applies cfg's [workers.policy] (Settings › Workers' limits) from the next listing or run (WK-63); a run going keeps the limits it started with.

func (*Workspace) RemoveEnv

func (w *Workspace) RemoveEnv(key string) error

RemoveEnv deletes one environment.

func (*Workspace) RemovePermissionRule

func (w *Workspace) RemovePermissionRule(rule string, save api.Scope) (api.PermissionChange, error)

RemovePermissionRule removes a rule (any effect) for this session and, with a scope, from that settings file. A project file's rule or a built-in one isn't removed: it's refused, naming where it's changed (spec_031 PRJ-41).

func (*Workspace) RenameFile

func (w *Workspace) RenameFile(ctx context.Context, from, to string) error

RenameFile moves from to to (a file or a folder); to must not exist.

func (*Workspace) RenamePictureSession added in v0.9.4

func (w *Workspace) RenamePictureSession(id, name string) (PictureSession, error)

RenamePictureSession names session id.

func (*Workspace) RenameSession

func (w *Workspace) RenameSession(title string) (api.SessionInfo, error)

RenameSession sets the active session's title. An empty title is refused.

func (*Workspace) RenderDocx added in v0.6.0

func (w *Workspace) RenderDocx(docPath, md string, diagrams map[string]Diagram) ([]byte, error)

RenderDocx writes markdown (a Markdown file's text, as the editor has it, or a conversation's) as a Word document, for the desktop app's Export as Word and /export (FS-75). Its images are read beside docPath, the file it belongs to ("" for none), as the editor reads them: the agent's path rules bind the agent, not the user. diagrams are its ```mermaid blocks as the caller drew them, by their text; one not there stays as code.

func (*Workspace) ReorderRules added in v0.7.1

func (w *Workspace) ReorderRules(names []string) error

ReorderRules numbers the named rules in .agents/rules in the order given (10, 20, 30…).

func (*Workspace) ResolveConflict added in v0.6.4

func (w *Workspace) ResolveConflict(ctx context.Context, p string, choice ConflictChoice) (api.GitStatus, error)

ResolveConflict settles a file a pull left in conflict: the branch's version, the remote's, or as edited (MarkResolved, refused while conflict markers remain). During a rebase git's "ours" is the remote's side, so mine and theirs are swapped for it. A side that deleted the file deletes it.

func (*Workspace) RestartLanguageServer added in v0.5.0

func (w *Workspace) RestartLanguageServer(language string) error

RestartLanguageServer stops language's server; the next request starts it again.

func (*Workspace) RestartMCPServer added in v0.7.1

func (w *Workspace) RestartMCPServer(ctx context.Context, name string) error

RestartMCPServer stops the MCP server named name and starts it afresh when the next turn lists its tools.

func (*Workspace) Restore added in v0.6.0

func (w *Workspace) Restore(ctx context.Context, p, rev, version string, preview bool) (string, []RestoredFile, error)

Restore puts p back as it was in rev: a file as RestoreFileRevision does (its new version), a folder or the workspace as RestoreFolder does (the files it put back, or would with preview).

func (*Workspace) RestoreFile added in v0.9.7

func (w *Workspace) RestoreFile(ctx context.Context, id, p string) error

RestoreFile puts back what TrashFile moved to the trash under id, at p (where it was); p must not exist.

func (*Workspace) RestoreFileRevision added in v0.6.0

func (w *Workspace) RestoreFileRevision(ctx context.Context, p, rev, version string) (string, error)

RestoreFileRevision makes the file p as it was in rev, unless it changed since version (its version as the caller last saw it, FileVersion; "" when it doesn't exist). The index is left alone, so the restore shows as a change to commit or discard.

func (*Workspace) RestoreFolder added in v0.6.0

func (w *Workspace) RestoreFolder(ctx context.Context, p, rev string, preview bool) ([]RestoredFile, error)

RestoreFolder puts the files under the folder p ("" the workspace) back as they were in rev: those changed since, and those deleted since. Files added since are kept. With preview, it only says which it would put back. The index is left alone.

func (*Workspace) ResumeFlow added in v0.7.1

func (w *Workspace) ResumeFlow(ctx context.Context, taskID string, answer map[string]any, on func(api.Event)) (api.TurnResult, error)

ResumeFlow answers a paused run's task and runs it on from there (the form's values, or {fired_at} for a timer), its agent steps in the chat it started in. A run whose workflow changed since it paused isn't resumed; its record goes. A job's run resumes only while the job is enabled as it is (WK-05b): its workflow and the permissions its steps grant are read once, from the bytes its hash covers.

func (*Workspace) RetryModel

func (w *Workspace) RetryModel(ctx context.Context) error

RetryModel builds the models again when the configured one couldn't be built: what it lacked may have appeared since, above all a sign-in made outside Blitz (gcloud's Application Default Credentials, an `ant auth login` profile), which no settings change announces. It does nothing while the model works.

func (*Workspace) ReviewSpec added in v0.9.4

func (w *Workspace) ReviewSpec(ctx context.Context, p, text string, judge bool) (api.SpecReview, error)

ReviewSpec reviews the spec at p (its text as edited): the checks without a model (SDD-02), and with judge the model's review too (SDD-03), which can fail on its own: Problem says why.

func (*Workspace) RevisionDiff added in v0.6.0

func (w *Workspace) RevisionDiff(ctx context.Context, p, rev, other string, against DiffAgainst) (diff string, truncated bool, err error)

RevisionDiff returns a unified diff for p (a file, a folder, "" the workspace): from rev to now, rev's own changes, or from rev to other. truncated says it was cut at 2 MB, at a line.

func (*Workspace) RevokeApprovals

func (w *Workspace) RevokeApprovals(keys ...string) (int, error)

RevokeApprovals removes approvals by key, for this session and from the saved ones, and returns how many keys it was given. Saved ones that couldn't be removed from the file are an ErrApprovalsStillSaved naming them: they're gone for now but come back at the next start.

func (*Workspace) Rewind

func (w *Workspace) Rewind(ctx context.Context, index int, mode api.RewindMode, force bool) (api.RewindResult, error)

Rewind takes the active session back to the prompt at transcript index index. Files are restored first (refusing on conflicts unless force), so a refused rewind changes nothing; then the conversation is cut before the prompt, whose text is returned to send again.

func (*Workspace) RewindPoints

func (w *Workspace) RewindPoints() ([]api.RewindPoint, error)

RewindPoints lists the active session's prompts, oldest first.

func (*Workspace) RewriteWorker added in v0.6.4

func (w *Workspace) RewriteWorker(ctx context.Context, spec api.WorkerSpec) (WorkerRewrite, error)

RewriteWorker has the suggestions model (else the reviewer's, else the main one) rewrite a worker's instructions so an unattended run does the job well and quickly, and list the permissions they need. The spec is the form as the user has it: nothing is saved.

func (*Workspace) Rules added in v0.7.1

func (w *Workspace) Rules() []gates.Rule

Rules are the workspace's rules, gates first (in the order they run), then instruction rules, read afresh. With memory off, instruction rules are left out as instruction files are, but gates still judge: they're checks, not instructions, and the organization's locked ones can't be switched off (spec_053 EN-31).

func (*Workspace) Run

func (w *Workspace) Run(ctx context.Context, sessionID string, t api.Turn, on func(api.Event)) (api.TurnResult, error)

Run sends one prompt to the agent in the session and passes its events to on as they happen. It runs prompt_submit hooks, audits the prompt, starts a checkpoint for /undo and records both sides in the transcript. A refused prompt is a *BlockedError. A turn that fails part way still returns what it produced.

func (*Workspace) RunBlitzCommand added in v0.9.6

func (w *Workspace) RunBlitzCommand(ctx context.Context, name string, args map[string]any, confirm bool, secrets map[string]string) (api.BlitzRun, error)

RunBlitzCommand runs one of the catalog's commands for the CLI's blitz do (spec_060_blitz_tools DRV-02): help, or the command, its arguments checked. One that changes something answers with what the person confirms (and the secrets it needs) until confirm, with secrets.

func (*Workspace) RunConnectorQuery added in v0.9.4

func (w *Workspace) RunConnectorQuery(ctx context.Context, c connectors.Connection, values map[string]string, run connectors.QueryRun) (datatable.Table, error)

RunConnectorQuery runs a statement, or one of a connection's saved queries, on the connection as written, and reads its result as a table (spec_059_data DAT-50).

func (*Workspace) RunDataQuery added in v0.9.7

func (w *Workspace) RunDataQuery(ctx context.Context, q api.DataQuery) (api.DataTable, error)

RunDataQuery runs q read-only on the workspace's connection it names, found as a chat finds it: on, trusted and readable (DAT-44, DAT-45). Error messages are masked.

func (*Workspace) RunDetached

func (w *Workspace) RunDetached(ctx context.Context, t api.Turn, started func(sessionID string), on func(api.Event)) (api.TurnResult, error)

RunDetached runs a turn in a new session of its own (blitz --bg): as a worker's does, the session doesn't become the workspace's active one, so the people working there aren't moved to it. started gets the session's ID before the turn begins.

func (*Workspace) RunEval added in v0.7.1

func (w *Workspace) RunEval(ctx context.Context, name string, o api.EvalOptions) (api.EvalRun, error)

RunEval runs eval name: each case (or those o.Cases names) on each of its agents (the active one when it names none), one after another, and records the run. An eval with a problem, or that names no case asked for, isn't run.

func (*Workspace) RunSkillScript added in v0.7.1

func (w *Workspace) RunSkillScript(ctx context.Context, name, script string, args []string) api.ScriptRun

RunSkillScript runs one of a skill's scripts now, with args, as run_skill_script would (the policy, its sandbox and the permission rules' denials all apply): Studio's Test run, which the user starts, so its approvals are given.

func (*Workspace) RunUserShell added in v0.8.6

func (w *Workspace) RunUserShell(ctx context.Context, command string, out func([]byte)) (exitCode int, truncated bool, startErr error)

RunUserShell runs a command the user typed after "!" in a client that has no terminal of its own (the desktop app's chat), in the workspace: as the user, outside the agent's sandbox and approvals, unseen by the agent. Its output (stdout and stderr together, at most MaxUserShellOutput) goes to out as it comes; the audit log records it as the terminal's ! is (AuditShell). It returns the exit code (-1 when stopped: ctx's end kills its process group), whether output was cut, and why it didn't start.

func (*Workspace) RunWorker

func (w *Workspace) RunWorker(ctx context.Context, name string, o RunOptions) (api.Run, error)

RunWorker runs the named worker once, as its schedule would: in a session of its own, with only the permissions it declares and within its limits, recorded in the run log. The worker must be enabled; a scheduled run of one that isn't is recorded as skipped. A run of the same worker still going makes this ErrRunInProgress.

func (*Workspace) RunningProcesses added in v0.8.4

func (w *Workspace) RunningProcesses() []api.ProcessInfo

RunningProcesses are the background processes still running, ordered by ID, whichever session started them (the tray's Processes menu).

func (*Workspace) SandboxSummary

func (w *Workspace) SandboxSummary() []string

SandboxSummary describes the sandbox commands run in, one line each.

func (*Workspace) SaveConnector added in v0.8.0

func (w *Workspace) SaveConnector(ctx context.Context, c connectors.Connection, values map[string]string, previous string) (connectors.Connection, []string, error)

SaveConnector writes one of the workspace's connections from Studio's form, in place of previous ("" for a new one), keeping the secret values given; problems, with nothing written, when it can't be saved. Saving it trusts it as written (a renamed one's old trust goes). The servers restart with it. A global one is Settings' to change (ErrGlobalConnector, CON-18).

func (*Workspace) SaveEval added in v0.7.1

func (w *Workspace) SaveEval(e evals.Eval, previous string) (evals.Eval, []string, error)

SaveEval writes an eval in .agents/evals, returning it as read back, or the problems that keep it from being saved.

func (*Workspace) SaveGuardrail added in v0.7.1

func (w *Workspace) SaveGuardrail(spec GuardrailSpec, previous string) (gates.Guardrail, []string, error)

SaveGuardrail writes a guardrail in .agents/guardrails (a built-in's file holds its settings, or switches it off), returning it as read back, or the problems.

func (*Workspace) SavePicture added in v0.9.4

func (w *Workspace) SavePicture(ctx context.Context, id, picture, p string) (string, error)

SavePicture writes session id's picture into the workspace (PIC-51): to p when given (a folder, ending in /, takes a name), else to folder (or images folder, else pictures/), named from its prompt and numbered, never overwriting. It returns the path written.

func (*Workspace) SaveRule added in v0.7.1

func (w *Workspace) SaveRule(spec RuleSpec, previous string) (gates.Rule, []string, error)

SaveRule writes a rule in .agents/rules (previous: the rule edited, "" for a new one), returning it as read back, or the problems that keep it from being saved.

func (*Workspace) SaveSkill added in v0.7.1

func (w *Workspace) SaveSkill(spec api.SkillSpec, previous, hash string) (api.SkillFile, []string, error)

SaveSkill writes a skill of the workspace's from spec: a new one in .agents/skills (previous ""), or the one named previous, renamed when the name differs, if its SKILL.md still has hash. Problems are returned, with nothing written, when it can't be saved.

func (*Workspace) SaveSkillScenario added in v0.8.0

func (w *Workspace) SaveSkillScenario(skill string, sc skills.Scenario, previous string) (skills.Scenario, []string, error)

SaveSkillScenario writes one of a workspace skill's scenarios (previous "" for a new one), returning it as read back, or the problems that keep it from being saved.

func (*Workspace) SaveSnapshot

func (w *Workspace) SaveSnapshot(name string, force bool) (api.SessionInfo, error)

SaveSnapshot saves a copy of the active session under name. Snapshots are never continued in place: loading one starts a new session from it.

func (*Workspace) SaveWorkflow added in v0.7.1

func (w *Workspace) SaveWorkflow(f flows.Flow, previous string) (flows.Flow, []string, error)

SaveWorkflow writes a workflow in .agents/workflows, returning it as read back, or the problems that keep it from being saved.

func (*Workspace) ScheduledHealthCheck added in v0.7.1

func (w *Workspace) ScheduledHealthCheck(ctx context.Context, starting func(item string, index, total int)) error

ScheduledHealthCheck runs the schedule's check: what changed, if its estimate is within health max_cost_usd (else it records why not).

func (*Workspace) ScheduledReflect added in v0.8.3

func (w *Workspace) ScheduledReflect(ctx context.Context) error

ScheduledReflect runs the schedule's reflection (HE-06): the reflector reads the evidence and keeps the changes it would offer for /reflect, in a read-only session of its own, deleted after, within harness max_cost_usd. Nothing in the workspace changes. Without new patterns since the last one, it doesn't run.

func (*Workspace) Search added in v0.3.0

Search searches the workspace's index (spec_035_search).

func (*Workspace) SearchProvider

func (w *Workspace) SearchProvider() (string, error)

SearchProvider names the web search provider, or ErrNoFetch.

func (*Workspace) SearchSession

func (w *Workspace) SearchSession(terms string) (found int, prompt string)

SearchSession looks for terms in the active session's transcript (which keeps what compaction removed from the model's context) and returns how many passages matched and the prompt that asks the agent about them.

func (*Workspace) SearchSkills

func (w *Workspace) SearchSkills(query string) []api.SkillInfo

SearchSkills returns the skills matching query.

func (*Workspace) SearchStatus added in v0.3.0

func (w *Workspace) SearchStatus() api.SearchStatus

SearchStatus is how the workspace's index is, with the settings it follows (even off) and what kept them from applying in full.

func (*Workspace) SearchWeb

func (w *Workspace) SearchWeb(ctx context.Context, terms string) (api.WebSearch, error)

SearchWeb searches the web for terms and prepares the agent's prompt from the results it can read.

func (*Workspace) ServiceProblems added in v0.9.0

func (w *Workspace) ServiceProblems(name string) ([]string, error)

ServiceProblems says what keeps the job name from running on the organization's service as it runs here (spec_053_enterprise EN-41): an MCP server that's a program on this computer or at a local address, a connector reaching this computer, a file outside the workspace, or a local address in the job itself. None means it can move.

func (*Workspace) SessionDiff

func (w *Workspace) SessionDiff() string

SessionDiff is a unified diff of every file the agent changed in the active session, against its state before the first change ("" when none). Checkpoints persist, so this spans the session's earlier runs.

func (*Workspace) SessionLedger added in v0.9.2

func (w *Workspace) SessionLedger() ([]api.Call, api.Totals, error)

SessionLedger returns the active session's calls, oldest first (what it spent before its ledger was kept as one, at the head), and their totals by model and purpose (spec_056 CA-120, CA-121).

func (*Workspace) SessionLedgerOf added in v0.9.2

func (w *Workspace) SessionLedgerOf(id string) ([]api.Call, api.Totals, error)

SessionLedgerOf is SessionLedger for saved session id, active or not; api.ErrSessionNotFound for an ID with no saved session.

func (*Workspace) SessionModel added in v0.9.2

func (w *Workspace) SessionModel(id string) string

SessionModel is session id's own model ("" when it runs on the workspace's).

func (*Workspace) SessionTools added in v0.7.1

func (w *Workspace) SessionTools(id string) ([]api.SessionTool, error)

SessionTools are the tool calls session id made, in order, each with its result and the prompt it ran under, read from its event log (a session with none, or none recorded, has none).

func (*Workspace) SessionUsage

func (w *Workspace) SessionUsage() (api.Usage, error)

SessionUsage returns the active session's usage.

func (*Workspace) Set

func (w *Workspace) Set(ctx context.Context, key, value string) (string, error)

Set changes a setting for this session ("agency" or "agency_level") and returns the key in canonical form. The agents' instructions embed it, so they are rebuilt.

func (*Workspace) SetAgent

func (w *Workspace) SetAgent(ctx context.Context, name string) (api.AgentInfo, error)

SetAgent makes name the active agent.

func (*Workspace) SetConnectorOn added in v0.8.0

func (w *Workspace) SetConnectorOn(ctx context.Context, category, scope, name string, on bool) error

SetConnectorOn turns a connection on or off in this workspace (CON-17; connectors.ErrUnknown when it isn't there): one that's off keeps its file and secrets, Studio can still test it, and the agents here don't get its tools. Its category's server is served again.

func (*Workspace) SetGoal

func (w *Workspace) SetGoal(condition string) (api.Goal, error)

SetGoal gives the active session a goal (replacing its goal, if any).

func (*Workspace) SetLocale

func (w *Workspace) SetLocale(ctx context.Context, input string) (api.LocaleChange, error)

SetLocale switches the language the model replies in, for this workspace, and saves it as ui.locale in the config file. input is a language tag or name. The interface language belongs to the client: a front end switches its own (i18n.SetCurrent) with the returned Tag.

func (*Workspace) SetModel

func (w *Workspace) SetModel(ctx context.Context, ref string) (activePin string, err error)

SetModel switches every unpinned agent to ref (a name or "provider/model"). It returns the active agent's pin when there is one, since that still decides what the active agent runs on.

func (*Workspace) SetPermissionMode

func (w *Workspace) SetPermissionMode(mode string) (string, error)

SetPermissionMode changes which actions run without asking, for every session of the workspace, and returns the mode's canonical name. Bypass needs the OS sandbox (ErrBypassNeedsSandbox). Auto, while a local model would review its own actions, is default instead (APR-14c): the name returned says so, and Settings' ModeNote why.

func (*Workspace) SetSessionModel added in v0.9.2

func (w *Workspace) SetSessionModel(ctx context.Context, id, ref string) (api.ModelPreview, error)

SetSessionModel moves session id to ref from its next turn ("" back to the workspace's model), compacting it first when it wouldn't fit, and returns what the move means (PreviewSessionModel).

func (*Workspace) SetUI

func (w *Workspace) SetUI(approve api.Approver, ask api.UserPromptFunc)

SetUI routes approval requests and questions to the front end.

func (*Workspace) Settings

func (w *Workspace) Settings() api.Settings

Settings returns the current settings.

func (*Workspace) SettingsChanges

func (w *Workspace) SettingsChanges(ctx context.Context) <-chan struct{}

SettingsChanges is a channel that hears of settings changes (at most one pending) until ctx ends.

func (*Workspace) Skill

func (w *Workspace) Skill(name string) (api.SkillInfo, bool)

Skill returns the named skill.

func (*Workspace) SkillScenarios added in v0.8.0

func (w *Workspace) SkillScenarios(name string) ([]skills.Scenario, error)

SkillScenarios are a skill's scenarios: any skill the workspace sees.

func (*Workspace) Skills

func (w *Workspace) Skills() *skills.Provider

Skills returns the skills provider.

func (*Workspace) SnoozeReflection added in v0.8.4

func (w *Workspace) SnoozeReflection(now time.Time)

SnoozeReflection holds off the chat's suggestion to reflect for a week from now: its Not now (HE-63).

func (*Workspace) StartCompose added in v0.7.1

func (w *Workspace) StartCompose(ctx context.Context, kind, request, current string) (*compose.Session, error)

StartCompose starts a composer conversation for kind with the user's request (current: the component being changed, as its file, or "") and runs its first turn.

func (*Workspace) StatFiles

func (w *Workspace) StatFiles(paths []string) map[string]string

StatFiles returns each file's version, "" for one that's gone (or isn't a readable file). Files over the editor's limit get their size and time instead of a hash.

func (*Workspace) Steer

func (w *Workspace) Steer(ctx context.Context, sessionID, text string) error

Steer queues a message for the agent while a turn runs in the session; the agent reads it with its next tool result. prompt_submit hooks apply, as to any prompt (a refusal is a *BlockedError), and the transcript records it.

func (*Workspace) StopProcess added in v0.8.4

func (w *Workspace) StopProcess(id int) (api.ProcessInfo, error)

StopProcess stops background process id and its descendants, whichever session started it: the user's own stop.

func (*Workspace) StopTask

func (w *Workspace) StopTask(id string) (api.TaskInfo, error)

StopTask stops background task id.

func (*Workspace) StopTaskIn

func (w *Workspace) StopTaskIn(sessions []string, id string) (api.TaskInfo, error)

StopTaskIn stops task id, when one of sessions (nil: any) started it.

func (*Workspace) Storage

func (w *Workspace) Storage() *session.Storage

Storage returns the saved-session store, scoped to this workspace.

func (*Workspace) StorageDir added in v0.7.1

func (w *Workspace) StorageDir() string

StorageDir is where the workspace keeps sessions (and paused runs' records, under it).

func (*Workspace) Suggestions

func (w *Workspace) Suggestions(ctx context.Context) api.Suggestions

Suggestions returns the workspace's welcome tiles: setup when it has no agent instructions, an update of the skills and agents when the specification changed after them or their runs went wrong since they changed, /reflect when its runs show what to learn, the latest conversation, uncommitted changes and a failed worker, then up to three ideas from the recent conversations. When those changed since the ideas were written, new ones are written in the background (Pending) and the earlier ones are returned meanwhile.

func (*Workspace) SwitchBranch added in v0.6.5

func (w *Workspace) SwitchBranch(ctx context.Context, name string) (api.GitStatus, error)

SwitchBranch checks out branch name, carrying uncommitted changes along when they don't clash with it (ErrLocalChanges when they do). A remote's branch ("origin/feature") gets a local branch that tracks it, as git switch does.

func (*Workspace) TakeProcessNotices

func (w *Workspace) TakeProcessNotices(session string) []string

TakeProcessNotices removes and returns the notices waiting for session (the REPL starts a turn with them).

func (*Workspace) Task

func (w *Workspace) Task(id string) (api.TaskInfo, []string, error)

Task is background task id with its latest events, in words.

func (*Workspace) TaskIn

func (w *Workspace) TaskIn(sessions []string, id string) (api.TaskInfo, []string, error)

TaskIn is task id with its latest events, when one of sessions (nil: any) started it (else api.ErrUnknownTask).

func (*Workspace) Terminals added in v0.9.7

func (w *Workspace) Terminals() *terminal.Manager

Terminals are the workspace's terminals (spec_062_terminal), made when first asked for and closed with the workspace (TRM-03).

func (*Workspace) TestConnector added in v0.8.0

func (w *Workspace) TestConnector(ctx context.Context, c connectors.Connection, values map[string]string) ([]connectors.ToolInfo, error)

TestConnector connects to a connection as written and lists its tools.

func (*Workspace) Tools

func (w *Workspace) Tools() *tools.Registry

Tools returns the tool registry: workspace, approvals, processes, MCP, hooks.

func (*Workspace) TraceSpecs added in v0.9.4

func (w *Workspace) TraceSpecs(p string) ([]api.SpecRequirement, error)

TraceSpecs is the requirements of the spec at p ("" for every spec, in order) as the ledger traces them (spec_057_spec_driven SDD-10).

func (*Workspace) TrashFile added in v0.9.7

func (w *Workspace) TrashFile(ctx context.Context, p string) (string, error)

TrashFile moves p (a file or a folder) to the workspace's trash and returns the ID that restores it (RestoreFile). Items older than a day are emptied first.

func (*Workspace) TrustProject

func (w *Workspace) TrustProject(hash string, trusted bool) error

TrustProject records trusting or declining the workspace's project settings as they are now (their hash): they load when it next opens.

func (*Workspace) TryConnectorTool added in v0.8.0

func (w *Workspace) TryConnectorTool(ctx context.Context, c connectors.Connection, values map[string]string, tool string, args map[string]any) (string, bool, error)

TryConnectorTool runs one of a connection's tools, as written, with args.

func (*Workspace) TryGuardrail added in v0.7.1

func (w *Workspace) TryGuardrail(ctx context.Context, g gates.Guardrail, sample string) (gates.Verdict, error)

TryGuardrail judges a sample against a guardrail as written (Studio's Try it): a custom one by the judge; the built-in injection and secrets ones by their patterns.

func (*Workspace) TrySkill added in v0.8.0

func (w *Workspace) TrySkill(ctx context.Context, skill, agent, prompt string, force bool) (api.SkillTry, error)

TrySkill runs prompt once on agent (SK-112): with the skill only offered, to see whether the agent uses it, or, forced, given to it. It saves nothing.

func (*Workspace) Undo

func (w *Workspace) Undo(session string, force bool) (api.UndoResult, error)

Undo restores the files session's latest turn with changes modified ("": the active session's), counting its sub-agents' and tasks', and audits it. Other sessions' turns are left alone, even when the session has nothing to undo. A partial restore returns both what was restored and why the rest wasn't.

func (*Workspace) UndoWorkerRun

func (w *Workspace) UndoWorkerRun(runID string, force bool) (api.UndoResult, error)

UndoWorkerRun restores the files worker run runID changed, as they were before it (BL-WK-02), with /undo's conflict rules.

func (*Workspace) Unpin

func (w *Workspace) Unpin(ctx context.Context, agent string) (api.PinResult, error)

Unpin returns agent to the configured model, or to its own default_model if it declares one, and removes the pin from the workspace's settings.

func (*Workspace) UpdateModelSettings

func (w *Workspace) UpdateModelSettings(ref string, reset bool, changes []api.Setting) (api.ModelSettingsChange, error)

UpdateModelSettings applies changes to ref's settings (reset clears them all first). They apply from the next model call and are saved in the config file, under the key it already uses for the model if any.

func (*Workspace) UpdateWorker

func (w *Workspace) UpdateWorker(spec api.WorkerSpec, hash string) (api.WorkerInfo, []string, error)

UpdateWorker rewrites a worker's WORKER.md from spec, if its files still have hash (api.ErrHashMismatch otherwise: they changed since they were read) and the result loads as a valid worker; otherwise it writes nothing and returns why. The name, its directory, can't change. The new content has a new hash, so an enabled worker is suspended until it's enabled again, as after any edit.

func (*Workspace) UploadFile added in v0.8.4

func (w *Workspace) UploadFile(ctx context.Context, p, id string, data []byte, done, replace bool) (string, string, error)

UploadFile writes a file the user dropped into the Files view in chunks, since a request carries at most 32 MiB (FIL-22). A call with id "" starts it; each call adds data; the call with done puts the file at p, which must not exist unless replace (a folder is never replaced). It returns the upload's id and, when done, the file's version. A failed call ends the upload; one left ten minutes without a chunk is dropped.

func (*Workspace) UsageOf

func (w *Workspace) UsageOf(sessionID string) api.Usage

UsageOf returns a session's usage, whichever is active.

func (*Workspace) VerifySpec added in v0.9.4

func (w *Workspace) VerifySpec(ctx context.Context, p string, judge, estimate bool) (api.SpecVerification, error)

VerifySpec verifies the saved spec at p (SDD-12): each requirement's ID found in the work, traced or untraced; with judge, the suggestions model's verdict from that evidence (implemented, partial, missing, contradicted); with estimate, only what judging would cost, nothing written. The ledger keeps the result.

func (*Workspace) WatchAgentBrowser added in v0.8.4

func (w *Workspace) WatchAgentBrowser(ctx context.Context, send func(api.AgentBrowserCommand) error) error

WatchAgentBrowser makes the caller (a desktop window, through the service) a host of the agent's browser views until ctx ends: each command for them goes to send, in order. The newest window hosts new views; when a window goes, the views it hosted close.

func (*Workspace) WatchDiagnostics added in v0.5.0

func (w *Workspace) WatchDiagnostics(ctx context.Context, client string, send func(lsp.DocumentDiagnostics) error) error

WatchDiagnostics sends client's documents' diagnostics to send until ctx ends or send fails.

func (*Workspace) WatchFolders added in v0.9.7

func (w *Workspace) WatchFolders(ctx context.Context, folders []string, send func(FolderChanges) error) error

WatchFolders watches folders of the workspace (relative paths, "" for its root; the Files shelf's open folders) until ctx ends, sending which changed. The first send has no folders: the watch is on. Folders it can't watch are reported once as Polling; .git and paths outside the workspace are never watched.

func (*Workspace) WatchTasks

func (w *Workspace) WatchTasks(ctx context.Context, sessions []string) <-chan api.SessionEvent

WatchTasks sends the events of sessions' tasks until ctx ends.

func (*Workspace) WorkerRuns

func (w *Workspace) WorkerRuns(name string, limit int) ([]api.Run, error)

WorkerRuns returns a worker's recorded runs, newest first.

func (*Workspace) Workflows added in v0.7.1

func (w *Workspace) Workflows() []flows.Flow

Workflows are the workspace's workflows, read afresh, by name; one in a loop of workflows calling each other, or calling one that isn't there, or with a Data step that can't run here, has that as its problem.

func (*Workspace) WriteBinaryFile added in v0.2.1

func (w *Workspace) WriteBinaryFile(ctx context.Context, p string, data []byte, version string) (string, error)

WriteBinaryFile is WriteFile for bytes: a PDF the editor exported.

func (*Workspace) WriteFile

func (w *Workspace) WriteFile(ctx context.Context, p, text, version string) (string, error)

WriteFile writes text to p if the file still has version ("" when it must not exist yet), and returns the new version. Otherwise it returns a *FileChangedError.

func (*Workspace) WriteSkillFile added in v0.7.1

func (w *Workspace) WriteSkillFile(name, rel string, data []byte) (api.SkillFile, error)

WriteSkillFile writes one of a workspace skill's files, under references/ or scripts/, and returns the skill as it is then.

Directories

Path Synopsis
Package agents loads the agents a workspace offers: the built-in ones and Markdown files with YAML frontmatter from ~/.blitz/agents, the project's .agents/agents (prompt text, loaded without trust; a project's agent may loosen the permission mode only once the project is trusted) and enabled plugins, each a name, a description, a system prompt, the tools it may use and optionally its own model (spec_014_agents).
Package agents loads the agents a workspace offers: the built-in ones and Markdown files with YAML frontmatter from ~/.blitz/agents, the project's .agents/agents (prompt text, loaded without trust; a project's agent may loosen the permission mode only once the project is trusted) and enabled plugins, each a name, a description, a system prompt, the tools it may use and optionally its own model (spec_014_agents).
builtin
Package builtin holds the agents Blitz ships with, as Markdown files embedded in the binary.
Package builtin holds the agents Blitz ships with, as Markdown files embedded in the binary.
Package atomicfile replaces a file whole: readers see the old content or the new, never part of it, even after a crash part way through.
Package atomicfile replaces a file whole: readers see the old content or the new, never part of it, even after a crash part way through.
Package audit writes an append-only JSONL record of what tools did and what the user approved or denied.
Package audit writes an append-only JSONL record of what tools did and what the user approved or denied.
Package breaker is a small circuit breaker for dependencies that fail persistently (MCP servers, model APIs): after a run of failures calls are refused for a cooldown that grows with each failed trial.
Package breaker is a small circuit breaker for dependencies that fail persistently (MCP servers, model APIs): after a run of failures calls are refused for a cooldown that grows with each failed trial.
Package browser drives a Chromium-family browser through the Chrome DevTools Protocol for the agent's browser tool (spec_027_parity §5.2): its own throwaway profile, never the user's, with every request it makes going through a proxy that applies the web rules.
Package browser drives a Chromium-family browser through the Chrome DevTools Protocol for the agent's browser tool (spec_027_parity §5.2): its own throwaway profile, never the user's, with every request it makes going through a proxy that applies the web rules.
browsertest
Package browsertest is a fake DevTools page, to test code driving a browser without one: it answers the commands package browser sends as a simple page would, and records them.
Package browsertest is a fake DevTools page, to test code driving a browser without one: it answers the commands package browser sends as a simple page would, and records them.
Package commands loads custom slash commands: Markdown files whose body is a prompt, from the user's and the project's command directories, plus the bundled ones.
Package commands loads custom slash commands: Markdown files whose body is a prompt, from the user's and the project's command directories, plus the bundled ones.
Package compose is the composer (spec_045_composer): a guided conversation that makes a workspace's component.
Package compose is the composer (spec_045_composer): a guided conversation that makes a workspace's component.
Package connectors is how Blitz's agents reach the systems a team works with (spec_047_connectors): databases now, email and others later.
Package connectors is how Blitz's agents reach the systems a team works with (spec_047_connectors): databases now, email and others later.
builtin
Package builtin holds the connector descriptors Blitz ships with (spec_047_connectors): categories/<id>.yaml and kinds/<id>.yaml, embedded in the binary.
Package builtin holds the connector descriptors Blitz ships with (spec_047_connectors): categories/<id>.yaml and kinds/<id>.yaml, embedded in the binary.
Package databases is the connectors' toolbox backend (spec_046_databases, spec_047_connectors): MCP Toolbox for Databases, run inside Blitz's process (third_party/mcp-toolbox/embed), serving a category's connection files (Toolbox YAML: sources, tools, toolsets) as one MCP server, its tools named <prefix>__<tool> (db__shop_list_tables).
Package databases is the connectors' toolbox backend (spec_046_databases, spec_047_connectors): MCP Toolbox for Databases, run inside Blitz's process (third_party/mcp-toolbox/embed), serving a category's connection files (Toolbox YAML: sources, tools, toolsets) as one MCP server, its tools named <prefix>__<tool> (db__shop_list_tables).
Package datatable is a query's result in one shape every step and chat can read (spec_059_data DAT-01..DAT-05): its columns with portable types, its rows as arrays in the columns' order, its values as JSON's.
Package datatable is a query's result in one shape every step and chat can read (spec_059_data DAT-01..DAT-05): its columns with portable types, its rows as arrays in the columns' order, its values as JSON's.
Package evals reads and writes eval files (spec_042_evals): cases, each a prompt and the output expected of it, in a Markdown table in .agents/evals/<name>.md; scores an agent's output against a case; and keeps the runs.
Package evals reads and writes eval files (spec_042_evals): cases, each a prompt and the output expected of it, in a Markdown table in .agents/evals/<name>.md; scores an agent's output against a case; and keeps the runs.
Package flows reads, checks and writes workflows (spec_043_workflows): steps joined into a graph, in .agents/workflows/<name>.flow.yaml, beside the .md commands there.
Package flows reads, checks and writes workflows (spec_043_workflows): steps joined into a graph, in .agents/workflows/<name>.flow.yaml, beside the .md commands there.
Package frontmatter reads and edits the YAML front matter of Markdown files (SKILL.md, rules) the way Studio's forms do: the fields a form edits are set, or removed when empty, and every other field is kept, in its order.
Package frontmatter reads and edits the YAML front matter of Markdown files (SKILL.md, rules) the way Studio's forms do: the fields a form edits are set, or removed when empty, and every other field is kept, in its order.
Package gates is the rules that gate an agent's turn (spec_041_gates): checks written in plain English in .agents/rules/<name>.md, with front matter when: before_agent or after_agent, judged in order by a model before the agent runs (on the prompt) or after (on its answer and the files it changed), each blocking, warning or asking for a revision.
Package gates is the rules that gate an agent's turn (spec_041_gates): checks written in plain English in .agents/rules/<name>.md, with front matter when: before_agent or after_agent, judged in order by a model before the agent runs (on the prompt) or after (on its answer and the files it changed), each blocking, warning or asking for a revision.
Package harness is what a workspace's harness learns from its runs (spec_048_harness_learning): the evidence of what went wrong in its sessions, drawn from the audit log without a model, for the reflector and /skills update and /agents update to propose changes from.
Package harness is what a workspace's harness learns from its runs (spec_048_harness_learning): the evidence of what went wrong in its sessions, drawn from the audit log without a model, for the reflector and /skills update and /agents update to propose changes from.
Package health is a workspace's dashboard (spec_044_health): the facts about what it holds and how its runs go, taken from what it already records (no model call), and the judge's verdicts on each item's quality, kept with their history.
Package health is a workspace's dashboard (spec_044_health): the facts about what it holds and how its runs go, taken from what it already records (no model call), and the judge's verdicts on each item's quality, kept with their history.
Package jsonl appends records to the JSON Lines files Blitz keeps (sessions' transcripts and events, jobs' runs) so that a crash part way through a write costs only the record it tore.
Package jsonl appends records to the JSON Lines files Blitz keeps (sessions' transcripts and events, jobs' runs) so that a crash part way through a write costs only the record it tore.
lsp
Package lsp talks to language servers for the agent's code intelligence (spec_027_parity PAR-TOOL-03): definitions, references, hover, symbols and diagnostics, from servers started lazily per language.
Package lsp talks to language servers for the agent's code intelligence (spec_027_parity PAR-TOOL-03): definitions, references, hover, symbols and diagnostics, from servers started lazily per language.
lsptest
Package lsptest is a fake language server for tests: the test binary runs it when started with BLITZ_FAKE_LSP=1 (call MaybeServe first in TestMain), and Launcher starts that.
Package lsptest is a fake language server for tests: the test binary runs it when started with BLITZ_FAKE_LSP=1 (call MaybeServe first in TestMain), and Launcher starts that.
Package mdpdf typesets Markdown as a PDF in pure Go, for the export_pdf tool (spec_006_filetools): GitHub-flavoured Markdown parsed by goldmark, laid out with fpdf in embedded Noto fonts, with an outline of the headings, page numbers, tables, highlighted code and the images the caller lets it read.
Package mdpdf typesets Markdown as a PDF in pure Go, for the export_pdf tool (spec_006_filetools): GitHub-flavoured Markdown parsed by goldmark, laid out with fpdf in embedded Noto fonts, with an outline of the headings, page numbers, tables, highlighted code and the images the caller lets it read.
Package memory loads project instruction files (AGENTS.md, CLAUDE.md, GEMINI.md, BLITZ.md), the files they import, and rule files, which are added to the agents' system prompt.
Package memory loads project instruction files (AGENTS.md, CLAUDE.md, GEMINI.md, BLITZ.md), the files they import, and rule files, which are added to the agents' system prompt.
Package runtime runs the agent: it wraps Google's ADK runner, builds the agent tree with its tools and sub-agents, runs a prompt as a turn within its limits, delivers steering mid-turn, answers side questions without touching history, compacts history, and records usage and traces.
Package runtime runs the agent: it wraps Google's ADK runner, builds the agent tree with its tools and sub-agents, runs a prompt as a turn within its limits, delivers steering mid-turn, answers side questions without touching history, compacts history, and records usage and traces.
wirefake
Package wirefake has fakes of the model APIs Blitz speaks (Anthropic's Messages API, the Gemini API and OpenAI's Responses API) that are as strict as the real ones (spec_056_conversation_adapters CA-150): each refuses, with the real API's status and words, what its documentation says it refuses.
Package wirefake has fakes of the model APIs Blitz speaks (Anthropic's Messages API, the Gemini API and OpenAI's Responses API) that are as strict as the real ones (spec_056_conversation_adapters CA-150): each refuses, with the real API's status and words, what its documentation says it refuses.
Package search is workspace search: an index of what a workspace holds (its files, the text of its PDFs and notebooks, its chats, its notes), kept on disk per workspace, brought up to date by scans that read only what changed, and searched by words (SQLite FTS5, ranked by BM25) and by substrings for code (spec_035_search).
Package search is workspace search: an index of what a workspace holds (its files, the text of its PDFs and notebooks, its chats, its notes), kept on disk per workspace, brought up to date by scans that read only what changed, and searched by words (SQLite FTS5, ranked by BM25) and by substrings for code (spec_035_search).
Package session stores conversations: each session's metadata and its messages and events on disk, snapshots to branch from, search over a session's history, and the store ADK reads the conversation from (spec_017_sessions).
Package session stores conversations: each session's metadata and its messages and events on disk, snapshots to branch from, search over a session's history, and the store ADK reads the conversation from (spec_017_sessions).
Package skills loads the skills a workspace offers: a SKILL.md with frontmatter and instructions, optionally scripts, from the built-in set, ~/.blitz/skills and (when trusted) the project; and the policy that caps what their scripts may do (spec_013_skills).
Package skills loads the skills a workspace offers: a SKILL.md with frontmatter and instructions, optionally scripts, from the built-in set, ~/.blitz/skills and (when trusted) the project; and the policy that caps what their scripts may do (spec_013_skills).
builtin
Package builtin holds the skills Blitz ships with (a SKILL.md each), embedded in the binary.
Package builtin holds the skills Blitz ships with (a SKILL.md each), embedded in the binary.
Package specs reads a project's specification as the project-spec agent (/spec) writes it, .agents/specs/NNN-<name>.md with README.md as the index, and checks it without a model (spec_057_spec_driven SDD-01..05): the title, the status, what each spec depends on, the requirements' IDs, "Done when" and the open questions.
Package specs reads a project's specification as the project-spec agent (/spec) writes it, .agents/specs/NNN-<name>.md with README.md as the index, and checks it without a model (spec_057_spec_driven SDD-01..05): the title, the status, what each spec depends on, the requirements' IDs, "Done when" and the open questions.
Package table reads delimited tables (CSV, TSV) for the desktop app's table viewer and workspace search (spec_029_files, spec_035_search): their delimiter and encoding (Latin-1 is decoded), a profile of their columns, and pages of rows matched by a search across columns, filters on columns and a sort, streamed so a file of hundreds of megabytes isn't loaded whole.
Package table reads delimited tables (CSV, TSV) for the desktop app's table viewer and workspace search (spec_029_files, spec_035_search): their delimiter and encoding (Latin-1 is decoded), a profile of their columns, and pages of rows matched by a search across columns, filters on columns and a sort, streamed so a file of hundreds of megabytes isn't loaded whole.
Package tools is everything the agent can do and the rules it does it under: file tools through the workspace's sandbox (with checkpoints for undo), shell commands under the command policy and the OS sandbox, approvals and permission rules, web fetch and search, MCP servers, skill scripts, images, the task list and questions to the user (spec_006_filetools, spec_007_shell, spec_005_approvals).
Package tools is everything the agent can do and the rules it does it under: file tools through the workspace's sandbox (with checkpoints for undo), shell commands under the command policy and the OS sandbox, approvals and permission rules, web fetch and search, MCP servers, skill scripts, images, the task list and questions to the user (spec_006_filetools, spec_007_shell, spec_005_approvals).
Package workers reads workers: scheduled workflows a workspace defines in workers/<name>/WORKER.md (ROADMAP item 24).
Package workers reads workers: scheduled workflows a workspace defines in workers/<name>/WORKER.md (ROADMAP item 24).

Jump to

Keyboard shortcuts

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