mindgraph 0.10.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,6 +413,12 @@ 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
424
  action: "chain" | "neighborhood" | "path" | "subgraph" | "top_k_paths";
@@ -443,6 +461,16 @@ interface PageOffset {
443
461
  page: number;
444
462
  char_start: number;
445
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
+ }
446
474
  interface IngestChunkRequest {
447
475
  content: string;
448
476
  chunk_type?: string;
@@ -451,6 +479,12 @@ interface IngestChunkRequest {
451
479
  label?: string;
452
480
  layers?: string[];
453
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;
454
488
  }
455
489
  interface IngestChunkResponse {
456
490
  chunk_uid: string;
@@ -489,6 +523,18 @@ interface IngestDocumentRequest {
489
523
  mime_type?: string;
490
524
  /** Re-ingest even if a document with the same content was already ingested. */
491
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;
492
538
  }
493
539
  interface IngestDocumentResponse {
494
540
  job_id: string;
@@ -504,6 +550,14 @@ interface IngestSessionRequest {
504
550
  chunk_overlap?: number;
505
551
  layers?: string[];
506
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;
507
561
  }
508
562
  interface RetrieveContextRequest {
509
563
  query: string;
@@ -593,6 +647,10 @@ interface RetrieveContextResponse {
593
647
  source_documents?: {
594
648
  uid: string;
595
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;
596
654
  }[];
597
655
  source_chunks?: SourceChunk[];
598
656
  believed_by?: BelievedBy[];
@@ -1046,6 +1104,17 @@ interface LinkDomainObjectsRequest {
1046
1104
  confidence?: number;
1047
1105
  agent_id?: string;
1048
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
+ }
1049
1118
  interface ExtractOntologyRequest {
1050
1119
  ontology_schema_id: string;
1051
1120
  source_uids: string[];
@@ -1558,6 +1627,37 @@ declare class MindGraph {
1558
1627
  score: number;
1559
1628
  }>;
1560
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
+ }>;
1561
1661
  linkDomainObjects(req: LinkDomainObjectsRequest): Promise<{
1562
1662
  edge_uid: string;
1563
1663
  }>;
@@ -1566,4 +1666,4 @@ declare class MindGraph {
1566
1666
  }>;
1567
1667
  }
1568
1668
 
1569
- 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,6 +413,12 @@ 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
424
  action: "chain" | "neighborhood" | "path" | "subgraph" | "top_k_paths";
@@ -443,6 +461,16 @@ interface PageOffset {
443
461
  page: number;
444
462
  char_start: number;
445
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
+ }
446
474
  interface IngestChunkRequest {
447
475
  content: string;
448
476
  chunk_type?: string;
@@ -451,6 +479,12 @@ interface IngestChunkRequest {
451
479
  label?: string;
452
480
  layers?: string[];
453
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;
454
488
  }
455
489
  interface IngestChunkResponse {
456
490
  chunk_uid: string;
@@ -489,6 +523,18 @@ interface IngestDocumentRequest {
489
523
  mime_type?: string;
490
524
  /** Re-ingest even if a document with the same content was already ingested. */
491
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;
492
538
  }
493
539
  interface IngestDocumentResponse {
494
540
  job_id: string;
@@ -504,6 +550,14 @@ interface IngestSessionRequest {
504
550
  chunk_overlap?: number;
505
551
  layers?: string[];
506
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;
507
561
  }
508
562
  interface RetrieveContextRequest {
509
563
  query: string;
@@ -593,6 +647,10 @@ interface RetrieveContextResponse {
593
647
  source_documents?: {
594
648
  uid: string;
595
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;
596
654
  }[];
597
655
  source_chunks?: SourceChunk[];
598
656
  believed_by?: BelievedBy[];
@@ -1046,6 +1104,17 @@ interface LinkDomainObjectsRequest {
1046
1104
  confidence?: number;
1047
1105
  agent_id?: string;
1048
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
+ }
1049
1118
  interface ExtractOntologyRequest {
1050
1119
  ontology_schema_id: string;
1051
1120
  source_uids: string[];
@@ -1558,6 +1627,37 @@ declare class MindGraph {
1558
1627
  score: number;
1559
1628
  }>;
1560
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
+ }>;
1561
1661
  linkDomainObjects(req: LinkDomainObjectsRequest): Promise<{
1562
1662
  edge_uid: string;
1563
1663
  }>;
@@ -1566,4 +1666,4 @@ declare class MindGraph {
1566
1666
  }>;
1567
1667
  }
1568
1668
 
1569
- 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
@@ -812,6 +812,24 @@ var MindGraph = class {
812
812
  async searchDomainObjects(query, opts) {
813
813
  return this.post("/ontology/objects/search", { query, ...opts ?? {} });
814
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
+ }
815
833
  async linkDomainObjects(req) {
816
834
  return this.post("/ontology/relation", { action: "create", ...req });
817
835
  }
package/dist/index.mjs CHANGED
@@ -785,6 +785,24 @@ var MindGraph = class {
785
785
  async searchDomainObjects(query, opts) {
786
786
  return this.post("/ontology/objects/search", { query, ...opts ?? {} });
787
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
+ }
788
806
  async linkDomainObjects(req) {
789
807
  return this.post("/ontology/relation", { action: "create", ...req });
790
808
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph",
3
- "version": "0.10.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",