Skip to main content

Crate kcode_k1_daemon_lib

Crate kcode_k1_daemon_lib 

Source
Expand description

§kcode-k1-daemon-lib 0.13.6 — the library-only composition root for the private K1 loopback daemon

§Public API and composition

pub fn run(k1_root: PathBuf) -> ExitCode;

run builds the multithreaded Tokio runtime, prompts once for Vault unlock, starts the complete daemon beneath <k1_root>/state, writes readiness, serves the loopback boundary, and returns success only after graceful shutdown. Startup or listener failure returns exit code 1 through the fixed safe daemon error surface.

The daemon composes one process-lifetime instance of its KTO-backed state, Access, Audio, Chat, Launch Nodes, providers, authenticated HTTP adapters, public Web serving, and model-facing code services. One retained K1WebHttp supplies both the public router and the identical shared projection used by WebCode. CodeServices opens process-owned RustCode and WebCode services, and Chat selects the full Social + SetLaunchNode + RustCode + WebCode + WebSearch constructor.

Chat and HTTP continue to share the existing Access, Profile, Filter, Objects, Groups, Launch Nodes, and Kmap facades. WebSearch continues to derive from the existing Chat Codex Adapter clone, so no provider process or profile is added.

§State, startup, and lifecycle boundary

Durable product state remains beneath <k1_root>/state and is committed through subsystem owners; Web and Rust projections plus per-user code caches are disposable derived state. Code-service host paths, pinned images, revisions, Chromium identity, and resource/time limits are required deployment environment inputs and are never defaulted.

Startup opens each subsystem once, reconciles invite stock, binds loopback port 4450, and writes readiness only after successful preparation. K1_PUBLIC_ORIGIN retains its existing behavior; existing authentication, replay protection, CORS, security, shutdown, and readiness behavior are unchanged.

This release proves package composition and managed checks only. Local dependency selection, daemon rebuild or restart, host provisioning, live code-tool calls, browser integration, UI selection, proxy/TLS, and deployment remain outside this package.

Functions§

run