Skip to main content

Crate onerig_core

Crate onerig_core 

Source
Expand description

Core library of onerig: the run state machine, lane policy and harness adapters. It has no terminal or argument-parsing dependencies, so a command-line tool, a terminal UI or a GUI can all be built on it.

Modules§

adapter
Harness adapters. An adapter knows one harness’s command line and output format. Every method is pure: it starts nothing and reads nothing, so an adapter is tested with captured output alone.
catalog
Pure provider/model catalog and role-lane editing helpers for Config.
config
The configuration file of design section 11: its data model, loading and validation.
fake
A scripted Runner for tests (design section 16). It plays back a JSON script instead of starting a harness, and keeps its position in a file so a later onerig resume process continues where an earlier one stopped.
halt
The two ways work is asked to stop: the owner quitting (a signal; never undone) and a stop of the current action, which is cleared when the next action starts so that it does not end that one too.
harness
The real Runner: one adapter per lane, run through the process driver.
plan
The plan a planner returns and the verdict a reviewer returns, with the checks that decide whether a harness’s answer is usable.
policy
Lane selection and failure policy: which lane takes the next worker attempt, and what a failed worker job leads to. Every function is a pure decision: the caller reads the clock and the quota, and stores the result.
process
The subprocess driver. It runs one described call to its end and knows nothing about harnesses or runs: it starts the child in its own process group, streams its output, and kills the whole group when a limit is hit, the stop flag is set, or the child is done.
prompt
The text every job receives: the planner’s prompt, the worker’s hand-over and the reviewer’s prompt. Pure text builders; nothing here reads files.
run
The run state machine of design sections 5 and 6: plan, execute, review, commit, pause and resume. It talks to harnesses only through Runner, so it is tested with the scripted runner.
runner
The interface the run state machine uses to run jobs, and the data that crosses it. The real runner combines an adapter with the process driver; tests use a scripted one.
session
Chat session persistence on disk (design sections 5 and 8): <repo>/.onerig/sessions/<session id>/transcript.jsonl, lock, and raw-<n>.log.
store
What a run keeps on disk (design section 12): its state, its plan, its log and its lock, plus the run id and time formats.
turn
Chat planner turn: answer schema, parser, prompt builder and retry loop (design sections 6.1, 6.6 and 7).
worktree
Git operations of a run (design section 10): the main checkout, the run’s branch and worktree, the task diff and the task commit. Git is driven through its executable.