Repository & Crate Map
Use this page to navigate the repository and quickly find which crate, built-in bundle, or package owns a change.
Top-level directory layout
hya/├── crates/ # Rust workspace crates (backend, kernel, runtime-abi, engine, store, server, SDK, migration, relay, xtask, e2e)├── packages/│ ├── hya-tui/ # Interactive Bun/OpenTUI terminal frontend (hya.v2)│ ├── hya-tui-web/ # Real-PTY + xterm.js browser WebUI host & tui-exp / Playwright test suites│ └── hya-tui-sdk/ # Standalone @hya/tui-sdk v2 package & QuickJS WASM / JIT extension runner├── proto/│ ├── hya/v2/ # Canonical hya.v2 Protobuf contract (15 services, 95 RPCs)│ └── hya/relay/v1/ # Blind relay rendezvous Protobuf contract├── public/ # Static GitHub Pages root landing page (plain HTML/CSS/JS)├── scripts/ # Unified release installer (hya-install.sh), bundle-ci, & developer utilities├── docs/ # Documentation & Astro Starlight site (docs/site/)├── CONTEXT.md # Root domain glossary└── versions.toml # Single source of truth for release version & minimum_backend_versionThe core checkout contains the host and test fixtures. The official bundle
repository uses the published
four-crate ABI SDK (hya-proto, hya-tool, hya-provider, and
hya-runtime-abi). The static registry
publishes independent bundle releases.
Rust workspace crates (crates/)
Lower-level crates never depend on hya-backend or frontend packages. hya-proto stays dependency-light, hya-runtime-abi carries zero store/engine/server dependencies, and hya-relay and hya-updater do not depend on runtime crates.
| Crate | Role |
|---|---|
hya-proto |
Newtyped IDs (SessionId, MessageId, …), canonical kernel Event + Event::Extension / Envelope, message parts, DTOs, and the deterministic Projection reducer (with Projection::extensions). |
hya-version |
Compile-time VERSION, BACKEND_VERSION, RUSTC, and MINIMUM_BACKEND_VERSION read from versions.toml. |
hya-api |
Generated proto/hya/v2 types (prost / tonic / pbjson), cursor helpers, and HTTP ↔ gRPC error-code table (xtask -- gen-api). |
hya-tool |
Tool trait, ToolRegistry (enforcing permanently reserved todo/rewrite), PermissionPlane, symlink-safe multi-root ProjectScope, HandleRouter (DynamicUriHandler), slim single-agent ToolCtx + ExtensionPlanes (ErasedPlane), and the sources the ABI digest hashes (tool::NATIVE_ABI_SOURCES). No bundle domain plane (project_activity is a hya/coding-extras tool over HostSessionStore::project_changes). |
hya-paths |
Shared resolver for config, data, state, and cache roots (HYA_HOME override, XDG directories, and HOME fallback). |
hya-runtime-abi |
Lockstep Native Runtime ABI v2 (4-crate ABI boundary with hya-proto, hya-tool, and hya-provider): export_native_bundle_v2!, abi_digest_v2, NativePluginContext, NativeRegistrations, Arc<dyn HostRuntime> + 7 sub-traits, and native extension traits; re-exports proto, tool, provider, and bundle so a bundle can build against this crate alone; see Native Bundle Runtime ABI v2. |
hya-bundle-trust |
Offline Sigstore verification for artifact signatures and signed advisories. |
hya-tool-loader |
One native load path for every bundle, from an installed package (load_native_bundle and load_v2_from_path): verifies the lockstep ABI v2 digest, bridges the Tokio runtime and deadline cell, collects provider kinds only from a bundle that declares the providers capability, and registers the exported tools from the bundle’s own resources.tools descriptors. Core tests load no first-party library. |
hya-provider |
Provider contract (Provider, Protocol, ProviderKinds, ProviderAuthFlow), router, preflight, the one HTTP+SSE transport and model-list discovery loop (behind optional http-client), OpenAI-compatible Chat, scripted FakeProvider, and offline DevProvider; the other wires (Anthropic, Gemini, OpenAI Responses/Codex, Grok Build) are provider kinds registered by provider-* in the official bundle repository. |
hya-store |
SQLite WAL v2 persistence (format_version = 2): schema_meta, event_log, projection_snapshot, project/project_root, generic bundle_state (CAS KV), generic bundle_claim (fenced leases), pending_resume, file_blob, and <db>.runtime-owner.lock. The standard runtime persists grants in permissions.toml. Fails fast on unmigrated v1 databases. |
hya-bundle |
Prepared catalog and .hyabundle reader, archive closure verification, installed bundle selection, and overrides: hya/bare. Verified official provenance gates the full tool plane. |
hya-child-io |
Bounded NDJSON line framing and async I/O task tracking shared by MCP and plugin child processes. |
hya-mcp |
MCP stdio, Streamable HTTP, and SSE client manager bridging mcp__<server>__<tool> into hya-tool. |
hya-plugin |
Out-of-process NDJSON JSON-RPC 2.0 plugin host, hook chain dispatcher, permission bridge, and host/capability handler. |
hya-plugin-bun |
Bun JS extension adapter (adapter/), translating high-level JS tool/hook modules onto the JSON-RPC stdio wire. |
hya-plugin-claude |
Claude Code plugin importer (--claude) and runtime hook adapter (adapter/). |
hya-core |
The three-primitive kernel loop (read, write, edit, bash, grep, todo, rewrite, plus built-in skill), kernel prompt builder, and 80% Rewrite trigger. Loads and links no bundle. |
hya-engine |
Slimmed single-agent SessionEngine + extension host adapters (TurnBinding, CatalogScope overlays, one HookChain per point, RuntimeRegistry, NativeService/NativeHook/ProjectionReducer wiring, and one kernel harness for all profiles). Depends on no bundle crate; the resource_view.deny rule reads the known-bundle set hya-app hands it. |
hya-code-mode |
Native code-mode__run tool, with an oxc_parser AST checker and an in-process QuickJS-NG sandbox via rquickjs. |
hya-app |
Runtime composition: Config v3 (config.toml, models.toml, profiles, and per-bundle TOML), OAuth/provider loading, core code_mode adapter (crates/hya-code-mode), HostRuntime implementation, project bundle/plugin watchers, and HyaRuntime shutdown orchestration. |
hya-server |
Single-port /v2 Axum HTTP/SSE/WS router + V2Grpc (BundleApi mounting native + JS handlers), Host allowlist guard, ephemeral session reaper, and relay_host connector. |
hya-sdk |
Typed Rust /v2 HTTP + SSE client (Sdk, Client) and SessionMirror transcript + extensions reducer. |
hya-migration |
Standalone offline v1-to-v2 migration & SHA-256 rollback CLI (bin/hya-migration) for sessions.db, config.yaml, tui.toml, tui.json, .hya/bundles/, and registry.sqlite3 (see Migrating v1 to v2). |
hya-relay |
Standalone hya.relay.v1 protocol, RelayLink parser, Noise_NKpsk0 tunnel, stateless room proxy, and gRPC + WebSocket client/server bindings. |
hya-updater |
Standalone release updater embedding scripts/hya-install.sh for hya update. |
hya-bundle-tooling |
Offline bundle tooling: the deterministic package writer, staging of untrusted packages, install/remove/enable administration and listings (BundleManager, the server’s BundleControl), and the hya bundle CLI. Only hya-backend and repository tooling depend on it. |
hya-backend |
Unified hya CLI binary: global --bare/--pure, subcommand dispatch (exec, -p, loop, workflow, serve, bundle through hya-bundle-tooling, relay, acp), detached daemon manager (daemon.rs), and Bun TUI/WebUI process supervisor (frontend.rs). |
hya-e2e |
Process-level E2E test harness (Track P: real hya binary + scripted FakeLlm, registered in matrix.toml). |
xtask |
Developer CLI for gen-api, gen-relay, gen-plugin, package-bundle, matrix-check, benchmarks, and release-rehearsal. |
Crate dependency flow
flowchart BT
Foundation["hya-proto · hya-version · hya-api"]
Planes["hya-tool · hya-runtime-abi · hya-tool-loader · hya-provider · hya-store · hya-bundle"]
Sidecars["hya-child-io · hya-mcp · hya-plugin · hya-plugin-bun · hya-plugin-claude"]
Kernel["hya-core (3-primitive kernel + 8 bare tools)"]
Engine["hya-engine (SessionEngine + Extension Host)"]
Bundles["Installed and project bundles"]
App["hya-app (Composition · HostRuntime · Code Mode)"]
Surface["hya-server · hya-sdk · hya-migration · hya-relay · hya-updater"]
Tooling["hya-bundle-tooling (package writer · install admin · hya bundle CLI)"]
CLI["hya-backend (bin/hya)"]
Planes --> Foundation
Bundles --> Planes
Sidecars --> Planes
Kernel --> Planes
Engine --> Kernel & Sidecars
App --> Engine & Sidecars
Surface --> Engine & Foundation
Tooling --> App & Surface
CLI --> App & Surface & Tooling
“Where should my change go?”
| If you are changing… | Edit here |
|---|---|
A wire Event / Event::Extension, ID type, or Projection folding rule |
crates/hya-proto |
A /v2 HTTP route, gRPC method, or error code |
proto/hya/v2/*.proto → run cargo run -p xtask -- gen-api → crates/hya-server |
Lockstep Native ABI v2 traits, HostRuntime, or export_native_bundle_v2! |
crates/hya-runtime-abi (and crates/hya-tool-loader / crates/hya-app/src/host_runtime.rs) |
| An LLM provider encoder/decoder or capability check | crates/hya-provider (contract, transport, OpenAI-compatible) or its provider-* in the official bundle repository bundle |
One of the 8 bare-mode core tools (read/write/edit/bash/grep/todo/rewrite/skill) or Rewrite rules |
crates/hya-core/src/kernel |
| Core Code Mode runtime | crates/hya-code-mode + crates/hya-app/src/code_mode.rs |
| Hashline file tools, LSP/formatters, project activity, web tools, plan mode, goal/loop drivers, subagents, channels (and channel templates), workflows, or compaction | {hashline,coding-extras,network,plan,goal,loop,multi-agent,agent-channels,workflow,compaction}/native in the official bundle repository |
An example of an external bundle built only against hya-runtime-abi and @hya/tui-sdk |
example/mini-agents |
Permission rules, ProjectScope, HandleRouter, ExtensionPlanes, or the Tool trait |
crates/hya-tool |
SQLite v2 tables, migrations, locks, bundle_state/bundle_claim, or event batching |
crates/hya-store |
| Offline v1-to-v2 migration or SHA-256 rollback | crates/hya-migration |
.hyabundle schema_version: 2 source manifest parsing or validation |
crates/hya-bundle-prepare |
hya bundle … (pack, verify, install, remove, list), package writing, or what the server’s bundle management routes do |
crates/hya-bundle-tooling |
*.hya.md Workflow syntax or DAG compilation |
workflow/native/core in the official bundle repository (src/compile/) |
| Single-agent turn loops or extension host wiring | crates/hya-engine |
| Config v3 loading, per-bundle TOML, OAuth, or Project catalog refresh | crates/hya-app |
CLI flags (--bare, --pure), daemon start/stop, or bare hya process launch |
crates/hya-backend |
TUI core shell, slash commands, keybindings, or tui.toml |
packages/hya-tui (and built-in TUI bundles under */tui/ in the official bundle repository) |
| Browser WebUI host or PTY test runner | packages/hya-tui-web |
@hya/tui-sdk v2 extension API or QuickJS VM sandbox |
packages/hya-tui-sdk |