Documentation
¶
Overview ¶
Missions an operator runs, each an objective with a plan the agent keeps current, persisted as session records
Index ¶
- Constants
- func IDFrom(ctx context.Context) string
- func NormalizeSteps(steps []Step) error
- func WithID(ctx context.Context, id string) context.Context
- type Change
- type Mission
- type Op
- type SessionPlan
- type Step
- type Store
- func (s *Store) Assign(id, agent string) (Mission, error)
- func (s *Store) Attach(sess *session.Session)
- func (s *Store) Create(objective string) (Mission, error)
- func (s *Store) Finish(id, status, reason string) (Mission, error)
- func (s *Store) Get(id string) (Mission, bool)
- func (s *Store) Len() int
- func (s *Store) List() []Mission
- func (s *Store) OnChange(fn func(Change))
- func (s *Store) Remove(id string) bool
- func (s *Store) Restore(sess *session.Session) error
- func (s *Store) Resume(id string) (Mission, error)
- func (s *Store) SetNote(id, note string) (Mission, error)
- func (s *Store) SetPlan(id string, steps []Step) (Mission, error)
- func (s *Store) SetStep(id string, n int, status string) (Mission, error)
- type Tool
Constants ¶
const ( StepPending = "pending" StepActive = "active" StepDone = "done" StepSkipped = "skipped" )
const ( StatusActive = "active" StatusDone = "done" StatusFailed = "failed" StatusCancelled = "cancelled" )
const RecordKind = "mission"
Kind of record a session keeps for every mission change
const SessionPlanKind = "session_plan"
Kind of record holding the working plan of a session with no mission attached
const ToolName = "Plan"
Name the model calls to keep its plan current
Variables ¶
This section is empty.
Functions ¶
func NormalizeSteps ¶
Trims step text, fills empty statuses with pending and rejects unknown statuses
Types ¶
type Change ¶
One mission change as listeners and the session log see it, flat so records without an op still read as updates
type Mission ¶
type Mission struct {
ID string `json:"id"`
Objective string `json:"objective"`
Plan []Step `json:"plan,omitempty"`
Agents []string `json:"agents,omitempty"`
Status string `json:"status"`
Started time.Time `json:"started"`
Finished time.Time `json:"finished,omitempty"`
Note string `json:"note,omitempty"`
// Why the mission failed or was cancelled
Error string `json:"error,omitempty"`
}
One objective with the plan, agents and outcome attached to it
type SessionPlan ¶
Working plan a run keeps on its session while no mission is attached
func CurrentSessionPlan ¶
func CurrentSessionPlan(sess *session.Session) (SessionPlan, bool)
Working plan last kept on the session, false when none was
func (SessionPlan) Format ¶ added in v1.0.11
func (p SessionPlan) Format() string
Numbered steps of the plan with the share done on top, as the tool reports them
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Missions keyed by id with change listeners and session persistence
func (*Store) Assign ¶
Records that an agent works on the mission, writing nothing when it already is listed
func (*Store) Restore ¶
Rebuilds the store from the mission records of a session, replaying adds, updates and removes in order
type Tool ¶
type Tool struct {
// Store of the calling run
Resolve func(context.Context) *Store
// Session of the calling run, holding the plan while no mission is attached
Session func(context.Context) *session.Session
}
Tool that replaces the plan of the mission the calling run serves, or of its session when no mission is attached
func (Tool) Annotations ¶
func (Tool) Annotations() tool.Annotations