@lians-ai/lians 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # @lians-ai/lians
2
+
3
+ **Financial-grade AI memory for TypeScript/Node** — bitemporal facts, SEC 17a-4
4
+ audit chain, GDPR crypto-shred, information barriers. The TypeScript client for
5
+ [Lians](https://github.com/Lians-ai/Lians).
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @lians-ai/lians
11
+ # or: pnpm add @lians-ai/lians / yarn add @lians-ai/lians
12
+ ```
13
+
14
+ Requires a running Lians server (`docker compose up --build`, or a managed
15
+ endpoint). For zero-setup local prototyping without a server, the Python SDK's
16
+ `LocalLiansClient` (SQLite) is the fastest path.
17
+
18
+ ## Quickstart
19
+
20
+ ```ts
21
+ import { LiansClient } from "@lians-ai/lians";
22
+
23
+ const client = new LiansClient({
24
+ baseUrl: "https://mem.yourfirm.internal",
25
+ apiKey: process.env.LIANS_API_KEY!,
26
+ });
27
+
28
+ // Write a fact with its event time
29
+ await client.addMemory({
30
+ agent_id: "equity-desk",
31
+ content: "NVDA FY2026 revenue guidance raised to $40B",
32
+ event_time: "2025-11-19T16:00:00Z",
33
+ metadata: { ticker: "NVDA", metric: "revenue_guidance" },
34
+ });
35
+
36
+ // Recall — superseded facts are excluded at the DB layer, never reach the LLM
37
+ const { memories } = await client.recall({
38
+ agent_id: "equity-desk",
39
+ query: "NVDA revenue guidance",
40
+ });
41
+
42
+ // GDPR Art. 17 crypto-shred — content becomes unreadable, audit trail survives
43
+ await client.eraseSubject({ subject_id: "subj-123", reason: "GDPR-REQ-1" });
44
+
45
+ // Point-in-time audit snapshot — what did we know on a past date?
46
+ const snap = await client.snapshot({ agent_id: "equity-desk", as_of: "2025-03-01T00:00:00Z" });
47
+
48
+ // Backtest lookahead-bias guard — flag facts unknowable at the simulation date
49
+ const report = await client.backtestCheck({ agent_id: "equity-desk", as_of: "2025-01-01T00:00:00Z" });
50
+ ```
51
+
52
+ ## What makes Lians different
53
+
54
+ | Feature | Lians | mem0 | Graphiti/Zep |
55
+ |---------|:----:|:----:|:-----------:|
56
+ | Bitemporal model (event + ingestion time) | ✓ | ✗ | ✓ |
57
+ | Supersession (stale facts excluded at DB layer) | ✓ | ✗ | Partial |
58
+ | SEC 17a-4 tamper-evident audit chain | ✓ | ✗ | ✗ |
59
+ | GDPR crypto-shred with audit survival | ✓ | ✗ | ✗ |
60
+ | Information barriers (PostgreSQL RLS) | ✓ | ✗ | ✗ |
61
+ | Backtest contamination detection | ✓ | ✗ | ✗ |
62
+
63
+ See the [regulated-eval head-to-head](https://github.com/Lians-ai/Lians/blob/master/docs/regulated-eval-results.md).
64
+
65
+ ## TypeScript-first
66
+
67
+ Fully typed: every request and response is a named interface (`MemoryAdd`,
68
+ `RecallRequest`, `RecallResult`, `EraseRequest`, `KnowledgeSnapshot`, …), exported
69
+ from the package root. Errors throw a typed `LiansError` with the HTTP status.
70
+
71
+ Full documentation: [github.com/Lians-ai/Lians](https://github.com/Lians-ai/Lians)
@@ -0,0 +1,211 @@
1
+ /**
2
+ * AgentMem TypeScript SDK — async HTTP client for the REST API.
3
+ *
4
+ * AgentMem is a financial-grade AI memory layer that provides:
5
+ * - Compliance-grade recall: bitemporal model with SEC 17a-4 hash chain, GDPR
6
+ * crypto-shred (audit hash survives), and PostgreSQL RLS information barriers.
7
+ * mem0 has no temporal model. Graphiti/Zep has temporal graph queries but no
8
+ * compliance stack (no hash chain, no crypto-shred, no information barriers).
9
+ * - Automatic supersession: the LLM engine detects when a new fact replaces an
10
+ * old one and invalidates the stale record, so recall always returns the
11
+ * current truth without your agent needing to deduplicate.
12
+ * - Crypto-shred erasure: GDPR Art. 17 / CCPA right-to-erasure via per-subject
13
+ * DEK destruction. The audit trail is preserved as content hashes so the
14
+ * erasure itself is provable.
15
+ * - Tamper-evident hash chain: every audit event is linked in a SHA-256 chain
16
+ * that can be verified at any time with verifyChain().
17
+ *
18
+ * @example
19
+ * const client = new LiansClient({
20
+ * baseUrl: "https://mem.yourfirm.internal",
21
+ * apiKey: process.env.AGENTMEM_API_KEY!,
22
+ * adminSecret: process.env.AGENTMEM_ADMIN_SECRET,
23
+ * });
24
+ * const result = await client.recall({ agent_id: "equity-desk", query: "AAPL price target" });
25
+ */
26
+ import type { LiansClientOptions, MemoryAdd, MemoryOut, MemoryBatchResult, RecallRequest, RecallResult, EraseRequest, EraseResult, ErasureCertificate, MemoryLineageResult, ConflictListResult, ConflictResolveRequest, ConflictResolveResult, SupersessionReviewResult, AuditExportResult, WebhookEndpoint, WebhookRegisterRequest, WebhookRegisterResult, WebhookUpdateRequest, WebhookDeliveryListResult, ComplianceReport, FactHistoryResult, KnowledgeSnapshot, ContaminationReport } from "./types.js";
27
+ /** Thrown by LiansClient when the server returns a non-2xx response. */
28
+ export declare class LiansError extends Error {
29
+ readonly status: number;
30
+ readonly body: string;
31
+ constructor(status: number, body: string, message: string);
32
+ }
33
+ export declare class LiansClient {
34
+ private readonly baseUrl;
35
+ private readonly apiKey;
36
+ private readonly adminSecret;
37
+ private readonly timeoutMs;
38
+ constructor(options: LiansClientOptions);
39
+ private _req;
40
+ /** Store a financial fact, observation, or decision with its event timestamp. */
41
+ addMemory(req: MemoryAdd): Promise<MemoryOut>;
42
+ /**
43
+ * Add multiple memories in a single request.
44
+ * Items are processed sequentially, so a later item can supersede an earlier
45
+ * one within the same batch (useful when loading a time-series of revisions).
46
+ */
47
+ batchAdd(memories: MemoryAdd[]): Promise<MemoryBatchResult>;
48
+ /**
49
+ * Retrieve the most relevant current memories for a query.
50
+ * Superseded facts are excluded at the database level. Pass `as_of` for
51
+ * point-in-time recall backed by a compliance audit stack (hash chain,
52
+ * crypto-shred, RLS information barriers) absent from mem0 and Graphiti/Zep.
53
+ */
54
+ recall(req: RecallRequest): Promise<RecallResult>;
55
+ /**
56
+ * Return the full supersession lineage graph for a memory.
57
+ * Useful for audit and human review: shows every version of a fact and the
58
+ * edges (with confidence + rationale) that link them.
59
+ */
60
+ getLineage(memoryId: string): Promise<MemoryLineageResult>;
61
+ /**
62
+ * GDPR Art. 17 / CCPA crypto-shred.
63
+ * Destroys the data subject's per-subject DEK so all their memories become
64
+ * permanently unreadable. The audit trail (hashes, timestamps) is preserved.
65
+ */
66
+ eraseSubject(req: EraseRequest): Promise<EraseResult>;
67
+ /** List detected contradictions between memories. */
68
+ listConflicts(opts?: {
69
+ status?: string;
70
+ limit?: number;
71
+ }): Promise<ConflictListResult>;
72
+ /** Resolve a conflict by accepting one side or dismissing the flag. */
73
+ resolveConflict(conflictId: string, req: ConflictResolveRequest): Promise<ConflictResolveResult>;
74
+ /**
75
+ * Return supersession events whose confidence is below `threshold`.
76
+ * Financial firms should poll this to surface uncertain supersessions for
77
+ * human review before treating the old fact as stale.
78
+ */
79
+ reviewSupersessions(opts?: {
80
+ threshold?: number;
81
+ limit?: number;
82
+ }): Promise<SupersessionReviewResult>;
83
+ /**
84
+ * Confirm a supersession — the engine was correct.
85
+ * Writes an immutable audit event; the superseded memory remains closed.
86
+ */
87
+ confirmSupersession(memoryId: string, reviewerNote?: string): Promise<unknown>;
88
+ /**
89
+ * Reject a supersession — the engine was wrong.
90
+ * Restores the old memory as currently valid (valid_to = NULL) and writes an
91
+ * immutable audit event. Both memories are now treated as additive.
92
+ */
93
+ rejectSupersession(memoryId: string, reviewerNote?: string): Promise<unknown>;
94
+ /**
95
+ * Generate a compliance report for the caller's namespace.
96
+ * Covers: memory counts, audit chain status, erasures, open conflicts,
97
+ * supersession statistics, and retention policy snapshot.
98
+ *
99
+ * @param from - Window start (ISO-8601 UTC). Omit for all-time.
100
+ * @param to - Window end (ISO-8601 UTC). Omit for now.
101
+ * @param verify - Run hash-chain verification (adds ~50ms per 10k events).
102
+ */
103
+ complianceReport(opts?: {
104
+ from?: string;
105
+ to?: string;
106
+ verify?: boolean;
107
+ }): Promise<ComplianceReport>;
108
+ /**
109
+ * Register a webhook endpoint.
110
+ * The returned `secret` is shown exactly once — store it to verify signatures.
111
+ * Every delivery is HMAC-SHA256-signed: `X-Lians-Signature: sha256=<hex>`
112
+ */
113
+ registerWebhook(req: WebhookRegisterRequest): Promise<WebhookRegisterResult>;
114
+ /** List all webhook endpoints registered for the caller's namespace. */
115
+ listWebhooks(): Promise<WebhookEndpoint[]>;
116
+ /** Update an endpoint's enabled state, subscribed events, or description. */
117
+ updateWebhook(endpointId: string, req: WebhookUpdateRequest): Promise<WebhookEndpoint>;
118
+ /** Remove a webhook endpoint permanently. */
119
+ deleteWebhook(endpointId: string): Promise<void>;
120
+ /** Return recent delivery attempts for a webhook endpoint. */
121
+ webhookDeliveries(endpointId: string, limit?: number): Promise<WebhookDeliveryListResult>;
122
+ /**
123
+ * Return all recorded versions of a structured fact, ordered by event_time.
124
+ *
125
+ * Unlike `getLineage` (which requires a memory_id), this queries by what
126
+ * analysts already know: the ticker and metric. Superseded versions are
127
+ * included so you can see how a fact evolved over time.
128
+ *
129
+ * Entity normalization is automatic — 'Apple Inc.', 'US0378331005' (ISIN),
130
+ * '037833100' (CUSIP), and 'AAPL' all resolve to the same fact series.
131
+ *
132
+ * @example
133
+ * const history = await client.factHistory({ agent_id: "equity-desk", ticker: "AAPL", metric: "eps" });
134
+ */
135
+ factHistory(opts: {
136
+ agent_id: string;
137
+ ticker: string;
138
+ metric: string;
139
+ limit?: number;
140
+ }): Promise<FactHistoryResult>;
141
+ /**
142
+ * Reconstruct the complete knowledge state of an agent at a specific point
143
+ * in time. Returns every fact that was valid at `as_of` — exhaustive, no
144
+ * relevance filter.
145
+ *
146
+ * This is the "audit reconstruction as a product surface" from SCALE.md §4:
147
+ * "Show me the agent's complete knowledge state as of T." One call. The
148
+ * compliance demo that closes deals with risk committees and regulators.
149
+ * mem0 has no temporal model. Graphiti/Zep has temporal graph queries but
150
+ * no tamper-evident hash chain or compliance export API.
151
+ *
152
+ * @param opts.agent_id - Agent whose knowledge state to reconstruct
153
+ * @param opts.as_of - ISO-8601 UTC checkpoint timestamp
154
+ * @param opts.limit - Max memories returned (default 1000)
155
+ */
156
+ snapshot(opts: {
157
+ agent_id: string;
158
+ as_of: string;
159
+ limit?: number;
160
+ }): Promise<KnowledgeSnapshot>;
161
+ /**
162
+ * Detect lookahead bias in a backtest simulation.
163
+ *
164
+ * Scans the agent's memory store and flags every fact the agent couldn't have
165
+ * known at `simulation_as_of`. Returns two contamination types:
166
+ * - `future_event` — event_time > simulation_as_of (clear lookahead)
167
+ * - `late_revision` — ingestion_time > simulation_as_of (subtle: the revised
168
+ * figure hadn't landed yet, even though the event is historical)
169
+ *
170
+ * `is_clean: true` is the proof a risk committee needs before trusting a
171
+ * backtest result. This is the "thin open-sourceable primitive" from SCALE.md §6
172
+ * that quant engineers can't get from any other memory store.
173
+ *
174
+ * @param opts.agent_id - Agent to inspect
175
+ * @param opts.simulation_as_of - ISO-8601 UTC simulation checkpoint
176
+ */
177
+ backtestCheck(opts: {
178
+ agent_id: string;
179
+ simulation_as_of: string;
180
+ }): Promise<ContaminationReport>;
181
+ /**
182
+ * Retrieve the cryptographic proof-of-erasure certificate for a data subject.
183
+ *
184
+ * The certificate proves: (1) N memories had their encrypted content permanently
185
+ * destroyed; (2) SHA-256 content_hashes are preserved — auditable but
186
+ * unrecoverable; (3) the audit chain remained intact after erasure.
187
+ *
188
+ * Returns 404 if no erasure has been recorded for this subject.
189
+ * Requires admin scope.
190
+ */
191
+ erasureCertificate(subjectId: string): Promise<ErasureCertificate>;
192
+ /**
193
+ * Export the full audit log for a namespace (SEC/FINRA/CFTC examiners).
194
+ * Pass `verify: true` to include a chain-verification report alongside events.
195
+ * Requires `adminSecret` to be set on the client.
196
+ */
197
+ auditExport(opts: {
198
+ namespace: string;
199
+ from?: string;
200
+ to?: string;
201
+ limit?: number;
202
+ verify?: boolean;
203
+ }): Promise<AuditExportResult>;
204
+ /**
205
+ * Verify the SEC 17a-4 tamper-evidence hash chain for a namespace.
206
+ * Returns `{ status: "ok", rows_checked: N }` or details on every broken link.
207
+ * Requires `adminSecret` to be set on the client.
208
+ */
209
+ verifyChain(namespace: string): Promise<unknown>;
210
+ }
211
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAIpB,wEAAwE;AACxE,qBAAa,UAAW,SAAQ,KAAK;aAEjB,MAAM,EAAE,MAAM;aACd,IAAI,EAAE,MAAM;gBADZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM;CAKlB;AAYD,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IACjD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,OAAO,EAAE,kBAAkB;YASzB,IAAI;IA0DlB,iFAAiF;IACjF,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAI7C;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQ3D;;;;;OAKG;IACH,MAAM,CAAC,GAAG,EAAE,aAAa,GA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AAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAMjD"}
package/dist/client.js ADDED
@@ -0,0 +1,329 @@
1
+ "use strict";
2
+ /**
3
+ * AgentMem TypeScript SDK — async HTTP client for the REST API.
4
+ *
5
+ * AgentMem is a financial-grade AI memory layer that provides:
6
+ * - Compliance-grade recall: bitemporal model with SEC 17a-4 hash chain, GDPR
7
+ * crypto-shred (audit hash survives), and PostgreSQL RLS information barriers.
8
+ * mem0 has no temporal model. Graphiti/Zep has temporal graph queries but no
9
+ * compliance stack (no hash chain, no crypto-shred, no information barriers).
10
+ * - Automatic supersession: the LLM engine detects when a new fact replaces an
11
+ * old one and invalidates the stale record, so recall always returns the
12
+ * current truth without your agent needing to deduplicate.
13
+ * - Crypto-shred erasure: GDPR Art. 17 / CCPA right-to-erasure via per-subject
14
+ * DEK destruction. The audit trail is preserved as content hashes so the
15
+ * erasure itself is provable.
16
+ * - Tamper-evident hash chain: every audit event is linked in a SHA-256 chain
17
+ * that can be verified at any time with verifyChain().
18
+ *
19
+ * @example
20
+ * const client = new LiansClient({
21
+ * baseUrl: "https://mem.yourfirm.internal",
22
+ * apiKey: process.env.AGENTMEM_API_KEY!,
23
+ * adminSecret: process.env.AGENTMEM_ADMIN_SECRET,
24
+ * });
25
+ * const result = await client.recall({ agent_id: "equity-desk", query: "AAPL price target" });
26
+ */
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.LiansClient = exports.LiansError = void 0;
29
+ // ── Error class ───────────────────────────────────────────────────────────────
30
+ /** Thrown by LiansClient when the server returns a non-2xx response. */
31
+ class LiansError extends Error {
32
+ constructor(status, body, message) {
33
+ super(message);
34
+ this.status = status;
35
+ this.body = body;
36
+ this.name = "LiansError";
37
+ }
38
+ }
39
+ exports.LiansError = LiansError;
40
+ // ── Client ────────────────────────────────────────────────────────────────────
41
+ class LiansClient {
42
+ constructor(options) {
43
+ this.baseUrl = options.baseUrl.replace(/\/$/, "");
44
+ this.apiKey = options.apiKey;
45
+ this.adminSecret = options.adminSecret;
46
+ this.timeoutMs = options.timeoutMs ?? 30000;
47
+ }
48
+ // ── Internal ──────────────────────────────────────────────────────────────
49
+ async _req(method, path, opts = {}) {
50
+ const { json, params, admin } = opts;
51
+ // Build URL with query parameters
52
+ let url = `${this.baseUrl}${path}`;
53
+ if (params) {
54
+ const qs = new URLSearchParams();
55
+ for (const [k, v] of Object.entries(params)) {
56
+ if (v !== undefined && v !== null)
57
+ qs.set(k, String(v));
58
+ }
59
+ const s = qs.toString();
60
+ if (s)
61
+ url += `?${s}`;
62
+ }
63
+ // Build headers
64
+ const headers = {
65
+ "Content-Type": "application/json",
66
+ "X-API-Key": this.apiKey,
67
+ };
68
+ if (admin && this.adminSecret) {
69
+ headers["X-Admin-Secret"] = this.adminSecret;
70
+ }
71
+ // Timeout via AbortController
72
+ const controller = new AbortController();
73
+ const timer = setTimeout(() => controller.abort(), this.timeoutMs);
74
+ let res;
75
+ try {
76
+ res = await fetch(url, {
77
+ method,
78
+ headers,
79
+ body: json !== undefined ? JSON.stringify(json) : undefined,
80
+ signal: controller.signal,
81
+ });
82
+ }
83
+ finally {
84
+ clearTimeout(timer);
85
+ }
86
+ if (!res.ok) {
87
+ const body = await res.text().catch(() => res.statusText);
88
+ throw new LiansError(res.status, body, `AgentMem ${method} ${path} → ${res.status}: ${body}`);
89
+ }
90
+ if (res.status === 204)
91
+ return undefined;
92
+ return res.json();
93
+ }
94
+ // ── Write ─────────────────────────────────────────────────────────────────
95
+ /** Store a financial fact, observation, or decision with its event timestamp. */
96
+ addMemory(req) {
97
+ return this._req("POST", "/v1/memories", { json: req });
98
+ }
99
+ /**
100
+ * Add multiple memories in a single request.
101
+ * Items are processed sequentially, so a later item can supersede an earlier
102
+ * one within the same batch (useful when loading a time-series of revisions).
103
+ */
104
+ batchAdd(memories) {
105
+ return this._req("POST", "/v1/memories/batch", {
106
+ json: { memories },
107
+ });
108
+ }
109
+ // ── Read ──────────────────────────────────────────────────────────────────
110
+ /**
111
+ * Retrieve the most relevant current memories for a query.
112
+ * Superseded facts are excluded at the database level. Pass `as_of` for
113
+ * point-in-time recall backed by a compliance audit stack (hash chain,
114
+ * crypto-shred, RLS information barriers) absent from mem0 and Graphiti/Zep.
115
+ */
116
+ recall(req) {
117
+ return this._req("POST", "/v1/recall", { json: req });
118
+ }
119
+ /**
120
+ * Return the full supersession lineage graph for a memory.
121
+ * Useful for audit and human review: shows every version of a fact and the
122
+ * edges (with confidence + rationale) that link them.
123
+ */
124
+ getLineage(memoryId) {
125
+ return this._req("GET", `/v1/memories/${memoryId}/lineage`);
126
+ }
127
+ // ── Compliance / Erasure ──────────────────────────────────────────────────
128
+ /**
129
+ * GDPR Art. 17 / CCPA crypto-shred.
130
+ * Destroys the data subject's per-subject DEK so all their memories become
131
+ * permanently unreadable. The audit trail (hashes, timestamps) is preserved.
132
+ */
133
+ eraseSubject(req) {
134
+ return this._req("POST", "/v1/erase", { json: req });
135
+ }
136
+ // ── Conflicts ─────────────────────────────────────────────────────────────
137
+ /** List detected contradictions between memories. */
138
+ listConflicts(opts = {}) {
139
+ return this._req("GET", "/v1/conflicts", {
140
+ params: { status: opts.status, limit: opts.limit },
141
+ });
142
+ }
143
+ /** Resolve a conflict by accepting one side or dismissing the flag. */
144
+ resolveConflict(conflictId, req) {
145
+ return this._req("POST", `/v1/conflicts/${conflictId}/resolve`, { json: req });
146
+ }
147
+ // ── Supersession review ───────────────────────────────────────────────────
148
+ /**
149
+ * Return supersession events whose confidence is below `threshold`.
150
+ * Financial firms should poll this to surface uncertain supersessions for
151
+ * human review before treating the old fact as stale.
152
+ */
153
+ reviewSupersessions(opts = {}) {
154
+ return this._req("GET", "/v1/supersessions/review", {
155
+ params: { threshold: opts.threshold, limit: opts.limit },
156
+ });
157
+ }
158
+ /**
159
+ * Confirm a supersession — the engine was correct.
160
+ * Writes an immutable audit event; the superseded memory remains closed.
161
+ */
162
+ confirmSupersession(memoryId, reviewerNote) {
163
+ return this._req("PATCH", `/v1/supersessions/${memoryId}`, {
164
+ json: { action: "confirm", reviewer_note: reviewerNote },
165
+ });
166
+ }
167
+ /**
168
+ * Reject a supersession — the engine was wrong.
169
+ * Restores the old memory as currently valid (valid_to = NULL) and writes an
170
+ * immutable audit event. Both memories are now treated as additive.
171
+ */
172
+ rejectSupersession(memoryId, reviewerNote) {
173
+ return this._req("PATCH", `/v1/supersessions/${memoryId}`, {
174
+ json: { action: "reject", reviewer_note: reviewerNote },
175
+ });
176
+ }
177
+ // ── Compliance ────────────────────────────────────────────────────────────
178
+ /**
179
+ * Generate a compliance report for the caller's namespace.
180
+ * Covers: memory counts, audit chain status, erasures, open conflicts,
181
+ * supersession statistics, and retention policy snapshot.
182
+ *
183
+ * @param from - Window start (ISO-8601 UTC). Omit for all-time.
184
+ * @param to - Window end (ISO-8601 UTC). Omit for now.
185
+ * @param verify - Run hash-chain verification (adds ~50ms per 10k events).
186
+ */
187
+ complianceReport(opts = {}) {
188
+ return this._req("GET", "/v1/compliance/report", {
189
+ params: { from: opts.from, to: opts.to, verify: opts.verify },
190
+ });
191
+ }
192
+ // ── Webhooks ──────────────────────────────────────────────────────────────
193
+ /**
194
+ * Register a webhook endpoint.
195
+ * The returned `secret` is shown exactly once — store it to verify signatures.
196
+ * Every delivery is HMAC-SHA256-signed: `X-Lians-Signature: sha256=<hex>`
197
+ */
198
+ registerWebhook(req) {
199
+ return this._req("POST", "/v1/webhooks", { json: req });
200
+ }
201
+ /** List all webhook endpoints registered for the caller's namespace. */
202
+ listWebhooks() {
203
+ return this._req("GET", "/v1/webhooks");
204
+ }
205
+ /** Update an endpoint's enabled state, subscribed events, or description. */
206
+ updateWebhook(endpointId, req) {
207
+ return this._req("PATCH", `/v1/webhooks/${endpointId}`, { json: req });
208
+ }
209
+ /** Remove a webhook endpoint permanently. */
210
+ deleteWebhook(endpointId) {
211
+ return this._req("DELETE", `/v1/webhooks/${endpointId}`);
212
+ }
213
+ /** Return recent delivery attempts for a webhook endpoint. */
214
+ webhookDeliveries(endpointId, limit = 50) {
215
+ return this._req("GET", `/v1/webhooks/${endpointId}/deliveries`, { params: { limit } });
216
+ }
217
+ // ── Fact history ──────────────────────────────────────────────────────────
218
+ /**
219
+ * Return all recorded versions of a structured fact, ordered by event_time.
220
+ *
221
+ * Unlike `getLineage` (which requires a memory_id), this queries by what
222
+ * analysts already know: the ticker and metric. Superseded versions are
223
+ * included so you can see how a fact evolved over time.
224
+ *
225
+ * Entity normalization is automatic — 'Apple Inc.', 'US0378331005' (ISIN),
226
+ * '037833100' (CUSIP), and 'AAPL' all resolve to the same fact series.
227
+ *
228
+ * @example
229
+ * const history = await client.factHistory({ agent_id: "equity-desk", ticker: "AAPL", metric: "eps" });
230
+ */
231
+ factHistory(opts) {
232
+ return this._req("GET", "/v1/facts/history", {
233
+ params: {
234
+ agent_id: opts.agent_id,
235
+ ticker: opts.ticker,
236
+ metric: opts.metric,
237
+ limit: opts.limit,
238
+ },
239
+ });
240
+ }
241
+ // ── Snapshot (audit reconstruction) ──────────────────────────────────────
242
+ /**
243
+ * Reconstruct the complete knowledge state of an agent at a specific point
244
+ * in time. Returns every fact that was valid at `as_of` — exhaustive, no
245
+ * relevance filter.
246
+ *
247
+ * This is the "audit reconstruction as a product surface" from SCALE.md §4:
248
+ * "Show me the agent's complete knowledge state as of T." One call. The
249
+ * compliance demo that closes deals with risk committees and regulators.
250
+ * mem0 has no temporal model. Graphiti/Zep has temporal graph queries but
251
+ * no tamper-evident hash chain or compliance export API.
252
+ *
253
+ * @param opts.agent_id - Agent whose knowledge state to reconstruct
254
+ * @param opts.as_of - ISO-8601 UTC checkpoint timestamp
255
+ * @param opts.limit - Max memories returned (default 1000)
256
+ */
257
+ snapshot(opts) {
258
+ return this._req("GET", "/v1/snapshot", {
259
+ params: { agent_id: opts.agent_id, as_of: opts.as_of, limit: opts.limit },
260
+ });
261
+ }
262
+ // ── Backtest contamination ────────────────────────────────────────────────
263
+ /**
264
+ * Detect lookahead bias in a backtest simulation.
265
+ *
266
+ * Scans the agent's memory store and flags every fact the agent couldn't have
267
+ * known at `simulation_as_of`. Returns two contamination types:
268
+ * - `future_event` — event_time > simulation_as_of (clear lookahead)
269
+ * - `late_revision` — ingestion_time > simulation_as_of (subtle: the revised
270
+ * figure hadn't landed yet, even though the event is historical)
271
+ *
272
+ * `is_clean: true` is the proof a risk committee needs before trusting a
273
+ * backtest result. This is the "thin open-sourceable primitive" from SCALE.md §6
274
+ * that quant engineers can't get from any other memory store.
275
+ *
276
+ * @param opts.agent_id - Agent to inspect
277
+ * @param opts.simulation_as_of - ISO-8601 UTC simulation checkpoint
278
+ */
279
+ backtestCheck(opts) {
280
+ return this._req("POST", "/v1/backtest/check", {
281
+ json: { agent_id: opts.agent_id, simulation_as_of: opts.simulation_as_of },
282
+ });
283
+ }
284
+ // ── Erasure certificate ───────────────────────────────────────────────────
285
+ /**
286
+ * Retrieve the cryptographic proof-of-erasure certificate for a data subject.
287
+ *
288
+ * The certificate proves: (1) N memories had their encrypted content permanently
289
+ * destroyed; (2) SHA-256 content_hashes are preserved — auditable but
290
+ * unrecoverable; (3) the audit chain remained intact after erasure.
291
+ *
292
+ * Returns 404 if no erasure has been recorded for this subject.
293
+ * Requires admin scope.
294
+ */
295
+ erasureCertificate(subjectId) {
296
+ return this._req("GET", `/v1/erase/${subjectId}/certificate`);
297
+ }
298
+ // ── Admin / Audit chain ───────────────────────────────────────────────────
299
+ /**
300
+ * Export the full audit log for a namespace (SEC/FINRA/CFTC examiners).
301
+ * Pass `verify: true` to include a chain-verification report alongside events.
302
+ * Requires `adminSecret` to be set on the client.
303
+ */
304
+ auditExport(opts) {
305
+ return this._req("GET", "/v1/admin/audit/export", {
306
+ params: {
307
+ namespace: opts.namespace,
308
+ from_: opts.from,
309
+ to: opts.to,
310
+ limit: opts.limit,
311
+ verify_chain: opts.verify,
312
+ },
313
+ admin: true,
314
+ });
315
+ }
316
+ /**
317
+ * Verify the SEC 17a-4 tamper-evidence hash chain for a namespace.
318
+ * Returns `{ status: "ok", rows_checked: N }` or details on every broken link.
319
+ * Requires `adminSecret` to be set on the client.
320
+ */
321
+ verifyChain(namespace) {
322
+ return this._req("GET", "/v1/admin/audit/verify", {
323
+ params: { namespace },
324
+ admin: true,
325
+ });
326
+ }
327
+ }
328
+ exports.LiansClient = LiansClient;
329
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;;AA6BH,iFAAiF;AAEjF,wEAAwE;AACxE,MAAa,UAAW,SAAQ,KAAK;IACnC,YACkB,MAAc,EACd,IAAY,EAC5B,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QAI5B,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF;AATD,gCASC;AAUD,iFAAiF;AAEjF,MAAa,WAAW;IAMtB,YAAY,OAA2B;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAM,CAAC;IAC/C,CAAC;IAED,6EAA6E;IAErE,KAAK,CAAC,IAAI,CAChB,MAAc,EACd,IAAY,EACZ,OAAgB,EAAE;QAElB,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QAErC,kCAAkC;QAClC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,CAAC;QACnC,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,EAAE,GAAG,IAA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,KAAK,EAAE,wBAAwB,EAAE;YACzD,MAAM,EAAE,EAAE,SAAS,EAAE;YACrB,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;IACL,CAAC;CACF;AA3WD,kCA2WC"}
@@ -0,0 +1,4 @@
1
+ export { LiansClient, LiansError } from "./client.js";
2
+ export { verifyWebhookSignature, parseWebhookPayload } from "./webhooks.js";
3
+ export type { LiansClientOptions, MemoryAdd, MemoryOut, MemoryBatchResult, RecallRequest, RecallResult, EraseRequest, EraseResult, LineageNode, LineageEdge, MemoryLineageResult, ConflictFlagOut, ConflictListResult, ConflictResolveRequest, ConflictResolveResult, SupersessionReviewItem, SupersessionReviewResult, AuditEvent, AuditExportResult, WebhookEventType, WebhookEndpoint, WebhookRegisterRequest, WebhookRegisterResult, WebhookUpdateRequest, WebhookDelivery, WebhookDeliveryListResult, WebhookPayload, ComplianceReport, ComplianceMemorySummary, ComplianceAuditChain, ComplianceErasures, ComplianceConflicts, ComplianceSupersessions, ComplianceRetention, FactHistoryResult, KnowledgeSnapshot, ContaminationFlag, ContaminationReport, ErasureCertificate, } from "./types.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC5E,YAAY,EACV,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,yBAAyB,EACzB,cAAc,EACd,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseWebhookPayload = exports.verifyWebhookSignature = exports.LiansError = exports.LiansClient = void 0;
4
+ var client_js_1 = require("./client.js");
5
+ Object.defineProperty(exports, "LiansClient", { enumerable: true, get: function () { return client_js_1.LiansClient; } });
6
+ Object.defineProperty(exports, "LiansError", { enumerable: true, get: function () { return client_js_1.LiansError; } });
7
+ var webhooks_js_1 = require("./webhooks.js");
8
+ Object.defineProperty(exports, "verifyWebhookSignature", { enumerable: true, get: function () { return webhooks_js_1.verifyWebhookSignature; } });
9
+ Object.defineProperty(exports, "parseWebhookPayload", { enumerable: true, get: function () { return webhooks_js_1.parseWebhookPayload; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAAsD;AAA7C,wGAAA,WAAW,OAAA;AAAE,uGAAA,UAAU,OAAA;AAChC,6CAA4E;AAAnE,qHAAA,sBAAsB,OAAA;AAAE,kHAAA,mBAAmB,OAAA"}