Extension-facing helpers for router limits and parse diagnostics.
Preserved-thinking handoff is provider-agnostic via the
:assistant-message field on ask! / ask-code! results. The
value is a canonical svar message — {:role "assistant" :content [<canonical-blocks>]} — which callers append to :messages on
the next call. Canonical {:type "thinking"} content blocks
carry the per-provider preserved-reasoning state under
:thinking-signature; svar's wire serializers transform them into
native shapes (Anthropic signed thinking blocks, z.ai
reasoning_content field, OpenAI Responses reasoning input items).
Plain chat models without preserved thinking just don't surface
:assistant-message, so the same caller pipeline
(keep :assistant-message results) works uniformly across every
provider with zero per-provider branching.
Extension-facing helpers for router limits and parse diagnostics.
Preserved-thinking handoff is provider-agnostic via the
`:assistant-message` field on `ask!` / `ask-code!` results. The
value is a canonical svar message — `{:role "assistant" :content
[<canonical-blocks>]}` — which callers append to `:messages` on
the next call. Canonical `{:type "thinking"}` content blocks
carry the per-provider preserved-reasoning state under
`:thinking-signature`; svar's wire serializers transform them into
native shapes (Anthropic signed thinking blocks, z.ai
`reasoning_content` field, OpenAI Responses reasoning input items).
Plain chat models without preserved thinking just don't surface
`:assistant-message`, so the same caller pipeline
`(keep :assistant-message results)` works uniformly across every
provider with zero per-provider branching.(parse-diagnose text)(parse-diagnose text spec-def)Diagnoses how svar would parse text, optionally against spec-def.
With no spec, returns SAP parser value + warnings. With a spec, runs the
full spec-aware path (str->data-with-spec) and validation. Exceptions are
captured into :error; this function is meant for extension/TUI diagnosis,
so it returns data instead of throwing on parse/schema failures.
Diagnoses how svar would parse `text`, optionally against `spec-def`. With no spec, returns SAP parser value + warnings. With a spec, runs the full spec-aware path (`str->data-with-spec`) and validation. Exceptions are captured into `:error`; this function is meant for extension/TUI diagnosis, so it returns data instead of throwing on parse/schema failures.
(provider-limits router)Returns extension-friendly provider limit state for a svar router.
Shape: {:window-ms N :providers {provider-id {:rpm {:limit N :used N :remaining N :reset-ms N} :tpm {:limit N :used N :remaining N :reset-ms N} :circuit-breaker :closed|:open|:half-open :models [...]}} :budget {:limit ... :spent ... :remaining ...}}
This is read-only. It does not claim a request slot or mutate router state.
Returns extension-friendly provider limit state for a svar router.
Shape:
{:window-ms N
:providers {provider-id {:rpm {:limit N :used N :remaining N :reset-ms N}
:tpm {:limit N :used N :remaining N :reset-ms N}
:circuit-breaker :closed|:open|:half-open
:models [...]}}
:budget {:limit ... :spent ... :remaining ...}}
This is read-only. It does not claim a request slot or mutate router state.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |