kcode-k1-daemon-lib 0.9.0

Library-only private K1 loopback daemon composition root
Documentation
# kcode-k1-daemon-lib

`kcode-k1-daemon-lib` 0.9.0 is the library-only composition root for the private K1 loopback daemon. Its public entry point remains `pub fn run(k1_root: PathBuf) -> ExitCode`.

`run` builds a multithreaded Tokio runtime, prompts without echo for the Vault passphrase, and opens durable state beneath `<k1_root>/state`. Startup retains the exact Ordering, Peering, Vault, Persons, Invites, Accounts, Users, Groups, Access Profiles, Objects, Audio Classification, Access, replay, invite-stock, Audio, and Chat composition and paths.

After every subsystem and provider is ready, the extracted HTTP Boundary binds `127.0.0.1:4450`, serves `/config.json` plus the authenticated API, writes one readiness record, warns on slow startup, and handles SIGINT/SIGTERM graceful shutdown. The Vault remains retained until serving ends, while the merged Axum router owns the opened Chat service. Startup and listener failures preserve the existing safe process messages and exit code 1.

The advertised public origin remains `http://localhost:4450`; the invite link origin and minimum 100-unused-invite gate are unchanged. Accounts, People, Persons, Audio, Terms, replay, authority enforcement, non-cacheable generated responses, safe API error contextualization, and fallback behavior remain unchanged.

Version 0.9.0 selects Provider Config 0.1.1, HTTP Chat 0.1.0, HTTP Boundary 0.1.0, Chat Service 0.2.0, Codex Adapter 0.5.0, and the source-compatible Speaker Analysis 0.3.4 backport with `adapter-providers`. Provider Config preserves `K1_CODEX_EXECUTABLE` with the literal `codex-safe` default, `ffmpeg` resolution from `PATH`, and Gemini 3.1 Pro followed by GPT-5.6 Terra model order.

Exactly one Codex app-server process is opened, with isolated profiles:

- Audio: `gpt-5.6-terra`, medium reasoning, empty base instructions, and only `record_speaker_labels` plus `record_speaker_analysis`.
- Chat: `gpt-5.6-sol`, xhigh reasoning, empty base instructions, and only `CurrentTime`.

Audio retains its existing Gemini and Terra paths, HTTP routes, authorization, persistence, classification, speaker tools, and ordering. Speaker Analysis 0.3.4 matches Audio's 0.3-compatible closure, yielding one nominal `Analyzer` type.

Chat Service is opened at `<k1_root>/state/chat` and moved into `kcode_k1_http_chat::router(chat, chat_model())`. That router is merged into the existing authenticated Axum router before its fallback, so HTTP Chat 0.1.0 is mounted only below K1Http's authenticated `/api`: its `/chat` routes create through a saved profile, list creation-ordered discovery metadata, return complete snapshots, send User text, rename, restart, and close. The server fixes every backend Chat model to Provider Config's `gpt-5.6-sol` identifier; request bodies cannot select a model or provider. K1Http continues to own authentication, signing, replay protection, CORS, `nosniff`, and the enclosing body limit. No unauthenticated Chat route, listener, state format, migration, retry, capacity limit, stream, delta, cancellation, upload, UI, deployment, or new provider mechanism is added.

Package checks start no listener or provider and do not prove genuine `codex-safe`, provider traffic, live Chat ingress, cold restart, or deployment readiness; this release makes no such deployment claim.