Documentation
¶
Index ¶
- type Claude
- func (c *Claude) CanEmbed() bool
- func (c *Claude) Discover() ([]agent.Agent, error)
- func (c *Claude) FindSessionFile(a agent.Agent) string
- func (c *Claude) Name() string
- func (c *Claude) OTELEnv(endpoint string) string
- func (c *Claude) OTELServiceName() string
- func (c *Claude) ParseTrace(filePath string) ([]trace.Turn, error)
- func (c *Claude) RecentDirs(max int) []RecentDir
- func (c *Claude) ResumeCommand(a agent.Agent) *exec.Cmd
- func (c *Claude) SpawnArgs() SpawnArgs
- func (c *Claude) SpawnCommand(dir, model, mode string) *exec.Cmd
- func (c *Claude) SubagentAttrKeys() subagent.AttrKeys
- type Codex
- func (c *Codex) CanEmbed() bool
- func (c *Codex) Discover() ([]agent.Agent, error)
- func (c *Codex) FindSessionFile(a agent.Agent) string
- func (c *Codex) Name() string
- func (c *Codex) OTELEnv(endpoint string) string
- func (c *Codex) OTELServiceName() string
- func (c *Codex) ParseTrace(filePath string) ([]trace.Turn, error)
- func (c *Codex) RecentDirs(max int) []RecentDir
- func (c *Codex) ResumeCommand(a agent.Agent) *exec.Cmd
- func (c *Codex) SpawnArgs() SpawnArgs
- func (c *Codex) SpawnCommand(dir, model, mode string) *exec.Cmd
- func (c *Codex) SubagentAttrKeys() subagent.AttrKeys
- type Gemini
- func (g *Gemini) CanEmbed() bool
- func (g *Gemini) Discover() ([]agent.Agent, error)
- func (g *Gemini) FindSessionFile(a agent.Agent) string
- func (g *Gemini) Name() string
- func (g *Gemini) OTELEnv(endpoint string) string
- func (g *Gemini) OTELServiceName() string
- func (g *Gemini) ParseTrace(filePath string) ([]trace.Turn, error)
- func (g *Gemini) RecentDirs(max int) []RecentDir
- func (g *Gemini) ResumeCommand(a agent.Agent) *exec.Cmd
- func (g *Gemini) SpawnArgs() SpawnArgs
- func (g *Gemini) SpawnCommand(dir, model, mode string) *exec.Cmd
- func (g *Gemini) SubagentAttrKeys() subagent.AttrKeys
- type Provider
- type RecentDir
- type Role
- type Segment
- type SpawnArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Claude ¶
type Claude struct{}
Claude is a Provider implementation for the Claude Code CLI.
func (*Claude) Discover ¶
Discover finds all running Claude Code processes, then enriches each agent with CWD, tmux session, session JSONL data, and estimated cost. SDK-spawned agents sharing the same directory and model are grouped into single entries.
func (*Claude) FindSessionFile ¶
FindSessionFile resolves the session/trace file for a Claude agent. It first tries the session ID lookup, then falls back to finding the newest JSONL in the agent's working directory.
func (*Claude) OTELEnv ¶
OTELEnv returns env vars to enable Claude Code's OTEL tracing. Sets both generic and signal-specific endpoints with explicit paths to avoid OTEL SDK path-appending issues across different Node.js SDK versions. Uses http/protobuf protocol (port 4318).
func (*Claude) OTELServiceName ¶ added in v0.5.0
func (*Claude) ParseTrace ¶
ParseTrace reads a Claude JSONL session file and parses it into trace turns.
func (*Claude) RecentDirs ¶
RecentDirs returns recently-used project directories from Claude's session history (~/.claude/projects/). Each subdirectory is a dir-key (the encoded working directory path). The newest .jsonl in each subdirectory determines LastUsed.
func (*Claude) SpawnCommand ¶
SpawnCommand builds the exec.Cmd to launch a new Claude session.
Flags:
- --model <model> if model is set and not "default"
- --dangerously-skip-permissions if mode == "bypass"
- --permission-mode plan if mode == "plan"
func (*Claude) SubagentAttrKeys ¶ added in v0.5.0
SubagentAttrKeys returns the OTEL attribute names Claude uses for subagent identity.
type Codex ¶
type Codex struct{}
Codex is a Provider implementation for the OpenAI Codex CLI.
func (*Codex) CanEmbed ¶
CanEmbed returns false — Codex's TUI hangs inside an embedded PTY even with --no-alt-screen. Use trace view + J to jump out instead.
func (*Codex) Discover ¶
Discover finds running Codex CLI processes and recent session files. Running processes are discovered via ps; recent sessions (last 24h) without a running process are shown as idle so they can be resumed.
func (*Codex) FindSessionFile ¶
FindSessionFile resolves the session/trace file for a Codex agent. Returns "" if the agent has no WorkingDir or if the session file is stale (not modified in the last 24 hours).
func (*Codex) OTELEnv ¶
OTELEnv returns env vars to enable Codex CLI's OTEL tracing. Codex exports both traces (session spans) and log events.
func (*Codex) OTELServiceName ¶ added in v0.5.0
func (*Codex) ParseTrace ¶
ParseTrace reads a Codex JSONL session file and parses it into trace turns.
func (*Codex) RecentDirs ¶
RecentDirs returns recently-used project directories from Codex's session history (~/.codex/sessions/). Scans recursively for .jsonl files from the last 30 days, reads session_meta for CWD, deduplicates by path, sorts by newest first, and caps at max.
func (*Codex) SpawnCommand ¶
SpawnCommand builds the exec.Cmd to launch a new Codex session.
Flags:
- --no-alt-screen always
- --model <model> if model is set and not "default"
- --full-auto if mode == "full-auto"
- --sandbox workspace-write if mode is empty or "default"
func (*Codex) SubagentAttrKeys ¶ added in v0.5.0
SubagentAttrKeys returns zero AttrKeys — Codex doesn't support subagent tracking.
type Gemini ¶
type Gemini struct{}
Gemini is a Provider implementation for the Google Gemini CLI.
func (*Gemini) CanEmbed ¶
CanEmbed returns false because Gemini's TUI cannot run inside an embedded PTY.
func (*Gemini) Discover ¶
Discover finds running Gemini CLI processes and enriches them with session data from ~/.gemini/tmp/<project>/chats/.
func (*Gemini) FindSessionFile ¶
FindSessionFile resolves the session file for a Gemini agent. If the agent has a SessionID, it finds the matching session-*.json in chats/. Otherwise it falls back to the newest session file.
func (*Gemini) OTELEnv ¶
OTELEnv returns env vars to enable Gemini CLI's OTEL tracing. Gemini exports traces, metrics, and logs.
func (*Gemini) OTELServiceName ¶ added in v0.5.0
func (*Gemini) ParseTrace ¶
ParseTrace reads a Gemini session file and parses it into trace turns. Supports both logs.json (array of log entries) and session-*.json (session object with messages array) formats.
func (*Gemini) RecentDirs ¶
RecentDirs returns recently-used project directories from Gemini's projects.json, sorted by most recent session activity.
func (*Gemini) ResumeCommand ¶
ResumeCommand builds the command to resume the latest Gemini session.
func (*Gemini) SpawnCommand ¶
SpawnCommand builds the exec.Cmd to launch a new Gemini session.
Flags:
- --model <model> if model is set and not "default"
- --yolo if mode == "yolo"
- --approval-mode plan if mode == "plan"
func (*Gemini) SubagentAttrKeys ¶ added in v0.5.0
SubagentAttrKeys returns zero AttrKeys — Gemini doesn't support subagent tracking.
type Provider ¶
type Provider interface {
Name() string
Discover() ([]agent.Agent, error)
ResumeCommand(a agent.Agent) *exec.Cmd
// CanEmbed returns true if the agent's TUI can run inside an
// embedded PTY (split view). False means trace-only view with
// jump-out for interaction.
CanEmbed() bool
// FindSessionFile resolves the session/trace file for an agent.
// Each provider knows its own storage layout. Returns "" if none found.
FindSessionFile(a agent.Agent) string
// RecentDirs returns recently-used project directories from this
// provider's session history, sorted by most recent first.
RecentDirs(max int) []RecentDir
// SpawnCommand builds the exec.Cmd to launch a new agent session
// in the given directory with the specified model and mode.
SpawnCommand(dir, model, mode string) *exec.Cmd
// SpawnArgs returns the available models and modes for the launcher UI.
SpawnArgs() SpawnArgs
// ParseTrace reads a session/trace file and parses it into a
// provider-specific structured trace. Each provider knows its own
// log format (Claude JSONL, Codex JSONL, Gemini JSON).
ParseTrace(filePath string) ([]trace.Turn, error)
// OTELEnv returns the shell env var prefix needed to enable OTEL
// tracing for this provider, pointing at the given endpoint.
// Each provider knows its own OTEL activation mechanism.
OTELEnv(endpoint string) string
// OTELServiceName returns the service.name value this provider
// emits in OTEL resource attributes (e.g. "claude-code").
OTELServiceName() string
// SubagentAttrKeys returns the OTEL attribute names this provider
// uses for subagent identity. Return zero AttrKeys if the provider
// doesn't support subagent tracking.
SubagentAttrKeys() subagent.AttrKeys
}
Provider discovers and manages AI CLI agents of a specific type. Adding a new provider requires only implementing this interface and registering in app.go NewApp() — no other files need changes.