@omiron33/omi-neuron-web 0.1.0 → 0.1.1

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 CHANGED
@@ -14,11 +14,14 @@ A drop-in Next.js library for data analysis and 3D visualization with OpenAI-pow
14
14
  ## Quick Start
15
15
 
16
16
  ```bash
17
+ # Install the package
18
+ pnpm add @omiron33/omi-neuron-web
19
+
17
20
  # Initialize in your Next.js project
18
- npx omi-neuron init
21
+ npx @omiron33/omi-neuron-web init
19
22
 
20
23
  # Start the database
21
- npx omi-neuron db:up
24
+ npx @omiron33/omi-neuron-web db:up
22
25
 
23
26
  # Run your Next.js app
24
27
  npm run dev
@@ -53,3 +56,4 @@ See [plans/master-plan-planner.md](./plans/master-plan-planner.md) for current s
53
56
  ## License
54
57
 
55
58
  MIT
59
+
@@ -0,0 +1,85 @@
1
+ import React__default from 'react';
2
+ import { N as NeuronVisualNode, a as NeuronVisualEdge, b as NeuronNode, c as NeuronEdge } from './edge-BzsYe2Ed.cjs';
3
+
4
+ interface NeuronStoryBeat {
5
+ id: string;
6
+ label: string;
7
+ nodeIds: string[];
8
+ }
9
+ interface StudyPathRequest {
10
+ fromNodeId: string;
11
+ toNodeId: string;
12
+ }
13
+ interface NeuronWebTheme {
14
+ colors: {
15
+ background: string;
16
+ domainColors: Record<string, string>;
17
+ defaultDomainColor: string;
18
+ edgeDefault: string;
19
+ edgeActive: string;
20
+ edgeSelected: string;
21
+ labelText: string;
22
+ labelBackground: string;
23
+ };
24
+ typography: {
25
+ labelFontFamily: string;
26
+ labelFontSize: number;
27
+ labelFontWeight: string;
28
+ };
29
+ effects: {
30
+ starfieldEnabled: boolean;
31
+ starfieldColor: string;
32
+ glowEnabled: boolean;
33
+ glowIntensity: number;
34
+ };
35
+ animation: {
36
+ focusDuration: number;
37
+ transitionDuration: number;
38
+ easing: string;
39
+ };
40
+ }
41
+ type NeuronLayoutMode = 'auto' | 'positioned' | 'fuzzy';
42
+ interface NeuronLayoutOptions {
43
+ mode?: NeuronLayoutMode;
44
+ radius?: number;
45
+ jitter?: number;
46
+ zSpread?: number;
47
+ seed?: string;
48
+ }
49
+ interface NeuronWebProps {
50
+ graphData: {
51
+ nodes: NeuronVisualNode[];
52
+ edges: NeuronVisualEdge[];
53
+ storyBeats?: NeuronStoryBeat[];
54
+ };
55
+ fullHeight?: boolean;
56
+ isFullScreen?: boolean;
57
+ className?: string;
58
+ style?: React__default.CSSProperties;
59
+ isLoading?: boolean;
60
+ error?: string | null;
61
+ selectedNode?: NeuronNode | null;
62
+ focusNodeSlug?: string | null;
63
+ visibleNodeSlugs?: string[] | null;
64
+ onNodeClick?: (node: NeuronNode) => void;
65
+ onNodeDoubleClick?: (node: NeuronNode) => void;
66
+ onNodeHover?: (node: NeuronNode | null) => void;
67
+ onNodeFocused?: (node: NeuronNode) => void;
68
+ onEdgeClick?: (edge: NeuronEdge) => void;
69
+ onBackgroundClick?: () => void;
70
+ onCameraChange?: (position: [number, number, number]) => void;
71
+ studyPathRequest?: StudyPathRequest | null;
72
+ onStudyPathComplete?: () => void;
73
+ layout?: NeuronLayoutOptions;
74
+ theme?: Partial<NeuronWebTheme>;
75
+ domainColors?: Record<string, string>;
76
+ renderNodeDetail?: (node: NeuronNode) => React__default.ReactNode;
77
+ renderEmptyState?: () => React__default.ReactNode;
78
+ renderLoadingState?: () => React__default.ReactNode;
79
+ performanceMode?: 'auto' | 'normal' | 'degraded' | 'fallback';
80
+ ariaLabel?: string;
81
+ }
82
+
83
+ declare function NeuronWeb({ graphData, className, style, isLoading, error, renderEmptyState, renderLoadingState, ariaLabel, theme, layout, }: NeuronWebProps): React__default.ReactElement;
84
+
85
+ export { type NeuronWebTheme as N, type NeuronLayoutOptions as a, NeuronWeb as b, type NeuronWebProps as c, type NeuronLayoutMode as d };
@@ -0,0 +1,85 @@
1
+ import React__default from 'react';
2
+ import { N as NeuronVisualNode, a as NeuronVisualEdge, b as NeuronNode, c as NeuronEdge } from './edge-BzsYe2Ed.js';
3
+
4
+ interface NeuronStoryBeat {
5
+ id: string;
6
+ label: string;
7
+ nodeIds: string[];
8
+ }
9
+ interface StudyPathRequest {
10
+ fromNodeId: string;
11
+ toNodeId: string;
12
+ }
13
+ interface NeuronWebTheme {
14
+ colors: {
15
+ background: string;
16
+ domainColors: Record<string, string>;
17
+ defaultDomainColor: string;
18
+ edgeDefault: string;
19
+ edgeActive: string;
20
+ edgeSelected: string;
21
+ labelText: string;
22
+ labelBackground: string;
23
+ };
24
+ typography: {
25
+ labelFontFamily: string;
26
+ labelFontSize: number;
27
+ labelFontWeight: string;
28
+ };
29
+ effects: {
30
+ starfieldEnabled: boolean;
31
+ starfieldColor: string;
32
+ glowEnabled: boolean;
33
+ glowIntensity: number;
34
+ };
35
+ animation: {
36
+ focusDuration: number;
37
+ transitionDuration: number;
38
+ easing: string;
39
+ };
40
+ }
41
+ type NeuronLayoutMode = 'auto' | 'positioned' | 'fuzzy';
42
+ interface NeuronLayoutOptions {
43
+ mode?: NeuronLayoutMode;
44
+ radius?: number;
45
+ jitter?: number;
46
+ zSpread?: number;
47
+ seed?: string;
48
+ }
49
+ interface NeuronWebProps {
50
+ graphData: {
51
+ nodes: NeuronVisualNode[];
52
+ edges: NeuronVisualEdge[];
53
+ storyBeats?: NeuronStoryBeat[];
54
+ };
55
+ fullHeight?: boolean;
56
+ isFullScreen?: boolean;
57
+ className?: string;
58
+ style?: React__default.CSSProperties;
59
+ isLoading?: boolean;
60
+ error?: string | null;
61
+ selectedNode?: NeuronNode | null;
62
+ focusNodeSlug?: string | null;
63
+ visibleNodeSlugs?: string[] | null;
64
+ onNodeClick?: (node: NeuronNode) => void;
65
+ onNodeDoubleClick?: (node: NeuronNode) => void;
66
+ onNodeHover?: (node: NeuronNode | null) => void;
67
+ onNodeFocused?: (node: NeuronNode) => void;
68
+ onEdgeClick?: (edge: NeuronEdge) => void;
69
+ onBackgroundClick?: () => void;
70
+ onCameraChange?: (position: [number, number, number]) => void;
71
+ studyPathRequest?: StudyPathRequest | null;
72
+ onStudyPathComplete?: () => void;
73
+ layout?: NeuronLayoutOptions;
74
+ theme?: Partial<NeuronWebTheme>;
75
+ domainColors?: Record<string, string>;
76
+ renderNodeDetail?: (node: NeuronNode) => React__default.ReactNode;
77
+ renderEmptyState?: () => React__default.ReactNode;
78
+ renderLoadingState?: () => React__default.ReactNode;
79
+ performanceMode?: 'auto' | 'normal' | 'degraded' | 'fallback';
80
+ ariaLabel?: string;
81
+ }
82
+
83
+ declare function NeuronWeb({ graphData, className, style, isLoading, error, renderEmptyState, renderLoadingState, ariaLabel, theme, layout, }: NeuronWebProps): React__default.ReactElement;
84
+
85
+ export { type NeuronWebTheme as N, type NeuronLayoutOptions as a, NeuronWeb as b, type NeuronWebProps as c, type NeuronLayoutMode as d };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkRTSFO7BW_cjs = require('../chunk-RTSFO7BW.cjs');
3
+ var chunkOBZGUYGW_cjs = require('../chunk-OBZGUYGW.cjs');
4
4
  var chunkCOO66N7H_cjs = require('../chunk-COO66N7H.cjs');
5
5
 
6
6
  // src/api/repositories/base.ts
@@ -10,12 +10,12 @@ var BaseRepository = class {
10
10
  this.tableName = tableName;
11
11
  }
12
12
  async findById(id) {
13
- const { sql, values } = chunkRTSFO7BW_cjs.buildSelect(this.tableName, "*", { id });
13
+ const { sql, values } = chunkOBZGUYGW_cjs.buildSelect(this.tableName, "*", { id });
14
14
  const rows = await this.db.query(sql, values);
15
15
  return rows[0] ?? null;
16
16
  }
17
17
  async findAll(options) {
18
- const { sql, values } = chunkRTSFO7BW_cjs.buildSelect(
18
+ const { sql, values } = chunkOBZGUYGW_cjs.buildSelect(
19
19
  this.tableName,
20
20
  "*",
21
21
  options?.where,
@@ -24,22 +24,22 @@ var BaseRepository = class {
24
24
  return this.db.query(sql, values);
25
25
  }
26
26
  async create(data) {
27
- const { sql, values } = chunkRTSFO7BW_cjs.buildInsert(this.tableName, data);
27
+ const { sql, values } = chunkOBZGUYGW_cjs.buildInsert(this.tableName, data);
28
28
  const rows = await this.db.query(sql, values);
29
29
  return rows[0];
30
30
  }
31
31
  async update(id, data) {
32
- const { sql, values } = chunkRTSFO7BW_cjs.buildUpdate(this.tableName, data, { id });
32
+ const { sql, values } = chunkOBZGUYGW_cjs.buildUpdate(this.tableName, data, { id });
33
33
  const rows = await this.db.query(sql, values);
34
34
  return rows[0] ?? null;
35
35
  }
36
36
  async delete(id) {
37
- const { sql, values } = chunkRTSFO7BW_cjs.buildDelete(this.tableName, { id });
37
+ const { sql, values } = chunkOBZGUYGW_cjs.buildDelete(this.tableName, { id });
38
38
  const count = await this.db.execute(sql, values);
39
39
  return count > 0;
40
40
  }
41
41
  async count(where) {
42
- const whereResult = chunkRTSFO7BW_cjs.buildWhereClause(where);
42
+ const whereResult = chunkOBZGUYGW_cjs.buildWhereClause(where);
43
43
  const sql = `SELECT COUNT(*)::int as count FROM ${this.tableName} ${whereResult.clause}`;
44
44
  const rows = await this.db.query(sql, whereResult.values);
45
45
  return Number(rows[0]?.count ?? 0);
@@ -147,12 +147,12 @@ var NodeRepository = class extends BaseRepository {
147
147
 
148
148
  // src/api/routes/nodes.ts
149
149
  var createNodesRoutes = (config) => {
150
- const db = chunkRTSFO7BW_cjs.createDatabase(config);
150
+ const db = chunkOBZGUYGW_cjs.createDatabase(config);
151
151
  const repo = new NodeRepository(db);
152
152
  return {
153
153
  async GET(request) {
154
154
  const url = new URL(request.url);
155
- const params = chunkRTSFO7BW_cjs.listNodesParamsSchema.parse(Object.fromEntries(url.searchParams));
155
+ const params = chunkOBZGUYGW_cjs.listNodesParamsSchema.parse(Object.fromEntries(url.searchParams));
156
156
  const nodes = await repo.findAll({
157
157
  where: {},
158
158
  limit: params.limit,
@@ -176,7 +176,7 @@ var createNodesRoutes = (config) => {
176
176
  },
177
177
  async POST(request) {
178
178
  const body = await request.json();
179
- const input = chunkRTSFO7BW_cjs.nodeBatchCreateSchema.parse(body);
179
+ const input = chunkOBZGUYGW_cjs.nodeBatchCreateSchema.parse(body);
180
180
  const created = await repo.batchCreate(input.nodes);
181
181
  return Response.json({ created, skipped: [], analysisJobId: null }, { status: 201 });
182
182
  },
@@ -185,7 +185,7 @@ var createNodesRoutes = (config) => {
185
185
  const id = url.pathname.split("/").pop();
186
186
  if (!id) return new Response("Missing id", { status: 400 });
187
187
  const body = await request.json();
188
- const input = chunkRTSFO7BW_cjs.nodeUpdateSchema.parse(body);
188
+ const input = chunkOBZGUYGW_cjs.nodeUpdateSchema.parse(body);
189
189
  const updated = await repo.update(id, input);
190
190
  return Response.json(updated);
191
191
  },
@@ -278,12 +278,12 @@ var EdgeRepository = class extends BaseRepository {
278
278
 
279
279
  // src/api/routes/edges.ts
280
280
  var createEdgesRoutes = (config) => {
281
- const db = chunkRTSFO7BW_cjs.createDatabase(config);
281
+ const db = chunkOBZGUYGW_cjs.createDatabase(config);
282
282
  const repo = new EdgeRepository(db);
283
283
  return {
284
284
  async GET(request) {
285
285
  const url = new URL(request.url);
286
- const params = chunkRTSFO7BW_cjs.listEdgesParamsSchema.parse(Object.fromEntries(url.searchParams));
286
+ const params = chunkOBZGUYGW_cjs.listEdgesParamsSchema.parse(Object.fromEntries(url.searchParams));
287
287
  const edges = await repo.findAll();
288
288
  return Response.json({
289
289
  edges,
@@ -299,7 +299,7 @@ var createEdgesRoutes = (config) => {
299
299
  },
300
300
  async POST(request) {
301
301
  const body = await request.json();
302
- const input = chunkRTSFO7BW_cjs.edgeCreateSchema.array().safeParse(body.edges ?? body);
302
+ const input = chunkOBZGUYGW_cjs.edgeCreateSchema.array().safeParse(body.edges ?? body);
303
303
  if (!input.success) {
304
304
  return Response.json({ error: input.error.message }, { status: 400 });
305
305
  }
@@ -311,7 +311,7 @@ var createEdgesRoutes = (config) => {
311
311
  const id = url.pathname.split("/").pop();
312
312
  if (!id) return new Response("Missing id", { status: 400 });
313
313
  const body = await request.json();
314
- const input = chunkRTSFO7BW_cjs.edgeUpdateSchema.parse(body);
314
+ const input = chunkOBZGUYGW_cjs.edgeUpdateSchema.parse(body);
315
315
  const updated = await repo.update(id, input);
316
316
  return Response.json(updated);
317
317
  },
@@ -488,12 +488,12 @@ var GraphQueryBuilder = class {
488
488
 
489
489
  // src/api/routes/graph.ts
490
490
  var createGraphRoutes = (config) => {
491
- const db = chunkRTSFO7BW_cjs.createDatabase(config);
491
+ const db = chunkOBZGUYGW_cjs.createDatabase(config);
492
492
  const builder = new GraphQueryBuilder(db);
493
493
  return {
494
494
  async GET(request) {
495
495
  const url = new URL(request.url);
496
- const params = chunkRTSFO7BW_cjs.getGraphParamsSchema.parse(Object.fromEntries(url.searchParams));
496
+ const params = chunkOBZGUYGW_cjs.getGraphParamsSchema.parse(Object.fromEntries(url.searchParams));
497
497
  const result = await builder.getGraph({
498
498
  ...params,
499
499
  nodeTypes: params.nodeTypes ? Array.isArray(params.nodeTypes) ? params.nodeTypes : [params.nodeTypes] : void 0,
@@ -508,13 +508,13 @@ var createGraphRoutes = (config) => {
508
508
  const url = new URL(request.url);
509
509
  if (url.pathname.endsWith("/expand")) {
510
510
  const body = await request.json();
511
- const input = chunkRTSFO7BW_cjs.expandGraphRequestSchema.parse(body);
511
+ const input = chunkOBZGUYGW_cjs.expandGraphRequestSchema.parse(body);
512
512
  const result = await builder.expandGraph(input);
513
513
  return Response.json(result);
514
514
  }
515
515
  if (url.pathname.endsWith("/path")) {
516
516
  const body = await request.json();
517
- const input = chunkRTSFO7BW_cjs.findPathRequestSchema.parse(body);
517
+ const input = chunkOBZGUYGW_cjs.findPathRequestSchema.parse(body);
518
518
  const result = await builder.findPaths(input);
519
519
  return Response.json(result);
520
520
  }
@@ -525,7 +525,7 @@ var createGraphRoutes = (config) => {
525
525
 
526
526
  // src/api/routes/analyze.ts
527
527
  var buildPipeline = (config) => {
528
- const db = chunkRTSFO7BW_cjs.createDatabase(config);
528
+ const db = chunkOBZGUYGW_cjs.createDatabase(config);
529
529
  const events = new chunkCOO66N7H_cjs.EventBus();
530
530
  const embeddings = new chunkCOO66N7H_cjs.EmbeddingsService(
531
531
  {
@@ -561,7 +561,7 @@ var createAnalyzeRoutes = (config) => {
561
561
  return Response.json({ cancelled });
562
562
  }
563
563
  const body = await request.json();
564
- const input = chunkRTSFO7BW_cjs.analysisRequestSchema.parse(body);
564
+ const input = chunkOBZGUYGW_cjs.analysisRequestSchema.parse(body);
565
565
  const pipeline = buildPipeline(config);
566
566
  let job;
567
567
  if (input.action === "embeddings") {
@@ -609,8 +609,8 @@ var defaultSettings = () => ({
609
609
  version: "0.1.0",
610
610
  repoName: "omi-neuron-web"
611
611
  },
612
- visualization: chunkRTSFO7BW_cjs.DEFAULT_VISUALIZATION_SETTINGS,
613
- analysis: chunkRTSFO7BW_cjs.DEFAULT_ANALYSIS_SETTINGS,
612
+ visualization: chunkOBZGUYGW_cjs.DEFAULT_VISUALIZATION_SETTINGS,
613
+ analysis: chunkOBZGUYGW_cjs.DEFAULT_ANALYSIS_SETTINGS,
614
614
  nodeTypes: [],
615
615
  domains: [],
616
616
  relationshipTypes: []
@@ -628,8 +628,8 @@ var SettingsRepository = class {
628
628
  }
629
629
  return {
630
630
  ...defaultSettings(),
631
- visualization: { ...chunkRTSFO7BW_cjs.DEFAULT_VISUALIZATION_SETTINGS, ...row.visualization ?? {} },
632
- analysis: { ...chunkRTSFO7BW_cjs.DEFAULT_ANALYSIS_SETTINGS, ...row.analysis ?? {} },
631
+ visualization: { ...chunkOBZGUYGW_cjs.DEFAULT_VISUALIZATION_SETTINGS, ...row.visualization ?? {} },
632
+ analysis: { ...chunkOBZGUYGW_cjs.DEFAULT_ANALYSIS_SETTINGS, ...row.analysis ?? {} },
633
633
  nodeTypes: row.node_types ?? [],
634
634
  domains: row.domains ?? [],
635
635
  relationshipTypes: row.relationship_types ?? []
@@ -680,7 +680,7 @@ var SettingsRepository = class {
680
680
 
681
681
  // src/api/routes/settings.ts
682
682
  var createSettingsRoutes = (config) => {
683
- const db = chunkRTSFO7BW_cjs.createDatabase(config);
683
+ const db = chunkOBZGUYGW_cjs.createDatabase(config);
684
684
  const repo = new SettingsRepository(db);
685
685
  return {
686
686
  async GET() {
@@ -689,7 +689,7 @@ var createSettingsRoutes = (config) => {
689
689
  },
690
690
  async PATCH(request) {
691
691
  const body = await request.json();
692
- const input = chunkRTSFO7BW_cjs.neuronSettingsUpdateSchema.parse(body);
692
+ const input = chunkOBZGUYGW_cjs.neuronSettingsUpdateSchema.parse(body);
693
693
  const settings = await repo.update(input);
694
694
  return Response.json({ settings });
695
695
  },
@@ -707,7 +707,7 @@ var createSettingsRoutes = (config) => {
707
707
 
708
708
  // src/api/routes/search.ts
709
709
  var createSearchRoutes = (config) => {
710
- const db = chunkRTSFO7BW_cjs.createDatabase(config);
710
+ const db = chunkOBZGUYGW_cjs.createDatabase(config);
711
711
  const embeddings = new chunkCOO66N7H_cjs.EmbeddingsService(
712
712
  {
713
713
  openaiApiKey: config.openai.apiKey,
@@ -719,18 +719,18 @@ var createSearchRoutes = (config) => {
719
719
  },
720
720
  db
721
721
  );
722
- const scoring = new chunkRTSFO7BW_cjs.ScoringEngine(db);
722
+ const scoring = new chunkOBZGUYGW_cjs.ScoringEngine(db);
723
723
  return {
724
724
  async POST(request) {
725
725
  const url = new URL(request.url);
726
726
  if (url.pathname.endsWith("/similar")) {
727
727
  const body2 = await request.json();
728
- const input2 = chunkRTSFO7BW_cjs.findSimilarRequestSchema.parse(body2);
728
+ const input2 = chunkOBZGUYGW_cjs.findSimilarRequestSchema.parse(body2);
729
729
  const results2 = await scoring.findSimilar(input2.nodeId, input2.limit ?? 10, input2.excludeConnected ?? false);
730
730
  return Response.json({ results: results2 });
731
731
  }
732
732
  const body = await request.json();
733
- const input = chunkRTSFO7BW_cjs.semanticSearchRequestSchema.parse(body);
733
+ const input = chunkOBZGUYGW_cjs.semanticSearchRequestSchema.parse(body);
734
734
  const embedding = await embeddings.generateEmbedding(input.query);
735
735
  const results = await scoring.scoreForQuery(embedding);
736
736
  return Response.json({ results: results.slice(0, input.limit ?? 10) });
@@ -740,7 +740,7 @@ var createSearchRoutes = (config) => {
740
740
 
741
741
  // src/api/routes/health.ts
742
742
  var createHealthRoutes = (config) => {
743
- const db = chunkRTSFO7BW_cjs.createDatabase(config);
743
+ const db = chunkOBZGUYGW_cjs.createDatabase(config);
744
744
  return {
745
745
  async GET() {
746
746
  const ok = await db.isConnected();
package/dist/api/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { DEFAULT_ANALYSIS_SETTINGS, DEFAULT_VISUALIZATION_SETTINGS, buildSelect, buildInsert, buildUpdate, buildDelete, buildWhereClause, createDatabase, ScoringEngine, findSimilarRequestSchema, semanticSearchRequestSchema, neuronSettingsUpdateSchema, analysisRequestSchema, expandGraphRequestSchema, findPathRequestSchema, getGraphParamsSchema, edgeUpdateSchema, edgeCreateSchema, listEdgesParamsSchema, nodeUpdateSchema, nodeBatchCreateSchema, listNodesParamsSchema } from '../chunk-XNR42GCJ.js';
1
+ import { DEFAULT_ANALYSIS_SETTINGS, DEFAULT_VISUALIZATION_SETTINGS, buildSelect, buildInsert, buildUpdate, buildDelete, buildWhereClause, createDatabase, ScoringEngine, findSimilarRequestSchema, semanticSearchRequestSchema, neuronSettingsUpdateSchema, analysisRequestSchema, expandGraphRequestSchema, findPathRequestSchema, getGraphParamsSchema, edgeUpdateSchema, edgeCreateSchema, listEdgesParamsSchema, nodeUpdateSchema, nodeBatchCreateSchema, listNodesParamsSchema } from '../chunk-6LW4KNAU.js';
2
2
  import { EmbeddingsService, EventBus, ClusteringEngine, RelationshipEngine, AnalysisPipeline } from '../chunk-RQCGONPN.js';
3
3
 
4
4
  // src/api/repositories/base.ts