agent

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package agent watches the JSONL transcripts that Codex and Claude Code write while their TUI runs, and projects those files as normalized events. The PTY byte stream stays the source of truth; this is a side channel for clients (notably Web) that want a structured view of the same process.

Index

Constants

View Source
const (
	// BindEnvSession marks the Warren session owning the CLI process. Hooks
	// and tool subprocesses see it, but only the managed hook uses it.
	BindEnvSession = "WARREN_SESSION_ID"
	// BindEnvFile points the managed hook at the file it must write with the
	// CLI session ID and transcript path.
	BindEnvFile = "WARREN_BIND_FILE"
	// BindEnvKind names the agent kind (codex or claude) for the hook.
	BindEnvKind = "WARREN_AGENT_KIND"
	// BindEnvState points the managed hook at the file it must update when the
	// CLI session changes lifecycle, so the daemon can update the status overlay.
	BindEnvState = "WARREN_STATE_FILE"
	// CodexSessionID and CodexThreadID are launcher-provided identity hints.
	// An interactive shell can inherit them from its parent Codex process; an
	// independently-created Warren session must not reuse that conversation.
	BindEnvCodexSessionID = "CODEX_SESSION_ID"
	BindEnvCodexThreadID  = "CODEX_THREAD_ID"
)
View Source
const (
	// DefaultReadRecent bounds a command result so an external agent does not
	// accidentally ingest an entire long-running conversation.
	DefaultReadRecent = 20
	// DefaultReadContentLimit is measured in Unicode code points, not bytes.
	DefaultReadContentLimit = 2000
	// MaxReadActivities bounds an unbounded (--all) read. Callers that need a
	// smaller response should set Recent explicitly.
	MaxReadActivities = 100000
)

Variables

This section is empty.

Functions

func AntigravityConfigDir added in v0.12.0

func AntigravityConfigDir() string

AntigravityConfigDir returns the configuration directory where hooks.json resides.

func AntigravityHome added in v0.12.0

func AntigravityHome() string

AntigravityHome returns the application data root directory for Antigravity CLI.

func BindDir

func BindDir() string

BindDir is the directory holding per-session bindings.

func BindEnvironment

func BindEnvironment(warrenSessionID, kind string) []string

BindEnvironment returns the runtime environment entries a session needs so the managed hook can report an agent CLI's own session ID to Warren.

func BindPath

func BindPath(warrenSessionID string) string

BindPath is the per-session file the managed hook writes.

func ClaudeConfigDir

func ClaudeConfigDir() string

ClaudeConfigDir returns the directory Claude reads settings from, honoring CLAUDE_CONFIG_DIR just like the CLI itself.

func ClaudeProjectsRoot

func ClaudeProjectsRoot() string

ClaudeProjectsRoot returns the directory Claude writes transcripts into, honoring CLAUDE_CONFIG_DIR just like the CLI itself.

func ClaudeTranscriptPath

func ClaudeTranscriptPath(claudeRoot, workspacePath, sessionID string) string

ClaudeTranscriptPath computes the transcript file Claude writes for a given session ID in a given working directory.

func CodexHome

func CodexHome() string

CodexHome returns the Codex configuration directory the daemon's children inherit, honoring CODEX_HOME just like the CLI itself.

func EnsureAntigravityBindHook added in v0.12.0

func EnsureAntigravityBindHook(configDir string) (changed bool, err error)

EnsureAntigravityBindHook installs Warren's PreInvocation and Stop lifecycle hooks into Antigravity's hooks.json, preserving any existing hooks.

func EnsureClaudeBindHook

func EnsureClaudeBindHook(claudeConfigDir string) (changed bool, err error)

EnsureClaudeBindHook installs Warren's binding and attention hooks into Claude's user settings file, preserving every existing entry. Claude emits PermissionRequest/PreToolUse and turn-boundary hooks as stable, machine-readable observations; the managed script projects them to the provider-neutral AgentStatus file without approving or denying anything.

func EnsureCodexBindHook

func EnsureCodexBindHook(codexHome string) (changed bool, err error)

EnsureCodexBindHook installs the Warren SessionStart and SessionEnd hooks into Codex's user hooks file, preserving every existing entry.

func EnsureOpenCodeBindPlugin added in v0.10.0

func EnsureOpenCodeBindPlugin() (bool, error)

