Expand description
Rust client for the kindling daemon.
A thin, async HTTP/1-over-Unix-domain-socket client for the
kindling-server daemon. It speaks the v1
wire contract exactly, sending the X-Kindling-Project header on every data
endpoint, and auto-spawns kindling serve --daemonize on first call if the
daemon is not running.
The method surface mirrors kindling-service for ergonomic
in-process / via-daemon interchangeability. To stay thin, the crate depends
only on kindling_types for domain shapes — never on kindling-service
or kindling-store (which pull rusqlite).
§v1 wire contract
GET /v1/health → 200 { version, schemaVersion, supportedKinds, storagePath, kindRegistry, projects: [...] }
POST /v1/capsules → 201 Capsule
GET /v1/capsules/open?sessionId → 200 Capsule | null
PATCH /v1/capsules/:id/close → 200 Capsule
POST /v1/observations → 201 Observation
POST /v1/observations/list → 200 ListObservationsResult (paginated)
POST /v1/observations/:id/forget → 204 (redact an observation)
POST /v1/retrieve → 200 RetrieveResult
POST /v1/pins → 201 Pin
DELETE /v1/pins/:id → 204
POST /v1/context/session-start → 200 { additionalContext: string | null }
POST /v1/context/pre-compact → 200 { additionalContext: string | null }§Schema version
Client::health checks the daemon’s reported schemaVersion against
ClientConfig::expected_schema_version (default
EXPECTED_SCHEMA_VERSION, sourced at compile time from the repo-root
schema/version.json) and returns ClientError::SchemaMismatch on
disagreement. See Spawner and the config notes for the cargo publish
copy-step caveat.
§Example
// Everything you need is re-exported here — no need to depend on
// `kindling-types` directly.
use kindling_client::{Client, CapsuleType, ScopeIds};
let client = Client::new()?;
let health = client.health().await?;
println!("daemon schema v{}", health.schema_version);
let capsule = client
.open_capsule(CapsuleType::Session, "investigate bug", ScopeIds::default(), None)
.await?;Re-exports§
pub use spool::SpoolConfig;pub use spool::SpoolError;pub use spool::SpoolStatus;pub use spool::SpooledClient;
Modules§
Structs§
- Append
Result - Outcome of
Client::append_observation. - Candidate
Result - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Candidate (observation or summary) ranked by score. - Capability
- Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Capability block surfaced by health andkindling status --json. - Capsule
- Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Bounded unit of meaning grouping related observations. - Client
- A thin async client for the kindling daemon.
- Client
Config - Configuration for a
Client. - Close
Capsule Body PATCH /v1/capsules/:id/closebody — all fields optional.- Create
PinBody POST /v1/pinsbody — create a pin.- Health
- Result of
GET /v1/health. - Kind
Registry Entry - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. One entry in the machine-readable kind registry. - List
Observations Request - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Filter + pagination for an observation list request. - List
Observations Result - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. One page of observations in stable(ts ASC, id ASC)order. - Observation
- Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Atomic, immutable record of an event captured during development. - Observation
Input - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Input for creating a new observation. Optional fields are auto-generated. - Pin
- Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Pinned reference to an observation or summary. - PinResult
- Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Pin together with the observation or summary it points at. - Provider
Search Options - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Search options for a retrieval provider. - Provider
Search Result - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. A single result from a retrieval provider. - Retrieve
Options - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Options for a retrieval request. - Retrieve
Provenance - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Provenance for a retrieval result. - Retrieve
Result - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Complete retrieval result: pins, optional current summary, ranked candidates, provenance. - Scope
Ids - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Scope identifiers for multi-dimensional isolation. - Summary
- Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. High-level description of a capsule’s content (typically LLM-generated).
Enums§
- Capsule
Status - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Capsule lifecycle status. - Capsule
Type - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Types of capsules. - Client
Error - Errors returned by
Clientoperations. - Observation
Kind - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Types of observations that can be captured. - PinTarget
Type - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Type of entity that can be pinned. - Retrieved
Entity - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. An entity returned from retrieval — either an observation or a summary. Untagged so the wire format matches the TS structural unionObservation | Summary. - Spawner
- How the client starts the daemon when it is not already running.
- Transport
- Which transport the client uses to reach the daemon.
Constants§
- EXPECTED_
SCHEMA_ VERSION - The canonical schema version this client expects the daemon to report.
- PROJECT_
HEADER - Header carrying the project root string for per-project DB routing. Mirrors
kindling_server::PROJECT_HEADER.
Functions§
- build_
capability - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Assemble the capability block from runtime inputs (version, schema, storage path). - default_
port_ path - Default daemon TCP port file path:
~/.kindling/kindling.port. - default_
socket_ path - Default daemon socket path:
~/.kindling/kindling.sock. - default_
spawn_ log_ path - Default spawn-failure log:
~/.kindling/spawn.log. - kind_
registry - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Machine-readable registry listing every kind with its required fields. - supported_
kind_ names - Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Snake-case kind names for everyObservationKindvariant, in declaration order.
Type Aliases§
- Id
- Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Unique identifier for entities. Implementation uses UUIDv4 format. - Timestamp
- Domain types re-exported from
kindling_typesso the daemon client is a self-contained SDK: depend onkindling-clientalone and reach every type the API sends or returns askindling_client::<Type>.kindling-typesstays an internal transitive dependency you never have to name. Timestamp in epoch milliseconds.