Documentation
¶
Overview ¶
Package ops is Operations: the owner's workstream board. Each workstream is one revisioned Caster document under the ops/v1 contract (caster://ops/ws.<id>), the Queued band's order is one document (caster://ops/queue), and the module's database is only a working copy read again every 15 seconds. Workstreams nest: a workstream is a concept of any size, with an optional parent. Activity and tasks are read from Torque (and the Tesseract status stream where a workstream names one) and rolled up from children. README.md has the format.
Ops reaches Tether through its own allowlisted link. It never launches anything: no session, team, dispatch or claim tool is on its list, whatever is asked.
Index ¶
- Constants
- Variables
- func CountsText(c map[string]int) string
- func DocRef(name string) string
- func Finished(s string) bool
- func ReadStage(s string) string
- func ReadTracker(path string) ([]byte, error)
- func Ref(id string) string
- func ValidID(id string) bool
- func ValidStage(s string) bool
- func WSName(id string) string
- func When(s string) time.Time
- type Board
- type Body
- type Brief
- type BriefAgent
- type BriefBudget
- type BriefChange
- type BriefFleet
- type BriefItem
- type BriefSection
- type BriefSource
- type Card
- type Caster
- type Check
- type Conflict
- type Correlation
- type Doc
- func (d *Doc) Bool(key string) bool
- func (d *Doc) Decode(key string, v any) error
- func (d *Doc) Del(key string)
- func (d *Doc) Has(key string) bool
- func (d *Doc) Num(key string) float64
- func (d *Doc) Set(key string, v any) error
- func (d *Doc) Str(key string) string
- func (d *Doc) String() string
- func (d *Doc) Strings(key string) []string
- type Entry
- type FleetDisk
- type FleetHost
- type FleetMetrics
- type FleetResult
- type FleetSample
- type GatewayCaster
- func (g GatewayCaster) Get(ctx context.Context, name string, rev int) (Item, bool, error)
- func (g GatewayCaster) List(ctx context.Context) ([]Head, error)
- func (g GatewayCaster) Log(ctx context.Context, name string) ([]Revision, error)
- func (g GatewayCaster) Put(ctx context.Context, name, content, title, mime string) (int, error)
- type Head
- type Held
- type Holder
- type InputError
- type Item
- type Link
- type NewWorkstream
- type OrchestrationRequest
- type Patch
- type Phase
- type Plan
- type Revision
- type Rollup
- type Section
- type SeedConcept
- type SeedFollowup
- type SeedItem
- type SeedPlan
- type SeedResult
- type SessionRow
- type SessionsResult
- type Store
- func (s *Store) All(ctx context.Context) (Board, error)
- func (s *Store) Apply(ctx context.Context, p SeedPlan, by string) (SeedResult, error)
- func (s *Store) At(ctx context.Context, id string, rev int) (Item, bool, error)
- func (s *Store) Cached(ctx context.Context) map[string]Rollup
- func (s *Store) ClaimPlan(ctx context.Context, id string) error
- func (s *Store) Create(ctx context.Context, in NewWorkstream, by string) (Workstream, error)
- func (s *Store) Followups(ctx context.Context) []string
- func (s *Store) Get(ctx context.Context, id string) (Workstream, bool, error)
- func (s *Store) LastError() string
- func (s *Store) Link(ctx context.Context, id string, l Link) (Workstream, error)
- func (s *Store) Log(ctx context.Context, id string) ([]Revision, error)
- func (s *Store) Move(ctx context.Context, id, to, why, by string) (Workstream, error)
- func (s *Store) NewPlan(ctx context.Context, p SeedPlan) (SeedPlan, error)
- func (s *Store) Plan(ctx context.Context, id string) (SeedPlan, bool, error)
- func (s *Store) Refresh(ctx context.Context, force bool) (int, error)
- func (s *Store) Refreshed() time.Time
- func (s *Store) ReleasePlan(ctx context.Context, id string) error
- func (s *Store) Reorder(ctx context.Context, id, before, after, dir string) ([]string, error)
- func (s *Store) SavePlan(ctx context.Context, p SeedPlan) error
- func (s *Store) Settle(ctx context.Context, id string, baseRev int, tracking Rollup, by string) (Workstream, error)
- func (s *Store) Unlink(ctx context.Context, id, kind, ref string) (Workstream, error)
- func (s *Store) Unsettle(ctx context.Context, id string, baseRev int, by string) (Workstream, error)
- func (s *Store) Update(ctx context.Context, id string, baseRev int, p Patch) (Workstream, error)
- type Taken
- type Task
- type Tick
- type Tracker
- type TrackerThread
- type Transition
- type UsageAlert
- type UsageBudget
- type UsageCard
- type UsageDetail
- type UsageEvent
- type UsageResult
- type UsageSpend
- type UsageTotals
- type UsageWindow
- type Workstream
Constants ¶
const ( HolderLive = "live" HolderNone = "none" HolderUnknown = "unknown" )
Liveness of a task's holder.
const ( StagePlanned = "planned" StageParked = "parked" StageQueued = "queued" StageInFlight = "in_flight" StageLanding = "landing" StageComplete = "complete" StageDropped = "dropped" )
The owner's six lifecycle stages, plus the separate discarded state.
const Contract = "v1"
Contract is the value of a workstream's `ops:` key.
const FollowupsName = "followups"
FollowupsName is the document of the owner's follow-ups the seed could not place.
const Namespace = "ops"
Namespace is Ops' namespace in Caster.
const QueueName = "queue"
QueueName is the queue's document name.
const SourceLiveness = "liveness"
SourceLiveness is the feed source for "assigned, no live agent" rows.
Variables ¶
var ( // ErrNoCaster says there is no way to reach Caster configured. ErrNoCaster = errors.New("Caster is not reachable: set ops.tether_command (or ops.tether_url) in Settings") // ErrNotFound says there is no such workstream. ErrNotFound = errors.New("there is no such workstream") )
var ErrApplied = errors.New("this preview was applied already; make a new one")
ErrApplied says a preview was applied already (or is being applied): make a new one.
var StageLabel = map[string]string{ StagePlanned: "Planned", StageParked: "Parked", StageQueued: "Queued", StageInFlight: "In Flight", StageLanding: "Landing", StageComplete: "Complete", StageDropped: "Dropped", }
StageLabel is a stage as a person reads it.
var Stages = []string{StagePlanned, StageParked, StageQueued, StageInFlight, StageLanding, StageComplete, StageDropped}
Stages are the lifecycle in board order, followed by the optional discarded state.
Functions ¶
func CountsText ¶
CountsText is a roll-up as a card says it: "2 doing · 1 review · 5 todo".
func ReadStage ¶ added in v0.12.0
ReadStage maps legacy ops/v1 and tracker vocabulary without changing the document. Unknown values remain unknown so migration callers can flag them for review.
func ReadTracker ¶
ReadTracker reads a tracker from a path on this machine: an absolute path to a regular .json file (not a link), opened once and read to at most maxTracker bytes. Only the owner's page gives a path.
func ValidID ¶
ValidID reports whether id can name a workstream: a slug of 3 to 64 letters, digits and dashes, not ending in a dash (the page's Cite detector drops a trailing dash as punctuation). It is also the Registry workstream key (1:1), so it is never re-keyed.
func ValidStage ¶
ValidStage reports whether s is a current stage accepted for new writes.
Types ¶
type Board ¶
type Board struct {
Workstreams []Workstream `json:"workstreams"`
// Queue is the Queued band in launch order: every workstream at stage queued, in the
// order the queue document gives, then any it does not name yet (oldest first).
Queue []string `json:"queue"`
}
Board is every workstream in the copy and the queue order.
func (Board) Descendants ¶
func (b Board) Descendants(id string) []Workstream
Descendants are a workstream's children, theirs, and so on (not itself), from b. All has already broken loops and over-deep chains, so every level is walked.
type Body ¶
Body is an item's body split on its "## " headings. Text before the first heading and sections with headings the kind does not name are kept as they are.
type Brief ¶ added in v0.15.0
type Brief struct {
GeneratedAt string `json:"generated_at"`
Since string `json:"since"`
Scope string `json:"scope"`
Sources []BriefSource `json:"sources"`
Warnings []string `json:"warnings,omitempty"`
NeedsMe BriefSection `json:"needs_me"`
Stalled BriefSection `json:"stalled"`
ChangedSince BriefSection `json:"changed_since"`
Suggestions BriefSection `json:"suggestions"`
InFlight BriefSection `json:"in_flight"`
Untracked BriefSection `json:"untracked"`
Fleet BriefFleet `json:"fleet"`
Budgets []BriefBudget `json:"budgets"`
Gaps []string `json:"gaps"`
Markdown string `json:"markdown"`
}
type BriefAgent ¶ added in v0.15.0
type BriefBudget ¶ added in v0.15.0
type BriefChange ¶ added in v0.15.0
type BriefFleet ¶ added in v0.15.0
type BriefItem ¶ added in v0.15.0
type BriefItem struct {
ID string `json:"id"`
Ref string `json:"ref"`
Title string `json:"title"`
Stage string `json:"stage"`
Owner string `json:"owner,omitempty"`
Why string `json:"why,omitempty"`
Latest string `json:"latest,omitempty"`
At string `json:"at,omitempty"`
Age string `json:"age,omitempty"`
Refs []string `json:"refs,omitempty"`
// In flight only.
Counts map[string]int `json:"counts,omitempty"`
Doing []string `json:"doing,omitempty"`
Agents []BriefAgent `json:"agents,omitempty"`
// Changed only: the moves and activity since the window opened, newest first.
Changes []BriefChange `json:"changes,omitempty"`
}
BriefItem is one line of a section: an item, why it is there, and refs to its sources.
type BriefSection ¶ added in v0.15.0
type BriefSource ¶ added in v0.15.0
type Card ¶
type Card struct {
Workstream
Tasks string `json:"tasks,omitempty"`
TaskCounts map[string]int `json:"task_counts,omitempty"`
TaskList []Task `json:"task_list,omitempty"`
Last *Entry `json:"last,omitempty"`
Suggest string `json:"suggest,omitempty"`
SuggestWhy string `json:"suggest_why,omitempty"`
// NoLiveAgent is the open tasks assigned or claimed that no live agent holds.
NoLiveAgent []string `json:"no_live_agent,omitempty"`
}
Card is a workstream as the board draws it: the document's fields, and what the cached roll-up says (no network on the board).
type Caster ¶
type Caster interface {
// List is every document in the namespace, latest revision each.
List(ctx context.Context) ([]Head, error)
// Get is a document's text at a revision (0 = latest). ok is false when there is none.
Get(ctx context.Context, name string, rev int) (it Item, ok bool, err error)
// Put makes a new revision (none when the content is the same) and returns it.
Put(ctx context.Context, name, content, title, mime string) (rev int, err error)
// Log is a document's revisions, newest first.
Log(ctx context.Context, name string) ([]Revision, error)
}
Caster is where the workstreams live: namespace "ops", one document per workstream (ws.<id>) and the queue (queue). The store keeps a working copy and writes through this. A port of Work's GatewayCaster (modules/work/caster.go), not an import: the seam forbids it.
type Check ¶
type Check struct {
Text string `yaml:"text" json:"text"`
Done bool `yaml:"done" json:"done"`
Ref string `yaml:"ref,omitempty" json:"ref,omitempty"`
}
Check is one line of a workstream's definition of "active".
type Conflict ¶
Conflict says the change does not stand: the document moved on, and it could not be applied to what is there. Rev is the revision now latest; Note, when set, says what happened.
type Correlation ¶
type Correlation struct {
Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"`
TetherWorkstreams []string `yaml:"tether_workstreams,omitempty" json:"tether_workstreams,omitempty"`
}
Correlation is how a workstream answers to things that do not link to it.
type Doc ¶
Doc is a document's text: YAML front matter and a markdown body, or (Plain) a YAML document with no body, as the queue is. Keys Ops does not know are kept as they are when it writes the document again. Ported from modules/work (doc.go): a module may not import another.
func ParsePlain ¶
ParsePlain reads a YAML document (a kind, a view). A leading "---" line is allowed.
func (*Doc) Decode ¶
Decode reads a key into v (for the structured keys: fields, links, material, published).
type Entry ¶
type Entry struct {
At string `json:"at"`
Source string `json:"source"` // torque, comment, status, ops, liveness
State string `json:"state,omitempty"`
Summary string `json:"summary"`
SubjectURN string `json:"subject_urn,omitempty"`
Task string `json:"task,omitempty"`
Workstream string `json:"workstream"`
Refs []string `json:"refs,omitempty"`
// Verified is true only for a status entry from a trusted writer. Today no writer is
// trusted (phase 2), so status rows show as claimed.
Verified bool `json:"verified"`
}
Entry is one row of the merged feed.
type FleetDisk ¶ added in v0.13.0
type FleetDisk struct {
Mount string `json:"mount"`
Used *float64 `json:"used"`
Total *float64 `json:"total"`
}
FleetDisk exposes only health facts. Connection details, inventory serials and credentials from Cerberus never cross this projection into the page or agent context.
type FleetHost ¶ added in v0.13.0
type FleetHost struct {
Name string `json:"name"`
Role string `json:"role"`
Provider string `json:"provider,omitempty"`
Owner string `json:"owner,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
State string `json:"state"`
Reason string `json:"reason,omitempty"`
LastSeen string `json:"last_seen,omitempty"`
ProbedAt string `json:"probed_at,omitempty"`
CheckedAt string `json:"checked_at,omitempty"`
Stale bool `json:"stale"`
Metrics FleetMetrics `json:"metrics"`
}
type FleetMetrics ¶ added in v0.13.0
type FleetMetrics struct {
CPUPercent *float64 `json:"cpu_percent,omitempty"`
MemoryUsed *float64 `json:"memory_used,omitempty"`
Disks []FleetDisk `json:"disks,omitempty"`
CPU *float64 `json:"cpu,omitempty"`
CPUModel string `json:"cpu_model,omitempty"`
GPUCount *int `json:"gpu_count,omitempty"`
GPUModel string `json:"gpu_model,omitempty"`
OS string `json:"os,omitempty"`
OSVersion string `json:"os_version,omitempty"`
Arch string `json:"arch,omitempty"`
Kernel string `json:"kernel,omitempty"`
DiskMount string `json:"disk_mount,omitempty"`
UptimeSeconds *int64 `json:"uptime_seconds,omitempty"`
Tools map[string]bool `json:"tools,omitempty"`
Units map[string]string `json:"units,omitempty"`
Load1 *float64 `json:"load1,omitempty"`
Load5 *float64 `json:"load5,omitempty"`
Load15 *float64 `json:"load15,omitempty"`
MemoryAvailable *float64 `json:"memory_available,omitempty"`
MemoryTotal *float64 `json:"memory_total,omitempty"`
DiskFree *float64 `json:"disk_free,omitempty"`
DiskTotal *float64 `json:"disk_total,omitempty"`
}
type FleetResult ¶ added in v0.13.0
type FleetResult struct {
Source string `json:"source"`
Hosts []FleetHost `json:"hosts"`
Host string `json:"host,omitempty"`
Samples []FleetSample `json:"samples"`
FetchedAt string `json:"fetched_at"`
Truncated bool `json:"truncated"`
Warning string `json:"warning,omitempty"`
// contains filtered or unexported fields
}
type FleetSample ¶ added in v0.13.0
type FleetSample struct {
SampleAt string `json:"sample_at,omitempty"`
At string `json:"at"`
Count int `json:"count"`
FleetMetrics
}
type GatewayCaster ¶
type GatewayCaster struct {
Link func() (tetherlink.Caller, error)
}
GatewayCaster reaches Caster through the Tether gateway. Link is asked for the client at each call, so the module's settings are read at the moment of use.
type Held ¶
type Held struct {
Reason string `yaml:"reason" json:"reason"`
Since string `yaml:"since,omitempty" json:"since,omitempty"`
}
Held marks a workstream blocked, in any lane. It is a flag, not a stage.
type Holder ¶ added in v0.16.0
type Holder struct {
// Agent is the assignee or claimant: an agent urn (msg://agent/...).
Agent string `json:"agent,omitempty"`
// Session and Run name a claim's holder when Torque records one.
Session string `json:"session,omitempty"`
Run string `json:"run,omitempty"`
// Source is how it was assigned: Torque's owner, doing, claim or dispatch.
Source string `json:"source"`
// Live is "live", "none" (nobody live holds it) or "unknown" (the check could not tell).
Live string `json:"live"`
// Why says what was found, for the drill-in and the agent.
Why string `json:"why,omitempty"`
// Unconfirmed is set when the fallback source, which cannot see kit-booted agents, found none.
Unconfirmed bool `json:"unconfirmed,omitempty"`
}
Holder says who a task is assigned to or claimed by, and whether they are live.
type InputError ¶
type InputError struct{ Msg string }
InputError is a change refused for what it asks.
func (*InputError) Error ¶
func (e *InputError) Error() string
type Link ¶
type Link struct {
Kind string `yaml:"kind" json:"kind"`
ID string `yaml:"id" json:"id"`
Role string `yaml:"role,omitempty" json:"role,omitempty"`
Label string `yaml:"label,omitempty" json:"label,omitempty"`
}
Link is a typed link: Kind is a Cite kind, so every link is a chip.
type NewWorkstream ¶
type NewWorkstream struct {
ID string `json:"id"`
Title string `json:"title"`
Owner string `json:"owner,omitempty"`
Project string `json:"project,omitempty"`
StatusNS string `json:"status_ns,omitempty"`
Stage string `json:"stage,omitempty"`
Parent string `json:"parent,omitempty"`
Links []Link `json:"links,omitempty"`
ActiveWhen []Check `json:"active_when,omitempty"`
Correlation Correlation `json:"correlation,omitempty"`
Purpose string `json:"purpose,omitempty"`
Notes string `json:"notes,omitempty"`
Why string `json:"why,omitempty"`
}
NewWorkstream is what a create takes.
type OrchestrationRequest ¶ added in v0.12.1
type OrchestrationRequest struct {
At string `json:"at" yaml:"at"`
Note string `json:"note" yaml:"note"`
MessageID string `json:"message_id" yaml:"message_id"`
RequestID string `json:"request_id" yaml:"request_id"`
Sender string `json:"-" yaml:"sender,omitempty"`
Payload string `json:"-" yaml:"payload,omitempty"`
}
OrchestrationRequest also retains a pending delivery's exact envelope, so retries after a lost response or restart use the same sender, payload and idempotency key.
type Patch ¶
type Patch struct {
Title *string `json:"title,omitempty"`
Owner *string `json:"owner,omitempty"`
Project *string `json:"project,omitempty"`
StatusNS *string `json:"status_ns,omitempty"`
Parent *string `json:"parent,omitempty"`
Purpose *string `json:"purpose,omitempty"`
ActiveMeans *string `json:"active_means,omitempty"`
Notes *string `json:"notes,omitempty"`
// AppendNote adds a paragraph to the notes, dated.
AppendNote *string `json:"append_note,omitempty"`
// Held sets the held flag with a reason; "" clears it.
Held *string `json:"held,omitempty"`
// ActiveWhen replaces the checklist; Tick sets one line's done by its index; AddCheck adds one.
ActiveWhen *[]Check `json:"active_when,omitempty"`
Tick *Tick `json:"tick,omitempty"`
AddCheck *Check `json:"add_check,omitempty"`
Labels *[]string `json:"labels,omitempty"`
}
Patch is what an update may change. A nil field is left as it is.
type Plan ¶ added in v0.9.0
type Plan struct {
ID string `json:"id"`
Title string `json:"title"`
Status string `json:"status"`
Workstream string `json:"workstream"`
Phases []Phase `json:"phases"`
Via string `json:"via,omitempty"` // directly linked task that revealed this plan
Truncated bool `json:"truncated,omitempty"`
}
Plan is a linked Torque plan and its ordered phases. Tasks remain in Rollup.Tasks, deduplicated with direct and epic links, and join the same activity reads.
type Rollup ¶
type Rollup struct {
Workstream string `json:"workstream"`
Counts map[string]int `json:"counts"`
Tasks []Task `json:"tasks"`
Plans []Plan `json:"plans,omitempty"`
Entries []Entry `json:"entries"`
// Last is the newest entry, for a card's "last activity" line.
Last *Entry `json:"last,omitempty"`
// Suggest is a stage the tasks suggest the workstream is in, when it differs (a hint:
// moves are the owner's).
Suggest string `json:"suggest,omitempty"`
SuggestWhy string `json:"suggest_why,omitempty"`
Errors []string `json:"errors,omitempty"`
// NoLiveAgent is the open tasks assigned or claimed that no live agent holds.
NoLiveAgent []string `json:"no_live_agent,omitempty"`
FetchedAt string `json:"fetched_at"`
}
Rollup is a workstream's tasks and activity, with its children's.
type SeedConcept ¶
type SeedConcept struct {
Accept bool `json:"accept"`
ID string `json:"id"`
Title string `json:"title"`
Why string `json:"why"`
Members []string `json:"members"`
Stage string `json:"stage"`
Exists bool `json:"exists,omitempty"`
}
SeedConcept is a proposed umbrella workstream over several threads.
type SeedFollowup ¶
type SeedFollowup struct {
Index int `json:"index"`
Text string `json:"text"`
Workstream string `json:"workstream,omitempty"`
Why string `json:"why,omitempty"`
}
SeedFollowup is a follow-up line and where it goes: a workstream's notes, or the owner's list.
type SeedItem ¶
type SeedItem struct {
Include bool `json:"include"`
ID string `json:"id"`
Title string `json:"title"`
Stage string `json:"stage"`
FromStage string `json:"from_stage"`
Phase string `json:"phase,omitempty"`
Owner string `json:"owner,omitempty"`
// Parent is a proposed concept (applied only when that concept is ticked), another seed
// workstream, or a workstream already in Ops.
Parent string `json:"parent,omitempty"`
Notes string `json:"notes"`
Links []Link `json:"links"`
// Exists marks an id Ops has already: applying skips it and never overwrites.
Exists bool `json:"exists,omitempty"`
Problems []string `json:"problems,omitempty"`
}
SeedItem is one tracker thread as a workstream.
type SeedPlan ¶
type SeedPlan struct {
ID string `json:"id"`
Source string `json:"source"`
TrackerUpdated string `json:"tracker_updated,omitempty"`
CreatedAt string `json:"created_at"`
AppliedAt string `json:"applied_at,omitempty"`
Workstreams []SeedItem `json:"workstreams"`
Concepts []SeedConcept `json:"concepts"`
Followups []SeedFollowup `json:"followups"`
// Mapping says, in lines, how the tracker's fields became Ops'.
Mapping []string `json:"mapping"`
}
SeedPlan is a preview: what applying would write, as the owner edits it.
type SeedResult ¶
type SeedResult struct {
Created []string `json:"created"`
Skipped []string `json:"skipped"`
Failed []string `json:"failed"`
Followups int `json:"followups_for_owner"`
// Noted are the workstreams Ops had already that got follow-ups on their notes.
Noted []string `json:"noted"`
}
SeedResult is what an apply did.
type SessionRow ¶ added in v0.13.0
type SessionRow struct {
ID string `json:"id"`
Kind string `json:"kind"`
AgentID string `json:"agent_id"`
AgentName string `json:"agent_name"`
AgentRef string `json:"agent_ref,omitempty"`
Host string `json:"host"`
State string `json:"state"`
RawState string `json:"raw_state"`
LastActivityAt string `json:"last_activity_at,omitempty"`
LastActivity string `json:"last_activity,omitempty"`
WorkstreamID string `json:"workstream_id,omitempty"`
TaskID string `json:"task_id,omitempty"`
Stale bool `json:"stale"`
Warning string `json:"warning,omitempty"`
}
SessionRow is the shared Agents/Fleet view of an authoritative Tether observation. Unknown observations stay unknown: lifecycle state and age do not imply idleness.
type SessionsResult ¶ added in v0.13.0
type SessionsResult struct {
Sessions []SessionRow `json:"sessions"`
FetchedAt string `json:"fetched_at"`
Truncated bool `json:"truncated"`
Warning string `json:"warning,omitempty"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the working copy of Ops' documents in Caster: a mirror for quick views and for reading while Caster is away. Every write goes to Caster at once, each after reading the document again, and the new revision is kept here. Nothing lives only here.
Caster's put takes no expected revision, so a write is checked by the revision it answers: one further on than the read plus one means someone else wrote in between. Their revision is then read, the change applied to it again and written once more (putOver), so neither write is lost; a change that cannot be applied to theirs puts theirs back and is refused.
func NewStore ¶
NewStore is the working copy in db over caster. caster may be nil: the copy is then read only and says why.
func (*Store) All ¶
All reads the copy. A workstream whose parent is missing, makes a loop or nests too deep is shown at the top level, with a problem saying why, so nothing drops off the board.
func (*Store) Apply ¶
Apply writes a preview as the owner left it (the caller has claimed it): the ticked concepts, then the included workstreams (a parent before its children), each with the follow-ups placed on it. Follow-ups for a workstream Ops had already go onto its notes; any whose workstream was not made go to the owner's list with the unplaced ones. An id Ops has already is skipped. Errors on one workstream do not stop the others.
func (*Store) Cached ¶
Cached are the cached roll-ups of every workstream, for the board (no network).
func (*Store) ClaimPlan ¶
ClaimPlan marks a preview applied, atomically: only one apply can claim it. ErrApplied when it was claimed before.
func (*Store) Create ¶
func (s *Store) Create(ctx context.Context, in NewWorkstream, by string) (Workstream, error)
Create writes a new workstream (refused when the id is taken, even by a write that lands between the check and this one: theirs is put back) and, at stage queued, puts it at the end of the queue.
func (*Store) Link ¶
Link adds a typed link (the same kind and id again replaces its role and label).
func (*Store) Move ¶
Move changes a workstream's stage, records the move, and keeps the queue: moving into Queued puts it at the end of the queue, moving out takes it off.
func (*Store) Refresh ¶
Refresh brings the copy up to date with Caster: one listing, and a read of each document whose revision moved. At most every refreshEvery unless forced. It returns how many changed.
func (*Store) Refreshed ¶ added in v0.15.0
Refreshed is when the copy was last refreshed from Caster (zero before the first).
func (*Store) ReleasePlan ¶
ReleasePlan gives a claimed preview back, for an apply that wrote nothing.
func (*Store) Reorder ¶
Reorder moves a queued workstream within the Queued band, among its siblings only (the queued workstreams with the same parent): before or after another, or one place up or down. The move is worked out on the queue as it is in Caster at the write, not as the copy last saw it.
func (*Store) SavePlan ¶
SavePlan keeps the owner's edits to a preview that has not been applied (ErrApplied when it has, or is being).
func (*Store) Settle ¶ added in v0.12.1
func (s *Store) Settle(ctx context.Context, id string, baseRev int, tracking Rollup, by string) (Workstream, error)
Settle preserves the final tracking in the revisioned document. It is not a stage: the workstream remains complete and addressable by its original Ops/Caster references.
type Taken ¶
type Taken struct{ ID string }
Taken says a create found the id taken (by someone who wrote it first).
type Task ¶
type Task struct {
ID string `json:"id"`
Title string `json:"title"`
Status string `json:"status"`
Updated string `json:"updated,omitempty"`
Workstream string `json:"workstream"`
// Via is how the workstream reaches it: a link, epic or plan.
Via string `json:"via,omitempty"`
PlanID string `json:"plan_id,omitempty"`
PhaseID string `json:"phase_id,omitempty"`
ParentID string `json:"parent_id,omitempty"`
EpicID string `json:"epic_id,omitempty"`
Kind string `json:"kind,omitempty"`
DiscoveredVia string `json:"discovered_via,omitempty"`
// Holder is who the task is assigned to or claimed by, and whether they are live
// (liveness.go); nil when nobody is.
Holder *Holder `json:"holder,omitempty"`
}
Task is one Torque task as the roll-up shows it.
type Tracker ¶
type Tracker struct {
Updated string `json:"updated"`
Note string `json:"note"`
Threads []TrackerThread `json:"threads"`
Followups []any `json:"followups"`
}
Tracker is the tracker's JSON.
func ParseTracker ¶
ParseTracker reads the tracker's JSON.
type TrackerThread ¶
type TrackerThread struct {
Name string `json:"name"`
Stage string `json:"stage"`
Phase string `json:"phase"`
PhaseLabel string `json:"phase_label"`
Owner string `json:"owner"`
Summary string `json:"summary"`
PhaseNote string `json:"phase_note"`
Tasks [][]any `json:"tasks"`
}
TrackerThread is one thread of the tracker.
type Transition ¶
type Transition struct {
From string `yaml:"from" json:"from"`
To string `yaml:"to" json:"to"`
At string `yaml:"at" json:"at"`
By string `yaml:"by,omitempty" json:"by,omitempty"`
Why string `yaml:"why,omitempty" json:"why,omitempty"`
}
Transition is one lifecycle move.
type UsageAlert ¶ added in v0.13.1
type UsageBudget ¶ added in v0.13.1
type UsageBudget struct {
Provider string `json:"provider"`
Model string `json:"model,omitempty"`
Level string `json:"level,omitempty"`
Scope string `json:"scope,omitempty"`
Window string `json:"window,omitempty"`
WindowStart string `json:"window_start,omitempty"`
ResetAt string `json:"reset_at,omitempty"`
MaxCostUSD *float64 `json:"max_cost_usd,omitempty"`
MaxRequests *float64 `json:"max_requests,omitempty"`
MaxTokens *float64 `json:"max_tokens,omitempty"`
Exhausted bool `json:"exhausted"`
Error string `json:"error,omitempty"`
}
type UsageCard ¶ added in v0.13.1
type UsageCard struct {
ID string `json:"id"`
Title string `json:"title"`
Kind string `json:"kind"` // gateway or subscription
Status string `json:"status"`
// Used and Limit share Unit; either is nil when the source does not report it.
Used *float64 `json:"used"`
Limit *float64 `json:"limit"`
// Remaining is a balance (credits) where the source reports one instead of a limit.
Remaining *float64 `json:"remaining,omitempty"`
Unit string `json:"unit,omitempty"`
Window string `json:"window,omitempty"`
ResetAt string `json:"reset_at,omitempty"`
Summary string `json:"summary,omitempty"`
Gap string `json:"gap,omitempty"`
Observed string `json:"observed_at,omitempty"`
}
type UsageDetail ¶ added in v0.13.1
type UsageDetail struct {
Windows []UsageWindow `json:"windows,omitempty"`
ByProvider []UsageTotals `json:"by_provider,omitempty"`
ByModel []UsageTotals `json:"by_model,omitempty"`
Budgets []UsageBudget `json:"budgets,omitempty"`
Alerts []UsageAlert `json:"alerts,omitempty"`
Spend []UsageSpend `json:"spend,omitempty"`
Recent []UsageEvent `json:"recent,omitempty"`
Notes []string `json:"notes,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}
UsageDetail is a card's details. Only the gateway has them so far. Sections are omitted when a source has nothing of that kind.
type UsageEvent ¶ added in v0.15.0
type UsageEvent struct {
ID string `json:"id"`
At string `json:"at"`
What string `json:"what"`
Amount *float64 `json:"amount,omitempty"`
Unit string `json:"unit,omitempty"`
Note string `json:"note,omitempty"`
OK bool `json:"ok"`
}
UsageEvent is one recent charge.
type UsageResult ¶ added in v0.13.1
type UsageResult struct {
Cards []UsageCard `json:"cards"`
Source string `json:"source,omitempty"`
Detail *UsageDetail `json:"detail,omitempty"`
FetchedAt string `json:"fetched_at"`
}
type UsageSpend ¶ added in v0.15.0
type UsageSpend struct {
Provider string `json:"provider"`
Calls int64 `json:"calls"`
Failed int64 `json:"failed"`
CostUSD float64 `json:"cost_usd"`
}
UsageSpend is one provider's spend in a window.
type UsageTotals ¶ added in v0.13.1
type UsageTotals struct {
Key string `json:"key"`
Requests int64 `json:"requests"`
Successes int64 `json:"successes"`
Errors int64 `json:"errors"`
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
ReasoningTokens int64 `json:"reasoning_tokens"`
CacheReadTokens int64 `json:"cache_read_tokens"`
}
UsageTotals is one aggregate row from the gateway: a provider, a model or a whole window.
type UsageWindow ¶ added in v0.13.1
type UsageWindow struct {
Label string `json:"label"`
Since string `json:"since"`
Total UsageTotals `json:"total"`
}
type Workstream ¶
type Workstream struct {
OrchestrationRequest *OrchestrationRequest `json:"orchestration_request,omitempty"`
SettledAt string `json:"settled_at,omitempty"`
SettledBy string `json:"settled_by,omitempty"`
SettledSummary string `json:"settled_summary,omitempty"`
ID string `json:"id"`
Title string `json:"title"`
Owner string `json:"owner,omitempty"`
Project string `json:"project,omitempty"`
StatusNS string `json:"status_ns,omitempty"`
Stage string `json:"stage"`
StageSince string `json:"stage_since,omitempty"`
Parent string `json:"parent,omitempty"`
Held *Held `json:"held,omitempty"`
ActiveWhen []Check `json:"active_when"`
Links []Link `json:"links"`
Correlation Correlation `json:"correlation"`
Transitions []Transition `json:"transitions"`
Purpose string `json:"purpose,omitempty"`
ActiveMeans string `json:"active_means,omitempty"`
Notes string `json:"notes,omitempty"`
Rev int `json:"rev"`
Updated string `json:"updated,omitempty"`
// Children are the workstreams whose parent this is (from the copy, not the document).
Children []string `json:"children"`
// Problem says why the document could not be read whole.
Problem string `json:"problem,omitempty"`
}
Workstream is one ops/v1 document as the app reads it.