EnsureOpenCodeBindPlugin installs the Warren binding plugin for OpenCode. It is the hook-equivalent for OpenCode: on session.created/status=busy the plugin reads WARREN_SESSION_ID and atomically writes the binding file so the daemon can resolve the SQLite session without cwd+time guessing.

func EnsurePiBindExtension added in v0.12.0

func EnsurePiBindExtension() (bool, error)

EnsurePiBindExtension installs the Warren binding extension for Pi. It is the hook-equivalent for Pi: on session_start the extension reads WARREN_SESSION_ID and WARREN_BIND_FILE from the environment Warren injects into the surrounding shell, then atomically writes the binding file so the daemon can resolve the Pi JSONL transcript without cwd+mtime guessing.

func EnsureQoderBindHook added in v0.12.0

func EnsureQoderBindHook(qoderConfigDir string) (changed bool, err error)

EnsureQoderBindHook installs the Warren binding hook into Qoder's user settings file (<configDir>/settings.json), preserving every existing key and hook entry. Qoder loads user-level hooks from the `hooks` object of its settings.json (SessionStart/SessionEnd events with a `command` hook), so a standalone hooks.json next to the config directory is never executed. On SessionStart the hook writes the binding file so the daemon can resolve the Warren session ID and transcript location without guessing.

func FindAntigravityTranscript added in v0.12.0

func FindAntigravityTranscript(sessionID, workspacePath string) string

FindAntigravityTranscript locates the transcript.jsonl file for an Antigravity conversation.

func FindPiTranscript added in v0.12.0

func FindPiTranscript(sessionID string) string

FindPiTranscript locates the JSONL transcript for a Warren session by its injected Pi session id. The scan is scoped to the exact filename suffix so a stale or manually-created Pi session can never be adopted. The header is verified as a second guard so a future Pi layout change degrades to a retry instead of tailing the wrong conversation. The cwd is deliberately not part of the match: a Session moved between Workspaces keeps its original transcript, so only the unique injected id is authoritative.

func FindQoderTranscript added in v0.12.0

func FindQoderTranscript(sessionID, cwd string) string

FindQoderTranscript locates the JSONL transcript for a Warren session by its injected Qoder session id. When the working directory is known the exact bucket is checked first (Qoder writes there deterministically); when it is empty, or the file is not there yet, a scan over every project bucket finds <session-id>.jsonl regardless of where the CLI actually started. The filename alone is scoped to the injected id, and the transcript is verified to mention that session id so a stale or manually-created file is never adopted.

func InjectClaudeSessionID

func InjectClaudeSessionID(command, warrenSessionID string) string

InjectClaudeSessionID makes Claude's transcript path deterministic for a Warren session. Existing resume/session flags are left untouched so a user who explicitly resumes an older conversation keeps their intent.

func InjectQoderSessionID added in v0.12.0

func InjectQoderSessionID(command, warrenSessionID string) string

InjectQoderSessionID makes Qoder's transcript path deterministic for a Warren session. Existing resume/session flags are left untouched so a user who explicitly resumes an older conversation keeps their intent.

func OpenCodeCachePath added in v0.10.0

func OpenCodeCachePath(warrenSessionID, opencodeSessionID string) string

OpenCodeCachePath is deterministic across daemon restarts and includes both Warren and OpenCode IDs, preventing a /clear or a reused Warren tab from consuming another conversation's projection.

func OpenCodeDataRoot added in v0.10.0

func OpenCodeDataRoot(override string) string

OpenCodeDataRoot returns OpenCode's application data directory. The explicit override is intended for tests and embedders. Warren's own override is deliberately namespaced so it cannot be mistaken for an OpenCode setting (the provider currently follows XDG_DATA_HOME and platform defaults).

func OpenCodeDatabasePath added in v0.10.0

func OpenCodeDatabasePath(dataRoot string) string

OpenCodeDatabasePath returns the current SQLite database path.

func OpenCodePluginPath added in v0.10.0

func OpenCodePluginPath() string

OpenCodePluginPath returns the Warren-managed OpenCode plugin path. The plugin is auto-discovered from ~/.config/opencode/plugin/ and project .opencode/plugin/; global ensures remote/empty projects still bind.

func PiExtensionPath added in v0.12.0

func PiExtensionPath() string

