Rulvar API reference / @rulvar/rulvar / ProviderAdapter
Interface: ProviderAdapter
Defined in: packages/core/dist/index.d.ts
Properties
Methods
caps()
caps(model): ModelCaps;Defined in: packages/core/dist/index.d.ts
Parameters
| Parameter | Type |
|---|---|
model | string |
Returns
countTokens()?
optional countTokens(req, opts?): Promise<number>;Defined in: packages/core/dist/index.d.ts
Provider-side token count for the request, used to tighten the admission reserve before a spawn dispatches. The request carries the FULL prompt, so an implementation that goes over the network is egress exactly like stream and MUST honor opts.signal (RV904): the engine only calls this after a zero-egress admission feasibility check, passes the spawn's abort signal, and treats an abort as cancellation rather than falling back to the flat reserve. Hosts that must not send prompts before their own admission gates pass an explicit estCost instead, which skips this call entirely.
Parameters
| Parameter | Type |
|---|---|
req | ChatRequest |
opts? | { signal?: AbortSignal; } |
opts.signal? | AbortSignal |
Returns
Promise<number>
describeRegulatedPosture()?
optional describeRegulatedPosture(): RegulatedPostureDescriptor;Defined in: packages/core/dist/index.d.ts
The construction-side posture attestation (RV4101): a PURE snapshot of the risk postures this adapter chose at construction (no wire, no side effects), read by compileRegulatedProfile to refuse a loosened posture and hash a tightened one. Optional: an adapter without it counts into the profile's unrecognized tally instead of being implied verified.
Returns
refreshCaps()?
optional refreshCaps(): Promise<void>;Defined in: packages/core/dist/index.d.ts
Refresh the capability table from live model lists.
Returns
Promise<void>
stream()
stream(
req,
signal?,
hooks?): AsyncIterable<ChatEvent>;Defined in: packages/core/dist/index.d.ts
Parameters
| Parameter | Type |
|---|---|
req | ChatRequest |
signal? | AbortSignal |
hooks? | StreamHooks |
Returns
AsyncIterable<ChatEvent>