@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,41 @@
|
|
|
1
|
+
import { PoolClient } from 'pg';
|
|
2
|
+
|
|
3
|
+
interface DatabaseConfig {
|
|
4
|
+
connectionString?: string;
|
|
5
|
+
host?: string;
|
|
6
|
+
port?: number;
|
|
7
|
+
user?: string;
|
|
8
|
+
password?: string;
|
|
9
|
+
database?: string;
|
|
10
|
+
pool?: {
|
|
11
|
+
min: number;
|
|
12
|
+
max: number;
|
|
13
|
+
idleTimeoutMs: number;
|
|
14
|
+
connectionTimeoutMs: number;
|
|
15
|
+
};
|
|
16
|
+
ssl?: boolean | object;
|
|
17
|
+
slowQueryThresholdMs?: number;
|
|
18
|
+
}
|
|
19
|
+
interface PoolStats {
|
|
20
|
+
totalCount: number;
|
|
21
|
+
idleCount: number;
|
|
22
|
+
waitingCount: number;
|
|
23
|
+
}
|
|
24
|
+
declare class Database {
|
|
25
|
+
private pool;
|
|
26
|
+
private slowQueryThresholdMs?;
|
|
27
|
+
constructor(config: DatabaseConfig);
|
|
28
|
+
connect(): Promise<void>;
|
|
29
|
+
disconnect(): Promise<void>;
|
|
30
|
+
isConnected(): Promise<boolean>;
|
|
31
|
+
query<T>(sql: string, params?: unknown[]): Promise<T[]>;
|
|
32
|
+
queryOne<T>(sql: string, params?: unknown[]): Promise<T | null>;
|
|
33
|
+
execute(sql: string, params?: unknown[]): Promise<number>;
|
|
34
|
+
transaction<T>(fn: (client: PoolClient) => Promise<T>): Promise<T>;
|
|
35
|
+
tableExists(tableName: string): Promise<boolean>;
|
|
36
|
+
getPoolStats(): Promise<PoolStats>;
|
|
37
|
+
private buildConnectionString;
|
|
38
|
+
private logSlowQuery;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { Database as D, type PoolStats as P, type DatabaseConfig as a };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { PoolClient } from 'pg';
|
|
2
|
+
|
|
3
|
+
interface DatabaseConfig {
|
|
4
|
+
connectionString?: string;
|
|
5
|
+
host?: string;
|
|
6
|
+
port?: number;
|
|
7
|
+
user?: string;
|
|
8
|
+
password?: string;
|
|
9
|
+
database?: string;
|
|
10
|
+
pool?: {
|
|
11
|
+
min: number;
|
|
12
|
+
max: number;
|
|
13
|
+
idleTimeoutMs: number;
|
|
14
|
+
connectionTimeoutMs: number;
|
|
15
|
+
};
|
|
16
|
+
ssl?: boolean | object;
|
|
17
|
+
slowQueryThresholdMs?: number;
|
|
18
|
+
}
|
|
19
|
+
interface PoolStats {
|
|
20
|
+
totalCount: number;
|
|
21
|
+
idleCount: number;
|
|
22
|
+
waitingCount: number;
|
|
23
|
+
}
|
|
24
|
+
declare class Database {
|
|
25
|
+
private pool;
|
|
26
|
+
private slowQueryThresholdMs?;
|
|
27
|
+
constructor(config: DatabaseConfig);
|
|
28
|
+
connect(): Promise<void>;
|
|
29
|
+
disconnect(): Promise<void>;
|
|
30
|
+
isConnected(): Promise<boolean>;
|
|
31
|
+
query<T>(sql: string, params?: unknown[]): Promise<T[]>;
|
|
32
|
+
queryOne<T>(sql: string, params?: unknown[]): Promise<T | null>;
|
|
33
|
+
execute(sql: string, params?: unknown[]): Promise<number>;
|
|
34
|
+
transaction<T>(fn: (client: PoolClient) => Promise<T>): Promise<T>;
|
|
35
|
+
tableExists(tableName: string): Promise<boolean>;
|
|
36
|
+
getPoolStats(): Promise<PoolStats>;
|
|
37
|
+
private buildConnectionString;
|
|
38
|
+
private logSlowQuery;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { Database as D, type PoolStats as P, type DatabaseConfig as a };
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node Types for omi-neuron-web
|
|
3
|
+
* Defines the core data structures for nodes in the neuron web graph
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Node tier - affects visual prominence and analysis priority
|
|
7
|
+
*/
|
|
8
|
+
type NodeTier = 'primary' | 'secondary' | 'tertiary' | 'insight';
|
|
9
|
+
/**
|
|
10
|
+
* Analysis status for tracking node processing state
|
|
11
|
+
*/
|
|
12
|
+
type AnalysisStatus = 'pending' | 'processing' | 'complete' | 'failed';
|
|
13
|
+
/**
|
|
14
|
+
* Base node interface - all nodes in the system extend this
|
|
15
|
+
* Kept minimal to allow maximum flexibility in consuming apps
|
|
16
|
+
*/
|
|
17
|
+
interface NeuronNodeBase {
|
|
18
|
+
/** UUID v4 identifier */
|
|
19
|
+
id: string;
|
|
20
|
+
/** URL-safe unique identifier */
|
|
21
|
+
slug: string;
|
|
22
|
+
/** Human-readable display name */
|
|
23
|
+
label: string;
|
|
24
|
+
/** Configurable node type per instance */
|
|
25
|
+
nodeType: string;
|
|
26
|
+
/** Category/grouping for visualization */
|
|
27
|
+
domain: string;
|
|
28
|
+
/** Creation timestamp */
|
|
29
|
+
createdAt: Date;
|
|
30
|
+
/** Last update timestamp */
|
|
31
|
+
updatedAt: Date;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Extended node with all optional analysis fields
|
|
35
|
+
*/
|
|
36
|
+
interface NeuronNode extends NeuronNodeBase {
|
|
37
|
+
/** AI-generated or manual summary */
|
|
38
|
+
summary?: string | null;
|
|
39
|
+
/** Longer form description */
|
|
40
|
+
description?: string | null;
|
|
41
|
+
/** Full content for analysis source */
|
|
42
|
+
content?: string | null;
|
|
43
|
+
metadata: Record<string, unknown>;
|
|
44
|
+
/** OpenAI embedding vector (1536 dimensions for ada-002) */
|
|
45
|
+
embedding?: number[] | null;
|
|
46
|
+
/** Model used for embedding generation */
|
|
47
|
+
embeddingModel?: string | null;
|
|
48
|
+
/** When embedding was generated */
|
|
49
|
+
embeddingGeneratedAt?: Date | null;
|
|
50
|
+
/** ID of the cluster this node belongs to */
|
|
51
|
+
clusterId?: string | null;
|
|
52
|
+
/** Similarity score to cluster centroid (0-1) */
|
|
53
|
+
clusterSimilarity?: number | null;
|
|
54
|
+
/** Total edge count */
|
|
55
|
+
connectionCount?: number;
|
|
56
|
+
/** Inbound edge count */
|
|
57
|
+
inboundCount?: number;
|
|
58
|
+
/** Outbound edge count */
|
|
59
|
+
outboundCount?: number;
|
|
60
|
+
/** Current analysis processing status */
|
|
61
|
+
analysisStatus?: AnalysisStatus;
|
|
62
|
+
/** Error message if analysis failed */
|
|
63
|
+
analysisError?: string | null;
|
|
64
|
+
/** Node importance tier */
|
|
65
|
+
tier?: NodeTier;
|
|
66
|
+
/** Visual priority (0-100), affects render order */
|
|
67
|
+
visualPriority?: number;
|
|
68
|
+
/** Manual position override [x, y, z] */
|
|
69
|
+
positionOverride?: [number, number, number] | null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Input type for creating nodes - minimal required fields
|
|
73
|
+
*/
|
|
74
|
+
interface NeuronNodeCreate {
|
|
75
|
+
/** Auto-generated from label if not provided */
|
|
76
|
+
slug?: string;
|
|
77
|
+
/** Required: human-readable label */
|
|
78
|
+
label: string;
|
|
79
|
+
/** Defaults to config.defaultNodeType */
|
|
80
|
+
nodeType?: string;
|
|
81
|
+
/** Defaults to config.defaultDomain */
|
|
82
|
+
domain?: string;
|
|
83
|
+
/** Optional summary */
|
|
84
|
+
summary?: string;
|
|
85
|
+
/** Optional description */
|
|
86
|
+
description?: string;
|
|
87
|
+
/** Optional full content for analysis */
|
|
88
|
+
content?: string;
|
|
89
|
+
/** Optional metadata */
|
|
90
|
+
metadata?: Record<string, unknown>;
|
|
91
|
+
/** Optional tier */
|
|
92
|
+
tier?: NodeTier;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Input type for updating nodes
|
|
96
|
+
*/
|
|
97
|
+
interface NeuronNodeUpdate {
|
|
98
|
+
label?: string;
|
|
99
|
+
summary?: string;
|
|
100
|
+
description?: string;
|
|
101
|
+
content?: string;
|
|
102
|
+
metadata?: Record<string, unknown>;
|
|
103
|
+
domain?: string;
|
|
104
|
+
tier?: NodeTier;
|
|
105
|
+
positionOverride?: [number, number, number] | null;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Batch input for ingesting multiple nodes
|
|
109
|
+
*/
|
|
110
|
+
interface NeuronNodeBatchCreate {
|
|
111
|
+
nodes: NeuronNodeCreate[];
|
|
112
|
+
options?: {
|
|
113
|
+
/** Skip if slug exists */
|
|
114
|
+
skipDuplicates?: boolean;
|
|
115
|
+
/** Update existing on slug conflict */
|
|
116
|
+
updateOnConflict?: boolean;
|
|
117
|
+
/** Trigger analysis after insert */
|
|
118
|
+
autoAnalyze?: boolean;
|
|
119
|
+
/** Depth of analysis to trigger */
|
|
120
|
+
analysisDepth?: 'embeddings' | 'cluster' | 'full';
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Visual node representation for Three.js rendering
|
|
125
|
+
*/
|
|
126
|
+
interface NeuronVisualNode {
|
|
127
|
+
id: string;
|
|
128
|
+
slug: string;
|
|
129
|
+
label: string;
|
|
130
|
+
domain: string;
|
|
131
|
+
tier?: NodeTier;
|
|
132
|
+
metadata: Record<string, unknown>;
|
|
133
|
+
/** Reference string (e.g., scripture reference, citation) */
|
|
134
|
+
ref?: string | null;
|
|
135
|
+
connectionCount: number;
|
|
136
|
+
/** Optional position override */
|
|
137
|
+
position?: [number, number, number];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Edge Types for omi-neuron-web
|
|
142
|
+
* Defines relationships between nodes in the graph
|
|
143
|
+
*/
|
|
144
|
+
/**
|
|
145
|
+
* Built-in relationship types - configurable but with sensible defaults
|
|
146
|
+
*/
|
|
147
|
+
type BuiltInRelationshipType = 'related_to' | 'derives_from' | 'contradicts' | 'supports' | 'references' | 'part_of' | 'leads_to' | 'similar_to';
|
|
148
|
+
/**
|
|
149
|
+
* Relationship type - built-in or custom string
|
|
150
|
+
*/
|
|
151
|
+
type RelationshipType = BuiltInRelationshipType | string;
|
|
152
|
+
/**
|
|
153
|
+
* Source of the edge - how it was created
|
|
154
|
+
*/
|
|
155
|
+
type EdgeSource = 'manual' | 'ai_inferred' | 'imported';
|
|
156
|
+
/**
|
|
157
|
+
* Edge evidence - supporting data for relationship
|
|
158
|
+
*/
|
|
159
|
+
interface EdgeEvidence {
|
|
160
|
+
/** Type of evidence */
|
|
161
|
+
type: 'text' | 'url' | 'citation' | 'ai_inference';
|
|
162
|
+
/** Evidence content */
|
|
163
|
+
content: string;
|
|
164
|
+
/** Confidence score for AI inferences (0-1) */
|
|
165
|
+
confidence?: number;
|
|
166
|
+
/** Reference to external source */
|
|
167
|
+
sourceId?: string;
|
|
168
|
+
/** Additional metadata */
|
|
169
|
+
metadata?: Record<string, unknown>;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Complete edge definition
|
|
173
|
+
*/
|
|
174
|
+
interface NeuronEdge {
|
|
175
|
+
/** UUID v4 identifier */
|
|
176
|
+
id: string;
|
|
177
|
+
/** Source node ID */
|
|
178
|
+
fromNodeId: string;
|
|
179
|
+
/** Target node ID */
|
|
180
|
+
toNodeId: string;
|
|
181
|
+
/** Type of relationship */
|
|
182
|
+
relationshipType: RelationshipType;
|
|
183
|
+
/** Relationship strength (0-1), affects visual prominence */
|
|
184
|
+
strength: number;
|
|
185
|
+
/** Confidence level (0-1), how certain is this relationship */
|
|
186
|
+
confidence: number;
|
|
187
|
+
/** Array of evidence items */
|
|
188
|
+
evidence: EdgeEvidence[];
|
|
189
|
+
/** Optional display label */
|
|
190
|
+
label?: string | null;
|
|
191
|
+
/** Optional description */
|
|
192
|
+
description?: string | null;
|
|
193
|
+
/** Additional metadata */
|
|
194
|
+
metadata: Record<string, unknown>;
|
|
195
|
+
/** How this edge was created */
|
|
196
|
+
source: EdgeSource;
|
|
197
|
+
/** AI model used if inferred */
|
|
198
|
+
sourceModel?: string | null;
|
|
199
|
+
/** Creation timestamp */
|
|
200
|
+
createdAt: Date;
|
|
201
|
+
/** Last update timestamp */
|
|
202
|
+
updatedAt: Date;
|
|
203
|
+
/** If true, renders both directions */
|
|
204
|
+
bidirectional: boolean;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Input for creating edges
|
|
208
|
+
*/
|
|
209
|
+
interface NeuronEdgeCreate {
|
|
210
|
+
/** Source node ID */
|
|
211
|
+
fromNodeId: string;
|
|
212
|
+
/** Target node ID */
|
|
213
|
+
toNodeId: string;
|
|
214
|
+
/** Defaults to 'related_to' */
|
|
215
|
+
relationshipType?: RelationshipType;
|
|
216
|
+
/** Defaults to 0.5 */
|
|
217
|
+
strength?: number;
|
|
218
|
+
/** Defaults to 1.0 for manual edges */
|
|
219
|
+
confidence?: number;
|
|
220
|
+
/** Supporting evidence */
|
|
221
|
+
evidence?: EdgeEvidence[];
|
|
222
|
+
/** Display label */
|
|
223
|
+
label?: string;
|
|
224
|
+
/** Description */
|
|
225
|
+
description?: string;
|
|
226
|
+
/** Additional metadata */
|
|
227
|
+
metadata?: Record<string, unknown>;
|
|
228
|
+
/** Defaults to false */
|
|
229
|
+
bidirectional?: boolean;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Input for updating edges
|
|
233
|
+
*/
|
|
234
|
+
interface NeuronEdgeUpdate {
|
|
235
|
+
strength?: number;
|
|
236
|
+
confidence?: number;
|
|
237
|
+
relationshipType?: RelationshipType;
|
|
238
|
+
label?: string;
|
|
239
|
+
description?: string;
|
|
240
|
+
evidence?: EdgeEvidence[];
|
|
241
|
+
metadata?: Record<string, unknown>;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Visual edge representation for Three.js rendering
|
|
245
|
+
*/
|
|
246
|
+
interface NeuronVisualEdge {
|
|
247
|
+
id: string;
|
|
248
|
+
/** Source node slug */
|
|
249
|
+
from: string;
|
|
250
|
+
/** Target node slug */
|
|
251
|
+
to: string;
|
|
252
|
+
relationshipType: string;
|
|
253
|
+
strength: number;
|
|
254
|
+
label?: string | null;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Inferred relationship result from AI analysis
|
|
258
|
+
*/
|
|
259
|
+
interface InferredRelationship {
|
|
260
|
+
fromNodeId: string;
|
|
261
|
+
toNodeId: string;
|
|
262
|
+
confidence: number;
|
|
263
|
+
/** AI explanation for the inference */
|
|
264
|
+
reasoning: string;
|
|
265
|
+
suggestedType: RelationshipType;
|
|
266
|
+
evidence: EdgeEvidence[];
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export type { AnalysisStatus as A, BuiltInRelationshipType as B, EdgeEvidence as E, InferredRelationship as I, NeuronVisualNode as N, RelationshipType as R, NeuronVisualEdge as a, NeuronNode as b, NeuronEdge as c, NeuronNodeCreate as d, NeuronNodeUpdate as e, NeuronEdgeCreate as f, NeuronEdgeUpdate as g, NodeTier as h, NeuronNodeBase as i, NeuronNodeBatchCreate as j, EdgeSource as k };
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node Types for omi-neuron-web
|
|
3
|
+
* Defines the core data structures for nodes in the neuron web graph
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Node tier - affects visual prominence and analysis priority
|
|
7
|
+
*/
|
|
8
|
+
type NodeTier = 'primary' | 'secondary' | 'tertiary' | 'insight';
|
|
9
|
+
/**
|
|
10
|
+
* Analysis status for tracking node processing state
|
|
11
|
+
*/
|
|
12
|
+
type AnalysisStatus = 'pending' | 'processing' | 'complete' | 'failed';
|
|
13
|
+
/**
|
|
14
|
+
* Base node interface - all nodes in the system extend this
|
|
15
|
+
* Kept minimal to allow maximum flexibility in consuming apps
|
|
16
|
+
*/
|
|
17
|
+
interface NeuronNodeBase {
|
|
18
|
+
/** UUID v4 identifier */
|
|
19
|
+
id: string;
|
|
20
|
+
/** URL-safe unique identifier */
|
|
21
|
+
slug: string;
|
|
22
|
+
/** Human-readable display name */
|
|
23
|
+
label: string;
|
|
24
|
+
/** Configurable node type per instance */
|
|
25
|
+
nodeType: string;
|
|
26
|
+
/** Category/grouping for visualization */
|
|
27
|
+
domain: string;
|
|
28
|
+
/** Creation timestamp */
|
|
29
|
+
createdAt: Date;
|
|
30
|
+
/** Last update timestamp */
|
|
31
|
+
updatedAt: Date;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Extended node with all optional analysis fields
|
|
35
|
+
*/
|
|
36
|
+
interface NeuronNode extends NeuronNodeBase {
|
|
37
|
+
/** AI-generated or manual summary */
|
|
38
|
+
summary?: string | null;
|
|
39
|
+
/** Longer form description */
|
|
40
|
+
description?: string | null;
|
|
41
|
+
/** Full content for analysis source */
|
|
42
|
+
content?: string | null;
|
|
43
|
+
metadata: Record<string, unknown>;
|
|
44
|
+
/** OpenAI embedding vector (1536 dimensions for ada-002) */
|
|
45
|
+
embedding?: number[] | null;
|
|
46
|
+
/** Model used for embedding generation */
|
|
47
|
+
embeddingModel?: string | null;
|
|
48
|
+
/** When embedding was generated */
|
|
49
|
+
embeddingGeneratedAt?: Date | null;
|
|
50
|
+
/** ID of the cluster this node belongs to */
|
|
51
|
+
clusterId?: string | null;
|
|
52
|
+
/** Similarity score to cluster centroid (0-1) */
|
|
53
|
+
clusterSimilarity?: number | null;
|
|
54
|
+
/** Total edge count */
|
|
55
|
+
connectionCount?: number;
|
|
56
|
+
/** Inbound edge count */
|
|
57
|
+
inboundCount?: number;
|
|
58
|
+
/** Outbound edge count */
|
|
59
|
+
outboundCount?: number;
|
|
60
|
+
/** Current analysis processing status */
|
|
61
|
+
analysisStatus?: AnalysisStatus;
|
|
62
|
+
/** Error message if analysis failed */
|
|
63
|
+
analysisError?: string | null;
|
|
64
|
+
/** Node importance tier */
|
|
65
|
+
tier?: NodeTier;
|
|
66
|
+
/** Visual priority (0-100), affects render order */
|
|
67
|
+
visualPriority?: number;
|
|
68
|
+
/** Manual position override [x, y, z] */
|
|
69
|
+
positionOverride?: [number, number, number] | null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Input type for creating nodes - minimal required fields
|
|
73
|
+
*/
|
|
74
|
+
interface NeuronNodeCreate {
|
|
75
|
+
/** Auto-generated from label if not provided */
|
|
76
|
+
slug?: string;
|
|
77
|
+
/** Required: human-readable label */
|
|
78
|
+
label: string;
|
|
79
|
+
/** Defaults to config.defaultNodeType */
|
|
80
|
+
nodeType?: string;
|
|
81
|
+
/** Defaults to config.defaultDomain */
|
|
82
|
+
domain?: string;
|
|
83
|
+
/** Optional summary */
|
|
84
|
+
summary?: string;
|
|
85
|
+
/** Optional description */
|
|
86
|
+
description?: string;
|
|
87
|
+
/** Optional full content for analysis */
|
|
88
|
+
content?: string;
|
|
89
|
+
/** Optional metadata */
|
|
90
|
+
metadata?: Record<string, unknown>;
|
|
91
|
+
/** Optional tier */
|
|
92
|
+
tier?: NodeTier;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Input type for updating nodes
|
|
96
|
+
*/
|
|
97
|
+
interface NeuronNodeUpdate {
|
|
98
|
+
label?: string;
|
|
99
|
+
summary?: string;
|
|
100
|
+
description?: string;
|
|
101
|
+
content?: string;
|
|
102
|
+
metadata?: Record<string, unknown>;
|
|
103
|
+
domain?: string;
|
|
104
|
+
tier?: NodeTier;
|
|
105
|
+
positionOverride?: [number, number, number] | null;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Batch input for ingesting multiple nodes
|
|
109
|
+
*/
|
|
110
|
+
interface NeuronNodeBatchCreate {
|
|
111
|
+
nodes: NeuronNodeCreate[];
|
|
112
|
+
options?: {
|
|
113
|
+
/** Skip if slug exists */
|
|
114
|
+
skipDuplicates?: boolean;
|
|
115
|
+
/** Update existing on slug conflict */
|
|
116
|
+
updateOnConflict?: boolean;
|
|
117
|
+
/** Trigger analysis after insert */
|
|
118
|
+
autoAnalyze?: boolean;
|
|
119
|
+
/** Depth of analysis to trigger */
|
|
120
|
+
analysisDepth?: 'embeddings' | 'cluster' | 'full';
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Visual node representation for Three.js rendering
|
|
125
|
+
*/
|
|
126
|
+
interface NeuronVisualNode {
|
|
127
|
+
id: string;
|
|
128
|
+
slug: string;
|
|
129
|
+
label: string;
|
|
130
|
+
domain: string;
|
|
131
|
+
tier?: NodeTier;
|
|
132
|
+
metadata: Record<string, unknown>;
|
|
133
|
+
/** Reference string (e.g., scripture reference, citation) */
|
|
134
|
+
ref?: string | null;
|
|
135
|
+
connectionCount: number;
|
|
136
|
+
/** Optional position override */
|
|
137
|
+
position?: [number, number, number];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Edge Types for omi-neuron-web
|
|
142
|
+
* Defines relationships between nodes in the graph
|
|
143
|
+
*/
|
|
144
|
+
/**
|
|
145
|
+
* Built-in relationship types - configurable but with sensible defaults
|
|
146
|
+
*/
|
|
147
|
+
type BuiltInRelationshipType = 'related_to' | 'derives_from' | 'contradicts' | 'supports' | 'references' | 'part_of' | 'leads_to' | 'similar_to';
|
|
148
|
+
/**
|
|
149
|
+
* Relationship type - built-in or custom string
|
|
150
|
+
*/
|
|
151
|
+
type RelationshipType = BuiltInRelationshipType | string;
|
|
152
|
+
/**
|
|
153
|
+
* Source of the edge - how it was created
|
|
154
|
+
*/
|
|
155
|
+
type EdgeSource = 'manual' | 'ai_inferred' | 'imported';
|
|
156
|
+
/**
|
|
157
|
+
* Edge evidence - supporting data for relationship
|
|
158
|
+
*/
|
|
159
|
+
interface EdgeEvidence {
|
|
160
|
+
/** Type of evidence */
|
|
161
|
+
type: 'text' | 'url' | 'citation' | 'ai_inference';
|
|
162
|
+
/** Evidence content */
|
|
163
|
+
content: string;
|
|
164
|
+
/** Confidence score for AI inferences (0-1) */
|
|
165
|
+
confidence?: number;
|
|
166
|
+
/** Reference to external source */
|
|
167
|
+
sourceId?: string;
|
|
168
|
+
/** Additional metadata */
|
|
169
|
+
metadata?: Record<string, unknown>;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Complete edge definition
|
|
173
|
+
*/
|
|
174
|
+
interface NeuronEdge {
|
|
175
|
+
/** UUID v4 identifier */
|
|
176
|
+
id: string;
|
|
177
|
+
/** Source node ID */
|
|
178
|
+
fromNodeId: string;
|
|
179
|
+
/** Target node ID */
|
|
180
|
+
toNodeId: string;
|
|
181
|
+
/** Type of relationship */
|
|
182
|
+
relationshipType: RelationshipType;
|
|
183
|
+
/** Relationship strength (0-1), affects visual prominence */
|
|
184
|
+
strength: number;
|
|
185
|
+
/** Confidence level (0-1), how certain is this relationship */
|
|
186
|
+
confidence: number;
|
|
187
|
+
/** Array of evidence items */
|
|
188
|
+
evidence: EdgeEvidence[];
|
|
189
|
+
/** Optional display label */
|
|
190
|
+
label?: string | null;
|
|
191
|
+
/** Optional description */
|
|
192
|
+
description?: string | null;
|
|
193
|
+
/** Additional metadata */
|
|
194
|
+
metadata: Record<string, unknown>;
|
|
195
|
+
/** How this edge was created */
|
|
196
|
+
source: EdgeSource;
|
|
197
|
+
/** AI model used if inferred */
|
|
198
|
+
sourceModel?: string | null;
|
|
199
|
+
/** Creation timestamp */
|
|
200
|
+
createdAt: Date;
|
|
201
|
+
/** Last update timestamp */
|
|
202
|
+
updatedAt: Date;
|
|
203
|
+
/** If true, renders both directions */
|
|
204
|
+
bidirectional: boolean;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Input for creating edges
|
|
208
|
+
*/
|
|
209
|
+
interface NeuronEdgeCreate {
|
|
210
|
+
/** Source node ID */
|
|
211
|
+
fromNodeId: string;
|
|
212
|
+
/** Target node ID */
|
|
213
|
+
toNodeId: string;
|
|
214
|
+
/** Defaults to 'related_to' */
|
|
215
|
+
relationshipType?: RelationshipType;
|
|
216
|
+
/** Defaults to 0.5 */
|
|
217
|
+
strength?: number;
|
|
218
|
+
/** Defaults to 1.0 for manual edges */
|
|
219
|
+
confidence?: number;
|
|
220
|
+
/** Supporting evidence */
|
|
221
|
+
evidence?: EdgeEvidence[];
|
|
222
|
+
/** Display label */
|
|
223
|
+
label?: string;
|
|
224
|
+
/** Description */
|
|
225
|
+
description?: string;
|
|
226
|
+
/** Additional metadata */
|
|
227
|
+
metadata?: Record<string, unknown>;
|
|
228
|
+
/** Defaults to false */
|
|
229
|
+
bidirectional?: boolean;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Input for updating edges
|
|
233
|
+
*/
|
|
234
|
+
interface NeuronEdgeUpdate {
|
|
235
|
+
strength?: number;
|
|
236
|
+
confidence?: number;
|
|
237
|
+
relationshipType?: RelationshipType;
|
|
238
|
+
label?: string;
|
|
239
|
+
description?: string;
|
|
240
|
+
evidence?: EdgeEvidence[];
|
|
241
|
+
metadata?: Record<string, unknown>;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Visual edge representation for Three.js rendering
|
|
245
|
+
*/
|
|
246
|
+
interface NeuronVisualEdge {
|
|
247
|
+
id: string;
|
|
248
|
+
/** Source node slug */
|
|
249
|
+
from: string;
|
|
250
|
+
/** Target node slug */
|
|
251
|
+
to: string;
|
|
252
|
+
relationshipType: string;
|
|
253
|
+
strength: number;
|
|
254
|
+
label?: string | null;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Inferred relationship result from AI analysis
|
|
258
|
+
*/
|
|
259
|
+
interface InferredRelationship {
|
|
260
|
+
fromNodeId: string;
|
|
261
|
+
toNodeId: string;
|
|
262
|
+
confidence: number;
|
|
263
|
+
/** AI explanation for the inference */
|
|
264
|
+
reasoning: string;
|
|
265
|
+
suggestedType: RelationshipType;
|
|
266
|
+
evidence: EdgeEvidence[];
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export type { AnalysisStatus as A, BuiltInRelationshipType as B, EdgeEvidence as E, InferredRelationship as I, NeuronVisualNode as N, RelationshipType as R, NeuronVisualEdge as a, NeuronNode as b, NeuronEdge as c, NeuronNodeCreate as d, NeuronNodeUpdate as e, NeuronEdgeCreate as f, NeuronEdgeUpdate as g, NodeTier as h, NeuronNodeBase as i, NeuronNodeBatchCreate as j, EdgeSource as k };
|