Documentation
¶
Overview ¶
Package filetime tracks file read operations to enforce "read before edit" semantics. Each Tracker instance maintains its own read map, providing per-session isolation (parent assistant and each subagent get independent tracking).
Index ¶
- Variables
- func WithTracker(ctx context.Context, t *Tracker) context.Context
- type Tracker
- func (t *Tracker) AssertRead(path string) error
- func (t *Tracker) ClearRead(path string)
- func (t *Tracker) Policy() tool.ReadBeforePolicy
- func (t *Tracker) RecordRead(path string)
- func (t *Tracker) RuntimeOverride() *tool.ReadBeforePolicy
- func (t *Tracker) SetPolicy(p tool.ReadBeforePolicy)
- func (t *Tracker) WasRead(path string) bool
Constants ¶
This section is empty.
Variables ¶
var ErrReadRequired = errors.New("file was modified or not yet read — read it again to see current content before making changes")
ErrReadRequired is returned when a file must be read before editing.
Functions ¶
Types ¶
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker tracks file reads and carries the read-before enforcement policy for a single session boundary (parent assistant or individual subagent).
All methods are nil-safe: a nil Tracker is a no-op for mutations and returns sane defaults for queries. This allows tools to call FromContext(ctx).RecordRead(...) without nil-checking, even when no Tracker is on the context (e.g. aura tools subcommand).
func FromContext ¶
FromContext extracts the Tracker from the context, or nil. A nil Tracker is safe to use — all methods are nil-safe.
func NewTracker ¶
func NewTracker(policy tool.ReadBeforePolicy) *Tracker
NewTracker creates a Tracker with the given base policy and an empty read map.
func (*Tracker) AssertRead ¶
AssertRead returns ErrReadRequired if file was not read.
func (*Tracker) Policy ¶
func (t *Tracker) Policy() tool.ReadBeforePolicy
Policy returns the effective read-before policy.
func (*Tracker) RecordRead ¶
RecordRead marks a file as read.
func (*Tracker) RuntimeOverride ¶
func (t *Tracker) RuntimeOverride() *tool.ReadBeforePolicy
RuntimeOverride returns the runtime policy override, or nil if none was set. Used by subagent construction to decide whether to override the child's config-resolved policy with the parent's session-wide runtime decision.
func (*Tracker) SetPolicy ¶
func (t *Tracker) SetPolicy(p tool.ReadBeforePolicy)
SetPolicy records a runtime policy override. This is called from the /readbefore slash command and session resume — both represent deliberate non-default policy that should propagate to subagents.