Skip to main content

Crate voro_core

Crate voro_core 

Source
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_days already computed); everything here is deterministic arithmetic on those rows.

Structs§

AgentSessionEntry
One session from an agent’s sessions command output: a JSON array of objects, of which the fields below are read and everything else ignored. sessionId (falling back to id) is the durable reference substituted into {session}; cwd and startedAt (ms epoch) identify a fresh dispatch’s session among its siblings; state is "done" once finished.
AgentTemplate
A named set of verb templates from voro.toml. dispatch (or its alias cmd) is required and always contains PROMPT_FILE_PLACEHOLDER; it may also carry the optional TASK_ID_PLACEHOLDER. The rest are optional, with their {session}/{prompt_file} placeholders validated at parse time.
AgentsConfig
The effective agent config: the built-in agents with any voro.toml merged on top, plus the user’s default_agent and viewers. Each agent carries its Provenance so agent list can 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 for Store::dependents_by_task.
Event
GithubIssue
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. proposed is quick capture; parked/ready mean 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_pr once 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’s origin, 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
ResolvedAgent
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.
RunningRow
A row of the cockpit’s running strip (DESIGN.md §9): one per running task, joined with its open session if it has one. A task with no open session (started by hand) still shows, with session_id/agent set to None. elapsed_secs is 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
TaskEdit
Content edits. State is deliberately absent — use Store::apply.
ViewerTemplate
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
NextAction
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.toml are layered, surfaced by voro agent list so it is clear which half of the config owns each agent.
ReviewAction
A project’s review medium (DESIGN.md §8/§11a): which of the two media the unified pr action uses to get a review task’s diff in front of the operator. Stored on the project (projects.review_action).
ReviewMedium
The concrete medium a ReviewAction resolves to: the single “show me this task’s diff” action, per project (DESIGN.md §8).
SessionOutcome
TaskState
Triage
Where a proposed task goes at triage.

Constants§

PROMPT_FILE_PLACEHOLDER
The prompt-file substitution in dispatch and continue templates. The working directory is handled by the spawner, not the template.
SESSION_PLACEHOLDER
The session-reference substitution in attach, resume, and continue templates: 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 dispatch template, 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_PLACEHOLDER it 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 sessions command’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 misconfigured sessions verb 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): a review task 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.

Type Aliases§

Result