Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanTransition ¶
CanTransition reports whether moving a task from `from` to `to` is a legal transition.
func SaveTasksFile ¶
SaveTasksFile writes f to path as 2-space indented JSON (matching the shipped templates), creating the file if needed. It is every writer's one encoding (#531), and atomic: a temp file of its own beside path, then a rename, so a reader — orch run reloading it — never sees half a file, and two writers never share a temp name. Serialising read-modify-write cycles is the caller's job (project.MutateTasks, project.TaskEditor).
Types ¶
type Backend ¶
type Backend string
Backend names a supported CLI coding agent. Ported from the Python `Backend` literal in orchestrator/models.py.
type Meta ¶
type Meta struct {
Project string
GeneratedAt string
Template string
Note string
Extra map[string]json.RawMessage
// contains filtered or unexported fields
}
Meta is tasks.json's top-level `meta` object. `Template` is only present when the project was scaffolded from a named template (see orchestrator/templates/projects/*/tasks.json.tmpl vs the bare orchestrator/templates/tasks.json.tmpl skeleton, which omits it).
func (Meta) MarshalJSON ¶
MarshalJSON preserves both Python's field order (project, generatedAt, template, note) and, for a decoded Meta, its own present-keys set — see Task.MarshalJSON's doc comment for why order is part of the contract here, not cosmetic.
func (*Meta) UnmarshalJSON ¶
type Phase ¶
type Phase struct {
ID int
Name string
Extra map[string]json.RawMessage
}
Phase is one entry in tasks.json's top-level `phases` array.
func (Phase) MarshalJSON ¶
MarshalJSON preserves Python's field order (id, name) — see Task.MarshalJSON's doc comment. Invisible today ("id" < "name" alphabetically too), but not guaranteed to stay that way, and the other two structs in this file prove alphabetical-by-accident isn't a property worth relying on.
func (*Phase) UnmarshalJSON ¶
type RouteEntry ¶
type RouteEntry struct {
Backend Backend `yaml:"backend"`
CLIModel string `yaml:"cli_model"`
Tier Tier `yaml:"tier"`
IsPremium bool `yaml:"is_premium"`
FallbackCLIModel *string `yaml:"fallback_cli_model,omitempty"`
// EscalationModel names another ROUTE KEY (not a raw CLIModel) that the
// reap loop promotes to on attempt 3 after a retryable failure on
// attempt 2. A non-nil value that doesn't correspond to a real route
// entry is a fail-fast startup error in internal/router, not here.
EscalationModel *string `yaml:"escalation_model,omitempty"`
// Backend-specific extras (agy — issues #87/#88). Agent is agy's
// `--agent <role>` selector, passed only when set: agy 1.4 has no
// "executor" persona and its default executes in-process (#382). Effort is agy's
// `--effort {low,medium,high}` for base-name Gemini models that
// require it; left nil when the cli_model already encodes effort as a
// suffix (e.g. "gemini-3.7-flash-high").
Agent *string `yaml:"agent,omitempty"`
Effort *string `yaml:"effort,omitempty"`
// ServiceTier is codex's service_tier for this route's dispatches (#416),
// so a Fast mode set globally in ~/.codex/config.toml is not forced on
// every one: "default" is the standard tier. Nil leaves codex's config.
ServiceTier *string `yaml:"service_tier,omitempty"`
// Failover names other ROUTE KEYS, in order, that a dispatch moves to
// when this route's provider runs out of quota (#439): a rate-limit
// failure retries on the next one instead of backing off, and later
// tasks skip the exhausted provider until its window resets. Like
// EscalationModel, a key that is not a route is a load error in
// internal/router. Empty keeps the plain rate-limit backoff.
Failover []string `yaml:"failover,omitempty"`
}
RouteEntry is one row from model_router.yaml, ported from RouteEntry in orchestrator/models.py. Field names/tags mirror the YAML keys the Python router reads (see orchestrator/model_router.yaml's header comment) so internal/router can decode straight into this struct with yaml.v3.
FallbackCLIModel, EscalationModel, Agent and Effort are nil when the route doesn't set them, matching Python's `| None` optional fields — IsPremium is NOT optional: Python precomputes it at load time from Tier so the dispatch hot path never string-compares Tier, and Go keeps that contract rather than deriving it lazily.
type Status ¶
type Status string
Status is a task's position in the workflow. The zero value ("") is not a valid Status — build one with ParseStatus or use a constant below.
func ParseStatus ¶
ParseStatus validates s against the five known statuses.
func Transitions ¶
Transitions returns every status `from` may legally move to next, in the canonical status order — used by CLI error messages and `--help` text so the list is stable across runs.
type Task ¶
type Task struct {
ID string
Phase int
Title string
Description string
Model string
Reason string
Status Status
Dependencies []string
EstimateHours float64
Files []string
SpecRef string
// SourceIssue is the URL of the GitHub issue the task was imported from
// (`orch atomize --from-issues`, #525): the PR body closes it and the
// client page links it. Optional on the wire (`sourceIssue`), and never
// written for a task without one, so files from before it keep their
// shape.
SourceIssue string
// Comments holds each entry's raw JSON value verbatim —
// orchestrator/models.py types this `list[dict]` with no fixed shape,
// so Go doesn't need to understand it to preserve it losslessly.
Comments []json.RawMessage
// Extra holds JSON object keys this struct doesn't know about, so a
// tasks.json field added later (or by a newer/older Python version)
// survives a Go Load→Save round trip untouched.
Extra map[string]json.RawMessage
// contains filtered or unexported fields
}
Task is a single unit of work from tasks.json. Field names match the frozen dataclass in orchestrator/models.py; JSON wire keys are handled by TaskFromJSON/MarshalJSON below rather than plain struct tags, because SaveTasksFile must reproduce Python's exact from_json defaulting AND must not invent a key (e.g. "comments") that the source file never had — see the `present` field.
func TaskFromJSON ¶
func TaskFromJSON(raw map[string]json.RawMessage) (Task, error)
TaskFromJSON builds a Task from one decoded tasks.json row, applying the exact defaults Task.from_json (orchestrator/models.py) applies.
func (Task) MarshalJSON ¶
MarshalJSON reproduces the wire key set the Task was decoded with (t.present == nil, i.e. built in Go rather than decoded, emits every optional field), in the same field order Python's dataclass — and this struct's own declaration — use. Order matters here: tasks.json is a file both binaries write and a person reads, not just an API response.
func (*Task) UnmarshalJSON ¶
UnmarshalJSON lets Task decode directly (e.g. as a TasksFile.Tasks element), delegating to TaskFromJSON for the actual defaulting logic.
type TasksFile ¶
TasksFile is the full contents of a project's tasks.json.
func LoadTasksFile ¶
LoadTasksFile reads and parses a tasks.json file.