mindgraph 0.1.2 → 0.1.8

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/dist/index.d.ts CHANGED
@@ -38,7 +38,7 @@ interface PathStep {
38
38
  depth: number;
39
39
  parent_uid: string | null;
40
40
  }
41
- interface IngestRequest {
41
+ interface CaptureRequest {
42
42
  action: "source" | "snippet" | "observation";
43
43
  label: string;
44
44
  summary?: string;
@@ -250,6 +250,10 @@ interface ExecutionRequest {
250
250
  agent_id?: string;
251
251
  }
252
252
  interface RetrieveRequest {
253
+ /**
254
+ * Retrieval action. Note: `"semantic"` requires a configured embedding
255
+ * provider on the server; for semantic search use `retrieveContext()` instead.
256
+ */
253
257
  action: "text" | "semantic" | "hybrid" | "active_goals" | "open_questions" | "weak_claims" | "pending_approvals" | "unresolved_contradictions" | "layer" | "recent";
254
258
  query?: string;
255
259
  k?: number;
@@ -286,26 +290,124 @@ interface EvolveRequest {
286
290
  version?: number;
287
291
  agent_id?: string;
288
292
  }
289
- interface SignupRequest {
290
- email: string;
291
- password: string;
293
+ interface IngestChunkRequest {
294
+ content: string;
295
+ chunk_type?: string;
296
+ document_uid?: string;
297
+ chunk_index?: number;
298
+ label?: string;
299
+ layers?: string[];
300
+ agent_id?: string;
301
+ }
302
+ interface IngestChunkResponse {
303
+ chunk_uid: string;
304
+ nodes_created: number;
305
+ nodes_deduplicated: number;
306
+ edges_created: number;
307
+ extracted_node_uids: string[];
308
+ errors: string[];
309
+ }
310
+ interface IngestDocumentRequest {
311
+ content: string;
312
+ title?: string;
313
+ document_type?: string;
314
+ /** Semantic content type: "article" (default), "meeting_notes", "journal". Drives default extraction layers. */
315
+ content_type?: string;
316
+ source_uri?: string;
317
+ chunk_size?: number;
318
+ chunk_overlap?: number;
319
+ layers?: string[];
320
+ agent_id?: string;
321
+ /** Paper metadata */
322
+ authors?: string[];
323
+ abstract_text?: string;
324
+ doi?: string;
325
+ publication_date?: string;
326
+ journal?: string;
327
+ keywords?: string[];
328
+ citation_count?: number;
329
+ arxiv_id?: string;
330
+ language?: string;
292
331
  }
293
- interface LoginRequest {
294
- email: string;
295
- password: string;
332
+ interface IngestDocumentResponse {
333
+ job_id: string;
334
+ document_uid: string;
296
335
  }
297
- interface CreateOrgRequest {
298
- name: string;
299
- slug?: string;
336
+ interface IngestSessionRequest {
337
+ content: string;
338
+ title?: string;
339
+ session_uid?: string;
340
+ chunk_size?: number;
341
+ chunk_overlap?: number;
342
+ layers?: string[];
343
+ agent_id?: string;
344
+ }
345
+ interface RetrieveContextRequest {
346
+ query: string;
347
+ k?: number;
348
+ depth?: number;
349
+ node_types?: string[];
350
+ layer?: string;
351
+ include_chunks?: boolean;
352
+ include_graph?: boolean;
353
+ min_similarity?: number;
300
354
  }
301
- interface CreateApiKeyRequest {
302
- name?: string;
355
+ interface RetrieveContextResponse {
356
+ chunks: {
357
+ chunk_uid: string;
358
+ content: string;
359
+ score: number;
360
+ document_uid: string | null;
361
+ chunk_index: number | null;
362
+ }[];
363
+ graph: {
364
+ nodes: Record<string, unknown>[];
365
+ edges: Record<string, unknown>[];
366
+ };
303
367
  }
304
- interface ApiKeyResponse {
368
+ interface Job {
305
369
  id: string;
306
- key: string;
307
- name: string;
308
- prefix: string;
370
+ title: string;
371
+ status: "pending" | "processing" | "completed" | "failed" | "cancelled";
372
+ progress: {
373
+ total_chunks: number;
374
+ processed_chunks: number;
375
+ nodes_created: number;
376
+ edges_created: number;
377
+ };
378
+ result: Record<string, unknown> | null;
379
+ error: string | null;
380
+ created_at: number;
381
+ queue_position?: number;
382
+ }
383
+ interface ClearResponse {
384
+ cleared: boolean;
385
+ nodes_removed: number;
386
+ edges_removed: number;
387
+ versions_removed: number;
388
+ aliases_removed: number;
389
+ embeddings_removed: number;
390
+ }
391
+ interface BatchRequest {
392
+ nodes?: {
393
+ label: string;
394
+ node_type?: string;
395
+ props?: Record<string, unknown>;
396
+ }[];
397
+ edges?: {
398
+ from_uid: string;
399
+ to_uid: string;
400
+ edge_type: string;
401
+ }[];
402
+ agent_id?: string;
403
+ }
404
+ interface DecayRequest {
405
+ half_life_secs: number;
406
+ min_salience?: number;
407
+ min_age_secs?: number;
408
+ }
409
+ interface PurgeRequest {
410
+ before?: number;
309
411
  }
310
412
  interface MindGraphConfig {
311
413
  baseUrl: string;
@@ -331,17 +433,55 @@ declare class MindGraph {
331
433
  status: string;
332
434
  }>;
333
435
  stats(): Promise<Record<string, unknown>>;
334
- ingest(req: IngestRequest): Promise<unknown>;
436
+ capture(req: CaptureRequest): Promise<unknown>;
335
437
  entity(req: EntityRequest): Promise<unknown>;
336
438
  /** Convenience: create or find an entity by label. */
337
439
  findOrCreateEntity(label: string, props?: Record<string, unknown>, agentId?: string): Promise<GraphNode & {
338
440
  created: boolean;
339
441
  }>;
442
+ /**
443
+ * Resolve text to an existing entity via alias matching.
444
+ * Returns `{ uid: string | null }`.
445
+ */
446
+ resolveEntity(text: string, agentId?: string): Promise<{
447
+ uid: string | null;
448
+ }>;
449
+ /**
450
+ * Fuzzy-match text against existing entities.
451
+ * Returns `{ matches: [{ uid, label, score }] }`.
452
+ */
453
+ fuzzyResolveEntity(text: string, limit?: number, agentId?: string): Promise<{
454
+ matches: {
455
+ uid: string;
456
+ label: string;
457
+ score: number;
458
+ }[];
459
+ }>;
340
460
  argue(req: ArgumentRequest): Promise<unknown>;
341
461
  inquire(req: InquiryRequest): Promise<unknown>;
342
462
  structure(req: StructureRequest): Promise<unknown>;
343
463
  commit(req: CommitmentRequest): Promise<unknown>;
344
464
  deliberate(req: DeliberationRequest): Promise<unknown>;
465
+ /** Open a new decision for deliberation. Returns the Decision node. */
466
+ openDecision(label: string, opts?: {
467
+ summary?: string;
468
+ props?: Record<string, unknown>;
469
+ agent_id?: string;
470
+ }): Promise<unknown>;
471
+ /** Add an option to an open decision. Returns the Option node. */
472
+ addOption(decisionUid: string, label: string, opts?: {
473
+ summary?: string;
474
+ props?: Record<string, unknown>;
475
+ agent_id?: string;
476
+ }): Promise<unknown>;
477
+ /**
478
+ * Resolve a decision by choosing an option.
479
+ * `chosenOptionUid` must be the uid of an option added via `addOption()`.
480
+ */
481
+ resolveDecision(decisionUid: string, chosenOptionUid: string, opts?: {
482
+ summary?: string;
483
+ agent_id?: string;
484
+ }): Promise<unknown>;
345
485
  procedure(req: ProcedureRequest): Promise<unknown>;
346
486
  risk(req: RiskRequest): Promise<unknown>;
347
487
  session(req: SessionRequest): Promise<unknown>;
@@ -358,10 +498,18 @@ declare class MindGraph {
358
498
  plan(req: PlanRequest): Promise<unknown>;
359
499
  governance(req: GovernanceRequest): Promise<unknown>;
360
500
  execution(req: ExecutionRequest): Promise<unknown>;
361
- retrieve(req: RetrieveRequest): Promise<unknown>;
501
+ /** Returns an array of results. Shape varies by action. */
502
+ retrieve(req: RetrieveRequest): Promise<unknown[]>;
362
503
  traverse(req: TraverseRequest): Promise<unknown>;
363
504
  evolve(req: EvolveRequest): Promise<unknown>;
364
505
  getNode(uid: string): Promise<GraphNode>;
506
+ /**
507
+ * Create a node via the low-level CRUD endpoint.
508
+ *
509
+ * The server requires `props._type` to determine the node variant.
510
+ * If `node_type` is provided and `_type` is not already in `props`,
511
+ * it is injected automatically.
512
+ */
365
513
  addNode(body: {
366
514
  label: string;
367
515
  node_type?: string;
@@ -376,16 +524,50 @@ declare class MindGraph {
376
524
  agent_id?: string;
377
525
  }): Promise<GraphNode>;
378
526
  deleteNode(uid: string): Promise<void>;
527
+ getNodeHistory(uid: string): Promise<unknown[]>;
528
+ getNodeAtVersion(uid: string, version: number): Promise<GraphNode>;
379
529
  addLink(body: {
380
530
  from_uid: string;
381
531
  to_uid: string;
382
532
  edge_type: string;
383
533
  agent_id?: string;
384
534
  }): Promise<unknown>;
535
+ /**
536
+ * Create an edge via the low-level CRUD endpoint.
537
+ *
538
+ * The server requires `props._type` to determine the edge variant.
539
+ * If `edge_type` is provided and `_type` is not already in `props`,
540
+ * it is injected automatically.
541
+ */
542
+ addEdge(body: {
543
+ from_uid: string;
544
+ to_uid: string;
545
+ edge_type: string;
546
+ weight?: number;
547
+ props?: Record<string, unknown>;
548
+ agent_id?: string;
549
+ }): Promise<unknown>;
550
+ updateEdge(uid: string, body: {
551
+ weight?: number;
552
+ props?: Record<string, unknown>;
553
+ agent_id?: string;
554
+ }): Promise<unknown>;
555
+ deleteEdge(uid: string): Promise<void>;
556
+ getEdgeHistory(uid: string): Promise<unknown[]>;
557
+ /**
558
+ * List edges filtered by source and/or target node.
559
+ * At least one of `from_uid` or `to_uid` is **required** —
560
+ * the server returns 400 if neither is provided.
561
+ */
385
562
  getEdges(params: {
386
563
  from_uid?: string;
387
564
  to_uid?: string;
388
565
  }): Promise<GraphEdge[]>;
566
+ getEdgeBetween(params: {
567
+ from_uid: string;
568
+ to_uid: string;
569
+ edge_type?: string;
570
+ }): Promise<GraphEdge[]>;
389
571
  search(query: string, opts?: {
390
572
  node_type?: string;
391
573
  layer?: string;
@@ -397,18 +579,94 @@ declare class MindGraph {
397
579
  node_types?: string[];
398
580
  layer?: string;
399
581
  }): Promise<SearchResult[]>;
582
+ getNodes(params?: {
583
+ node_type?: string;
584
+ layer?: string;
585
+ limit?: number;
586
+ offset?: number;
587
+ }): Promise<unknown>;
588
+ getAgentNodes(agentId: string): Promise<GraphNode[]>;
589
+ batch(req: BatchRequest): Promise<unknown>;
590
+ /** Fetch multiple nodes by UID in a single request. */
591
+ getNodesBatch(uids: string[]): Promise<GraphNode[]>;
592
+ /** Fetch all edges between a set of node UIDs. */
593
+ getEdgesBatch(uids: string[]): Promise<GraphEdge[]>;
594
+ configureEmbeddings(body: {
595
+ model: string;
596
+ dimensions: number;
597
+ distance_metric?: string;
598
+ }): Promise<unknown>;
599
+ embeddingSearch(body: {
600
+ vector: number[];
601
+ k?: number;
602
+ node_types?: string[];
603
+ threshold?: number;
604
+ }): Promise<unknown>;
605
+ embeddingSearchText(body: {
606
+ text: string;
607
+ k?: number;
608
+ node_types?: string[];
609
+ threshold?: number;
610
+ }): Promise<unknown>;
611
+ getEmbedding(uid: string): Promise<unknown>;
612
+ setEmbedding(uid: string, vector: number[]): Promise<void>;
613
+ deleteEmbedding(uid: string): Promise<void>;
614
+ mergeEntities(body: {
615
+ keep_uid: string;
616
+ merge_uid: string;
617
+ agent_id?: string;
618
+ }): Promise<unknown>;
619
+ addAlias(body: {
620
+ text: string;
621
+ canonical_uid: string;
622
+ score?: number;
623
+ }): Promise<unknown>;
624
+ getAliases(uid: string): Promise<unknown>;
625
+ resolveAlias(text: string): Promise<unknown>;
626
+ exportGraph(): Promise<unknown>;
627
+ importGraph(data: unknown): Promise<unknown>;
628
+ decay(req: DecayRequest): Promise<unknown>;
629
+ purge(req?: PurgeRequest): Promise<unknown>;
400
630
  reasoningChain(uid: string, maxDepth?: number): Promise<PathStep[]>;
401
631
  neighborhood(uid: string, maxDepth?: number): Promise<PathStep[]>;
632
+ subgraph(uid: string, opts?: {
633
+ max_depth?: number;
634
+ direction?: "outgoing" | "incoming" | "both";
635
+ edge_types?: string[];
636
+ weight_threshold?: number;
637
+ }): Promise<{
638
+ nodes: GraphNode[];
639
+ edges: GraphEdge[];
640
+ }>;
402
641
  tombstone(uid: string, reason?: string, agentId?: string): Promise<unknown>;
403
642
  restore(uid: string, agentId?: string): Promise<unknown>;
404
- signup(email: string, password: string): Promise<unknown>;
405
- login(email: string, password: string): Promise<unknown>;
406
- createApiKey(name?: string): Promise<ApiKeyResponse>;
407
- listApiKeys(): Promise<{
408
- api_keys: unknown[];
643
+ getGoals(): Promise<GraphNode[]>;
644
+ getOpenDecisions(): Promise<GraphNode[]>;
645
+ getOpenQuestions(): Promise<GraphNode[]>;
646
+ getWeakClaims(): Promise<GraphNode[]>;
647
+ getContradictions(): Promise<unknown[]>;
648
+ getPendingApprovals(): Promise<GraphNode[]>;
649
+ ingestChunk(req: IngestChunkRequest): Promise<IngestChunkResponse>;
650
+ ingestDocument(req: IngestDocumentRequest): Promise<IngestDocumentResponse>;
651
+ ingestSession(req: IngestSessionRequest): Promise<IngestDocumentResponse>;
652
+ retrieveContext(req: RetrieveContextRequest): Promise<RetrieveContextResponse>;
653
+ listJobs(): Promise<Job[]>;
654
+ getJob(id: string): Promise<Job>;
655
+ cancelJob(id: string): Promise<unknown>;
656
+ /** Resume ingestion of a document that has failed chunks. */
657
+ resumeDocument(docUid: string, opts?: {
658
+ layers?: string[];
659
+ agent_id?: string;
660
+ }): Promise<{
661
+ job_id: string;
662
+ document_uid: string;
663
+ chunks_to_resume: number;
409
664
  }>;
410
- revokeApiKey(id: string): Promise<void>;
411
- getUsage(): Promise<unknown>;
665
+ /** Delete a document and all its chunks and extracted nodes. */
666
+ deleteDocument(uid: string): Promise<unknown>;
667
+ cleanupOrphans(): Promise<unknown>;
668
+ embedAll(): Promise<unknown>;
669
+ clearGraph(): Promise<ClearResponse>;
412
670
  }
413
671
 
414
- export { type ApiKeyResponse, type ArgumentRequest, type CommitmentRequest, type CreateApiKeyRequest, type CreateOrgRequest, type DeliberationRequest, type DistillRequest, type EntityRequest, type EvolveRequest, type ExecutionRequest, type GovernanceRequest, type GraphEdge, type GraphNode, type IngestRequest, type InquiryRequest, type LoginRequest, type MemoryConfigRequest, MindGraph, type MindGraphConfig, MindGraphError, type PathStep, type PlanRequest, type ProcedureRequest, type RetrieveRequest, type RiskRequest, type SearchResult, type SessionRequest, type SignupRequest, type StructureRequest, type TraverseRequest };
672
+ export { type ArgumentRequest, type BatchRequest, type CaptureRequest, type ClearResponse, type CommitmentRequest, type DecayRequest, type DeliberationRequest, type DistillRequest, type EntityRequest, type EvolveRequest, type ExecutionRequest, type GovernanceRequest, type GraphEdge, type GraphNode, type IngestChunkRequest, type IngestChunkResponse, type IngestDocumentRequest, type IngestDocumentResponse, type IngestSessionRequest, type InquiryRequest, type Job, type MemoryConfigRequest, MindGraph, type MindGraphConfig, MindGraphError, type PathStep, type PlanRequest, type ProcedureRequest, type PurgeRequest, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchResult, type SessionRequest, type StructureRequest, type TraverseRequest };