PiExtensionPath returns the Warren-managed Pi extension path. Pi auto-discovers global extensions from ~/.pi/agent/extensions/ (honoring PI_CODING_AGENT_DIR), so a global install covers shell overlays in every workspace. A deterministic filename with a marker makes repeated daemon starts idempotent.

func PiSessionFileName added in v0.12.0

func PiSessionFileName(sessionID string) string

PiSessionFileName returns the deterministic suffix pi's session files end with: pi writes <timestamp>_<session-id>.jsonl.

func PiSessionsRoot added in v0.12.0

func PiSessionsRoot() string

PiSessionsRoot returns the directory Pi stores session files in, honoring the same overrides as the CLI: --session-dir / PI_CODING_AGENT_SESSION_DIR win over the default under PI_CODING_AGENT_DIR (or ~/.pi/agent).

func ProjectEvents

func ProjectEvents(events []api.AgentEvent, options ReadOptions) ([]api.AgentEvent, error)

ProjectEvents applies the same filtering and content limits as ReadTranscript to events already retained by a live Host watcher. This is used by remote session readers, where the transcript file lives on the Host rather than on the CLI machine.

func QoderConfigDir added in v0.12.0

func QoderConfigDir() string

QoderConfigDir returns the directory Qoder reads settings from, honoring QODER_CONFIG_DIR just like the CLI itself.

func QoderHome added in v0.12.0

func QoderHome() string

QoderHome returns the Qoder configuration directory, honoring QODER_HOME just like the CLI itself.

func QoderProjectsRoot added in v0.12.0

func QoderProjectsRoot() string

QoderProjectsRoot returns the directory Qoder stores project transcripts under: <root>/projects/<cwd-slug>/<session-id>.jsonl. The projects root is always the real-home ~/.qoder/projects: Qoder keeps the settings file under the config dir (honoring QODER_HOME/QODER_CONFIG_DIR) but writes session transcripts under the user's actual .qoder directory regardless of those overrides. QODER_SESSION_DIR is honored only as a test/override seam and is not read by the CLI itself.

func QoderTranscriptPath added in v0.12.0

func QoderTranscriptPath(cwd, sessionID string) string

QoderTranscriptPath returns the deterministic transcript path Qoder writes for a session id started in cwd. The session-id flag is the primary anchor, so the path is only valid when the caller injected it at launch.

func ReadAgentStatus

func ReadAgentStatus(path string) (api.AgentStatus, error)

ReadAgentStatus returns only the status recorded by the managed hook. It is kept as a compatibility helper for callers that do not need the provider ID.

func ReadTranscript

func ReadTranscript(ctx context.Context, provider, path string, options ReadOptions) ([]api.AgentEvent, error)

ReadTranscript parses one Codex, Claude, OpenCode, or Pi JSONL transcript into the same normalized events used by Warren's live agent view. The file is consumed line by line, so the reader never loads the whole transcript into memory.

func ReadTranscriptChunk added in v0.9.0

func ReadTranscriptChunk(path string, offset int64, limit int) ([]byte, int64, bool, error)

ReadTranscriptChunk returns one exact byte range from a bound transcript. It deliberately does not parse or normalize the JSONL: callers use it for the explicit full-transcript escape hatch and stream the result onward in small chunks. The returned EOF applies to the file size observed for this read; a concurrently-running Agent may append another record afterwards.

func RemoveBinding

func RemoveBinding(warrenSessionID string)

RemoveBinding cleans up the per-session file when the session is deleted.

func RemoveOpenCodeCache added in v0.10.0

func RemoveOpenCodeCache(path string) error

RemoveOpenCodeCache removes a persisted cache when no live tailer exists, while leaving missing files as a successful cleanup.

func StateMatchesBinding added in v0.12.0

func StateMatchesBinding(state AgentState, binding *Binding) bool

StateMatchesBinding reports whether a provider state belongs to the current binding. An empty state ID is deliberately not considered a match.

func StatePath

func StatePath(warrenSessionID string) string

StatePath is the per-session file the managed hook uses to report lifecycle changes to the daemon.

func ValidateAntigravityCommand added in v0.12.0

func ValidateAntigravityCommand(command string) error

ValidateAntigravityCommand ensures commands for Antigravity start an interactive session and reject resume or print/non-interactive flags.

func ValidateOpenCodeCommand added in v0.10.0

func ValidateOpenCodeCommand(command string) error

