SCHEMA — tools/fleetcore¶
The core the Harness Console (browser), the terminal dash (TUI) and AI agents (MCP) share: the fleet views, keys v1, the bashOS palette, the console job-API client and the
fleetMCP server, so every surface renders one model and runs one runtime (docs/TERMINAL-FRAMEWORK.md §10).
Conventions¶
- Pure Python on the standard library + PyYAML. No web framework, no Textual import at module level (
theme.textual_themes()imports it lazily), so either surface and the tests can load any module. - A surface consumes this package; it does not copy from it. A view, key or colour both surfaces show is defined here once.
Structure¶
| entry | kind | purpose | rules |
|---|---|---|---|
README.md |
file | What the core is, which surface reads what, and how the TUI joins the console runtime | required |
__init__.py |
file | Package marker (from fleetcore import … with tools/ on the path) |
required |
fleet.py |
file | The data layer: registry ⨝ project_health.yml ⨝ fleet_triage.yml ⨝ harness_health.yml, the inbox and per-repo drill-down, source freshness, filters and sorts — degrading cleanly when any signal is absent |
required |
yamlio.py |
file | The one YAML reader the surfaces share: libyaml's parser when PyYAML has it, one parse per version of a file (load), a private copy per caller, and cached() for a value derived from files; a file changed in the last two seconds is never kept |
required |
host.py |
file | Docker inventory over every DASH_DOCKER_HOST endpoint, attributed to registry rows by the UPS-OPS-17 label, then by name |
required |
nodes.py |
file | Where each hub workload runs: _data/fleet.yml nodes: resolved against docker-compose.yml (edge-bound, dependency-direction, durable-data and link-port rules), the plan against running containers, the per-node compose overlays and OpenTofu inputs (dash node, dash infra; ADR 0003); status_doc(), the one status document behind dash node status --json, /api/nodes and MCP fleet_nodes, and host_nodes() for the TUI's Node column |
required |
views.py |
file | dash_view() / docker_view() — the views as plain data, filtered and sorted by fleet.py's own functions; the console serves them at /api/fleet |
required |
apps.py |
file | The app portal's launcher (fleet-launcher/v1, ADR 0005): every registry frontend: block joined to its live address and its local ports in _data/ports.yml (a compose stack's, or a devenv-hosted site's on the workspace block devenv publishes), the verify kit's device matrix, the origins the console's Content-Security-Policy admits, and repos — every submodule with the frontend component it has or is owed (tools/dash apps plan); python3 -m fleetcore.apps is tools/dash apps |
required |
assist.py |
file | The fleet assistant baseline (fleet-assist/v1, ADR 0014): for every repo apps.repos() lists, whether its platform gets the page bridge (and which kit adapter mounts it), is reached in its checkout, or draws pages no adapter covers; tools/dash apps assist |
required |
assistlog.py |
file | What the console's assistant did (assist-activity/v1, agent local:console-assist): the one reader of its two records, the page bridge's audit (.fleet/assist/page-audit.jsonl) and its rows of the AI ledger (source console assist), counted and with the newest rows of each; the console's Assist page (/api/assist/activity), MCP assist_activity, the lake (lake assist) and tools/dash apps assist activity all read it |
required |
loopjob.py |
file | The loop-run job (the JEV loop runner started from the console) read once: its --json run record or, before one exists, its status lines → the fields the page and the TUI render (parse_log, summary_lines) |
required |
keys.py |
file | keys v1 as data — the TUI builds its Bindings from it and the console serves it at /api/keys |
required |
theme.py |
file | The bashOS palette as tokens → console CSS (/theme.css) and Textual themes (bashos-dark / bashos-light); OS_TOKENS is the bashOS GUI desktop's paper palette, served as --os-* for the console's Desktop page |
required |
graph.py |
file | The fleet graph (fleet-graph/v1, ADR 0010): the registry, the workflow atlas, the switches map, the agent inventory, the feature index, the roadmap, the decision logs and the four operator surfaces joined into one typed graph; show / impact / lineage / path, the checks (a source nobody writes, a scheduled workflow with no switch entry, the surface-parity notes) and view(), the one function /api/graph and the MCP's fleet_graph serve; python3 -m fleetcore.graph is tools/dash graph (docs/FLEET-GRAPH.md) |
required |
learn.py |
file | Outcome learning, shadow only (learning/v1, ADR 0010): each loop's filed issues and pull requests sorted into landed / rejected / stale / working / young / unread from the lake (opened read-only), a decayed Beta estimate per loop and per repo, the Thompson-sampling plan for the next slots, the replay skill test and the backlog advice; view() is what /api/learn and the MCP's fleet_learning serve; python3 -m fleetcore.learn is tools/dash learn (docs/LEARNING.md) |
required |
workflows.py |
file | The fleet workflow model (fleet-workflows/v1, ADR 0007 S1): every registry repository and the hub, with its last read (read_at) or why it was not read, each workflow file the read listed through the atlas's own parse_workflow() / lint_workflow() (hub rules for the hub only), and each workflow's check state from its latest run (verified · passed-empty · never-ran · quota · real-failure · cancelled), from the lake opened read-only; view() is what the MCP's fleet_workflows serves with fleet=true; python3 -m fleetcore.workflows is tools/dash workflows --fleet (docs/WORKFLOW-ATLAS.md) |
required |
prqueue.py |
file | The PR queue's model (pr-queue/v1, docs/PR-QUEUE.md), pure: check runs collapsed per check to the latest run on the head commit (a cancelled run followed by a success is green), the review gate as tools/weekly/closeout.py's gate_verdict on the pull request as if green, the merge method, whether an agent may merge under § 12.2, who moves it next and the bulk action that does it, kinds and fan-out batches, the triage comment parsed as a hint, the action catalogue with its switches, plan identity and the next-action comment's bytes; tools/console/pr_queue.py feeds it |
required |
client.py |
file | Stdlib client for the console's job API over http:// or unix:// (DASH_CONSOLE_URL) — how the TUI and the MCP server submit jobs to the same runtime the browser uses |
required |
mcp_server.py |
file | MERGED into tools/console/mcp_layer/: its tool functions are reused there; running it delegates to the layer (FLEET_MCP_STDLIB=1 keeps the old stdlib loop) |
required |
Placement¶
- A new rule about an open pull request (a kind, a check state, who moves it next, a bulk action) →
prqueue.py(case intools/test_fleetcore_prqueue.py); its reads and writes stay intools/console/pr_queue.py. - A read of a YAML file a surface asks for more than once →
yamlio.load(), never a secondyaml.safe_load(case intools/test_fleetcore_yamlio.py); a value derived from files and asked for on every request →yamlio.cached(). - A new derived view or KPI → a pure function in
fleet.py(case intools/test_tui_fleet.py), exposed throughviews.py; then each surface renders it. - A new fact about where a frontend runs (a target kind, a launcher field) →
apps.py(case intools/test_fleetcore_apps.py); the Apps page,tools/dash appsandtools/frontend_registry.py launcherall read that one projection. - A new key →
keys.py(case intools/test_fleetcore.py); map its action intools/tui/app.pyKEY_ACTIONSand the page'sKEY_DO. - A new colour role →
theme.pyTOKENS+CSS_ROLES; a colour of the OS shell's own chrome (the Desktop) →OS_TOKENS+OS_CSS_ROLES. - A new registry, surface or relation the control plane has → a builder in
graph.py(BUILDERS,KINDS,RELS; case intools/test_fleetcore_graph.py), parsed through its owner's parser, never a second copy of the fact. - A new loop whose output should be measured → a rule in
_data/fleet.ymllearning.loops; a new outcome or estimate →learn.py(case intools/test_fleetcore_learn.py). Anything that lets the estimate steer a loop is a gated change (ADR 0010 decision 6). - A new fact about a fleet repository's workflows or a new check state →
workflows.py(case intools/test_fleetcore_workflows.py); a new fact that needs a GitHub read →workflow_sync.pyin dash-gen, which writes the lake, never here. - A new agent capability → a tool in
tools/console/mcp_layer/server.pyover an existing view or console route (case intools/test_fleetcore.py); never a path that skips the console's allowlist.
Forbidden¶
- No writes and no subprocesses other than
docker ps.learn.pyandworkflows.pyopen the lake read-only (mode=ro) andgraph.pywrites only the fileexport --outnames. Running anything belongs to the console's allowlist (tools/console/core.pyOPS), reached throughclient.py. - No credentials stored here;
client.pyreadsDASH_CONSOLE_TOKENfrom the environment and sends it only to the console.