Documentation
¶
Overview ¶
Package sessionpicker lists historical sessions from supported ACP agent backends so a user can pick one and resume it.
Pickers read the agent's on-disk session store directly — they do not require the agent process to be running. Each backend has its own location and format (see individual implementations).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClaudePicker ¶
type ClaudePicker struct {
// BaseDir overrides the default ~/.claude/projects path. Mainly
// for tests; leave empty in production.
BaseDir string
}
ClaudePicker reads sessions written by @agentclientprotocol/claude-agent-acp.
On-disk layout: ~/.claude/projects/<encoded-cwd>/<session-id>.jsonl, where <encoded-cwd> replaces every non-alphanumeric rune in the absolute cwd with '-'. Each JSONL file is an event stream; the first line is typically a file-history-snapshot followed by user/assistant messages, each carrying its own cwd / sessionId / timestamp.
func NewClaudePicker ¶
func NewClaudePicker(baseDir string) *ClaudePicker
NewClaudePicker returns a picker that reads sessions from baseDir, or from the user's default Claude projects location when baseDir is empty.
func (*ClaudePicker) AgentType ¶
func (c *ClaudePicker) AgentType() string
type CodexPicker ¶
type CodexPicker struct {
// HistoryPath overrides the default ~/.codex/history.jsonl.
// Mainly for tests; leave empty in production.
HistoryPath string
}
CodexPicker reads sessions indexed by OpenAI Codex CLI in ~/.codex/history.jsonl.
Unlike the other three backends, Codex keeps a flat, append-only index file rather than per-session directories: each line records a single prompt as {"session_id": ..., "ts": unix_seconds, "text": ...}. One session may therefore span many lines. The picker groups by session_id, keeping the earliest text as the title and the latest ts as UpdatedAt.
Limitation: the history entries carry no cwd, so cwd filtering is impossible — passing a non-empty cwd returns no results rather than silently ignoring the filter, to avoid misleading a caller who believed they were scoping results.
func NewCodexPicker ¶
func NewCodexPicker(historyPath string) *CodexPicker
NewCodexPicker returns a picker that reads sessions from historyPath, or from the user's default Codex location when historyPath is empty.
func (*CodexPicker) AgentType ¶
func (c *CodexPicker) AgentType() string
type CopilotPicker ¶
type CopilotPicker struct {
// BaseDir overrides the default ~/.copilot/session-state path.
// Mainly for tests; leave empty in production.
BaseDir string
}
CopilotPicker reads sessions written by GitHub Copilot CLI.
On-disk layout: ~/.copilot/session-state/<session-id>/ with
- workspace.yaml : session metadata
- events.jsonl : full event log
- optional plan.md / checkpoints/ / files/
The GitHub docs describe that these files exist but do not publish a field-level schema, so the YAML loader below accepts several common key names (`session_id` / `id`, `cwd` / `workdir`, `title` / `name` / `summary`) and falls back to the first user event in events.jsonl when workspace.yaml is absent or missing a title.
func NewCopilotPicker ¶
func NewCopilotPicker(baseDir string) *CopilotPicker
NewCopilotPicker returns a picker that reads sessions from baseDir, or from the user's default Copilot CLI location when baseDir is empty.
func (*CopilotPicker) AgentType ¶
func (c *CopilotPicker) AgentType() string
type GeminiPicker ¶ added in v0.30.0
type GeminiPicker struct {
// BaseDir overrides the default ~/.gemini/tmp path. Mainly for tests.
BaseDir string
}
GeminiPicker reads sessions written by gemini-cli's ACP mode.
On-disk layout: <baseDir>/<project-tmp-id>/chats/session-<TS>-<id8>.jsonl, where <baseDir> is ~/.gemini/tmp by default. Each chats/ directory belongs to one project; gemini-cli derives the directory name either via a project registry (newer versions) or via sha256(cwd) (legacy). Because that mapping is opaque from quill's side, the picker walks every project directory and filters by the per-session `projectHash` field stored inside the file — `projectHash` is always sha256(cwd) regardless of how the parent directory was named.
Each .jsonl file is an event stream:
- Optional initial metadata line (Partial<ConversationRecord>): {"sessionId":"...","projectHash":"...","startTime":"...","lastUpdated":"..."}
- Followed by message records (`{"id":..,"timestamp":..,"type":"user"|"gemini",..}`), `$set` metadata updates, and `$rewindTo` markers (ignored here).
Subagent sessions (`kind:"subagent"`) are implementation details of tool calls and are skipped, mirroring the upstream session browser.
func NewGeminiPicker ¶ added in v0.30.0
func NewGeminiPicker(baseDir string) *GeminiPicker
NewGeminiPicker returns a picker that reads sessions from baseDir, or from the user's default ~/.gemini/tmp location when baseDir is empty.
func (*GeminiPicker) AgentType ¶ added in v0.30.0
func (g *GeminiPicker) AgentType() string
type KiroPicker ¶
type KiroPicker struct {
// BaseDir overrides the default ~/.kiro/sessions/cli path. Mainly
// for tests; leave empty in production.
BaseDir string
// AgentName, when non-empty, restricts List results to sessions
// whose stored `agent_name` matches. Kiro binds each session to the
// agent that created it and refuses `session/load` across agent
// boundaries (returns Internal error), so listing mismatched
// sessions in the picker would only produce unloadable entries.
// Leave empty to show every session regardless of agent.
AgentName string
}
KiroPicker reads sessions from ~/.kiro/sessions/cli/*.json.
Each session lives as a pair on disk: <uuid>.json holds the metadata (session_id, cwd, title, timestamps) and <uuid>.jsonl holds the conversation stream. Only the .json metadata file is consulted here.
func NewKiroPicker ¶
func NewKiroPicker(baseDir string) *KiroPicker
NewKiroPicker returns a picker that reads sessions from baseDir, or from the user's default Kiro location when baseDir is empty.
func (*KiroPicker) AgentType ¶
func (k *KiroPicker) AgentType() string
type Picker ¶
type Picker interface {
// AgentType returns a stable identifier for the backend, matching
// the agent binary name (e.g. "kiro-cli", "claude-agent-acp").
AgentType() string
// List returns sessions newest first. If cwd is non-empty, only
// sessions matching that working directory are returned. If limit
// is > 0, at most that many results are returned.
List(cwd string, limit int) ([]Session, error)
}
Picker lists sessions for one agent backend.