ValidateOpenCodeCommand keeps every session.create caller from selecting a provider conversation that Warren did not create. The CLI performs the same validation for agent create, but Desktop and Web launch presets call session.create directly and must receive the invariant at the Host boundary.

func ValidatePiCommand added in v0.12.0

func ValidatePiCommand(command string) error

ValidatePiCommand keeps every session.create caller from selecting a Pi conversation that Warren did not create. The CLI performs the same validation for agent create, but Desktop and Web launch presets call session.create directly and must receive the invariant at the Host boundary.

func ValidateQoderCommand added in v0.12.0

func ValidateQoderCommand(command string) error

ValidateQoderCommand keeps every session.create caller from selecting a Qoder conversation that Warren did not create. The CLI performs the same validation for agent create, but Desktop and Web launch presets call session.create directly and must receive the invariant at the Host boundary.

func WriteAgentState added in v0.12.0

func WriteAgentState(path, sessionID string, status api.AgentStatus) error

WriteAgentState persists a status reported by a hook. The write is atomic so the daemon never reads a half-written status file.

func WriteAgentStatus

func WriteAgentStatus(path string, status api.AgentStatus) error

WriteAgentStatus persists a status without a provider ID for callers that only need the legacy status-file format.

func WriteBinding

func WriteBinding(path string, binding Binding) error

WriteBinding persists the binding reported by a hook. It is safe for the hook and the daemon to race: both write the same structured JSON and the daemon only starts a watcher for a path that exists on disk.

Types

type ActivityTracker

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

ActivityTracker folds normalized transcript events into an AgentStatus. It owns lifecycle and liveness state; provider-specific attention observations can be applied through MarkAttention without teaching the tracker provider event names.

func NewActivityTracker

func NewActivityTracker() *ActivityTracker

NewActivityTracker starts an agent in the ready state: open and idle.

func (*ActivityTracker) Activity

func (t *ActivityTracker) Activity() api.AgentActivity

Activity returns the lifecycle portion of Status.

func (*ActivityTracker) ClearAttention

func (t *ActivityTracker) ClearAttention()

ClearAttention removes a pending human-facing condition without changing the current lifecycle state unless it was blocked or stalled by the attention.

func (*ActivityTracker) DrainTurns

func (t *ActivityTracker) DrainTurns() []api.AgentTurn

DrainTurns returns lifecycle transitions observed since the previous call.

func (*ActivityTracker) Exited

func (t *ActivityTracker) Exited()

Exited marks the agent process as gone.

func (*ActivityTracker) MarkAttention

func (t *ActivityTracker) MarkAttention(kind api.AgentAttentionKind, reason, requestID string, since time.Time)

MarkAttention applies a provider-neutral human-facing observation. The reducer owns the resulting activity so callers cannot accidentally create a yellow state without the corresponding blocked/warning lifecycle state.

func (*ActivityTracker) Observe

func (t *ActivityTracker) Observe(event api.AgentEvent)

Observe advances the tracker from one normalized transcript event.

func (*ActivityTracker) Status

func (t *ActivityTracker) Status() api.AgentStatus

Status returns the current complete presentation state.

func (*ActivityTracker) Tick

func (t *ActivityTracker) Tick(now time.Time)

Tick notices a tool call that has made no progress for the liveness grace period. It intentionally produces a stalled warning, never an input or approval request.

func (*ActivityTracker) Turn

func (t *ActivityTracker) Turn() uint64

Turn returns the current turn number. It remains stable after completion so events emitted at the boundary can still be associated with that turn.

func (*ActivityTracker) TurnAborted

func (t *ActivityTracker) TurnAborted()

TurnAborted is kept as a source-compatible alias for provider adapters that still use the older name. New adapters should call TurnInterrupted.

func (*ActivityTracker) TurnComplete

func (t *ActivityTracker) TurnComplete()

TurnComplete marks a finished turn. The agent is idle and ready for the next instruction.

func (*ActivityTracker) TurnFailed

func (t *ActivityTracker) TurnFailed()

TurnFailed marks a turn that ended with an error.

func (*ActivityTracker) TurnInterrupted added in v0.12.0

func (t *ActivityTracker) TurnInterrupted()

TurnInterrupted marks a provider-observed interruption. The provider does not know whether a Warren cancel command caused it, so Host correlation is deliberately left to the service layer.

