mindgraph 0.9.0 → 0.11.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
@@ -23,12 +23,24 @@ interface GraphEdge {
23
23
  updated_at: number;
24
24
  tombstone_at: number | null;
25
25
  }
26
+ /**
27
+ * A `/retrieve` (text/semantic/hybrid) result. BREAKING (D3): the wire shape is
28
+ * `{node, score, legs?}` — the previous flat `{uid, label, summary, node_type,
29
+ * score}` never matched the server. Read fields off `.node` (e.g. `.node.uid`).
30
+ * With `include_sources: true`, `.node.source_documents` carries provenance.
31
+ */
26
32
  interface SearchResult {
27
- uid: string;
28
- label: string;
29
- summary: string;
30
- node_type: string;
33
+ node: GraphNode & {
34
+ source_documents?: Array<{
35
+ uid: string;
36
+ title: string;
37
+ ingested_by_name?: string;
38
+ occurred_at?: string;
39
+ }>;
40
+ };
31
41
  score: number;
42
+ /** Present only when the hybrid search ran with `explain: true`. */
43
+ legs?: LegContribution[];
32
44
  }
33
45
  /**
34
46
  * One retrieval leg's contribution to a fused hybrid result — the
@@ -401,15 +413,27 @@ interface RetrieveRequest {
401
413
  * timestamp (seconds). Filters by INGESTION time, not event time.
402
414
  */
403
415
  created_before?: number;
416
+ /**
417
+ * When true (`text`/`semantic`/`hybrid`), annotate each result's `node` with
418
+ * `source_documents` (`[{uid, title, ingested_by_name?, occurred_at?}]`) —
419
+ * provenance for citing "which teammate's notes" (D3). Requires server ≥ 1.8.0.
420
+ */
421
+ include_sources?: boolean;
404
422
  }
405
423
  interface TraverseRequest {
406
- action: "chain" | "neighborhood" | "path" | "subgraph";
424
+ action: "chain" | "neighborhood" | "path" | "subgraph" | "top_k_paths";
407
425
  start_uid: string;
408
426
  end_uid?: string;
409
427
  max_depth?: number;
410
428
  direction?: "outgoing" | "incoming" | "both";
411
429
  edge_types?: string[];
412
430
  weight_threshold?: number;
431
+ /** `top_k_paths` only: number of cheapest paths to return (default 3, cap 25). */
432
+ k?: number;
433
+ /** `top_k_paths` only: max edges per path (default 8, cap 16). */
434
+ max_hops?: number;
435
+ /** `top_k_paths` only: prune paths whose min-plus cost exceeds this. */
436
+ max_cost?: number;
413
437
  }
