mindgraph 0.5.0 → 0.6.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/dist/index.d.mts CHANGED
@@ -30,6 +30,44 @@ interface SearchResult {
30
30
  node_type: string;
31
31
  score: number;
32
32
  }
33
+ /**
34
+ * One retrieval leg's contribution to a fused hybrid result — the
35
+ * "why retrieved" detail. The fused score reconstructs exactly as
36
+ * `Σ 1/(60 + rank)` over a result's legs.
37
+ */
38
+ interface LegContribution {
39
+ /** Which leg surfaced the result: `"fts"` (keyword/BM25) or `"vec"` (vector). */
40
+ leg: string;
41
+ /** 1-based within-leg rank the fusion used. */
42
+ rank: number;
43
+ /**
44
+ * The leg's raw score (BM25 relevance for `fts`, cosine similarity for
45
+ * `vec`). Not comparable across legs — RRF fuses by rank, not score.
46
+ */
47
+ score: number;
48
+ }
49
+ /** A suspected duplicate pair awaiting human review (pending PossibleDuplicate edge). */
50
+ interface MergeCandidate {
51
+ edge_uid: string;
52
+ node_a_uid: string;
53
+ node_a_label: string;
54
+ node_a_summary: string;
55
+ node_b_uid: string;
56
+ node_b_label: string;
57
+ node_b_summary: string;
58
+ node_type: string;
59
+ /** Similarity score that triggered the candidate (e.g. cosine), if known. */
60
+ similarity: number | null;
61
+ /** How the candidate was found: "exact" | "fuzzy" | "semantic" | "llm". */
62
+ method: string | null;
63
+ }
64
+ /** A `/retrieve` hybrid result: the full node plus the fused RRF score. */
65
+ interface HybridSearchResult {
66
+ node: GraphNode;
67
+ score: number;
68
+ /** Per-leg contributions; present only when the request set `explain: true`. */
69
+ legs?: LegContribution[];
70
+ }
33
71
  interface SearchChunk {
34
72
  chunk_uid: string;
35
73
  content: string;
@@ -329,6 +367,12 @@ interface RetrieveRequest {
329
367
  salience_min?: number;
330
368
  limit?: number;
331
369
  offset?: number;
370
+ /**
371
+ * Hybrid action only: attach per-leg contributions (`legs`) to each
372
+ * result — the "why retrieved" detail. Requires server ≥ 1.2.0; older
373
+ * servers ignore the field.
374
+ */
375
+ explain?: boolean;
332
376
  }
333
377
  interface TraverseRequest {
334
378
  action: "chain" | "neighborhood" | "path" | "subgraph";
@@ -1038,12 +1082,17 @@ declare class MindGraph {
1038
1082
  include_edges?: boolean;
1039
1083
  include_chunks?: boolean;
1040
1084
  }): Promise<SearchResult[] | EnrichedSearchResponse>;
1041
- /** Hybrid BM25 + vector search with reciprocal rank fusion. */
1085
+ /**
1086
+ * Hybrid BM25 + vector search with reciprocal rank fusion. Pass
1087
+ * `explain: true` to get per-leg contributions (`legs`) on each result —
1088
+ * the "why retrieved" detail (server ≥ 1.2.0; older servers ignore it).
1089
+ */
1042
1090
  hybridSearch(query: string, opts?: {
1043
1091
  k?: number;
1044
1092
  node_types?: string[];
1045
1093
  layer?: string;
1046
- }): Promise<SearchResult[]>;
1094
+ explain?: boolean;
1095
+ }): Promise<HybridSearchResult[]>;
1047
1096
  getNodes(params?: {
1048
1097
  node_type?: string;
1049
1098
  layer?: string;
@@ -1110,6 +1159,12 @@ declare class MindGraph {
1110
1159
  getOpenQuestions(): Promise<GraphNode[]>;
1111
1160
  getWeakClaims(): Promise<GraphNode[]>;
1112
1161
  getContradictions(): Promise<unknown[]>;
1162
+ /**
1163
+ * Pending merge candidates: suspected duplicate pairs recorded by the dedup
1164
+ * pipeline's ambiguous zone as PossibleDuplicate edges, awaiting a human
1165
+ * merge/dismiss decision (server >= 1.3).
1166
+ */
1167
+ getMergeCandidates(): Promise<MergeCandidate[]>;
1113
1168
  getPendingApprovals(): Promise<GraphNode[]>;
1114
1169
  ingestChunk(req: IngestChunkRequest): Promise<IngestChunkResponse>;
1115
1170
  ingestDocument(req: IngestDocumentRequest): Promise<IngestDocumentResponse>;
package/dist/index.d.ts CHANGED
@@ -30,6 +30,44 @@ interface SearchResult {
30
30
  node_type: string;
31
31
  score: number;
32
32
  }
33
+ /**
34
+ * One retrieval leg's contribution to a fused hybrid result — the
35
+ * "why retrieved" detail. The fused score reconstructs exactly as
36
+ * `Σ 1/(60 + rank)` over a result's legs.
37
+ */
38
+ interface LegContribution {
39
+ /** Which leg surfaced the result: `"fts"` (keyword/BM25) or `"vec"` (vector). */
40
+ leg: string;
41
+ /** 1-based within-leg rank the fusion used. */
42
+ rank: number;
43
+ /**
44
+ * The leg's raw score (BM25 relevance for `fts`, cosine similarity for
45
+ * `vec`). Not comparable across legs — RRF fuses by rank, not score.
46
+ */
47
+ score: number;
48
+ }
49
+ /** A suspected duplicate pair awaiting human review (pending PossibleDuplicate edge). */
50
+ interface MergeCandidate {
51
+ edge_uid: string;
52
+ node_a_uid: string;
53
+ node_a_label: string;
54
+ node_a_summary: string;
55
+ node_b_uid: string;
56
+ node_b_label: string;
57
+ node_b_summary: string;
58
+ node_type: string;
59
+ /** Similarity score that triggered the candidate (e.g. cosine), if known. */
60
+ similarity: number | null;
61
+ /** How the candidate was found: "exact" | "fuzzy" | "semantic" | "llm". */
62
+ method: string | null;
63
+ }
64
+ /** A `/retrieve` hybrid result: the full node plus the fused RRF score. */
65
+ interface HybridSearchResult {
66
+ node: GraphNode;
67
+ score: number;
68
+ /** Per-leg contributions; present only when the request set `explain: true`. */
69
+ legs?: LegContribution[];
70
+ }
33
71
  interface SearchChunk {
34
72
  chunk_uid: string;
35
73
  content: string;
@@ -329,6 +367,12 @@ interface RetrieveRequest {
329
367
  salience_min?: number;
330
368
  limit?: number;
331
369
  offset?: number;
370
+ /**
371
+ * Hybrid action only: attach per-leg contributions (`legs`) to each
372
+ * result — the "why retrieved" detail. Requires server ≥ 1.2.0; older
373
+ * servers ignore the field.
374
+ */
375
+ explain?: boolean;
332
376
  }
333
377
  interface TraverseRequest {
334
378
  action: "chain" | "neighborhood" | "path" | "subgraph";
@@ -1038,12 +1082,17 @@ declare class MindGraph {
1038
1082
  include_edges?: boolean;
1039
1083
  include_chunks?: boolean;
1040
1084
  }): Promise<SearchResult[] | EnrichedSearchResponse>;
1041
- /** Hybrid BM25 + vector search with reciprocal rank fusion. */
1085
+ /**
1086
+ * Hybrid BM25 + vector search with reciprocal rank fusion. Pass
1087
+ * `explain: true` to get per-leg contributions (`legs`) on each result —
1088
+ * the "why retrieved" detail (server ≥ 1.2.0; older servers ignore it).
1089
+ */
1042
1090
  hybridSearch(query: string, opts?: {
1043
1091
  k?: number;
1044
1092
  node_types?: string[];
1045
1093
  layer?: string;
1046
- }): Promise<SearchResult[]>;
1094
+ explain?: boolean;
1095
+ }): Promise<HybridSearchResult[]>;
1047
1096
  getNodes(params?: {
1048
1097
  node_type?: string;
1049
1098
  layer?: string;
@@ -1110,6 +1159,12 @@ declare class MindGraph {
1110
1159
  getOpenQuestions(): Promise<GraphNode[]>;
1111
1160
  getWeakClaims(): Promise<GraphNode[]>;
1112
1161
  getContradictions(): Promise<unknown[]>;
1162
+ /**
1163
+ * Pending merge candidates: suspected duplicate pairs recorded by the dedup
1164
+ * pipeline's ambiguous zone as PossibleDuplicate edges, awaiting a human
1165
+ * merge/dismiss decision (server >= 1.3).
1166
+ */
1167
+ getMergeCandidates(): Promise<MergeCandidate[]>;
1113
1168
  getPendingApprovals(): Promise<GraphNode[]>;
1114
1169
  ingestChunk(req: IngestChunkRequest): Promise<IngestChunkResponse>;
1115
1170
  ingestDocument(req: IngestDocumentRequest): Promise<IngestDocumentResponse>;
package/dist/index.js CHANGED
@@ -397,7 +397,11 @@ var MindGraph = class {
397
397
  async search(query, opts) {
398
398
  return this.post("/search", { query, ...opts });
399
399
  }
400
- /** Hybrid BM25 + vector search with reciprocal rank fusion. */
400
+ /**
401
+ * Hybrid BM25 + vector search with reciprocal rank fusion. Pass
402
+ * `explain: true` to get per-leg contributions (`legs`) on each result —
403
+ * the "why retrieved" detail (server ≥ 1.2.0; older servers ignore it).
404
+ */
401
405
  async hybridSearch(query, opts) {
402
406
  return this.post("/retrieve", {
403
407
  action: "hybrid",
@@ -527,6 +531,14 @@ var MindGraph = class {
527
531
  async getContradictions() {
528
532
  return this.get("/contradictions");
529
533
  }
534
+ /**
535
+ * Pending merge candidates: suspected duplicate pairs recorded by the dedup
536
+ * pipeline's ambiguous zone as PossibleDuplicate edges, awaiting a human
537
+ * merge/dismiss decision (server >= 1.3).
538
+ */
539
+ async getMergeCandidates() {
540
+ return this.post("/retrieve", { action: "merge_candidates" });
541
+ }
530
542
  async getPendingApprovals() {
531
543
  return this.get("/approvals/pending");
532
544
  }
package/dist/index.mjs CHANGED
@@ -370,7 +370,11 @@ var MindGraph = class {
370
370
  async search(query, opts) {
371
371
  return this.post("/search", { query, ...opts });
372
372
  }
373
- /** Hybrid BM25 + vector search with reciprocal rank fusion. */
373
+ /**
374
+ * Hybrid BM25 + vector search with reciprocal rank fusion. Pass
375
+ * `explain: true` to get per-leg contributions (`legs`) on each result —
376
+ * the "why retrieved" detail (server ≥ 1.2.0; older servers ignore it).
377
+ */
374
378
  async hybridSearch(query, opts) {
375
379
  return this.post("/retrieve", {
376
380
  action: "hybrid",
@@ -500,6 +504,14 @@ var MindGraph = class {
500
504
  async getContradictions() {
501
505
  return this.get("/contradictions");
502
506
  }
507
+ /**
508
+ * Pending merge candidates: suspected duplicate pairs recorded by the dedup
509
+ * pipeline's ambiguous zone as PossibleDuplicate edges, awaiting a human
510
+ * merge/dismiss decision (server >= 1.3).
511
+ */
512
+ async getMergeCandidates() {
513
+ return this.post("/retrieve", { action: "merge_candidates" });
514
+ }
503
515
  async getPendingApprovals() {
504
516
  return this.get("/approvals/pending");
505
517
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "TypeScript client for the MindGraph Cloud API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",