Expand description
Core logic for Voro: the SQLite store, the task state machine, and the
scheduler/scoring. Pure of terminal I/O; every interface (TUI, CLI verbs)
is a thin consumer of this crate. Concepts and invariants are specified in
docs/DESIGN.md.
Re-exports§
pub use scheduler::Candidate;pub use scheduler::ScoreBreakdown;pub use scheduler::StateCounts;
Modules§
- scheduler
- The scheduler (DESIGN.md §7): pure scoring and the ordering of the two
views. The store supplies candidates (with
age_daysalready computed); everything here is deterministic arithmetic on those rows.
Structs§
- Agent
Session Entry - One session from an agent’s
sessionscommand output: a JSON array of objects, of which the fields below are read and everything else ignored.sessionId(falling back toid) is the durable reference substituted into{session};cwdandstartedAt(ms epoch) identify a fresh dispatch’s session among its siblings;stateis"done"once finished. - Agent
Template - A named set of verb templates from
voro.toml.dispatch(or its aliascmd) is required and always containsPROMPT_FILE_PLACEHOLDER; it may also carry the optionalTASK_ID_PLACEHOLDER. The rest are optional, with their{session}/{prompt_file}placeholders validated at parse time. - Agents
Config - The effective agent config: the built-in agents with any
voro.tomlmerged on top, plus the user’sdefault_agentand viewers. Each agent carries itsProvenancesoagent listcan show where it came from. - Dep
- DepRef
- A dependency edge resolved for display: the task at the other end of the
edge with its current title and state, plus the edge’s kind. Which end is
“other” depends on the query — the dependency for
Store::deps_by_task, the dependant forStore::dependents_by_task. - Event
- Github
Issue - One issue from
gh issue list --json number,title,body,url. Those four fields are all gh documents for this command; anything else it emits is ignored. - NewTask
- Initial state for a task created by a human.
proposedis quick capture;parked/readymean the creator has already triaged their own task. - PrPlan
- Everything the forge needs to open a PR for a review task (DESIGN.md §8):
the branch to push and the title and body of the pull request. Assembled by
plan_pronce the task is proven PR-ready. - PrRef
- A parsed reference to a GitHub pull request. The base repo is recorded
explicitly (
owner/repo/host) rather than inferred from a checkout’sorigin, so a PR opened from a fork is still addressed against the repo where the diff and its review comments live (DESIGN.md §11c). - Project
- Resolved
Agent - The agent a task will be dispatched with: the task’s own override if it has one, otherwise the config’s global default, with every verb template resolved.
- Running
Row - A row of the cockpit’s running strip (DESIGN.md §9): one per
runningtask, joined with its open session if it has one. A task with no open session (started by hand) still shows, withsession_id/agentset toNone.elapsed_secsis computed in SQL against the database’s clock, so the TUI only has to format it. - Session
- Store
- Owns the SQLite database. All writes go through this type; task state in
particular is only ever changed by the transition API in
transition.rs. - Task
- Task
Edit - Content edits. State is deliberately absent — use
Store::apply. - Viewer
Template - A viewer command template from
voro.toml(DESIGN.md §11a): a shell command run in a task’s checkout — or its worktree — to open its diff. Defined as a named[viewers.<name>]table or the anonymous[viewer]default. The placeholders{path}(checkout/worktree dir),{branch}(the task’s branch), and{base}(the checkout’s default branch) are all optional, so nothing is validated at parse time.
Enums§
- Action
- DepKind
- Error
- Next
Action - The verb a task’s queue row asks of the human (DESIGN.md §3), derived from state × fields rather than stored.
- Priority
- Provenance
- Where an effective agent came from once the built-ins and
voro.tomlare layered, surfaced byvoro agent listso it is clear which half of the config owns each agent. - Review
Action - A project’s review medium (DESIGN.md §8/§11a): which of the two media the
unified
praction uses to get a review task’s diff in front of the operator. Stored on the project (projects.review_action). - Review
Medium - The concrete medium a
ReviewActionresolves to: the single “show me this task’s diff” action, per project (DESIGN.md §8). - Session
Outcome - Task
State - Triage
- Where a
proposedtask goes at triage.
Constants§
- PROMPT_
FILE_ PLACEHOLDER - The prompt-file substitution in
dispatchandcontinuetemplates. The working directory is handled by the spawner, not the template. - SESSION_
PLACEHOLDER - The session-reference substitution in
attach,resume, andcontinuetemplates: the agent-opaque reference captured at dispatch (a Claude session UUID, a Codex session id, a tmux session name). - TASK_
ID_ PLACEHOLDER - The task-id substitution in the
dispatchtemplate, the numeric id of the task. Optional — a template that omits it dispatches unchanged — so agents with a session-naming flag can tie the session back to its task. - VIEWER_
BASE_ PLACEHOLDER - The substitution in a viewer command template for the checkout’s default branch — the base a task branch is diffed against (DESIGN.md §8).
- VIEWER_
BRANCH_ PLACEHOLDER - The substitution in a viewer command template for the task’s git branch, or
empty when the task has none. Paired with
VIEWER_BASE_PLACEHOLDERit lets a viewer express a diff range ({base}...{branch}) rather than a bare directory (DESIGN.md §8). - VIEWER_
PATH_ PLACEHOLDER - The substitution in a viewer command template (DESIGN.md §11a): the checkout
path of the task’s project — or the task’s worktree, when it has a branch
checked out in one (DESIGN.md §8). Optional — a viewer that acts on the
current directory (
git difftool -d) needs no placeholder.
Functions§
- already_
imported - Whether
body(an existing task’s body) already carries this issue’s URL — the idempotency check that lets import be run repeatedly without creating duplicate tasks. - format_
review_ feedback - Build a reject-with-feedback body from a PR’s reviews and inline comments (DESIGN.md §11c), so a GitHub review reaches the agent without retyping. Reviews with an empty body are skipped; the inline comments carry their own text. Returns an empty string when there is nothing to relay.
- issue_
new_ task - An issue mapped to a task, always landing in
proposed: imports are untriaged like any other machine-generated task, and priority is not guessed from labels in v1 — triage assigns it. - issue_
task_ body - The task body for an imported issue: the URL and issue number stamped at
the top (both for human reference and as the idempotency marker checked
by
already_imported), followed by the issue body verbatim. - parse_
sessions_ json - Parse a
sessionscommand’s stdout. Entries without any id are skipped rather than failing the whole listing; anything that is not a JSON array is an error, so a misconfiguredsessionsverb surfaces rather than reading as “no sessions”. - plan_pr
- Validate that a task can have a PR opened from its done-time state, and if so
assemble the
PrPlan(DESIGN.md §8): areviewtask carrying both a branch (the work to push) and a completion summary (the PR body; the caller supplies the latest). Each gap fails naming what is missing — state, branch, or summary. Pure of I/O.