mindgraph 0.8.0 → 0.10.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
@@ -81,12 +81,20 @@ interface EnrichedSearchResponse {
81
81
  chunks: SearchChunk[];
82
82
  }
83
83
  interface PathStep {
84
- uid: string;
84
+ node_uid: string;
85
85
  label: string;
86
86
  node_type: string;
87
87
  edge_type: string | null;
88
88
  depth: number;
89
89
  parent_uid: string | null;
90
+ /** Min-plus cost of the returned BFS path from the start node
91
+ * (sum of -ln(weight), weights clamped to (1e-9, 1]); cost of the path
92
+ * the traversal returned, not the cheapest path. 0 at the start node. */
93
+ path_cost?: number;
94
+ /** Product of edge confidences along the returned BFS path (clamped to
95
+ * (1e-9, 1]); a ranking signal, not a calibrated probability. 1 at the
96
+ * start node. */
97
+ path_confidence?: number;
90
98
  }
91
99
  interface PersonProps {
92
100
  canonical_name: string;
@@ -395,13 +403,19 @@ interface RetrieveRequest {
395
403
  created_before?: number;
396
404
  }
397
405
  interface TraverseRequest {
398
- action: "chain" | "neighborhood" | "path" | "subgraph";
406
+ action: "chain" | "neighborhood" | "path" | "subgraph" | "top_k_paths";
399
407
  start_uid: string;
400
408
  end_uid?: string;
401
409
  max_depth?: number;
402
410
  direction?: "outgoing" | "incoming" | "both";
403
411
  edge_types?: string[];
404
412
  weight_threshold?: number;
413
+ /** `top_k_paths` only: number of cheapest paths to return (default 3, cap 25). */
414
+ k?: number;
415
+ /** `top_k_paths` only: max edges per path (default 8, cap 16). */
416
+ max_hops?: number;
417
+ /** `top_k_paths` only: prune paths whose min-plus cost exceeds this. */
418
+ max_cost?: number;
405
419
  }
406
420
  interface EvolveRequest {
407
421
  action: "update" | "tombstone" | "restore" | "decay" | "history" | "snapshot" | "tombstone_edge" | "restore_edge" | "tombstone_cascade";
@@ -503,6 +517,11 @@ interface RetrieveContextRequest {
503
517
  layer?: string;
504
518
  include_graph?: boolean;
505
519
  min_similarity?: number;
520
+ /**
521
+ * M3 as-of (valid time): ISO-8601 date to judge validity windows against.
522
+ * Windowed nodes then carry `valid_at_time` instead of `currently_valid`.
523
+ */
524
+ valid_at?: string;
506
525
  }
507
526
  interface ArticleResult {
508
527
  uid: string;
@@ -577,6 +596,18 @@ interface RetrieveContextResponse {
577
596
  }[];
578
597
  source_chunks?: SourceChunk[];
579
598
  believed_by?: BelievedBy[];
599
+ /** This node has been replaced by a newer value (Supersedes edge). */
600
+ superseded?: boolean;
601
+ /** UID of the node that superseded this one. */
602
+ superseded_by?: string;
603
+ /**
604
+ * Whether the node's valid-time window (`props.valid_from`/`valid_until`)
605
+ * contains today. Absent when the node carries no window — unknown is
606
+ * not false.
607
+ */
608
+ currently_valid?: boolean;
609
+ /** As-of variant of `currently_valid` when the request set `valid_at`. */
610
+ valid_at_time?: boolean;
580
611
  })[];
581
612
  edges: Record<string, unknown>[];
582
613
  };
@@ -1042,6 +1073,16 @@ declare class MindGraph {
1042
1073
  status: string;
1043
1074
  }>;
1044
1075
  stats(): Promise<Record<string, unknown>>;
1076
+ /**
1077
+ * Schema fill-rate report (measure-first tiering): per live node type,
1078
+ * the exact live count and sampled per-field fill rates; near-empty
1079
+ * fields flagged below 5%. `sample` caps per-type sampling (default
1080
+ * 1000); `layer` restricts (e.g. "epistemic").
1081
+ */
1082
+ schemaFillStats(params?: {
1083
+ sample?: number;
1084
+ layer?: string;
1085
+ }): Promise<unknown>;
1045
1086
  capture(req: CaptureRequest): Promise<unknown>;
1046
1087
  entity(req: EntityRequest): Promise<unknown>;
1047
1088
  /** Convenience: create or find an entity by label. */
