Documentation
¶
Overview ¶
Package memoryruntime owns model-backed memory injection and hidden turn extraction.
Index ¶
- type Config
- type ModelResolver
- type OrganizerRun
- type OrganizerScheduler
- type OrganizerTrigger
- type Runtime
- func (r *Runtime) Abandoned(sessionID string, user ai.Message)
- func (r *Runtime) ApplyOrganizerRun(ctx context.Context, runID string) (OrganizerRun, error)
- func (r *Runtime) Close() error
- func (r *Runtime) Completed(parent context.Context, turn agent.MemoryTurn)
- func (r *Runtime) Inject(ctx context.Context, workdir string) (string, error)
- func (r *Runtime) NewOrganizerScheduler(ctx context.Context, workdir string, enabled bool, interval time.Duration) *OrganizerScheduler
- func (r *Runtime) OrganizerHistory() []OrganizerRun
- func (r *Runtime) RunOrganizer(ctx context.Context, workdir string, trigger OrganizerTrigger) (OrganizerRun, error)
- func (r *Runtime) StartOrganizerScheduler(ctx context.Context, workdir string, interval time.Duration) func()
- func (r *Runtime) Tools(workdir func() string) []tools.Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OrganizerRun ¶
type OrganizerRun struct {
RunID string `json:"runId"`
Epoch uint64 `json:"epoch"`
Executor string `json:"executorId"`
Trigger OrganizerTrigger `json:"trigger"`
Phase string `json:"phase"`
Status string `json:"status"`
Workdir string `json:"workdir,omitempty"`
Model string `json:"model,omitempty"`
Scanned int `json:"scanned"`
Clusters int `json:"clusters"`
Applied int `json:"applied"`
Risk string `json:"risk"`
Pending []memory.Decision `json:"pending,omitempty"`
Warnings []string `json:"warnings,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
type OrganizerScheduler ¶ added in v0.107.28
type OrganizerScheduler struct {
// contains filtered or unexported fields
}
OrganizerScheduler runs the organizer every interval while enabled. Each countdown starts when the scheduler starts, when Update is called and when the previous scheduled run returns, so runs never overlap.
func (*OrganizerScheduler) Close ¶ added in v0.107.28
func (s *OrganizerScheduler) Close()
Close stops the loop, cancelling a run in progress, and waits for it.
func (*OrganizerScheduler) State ¶ added in v0.107.28
func (s *OrganizerScheduler) State() (enabled bool, interval time.Duration)
State is the schedule the loop currently follows.
func (*OrganizerScheduler) Update ¶ added in v0.107.28
func (s *OrganizerScheduler) Update(enabled bool, interval time.Duration)
Update applies a new schedule without restarting the loop: disabling stops future runs (a run in progress finishes), and enabling or changing the interval restarts the countdown from now. A non-positive interval means 24h.
type OrganizerTrigger ¶
type OrganizerTrigger string
const ( OrganizerManual OrganizerTrigger = "manual" OrganizerScheduled OrganizerTrigger = "scheduled" )
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func (*Runtime) Abandoned ¶ added in v0.107.6
Abandoned keeps the user message of a stopped or failed turn for the session's next completed turn; it stays in History, which later turns treat as context only.
func (*Runtime) ApplyOrganizerRun ¶
func (*Runtime) Completed ¶
func (r *Runtime) Completed(parent context.Context, turn agent.MemoryTurn)
func (*Runtime) NewOrganizerScheduler ¶ added in v0.107.28
func (r *Runtime) NewOrganizerScheduler(ctx context.Context, workdir string, enabled bool, interval time.Duration) *OrganizerScheduler
NewOrganizerScheduler starts a scheduled organizer loop that can be paused, resumed and given a new interval while it runs (see OrganizerScheduler.Update). A non-positive interval means 24h.
func (*Runtime) OrganizerHistory ¶
func (r *Runtime) OrganizerHistory() []OrganizerRun
func (*Runtime) RunOrganizer ¶
func (r *Runtime) RunOrganizer(ctx context.Context, workdir string, trigger OrganizerTrigger) (OrganizerRun, error)
RunOrganizer executes the auditable scan -> cluster -> plan -> gate -> apply flow. Manual runs stop at gate and can be applied later with ApplyOrganizerRun.