Skip to content

SDK reference

  • EmpressClient
  • EmpressError
  • EmpressClientOptions
  • RerankCandidate
  • XapiAgent
  • XapiStatement

Renames and re-exports EmpressClient


new EmpressClient(opts): EmpressClient

EmpressClientOptions

EmpressClient

readonly analytics: object

actorStats: (actorId) => Promise<unknown>

string

Promise<unknown>

difficulty: (objectId) => Promise<unknown>

string

Promise<unknown>

rerank: (body) => Promise<{ order: string[]; scores: Record<string, number>; signal: boolean; }>

Per-actor personalized ordering over your candidates (signal:false → use your default order).

string

RerankCandidate[]

Promise<{ order: string[]; scores: Record<string, number>; signal: boolean; }>

summary: () => Promise<unknown>

Promise<unknown>

trending: (body) => Promise<{ counts: Record<string, number>; }>

Population play-counts over a window (the trending signal).

string[]

number

string

Promise<{ counts: Record<string, number>; }>

readonly belief: object

recommended: (actorId, strategy?) => Promise<unknown>

What this actor should see next: due reviews / ready-to-learn / at-boundary.

string

"review" | "learn" | "challenge"

Promise<unknown>

state: (actorId) => Promise<unknown>

Full FSRS belief map for an actor (spaced-repetition state per concept).

string

Promise<unknown>

emit(statement): Promise<{ id?: string; success?: boolean; }>

Append a statement to the immutable ledger.

XapiStatement

Promise<{ id?: string; success?: boolean; }>

exportAll(onPage, opts?): Promise<number>

Export your ENTIRE ledger, page by page (NDJSON under the hood). Calls onPage per batch; returns the total count. Your data is yours — portability by construction.

(rows) => void | Promise<void>

number

string

Promise<number>

statements(params?): Promise<{ statements: XapiStatement[]; }>

Read your tenant’s recent statements. agent accepts a plain actor id (convenience) or a spec IFI JSON string; activity/verb are exact-match IRIs.

string

string

number

string

string

string

Promise<{ statements: XapiStatement[]; }>


  • Error

new EmpressError(status, message): EmpressError

number

string

EmpressError

Error.constructor

optional cause?: unknown

Error.cause

message: string

Error.message

name: string

Error.name

optional stack?: string

Error.stack

status: number


@empress-eco/client — the tenant SDK for the Empress behavioral substrate.

Zero dependencies; browser + Node (any fetch runtime). One client, the whole sold surface: emit → immutable ledger · statements/exportAll → your data, portable · analytics/rerank/belief → the computed layer. Auth is your tenant API key; isolation is enforced substrate-side (proven: a tenant’s reads and exports can only ever contain their own statements).

apiKey: string

optional baseUrl?: string

Defaults to the production substrate.

optional fetch?: (input, init?) => Promise<Response>

MDN Reference

RequestInfo | URL

RequestInit

Promise<Response>


optional creator?: string | null

id: string

optional publicId?: string | null

optional tags?: string[]

optional templateType?: string | null


optional account?: object

homePage: string

name: string

optional mbox?: string

optional name?: string

objectType: "Agent"


actor: XapiAgent

optional context?: object

optional extensions?: Record<string, unknown>

object: object

optional definition?: object

optional name?: Record<string, string>

optional type?: string

id: string

objectType: "Activity"

optional result?: object

optional completion?: boolean

optional duration?: string

optional score?: object

optional raw?: number

optional scaled?: number

optional success?: boolean

optional timestamp?: string

verb: object

optional display?: Record<string, string>

id: string