@@ -1296,6 +1337,14 @@ declare class MindGraph {
1296
1337
  getAliases(uid: string): Promise<unknown>;
1297
1338
  resolveAlias(text: string): Promise<unknown>;
1298
1339
  exportGraph(): Promise<unknown>;
1340
+ /**
1341
+ * Export one document's extraction provenance as JSON-LD: PROV-O
1342
+ * entities/agents, CiTO relations between extracted claims, and the
1343
+ * citation anchors as W3C Web Annotations (TextQuoteSelector +
1344
+ * TextPositionSelector; positions are chunk-relative UTF-8 byte offsets,
1345
+ * flagged via `mg:offsetUnit`).
1346
+ */
1347
+ exportProvenance(documentUid: string): Promise<unknown>;
1299
1348
  importGraph(data: unknown): Promise<unknown>;
1300
1349
  decay(req: DecayRequest): Promise<unknown>;
1301
1350
  purge(req?: PurgeRequest): Promise<unknown>;
package/dist/index.d.ts CHANGED
@@ -81,12 +81,20 @@ interface EnrichedSearchResponse {
81
81
  chunks: SearchChunk[];
82
82
  }
83
83
  interface PathStep {
84
- uid: string;
84
+ node_uid: string;
85
85
  label: string;
86
86
  node_type: string;
87
87
  edge_type: string | null;
88
88
  depth: number;
89
89
  parent_uid: string | null;
90
+ /** Min-plus cost of the returned BFS path from the start node
91
+ * (sum of -ln(weight), weights clamped to (1e-9, 1]); cost of the path
92
+ * the traversal returned, not the cheapest path. 0 at the start node. */
93
+ path_cost?: number;
94
+ /** Product of edge confidences along the returned BFS path (clamped to
95
+ * (1e-9, 1]); a ranking signal, not a calibrated probability. 1 at the
96
+ * start node. */
97
+ path_confidence?: number;
90
98
  }
91
99
  interface PersonProps {
92
100
  canonical_name: string;
@@ -395,13 +403,19 @@ interface RetrieveRequest {
395
403
  created_before?: number;
396
404
  }
397
405
  interface TraverseRequest {
398
- action: "chain" | "neighborhood" | "path" | "subgraph";
406
+ action: "chain" | "neighborhood" | "path" | "subgraph" | "top_k_paths";
399
407
  start_uid: string;
400
408
  end_uid?: string;
401
409
  max_depth?: number;
402
410
  direction?: "outgoing" | "incoming" | "both";
403
411
  edge_types?: string[];
404
412
  weight_threshold?: number;
413
+ /** `top_k_paths` only: number of cheapest paths to return (default 3, cap 25). */
414
+ k?: number;
415
+ /** `top_k_paths` only: max edges per path (default 8, cap 16). */
416
+ max_hops?: number;
417
+ /** `top_k_paths` only: prune paths whose min-plus cost exceeds this. */
418
+ max_cost?: number;
405
419
  }
406
420
  interface EvolveRequest {
407
421
  action: "update" | "tombstone" | "restore" | "decay" | "history" | "snapshot" | "tombstone_edge" | "restore_edge" | "tombstone_cascade";
@@ -503,6 +517,11 @@ interface RetrieveContextRequest {
503
517
  layer?: string;
504
518
  include_graph?: boolean;
505
519
  min_similarity?: number;
520
+ /**
521
+ * M3 as-of (valid time): ISO-8601 date to judge validity windows against.
522
+ * Windowed nodes then carry `valid_at_time` instead of `currently_valid`.
523
+ */
524
+ valid_at?: string;
506
525
  }
507
526
  interface ArticleResult {
508
527
  uid: string;
@@ -577,6 +596,18 @@ interface RetrieveContextResponse {
577
596
  }[];
578
597
  source_chunks?: SourceChunk[];
579
598
  believed_by?: BelievedBy[];
599
+ /** This node has been replaced by a newer value (Supersedes edge). */
600
+ superseded?: boolean;
601
+ /** UID of the node that superseded this one. */
602
+ superseded_by?: string;
603
+ /**
604
+ * Whether the node's valid-time window (`props.valid_from`/`valid_until`)
605
+ * contains today. Absent when the node carries no window — unknown is
606
+ * not false.
607
+ */
608
+ currently_valid?: boolean;
609
+ /** As-of variant of `currently_valid` when the request set `valid_at`. */
610
+ valid_at_time?: boolean;
580
611
  })[];
581
612
  edges: Record<string, unknown>[];
582
613
  };
@@ -1042,6 +1073,16 @@ declare class MindGraph {
1042
1073
  status: string;
1043
1074
  }>;
1044
1075
  stats(): Promise<Record<string, unknown>>;
1076
+ /**
1077
+ * Schema fill-rate report (measure-first tiering): per live node type,
1078
+ * the exact live count and sampled per-field fill rates; near-empty
1079
+ * fields flagged below 5%. `sample` caps per-type sampling (default
1080
+ * 1000); `layer` restricts (e.g. "epistemic").
1081
+ */
1082
+ schemaFillStats(params?: {
1083
+ sample?: number;
1084
+ layer?: string;
1085
+ }): Promise<unknown>;
1045
1086
  capture(req: CaptureRequest): Promise<unknown>;
1046
1087
  entity(req: EntityRequest): Promise<unknown>;
1047
1088
  /** Convenience: create or find an entity by label. */
@@ -1296,6 +1337,14 @@ declare class MindGraph {
1296
1337
  getAliases(uid: string): Promise<unknown>;
1297
1338
  resolveAlias(text: string): Promise<unknown>;
1298
1339
  exportGraph(): Promise<unknown>;
1340
+ /**
1341
+ * Export one document's extraction provenance as JSON-LD: PROV-O
1342
+ * entities/agents, CiTO relations between extracted claims, and the
1343
+ * citation anchors as W3C Web Annotations (TextQuoteSelector +
1344
+ * TextPositionSelector; positions are chunk-relative UTF-8 byte offsets,
1345
+ * flagged via `mg:offsetUnit`).
1346
+ */
1347
+ exportProvenance(documentUid: string): Promise<unknown>;
1299
1348
  importGraph(data: unknown): Promise<unknown>;
1300
1349
  decay(req: DecayRequest): Promise<unknown>;
1301
1350
  purge(req?: PurgeRequest): Promise<unknown>;
package/dist/index.js CHANGED
@@ -108,6 +108,19 @@ var MindGraph = class {
108
108
  async stats() {
109
109
  return this.get("/stats");
110
110
  }
111
+ /**
112
+ * Schema fill-rate report (measure-first tiering): per live node type,
113
+ * the exact live count and sampled per-field fill rates; near-empty
114
+ * fields flagged below 5%. `sample` caps per-type sampling (default
115
+ * 1000); `layer` restricts (e.g. "epistemic").
116
+ */
117
+ async schemaFillStats(params) {
118
+ const q = new URLSearchParams();
119
+ if (params?.sample !== void 0) q.set("sample", String(params.sample));
120
+ if (params?.layer) q.set("layer", params.layer);
121
+ const qs = q.toString();
122
+ return this.get(`/stats/schema-fill${qs ? `?${qs}` : ""}`);
123
+ }
111
124
  // ---- Reality Layer ----
112
125
  async capture(req) {
113
126
  return this.post("/reality/capture", req);
@@ -469,6 +482,18 @@ var MindGraph = class {
469
482
  async exportGraph() {
470
483
  return this.get("/export");
471
484
  }
485
+ /**
486
+ * Export one document's extraction provenance as JSON-LD: PROV-O
487
+ * entities/agents, CiTO relations between extracted claims, and the
488
+ * citation anchors as W3C Web Annotations (TextQuoteSelector +
489
+ * TextPositionSelector; positions are chunk-relative UTF-8 byte offsets,
490
+ * flagged via `mg:offsetUnit`).
491
+ */
492
+ async exportProvenance(documentUid) {
493
+ return this.get(
494
+ `/export/prov?document_uid=${encodeURIComponent(documentUid)}`
495
+ );
496
+ }
472
497
  async importGraph(data) {
473
498
  return this.post("/import", data);
474
499
  }
package/dist/index.mjs CHANGED
@@ -81,6 +81,19 @@ var MindGraph = class {
81
81
  async stats() {
82
82
  return this.get("/stats");
83
83
  }
84
+ /**
85
+ * Schema fill-rate report (measure-first tiering): per live node type,
86
+ * the exact live count and sampled per-field fill rates; near-empty
87
+ * fields flagged below 5%. `sample` caps per-type sampling (default
88
+ * 1000); `layer` restricts (e.g. "epistemic").
89
+ */
90
+ async schemaFillStats(params) {
91
+ const q = new URLSearchParams();
92
+ if (params?.sample !== void 0) q.set("sample", String(params.sample));
93
+ if (params?.layer) q.set("layer", params.layer);
94
+ const qs = q.toString();
95
+ return this.get(`/stats/schema-fill${qs ? `?${qs}` : ""}`);
96
+ }
84
97
  // ---- Reality Layer ----
85
98
  async capture(req) {
86
99
  return this.post("/reality/capture", req);
@@ -442,6 +455,18 @@ var MindGraph = class {
442
455
  async exportGraph() {
443
456
  return this.get("/export");
444
457
  }
458
+ /**
459
+ * Export one document's extraction provenance as JSON-LD: PROV-O
460
+ * entities/agents, CiTO relations between extracted claims, and the
461
+ * citation anchors as W3C Web Annotations (TextQuoteSelector +
462
+ * TextPositionSelector; positions are chunk-relative UTF-8 byte offsets,
463
+ * flagged via `mg:offsetUnit`).
464
+ */
465
+ async exportProvenance(documentUid) {
466
+ return this.get(
467
+ `/export/prov?document_uid=${encodeURIComponent(documentUid)}`
468
+ );
469
+ }
445
470
  async importGraph(data) {
446
471
  return this.post("/import", data);
447
472
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "TypeScript client for the MindGraph Cloud API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",