@redplanethq/sdk 0.1.2 → 0.1.4
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 +1 -1
- package/README.md +43 -18
- package/dist/index.d.mts +321 -14
- package/dist/index.d.ts +321 -14
- package/dist/index.js +120 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +112 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -53,9 +53,25 @@ declare const LLMModelType: {
|
|
|
53
53
|
};
|
|
54
54
|
type LLMModelType = (typeof LLMModelType)[keyof typeof LLMModelType];
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Interface for document node in the reified knowledge graph
|
|
58
|
+
* Documents are parent containers for episodic chunks
|
|
59
|
+
*/
|
|
60
|
+
interface DocumentNode {
|
|
61
|
+
uuid: string;
|
|
62
|
+
title: string;
|
|
63
|
+
originalContent: string;
|
|
64
|
+
metadata: Record<string, any>;
|
|
65
|
+
source: string;
|
|
66
|
+
userId: string;
|
|
67
|
+
createdAt: Date;
|
|
68
|
+
validAt: Date;
|
|
69
|
+
totalChunks: number;
|
|
70
|
+
sessionId?: string;
|
|
71
|
+
version: number;
|
|
72
|
+
contentHash: string;
|
|
73
|
+
previousVersionUuid?: string;
|
|
74
|
+
chunkHashes?: string[];
|
|
59
75
|
}
|
|
60
76
|
/**
|
|
61
77
|
* Interface for episodic node in the reified knowledge graph
|
|
@@ -74,7 +90,23 @@ interface EpisodicNode {
|
|
|
74
90
|
userId: string;
|
|
75
91
|
space?: string;
|
|
76
92
|
sessionId?: string;
|
|
93
|
+
recallCount?: number;
|
|
94
|
+
chunkIndex?: number;
|
|
95
|
+
labelIds?: string[];
|
|
77
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Episodic node without embeddings for query responses
|
|
99
|
+
* Use this type when returning episodes from Cypher queries to avoid loading large embedding arrays
|
|
100
|
+
*/
|
|
101
|
+
type EpisodicNodeWithoutEmbeddings = Omit<EpisodicNode, "contentEmbedding">;
|
|
102
|
+
/**
|
|
103
|
+
* Helper to get episodic node properties for Cypher RETURN clause (excludes embeddings)
|
|
104
|
+
* Usage in Cypher: RETURN ${EPISODIC_NODE_PROPERTIES} as episode
|
|
105
|
+
*/
|
|
106
|
+
declare const EPISODIC_NODE_PROPERTIES = "{\n uuid: e.uuid,\n content: e.content,\n originalContent: e.originalContent,\n createdAt: e.createdAt,\n userId: e.userId,\n sessionId: e.sessionId,\n labelIds: e.labelIds,\n validAt: e.validAt,\n recallCount: e.recallCount,\n chunkIndex: e.chunkIndex\n}";
|
|
107
|
+
declare const STATEMENT_NODE_PROPERTIES = "{\n uuid: s.uuid,\n fact: s.fact,\n createdAt: s.createdAt,\n userId: s.userId,\n validAt: s.validAt,\n invalidAt: s.invalidAt,\n invalidatedBy: s.invalidatedBy,\n attributes: s.attributes,\n recallCount: s.recallCount,\n provenanceCount: s.provenanceCount\n}";
|
|
108
|
+
declare const ENTITY_NODE_PROPERTIES = "{\n uuid: ent.uuid,\n name: ent.name,\n createdAt: ent.createdAt,\n userId: ent.userId,\n attributes: ent.attributes\n}";
|
|
109
|
+
declare const COMPACTED_SESSION_NODE_PROPERTIES = "{\n uuid: cs.uuid,\n sessionId: cs.sessionId,\n summary: cs.summary,\n episodeCount: cs.episodeCount,\n startTime: cs.startTime,\n endTime: cs.endTime,\n createdAt: cs.createdAt,\n updatedAt: cs.updatedAt,\n confidence: cs.confidence,\n userId: cs.userId,\n source: cs.source,\n compressionRatio: cs.compressionRatio,\n metadata: cs.metadata\n}";
|
|
78
110
|
/**
|
|
79
111
|
* Interface for entity node in the reified knowledge graph
|
|
80
112
|
* Entities represent subjects, objects, or predicates in statements
|
|
@@ -82,13 +114,11 @@ interface EpisodicNode {
|
|
|
82
114
|
interface EntityNode {
|
|
83
115
|
uuid: string;
|
|
84
116
|
name: string;
|
|
85
|
-
type
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
typeEmbedding: number[];
|
|
117
|
+
type?: string;
|
|
118
|
+
nameEmbedding?: number[];
|
|
119
|
+
attributes?: Record<string, any>;
|
|
89
120
|
createdAt: Date;
|
|
90
121
|
userId: string;
|
|
91
|
-
space?: string;
|
|
92
122
|
}
|
|
93
123
|
/**
|
|
94
124
|
* Interface for statement node in the reified knowledge graph
|
|
@@ -101,9 +131,16 @@ interface StatementNode {
|
|
|
101
131
|
createdAt: Date;
|
|
102
132
|
validAt: Date;
|
|
103
133
|
invalidAt: Date | null;
|
|
134
|
+
invalidatedBy?: string;
|
|
104
135
|
attributes: Record<string, any>;
|
|
105
136
|
userId: string;
|
|
106
137
|
space?: string;
|
|
138
|
+
labelIds?: string[];
|
|
139
|
+
recallCount?: {
|
|
140
|
+
low: number;
|
|
141
|
+
high: number;
|
|
142
|
+
};
|
|
143
|
+
provenanceCount?: number;
|
|
107
144
|
}
|
|
108
145
|
/**
|
|
109
146
|
* Interface for a triple in the reified knowledge graph
|
|
@@ -117,14 +154,25 @@ interface Triple {
|
|
|
117
154
|
object: EntityNode;
|
|
118
155
|
provenance: EpisodicNode;
|
|
119
156
|
}
|
|
157
|
+
declare enum EpisodeTypeEnum {
|
|
158
|
+
CONVERSATION = "CONVERSATION",
|
|
159
|
+
DOCUMENT = "DOCUMENT"
|
|
160
|
+
}
|
|
161
|
+
declare const EpisodeType: {
|
|
162
|
+
CONVERSATION: string;
|
|
163
|
+
DOCUMENT: string;
|
|
164
|
+
IMAGE: string;
|
|
165
|
+
};
|
|
166
|
+
type EpisodeType = (typeof EpisodeType)[keyof typeof EpisodeType];
|
|
120
167
|
type AddEpisodeParams = {
|
|
121
168
|
episodeBody: string;
|
|
122
169
|
referenceTime: Date;
|
|
123
|
-
metadata
|
|
170
|
+
metadata?: Record<string, any>;
|
|
124
171
|
source: string;
|
|
125
172
|
userId: string;
|
|
126
173
|
spaceId?: string;
|
|
127
174
|
sessionId?: string;
|
|
175
|
+
type?: EpisodeType;
|
|
128
176
|
};
|
|
129
177
|
type AddEpisodeResult = {
|
|
130
178
|
episodeUuid: string;
|
|
@@ -134,13 +182,29 @@ type AddEpisodeResult = {
|
|
|
134
182
|
};
|
|
135
183
|
interface ExtractedTripleData {
|
|
136
184
|
source: string;
|
|
137
|
-
sourceType
|
|
185
|
+
sourceType?: string;
|
|
138
186
|
predicate: string;
|
|
139
187
|
target: string;
|
|
140
|
-
targetType
|
|
188
|
+
targetType?: string;
|
|
141
189
|
fact: string;
|
|
142
190
|
attributes?: Record<string, any>;
|
|
143
191
|
}
|
|
192
|
+
interface CompactedSessionNode {
|
|
193
|
+
uuid: string;
|
|
194
|
+
sessionId: string;
|
|
195
|
+
summary: string;
|
|
196
|
+
summaryEmbedding?: number[];
|
|
197
|
+
episodeCount: number;
|
|
198
|
+
startTime: Date;
|
|
199
|
+
endTime: Date;
|
|
200
|
+
createdAt: Date;
|
|
201
|
+
updatedAt?: Date;
|
|
202
|
+
confidence: number;
|
|
203
|
+
userId: string;
|
|
204
|
+
source: string;
|
|
205
|
+
compressionRatio?: number;
|
|
206
|
+
metadata?: Record<string, any>;
|
|
207
|
+
}
|
|
144
208
|
|
|
145
209
|
declare enum ActionStatusEnum {
|
|
146
210
|
ACCEPT = "ACCEPT",
|
|
@@ -199,10 +263,23 @@ declare enum IntegrationEventType {
|
|
|
199
263
|
/**
|
|
200
264
|
* For returning integration metadata/config
|
|
201
265
|
*/
|
|
202
|
-
SPEC = "spec"
|
|
266
|
+
SPEC = "spec",
|
|
267
|
+
/**
|
|
268
|
+
* For to start mcp
|
|
269
|
+
*/
|
|
270
|
+
MCP = "mcp"
|
|
271
|
+
}
|
|
272
|
+
interface IntegrationDefinition {
|
|
273
|
+
name: string;
|
|
274
|
+
version: string;
|
|
275
|
+
description: string;
|
|
203
276
|
}
|
|
204
277
|
interface IntegrationEventPayload {
|
|
205
278
|
event: IntegrationEventType;
|
|
279
|
+
integrationDefinition?: IntegrationDefinition;
|
|
280
|
+
eventBody: any;
|
|
281
|
+
config?: Config;
|
|
282
|
+
state?: Record<string, string>;
|
|
206
283
|
[x: string]: any;
|
|
207
284
|
}
|
|
208
285
|
declare class Spec {
|
|
@@ -220,7 +297,7 @@ declare class Spec {
|
|
|
220
297
|
}
|
|
221
298
|
interface Config {
|
|
222
299
|
access_token: string;
|
|
223
|
-
[key: string]:
|
|
300
|
+
[key: string]: string;
|
|
224
301
|
}
|
|
225
302
|
interface Identifier {
|
|
226
303
|
id: string;
|
|
@@ -238,6 +315,235 @@ declare enum UserTypeEnum {
|
|
|
238
315
|
System = "System"
|
|
239
316
|
}
|
|
240
317
|
|
|
318
|
+
interface SpaceNode {
|
|
319
|
+
uuid: string;
|
|
320
|
+
name: string;
|
|
321
|
+
description?: string;
|
|
322
|
+
userId: string;
|
|
323
|
+
createdAt: Date;
|
|
324
|
+
updatedAt: Date;
|
|
325
|
+
isActive: boolean;
|
|
326
|
+
contextCount?: number;
|
|
327
|
+
embedding?: number[];
|
|
328
|
+
}
|
|
329
|
+
interface CreateSpaceParams {
|
|
330
|
+
name: string;
|
|
331
|
+
description?: string;
|
|
332
|
+
userId: string;
|
|
333
|
+
workspaceId: string;
|
|
334
|
+
}
|
|
335
|
+
interface UpdateSpaceParams {
|
|
336
|
+
name?: string;
|
|
337
|
+
description?: string;
|
|
338
|
+
icon?: string;
|
|
339
|
+
status?: string;
|
|
340
|
+
}
|
|
341
|
+
interface SpaceWithStatements extends SpaceNode {
|
|
342
|
+
statements: any[];
|
|
343
|
+
}
|
|
344
|
+
interface AssignStatementsParams {
|
|
345
|
+
statementIds: string[];
|
|
346
|
+
spaceId: string;
|
|
347
|
+
userId: string;
|
|
348
|
+
}
|
|
349
|
+
interface SpaceAssignmentResult {
|
|
350
|
+
success: boolean;
|
|
351
|
+
statementsUpdated: number;
|
|
352
|
+
error?: string;
|
|
353
|
+
}
|
|
354
|
+
interface SpaceDeletionResult {
|
|
355
|
+
deleted: boolean;
|
|
356
|
+
statementsUpdated: number;
|
|
357
|
+
error?: string;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
type UserConfirmationStatus = "pending" | "accepted" | "rejected" | "edited";
|
|
361
|
+
interface SpacePattern {
|
|
362
|
+
id: string;
|
|
363
|
+
name: string;
|
|
364
|
+
source: "explicit" | "implicit";
|
|
365
|
+
type: string;
|
|
366
|
+
summary: string;
|
|
367
|
+
editedSummary?: string;
|
|
368
|
+
evidence: string[];
|
|
369
|
+
confidence: number;
|
|
370
|
+
userConfirmed: UserConfirmationStatus;
|
|
371
|
+
spaceId: string;
|
|
372
|
+
createdAt: Date;
|
|
373
|
+
updatedAt: Date;
|
|
374
|
+
}
|
|
375
|
+
interface CreatePatternParams {
|
|
376
|
+
name: string;
|
|
377
|
+
source: "explicit" | "implicit";
|
|
378
|
+
type: string;
|
|
379
|
+
summary: string;
|
|
380
|
+
editedSummary?: string;
|
|
381
|
+
evidence: string[];
|
|
382
|
+
confidence: number;
|
|
383
|
+
userConfirmed?: UserConfirmationStatus;
|
|
384
|
+
spaceId: string;
|
|
385
|
+
}
|
|
386
|
+
interface PatternDetectionResult {
|
|
387
|
+
explicitPatterns: Omit<SpacePattern, "id" | "createdAt" | "updatedAt" | "spaceId">[];
|
|
388
|
+
implicitPatterns: Omit<SpacePattern, "id" | "createdAt" | "updatedAt" | "spaceId">[];
|
|
389
|
+
totalPatternsFound: number;
|
|
390
|
+
processingStats: {
|
|
391
|
+
statementsAnalyzed: number;
|
|
392
|
+
themesProcessed: number;
|
|
393
|
+
implicitPatternsExtracted: number;
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
interface PatternConfirmationParams {
|
|
397
|
+
patternId: string;
|
|
398
|
+
confirmed: boolean;
|
|
399
|
+
}
|
|
400
|
+
declare const EXPLICIT_PATTERN_TYPES: {
|
|
401
|
+
readonly THEME: "theme";
|
|
402
|
+
readonly TOPIC: "topic";
|
|
403
|
+
readonly DOMAIN: "domain";
|
|
404
|
+
readonly INTEREST_AREA: "interest_area";
|
|
405
|
+
};
|
|
406
|
+
declare const IMPLICIT_PATTERN_TYPES: {
|
|
407
|
+
readonly PREFERENCE: "preference";
|
|
408
|
+
readonly HABIT: "habit";
|
|
409
|
+
readonly WORKFLOW: "workflow";
|
|
410
|
+
readonly COMMUNICATION_STYLE: "communication_style";
|
|
411
|
+
readonly DECISION_PATTERN: "decision_pattern";
|
|
412
|
+
readonly TEMPORAL_PATTERN: "temporal_pattern";
|
|
413
|
+
readonly BEHAVIORAL_PATTERN: "behavioral_pattern";
|
|
414
|
+
readonly LEARNING_STYLE: "learning_style";
|
|
415
|
+
readonly COLLABORATION_STYLE: "collaboration_style";
|
|
416
|
+
};
|
|
417
|
+
declare const PATTERN_TYPES: {
|
|
418
|
+
readonly PREFERENCE: "preference";
|
|
419
|
+
readonly HABIT: "habit";
|
|
420
|
+
readonly WORKFLOW: "workflow";
|
|
421
|
+
readonly COMMUNICATION_STYLE: "communication_style";
|
|
422
|
+
readonly DECISION_PATTERN: "decision_pattern";
|
|
423
|
+
readonly TEMPORAL_PATTERN: "temporal_pattern";
|
|
424
|
+
readonly BEHAVIORAL_PATTERN: "behavioral_pattern";
|
|
425
|
+
readonly LEARNING_STYLE: "learning_style";
|
|
426
|
+
readonly COLLABORATION_STYLE: "collaboration_style";
|
|
427
|
+
readonly THEME: "theme";
|
|
428
|
+
readonly TOPIC: "topic";
|
|
429
|
+
readonly DOMAIN: "domain";
|
|
430
|
+
readonly INTEREST_AREA: "interest_area";
|
|
431
|
+
};
|
|
432
|
+
type ExplicitPatternType = (typeof EXPLICIT_PATTERN_TYPES)[keyof typeof EXPLICIT_PATTERN_TYPES];
|
|
433
|
+
type ImplicitPatternType = (typeof IMPLICIT_PATTERN_TYPES)[keyof typeof IMPLICIT_PATTERN_TYPES];
|
|
434
|
+
type PatternType = (typeof PATTERN_TYPES)[keyof typeof PATTERN_TYPES];
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Search options interface
|
|
438
|
+
*/
|
|
439
|
+
interface SearchOptions {
|
|
440
|
+
limit?: number;
|
|
441
|
+
maxBfsDepth?: number;
|
|
442
|
+
validAt?: Date;
|
|
443
|
+
startTime?: Date | null;
|
|
444
|
+
endTime?: Date;
|
|
445
|
+
includeInvalidated?: boolean;
|
|
446
|
+
entityTypes?: string[];
|
|
447
|
+
predicateTypes?: string[];
|
|
448
|
+
scoreThreshold?: number;
|
|
449
|
+
minResults?: number;
|
|
450
|
+
labelIds?: string[];
|
|
451
|
+
adaptiveFiltering?: boolean;
|
|
452
|
+
structured?: boolean;
|
|
453
|
+
useLLMValidation?: boolean;
|
|
454
|
+
qualityThreshold?: number;
|
|
455
|
+
maxEpisodesForLLM?: number;
|
|
456
|
+
sortBy?: "relevance" | "recency";
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Statement with source provenance tracking
|
|
460
|
+
*/
|
|
461
|
+
interface StatementWithSource {
|
|
462
|
+
statement: StatementNode;
|
|
463
|
+
sources: {
|
|
464
|
+
episodeGraph?: {
|
|
465
|
+
score: number;
|
|
466
|
+
entityMatches: number;
|
|
467
|
+
};
|
|
468
|
+
bfs?: {
|
|
469
|
+
score: number;
|
|
470
|
+
hopDistance: number;
|
|
471
|
+
relevance: number;
|
|
472
|
+
};
|
|
473
|
+
vector?: {
|
|
474
|
+
score: number;
|
|
475
|
+
similarity: number;
|
|
476
|
+
};
|
|
477
|
+
bm25?: {
|
|
478
|
+
score: number;
|
|
479
|
+
rank: number;
|
|
480
|
+
};
|
|
481
|
+
};
|
|
482
|
+
primarySource: "episodeGraph" | "bfs" | "vector" | "bm25";
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Episode with provenance tracking from multiple sources
|
|
486
|
+
*/
|
|
487
|
+
interface EpisodeWithProvenance {
|
|
488
|
+
episode: EpisodicNode;
|
|
489
|
+
statements: StatementWithSource[];
|
|
490
|
+
episodeGraphScore: number;
|
|
491
|
+
bfsScore: number;
|
|
492
|
+
vectorScore: number;
|
|
493
|
+
bm25Score: number;
|
|
494
|
+
sourceBreakdown: {
|
|
495
|
+
fromEpisodeGraph: number;
|
|
496
|
+
fromBFS: number;
|
|
497
|
+
fromVector: number;
|
|
498
|
+
fromBM25: number;
|
|
499
|
+
};
|
|
500
|
+
entityMatchCount?: number;
|
|
501
|
+
firstLevelScore?: number;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Quality filtering result
|
|
505
|
+
*/
|
|
506
|
+
interface QualityFilterResult {
|
|
507
|
+
episodes: EpisodeWithProvenance[];
|
|
508
|
+
confidence: number;
|
|
509
|
+
message: string;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Quality thresholds for filtering
|
|
513
|
+
*/
|
|
514
|
+
declare const QUALITY_THRESHOLDS: {
|
|
515
|
+
HIGH_QUALITY_EPISODE: number;
|
|
516
|
+
MEDIUM_QUALITY_EPISODE: number;
|
|
517
|
+
LOW_QUALITY_EPISODE: number;
|
|
518
|
+
CONFIDENT_RESULT: number;
|
|
519
|
+
UNCERTAIN_RESULT: number;
|
|
520
|
+
NO_RESULT: number;
|
|
521
|
+
MINIMUM_GAP_RATIO: number;
|
|
522
|
+
};
|
|
523
|
+
/**
|
|
524
|
+
* Episode search result with aggregated scores and sample statements
|
|
525
|
+
* Returned by BM25, Vector, and BFS searches
|
|
526
|
+
*/
|
|
527
|
+
interface EpisodeSearchResult {
|
|
528
|
+
episode: EpisodicNode;
|
|
529
|
+
score: number;
|
|
530
|
+
statementCount: number;
|
|
531
|
+
topStatements: StatementNode[];
|
|
532
|
+
invalidatedStatements: StatementNode[];
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Configuration for reranking
|
|
536
|
+
*/
|
|
537
|
+
interface RerankConfig {
|
|
538
|
+
provider: "cohere" | "ollama" | "none";
|
|
539
|
+
limit?: number;
|
|
540
|
+
threshold: number;
|
|
541
|
+
cohereApiKey?: string;
|
|
542
|
+
cohereModel?: string;
|
|
543
|
+
ollamaUrl?: string;
|
|
544
|
+
ollamaModel?: string;
|
|
545
|
+
}
|
|
546
|
+
|
|
241
547
|
declare abstract class IntegrationCLI {
|
|
242
548
|
protected program: Command;
|
|
243
549
|
protected integrationName: string;
|
|
@@ -248,10 +554,11 @@ declare abstract class IntegrationCLI {
|
|
|
248
554
|
private setupDataCommands;
|
|
249
555
|
private setupSpecCommand;
|
|
250
556
|
private setupSyncCommand;
|
|
557
|
+
private setupMCPCommand;
|
|
251
558
|
protected abstract handleEvent(eventPayload: IntegrationEventPayload): Promise<Message[]>;
|
|
252
559
|
protected abstract getSpec(): Promise<Spec>;
|
|
253
560
|
parse(): void;
|
|
254
561
|
getProgram(): Command;
|
|
255
562
|
}
|
|
256
563
|
|
|
257
|
-
export { APIKeyParams, ActionStatus, ActionStatusEnum, type AddEpisodeParams, type AddEpisodeResult, type AuthType, ClaudeModels, type Config, type EntityNode, EpisodeType, type EpisodicNode, type ExtractedTripleData, GeminiModels, type Identifier, IntegrationCLI, type IntegrationEventPayload, IntegrationEventType, LLMMappings, LLMModelEnum, LLMModelType, type Message, type MessageType, OAuth2Params, OpenAIModels, Spec, type StatementNode, type Triple, UserTypeEnum };
|
|
564
|
+
export { APIKeyParams, ActionStatus, ActionStatusEnum, type AddEpisodeParams, type AddEpisodeResult, type AssignStatementsParams, type AuthType, COMPACTED_SESSION_NODE_PROPERTIES, ClaudeModels, type CompactedSessionNode, type Config, type CreatePatternParams, type CreateSpaceParams, type DocumentNode, ENTITY_NODE_PROPERTIES, EPISODIC_NODE_PROPERTIES, EXPLICIT_PATTERN_TYPES, type EntityNode, type EpisodeSearchResult, EpisodeType, EpisodeTypeEnum, type EpisodeWithProvenance, type EpisodicNode, type EpisodicNodeWithoutEmbeddings, type ExplicitPatternType, type ExtractedTripleData, GeminiModels, IMPLICIT_PATTERN_TYPES, type Identifier, type ImplicitPatternType, IntegrationCLI, type IntegrationEventPayload, IntegrationEventType, LLMMappings, LLMModelEnum, LLMModelType, type Message, type MessageType, OAuth2Params, OpenAIModels, PATTERN_TYPES, type PatternConfirmationParams, type PatternDetectionResult, type PatternType, QUALITY_THRESHOLDS, type QualityFilterResult, type RerankConfig, STATEMENT_NODE_PROPERTIES, type SearchOptions, type SpaceAssignmentResult, type SpaceDeletionResult, type SpaceNode, type SpacePattern, type SpaceWithStatements, Spec, type StatementNode, type StatementWithSource, type Triple, type UpdateSpaceParams, type UserConfirmationStatus, UserTypeEnum };
|
package/dist/index.js
CHANGED
|
@@ -77,11 +77,62 @@ var GeminiModels = [
|
|
|
77
77
|
];
|
|
78
78
|
|
|
79
79
|
// ../types/dist/graph/graph.entity.js
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
var EPISODIC_NODE_PROPERTIES = `{
|
|
81
|
+
uuid: e.uuid,
|
|
82
|
+
content: e.content,
|
|
83
|
+
originalContent: e.originalContent,
|
|
84
|
+
createdAt: e.createdAt,
|
|
85
|
+
userId: e.userId,
|
|
86
|
+
sessionId: e.sessionId,
|
|
87
|
+
labelIds: e.labelIds,
|
|
88
|
+
validAt: e.validAt,
|
|
89
|
+
recallCount: e.recallCount,
|
|
90
|
+
chunkIndex: e.chunkIndex
|
|
91
|
+
}`;
|
|
92
|
+
var STATEMENT_NODE_PROPERTIES = `{
|
|
93
|
+
uuid: s.uuid,
|
|
94
|
+
fact: s.fact,
|
|
95
|
+
createdAt: s.createdAt,
|
|
96
|
+
userId: s.userId,
|
|
97
|
+
validAt: s.validAt,
|
|
98
|
+
invalidAt: s.invalidAt,
|
|
99
|
+
invalidatedBy: s.invalidatedBy,
|
|
100
|
+
attributes: s.attributes,
|
|
101
|
+
recallCount: s.recallCount,
|
|
102
|
+
provenanceCount: s.provenanceCount
|
|
103
|
+
}`;
|
|
104
|
+
var ENTITY_NODE_PROPERTIES = `{
|
|
105
|
+
uuid: ent.uuid,
|
|
106
|
+
name: ent.name,
|
|
107
|
+
createdAt: ent.createdAt,
|
|
108
|
+
userId: ent.userId,
|
|
109
|
+
attributes: ent.attributes
|
|
110
|
+
}`;
|
|
111
|
+
var COMPACTED_SESSION_NODE_PROPERTIES = `{
|
|
112
|
+
uuid: cs.uuid,
|
|
113
|
+
sessionId: cs.sessionId,
|
|
114
|
+
summary: cs.summary,
|
|
115
|
+
episodeCount: cs.episodeCount,
|
|
116
|
+
startTime: cs.startTime,
|
|
117
|
+
endTime: cs.endTime,
|
|
118
|
+
createdAt: cs.createdAt,
|
|
119
|
+
updatedAt: cs.updatedAt,
|
|
120
|
+
confidence: cs.confidence,
|
|
121
|
+
userId: cs.userId,
|
|
122
|
+
source: cs.source,
|
|
123
|
+
compressionRatio: cs.compressionRatio,
|
|
124
|
+
metadata: cs.metadata
|
|
125
|
+
}`;
|
|
126
|
+
exports.EpisodeTypeEnum = void 0;
|
|
127
|
+
(function(EpisodeTypeEnum2) {
|
|
128
|
+
EpisodeTypeEnum2["CONVERSATION"] = "CONVERSATION";
|
|
129
|
+
EpisodeTypeEnum2["DOCUMENT"] = "DOCUMENT";
|
|
130
|
+
})(exports.EpisodeTypeEnum || (exports.EpisodeTypeEnum = {}));
|
|
131
|
+
var EpisodeType = {
|
|
132
|
+
CONVERSATION: "CONVERSATION",
|
|
133
|
+
DOCUMENT: "DOCUMENT",
|
|
134
|
+
IMAGE: "IMAGE"
|
|
135
|
+
};
|
|
85
136
|
|
|
86
137
|
// ../types/dist/conversation-execution-step/conversation-execution.entity.js
|
|
87
138
|
exports.ActionStatusEnum = void 0;
|
|
@@ -122,6 +173,7 @@ exports.IntegrationEventType = void 0;
|
|
|
122
173
|
IntegrationEventType2["IDENTIFY"] = "identify";
|
|
123
174
|
IntegrationEventType2["SYNC"] = "sync";
|
|
124
175
|
IntegrationEventType2["SPEC"] = "spec";
|
|
176
|
+
IntegrationEventType2["MCP"] = "mcp";
|
|
125
177
|
})(exports.IntegrationEventType || (exports.IntegrationEventType = {}));
|
|
126
178
|
var Spec = class {
|
|
127
179
|
static {
|
|
@@ -136,6 +188,42 @@ exports.UserTypeEnum = void 0;
|
|
|
136
188
|
UserTypeEnum2["User"] = "User";
|
|
137
189
|
UserTypeEnum2["System"] = "System";
|
|
138
190
|
})(exports.UserTypeEnum || (exports.UserTypeEnum = {}));
|
|
191
|
+
|
|
192
|
+
// ../types/dist/pattern.js
|
|
193
|
+
var EXPLICIT_PATTERN_TYPES = {
|
|
194
|
+
// Derived from space themes and explicit content
|
|
195
|
+
THEME: "theme",
|
|
196
|
+
TOPIC: "topic",
|
|
197
|
+
DOMAIN: "domain",
|
|
198
|
+
INTEREST_AREA: "interest_area"
|
|
199
|
+
};
|
|
200
|
+
var IMPLICIT_PATTERN_TYPES = {
|
|
201
|
+
// Discovered from behavioral analysis and content patterns
|
|
202
|
+
PREFERENCE: "preference",
|
|
203
|
+
HABIT: "habit",
|
|
204
|
+
WORKFLOW: "workflow",
|
|
205
|
+
COMMUNICATION_STYLE: "communication_style",
|
|
206
|
+
DECISION_PATTERN: "decision_pattern",
|
|
207
|
+
TEMPORAL_PATTERN: "temporal_pattern",
|
|
208
|
+
BEHAVIORAL_PATTERN: "behavioral_pattern",
|
|
209
|
+
LEARNING_STYLE: "learning_style",
|
|
210
|
+
COLLABORATION_STYLE: "collaboration_style"
|
|
211
|
+
};
|
|
212
|
+
var PATTERN_TYPES = Object.assign(Object.assign({}, EXPLICIT_PATTERN_TYPES), IMPLICIT_PATTERN_TYPES);
|
|
213
|
+
|
|
214
|
+
// ../types/dist/search.js
|
|
215
|
+
var QUALITY_THRESHOLDS = {
|
|
216
|
+
// Adaptive episode-level scoring (based on available sources)
|
|
217
|
+
HIGH_QUALITY_EPISODE: 5,
|
|
218
|
+
MEDIUM_QUALITY_EPISODE: 1,
|
|
219
|
+
LOW_QUALITY_EPISODE: 0.3,
|
|
220
|
+
// Overall result confidence
|
|
221
|
+
CONFIDENT_RESULT: 0.7,
|
|
222
|
+
UNCERTAIN_RESULT: 0.3,
|
|
223
|
+
NO_RESULT: 0.3,
|
|
224
|
+
// Score gap detection
|
|
225
|
+
MINIMUM_GAP_RATIO: 0.5
|
|
226
|
+
};
|
|
139
227
|
var IntegrationCLI = class {
|
|
140
228
|
static {
|
|
141
229
|
__name(this, "IntegrationCLI");
|
|
@@ -155,6 +243,7 @@ var IntegrationCLI = class {
|
|
|
155
243
|
this.setupAccountCommands();
|
|
156
244
|
this.setupDataCommands();
|
|
157
245
|
this.setupSyncCommand();
|
|
246
|
+
this.setupMCPCommand();
|
|
158
247
|
}
|
|
159
248
|
setupAccountCommands() {
|
|
160
249
|
this.program.command("setup").description(`Set up a new ${this.integrationName} integration account`).requiredOption("--event-body <body>", "Event body JSON (e.g. OAuth response or setup data)").requiredOption("--integration-definition <definition>", "Integration definition JSON").action(async (options) => {
|
|
@@ -244,6 +333,23 @@ var IntegrationCLI = class {
|
|
|
244
333
|
}
|
|
245
334
|
});
|
|
246
335
|
}
|
|
336
|
+
setupMCPCommand() {
|
|
337
|
+
this.program.command("mcp").description("To start the mcp").requiredOption("--config <config>", "Integration configuration JSON").requiredOption("--integration-definition <definition>", "Integration definition JSON").action(async (options) => {
|
|
338
|
+
try {
|
|
339
|
+
const config = JSON.parse(options.config);
|
|
340
|
+
const integrationDefinition = JSON.parse(options.integrationDefinition);
|
|
341
|
+
await this.handleEvent({
|
|
342
|
+
event: exports.IntegrationEventType.MCP,
|
|
343
|
+
eventBody: {},
|
|
344
|
+
config,
|
|
345
|
+
integrationDefinition
|
|
346
|
+
});
|
|
347
|
+
} catch (error) {
|
|
348
|
+
console.error("Error during sync:", error);
|
|
349
|
+
process.exit(1);
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
}
|
|
247
353
|
/**
|
|
248
354
|
* Parse and execute the CLI commands
|
|
249
355
|
*/
|
|
@@ -260,12 +366,21 @@ var IntegrationCLI = class {
|
|
|
260
366
|
|
|
261
367
|
exports.APIKeyParams = APIKeyParams;
|
|
262
368
|
exports.ActionStatus = ActionStatus;
|
|
369
|
+
exports.COMPACTED_SESSION_NODE_PROPERTIES = COMPACTED_SESSION_NODE_PROPERTIES;
|
|
263
370
|
exports.ClaudeModels = ClaudeModels;
|
|
371
|
+
exports.ENTITY_NODE_PROPERTIES = ENTITY_NODE_PROPERTIES;
|
|
372
|
+
exports.EPISODIC_NODE_PROPERTIES = EPISODIC_NODE_PROPERTIES;
|
|
373
|
+
exports.EXPLICIT_PATTERN_TYPES = EXPLICIT_PATTERN_TYPES;
|
|
374
|
+
exports.EpisodeType = EpisodeType;
|
|
264
375
|
exports.GeminiModels = GeminiModels;
|
|
376
|
+
exports.IMPLICIT_PATTERN_TYPES = IMPLICIT_PATTERN_TYPES;
|
|
265
377
|
exports.IntegrationCLI = IntegrationCLI;
|
|
266
378
|
exports.LLMModelType = LLMModelType;
|
|
267
379
|
exports.OAuth2Params = OAuth2Params;
|
|
268
380
|
exports.OpenAIModels = OpenAIModels;
|
|
381
|
+
exports.PATTERN_TYPES = PATTERN_TYPES;
|
|
382
|
+
exports.QUALITY_THRESHOLDS = QUALITY_THRESHOLDS;
|
|
383
|
+
exports.STATEMENT_NODE_PROPERTIES = STATEMENT_NODE_PROPERTIES;
|
|
269
384
|
exports.Spec = Spec;
|
|
270
385
|
//# sourceMappingURL=index.js.map
|
|
271
386
|
//# sourceMappingURL=index.js.map
|