/** * Capability constants — PROTOCOL §7 / §9.1 (saga vr7kgx.6). * * A small L1 surface for the secret-free feature strings a server advertises. Servers * emit these in `hello.capabilities` (transport-scoped) and, for an attached runtime, in * the daemon-authored `sync.capabilities` (projected from the child runtime's own hello). * Clients must NOT infer support from the protocol version or probe unsupported commands * (§7) — they gate controls on the presence of these strings. * * Kept as plain `const` strings (not a closed enum) so extension/transport capabilities can * be advertised additively without touching this module; the typed constants here are the * ones the reference servers + browser controls agree on. */ /** Live `message_delta` streaming is available (T1–T3). */ export const CAP_STREAMING_DELTAS = 'streaming-deltas'; /** `list_models` returns a secret-free model catalog + active selection. */ export const CAP_MODEL_CATALOG = 'model-catalog'; /** `set_model` queues a catalog selection for the next provider call. */ export const CAP_MODEL_SWITCH = 'model-switch'; /** `list_reasoning_levels` returns the active model's reasoning effort catalog (saga p7m8jp.3). */ export const CAP_REASONING_CATALOG = 'reasoning-catalog'; /** `set_reasoning_level` changes the active model's reasoning effort (saga p7m8jp.3). */ export const CAP_REASONING_SWITCH = 'reasoning-switch'; /** `list_modes` returns a secret-free mode catalog + active mode. */ export const CAP_MODE_CATALOG = 'mode-catalog'; /** `set_mode` switches the active mode. */ export const CAP_MODE_SWITCH = 'mode-switch'; /** * The canonical v0.1 capability strings the reference runtime advertises. Transports * project a subset: the daemon's top-level `hello` is transport-scoped * (`streaming-deltas`/`websocket`), while an attached runtime's `sync.capabilities` is the * child runtime's exact set (mode controls are mandatory; model controls are conditional on * a `ModelController`). */ export const KNOWN_CAPABILITIES = [ CAP_STREAMING_DELTAS, CAP_MODEL_CATALOG, CAP_MODEL_SWITCH, CAP_REASONING_CATALOG, CAP_REASONING_SWITCH, CAP_MODE_CATALOG, CAP_MODE_SWITCH, ] as const; /** Whether a capability string is one of the known v0.1 features. Unknown strings are * retained for diagnostics but grant no behavior (§7 — clients must not infer). */ export function isKnownCapability(cap: string): boolean { return (KNOWN_CAPABILITIES as readonly string[]).includes(cap); }