Documentation
¶
Overview ¶
Package contextprofile stores the owner's named contexts and their pins. It owns persistence, revision checks and backups; resolution and tool enforcement belong to the host.
Index ¶
- Constants
- Variables
- type Backup
- type Lifetime
- type Pin
- type Record
- type Scope
- type Store
- func (s *Store) Delete(ctx context.Context, name, revision, reason string, force bool) error
- func (s *Store) Get(ctx context.Context, name string) (Record, error)
- func (s *Store) History(ctx context.Context, name string) ([]Backup, error)
- func (s *Store) List(ctx context.Context) ([]Record, error)
- func (s *Store) Pin(ctx context.Context, name string, scope Scope) (Pin, error)
- func (s *Store) PinFor(ctx context.Context, scope Scope) (*Pin, error)
- func (s *Store) Put(ctx context.Context, p steer.Preset, revision, reason string) (Record, error)
- func (s *Store) Unpin(ctx context.Context, id string) error
Constants ¶
const LifetimeUntilUnpinned = "until-unpinned"
LifetimeUntilUnpinned is the only pin lifetime so far: stored, it survives a restart.
const ScopeConversation = "conversation"
ScopeConversation is the only pin scope so far: the embedded agent's or a local Nanite seat's conversation.
Variables ¶
var ( ErrNotFound = errors.New("context not found") ErrConflict = errors.New("context changed; read its current revision before writing") ErrInvalid = errors.New("invalid context") )
var ErrPinned = errors.New("context is pinned; unpin it first or delete with force")
ErrPinned refuses deleting a context that a live pin names, unless forced.
Functions ¶
This section is empty.
Types ¶
type Pin ¶ added in v0.28.6
type Pin struct {
ID string `json:"id"`
Context string `json:"context"`
Scope Scope `json:"scope"`
Lifetime Lifetime `json:"lifetime"`
Origin string `json:"origin"`
CreatedAt string `json:"created_at"`
}
Pin makes a saved context active in a scope. A pin names the context, so an edit of the context applies from the next turn.
type Record ¶
type Record struct {
steer.Preset
Revision string `json:"revision"`
UpdatedAt string `json:"updated_at"`
}
Record keeps the authored definition separate from any resolved context.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) Delete ¶
Delete removes a context. A context a pin names is refused with ErrPinned unless force, which removes its pins in the same transaction.
func (*Store) History ¶
History returns superseded and deleted definitions, newest first. Restoring one uses Put with the current revision; backups never bypass optimistic concurrency.
func (*Store) Pin ¶ added in v0.28.6
Pin pins an existing context to a scope, replacing the scope's earlier pin.