mindgraph 0.2.1 → 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 +78 -7
- package/dist/index.d.ts +78 -7
- package/dist/index.js +43 -0
- package/dist/index.mjs +43 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -30,6 +30,18 @@ interface SearchResult {
|
|
|
30
30
|
node_type: string;
|
|
31
31
|
score: number;
|
|
32
32
|
}
|
|
33
|
+
interface SearchChunk {
|
|
34
|
+
chunk_uid: string;
|
|
35
|
+
content: string;
|
|
36
|
+
document_uid: string | null;
|
|
37
|
+
document_title: string | null;
|
|
38
|
+
chunk_index: number | null;
|
|
39
|
+
}
|
|
40
|
+
interface EnrichedSearchResponse {
|
|
41
|
+
results: SearchResult[];
|
|
42
|
+
edges: GraphEdge[];
|
|
43
|
+
chunks: SearchChunk[];
|
|
44
|
+
}
|
|
33
45
|
interface PathStep {
|
|
34
46
|
uid: string;
|
|
35
47
|
label: string;
|
|
@@ -397,24 +409,48 @@ interface IngestSessionRequest {
|
|
|
397
409
|
}
|
|
398
410
|
interface RetrieveContextRequest {
|
|
399
411
|
query: string;
|
|
400
|
-
|
|
401
|
-
|
|
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;
|
|
402
418
|
node_types?: string[];
|
|
403
419
|
layer?: string;
|
|
404
|
-
include_chunks?: boolean;
|
|
405
420
|
include_graph?: boolean;
|
|
406
421
|
min_similarity?: number;
|
|
407
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
|
+
}
|
|
408
437
|
interface RetrieveContextResponse {
|
|
409
|
-
|
|
438
|
+
articles?: ArticleResult[];
|
|
439
|
+
chunks?: {
|
|
410
440
|
chunk_uid: string;
|
|
411
441
|
content: string;
|
|
412
442
|
score: number;
|
|
413
443
|
document_uid: string | null;
|
|
444
|
+
document_title: string | null;
|
|
414
445
|
chunk_index: number | null;
|
|
415
446
|
}[];
|
|
416
447
|
graph: {
|
|
417
|
-
nodes: Record<string, unknown>
|
|
448
|
+
nodes: (Record<string, unknown> & {
|
|
449
|
+
source_documents?: {
|
|
450
|
+
uid: string;
|
|
451
|
+
title: string;
|
|
452
|
+
}[];
|
|
453
|
+
})[];
|
|
418
454
|
edges: Record<string, unknown>[];
|
|
419
455
|
};
|
|
420
456
|
}
|
|
@@ -686,7 +722,10 @@ declare class MindGraph {
|
|
|
686
722
|
node_type?: string;
|
|
687
723
|
layer?: string;
|
|
688
724
|
limit?: number;
|
|
689
|
-
|
|
725
|
+
min_score?: number;
|
|
726
|
+
include_edges?: boolean;
|
|
727
|
+
include_chunks?: boolean;
|
|
728
|
+
}): Promise<SearchResult[] | EnrichedSearchResponse>;
|
|
690
729
|
/** Hybrid BM25 + vector search with reciprocal rank fusion. */
|
|
691
730
|
hybridSearch(query: string, opts?: {
|
|
692
731
|
k?: number;
|
|
@@ -764,6 +803,11 @@ declare class MindGraph {
|
|
|
764
803
|
ingestDocument(req: IngestDocumentRequest): Promise<IngestDocumentResponse>;
|
|
765
804
|
ingestSession(req: IngestSessionRequest): Promise<IngestDocumentResponse>;
|
|
766
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
|
+
}>;
|
|
767
811
|
listJobs(): Promise<Job[]>;
|
|
768
812
|
getJob(id: string): Promise<Job>;
|
|
769
813
|
cancelJob(id: string): Promise<unknown>;
|
|
@@ -781,6 +825,33 @@ declare class MindGraph {
|
|
|
781
825
|
cleanupOrphans(): Promise<unknown>;
|
|
782
826
|
embedAll(): Promise<unknown>;
|
|
783
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
|
+
}>;
|
|
784
855
|
}
|
|
785
856
|
|
|
786
|
-
export { type ArgumentRequest, type BatchRequest, type CaptureRequest, type ClearResponse, type CommitmentRequest, type DecayRequest, type DeliberationRequest, type DistillRequest, 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 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
|
@@ -30,6 +30,18 @@ interface SearchResult {
|
|
|
30
30
|
node_type: string;
|
|
31
31
|
score: number;
|
|
32
32
|
}
|
|
33
|
+
interface SearchChunk {
|
|
34
|
+
chunk_uid: string;
|
|
35
|
+
content: string;
|
|
36
|
+
document_uid: string | null;
|
|
37
|
+
document_title: string | null;
|
|
38
|
+
chunk_index: number | null;
|
|
39
|
+
}
|
|
40
|
+
interface EnrichedSearchResponse {
|
|
41
|
+
results: SearchResult[];
|
|
42
|
+
edges: GraphEdge[];
|
|
43
|
+
chunks: SearchChunk[];
|
|
44
|
+
}
|
|
33
45
|
interface PathStep {
|
|
34
46
|
uid: string;
|
|
35
47
|
label: string;
|
|
@@ -397,24 +409,48 @@ interface IngestSessionRequest {
|
|
|
397
409
|
}
|
|
398
410
|
interface RetrieveContextRequest {
|
|
399
411
|
query: string;
|
|
400
|
-
|
|
401
|
-
|
|
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;
|
|
402
418
|
node_types?: string[];
|
|
403
419
|
layer?: string;
|
|
404
|
-
include_chunks?: boolean;
|
|
405
420
|
include_graph?: boolean;
|
|
406
421
|
min_similarity?: number;
|
|
407
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
|
+
}
|
|
408
437
|
interface RetrieveContextResponse {
|
|
409
|
-
|
|
438
|
+
articles?: ArticleResult[];
|
|
439
|
+
chunks?: {
|
|
410
440
|
chunk_uid: string;
|
|
411
441
|
content: string;
|
|
412
442
|
score: number;
|
|
413
443
|
document_uid: string | null;
|
|
444
|
+
document_title: string | null;
|
|
414
445
|
chunk_index: number | null;
|
|
415
446
|
}[];
|
|
416
447
|
graph: {
|
|
417
|
-
nodes: Record<string, unknown>
|
|
448
|
+
nodes: (Record<string, unknown> & {
|
|
449
|
+
source_documents?: {
|
|
450
|
+
uid: string;
|
|
451
|
+
title: string;
|
|
452
|
+
}[];
|
|
453
|
+
})[];
|
|
418
454
|
edges: Record<string, unknown>[];
|
|
419
455
|
};
|
|
420
456
|
}
|
|
@@ -686,7 +722,10 @@ declare class MindGraph {
|
|
|
686
722
|
node_type?: string;
|
|
687
723
|
layer?: string;
|
|
688
724
|
limit?: number;
|
|
689
|
-
|
|
725
|
+
min_score?: number;
|
|
726
|
+
include_edges?: boolean;
|
|
727
|
+
include_chunks?: boolean;
|
|
728
|
+
}): Promise<SearchResult[] | EnrichedSearchResponse>;
|
|
690
729
|
/** Hybrid BM25 + vector search with reciprocal rank fusion. */
|
|
691
730
|
hybridSearch(query: string, opts?: {
|
|
692
731
|
k?: number;
|
|
@@ -764,6 +803,11 @@ declare class MindGraph {
|
|
|
764
803
|
ingestDocument(req: IngestDocumentRequest): Promise<IngestDocumentResponse>;
|
|
765
804
|
ingestSession(req: IngestSessionRequest): Promise<IngestDocumentResponse>;
|
|
766
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
|
+
}>;
|
|
767
811
|
listJobs(): Promise<Job[]>;
|
|
768
812
|
getJob(id: string): Promise<Job>;
|
|
769
813
|
cancelJob(id: string): Promise<unknown>;
|
|
@@ -781,6 +825,33 @@ declare class MindGraph {
|
|
|
781
825
|
cleanupOrphans(): Promise<unknown>;
|
|
782
826
|
embedAll(): Promise<unknown>;
|
|
783
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
|
+
}>;
|
|
784
855
|
}
|
|
785
856
|
|
|
786
|
-
export { type ArgumentRequest, type BatchRequest, type CaptureRequest, type ClearResponse, type CommitmentRequest, type DecayRequest, type DeliberationRequest, type DistillRequest, 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 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,
|