Documentation
¶
Overview ¶
Package session provides an explicit local archive of completed library conversations. It does not run a model or resume an interrupted operation.
Index ¶
- Variables
- type Archive
- func (a *Archive) Close() error
- func (a *Archive) Delete(ctx context.Context, id string, expected Revision) error
- func (a *Archive) List(ctx context.Context, after string, limit int) (Page, error)
- func (a *Archive) Load(ctx context.Context, id string) (Record, error)
- func (a *Archive) SaveCompleted(ctx context.Context, id string, expected Revision, r agent.Result, ...) (Revision, error)
- func (a *Archive) Search(ctx context.Context, query string, limit int) (SearchResult, error)
- type Config
- type Entry
- type Page
- type Record
- type Revision
- type SearchHit
- type SearchResult
Constants ¶
This section is empty.
Variables ¶
var ( ErrConfig = errors.New("session: invalid archive configuration") ErrStorage = errors.New("session: archive operation failed") ErrIncompatible = errors.New("session: incompatible archive or context") ErrNotFound = errors.New("session: record not found") ErrConflict = errors.New("session: record revision conflict") ErrIncomplete = errors.New("session: only successful completed results may be saved") ErrCorrupt = errors.New("session: invalid stored record") ErrLimit = errors.New("session: record or result limit exceeded") ErrBusy = errors.New("session: archive is busy") ErrSearchDisabled = errors.New("session: archive search is disabled") )
Functions ¶
This section is empty.
Types ¶
type Archive ¶
type Archive struct {
// contains filtered or unexported fields
}
Archive owns its database/sql handle. Open and schema upgrades must be serialized by the caller. Already-open handles may compete for a revision.
func Open ¶
Open opens a dedicated local SQLite archive. The parent directory and its contents must be trusted. It is not a filesystem sandbox or encrypted store.
func (*Archive) Delete ¶
Delete removes a record only if its revision matches. This is logical deletion, not secure erasure of old database pages, journals or backups.
func (*Archive) List ¶
List returns a bounded lexically ordered page of record identifiers. Multiple pages are not a transactionally frozen snapshot.
func (*Archive) SaveCompleted ¶
func (a *Archive) SaveCompleted(ctx context.Context, id string, expected Revision, r agent.Result, runErr error) (Revision, error)
SaveCompleted stores only a result explicitly supplied with its Run error. Empty expected creates; a nonempty expected conditionally replaces. If an operation returns an error, inspect the record before retrying: an interrupted caller cannot infer that a commit did not occur.
type Config ¶
type Config struct {
Context string
NativeFormat string
// EnableSearch opts into a persistent index of visible user/assistant text.
// Once enabled, every open must use this option. No downgrade is provided.
EnableSearch bool
}
Config binds an archive to a caller-selected, non-secret application context. NativeFormat is empty by default, which rejects native data. These labels are not an authentication or isolation mechanism.
type Record ¶
type Record struct {
ID string
Revision Revision
Messages []agent.Message
Verification *agent.VerificationReport
}
Record contains a completed history. Loading it never executes tools.
type Revision ¶
type Revision string
Revision is an opaque record-version string, not an access token.
type SearchHit ¶
SearchHit identifies a visible message in an observed record revision. Snippet is display text, not an executable instruction or whole history.
type SearchResult ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
recordcodec
Package recordcodec owns the private version-one persisted record format.
|
Package recordcodec owns the private version-one persisted record format. |
|
sqlitefile
Package sqlitefile owns the archive's private SQLite file and connection policy.
|
Package sqlitefile owns the archive's private SQLite file and connection policy. |