Documentation
¶
Overview ¶
Package missionchanges answers two oversight questions from a mission's already-journaled work: what the unit changed, and whether its attention wandered outside its workspace. It is a pure consumer of the replay journal and never gates.
Index ¶
Constants ¶
const ( StatusAdded = "added" StatusModified = "modified" StatusDeleted = "deleted" )
The three status strings ChangedFile.Status draws from.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangedFile ¶
type ChangedFile struct {
Path string `json:"path"`
Status string `json:"status"` // "added" | "modified" | "deleted"
Score int `json:"score"`
}
ChangedFile is one file the mission's unit wrote, with Score its Stage-1 DOI and Status derived from the first and last diff seen.
type Changes ¶
type Changes struct {
Files []ChangedFile `json:"files"`
Incomplete bool `json:"incomplete"`
Scope ScopeStats `json:"scope"`
}
Changes is the GET /missions/{id}/changes response, with Files always non-nil and Incomplete set when the list was capped.
type Diff ¶
type Diff struct {
Original string `json:"original"`
Modified string `json:"modified"`
Truncated bool `json:"truncated,omitempty"`
}
Diff is the GET /missions/{id}/changes/diff?path= response fed to Monaco's DiffEditor; Truncated is set when either side was clipped.
type ScopeStats ¶
type ScopeStats struct {
Files int `json:"files"`
Dirs int `json:"dirs"`
Anomaly bool `json:"anomaly"`
OutsidePaths []string `json:"outsidePaths,omitempty"`
}
ScopeStats is the Stage-2 scope summary: how broadly the unit ranged and whether it left its lane; all fields are advisory.
type Service ¶
type Service interface {
// Changes folds mission id's session journal into the ordered changed-files list plus the scope summary; a mission whose unit left no recoverable journal yields an empty, non-error Changes.
Changes(ctx context.Context, missionID string) (*Changes, error)
// Diff returns the {original, modified} pair for one changed path in mission id, truncated to diffDisplayCap; a path the mission never wrote yields a not-found error.
Diff(ctx context.Context, missionID, filePath string) (*Diff, error)
}
Service answers the two attention-layer endpoints and is read-only by construction: no method here mutates a mission.
func New ¶
func New(missions missionGetter, journal SessionJournalReader) Service
New builds the service over a mission resolver and the kernel journal reader; journal may be nil, in which case every mission reads as having no recorded work.
type SessionJournalReader ¶
type SessionJournalReader interface {
SessionJournal(instanceID string, sessionID libacp.SessionID) ([]libacp.SessionNotification, string, bool)
}
SessionJournalReader is the kernel capability, reached by type assertion, that returns a session's raw journal; ok is false for an unknown instance or session.