414
438
  interface EvolveRequest {
415
439
  action: "update" | "tombstone" | "restore" | "decay" | "history" | "snapshot" | "tombstone_edge" | "restore_edge" | "tombstone_cascade";
@@ -437,6 +461,16 @@ interface PageOffset {
437
461
  page: number;
438
462
  char_start: number;
439
463
  }
464
+ /**
465
+ * A named participant in a conversation/transcript. Supplied at ingest so
466
+ * extraction can map generic speaker labels ("Interviewer:") to real people
467
+ * and attribute claims/preferences/demands to the named person.
468
+ */
469
+ interface Participant {
470
+ name: string;
471
+ organization?: string;
472
+ role?: string;
473
+ }
440
474
  interface IngestChunkRequest {
441
475
  content: string;
442
476
  chunk_type?: string;
@@ -445,6 +479,12 @@ interface IngestChunkRequest {
445
479
  label?: string;
446
480
  layers?: string[];
447
481
  agent_id?: string;
482
+ /**
483
+ * Optional ontology schema id. When set, the per-chunk ontology extraction
484
+ * pass runs inline after cognitive extraction and submits proposed domain
485
+ * objects/relations. Presence alone triggers it.
486
+ */
487
+ ontology_schema_id?: string;
448
488
  }
449
489
  interface IngestChunkResponse {
450
490
  chunk_uid: string;
@@ -483,6 +523,18 @@ interface IngestDocumentRequest {
483
523
  mime_type?: string;
484
524
  /** Re-ingest even if a document with the same content was already ingested. */
485
525
  force_reingest?: boolean;
526
+ /**
527
+ * Optional ontology schema id. When set, the ontology extraction pass runs
528
+ * after cognitive passes. Presence alone triggers it (no `"ontology"` layer
529
+ * required), so auto-classified documents still get typed extraction.
530
+ */
531
+ ontology_schema_id?: string;
532
+ /** Named conversation participants — maps speaker labels to real people. */
533
+ participants?: Participant[];
534
+ /** When the document/conversation occurred (ISO-8601, imprecision ok). */
535
+ occurred_at?: string;
536
+ /** Free-text context grounding attribution during extraction. */
537
+ context?: string;
486
538
  }
487
539
  interface IngestDocumentResponse {
488
540
  job_id: string;
@@ -498,6 +550,14 @@ interface IngestSessionRequest {
498
550
  chunk_overlap?: number;
499
551
  layers?: string[];
500
552
  agent_id?: string;
553
+ /** Optional ontology schema id — triggers the ontology post-pass over the transcript's chunks. */
554
+ ontology_schema_id?: string;
555
+ /** Named conversation participants — maps speaker labels to real people. */
556
+ participants?: Participant[];
557
+ /** When the conversation occurred (ISO-8601, imprecision ok). */
558
+ occurred_at?: string;
559
+ /** Free-text context grounding attribution during extraction. */
560
+ context?: string;
501
561
  }
502
562
  interface RetrieveContextRequest {
503
563
  query: string;
@@ -511,6 +571,11 @@ interface RetrieveContextRequest {
511
571
  layer?: string;
512
572
  include_graph?: boolean;
513
573
  min_similarity?: number;
574
+ /**
575
+ * M3 as-of (valid time): ISO-8601 date to judge validity windows against.
576
+ * Windowed nodes then carry `valid_at_time` instead of `currently_valid`.
577
+ */
578
+ valid_at?: string;
514
579
  }
515
580
  interface ArticleResult {
516
581
  uid: string;
@@ -582,9 +647,25 @@ interface RetrieveContextResponse {
582
647
  source_documents?: {
583
648
  uid: string;
584
649
  title: string;
650
+ /** User id of the teammate who ingested the source document (A4). */
651
+ ingested_by?: string;
652
+ /** Display name (else email) of the ingesting teammate. */
653
+ ingested_by_name?: string;
585
654
  }[];
586
655
  source_chunks?: SourceChunk[];
587
656
  believed_by?: BelievedBy[];
657
+ /** This node has been replaced by a newer value (Supersedes edge). */
658
+ superseded?: boolean;
659
+ /** UID of the node that superseded this one. */
660
+ superseded_by?: string;
661
+ /**
662
+ * Whether the node's valid-time window (`props.valid_from`/`valid_until`)
663
+ * contains today. Absent when the node carries no window — unknown is
664
+ * not false.
665
+ */
666
+ currently_valid?: boolean;
667
+ /** As-of variant of `currently_valid` when the request set `valid_at`. */
668
+ valid_at_time?: boolean;
588
669
  })[];
589
670
  edges: Record<string, unknown>[];
590
671
  };
@@ -1023,6 +1104,17 @@ interface LinkDomainObjectsRequest {
1023
1104
  confidence?: number;
1024
1105
  agent_id?: string;
1025
1106
  }
1107
+ interface CreateDomainObjectRequest {
1108
+ schema_id: string;
1109
+ object_type: string;
1110
+ canonical_name: string;
1111
+ fields?: Record<string, unknown>;
1112
+ aliases?: string[];
1113
+ identity?: Record<string, unknown>;
1114
+ confidence?: number;
1115
+ /** Skip the same-type + same-name duplicate guard (default false). */
1116
+ allow_duplicate?: boolean;
1117
+ }
1026
1118
  interface ExtractOntologyRequest {
1027
1119
  ontology_schema_id: string;
1028
1120
  source_uids: string[];
@@ -1050,6 +1142,16 @@ declare class MindGraph {
1050
1142
  status: string;
1051
1143
  }>;
1052
1144
  stats(): Promise<Record<string, unknown>>;
1145
+ /**
1146
+ * Schema fill-rate report (measure-first tiering): per live node type,
1147
+ * the exact live count and sampled per-field fill rates; near-empty
1148
+ * fields flagged below 5%. `sample` caps per-type sampling (default
1149
+ * 1000); `layer` restricts (e.g. "epistemic").
1150
+ */
1151
+ schemaFillStats(params?: {
1152
+ sample?: number;
1153
+ layer?: string;
1154
+ }): Promise<unknown>;
1053
1155
  capture(req: CaptureRequest): Promise<unknown>;
1054
1156
  entity(req: EntityRequest): Promise<unknown>;
1055
1157
  /** Convenience: create or find an entity by label. */
@@ -1304,6 +1406,14 @@ declare class MindGraph {
1304
1406
  getAliases(uid: string): Promise<unknown>;
1305
1407
  resolveAlias(text: string): Promise<unknown>;
1306
1408
  exportGraph(): Promise<unknown>;
1409
+ /**
1410
+ * Export one document's extraction provenance as JSON-LD: PROV-O
1411
+ * entities/agents, CiTO relations between extracted claims, and the
1412
+ * citation anchors as W3C Web Annotations (TextQuoteSelector +
1413
+ * TextPositionSelector; positions are chunk-relative UTF-8 byte offsets,
1414
+ * flagged via `mg:offsetUnit`).
1415
+ */
1416
+ exportProvenance(documentUid: string): Promise<unknown>;
1307
1417
  importGraph(data: unknown): Promise<unknown>;
1308
1418
  decay(req: DecayRequest): Promise<unknown>;
1309
1419
  purge(req?: PurgeRequest): Promise<unknown>;
@@ -1517,6 +1627,37 @@ declare class MindGraph {
1517
1627
  score: number;
1518
1628
  }>;
1519
1629
  }>;
1630
+ /**
1631
+ * Per-object-type coverage stats for a schema (C2f): field fill rates
1632
+ * (with a `near_empty` flag < 5%) and identity collisions, over a bounded
1633
+ * per-type sample (default 500, max 2000).
1634
+ */
1635
+ ontologyStats(schemaId: string, sample?: number): Promise<{
1636
+ schema_id: string;
1637
+ object_types: Array<{
1638
+ object_type: string;
1639
+ count: number;
1640
+ sampled: boolean;
1641
+ fields: Array<{
1642
+ name: string;
1643
+ fill_rate: number;
1644
+ near_empty: boolean;
1645
+ }>;
1646
+ collisions: Array<{
1647
+ identity: string;
1648
+ uids: string[];
1649
+ }>;
1650
+ }>;
1651
+ }>;
1652
+ /**
1653
+ * Create a domain object by hand (auto-approved). Returns the created node
1654
+ * uid + the audit proposal id. Throws 409 if an object of the same type +
1655
+ * canonical_name already exists, unless `allow_duplicate` is set.
1656
+ */
1657
+ createDomainObject(req: CreateDomainObjectRequest): Promise<{
1658
+ uid: string;
1659
+ proposal_id: string;
1660
+ }>;
1520
1661
  linkDomainObjects(req: LinkDomainObjectsRequest): Promise<{
1521
1662
  edge_uid: string;
1522
1663
  }>;
@@ -1525,4 +1666,4 @@ declare class MindGraph {
1525
1666
  }>;
1526
1667
  }
1527
1668
 
1528
- export { type AnalogyCandidate, type ArgumentRequest, type ArticleResult, type BatchRequest, type BelievedBy, type CaptureRequest, type ClaimHub, type ClearResponse, type ClusterClaimSample, type ClusteredClaimHub, type CommitmentRequest, type ConceptCluster, type DecayRequest, type DeliberationRequest, type DialecticalPair, type DistillRequest, type DocumentRef, type EnrichedSearchResponse, type EntityBridge, type EntityRequest, type EpistemicCounts, 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 RankedClaimHub, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SessionRequest, type SignalsQuery, type SignalsResponse, type SourceChunk, type StructureRequest, type SynthesisJobResponse, type TextSelector, type TheorySupportGap, type TraverseRequest };
1669
+ export { type AnalogyCandidate, type ArgumentRequest, type ArticleResult, type BatchRequest, type BelievedBy, type CaptureRequest, type ClaimHub, type ClearResponse, type ClusterClaimSample, type ClusteredClaimHub, type CommitmentRequest, type ConceptCluster, type DecayRequest, type DeliberationRequest, type DialecticalPair, type DistillRequest, type DocumentRef, type EnrichedSearchResponse, type EntityBridge, type EntityRequest, type EpistemicCounts, 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 Participant, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type PurgeRequest, type RankedClaimHub, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SessionRequest, type SignalsQuery, type SignalsResponse, type SourceChunk, type StructureRequest, type SynthesisJobResponse, type TextSelector, type TheorySupportGap, type TraverseRequest };
package/dist/index.d.ts CHANGED
@@ -23,12 +23,24 @@ interface GraphEdge {
23
23
  updated_at: number;
24
24
  tombstone_at: number | null;
25
25
  }
26
+ /**
27
+ * A `/retrieve` (text/semantic/hybrid) result. BREAKING (D3): the wire shape is
28
+ * `{node, score, legs?}` — the previous flat `{uid, label, summary, node_type,
29
+ * score}` never matched the server. Read fields off `.node` (e.g. `.node.uid`).
30
+ * With `include_sources: true`, `.node.source_documents` carries provenance.
31
+ */
26
32
  interface SearchResult {
27
- uid: string;
28
- label: string;
29
- summary: string;
30
- node_type: string;
33
+ node: GraphNode & {
34
+ source_documents?: Array<{
35
+ uid: string;
36
+ title: string;
37
+ ingested_by_name?: string;
38
+ occurred_at?: string;
39
+ }>;
40
+ };
31
41
  score: number;
42
+ /** Present only when the hybrid search ran with `explain: true`. */
43
+ legs?: LegContribution[];
32
44
  }
33
45
  /**
34
46
  * One retrieval leg's contribution to a fused hybrid result — the
@@ -401,15 +413,27 @@ interface RetrieveRequest {
401
413
  * timestamp (seconds). Filters by INGESTION time, not event time.
402
414
  */
403
415
  created_before?: number;
416
+ /**
417
+ * When true (`text`/`semantic`/`hybrid`), annotate each result's `node` with
418
+ * `source_documents` (`[{uid, title, ingested_by_name?, occurred_at?}]`) —
419
+ * provenance for citing "which teammate's notes" (D3). Requires server ≥ 1.8.0.
420
+ */
421
+ include_sources?: boolean;
404
422
  }
405
423
  interface TraverseRequest {
406
- action: "chain" | "neighborhood" | "path" | "subgraph";
424
+ action: "chain" | "neighborhood" | "path" | "subgraph" | "top_k_paths";
407
425
  start_uid: string;
408
426
  end_uid?: string;
409
427
  max_depth?: number;
410
428
  direction?: "outgoing" | "incoming" | "both";
411
429
  edge_types?: string[];
412
430
  weight_threshold?: number;
431
+ /** `top_k_paths` only: number of cheapest paths to return (default 3, cap 25). */
432
+ k?: number;
433
+ /** `top_k_paths` only: max edges per path (default 8, cap 16). */
434
+ max_hops?: number;
435
+ /** `top_k_paths` only: prune paths whose min-plus cost exceeds this. */
436
+ max_cost?: number;
413
437
  }
414
438
  interface EvolveRequest {
415
439
  action: "update" | "tombstone" | "restore" | "decay" | "history" | "snapshot" | "tombstone_edge" | "restore_edge" | "tombstone_cascade";
@@ -437,6 +461,16 @@ interface PageOffset {
437
461
  page: number;
438
462
  char_start: number;
439
463
  }
464
+ /**
465
+ * A named participant in a conversation/transcript. Supplied at ingest so
466
+ * extraction can map generic speaker labels ("Interviewer:") to real people
467
+ * and attribute claims/preferences/demands to the named person.
468
+ */
469
+ interface Participant {
470
+ name: string;
471
+ organization?: string;
472
+ role?: string;
473
+ }
440
474
  interface IngestChunkRequest {
441
475
  content: string;
442
476
  chunk_type?: string;
@@ -445,6 +479,12 @@ interface IngestChunkRequest {
445
479
  label?: string;
446
480
  layers?: string[];
447
481
  agent_id?: string;
482
+ /**
483
+ * Optional ontology schema id. When set, the per-chunk ontology extraction
484
+ * pass runs inline after cognitive extraction and submits proposed domain
485
+ * objects/relations. Presence alone triggers it.
486
+ */
487
+ ontology_schema_id?: string;
448
488
  }
449
489
  interface IngestChunkResponse {
450
490
  chunk_uid: string;
@@ -483,6 +523,18 @@ interface IngestDocumentRequest {
483
523
  mime_type?: string;
484
524
  /** Re-ingest even if a document with the same content was already ingested. */
485
525
  force_reingest?: boolean;
526
+ /**
527
+ * Optional ontology schema id. When set, the ontology extraction pass runs
528
+ * after cognitive passes. Presence alone triggers it (no `"ontology"` layer
529
+ * required), so auto-classified documents still get typed extraction.
530
+ */
531
+ ontology_schema_id?: string;
532
+ /** Named conversation participants — maps speaker labels to real people. */
533
+ participants?: Participant[];
534
+ /** When the document/conversation occurred (ISO-8601, imprecision ok). */
535
+ occurred_at?: string;
536
+ /** Free-text context grounding attribution during extraction. */
537
+ context?: string;
486
538
  }
487
539
  interface IngestDocumentResponse {
488
540
  job_id: string;
@@ -498,6 +550,14 @@ interface IngestSessionRequest {
498
550
  chunk_overlap?: number;
499
551
  layers?: string[];
500
552
  agent_id?: string;
553
+ /** Optional ontology schema id — triggers the ontology post-pass over the transcript's chunks. */
554
+ ontology_schema_id?: string;
555
+ /** Named conversation participants — maps speaker labels to real people. */
556
+ participants?: Participant[];
557
+ /** When the conversation occurred (ISO-8601, imprecision ok). */
558
+ occurred_at?: string;
559
+ /** Free-text context grounding attribution during extraction. */
560
+ context?: string;
501
561
  }
502
562
  interface RetrieveContextRequest {
503
563
  query: string;
@@ -511,6 +571,11 @@ interface RetrieveContextRequest {
511
571
  layer?: string;
512
572
  include_graph?: boolean;
513
573
  min_similarity?: number;
574
+ /**
575
+ * M3 as-of (valid time): ISO-8601 date to judge validity windows against.
576
+ * Windowed nodes then carry `valid_at_time` instead of `currently_valid`.
577
+ */
578
+ valid_at?: string;
514
579
  }
515
580
  interface ArticleResult {
516
581
  uid: string;
@@ -582,9 +647,25 @@ interface RetrieveContextResponse {
582
647
  source_documents?: {
583
648
  uid: string;
584
649
  title: string;
650
+ /** User id of the teammate who ingested the source document (A4). */
651
+ ingested_by?: string;
652
+ /** Display name (else email) of the ingesting teammate. */
653
+ ingested_by_name?: string;
585
654
  }[];
586
655
  source_chunks?: SourceChunk[];
587
656
  believed_by?: BelievedBy[];
657
+ /** This node has been replaced by a newer value (Supersedes edge). */
658
+ superseded?: boolean;
659
+ /** UID of the node that superseded this one. */
660
+ superseded_by?: string;
661
+ /**
662
+ * Whether the node's valid-time window (`props.valid_from`/`valid_until`)
663
+ * contains today. Absent when the node carries no window — unknown is
664
+ * not false.
665
+ */
666
+ currently_valid?: boolean;
667
+ /** As-of variant of `currently_valid` when the request set `valid_at`. */
668
+ valid_at_time?: boolean;
588
669
  })[];
589
670
  edges: Record<string, unknown>[];
590
671
  };
@@ -1023,6 +1104,17 @@ interface LinkDomainObjectsRequest {
1023
1104
  confidence?: number;
1024
1105
  agent_id?: string;
1025
1106
  }
1107
+ interface CreateDomainObjectRequest {
1108
+ schema_id: string;
1109
+ object_type: string;
1110
+ canonical_name: string;
1111
+ fields?: Record<string, unknown>;
1112
+ aliases?: string[];
1113
+ identity?: Record<string, unknown>;
1114
+ confidence?: number;
1115
+ /** Skip the same-type + same-name duplicate guard (default false). */
1116
+ allow_duplicate?: boolean;
1117
+ }
1026
1118
  interface ExtractOntologyRequest {
1027
1119
  ontology_schema_id: string;
1028
1120
  source_uids: string[];
@@ -1050,6 +1142,16 @@ declare class MindGraph {
1050
1142
  status: string;
1051
1143
  }>;
1052
1144
  stats(): Promise<Record<string, unknown>>;
1145
+ /**
1146
+ * Schema fill-rate report (measure-first tiering): per live node type,
1147
+ * the exact live count and sampled per-field fill rates; near-empty
1148
+ * fields flagged below 5%. `sample` caps per-type sampling (default
1149
+ * 1000); `layer` restricts (e.g. "epistemic").
1150
+ */
1151
+ schemaFillStats(params?: {
1152
+ sample?: number;
1153
+ layer?: string;
1154
+ }): Promise<unknown>;
1053
1155
  capture(req: CaptureRequest): Promise<unknown>;
1054
1156
  entity(req: EntityRequest): Promise<unknown>;
1055
1157
  /** Convenience: create or find an entity by label. */
@@ -1304,6 +1406,14 @@ declare class MindGraph {
1304
1406
  getAliases(uid: string): Promise<unknown>;
1305
1407
  resolveAlias(text: string): Promise<unknown>;
1306
1408
  exportGraph(): Promise<unknown>;
1409
+ /**
1410
+ * Export one document's extraction provenance as JSON-LD: PROV-O
1411
+ * entities/agents, CiTO relations between extracted claims, and the
1412
+ * citation anchors as W3C Web Annotations (TextQuoteSelector +
1413
+ * TextPositionSelector; positions are chunk-relative UTF-8 byte offsets,
1414
+ * flagged via `mg:offsetUnit`).
1415
+ */
1416
+ exportProvenance(documentUid: string): Promise<unknown>;
1307
1417
  importGraph(data: unknown): Promise<unknown>;
1308
1418
  decay(req: DecayRequest): Promise<unknown>;
1309
1419
  purge(req?: PurgeRequest): Promise<unknown>;
@@ -1517,6 +1627,37 @@ declare class MindGraph {
1517
1627
  score: number;
1518
1628
  }>;
1519
1629
  }>;
1630
+ /**
1631
+ * Per-object-type coverage stats for a schema (C2f): field fill rates
1632
+ * (with a `near_empty` flag < 5%) and identity collisions, over a bounded
1633
+ * per-type sample (default 500, max 2000).
1634
+ */
1635
+ ontologyStats(schemaId: string, sample?: number): Promise<{
1636
+ schema_id: string;
1637
+ object_types: Array<{
1638
+ object_type: string;
1639
+ count: number;
1640
+ sampled: boolean;
1641
+ fields: Array<{
1642
+ name: string;
1643
+ fill_rate: number;
1644
+ near_empty: boolean;
1645
+ }>;
1646
+ collisions: Array<{
1647
+ identity: string;
1648
+ uids: string[];
1649
+ }>;
1650
+ }>;
1651
+ }>;
1652
+ /**
1653
+ * Create a domain object by hand (auto-approved). Returns the created node
1654
+ * uid + the audit proposal id. Throws 409 if an object of the same type +
1655
+ * canonical_name already exists, unless `allow_duplicate` is set.
1656
+ */
1657
+ createDomainObject(req: CreateDomainObjectRequest): Promise<{
1658
+ uid: string;
1659
+ proposal_id: string;
1660
+ }>;
1520
1661
  linkDomainObjects(req: LinkDomainObjectsRequest): Promise<{
1521
1662
  edge_uid: string;
1522
1663
  }>;
@@ -1525,4 +1666,4 @@ declare class MindGraph {
1525
1666
  }>;
1526
1667
  }
1527
1668
 
1528
- export { type AnalogyCandidate, type ArgumentRequest, type ArticleResult, type BatchRequest, type BelievedBy, type CaptureRequest, type ClaimHub, type ClearResponse, type ClusterClaimSample, type ClusteredClaimHub, type CommitmentRequest, type ConceptCluster, type DecayRequest, type DeliberationRequest, type DialecticalPair, type DistillRequest, type DocumentRef, type EnrichedSearchResponse, type EntityBridge, type EntityRequest, type EpistemicCounts, 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 RankedClaimHub, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SessionRequest, type SignalsQuery, type SignalsResponse, type SourceChunk, type StructureRequest, type SynthesisJobResponse, type TextSelector, type TheorySupportGap, type TraverseRequest };
1669
+ export { type AnalogyCandidate, type ArgumentRequest, type ArticleResult, type BatchRequest, type BelievedBy, type CaptureRequest, type ClaimHub, type ClearResponse, type ClusterClaimSample, type ClusteredClaimHub, type CommitmentRequest, type ConceptCluster, type DecayRequest, type DeliberationRequest, type DialecticalPair, type DistillRequest, type DocumentRef, type EnrichedSearchResponse, type EntityBridge, type EntityRequest, type EpistemicCounts, 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 Participant, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type PurgeRequest, type RankedClaimHub, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SessionRequest, type SignalsQuery, type SignalsResponse, type SourceChunk, type StructureRequest, type SynthesisJobResponse, type TextSelector, type TheorySupportGap, type TraverseRequest };
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
  }
@@ -787,6 +812,24 @@ var MindGraph = class {
787
812
  async searchDomainObjects(query, opts) {
788
813
  return this.post("/ontology/objects/search", { query, ...opts ?? {} });
789
814
  }
815
+ /**
816
+ * Per-object-type coverage stats for a schema (C2f): field fill rates
817
+ * (with a `near_empty` flag < 5%) and identity collisions, over a bounded
818
+ * per-type sample (default 500, max 2000).
819
+ */
820
+ async ontologyStats(schemaId, sample) {
821
+ const q = new URLSearchParams({ schema_id: schemaId });
822
+ if (sample != null) q.set("sample", String(sample));
823
+ return this.get(`/ontology/stats?${q.toString()}`);
824
+ }
825
+ /**
826
+ * Create a domain object by hand (auto-approved). Returns the created node
827
+ * uid + the audit proposal id. Throws 409 if an object of the same type +
828
+ * canonical_name already exists, unless `allow_duplicate` is set.
829
+ */
830
+ async createDomainObject(req) {
831
+ return this.post("/v1/ontology/objects", req);
832
+ }
790
833
  async linkDomainObjects(req) {
791
834
  return this.post("/ontology/relation", { action: "create", ...req });
792
835
  }
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
  }
@@ -760,6 +785,24 @@ var MindGraph = class {
760
785
  async searchDomainObjects(query, opts) {
761
786
  return this.post("/ontology/objects/search", { query, ...opts ?? {} });
762
787
  }
788
+ /**
789
+ * Per-object-type coverage stats for a schema (C2f): field fill rates
790
+ * (with a `near_empty` flag < 5%) and identity collisions, over a bounded
791
+ * per-type sample (default 500, max 2000).
792
+ */
793
+ async ontologyStats(schemaId, sample) {
794
+ const q = new URLSearchParams({ schema_id: schemaId });
795
+ if (sample != null) q.set("sample", String(sample));
796
+ return this.get(`/ontology/stats?${q.toString()}`);
797
+ }
798
+ /**
799
+ * Create a domain object by hand (auto-approved). Returns the created node
800
+ * uid + the audit proposal id. Throws 409 if an object of the same type +
801
+ * canonical_name already exists, unless `allow_duplicate` is set.
802
+ */
803
+ async createDomainObject(req) {
804
+ return this.post("/v1/ontology/objects", req);
805
+ }
763
806
  async linkDomainObjects(req) {
764
807
  return this.post("/ontology/relation", { action: "create", ...req });
765
808
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "TypeScript client for the MindGraph Cloud API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",