func (*ActivityTracker) TurnStarted

func (t *ActivityTracker) TurnStarted()

TurnStarted marks the beginning of a new turn and clears attention from a request that the new user turn supersedes.

type AgentState added in v0.12.0

type AgentState struct {
	SessionID string          `json:"sessionId,omitempty"`
	Status    api.AgentStatus `json:"status"`
}

AgentState is the lifecycle status reported by a managed hook together with the provider conversation that produced it. The ID prevents a late SessionEnd from an older Codex thread from changing the current projection.

func ReadAgentState added in v0.12.0

func ReadAgentState(path string) (AgentState, error)

ReadAgentState returns the state recorded by the managed hook, or a zero state when the file is missing or malformed.

type Binding

type Binding struct {
	Provider       string    `json:"provider"`
	SessionID      string    `json:"sessionId"`
	TranscriptPath string    `json:"transcriptPath"`
	Cwd            string    `json:"cwd,omitempty"`
	UpdatedAt      time.Time `json:"updatedAt"`
}

Binding records which Codex/Claude conversation belongs to one Warren session. It is written by the Warren-managed SessionStart hook (Codex) or derived from the deterministic `--session-id` flag (Claude), and read by the daemon so transcript discovery is keyed by the CLI's own session ID instead of guessing by cwd and mtime.

func ReadBinding

func ReadBinding(path string) (*Binding, error)

ReadBinding returns nil when the file does not exist or is malformed; a malformed file is transient while a hook is mid-write, so callers retry.

type BindingCandidatesFinder added in v0.10.0

type BindingCandidatesFinder interface {
	FindBindings(ctx context.Context, warrenSessionID, kind, workspacePath string, after time.Time) ([]*OpenCodeBinding, error)
}

BindingCandidatesFinder is an optional extension used when more than one OpenCode session is created in the same workspace at nearly the same time. A caller can skip candidates already bound to another Warren session instead of repeatedly selecting the same earliest row.

type BindingFinder added in v0.10.0

type BindingFinder interface {
	FindBinding(ctx context.Context, warrenSessionID, kind, workspacePath string, after time.Time) (*OpenCodeBinding, error)
	FindBindingBySessionID(ctx context.Context, warrenSessionID, workspacePath, opencodeSessionID string) (*OpenCodeBinding, error)
}

BindingFinder is an additive interface. Finder remains source-compatible with the Codex/Claude file finder, while OpenCode callers can obtain the complete backend/session binding needed for a stable tailer.

type DefaultFinder

type DefaultFinder struct {
	// CodexRoot is the Codex sessions directory (default ~/.codex/sessions).
	CodexRoot string
	// ClaudeRoot is the Claude Code projects directory (default ~/.claude/projects).
	ClaudeRoot string
	// OpenCodeRoot overrides OpenCode's current data directory containing
	// opencode.db.
	OpenCodeRoot string
}

DefaultFinder implements Finder for the stock Codex and Claude Code layouts.

func (DefaultFinder) Find

func (f DefaultFinder) Find(ctx context.Context, kind, workspacePath string, after time.Time) (string, error)

func (DefaultFinder) FindBinding added in v0.10.0

func (f DefaultFinder) FindBinding(ctx context.Context, warrenSessionID, kind, workspacePath string, after time.Time) (*OpenCodeBinding, error)

DefaultFinder implements the stock Codex/Claude finder and OpenCode's current SQLite binding finder. The old Find method remains available for the other providers and returns the cache path for OpenCode.

func (DefaultFinder) FindBindingBySessionID added in v0.10.0

func (f DefaultFinder) FindBindingBySessionID(ctx context.Context, warrenSessionID, workspacePath, opencodeSessionID string) (*OpenCodeBinding, error)

func (DefaultFinder) FindBindings added in v0.10.0

func (f DefaultFinder) FindBindings(ctx context.Context, warrenSessionID, kind, workspacePath string, after time.Time) ([]*OpenCodeBinding, error)

type EventPoller added in v0.12.0

type EventPoller interface {
	PollEvents() []api.AgentEvent
}

EventPoller is implemented by Parsers that observe asynchronous states outside the transcript file (such as database queues).

type Finder

type Finder interface {
	Find(ctx context.Context, kind, workspacePath string, after time.Time) (string, error)
}

