Local Edge AI (QVAC)
Totem is being extended so devices run their own AI inference — models on the edge, not cloud APIs. Two new packages make this safe to wire into the mining, payment, and policy core:
| Package | Role |
|---|---|
@totemsdk/intelligence | Provider-neutral contracts — capabilities, operations, usage receipts, error codes, and the EdgeIntelligencePort |
@totemsdk/qvac | QVAC adapter — wraps @qvac/sdk into those contracts, with runtime capability discovery and per-domain adapters |
Trust model: the AI proposes, Totem authorizes
An IntelligenceProvider is a compute surface, never a signing surface.
- Inference runs locally/self-hosted inside the device's own process.
- The inference layer cannot sign transactions and never holds keys.
- Every inference is keyed by a
proposalId/runIdso policy layers upstream (@totemsdk/agent-policy,@totemsdk/authority) can authorize, meter, and budget it the same way they authorize a payment.
What the contracts provide
- Domains —
llm,embed,rag,asr,translate,tts,diffusion,ocr,classify,audiogen,video,vla,world,models,system,plugins. Each surfaces as anintelligence:<domain>capability string, compatible with@totemsdk/edge'sdomain:actionconvention. - Operations — a stable
domain+op+paramsshape so consumers never depend on a concrete provider's vocabulary. - Usage receipts —
usageoutput per invocation (tokens, duration) is the metering unit that@totemsdk/agent-policyinference-cost flows consume. - Errors —
IntelligenceErrorcarries a stable error code and aretryableflag for retries and budgets.
QVAC adapter
@totemsdk/qvac consumes @qvac/sdk at runtime only — injected, loaded via
sdkLoader, or lazily required. The package has no manifest peer on the
heavy native SDK: its type surface is vendored from the real
@qvac/sdk@0.19.0 declarations, so adapter param/result types are genuine
upstream signatures (e.g. CompletionParams requires modelId + history),
and a CI drift audit (validate:qvac-drift) reinstalls the real SDK and
verifies the wrapped op surface still exists upstream.
import * as qvac from '@qvac/sdk';
import { createQvacIntelligenceProvider } from '@totemsdk/qvac';
const provider = createQvacIntelligenceProvider({ sdk: qvac });
const result = await provider.invoke({
domain: 'llm',
op: 'completion',
params: { modelId: 'qvac-llm', history: [{ role: 'user', content: 'Summarize this invoice' }] },
});
if (result.ok) console.log(result.data, result.usage?.tokensOut);
Capability discovery. provider.capabilities reflects which domains are
actually callable on the resolved SDK — a runtime without the RAG plugin stops
advertising intelligence:rag.
Shapes & cancellation. The provider dispatches each op per the real SDK
invocation shape (record / positional / callback), maps streamable run/session
surfaces (textToSpeech audio samples, transcribeStream segments,
completion token/progress/done, loggingStream deltas) onto
IntelligenceStreamChunks, mirrors real adapter signatures, and forwards
cancellation to sdk.cancel({ requestId }) when the SDK decorates pending
promises with a requestId.
Edge integration
Routes intelligence:invoke / intelligence:cancel actions to the
EdgeIntelligencePort:
import { createQvacEdgeIntelligencePort } from '@totemsdk/qvac/edge';
import { edgeRuntime } from '@totemsdk/edge';
const port = createQvacEdgeIntelligencePort({ sdk: qvac });
edgeRuntime.ports.intelligence = port;
Dispatch is capability-gated: intelligence:invoke fails with
CAPABILITY_MISSING before touching the port if intelligence:<domain> is not
in the runtime's EdgeCapabilitySet.
Learning more
@totemsdk/intelligence— contract reference@totemsdk/qvac— adapter reference- Agent Policy Overview — how proposals like
inferenceintents get evaluated and signed