Documentation
¶
Overview ¶
Package tui is the agent TUI: bubbletea v2 + ultraviolet, built around the code runner (zkit/agent/runner). It is a single tea.Model that paints panes onto a uv.ScreenBuffer via Draw(scr, area); panes are imperative structs the root draws directly, with no per-pane Update loop. Runner events arrive as tea messages via the teasink event spine and land in the run timeline.
Index ¶
- Variables
- func RunFn(ctx context.Context, l *engine.LiveRunner, prompt string) tea.Cmd
- func RunFnWithAttachments(ctx context.Context, l *engine.LiveRunner, prompt string, ...) tea.Cmd
- func UseTheme(t theme.Theme)
- type Checkpoints
- func (c *Checkpoints) CheckpointForTurn(turnID string) (TurnCheckpoint, bool)
- func (c *Checkpoints) CompleteTurn(turnID string, at time.Time)
- func (c *Checkpoints) PlanRestoreFile(turnID, path string) (RollbackPlan, error)
- func (c *Checkpoints) PlanRestoreTurn(turnID string) (RollbackPlan, error)
- func (c *Checkpoints) RecordMutation(m WorkingSetMutation, before []byte, beforeMissing bool, after []byte, ...)
- func (c *Checkpoints) RestoreFile(turnID, path string) error
- func (c *Checkpoints) RestoreTurn(turnID string) error
- func (c *Checkpoints) SetWorkspaceDir(workspaceDir string)
- func (c *Checkpoints) StartTurn(turnID string, turnOrdinal int, at time.Time)
- func (c *Checkpoints) Turns() []TurnCheckpoint
- type EventRing
- type EventRingEntry
- type FileCheckpoint
- type FileImage
- type Focusable
- type InspectorSnapshot
- type Launch
- type PRInfo
- type Pane
- type RollbackFilePlan
- type RollbackPlan
- type RunState
- type Session
- func (s *Session) ActiveProviderSpec() engine.ProviderSpec
- func (s *Session) ApplyModelPricing(model string)
- func (s *Session) ApplyProviderCostBasis(spec engine.ProviderSpec)
- func (s *Session) CacheModels(provider string, models []string)
- func (s *Session) ClearIdentity()
- func (s *Session) EnsureIdentity(id string, now time.Time)
- func (s *Session) ProviderContext() (engine.ProviderSpec, engine.ProviderSpec)
- func (s *Session) SetActiveModel(model string)
- func (s *Session) SetActiveProviderSpec(spec engine.ProviderSpec)
- func (s *Session) SetCockpitExpanded(expanded bool)
- func (s *Session) SetConfirmQuit(confirm bool)
- func (s *Session) SetContextWindow(tokens int)
- func (s *Session) SetErrorToast(msg string)
- func (s *Session) SetIdentity(id, label string, createdAt time.Time)
- func (s *Session) SetModelMeta(m modelMeta)
- func (s *Session) SetPressureConfig(window, reserve int)
- func (s *Session) SetPricing(inPer1k, outPer1k float64)
- func (s *Session) SetProviderContext(fallback, current engine.ProviderSpec)
- func (s *Session) SetProviderDisplay(name string)
- func (s *Session) SetSkipStartedPrompt(prompt string)
- func (s *Session) SetSuccessToast(msg string)
- func (s *Session) SetToast(msg string)
- func (s *Session) SetToastTone(msg string, tone toastTone)
- func (s *Session) SetWorkspace(root, model string)
- func (s *Session) ToastExpiryCmd() tea.Cmd
- func (s *Session) TogglePlanMode() bool
- type SessionUsageSnapshot
- type TurnCheckpoint
- type UI
- func (m *UI) ActivateIntro(ctx context.Context)
- func (m *UI) Draw(scr uv.Screen, _ uv.Rectangle)
- func (m *UI) Init() tea.Cmd
- func (m *UI) SaveSession(ctx context.Context) error
- func (m *UI) SetContextWindow(tokens int)
- func (m *UI) SetLiveRunner(l *engine.LiveRunner)
- func (m *UI) SetPressureConfig(window, reserve int)
- func (m *UI) SetPricing(inPer1k, outPer1k float64)
- func (m *UI) SetProvider(name string)
- func (m *UI) SetProviderContext(fallback, current engine.ProviderSpec)
- func (m *UI) SetRunFn(fn func(prompt string) tea.Cmd)
- func (m *UI) SetSettings(s *engine.Settings)
- func (m *UI) SetStartupFailure(wsRoot, title, err string)
- func (m *UI) SetWorkspace(root, model string)
- func (m *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *UI) View() tea.View
- type WorkingSet
- func (w *WorkingSet) CompleteTurn(turnID string)
- func (w *WorkingSet) DiffBodies() map[string]string
- func (w *WorkingSet) FilesChangedForTurn(turnID string) []WorkingSetFile
- func (w *WorkingSet) FilesChangedThisSession() []WorkingSetFile
- func (w *WorkingSet) MutationsForFile(path string) []WorkingSetMutation
- func (w *WorkingSet) MutationsForTurn(turnID string) []WorkingSetMutation
- func (w *WorkingSet) MutationsThisSession() []WorkingSetMutation
- func (w *WorkingSet) RecordDiff(path, diff string) WorkingSetMutation
- func (w *WorkingSet) RestoreDiffBodies(bodies map[string]string, at time.Time)
- func (w *WorkingSet) SetWorkspaceDir(workspaceDir string)
- func (w *WorkingSet) StartTurn(turnID string) int
- func (w *WorkingSet) TurnsChangedThisSession() []WorkingSetTurn
- type WorkingSetFile
- type WorkingSetMutation
- type WorkingSetTurn
- type Zarlcode
Constants ¶
This section is empty.
Variables ¶
var ErrCheckpointConflict = errors.New("checkpoint conflict")
var ErrCheckpointNotFound = errors.New("checkpoint not found")
Functions ¶
func RunFn ¶
RunFn is the UI.SetRunFn handler: it adapts the charm-free engine.LiveRunner.RunTurn into a tea.Cmd. A setup failure surfaces as turnSetupFailedMsg; a finished turn surfaces as liveTurnFinishedMsg. The turn runs off the Update loop, and streaming output reaches the timeline through the sink's pump. It is a package func, not a method, because RunFn must live in the TUI (it returns a tea.Cmd) while LiveRunner lives in the engine.
func RunFnWithAttachments ¶ added in v0.2.0
func RunFnWithAttachments(ctx context.Context, l *engine.LiveRunner, prompt string, attachments []llm.ContentPart) tea.Cmd
Types ¶
type Checkpoints ¶
type Checkpoints struct {
// contains filtered or unexported fields
}
func NewCheckpoints ¶
func NewCheckpoints(workspaceDir string) *Checkpoints
func (*Checkpoints) CheckpointForTurn ¶
func (c *Checkpoints) CheckpointForTurn(turnID string) (TurnCheckpoint, bool)
func (*Checkpoints) CompleteTurn ¶
func (c *Checkpoints) CompleteTurn(turnID string, at time.Time)
func (*Checkpoints) PlanRestoreFile ¶
func (c *Checkpoints) PlanRestoreFile(turnID, path string) (RollbackPlan, error)
func (*Checkpoints) PlanRestoreTurn ¶
func (c *Checkpoints) PlanRestoreTurn(turnID string) (RollbackPlan, error)
func (*Checkpoints) RecordMutation ¶
func (c *Checkpoints) RecordMutation(m WorkingSetMutation, before []byte, beforeMissing bool, after []byte, afterMissing bool)
func (*Checkpoints) RestoreFile ¶
func (c *Checkpoints) RestoreFile(turnID, path string) error
func (*Checkpoints) RestoreTurn ¶
func (c *Checkpoints) RestoreTurn(turnID string) error
func (*Checkpoints) SetWorkspaceDir ¶
func (c *Checkpoints) SetWorkspaceDir(workspaceDir string)
func (*Checkpoints) StartTurn ¶
func (c *Checkpoints) StartTurn(turnID string, turnOrdinal int, at time.Time)
func (*Checkpoints) Turns ¶
func (c *Checkpoints) Turns() []TurnCheckpoint
type EventRing ¶
type EventRing struct {
// contains filtered or unexported fields
}
EventRing is a fixed-capacity circular buffer of recent runner events. It is safe for single-goroutine use (the TUI Update loop).
func NewEventRing ¶
NewEventRing returns an empty ring with the given capacity.
func (*EventRing) Add ¶
func (r *EventRing) Add(e EventRingEntry)
Add pushes an entry onto the ring, evicting the oldest entry when full.
func (*EventRing) Snapshot ¶
func (r *EventRing) Snapshot() []EventRingEntry
Snapshot returns a copy of all entries in insertion order (oldest first).
type EventRingEntry ¶
EventRingEntry is one recorded runner event with a timestamp and a brief human-readable kind/detail pair.
type FileCheckpoint ¶
type Focusable ¶
type Focusable interface {
Pane
// Focused reports whether this pane currently holds keyboard focus.
Focused() bool
// Focus is called when the pane gains keyboard focus.
Focus()
// Blur is called when the pane loses keyboard focus.
Blur()
}
Focusable is a Pane that can receive keyboard focus. The shell tracks which pane is focused and routes KeyPressMsg, PasteMsg, and ClipboardMsg to it first (before falling back to broadcast).
Focus/Blur are called by the shell during focus transitions. Panes use Focused() to decide whether to render a cursor, selection highlight, or other focus-dependent chrome.
type InspectorSnapshot ¶
type InspectorSnapshot struct {
// Tools is the tool roster that would be registered for the next turn.
Tools []tools.ToolSpec
// PlanMode is whether the runner is in PLAN mode.
PlanMode bool
// PromptSystem is the rendered system prompt for the current mode.
PromptSystem string
// PromptStack records neutral prompt-fragment accounting for inspection.
PromptStack prompts.Stack
// PromptSource is the active prompt body source selected by live resolution.
PromptSource string
// PromptPreferencesSource is the additive preferences source, when present.
PromptPreferencesSource string
// PromptResolutionMode identifies embedded or explicit override resolution.
PromptResolutionMode home.PromptResolutionMode
// Errors are non-fatal snapshot/render issues surfaced in the inspector.
Errors []string
// Guardrails is a summary of guardrail configuration.
Guardrails string
// Processes lists background bash processes tracked by the live ProcessManager.
Processes []code.ProcessInfo
// MCPServers lists configured/running MCP servers (names only, redacted).
MCPServers []string
// EventLog contains recent runner events from the session.
EventLog []EventRingEntry
// Skills is the loaded skill catalog for the workspace.
Skills []catalog.Skill
// Agents is the loaded agent catalog for the workspace.
Agents []catalog.Agent
// Hooks is the loaded command-hook catalog for the workspace — what the
// next turn's hook guardrail arms.
Hooks []catalog.Hook
// ToolSurface is the exact post-gate surface from the latest top-level
// request. Zero before the first iteration completes.
ToolSurface runner.ToolSurface
}
InspectorSnapshot holds a read-only view of the runner's current state, built on demand without starting a run or mutating persistent registries.
func BuildInspectorSnapshot ¶
func BuildInspectorSnapshot(session *Session, live *engine.LiveRunner, catalog *engine.RuntimeCatalog) InspectorSnapshot
BuildInspectorSnapshot builds a read-only snapshot of the runner's state for the inspector overlay. It does not start a run or mutate persistent state.
type Launch ¶
type Launch struct {
EnvFile string
AgentName string
Resume bool
Headless bool
Prompt string // pre-resolved in Main from --prompt-file/--prompt-text
MaxIter int
PprofAddr string
TraceFile string
PromptProfile engine.PromptProfile
ReportFile string
}
Launch implements zapp.Program[*Zarlcode]. Flag values are parsed in zarlcode.Main and threaded through here so Create/Run never touch the flag package — they read intent off the struct.
func (Launch) Create ¶
Create wires the application against the workspace (the launch cwd): optional .env, file-only logging (the alt-screen owns stdout), shared ~/.zarlcode settings + provider, the bubbletea model, and the live runner. Long-lived resources are registered with app.AddCloser so the harness closes them deterministically on exit.
type PRInfo ¶
type PRInfo struct {
Number int
Title string
URL string
State string // OPEN / MERGED / CLOSED, as reported by gh
Draft bool
}
PRInfo is the at-a-glance view of the open GitHub PR for the active branch, rendered in the cockpit's workspace card. Populated asynchronously by fetchPRCmd; nil means "no PR, gh unavailable, or not yet resolved".
type Pane ¶
type Pane interface {
// Draw paints the pane's content into scr within area. The shell
// guarantees area is non-empty and clipped to the screen.
Draw(scr uv.Screen, area uv.Rectangle)
// Update handles a message intended for this pane. Returns a command
// the shell should execute, or nil when the message was not consumed.
Update(msg tea.Msg) tea.Cmd
}
Pane is a rectangular region of the screen that handles its own rendering and event dispatch. A pane returns nil from Update when a message isn't for it, letting the shell try the next pane in priority order.
Panes do not implement tea.Model. They are driven imperatively by the shell: the shell computes the pane's bounds from the layout, calls Draw with that rectangle, and routes messages through Update.
type RollbackFilePlan ¶
type RollbackPlan ¶
type RollbackPlan struct {
TurnID string
Path string
Files []RollbackFilePlan
Conflict bool
}
type RunState ¶
type RunState struct {
// --- live run (reset each top-level turn) ---
Running bool
// contains filtered or unexported fields
}
RunState is the cockpit model: the live summary of the current top-level run plus the session-cumulative accounting (tokens, cost, tools, compaction, per-turn history) the sidebar and dashboard render. It is folded from runner events in handleRunnerMsg — every field here is set from a teasink message, never derived at the call site.
func (*RunState) RestoreUsage ¶
func (s *RunState) RestoreUsage(snap SessionUsageSnapshot)
RestoreUsage seeds the session rollup from a persisted snapshot so a resumed session's cockpit reflects the tokens it already spent. Live counters are untouched; the next turn accumulates on top.
func (*RunState) UsageSnapshot ¶
func (s *RunState) UsageSnapshot() SessionUsageSnapshot
UsageSnapshot captures the session rollup for persistence.
type Session ¶
type Session struct {
// Workspace identity.
Workspace string // ~-shortened display path
WorkspaceDir string // real path for file operations
Branch string // git branch, or ""
PR *PRInfo // open GitHub PR for Branch, or nil until resolved
// Active provider/model display state.
Provider string
Model string
// Provider specs for repoint detection after settings change.
ProvFallback engine.ProviderSpec // env-derived default
ProvSpec engine.ProviderSpec // currently-pointed selection
// Model list cache — populated by async fetch, read by quick pick and
// settings dialog. Keyed by provider name.
ModelCache map[string][]string
// Persisted session identity.
StartedAt time.Time // when this TUI session launched
ID string // persisted session id, empty until first save
Label string
CreatedAt time.Time
// Runtime modes and telemetry.
PlanMode bool // PLAN mode (shift+tab): read-only tools, planning prompt
CockpitExpanded bool // full-width dashboard (ctrl+l)
StateSidebarHidden bool // temporary shell preference toggled with ctrl+b
Run RunState
// User preferences loaded from the settings store.
ConfirmQuit bool
// AutoCompact mirrors the compaction_mode setting: true (default) means the
// runner auto-compacts; false means manual, so the cockpit warns near the
// trigger instead. compactWarned latches the one-shot warning so it fires
// once per crossing rather than every iteration.
AutoCompact bool
// Transient notification — shown at the right of the status bar.
Toast string
ToastTone toastTone
ToastAt time.Time
// Plan is the latest structured plan from update_plan. The plan overlay
// (ctrl+p) and transcript plan notices read this.
Plan code.Plan
// WorkingSet records file mutations observed during this TUI session.
WorkingSet *WorkingSet
// Checkpoints records per-turn pre-images for changed files so a later UI can
// offer rollback without asking the runner to own TUI-shaped state.
Checkpoints *Checkpoints
// EventLog holds a ring of the most recent runner events for inspector
// debugging.
EventLog *EventRing
// LastToolResult holds the most recent tool's Result (any) for rich
// rendering by the timeline pane.
LastToolResult any
// LastToolEffects holds the most recent tool's typed Effects, replacing
// the old firstEffectSummary string flattening.
LastToolEffects []tools.Effect
// LastParentToolCallID is the ParentToolCallID from the most recent
// ConversationStarted/Completed, linking sub-agents to their spawn call.
LastParentToolCallID string
// LastAgentName is the AgentName from ConversationStarted.
LastAgentName string
// PendingSkillNames tracks skill_load ToolStartedMsg parameters by ToolID
// so skill names can be surfaced when the tool completes.
PendingSkillNames map[string]string
// SkipStartedPrompt suppresses the ConversationStarted user row for a
// queued input already rendered while the previous turn was live.
SkipStartedPrompt string
// contains filtered or unexported fields
}
Session holds the shared mutable state that runner events update and multiple panes read. It replaces the 15+ scattered fields on the old UI struct, giving each pane a single source of truth for workspace identity, run progress, plan state, and user preferences.
The shell owns the Session; panes receive a pointer in Draw so they can read live state without holding their own copies. Runner events flow through handleRunnerMsg, which delegates state changes to Session mutation methods; panes then re-render on the next frame from the updated session.
func NewSession ¶
NewSession returns a Session with sensible defaults.
func (*Session) ActiveProviderSpec ¶
func (s *Session) ActiveProviderSpec() engine.ProviderSpec
func (*Session) ApplyModelPricing ¶
func (*Session) ApplyProviderCostBasis ¶
func (s *Session) ApplyProviderCostBasis(spec engine.ProviderSpec)
func (*Session) CacheModels ¶
func (*Session) ClearIdentity ¶
func (s *Session) ClearIdentity()
func (*Session) ProviderContext ¶
func (s *Session) ProviderContext() (engine.ProviderSpec, engine.ProviderSpec)
func (*Session) SetActiveModel ¶
func (*Session) SetActiveProviderSpec ¶
func (s *Session) SetActiveProviderSpec(spec engine.ProviderSpec)
func (*Session) SetCockpitExpanded ¶
func (*Session) SetConfirmQuit ¶
func (*Session) SetContextWindow ¶
func (*Session) SetErrorToast ¶
func (*Session) SetModelMeta ¶
func (s *Session) SetModelMeta(m modelMeta)
SetModelMeta wires the registry-backed resolver and refreshes the basis. Called once when settings open; nil leaves the cost basis at its defaults.
func (*Session) SetPressureConfig ¶
func (*Session) SetPricing ¶
func (*Session) SetProviderContext ¶
func (s *Session) SetProviderContext(fallback, current engine.ProviderSpec)
func (*Session) SetProviderDisplay ¶
func (*Session) SetSkipStartedPrompt ¶
func (*Session) SetSuccessToast ¶
func (*Session) SetToast ¶
SetToast records a status-bar notification with an expiry timestamp. The tone is inferred for existing callers so legacy "✓ ..." / "✗ ..." messages still render with semantic colours.
func (*Session) SetToastTone ¶
func (*Session) SetWorkspace ¶
func (*Session) ToastExpiryCmd ¶
ToastExpiryCmd returns a command that wakes the Update loop when the current toast is due to expire. Returns nil when no toast is active.
func (*Session) TogglePlanMode ¶
type SessionUsageSnapshot ¶
type SessionUsageSnapshot struct {
Turns int `json:"turns"`
ToolCalls int `json:"tool_calls"`
In int `json:"in"`
Out int `json:"out"`
Cached int `json:"cached"`
InParent int `json:"in_parent"`
OutParent int `json:"out_parent"`
CachedParent int `json:"cached_parent"`
CostUSD float64 `json:"cost_usd,omitempty"`
CostParentUSD float64 `json:"cost_parent_usd,omitempty"`
CacheSavedUSD float64 `json:"cache_saved_usd,omitempty"`
NestedCompleted int `json:"nested_completed,omitempty"`
NestedFailed int `json:"nested_failed,omitempty"`
NestedDuration time.Duration `json:"nested_duration,omitempty"`
NestedTools map[string]int `json:"nested_tools,omitempty"`
}
type TurnCheckpoint ¶
type UI ¶
type UI struct {
// contains filtered or unexported fields
}
UI is the sole bubbletea v2 model. Per-pane state lives in imperative sub-structs the root drives directly; they do not implement tea.Model.
func New ¶
func New() *UI
New constructs the v2 UI model. The cockpit gauge defaults to the live runner's context window so the fill fraction is meaningful from the first turn even before the consumer overrides it.
func (*UI) ActivateIntro ¶
func (*UI) Draw ¶
Draw paints the pane rectangles onto scr. area is the clip region (the full screen); per-pane geometry comes from m.layout.
func (*UI) Init ¶
Init implements tea.Model. Non-critical startup work runs as Bubble Tea commands so the first frame is not blocked by external services.
func (*UI) SetContextWindow ¶
SetContextWindow overrides the cockpit gauge's denominator (the model's usable context window, in tokens). Defaults to the live runner's window.
func (*UI) SetLiveRunner ¶
func (m *UI) SetLiveRunner(l *engine.LiveRunner)
SetLiveRunner wires the live runner as the prompt handler AND keeps a reference so a provider change in the settings overlay can re-point it mid-session (see maybeRepoint).
func (*UI) SetPressureConfig ¶
SetPressureConfig records the compaction pressure threshold (window - reserve) so the context bar can draw a marker at the trigger point and the headline can show "compact at ~Xk". Pass window=0 to hide the pressure indicator.
func (*UI) SetPricing ¶
SetPricing overrides the cockpit's per-1k (input, output) USD token price. Use it when the exact rate is known and the name-matched default is wrong or missing.
func (*UI) SetProvider ¶
SetProvider records the active provider name (e.g. "llamacpp", "anthropic") for the cockpit's identity section, and whether it's a local/unmetered backend (drives the COST label). Empty hides the provider row.
func (*UI) SetProviderContext ¶
func (m *UI) SetProviderContext(fallback, current engine.ProviderSpec)
SetProviderContext records the env-derived fallback spec and the currently active spec, so the settings overlay can detect a provider change and re-point the live runner on close.
func (*UI) SetRunFn ¶
SetRunFn wires the live-run launcher invoked when the user submits a prompt. The standalone cmd sets this after building the runner factory.
func (*UI) SetSettings ¶
SetSettings wires the persistence handle so the settings overlay (ctrl+s) can read and write preferences. Nil leaves the overlay unavailable. Also resolves the confirm_quit setting.
func (*UI) SetStartupFailure ¶ added in v0.1.3
func (*UI) SetWorkspace ¶
SetWorkspace sets the workspace path (~-shortened), git branch (if any), and model name. The workspace/branch render in the state sidebar; the model also appears in the timeline title. Resolving the model name seeds the cockpit's best-effort token pricing (overridable via SetPricing).
func (*UI) Update ¶
Update implements tea.Model. Resize recomputes the layout rects; esc stops a running turn while ctrl+c handles quitting. Runner events (teasink messages) are handled here too.
type WorkingSet ¶
type WorkingSet struct {
// contains filtered or unexported fields
}
WorkingSet records file mutations observed during this TUI session. It is a local, in-memory read model for future panes; persistence and rendering stay outside this type.
func NewWorkingSet ¶
func NewWorkingSet(workspaceDir string) *WorkingSet
NewWorkingSet returns an empty working-set model for workspaceDir.
func (*WorkingSet) CompleteTurn ¶
func (w *WorkingSet) CompleteTurn(turnID string)
CompleteTurn clears active attribution once the top-level runner turn ends.
func (*WorkingSet) DiffBodies ¶
func (w *WorkingSet) DiffBodies() map[string]string
DiffBodies returns the latest unified-diff body per changed file. This is the persistable shape stored in a session's diff_bodies_json so the Files dock and diff viewer repopulate on -continue. Nil when nothing changed.
func (*WorkingSet) FilesChangedForTurn ¶
func (w *WorkingSet) FilesChangedForTurn(turnID string) []WorkingSetFile
FilesChangedForTurn returns one coalesced summary per file changed during the given turn, ordered by first mutation within that turn.
func (*WorkingSet) FilesChangedThisSession ¶
func (w *WorkingSet) FilesChangedThisSession() []WorkingSetFile
FilesChangedThisSession returns one coalesced summary per changed file, ordered by first mutation in the session.
func (*WorkingSet) MutationsForFile ¶
func (w *WorkingSet) MutationsForFile(path string) []WorkingSetMutation
MutationsForFile returns the full per-mutation history for path.
func (*WorkingSet) MutationsForTurn ¶
func (w *WorkingSet) MutationsForTurn(turnID string) []WorkingSetMutation
MutationsForTurn returns the full per-mutation history for turnID.
func (*WorkingSet) MutationsThisSession ¶
func (w *WorkingSet) MutationsThisSession() []WorkingSetMutation
MutationsThisSession returns the full per-mutation history for the session.
func (*WorkingSet) RecordDiff ¶
func (w *WorkingSet) RecordDiff(path, diff string) WorkingSetMutation
RecordDiff stores one file mutation using the current time.
func (*WorkingSet) RestoreDiffBodies ¶
func (w *WorkingSet) RestoreDiffBodies(bodies map[string]string, at time.Time)
RestoreDiffBodies replays persisted diff bodies into an empty working set so the Files dock and diff viewer reflect the resumed session. Each path becomes a single mutation outside any turn; counts are recomputed from the body. Paths are replayed in sorted order so the dock ordering is deterministic across restores.
func (*WorkingSet) SetWorkspaceDir ¶
func (w *WorkingSet) SetWorkspaceDir(workspaceDir string)
SetWorkspaceDir updates the root used to normalize absolute paths into workspace-relative paths. Existing mutations keep the path recorded at the time they were observed.
func (*WorkingSet) StartTurn ¶
func (w *WorkingSet) StartTurn(turnID string) int
StartTurn marks a top-level runner turn as the active attribution target for subsequent diffs.
func (*WorkingSet) TurnsChangedThisSession ¶
func (w *WorkingSet) TurnsChangedThisSession() []WorkingSetTurn
TurnsChangedThisSession returns one summary per turn that changed files, ordered by the first mutation observed in each turn. Diffs observed outside a top-level turn are intentionally excluded because they have no turn identity.
type WorkingSetFile ¶
type WorkingSetFile struct {
Path string
FirstChangedAt time.Time
LastChangedAt time.Time
Additions int
Deletions int
Mutations int
}
WorkingSetFile is the coalesced session or turn summary for one changed file.
type WorkingSetMutation ¶
type WorkingSetMutation struct {
Path string
Diff string
TurnID string
TurnOrdinal int
ChangedAt time.Time
MutationOrdinal int
Additions int
Deletions int
}
WorkingSetMutation is one recorded file mutation and the turn it belongs to.
type WorkingSetTurn ¶
type WorkingSetTurn struct {
ID string
Ordinal int
FirstChangedAt time.Time
LastChangedAt time.Time
Files int
Mutations int
Additions int
Deletions int
}
WorkingSetTurn is the coalesced summary for files changed during one turn.
type Zarlcode ¶
type Zarlcode struct {
// contains filtered or unexported fields
}
Zarlcode is the running application: workspace, settings, the live runner, and the bubbletea model. It's the typed instance carried by the zapp lifecycle harness — Launch.Create wires it (registering closers with the app), Launch.Run drives it.
Source Files
¶
- activity.go
- agent_activity_screen.go
- animate.go
- askpass_dialog.go
- askpass_server.go
- attachments.go
- badges.go
- branding.go
- catalog_edit.go
- catalog_pane.go
- checkpoint.go
- child_layout.go
- cockpit.go
- cockpit_render.go
- compact_now.go
- composer.go
- content_render.go
- dashboard.go
- dialog.go
- diff_browser.go
- diff_item.go
- draw.go
- effect_summary.go
- event_ring.go
- file_mention_picker.go
- file_viewer.go
- file_viewer_async.go
- group.go
- handle_runner.go
- header.go
- inspector.go
- intro.go
- keyhints.go
- launch.go
- layout.go
- list_window.go
- listpicker.go
- live_runfn.go
- markdown.go
- mcp_pane.go
- model.go
- model_info.go
- model_quick_pick.go
- models.go
- mouse.go
- oauth.go
- overlay_helpers.go
- pane.go
- pane_header.go
- pane_status.go
- passphrase.go
- perf.go
- plan_dialog.go
- plan_item.go
- pr.go
- process_kill.go
- providers_dialog.go
- queued_turn.go
- render_primitives.go
- repoint.go
- resume_target_dialog.go
- rollback_dialog.go
- scroll.go
- service_dialog.go
- services_cmd.go
- session.go
- session_persist.go
- session_runner.go
- settings_dialog.go
- settings_render.go
- sidebar.go
- sidebar_tabs.go
- skills_item.go
- slash_commands.go
- sparkline.go
- splash.go
- startup_failure.go
- steer_tray.go
- streaming.go
- styles.go
- subagent_item.go
- theme_gallery.go
- themepicker.go
- think_item.go
- timeline.go
- timeline_nav.go
- timeline_selection.go
- toast.go
- tool_history.go
- tool_trace.go
- toolrender.go
- transcript_reader.go
- vault_unlock.go
- working_set.go
- working_set_pane.go