Repository navigation
v0.2.0 — vision, media, compaction, budgets
v0.2.0 — vision, media, compaction, budgets
The first feature release since the public snapshot. Everything here is additive: no event kind,
wire shape or replay rule breaks, and a config that does not opt in keeps its request bytes
byte-identical.
Context and cost
- Long sessions compact themselves.
kian-orchestrator::compactionfolds old turns under
measured pressure — only when the worst-case next request would consume 90% of a declared
model_profiles.*.context_window, or when the provider reports an overflow. The fold is an
ordinary persisted maintenance turn (step/requestwithpurpose: compact, then acompact
event on success), uses the session's bound slot with one request and no fallback, and is capped
at two folds per drain episode. Ordinary turns reserve 10% of the token allowance for it. - A session-lifetime token budget that refuses before the call.
agents.<name>.budgets.tokens
projectsbase + Σbudget/raised − Σturn/end.usage, admits the request plan's worst case and
refuses the turn beforestep/requestis persisted; the session parksawaiting_budgetand
resumes.kian raise-budget/raise_budgetadmits one durable, idempotent control row. - A price book turns usage into money.
pricing:declares per-million-token cache-hit,
cache-miss and output prices, peak windows and holidays, normalized once to integer micro-USD;
kian costattributes eachturn/endusage to the last request target and reports priced /
unpriced / unknown usage and the peak split. Nothing is written to the event stream. - Request plans. Every provider attempt is built by a pure planner returning the body, its
dialect, profile digest, body digest and a token band; sender, persistence, cache check and the
budget gate consume that one value.model_profiles:now also carriesvision: true. kian usage-stats,/metricsandsession inspectreport cache-miss input tokens and a hit
rate. A rejected DeepSeek request (HTTP 422 / in-band 400/422) is classifiedInvalidResponse
and no longer retried on a fallback.
Media and artifacts
- Tool results ride the event stream by reference. With
artifacts:configured, a successful
tool/resultaboveinline_max_bytes(16 KiB) is rewritten to a content-addressed
{artifact, preview, truncated}before the event is appended; the store is sha256-addressed,
atomic, path-traversal-proof and collected by retention (kian artifacts gc, 10 GiB / 30 days).
artifact_readserves the payload back in bounded windows. - Media tools and file ingest.
media:mountsimage_ocr,audio_transcribeand
speech_synthesizeas audited tools over DeepSeek's media APIs;kian artifacts put <path>
turns a local file into an artifact. - Vision inputs. A vision-profile target sees artifact-backed images as OpenAI
image_url
content parts; V1 and every image-free V2 body stay byte-identical, and a reclaimed blob degrades
the picture rather than the turn. - Channel-edge media. Voice notes and photos from an adapter carrying the
mediaenvelope are
written to the artifact store, transcribed, and admitted as text plus an artifact reference — no
base64 ever re-enters the payload. Shipped adapters emit the envelope in their phase-2 contract.
Tools and operations
web_searchandweb_fetchon the operator's own DeepSeek key (web:), as ordinary
audited tool calls; large pages spill by reference instead of being truncated.- Artifact retention runs inside
kian servebeside the snapshot and view tickers, and
kian session export --with-artifactspins every referenced blob into a sibling directory so an
audit package stays payload-complete. - Off-peak deferral. JSON-RPC
submit/queuewithdefer: "off_peak"and a cron resident
schedule withdefer: off_peakpersist the ordinary inbox row with a computedeligible_at,
bounded bydefer.max_wait_ms. No second scheduler, no timer per row, no new event kind.
Install
Prebuilt archives (with .sha256) for x86_64/aarch64 Linux and macOS are attached below, and
ghcr.io/flyer103/kian:0.2.0 carries the same kian + kiand pair. From source:
cargo build --release --locked -p kian-cli -p kiandcrates.io still carries 0.1.1; the registry publish is a separate step.
Boundaries, stated up front
- No shipped channel adapter emits the
mediaenvelope yet — WeChat and iMessage record it as
their phase-2 contract. - Search/Fetch per-request fees are not yet in the token cost projection.
- Wall-clock budget raises are projected but not enforced while a drain is idle.
- Compaction never runs for cost: only measured context pressure or a provider overflow triggers it.
Licensed under Apache-2.0.