SDK reference
@empress-eco/client
Section titled “@empress-eco/client”Classes
Section titled “Classes”EmpressClientEmpressError
Interfaces
Section titled “Interfaces”EmpressClientOptionsRerankCandidateXapiAgentXapiStatement
References
Section titled “References”default
Section titled “default”Renames and re-exports EmpressClient
Class: EmpressClient
Section titled “Class: EmpressClient”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EmpressClient(
opts):EmpressClient
Parameters
Section titled “Parameters”EmpressClientOptions
Returns
Section titled “Returns”EmpressClient
Properties
Section titled “Properties”analytics
Section titled “analytics”
readonlyanalytics:object
actorStats
Section titled “actorStats”actorStats: (
actorId) =>Promise<unknown>
Parameters
Section titled “Parameters”actorId
Section titled “actorId”string
Returns
Section titled “Returns”Promise<unknown>
difficulty
Section titled “difficulty”difficulty: (
objectId) =>Promise<unknown>
Parameters
Section titled “Parameters”objectId
Section titled “objectId”string
Returns
Section titled “Returns”Promise<unknown>
rerank
Section titled “rerank”rerank: (
body) =>Promise<{order:string[];scores:Record<string,number>;signal:boolean; }>
Per-actor personalized ordering over your candidates (signal:false → use your default order).
Parameters
Section titled “Parameters”actorId
Section titled “actorId”string
candidates
Section titled “candidates”RerankCandidate[]
Returns
Section titled “Returns”Promise<{ order: string[]; scores: Record<string, number>; signal: boolean; }>
summary
Section titled “summary”summary: () =>
Promise<unknown>
Returns
Section titled “Returns”Promise<unknown>
trending
Section titled “trending”trending: (
body) =>Promise<{counts:Record<string,number>; }>
Population play-counts over a window (the trending signal).
Parameters
Section titled “Parameters”objectIds
Section titled “objectIds”string[]
sinceDays?
Section titled “sinceDays?”number
string
Returns
Section titled “Returns”Promise<{ counts: Record<string, number>; }>
belief
Section titled “belief”
readonlybelief:object
recommended
Section titled “recommended”recommended: (
actorId,strategy?) =>Promise<unknown>
What this actor should see next: due reviews / ready-to-learn / at-boundary.
Parameters
Section titled “Parameters”actorId
Section titled “actorId”string
strategy?
Section titled “strategy?”"review" | "learn" | "challenge"
Returns
Section titled “Returns”Promise<unknown>
state: (
actorId) =>Promise<unknown>
Full FSRS belief map for an actor (spaced-repetition state per concept).
Parameters
Section titled “Parameters”actorId
Section titled “actorId”string
Returns
Section titled “Returns”Promise<unknown>
Methods
Section titled “Methods”emit()
Section titled “emit()”emit(
statement):Promise<{id?:string;success?:boolean; }>
Append a statement to the immutable ledger.
Parameters
Section titled “Parameters”statement
Section titled “statement”XapiStatement
Returns
Section titled “Returns”Promise<{ id?: string; success?: boolean; }>
exportAll()
Section titled “exportAll()”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.
Parameters
Section titled “Parameters”onPage
Section titled “onPage”(rows) => void | Promise<void>
pageSize?
Section titled “pageSize?”number
since?
Section titled “since?”string
Returns
Section titled “Returns”Promise<number>
statements()
Section titled “statements()”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.
Parameters
Section titled “Parameters”params?
Section titled “params?”activity?
Section titled “activity?”string
agent?
Section titled “agent?”string
limit?
Section titled “limit?”number
since?
Section titled “since?”string
until?
Section titled “until?”string
string
Returns
Section titled “Returns”Promise<{ statements: XapiStatement[]; }>
Class: EmpressError
Section titled “Class: EmpressError”Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EmpressError(
status,message):EmpressError
Parameters
Section titled “Parameters”status
Section titled “status”number
message
Section titled “message”string
Returns
Section titled “Returns”EmpressError
Overrides
Section titled “Overrides”Error.constructor
Properties
Section titled “Properties”cause?
Section titled “cause?”
optionalcause?:unknown
Inherited from
Section titled “Inherited from”Error.cause
message
Section titled “message”message:
string
Inherited from
Section titled “Inherited from”Error.message
name:
string
Inherited from
Section titled “Inherited from”Error.name
stack?
Section titled “stack?”
optionalstack?:string
Inherited from
Section titled “Inherited from”Error.stack
status
Section titled “status”status:
number
Interface: EmpressClientOptions
Section titled “Interface: EmpressClientOptions”@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).
Properties
Section titled “Properties”apiKey
Section titled “apiKey”apiKey:
string
baseUrl?
Section titled “baseUrl?”
optionalbaseUrl?:string
Defaults to the production substrate.
fetch?
Section titled “fetch?”
optionalfetch?: (input,init?) =>Promise<Response>
Parameters
Section titled “Parameters”RequestInfo | URL
RequestInit
Returns
Section titled “Returns”Promise<Response>
Interface: RerankCandidate
Section titled “Interface: RerankCandidate”Properties
Section titled “Properties”creator?
Section titled “creator?”
optionalcreator?:string|null
id:
string
publicId?
Section titled “publicId?”
optionalpublicId?:string|null
optionaltags?:string[]
templateType?
Section titled “templateType?”
optionaltemplateType?:string|null
Interface: XapiAgent
Section titled “Interface: XapiAgent”Properties
Section titled “Properties”account?
Section titled “account?”
optionalaccount?:object
homePage
Section titled “homePage”homePage:
string
name:
string
optionalmbox?:string
optionalname?:string
objectType
Section titled “objectType”objectType:
"Agent"
Interface: XapiStatement
Section titled “Interface: XapiStatement”Properties
Section titled “Properties”actor:
XapiAgent
context?
Section titled “context?”
optionalcontext?:object
extensions?
Section titled “extensions?”
optionalextensions?:Record<string,unknown>
object
Section titled “object”object:
object
definition?
Section titled “definition?”
optionaldefinition?:object
definition.name?
Section titled “definition.name?”
optionalname?:Record<string,string>
definition.type?
Section titled “definition.type?”
optionaltype?:string
id:
string
objectType
Section titled “objectType”objectType:
"Activity"
result?
Section titled “result?”
optionalresult?:object
completion?
Section titled “completion?”
optionalcompletion?:boolean
duration?
Section titled “duration?”
optionalduration?:string
score?
Section titled “score?”
optionalscore?:object
score.raw?
Section titled “score.raw?”
optionalraw?:number
score.scaled?
Section titled “score.scaled?”
optionalscaled?:number
success?
Section titled “success?”
optionalsuccess?:boolean
timestamp?
Section titled “timestamp?”
optionaltimestamp?:string
verb:
object
display?
Section titled “display?”
optionaldisplay?:Record<string,string>
id:
string