Expand description
NATS KV bucket name + key helpers (spec §2.3.2).
NATS KV bucket names must be domain-safe ASCII (a-z, A-Z, 0-9, _, -),
so the spec’s dotted names (script.current, script.status) are
flattened to underscore form here.
Constants§
- BUCKET_
AGENTS_ STATE - BUCKET_
AGENT_ CONFIG - BUCKET_
AGENT_ GROUPS - BUCKET_
JOBS - Job catalog (v0.15) — operator-registered Manifests, keyed by
manifest.id. Schedules and ad-hockanade run --job-id ...look jobs up here; the wire never round-trips an inline Manifest body through a Schedule again. Editing a job in-place retroactively changes what future schedule fires deploy. - BUCKET_
JOBS_ YAML - Parallel “operator source-of-truth YAML” stores keyed identically
to
BUCKET_JOBS/BUCKET_SCHEDULES. The agent / scheduler / projector all keep reading the JSON KVs above — these buckets exist only so the SPA’s YAML editor can round-trip operator comments + script indentation + block-scalar style exactly. - BUCKET_
SCHEDULES - BUCKET_
SCHEDULES_ YAML - BUCKET_
SCRIPT_ CURRENT - BUCKET_
SCRIPT_ STATUS - KEY_
AGENT_ CONFIG_ GLOBAL - Sprint 6 layered-config keys inside
BUCKET_AGENT_CONFIG: - KEY_
AGENT_ TARGET_ VERSION - Key inside
BUCKET_AGENT_CONFIGcarrying the broadcast target version. Agents watch this key and self-update when their running version drifts. - OBJECT_
AGENT_ RELEASES - Object Store bucket holding raw agent binaries (one object per
version, e.g.
0.2.0→ file bytes). - OBJECT_
APP_ PACKAGES - Object Store holding generic application packages — anything the agent / kitting scripts pull down + install on endpoints. First consumer is the kanade-client app, but the bucket is intentionally generic: third-party installers (Webex, Teams, custom MSI bundles), upgrade scripts, configuration archives, etc. all live here.
- OBJECT_
RESULT_ OUTPUT - Object Store holding overflow stdout / stderr blobs for the
ExecResultwire kind (#227). The default NATSmax_payloadis 1 MB; a result whose stdout / stderr exceeds it would reject the publish and pin the agent’s outbox in a reconnect loop. The agent uploads any stdout / stderr larger thanSTDOUT_INLINE_THRESHOLD(256 KB, picked at 1/4 of the default max_payload so the rest of the ExecResult fields fit alongside) into this bucket and replaces the inline field withcrate::wire::ExecResult::stdout_object/stderr_objectpointers. Backend’s results projector derefs the pointers before INSERT so downstream consumers (SQLite, SPA Activity, inventory projector) see the full text the same way they always have. - OBJECT_
SCRIPTS - Object Store holding manifest script bodies referenced by
Execute::script_object(SPEC §2.4.1’s alternative to inlinescript:/ repo-localscript_file:). Per yukimemi/kanade issue #210, this is the “Plan B 4-bucket layout” sibling ofapp_packages— separated because scripts have a different lifecycle than installer binaries: - PREFIX_
AGENT_ CONFIG_ GROUPS - PREFIX_
AGENT_ CONFIG_ PCS - SCRIPT_
STATUS_ ACTIVE - SCRIPT_
STATUS_ REVOKED - STDOUT_
INLINE_ THRESHOLD - Inline threshold for
ExecResult.stdout/.stderr. Larger payloads overflow intoOBJECT_RESULT_OUTPUT. 256 KB = 1/4 of the NATS defaultmax_payload(1 MB) so the rest of the ExecResult JSON (request_id, exec_id, etc.) easily fits below the publish-reject ceiling. - STREAM_
AUDIT - STREAM_
EVENTS - STREAM_
EXEC - STREAM_
INVENTORY - STREAM_
OBS_ EVENTS - JetStream stream backing the per-PC observability event pipeline
(Issue #246). Distinct from
STREAM_EVENTS(in-flight script lifecycle) —STREAM_OBS_EVENTScarries the timeline data the SPA’s Events page consumes: sign-in/out, power on/off, sleep/ resume, agent milestones, diagnostic bundle pointers. The agent publishes onobs.<pc_id>(seecrate::subject::obs) and this stream catches everything matchingcrate::subject::OBS_FILTERso a backend that boots after the agent doesn’t miss any already-emitted events. - STREAM_
RESULTS
Functions§
- agent_
config_ group_ key - agent_
config_ pc_ key - parse_
agent_ config_ group_ key - Inverse of
agent_config_group_key— returns the bare group name ifkeycarries the groups-scope prefix, elseNone. - parse_
agent_ config_ pc_ key - Inverse of
agent_config_pc_key.