@scitrera/memorylayer-sdk 0.0.5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +177 -0
- package/README.md +22 -0
- package/dist/client.d.ts +316 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +896 -67
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +9 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +14 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/knowledgebase.d.ts +41 -0
- package/dist/knowledgebase.d.ts.map +1 -0
- package/dist/knowledgebase.js +86 -0
- package/dist/knowledgebase.js.map +1 -0
- package/dist/mcp_servers.d.ts +94 -0
- package/dist/mcp_servers.d.ts.map +1 -0
- package/dist/mcp_servers.js +132 -0
- package/dist/mcp_servers.js.map +1 -0
- package/dist/rpg.d.ts +178 -0
- package/dist/rpg.d.ts.map +1 -0
- package/dist/rpg.js +126 -0
- package/dist/rpg.js.map +1 -0
- package/dist/skills.d.ts +194 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +465 -0
- package/dist/skills.js.map +1 -0
- package/dist/types.d.ts +630 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +27 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +43 -0
- package/dist/utils.js.map +1 -1
- package/package.json +11 -3
- package/vitest.config.ts +0 -12
package/dist/types.d.ts
CHANGED
|
@@ -16,7 +16,8 @@ export declare enum MemorySubtype {
|
|
|
16
16
|
PROFILE = "profile",
|
|
17
17
|
ENTITY = "entity",
|
|
18
18
|
EVENT = "event",
|
|
19
|
-
DIRECTIVE = "directive"
|
|
19
|
+
DIRECTIVE = "directive",
|
|
20
|
+
INFERENCE = "inference"
|
|
20
21
|
}
|
|
21
22
|
export declare enum RecallMode {
|
|
22
23
|
RAG = "rag",
|
|
@@ -96,6 +97,46 @@ export interface Memory {
|
|
|
96
97
|
deleted_at?: string;
|
|
97
98
|
created_at: string;
|
|
98
99
|
updated_at: string;
|
|
100
|
+
match_signals?: string[];
|
|
101
|
+
relation_write_result?: EntityRelationWriteResult;
|
|
102
|
+
}
|
|
103
|
+
export interface EntityRelationInput {
|
|
104
|
+
source_entity_id?: string;
|
|
105
|
+
source_entity_name?: string;
|
|
106
|
+
target_entity_id?: string;
|
|
107
|
+
target_entity_name?: string;
|
|
108
|
+
relationship: string;
|
|
109
|
+
confidence?: number;
|
|
110
|
+
source_span_start?: number;
|
|
111
|
+
source_span_end?: number;
|
|
112
|
+
}
|
|
113
|
+
export interface EntityRelationWriteResult {
|
|
114
|
+
resolved: number;
|
|
115
|
+
unresolved: number;
|
|
116
|
+
rejected: number;
|
|
117
|
+
duplicate: number;
|
|
118
|
+
relation_ids: string[];
|
|
119
|
+
errors: string[];
|
|
120
|
+
}
|
|
121
|
+
export interface BudgetSummary {
|
|
122
|
+
requested?: number;
|
|
123
|
+
used: number;
|
|
124
|
+
estimator: string;
|
|
125
|
+
truncated_items: number;
|
|
126
|
+
omitted_items: number;
|
|
127
|
+
}
|
|
128
|
+
export interface GenerationSummary {
|
|
129
|
+
policy: "deterministic" | "adaptive" | "generative";
|
|
130
|
+
calls: number;
|
|
131
|
+
input_tokens: number;
|
|
132
|
+
output_tokens: number;
|
|
133
|
+
}
|
|
134
|
+
export interface EntityRelationPath {
|
|
135
|
+
seed_entity_id: string;
|
|
136
|
+
entity_ids: string[];
|
|
137
|
+
relations: Array<Record<string, unknown>>;
|
|
138
|
+
evidence_ids: string[];
|
|
139
|
+
evidence_memory_ids: string[];
|
|
99
140
|
}
|
|
100
141
|
export interface RecallResult {
|
|
101
142
|
memories: Memory[];
|
|
@@ -112,6 +153,11 @@ export interface RecallResult {
|
|
|
112
153
|
full_would_be: number;
|
|
113
154
|
savings_percent: number;
|
|
114
155
|
};
|
|
156
|
+
retrieval_confidence: "strong" | "moderate" | "weak";
|
|
157
|
+
confidence_reasons: string[];
|
|
158
|
+
budget_summary?: BudgetSummary;
|
|
159
|
+
generation_summary?: GenerationSummary;
|
|
160
|
+
relation_paths: EntityRelationPath[];
|
|
115
161
|
}
|
|
116
162
|
export interface ReflectResult {
|
|
117
163
|
reflection: string;
|
|
@@ -159,11 +205,71 @@ export interface SessionBriefing {
|
|
|
159
205
|
contradictions_detected: Array<Record<string, unknown>>;
|
|
160
206
|
memories: Array<Record<string, unknown>>;
|
|
161
207
|
}
|
|
208
|
+
export interface SessionCheckpoint {
|
|
209
|
+
id: string;
|
|
210
|
+
workspace_id: string;
|
|
211
|
+
session_id: string;
|
|
212
|
+
raw_memory_id: string;
|
|
213
|
+
source_kind: string;
|
|
214
|
+
source_sequence?: number;
|
|
215
|
+
source_boundary?: number;
|
|
216
|
+
content_hash: string;
|
|
217
|
+
byte_count: number;
|
|
218
|
+
capture_status: string;
|
|
219
|
+
index_status: string;
|
|
220
|
+
enrichment_status: string;
|
|
221
|
+
idempotency_key: string;
|
|
222
|
+
created_at: string;
|
|
223
|
+
updated_at: string;
|
|
224
|
+
}
|
|
225
|
+
export interface ContextPackItem {
|
|
226
|
+
id: string;
|
|
227
|
+
kind: string;
|
|
228
|
+
content: string;
|
|
229
|
+
importance: number;
|
|
230
|
+
event_time?: string;
|
|
231
|
+
match_signals: string[];
|
|
232
|
+
source_references: string[];
|
|
233
|
+
tombstone: boolean;
|
|
234
|
+
}
|
|
235
|
+
export interface ContextPack {
|
|
236
|
+
rendered: string;
|
|
237
|
+
items: ContextPackItem[];
|
|
238
|
+
open_threads: Array<Record<string, unknown>>;
|
|
239
|
+
unresolved_contradictions: Array<Record<string, unknown>>;
|
|
240
|
+
budget_summary: BudgetSummary;
|
|
241
|
+
generation_summary: GenerationSummary;
|
|
242
|
+
cursor: string;
|
|
243
|
+
degradation_notices: string[];
|
|
244
|
+
}
|
|
245
|
+
export interface ContextDelta {
|
|
246
|
+
rendered: string;
|
|
247
|
+
items: ContextPackItem[];
|
|
248
|
+
budget_summary: BudgetSummary;
|
|
249
|
+
generation_summary: GenerationSummary;
|
|
250
|
+
cursor: string;
|
|
251
|
+
has_more: boolean;
|
|
252
|
+
degradation_notices: string[];
|
|
253
|
+
}
|
|
254
|
+
export interface ContextPackOptions {
|
|
255
|
+
topic?: string;
|
|
256
|
+
entityIds?: string[];
|
|
257
|
+
entityNames?: string[];
|
|
258
|
+
budgetTokens?: number;
|
|
259
|
+
sectionLimits?: Record<string, number>;
|
|
260
|
+
includeDirectives?: boolean;
|
|
261
|
+
includeWorkingMemory?: boolean;
|
|
262
|
+
includeRecentActivity?: boolean;
|
|
263
|
+
includeContradictions?: boolean;
|
|
264
|
+
includeSandboxSummary?: boolean;
|
|
265
|
+
includeCheckpointRecovery?: boolean;
|
|
266
|
+
}
|
|
162
267
|
export interface Workspace {
|
|
163
268
|
id: string;
|
|
164
269
|
tenant_id: string;
|
|
165
270
|
name: string;
|
|
166
271
|
settings: Record<string, unknown>;
|
|
272
|
+
tags: string[];
|
|
167
273
|
created_at: string;
|
|
168
274
|
updated_at: string;
|
|
169
275
|
}
|
|
@@ -192,6 +298,9 @@ export interface RememberOptions {
|
|
|
192
298
|
metadata?: Record<string, unknown>;
|
|
193
299
|
associations?: string[];
|
|
194
300
|
contextId?: string;
|
|
301
|
+
userId?: string;
|
|
302
|
+
authority?: AuthorityContext;
|
|
303
|
+
relations?: EntityRelationInput[];
|
|
195
304
|
}
|
|
196
305
|
export interface RecallOptions {
|
|
197
306
|
/** Override workspace for this query (fallback if session not set) */
|
|
@@ -210,12 +319,29 @@ export interface RecallOptions {
|
|
|
210
319
|
maxExpansion?: number;
|
|
211
320
|
createdAfter?: Date;
|
|
212
321
|
createdBefore?: Date;
|
|
322
|
+
/** Skip this many results (pagination). Maps to `offset`. */
|
|
323
|
+
offset?: number;
|
|
324
|
+
/** Keep memories whose effective event time is >= this. Maps to `event_after`. */
|
|
325
|
+
eventAfter?: Date;
|
|
326
|
+
/** Keep memories whose effective event time is <= this. Maps to `event_before`. */
|
|
327
|
+
eventBefore?: Date;
|
|
328
|
+
/** Order results by effective event time: 'asc' or 'desc' (omit = by relevance). */
|
|
329
|
+
timeOrder?: 'asc' | 'desc';
|
|
330
|
+
/** Include the _global workspace in search (default true server-side). */
|
|
331
|
+
includeGlobal?: boolean;
|
|
332
|
+
/** Include the user-scoped global workspace (_global_user), filtered by user_id. */
|
|
333
|
+
includeGlobalUser?: boolean;
|
|
213
334
|
conversationContext?: Array<{
|
|
214
335
|
role: string;
|
|
215
336
|
content: string;
|
|
216
337
|
}>;
|
|
217
338
|
ragThreshold?: number;
|
|
218
339
|
detailLevel?: DetailLevel | 'abstract' | 'overview' | 'full';
|
|
340
|
+
userId?: string;
|
|
341
|
+
authority?: AuthorityContext;
|
|
342
|
+
budgetTokens?: number;
|
|
343
|
+
includeConfidence?: boolean;
|
|
344
|
+
includeRelations?: boolean;
|
|
219
345
|
}
|
|
220
346
|
export interface ReflectOptions {
|
|
221
347
|
/** Override workspace for this query (fallback if session not set) */
|
|
@@ -227,6 +353,16 @@ export interface ReflectOptions {
|
|
|
227
353
|
subtypes?: (MemorySubtype | string)[];
|
|
228
354
|
tags?: string[];
|
|
229
355
|
contextId?: string;
|
|
356
|
+
userId?: string;
|
|
357
|
+
authority?: AuthorityContext;
|
|
358
|
+
}
|
|
359
|
+
export interface PrincipalRef {
|
|
360
|
+
type: string;
|
|
361
|
+
id: string;
|
|
362
|
+
}
|
|
363
|
+
export interface AuthorityContext {
|
|
364
|
+
grantId: string;
|
|
365
|
+
subject: PrincipalRef;
|
|
230
366
|
}
|
|
231
367
|
export interface ClientConfig {
|
|
232
368
|
baseUrl?: string;
|
|
@@ -234,6 +370,27 @@ export interface ClientConfig {
|
|
|
234
370
|
workspaceId?: string;
|
|
235
371
|
sessionId?: string;
|
|
236
372
|
timeout?: number;
|
|
373
|
+
defaultAuthority?: AuthorityContext;
|
|
374
|
+
/**
|
|
375
|
+
* Maximum number of retries for transient failures (5xx, 429). Defaults to 3.
|
|
376
|
+
* Set to 0 to disable retries.
|
|
377
|
+
*/
|
|
378
|
+
maxRetries?: number;
|
|
379
|
+
/**
|
|
380
|
+
* Base delay in milliseconds for exponential backoff between retries.
|
|
381
|
+
* Defaults to 500. Actual delay is `retryBaseDelay * 2^attempt`, or the
|
|
382
|
+
* `Retry-After` header value when the server provides one.
|
|
383
|
+
*/
|
|
384
|
+
retryBaseDelay?: number;
|
|
385
|
+
/**
|
|
386
|
+
* Custom fetch implementation. Defaults to globalThis.fetch.
|
|
387
|
+
*
|
|
388
|
+
* Use this to route requests through an alternate transport — for example,
|
|
389
|
+
* `AetherFetchTransport` from `@scitrera/aether-client` so requests tunnel
|
|
390
|
+
* over an Aether sidecar instead of a direct HTTP call. The implementation
|
|
391
|
+
* must match the WHATWG fetch signature.
|
|
392
|
+
*/
|
|
393
|
+
fetch?: typeof fetch;
|
|
237
394
|
}
|
|
238
395
|
export interface SessionCreateOptions {
|
|
239
396
|
sessionId?: string;
|
|
@@ -298,18 +455,18 @@ export interface GraphQueryResult {
|
|
|
298
455
|
query_latency_ms: number;
|
|
299
456
|
}
|
|
300
457
|
export type BatchOperation = {
|
|
301
|
-
|
|
458
|
+
op: "create";
|
|
302
459
|
memory: RememberOptions & {
|
|
303
460
|
content: string;
|
|
304
461
|
};
|
|
305
462
|
} | {
|
|
306
|
-
|
|
463
|
+
op: "update";
|
|
307
464
|
memory_id: string;
|
|
308
465
|
updates: Partial<RememberOptions> & {
|
|
309
466
|
content?: string;
|
|
310
467
|
};
|
|
311
468
|
} | {
|
|
312
|
-
|
|
469
|
+
op: "delete";
|
|
313
470
|
memory_id: string;
|
|
314
471
|
hard?: boolean;
|
|
315
472
|
};
|
|
@@ -392,6 +549,81 @@ export interface ContextInjectResult {
|
|
|
392
549
|
key: string;
|
|
393
550
|
type: string;
|
|
394
551
|
}
|
|
552
|
+
export interface DocumentPage {
|
|
553
|
+
id: string;
|
|
554
|
+
document_id: string;
|
|
555
|
+
workspace_id: string;
|
|
556
|
+
page_no: number;
|
|
557
|
+
image_storage_path?: string;
|
|
558
|
+
transcript?: string;
|
|
559
|
+
transcript_model?: string;
|
|
560
|
+
metadata: Record<string, unknown>;
|
|
561
|
+
created_at?: string;
|
|
562
|
+
relevance_score?: number;
|
|
563
|
+
}
|
|
564
|
+
export interface DocumentInfo {
|
|
565
|
+
id: string;
|
|
566
|
+
workspace_id: string;
|
|
567
|
+
filename: string;
|
|
568
|
+
document_type: string;
|
|
569
|
+
content_hash: string;
|
|
570
|
+
size_bytes: number;
|
|
571
|
+
mime_type?: string;
|
|
572
|
+
status: string;
|
|
573
|
+
target_context_id: string;
|
|
574
|
+
page_count: number;
|
|
575
|
+
chunk_count: number;
|
|
576
|
+
memory_ids: string[];
|
|
577
|
+
storage_path?: string;
|
|
578
|
+
retain_original: boolean;
|
|
579
|
+
metadata: Record<string, unknown>;
|
|
580
|
+
created_at: string;
|
|
581
|
+
processing_started_at?: string;
|
|
582
|
+
processing_completed_at?: string;
|
|
583
|
+
}
|
|
584
|
+
export interface JobInfo {
|
|
585
|
+
id: string;
|
|
586
|
+
workspace_id: string;
|
|
587
|
+
document_ids: string[];
|
|
588
|
+
status: string;
|
|
589
|
+
progress_percent: number;
|
|
590
|
+
documents_processed: number;
|
|
591
|
+
total_memories_created: number;
|
|
592
|
+
errors: Array<Record<string, unknown>>;
|
|
593
|
+
created_at: string;
|
|
594
|
+
started_at?: string;
|
|
595
|
+
completed_at?: string;
|
|
596
|
+
}
|
|
597
|
+
export interface DocumentUploadOptions {
|
|
598
|
+
targetContextId?: string;
|
|
599
|
+
chunkingStrategy?: string;
|
|
600
|
+
chunkSize?: number;
|
|
601
|
+
chunkOverlap?: number;
|
|
602
|
+
importance?: number;
|
|
603
|
+
retainOriginal?: boolean;
|
|
604
|
+
}
|
|
605
|
+
export interface DocumentUploadResponse {
|
|
606
|
+
document: DocumentInfo;
|
|
607
|
+
job: JobInfo;
|
|
608
|
+
}
|
|
609
|
+
export interface PageSearchOptions {
|
|
610
|
+
limit?: number;
|
|
611
|
+
docIds?: string[];
|
|
612
|
+
}
|
|
613
|
+
export interface PageSearchResponse {
|
|
614
|
+
pages: DocumentPage[];
|
|
615
|
+
total_count: number;
|
|
616
|
+
query: string;
|
|
617
|
+
}
|
|
618
|
+
export interface PageListResponse {
|
|
619
|
+
document_id: string;
|
|
620
|
+
pages: DocumentPage[];
|
|
621
|
+
total_count: number;
|
|
622
|
+
}
|
|
623
|
+
export interface DocumentListResponse {
|
|
624
|
+
documents: DocumentInfo[];
|
|
625
|
+
total_count: number;
|
|
626
|
+
}
|
|
395
627
|
export interface ContextQueryOptions {
|
|
396
628
|
maxContextChars?: number;
|
|
397
629
|
resultVar?: string;
|
|
@@ -422,4 +654,398 @@ export interface ContextStatusResult {
|
|
|
422
654
|
execution_count: number;
|
|
423
655
|
memory_bytes?: number;
|
|
424
656
|
}
|
|
657
|
+
export interface ChatMessageContent {
|
|
658
|
+
type: string;
|
|
659
|
+
text?: string;
|
|
660
|
+
data?: Record<string, unknown>;
|
|
661
|
+
}
|
|
662
|
+
export interface ChatMessage {
|
|
663
|
+
id: string;
|
|
664
|
+
thread_id: string;
|
|
665
|
+
message_index: number;
|
|
666
|
+
role: string;
|
|
667
|
+
content: string | ChatMessageContent[];
|
|
668
|
+
metadata: Record<string, unknown>;
|
|
669
|
+
created_at: string;
|
|
670
|
+
}
|
|
671
|
+
export interface ChatThread {
|
|
672
|
+
id: string;
|
|
673
|
+
workspace_id: string;
|
|
674
|
+
tenant_id: string;
|
|
675
|
+
user_id?: string;
|
|
676
|
+
context_id: string;
|
|
677
|
+
observer_id?: string;
|
|
678
|
+
subject_id?: string;
|
|
679
|
+
title?: string;
|
|
680
|
+
metadata: Record<string, unknown>;
|
|
681
|
+
message_count: number;
|
|
682
|
+
last_decomposed_at?: string;
|
|
683
|
+
last_decomposed_index: number;
|
|
684
|
+
expires_at?: string;
|
|
685
|
+
created_at: string;
|
|
686
|
+
updated_at: string;
|
|
687
|
+
}
|
|
688
|
+
export interface ThreadCreateOptions {
|
|
689
|
+
threadId?: string;
|
|
690
|
+
workspaceId?: string;
|
|
691
|
+
userId?: string;
|
|
692
|
+
contextId?: string;
|
|
693
|
+
observerId?: string;
|
|
694
|
+
subjectId?: string;
|
|
695
|
+
title?: string;
|
|
696
|
+
metadata?: Record<string, unknown>;
|
|
697
|
+
expiresAt?: string;
|
|
698
|
+
}
|
|
699
|
+
export interface ThreadListOptions {
|
|
700
|
+
workspaceId?: string;
|
|
701
|
+
userId?: string;
|
|
702
|
+
limit?: number;
|
|
703
|
+
offset?: number;
|
|
704
|
+
}
|
|
705
|
+
export interface MessageAppendInput {
|
|
706
|
+
role: string;
|
|
707
|
+
content: string | ChatMessageContent[];
|
|
708
|
+
metadata?: Record<string, unknown>;
|
|
709
|
+
}
|
|
710
|
+
export interface ThreadWithMessagesResponse {
|
|
711
|
+
thread: ChatThread;
|
|
712
|
+
messages: ChatMessage[];
|
|
713
|
+
total_messages: number;
|
|
714
|
+
}
|
|
715
|
+
export interface ThreadListResponse {
|
|
716
|
+
threads: ChatThread[];
|
|
717
|
+
total_count: number;
|
|
718
|
+
}
|
|
719
|
+
export interface MessageListResponse {
|
|
720
|
+
messages: ChatMessage[];
|
|
721
|
+
thread_id: string;
|
|
722
|
+
total_count: number;
|
|
723
|
+
}
|
|
724
|
+
export interface MessagesAppendResponse {
|
|
725
|
+
messages: ChatMessage[];
|
|
726
|
+
thread_id: string;
|
|
727
|
+
new_message_count: number;
|
|
728
|
+
}
|
|
729
|
+
export interface DecomposeResponse {
|
|
730
|
+
thread_id: string;
|
|
731
|
+
workspace_id: string;
|
|
732
|
+
messages_processed: number;
|
|
733
|
+
memories_created: number;
|
|
734
|
+
from_index: number;
|
|
735
|
+
to_index: number;
|
|
736
|
+
}
|
|
737
|
+
export interface DatasetColumn {
|
|
738
|
+
name: string;
|
|
739
|
+
dtype: string;
|
|
740
|
+
column_type: string;
|
|
741
|
+
nullable: boolean;
|
|
742
|
+
null_count: number;
|
|
743
|
+
null_percent: number;
|
|
744
|
+
unique_count: number;
|
|
745
|
+
min_value?: number;
|
|
746
|
+
max_value?: number;
|
|
747
|
+
mean_value?: number;
|
|
748
|
+
median_value?: number;
|
|
749
|
+
std_value?: number;
|
|
750
|
+
p25_value?: number;
|
|
751
|
+
p75_value?: number;
|
|
752
|
+
min_length?: number;
|
|
753
|
+
max_length?: number;
|
|
754
|
+
avg_length?: number;
|
|
755
|
+
top_values?: Array<Record<string, unknown>>;
|
|
756
|
+
is_temporal: boolean;
|
|
757
|
+
temporal_resolution?: string;
|
|
758
|
+
temporal_range_start?: string;
|
|
759
|
+
temporal_range_end?: string;
|
|
760
|
+
histogram?: Record<string, unknown>;
|
|
761
|
+
}
|
|
762
|
+
export interface DatasetInfo {
|
|
763
|
+
id: string;
|
|
764
|
+
workspace_id: string;
|
|
765
|
+
name: string;
|
|
766
|
+
filename: string;
|
|
767
|
+
format: string;
|
|
768
|
+
content_hash: string;
|
|
769
|
+
size_bytes: number;
|
|
770
|
+
status: string;
|
|
771
|
+
target_context_id: string;
|
|
772
|
+
row_count: number;
|
|
773
|
+
column_count: number;
|
|
774
|
+
columns: DatasetColumn[];
|
|
775
|
+
memory_ids: string[];
|
|
776
|
+
profile_summary?: string;
|
|
777
|
+
metadata: Record<string, unknown>;
|
|
778
|
+
created_at: string;
|
|
779
|
+
profiling_started_at?: string;
|
|
780
|
+
profiling_completed_at?: string;
|
|
781
|
+
}
|
|
782
|
+
export interface DatasetJobInfo {
|
|
783
|
+
id: string;
|
|
784
|
+
workspace_id: string;
|
|
785
|
+
dataset_ids: string[];
|
|
786
|
+
status: string;
|
|
787
|
+
progress_percent: number;
|
|
788
|
+
datasets_processed: number;
|
|
789
|
+
total_memories_created: number;
|
|
790
|
+
errors: Array<Record<string, unknown>>;
|
|
791
|
+
created_at: string;
|
|
792
|
+
started_at?: string;
|
|
793
|
+
completed_at?: string;
|
|
794
|
+
}
|
|
795
|
+
export interface DatasetUploadOptions {
|
|
796
|
+
name?: string;
|
|
797
|
+
targetContextId?: string;
|
|
798
|
+
importance?: number;
|
|
799
|
+
sampleRows?: number;
|
|
800
|
+
detectTimeSeries?: boolean;
|
|
801
|
+
generateSummaries?: boolean;
|
|
802
|
+
}
|
|
803
|
+
export interface DatasetUploadResponse {
|
|
804
|
+
dataset: DatasetInfo;
|
|
805
|
+
job: DatasetJobInfo;
|
|
806
|
+
}
|
|
807
|
+
export interface DatasetListResponse {
|
|
808
|
+
datasets: DatasetInfo[];
|
|
809
|
+
total_count: number;
|
|
810
|
+
}
|
|
811
|
+
export interface DatasetSliceOptions {
|
|
812
|
+
sql?: string;
|
|
813
|
+
columns?: string[];
|
|
814
|
+
filters?: Array<Record<string, unknown>>;
|
|
815
|
+
orderBy?: string;
|
|
816
|
+
descending?: boolean;
|
|
817
|
+
limit?: number;
|
|
818
|
+
offset?: number;
|
|
819
|
+
}
|
|
820
|
+
export interface DatasetSliceResult {
|
|
821
|
+
dataset_id: string;
|
|
822
|
+
columns: string[];
|
|
823
|
+
dtypes: string[];
|
|
824
|
+
rows: unknown[][];
|
|
825
|
+
total_matching: number;
|
|
826
|
+
returned_count: number;
|
|
827
|
+
sql_executed?: string;
|
|
828
|
+
}
|
|
829
|
+
export interface DatasetMemoriesResponse {
|
|
830
|
+
dataset_id: string;
|
|
831
|
+
memories: Array<{
|
|
832
|
+
id: string;
|
|
833
|
+
content: string;
|
|
834
|
+
type: string;
|
|
835
|
+
importance: number;
|
|
836
|
+
tags: string[];
|
|
837
|
+
created_at: string;
|
|
838
|
+
}>;
|
|
839
|
+
total_count: number;
|
|
840
|
+
}
|
|
841
|
+
export interface ApiToken {
|
|
842
|
+
id: string;
|
|
843
|
+
name: string;
|
|
844
|
+
principal_type: string;
|
|
845
|
+
workspace_patterns: string[];
|
|
846
|
+
scopes: string[];
|
|
847
|
+
created_at: string;
|
|
848
|
+
expires_at?: string | null;
|
|
849
|
+
revoked: boolean;
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* Response from creating a token — extends {@link ApiToken} with the
|
|
853
|
+
* plaintext `token` value, which is only ever returned at creation time.
|
|
854
|
+
*/
|
|
855
|
+
export interface ApiTokenWithSecret extends ApiToken {
|
|
856
|
+
token: string;
|
|
857
|
+
}
|
|
858
|
+
export interface TokenCreateOptions {
|
|
859
|
+
name: string;
|
|
860
|
+
/** Principal type for the token. Defaults to "User" server-side. */
|
|
861
|
+
principalType?: string;
|
|
862
|
+
/** Workspace glob patterns the token may access. Defaults to ["*"]. */
|
|
863
|
+
workspacePatterns?: string[];
|
|
864
|
+
/** Permission scopes. Defaults to ["*"]. */
|
|
865
|
+
scopes?: string[];
|
|
866
|
+
/** Token lifetime in days. Omit for a non-expiring token. */
|
|
867
|
+
expiresInDays?: number;
|
|
868
|
+
}
|
|
869
|
+
export interface TokenListResponse {
|
|
870
|
+
tokens: ApiToken[];
|
|
871
|
+
}
|
|
872
|
+
export interface MemoryListOptions {
|
|
873
|
+
limit?: number;
|
|
874
|
+
offset?: number;
|
|
875
|
+
type?: MemoryType | string;
|
|
876
|
+
subtype?: MemorySubtype | string;
|
|
877
|
+
/** Filter by a single tag. */
|
|
878
|
+
tag?: string;
|
|
879
|
+
contextId?: string;
|
|
880
|
+
}
|
|
881
|
+
export interface MemoryListResponse {
|
|
882
|
+
memories: Memory[];
|
|
883
|
+
total_count: number;
|
|
884
|
+
}
|
|
885
|
+
export type EntityTypeValue = "person" | "org" | "project" | "place" | "concept" | "event";
|
|
886
|
+
export interface Entity {
|
|
887
|
+
id: string;
|
|
888
|
+
workspace_id: string;
|
|
889
|
+
entity_type: EntityTypeValue | string;
|
|
890
|
+
canonical_name: string;
|
|
891
|
+
normalized_name: string;
|
|
892
|
+
aliases: string[];
|
|
893
|
+
confidence: number;
|
|
894
|
+
provenance: Record<string, unknown>;
|
|
895
|
+
representative_memory_id?: string | null;
|
|
896
|
+
status: string;
|
|
897
|
+
merged_into?: string | null;
|
|
898
|
+
created_at: string;
|
|
899
|
+
updated_at: string;
|
|
900
|
+
}
|
|
901
|
+
export interface EntityResolution {
|
|
902
|
+
entity: Entity;
|
|
903
|
+
matched_via: "exact" | "alias" | "created" | "embedding";
|
|
904
|
+
score: number;
|
|
905
|
+
}
|
|
906
|
+
export interface EntityListResponse {
|
|
907
|
+
entities: Entity[];
|
|
908
|
+
total_count: number;
|
|
909
|
+
}
|
|
910
|
+
export interface EntityResponse {
|
|
911
|
+
entity: Entity;
|
|
912
|
+
}
|
|
913
|
+
export interface EntityResolveResponse {
|
|
914
|
+
resolution: EntityResolution;
|
|
915
|
+
}
|
|
916
|
+
export interface EntityListOptions {
|
|
917
|
+
workspaceId?: string;
|
|
918
|
+
/** Entity status filter: 'active' (default) or 'merged'. */
|
|
919
|
+
status?: "active" | "merged";
|
|
920
|
+
limit?: number;
|
|
921
|
+
}
|
|
922
|
+
export interface EntityResolveOptions {
|
|
923
|
+
workspaceId?: string;
|
|
924
|
+
/** Entity type to resolve against. Defaults to 'person' server-side. */
|
|
925
|
+
entityType?: EntityTypeValue | string;
|
|
926
|
+
}
|
|
927
|
+
export interface EntityMergeOptions {
|
|
928
|
+
sourceId: string;
|
|
929
|
+
targetId: string;
|
|
930
|
+
/** Audit reason recorded in the merged entity's provenance. */
|
|
931
|
+
reason: string;
|
|
932
|
+
workspaceId?: string;
|
|
933
|
+
}
|
|
934
|
+
export interface AssociationUpdateOptions {
|
|
935
|
+
/** New relationship strength (omit = unchanged). */
|
|
936
|
+
strength?: number;
|
|
937
|
+
/** New metadata dict, replaces existing (omit = unchanged). */
|
|
938
|
+
metadata?: Record<string, unknown>;
|
|
939
|
+
}
|
|
940
|
+
export interface ThreadUpdateOptions {
|
|
941
|
+
title?: string;
|
|
942
|
+
metadata?: Record<string, unknown>;
|
|
943
|
+
workspaceId?: string;
|
|
944
|
+
}
|
|
945
|
+
export interface UserThreadListOptions {
|
|
946
|
+
/** Ownership filter: 'user' (default) or 'workspace'. */
|
|
947
|
+
ownership?: "user" | "workspace";
|
|
948
|
+
/** Scope filter: 'web' | 'office' | undefined (all). */
|
|
949
|
+
scopeFilter?: "web" | "office";
|
|
950
|
+
limit?: number;
|
|
951
|
+
offset?: number;
|
|
952
|
+
}
|
|
953
|
+
export interface GraphStats {
|
|
954
|
+
node_count: number;
|
|
955
|
+
edge_count: number;
|
|
956
|
+
community_count: number;
|
|
957
|
+
density: number;
|
|
958
|
+
avg_degree: number;
|
|
959
|
+
max_degree: number;
|
|
960
|
+
god_node_count: number;
|
|
961
|
+
}
|
|
962
|
+
export interface Knowledgebase {
|
|
963
|
+
workspace_id: string;
|
|
964
|
+
article_count: number;
|
|
965
|
+
community_count: number;
|
|
966
|
+
generated_at: string;
|
|
967
|
+
stats?: GraphStats | null;
|
|
968
|
+
}
|
|
969
|
+
export interface KBArticle {
|
|
970
|
+
id: string;
|
|
971
|
+
article_type: string;
|
|
972
|
+
title: string;
|
|
973
|
+
content_md: string;
|
|
974
|
+
metadata: Record<string, unknown>;
|
|
975
|
+
generated_at: string;
|
|
976
|
+
}
|
|
977
|
+
export interface KBArticleListResponse {
|
|
978
|
+
articles: KBArticle[];
|
|
979
|
+
total: number;
|
|
980
|
+
}
|
|
981
|
+
export interface KBGenerateOptions {
|
|
982
|
+
workspaceId?: string;
|
|
983
|
+
contextId?: string;
|
|
984
|
+
includeRpg?: boolean;
|
|
985
|
+
maxCommunities?: number;
|
|
986
|
+
maxGodNodes?: number;
|
|
987
|
+
regenerate?: boolean;
|
|
988
|
+
}
|
|
989
|
+
export interface KBArticleListOptions {
|
|
990
|
+
/** Filter by article type: 'index', 'community', 'entity'. */
|
|
991
|
+
articleType?: string;
|
|
992
|
+
limit?: number;
|
|
993
|
+
offset?: number;
|
|
994
|
+
}
|
|
995
|
+
export interface GraphSnapshot {
|
|
996
|
+
workspace_id: string;
|
|
997
|
+
context_id?: string | null;
|
|
998
|
+
node_count: number;
|
|
999
|
+
edge_count: number;
|
|
1000
|
+
includes_rpg: boolean;
|
|
1001
|
+
}
|
|
1002
|
+
export interface GraphCommunity {
|
|
1003
|
+
id: number;
|
|
1004
|
+
memory_ids: string[];
|
|
1005
|
+
size: number;
|
|
1006
|
+
cohesion_score: number;
|
|
1007
|
+
central_node_ids: string[];
|
|
1008
|
+
label?: string | null;
|
|
1009
|
+
}
|
|
1010
|
+
export interface GraphCentralNode {
|
|
1011
|
+
memory_id: string;
|
|
1012
|
+
degree: number;
|
|
1013
|
+
betweenness: number;
|
|
1014
|
+
community_id: number;
|
|
1015
|
+
}
|
|
1016
|
+
export interface GraphBridge {
|
|
1017
|
+
source_community_id: number;
|
|
1018
|
+
target_community_id: number;
|
|
1019
|
+
memory_id_source: string;
|
|
1020
|
+
memory_id_target: string;
|
|
1021
|
+
relationship_type: string;
|
|
1022
|
+
strength: number;
|
|
1023
|
+
}
|
|
1024
|
+
export interface GraphAnalysis {
|
|
1025
|
+
snapshot: GraphSnapshot;
|
|
1026
|
+
communities: GraphCommunity[];
|
|
1027
|
+
central_nodes: GraphCentralNode[];
|
|
1028
|
+
bridges: GraphBridge[];
|
|
1029
|
+
stats: GraphStats;
|
|
1030
|
+
}
|
|
1031
|
+
export interface GraphAnalysisResponse {
|
|
1032
|
+
analysis?: GraphAnalysis | null;
|
|
1033
|
+
cached: boolean;
|
|
1034
|
+
}
|
|
1035
|
+
/** Standard .mcp.json document shape: { mcpServers: { name: config, ... } }. */
|
|
1036
|
+
export interface McpJsonDocument {
|
|
1037
|
+
mcpServers: Record<string, Record<string, unknown>>;
|
|
1038
|
+
}
|
|
1039
|
+
export interface McpServerImportOptions {
|
|
1040
|
+
workspaceId?: string;
|
|
1041
|
+
userId?: string;
|
|
1042
|
+
/** Provenance: 'server' (default) | 'filesystem' | 'mirrored'. */
|
|
1043
|
+
sourceMode?: string;
|
|
1044
|
+
}
|
|
1045
|
+
export interface McpServerImportResult {
|
|
1046
|
+
imported: number;
|
|
1047
|
+
updated: number;
|
|
1048
|
+
skipped: number;
|
|
1049
|
+
errors: string[];
|
|
1050
|
+
}
|
|
425
1051
|
//# sourceMappingURL=types.d.ts.map
|