Finder locates the transcript file for a running Codex or Claude session. OpenCode uses BindingFinder to resolve its database-backed conversation and returns a Warren-owned cache path through this compatibility method. A missing file is not an error: the CLI may not be installed, may not have written a transcript yet, or may be running a version with a different layout. Callers retry until the file appears.

type OpenCodeBinding added in v0.10.0

type OpenCodeBinding struct {
	Provider      string `json:"provider"`
	SessionID     string `json:"sessionId"`
	Backend       string `json:"backend"`
	DataRoot      string `json:"dataRoot,omitempty"`
	DatabasePath  string `json:"databasePath,omitempty"`
	CachePath     string `json:"cachePath"`
	WorkspacePath string `json:"workspacePath,omitempty"`
}

OpenCodeBinding is the immutable identity used by one Warren session. A binding points at one OpenCode conversation, not at whichever conversation happens to be newest in the same checkout on the next poll.

func (OpenCodeBinding) Valid added in v0.10.0

func (b OpenCodeBinding) Valid() bool

type OpenCodeTailer added in v0.10.0

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

OpenCodeTailer polls one bound session and appends complete snapshots to its private cache. Failed writes and incomplete message/part races never mark a message as seen, so the next poll can recover the missing content.

func NewOpenCodeTailer added in v0.10.0

func NewOpenCodeTailer(binding OpenCodeBinding) (*OpenCodeTailer, error)

func StartOpenCodeSessionTailer added in v0.10.0

func StartOpenCodeSessionTailer(binding OpenCodeBinding) (*OpenCodeTailer, error)

StartOpenCodeSessionTailer starts the stable, bound tailer used by Service.

func (*OpenCodeTailer) Close added in v0.10.0

func (t *OpenCodeTailer) Close()

func (*OpenCodeTailer) Path added in v0.10.0

func (t *OpenCodeTailer) Path() string

Path returns the Warren-owned JSONL cache consumed by the transcript watcher.

func (*OpenCodeTailer) Poll added in v0.10.0

func (t *OpenCodeTailer) Poll(parent context.Context) (err error)

Poll performs one bounded read and is exported for deterministic fixtures.

func (*OpenCodeTailer) RemoveCache added in v0.10.0

func (t *OpenCodeTailer) RemoveCache() error

RemoveCache is reserved for explicit Warren session deletion. Close keeps the cache so a daemon restart can restore the structured conversation.

type Parser added in v0.12.0

type Parser interface {
	Parse(line []byte) []api.AgentEvent

	Status() api.AgentStatus
	Activity() api.AgentActivity
	DrainTurns() []api.AgentTurn
	Tick(now time.Time)
	// contains filtered or unexported methods
}

Parser converts raw transcript lines from a specific provider into normalized AgentEvents, tracking activity state and lifecycle turn transitions.

type ReadOptions

type ReadOptions struct {
	Recent       int
	ContentLimit int
	Full         bool
	IncludeTypes []string
	ExcludeTypes []string
	// Tools adds compact tool-call records to the conversation projection.
	// ToolOutput additionally includes the bounded raw tool results.
	ToolOutput bool
	Tools      bool
}

ReadOptions controls how a transcript is projected for an external caller. A zero Recent means that every matching event is returned. ContentLimit is ignored when Full is true; a zero ContentLimit uses the default limit.

type Watcher

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

Watcher tails one transcript file and emits normalized events. The first poll replays existing history; later polls only deliver newly appended lines. A truncated file restarts from byte zero without re-emitting the already-served prefix, which is acceptable for a best-effort side channel.

func Start

func Start(
	sessionID, provider, path string,
	onEvents func([]api.AgentEvent, api.AgentStatus),
	onStatus func(api.AgentStatus),
	onTurns func([]api.AgentTurn, bool),
) *Watcher

Start begins tailing path immediately in a background goroutine.

func (*Watcher) Close

func (w *Watcher) Close()

Close stops the poll loop and waits for it to finish.

func (*Watcher) Path

func (w *Watcher) Path() string

Path returns the transcript file being watched.

func (*Watcher) Snapshot

func (w *Watcher) Snapshot() []api.AgentEvent

Snapshot returns the retained event history.

func (*Watcher) WaitReady

func (w *Watcher) WaitReady(ctx context.Context) error

WaitReady waits until the initial transcript replay has established the current status and turn cursor.

Jump to

Keyboard shortcuts

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