@memnexus-ai/sdk 1.55.2

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.
@@ -0,0 +1,4291 @@
1
+ /**
2
+ * Native fetch-based HTTP transport for the MemNexus Node.js SDK.
3
+ * Auto-generated by sdk-generator — do not edit manually.
4
+ *
5
+ * Requires Node.js >= 18 (built-in fetch).
6
+ */
7
+ /** Thrown when the API returns a non-2xx response after all retries. */
8
+ declare class SdkError extends Error {
9
+ readonly status: number;
10
+ readonly statusText: string;
11
+ readonly data: unknown;
12
+ constructor(status: number, statusText: string, data: unknown);
13
+ }
14
+ /** Typed HTTP response returned by every service method. */
15
+ interface HttpResponse<T = unknown> {
16
+ status: number;
17
+ statusText: string;
18
+ headers: Record<string, string>;
19
+ data: T;
20
+ }
21
+ interface HttpClientOptions {
22
+ /** Bearer token for authentication. Falls back to MEMNEXUS_API_KEY env var. */
23
+ apiKey?: string;
24
+ /** Base URL for all requests. Defaults to https://api.memnexus.ai */
25
+ baseUrl?: string;
26
+ /** Request timeout in milliseconds. Defaults to 30 000. */
27
+ timeoutMs?: number;
28
+ }
29
+ /** Request options for a single API call */
30
+ interface RequestOptions {
31
+ pathParams?: Record<string, string | number | boolean>;
32
+ queryParams?: Record<string, string | number | boolean | null | undefined>;
33
+ headers?: Record<string, string>;
34
+ body?: unknown;
35
+ method: string;
36
+ path: string;
37
+ }
38
+ /**
39
+ * Lightweight HTTP client using native fetch with exponential-backoff retry.
40
+ *
41
+ * @example
42
+ * const client = new HttpClient({ apiKey: 'key' });
43
+ * const response = await client.request({ method: 'GET', path: '/memories' });
44
+ */
45
+ declare class HttpClient {
46
+ private readonly apiKey;
47
+ private readonly baseUrl;
48
+ private readonly timeoutMs;
49
+ constructor(options?: HttpClientOptions);
50
+ request<T = unknown>(opts: RequestOptions): Promise<HttpResponse<T>>;
51
+ }
52
+
53
+ /**
54
+ * TypeScript interfaces for the MemNexus API.
55
+ * Auto-generated by sdk-generator — do not edit manually.
56
+ */
57
+ interface Error$1 {
58
+ /** Error message */
59
+ error: string;
60
+ /** Optional constructor name of the underlying error. Present on selected 500 responses for client diagnostics; absent on most error responses. */
61
+ errorClass?: string;
62
+ }
63
+ interface Pagination {
64
+ /** Maximum number of items per page */
65
+ limit: number;
66
+ /** Number of items to skip */
67
+ offset: number;
68
+ /** Total number of items */
69
+ count: number;
70
+ }
71
+ /** Environment context for memory scoping — product, service, team, component, role. */
72
+ interface CodeContext {
73
+ /** Product name (e.g. 'memnexus', 'spearmint') */
74
+ product?: string;
75
+ /** Repository name, if different from product */
76
+ repo?: string;
77
+ /** Service or package name (e.g. 'core-api', 'mcp-server', 'cli') */
78
+ service?: string;
79
+ /** Subsystem or component (e.g. 'extraction-pipeline', 'search', 'billing') */
80
+ component?: string;
81
+ /** Team that produced this knowledge (e.g. 'extraction', 'mcp', 'platform') */
82
+ team?: string;
83
+ /** Agent role or persona (e.g. 'team-lead', 'implementer', 'reviewer') */
84
+ role?: string;
85
+ /** Additional project-specific scope tags */
86
+ extra?: Record<string, unknown>;
87
+ }
88
+ interface Memory {
89
+ /** Unique memory identifier */
90
+ id: string;
91
+ /** Optional human-readable name for deterministic retrieval. Only the HEAD version carries the name. */
92
+ name?: string;
93
+ /** Version number for named memories (1 for first version, increments on update) */
94
+ version?: number;
95
+ /** Memory content */
96
+ content: string;
97
+ /** Type of memory */
98
+ memoryType: 'episodic' | 'semantic' | 'procedural';
99
+ /** Context or domain of the memory */
100
+ context?: string;
101
+ /** Associated topics */
102
+ topics?: string[];
103
+ /** System ingestion timestamp (when the system learned about this) */
104
+ timestamp?: string;
105
+ /** Event time (when the event actually occurred in reality) */
106
+ eventTime?: string;
107
+ /** Validity start time (when this fact becomes valid) */
108
+ validFrom?: string;
109
+ /** Validity end time (when this fact expires, null means never expires) */
110
+ validTo?: string | null;
111
+ /** Environment context for memory scoping — product, service, team, component, role. */
112
+ codeContext?: CodeContext;
113
+ /** Creation timestamp */
114
+ createdAt: string;
115
+ /** Last update timestamp */
116
+ updatedAt: string;
117
+ /** Confidence score (0-1) for this memory's accuracy */
118
+ confidenceScore?: number;
119
+ /** Basis for the confidence score */
120
+ confidenceBasis?: 'direct-statement' | 'repeated-mention' | 'single-mention' | 'hedged' | 'inference' | 'external-source' | 'contradicted';
121
+ /** Effective state of the memory in the narrative */
122
+ effectiveState?: 'current' | 'superseded' | 'contradicted' | 'duplicate';
123
+ /** Authority level: directive (mandates) > decision (choices with reasoning) > observation (learned during work) > auto-captured (generated content) */
124
+ authority?: 'directive' | 'decision' | 'observation' | 'auto-captured';
125
+ /** Legacy aggregate extraction status. DERIVED on read from the six per-stage statuses (contentEmbeddingStatus, summaryStatus, questionsStatus, summaryEmbeddingStatus, questionsEmbeddingStatus, graphStatus). Preserved for SDK compatibility per PRD memory-creation-pipeline-v2 §5 Q7. */
126
+ extractionStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
127
+ /** When extraction was completed */
128
+ extractionCompletedAt?: string;
129
+ /** Pipeline 2 content-embedding stage status. Tracks the queue lifecycle for writing m.embedding (primary content embedding). */
130
+ contentEmbeddingStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
131
+ /** AI-generated summary of the memory content */
132
+ summary?: string;
133
+ /** Pipeline 1 summary stage status. Tracks generation of m.summary by the summary-qna LLM call. */
134
+ summaryStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
135
+ /** Pipeline 1 questions stage status. Tracks generation of anticipated Question nodes by the summary-qna LLM call. */
136
+ questionsStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
137
+ /** Pipeline 2 summary-embedding stage status. Tracks the queue lifecycle for writing m.summaryEmbedding (depends on summaryStatus=completed). */
138
+ summaryEmbeddingStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
139
+ /** Pipeline 2 question-embedding stage status. Tracks the queue lifecycle for writing Question.embedding for each anticipated question (depends on questionsStatus=completed). */
140
+ questionsEmbeddingStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
141
+ /** Pipeline 3 graph-extraction stage status. Tracks generation of entities, facts, topics, authority, and memory-type. Replaces the role formerly played by the monolithic extractionStatus writer. */
142
+ graphStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
143
+ /** When graphStatus=skipped, records why graph extraction was skipped. Mirrors the legacy extractionSkipReason field but scoped to the graph pipeline. */
144
+ graphSkipReason?: 'global_disabled' | 'plan_excluded' | 'user_opt_out' | 'content_too_short' | 'legacy' | 'budget_exhausted' | null;
145
+ /** When extractionStatus=skipped, records why extraction was skipped. global_disabled = GRAPH_EXTRACTION_ENABLED=false kill switch. */
146
+ extractionSkipReason?: 'global_disabled' | 'plan_excluded' | 'user_opt_out' | 'content_too_short' | 'legacy';
147
+ /** Status of primary (Ollama) embedding generation via durable queue */
148
+ embeddingStatus?: 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
149
+ /** Status of secondary (OpenAI) dual-write embedding generation via durable queue */
150
+ embeddingOpenaiStatus?: 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
151
+ /** True if the primary content embedding used a head-truncated input (model context exceeded). */
152
+ embeddingTruncated?: boolean;
153
+ /** Token count of the original content (pre-truncation, cl100k proxy). Useful for identifying under-indexed memories. */
154
+ embeddingOriginalTokens?: number;
155
+ /** Smart-field strategy used to produce the primary content embedding. */
156
+ embeddingStrategy?: 'full' | 'head-truncated' | 'summary-selected' | 'question-selected';
157
+ /** Number of topics extracted from content */
158
+ extractedTopicCount?: number;
159
+ /** Number of facts extracted from content */
160
+ extractedFactCount?: number;
161
+ /** Number of entities extracted from content */
162
+ extractedEntityCount?: number;
163
+ /** Number of memories this memory contradicts via outgoing CONTRADICTS relationships */
164
+ conflictCount?: number;
165
+ /** Memory visibility level. Null/undefined treated as 'private' for backward compatibility. 'admin_visible' is computed at retrieval time when an org owner/admin queries another member's post-join memory and is never accepted on writes. */
166
+ visibility?: 'private' | 'shared_with_users' | 'shared_with_org' | 'admin_visible';
167
+ /** User IDs this memory is shared with (only populated when visibility = 'shared_with_users') */
168
+ sharedWith?: string[];
169
+ /** Topics explicitly provided by the user */
170
+ userTopics?: string[];
171
+ /** Topics automatically extracted from content */
172
+ extractedTopics?: string[];
173
+ /** Entities extracted from memory content */
174
+ entities?: {
175
+ name: string;
176
+ type: string;
177
+ confidence?: number;
178
+ }[];
179
+ /** Task identifier for agentic loop memories */
180
+ taskId?: string | null;
181
+ /** Task outcome status */
182
+ outcome?: 'resolved' | 'unresolved' | null;
183
+ /** Attempt number within the task */
184
+ attemptNumber?: number | null;
185
+ /** Distillation pipeline stage status */
186
+ distillStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped' | null;
187
+ /** Reason distillation was skipped */
188
+ distillSkipReason?: 'global_disabled' | 'plan_excluded' | 'user_opt_out' | 'content_too_short' | 'legacy' | 'budget_exhausted' | null;
189
+ /** Error message if distillation failed */
190
+ distillError?: string | null;
191
+ /** ISO 8601 timestamp when distillation completed */
192
+ distillCompletedAt?: string | null;
193
+ }
194
+ /** Privileged-only short-circuit for Pipeline 1/2 — admin/internal/test callers may pre-supply summary, questions, and/or embeddings to bypass LLM and embedding work at create time. Silently ignored for non-privileged callers. */
195
+ interface PrecomputedMemoryFields {
196
+ /** Pre-computed memory summary. When supplied, summary-qna LLM call is skipped and m.summary is set inline. */
197
+ summary?: string;
198
+ /** Pre-computed anticipated questions. When supplied, the questions stage of the summary-qna LLM call is skipped and Question nodes are created inline. Hard-capped at 20. */
199
+ questions?: string[];
200
+ /** Pre-computed embeddings keyed by Pipeline 2 job kind (content / summary / question). */
201
+ embeddings?: {
202
+ content?: number[];
203
+ summary?: number[];
204
+ questions?: number[][];
205
+ };
206
+ }
207
+ interface CreateMemoryRequest {
208
+ /** Conversation ID - use "NEW" to always create a new conversation, provide an existing ID to append to it, or omit to auto-assign via claudeSessionId session grouping. */
209
+ conversationId?: string;
210
+ /** Agent session ID (e.g. MCP session ID, Claude Code session UUID). When conversationId is omitted, reuses or creates a conversation for this session (automatic grouping). Ignored when conversationId is explicitly provided. Works with any MCP client (Claude, Copilot, Cursor, etc.). */
211
+ claudeSessionId?: string;
212
+ /** Optional human-readable name for deterministic retrieval. Must be unique per user. */
213
+ name?: string;
214
+ /** Memory content */
215
+ content: string;
216
+ /** Type of memory */
217
+ memoryType?: 'episodic' | 'semantic' | 'procedural';
218
+ /** Role (MCP protocol compatibility) */
219
+ role?: 'user' | 'assistant' | 'system';
220
+ /** Context or domain */
221
+ context?: string;
222
+ /** Associated topics */
223
+ topics?: string[];
224
+ /** Event time (when the event actually occurred in reality, ISO 8601 format) */
225
+ eventTime?: string;
226
+ /** Validity start time (when this fact becomes valid, ISO 8601 format) */
227
+ validFrom?: string;
228
+ /** Validity end time (when this fact expires, ISO 8601 format, omit for never expires) */
229
+ validTo?: string;
230
+ codeContext?: {
231
+ product?: string;
232
+ repo?: string;
233
+ service?: string;
234
+ component?: string;
235
+ team?: string;
236
+ role?: string;
237
+ extra?: Record<string, unknown>;
238
+ };
239
+ /** Privileged-only short-circuit for Pipeline 1/2 — admin/internal/test callers may pre-supply summary, questions, and/or embeddings to bypass LLM and embedding work at create time. Silently ignored for non-privileged callers. */
240
+ precomputed?: PrecomputedMemoryFields;
241
+ /** Task identifier for grouping memories across agentic loop attempts */
242
+ taskId?: string;
243
+ /** Task outcome status for this memory */
244
+ outcome?: 'resolved' | 'unresolved';
245
+ /** Request distillation of this memory (Pro/Enterprise only) */
246
+ distill?: boolean;
247
+ }
248
+ interface UpdateMemoryRequest {
249
+ /** Updated memory content */
250
+ content?: string;
251
+ /** Assign or remove a name. Set to a valid name to assign, empty string to remove. */
252
+ name?: string | '';
253
+ /** Updated memory type */
254
+ memoryType?: 'episodic' | 'semantic' | 'procedural';
255
+ /** Updated context or domain */
256
+ context?: string;
257
+ /** Updated topics */
258
+ topics?: string[];
259
+ /** Task outcome status. Set to null to clear. */
260
+ outcome?: 'resolved' | 'unresolved' | null;
261
+ }
262
+ interface CreateMemoryResponseMeta {
263
+ /** Conversation ID (actual ID if "NEW" was provided) */
264
+ conversationId: string;
265
+ /** Auto-assigned session ID based on 90-minute gap detection */
266
+ sessionId: string;
267
+ /** Whether a new session was created (true) or existing session was reused (false) */
268
+ sessionCreated: boolean;
269
+ /** Whether a new conversation was created (true if conversationId was "NEW") */
270
+ conversationCreated: boolean;
271
+ }
272
+ /** Response from creating a memory, includes the memory and session/conversation metadata */
273
+ interface CreateMemoryResponse {
274
+ data: Memory;
275
+ meta: CreateMemoryResponseMeta;
276
+ }
277
+ interface RelatedMemoryResult {
278
+ memory: {
279
+ id: string;
280
+ name?: string;
281
+ version?: number;
282
+ content: string;
283
+ memoryType: 'episodic' | 'semantic' | 'procedural';
284
+ context?: string;
285
+ topics?: string[];
286
+ timestamp?: string;
287
+ eventTime?: string;
288
+ validFrom?: string;
289
+ validTo?: string | null;
290
+ codeContext?: CodeContext;
291
+ createdAt: string;
292
+ updatedAt: string;
293
+ confidenceScore?: number;
294
+ confidenceBasis?: 'direct-statement' | 'repeated-mention' | 'single-mention' | 'hedged' | 'inference' | 'external-source' | 'contradicted';
295
+ effectiveState?: 'current' | 'superseded' | 'contradicted' | 'duplicate';
296
+ authority?: 'directive' | 'decision' | 'observation' | 'auto-captured';
297
+ extractionStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
298
+ extractionCompletedAt?: string;
299
+ contentEmbeddingStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
300
+ summary?: string;
301
+ summaryStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
302
+ questionsStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
303
+ summaryEmbeddingStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
304
+ questionsEmbeddingStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
305
+ graphStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
306
+ graphSkipReason?: 'global_disabled' | 'plan_excluded' | 'user_opt_out' | 'content_too_short' | 'legacy' | 'budget_exhausted' | null;
307
+ extractionSkipReason?: 'global_disabled' | 'plan_excluded' | 'user_opt_out' | 'content_too_short' | 'legacy';
308
+ embeddingStatus?: 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
309
+ embeddingOpenaiStatus?: 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
310
+ embeddingTruncated?: boolean;
311
+ embeddingOriginalTokens?: number;
312
+ embeddingStrategy?: 'full' | 'head-truncated' | 'summary-selected' | 'question-selected';
313
+ extractedTopicCount?: number;
314
+ extractedFactCount?: number;
315
+ extractedEntityCount?: number;
316
+ conflictCount?: number;
317
+ visibility?: 'private' | 'shared_with_users' | 'shared_with_org' | 'admin_visible';
318
+ sharedWith?: string[];
319
+ userTopics?: string[];
320
+ extractedTopics?: string[];
321
+ entities?: {
322
+ name: string;
323
+ type: string;
324
+ confidence?: number;
325
+ }[];
326
+ taskId?: string | null;
327
+ outcome?: 'resolved' | 'unresolved' | null;
328
+ attemptNumber?: number | null;
329
+ distillStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped' | null;
330
+ distillSkipReason?: 'global_disabled' | 'plan_excluded' | 'user_opt_out' | 'content_too_short' | 'legacy' | 'budget_exhausted' | null;
331
+ distillError?: string | null;
332
+ distillCompletedAt?: string | null;
333
+ };
334
+ /** Relevance score (0-1). For similar: semantic similarity. For related: topic overlap ratio. For conversation: position score. */
335
+ score: number;
336
+ /** Type of relationship: similar, similar-by-topic, conversation, or topic */
337
+ relationship: string;
338
+ /** Topics shared with the source memory (only for topic relationship) */
339
+ sharedTopics?: string[];
340
+ }
341
+ /** Response from getting a memory by ID */
342
+ interface GetMemoryResponse {
343
+ data: Memory;
344
+ }
345
+ interface UpdateNamedMemoryRequest {
346
+ /** New content for the named memory version */
347
+ content: string;
348
+ /** Type of memory (defaults to previous version's type) */
349
+ memoryType?: 'episodic' | 'semantic' | 'procedural';
350
+ /** Context or domain */
351
+ context?: string;
352
+ /** Associated topics */
353
+ topics?: string[];
354
+ /** Conversation to group this version with (overrides previous version's conversation) */
355
+ conversationId?: string;
356
+ codeContext?: {
357
+ product?: string;
358
+ repo?: string;
359
+ service?: string;
360
+ component?: string;
361
+ team?: string;
362
+ role?: string;
363
+ extra?: Record<string, unknown>;
364
+ };
365
+ /** Additional memory ID that this version supersedes (beyond the implicit version chain) */
366
+ supersedes?: string;
367
+ }
368
+ interface NamedMemoryHistoryResponse {
369
+ /** Human-readable name for deterministic retrieval (kebab-case, 2-64 chars) */
370
+ name: string;
371
+ versions: Array<{
372
+ version: number;
373
+ id: string;
374
+ content: string;
375
+ effectiveState?: 'current' | 'superseded' | 'contradicted' | 'duplicate';
376
+ createdAt: string;
377
+ }>;
378
+ }
379
+ interface BatchGetMemoriesRequest {
380
+ /** Array of memory IDs to retrieve. Non-existent or malformed IDs are returned in the 'missing' array rather than failing the request. */
381
+ ids: string[];
382
+ /** Detail level for each memory. 'minimal' returns raw memory only (default, backward compatible). 'standard' adds topics, entities, facts, and relationships. 'full' additionally adds conversation context and relationship target previews. */
383
+ detail?: 'minimal' | 'standard' | 'full';
384
+ }
385
+ interface BatchGetMemoriesMeta {
386
+ /** Number of IDs requested */
387
+ requested: number;
388
+ /** Number of memories found */
389
+ found: number;
390
+ /** IDs that were not found */
391
+ missing: string[];
392
+ }
393
+ /** Response from batch memory retrieval */
394
+ interface BatchGetMemoriesResponse {
395
+ data: Memory[];
396
+ meta: BatchGetMemoriesMeta;
397
+ }
398
+ interface GraphRAGQueryRequest {
399
+ /** GraphRAG query string */
400
+ query: string;
401
+ /** Maximum graph traversal depth (alias: depth) */
402
+ maxDepth?: number;
403
+ /** Graph traversal depth (deprecated, use maxDepth) */
404
+ depth?: number;
405
+ /** Maximum number of results to return */
406
+ limit?: number;
407
+ /** Include relationship data in response */
408
+ includeRelationships?: boolean;
409
+ }
410
+ interface GraphRAGQueryResponse {
411
+ /** Unique identifier for this query execution */
412
+ queryId: string;
413
+ /** Array of query results with graph context */
414
+ results: {
415
+ memory: Memory;
416
+ score: number;
417
+ topics: Record<string, unknown>[];
418
+ entities: Record<string, unknown>[];
419
+ relatedMemories: Record<string, unknown>[];
420
+ }[];
421
+ /** Query execution metadata */
422
+ metadata: {
423
+ query: string;
424
+ depth: number;
425
+ limit: number;
426
+ timestamp: string;
427
+ };
428
+ }
429
+ interface Conversation {
430
+ /** Unique conversation identifier */
431
+ id: string;
432
+ /** Conversation title */
433
+ title: string;
434
+ /** Conversation summary */
435
+ summary: string | null;
436
+ /** Creation timestamp */
437
+ createdAt: string;
438
+ /** Last update timestamp */
439
+ updatedAt: string;
440
+ }
441
+ interface CreateConversationRequest {
442
+ /** Conversation title */
443
+ title: string;
444
+ /** Optional conversation summary */
445
+ summary?: string;
446
+ }
447
+ interface ApiKey {
448
+ /** Unique API key identifier */
449
+ id: string;
450
+ /** Human-readable label for the API key */
451
+ label: string;
452
+ /** API key prefix for identification */
453
+ prefix: string;
454
+ /** Creation timestamp */
455
+ createdAt: string;
456
+ /** Expiration timestamp (null if never expires) */
457
+ expiresAt: string | null;
458
+ /** Last usage timestamp (null if never used) */
459
+ lastUsedAt: string | null;
460
+ }
461
+ interface Topic {
462
+ /** Topic name */
463
+ name: string;
464
+ /** Number of memories associated with this topic */
465
+ count: number;
466
+ }
467
+ interface Pattern {
468
+ /** Unique pattern identifier */
469
+ id: string;
470
+ /** Pattern type */
471
+ type: string;
472
+ /** Pattern description */
473
+ description: string;
474
+ /** Confidence score (0-1) */
475
+ confidence: number;
476
+ }
477
+ interface CompileInstructionsRequest {
478
+ conversationContext?: string[];
479
+ currentQuery?: string;
480
+ tokenBudget?: number;
481
+ minConfidence?: number;
482
+ maxInstructions?: number;
483
+ }
484
+ interface CompileInstructionsResponse {
485
+ instructions: Array<{
486
+ patternId: string;
487
+ instruction: string;
488
+ confidence: number;
489
+ priority: number;
490
+ source: 'learned' | 'explicit' | 'manual';
491
+ patternType: string;
492
+ activatedBy: string[];
493
+ recommendationId?: string;
494
+ triggerContext?: string;
495
+ evidenceSummary?: string;
496
+ firstSurfacing?: boolean;
497
+ }>;
498
+ summary: string;
499
+ tokenCount: number;
500
+ patternsEvaluated: number;
501
+ patternsActivated: number;
502
+ conflictsResolved: {
503
+ winnerId: string;
504
+ loserId: string;
505
+ strategy: 'priority_override';
506
+ }[];
507
+ systemState?: 'ok' | 'cold_start' | 'pending_only' | 'no_match';
508
+ pendingCount?: number;
509
+ patternsExcluded?: number;
510
+ }
511
+ interface Recommendation {
512
+ id: string;
513
+ userId: string;
514
+ triggerContext: string;
515
+ practice: string;
516
+ evidenceSummary?: string;
517
+ source: 'explicit' | 'learned' | 'manual';
518
+ outcomeSignal: 'positive' | 'neutral' | 'unknown';
519
+ confidence: number;
520
+ evidenceMemoryIds?: string[];
521
+ triggerEmbeddingStatus: 'pending' | 'complete' | 'failed';
522
+ applicationCount: number;
523
+ provisional: boolean;
524
+ status: 'pending_review' | 'active' | 'paused' | 'dismissed' | 'superseded';
525
+ validFrom?: string;
526
+ validUntil?: string | null;
527
+ supersededBy?: string | null;
528
+ createdAt: string;
529
+ updatedAt: string;
530
+ }
531
+ interface CreateRecommendationRequest {
532
+ triggerContext: string;
533
+ practice: string;
534
+ evidenceSummary?: string;
535
+ outcomeSignal?: 'positive' | 'neutral' | 'unknown';
536
+ evidenceMemoryIds?: string[];
537
+ activateImmediately?: boolean;
538
+ }
539
+ interface MatchRecommendationsRequest {
540
+ content: string;
541
+ limit?: number;
542
+ similarityThreshold?: number;
543
+ }
544
+ interface ServiceCheck {
545
+ /** Service status */
546
+ status: 'up' | 'down';
547
+ /** Response time in milliseconds */
548
+ responseTime?: number;
549
+ }
550
+ interface HealthCheck {
551
+ /** Overall system health status */
552
+ status: 'healthy' | 'degraded' | 'unhealthy';
553
+ /** Health check timestamp */
554
+ timestamp: string;
555
+ /** API version */
556
+ version: string;
557
+ /** System uptime in seconds */
558
+ uptime: number;
559
+ /** Individual service health checks */
560
+ checks: Record<string, unknown>;
561
+ }
562
+ interface SearchRequest {
563
+ /** Search query. On POST all methods accept up to 32768 chars; the GET endpoint caps all methods at 2000 (use POST for larger queries). For queries over 2000 chars the keyword-matching side (the keyword method, and hybrid's fulltext/entity sub-branches) searches on a representative SAMPLE of the query's most salient terms rather than the whole text; the semantic branch still embeds the full query. Queries at or under 2000 chars are searched verbatim. */
564
+ query: string;
565
+ /** Content filtering mode (defaults to unified) */
566
+ mode?: 'unified' | 'content' | 'facts';
567
+ /** Search algorithm: hybrid (combined, default), semantic (vector), or keyword (fulltext). */
568
+ searchMethod?: 'keyword' | 'semantic' | 'hybrid';
569
+ /** Maximum number of results (defaults to 20) */
570
+ limit?: number;
571
+ /** Offset for pagination (defaults to 0) */
572
+ offset?: number;
573
+ /** Weight for vector (semantic) results in hybrid search (0-1, defaults to 0.7) */
574
+ vectorWeight?: number;
575
+ /** Weight for fulltext (keyword) results in hybrid search (0-1, defaults to 0.3) */
576
+ fulltextWeight?: number;
577
+ /** Minimum similarity threshold for semantic search (0-1, defaults to 0.5) */
578
+ threshold?: number;
579
+ /** If true, include detailed explanation of how each result was matched */
580
+ explain?: boolean;
581
+ /** Point-in-time query: show what the system knew at this time (ISO 8601 format) */
582
+ asOfTime?: string;
583
+ /** Validity query: show facts that were valid at this time (ISO 8601 format) */
584
+ validAtTime?: string;
585
+ /** Event time range start (ISO 8601 format) */
586
+ eventTimeFrom?: string;
587
+ /** Event time range end (ISO 8601 format) */
588
+ eventTimeTo?: string;
589
+ /** Ingestion time range start (ISO 8601 format) */
590
+ ingestionTimeFrom?: string;
591
+ /** Ingestion time range end (ISO 8601 format) */
592
+ ingestionTimeTo?: string;
593
+ /** Include expired facts (defaults to false) */
594
+ includeExpired?: boolean;
595
+ /** Temporal query mode: 'current' (only valid now), 'historical' (as of a point in time), 'evolution' (chronological) */
596
+ temporalMode?: 'current' | 'historical' | 'evolution';
597
+ /** Filter by topics - returns memories that have ANY of the specified topics */
598
+ topics?: string[];
599
+ /** Filter by memory type */
600
+ memoryType?: 'episodic' | 'semantic' | 'procedural';
601
+ /** Filter by conversation ID */
602
+ conversationId?: string;
603
+ /** Task-scoped retrieval: returns own-history first, fills remainder with cross-task results. */
604
+ taskId?: string;
605
+ /** Filter by task outcome. Use 'resolved' to find successful approaches from past tasks. */
606
+ outcomeFilter?: 'resolved' | 'unresolved' | 'any';
607
+ /** Include topics associated with matched memories (defaults to false for performance) */
608
+ includeTopics?: boolean;
609
+ /** Include entities mentioned in matched memories (defaults to false for performance) */
610
+ includeEntities?: boolean;
611
+ /** Include facts extracted from matched memories (defaults to false for performance) */
612
+ includeFacts?: boolean;
613
+ /** Include claims associated with matched memories (defaults to true) */
614
+ includeClaims?: boolean;
615
+ /** Filter entities by type (e.g., PERSON, TECHNOLOGY, PROJECT) */
616
+ entityTypes?: string[];
617
+ /** Enable entity graph traversal branch in hybrid search (default false) */
618
+ expandEntities?: boolean;
619
+ /** Enable topic graph traversal branch in hybrid search (default true) */
620
+ expandTopics?: boolean;
621
+ /** Enable fact graph traversal branch in hybrid search (default true) */
622
+ expandFacts?: boolean;
623
+ /** Include superseded and contradicted memories in results (default false) */
624
+ includeSuperseded?: boolean;
625
+ /** Weight for entity graph branch in hybrid search (0-1, default 0.1) */
626
+ entityWeight?: number;
627
+ /** Weight for topic graph branch in hybrid search (0-1, default 0.5) */
628
+ topicWeight?: number;
629
+ /** Weight for fact graph branch in hybrid search (0-1, default 0.6) */
630
+ factWeight?: number;
631
+ /** Weight for question graph branch in hybrid search (0-1) */
632
+ questionWeight?: number;
633
+ /** Weight for claims vector branch in hybrid search (0-1, default 0.5) */
634
+ claimsWeight?: number;
635
+ /** Field to sort results by (defaults to 'relevance' for search, 'createdAt' for list) */
636
+ sortBy?: 'relevance' | 'createdAt' | 'updatedAt' | 'eventTime';
637
+ /** Sort order: 'asc' or 'desc' (defaults to 'desc' for timestamps, 'desc' for relevance) */
638
+ order?: 'asc' | 'desc';
639
+ /** Include facet aggregation (topics, memoryType, effectiveState) in response (defaults to false) */
640
+ includeFacets?: boolean;
641
+ }
642
+ interface Entity {
643
+ /** Entity name */
644
+ name?: string;
645
+ /** Entity type */
646
+ type?: string;
647
+ }
648
+ interface SearchResult {
649
+ /** Unique memory identifier */
650
+ id: string;
651
+ /** Full memory content */
652
+ content: string;
653
+ /** Truncated content preview (max 200 chars) */
654
+ preview: string;
655
+ /** Optional human-readable name for deterministic retrieval */
656
+ name?: string | null;
657
+ /** Type of memory */
658
+ memoryType: 'episodic' | 'semantic' | 'procedural';
659
+ /** Associated topics */
660
+ topics?: string[];
661
+ /** Conversation this memory belongs to */
662
+ conversationId?: string | null;
663
+ /** System ingestion timestamp */
664
+ timestamp?: string;
665
+ /** Event time (when the event actually occurred) */
666
+ eventTime?: string;
667
+ /** Validity start time */
668
+ validFrom?: string;
669
+ /** Creation timestamp */
670
+ createdAt?: string;
671
+ /** Last update timestamp */
672
+ updatedAt?: string;
673
+ /** Effective state of the memory */
674
+ effectiveState?: string;
675
+ /** Confidence score (0-1) */
676
+ confidenceScore?: number;
677
+ /** Overall relevance score for this result */
678
+ score?: number | null;
679
+ /** Entities mentioned in this memory */
680
+ entities?: Entity[];
681
+ /** Facts extracted from this memory */
682
+ facts?: {
683
+ subject: string;
684
+ predicate: string;
685
+ object: string;
686
+ confidence?: number;
687
+ }[];
688
+ /** Combined RRF score for hybrid search */
689
+ hybridScore?: number | null;
690
+ /** Vector similarity score (0-1) */
691
+ vectorScore?: number;
692
+ /** Rank in vector search results */
693
+ vectorRank?: number | null;
694
+ /** Fulltext search score */
695
+ fulltextScore?: number;
696
+ /** Rank in fulltext search results */
697
+ fulltextRank?: number | null;
698
+ /** Search branches that contributed to this result (e.g. ['semantic', 'entity']) */
699
+ matchedVia?: string[];
700
+ /** Per-branch RRF scores for this result */
701
+ branchScores?: Record<string, unknown>;
702
+ /** Raw cross-encoder rerank score; present only when the reranker reordered this request's top-K (null otherwise) */
703
+ rerankScore?: number | null;
704
+ /** Detailed explanation of the match (only when explain=true) */
705
+ explanation?: {
706
+ matchReason: string;
707
+ matchedTerms?: string[];
708
+ semanticSimilarity?: number;
709
+ contributingFactors?: string[];
710
+ };
711
+ }
712
+ /** Temporal query metadata (present when temporal filters are used) */
713
+ interface TemporalMetadata {
714
+ /** Temporal query mode used */
715
+ temporalMode: string;
716
+ /** Point-in-time timestamp */
717
+ asOfTime: string | null;
718
+ /** Validity timestamp */
719
+ validAtTime: string | null;
720
+ /** Event time range filter */
721
+ eventTimeRange: {
722
+ from: string | null;
723
+ to: string | null;
724
+ } | null;
725
+ /** Ingestion time range filter */
726
+ ingestionTimeRange: {
727
+ from: string | null;
728
+ to: string | null;
729
+ } | null;
730
+ /** Whether expired facts are included */
731
+ includeExpired: boolean;
732
+ /** Whether temporal fields are included in results */
733
+ temporalFieldsIncluded: boolean;
734
+ }
735
+ /** Search metadata including pagination, timing, and method */
736
+ interface SearchMeta {
737
+ /** Total number of results matching the query */
738
+ total: number;
739
+ /** Current page number (1-based) */
740
+ page: number;
741
+ /** Number of results per page */
742
+ pageSize: number;
743
+ /** Search duration in milliseconds */
744
+ searchTime: number;
745
+ /** Search method used for this query */
746
+ searchMethod: string;
747
+ /** Temporal query metadata (present when temporal filters are used) */
748
+ temporalMetadata?: TemporalMetadata;
749
+ }
750
+ interface FacetEntry {
751
+ /** Facet value */
752
+ value: string;
753
+ /** Number of results with this value */
754
+ count: number;
755
+ }
756
+ /** Facet aggregations (only present when includeFacets=true) */
757
+ interface Facets {
758
+ /** Topic facet counts (top 20 by frequency) */
759
+ topics: FacetEntry[];
760
+ /** Memory type facet counts */
761
+ memoryType: FacetEntry[];
762
+ /** Effective state facet counts */
763
+ effectiveState: FacetEntry[];
764
+ }
765
+ interface ClaimGroupClaim {
766
+ /** Claim ID */
767
+ id: string;
768
+ /** Claim content text */
769
+ content: string;
770
+ /** Memory this claim was extracted from */
771
+ memoryId: string;
772
+ /** Claim creation timestamp */
773
+ createdAt: string;
774
+ /** When the claimed event occurred */
775
+ occurredStart?: string;
776
+ }
777
+ /** Computed signals about the claim cluster */
778
+ interface ClaimGroupSignals {
779
+ /** Number of claims in this group */
780
+ n_claims: number;
781
+ /** Minimum LLM-judged alignment score among all pairs in the group (0=conflict, 1=corroborate) */
782
+ alignment_min: number;
783
+ /** Days between earliest and latest claim in the group */
784
+ temporal_spread_days: number;
785
+ /** True if alignment_min < 0.85, indicating potential conflict */
786
+ has_low_alignment_pair: boolean;
787
+ /** True if alignment_min < 0.4 — claims directly conflict or one supersedes the other */
788
+ has_conflict: boolean;
789
+ /** True if temporal_spread_days > 30 */
790
+ has_temporal_spread: boolean;
791
+ }
792
+ interface ClaimGroup {
793
+ /** Deterministic group ID */
794
+ id: string;
795
+ /** Claims in this group, sorted by createdAt descending (newest first) */
796
+ claims: ClaimGroupClaim[];
797
+ /** Computed signals about the claim cluster */
798
+ signals: ClaimGroupSignals;
799
+ }
800
+ interface SearchResponse {
801
+ /** Flattened search results with memory fields and search metadata */
802
+ data: SearchResult[];
803
+ /** Search metadata including pagination, timing, and method */
804
+ meta: SearchMeta;
805
+ /** Facet aggregations (only present when includeFacets=true) */
806
+ facets?: Facets;
807
+ /** Reader instructions for interpreting claims and resolving conflicts */
808
+ instructions?: string;
809
+ /** Clusters of related claims that may conflict. Only present when relevant groups exist. Claims within each group are sorted newest-first. */
810
+ claim_groups?: ClaimGroup[];
811
+ }
812
+ interface Fact {
813
+ /** Unique identifier for the fact */
814
+ id: string;
815
+ /** User ID who owns this fact */
816
+ userId: string;
817
+ /** The subject of the fact (what the fact is about) */
818
+ subject: string;
819
+ /** The relationship or property type */
820
+ predicate: string;
821
+ /** The value or target of the relationship */
822
+ object: string;
823
+ /** Fact name/label (deprecated, use subject) */
824
+ name?: string;
825
+ /** Entity type (deprecated, use predicate) */
826
+ type?: string;
827
+ /** Fact description (deprecated) */
828
+ description?: string | null;
829
+ /** Confidence score (0-1) */
830
+ confidence?: number;
831
+ /** ID of the memory this fact was extracted from */
832
+ sourceMemoryId?: string;
833
+ /** When this fact was extracted */
834
+ extractedAt?: string;
835
+ /** Creation timestamp */
836
+ createdAt: string;
837
+ /** Last update timestamp */
838
+ updatedAt: string;
839
+ }
840
+ interface CreateFactRequest {
841
+ /** Fact subject (entity name) */
842
+ subject: string;
843
+ /** Relationship type */
844
+ predicate: string;
845
+ /** Fact object (related entity) */
846
+ object: string;
847
+ }
848
+ interface UpdateFactRequest {
849
+ /** Fact subject (entity name) */
850
+ subject?: string;
851
+ /** Relationship type */
852
+ predicate?: string;
853
+ /** Fact object (related entity) */
854
+ object?: string;
855
+ /** Confidence score (0-1) */
856
+ confidence?: number;
857
+ }
858
+ interface FactSearchRequest {
859
+ /** Search query string */
860
+ query: string;
861
+ /** Maximum number of results to return */
862
+ limit?: number;
863
+ }
864
+ interface Community {
865
+ /** Unique identifier for the community */
866
+ id: string;
867
+ /** Community name */
868
+ name: string;
869
+ /** Community description */
870
+ description?: string | null;
871
+ /** Number of topics in this community */
872
+ topicCount?: number;
873
+ /** Creation timestamp */
874
+ createdAt: string;
875
+ /** Last update timestamp */
876
+ updatedAt: string;
877
+ }
878
+ interface EntityNode {
879
+ /** Unique identifier for the entity */
880
+ id: string;
881
+ /** User ID who owns this entity */
882
+ userId: string;
883
+ /** Entity display name */
884
+ name: string;
885
+ /** Normalized (lowercase) name for deduplication */
886
+ normalizedName: string;
887
+ /** Entity type classification (v2: PERSON, ORGANIZATION, CONCEPT; legacy types accepted) */
888
+ type: 'PERSON' | 'ORGANIZATION' | 'CONCEPT' | 'PROJECT' | 'TECHNOLOGY' | 'COMPONENT' | 'API_ENDPOINT' | 'FILE' | 'LOCATION';
889
+ /** Alternative names for this entity */
890
+ aliases?: string[];
891
+ /** Extraction confidence score (0-1) */
892
+ confidence: number;
893
+ /** When this entity was first extracted */
894
+ firstSeenAt: string;
895
+ /** When this entity was most recently seen */
896
+ lastSeenAt: string;
897
+ /** Number of memories that mention this entity */
898
+ mentionCount: number;
899
+ /** Creation timestamp */
900
+ createdAt: string;
901
+ /** Last update timestamp */
902
+ updatedAt: string;
903
+ }
904
+ interface Artifact {
905
+ /** Unique identifier for the artifact */
906
+ id: string;
907
+ /** User ID who owns this artifact */
908
+ userId: string;
909
+ /** Artifact content */
910
+ content: string;
911
+ /** Artifact type (e.g., note, document, code) */
912
+ type: string;
913
+ /** Artifact name */
914
+ name?: string | null;
915
+ /** Artifact description */
916
+ description?: string | null;
917
+ /** Associated memory ID */
918
+ memoryId?: string | null;
919
+ /** Associated conversation ID */
920
+ conversationId?: string | null;
921
+ /** Additional metadata */
922
+ metadata?: Record<string, unknown>;
923
+ /** Creation timestamp */
924
+ createdAt: string;
925
+ /** Last update timestamp */
926
+ updatedAt: string;
927
+ }
928
+ interface CreateArtifactRequest {
929
+ /** Artifact content */
930
+ content: string;
931
+ /** Artifact type (e.g., note, document, code) */
932
+ type: string;
933
+ /** Artifact name */
934
+ name?: string;
935
+ /** Artifact description */
936
+ description?: string;
937
+ /** Associated memory ID */
938
+ memoryId?: string;
939
+ /** Associated conversation ID */
940
+ conversationId?: string;
941
+ /** Additional metadata */
942
+ metadata?: Record<string, unknown>;
943
+ }
944
+ interface UpdateArtifactRequest {
945
+ /** Artifact content */
946
+ content?: string;
947
+ /** Artifact type (e.g., note, document, code) */
948
+ type?: string;
949
+ /** Artifact name */
950
+ name?: string;
951
+ /** Artifact description */
952
+ description?: string;
953
+ /** Additional metadata */
954
+ metadata?: Record<string, unknown>;
955
+ }
956
+ interface MemoryRelationship {
957
+ /** Unique relationship identifier */
958
+ id: string;
959
+ /** ID of the source memory (the memory that has the relationship) */
960
+ sourceMemoryId: string;
961
+ /** ID of the target memory (the memory being related to) */
962
+ targetMemoryId: string;
963
+ /** Type of relationship between memories */
964
+ type: 'SUPERSEDES' | 'FOLLOWS' | 'RESOLVES' | 'CONTRADICTS' | 'REFERENCES' | 'DUPLICATES';
965
+ /** Confidence score for the relationship (0-1) */
966
+ confidence: number;
967
+ /** How the relationship was created */
968
+ creationMethod: 'manual' | 'auto-semantic' | 'auto-temporal' | 'auto-llm';
969
+ /** Human-readable explanation for why this relationship exists */
970
+ reason?: string;
971
+ /** When the relationship was created */
972
+ createdAt: string;
973
+ }
974
+ interface CreateMemoryRelationshipRequest {
975
+ /** ID of the target memory to create a relationship with */
976
+ targetMemoryId: string;
977
+ /** Type of relationship between memories */
978
+ type: 'SUPERSEDES' | 'FOLLOWS' | 'RESOLVES' | 'CONTRADICTS' | 'REFERENCES' | 'DUPLICATES';
979
+ /** Confidence score for the relationship (0-1, defaults to 1.0 for manual) */
980
+ confidence?: number;
981
+ /** Optional explanation for the relationship */
982
+ reason?: string;
983
+ }
984
+ interface MemoryRelationshipsResponse {
985
+ data: MemoryRelationship[];
986
+ /** The source memory ID these relationships are for */
987
+ sourceMemoryId: string;
988
+ /** Direction of relationships returned */
989
+ direction: 'outgoing' | 'incoming' | 'both';
990
+ }
991
+ interface NarrativeThread {
992
+ /** Unique narrative thread identifier */
993
+ id: string;
994
+ /** User ID who owns this narrative */
995
+ userId: string;
996
+ /** Title describing the narrative thread */
997
+ title: string;
998
+ /** Current state of the narrative thread */
999
+ state: 'open' | 'resolved' | 'reopened' | 'superseded';
1000
+ /** ID of the first memory in this narrative */
1001
+ rootMemoryId: string;
1002
+ /** ID of the most recent memory in this narrative */
1003
+ currentMemoryId?: string;
1004
+ /** ID of the memory that resolved this narrative (if resolved) */
1005
+ resolutionMemoryId?: string;
1006
+ /** Topics associated with this narrative */
1007
+ topics: string[];
1008
+ /** Number of memories in this narrative */
1009
+ memoryCount: number;
1010
+ /** When the narrative was created */
1011
+ createdAt: string;
1012
+ /** When the narrative was last updated */
1013
+ updatedAt: string;
1014
+ }
1015
+ interface CreateNarrativeRequest {
1016
+ /** Title for the narrative thread */
1017
+ title: string;
1018
+ /** ID of the first memory in this narrative */
1019
+ rootMemoryId: string;
1020
+ /** Topics to associate with this narrative */
1021
+ topics?: string[];
1022
+ }
1023
+ interface UpdateNarrativeRequest {
1024
+ /** Updated title for the narrative */
1025
+ title?: string;
1026
+ /** Current state of the narrative thread */
1027
+ state?: 'open' | 'resolved' | 'reopened' | 'superseded';
1028
+ /** ID of the memory that resolves this narrative */
1029
+ resolutionMemoryId?: string;
1030
+ /** Updated topics for the narrative */
1031
+ topics?: string[];
1032
+ }
1033
+ interface AddMemoryToNarrativeRequest {
1034
+ /** ID of the memory to add to the narrative */
1035
+ memoryId: string;
1036
+ /** Position in the narrative (0-indexed, omit for append) */
1037
+ position?: number;
1038
+ }
1039
+ interface NarrativeMemory {
1040
+ memory: {
1041
+ id: string;
1042
+ name?: string;
1043
+ version?: number;
1044
+ content: string;
1045
+ memoryType: 'episodic' | 'semantic' | 'procedural';
1046
+ context?: string;
1047
+ topics?: string[];
1048
+ timestamp?: string;
1049
+ eventTime?: string;
1050
+ validFrom?: string;
1051
+ validTo?: string | null;
1052
+ codeContext?: CodeContext;
1053
+ createdAt: string;
1054
+ updatedAt: string;
1055
+ confidenceScore?: number;
1056
+ confidenceBasis?: 'direct-statement' | 'repeated-mention' | 'single-mention' | 'hedged' | 'inference' | 'external-source' | 'contradicted';
1057
+ effectiveState?: 'current' | 'superseded' | 'contradicted' | 'duplicate';
1058
+ authority?: 'directive' | 'decision' | 'observation' | 'auto-captured';
1059
+ extractionStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
1060
+ extractionCompletedAt?: string;
1061
+ contentEmbeddingStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
1062
+ summary?: string;
1063
+ summaryStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
1064
+ questionsStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
1065
+ summaryEmbeddingStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
1066
+ questionsEmbeddingStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
1067
+ graphStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
1068
+ graphSkipReason?: 'global_disabled' | 'plan_excluded' | 'user_opt_out' | 'content_too_short' | 'legacy' | 'budget_exhausted' | null;
1069
+ extractionSkipReason?: 'global_disabled' | 'plan_excluded' | 'user_opt_out' | 'content_too_short' | 'legacy';
1070
+ embeddingStatus?: 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
1071
+ embeddingOpenaiStatus?: 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
1072
+ embeddingTruncated?: boolean;
1073
+ embeddingOriginalTokens?: number;
1074
+ embeddingStrategy?: 'full' | 'head-truncated' | 'summary-selected' | 'question-selected';
1075
+ extractedTopicCount?: number;
1076
+ extractedFactCount?: number;
1077
+ extractedEntityCount?: number;
1078
+ conflictCount?: number;
1079
+ visibility?: 'private' | 'shared_with_users' | 'shared_with_org' | 'admin_visible';
1080
+ sharedWith?: string[];
1081
+ userTopics?: string[];
1082
+ extractedTopics?: string[];
1083
+ entities?: {
1084
+ name: string;
1085
+ type: string;
1086
+ confidence?: number;
1087
+ }[];
1088
+ taskId?: string | null;
1089
+ outcome?: 'resolved' | 'unresolved' | null;
1090
+ attemptNumber?: number | null;
1091
+ distillStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped' | null;
1092
+ distillSkipReason?: 'global_disabled' | 'plan_excluded' | 'user_opt_out' | 'content_too_short' | 'legacy' | 'budget_exhausted' | null;
1093
+ distillError?: string | null;
1094
+ distillCompletedAt?: string | null;
1095
+ };
1096
+ /** Position of this memory in the narrative (0-indexed) */
1097
+ position: number;
1098
+ /** Effective state of this memory in the narrative context */
1099
+ effectiveState?: 'current' | 'superseded' | 'contradicted';
1100
+ }
1101
+ interface NarrativeTimelineResponse {
1102
+ data: NarrativeMemory[];
1103
+ narrative: NarrativeThread;
1104
+ pagination: {
1105
+ limit: number;
1106
+ offset: number;
1107
+ total: number;
1108
+ };
1109
+ }
1110
+ interface GetNarrativeResponse {
1111
+ data: NarrativeThread;
1112
+ }
1113
+ interface ListNarrativesResponse {
1114
+ data: NarrativeThread[];
1115
+ pagination: {
1116
+ limit: number;
1117
+ offset: number;
1118
+ count: number;
1119
+ };
1120
+ }
1121
+ interface User {
1122
+ id: string;
1123
+ email: string;
1124
+ firstName: string | null;
1125
+ lastName: string | null;
1126
+ profilePictureUrl: string | null;
1127
+ status: 'active' | 'suspended' | 'disabled';
1128
+ plan: 'free' | 'pro' | 'enterprise';
1129
+ memoryLimit: number;
1130
+ retentionDays: number | null;
1131
+ isTestUser: boolean;
1132
+ isPreviewUser: boolean;
1133
+ isInternalUser: boolean;
1134
+ deletionStatus: 'none' | 'pending_deletion' | 'deleting' | 'deleted' | 'deletion_failed';
1135
+ deletionScheduledFor: string | null;
1136
+ createdAt: string;
1137
+ updatedAt: string;
1138
+ }
1139
+ interface UserUsage {
1140
+ memoriesUsed: number;
1141
+ memoryLimit: number;
1142
+ memoriesRemaining: number;
1143
+ percentUsed: number;
1144
+ plan: 'free' | 'pro' | 'enterprise';
1145
+ periodStart: string;
1146
+ periodEnd: string;
1147
+ }
1148
+ interface Subscription {
1149
+ /** Stripe subscription ID */
1150
+ id: string;
1151
+ /** Current subscription status */
1152
+ status: 'active' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'past_due' | 'paused' | 'trialing' | 'unpaid';
1153
+ /** Plan type */
1154
+ plan: 'free' | 'pro' | 'enterprise';
1155
+ /** Current period start date */
1156
+ currentPeriodStart: string;
1157
+ /** Current period end date */
1158
+ currentPeriodEnd: string;
1159
+ /** Whether subscription cancels at period end */
1160
+ cancelAtPeriodEnd: boolean;
1161
+ /** When subscription was canceled */
1162
+ canceledAt: string | null;
1163
+ }
1164
+ interface Invoice {
1165
+ /** Stripe invoice ID */
1166
+ id: string;
1167
+ /** Invoice number */
1168
+ number: string | null;
1169
+ /** Invoice status */
1170
+ status: 'draft' | 'open' | 'paid' | 'uncollectible' | 'void';
1171
+ /** Amount due in cents */
1172
+ amountDue: number;
1173
+ /** Amount paid in cents */
1174
+ amountPaid: number;
1175
+ /** Three-letter ISO currency code */
1176
+ currency: string;
1177
+ /** Start of billing period */
1178
+ periodStart: string;
1179
+ /** End of billing period */
1180
+ periodEnd: string;
1181
+ /** When invoice was created */
1182
+ created: string;
1183
+ /** URL to view invoice */
1184
+ hostedInvoiceUrl: string | null;
1185
+ /** URL to download invoice PDF */
1186
+ invoicePdf: string | null;
1187
+ }
1188
+ interface PaymentMethod {
1189
+ /** Stripe payment method ID */
1190
+ id: string;
1191
+ /** Payment method type (card, etc.) */
1192
+ type: string;
1193
+ /** Card details if type is card */
1194
+ card: {
1195
+ brand: string;
1196
+ last4: string;
1197
+ expMonth: number;
1198
+ expYear: number;
1199
+ } | null;
1200
+ /** Whether this is the default payment method */
1201
+ isDefault: boolean;
1202
+ }
1203
+ interface BillingOverview {
1204
+ subscription: {
1205
+ id: string;
1206
+ status: 'active' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'past_due' | 'paused' | 'trialing' | 'unpaid';
1207
+ plan: 'free' | 'pro' | 'enterprise';
1208
+ currentPeriodStart: string;
1209
+ currentPeriodEnd: string;
1210
+ cancelAtPeriodEnd: boolean;
1211
+ canceledAt: string | null;
1212
+ };
1213
+ defaultPaymentMethod: {
1214
+ id: string;
1215
+ type: string;
1216
+ card: {
1217
+ brand: string;
1218
+ last4: string;
1219
+ expMonth: number;
1220
+ expYear: number;
1221
+ } | null;
1222
+ isDefault: boolean;
1223
+ };
1224
+ /** Upcoming invoice preview */
1225
+ upcomingInvoice: {
1226
+ amountDue: number;
1227
+ currency: string;
1228
+ periodEnd: string;
1229
+ } | null;
1230
+ }
1231
+ interface CreateCheckoutSessionRequest {
1232
+ /** Stripe price ID (defaults to Pro price) */
1233
+ priceId?: string;
1234
+ /** URL to redirect after successful checkout */
1235
+ successUrl: string;
1236
+ /** URL to redirect if checkout is canceled */
1237
+ cancelUrl: string;
1238
+ }
1239
+ interface CheckoutSessionResponse {
1240
+ /** Stripe checkout session ID */
1241
+ sessionId: string;
1242
+ /** URL to redirect user to Stripe checkout */
1243
+ url: string;
1244
+ }
1245
+ interface CreatePortalSessionRequest {
1246
+ /** URL to redirect after leaving the portal */
1247
+ returnUrl: string;
1248
+ }
1249
+ interface PortalSessionResponse {
1250
+ /** URL to redirect user to Stripe billing portal */
1251
+ url: string;
1252
+ }
1253
+ interface ListInvoicesResponse {
1254
+ /** List of invoices */
1255
+ data: Invoice[];
1256
+ /** Whether there are more invoices */
1257
+ hasMore: boolean;
1258
+ }
1259
+ interface ListPaymentMethodsResponse {
1260
+ /** List of payment methods */
1261
+ data: PaymentMethod[];
1262
+ }
1263
+ interface DigestRequest {
1264
+ /** The topic or subject to generate a digest for */
1265
+ query: string;
1266
+ /** Time window filter (e.g., "7d", "24h", "2w", "30m"). Only considers memories within this window. */
1267
+ recent?: string;
1268
+ /** Filter to memories with these topics */
1269
+ topics?: string[];
1270
+ /** Limit to specific conversation IDs */
1271
+ conversationIds?: string[];
1272
+ /** Output format: "structured" (sections with headers), "narrative" (chronological prose), "timeline" (dated event list), "status-report" (done/in-progress/blocked) */
1273
+ format?: 'structured' | 'narrative' | 'timeline' | 'status-report';
1274
+ /** Maximum number of memories to consider (1-500, default 100) */
1275
+ maxSources?: number;
1276
+ /** Whether to include source memory IDs in the response */
1277
+ includeMemoryIds?: boolean;
1278
+ /** Number of most-recent matching memories to return VERBATIM (full stored content, untouched) in `recentMemories`, instead of synthesizing them into `digest`. The remaining (older) memories are still synthesized into `digest` as usual. Recency is determined by event time when present, else system timestamp, else creation time. Default 0 = current behavior (synthesize all memories, `recentMemories` empty). When the total matched count is <= verbatimRecent, all matches are returned in `recentMemories` and `digest` is an empty string (no older memories to synthesize). Range 0-50. */
1279
+ verbatimRecent?: number;
1280
+ }
1281
+ /** Time range of the source memories (null if no sources found) */
1282
+ interface DigestTimeRange {
1283
+ /** Earliest memory timestamp in the digest sources */
1284
+ earliest: string;
1285
+ /** Latest memory timestamp in the digest sources */
1286
+ latest: string;
1287
+ }
1288
+ /** Generation metadata including source statistics */
1289
+ interface DigestMetadata {
1290
+ /** The query used to generate the digest */
1291
+ query: string;
1292
+ /** Total number of memories gathered (search + expansion) before synthesis */
1293
+ sourcesConsidered: number;
1294
+ /** Number of memories fed into the synthesis step */
1295
+ sourcesUsed: number;
1296
+ /** Number of distinct conversations the sources come from */
1297
+ conversationsSpanned: number;
1298
+ /** Time range of the source memories (null if no sources found) */
1299
+ timeRange: DigestTimeRange;
1300
+ /** Output format used for this digest */
1301
+ format: 'structured' | 'narrative' | 'timeline' | 'status-report';
1302
+ /** Average relevance score (0-1) of the source memories used in synthesis. Low values (<0.02) indicate the query may not have strong matches. */
1303
+ averageRelevance?: number;
1304
+ /** True when averageRelevance falls in the narrow-window band (>= DIGEST_RELEVANCE_THRESHOLD but < NARROW_WINDOW_FALLBACK_CEILING) — the digest synthesised from weak matches that may not represent strong context. Consumers should surface a warning to the calling agent. */
1305
+ narrowWindowFallback?: boolean;
1306
+ /** True when the digest is in the narrow-window band AND the source memories span 2+ distinct codeContext.product values (or none share a product). Indicates the synthesis is drawn from heterogeneous, possibly cross-project sources — likely the wrong project for the calling agent. See support#183. */
1307
+ crossProjectFallback?: boolean;
1308
+ /** ISO 8601 timestamp when the digest was generated */
1309
+ generatedAt: string;
1310
+ /** Recursion stats (only present when recursive synthesis is used) */
1311
+ recursion?: {
1312
+ enabled: boolean;
1313
+ leafGroups: number;
1314
+ llmCallsUsed: number;
1315
+ maxDepthReached: number;
1316
+ };
1317
+ }
1318
+ interface DigestSource {
1319
+ /** Source memory ID */
1320
+ memoryId: string;
1321
+ /** Relevance score (0-1) for this source memory */
1322
+ relevance: number;
1323
+ /** Conversation ID this memory belongs to */
1324
+ conversation?: string;
1325
+ }
1326
+ interface DigestKeyFact {
1327
+ /** Fact subject */
1328
+ subject: string;
1329
+ /** Relationship type */
1330
+ predicate: string;
1331
+ /** Fact value */
1332
+ object: string;
1333
+ /** Confidence score */
1334
+ confidence: number;
1335
+ }
1336
+ interface DigestEntity {
1337
+ /** Entity name */
1338
+ name: string;
1339
+ /** Entity type */
1340
+ type: string;
1341
+ }
1342
+ /** Breakdown of source memories by effective state (current/superseded/contradicted) */
1343
+ interface EffectiveStateBreakdown {
1344
+ /** Active memories used in synthesis */
1345
+ current: number;
1346
+ /** Superseded memories (deprioritized in synthesis) */
1347
+ superseded: number;
1348
+ /** Contradicted memories (deprioritized in synthesis) */
1349
+ contradicted: number;
1350
+ }
1351
+ interface DigestResponse {
1352
+ /** The generated digest content (markdown formatted) */
1353
+ digest: string;
1354
+ /** Generation metadata including source statistics */
1355
+ metadata: DigestMetadata;
1356
+ /** Source memories used to generate the digest, for traceability */
1357
+ sources: DigestSource[];
1358
+ /** The N most-recent matching memories returned VERBATIM (full stored content, untouched), where N = the request's verbatimRecent. Ordered newest-first. Empty/omitted when verbatimRecent is 0 (the default). These memories are NOT synthesized into `digest` — the synthesis covers only the older remainder. Lets callers preserve the exact structure of recent items (per-item status, identifiers, next-step) while still condensing the older tail. */
1359
+ recentMemories?: Memory[];
1360
+ /** Top extracted facts relevant to the digest, deduplicated and ranked by frequency */
1361
+ keyFacts?: DigestKeyFact[];
1362
+ /** Key entities mentioned across source memories */
1363
+ entities?: DigestEntity[];
1364
+ /** Breakdown of source memories by effective state (current/superseded/contradicted) */
1365
+ effectiveStateBreakdown?: EffectiveStateBreakdown;
1366
+ }
1367
+ interface ExportRequest {
1368
+ /** Optional search query to filter memories for export */
1369
+ query?: string;
1370
+ /** Filter by topics */
1371
+ topics?: string[];
1372
+ /** Filter by memory type */
1373
+ memoryType?: 'episodic' | 'semantic' | 'procedural';
1374
+ /** Export format: json or csv (default: json) */
1375
+ format?: 'json' | 'csv';
1376
+ /** Optional field selection. If omitted, all standard fields are included. */
1377
+ fields?: string[];
1378
+ /** Maximum results to export (default 100, max 1000) */
1379
+ limit?: number;
1380
+ }
1381
+ interface BulkUpdateRequest {
1382
+ /** Memory IDs to update (max 100) */
1383
+ ids: string[];
1384
+ /** Fields to update on all specified memories */
1385
+ updates: {
1386
+ topics?: string[];
1387
+ memoryType?: 'episodic' | 'semantic' | 'procedural';
1388
+ };
1389
+ }
1390
+ interface BulkUpdateResponse {
1391
+ /** Number of memories successfully updated */
1392
+ updated: number;
1393
+ /** Number of memories that failed to update */
1394
+ failed: number;
1395
+ /** Per-item error details */
1396
+ errors: {
1397
+ id: string;
1398
+ error: string;
1399
+ }[];
1400
+ }
1401
+ interface BulkDeleteRequest {
1402
+ /** Memory IDs to delete (max 100) */
1403
+ ids: string[];
1404
+ /** Must be true to confirm bulk deletion */
1405
+ confirmDeletion: true;
1406
+ }
1407
+ interface BulkDeleteResponse {
1408
+ /** Number of memories successfully deleted */
1409
+ deleted: number;
1410
+ /** Number of memories that failed to delete */
1411
+ failed: number;
1412
+ /** Per-item error details */
1413
+ errors: {
1414
+ id: string;
1415
+ error: string;
1416
+ }[];
1417
+ }
1418
+ interface BulkTagRequest {
1419
+ /** Memory IDs to modify tags on (max 100) */
1420
+ ids: string[];
1421
+ /** Topics to add to all specified memories */
1422
+ addTopics?: string[];
1423
+ /** Topics to remove from all specified memories */
1424
+ removeTopics?: string[];
1425
+ }
1426
+ interface BulkTagResponse {
1427
+ /** Number of memories successfully modified */
1428
+ modified: number;
1429
+ /** Number of memories that failed to modify */
1430
+ failed: number;
1431
+ /** Per-item error details */
1432
+ errors: {
1433
+ id: string;
1434
+ error: string;
1435
+ }[];
1436
+ }
1437
+ interface BuildContextRequest {
1438
+ /** What you are about to work on */
1439
+ context: string;
1440
+ /** File paths you will be touching */
1441
+ files?: string[];
1442
+ /** How far back to look for recent activity (hours, default 24) */
1443
+ recentHours?: number;
1444
+ }
1445
+ /** Most relevant active conversation, or null if none found */
1446
+ interface BuildContextActiveWork {
1447
+ /** Conversation ID */
1448
+ conversationId: string;
1449
+ /** Conversation title */
1450
+ title: string | null;
1451
+ /** ISO 8601 timestamp of last activity */
1452
+ lastActivity: string;
1453
+ /** Most recent memory in this conversation */
1454
+ lastMemory: {
1455
+ id: string;
1456
+ summary: string;
1457
+ };
1458
+ }
1459
+ interface BuildContextFact {
1460
+ /** Fact subject */
1461
+ subject: string;
1462
+ /** Fact predicate */
1463
+ predicate: string;
1464
+ /** Fact object */
1465
+ object: string;
1466
+ /** Confidence score (0-1) */
1467
+ confidence: number;
1468
+ /** Memory this fact was extracted from */
1469
+ sourceMemoryId: string;
1470
+ }
1471
+ interface BuildContextGotcha {
1472
+ /** The gotcha fact text */
1473
+ fact: string;
1474
+ /** Number of distinct source memories mentioning this */
1475
+ sourceCount: number;
1476
+ /** Source memory IDs */
1477
+ sourceMemories: string[];
1478
+ /** ISO 8601 timestamp of most recent source */
1479
+ lastSeen: string;
1480
+ }
1481
+ interface BuildContextActivity {
1482
+ /** Memory ID */
1483
+ id: string;
1484
+ /** Truncated content summary (max 200 chars) */
1485
+ summary: string;
1486
+ /** ISO 8601 timestamp */
1487
+ date: string;
1488
+ /** Conversation ID */
1489
+ conversationId: string | null;
1490
+ }
1491
+ interface BuildContextPattern {
1492
+ /** Pattern description */
1493
+ pattern: string;
1494
+ /** Confidence score (0-1) */
1495
+ confidence: number;
1496
+ }
1497
+ /** Request metadata for transparency */
1498
+ interface BuildContextMeta {
1499
+ /** Search terms extracted from the context and files */
1500
+ contextTerms: string[];
1501
+ /** Hours window used for recent activity */
1502
+ recentHours: number;
1503
+ /** Sections whose backing query exceeded the per-branch timeout and were returned empty. Present only when at least one branch timed out, so an empty section can otherwise be read as 'no data'. */
1504
+ timedOutSections?: string[];
1505
+ }
1506
+ interface BuildContextResponse {
1507
+ /** Most relevant active conversation, or null if none found */
1508
+ activeWork: BuildContextActiveWork;
1509
+ /** Facts related to the context terms */
1510
+ relevantFacts: BuildContextFact[];
1511
+ /** Gotchas — facts appearing in 2+ source memories */
1512
+ gotchas: BuildContextGotcha[];
1513
+ /** Recent relevant memories within the time window */
1514
+ recentActivity: BuildContextActivity[];
1515
+ /** Behavioral patterns related to the context */
1516
+ relatedPatterns: BuildContextPattern[];
1517
+ /** Request metadata for transparency */
1518
+ meta: BuildContextMeta;
1519
+ }
1520
+ interface SystemAlert {
1521
+ id: string;
1522
+ title: string;
1523
+ body: string;
1524
+ severity: 'info' | 'warning' | 'critical';
1525
+ active?: boolean;
1526
+ dismissible?: boolean;
1527
+ targetAllUsers?: boolean;
1528
+ targetUserIds?: string[];
1529
+ createdAt: string;
1530
+ expiresAt: string | null;
1531
+ createdBy: string;
1532
+ }
1533
+ interface CreateSystemAlertRequest {
1534
+ title: string;
1535
+ body: string;
1536
+ severity?: 'info' | 'warning' | 'critical';
1537
+ active?: boolean;
1538
+ dismissible?: boolean;
1539
+ targetAllUsers?: boolean;
1540
+ targetUserIds?: string[];
1541
+ expiresAt?: string | null;
1542
+ }
1543
+ interface UpdateSystemAlertRequest {
1544
+ title?: string;
1545
+ body?: string;
1546
+ severity?: 'info' | 'warning' | 'critical';
1547
+ active?: boolean;
1548
+ dismissible?: boolean;
1549
+ targetAllUsers?: boolean;
1550
+ targetUserIds?: string[];
1551
+ expiresAt?: string | null;
1552
+ }
1553
+
1554
+ /**
1555
+ * UsersService — User management and profile endpoints API operations.
1556
+ * Auto-generated by sdk-generator — do not edit manually.
1557
+ */
1558
+
1559
+ /** User management and profile endpoints */
1560
+ declare class Users {
1561
+ private readonly _http;
1562
+ constructor(http: HttpClient);
1563
+ /**
1564
+ * Sync user from WorkOS
1565
+ *
1566
+ * Called by the customer portal after WorkOS authentication.
1567
+ * Creates a new user if they don't exist, or updates their profile if they do.
1568
+ * This is the main entry point for user provisioning.
1569
+ * When the invite gate is closed and a new user is created, the inviteCode
1570
+ * is redeemed atomically to track which code was used for registration.
1571
+ *
1572
+ * @param body — Request body
1573
+ */
1574
+ syncUser(body: {
1575
+ workosId: string;
1576
+ email: string;
1577
+ firstName?: string | null;
1578
+ lastName?: string | null;
1579
+ profilePictureUrl?: string | null;
1580
+ inviteCode?: string;
1581
+ }): Promise<HttpResponse<{
1582
+ data?: User;
1583
+ created?: boolean;
1584
+ }>>;
1585
+ /**
1586
+ * Get current user
1587
+ *
1588
+ * Get the currently authenticated user's profile and usage information
1589
+ */
1590
+ getCurrentUser(): Promise<HttpResponse<{
1591
+ data?: User;
1592
+ usage?: UserUsage;
1593
+ }>>;
1594
+ /**
1595
+ * Update current user
1596
+ *
1597
+ * Update the currently authenticated user's profile
1598
+ * @param options — Optional parameters
1599
+ */
1600
+ updateCurrentUser(options?: {
1601
+ body?: {
1602
+ firstName?: string | null;
1603
+ lastName?: string | null;
1604
+ profilePictureUrl?: string | null;
1605
+ };
1606
+ }): Promise<HttpResponse<{
1607
+ data?: User;
1608
+ }>>;
1609
+ /**
1610
+ * Get current user's usage
1611
+ *
1612
+ * Get the currently authenticated user's memory usage statistics
1613
+ */
1614
+ getCurrentUserUsage(): Promise<HttpResponse<{
1615
+ data?: UserUsage;
1616
+ }>>;
1617
+ /**
1618
+ * Export all user data
1619
+ *
1620
+ * Export all user data as a JSON archive. Includes profile, memories,
1621
+ * conversations, facts, and patterns. Supports GDPR Article 20
1622
+ * (right to data portability). Sensitive fields (Stripe customer ID,
1623
+ * WorkOS ID, embeddings) are excluded.
1624
+ *
1625
+ */
1626
+ exportUserData(): Promise<HttpResponse<{
1627
+ exportVersion?: string;
1628
+ exportedAt?: string;
1629
+ counts?: {
1630
+ memories?: number;
1631
+ conversations?: number;
1632
+ facts?: number;
1633
+ patterns?: number;
1634
+ };
1635
+ profile?: Record<string, unknown>;
1636
+ memories?: Memory[];
1637
+ conversations?: Conversation[];
1638
+ facts?: Fact[];
1639
+ patterns?: Pattern[];
1640
+ }>>;
1641
+ /**
1642
+ * Initiate account deletion
1643
+ *
1644
+ * Schedule the current user's account for deletion after a 7-day grace period.
1645
+ * Requires email confirmation. Immediately revokes API keys and cancels
1646
+ * any active subscription. The account enters read-only mode.
1647
+ *
1648
+ * @param body — Request body
1649
+ */
1650
+ initiateAccountDeletion(body: {
1651
+ confirmationEmail: string;
1652
+ }): Promise<HttpResponse<{
1653
+ data?: User;
1654
+ message?: string;
1655
+ }>>;
1656
+ /**
1657
+ * Cancel account deletion
1658
+ *
1659
+ * Cancel a pending account deletion during the grace period.
1660
+ * Note: Previously revoked API keys are not restored — new keys must be created.
1661
+ * Stripe subscription may need manual reactivation via the billing portal.
1662
+ *
1663
+ */
1664
+ cancelAccountDeletion(): Promise<HttpResponse<{
1665
+ data?: User;
1666
+ message?: string;
1667
+ }>>;
1668
+ /**
1669
+ * Get user by ID
1670
+ *
1671
+ * Get a user by their internal ID (admin only)
1672
+ * @param id
1673
+ */
1674
+ getUserById(id: string): Promise<HttpResponse<{
1675
+ data?: User;
1676
+ }>>;
1677
+ }
1678
+
1679
+ /**
1680
+ * TopicsService — Topic detection, clustering, and management endpoints API operations.
1681
+ * Auto-generated by sdk-generator — do not edit manually.
1682
+ */
1683
+
1684
+ /** Topic detection, clustering, and management endpoints */
1685
+ declare class Topics {
1686
+ private readonly _http;
1687
+ constructor(http: HttpClient);
1688
+ /**
1689
+ * List topics
1690
+ *
1691
+ * List all topics with pagination
1692
+ * @param options — Optional parameters
1693
+ */
1694
+ listTopics(options?: {
1695
+ limit?: number;
1696
+ offset?: number;
1697
+ sortBy?: 'name' | 'memoryCount';
1698
+ order?: 'asc' | 'desc';
1699
+ }): Promise<HttpResponse<{
1700
+ data?: Topic[];
1701
+ pagination?: {
1702
+ limit?: number;
1703
+ offset?: number;
1704
+ count?: number;
1705
+ };
1706
+ }>>;
1707
+ /**
1708
+ * Get topic by ID
1709
+ *
1710
+ * Retrieve a specific topic by its ID
1711
+ * @param id — The topic ID
1712
+ */
1713
+ getTopicById(id: string): Promise<HttpResponse<{
1714
+ data?: Topic;
1715
+ }>>;
1716
+ /**
1717
+ * Merge topics
1718
+ *
1719
+ * Merge two topics into one
1720
+ * @param body — Request body
1721
+ */
1722
+ mergeTopics(body: {
1723
+ sourceTopicId: string;
1724
+ targetTopicId: string;
1725
+ }): Promise<HttpResponse<{
1726
+ data?: Topic;
1727
+ }>>;
1728
+ /**
1729
+ * Discover related topics
1730
+ *
1731
+ * Discover topics related to a given topic
1732
+ * @param body — Request body
1733
+ */
1734
+ discoverRelatedTopics(body: {
1735
+ topicId: string;
1736
+ limit?: number;
1737
+ }): Promise<HttpResponse<{
1738
+ data?: Topic[];
1739
+ }>>;
1740
+ /**
1741
+ * Calculate topic similarity
1742
+ *
1743
+ * Calculate similarity score between two topics
1744
+ * @param body — Request body
1745
+ */
1746
+ calculateTopicSimilarity(body: {
1747
+ topicId1: string;
1748
+ topicId2: string;
1749
+ }): Promise<HttpResponse<{
1750
+ data?: {
1751
+ similarity?: number;
1752
+ };
1753
+ }>>;
1754
+ /**
1755
+ * Find similar topics
1756
+ *
1757
+ * Find topics similar to a given topic
1758
+ * @param body — Request body
1759
+ */
1760
+ findSimilarTopics(body: {
1761
+ topicId: string;
1762
+ threshold?: number;
1763
+ limit?: number;
1764
+ }): Promise<HttpResponse<{
1765
+ data?: {
1766
+ topic?: Topic;
1767
+ similarity?: number;
1768
+ }[];
1769
+ }>>;
1770
+ /**
1771
+ * Cluster topics
1772
+ *
1773
+ * Cluster topics using community detection algorithms
1774
+ * @param options — Optional parameters
1775
+ */
1776
+ clusterTopics(options?: {
1777
+ body?: {
1778
+ minClusterSize?: number;
1779
+ };
1780
+ }): Promise<HttpResponse<{
1781
+ data?: {
1782
+ clusters?: Record<string, unknown>[];
1783
+ clusterCount?: number;
1784
+ };
1785
+ }>>;
1786
+ /**
1787
+ * Detect communities
1788
+ *
1789
+ * Detect communities in the topic graph using specified algorithm
1790
+ * @param options — Optional parameters
1791
+ */
1792
+ detectCommunities(options?: {
1793
+ body?: {
1794
+ algorithm?: string;
1795
+ };
1796
+ }): Promise<HttpResponse<{
1797
+ data?: {
1798
+ communities?: Community[];
1799
+ communityCount?: number;
1800
+ };
1801
+ }>>;
1802
+ /**
1803
+ * Search topics
1804
+ *
1805
+ * Search topics by query string using fulltext search
1806
+ * @param body — Request body
1807
+ */
1808
+ searchTopics(body: {
1809
+ query: string;
1810
+ limit?: number;
1811
+ offset?: number;
1812
+ }): Promise<HttpResponse<{
1813
+ data?: Record<string, unknown>[];
1814
+ total?: number;
1815
+ limit?: number;
1816
+ offset?: number;
1817
+ }>>;
1818
+ }
1819
+
1820
+ /**
1821
+ * SystemService — System health, monitoring, and configuration endpoints API operations.
1822
+ * Auto-generated by sdk-generator — do not edit manually.
1823
+ */
1824
+
1825
+ /** System health, monitoring, and configuration endpoints */
1826
+ declare class System {
1827
+ private readonly _http;
1828
+ constructor(http: HttpClient);
1829
+ /**
1830
+ * Get system health status
1831
+ *
1832
+ * Get the current health status of the system including database connectivity
1833
+ */
1834
+ getSystemHealth(): Promise<HttpResponse<{
1835
+ data?: {
1836
+ status?: 'healthy' | 'unhealthy';
1837
+ database?: Record<string, unknown>;
1838
+ uptime?: number;
1839
+ };
1840
+ }>>;
1841
+ /**
1842
+ * Get context status
1843
+ *
1844
+ * Get database statistics and context information
1845
+ */
1846
+ getContextStatus(): Promise<HttpResponse<{
1847
+ data?: Record<string, unknown>;
1848
+ }>>;
1849
+ /**
1850
+ * Get feature flags
1851
+ *
1852
+ * Get all feature flags for the authenticated user
1853
+ */
1854
+ getFeatureFlags(): Promise<HttpResponse<{
1855
+ data?: Record<string, unknown>;
1856
+ }>>;
1857
+ /**
1858
+ * Evaluate feature flag
1859
+ *
1860
+ * Evaluate a specific feature flag for the authenticated user
1861
+ * @param body — Request body
1862
+ */
1863
+ evaluateFeatureFlag(body: {
1864
+ flagName: string;
1865
+ context?: Record<string, unknown>;
1866
+ }): Promise<HttpResponse<{
1867
+ data?: {
1868
+ enabled?: boolean;
1869
+ flagName?: string;
1870
+ };
1871
+ }>>;
1872
+ /**
1873
+ * Analyze memory quality distribution
1874
+ *
1875
+ * Analyze the quality distribution of memories for the authenticated user
1876
+ * @param options — Optional parameters
1877
+ */
1878
+ analyzeMemoryQuality(options?: {
1879
+ includeDetails?: boolean;
1880
+ minQualityThreshold?: number;
1881
+ }): Promise<HttpResponse<{
1882
+ data?: {
1883
+ totalMemories?: number;
1884
+ qualityDistribution?: {
1885
+ high?: number;
1886
+ medium?: number;
1887
+ low?: number;
1888
+ };
1889
+ averageQuality?: number;
1890
+ pruningCandidates?: number;
1891
+ };
1892
+ }>>;
1893
+ /**
1894
+ * Prune low-quality memories
1895
+ *
1896
+ * Prune (soft delete) low-quality memories for the authenticated user
1897
+ * @param options — Optional parameters
1898
+ */
1899
+ pruneMemories(options?: {
1900
+ body?: {
1901
+ targetReduction?: number;
1902
+ minQualityThreshold?: number;
1903
+ preserveRecent?: boolean;
1904
+ recentDaysToPreserve?: number;
1905
+ dryRun?: boolean;
1906
+ };
1907
+ }): Promise<HttpResponse<{
1908
+ data?: {
1909
+ prunedCount?: number;
1910
+ prunedIds?: string[];
1911
+ dryRun?: boolean;
1912
+ };
1913
+ }>>;
1914
+ /**
1915
+ * Get OpenAPI specification
1916
+ *
1917
+ * Returns the OpenAPI 3.x specification for the entire API. This endpoint is used by CI/CD to sync the API Gateway.
1918
+ * @param options — Optional parameters
1919
+ */
1920
+ getOpenApiSpec(options?: {
1921
+ noCache?: '1' | 'true';
1922
+ }): Promise<HttpResponse<Record<string, unknown>>>;
1923
+ }
1924
+
1925
+ /**
1926
+ * PatternsService — Pattern detection and behavioral analysis endpoints API operations.
1927
+ * Auto-generated by sdk-generator — do not edit manually.
1928
+ */
1929
+
1930
+ /** Pattern detection and behavioral analysis endpoints */
1931
+ declare class Patterns {
1932
+ private readonly _http;
1933
+ constructor(http: HttpClient);
1934
+ /**
1935
+ * List patterns
1936
+ *
1937
+ * List all patterns for the authenticated user
1938
+ * @param options — Optional parameters
1939
+ */
1940
+ listPatterns(options?: {
1941
+ limit?: number;
1942
+ offset?: number;
1943
+ }): Promise<HttpResponse<{
1944
+ data?: Pattern[];
1945
+ pagination?: {
1946
+ limit?: number;
1947
+ offset?: number;
1948
+ count?: number;
1949
+ };
1950
+ }>>;
1951
+ /**
1952
+ * Compile patterns
1953
+ *
1954
+ * Compile patterns from user's memories
1955
+ * @param options — Optional parameters
1956
+ */
1957
+ compilePatterns(options?: {
1958
+ body?: {
1959
+ minOccurrences?: number;
1960
+ timeWindow?: string;
1961
+ };
1962
+ }): Promise<HttpResponse<{
1963
+ data?: Pattern[];
1964
+ count?: number;
1965
+ }>>;
1966
+ /**
1967
+ * Detect behavioral patterns
1968
+ *
1969
+ * Run pattern detection algorithms to identify recurring behavioral patterns
1970
+ * @param options — Optional parameters
1971
+ */
1972
+ detectPatterns(options?: {
1973
+ body?: {
1974
+ contextFilter?: string;
1975
+ timeframeStart?: string;
1976
+ timeframeEnd?: string;
1977
+ minConfidence?: number;
1978
+ maxResults?: number;
1979
+ autoStore?: boolean;
1980
+ };
1981
+ }): Promise<HttpResponse<{
1982
+ data?: {
1983
+ detectedPatterns?: Pattern[];
1984
+ count?: number;
1985
+ stored?: number;
1986
+ confidence?: {
1987
+ average?: number;
1988
+ highest?: number;
1989
+ };
1990
+ };
1991
+ }>>;
1992
+ /**
1993
+ * Analyze pattern trends
1994
+ *
1995
+ * Analyze pattern trends, correlations, and generate insights
1996
+ * @param options — Optional parameters
1997
+ */
1998
+ analyzePatterns(options?: {
1999
+ body?: {
2000
+ timeRange?: number;
2001
+ groupBy?: 'type' | 'context' | 'confidence';
2002
+ includeDetails?: boolean;
2003
+ };
2004
+ }): Promise<HttpResponse<{
2005
+ data?: {
2006
+ analysis?: {
2007
+ totalPatterns?: number;
2008
+ recentPatterns?: number;
2009
+ trends?: Record<string, unknown>;
2010
+ insights?: string[];
2011
+ recommendations?: string[];
2012
+ };
2013
+ timeRange?: number;
2014
+ analyzedAt?: string;
2015
+ };
2016
+ }>>;
2017
+ /**
2018
+ * Update pattern
2019
+ *
2020
+ * Update an existing pattern with partial data
2021
+ * @param id — The pattern ID
2022
+ * @param body — Request body
2023
+ */
2024
+ updatePattern(id: string, body: {
2025
+ name?: string;
2026
+ description?: string;
2027
+ confidence?: number;
2028
+ metadata?: Record<string, unknown>;
2029
+ }): Promise<HttpResponse<{
2030
+ data?: Pattern;
2031
+ }>>;
2032
+ /**
2033
+ * Record pattern feedback
2034
+ *
2035
+ * Record feedback on a pattern
2036
+ * @param body — Request body
2037
+ */
2038
+ recordPatternFeedback(body: {
2039
+ patternId: string;
2040
+ feedback: string;
2041
+ }): Promise<HttpResponse<{
2042
+ data?: Pattern;
2043
+ }>>;
2044
+ /**
2045
+ * Compile behavioral instructions from stored patterns
2046
+ *
2047
+ * Converts stored behavioral patterns into actionable instructions suitable for injection into AI agent context at conversation start. Uses template-based (non-LLM) generation for deterministic output within the P95 <100ms budget.
2048
+ *
2049
+ * @param options — Optional parameters
2050
+ */
2051
+ compileInstructions(options?: {
2052
+ body?: {
2053
+ conversationContext?: string[];
2054
+ currentQuery?: string;
2055
+ tokenBudget?: number;
2056
+ minConfidence?: number;
2057
+ maxInstructions?: number;
2058
+ };
2059
+ }): Promise<HttpResponse<{
2060
+ instructions: Array<{
2061
+ patternId: string;
2062
+ instruction: string;
2063
+ confidence: number;
2064
+ priority: number;
2065
+ source: 'learned' | 'explicit' | 'manual';
2066
+ patternType: string;
2067
+ activatedBy: string[];
2068
+ recommendationId?: string;
2069
+ triggerContext?: string;
2070
+ evidenceSummary?: string;
2071
+ firstSurfacing?: boolean;
2072
+ }>;
2073
+ summary: string;
2074
+ tokenCount: number;
2075
+ patternsEvaluated: number;
2076
+ patternsActivated: number;
2077
+ conflictsResolved: {
2078
+ winnerId: string;
2079
+ loserId: string;
2080
+ strategy: 'priority_override';
2081
+ }[];
2082
+ systemState?: 'ok' | 'cold_start' | 'pending_only' | 'no_match';
2083
+ pendingCount?: number;
2084
+ patternsExcluded?: number;
2085
+ }>>;
2086
+ }
2087
+
2088
+ /**
2089
+ * BehaviorService — Behavioral pattern tracking and state management endpoints API operations.
2090
+ * Auto-generated by sdk-generator — do not edit manually.
2091
+ */
2092
+
2093
+ /** Behavioral pattern tracking and state management endpoints */
2094
+ declare class Behavior {
2095
+ private readonly _http;
2096
+ constructor(http: HttpClient);
2097
+ /**
2098
+ * Get behavioral state
2099
+ *
2100
+ * Get current behavioral state for the authenticated user
2101
+ */
2102
+ getBehavioralState(): Promise<HttpResponse<{
2103
+ data?: Record<string, unknown>;
2104
+ }>>;
2105
+ /**
2106
+ * Update behavioral state
2107
+ *
2108
+ * Update or mutate behavioral state
2109
+ * @param options — Optional parameters
2110
+ */
2111
+ updateBehavioralState(options?: {
2112
+ body?: {
2113
+ state?: Record<string, unknown>;
2114
+ mutations?: Record<string, unknown>;
2115
+ };
2116
+ }): Promise<HttpResponse<{
2117
+ data?: Record<string, unknown>;
2118
+ }>>;
2119
+ }
2120
+
2121
+ /**
2122
+ * RecommendationsService — Behavioral recommendation management endpoints (v2) API operations.
2123
+ * Auto-generated by sdk-generator — do not edit manually.
2124
+ */
2125
+
2126
+ /** Behavioral recommendation management endpoints (v2) */
2127
+ declare class Recommendations {
2128
+ private readonly _http;
2129
+ constructor(http: HttpClient);
2130
+ /**
2131
+ * Create an explicit recommendation
2132
+ *
2133
+ * Create a new explicit recommendation (triggerContext + practice pair). Source is set to 'explicit'; triggerEmbedding is generated synchronously before return. SEC-BL-v2-002: practice content is validated against a prompt-injection deny-list. SEC-BL-v2-003: evidenceMemoryIds ownership is verified against the authenticated user.
2134
+ *
2135
+ * @param body — Request body
2136
+ */
2137
+ createRecommendation(body: {
2138
+ triggerContext: string;
2139
+ practice: string;
2140
+ evidenceSummary?: string;
2141
+ outcomeSignal?: 'positive' | 'neutral' | 'unknown';
2142
+ evidenceMemoryIds?: string[];
2143
+ activateImmediately?: boolean;
2144
+ }): Promise<HttpResponse<{
2145
+ data?: Recommendation;
2146
+ }>>;
2147
+ /**
2148
+ * List pending recommendations
2149
+ *
2150
+ * Returns recommendations with status='pending_review' for the authenticated user, ordered by confidence DESC, createdAt ASC.
2151
+ *
2152
+ * @param options — Optional parameters
2153
+ */
2154
+ listPendingRecommendations(options?: {
2155
+ limit?: number;
2156
+ offset?: number;
2157
+ }): Promise<HttpResponse<{
2158
+ data?: Recommendation[];
2159
+ pagination?: {
2160
+ limit?: number;
2161
+ offset?: number;
2162
+ count?: number;
2163
+ };
2164
+ }>>;
2165
+ /**
2166
+ * Approve a pending recommendation
2167
+ *
2168
+ * Transitions a recommendation from status='pending_review' to status='active'. Returns 404 if the recommendation is not found, not owned by the authenticated user, or is not in pending_review status.
2169
+ *
2170
+ * @param id — Recommendation ID
2171
+ * @param options — Optional parameters
2172
+ */
2173
+ approveRecommendation(id: string, options?: {
2174
+ body?: Record<string, unknown>;
2175
+ }): Promise<HttpResponse<{
2176
+ data?: Recommendation;
2177
+ }>>;
2178
+ /**
2179
+ * Dismiss a recommendation
2180
+ *
2181
+ * Permanently dismisses a recommendation (any non-dismissed status → dismissed). This transition is terminal — dismissed recommendations cannot be reactivated. Returns 404 if not found, not owned by the authenticated user, or already dismissed.
2182
+ *
2183
+ * @param id — Recommendation ID
2184
+ * @param options — Optional parameters
2185
+ */
2186
+ dismissRecommendation(id: string, options?: {
2187
+ body?: Record<string, unknown>;
2188
+ }): Promise<HttpResponse<{
2189
+ data?: Recommendation;
2190
+ }>>;
2191
+ /**
2192
+ * List active recommendations
2193
+ *
2194
+ * Returns recommendations with status='active' for the authenticated user, ordered by confidence DESC. These are the behavioral preferences currently surfacing in Claude via compile-instructions and build_context. SEC-BL-v2-003: results are scoped to the authenticated user — no cross-user data.
2195
+ *
2196
+ * @param options — Optional parameters
2197
+ */
2198
+ listActiveRecommendations(options?: {
2199
+ limit?: number;
2200
+ offset?: number;
2201
+ }): Promise<HttpResponse<{
2202
+ data?: Recommendation[];
2203
+ pagination?: {
2204
+ limit?: number;
2205
+ offset?: number;
2206
+ count?: number;
2207
+ };
2208
+ }>>;
2209
+ /**
2210
+ * Match active recommendations to content
2211
+ *
2212
+ * Embeds the supplied content and returns active Recommendations whose triggerContext is semantically similar. Used by the MCP server for just-in-time behavioral nudges on memory save. Results are scoped to the authenticated user — no cross-user data is returned.
2213
+ *
2214
+ * @param body — Request body
2215
+ */
2216
+ matchRecommendations(body: {
2217
+ content: string;
2218
+ limit?: number;
2219
+ similarityThreshold?: number;
2220
+ }): Promise<HttpResponse<{
2221
+ data: Recommendation[];
2222
+ }>>;
2223
+ /**
2224
+ * Pause an active recommendation
2225
+ *
2226
+ * Transitions a recommendation from status='active' to status='paused'. Paused recommendations are excluded from compile-instructions and build_context surfacing. Returns 404 if the recommendation is not found, not owned by the authenticated user, or is not in active status. SEC-BL-v2-003: MATCH includes userId — no IDOR.
2227
+ *
2228
+ * @param id — Recommendation ID
2229
+ * @param options — Optional parameters
2230
+ */
2231
+ pauseRecommendation(id: string, options?: {
2232
+ body?: Record<string, unknown>;
2233
+ }): Promise<HttpResponse<{
2234
+ data?: Recommendation;
2235
+ }>>;
2236
+ }
2237
+
2238
+ /**
2239
+ * NarrativesService — Narrative thread management endpoints API operations.
2240
+ * Auto-generated by sdk-generator — do not edit manually.
2241
+ */
2242
+
2243
+ /** Narrative thread management endpoints */
2244
+ declare class Narratives {
2245
+ private readonly _http;
2246
+ constructor(http: HttpClient);
2247
+ /**
2248
+ * List narrative threads
2249
+ *
2250
+ * List all narrative threads for the authenticated user.
2251
+ * Narratives group related memories into coherent storylines.
2252
+ *
2253
+ * @param options — Optional parameters
2254
+ */
2255
+ listNarratives(options?: {
2256
+ limit?: number;
2257
+ offset?: number;
2258
+ state?: 'open' | 'resolved' | 'reopened' | 'superseded';
2259
+ topics?: string;
2260
+ }): Promise<HttpResponse<{
2261
+ data: NarrativeThread[];
2262
+ pagination: {
2263
+ limit: number;
2264
+ offset: number;
2265
+ count: number;
2266
+ };
2267
+ }>>;
2268
+ /**
2269
+ * Create a narrative thread
2270
+ *
2271
+ * Create a new narrative thread starting from a root memory.
2272
+ * Narratives help organize related memories into coherent storylines.
2273
+ *
2274
+ * @param body — Request body
2275
+ */
2276
+ createNarrative(body: {
2277
+ title: string;
2278
+ rootMemoryId: string;
2279
+ topics?: string[];
2280
+ }): Promise<HttpResponse<{
2281
+ data: NarrativeThread;
2282
+ }>>;
2283
+ /**
2284
+ * Get a narrative thread
2285
+ *
2286
+ * Retrieve a specific narrative thread by ID
2287
+ * @param id — The narrative ID
2288
+ */
2289
+ getNarrative(id: string): Promise<HttpResponse<{
2290
+ data: NarrativeThread;
2291
+ }>>;
2292
+ /**
2293
+ * Delete a narrative thread
2294
+ *
2295
+ * Delete a narrative thread.
2296
+ * This does not delete the associated memories, only the narrative structure.
2297
+ *
2298
+ * @param id — The narrative ID
2299
+ */
2300
+ deleteNarrative(id: string): Promise<HttpResponse<unknown>>;
2301
+ /**
2302
+ * Update a narrative thread
2303
+ *
2304
+ * Update a narrative thread's title, topics, or state.
2305
+ * Use this to resolve, reopen, or modify narratives.
2306
+ *
2307
+ * @param id — The narrative ID
2308
+ * @param body — Request body
2309
+ */
2310
+ updateNarrative(id: string, body: {
2311
+ title?: string;
2312
+ state?: 'open' | 'resolved' | 'reopened' | 'superseded';
2313
+ resolutionMemoryId?: string;
2314
+ topics?: string[];
2315
+ }): Promise<HttpResponse<{
2316
+ data: NarrativeThread;
2317
+ }>>;
2318
+ /**
2319
+ * Get narrative timeline
2320
+ *
2321
+ * Get all memories in a narrative, ordered by their position in the narrative.
2322
+ * Each memory includes its position and effective state.
2323
+ *
2324
+ * @param id — The narrative ID
2325
+ * @param options — Optional parameters
2326
+ */
2327
+ getNarrativeTimeline(id: string, options?: {
2328
+ limit?: number;
2329
+ offset?: number;
2330
+ }): Promise<HttpResponse<{
2331
+ data: NarrativeMemory[];
2332
+ narrative: NarrativeThread;
2333
+ pagination: {
2334
+ limit: number;
2335
+ offset: number;
2336
+ total: number;
2337
+ };
2338
+ }>>;
2339
+ /**
2340
+ * Add a memory to a narrative
2341
+ *
2342
+ * Add an existing memory to a narrative thread.
2343
+ * Optionally specify a position to insert the memory at.
2344
+ *
2345
+ * @param id — The narrative ID
2346
+ * @param body — Request body
2347
+ */
2348
+ addMemoryToNarrative(id: string, body: {
2349
+ memoryId: string;
2350
+ position?: number;
2351
+ }): Promise<HttpResponse<{
2352
+ data: NarrativeThread;
2353
+ }>>;
2354
+ /**
2355
+ * Remove a memory from a narrative
2356
+ *
2357
+ * Remove a memory from a narrative thread.
2358
+ * This does not delete the memory itself, only removes it from the narrative.
2359
+ *
2360
+ * @param id — The narrative ID
2361
+ * @param memoryId — The memory ID to remove
2362
+ */
2363
+ removeMemoryFromNarrative(id: string, memoryId: string): Promise<HttpResponse<unknown>>;
2364
+ }
2365
+
2366
+ /**
2367
+ * MonitoringService — Observability and metrics endpoints for production monitoring API operations.
2368
+ * Auto-generated by sdk-generator — do not edit manually.
2369
+ */
2370
+
2371
+ /** Observability and metrics endpoints for production monitoring */
2372
+ declare class Monitoring {
2373
+ private readonly _http;
2374
+ constructor(http: HttpClient);
2375
+ /**
2376
+ * Prometheus metrics endpoint
2377
+ *
2378
+ * Returns Prometheus-formatted metrics for monitoring and observability.
2379
+ * This endpoint is public and requires no authentication.
2380
+ * Designed to be scraped by Prometheus at regular intervals.
2381
+ *
2382
+ */
2383
+ getMetrics(): Promise<HttpResponse<unknown>>;
2384
+ }
2385
+
2386
+ /**
2387
+ * MemoriesService — Memory management and retrieval endpoints API operations.
2388
+ * Auto-generated by sdk-generator — do not edit manually.
2389
+ */
2390
+
2391
+ /** Memory management and retrieval endpoints */
2392
+ declare class Memories {
2393
+ private readonly _http;
2394
+ constructor(http: HttpClient);
2395
+ /**
2396
+ * Get memory by ID
2397
+ *
2398
+ * Retrieve a specific memory by its ID with configurable detail level.
2399
+ *
2400
+ * **Detail levels:**
2401
+ * - `minimal` — raw memory only, no extra queries
2402
+ * - `standard` (default) — adds userTopics, extractedTopics, entities, facts, relationships
2403
+ * - `full` — adds conversationContext (title, memoryCount, position) and relationship target previews
2404
+ *
2405
+ * @param id — The memory ID
2406
+ * @param options — Optional parameters
2407
+ */
2408
+ getMemoryById(id: string, options?: {
2409
+ detail?: 'minimal' | 'standard' | 'full';
2410
+ }): Promise<HttpResponse<{
2411
+ data: Memory;
2412
+ }>>;
2413
+ /**
2414
+ * Update a memory
2415
+ *
2416
+ * Update an existing memory for the authenticated user
2417
+ * @param id — Memory ID
2418
+ * @param body — Request body
2419
+ */
2420
+ updateMemory(id: string, body: {
2421
+ content?: string;
2422
+ name?: string | '';
2423
+ memoryType?: 'episodic' | 'semantic' | 'procedural';
2424
+ context?: string;
2425
+ topics?: string[];
2426
+ outcome?: 'resolved' | 'unresolved' | null;
2427
+ }): Promise<HttpResponse<{
2428
+ data?: Memory;
2429
+ }>>;
2430
+ /**
2431
+ * Delete memory
2432
+ *
2433
+ * Delete a memory by its ID
2434
+ * @param id — The memory ID
2435
+ */
2436
+ deleteMemory(id: string): Promise<HttpResponse<unknown>>;
2437
+ /**
2438
+ * Aggregated memory analytics
2439
+ *
2440
+ * Return aggregated memory counts grouped by a time dimension (day, week, month)
2441
+ * or by topic. Useful for activity dashboards and trend analysis.
2442
+ *
2443
+ * @param options — Optional parameters
2444
+ */
2445
+ getMemoriesStats(options?: {
2446
+ groupBy: 'day' | 'week' | 'month' | 'topic';
2447
+ after?: string;
2448
+ before?: string;
2449
+ recent?: string;
2450
+ topic?: string;
2451
+ limit?: number;
2452
+ }): Promise<HttpResponse<{
2453
+ groupBy?: 'day' | 'week' | 'month' | 'topic';
2454
+ data?: {
2455
+ bucket?: string;
2456
+ count?: number;
2457
+ }[];
2458
+ total?: number;
2459
+ filters?: {
2460
+ after?: string | null;
2461
+ before?: string | null;
2462
+ topic?: string | null;
2463
+ };
2464
+ }>>;
2465
+ /**
2466
+ * List memories
2467
+ *
2468
+ * List all memories for the authenticated user with pagination.
2469
+ *
2470
+ * **ID Prefix Search:**
2471
+ * Use the `idPrefix` parameter for git-style short ID lookup. This enables efficient
2472
+ * server-side filtering instead of fetching all memories and filtering client-side.
2473
+ * - Minimum 6 characters required for `idPrefix`
2474
+ * - Returns matching memories directly (no need for secondary fetch)
2475
+ * - Example: `?idPrefix=2d09116a` finds memories starting with that prefix
2476
+ *
2477
+ * @param options — Optional parameters
2478
+ */
2479
+ listMemories(options?: {
2480
+ idPrefix?: string;
2481
+ limit?: number;
2482
+ offset?: number;
2483
+ page?: number;
2484
+ sortBy?: 'createdAt' | 'updatedAt' | 'eventTime';
2485
+ order?: 'asc' | 'desc';
2486
+ from$?: string;
2487
+ to?: string;
2488
+ recent?: string;
2489
+ topics?: string;
2490
+ excludeTopics?: string;
2491
+ conversationId?: string;
2492
+ scope?: string;
2493
+ }): Promise<HttpResponse<{
2494
+ data?: Memory[];
2495
+ pagination?: Pagination;
2496
+ filtersApplied?: {
2497
+ from?: string | null;
2498
+ to?: string | null;
2499
+ topics?: string[] | null;
2500
+ excludeTopics?: string[] | null;
2501
+ conversationId?: string | null;
2502
+ scope?: Record<string, unknown> | null;
2503
+ };
2504
+ }>>;
2505
+ /**
2506
+ * Create a memory
2507
+ *
2508
+ * Create a new memory for the authenticated user.
2509
+ *
2510
+ * **Conversation Management:**
2511
+ * - Use `conversationId: "NEW"` to create a new conversation automatically
2512
+ * - Provide an existing conversation ID to add to that conversation
2513
+ *
2514
+ * **Session Management:**
2515
+ * - Sessions are automatically assigned based on 90-minute gap detection
2516
+ * - If the last memory in the conversation was within 90 minutes, the same session is reused
2517
+ * - If the gap exceeds 90 minutes, a new session is created
2518
+ *
2519
+ * **Response:**
2520
+ * - Returns the created memory in `data` field
2521
+ * - Returns session/conversation metadata in `meta` field
2522
+ *
2523
+ * @param body — Request body
2524
+ */
2525
+ createMemory(body: {
2526
+ conversationId?: string;
2527
+ claudeSessionId?: string;
2528
+ name?: string;
2529
+ content: string;
2530
+ memoryType?: 'episodic' | 'semantic' | 'procedural';
2531
+ role?: 'user' | 'assistant' | 'system';
2532
+ context?: string;
2533
+ topics?: string[];
2534
+ eventTime?: string;
2535
+ validFrom?: string;
2536
+ validTo?: string;
2537
+ codeContext?: {
2538
+ product?: string;
2539
+ repo?: string;
2540
+ service?: string;
2541
+ component?: string;
2542
+ team?: string;
2543
+ role?: string;
2544
+ extra?: Record<string, unknown>;
2545
+ };
2546
+ precomputed?: PrecomputedMemoryFields;
2547
+ taskId?: string;
2548
+ outcome?: 'resolved' | 'unresolved';
2549
+ distill?: boolean;
2550
+ }): Promise<HttpResponse<{
2551
+ data: Memory;
2552
+ meta: CreateMemoryResponseMeta;
2553
+ }>>;
2554
+ /**
2555
+ * Search memories (GET)
2556
+ *
2557
+ * Search memories using query parameters. Provides the same functionality as
2558
+ * POST /api/memories/search but accepts parameters via query string.
2559
+ *
2560
+ * **Benefits of GET:**
2561
+ * - Faster response times (~3x improvement)
2562
+ * - Browser/CDN caching support
2563
+ * - Simpler integration for read-only clients
2564
+ *
2565
+ * **Search Methods:**
2566
+ * - **hybrid** (default): Combines semantic and keyword search with Reciprocal Rank Fusion
2567
+ * - **semantic**: Vector-based semantic search using OpenAI embeddings
2568
+ * - **keyword**: Traditional fulltext search using Lucene
2569
+ *
2570
+ * **Array Parameters:**
2571
+ * - `topics`: Provide as comma-separated values (e.g., `topics=typescript,api-design`)
2572
+ *
2573
+ * @param options — Optional parameters
2574
+ */
2575
+ searchMemoriesGet(options?: {
2576
+ q?: string;
2577
+ searchMethod?: 'keyword' | 'semantic' | 'hybrid';
2578
+ limit?: number;
2579
+ offset?: number;
2580
+ threshold?: number;
2581
+ mode?: 'unified' | 'content' | 'facts';
2582
+ vectorWeight?: number;
2583
+ fulltextWeight?: number;
2584
+ topics?: string;
2585
+ excludeTopics?: string;
2586
+ memoryType?: 'episodic' | 'semantic' | 'procedural';
2587
+ conversationId?: string;
2588
+ explain?: boolean;
2589
+ includeTopics?: boolean;
2590
+ includeEntities?: boolean;
2591
+ includeFacts?: boolean;
2592
+ includeClaims?: boolean;
2593
+ asOfTime?: string;
2594
+ validAtTime?: string;
2595
+ eventTimeFrom?: string;
2596
+ eventTimeTo?: string;
2597
+ ingestionTimeFrom?: string;
2598
+ ingestionTimeTo?: string;
2599
+ includeExpired?: boolean;
2600
+ temporalMode?: 'current' | 'historical' | 'evolution';
2601
+ sortBy?: 'relevance' | 'createdAt' | 'updatedAt' | 'eventTime';
2602
+ order?: 'asc' | 'desc';
2603
+ expandEntities?: boolean;
2604
+ expandTopics?: boolean;
2605
+ expandFacts?: boolean;
2606
+ includeSuperseded?: boolean;
2607
+ entityWeight?: number;
2608
+ topicWeight?: number;
2609
+ factWeight?: number;
2610
+ questionWeight?: number;
2611
+ claimsWeight?: number;
2612
+ includeFacets?: boolean;
2613
+ embeddingProvider?: 'ollama' | 'openai' | 'voyage';
2614
+ scope?: string;
2615
+ taskId?: string;
2616
+ outcomeFilter?: 'resolved' | 'unresolved' | 'any';
2617
+ }): Promise<HttpResponse<{
2618
+ data: SearchResult[];
2619
+ meta: SearchMeta;
2620
+ facets?: Facets;
2621
+ instructions?: string;
2622
+ claim_groups?: ClaimGroup[];
2623
+ }>>;
2624
+ /**
2625
+ * Search all memories
2626
+ *
2627
+ * Search memories using different search methods:
2628
+ * - **hybrid** (default): Combines semantic and keyword search with Reciprocal Rank Fusion
2629
+ * - **semantic**: Vector-based semantic search using OpenAI embeddings
2630
+ * - **keyword**: Traditional fulltext search using Lucene
2631
+ *
2632
+ * The `mode` parameter controls content filtering (unified, content, facts).
2633
+ * The `searchMethod` parameter controls the search algorithm.
2634
+ *
2635
+ * @param body — Request body
2636
+ */
2637
+ searchMemories(body: {
2638
+ query: string;
2639
+ mode?: 'unified' | 'content' | 'facts';
2640
+ searchMethod?: 'keyword' | 'semantic' | 'hybrid';
2641
+ limit?: number;
2642
+ offset?: number;
2643
+ vectorWeight?: number;
2644
+ fulltextWeight?: number;
2645
+ threshold?: number;
2646
+ explain?: boolean;
2647
+ asOfTime?: string;
2648
+ validAtTime?: string;
2649
+ eventTimeFrom?: string;
2650
+ eventTimeTo?: string;
2651
+ ingestionTimeFrom?: string;
2652
+ ingestionTimeTo?: string;
2653
+ includeExpired?: boolean;
2654
+ temporalMode?: 'current' | 'historical' | 'evolution';
2655
+ topics?: string[];
2656
+ memoryType?: 'episodic' | 'semantic' | 'procedural';
2657
+ conversationId?: string;
2658
+ taskId?: string;
2659
+ outcomeFilter?: 'resolved' | 'unresolved' | 'any';
2660
+ includeTopics?: boolean;
2661
+ includeEntities?: boolean;
2662
+ includeFacts?: boolean;
2663
+ includeClaims?: boolean;
2664
+ entityTypes?: string[];
2665
+ expandEntities?: boolean;
2666
+ expandTopics?: boolean;
2667
+ expandFacts?: boolean;
2668
+ includeSuperseded?: boolean;
2669
+ entityWeight?: number;
2670
+ topicWeight?: number;
2671
+ factWeight?: number;
2672
+ questionWeight?: number;
2673
+ claimsWeight?: number;
2674
+ sortBy?: 'relevance' | 'createdAt' | 'updatedAt' | 'eventTime';
2675
+ order?: 'asc' | 'desc';
2676
+ includeFacets?: boolean;
2677
+ }): Promise<HttpResponse<{
2678
+ data: SearchResult[];
2679
+ meta: SearchMeta;
2680
+ facets?: Facets;
2681
+ instructions?: string;
2682
+ claim_groups?: ClaimGroup[];
2683
+ }>>;
2684
+ /**
2685
+ * Get multiple memories by IDs
2686
+ *
2687
+ * Retrieve multiple memories by their IDs in a single request.
2688
+ * More efficient than making multiple individual GET requests.
2689
+ *
2690
+ * Returns memories in the order requested, with metadata about
2691
+ * which IDs were found or missing.
2692
+ *
2693
+ * @param body — Request body
2694
+ */
2695
+ getMemoriesBatch(body: {
2696
+ ids: string[];
2697
+ detail?: 'minimal' | 'standard' | 'full';
2698
+ }): Promise<HttpResponse<{
2699
+ data: Memory[];
2700
+ meta: BatchGetMemoriesMeta;
2701
+ }>>;
2702
+ /**
2703
+ * Generate memory digest
2704
+ *
2705
+ * Synthesizes a comprehensive, structured briefing from all relevant memories
2706
+ * on a topic. Instead of multiple search rounds, one call returns a complete digest.
2707
+ *
2708
+ * **Formats:**
2709
+ * - `structured` (default): Sections with headers, bullet points, key decisions
2710
+ * - `narrative`: Chronological prose narrative
2711
+ * - `timeline`: Dated event list
2712
+ * - `status-report`: Done/In Progress/Blocked grouping
2713
+ *
2714
+ * **Pipeline:**
2715
+ * 1. Gather: High-limit search + conversation expansion
2716
+ * 2. Organize: Group by conversation, status, timeline
2717
+ * 3. Synthesize: LLM generates formatted digest
2718
+ *
2719
+ * Requires an LLM provider to be configured (EXTRACTION_ENABLED=true).
2720
+ * Returns 503 if the LLM provider is unavailable and 3+ memories are found.
2721
+ *
2722
+ * @param body — Request body
2723
+ */
2724
+ generateMemoryDigest(body: {
2725
+ query: string;
2726
+ recent?: string;
2727
+ topics?: string[];
2728
+ conversationIds?: string[];
2729
+ format?: 'structured' | 'narrative' | 'timeline' | 'status-report';
2730
+ maxSources?: number;
2731
+ includeMemoryIds?: boolean;
2732
+ verbatimRecent?: number;
2733
+ }): Promise<HttpResponse<{
2734
+ digest: string;
2735
+ metadata: DigestMetadata;
2736
+ sources: DigestSource[];
2737
+ recentMemories?: Memory[];
2738
+ keyFacts?: DigestKeyFact[];
2739
+ entities?: DigestEntity[];
2740
+ effectiveStateBreakdown?: EffectiveStateBreakdown;
2741
+ }>>;
2742
+ /**
2743
+ * Generate memory digest (SSE streaming)
2744
+ *
2745
+ * Same as POST /api/memories/digest but uses Server-Sent Events (SSE) to stream
2746
+ * the response. Sends `: heartbeat` comments every 10 seconds during processing
2747
+ * to prevent gateway read-timeout (default 60s) from killing long-running digests.
2748
+ *
2749
+ * **Event sequence:**
2750
+ * - `: heartbeat` — keep-alive comment, sent every 10s during processing
2751
+ * - `event: result` / `data: <DigestResponse JSON>` — digest completed successfully
2752
+ * - `event: error` / `data: {"error":"...","statusCode":N}` — digest failed
2753
+ * - `event: done` / `data: {}` — stream complete (sent after result)
2754
+ *
2755
+ * **Formats and pipeline:** identical to POST /api/memories/digest.
2756
+ *
2757
+ * @param body — Request body
2758
+ */
2759
+ streamMemoryDigest(body: {
2760
+ query: string;
2761
+ recent?: string;
2762
+ topics?: string[];
2763
+ conversationIds?: string[];
2764
+ format?: 'structured' | 'narrative' | 'timeline' | 'status-report';
2765
+ maxSources?: number;
2766
+ includeMemoryIds?: boolean;
2767
+ verbatimRecent?: number;
2768
+ }): Promise<HttpResponse<unknown>>;
2769
+ /**
2770
+ * Build a context briefing
2771
+ *
2772
+ * Answers "What should I know before working on X?" by combining active work
2773
+ * detection, fact retrieval, gotcha detection, recent activity, and pattern
2774
+ * matching into a single call. Eliminates the 5+ round-trip pattern agents
2775
+ * use today.
2776
+ *
2777
+ * @param body — Request body
2778
+ */
2779
+ buildContext(body: {
2780
+ context: string;
2781
+ files?: string[];
2782
+ recentHours?: number;
2783
+ }): Promise<HttpResponse<{
2784
+ activeWork: BuildContextActiveWork;
2785
+ relevantFacts: BuildContextFact[];
2786
+ gotchas: BuildContextGotcha[];
2787
+ recentActivity: BuildContextActivity[];
2788
+ relatedPatterns: BuildContextPattern[];
2789
+ meta: BuildContextMeta;
2790
+ }>>;
2791
+ /**
2792
+ * Get version history for a named memory
2793
+ *
2794
+ * Returns the full version chain for a named memory, ordered newest-first.
2795
+ * Walks the SUPERSEDES chain from HEAD backwards.
2796
+ *
2797
+ * @param name — Memory name (kebab-case, 2-64 chars)
2798
+ * @param options — Optional parameters
2799
+ */
2800
+ getNamedMemoryHistory(name: string, options?: {
2801
+ limit?: number;
2802
+ }): Promise<HttpResponse<{
2803
+ name: string;
2804
+ versions: Array<{
2805
+ version: number;
2806
+ id: string;
2807
+ content: string;
2808
+ effectiveState?: 'current' | 'superseded' | 'contradicted' | 'duplicate';
2809
+ createdAt: string;
2810
+ }>;
2811
+ }>>;
2812
+ /**
2813
+ * Get a memory by name
2814
+ *
2815
+ * Retrieve the current HEAD version of a named memory by its user-assigned name.
2816
+ * Supports the same detail levels as GET /api/memories/{id}.
2817
+ *
2818
+ * @param name — Memory name (kebab-case, 2-64 chars)
2819
+ * @param options — Optional parameters
2820
+ */
2821
+ getMemoryByName(name: string, options?: {
2822
+ detail?: 'minimal' | 'standard' | 'full';
2823
+ }): Promise<HttpResponse<{
2824
+ data: Memory;
2825
+ }>>;
2826
+ /**
2827
+ * Update a named memory (create new version)
2828
+ *
2829
+ * Creates a new version of a named memory. The name pointer moves to the new version,
2830
+ * and a SUPERSEDES relationship links the new version to the old one.
2831
+ * The old version's effectiveState becomes 'superseded'.
2832
+ *
2833
+ * @param name — Memory name (kebab-case, 2-64 chars)
2834
+ * @param body — Request body
2835
+ */
2836
+ updateNamedMemory(name: string, body: {
2837
+ content: string;
2838
+ memoryType?: 'episodic' | 'semantic' | 'procedural';
2839
+ context?: string;
2840
+ topics?: string[];
2841
+ conversationId?: string;
2842
+ codeContext?: {
2843
+ product?: string;
2844
+ repo?: string;
2845
+ service?: string;
2846
+ component?: string;
2847
+ team?: string;
2848
+ role?: string;
2849
+ extra?: Record<string, unknown>;
2850
+ };
2851
+ supersedes?: string;
2852
+ }): Promise<HttpResponse<{
2853
+ data?: Memory;
2854
+ meta?: {
2855
+ previousVersionId?: string;
2856
+ version?: number;
2857
+ };
2858
+ }>>;
2859
+ /**
2860
+ * Bulk delete multiple memories
2861
+ *
2862
+ * Soft-delete multiple memories at once. Requires confirmDeletion=true.
2863
+ * Each memory is verified to belong to the authenticated user.
2864
+ * Maximum 100 IDs per request.
2865
+ *
2866
+ * @param body — Request body
2867
+ */
2868
+ bulkDeleteMemories(body: {
2869
+ ids: string[];
2870
+ confirmDeletion: true;
2871
+ }): Promise<HttpResponse<{
2872
+ deleted: number;
2873
+ failed: number;
2874
+ errors: {
2875
+ id: string;
2876
+ error: string;
2877
+ }[];
2878
+ }>>;
2879
+ /**
2880
+ * Repair orphaned effectiveState values
2881
+ *
2882
+ * Finds memories with effectiveState='superseded' or 'contradicted' but no
2883
+ * corresponding incoming SUPERSEDES/CONTRADICTS edges, and resets them to 'current'.
2884
+ * This handles cases where edges were deleted but effectiveState wasn't recalculated.
2885
+ *
2886
+ */
2887
+ repairEffectiveState(): Promise<HttpResponse<{
2888
+ repaired?: number;
2889
+ memories?: {
2890
+ memoryId?: string;
2891
+ previousState?: string;
2892
+ }[];
2893
+ }>>;
2894
+ /**
2895
+ * Record behavioral feedback on a search result
2896
+ *
2897
+ * Record whether a search result was selected or ignored by the user.
2898
+ * Used to build behavioral signals for retrieval quality measurement.
2899
+ *
2900
+ * @param body — Request body
2901
+ */
2902
+ recordSearchResultFeedback(body: {
2903
+ memoryId: string;
2904
+ action: 'selected' | 'not_selected';
2905
+ searchMethod?: string;
2906
+ searchSessionId?: string;
2907
+ resultPosition?: number;
2908
+ }): Promise<HttpResponse<unknown>>;
2909
+ /**
2910
+ * Find similar memories
2911
+ *
2912
+ * Find memories that are semantically similar to the given memory.
2913
+ *
2914
+ * Uses vector similarity search if embeddings are available for the memory.
2915
+ * Falls back to topic-based similarity if embeddings are not available.
2916
+ *
2917
+ * The `relationship` field in results indicates the method used:
2918
+ * - `similar` - Found via vector/semantic similarity
2919
+ * - `similar-by-topic` - Fallback using shared topics
2920
+ *
2921
+ * @param id — The source memory ID
2922
+ * @param options — Optional parameters
2923
+ */
2924
+ getSimilarMemories(id: string, options?: {
2925
+ limit?: number;
2926
+ }): Promise<HttpResponse<{
2927
+ data?: RelatedMemoryResult[];
2928
+ sourceMemory?: Memory;
2929
+ }>>;
2930
+ /**
2931
+ * Find memories from same conversation
2932
+ *
2933
+ * Find other memories that belong to the same conversation as the given memory.
2934
+ *
2935
+ * Returns memories sorted chronologically (oldest first) to show the conversation flow.
2936
+ * If the memory doesn't belong to a conversation, returns an empty array.
2937
+ *
2938
+ * @param id — The source memory ID
2939
+ * @param options — Optional parameters
2940
+ */
2941
+ getConversationMemories(id: string, options?: {
2942
+ limit?: number;
2943
+ }): Promise<HttpResponse<{
2944
+ data?: RelatedMemoryResult[];
2945
+ sourceMemory?: Memory;
2946
+ conversationId?: string | null;
2947
+ }>>;
2948
+ /**
2949
+ * Find related memories by topics
2950
+ *
2951
+ * Find memories that share topics with the given memory.
2952
+ *
2953
+ * The score indicates the ratio of shared topics (1.0 = all topics match).
2954
+ * Results are sorted by score (most related first), then by timestamp.
2955
+ *
2956
+ * If the source memory has no topics, returns an empty array.
2957
+ *
2958
+ * @param id — The source memory ID
2959
+ * @param options — Optional parameters
2960
+ */
2961
+ getRelatedMemories(id: string, options?: {
2962
+ limit?: number;
2963
+ }): Promise<HttpResponse<{
2964
+ data?: Array<{
2965
+ memory: {
2966
+ id: string;
2967
+ name?: string;
2968
+ version?: number;
2969
+ content: string;
2970
+ memoryType: 'episodic' | 'semantic' | 'procedural';
2971
+ context?: string;
2972
+ topics?: string[];
2973
+ timestamp?: string;
2974
+ eventTime?: string;
2975
+ validFrom?: string;
2976
+ validTo?: string | null;
2977
+ codeContext?: CodeContext;
2978
+ createdAt: string;
2979
+ updatedAt: string;
2980
+ confidenceScore?: number;
2981
+ confidenceBasis?: 'direct-statement' | 'repeated-mention' | 'single-mention' | 'hedged' | 'inference' | 'external-source' | 'contradicted';
2982
+ effectiveState?: 'current' | 'superseded' | 'contradicted' | 'duplicate';
2983
+ authority?: 'directive' | 'decision' | 'observation' | 'auto-captured';
2984
+ extractionStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
2985
+ extractionCompletedAt?: string;
2986
+ contentEmbeddingStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
2987
+ summary?: string;
2988
+ summaryStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
2989
+ questionsStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
2990
+ summaryEmbeddingStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
2991
+ questionsEmbeddingStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
2992
+ graphStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
2993
+ graphSkipReason?: 'global_disabled' | 'plan_excluded' | 'user_opt_out' | 'content_too_short' | 'legacy' | 'budget_exhausted' | null;
2994
+ extractionSkipReason?: 'global_disabled' | 'plan_excluded' | 'user_opt_out' | 'content_too_short' | 'legacy';
2995
+ embeddingStatus?: 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
2996
+ embeddingOpenaiStatus?: 'queued' | 'running' | 'completed' | 'failed' | 'skipped';
2997
+ embeddingTruncated?: boolean;
2998
+ embeddingOriginalTokens?: number;
2999
+ embeddingStrategy?: 'full' | 'head-truncated' | 'summary-selected' | 'question-selected';
3000
+ extractedTopicCount?: number;
3001
+ extractedFactCount?: number;
3002
+ extractedEntityCount?: number;
3003
+ conflictCount?: number;
3004
+ visibility?: 'private' | 'shared_with_users' | 'shared_with_org' | 'admin_visible';
3005
+ sharedWith?: string[];
3006
+ userTopics?: string[];
3007
+ extractedTopics?: string[];
3008
+ entities?: {
3009
+ name: string;
3010
+ type: string;
3011
+ confidence?: number;
3012
+ }[];
3013
+ taskId?: string | null;
3014
+ outcome?: 'resolved' | 'unresolved' | null;
3015
+ attemptNumber?: number | null;
3016
+ distillStatus?: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped' | null;
3017
+ distillSkipReason?: 'global_disabled' | 'plan_excluded' | 'user_opt_out' | 'content_too_short' | 'legacy' | 'budget_exhausted' | null;
3018
+ distillError?: string | null;
3019
+ distillCompletedAt?: string | null;
3020
+ };
3021
+ score: number;
3022
+ relationship: string;
3023
+ sharedTopics?: string[];
3024
+ }>;
3025
+ sourceMemory?: Memory;
3026
+ }>>;
3027
+ /**
3028
+ * Get relationships for a memory
3029
+ *
3030
+ * Retrieve all relationships for a memory.
3031
+ *
3032
+ * **Direction Options:**
3033
+ * - **outgoing**: Relationships where this memory is the source
3034
+ * - **incoming**: Relationships where this memory is the target
3035
+ * - **both**: All relationships involving this memory
3036
+ *
3037
+ * @param id — The memory ID
3038
+ * @param options — Optional parameters
3039
+ */
3040
+ getMemoryRelationships(id: string, options?: {
3041
+ direction?: 'outgoing' | 'incoming' | 'both';
3042
+ }): Promise<HttpResponse<{
3043
+ data: MemoryRelationship[];
3044
+ sourceMemoryId: string;
3045
+ direction: 'outgoing' | 'incoming' | 'both';
3046
+ }>>;
3047
+ /**
3048
+ * Create a relationship between memories
3049
+ *
3050
+ * Create a relationship between the source memory and a target memory.
3051
+ *
3052
+ * **Relationship Types:**
3053
+ * - **SUPERSEDES**: The source memory replaces/updates the target memory
3054
+ * - **FOLLOWS**: The source memory follows chronologically from the target
3055
+ * - **RESOLVES**: The source memory resolves an issue mentioned in the target
3056
+ * - **CONTRADICTS**: The source memory contradicts the target memory
3057
+ * - **REFERENCES**: The source memory references the target memory
3058
+ *
3059
+ * When creating SUPERSEDES or CONTRADICTS relationships, the target memory's
3060
+ * effectiveState will be automatically updated.
3061
+ *
3062
+ * @param id — The source memory ID
3063
+ * @param body — Request body
3064
+ */
3065
+ createMemoryRelationship(id: string, body: {
3066
+ targetMemoryId: string;
3067
+ type: 'SUPERSEDES' | 'FOLLOWS' | 'RESOLVES' | 'CONTRADICTS' | 'REFERENCES' | 'DUPLICATES';
3068
+ confidence?: number;
3069
+ reason?: string;
3070
+ }): Promise<HttpResponse<{
3071
+ data?: MemoryRelationship;
3072
+ }>>;
3073
+ /**
3074
+ * Delete a relationship
3075
+ *
3076
+ * Delete a specific relationship from a memory
3077
+ * @param id — The source memory ID
3078
+ * @param relationshipId — The relationship ID to delete
3079
+ */
3080
+ deleteMemoryRelationship(id: string, relationshipId: string): Promise<HttpResponse<unknown>>;
3081
+ /**
3082
+ * Get timeline context for a memory
3083
+ *
3084
+ * Get the chronological context around a memory.
3085
+ * Returns preceding and following memories ordered by event time.
3086
+ * Useful for understanding the narrative flow.
3087
+ *
3088
+ * @param id — The memory ID
3089
+ * @param options — Optional parameters
3090
+ */
3091
+ getMemoryTimeline(id: string, options?: {
3092
+ before?: number;
3093
+ after?: number;
3094
+ }): Promise<HttpResponse<{
3095
+ data?: {
3096
+ memory?: Memory;
3097
+ preceding?: Memory[];
3098
+ following?: Memory[];
3099
+ };
3100
+ }>>;
3101
+ /**
3102
+ * Detect potential relationships for a memory
3103
+ *
3104
+ * Analyze a memory and detect potential relationships with other memories.
3105
+ * Uses semantic similarity and pattern detection to suggest relationships.
3106
+ *
3107
+ * Set `autoCreate: true` to automatically create high-confidence relationships.
3108
+ *
3109
+ * @param id — The memory ID
3110
+ * @param options — Optional parameters
3111
+ */
3112
+ detectMemoryRelationships(id: string, options?: {
3113
+ body?: {
3114
+ autoCreate?: boolean;
3115
+ minConfidence?: number;
3116
+ };
3117
+ }): Promise<HttpResponse<{
3118
+ data?: Array<{
3119
+ targetMemoryId?: string;
3120
+ type?: 'SUPERSEDES' | 'FOLLOWS' | 'RESOLVES' | 'CONTRADICTS' | 'REFERENCES';
3121
+ confidence?: number;
3122
+ reason?: string;
3123
+ }>;
3124
+ autoCreated?: boolean;
3125
+ }>>;
3126
+ /**
3127
+ * Generate LLM explanation for a memory relationship
3128
+ *
3129
+ * Uses an LLM to explain why two memories have been flagged with a
3130
+ * particular relationship (e.g. contradiction). Returns a short
3131
+ * plain-text explanation highlighting the specific differences.
3132
+ *
3133
+ * @param id — The ID of the source memory
3134
+ * @param body — Request body
3135
+ */
3136
+ explainMemoryRelationship(id: string, body: {
3137
+ otherMemoryId: string;
3138
+ relationshipType: string;
3139
+ }): Promise<HttpResponse<{
3140
+ data?: {
3141
+ explanation?: string;
3142
+ };
3143
+ }>>;
3144
+ /**
3145
+ * Export memories matching filters
3146
+ *
3147
+ * Export memories matching an optional search query and filters to JSON or CSV format.
3148
+ * When a query is provided, uses hybrid search. When no query is provided, lists memories
3149
+ * with optional topic and memoryType filters. Maximum 1000 results per export.
3150
+ *
3151
+ * @param body — Request body
3152
+ */
3153
+ exportMemories(body: {
3154
+ query?: string;
3155
+ topics?: string[];
3156
+ memoryType?: 'episodic' | 'semantic' | 'procedural';
3157
+ format?: 'json' | 'csv';
3158
+ fields?: string[];
3159
+ limit?: number;
3160
+ }): Promise<HttpResponse<Record<string, unknown>[]>>;
3161
+ /**
3162
+ * Bulk update multiple memories
3163
+ *
3164
+ * Update multiple memories at once. Supports updating topics and memoryType.
3165
+ * Each memory is verified to belong to the authenticated user.
3166
+ * Maximum 100 IDs per request.
3167
+ *
3168
+ * @param body — Request body
3169
+ */
3170
+ bulkUpdateMemories(body: {
3171
+ ids: string[];
3172
+ updates: {
3173
+ topics?: string[];
3174
+ memoryType?: 'episodic' | 'semantic' | 'procedural';
3175
+ };
3176
+ }): Promise<HttpResponse<{
3177
+ updated: number;
3178
+ failed: number;
3179
+ errors: {
3180
+ id: string;
3181
+ error: string;
3182
+ }[];
3183
+ }>>;
3184
+ /**
3185
+ * Bulk add or remove topics from memories
3186
+ *
3187
+ * Add and/or remove topics from multiple memories at once.
3188
+ * At least one of addTopics or removeTopics must be provided.
3189
+ * Each memory is verified to belong to the authenticated user.
3190
+ * Maximum 100 IDs per request.
3191
+ *
3192
+ * @param body — Request body
3193
+ */
3194
+ bulkTagMemories(body: {
3195
+ ids: string[];
3196
+ addTopics?: string[];
3197
+ removeTopics?: string[];
3198
+ }): Promise<HttpResponse<{
3199
+ modified: number;
3200
+ failed: number;
3201
+ errors: {
3202
+ id: string;
3203
+ error: string;
3204
+ }[];
3205
+ }>>;
3206
+ }
3207
+
3208
+ /**
3209
+ * InvitesService — Invite code validation and gate status endpoints API operations.
3210
+ * Auto-generated by sdk-generator — do not edit manually.
3211
+ */
3212
+
3213
+ /** Invite code validation and gate status endpoints */
3214
+ declare class Invites {
3215
+ private readonly _http;
3216
+ constructor(http: HttpClient);
3217
+ /**
3218
+ * Check invite gate status
3219
+ *
3220
+ * Check whether the invite gate is currently open or closed.
3221
+ * When gated is true, new signups require a valid invite code.
3222
+ * Response is cached server-side (30-second TTL).
3223
+ *
3224
+ */
3225
+ getGateStatus(): Promise<HttpResponse<{
3226
+ gated?: boolean;
3227
+ }>>;
3228
+ /**
3229
+ * Validate an invite code
3230
+ *
3231
+ * Validate an invite code without redeeming it.
3232
+ * Rate limited to 10 requests per minute per IP to prevent enumeration.
3233
+ * Error messages are intentionally generic.
3234
+ *
3235
+ * @param body — Request body
3236
+ */
3237
+ validateInviteCode(body: {
3238
+ code: string;
3239
+ email: string;
3240
+ }): Promise<HttpResponse<{
3241
+ valid?: boolean;
3242
+ error?: string;
3243
+ }>>;
3244
+ }
3245
+
3246
+ /**
3247
+ * HealthService — Health check endpoints API operations.
3248
+ * Auto-generated by sdk-generator — do not edit manually.
3249
+ */
3250
+
3251
+ /** Health check endpoints */
3252
+ declare class Health {
3253
+ private readonly _http;
3254
+ constructor(http: HttpClient);
3255
+ /**
3256
+ * Liveness probe endpoint
3257
+ *
3258
+ * Returns 200 if the process is alive. Does not check external dependencies.
3259
+ * Used by Kubernetes liveness probes to determine if the container should be restarted.
3260
+ * Unlike /health, this endpoint does not query the database — a database outage
3261
+ * should not cause the API process to be killed and restarted.
3262
+ *
3263
+ */
3264
+ livenessCheck(): Promise<HttpResponse<{
3265
+ status?: 'alive';
3266
+ uptime?: number;
3267
+ }>>;
3268
+ /**
3269
+ * API health check endpoint
3270
+ *
3271
+ * Returns the health status and uptime of the API service.
3272
+ * This endpoint is public and requires no authentication.
3273
+ * Use this endpoint for monitoring, health checks, and service availability verification.
3274
+ * Returns 200 when healthy, 503 when the database is unreachable.
3275
+ *
3276
+ */
3277
+ healthCheck(): Promise<HttpResponse<{
3278
+ status: 'healthy' | 'degraded' | 'unhealthy';
3279
+ timestamp: string;
3280
+ version: string;
3281
+ uptime: number;
3282
+ checks: Record<string, unknown>;
3283
+ }>>;
3284
+ }
3285
+
3286
+ /**
3287
+ * GraphragService — Graph-based retrieval augmented generation endpoints API operations.
3288
+ * Auto-generated by sdk-generator — do not edit manually.
3289
+ */
3290
+
3291
+ /** Graph-based retrieval augmented generation endpoints */
3292
+ declare class Graphrag {
3293
+ private readonly _http;
3294
+ constructor(http: HttpClient);
3295
+ /**
3296
+ * Explain a GraphRAG query
3297
+ *
3298
+ * Get explanation for a previously executed GraphRAG query result
3299
+ * @param options — Optional parameters
3300
+ */
3301
+ explainGraphRAGQuery(options?: {
3302
+ queryId: string;
3303
+ }): Promise<HttpResponse<{
3304
+ data?: Record<string, unknown>;
3305
+ }>>;
3306
+ /**
3307
+ * Query communities
3308
+ *
3309
+ * Query communities for relevant information using semantic search
3310
+ * @param body — Request body
3311
+ */
3312
+ queryCommunities(body: {
3313
+ query: string;
3314
+ limit?: number;
3315
+ }): Promise<HttpResponse<{
3316
+ data?: Record<string, unknown>[];
3317
+ }>>;
3318
+ /**
3319
+ * Execute a GraphRAG query
3320
+ *
3321
+ * Execute a graph-based retrieval augmented generation query
3322
+ * @param body — Request body
3323
+ */
3324
+ executeGraphRAGQuery(body: {
3325
+ query: string;
3326
+ maxDepth?: number;
3327
+ depth?: number;
3328
+ limit?: number;
3329
+ includeRelationships?: boolean;
3330
+ }): Promise<HttpResponse<{
3331
+ data?: GraphRAGQueryResponse;
3332
+ }>>;
3333
+ }
3334
+
3335
+ /**
3336
+ * FactsService — Fact extraction and management endpoints API operations.
3337
+ * Auto-generated by sdk-generator — do not edit manually.
3338
+ */
3339
+
3340
+ /** Fact extraction and management endpoints */
3341
+ declare class Facts {
3342
+ private readonly _http;
3343
+ constructor(http: HttpClient);
3344
+ /**
3345
+ * List facts
3346
+ *
3347
+ * List all facts for the authenticated user
3348
+ * @param options — Optional parameters
3349
+ */
3350
+ listFacts(options?: {
3351
+ limit?: number;
3352
+ offset?: number;
3353
+ memoryId?: string;
3354
+ sortBy?: 'confidence' | 'createdAt';
3355
+ order?: 'asc' | 'desc';
3356
+ }): Promise<HttpResponse<{
3357
+ data?: Fact[];
3358
+ count?: number;
3359
+ }>>;
3360
+ /**
3361
+ * Create fact
3362
+ *
3363
+ * Create a new semantic fact
3364
+ * @param body — Request body
3365
+ */
3366
+ createFact(body: {
3367
+ subject: string;
3368
+ predicate: string;
3369
+ object: string;
3370
+ }): Promise<HttpResponse<{
3371
+ data?: Fact;
3372
+ }>>;
3373
+ /**
3374
+ * Get fact by ID
3375
+ *
3376
+ * Retrieve a specific fact by its ID
3377
+ * @param id — The fact ID
3378
+ */
3379
+ getFactById(id: string): Promise<HttpResponse<{
3380
+ data?: Fact;
3381
+ }>>;
3382
+ /**
3383
+ * Update fact
3384
+ *
3385
+ * Update an existing fact completely
3386
+ * @param id — The fact ID
3387
+ * @param body — Request body
3388
+ */
3389
+ updateFact(id: string, body: {
3390
+ subject?: string;
3391
+ predicate?: string;
3392
+ object?: string;
3393
+ confidence?: number;
3394
+ }): Promise<HttpResponse<{
3395
+ data?: Fact;
3396
+ }>>;
3397
+ /**
3398
+ * Delete fact
3399
+ *
3400
+ * Delete a fact by its ID
3401
+ * @param id — The fact ID
3402
+ */
3403
+ deleteFact(id: string): Promise<HttpResponse<unknown>>;
3404
+ /**
3405
+ * Search facts
3406
+ *
3407
+ * Search semantic facts by query string
3408
+ * @param body — Request body
3409
+ */
3410
+ searchFacts(body: {
3411
+ query: string;
3412
+ limit?: number;
3413
+ }): Promise<HttpResponse<{
3414
+ data?: Fact[];
3415
+ count?: number;
3416
+ metadata?: {
3417
+ query?: string;
3418
+ };
3419
+ }>>;
3420
+ }
3421
+
3422
+ /**
3423
+ * EntitiesService — Entity extraction and discovery endpoints API operations.
3424
+ * Auto-generated by sdk-generator — do not edit manually.
3425
+ */
3426
+
3427
+ /** Entity extraction and discovery endpoints */
3428
+ declare class Entities {
3429
+ private readonly _http;
3430
+ constructor(http: HttpClient);
3431
+ /**
3432
+ * List entities
3433
+ *
3434
+ * List all entities for the authenticated user, optionally filtered by type
3435
+ * @param options — Optional parameters
3436
+ */
3437
+ listEntities(options?: {
3438
+ query?: string;
3439
+ type$?: string;
3440
+ limit?: number;
3441
+ offset?: number;
3442
+ }): Promise<HttpResponse<{
3443
+ data?: EntityNode[];
3444
+ pagination?: {
3445
+ limit?: number;
3446
+ offset?: number;
3447
+ count?: number;
3448
+ };
3449
+ }>>;
3450
+ /**
3451
+ * Get entity by ID
3452
+ *
3453
+ * Retrieve a specific entity by its ID
3454
+ * @param id — The entity ID
3455
+ */
3456
+ getEntityById(id: string): Promise<HttpResponse<{
3457
+ data?: EntityNode;
3458
+ }>>;
3459
+ /**
3460
+ * Get memories mentioning entity
3461
+ *
3462
+ * Get all memories that mention a specific entity
3463
+ * @param id — The entity ID
3464
+ * @param options — Optional parameters
3465
+ */
3466
+ getEntityMemories(id: string, options?: {
3467
+ limit?: number;
3468
+ offset?: number;
3469
+ }): Promise<HttpResponse<{
3470
+ data?: {
3471
+ memory?: Memory;
3472
+ confidence?: number;
3473
+ }[];
3474
+ pagination?: {
3475
+ limit?: number;
3476
+ offset?: number;
3477
+ count?: number;
3478
+ };
3479
+ }>>;
3480
+ /**
3481
+ * Get graph health metrics
3482
+ *
3483
+ * Returns knowledge graph health metrics including entity counts, fact counts, topic counts, and extraction coverage
3484
+ */
3485
+ getGraphHealth(): Promise<HttpResponse<{
3486
+ data?: {
3487
+ totalMemories?: number;
3488
+ totalEntities?: number;
3489
+ totalFacts?: number;
3490
+ totalTopics?: number;
3491
+ memoriesWithEntities?: number;
3492
+ entityCoverage?: number;
3493
+ };
3494
+ }>>;
3495
+ }
3496
+
3497
+ /**
3498
+ * ConversationsService — Conversation tracking and analysis endpoints API operations.
3499
+ * Auto-generated by sdk-generator — do not edit manually.
3500
+ */
3501
+
3502
+ /** Conversation tracking and analysis endpoints */
3503
+ declare class Conversations {
3504
+ private readonly _http;
3505
+ constructor(http: HttpClient);
3506
+ /**
3507
+ * List conversations
3508
+ *
3509
+ * List all conversations for the authenticated user with pagination
3510
+ * @param options — Optional parameters
3511
+ */
3512
+ listConversations(options?: {
3513
+ limit?: number;
3514
+ offset?: number;
3515
+ since?: string;
3516
+ sortBy?: 'lastActivityAt' | 'createdAt' | 'memoryCount';
3517
+ order?: 'asc' | 'desc';
3518
+ minMemories?: number;
3519
+ }): Promise<HttpResponse<{
3520
+ data?: Conversation[];
3521
+ pagination?: {
3522
+ limit?: number;
3523
+ offset?: number;
3524
+ count?: number;
3525
+ };
3526
+ }>>;
3527
+ /**
3528
+ * Create conversation
3529
+ *
3530
+ * Create a new conversation for the authenticated user
3531
+ * @param body — Request body
3532
+ */
3533
+ createConversation(body: {
3534
+ title: string;
3535
+ summary?: string;
3536
+ }): Promise<HttpResponse<{
3537
+ data?: Conversation;
3538
+ }>>;
3539
+ /**
3540
+ * Get conversation summary
3541
+ *
3542
+ * Retrieve a conversation summary by its ID
3543
+ * @param conversationId — The conversation ID
3544
+ */
3545
+ getConversationSummary(conversationId: string): Promise<HttpResponse<{
3546
+ data?: Conversation;
3547
+ }>>;
3548
+ /**
3549
+ * Delete conversation
3550
+ *
3551
+ * Delete a conversation and soft-delete all associated memories
3552
+ * @param conversationId — The conversation ID
3553
+ */
3554
+ deleteConversation(conversationId: string): Promise<HttpResponse<unknown>>;
3555
+ /**
3556
+ * Get conversation timeline
3557
+ *
3558
+ * Get all memories in a conversation in chronological order
3559
+ * @param conversationId — The conversation ID
3560
+ */
3561
+ getConversationTimeline(conversationId: string): Promise<HttpResponse<{
3562
+ data?: Memory[];
3563
+ count?: number;
3564
+ }>>;
3565
+ /**
3566
+ * Search conversations
3567
+ *
3568
+ * Search conversations by query string
3569
+ * @param body — Request body
3570
+ */
3571
+ searchConversations(body: {
3572
+ query: string;
3573
+ limit?: number;
3574
+ }): Promise<HttpResponse<{
3575
+ data?: Conversation[];
3576
+ count?: number;
3577
+ }>>;
3578
+ /**
3579
+ * Find conversations by topic
3580
+ *
3581
+ * Find conversations that contain a specific topic
3582
+ * @param body — Request body
3583
+ */
3584
+ findConversationsByTopic(body: {
3585
+ topicId: string;
3586
+ limit?: number;
3587
+ }): Promise<HttpResponse<{
3588
+ data?: Conversation[];
3589
+ count?: number;
3590
+ metadata?: {
3591
+ topicId?: string;
3592
+ };
3593
+ }>>;
3594
+ }
3595
+
3596
+ /**
3597
+ * BillingService — Subscription billing and payment management endpoints API operations.
3598
+ * Auto-generated by sdk-generator — do not edit manually.
3599
+ */
3600
+
3601
+ /** Subscription billing and payment management endpoints */
3602
+ declare class Billing {
3603
+ private readonly _http;
3604
+ constructor(http: HttpClient);
3605
+ /**
3606
+ * Get billing overview
3607
+ *
3608
+ * Get subscription, payment method, and upcoming invoice information
3609
+ */
3610
+ getBillingOverview(): Promise<HttpResponse<{
3611
+ data?: BillingOverview;
3612
+ }>>;
3613
+ /**
3614
+ * Create checkout session
3615
+ *
3616
+ * Create a Stripe checkout session for subscription upgrade
3617
+ * @param body — Request body
3618
+ */
3619
+ createCheckoutSession(body: {
3620
+ priceId?: string;
3621
+ successUrl: string;
3622
+ cancelUrl: string;
3623
+ }): Promise<HttpResponse<{
3624
+ data?: CheckoutSessionResponse;
3625
+ }>>;
3626
+ /**
3627
+ * Create billing portal session
3628
+ *
3629
+ * Create a Stripe billing portal session for managing subscription
3630
+ * @param body — Request body
3631
+ */
3632
+ createPortalSession(body: {
3633
+ returnUrl: string;
3634
+ }): Promise<HttpResponse<{
3635
+ data?: PortalSessionResponse;
3636
+ }>>;
3637
+ /**
3638
+ * Get current subscription
3639
+ *
3640
+ * Get the current subscription details for the authenticated user
3641
+ */
3642
+ getSubscription(): Promise<HttpResponse<{
3643
+ data?: Subscription;
3644
+ }>>;
3645
+ /**
3646
+ * Cancel subscription
3647
+ *
3648
+ * Cancel the current subscription at the end of the billing period
3649
+ * @param options — Optional parameters
3650
+ */
3651
+ cancelSubscription(options?: {
3652
+ body?: Record<string, unknown>;
3653
+ }): Promise<HttpResponse<{
3654
+ data?: Subscription;
3655
+ }>>;
3656
+ /**
3657
+ * Reactivate subscription
3658
+ *
3659
+ * Reactivate a subscription that was scheduled for cancellation
3660
+ * @param options — Optional parameters
3661
+ */
3662
+ reactivateSubscription(options?: {
3663
+ body?: Record<string, unknown>;
3664
+ }): Promise<HttpResponse<{
3665
+ data?: Subscription;
3666
+ }>>;
3667
+ /**
3668
+ * List invoices
3669
+ *
3670
+ * Get a list of invoices for the authenticated user
3671
+ * @param options — Optional parameters
3672
+ */
3673
+ listInvoices(options?: {
3674
+ limit?: number;
3675
+ }): Promise<HttpResponse<{
3676
+ data?: ListInvoicesResponse;
3677
+ }>>;
3678
+ /**
3679
+ * List payment methods
3680
+ *
3681
+ * Get a list of payment methods for the authenticated user
3682
+ */
3683
+ listPaymentMethods(): Promise<HttpResponse<{
3684
+ data?: ListPaymentMethodsResponse;
3685
+ }>>;
3686
+ /**
3687
+ * Set default payment method
3688
+ *
3689
+ * Set a payment method as the default for future payments
3690
+ * @param id — The payment method ID
3691
+ * @param options — Optional parameters
3692
+ */
3693
+ setDefaultPaymentMethod(id: string, options?: {
3694
+ body?: Record<string, unknown>;
3695
+ }): Promise<HttpResponse<{
3696
+ message?: string;
3697
+ }>>;
3698
+ /**
3699
+ * Delete payment method
3700
+ *
3701
+ * Remove a payment method from the account
3702
+ * @param id — The payment method ID
3703
+ */
3704
+ deletePaymentMethod(id: string): Promise<HttpResponse<unknown>>;
3705
+ /**
3706
+ * Stripe webhook endpoint
3707
+ *
3708
+ * Receive and process Stripe webhook events
3709
+ * @param body — Request body
3710
+ */
3711
+ stripeWebhook(body: Record<string, unknown>): Promise<HttpResponse<{
3712
+ received?: boolean;
3713
+ }>>;
3714
+ }
3715
+
3716
+ /**
3717
+ * ArtifactsService — Artifact storage and retrieval endpoints API operations.
3718
+ * Auto-generated by sdk-generator — do not edit manually.
3719
+ */
3720
+
3721
+ /** Artifact storage and retrieval endpoints */
3722
+ declare class Artifacts {
3723
+ private readonly _http;
3724
+ constructor(http: HttpClient);
3725
+ /**
3726
+ * List artifacts
3727
+ *
3728
+ * List all artifacts for the authenticated user with optional filters
3729
+ * @param options — Optional parameters
3730
+ */
3731
+ listArtifacts(options?: {
3732
+ limit?: number;
3733
+ offset?: number;
3734
+ memoryId?: string;
3735
+ conversationId?: string;
3736
+ type$?: string;
3737
+ }): Promise<HttpResponse<{
3738
+ data?: Artifact[];
3739
+ count?: number;
3740
+ }>>;
3741
+ /**
3742
+ * Create artifact
3743
+ *
3744
+ * Create a new artifact for the authenticated user
3745
+ * @param body — Request body
3746
+ */
3747
+ createArtifact(body: {
3748
+ content: string;
3749
+ type: string;
3750
+ name?: string;
3751
+ description?: string;
3752
+ memoryId?: string;
3753
+ conversationId?: string;
3754
+ metadata?: Record<string, unknown>;
3755
+ }): Promise<HttpResponse<{
3756
+ data?: Artifact;
3757
+ }>>;
3758
+ /**
3759
+ * Get artifact by ID
3760
+ *
3761
+ * Retrieve a specific artifact by its ID
3762
+ * @param id — The artifact ID
3763
+ */
3764
+ getArtifactById(id: string): Promise<HttpResponse<{
3765
+ data?: Artifact;
3766
+ }>>;
3767
+ /**
3768
+ * Delete artifact
3769
+ *
3770
+ * Delete an artifact by its ID
3771
+ * @param id — The artifact ID
3772
+ */
3773
+ deleteArtifact(id: string): Promise<HttpResponse<unknown>>;
3774
+ /**
3775
+ * Update artifact
3776
+ *
3777
+ * Update an existing artifact with partial data
3778
+ * @param id — The artifact ID
3779
+ * @param body — Request body
3780
+ */
3781
+ updateArtifact(id: string, body: {
3782
+ content?: string;
3783
+ type?: string;
3784
+ name?: string;
3785
+ description?: string;
3786
+ metadata?: Record<string, unknown>;
3787
+ }): Promise<HttpResponse<{
3788
+ data?: Artifact;
3789
+ }>>;
3790
+ }
3791
+
3792
+ /**
3793
+ * ApiKeysService — API key management endpoints API operations.
3794
+ * Auto-generated by sdk-generator — do not edit manually.
3795
+ */
3796
+
3797
+ /** API key management endpoints */
3798
+ declare class ApiKeys {
3799
+ private readonly _http;
3800
+ constructor(http: HttpClient);
3801
+ /**
3802
+ * Get user information for current API key
3803
+ *
3804
+ * Debug endpoint to retrieve user ID and authentication method from the current API key
3805
+ */
3806
+ debugUser(): Promise<HttpResponse<{
3807
+ data?: {
3808
+ userId?: string;
3809
+ authMethod?: string;
3810
+ };
3811
+ }>>;
3812
+ /**
3813
+ * List API keys
3814
+ *
3815
+ * List all API keys for the authenticated user
3816
+ */
3817
+ listApiKeys(): Promise<HttpResponse<{
3818
+ data?: ApiKey[];
3819
+ }>>;
3820
+ /**
3821
+ * Create API key
3822
+ *
3823
+ * Create a new API key for the authenticated user
3824
+ * @param options — Optional parameters
3825
+ */
3826
+ createApiKey(options?: {
3827
+ body?: {
3828
+ label?: string;
3829
+ expiresAt?: string;
3830
+ scopes?: Array<'read' | 'write' | 'admin'>;
3831
+ };
3832
+ }): Promise<HttpResponse<{
3833
+ data?: {
3834
+ apiKey?: string;
3835
+ keyInfo?: ApiKey;
3836
+ };
3837
+ }>>;
3838
+ /**
3839
+ * Delete API key
3840
+ *
3841
+ * Delete (revoke) an API key by its ID
3842
+ * @param id — The API key ID
3843
+ */
3844
+ deleteApiKey(id: string): Promise<HttpResponse<unknown>>;
3845
+ }
3846
+
3847
+ /**
3848
+ * AlertsService — System alerts banner endpoints (customer portal) API operations.
3849
+ * Auto-generated by sdk-generator — do not edit manually.
3850
+ */
3851
+
3852
+ /** System alerts banner endpoints (customer portal) */
3853
+ declare class Alerts {
3854
+ private readonly _http;
3855
+ constructor(http: HttpClient);
3856
+ /**
3857
+ * List active system alerts for the current user
3858
+ *
3859
+ * Returns all active, non-expired system alerts that target either
3860
+ * all users or the authenticated user specifically. Used by the
3861
+ * customer portal to render the system alerts banner.
3862
+ *
3863
+ */
3864
+ getActiveSystemAlerts(): Promise<HttpResponse<{
3865
+ alerts?: SystemAlert[];
3866
+ }>>;
3867
+ }
3868
+
3869
+ /**
3870
+ * AdminService — Admin management endpoints for invite codes and platform configuration API operations.
3871
+ * Auto-generated by sdk-generator — do not edit manually.
3872
+ */
3873
+
3874
+ /** Admin management endpoints for invite codes and platform configuration */
3875
+ declare class Admin {
3876
+ private readonly _http;
3877
+ constructor(http: HttpClient);
3878
+ /**
3879
+ * List invite codes
3880
+ *
3881
+ * List all invite codes with optional status filter
3882
+ * @param options — Optional parameters
3883
+ */
3884
+ adminListInviteCodes(options?: {
3885
+ status?: 'active' | 'exhausted' | 'revoked' | 'expired';
3886
+ limit?: number;
3887
+ offset?: number;
3888
+ }): Promise<HttpResponse<{
3889
+ invites?: Array<{
3890
+ id?: string;
3891
+ code?: string;
3892
+ email?: string;
3893
+ label?: string;
3894
+ maxUses?: number;
3895
+ currentUses?: number;
3896
+ status?: string;
3897
+ expiresAt?: string | null;
3898
+ createdAt?: string;
3899
+ }>;
3900
+ total?: number;
3901
+ }>>;
3902
+ /**
3903
+ * Create invite code
3904
+ *
3905
+ * Create a new invite code for the gated preview
3906
+ * @param body — Request body
3907
+ */
3908
+ adminCreateInviteCode(body: {
3909
+ email: string;
3910
+ label: string;
3911
+ maxUses?: number;
3912
+ code?: string;
3913
+ expiresAt?: string | null;
3914
+ metadata?: Record<string, unknown>;
3915
+ }): Promise<HttpResponse<{
3916
+ id?: string;
3917
+ code?: string;
3918
+ label?: string;
3919
+ maxUses?: number;
3920
+ currentUses?: number;
3921
+ status?: string;
3922
+ expiresAt?: string | null;
3923
+ createdAt?: string;
3924
+ shareUrl?: string;
3925
+ }>>;
3926
+ /**
3927
+ * Get invite system statistics
3928
+ *
3929
+ * Aggregate statistics for the invite system
3930
+ */
3931
+ adminGetInviteStats(): Promise<HttpResponse<{
3932
+ totalCodes?: number;
3933
+ activeCodes?: number;
3934
+ totalRedemptions?: number;
3935
+ totalCapacity?: number;
3936
+ utilizationRate?: number;
3937
+ recentRedemptions?: {
3938
+ code?: string;
3939
+ email?: string;
3940
+ redeemedAt?: string;
3941
+ }[];
3942
+ }>>;
3943
+ /**
3944
+ * Get invite code details
3945
+ *
3946
+ * Get details for a single invite code including redemptions
3947
+ * @param code — The invite code
3948
+ */
3949
+ adminGetInviteCode(code: string): Promise<HttpResponse<{
3950
+ id?: string;
3951
+ code?: string;
3952
+ email?: string;
3953
+ label?: string;
3954
+ maxUses?: number;
3955
+ currentUses?: number;
3956
+ status?: string;
3957
+ redemptions?: {
3958
+ userId?: string;
3959
+ email?: string;
3960
+ redeemedAt?: string;
3961
+ }[];
3962
+ }>>;
3963
+ /**
3964
+ * Revoke an invite code
3965
+ *
3966
+ * Revoke an invite code. Existing accounts created with this code are unaffected.
3967
+ * @param code
3968
+ */
3969
+ adminRevokeInviteCode(code: string): Promise<HttpResponse<{
3970
+ code?: string;
3971
+ status?: string;
3972
+ message?: string;
3973
+ }>>;
3974
+ /**
3975
+ * Get gate status with audit info
3976
+ *
3977
+ * Get current invite gate state with audit information
3978
+ */
3979
+ adminGetGateStatus(): Promise<HttpResponse<{
3980
+ gated?: boolean;
3981
+ updatedAt?: string | null;
3982
+ updatedBy?: string | null;
3983
+ }>>;
3984
+ /**
3985
+ * Toggle invite gate
3986
+ *
3987
+ * Toggle the invite gate. When enabled (true), new signups require a valid invite code.
3988
+ * When disabled (false), registration is open. Takes effect immediately.
3989
+ *
3990
+ * @param body — Request body
3991
+ */
3992
+ adminSetGateStatus(body: {
3993
+ enabled: boolean;
3994
+ }): Promise<HttpResponse<{
3995
+ gated?: boolean;
3996
+ updatedAt?: string;
3997
+ message?: string;
3998
+ }>>;
3999
+ /**
4000
+ * Backfill per-stage memory pipeline status fields by inspecting actual graph state
4001
+ * @param options — Optional parameters
4002
+ */
4003
+ adminMigratePerStageStatus(options?: {
4004
+ body?: {
4005
+ userId?: string;
4006
+ limit?: number;
4007
+ offset?: number;
4008
+ dryRun?: boolean;
4009
+ };
4010
+ }): Promise<HttpResponse<{
4011
+ scanned: number;
4012
+ unchanged: number;
4013
+ updated: number;
4014
+ dryRun: boolean;
4015
+ batchOffset: number;
4016
+ totalCandidates: number;
4017
+ totalRemaining: number;
4018
+ startedAt: string;
4019
+ completedAt: string;
4020
+ durationMs: number;
4021
+ errors: {
4022
+ memoryId?: string;
4023
+ error?: string;
4024
+ }[];
4025
+ toUpdate?: Record<string, unknown>[];
4026
+ toUpdateCount?: number;
4027
+ }>>;
4028
+ }
4029
+
4030
+ /**
4031
+ * AdminAlertsService — Admin endpoints for managing system alerts API operations.
4032
+ * Auto-generated by sdk-generator — do not edit manually.
4033
+ */
4034
+
4035
+ /** Admin endpoints for managing system alerts */
4036
+ declare class AdminAlerts {
4037
+ private readonly _http;
4038
+ constructor(http: HttpClient);
4039
+ /**
4040
+ * List system alerts
4041
+ * @param options — Optional parameters
4042
+ */
4043
+ adminListSystemAlerts(options?: {
4044
+ activeOnly?: boolean;
4045
+ }): Promise<HttpResponse<{
4046
+ alerts?: SystemAlert[];
4047
+ }>>;
4048
+ /**
4049
+ * Create a system alert
4050
+ * @param body — Request body
4051
+ */
4052
+ adminCreateSystemAlert(body: {
4053
+ title: string;
4054
+ body: string;
4055
+ severity?: 'info' | 'warning' | 'critical';
4056
+ active?: boolean;
4057
+ dismissible?: boolean;
4058
+ targetAllUsers?: boolean;
4059
+ targetUserIds?: string[];
4060
+ expiresAt?: string | null;
4061
+ }): Promise<HttpResponse<{
4062
+ id: string;
4063
+ title: string;
4064
+ body: string;
4065
+ severity: 'info' | 'warning' | 'critical';
4066
+ active?: boolean;
4067
+ dismissible?: boolean;
4068
+ targetAllUsers?: boolean;
4069
+ targetUserIds?: string[];
4070
+ createdAt: string;
4071
+ expiresAt: string | null;
4072
+ createdBy: string;
4073
+ }>>;
4074
+ /**
4075
+ * Get a system alert by id
4076
+ * @param id — System alert id
4077
+ */
4078
+ adminGetSystemAlert(id: string): Promise<HttpResponse<{
4079
+ id: string;
4080
+ title: string;
4081
+ body: string;
4082
+ severity: 'info' | 'warning' | 'critical';
4083
+ active?: boolean;
4084
+ dismissible?: boolean;
4085
+ targetAllUsers?: boolean;
4086
+ targetUserIds?: string[];
4087
+ createdAt: string;
4088
+ expiresAt: string | null;
4089
+ createdBy: string;
4090
+ }>>;
4091
+ /**
4092
+ * Delete a system alert
4093
+ * @param id — System alert id
4094
+ */
4095
+ adminDeleteSystemAlert(id: string): Promise<HttpResponse<{
4096
+ deleted?: boolean;
4097
+ }>>;
4098
+ /**
4099
+ * Update a system alert
4100
+ * @param id
4101
+ * @param body — Request body
4102
+ */
4103
+ adminUpdateSystemAlert(id: string, body: {
4104
+ title?: string;
4105
+ body?: string;
4106
+ severity?: 'info' | 'warning' | 'critical';
4107
+ active?: boolean;
4108
+ dismissible?: boolean;
4109
+ targetAllUsers?: boolean;
4110
+ targetUserIds?: string[];
4111
+ expiresAt?: string | null;
4112
+ }): Promise<HttpResponse<{
4113
+ id: string;
4114
+ title: string;
4115
+ body: string;
4116
+ severity: 'info' | 'warning' | 'critical';
4117
+ active?: boolean;
4118
+ dismissible?: boolean;
4119
+ targetAllUsers?: boolean;
4120
+ targetUserIds?: string[];
4121
+ createdAt: string;
4122
+ expiresAt: string | null;
4123
+ createdBy: string;
4124
+ }>>;
4125
+ }
4126
+
4127
+ /**
4128
+ * AdminPipelineService — Admin Pipeline API operations.
4129
+ * Auto-generated by sdk-generator — do not edit manually.
4130
+ */
4131
+
4132
+ declare class AdminPipeline {
4133
+ private readonly _http;
4134
+ constructor(http: HttpClient);
4135
+ /**
4136
+ * Re-enqueue a single memory through one pipeline
4137
+ *
4138
+ * Admin-only. Re-publishes the requested pipeline job for the given
4139
+ * memory and resets the corresponding per-stage status field(s) to
4140
+ * `queued`. Used to recover individual memories from transient
4141
+ * worker failures or to replay a stage after a code change.
4142
+ *
4143
+ * @param id — Memory id (admin can target any tenant).
4144
+ * @param body — Request body
4145
+ */
4146
+ adminRerunMemoryPipeline(id: string, body: {
4147
+ pipeline: 'summary-qna' | 'embeddings' | 'graph';
4148
+ embeddingKind?: 'content' | 'summary' | 'question';
4149
+ questionId?: string;
4150
+ }): Promise<HttpResponse<{
4151
+ memoryId?: string;
4152
+ pipeline?: string;
4153
+ status?: string;
4154
+ }>>;
4155
+ /**
4156
+ * Per-queue depth + failure counts for the memory-creation pipelines
4157
+ *
4158
+ * Returns BullMQ `getJobCounts()` for each known pipeline queue. Queues
4159
+ * that have not yet been provisioned (e.g. `summary-qna` while task 2.3
4160
+ * is in flight) are reported with `{ status: "not_configured" }` rather
4161
+ * than throwing.
4162
+ *
4163
+ */
4164
+ adminGetPipelineHealth(): Promise<HttpResponse<{
4165
+ queues?: Record<string, unknown>;
4166
+ timestamp?: string;
4167
+ }>>;
4168
+ /**
4169
+ * Inspect per-stage pipeline status for a single memory
4170
+ *
4171
+ * Debugging affordance — returns the six per-stage status fields and graphSkipReason.
4172
+ * @param id
4173
+ */
4174
+ adminGetMemoryPipelineStatus(id: string): Promise<HttpResponse<{
4175
+ memoryId?: string;
4176
+ contentEmbeddingStatus?: string | null;
4177
+ summaryStatus?: string | null;
4178
+ questionsStatus?: string | null;
4179
+ summaryEmbeddingStatus?: string | null;
4180
+ questionsEmbeddingStatus?: string | null;
4181
+ graphStatus?: string | null;
4182
+ graphSkipReason?: string | null;
4183
+ }>>;
4184
+ }
4185
+
4186
+ /**
4187
+ * MemNexus Node.js SDK — main client.
4188
+ * Auto-generated by sdk-generator — do not edit manually.
4189
+ */
4190
+
4191
+ /**
4192
+ * MemNexus SDK client.
4193
+ *
4194
+ * Provides access to all MemNexus API services and convenience shorthand methods.
4195
+ *
4196
+ * @example
4197
+ * ```ts
4198
+ * import { MemNexus } from '@memnexus-ai/sdk';
4199
+ *
4200
+ * const client = new MemNexus({ apiKey: 'your-api-key' });
4201
+ * await client.remember('Deployed the new feature');
4202
+ * ```
4203
+ */
4204
+ declare class MemNexus {
4205
+ private readonly _http;
4206
+ /** User management and profile endpoints */
4207
+ readonly users: Users;
4208
+ /** Topic detection, clustering, and management endpoints */
4209
+ readonly topics: Topics;
4210
+ /** System health, monitoring, and configuration endpoints */
4211
+ readonly system: System;
4212
+ /** Pattern detection and behavioral analysis endpoints */
4213
+ readonly patterns: Patterns;
4214
+ /** Behavioral pattern tracking and state management endpoints */
4215
+ readonly behavior: Behavior;
4216
+ /** Behavioral recommendation management endpoints (v2) */
4217
+ readonly recommendations: Recommendations;
4218
+ /** Narrative thread management endpoints */
4219
+ readonly narratives: Narratives;
4220
+ /** Observability and metrics endpoints for production monitoring */
4221
+ readonly monitoring: Monitoring;
4222
+ /** Memory management and retrieval endpoints */
4223
+ readonly memories: Memories;
4224
+ /** Invite code validation and gate status endpoints */
4225
+ readonly invites: Invites;
4226
+ /** Health check endpoints */
4227
+ readonly health: Health;
4228
+ /** Graph-based retrieval augmented generation endpoints */
4229
+ readonly graphrag: Graphrag;
4230
+ /** Fact extraction and management endpoints */
4231
+ readonly facts: Facts;
4232
+ /** Entity extraction and discovery endpoints */
4233
+ readonly entities: Entities;
4234
+ /** Conversation tracking and analysis endpoints */
4235
+ readonly conversations: Conversations;
4236
+ /** Subscription billing and payment management endpoints */
4237
+ readonly billing: Billing;
4238
+ /** Artifact storage and retrieval endpoints */
4239
+ readonly artifacts: Artifacts;
4240
+ /** API key management endpoints */
4241
+ readonly apiKeys: ApiKeys;
4242
+ /** System alerts banner endpoints (customer portal) */
4243
+ readonly alerts: Alerts;
4244
+ /** Admin management endpoints for invite codes and platform configuration */
4245
+ readonly admin: Admin;
4246
+ /** Admin endpoints for managing system alerts */
4247
+ readonly adminAlerts: AdminAlerts;
4248
+ /** Admin Pipeline operations */
4249
+ readonly adminPipeline: AdminPipeline;
4250
+ constructor(options?: HttpClientOptions & {
4251
+ baseUrl?: string;
4252
+ });
4253
+ /**
4254
+ * Save a memory.
4255
+ * Convenience wrapper around `memories.createMemory`.
4256
+ *
4257
+ * @param content — The memory content to save.
4258
+ * @param extra — Additional fields passed to CreateMemoryRequest.
4259
+ */
4260
+ remember(content: string, extra?: Record<string, unknown>): Promise<HttpResponse<unknown>>;
4261
+ /**
4262
+ * Get an AI-synthesized recall digest.
4263
+ * Convenience wrapper.
4264
+ *
4265
+ * @param query — The recall query or topic.
4266
+ */
4267
+ recall(query: string, extra?: Record<string, unknown>): Promise<HttpResponse<unknown>>;
4268
+ /**
4269
+ * Search memories.
4270
+ * Convenience wrapper.
4271
+ *
4272
+ * @param query — The search query.
4273
+ */
4274
+ search(query: string, extra?: Record<string, unknown>): Promise<HttpResponse<unknown>>;
4275
+ /**
4276
+ * Build a context briefing.
4277
+ * Convenience wrapper.
4278
+ *
4279
+ * @param context — Context description for the briefing.
4280
+ */
4281
+ brief(context: string, extra?: Record<string, unknown>): Promise<HttpResponse<unknown>>;
4282
+ /**
4283
+ * Delete a memory by ID.
4284
+ * Convenience wrapper.
4285
+ *
4286
+ * @param memoryId — The ID of the memory to delete.
4287
+ */
4288
+ forget(memoryId: string): Promise<HttpResponse<unknown>>;
4289
+ }
4290
+
4291
+ export { type AddMemoryToNarrativeRequest, type ApiKey, type Artifact, type BatchGetMemoriesMeta, type BatchGetMemoriesRequest, type BatchGetMemoriesResponse, type BillingOverview, type BuildContextActiveWork, type BuildContextActivity, type BuildContextFact, type BuildContextGotcha, type BuildContextMeta, type BuildContextPattern, type BuildContextRequest, type BuildContextResponse, type BulkDeleteRequest, type BulkDeleteResponse, type BulkTagRequest, type BulkTagResponse, type BulkUpdateRequest, type BulkUpdateResponse, type CheckoutSessionResponse, type ClaimGroup, type ClaimGroupClaim, type ClaimGroupSignals, type CodeContext, type Community, type CompileInstructionsRequest, type CompileInstructionsResponse, type Conversation, type CreateArtifactRequest, type CreateCheckoutSessionRequest, type CreateConversationRequest, type CreateFactRequest, type CreateMemoryRelationshipRequest, type CreateMemoryRequest, type CreateMemoryResponse, type CreateMemoryResponseMeta, type CreateNarrativeRequest, type CreatePortalSessionRequest, type CreateRecommendationRequest, type CreateSystemAlertRequest, type DigestEntity, type DigestKeyFact, type DigestMetadata, type DigestRequest, type DigestResponse, type DigestSource, type DigestTimeRange, type EffectiveStateBreakdown, type Entity, type EntityNode, type Error$1 as Error, type ExportRequest, type FacetEntry, type Facets, type Fact, type FactSearchRequest, type GetMemoryResponse, type GetNarrativeResponse, type GraphRAGQueryRequest, type GraphRAGQueryResponse, type HealthCheck, type HttpClientOptions, type HttpResponse, type Invoice, type ListInvoicesResponse, type ListNarrativesResponse, type ListPaymentMethodsResponse, type MatchRecommendationsRequest, MemNexus, type Memory, type MemoryRelationship, type MemoryRelationshipsResponse, type NamedMemoryHistoryResponse, type NarrativeMemory, type NarrativeThread, type NarrativeTimelineResponse, type Pagination, type Pattern, type PaymentMethod, type PortalSessionResponse, type PrecomputedMemoryFields, type Recommendation, type RelatedMemoryResult, SdkError, type SearchMeta, type SearchRequest, type SearchResponse, type SearchResult, type ServiceCheck, type Subscription, type SystemAlert, type TemporalMetadata, type Topic, type UpdateArtifactRequest, type UpdateFactRequest, type UpdateMemoryRequest, type UpdateNamedMemoryRequest, type UpdateNarrativeRequest, type UpdateSystemAlertRequest, type User, type UserUsage };