mindgraph 0.2.2 → 0.3.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/dist/index.d.mts CHANGED
@@ -409,24 +409,48 @@ interface IngestSessionRequest {
409
409
  }
410
410
  interface RetrieveContextRequest {
411
411
  query: string;
412
- k?: number;
413
- depth?: number;
412
+ /** Max graph nodes to return (default 10). */
413
+ node_limit?: number;
414
+ /** Max wiki articles to return (default 3). Set to 0 to skip. */
415
+ article_limit?: number;
416
+ /** Max raw chunks to return (default 0). Set > 0 to include source text. */
417
+ chunk_limit?: number;
414
418
  node_types?: string[];
415
419
  layer?: string;
416
- include_chunks?: boolean;
417
420
  include_graph?: boolean;
418
421
  min_similarity?: number;
419
422
  }
423
+ interface ArticleResult {
424
+ uid: string;
425
+ label: string;
426
+ content: string;
427
+ article_type: string;
428
+ covers_uid: string | null;
429
+ questions: string[] | null;
430
+ score: number;
431
+ }
432
+ interface ListArticlesResponse {
433
+ articles: GraphNode[];
434
+ total: number;
435
+ has_more: boolean;
436
+ }
420
437
  interface RetrieveContextResponse {
421
- chunks: {
438
+ articles?: ArticleResult[];
439
+ chunks?: {
422
440
  chunk_uid: string;
423
441
  content: string;
424
442
  score: number;
425
443
  document_uid: string | null;
444
+ document_title: string | null;
426
445
  chunk_index: number | null;
427
446
  }[];
428
447
  graph: {
429
- nodes: Record<string, unknown>[];
448
+ nodes: (Record<string, unknown> & {
449
+ source_documents?: {
450
+ uid: string;
451
+ title: string;
452
+ }[];
453
+ })[];
430
454
  edges: Record<string, unknown>[];
431
455
  };
432
456
  }
@@ -779,6 +803,11 @@ declare class MindGraph {
779
803
  ingestDocument(req: IngestDocumentRequest): Promise<IngestDocumentResponse>;
780
804
  ingestSession(req: IngestSessionRequest): Promise<IngestDocumentResponse>;
781
805
  retrieveContext(req: RetrieveContextRequest): Promise<RetrieveContextResponse>;
806
+ /** Backfill node_source provenance for existing graphs. */
807
+ backfillNodeSources(): Promise<{
808
+ documents_processed: number;
809
+ node_source_pairs_added: number;
810
+ }>;
782
811
  listJobs(): Promise<Job[]>;
783
812
  getJob(id: string): Promise<Job>;
784
813
  cancelJob(id: string): Promise<unknown>;
@@ -796,6 +825,33 @@ declare class MindGraph {
796
825
  cleanupOrphans(): Promise<unknown>;
797
826
  embedAll(): Promise<unknown>;
798
827
  clearGraph(): Promise<ClearResponse>;
828
+ /** List wiki articles with optional filters. */
829
+ listArticles(params?: {
830
+ article_type?: string;
831
+ covers_node_type?: string;
832
+ search?: string;
833
+ limit?: number;
834
+ offset?: number;
835
+ }): Promise<ListArticlesResponse>;
836
+ /** Get a single wiki article by UID. */
837
+ getArticle(uid: string): Promise<GraphNode>;
838
+ /** Find the article that covers or summarizes a given entity/document UID. */
839
+ getArticleBySubject(subjectUid: string): Promise<GraphNode | null>;
840
+ /** Update an article's markdown content (user editing). */
841
+ updateArticle(uid: string, content: string): Promise<GraphNode>;
842
+ /** Trigger wiki compilation for a specific document. */
843
+ compileDocument(docUid: string): Promise<{
844
+ job_id?: string;
845
+ status: string;
846
+ }>;
847
+ /** Trigger wiki compilation for a specific entity. */
848
+ compileEntity(entityUid: string): Promise<{
849
+ job_id: string;
850
+ }>;
851
+ /** Backfill: compile articles for all documents and eligible entities. */
852
+ compileAll(): Promise<{
853
+ job_id: string;
854
+ }>;
799
855
  }
800
856
 
801
- export { type ArgumentRequest, type BatchRequest, type CaptureRequest, type ClearResponse, type CommitmentRequest, type DecayRequest, type DeliberationRequest, type DistillRequest, type EnrichedSearchResponse, type EntityRequest, type EventProps, 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 NationProps, type OrganizationProps, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type PurgeRequest, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SessionRequest, type StructureRequest, type TraverseRequest };
857
+ export { type ArgumentRequest, type ArticleResult, type BatchRequest, type CaptureRequest, type ClearResponse, type CommitmentRequest, type DecayRequest, type DeliberationRequest, type DistillRequest, type EnrichedSearchResponse, type EntityRequest, type EventProps, 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 ListArticlesResponse, type MemoryConfigRequest, MindGraph, type MindGraphConfig, MindGraphError, type NationProps, type OrganizationProps, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type PurgeRequest, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SessionRequest, type StructureRequest, type TraverseRequest };
package/dist/index.d.ts CHANGED
@@ -409,24 +409,48 @@ interface IngestSessionRequest {
409
409
  }
410
410
  interface RetrieveContextRequest {
411
411
  query: string;
412
- k?: number;
413
- depth?: number;
412
+ /** Max graph nodes to return (default 10). */
413
+ node_limit?: number;
414
+ /** Max wiki articles to return (default 3). Set to 0 to skip. */
415
+ article_limit?: number;
416
+ /** Max raw chunks to return (default 0). Set > 0 to include source text. */
417
+ chunk_limit?: number;
414
418
  node_types?: string[];
415
419
  layer?: string;
416
- include_chunks?: boolean;
417
420
  include_graph?: boolean;
418
421
  min_similarity?: number;
419
422
  }
423
+ interface ArticleResult {
424
+ uid: string;
425
+ label: string;
426
+ content: string;
427
+ article_type: string;
428
+ covers_uid: string | null;
429
+ questions: string[] | null;
430
+ score: number;
431
+ }
432
+ interface ListArticlesResponse {
433
+ articles: GraphNode[];
434
+ total: number;
435
+ has_more: boolean;
436
+ }
420
437
  interface RetrieveContextResponse {
421
- chunks: {
438
+ articles?: ArticleResult[];
439
+ chunks?: {
422
440
  chunk_uid: string;
423
441
  content: string;
424
442
  score: number;
425
443
  document_uid: string | null;
444
+ document_title: string | null;
426
445
  chunk_index: number | null;
427
446
  }[];
428
447
  graph: {
429
- nodes: Record<string, unknown>[];
448
+ nodes: (Record<string, unknown> & {
449
+ source_documents?: {
450
+ uid: string;
451
+ title: string;
452
+ }[];
453
+ })[];
430
454
  edges: Record<string, unknown>[];
431
455
  };
432
456
  }
@@ -779,6 +803,11 @@ declare class MindGraph {
779
803
  ingestDocument(req: IngestDocumentRequest): Promise<IngestDocumentResponse>;
780
804
  ingestSession(req: IngestSessionRequest): Promise<IngestDocumentResponse>;
781
805
  retrieveContext(req: RetrieveContextRequest): Promise<RetrieveContextResponse>;
806
+ /** Backfill node_source provenance for existing graphs. */
807
+ backfillNodeSources(): Promise<{
808
+ documents_processed: number;
809
+ node_source_pairs_added: number;
810
+ }>;
782
811
  listJobs(): Promise<Job[]>;
783
812
  getJob(id: string): Promise<Job>;
784
813
  cancelJob(id: string): Promise<unknown>;
@@ -796,6 +825,33 @@ declare class MindGraph {
796
825
  cleanupOrphans(): Promise<unknown>;
797
826
  embedAll(): Promise<unknown>;
798
827
  clearGraph(): Promise<ClearResponse>;
828
+ /** List wiki articles with optional filters. */
829
+ listArticles(params?: {
830
+ article_type?: string;
831
+ covers_node_type?: string;
832
+ search?: string;
833
+ limit?: number;
834
+ offset?: number;
835
+ }): Promise<ListArticlesResponse>;
836
+ /** Get a single wiki article by UID. */
837
+ getArticle(uid: string): Promise<GraphNode>;
838
+ /** Find the article that covers or summarizes a given entity/document UID. */
839
+ getArticleBySubject(subjectUid: string): Promise<GraphNode | null>;
840
+ /** Update an article's markdown content (user editing). */
841
+ updateArticle(uid: string, content: string): Promise<GraphNode>;
842
+ /** Trigger wiki compilation for a specific document. */
843
+ compileDocument(docUid: string): Promise<{
844
+ job_id?: string;
845
+ status: string;
846
+ }>;
847
+ /** Trigger wiki compilation for a specific entity. */
848
+ compileEntity(entityUid: string): Promise<{
849
+ job_id: string;
850
+ }>;
851
+ /** Backfill: compile articles for all documents and eligible entities. */
852
+ compileAll(): Promise<{
853
+ job_id: string;
854
+ }>;
799
855
  }
800
856
 
801
- export { type ArgumentRequest, type BatchRequest, type CaptureRequest, type ClearResponse, type CommitmentRequest, type DecayRequest, type DeliberationRequest, type DistillRequest, type EnrichedSearchResponse, type EntityRequest, type EventProps, 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 NationProps, type OrganizationProps, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type PurgeRequest, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SessionRequest, type StructureRequest, type TraverseRequest };
857
+ export { type ArgumentRequest, type ArticleResult, type BatchRequest, type CaptureRequest, type ClearResponse, type CommitmentRequest, type DecayRequest, type DeliberationRequest, type DistillRequest, type EnrichedSearchResponse, type EntityRequest, type EventProps, 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 ListArticlesResponse, type MemoryConfigRequest, MindGraph, type MindGraphConfig, MindGraphError, type NationProps, type OrganizationProps, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type PurgeRequest, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SessionRequest, type StructureRequest, type TraverseRequest };
package/dist/index.js CHANGED
@@ -540,6 +540,10 @@ var MindGraph = class {
540
540
  async retrieveContext(req) {
541
541
  return this.post("/retrieve/context", req);
542
542
  }
543
+ /** Backfill node_source provenance for existing graphs. */
544
+ async backfillNodeSources() {
545
+ return this.post("/backfill/node-sources", {});
546
+ }
543
547
  async listJobs() {
544
548
  return this.get("/jobs");
545
549
  }
@@ -566,6 +570,45 @@ var MindGraph = class {
566
570
  async clearGraph() {
567
571
  return this.post("/clear", {});
568
572
  }
573
+ // ── Wiki ──────────────────────────────────────────────────────────────
574
+ /** List wiki articles with optional filters. */
575
+ async listArticles(params) {
576
+ const q = new URLSearchParams();
577
+ if (params?.article_type) q.set("article_type", params.article_type);
578
+ if (params?.covers_node_type) q.set("covers_node_type", params.covers_node_type);
579
+ if (params?.search) q.set("search", params.search);
580
+ if (params?.limit) q.set("limit", String(params.limit));
581
+ if (params?.offset) q.set("offset", String(params.offset));
582
+ return this.get(`/wiki/articles?${q}`);
583
+ }
584
+ /** Get a single wiki article by UID. */
585
+ async getArticle(uid) {
586
+ return this.get(`/wiki/article/${uid}`);
587
+ }
588
+ /** Find the article that covers or summarizes a given entity/document UID. */
589
+ async getArticleBySubject(subjectUid) {
590
+ try {
591
+ return await this.get(`/wiki/article/by-subject/${subjectUid}`);
592
+ } catch {
593
+ return null;
594
+ }
595
+ }
596
+ /** Update an article's markdown content (user editing). */
597
+ async updateArticle(uid, content) {
598
+ return this.patch(`/wiki/article/${uid}`, { content });
599
+ }
600
+ /** Trigger wiki compilation for a specific document. */
601
+ async compileDocument(docUid) {
602
+ return this.post(`/wiki/compile/${docUid}`, {});
603
+ }
604
+ /** Trigger wiki compilation for a specific entity. */
605
+ async compileEntity(entityUid) {
606
+ return this.post(`/wiki/compile/entity/${entityUid}`, {});
607
+ }
608
+ /** Backfill: compile articles for all documents and eligible entities. */
609
+ async compileAll() {
610
+ return this.post("/wiki/compile/all", {});
611
+ }
569
612
  };
570
613
  // Annotate the CommonJS export names for ESM import in node:
571
614
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -513,6 +513,10 @@ var MindGraph = class {
513
513
  async retrieveContext(req) {
514
514
  return this.post("/retrieve/context", req);
515
515
  }
516
+ /** Backfill node_source provenance for existing graphs. */
517
+ async backfillNodeSources() {
518
+ return this.post("/backfill/node-sources", {});
519
+ }
516
520
  async listJobs() {
517
521
  return this.get("/jobs");
518
522
  }
@@ -539,6 +543,45 @@ var MindGraph = class {
539
543
  async clearGraph() {
540
544
  return this.post("/clear", {});
541
545
  }
546
+ // ── Wiki ──────────────────────────────────────────────────────────────
547
+ /** List wiki articles with optional filters. */
548
+ async listArticles(params) {
549
+ const q = new URLSearchParams();
550
+ if (params?.article_type) q.set("article_type", params.article_type);
551
+ if (params?.covers_node_type) q.set("covers_node_type", params.covers_node_type);
552
+ if (params?.search) q.set("search", params.search);
553
+ if (params?.limit) q.set("limit", String(params.limit));
554
+ if (params?.offset) q.set("offset", String(params.offset));
555
+ return this.get(`/wiki/articles?${q}`);
556
+ }
557
+ /** Get a single wiki article by UID. */
558
+ async getArticle(uid) {
559
+ return this.get(`/wiki/article/${uid}`);
560
+ }
561
+ /** Find the article that covers or summarizes a given entity/document UID. */
562
+ async getArticleBySubject(subjectUid) {
563
+ try {
564
+ return await this.get(`/wiki/article/by-subject/${subjectUid}`);
565
+ } catch {
566
+ return null;
567
+ }
568
+ }
569
+ /** Update an article's markdown content (user editing). */
570
+ async updateArticle(uid, content) {
571
+ return this.patch(`/wiki/article/${uid}`, { content });
572
+ }
573
+ /** Trigger wiki compilation for a specific document. */
574
+ async compileDocument(docUid) {
575
+ return this.post(`/wiki/compile/${docUid}`, {});
576
+ }
577
+ /** Trigger wiki compilation for a specific entity. */
578
+ async compileEntity(entityUid) {
579
+ return this.post(`/wiki/compile/entity/${entityUid}`, {});
580
+ }
581
+ /** Backfill: compile articles for all documents and eligible entities. */
582
+ async compileAll() {
583
+ return this.post("/wiki/compile/all", {});
584
+ }
542
585
  };
543
586
  export {
544
587
  MindGraph,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "TypeScript client for the MindGraph Cloud API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",