Skip to main content
Version: 0.4.1

Primitives

Attribution

export interface Attribution {
source_type: "message" | "tool" | "boilerplate" | "output";
source_id: number | null;
word_id: number;
word_string: string;
score: number;
}

A word-level relevance value reconstructed by the SDK.

Source: js/src/public.ts:28

ChatMessage

export interface ChatMessage {
role: ChatMessageRole;
content: string;
}

A chat message rendered by the SDK's profile-specific tokenizer template.

Source: js/src/public.ts:12

ChatMessageRole

export type ChatMessageRole =
| "assistant"
| "system"
| "tool-description"
| "tool"
| "user";

Roles supported by the release-pinned chat templates.

Source: js/src/public.ts:4

ChatTool

export interface ChatTool {
type: "function";
function: {
name: string;
description?: string;
parameters: Record<string, unknown>;
};
}

An OpenAI-compatible function tool definition accepted by the chat template.

Source: js/src/public.ts:18

ClaimEvidence

export interface ClaimEvidence {
id: string;
text: string;
outputSpan: TextSpan;
importantTerms: string[];
sources: EvidenceSource[];
attributionCoverage: number;
groundingScore: number;
contextOverlap: number;
instructionGrounding: number;
semanticVerification: SemanticVerification | null;
verdict: EvidenceVerdict;
method: "attribution" | "attribution_and_verifier";
sourceMappingQuality: "exact" | "aligned" | "approximate";
}

Evidence and source grounding for one stable assistant claim.

Source: js/src/public.ts:107

ClaimVerificationInput

export interface ClaimVerificationInput {
claim: string;
sources: readonly EvidenceSource[];
messages: readonly ChatMessage[];
}

Input passed to a host-provided semantic claim verifier.

Source: js/src/public.ts:95

ClaimVerifier

export type ClaimVerifier = (
input: ClaimVerificationInput,
) => SemanticVerification | Promise<SemanticVerification>;

A host extension that can turn attribution grounding into semantic support.

Source: js/src/public.ts:102

CompletionRequest

export interface CompletionRequest {
messages: readonly ChatMessage[];
tools?: readonly ChatTool[] | null;
maxTokens?: number;
topKAttributions?: number;
forcedIds?: readonly number[];
signal?: AbortSignal;
}

Options for one greedy attributed completion stream.

Source: js/src/public.ts:49

CompletionStreamChunk

export interface CompletionStreamChunk {
type: "text" | "tool_start" | "tool_delta" | "tool_end";
content?: string;
name?: string;
grad?: number;
toks?: number;
is_syntax?: boolean;
input_attributions: Attribution[];
output_attributions: Attribution[];
}

A ready-to-consume completion fragment with word-level attributions.

Source: js/src/public.ts:37

EngineCompatibilityError

class EngineCompatibilityError {
constructor(message: string);
}

Raised when an Engine cannot safely serve this SDK.

Source: js/src/internal/contract.ts:57

EvidenceOptions

export interface EvidenceOptions {
maxClaimChars?: number;
minAttributionScore?: number;
verifier?: ClaimVerifier;
toolPolicies?: Readonly<Record<string, ToolPolicy>>;
}

Options controlling claim boundaries, verification, and local tool policy.

Source: js/src/public.ts:172

EvidenceSource

export interface EvidenceSource {
sourceType: Attribution["source_type"];
sourceId: number | null;
role?: ChatMessageRole;
text: string;
attributedWords: string[];
attributionScore: number;
quality: number;
}

A context source selected from word attribution for an evidence object.

Source: js/src/public.ts:77

EvidenceStreamEvent

export type EvidenceStreamEvent =
| {
/**
* Emitted once, as soon as the kind of the FIRST output is observed.
* A response may still continue with the other kind afterwards; the
* final `ResponseEvidence.outputKind` then reports `"mixed"`.
*/
type: "output_kind";
kind: Exclude<OutputKind, "mixed">;
/** True because the kind was directly observed, not heuristically guessed. */
definitive: true;
}
| { type: "completion_chunk"; chunk: CompletionStreamChunk }
| { type: "claim_evidence"; evidence: ClaimEvidence }
| { type: "tool_call_evidence"; evidence: ToolCallEvidence }
| { type: "response_evidence"; evidence: ResponseEvidence };

One event from the semantic completion stream with evidence.

Source: js/src/public.ts:189

EvidenceVerdict

