entity-viz-kit/core
Generated from actual exported declarations. These signatures and comments are not a second specification. See the integration guide and documented verification limits.
Action
Section titled “Action”See the declaration and integration guide.
export type Action = { readonly type: 'query.add'; readonly entityId: EntityId;} | { readonly type: 'query.remove'; readonly entityId: EntityId;} | { readonly type: 'query.text'; readonly text: string;} | { readonly type: 'query.clear';} | { readonly type: 'context.set'; readonly context: HostContext | null;} | { readonly type: 'inspect'; readonly inspection: Inspection;} | { readonly type: 'presentation.order'; readonly entityIds: readonly EntityId[];} | { readonly type: 'presentation.set'; readonly presentation: Presentation;};aggregateRelations
Section titled “aggregateRelations”Deterministically aggregate assertions without erasing evidence stances or direction. Equal assertion IDs must have equal meaning; a conflict fails the whole operation. Self-assertions are returned separately rather than becoming graph edges. REQ: core-r-0011 REQ: core-r-0012
export declare function aggregateRelations(input: readonly Assertion[]): { readonly pairs: readonly PairRelation[]; readonly selfAssertions: readonly Assertion[];};AnchorResolution
Section titled “AnchorResolution”See the declaration and integration guide.
export interface AnchorResolution { readonly schemaVersion: 1; readonly status: 'exact' | 're-anchored' | 'ambiguous' | 'unavailable'; readonly original: TextAnchor; readonly currentVersion: string; readonly range: Utf16Range | null; readonly candidates: readonly Utf16Range[]; readonly truncated: boolean; readonly reason: 'validated-offsets' | 'unique-context-match' | 'multiple-matches' | 'no-match' | 'wrong-document';}AnnotationStateReport
Section titled “AnnotationStateReport”See the declaration and integration guide.
export interface AnnotationStateReport { readonly status: 'current' | 'pending' | 'failed'; readonly renderer: 'native' | 'overlay'; readonly mentions: readonly MentionSummary[]; /** True when the page had more mentions than a bounded report may carry. */ readonly truncated?: boolean;}Assertion
Section titled “Assertion”See the declaration and integration guide.
export interface Assertion { readonly id: AssertionId; readonly from: EntityId; readonly to: EntityId; readonly predicate: string; readonly evidence: readonly EvidenceLink[]; readonly validFrom?: string; readonly validTo?: string; readonly status?: string;}assertionId
Section titled “assertionId”See the declaration and integration guide.
assertionId: (v: unknown) => AssertionIdAssertionId
Section titled “AssertionId”See the declaration and integration guide.
export type AssertionId = Id<'assertion'>;assertText
Section titled “assertText”See the declaration and integration guide.
export declare function assertText(value: string): void;AsyncPhase
Section titled “AsyncPhase”See the declaration and integration guide.
export type AsyncPhase = 'initial' | 'loading' | 'refreshing' | 'ready' | 'empty' | 'partial' | 'failed' | 'unavailable' | 'disposed';AsyncState
Section titled “AsyncState”See the declaration and integration guide.
export interface AsyncState<T> { readonly phase: AsyncPhase; readonly revision: number; readonly requestId: RequestId | null; readonly key: string | null; readonly dataRevision: number | null; readonly data: T | null; readonly error: ClientError | null;}AudienceProjectionInput
Section titled “AudienceProjectionInput”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
See the declaration and integration guide.
export interface AudienceProjectionInput { readonly sessionId: SessionId; readonly sequence: number; /** Operator state. Only query, context and presentation are read; inspection is private. */ readonly state: InteractionState; readonly registry: EntityRegistry; /** What the operator chose to present. Independent of the operator's own inspection. */ readonly focus: Inspection; /** Host-approved records. Nothing else from the operator's controller or caches is included. */ readonly documents?: readonly ResultDocument[]; readonly evidence?: readonly Evidence[]; readonly relations?: readonly PairRelation[]; readonly includeQueryText?: boolean;}audienceRequest
Section titled “audienceRequest”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
See the declaration and integration guide.
export declare function audienceRequest(pairing: string): AudienceRequest;AudienceRequest
Section titled “AudienceRequest”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
The audience only ever asks for the current published snapshot; it never sends state back.
export interface AudienceRequest { readonly protocol: typeof PRESENTATION_PROTOCOL; readonly version: 1; readonly direction: 'audience'; readonly pairing: string; readonly kind: 'request-current';}AudienceSnapshot
Section titled “AudienceSnapshot”Host-approved presentation data only, not an operator-store dump.
export interface AudienceSnapshot { readonly schemaVersion: 1; readonly sessionId: SessionId; readonly sequence: number; readonly context: HostContext | null; readonly query: Query; readonly presentation: Presentation; readonly focus: Inspection; readonly entities: readonly Entity[]; readonly documents: readonly ResultDocument[]; readonly evidence: readonly Evidence[]; readonly relations: readonly PairRelation[];}ClientError
Section titled “ClientError”See the declaration and integration guide.
export interface ClientError { readonly code: 'invalid-response' | 'adapter-failed'; readonly message: string;}codePointOffsets
Section titled “codePointOffsets”Includes the end boundary; combining marks remain distinct code points.
export declare function codePointOffsets(text: string): readonly number[];contextId
Section titled “contextId”See the declaration and integration guide.
contextId: (v: unknown) => ContextIdContextId
Section titled “ContextId”See the declaration and integration guide.
export type ContextId = Id<'context'>;contextSignature
Section titled “contextSignature”Context labels are presentation metadata; hosts must advance revision when hidden context changes.
export declare function contextSignature(context: HostContext | null): string;ControllerOptions
Section titled “ControllerOptions”See the declaration and integration guide.
export interface ControllerOptions { readonly state?: InteractionState; readonly registry?: EntityRegistry; readonly debounceMs?: number;}ControllerSnapshot
Section titled “ControllerSnapshot”See the declaration and integration guide.
export interface ControllerSnapshot { readonly state: InteractionState; readonly revision: number; readonly search: AsyncState<SearchResponse>; readonly resources: { readonly profile: AsyncState<ResourceResponse<Entity>>; readonly relation: AsyncState<ResourceResponse<PairRelation>>; readonly evidence: AsyncState<ResourceResponse<Evidence>>; readonly source: AsyncState<ResourceResponse<SourceDocument>>; };}createController
Section titled “createController”See the declaration and integration guide.
export declare function createController(adapter: SearchAdapter, options?: ControllerOptions): EntityController;createOffsetConverter
Section titled “createOffsetConverter”Reuse for many annotations on one immutable string. The code-point map is allocated only if used.
export declare function createOffsetConverter(text: string): OffsetConverter;createPresentationSender
Section titled “createPresentationSender”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
See the declaration and integration guide.
export declare function createPresentationSender(options: { readonly pairing: string; readonly sessionId: SessionId | string; readonly startedAt: number;}): PresentationSender;createSnapshotReceiver
Section titled “createSnapshotReceiver”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
Audience side. Adopts a newer operator session (later startedAt), never an older one, and within
export declare function createSnapshotReceiver(options: { readonly pairing: string;}): { receive(message: unknown): ReceiveResult; readonly state: ReceiverState;};createState
Section titled “createState”Create an isolated initial state with no global persistence. REQ: core-r-0006 REQ: core-r-0009
export declare function createState(input?: { query?: Query; context?: HostContext | null;}): InteractionState;DEFAULT_TYPES
Section titled “DEFAULT_TYPES”See the declaration and integration guide.
DEFAULT_TYPES: readonly EntityType[]Detail
Section titled “Detail”See the declaration and integration guide.
export interface Detail { readonly label: string; readonly value: string | number | boolean | null;}documentId
Section titled “documentId”See the declaration and integration guide.
documentId: (v: unknown) => DocumentIdDocumentId
Section titled “DocumentId”See the declaration and integration guide.
export type DocumentId = Id<'document'>;Entity
Section titled “Entity”See the declaration and integration guide.
export interface Entity { readonly id: EntityId; readonly type: string; readonly label: string; readonly subtitle?: string; readonly aliases?: readonly string[]; readonly imageUrl?: string; readonly details?: readonly Detail[];}ENTITY_GLYPH_PATHS
Section titled “ENTITY_GLYPH_PATHS”Original project-owned vector data shared by DOM and graph renderers. No font/network asset. REQ: core-r-0004 REQ: graph-r-0051 REQ: system-r-0085
ENTITY_GLYPH_PATHS: Readonly<Record<string, string>>EntityController
Section titled “EntityController”Optional small external-store controller. Hosts can instead use reduceState with their own store. Nothing starts until start()/refresh() is called. No storage, URL mutation or network endpoint is built in. REQ: core-r-0006 REQ: core-r-0008 REQ: core-r-0009 REQ: core-r-0013 REQ: core-r-0020 REQ: components-r-0021 REQ: components-r-0022 REQ: components-r-0023
/** Optional small external-store controller. Hosts can instead use reduceState with their own store. * Nothing starts until start()/refresh() is called. No storage, URL mutation or network endpoint is built in. * REQ: core-r-0006 * REQ: core-r-0008 * REQ: core-r-0009 * REQ: core-r-0013 * REQ: core-r-0020 * REQ: components-r-0021 * REQ: components-r-0022 * REQ: components-r-0023 */export declare class EntityController { readonly registry: EntityRegistry; constructor(adapter: SearchAdapter, options?: ControllerOptions); getSnapshot: () => ControllerSnapshot; subscribe: (listener: Listener) => (() => void); dispatch(action: Action): void; setState(value: InteractionState): void; start(): Promise<void>; refresh(): Promise<void>; /** Called by real input composition handlers. State changes immediately; retrieval waits. */ setComposing(value: boolean): void; flush(): Promise<void>; loadProfile(key: EntityId): Promise<void>; loadRelation(key: PairId): Promise<void>; loadEvidence(key: EvidenceId): Promise<void>; loadSource(key: DocumentId): Promise<void>; /** Release active requests, timers, owned metadata and subscriber references. Idempotent. */ dispose(): void;}entityId
Section titled “entityId”See the declaration and integration guide.
entityId: (v: unknown) => EntityIdEntityId
Section titled “EntityId”See the declaration and integration guide.
export type EntityId = Id<'entity'>;EntityRegistry
Section titled “EntityRegistry”Explicitly scoped registry. Upserts are atomic and immutable; aliases are presentation only. REQ: core-r-0001 REQ: core-r-0002 REQ: core-r-0004 REQ: core-r-0005 REQ: core-r-0009
/** Explicitly scoped registry. Upserts are atomic and immutable; aliases are presentation only. * REQ: core-r-0001 * REQ: core-r-0002 * REQ: core-r-0004 * REQ: core-r-0005 * REQ: core-r-0009 */export declare class EntityRegistry { readonly capacity: number; constructor(initial?: readonly Entity[], capacity?: number); get size(): number; getRevision: () => number; subscribe: (listener: Listener) => (() => void); get(id: EntityId): Entity | undefined; resolve(id: EntityId): Entity; all(): readonly Entity[]; getType(type: string): EntityType; registerType(type: EntityType): void; upsertMany(values: readonly Entity[]): void; remove(id: EntityId): void; clear(): void;}EntityType
Section titled “EntityType”See the declaration and integration guide.
export interface EntityType { readonly id: string; readonly label: string; readonly glyph: string;}Evidence
Section titled “Evidence”See the declaration and integration guide.
export interface Evidence { readonly id: EvidenceId; readonly anchor: TextAnchor; readonly sourceLabel: string; readonly passage: Snippet; readonly relationshipRange?: TextRange; readonly url?: string;}evidenceId
Section titled “evidenceId”See the declaration and integration guide.
evidenceId: (v: unknown) => EvidenceIdEvidenceId
Section titled “EvidenceId”See the declaration and integration guide.
export type EvidenceId = Id<'evidence'>;EvidenceLink
Section titled “EvidenceLink”See the declaration and integration guide.
export interface EvidenceLink { readonly evidenceId: EvidenceId; readonly stance: 'supports' | 'contradicts' | 'uncertain';}ExtensionAction
Section titled “ExtensionAction”Page ↔ extension panel actions. Data only: no executable strings, URLs to fetch, DOM objects or method names. Sender tab/frame/document identity is never part of the payload; the privileged side takes it from the browser API. REQ: integration-r-0082
export type ExtensionAction = { readonly type: 'entity.activate'; readonly entityId: EntityId; readonly mentionId?: MentionId; readonly intent: 'query' | 'inspect';} | { readonly type: 'mentions.choose'; readonly intent: 'query' | 'inspect'; readonly candidates: readonly MentionSummary[];} | { readonly type: 'panel.focus';} | { readonly type: 'capabilities'; readonly capabilities: SurfaceCapabilities;} | { readonly type: 'annotations.state'; readonly state: AnnotationStateReport;} | { readonly type: 'query.state'; readonly entityIds: readonly EntityId[];} | { readonly type: 'mention.select'; readonly mentionId: MentionId | null;} | { readonly type: 'mention.locate'; readonly mentionId: MentionId;};ExtensionEnvelope
Section titled “ExtensionEnvelope”Versioned page/panel envelope. documentRevision (live index revision) and correlationId
were added in 0.6 as optional fields under protocol version 1.
export interface ExtensionEnvelope { readonly protocolVersion: 1; readonly sessionId: SessionId; readonly sequence: number; readonly context: HostContext; readonly documentRevision?: number; readonly correlationId?: RequestId; readonly action: ExtensionAction;}graphId
Section titled “graphId”See the declaration and integration guide.
graphId: (v: unknown) => GraphIdGraphId
Section titled “GraphId”See the declaration and integration guide.
export type GraphId = Id<'graph'>;GraphSnapshot
Section titled “GraphSnapshot”See the declaration and integration guide.
export interface GraphSnapshot { readonly id: GraphId; readonly revision: string; readonly entityIds: readonly EntityId[]; readonly pairs: readonly PairRelation[];}GraphView
Section titled “GraphView”See the declaration and integration guide.
export interface GraphView { readonly graphId: GraphId; readonly contextKey: string; readonly positions: readonly Position[]; readonly pins: readonly Position[]; readonly camera: { readonly x: number; readonly y: number; readonly ratio: number; };}HostContext
Section titled “HostContext”See the declaration and integration guide.
export interface HostContext { readonly id: ContextId; readonly revision: string; readonly label: string; readonly document?: { readonly id: DocumentId; readonly version: string; }; readonly entityIds?: readonly EntityId[];}See the declaration and integration guide.
export type Id<K extends string> = string & { readonly [identity]: K;};immutableData
Section titled “immutableData”Detach and freeze bounded plain data. Reject accessors before invoking them, cycles, sparse arrays, class instances and executable values. This is not an authorization layer. REQ: core-r-0003 REQ: core-r-0010 REQ: system-r-0088
export declare function immutableData<T>(value: T): T;Inspection
Section titled “Inspection”See the declaration and integration guide.
export type Inspection = { readonly kind: 'none';} | { readonly kind: 'entity'; readonly entityId: EntityId;} | { readonly kind: 'relation'; readonly pairId: PairId;} | { readonly kind: 'evidence'; readonly evidenceId: EvidenceId;} | { readonly kind: 'source'; readonly documentId: DocumentId;};InteractionState
Section titled “InteractionState”See the declaration and integration guide.
export interface InteractionState { readonly schemaVersion: 1; readonly query: Query; readonly context: HostContext | null; readonly inspection: Inspection; readonly presentation: Presentation;}IntervalKind
Section titled “IntervalKind”See the declaration and integration guide.
export type IntervalKind = 'mention' | 'query' | 'evidence' | 'link';isCodePointBoundary
Section titled “isCodePointBoundary”See the declaration and integration guide.
export declare function isCodePointBoundary(text: string, offset: number): boolean;LoadRequest
Section titled “LoadRequest”See the declaration and integration guide.
export interface LoadRequest<K extends string> extends RequestMeta { readonly key: K; readonly context: HostContext | null;}MAX_PRESENTATION_MESSAGE
Section titled “MAX_PRESENTATION_MESSAGE”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
Serialized size limit for one presentation message (UTF-16 units of its JSON form).
MAX_PRESENTATION_MESSAGE = 2000000Mention
Section titled “Mention”See the declaration and integration guide.
export interface Mention { readonly id: MentionId; readonly entityIds: readonly EntityId[]; readonly range: TextRange;}mentionId
Section titled “mentionId”See the declaration and integration guide.
mentionId: (v: unknown) => MentionIdMentionId
Section titled “MentionId”See the declaration and integration guide.
export type MentionId = Id<'mention'>;MentionSummary
Section titled “MentionSummary”One annotated mention as reported by a page to its extension panel: bounded display data only.
export interface MentionSummary { readonly mentionId: MentionId; readonly entityIds: readonly EntityId[]; readonly label: string; readonly context: string; readonly kind: 'entity' | 'evidence'; readonly status: 'exact' | 're-anchored' | 'ambiguous' | 'unavailable'; readonly painted: boolean; readonly insideInteractive: boolean;}newSessionId
Section titled “newSessionId”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
Random session identifier for a new operator window (Web Crypto; no storage).
export declare function newSessionId(): SessionId;OffsetConverter
Section titled “OffsetConverter”See the declaration and integration guide.
export type OffsetConverter = (range: TextRange) => Utf16Range;OffsetUnit
Section titled “OffsetUnit”See the declaration and integration guide.
export type OffsetUnit = 'utf16' | 'codepoint';OperatorBody
Section titled “OperatorBody”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
See the declaration and integration guide.
export type OperatorBody = { readonly kind: 'snapshot'; readonly snapshot: AudienceSnapshot; readonly held: boolean;} | { readonly kind: 'hold'; readonly held: boolean;} | { readonly kind: 'end';};OperatorMessage
Section titled “OperatorMessage”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
See the declaration and integration guide.
export interface OperatorMessage { readonly protocol: typeof PRESENTATION_PROTOCOL; readonly version: 1; readonly direction: 'operator'; readonly pairing: string; readonly sessionId: SessionId; readonly startedAt: number; readonly sequence: number; readonly body: OperatorBody;}pairEndpoints
Section titled “pairEndpoints”See the declaration and integration guide.
export declare function pairEndpoints(value: unknown): readonly [EntityId, EntityId];pairId
Section titled “pairId”Collision-safe identity for an unordered pair. Self-relations are not graph edges. REQ: core-r-0011
export declare function pairId(a: EntityId, b: EntityId): PairId;PairId
Section titled “PairId”See the declaration and integration guide.
export type PairId = Id<'pair'>;PairRelation
Section titled “PairRelation”See the declaration and integration guide.
export interface PairRelation { readonly id: PairId; readonly a: EntityId; readonly b: EntityId; readonly assertions: readonly Assertion[];}parseAction
Section titled “parseAction”See the declaration and integration guide.
parseAction: (v: unknown) => ActionparseAssertion
Section titled “parseAssertion”See the declaration and integration guide.
parseAssertion: (v: unknown) => AssertionparseAudienceSnapshot
Section titled “parseAudienceSnapshot”See the declaration and integration guide.
parseAudienceSnapshot: (v: unknown) => AudienceSnapshotparseEntity
Section titled “parseEntity”See the declaration and integration guide.
parseEntity: (v: unknown) => EntityparseEntityType
Section titled “parseEntityType”See the declaration and integration guide.
parseEntityType: (v: unknown) => EntityTypeparseEvidence
Section titled “parseEvidence”See the declaration and integration guide.
parseEvidence: (v: unknown) => EvidenceparseExtensionEnvelope
Section titled “parseExtensionEnvelope”See the declaration and integration guide.
parseExtensionEnvelope: (v: unknown) => ExtensionEnvelopeparseGraphSnapshot
Section titled “parseGraphSnapshot”See the declaration and integration guide.
parseGraphSnapshot: (v: unknown) => GraphSnapshotparseHostContext
Section titled “parseHostContext”See the declaration and integration guide.
parseHostContext: (v: unknown) => HostContext | nullparseId
Section titled “parseId”See the declaration and integration guide.
export declare function parseId<K extends string>(kind: K, value: unknown): Id<K>;parseInteractionState
Section titled “parseInteractionState”See the declaration and integration guide.
parseInteractionState: (v: unknown) => InteractionStateparsePairId
Section titled “parsePairId”See the declaration and integration guide.
export declare function parsePairId(value: unknown): PairId;parsePairing
Section titled “parsePairing”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
See the declaration and integration guide.
export declare function parsePairing(value: unknown): string;parsePairRelation
Section titled “parsePairRelation”See the declaration and integration guide.
parsePairRelation: (v: unknown) => PairRelationparsePresentationMessage
Section titled “parsePresentationMessage”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
Strict, size-bounded, deep-frozen copy of an inbound presentation message.
export declare function parsePresentationMessage(value: unknown): PresentationMessage;parseResourceResponse
Section titled “parseResourceResponse”See the declaration and integration guide.
export declare function parseResourceResponse<T>(v: unknown, parse: (value: unknown) => T): ResourceResponse<T>;parseResultDocument
Section titled “parseResultDocument”See the declaration and integration guide.
parseResultDocument: (v: unknown) => ResultDocumentparseSearchResponse
Section titled “parseSearchResponse”See the declaration and integration guide.
parseSearchResponse: (v: unknown) => SearchResponseparseSnippet
Section titled “parseSnippet”See the declaration and integration guide.
parseSnippet: (v: unknown) => SnippetparseSourceDocument
Section titled “parseSourceDocument”See the declaration and integration guide.
parseSourceDocument: (v: unknown) => SourceDocumentparseTextAnchor
Section titled “parseTextAnchor”See the declaration and integration guide.
parseTextAnchor: (v: unknown) => TextAnchorPassageSegment
Section titled “PassageSegment”See the declaration and integration guide.
export interface PassageSegment extends TextSegment { readonly mentionIds: readonly MentionId[]; readonly entityIds: readonly EntityId[]; readonly queryMatch: boolean; readonly evidenceMatch: boolean; readonly url: string | null;}Position
Section titled “Position”See the declaration and integration guide.
export interface Position { readonly entityId: EntityId; readonly x: number; readonly y: number;}Presentation
Section titled “Presentation”See the declaration and integration guide.
export interface Presentation { readonly tagOrder: readonly EntityId[]; readonly density: 'comfortable' | 'compact'; readonly scale: number; readonly mode: 'standard' | 'compact' | 'presentation'; readonly graph: GraphView | null;}PRESENTATION_PROTOCOL
Section titled “PRESENTATION_PROTOCOL”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
See the declaration and integration guide.
PRESENTATION_PROTOCOL = "evk-presentation"PresentationMessage
Section titled “PresentationMessage”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
See the declaration and integration guide.
export type PresentationMessage = OperatorMessage | AudienceRequest;PresentationSender
Section titled “PresentationSender”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
Operator side: one session, strictly increasing sequence for every message it emits.
export interface PresentationSender { readonly sessionId: SessionId; readonly startedAt: number; snapshot(build: (session: { readonly sessionId: SessionId; readonly sequence: number; }) => AudienceSnapshot, held: boolean): OperatorMessage; /** Re-send an already published snapshot of this session (answering an audience's request). */ repeat(snapshot: AudienceSnapshot, held: boolean): OperatorMessage; hold(held: boolean): OperatorMessage; end(): OperatorMessage;}PresentationTransport
Section titled “PresentationTransport”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
Minimal host transport (BroadcastChannel, a websocket, a message port…). Messages are plain data.
export interface PresentationTransport { send(message: PresentationMessage): void; subscribe(listener: (message: unknown) => void): () => void; close(): void;}projectAudienceSnapshot
Section titled “projectAudienceSnapshot”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
Build an immutable audience snapshot from explicitly approved data. Entities are limited to the
export declare function projectAudienceSnapshot(input: AudienceProjectionInput): AudienceSnapshot;See the declaration and integration guide.
export interface Query { readonly text: string; readonly entityIds: readonly EntityId[];}querySignature
Section titled “querySignature”Sort a copy of membership. Do not change the user’s visible tag order or text. REQ: core-r-0008 REQ: core-r-0013
export declare function querySignature(state: Pick<InteractionState, 'query' | 'context'>): string;ReceiveResult
Section titled “ReceiveResult”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
See the declaration and integration guide.
export type ReceiveResult = { readonly accepted: true; readonly state: ReceiverState;} | { readonly accepted: false; readonly reason: 'invalid' | 'other-pairing' | 'not-operator' | 'stale-session' | 'stale-sequence'; readonly state: ReceiverState;};ReceiverState
Section titled “ReceiverState”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
See the declaration and integration guide.
export interface ReceiverState { readonly status: ReceiverStatus; readonly snapshot: AudienceSnapshot | null; readonly sessionId: SessionId | null; readonly startedAt: number; readonly sequence: number; readonly rejected: number;}ReceiverStatus
Section titled “ReceiverStatus”Experimental. Outside the 1.0 stability promise; it may change in any minor release (system-r-0117).
See the declaration and integration guide.
export type ReceiverStatus = 'waiting' | 'live' | 'held' | 'ended';Recommendation
Section titled “Recommendation”See the declaration and integration guide.
export interface Recommendation { readonly entityId: EntityId; readonly reason?: string;}reduceState
Section titled “reduceState”Pure controlled-state interface. No backend call can occur here. REQ: core-r-0001 REQ: core-r-0006 REQ: core-r-0007 REQ: core-r-0008
export declare function reduceState(state: InteractionState, input: Action): InteractionState;requestId
Section titled “requestId”See the declaration and integration guide.
requestId: (v: unknown) => RequestIdRequestId
Section titled “RequestId”See the declaration and integration guide.
export type RequestId = Id<'request'>;RequestMeta
Section titled “RequestMeta”See the declaration and integration guide.
export interface RequestMeta { readonly requestId: RequestId; readonly revision: number;}resolveAnchor
Section titled “resolveAnchor”Offsets are a fast path only with the same document version AND exact quote/context validation. On any other path, all exact quotations satisfying provided adjacent context are considered. A 1000-candidate limit produces ambiguous/truncated, never an apparently unique match.
export declare function resolveAnchor(value: TextAnchor, current: SourceDocument): AnchorResolution;resolveAnchors
Section titled “resolveAnchors”Batch form of resolveAnchor: identical results, in input order, for many anchors against one
source. Occurrences of each distinct quotation are found once, and anchors that share the same
quotation and context share one frozen candidate list, instead of rescanning the whole text per
anchor. (The idea — one search pass per distinct query — comes from the MIT-licensed
html-highlighter by Dossier/Diffeo; no code is reused.)
REQ: core-r-0037
REQ: core-r-0039
REQ: highlighter-r-0069
export declare function resolveAnchors(values: readonly TextAnchor[], current: SourceDocument): readonly AnchorResolution[];ResourceResponse
Section titled “ResourceResponse”See the declaration and integration guide.
export interface ResourceResponse<T> extends RequestMeta { readonly status: 'ok' | 'unavailable'; readonly value: T | null;}restoreAnchorResolution
Section titled “restoreAnchorResolution”See the declaration and integration guide.
export declare function restoreAnchorResolution(serialized: string, source: SourceDocument): AnchorResolution;restoreState
Section titled “restoreState”See the declaration and integration guide.
export declare function restoreState(encoded: string): InteractionState;ResultDocument
Section titled “ResultDocument”See the declaration and integration guide.
export interface ResultDocument { readonly id: DocumentId; readonly version: string; readonly title: string; readonly sourceLabel?: string; readonly url?: string; readonly snippet: Snippet; readonly entityIds: readonly EntityId[]; readonly publishedAt?: string; readonly attribution?: string; readonly availability?: 'available' | 'withdrawn' | 'unavailable';}safeUrl
Section titled “safeUrl”HTTP(S) only; no implicit relative base, embedded credentials, or active schemes.
export declare function safeUrl(value: string): string;SearchAdapter
Section titled “SearchAdapter”Adapter returns unknown intentionally: runtime parsing, not a TS cast, establishes trust.
export interface SearchAdapter { search(request: SearchRequest, signal: AbortSignal): Promise<unknown>; profile?(request: LoadRequest<EntityId>, signal: AbortSignal): Promise<unknown>; relation?(request: LoadRequest<PairId>, signal: AbortSignal): Promise<unknown>; evidence?(request: LoadRequest<EvidenceId>, signal: AbortSignal): Promise<unknown>; source?(request: LoadRequest<DocumentId>, signal: AbortSignal): Promise<unknown>;}SearchRequest
Section titled “SearchRequest”See the declaration and integration guide.
export interface SearchRequest extends RequestMeta { readonly query: Query; readonly context: HostContext | null;}SearchResponse
Section titled “SearchResponse”See the declaration and integration guide.
export interface SearchResponse extends RequestMeta { readonly status: 'ok' | 'partial' | 'unavailable'; readonly documents: readonly ResultDocument[]; readonly entities: readonly Entity[]; readonly recommendations: readonly Recommendation[]; readonly nextCursor?: string | null; readonly message?: string;}segmentPassage
Section titled “segmentPassage”See the declaration and integration guide.
export declare function segmentPassage(value: Snippet, selectedEvidence?: readonly TextRange[]): readonly PassageSegment[];segmentText
Section titled “segmentText”Sweep-line partition: reconstruction is byte-for-byte exact; no incompatible nested controls. Bounded total memberships prevents pathological quadratic output from hostile intervals.
export declare function segmentText(text: string, intervals: readonly TextInterval[]): readonly TextSegment[];serializeAnchorResolution
Section titled “serializeAnchorResolution”Round-trip by recomputing against an explicit source, rather than trusting a cached success flag.
export declare function serializeAnchorResolution(value: AnchorResolution): string;serializeState
Section titled “serializeState”Explicit opt-in serialization. Unknown fields/versions are rejected, not carried through. REQ: core-r-0010
export declare function serializeState(state: InteractionState): string;sessionId
Section titled “sessionId”See the declaration and integration guide.
sessionId: (v: unknown) => SessionIdSessionId
Section titled “SessionId”See the declaration and integration guide.
export type SessionId = Id<'session'>;Snippet
Section titled “Snippet”See the declaration and integration guide.
export interface Snippet { readonly text: string; readonly mentions: readonly Mention[]; readonly queryMatches?: readonly TextRange[]; readonly links?: readonly TextLink[];}SourceDocument
Section titled “SourceDocument”See the declaration and integration guide.
export interface SourceDocument { readonly id: DocumentId; readonly version: string; readonly canonicalVersion: 1; readonly text: string; readonly url?: string; readonly mentions?: readonly Mention[];}SurfaceCapabilities
Section titled “SurfaceCapabilities”See the declaration and integration guide.
export interface SurfaceCapabilities { readonly profile: boolean; readonly relations: boolean; readonly evidence: boolean; readonly source: boolean; readonly graph: boolean; readonly liveDom: boolean; readonly audience: boolean;}TextAnchor
Section titled “TextAnchor”Offsets describe canonicalVersion 1 logical text, never HTML bytes or visual glyph positions.
export interface TextAnchor { readonly documentId: DocumentId; readonly documentVersion: string; readonly canonicalVersion: 1; readonly range: TextRange; readonly exact: string; readonly prefix?: string; readonly suffix?: string;}TextInterval
Section titled “TextInterval”See the declaration and integration guide.
export interface TextInterval { readonly id: string; readonly kind: IntervalKind; readonly range: TextRange;}TextLink
Section titled “TextLink”See the declaration and integration guide.
export interface TextLink { readonly range: TextRange; readonly url: string;}TextRange
Section titled “TextRange”See the declaration and integration guide.
export interface TextRange { readonly start: number; readonly end: number; readonly unit: OffsetUnit;}TextSegment
Section titled “TextSegment”See the declaration and integration guide.
export interface TextSegment { readonly start: number; readonly end: number; readonly text: string; readonly intervals: readonly { readonly id: string; readonly kind: IntervalKind; }[];}toUtf16Range
Section titled “toUtf16Range”See the declaration and integration guide.
export declare function toUtf16Range(text: string, range: TextRange): Utf16Range;Utf16Range
Section titled “Utf16Range”See the declaration and integration guide.
export interface Utf16Range { readonly start: number; readonly end: number; readonly unit: 'utf16';}ValidationError
Section titled “ValidationError”See the declaration and integration guide.
export declare class ValidationError extends Error { readonly code = "invalid-data"; readonly path: string; constructor(path: string, message: string);}