@omiron33/omi-neuron-web 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -0
- package/dist/api/index.cjs +943 -0
- package/dist/api/index.cjs.map +1 -0
- package/dist/api/index.d.cts +140 -0
- package/dist/api/index.d.ts +140 -0
- package/dist/api/index.js +934 -0
- package/dist/api/index.js.map +1 -0
- package/dist/chunk-BSOSHBDR.cjs +300 -0
- package/dist/chunk-BSOSHBDR.cjs.map +1 -0
- package/dist/chunk-COO66N7H.cjs +950 -0
- package/dist/chunk-COO66N7H.cjs.map +1 -0
- package/dist/chunk-FXKXMSLY.cjs +270 -0
- package/dist/chunk-FXKXMSLY.cjs.map +1 -0
- package/dist/chunk-PSDVPB7Y.js +289 -0
- package/dist/chunk-PSDVPB7Y.js.map +1 -0
- package/dist/chunk-RQCGONPN.js +937 -0
- package/dist/chunk-RQCGONPN.js.map +1 -0
- package/dist/chunk-RTSFO7BW.cjs +592 -0
- package/dist/chunk-RTSFO7BW.cjs.map +1 -0
- package/dist/chunk-TFLMPBX7.js +262 -0
- package/dist/chunk-TFLMPBX7.js.map +1 -0
- package/dist/chunk-XNR42GCJ.js +547 -0
- package/dist/chunk-XNR42GCJ.js.map +1 -0
- package/dist/cli/index.cjs +571 -0
- package/dist/cli/index.cjs.map +1 -0
- package/dist/cli/index.d.cts +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +563 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/database-B0vplyA4.d.cts +41 -0
- package/dist/database-B0vplyA4.d.ts +41 -0
- package/dist/edge-BzsYe2Ed.d.cts +269 -0
- package/dist/edge-BzsYe2Ed.d.ts +269 -0
- package/dist/index.cjs +895 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1484 -0
- package/dist/index.d.ts +1484 -0
- package/dist/index.js +654 -0
- package/dist/index.js.map +1 -0
- package/dist/migration/index.cjs +32 -0
- package/dist/migration/index.cjs.map +1 -0
- package/dist/migration/index.d.cts +51 -0
- package/dist/migration/index.d.ts +51 -0
- package/dist/migration/index.js +3 -0
- package/dist/migration/index.js.map +1 -0
- package/dist/query-helpers-D8po5Mn-.d.cts +777 -0
- package/dist/query-helpers-DvQTA2_Z.d.ts +777 -0
- package/dist/visualization/index.cjs +485 -0
- package/dist/visualization/index.cjs.map +1 -0
- package/dist/visualization/index.d.cts +134 -0
- package/dist/visualization/index.d.ts +134 -0
- package/dist/visualization/index.js +460 -0
- package/dist/visualization/index.js.map +1 -0
- package/docker/docker-compose.template.yml +28 -0
- package/package.json +116 -0
|
@@ -0,0 +1,777 @@
|
|
|
1
|
+
import { R as RelationshipType, E as EdgeEvidence, b as NeuronNode, d as NeuronNodeCreate, c as NeuronEdge, e as NeuronNodeUpdate, f as NeuronEdgeCreate, g as NeuronEdgeUpdate, N as NeuronVisualNode, a as NeuronVisualEdge } from './edge-BzsYe2Ed.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cluster Types for omi-neuron-web
|
|
5
|
+
* Defines groupings of similar nodes based on embeddings
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Cluster represents a grouping of similar nodes
|
|
9
|
+
*/
|
|
10
|
+
interface NeuronCluster {
|
|
11
|
+
/** UUID v4 identifier */
|
|
12
|
+
id: string;
|
|
13
|
+
/** AI-generated or manual label */
|
|
14
|
+
label: string;
|
|
15
|
+
/** Type of cluster (e.g., 'topic', 'narrative', 'entity') */
|
|
16
|
+
clusterType: string;
|
|
17
|
+
/** Average embedding of all members */
|
|
18
|
+
centroid: number[];
|
|
19
|
+
/** Number of nodes in cluster */
|
|
20
|
+
memberCount: number;
|
|
21
|
+
/** Average similarity of members to centroid (0-1) */
|
|
22
|
+
avgSimilarity: number;
|
|
23
|
+
/** How tightly grouped the cluster is (0-1) */
|
|
24
|
+
cohesion: number;
|
|
25
|
+
/** Optional description */
|
|
26
|
+
description?: string | null;
|
|
27
|
+
/** Extracted keywords */
|
|
28
|
+
keywords: string[];
|
|
29
|
+
/** Additional metadata */
|
|
30
|
+
metadata: Record<string, unknown>;
|
|
31
|
+
/** Creation timestamp */
|
|
32
|
+
createdAt: Date;
|
|
33
|
+
/** Last update timestamp */
|
|
34
|
+
updatedAt: Date;
|
|
35
|
+
/** Last time centroid was recomputed */
|
|
36
|
+
lastRecomputedAt?: Date | null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Node-to-cluster membership
|
|
40
|
+
*/
|
|
41
|
+
interface ClusterMembership {
|
|
42
|
+
/** Node ID */
|
|
43
|
+
nodeId: string;
|
|
44
|
+
/** Cluster ID */
|
|
45
|
+
clusterId: string;
|
|
46
|
+
/** Similarity to cluster centroid (0-1) */
|
|
47
|
+
similarityScore: number;
|
|
48
|
+
/** Whether this is the primary cluster for this node */
|
|
49
|
+
isPrimary: boolean;
|
|
50
|
+
/** When the node was assigned to this cluster */
|
|
51
|
+
assignedAt: Date;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Input for creating clusters manually
|
|
55
|
+
*/
|
|
56
|
+
interface NeuronClusterCreate {
|
|
57
|
+
label: string;
|
|
58
|
+
clusterType?: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
keywords?: string[];
|
|
61
|
+
metadata?: Record<string, unknown>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Input for updating clusters
|
|
65
|
+
*/
|
|
66
|
+
interface NeuronClusterUpdate {
|
|
67
|
+
label?: string;
|
|
68
|
+
description?: string;
|
|
69
|
+
keywords?: string[];
|
|
70
|
+
metadata?: Record<string, unknown>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Visual cluster representation
|
|
74
|
+
*/
|
|
75
|
+
interface NeuronVisualCluster {
|
|
76
|
+
id: string;
|
|
77
|
+
label: string;
|
|
78
|
+
nodeIds: string[];
|
|
79
|
+
color?: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Clustering algorithm options
|
|
83
|
+
*/
|
|
84
|
+
type ClusteringAlgorithm = 'kmeans' | 'dbscan' | 'hierarchical';
|
|
85
|
+
/**
|
|
86
|
+
* Clustering configuration
|
|
87
|
+
*/
|
|
88
|
+
interface ClusteringConfig {
|
|
89
|
+
/** Algorithm to use */
|
|
90
|
+
algorithm: ClusteringAlgorithm;
|
|
91
|
+
/** Target number of clusters (for k-means) */
|
|
92
|
+
clusterCount?: number;
|
|
93
|
+
/** Minimum cluster size */
|
|
94
|
+
minClusterSize?: number;
|
|
95
|
+
/** Similarity threshold for cluster assignment */
|
|
96
|
+
similarityThreshold?: number;
|
|
97
|
+
/** Epsilon for DBSCAN */
|
|
98
|
+
epsilon?: number;
|
|
99
|
+
/** Min samples for DBSCAN */
|
|
100
|
+
minSamples?: number;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Analysis Types for omi-neuron-web
|
|
105
|
+
* Defines analysis jobs and pipeline operations
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Type of analysis run
|
|
110
|
+
*/
|
|
111
|
+
type AnalysisRunType = 'embedding' | 'clustering' | 'relationship_inference' | 'full_analysis';
|
|
112
|
+
/**
|
|
113
|
+
* Status of an analysis job
|
|
114
|
+
*/
|
|
115
|
+
type AnalysisJobStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
116
|
+
/**
|
|
117
|
+
* Analysis run record - tracks analysis jobs
|
|
118
|
+
*/
|
|
119
|
+
interface AnalysisRun {
|
|
120
|
+
/** UUID v4 identifier */
|
|
121
|
+
id: string;
|
|
122
|
+
/** Type of analysis being performed */
|
|
123
|
+
runType: AnalysisRunType;
|
|
124
|
+
inputParams: {
|
|
125
|
+
/** Specific node IDs or all if undefined */
|
|
126
|
+
nodeIds?: string[];
|
|
127
|
+
/** Force regenerate even if exists */
|
|
128
|
+
forceRecompute?: boolean;
|
|
129
|
+
/** Target cluster count for k-means */
|
|
130
|
+
clusterCount?: number;
|
|
131
|
+
/** Minimum confidence for relationships */
|
|
132
|
+
relationshipThreshold?: number;
|
|
133
|
+
/** Embedding model to use */
|
|
134
|
+
embeddingModel?: string;
|
|
135
|
+
};
|
|
136
|
+
results: {
|
|
137
|
+
nodesProcessed: number;
|
|
138
|
+
embeddingsGenerated: number;
|
|
139
|
+
clustersCreated: number;
|
|
140
|
+
relationshipsInferred: number;
|
|
141
|
+
errors: Array<{
|
|
142
|
+
nodeId: string;
|
|
143
|
+
error: string;
|
|
144
|
+
}>;
|
|
145
|
+
};
|
|
146
|
+
/** Current job status */
|
|
147
|
+
status: AnalysisJobStatus;
|
|
148
|
+
/** Progress percentage (0-100) */
|
|
149
|
+
progress: number;
|
|
150
|
+
/** When the job started */
|
|
151
|
+
startedAt?: Date | null;
|
|
152
|
+
/** When the job completed */
|
|
153
|
+
completedAt?: Date | null;
|
|
154
|
+
/** Duration in milliseconds */
|
|
155
|
+
durationMs?: number | null;
|
|
156
|
+
/** Error message if failed */
|
|
157
|
+
errorMessage?: string | null;
|
|
158
|
+
/** Error stack trace */
|
|
159
|
+
errorStack?: string | null;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Request to trigger analysis
|
|
163
|
+
*/
|
|
164
|
+
interface AnalysisRequest {
|
|
165
|
+
/** Type of analysis to perform */
|
|
166
|
+
action: 'embeddings' | 'cluster' | 'infer_relationships' | 'full';
|
|
167
|
+
/** Specific node IDs, or all if omitted */
|
|
168
|
+
nodeIds?: string[];
|
|
169
|
+
/** Options per action type */
|
|
170
|
+
options?: {
|
|
171
|
+
forceRecompute?: boolean;
|
|
172
|
+
embeddingModel?: string;
|
|
173
|
+
clusterCount?: number;
|
|
174
|
+
minClusterSize?: number;
|
|
175
|
+
reassignAll?: boolean;
|
|
176
|
+
relationshipThreshold?: number;
|
|
177
|
+
maxRelationshipsPerNode?: number;
|
|
178
|
+
includeExisting?: boolean;
|
|
179
|
+
};
|
|
180
|
+
/** Run asynchronously (default: true for large jobs) */
|
|
181
|
+
async?: boolean;
|
|
182
|
+
/** Webhook URL to notify on completion */
|
|
183
|
+
webhookUrl?: string;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Response from triggering analysis
|
|
187
|
+
*/
|
|
188
|
+
interface AnalysisResponse {
|
|
189
|
+
/** Job ID for tracking */
|
|
190
|
+
jobId: string;
|
|
191
|
+
/** Current status */
|
|
192
|
+
status: AnalysisJobStatus;
|
|
193
|
+
/** Estimated duration in seconds */
|
|
194
|
+
estimatedDuration?: number;
|
|
195
|
+
/** Results if sync and completed */
|
|
196
|
+
results?: AnalysisRun['results'];
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Relationship inference result
|
|
200
|
+
*/
|
|
201
|
+
interface InferredRelationshipResult {
|
|
202
|
+
fromNodeId: string;
|
|
203
|
+
toNodeId: string;
|
|
204
|
+
confidence: number;
|
|
205
|
+
reasoning: string;
|
|
206
|
+
suggestedType: RelationshipType;
|
|
207
|
+
evidence: EdgeEvidence[];
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Embedding generation result
|
|
211
|
+
*/
|
|
212
|
+
interface EmbeddingResult {
|
|
213
|
+
nodeId: string;
|
|
214
|
+
embedding: number[];
|
|
215
|
+
model: string;
|
|
216
|
+
tokenCount: number;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Clustering result
|
|
220
|
+
*/
|
|
221
|
+
interface ClusteringResult {
|
|
222
|
+
clusterId: string;
|
|
223
|
+
label: string;
|
|
224
|
+
nodeIds: string[];
|
|
225
|
+
centroid: number[];
|
|
226
|
+
avgSimilarity: number;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Analysis pipeline configuration
|
|
230
|
+
*/
|
|
231
|
+
interface AnalysisPipelineConfig {
|
|
232
|
+
embeddingModel: string;
|
|
233
|
+
embeddingDimensions: number;
|
|
234
|
+
embeddingBatchSize: number;
|
|
235
|
+
embeddingCacheTTL: number;
|
|
236
|
+
clusteringAlgorithm: 'kmeans' | 'dbscan' | 'hierarchical';
|
|
237
|
+
defaultClusterCount: number;
|
|
238
|
+
minClusterSize: number;
|
|
239
|
+
clusterSimilarityThreshold: number;
|
|
240
|
+
relationshipInferenceModel: string;
|
|
241
|
+
relationshipMinConfidence: number;
|
|
242
|
+
relationshipMaxPerNode: number;
|
|
243
|
+
openaiRateLimit: number;
|
|
244
|
+
maxConcurrentAnalysis: number;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Settings Types for omi-neuron-web
|
|
249
|
+
* Complete configuration schema for the library
|
|
250
|
+
*/
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Embedding model options
|
|
254
|
+
*/
|
|
255
|
+
type EmbeddingModel = 'text-embedding-ada-002' | 'text-embedding-3-small' | 'text-embedding-3-large';
|
|
256
|
+
/**
|
|
257
|
+
* Performance mode for visualization
|
|
258
|
+
*/
|
|
259
|
+
type PerformanceMode = 'auto' | 'normal' | 'degraded' | 'fallback';
|
|
260
|
+
/**
|
|
261
|
+
* Node type configuration
|
|
262
|
+
*/
|
|
263
|
+
interface NodeTypeConfig {
|
|
264
|
+
/** Type identifier */
|
|
265
|
+
type: string;
|
|
266
|
+
/** Human-readable label */
|
|
267
|
+
label: string;
|
|
268
|
+
/** Optional description */
|
|
269
|
+
description?: string;
|
|
270
|
+
/** Default domain for this type */
|
|
271
|
+
defaultDomain: string;
|
|
272
|
+
/** Icon name or emoji */
|
|
273
|
+
icon?: string;
|
|
274
|
+
/** Color hex code */
|
|
275
|
+
color?: string;
|
|
276
|
+
/** Custom AI prompt for analyzing this type */
|
|
277
|
+
analysisPrompt?: string;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Domain configuration for visualization
|
|
281
|
+
*/
|
|
282
|
+
interface DomainConfig {
|
|
283
|
+
/** Domain key */
|
|
284
|
+
key: string;
|
|
285
|
+
/** Human-readable label */
|
|
286
|
+
label: string;
|
|
287
|
+
/** Color hex code */
|
|
288
|
+
color: string;
|
|
289
|
+
/** Optional description */
|
|
290
|
+
description?: string;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Relationship type configuration
|
|
294
|
+
*/
|
|
295
|
+
interface RelationshipTypeConfig {
|
|
296
|
+
/** Type identifier */
|
|
297
|
+
type: string;
|
|
298
|
+
/** Human-readable label */
|
|
299
|
+
label: string;
|
|
300
|
+
/** Optional description */
|
|
301
|
+
description?: string;
|
|
302
|
+
/** Whether this type is bidirectional */
|
|
303
|
+
bidirectional: boolean;
|
|
304
|
+
/** Optional color hex code */
|
|
305
|
+
color?: string;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Visualization settings - all API-modifiable
|
|
309
|
+
*/
|
|
310
|
+
interface VisualizationSettings {
|
|
311
|
+
/** Domain to color mapping */
|
|
312
|
+
domainColors: Record<string, string>;
|
|
313
|
+
/** Default color for unknown domains */
|
|
314
|
+
defaultDomainColor: string;
|
|
315
|
+
/** Default edge color */
|
|
316
|
+
edgeColor: string;
|
|
317
|
+
/** Active/highlighted edge color */
|
|
318
|
+
edgeActiveColor: string;
|
|
319
|
+
/** Scene background color */
|
|
320
|
+
backgroundColor: string;
|
|
321
|
+
/** Initial camera position [x, y, z] */
|
|
322
|
+
defaultCameraPosition: [number, number, number];
|
|
323
|
+
/** Initial camera target [x, y, z] */
|
|
324
|
+
defaultCameraTarget: [number, number, number];
|
|
325
|
+
/** Minimum zoom distance */
|
|
326
|
+
minZoomDistance: number;
|
|
327
|
+
/** Maximum zoom distance */
|
|
328
|
+
maxZoomDistance: number;
|
|
329
|
+
/** Enable starfield background */
|
|
330
|
+
enableStarfield: boolean;
|
|
331
|
+
/** Number of stars in starfield */
|
|
332
|
+
starfieldCount: number;
|
|
333
|
+
/** Distance at which labels appear */
|
|
334
|
+
labelDistance: number;
|
|
335
|
+
/** Maximum number of visible labels */
|
|
336
|
+
maxVisibleLabels: number;
|
|
337
|
+
/** Performance mode selection */
|
|
338
|
+
performanceMode: PerformanceMode;
|
|
339
|
+
/** Node count threshold for degraded mode */
|
|
340
|
+
nodeCountThreshold: number;
|
|
341
|
+
/** Maximum device pixel ratio */
|
|
342
|
+
pixelRatioCap: number;
|
|
343
|
+
/** Enable animations */
|
|
344
|
+
enableAnimations: boolean;
|
|
345
|
+
/** Focus tween duration in ms */
|
|
346
|
+
focusTweenDuration: number;
|
|
347
|
+
/** Filter transition duration in ms */
|
|
348
|
+
filterTransitionDuration: number;
|
|
349
|
+
/** Enable hover effects */
|
|
350
|
+
enableHover: boolean;
|
|
351
|
+
/** Enable click handling */
|
|
352
|
+
enableClick: boolean;
|
|
353
|
+
/** Enable double-click handling */
|
|
354
|
+
enableDoubleClick: boolean;
|
|
355
|
+
/** Enable panning */
|
|
356
|
+
enablePan: boolean;
|
|
357
|
+
/** Enable zooming */
|
|
358
|
+
enableZoom: boolean;
|
|
359
|
+
/** Enable rotation */
|
|
360
|
+
enableRotate: boolean;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Analysis settings
|
|
364
|
+
*/
|
|
365
|
+
interface AnalysisSettings {
|
|
366
|
+
/** OpenAI embedding model */
|
|
367
|
+
embeddingModel: EmbeddingModel;
|
|
368
|
+
/** Embedding dimensions (must match model) */
|
|
369
|
+
embeddingDimensions: number;
|
|
370
|
+
/** Batch size for API calls */
|
|
371
|
+
embeddingBatchSize: number;
|
|
372
|
+
/** Cache TTL in seconds */
|
|
373
|
+
embeddingCacheTTL: number;
|
|
374
|
+
/** Clustering algorithm */
|
|
375
|
+
clusteringAlgorithm: ClusteringAlgorithm;
|
|
376
|
+
/** Default number of clusters */
|
|
377
|
+
defaultClusterCount: number;
|
|
378
|
+
/** Minimum cluster size */
|
|
379
|
+
minClusterSize: number;
|
|
380
|
+
/** Similarity threshold for cluster assignment */
|
|
381
|
+
clusterSimilarityThreshold: number;
|
|
382
|
+
/** Model for relationship inference */
|
|
383
|
+
relationshipInferenceModel: string;
|
|
384
|
+
/** Minimum confidence to create relationship */
|
|
385
|
+
relationshipMinConfidence: number;
|
|
386
|
+
/** Maximum relationships per node */
|
|
387
|
+
relationshipMaxPerNode: number;
|
|
388
|
+
/** OpenAI requests per minute */
|
|
389
|
+
openaiRateLimit: number;
|
|
390
|
+
/** Maximum concurrent analysis jobs */
|
|
391
|
+
maxConcurrentAnalysis: number;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Instance settings
|
|
395
|
+
*/
|
|
396
|
+
interface InstanceSettings {
|
|
397
|
+
/** Human-readable instance name */
|
|
398
|
+
name: string;
|
|
399
|
+
/** Library version */
|
|
400
|
+
version: string;
|
|
401
|
+
/** Used for pg-{repoName} database naming */
|
|
402
|
+
repoName: string;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Database settings
|
|
406
|
+
*/
|
|
407
|
+
interface DatabaseSettings {
|
|
408
|
+
/** 'docker' for managed, 'external' for BYO */
|
|
409
|
+
mode: 'docker' | 'external';
|
|
410
|
+
/** Port to expose (Docker mode) */
|
|
411
|
+
port: number;
|
|
412
|
+
/** Container name override */
|
|
413
|
+
containerName?: string;
|
|
414
|
+
/** Docker image */
|
|
415
|
+
image?: string;
|
|
416
|
+
/** Database user */
|
|
417
|
+
user?: string;
|
|
418
|
+
/** Database password */
|
|
419
|
+
password?: string;
|
|
420
|
+
/** Database name */
|
|
421
|
+
database?: string;
|
|
422
|
+
/** Connection URL (external mode) */
|
|
423
|
+
url?: string;
|
|
424
|
+
/** Connection pool settings */
|
|
425
|
+
pool?: {
|
|
426
|
+
min: number;
|
|
427
|
+
max: number;
|
|
428
|
+
idleTimeoutMs: number;
|
|
429
|
+
connectionTimeoutMs: number;
|
|
430
|
+
};
|
|
431
|
+
/** Resource limits (Docker mode) */
|
|
432
|
+
resources?: {
|
|
433
|
+
memoryLimit: string;
|
|
434
|
+
cpuLimit?: string;
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* API settings
|
|
439
|
+
*/
|
|
440
|
+
interface ApiSettings {
|
|
441
|
+
/** Base path for API routes */
|
|
442
|
+
basePath: string;
|
|
443
|
+
/** Enable CORS */
|
|
444
|
+
enableCors: boolean;
|
|
445
|
+
/** Rate limiting configuration */
|
|
446
|
+
rateLimit?: {
|
|
447
|
+
windowMs: number;
|
|
448
|
+
max: number;
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Logging settings
|
|
453
|
+
*/
|
|
454
|
+
interface LoggingSettings {
|
|
455
|
+
/** Log level */
|
|
456
|
+
level: 'debug' | 'info' | 'warn' | 'error';
|
|
457
|
+
/** Pretty print logs */
|
|
458
|
+
prettyPrint: boolean;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Complete settings schema - stored in database and repo config
|
|
462
|
+
*/
|
|
463
|
+
interface NeuronSettings {
|
|
464
|
+
/** Instance identification */
|
|
465
|
+
instance: InstanceSettings;
|
|
466
|
+
/** Visualization settings (API-modifiable) */
|
|
467
|
+
visualization: VisualizationSettings;
|
|
468
|
+
/** Analysis settings */
|
|
469
|
+
analysis: AnalysisSettings;
|
|
470
|
+
/** Node type configuration */
|
|
471
|
+
nodeTypes: NodeTypeConfig[];
|
|
472
|
+
/** Domain configuration */
|
|
473
|
+
domains: DomainConfig[];
|
|
474
|
+
/** Relationship type configuration */
|
|
475
|
+
relationshipTypes: RelationshipTypeConfig[];
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Full configuration including non-runtime settings
|
|
479
|
+
*/
|
|
480
|
+
interface NeuronConfig extends NeuronSettings {
|
|
481
|
+
/** OpenAI configuration */
|
|
482
|
+
openai: {
|
|
483
|
+
apiKey: string;
|
|
484
|
+
organization?: string;
|
|
485
|
+
requestsPerMinute?: number;
|
|
486
|
+
maxRetries?: number;
|
|
487
|
+
};
|
|
488
|
+
/** Database configuration */
|
|
489
|
+
database: DatabaseSettings;
|
|
490
|
+
/** API configuration */
|
|
491
|
+
api: ApiSettings;
|
|
492
|
+
/** Logging configuration */
|
|
493
|
+
logging: LoggingSettings;
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Partial settings for updates
|
|
497
|
+
*/
|
|
498
|
+
interface NeuronSettingsUpdate {
|
|
499
|
+
visualization?: Partial<VisualizationSettings>;
|
|
500
|
+
analysis?: Partial<AnalysisSettings>;
|
|
501
|
+
nodeTypes?: NodeTypeConfig[];
|
|
502
|
+
domains?: DomainConfig[];
|
|
503
|
+
relationshipTypes?: RelationshipTypeConfig[];
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Default visualization settings
|
|
507
|
+
*/
|
|
508
|
+
declare const DEFAULT_VISUALIZATION_SETTINGS: VisualizationSettings;
|
|
509
|
+
/**
|
|
510
|
+
* Default analysis settings
|
|
511
|
+
*/
|
|
512
|
+
declare const DEFAULT_ANALYSIS_SETTINGS: AnalysisSettings;
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* API Types for omi-neuron-web
|
|
516
|
+
* Request and response types for all API endpoints
|
|
517
|
+
*/
|
|
518
|
+
|
|
519
|
+
interface PaginationParams {
|
|
520
|
+
page?: number;
|
|
521
|
+
limit?: number;
|
|
522
|
+
}
|
|
523
|
+
interface PaginationMeta {
|
|
524
|
+
page: number;
|
|
525
|
+
limit: number;
|
|
526
|
+
total: number;
|
|
527
|
+
totalPages: number;
|
|
528
|
+
hasNext: boolean;
|
|
529
|
+
hasPrev: boolean;
|
|
530
|
+
}
|
|
531
|
+
interface GraphFilters {
|
|
532
|
+
domains?: string[];
|
|
533
|
+
nodeTypes?: string[];
|
|
534
|
+
search?: string;
|
|
535
|
+
}
|
|
536
|
+
interface ListNodesParams extends PaginationParams {
|
|
537
|
+
nodeType?: string | string[];
|
|
538
|
+
domain?: string | string[];
|
|
539
|
+
clusterId?: string;
|
|
540
|
+
analysisStatus?: string;
|
|
541
|
+
search?: string;
|
|
542
|
+
sortBy?: 'createdAt' | 'updatedAt' | 'label' | 'connectionCount';
|
|
543
|
+
sortOrder?: 'asc' | 'desc';
|
|
544
|
+
includeEmbeddings?: boolean;
|
|
545
|
+
includeStats?: boolean;
|
|
546
|
+
}
|
|
547
|
+
interface ListNodesResponse {
|
|
548
|
+
nodes: NeuronNode[];
|
|
549
|
+
pagination: PaginationMeta;
|
|
550
|
+
meta: {
|
|
551
|
+
queryTime: number;
|
|
552
|
+
filters: Record<string, unknown>;
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
interface CreateNodesRequest {
|
|
556
|
+
nodes: NeuronNodeCreate[];
|
|
557
|
+
options?: {
|
|
558
|
+
skipDuplicates?: boolean;
|
|
559
|
+
updateOnConflict?: boolean;
|
|
560
|
+
autoAnalyze?: boolean;
|
|
561
|
+
analysisDepth?: 'embeddings' | 'cluster' | 'full';
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
interface CreateNodesResponse {
|
|
565
|
+
created: NeuronNode[];
|
|
566
|
+
skipped: Array<{
|
|
567
|
+
slug: string;
|
|
568
|
+
reason: string;
|
|
569
|
+
}>;
|
|
570
|
+
analysisJobId?: string;
|
|
571
|
+
}
|
|
572
|
+
interface GetNodeResponse {
|
|
573
|
+
node: NeuronNode;
|
|
574
|
+
edges: {
|
|
575
|
+
outbound: NeuronEdge[];
|
|
576
|
+
inbound: NeuronEdge[];
|
|
577
|
+
};
|
|
578
|
+
cluster?: NeuronCluster | null;
|
|
579
|
+
relatedNodes: NeuronNode[];
|
|
580
|
+
}
|
|
581
|
+
interface UpdateNodeRequest extends NeuronNodeUpdate {
|
|
582
|
+
}
|
|
583
|
+
interface DeleteNodeResponse {
|
|
584
|
+
deleted: boolean;
|
|
585
|
+
edgesRemoved: number;
|
|
586
|
+
}
|
|
587
|
+
interface ListEdgesParams extends PaginationParams {
|
|
588
|
+
fromNodeId?: string;
|
|
589
|
+
toNodeId?: string;
|
|
590
|
+
nodeId?: string;
|
|
591
|
+
relationshipType?: string | string[];
|
|
592
|
+
source?: 'manual' | 'ai_inferred' | 'imported';
|
|
593
|
+
minStrength?: number;
|
|
594
|
+
minConfidence?: number;
|
|
595
|
+
}
|
|
596
|
+
interface ListEdgesResponse {
|
|
597
|
+
edges: NeuronEdge[];
|
|
598
|
+
pagination: PaginationMeta;
|
|
599
|
+
}
|
|
600
|
+
interface CreateEdgesRequest {
|
|
601
|
+
edges: NeuronEdgeCreate[];
|
|
602
|
+
}
|
|
603
|
+
interface CreateEdgesResponse {
|
|
604
|
+
created: NeuronEdge[];
|
|
605
|
+
errors: Array<{
|
|
606
|
+
index: number;
|
|
607
|
+
error: string;
|
|
608
|
+
}>;
|
|
609
|
+
}
|
|
610
|
+
interface UpdateEdgeRequest extends NeuronEdgeUpdate {
|
|
611
|
+
}
|
|
612
|
+
interface DeleteEdgeResponse {
|
|
613
|
+
deleted: boolean;
|
|
614
|
+
}
|
|
615
|
+
interface GetGraphParams {
|
|
616
|
+
nodeTypes?: string[];
|
|
617
|
+
domains?: string[];
|
|
618
|
+
clusterIds?: string[];
|
|
619
|
+
nodeIds?: string[];
|
|
620
|
+
depth?: number;
|
|
621
|
+
minEdgeStrength?: number;
|
|
622
|
+
relationshipTypes?: string[];
|
|
623
|
+
maxNodes?: number;
|
|
624
|
+
includeOrphanNodes?: boolean;
|
|
625
|
+
}
|
|
626
|
+
interface GetGraphResponse {
|
|
627
|
+
nodes: NeuronVisualNode[];
|
|
628
|
+
edges: NeuronVisualEdge[];
|
|
629
|
+
clusters: NeuronVisualCluster[];
|
|
630
|
+
meta: {
|
|
631
|
+
totalNodes: number;
|
|
632
|
+
totalEdges: number;
|
|
633
|
+
truncated: boolean;
|
|
634
|
+
queryTime: number;
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
interface ExpandGraphRequest {
|
|
638
|
+
fromNodeIds: string[];
|
|
639
|
+
depth: number;
|
|
640
|
+
direction: 'outbound' | 'inbound' | 'both';
|
|
641
|
+
maxNodes?: number;
|
|
642
|
+
}
|
|
643
|
+
interface ExpandGraphResponse {
|
|
644
|
+
nodes: NeuronVisualNode[];
|
|
645
|
+
edges: NeuronVisualEdge[];
|
|
646
|
+
}
|
|
647
|
+
interface FindPathRequest {
|
|
648
|
+
fromNodeId: string;
|
|
649
|
+
toNodeId: string;
|
|
650
|
+
maxDepth?: number;
|
|
651
|
+
algorithm?: 'shortest' | 'all';
|
|
652
|
+
}
|
|
653
|
+
interface FindPathResponse {
|
|
654
|
+
paths: Array<{
|
|
655
|
+
nodes: string[];
|
|
656
|
+
edges: string[];
|
|
657
|
+
length: number;
|
|
658
|
+
totalStrength: number;
|
|
659
|
+
}>;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
interface GetAnalysisJobResponse {
|
|
663
|
+
job: AnalysisRun;
|
|
664
|
+
}
|
|
665
|
+
interface CancelAnalysisResponse {
|
|
666
|
+
cancelled: boolean;
|
|
667
|
+
}
|
|
668
|
+
interface SemanticSearchRequest {
|
|
669
|
+
query: string;
|
|
670
|
+
nodeTypes?: string[];
|
|
671
|
+
domains?: string[];
|
|
672
|
+
limit?: number;
|
|
673
|
+
minSimilarity?: number;
|
|
674
|
+
includeExplanation?: boolean;
|
|
675
|
+
}
|
|
676
|
+
interface SemanticSearchOptions {
|
|
677
|
+
nodeTypes?: string[];
|
|
678
|
+
domains?: string[];
|
|
679
|
+
limit?: number;
|
|
680
|
+
minSimilarity?: number;
|
|
681
|
+
includeExplanation?: boolean;
|
|
682
|
+
}
|
|
683
|
+
interface SemanticSearchResponse {
|
|
684
|
+
results: Array<{
|
|
685
|
+
node: NeuronNode;
|
|
686
|
+
similarity: number;
|
|
687
|
+
explanation?: string;
|
|
688
|
+
}>;
|
|
689
|
+
queryEmbedding?: number[];
|
|
690
|
+
queryTime: number;
|
|
691
|
+
}
|
|
692
|
+
interface SearchResult {
|
|
693
|
+
node: NeuronNode;
|
|
694
|
+
similarity: number;
|
|
695
|
+
explanation?: string;
|
|
696
|
+
}
|
|
697
|
+
interface FindSimilarRequest {
|
|
698
|
+
nodeId: string;
|
|
699
|
+
limit?: number;
|
|
700
|
+
minSimilarity?: number;
|
|
701
|
+
excludeConnected?: boolean;
|
|
702
|
+
}
|
|
703
|
+
interface FindSimilarOptions {
|
|
704
|
+
limit?: number;
|
|
705
|
+
minSimilarity?: number;
|
|
706
|
+
excludeConnected?: boolean;
|
|
707
|
+
}
|
|
708
|
+
interface FindSimilarResponse {
|
|
709
|
+
results: Array<{
|
|
710
|
+
node: NeuronNode;
|
|
711
|
+
similarity: number;
|
|
712
|
+
}>;
|
|
713
|
+
}
|
|
714
|
+
interface GetSettingsResponse {
|
|
715
|
+
settings: NeuronSettings;
|
|
716
|
+
source: 'database' | 'config_file' | 'defaults';
|
|
717
|
+
}
|
|
718
|
+
interface UpdateSettingsRequest extends NeuronSettingsUpdate {
|
|
719
|
+
}
|
|
720
|
+
interface UpdateSettingsResponse {
|
|
721
|
+
settings: NeuronSettings;
|
|
722
|
+
}
|
|
723
|
+
interface ResetSettingsRequest {
|
|
724
|
+
sections?: Array<'visualization' | 'analysis' | 'nodeTypes' | 'domains' | 'relationshipTypes'>;
|
|
725
|
+
}
|
|
726
|
+
interface ResetSettingsResponse {
|
|
727
|
+
settings: NeuronSettings;
|
|
728
|
+
}
|
|
729
|
+
interface ApiErrorResponse {
|
|
730
|
+
error: string;
|
|
731
|
+
code: string;
|
|
732
|
+
details?: Record<string, unknown>;
|
|
733
|
+
statusCode: number;
|
|
734
|
+
}
|
|
735
|
+
interface HealthCheckResponse {
|
|
736
|
+
status: 'healthy' | 'degraded' | 'unhealthy';
|
|
737
|
+
version: string;
|
|
738
|
+
database: {
|
|
739
|
+
connected: boolean;
|
|
740
|
+
latencyMs?: number;
|
|
741
|
+
};
|
|
742
|
+
services: {
|
|
743
|
+
openai: boolean;
|
|
744
|
+
docker: boolean;
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
type WhereClause = Record<string, unknown>;
|
|
749
|
+
interface SelectOptions {
|
|
750
|
+
limit?: number;
|
|
751
|
+
offset?: number;
|
|
752
|
+
orderBy?: string;
|
|
753
|
+
orderDirection?: 'asc' | 'desc';
|
|
754
|
+
}
|
|
755
|
+
declare const buildWhereClause: (where?: WhereClause, startIndex?: number) => {
|
|
756
|
+
clause: string;
|
|
757
|
+
values: unknown[];
|
|
758
|
+
nextIndex: number;
|
|
759
|
+
};
|
|
760
|
+
declare const buildInsert: (table: string, data: Record<string, unknown>) => {
|
|
761
|
+
sql: string;
|
|
762
|
+
values: unknown[];
|
|
763
|
+
};
|
|
764
|
+
declare const buildUpdate: (table: string, data: Record<string, unknown>, where: WhereClause) => {
|
|
765
|
+
sql: string;
|
|
766
|
+
values: unknown[];
|
|
767
|
+
};
|
|
768
|
+
declare const buildSelect: (table: string, columns: string[] | "*", where?: WhereClause, options?: SelectOptions) => {
|
|
769
|
+
sql: string;
|
|
770
|
+
values: unknown[];
|
|
771
|
+
};
|
|
772
|
+
declare const buildDelete: (table: string, where: WhereClause) => {
|
|
773
|
+
sql: string;
|
|
774
|
+
values: unknown[];
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
export { type ClusteringConfig as $, type AnalysisRun as A, type FindSimilarOptions as B, type CreateNodesRequest as C, type DeleteNodeResponse as D, type ExpandGraphRequest as E, type FindPathRequest as F, type GetGraphParams as G, type FindSimilarResponse as H, type GetSettingsResponse as I, type UpdateSettingsRequest as J, type UpdateSettingsResponse as K, type ListNodesParams as L, type ResetSettingsResponse as M, type NeuronConfig as N, type ApiErrorResponse as O, type PaginationParams as P, type HealthCheckResponse as Q, type ResetSettingsRequest as R, type SelectOptions as S, type ClusterMembership as T, type UpdateNodeRequest as U, type ClusteringAlgorithm as V, type WhereClause as W, type NeuronVisualCluster as X, type VisualizationSettings as Y, type NeuronClusterCreate as Z, type NeuronClusterUpdate as _, type NeuronCluster as a, type AnalysisRunType as a0, type AnalysisJobStatus as a1, type InferredRelationshipResult as a2, type EmbeddingResult as a3, type ClusteringResult as a4, type AnalysisPipelineConfig as a5, type EmbeddingModel as a6, type PerformanceMode as a7, type NodeTypeConfig as a8, type DomainConfig as a9, type RelationshipTypeConfig as aa, type AnalysisSettings as ab, type InstanceSettings as ac, type DatabaseSettings as ad, type ApiSettings as ae, type LoggingSettings as af, DEFAULT_VISUALIZATION_SETTINGS as ag, DEFAULT_ANALYSIS_SETTINGS as ah, buildWhereClause as ai, buildInsert as aj, buildUpdate as ak, buildSelect as al, buildDelete as am, type NeuronSettings as b, type NeuronSettingsUpdate as c, type GetGraphResponse as d, type ExpandGraphResponse as e, type FindPathResponse as f, type AnalysisRequest as g, type AnalysisResponse as h, type PaginationMeta as i, type GraphFilters as j, type ListNodesResponse as k, type CreateNodesResponse as l, type GetNodeResponse as m, type ListEdgesParams as n, type ListEdgesResponse as o, type CreateEdgesRequest as p, type CreateEdgesResponse as q, type UpdateEdgeRequest as r, type DeleteEdgeResponse as s, type GetAnalysisJobResponse as t, type CancelAnalysisResponse as u, type SemanticSearchRequest as v, type SemanticSearchOptions as w, type SemanticSearchResponse as x, type SearchResult as y, type FindSimilarRequest as z };
|