export type EvidenceVerdict =
| "supported"
| "contradicted"
| "grounded"
| "partially_grounded"
| "ungrounded"
| "unknown";

How strongly the available context grounds or verifies one claim.

Source: js/src/public.ts:68

InveraClient

class InveraClient {
readonly chat: {
completions: {
/** Stream text and tool-call chunks with SDK-aggregated word attributions. */
stream: (
request: CompletionRequest,
) => AsyncIterable<CompletionStreamChunk>;
/** Stream completion chunks plus claim and pre-execution tool evidence. */
streamWithEvidence: (
request: CompletionRequest,
options?: EvidenceOptions,
) => AsyncIterable<EvidenceStreamEvent>;
};
};
readonly models: {
/** Return stable information about the selected compatible Engine model. */
current: (signal?: AbortSignal) => Promise<ModelInfo>;
};
constructor(options: InveraClientOptions);
}

A lazy high-level client for ready-to-consume attributed completion streams.

Source: js/src/client.ts:38

InveraClientOptions

export interface InveraClientOptions {
/** Engine root URL, with or without its stable `/v1` suffix. */
baseUrl: string;
/** Optional release profile; otherwise the first compatible model is selected. */
model?: "qwen3-4b";
/** Replace fetch for custom server runtimes, authentication, or tests. */
fetch?: typeof globalThis.fetch;
/** Allow a prerelease Engine Contract during local development only. */
allowPrereleaseContract?: boolean;
/** Host warning sink for structured Engine deprecation notices. */
warn?: (message: string) => void;
}

Construction options for the high-level attributed-completion client.

Source: js/src/public.ts:215

InveraHttpError

class InveraHttpError {
readonly status: number;
constructor(status: number, message: string);
}

Raised when an Engine request fails before a valid stream can be consumed.

Source: js/src/internal/engine-transport.ts:9

ModelInfo

export interface ModelInfo {
id: string;
profile: string;
engineBuild: string;
contextWindow: number;
}

Stable model details intended for application display and diagnostics.

Source: js/src/public.ts:207

OutputKind

export type OutputKind = "text" | "tool_call" | "mixed";

The semantic kind observed in an assistant response.

Source: js/src/public.ts:65

ParameterEvidence

export interface ParameterEvidence {
path: string;
value: unknown;
sources: EvidenceSource[];
groundingScore: number;
}

Evidence connecting one generated tool argument to conversation context.

Source: js/src/public.ts:132

ResponseEvidence

export interface ResponseEvidence {
outputKind: OutputKind;
claims: ClaimEvidence[];
toolCalls: ToolCallEvidence[];
overallGrounding: number;
requiresReview: boolean;
}

Final evidence report emitted after every claim and tool call is assessed.

Source: js/src/public.ts:180

SchemaIssue

export interface SchemaIssue {
path: string;
code:
| "invalid_json"
| "unknown_tool"
| "missing_required"
| "invalid_type"
| "invalid_enum"
| "additional_property";
message: string;
}

A machine-readable JSON-schema problem found in a generated tool call.

Source: js/src/public.ts:140

SemanticVerification

export interface SemanticVerification {
relation: "entails" | "contradicts" | "related" | "unknown";
score: number;
explanation?: string;
}

Optional semantic judgement supplied by a host verifier.

Source: js/src/public.ts:88

TextSpan

export interface TextSpan {
start: number;
end: number;
}

Character offsets into the visible assistant text.

Source: js/src/public.ts:59

ToolCallEvidence

export interface ToolCallEvidence {
callId: string;
name: string | null;
arguments: unknown;
rawCall: string;
parseValid: boolean;
parseError: string | null;
schemaValid: boolean;
schemaIssues: SchemaIssue[];
completeness: number;
parameters: ParameterEvidence[];
intentGrounding: number;
riskLevel: "low" | "medium" | "high" | "critical";
riskReasons: string[];
requiresApproval: boolean;
decision: "allow" | "review" | "block";
}

A completed tool call assessed before an agent harness executes it.

Source: js/src/public.ts:153

ToolPolicy

export interface ToolPolicy {
riskLevel?: "low" | "medium" | "high" | "critical";
requiresApproval?: boolean;
sideEffect?: "none" | "reversible" | "irreversible";
sensitiveParameters?: readonly string[];
}

Local action-risk metadata that is never rendered into the model prompt.

Source: js/src/public.ts:124