Documentation
¶
Overview ¶
Package snapshots implements pre-edit file rollback per docs/design.md §8.4.
Before any tool that mutates files, the agent calls Take(sessionID, stepIdx, paths). Each affected file is copied into:
.deepseek/snapshots/<sessionID>/<stepIdx>/<base64-of-relpath>
/undo restores the most-recent step's snapshots; /undo N restores N steps. Prune trims to the most recent K sessions.
Snapshots never include directories — only files we observe being touched by name. Bash commands hand AffectedPaths==nil to the agent, so destructive bash is handled by the Duet validator and the permission prompt, not by pre-snapshot.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns the on-disk snapshot directory tree. Construct with New.
All exported mutating operations (Take/Undo/Prune) hold mu so concurrent callers cannot interleave reads of the step-dir listing with removals.
func New ¶
New returns a Manager rooted at .deepseek/snapshots under cwd. Passing a non-empty rootOverride is for tests.
func (*Manager) HasSnapshots ¶
HasSnapshots reports whether the session has any unconsumed snapshots.
func (*Manager) Prune ¶
Prune removes snapshot dirs for sessions not in `keepSessionIDs`. Typical usage: keep the most recent 30 session IDs from the store.