API Reference H v#0.3.0

Copy Markdown View Source

Modules

H

Elixir/OTP core for H (hiness on Hex, :harness OTP application).

Daemon-owned named accounts and login operations. Inference workers can resolve a credential; owner clients get only an explicitly projected view.

Private single-writer credential storage under the daemon's data-dir lock. Not part of session storage and not an isolation boundary for same-UID tools.

OTP application entry point. Embedded hosts can opt into the same daemon instance as H.serve/1 by configuring :harness, :data_dir. Read Embed the core in an OTP application on hiness.dev for store isolation and workspace boundaries.

Read-only imported session snapshots, stored separately from live session WALs.

Owner bearer token and browser session cookie manager backed by a :protected ETS table and <data_dir>/auth.token (0600).

Server-owned session metadata index (<data_dir>/catalog/sessions.json) backed by a :protected ETS table for lock-free concurrent reads.

Pure context reducer projecting visible transcript entries, agent settings, and tool descriptors into a provider-neutral request map and ReqLLM structs.

A linear transcript segment, optionally inheriting another conversation's prefix.

In-memory credential resolver for LLM providers.

Transport-agnostic daemon API for H sessions, conversations, transcripts, SSE subscriptions, and idempotent commands.

Side-effect-free cold storage reader for archived native sessions.

Boundary parameter, query, and command envelope validation for H.Daemon.

Workspace directory browsing, bounded recursive file discovery, UTF-8 file reading, and lexical + canonical symlink containment checks for H.Daemon.

Versioned pure-functional conversation documents (agent, live, inbox, usage), JSON delta operations, and fork policy resolution.

An immutable transcript record. IDs are ordered and unique within a session.

Stateless resolver turning environment configurations into live H.ExecutionEnv.t() handles and plain JSON-safe environment descriptors.

Pluggable filesystem and process execution boundary for H tools.

Local host filesystem and OTP Port process-group execution environment (H.ExecutionEnv).

Sanitized environment construction, OTP Port execution, OS PGID process-group reaping, and rolling tail/spill-file output buffering for H.ExecutionEnv.Host.

Local host filesystem operations for H.ExecutionEnv.Host: symlink-hop-bounded canonical_path, UTF-8 line scanning, bounded byte reads, atomic file writes, directory listing, and bounded BFS file discovery.

Compatibility wrapper delegating to H.ExecutionEnv.Host.

Cooperative remote H.ExecutionEnv adapter backed by a H.RemoteAgent handle.

Startup contract for a trusted, locally built H extension (API 1).

Plug.Router for the local H HTTP/JSON and SSE daemon.

Chunked Server-Sent Events (text/event-stream) transport loop.

HTTP security boundary

Behaviour for pluggable agent harness profiles (H.Harness.Coding, etc.).

Default Pi-compatible coding harness profile (id: "coding").

Storage-neutral LLM streaming behaviour for H.

Optional account ordering for the existing Codex adapter. Return a subset of the supplied aliases, in preference order, using cached data only.

Deterministic scripted H.Provider for --no-start unit and recovery tests.

Raised when H.Provider.Fake receives a turn after its scripted steps are exhausted.

H.Provider adapter backed by ReqLLM and LLMDB.

Model catalog curation, LLMDB lookup, Gemini/Vertex synchronous limit normalization, and default model selection for H.Provider.ReqLLM.

Managed Codex account dispatch, pooled credential selection, and pre-output authentication rejection handling for H.Provider.ReqLLM.

In-VM cooperative remote execution agent GenServer (H.ExecutionEnv.Remote transport seam).

Boundary validator for untrusted decoded JSON maps, command envelopes, and HTTP parameters.

Pure session history: a working directory, conversations, and immutable entries.

Manual /compact policy, safe provider-visible prefix projection, boundary selection, and single-call summarization for H sessions.

Single mutation authority and durable coordinator for one H session.

Command envelope deduplication and staging (submit, fork, fork_and_submit, configure, abort, withdraw, rename, compact, and user_shell delegation) for H.Session.Server.

Generation and compaction worker spawning, auto-compaction promotion, retry/wake staging, and completion/cancellation/abort settlement for H.Session.Server.

Session store bootstrap, open-time checkpoint reconciliation, worker crash recovery, restart-budget enforcement, and clean-shutdown persistence for H.Session.Server.

Shared session coordinator state transitions, conversation entry/visibility queries, workspace lease coordination, worker termination, and H.Catalog runtime reporting.

Ephemeral streaming output buffers, periodic live document flushing, ProcBin SSE commit/ephemeral frame broadcasting, 64-entry replay ring, and initial conversation snapshot encoding.

Submission lookup, bounded LRU caching, settlement, inbox draining, automatic initial title derivation, and pending generation run creation for H.Session.Server and H.Session.UserShell.

Tool worker spawning, argument validation, mutating workspace lease handling, sequential tool-round advancement, and interrupted/aborted tool settlement for H.Session.Server.

Signal-driven workspace admission. Waiting work has no execution attempt to replay.

Coordinator-managed subagent delegation lifecycle for H.Session.Server.

Per-session :one_for_all supervision boundary (Task.Supervisor + H.Session.Server).

Read-only session-wide entry tree builder for live, cold native, and imported archived sessions.

Durable backend lifecycle for user-invoked shell commands (! / !!).

Pluggable persistence boundary for a single H session.

Shared in-memory domain projection, batch evaluation, entry scanning, revisioned document lookup, and safe string-key normalization for H.Storage backends.

Durable local file backend implementing H.Storage with a CRC32-framed binary WAL (commit.log) and atomic JSON snapshots (snapshot.<seq>.json).

Atomic JSON snapshot persistence (snapshot.<seq>.json), WAL truncation, and snapshot recovery for H.Storage.File.

CRC32-framed binary write-ahead log (commit.log) encoding, appending, replay, and torn-tail recovery for H.Storage.File.

In-memory reference backend implementing H.Storage.

OS-level single-daemon ownership lock for data_dir.

Idempotent command receipt keyed by request_id with deterministic payload fingerprinting and status transitions (queued, placed, done, unanswered, withdrawn).

Versioned durable task record (generation, tool_call) and pure state transitions (pending, running, waiting, sleeping, terminal).

Behaviour and JSON Schema validation helper for durable tools in H.

Core bash tool for executing shell commands via H.ExecutionEnv.exec/3.

Core edit tool for exact, unique, non-overlapping multi-hunk replacements against the original file contents while preserving untouched line endings.

Core read tool for bounded UTF-8 text reads and PNG/JPEG/GIF/WebP image reads.

Core search_history tool for searching raw un-truncated transcript entries.

Coordinator-managed subagent delegation tool (name: "subagent").

Core write tool for atomically writing a file through H.ExecutionEnv.

Pure Elixir reducer for conversation transcript SSE/PubSub frames. Applies document deltas with H.Document.apply_ops/2.

Coordinates per-workspace mutating tool leases by {env_id, canonical_cwd} so concurrent coding runs do not clobber the same working tree while keeping separate execution environments isolated.