mindgraph 0.9.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
@@ -403,13 +403,19 @@ interface RetrieveRequest {
403
403
  created_before?: number;
404
404
  }
405
405
  interface TraverseRequest {
406
- action: "chain" | "neighborhood" | "path" | "subgraph";
406
+ action: "chain" | "neighborhood" | "path" | "subgraph" | "top_k_paths";
407
407
  start_uid: string;
408
408
  end_uid?: string;
409
409
  max_depth?: number;
410
410
  direction?: "outgoing" | "incoming" | "both";
411
411
  edge_types?: string[];
412
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;
413
419
  }
414
420
  interface EvolveRequest {
415
421
  action: "update" | "tombstone" | "restore" | "decay" | "history" | "snapshot" | "tombstone_edge" | "restore_edge" | "tombstone_cascade";
@@ -511,6 +517,11 @@ interface RetrieveContextRequest {
511
517
  layer?: string;
512
518
  include_graph?: boolean;
513
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;
514
525
  }
515
526
  interface ArticleResult {
516
527
  uid: string;
@@ -585,6 +596,18 @@ interface RetrieveContextResponse {
585
596
  }[];
586
597
  source_chunks?: SourceChunk[];
587
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;
588
611
  })[];
589
612
  edges: Record<string, unknown>[];
590
613
  };
@@ -1050,6 +1073,16 @@ declare class MindGraph {
1050
1073
  status: string;
1051
1074
  }>;
1052
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>;
1053
1086
  capture(req: CaptureRequest): Promise<unknown>;
1054
1087
  entity(req: EntityRequest): Promise<unknown>;
1055
1088
  /** Convenience: create or find an entity by label. */
@@ -1304,6 +1337,14 @@ declare class MindGraph {
1304
1337
  getAliases(uid: string): Promise<unknown>;
1305
1338
  resolveAlias(text: string): Promise<unknown>;
1306
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>;
1307
1348
  importGraph(data: unknown): Promise<unknown>;
1308
1349
  decay(req: DecayRequest): Promise<unknown>;
1309
1350
  purge(req?: PurgeRequest): Promise<unknown>;
package/dist/index.d.ts CHANGED
@@ -403,13 +403,19 @@ interface RetrieveRequest {
403
403
  created_before?: number;
404
404
  }
405
405
  interface TraverseRequest {
406
- action: "chain" | "neighborhood" | "path" | "subgraph";
406
+ action: "chain" | "neighborhood" | "path" | "subgraph" | "top_k_paths";
407
407
  start_uid: string;
408
408
  end_uid?: string;
409
409
  max_depth?: number;
410
410
  direction?: "outgoing" | "incoming" | "both";
411
411
  edge_types?: string[];
412
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;
413
419
  }
414
420
  interface EvolveRequest {
415
421
  action: "update" | "tombstone" | "restore" | "decay" | "history" | "snapshot" | "tombstone_edge" | "restore_edge" | "tombstone_cascade";
@@ -511,6 +517,11 @@ interface RetrieveContextRequest {
511
517
  layer?: string;
512
518
  include_graph?: boolean;
513
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;
514
525
  }
515
526
  interface ArticleResult {
516
527
  uid: string;
@@ -585,6 +596,18 @@ interface RetrieveContextResponse {
585
596
  }[];
586
597
  source_chunks?: SourceChunk[];
587
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;
588
611
  })[];
589
612
  edges: Record<string, unknown>[];
590
613
  };
@@ -1050,6 +1073,16 @@ declare class MindGraph {
1050
1073
  status: string;
1051
1074
  }>;
1052
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>;
1053
1086
  capture(req: CaptureRequest): Promise<unknown>;
1054
1087
  entity(req: EntityRequest): Promise<unknown>;
1055
1088
  /** Convenience: create or find an entity by label. */
@@ -1304,6 +1337,14 @@ declare class MindGraph {
1304
1337
  getAliases(uid: string): Promise<unknown>;
1305
1338
  resolveAlias(text: string): Promise<unknown>;
1306
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>;
1307
1348
  importGraph(data: unknown): Promise<unknown>;
1308
1349
  decay(req: DecayRequest): Promise<unknown>;
1309
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.9.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",