mindgraph 0.10.0 → 0.12.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/README.md CHANGED
@@ -88,6 +88,7 @@ const entity = await graph.findOrCreateEntity("Some Entity");
88
88
  |--------|-------------|
89
89
  | `commit(req)` | Create a goal, project, or milestone |
90
90
  | `deliberate(req)` | Open decisions, add options/constraints, resolve decisions |
91
+ | `resolveDecision(decisionUid, optionUid, opts)` | Resolve with optional dated context and session/retrieval-trace linkage |
91
92
 
92
93
  ### Action Layer
93
94
 
@@ -102,7 +103,7 @@ const entity = await graph.findOrCreateEntity("Some Entity");
102
103
  |--------|-------------|
103
104
  | `session(req)` | Open a session, record traces, or close a session |
104
105
  | `journal(label, props, options?)` | Record a journal entry linked to an optional session |
105
- | `distill(req)` | Create a summary that distills multiple source nodes |
106
+ | `distill(req)` | Create a Summary (default) or Lesson with source provenance |
106
107
  | `memoryConfig(req)` | Set/get preferences and memory policies |
107
108
 
108
109
  ### Agent Layer
@@ -184,7 +185,7 @@ See the [Operational Ontology](https://mindgraph.cloud/docs/ontology) and [Conne
184
185
  | `ingestChunk(req)` | Ingest a single text chunk (sync): stores, embeds, and runs LLM extraction |
185
186
  | `ingestDocument(req)` | Ingest a full document (async): chunks text, returns job ID |
186
187
  | `ingestSession(req)` | Ingest a session transcript (async): links to session, returns job ID |
187
- | `retrieveContext(req)` | Retrieve semantically matched chunks + connected graph nodes/edges |
188
+ | `retrieveContext(req)` | Direct retrieval plus optional cheapest-first graph expansion (`graph_expansion_limit`, `graph_max_depth`) |
188
189
  | `getJob(id)` | Get async job status and progress |
189
190
  | `clearGraph()` | Clear all graph data |
190
191
 
@@ -200,7 +201,7 @@ See the [Operational Ontology](https://mindgraph.cloud/docs/ontology) and [Conne
200
201
  | Method | Description |
201
202
  |--------|-------------|
202
203
  | `retrieve(req)` | Unified retrieval: text search, active goals, open questions, weak claims |
203
- | `traverse(req)` | Graph traversal: chain, neighborhood, path, or subgraph |
204
+ | `traverse(req)` | Budgeted min-cost traversal; `depth` is the selected witness hop count |
204
205
  | `evolve(req)` | Lifecycle mutations: update, tombstone, restore, decay, history |
205
206
 
206
207
  ### Health & Stats
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
@@ -60,6 +72,25 @@ interface MergeCandidate {
60
72
  similarity: number | null;
61
73
  /** How the candidate was found: "exact" | "fuzzy" | "semantic" | "llm". */
62
74
  method: string | null;
75
+ /**
76
+ * Normalized `truth_status` of each side (Claims), so curation UIs can
77
+ * warn before merging a refuted claim. Absent on servers older than the
78
+ * hardening batch.
79
+ */
80
+ node_a_truth_status?: string | null;
81
+ node_b_truth_status?: string | null;
82
+ }
83
+ /** A derived statement awaiting review after a load-bearing premise changed. */
84
+ interface StaleDerivation {
85
+ invalidation_uid: string;
86
+ invalidator_uid: string;
87
+ invalidator_label: string;
88
+ node_uid: string;
89
+ node_label: string;
90
+ node_summary: string;
91
+ node_type: string;
92
+ reason: string | null;
93
+ invalidated_at: string | null;
63
94
  }
64
95
  /** A `/retrieve` hybrid result: the full node plus the fused RRF score. */
65
96
  interface HybridSearchResult {
@@ -87,11 +118,10 @@ interface PathStep {
87
118
  edge_type: string | null;
88
119
  depth: number;
89
120
  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. */
121
+ /** Min-plus cost of the selected cheapest path from the start node
122
+ * (sum of -ln(weight), weights clamped to (1e-9, 1]). */
93
123
  path_cost?: number;
94
- /** Product of edge confidences along the returned BFS path (clamped to
124
+ /** Product of edge confidences along the selected min-cost path (clamped to
95
125
  * (1e-9, 1]); a ranking signal, not a calibrated probability. 1 at the
96
126
  * start node. */
97
127
  path_confidence?: number;
@@ -259,6 +289,12 @@ interface DeliberationRequest {
259
289
  chosen_option_uid?: string;
260
290
  blocks_uid?: string;
261
291
  informs_uid?: string[];
292
+ /** ISO 8601 date when resolve-time context was available. */
293
+ as_of_date?: string;
294
+ /** Session whose retrieval context informed the resolution. */
295
+ session_id?: string;
296
+ /** Optional identifier of the decision-time retrieval trace. */
297
+ retrieval_trace_id?: string;
262
298
  props?: Record<string, unknown>;
263
299
  agent_id?: string;
264
300
  }
@@ -299,6 +335,8 @@ interface SessionRequest {
299
335
  }
300
336
  interface DistillRequest {
301
337
  label: string;
338
+ /** Defaults to "summary" for backward compatibility. */
339
+ output_type?: "summary" | "lesson";
302
340
  summary?: string;
303
341
  confidence?: number;
304
342
  salience?: number;
@@ -365,7 +403,7 @@ interface RetrieveRequest {
365
403
  * Retrieval action. Note: `"semantic"` requires a configured embedding
366
404
  * provider on the server; for semantic search use `retrieveContext()` instead.
367
405
  */
368
- action: "text" | "semantic" | "hybrid" | "active_goals" | "open_questions" | "weak_claims" | "pending_approvals" | "unresolved_contradictions" | "preferences" | "layer" | "recent";
406
+ action: "text" | "semantic" | "hybrid" | "active_goals" | "open_questions" | "weak_claims" | "pending_approvals" | "unresolved_contradictions" | "stale_derivations" | "preferences" | "layer" | "recent";
369
407
  /**
370
408
  * Required for `"text"`, `"semantic"`, `"hybrid"`. Optional for
371
409
  * `"preferences"`: with a `query` you get topic-relevant preferences (the
@@ -401,6 +439,12 @@ interface RetrieveRequest {
401
439
  * timestamp (seconds). Filters by INGESTION time, not event time.
402
440
  */
403
441
  created_before?: number;
442
+ /**
443
+ * When true (`text`/`semantic`/`hybrid`), annotate each result's `node` with
444
+ * `source_documents` (`[{uid, title, ingested_by_name?, occurred_at?}]`) —
445
+ * provenance for citing "which teammate's notes" (D3). Requires server ≥ 1.8.0.
446
+ */
447
+ include_sources?: boolean;
404
448
  }
405
449
  interface TraverseRequest {
406
450
  action: "chain" | "neighborhood" | "path" | "subgraph" | "top_k_paths";
@@ -409,7 +453,12 @@ interface TraverseRequest {
409
453
  max_depth?: number;
410
454
  direction?: "outgoing" | "incoming" | "both";
411
455
  edge_types?: string[];
456
+ exclude_edge_types?: string[];
412
457
  weight_threshold?: number;
458
+ /** Include ingestion/provenance edges excluded by default. */
459
+ include_provenance?: boolean;
460
+ /** Global distinct-node budget, including the seed (default 500). */
461
+ max_nodes?: number;
413
462
  /** `top_k_paths` only: number of cheapest paths to return (default 3, cap 25). */
414
463
  k?: number;
415
464
  /** `top_k_paths` only: max edges per path (default 8, cap 16). */
@@ -443,6 +492,16 @@ interface PageOffset {
443
492
  page: number;
444
493
  char_start: number;
445
494
  }
495
+ /**
496
+ * A named participant in a conversation/transcript. Supplied at ingest so
497
+ * extraction can map generic speaker labels ("Interviewer:") to real people
498
+ * and attribute claims/preferences/demands to the named person.
499
+ */
500
+ interface Participant {
501
+ name: string;
502
+ organization?: string;
503
+ role?: string;
504
+ }
446
505
  interface IngestChunkRequest {
447
506
  content: string;
448
507
  chunk_type?: string;
@@ -451,6 +510,12 @@ interface IngestChunkRequest {
451
510
  label?: string;
452
511
  layers?: string[];
453
512
  agent_id?: string;
513
+ /**
514
+ * Optional ontology schema id. When set, the per-chunk ontology extraction
515
+ * pass runs inline after cognitive extraction and submits proposed domain
516
+ * objects/relations. Presence alone triggers it.
517
+ */
518
+ ontology_schema_id?: string;
454
519
  }
455
520
  interface IngestChunkResponse {
456
521
  chunk_uid: string;
@@ -489,6 +554,18 @@ interface IngestDocumentRequest {
489
554
  mime_type?: string;
490
555
  /** Re-ingest even if a document with the same content was already ingested. */
491
556
  force_reingest?: boolean;
557
+ /**
558
+ * Optional ontology schema id. When set, the ontology extraction pass runs
559
+ * after cognitive passes. Presence alone triggers it (no `"ontology"` layer
560
+ * required), so auto-classified documents still get typed extraction.
561
+ */
562
+ ontology_schema_id?: string;
563
+ /** Named conversation participants — maps speaker labels to real people. */
564
+ participants?: Participant[];
565
+ /** When the document/conversation occurred (ISO-8601, imprecision ok). */
566
+ occurred_at?: string;
567
+ /** Free-text context grounding attribution during extraction. */
568
+ context?: string;
492
569
  }
493
570
  interface IngestDocumentResponse {
494
571
  job_id: string;
@@ -504,6 +581,14 @@ interface IngestSessionRequest {
504
581
  chunk_overlap?: number;
505
582
  layers?: string[];
506
583
  agent_id?: string;
584
+ /** Optional ontology schema id — triggers the ontology post-pass over the transcript's chunks. */
585
+ ontology_schema_id?: string;
586
+ /** Named conversation participants — maps speaker labels to real people. */
587
+ participants?: Participant[];
588
+ /** When the conversation occurred (ISO-8601, imprecision ok). */
589
+ occurred_at?: string;
590
+ /** Free-text context grounding attribution during extraction. */
591
+ context?: string;
507
592
  }
508
593
  interface RetrieveContextRequest {
509
594
  query: string;
@@ -517,6 +602,11 @@ interface RetrieveContextRequest {
517
602
  layer?: string;
518
603
  include_graph?: boolean;
519
604
  min_similarity?: number;
605
+ /** Reserve up to this many node slots for cheapest-first graph expansion.
606
+ * Default 0 preserves direct-only retrieval. */
607
+ graph_expansion_limit?: number;
608
+ /** Maximum graph-expansion hops (default 2). */
609
+ graph_max_depth?: number;
520
610
  /**
521
611
  * M3 as-of (valid time): ISO-8601 date to judge validity windows against.
522
612
  * Windowed nodes then carry `valid_at_time` instead of `currently_valid`.
@@ -593,6 +683,10 @@ interface RetrieveContextResponse {
593
683
  source_documents?: {
594
684
  uid: string;
595
685
  title: string;
686
+ /** User id of the teammate who ingested the source document (A4). */
687
+ ingested_by?: string;
688
+ /** Display name (else email) of the ingesting teammate. */
689
+ ingested_by_name?: string;
596
690
  }[];
597
691
  source_chunks?: SourceChunk[];
598
692
  believed_by?: BelievedBy[];
@@ -608,6 +702,11 @@ interface RetrieveContextResponse {
608
702
  currently_valid?: boolean;
609
703
  /** As-of variant of `currently_valid` when the request set `valid_at`. */
610
704
  valid_at_time?: boolean;
705
+ /** Present when the node was added by budgeted graph expansion. */
706
+ retrieval_origin?: "graph_expansion";
707
+ retrieval_path_cost?: number;
708
+ retrieval_depth?: number;
709
+ retrieval_parent_uid?: string | null;
611
710
  })[];
612
711
  edges: Record<string, unknown>[];
613
712
  };
@@ -775,6 +874,125 @@ interface MindGraphConfig {
775
874
  /** Initial backoff in ms before first retry. Doubles each attempt. Default: 1000. */
776
875
  retryBackoffMs?: number;
777
876
  }
877
+ /** Schema-level behavior for compiled semantic-match diagnostics. */
878
+ type SemanticValidationMode = "off" | "advisory" | "review" | "strict";
879
+ /** Validation modes accepted by the M5.1 schema update endpoint. */
880
+ type SemanticValidationAuthoringMode = "off" | "advisory";
881
+ /** The six storage/runtime behaviors supported by semantic profile v1. */
882
+ type SemanticRuntimeTemplate = "entity" | "dependent_entity" | "collective" | "relationship_object" | "event" | "observation";
883
+ /** Optional orthogonal classifications that do not introduce storage layouts. */
884
+ type SemanticModifier = "role" | "phase" | "social_construct";
885
+ type OntologicalBaseKind = "kind" | "subkind" | "dependent_particular" | "collective" | "relator" | "event" | "quality" | "unspecified";
886
+ type SemanticRigidity = "rigid" | "anti_rigid" | "unspecified";
887
+ type SemanticIdentityMode = "provided" | "inherited" | "derived" | "unspecified";
888
+ type SemanticDependence = "independent" | "bearer" | "external" | "unspecified";
889
+ type SemanticTemporalMode = "persistent" | "interval" | "occurrence" | "observation_time" | "unspecified";
890
+ type SemanticMatchStatus = "candidate" | "accepted" | "rejected" | "superseded";
891
+ type SemanticEvidenceSourceKind = "corpus_span" | "declared_structure" | "sql_metadata" | "graph_usage" | "human_review" | "llm_classification";
892
+ type SemanticSignalKind = "own_identity" | "borrowed_identity" | "host_attachment" | "participant_count" | "membership_relation" | "occurs_at" | "observed_at" | "externally_assigned" | "lifecycle_stage" | "institutionally_defined" | "relation_endpoints";
893
+ type ParticipantSlotKind = "bearer" | "player" | "context" | "subject" | "source" | "participant" | "member" | "observed_entity" | "base_type";
894
+ /** A typed participant requirement resolved against the containing schema version. */
895
+ interface SemanticParticipantSlot {
896
+ name: string;
897
+ template_slot: ParticipantSlotKind;
898
+ object_types?: string[];
899
+ min?: number;
900
+ max?: number;
901
+ relation_type?: string;
902
+ }
903
+ type FieldSemanticKind = "phase_indicator" | "role_indicator" | "internal_disposition" | "event_time" | "observed_at" | "source_wording";
904
+ /** Typed meaning for a concrete object field; prose is never compiled. */
905
+ interface FieldSemantic {
906
+ field: string;
907
+ semantic: FieldSemanticKind;
908
+ temporal_mode?: SemanticTemporalMode;
909
+ lossy?: boolean;
910
+ }
911
+ type NormativeKind = "need" | "constraint" | "obligation" | "preference" | "unspecified";
912
+ type CanonicalAttachmentAuthority = "relation" | "reference_field";
913
+ type CanonicalAttachmentDirection = "outgoing" | "incoming";
914
+ /** Declares which of a relation/reference-field pair owns an attachment fact. */
915
+ interface CanonicalAttachmentBinding {
916
+ slot: string;
917
+ relation_type: string;
918
+ reference_field?: string;
919
+ authority: CanonicalAttachmentAuthority;
920
+ direction: CanonicalAttachmentDirection;
921
+ }
922
+ /** Pins a match to one immutable global archetype template version. */
923
+ interface SemanticTemplateRef {
924
+ id: string;
925
+ version: number;
926
+ }
927
+ interface SemanticEvidenceRef {
928
+ id: string;
929
+ source_kind: SemanticEvidenceSourceKind;
930
+ source_ref: string;
931
+ asserted_by?: string;
932
+ asserted_at?: string;
933
+ }
934
+ interface SemanticGeneratorRef {
935
+ id: string;
936
+ version: number;
937
+ proposal_ref?: string;
938
+ }
939
+ interface SemanticSignal {
940
+ signal: SemanticSignalKind;
941
+ value: boolean | number | string;
942
+ evidence_ref: SemanticEvidenceRef;
943
+ generator?: SemanticGeneratorRef;
944
+ confidence: number;
945
+ observed_at?: string;
946
+ }
947
+ interface SemanticNegativeControl {
948
+ template: SemanticTemplateRef;
949
+ reason: string;
950
+ }
951
+ interface SemanticMatchAlternative {
952
+ template: SemanticTemplateRef;
953
+ confidence: number;
954
+ reason: string;
955
+ evidence?: SemanticSignal[];
956
+ }
957
+ interface SemanticModifierMatch {
958
+ template: SemanticTemplateRef;
959
+ evidence: SemanticSignal[];
960
+ negative_control: SemanticNegativeControl;
961
+ }
962
+ interface SemanticReviewDecision {
963
+ actor: string;
964
+ decided_at: string;
965
+ rationale: string;
966
+ premises?: string[];
967
+ supersedes?: string;
968
+ }
969
+ interface SemanticTenantBindings {
970
+ ontological_base_kind?: OntologicalBaseKind;
971
+ rigidity?: SemanticRigidity;
972
+ identity_mode?: SemanticIdentityMode;
973
+ dependence?: SemanticDependence;
974
+ temporal_mode?: SemanticTemporalMode;
975
+ slots?: SemanticParticipantSlot[];
976
+ fields?: FieldSemantic[];
977
+ normative_kind?: NormativeKind;
978
+ attachments?: CanonicalAttachmentBinding[];
979
+ }
980
+ type SemanticRelationKind = "association" | "mediation" | "participation" | "membership" | "characterization" | "part_whole" | "derivation" | "classification" | "unspecified";
981
+ /** Unified evidence-backed classification for object and relation types. */
982
+ interface SemanticMatch {
983
+ version: number;
984
+ template: SemanticTemplateRef;
985
+ modifiers?: SemanticModifierMatch[];
986
+ status: SemanticMatchStatus;
987
+ evidence: SemanticSignal[];
988
+ negative_control: SemanticNegativeControl;
989
+ alternatives?: SemanticMatchAlternative[];
990
+ bindings?: SemanticTenantBindings;
991
+ confidence: number;
992
+ rationale: string;
993
+ proposed_by?: SemanticGeneratorRef[];
994
+ decision?: SemanticReviewDecision;
995
+ }
778
996
  /** Field schema entry inside `OntologyObjectType.fields_json`. */
779
997
  interface FieldDefinition {
780
998
  name: string;
@@ -852,6 +1070,12 @@ interface OntologySchema {
852
1070
  description?: string;
853
1071
  status: "draft" | "active" | "deprecated" | "archived";
854
1072
  version: number;
1073
+ /**
1074
+ * Advisory semantic-profile validation is opt-in per schema. Optional so the
1075
+ * SDK tolerates servers that predate the field (the server itself defaults
1076
+ * absent rows to "off").
1077
+ */
1078
+ semantic_validation_mode?: SemanticValidationMode;
855
1079
  propose_status?: "pending" | "running" | "ready" | "failed" | null;
856
1080
  propose_job_id?: string | null;
857
1081
  propose_error?: string | null;
@@ -877,6 +1101,8 @@ interface OntologyObjectType {
877
1101
  extraction_hints?: string | null;
878
1102
  default_confidence: number;
879
1103
  review_policy: "always" | "low_confidence" | "never";
1104
+ /** Accepted semantic match. Candidates remain in the proposal ledger. */
1105
+ semantic_match?: SemanticMatch | null;
880
1106
  /** Datasource binding (null = extracted/authored). */
881
1107
  backing?: ObjectBacking | null;
882
1108
  status: "active" | "deprecated" | "archived";
@@ -899,7 +1125,10 @@ interface OntologyRelationType {
899
1125
  inverse_relation_type?: string | null;
900
1126
  fields_json: FieldDefinition[];
901
1127
  extraction_hints?: string | null;
1128
+ default_confidence: number;
902
1129
  review_policy: "always" | "low_confidence" | "never";
1130
+ /** Accepted relation match. Candidates remain in the proposal ledger. */
1131
+ semantic_match?: SemanticMatch | null;
903
1132
  /** Datasource binding (null = extracted/authored). */
904
1133
  backing?: RelationBacking | null;
905
1134
  status: "active" | "deprecated" | "archived";
@@ -928,6 +1157,7 @@ interface CreateOntologySchemaRequest {
928
1157
  interface UpdateOntologySchemaRequest {
929
1158
  name?: string;
930
1159
  description?: string;
1160
+ semantic_validation_mode?: SemanticValidationAuthoringMode;
931
1161
  }
932
1162
  interface OntologyObjectTypeInput {
933
1163
  name: string;
@@ -941,6 +1171,8 @@ interface OntologyObjectTypeInput {
941
1171
  extraction_hints?: string;
942
1172
  default_confidence?: number;
943
1173
  review_policy?: "always" | "low_confidence" | "never";
1174
+ /** Add, replace, or clear the object's accepted semantic match. */
1175
+ semantic_match?: SemanticMatch | null;
944
1176
  /** Bind this object type to an external source (SQL). Omit for extracted/authored. */
945
1177
  backing?: ObjectBacking | null;
946
1178
  }
@@ -956,7 +1188,10 @@ interface OntologyRelationTypeInput {
956
1188
  inverse_relation_type?: string;
957
1189
  fields?: FieldDefinition[];
958
1190
  extraction_hints?: string;
1191
+ default_confidence?: number;
959
1192
  review_policy?: "always" | "low_confidence" | "never";
1193
+ /** Add, replace, or clear the relation's accepted semantic match. */
1194
+ semantic_match?: SemanticMatch | null;
960
1195
  /** Bind this relation to an FK column or M:M join table. Both endpoints must be sql-mapped. */
961
1196
  backing?: RelationBacking | null;
962
1197
  }
@@ -967,6 +1202,8 @@ interface OntologyProposal {
967
1202
  schema_id: string;
968
1203
  proposal_type: string;
969
1204
  proposed_by_agent_id?: string | null;
1205
+ proposed_by_user_id?: string | null;
1206
+ extract_job_id?: string | null;
970
1207
  source_uids: string[];
971
1208
  source_scope_ids: string[];
972
1209
  changes_json: {
@@ -991,6 +1228,34 @@ interface OntologyProposal {
991
1228
  resolved_at?: string | null;
992
1229
  resolved_by?: string | null;
993
1230
  }
1231
+ interface OntologyDuplicateAudit {
1232
+ schema_id: string;
1233
+ object_groups: Array<{
1234
+ object_type: string;
1235
+ identity_hash: string;
1236
+ canonical_uid: string;
1237
+ members: Array<{
1238
+ uid: string;
1239
+ label: string;
1240
+ source_uids: string[];
1241
+ }>;
1242
+ conflicting_fields: string[];
1243
+ affected_edges: number;
1244
+ auto_merge_safe: boolean;
1245
+ }>;
1246
+ relation_groups: Array<{
1247
+ relation_type: string;
1248
+ identity_hash: string;
1249
+ canonical_uid: string;
1250
+ edge_uids: string[];
1251
+ from_uid: string;
1252
+ to_uid: string;
1253
+ auto_merge_safe: boolean;
1254
+ }>;
1255
+ objects_without_deterministic_identity: number;
1256
+ context_ambiguous_objects: number;
1257
+ repeatable_relations_skipped: number;
1258
+ }
994
1259
  interface ProposalEdits {
995
1260
  canonical_name?: string;
996
1261
  fields?: Record<string, unknown>;
@@ -1046,6 +1311,17 @@ interface LinkDomainObjectsRequest {
1046
1311
  confidence?: number;
1047
1312
  agent_id?: string;
1048
1313
  }
1314
+ interface CreateDomainObjectRequest {
1315
+ schema_id: string;
1316
+ object_type: string;
1317
+ canonical_name: string;
1318
+ fields?: Record<string, unknown>;
1319
+ aliases?: string[];
1320
+ identity?: Record<string, unknown>;
1321
+ confidence?: number;
1322
+ /** Skip the same-type + same-name duplicate guard (default false). */
1323
+ allow_duplicate?: boolean;
1324
+ }
1049
1325
  interface ExtractOntologyRequest {
1050
1326
  ontology_schema_id: string;
1051
1327
  source_uids: string[];
@@ -1166,6 +1442,11 @@ declare class MindGraph {
1166
1442
  */
1167
1443
  resolveDecision(decisionUid: string, chosenOptionUid: string, opts?: {
1168
1444
  summary?: string;
1445
+ props?: Record<string, unknown>;
1446
+ informs_uid?: string[];
1447
+ as_of_date?: string;
1448
+ session_id?: string;
1449
+ retrieval_trace_id?: string;
1169
1450
  agent_id?: string;
1170
1451
  }): Promise<unknown>;
1171
1452
  procedure(req: ProcedureRequest): Promise<unknown>;
@@ -1372,6 +1653,8 @@ declare class MindGraph {
1372
1653
  * merge/dismiss decision (server >= 1.3).
1373
1654
  */
1374
1655
  getMergeCandidates(): Promise<MergeCandidate[]>;
1656
+ /** Load-bearing conclusions awaiting repair after a premise changed. */
1657
+ getStaleDerivations(limit?: number, offset?: number): Promise<StaleDerivation[]>;
1375
1658
  getPendingApprovals(): Promise<GraphNode[]>;
1376
1659
  ingestChunk(req: IngestChunkRequest): Promise<IngestChunkResponse>;
1377
1660
  ingestDocument(req: IngestDocumentRequest): Promise<IngestDocumentResponse>;
@@ -1477,10 +1760,18 @@ declare class MindGraph {
1477
1760
  addOntologyRelationType(schemaId: string, req: OntologyRelationTypeInput): Promise<OntologyRelationType>;
1478
1761
  updateOntologyRelationType(schemaId: string, typeId: string, req: Partial<OntologyRelationTypeInput>): Promise<OntologyRelationType>;
1479
1762
  deleteOntologyRelationType(schemaId: string, typeId: string): Promise<OntologyRelationType>;
1763
+ /** Generate inert semantic classifications for individual human review. */
1764
+ analyzeOntologySemanticGuidance(schemaId: string): Promise<{
1765
+ created: number;
1766
+ }>;
1767
+ /** Read-only exact-identity collision audit; never merges graph data. */
1768
+ auditOntologyDuplicates(schemaId: string): Promise<OntologyDuplicateAudit>;
1480
1769
  listOntologyProposals(opts?: {
1481
1770
  status?: string;
1482
1771
  schema_id?: string;
1483
1772
  object_type?: string;
1773
+ proposal_type?: string;
1774
+ extract_job_id?: string;
1484
1775
  limit?: number;
1485
1776
  offset?: number;
1486
1777
  }): Promise<{
@@ -1558,6 +1849,37 @@ declare class MindGraph {
1558
1849
  score: number;
1559
1850
  }>;
1560
1851
  }>;
1852
+ /**
1853
+ * Per-object-type coverage stats for a schema (C2f): field fill rates
1854
+ * (with a `near_empty` flag < 5%) and identity collisions, over a bounded
1855
+ * per-type sample (default 500, max 2000).
1856
+ */
1857
+ ontologyStats(schemaId: string, sample?: number): Promise<{
1858
+ schema_id: string;
1859
+ object_types: Array<{
1860
+ object_type: string;
1861
+ count: number;
1862
+ sampled: boolean;
1863
+ fields: Array<{
1864
+ name: string;
1865
+ fill_rate: number;
1866
+ near_empty: boolean;
1867
+ }>;
1868
+ collisions: Array<{
1869
+ identity: string;
1870
+ uids: string[];
1871
+ }>;
1872
+ }>;
1873
+ }>;
1874
+ /**
1875
+ * Create a domain object by hand (auto-approved). Returns the created node
1876
+ * uid + the audit proposal id. Throws 409 if an object of the same type +
1877
+ * canonical_name already exists, unless `allow_duplicate` is set.
1878
+ */
1879
+ createDomainObject(req: CreateDomainObjectRequest): Promise<{
1880
+ uid: string;
1881
+ proposal_id: string;
1882
+ }>;
1561
1883
  linkDomainObjects(req: LinkDomainObjectsRequest): Promise<{
1562
1884
  edge_uid: string;
1563
1885
  }>;
@@ -1566,4 +1888,4 @@ declare class MindGraph {
1566
1888
  }>;
1567
1889
  }
1568
1890
 
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 };
1891
+ export { type AnalogyCandidate, type ArgumentRequest, type ArticleResult, type BatchRequest, type BelievedBy, type CanonicalAttachmentAuthority, type CanonicalAttachmentBinding, type CanonicalAttachmentDirection, type CaptureRequest, type ClaimHub, type ClearResponse, type ClusterClaimSample, type ClusteredClaimHub, type CommitmentRequest, type ConceptCluster, type CreateOntologySchemaRequest, 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 FieldDefinition, type FieldSemantic, type FieldSemanticKind, 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 NormativeKind, type ObjectBacking, type OntologicalBaseKind, type OntologyDuplicateAudit, type OntologyObjectType, type OntologyObjectTypeInput, type OntologyProposal, type OntologyRelationType, type OntologyRelationTypeInput, type OntologySchema, type OntologySchemaDetail, type OrganizationProps, type Participant, type ParticipantSlotKind, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type ProposalEdits, type PurgeRequest, type RankedClaimHub, type RelationBacking, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SemanticDependence, type SemanticEvidenceRef, type SemanticEvidenceSourceKind, type SemanticGeneratorRef, type SemanticIdentityMode, type SemanticMatch, type SemanticMatchAlternative, type SemanticMatchStatus, type SemanticModifier, type SemanticModifierMatch, type SemanticNegativeControl, type SemanticParticipantSlot, type SemanticRelationKind, type SemanticReviewDecision, type SemanticRigidity, type SemanticRuntimeTemplate, type SemanticSignal, type SemanticSignalKind, type SemanticTemplateRef, type SemanticTemporalMode, type SemanticTenantBindings, type SemanticValidationAuthoringMode, type SemanticValidationMode, type SessionRequest, type SignalsQuery, type SignalsResponse, type SourceChunk, type StructureRequest, type SynthesisJobResponse, type TextSelector, type TheorySupportGap, type TraverseRequest, type UpdateOntologySchemaRequest };
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
@@ -60,6 +72,25 @@ interface MergeCandidate {
60
72
  similarity: number | null;
61
73
  /** How the candidate was found: "exact" | "fuzzy" | "semantic" | "llm". */
62
74
  method: string | null;
75
+ /**
76
+ * Normalized `truth_status` of each side (Claims), so curation UIs can
77
+ * warn before merging a refuted claim. Absent on servers older than the
78
+ * hardening batch.
79
+ */
80
+ node_a_truth_status?: string | null;
81
+ node_b_truth_status?: string | null;
82
+ }
83
+ /** A derived statement awaiting review after a load-bearing premise changed. */
84
+ interface StaleDerivation {
85
+ invalidation_uid: string;
86
+ invalidator_uid: string;
87
+ invalidator_label: string;
88
+ node_uid: string;
89
+ node_label: string;
90
+ node_summary: string;
91
+ node_type: string;
92
+ reason: string | null;
93
+ invalidated_at: string | null;
63
94
  }
64
95
  /** A `/retrieve` hybrid result: the full node plus the fused RRF score. */
65
96
  interface HybridSearchResult {
@@ -87,11 +118,10 @@ interface PathStep {
87
118
  edge_type: string | null;
88
119
  depth: number;
89
120
  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. */
121
+ /** Min-plus cost of the selected cheapest path from the start node
122
+ * (sum of -ln(weight), weights clamped to (1e-9, 1]). */
93
123
  path_cost?: number;
94
- /** Product of edge confidences along the returned BFS path (clamped to
124
+ /** Product of edge confidences along the selected min-cost path (clamped to
95
125
  * (1e-9, 1]); a ranking signal, not a calibrated probability. 1 at the
96
126
  * start node. */
97
127
  path_confidence?: number;
@@ -259,6 +289,12 @@ interface DeliberationRequest {
259
289
  chosen_option_uid?: string;
260
290
  blocks_uid?: string;
261
291
  informs_uid?: string[];
292
+ /** ISO 8601 date when resolve-time context was available. */
293
+ as_of_date?: string;
294
+ /** Session whose retrieval context informed the resolution. */
295
+ session_id?: string;
296
+ /** Optional identifier of the decision-time retrieval trace. */
297
+ retrieval_trace_id?: string;
262
298
  props?: Record<string, unknown>;
263
299
  agent_id?: string;
264
300
  }
@@ -299,6 +335,8 @@ interface SessionRequest {
299
335
  }
300
336
  interface DistillRequest {
301
337
  label: string;
338
+ /** Defaults to "summary" for backward compatibility. */
339
+ output_type?: "summary" | "lesson";
302
340
  summary?: string;
303
341
  confidence?: number;
304
342
  salience?: number;
@@ -365,7 +403,7 @@ interface RetrieveRequest {
365
403
  * Retrieval action. Note: `"semantic"` requires a configured embedding
366
404
  * provider on the server; for semantic search use `retrieveContext()` instead.
367
405
  */
368
- action: "text" | "semantic" | "hybrid" | "active_goals" | "open_questions" | "weak_claims" | "pending_approvals" | "unresolved_contradictions" | "preferences" | "layer" | "recent";
406
+ action: "text" | "semantic" | "hybrid" | "active_goals" | "open_questions" | "weak_claims" | "pending_approvals" | "unresolved_contradictions" | "stale_derivations" | "preferences" | "layer" | "recent";
369
407
  /**
370
408
  * Required for `"text"`, `"semantic"`, `"hybrid"`. Optional for
371
409
  * `"preferences"`: with a `query` you get topic-relevant preferences (the
@@ -401,6 +439,12 @@ interface RetrieveRequest {
401
439
  * timestamp (seconds). Filters by INGESTION time, not event time.
402
440
  */
403
441
  created_before?: number;
442
+ /**
443
+ * When true (`text`/`semantic`/`hybrid`), annotate each result's `node` with
444
+ * `source_documents` (`[{uid, title, ingested_by_name?, occurred_at?}]`) —
445
+ * provenance for citing "which teammate's notes" (D3). Requires server ≥ 1.8.0.
446
+ */
447
+ include_sources?: boolean;
404
448
  }
405
449
  interface TraverseRequest {
406
450
  action: "chain" | "neighborhood" | "path" | "subgraph" | "top_k_paths";
@@ -409,7 +453,12 @@ interface TraverseRequest {
409
453
  max_depth?: number;
410
454
  direction?: "outgoing" | "incoming" | "both";
411
455
  edge_types?: string[];
456
+ exclude_edge_types?: string[];
412
457
  weight_threshold?: number;
458
+ /** Include ingestion/provenance edges excluded by default. */
459
+ include_provenance?: boolean;
460
+ /** Global distinct-node budget, including the seed (default 500). */
461
+ max_nodes?: number;
413
462
  /** `top_k_paths` only: number of cheapest paths to return (default 3, cap 25). */
414
463
  k?: number;
415
464
  /** `top_k_paths` only: max edges per path (default 8, cap 16). */
@@ -443,6 +492,16 @@ interface PageOffset {
443
492
  page: number;
444
493
  char_start: number;
445
494
  }
495
+ /**
496
+ * A named participant in a conversation/transcript. Supplied at ingest so
497
+ * extraction can map generic speaker labels ("Interviewer:") to real people
498
+ * and attribute claims/preferences/demands to the named person.
499
+ */
500
+ interface Participant {
501
+ name: string;
502
+ organization?: string;
503
+ role?: string;
504
+ }
446
505
  interface IngestChunkRequest {
447
506
  content: string;
448
507
  chunk_type?: string;
@@ -451,6 +510,12 @@ interface IngestChunkRequest {
451
510
  label?: string;
452
511
  layers?: string[];
453
512
  agent_id?: string;
513
+ /**
514
+ * Optional ontology schema id. When set, the per-chunk ontology extraction
515
+ * pass runs inline after cognitive extraction and submits proposed domain
516
+ * objects/relations. Presence alone triggers it.
517
+ */
518
+ ontology_schema_id?: string;
454
519
  }
455
520
  interface IngestChunkResponse {
456
521
  chunk_uid: string;
@@ -489,6 +554,18 @@ interface IngestDocumentRequest {
489
554
  mime_type?: string;
490
555
  /** Re-ingest even if a document with the same content was already ingested. */
491
556
  force_reingest?: boolean;
557
+ /**
558
+ * Optional ontology schema id. When set, the ontology extraction pass runs
559
+ * after cognitive passes. Presence alone triggers it (no `"ontology"` layer
560
+ * required), so auto-classified documents still get typed extraction.
561
+ */
562
+ ontology_schema_id?: string;
563
+ /** Named conversation participants — maps speaker labels to real people. */
564
+ participants?: Participant[];
565
+ /** When the document/conversation occurred (ISO-8601, imprecision ok). */
566
+ occurred_at?: string;
567
+ /** Free-text context grounding attribution during extraction. */
568
+ context?: string;
492
569
  }
493
570
  interface IngestDocumentResponse {
494
571
  job_id: string;
@@ -504,6 +581,14 @@ interface IngestSessionRequest {
504
581
  chunk_overlap?: number;
505
582
  layers?: string[];
506
583
  agent_id?: string;
584
+ /** Optional ontology schema id — triggers the ontology post-pass over the transcript's chunks. */
585
+ ontology_schema_id?: string;
586
+ /** Named conversation participants — maps speaker labels to real people. */
587
+ participants?: Participant[];
588
+ /** When the conversation occurred (ISO-8601, imprecision ok). */
589
+ occurred_at?: string;
590
+ /** Free-text context grounding attribution during extraction. */
591
+ context?: string;
507
592
  }
508
593
  interface RetrieveContextRequest {
509
594
  query: string;
@@ -517,6 +602,11 @@ interface RetrieveContextRequest {
517
602
  layer?: string;
518
603
  include_graph?: boolean;
519
604
  min_similarity?: number;
605
+ /** Reserve up to this many node slots for cheapest-first graph expansion.
606
+ * Default 0 preserves direct-only retrieval. */
607
+ graph_expansion_limit?: number;
608
+ /** Maximum graph-expansion hops (default 2). */
609
+ graph_max_depth?: number;
520
610
  /**
521
611
  * M3 as-of (valid time): ISO-8601 date to judge validity windows against.
522
612
  * Windowed nodes then carry `valid_at_time` instead of `currently_valid`.
@@ -593,6 +683,10 @@ interface RetrieveContextResponse {
593
683
  source_documents?: {
594
684
  uid: string;
595
685
  title: string;
686
+ /** User id of the teammate who ingested the source document (A4). */
687
+ ingested_by?: string;
688
+ /** Display name (else email) of the ingesting teammate. */
689
+ ingested_by_name?: string;
596
690
  }[];
597
691
  source_chunks?: SourceChunk[];
598
692
  believed_by?: BelievedBy[];
@@ -608,6 +702,11 @@ interface RetrieveContextResponse {
608
702
  currently_valid?: boolean;
609
703
  /** As-of variant of `currently_valid` when the request set `valid_at`. */
610
704
  valid_at_time?: boolean;
705
+ /** Present when the node was added by budgeted graph expansion. */
706
+ retrieval_origin?: "graph_expansion";
707
+ retrieval_path_cost?: number;
708
+ retrieval_depth?: number;
709
+ retrieval_parent_uid?: string | null;
611
710
  })[];
612
711
  edges: Record<string, unknown>[];
613
712
  };
@@ -775,6 +874,125 @@ interface MindGraphConfig {
775
874
  /** Initial backoff in ms before first retry. Doubles each attempt. Default: 1000. */
776
875
  retryBackoffMs?: number;
777
876
  }
877
+ /** Schema-level behavior for compiled semantic-match diagnostics. */
878
+ type SemanticValidationMode = "off" | "advisory" | "review" | "strict";
879
+ /** Validation modes accepted by the M5.1 schema update endpoint. */
880
+ type SemanticValidationAuthoringMode = "off" | "advisory";
881
+ /** The six storage/runtime behaviors supported by semantic profile v1. */
882
+ type SemanticRuntimeTemplate = "entity" | "dependent_entity" | "collective" | "relationship_object" | "event" | "observation";
883
+ /** Optional orthogonal classifications that do not introduce storage layouts. */
884
+ type SemanticModifier = "role" | "phase" | "social_construct";
885
+ type OntologicalBaseKind = "kind" | "subkind" | "dependent_particular" | "collective" | "relator" | "event" | "quality" | "unspecified";
886
+ type SemanticRigidity = "rigid" | "anti_rigid" | "unspecified";
887
+ type SemanticIdentityMode = "provided" | "inherited" | "derived" | "unspecified";
888
+ type SemanticDependence = "independent" | "bearer" | "external" | "unspecified";
889
+ type SemanticTemporalMode = "persistent" | "interval" | "occurrence" | "observation_time" | "unspecified";
890
+ type SemanticMatchStatus = "candidate" | "accepted" | "rejected" | "superseded";
891
+ type SemanticEvidenceSourceKind = "corpus_span" | "declared_structure" | "sql_metadata" | "graph_usage" | "human_review" | "llm_classification";
892
+ type SemanticSignalKind = "own_identity" | "borrowed_identity" | "host_attachment" | "participant_count" | "membership_relation" | "occurs_at" | "observed_at" | "externally_assigned" | "lifecycle_stage" | "institutionally_defined" | "relation_endpoints";
893
+ type ParticipantSlotKind = "bearer" | "player" | "context" | "subject" | "source" | "participant" | "member" | "observed_entity" | "base_type";
894
+ /** A typed participant requirement resolved against the containing schema version. */
895
+ interface SemanticParticipantSlot {
896
+ name: string;
897
+ template_slot: ParticipantSlotKind;
898
+ object_types?: string[];
899
+ min?: number;
900
+ max?: number;
901
+ relation_type?: string;
902
+ }
903
+ type FieldSemanticKind = "phase_indicator" | "role_indicator" | "internal_disposition" | "event_time" | "observed_at" | "source_wording";
904
+ /** Typed meaning for a concrete object field; prose is never compiled. */
905
+ interface FieldSemantic {
906
+ field: string;
907
+ semantic: FieldSemanticKind;
908
+ temporal_mode?: SemanticTemporalMode;
909
+ lossy?: boolean;
910
+ }
911
+ type NormativeKind = "need" | "constraint" | "obligation" | "preference" | "unspecified";
912
+ type CanonicalAttachmentAuthority = "relation" | "reference_field";
913
+ type CanonicalAttachmentDirection = "outgoing" | "incoming";
914
+ /** Declares which of a relation/reference-field pair owns an attachment fact. */
915
+ interface CanonicalAttachmentBinding {
916
+ slot: string;
917
+ relation_type: string;
918
+ reference_field?: string;
919
+ authority: CanonicalAttachmentAuthority;
920
+ direction: CanonicalAttachmentDirection;
921
+ }
922
+ /** Pins a match to one immutable global archetype template version. */
923
+ interface SemanticTemplateRef {
924
+ id: string;
925
+ version: number;
926
+ }
927
+ interface SemanticEvidenceRef {
928
+ id: string;
929
+ source_kind: SemanticEvidenceSourceKind;
930
+ source_ref: string;
931
+ asserted_by?: string;
932
+ asserted_at?: string;
933
+ }
934
+ interface SemanticGeneratorRef {
935
+ id: string;
936
+ version: number;
937
+ proposal_ref?: string;
938
+ }
939
+ interface SemanticSignal {
940
+ signal: SemanticSignalKind;
941
+ value: boolean | number | string;
942
+ evidence_ref: SemanticEvidenceRef;
943
+ generator?: SemanticGeneratorRef;
944
+ confidence: number;
945
+ observed_at?: string;
946
+ }
947
+ interface SemanticNegativeControl {
948
+ template: SemanticTemplateRef;
949
+ reason: string;
950
+ }
951
+ interface SemanticMatchAlternative {
952
+ template: SemanticTemplateRef;
953
+ confidence: number;
954
+ reason: string;
955
+ evidence?: SemanticSignal[];
956
+ }
957
+ interface SemanticModifierMatch {
958
+ template: SemanticTemplateRef;
959
+ evidence: SemanticSignal[];
960
+ negative_control: SemanticNegativeControl;
961
+ }
962
+ interface SemanticReviewDecision {
963
+ actor: string;
964
+ decided_at: string;
965
+ rationale: string;
966
+ premises?: string[];
967
+ supersedes?: string;
968
+ }
969
+ interface SemanticTenantBindings {
970
+ ontological_base_kind?: OntologicalBaseKind;
971
+ rigidity?: SemanticRigidity;
972
+ identity_mode?: SemanticIdentityMode;
973
+ dependence?: SemanticDependence;
974
+ temporal_mode?: SemanticTemporalMode;
975
+ slots?: SemanticParticipantSlot[];
976
+ fields?: FieldSemantic[];
977
+ normative_kind?: NormativeKind;
978
+ attachments?: CanonicalAttachmentBinding[];
979
+ }
980
+ type SemanticRelationKind = "association" | "mediation" | "participation" | "membership" | "characterization" | "part_whole" | "derivation" | "classification" | "unspecified";
981
+ /** Unified evidence-backed classification for object and relation types. */
982
+ interface SemanticMatch {
983
+ version: number;
984
+ template: SemanticTemplateRef;
985
+ modifiers?: SemanticModifierMatch[];
986
+ status: SemanticMatchStatus;
987
+ evidence: SemanticSignal[];
988
+ negative_control: SemanticNegativeControl;
989
+ alternatives?: SemanticMatchAlternative[];
990
+ bindings?: SemanticTenantBindings;
991
+ confidence: number;
992
+ rationale: string;
993
+ proposed_by?: SemanticGeneratorRef[];
994
+ decision?: SemanticReviewDecision;
995
+ }
778
996
  /** Field schema entry inside `OntologyObjectType.fields_json`. */
779
997
  interface FieldDefinition {
780
998
  name: string;
@@ -852,6 +1070,12 @@ interface OntologySchema {
852
1070
  description?: string;
853
1071
  status: "draft" | "active" | "deprecated" | "archived";
854
1072
  version: number;
1073
+ /**
1074
+ * Advisory semantic-profile validation is opt-in per schema. Optional so the
1075
+ * SDK tolerates servers that predate the field (the server itself defaults
1076
+ * absent rows to "off").
1077
+ */
1078
+ semantic_validation_mode?: SemanticValidationMode;
855
1079
  propose_status?: "pending" | "running" | "ready" | "failed" | null;
856
1080
  propose_job_id?: string | null;
857
1081
  propose_error?: string | null;
@@ -877,6 +1101,8 @@ interface OntologyObjectType {
877
1101
  extraction_hints?: string | null;
878
1102
  default_confidence: number;
879
1103
  review_policy: "always" | "low_confidence" | "never";
1104
+ /** Accepted semantic match. Candidates remain in the proposal ledger. */
1105
+ semantic_match?: SemanticMatch | null;
880
1106
  /** Datasource binding (null = extracted/authored). */
881
1107
  backing?: ObjectBacking | null;
882
1108
  status: "active" | "deprecated" | "archived";
@@ -899,7 +1125,10 @@ interface OntologyRelationType {
899
1125
  inverse_relation_type?: string | null;
900
1126
  fields_json: FieldDefinition[];
901
1127
  extraction_hints?: string | null;
1128
+ default_confidence: number;
902
1129
  review_policy: "always" | "low_confidence" | "never";
1130
+ /** Accepted relation match. Candidates remain in the proposal ledger. */
1131
+ semantic_match?: SemanticMatch | null;
903
1132
  /** Datasource binding (null = extracted/authored). */
904
1133
  backing?: RelationBacking | null;
905
1134
  status: "active" | "deprecated" | "archived";
@@ -928,6 +1157,7 @@ interface CreateOntologySchemaRequest {
928
1157
  interface UpdateOntologySchemaRequest {
929
1158
  name?: string;
930
1159
  description?: string;
1160
+ semantic_validation_mode?: SemanticValidationAuthoringMode;
931
1161
  }
932
1162
  interface OntologyObjectTypeInput {
933
1163
  name: string;
@@ -941,6 +1171,8 @@ interface OntologyObjectTypeInput {
941
1171
  extraction_hints?: string;
942
1172
  default_confidence?: number;
943
1173
  review_policy?: "always" | "low_confidence" | "never";
1174
+ /** Add, replace, or clear the object's accepted semantic match. */
1175
+ semantic_match?: SemanticMatch | null;
944
1176
  /** Bind this object type to an external source (SQL). Omit for extracted/authored. */
945
1177
  backing?: ObjectBacking | null;
946
1178
  }
@@ -956,7 +1188,10 @@ interface OntologyRelationTypeInput {
956
1188
  inverse_relation_type?: string;
957
1189
  fields?: FieldDefinition[];
958
1190
  extraction_hints?: string;
1191
+ default_confidence?: number;
959
1192
  review_policy?: "always" | "low_confidence" | "never";
1193
+ /** Add, replace, or clear the relation's accepted semantic match. */
1194
+ semantic_match?: SemanticMatch | null;
960
1195
  /** Bind this relation to an FK column or M:M join table. Both endpoints must be sql-mapped. */
961
1196
  backing?: RelationBacking | null;
962
1197
  }
@@ -967,6 +1202,8 @@ interface OntologyProposal {
967
1202
  schema_id: string;
968
1203
  proposal_type: string;
969
1204
  proposed_by_agent_id?: string | null;
1205
+ proposed_by_user_id?: string | null;
1206
+ extract_job_id?: string | null;
970
1207
  source_uids: string[];
971
1208
  source_scope_ids: string[];
972
1209
  changes_json: {
@@ -991,6 +1228,34 @@ interface OntologyProposal {
991
1228
  resolved_at?: string | null;
992
1229
  resolved_by?: string | null;
993
1230
  }
1231
+ interface OntologyDuplicateAudit {
1232
+ schema_id: string;
1233
+ object_groups: Array<{
1234
+ object_type: string;
1235
+ identity_hash: string;
1236
+ canonical_uid: string;
1237
+ members: Array<{
1238
+ uid: string;
1239
+ label: string;
1240
+ source_uids: string[];
1241
+ }>;
1242
+ conflicting_fields: string[];
1243
+ affected_edges: number;
1244
+ auto_merge_safe: boolean;
1245
+ }>;
1246
+ relation_groups: Array<{
1247
+ relation_type: string;
1248
+ identity_hash: string;
1249
+ canonical_uid: string;
1250
+ edge_uids: string[];
1251
+ from_uid: string;
1252
+ to_uid: string;
1253
+ auto_merge_safe: boolean;
1254
+ }>;
1255
+ objects_without_deterministic_identity: number;
1256
+ context_ambiguous_objects: number;
1257
+ repeatable_relations_skipped: number;
1258
+ }
994
1259
  interface ProposalEdits {
995
1260
  canonical_name?: string;
996
1261
  fields?: Record<string, unknown>;
@@ -1046,6 +1311,17 @@ interface LinkDomainObjectsRequest {
1046
1311
  confidence?: number;
1047
1312
  agent_id?: string;
1048
1313
  }
1314
+ interface CreateDomainObjectRequest {
1315
+ schema_id: string;
1316
+ object_type: string;
1317
+ canonical_name: string;
1318
+ fields?: Record<string, unknown>;
1319
+ aliases?: string[];
1320
+ identity?: Record<string, unknown>;
1321
+ confidence?: number;
1322
+ /** Skip the same-type + same-name duplicate guard (default false). */
1323
+ allow_duplicate?: boolean;
1324
+ }
1049
1325
  interface ExtractOntologyRequest {
1050
1326
  ontology_schema_id: string;
1051
1327
  source_uids: string[];
@@ -1166,6 +1442,11 @@ declare class MindGraph {
1166
1442
  */
1167
1443
  resolveDecision(decisionUid: string, chosenOptionUid: string, opts?: {
1168
1444
  summary?: string;
1445
+ props?: Record<string, unknown>;
1446
+ informs_uid?: string[];
1447
+ as_of_date?: string;
1448
+ session_id?: string;
1449
+ retrieval_trace_id?: string;
1169
1450
  agent_id?: string;
1170
1451
  }): Promise<unknown>;
1171
1452
  procedure(req: ProcedureRequest): Promise<unknown>;
@@ -1372,6 +1653,8 @@ declare class MindGraph {
1372
1653
  * merge/dismiss decision (server >= 1.3).
1373
1654
  */
1374
1655
  getMergeCandidates(): Promise<MergeCandidate[]>;
1656
+ /** Load-bearing conclusions awaiting repair after a premise changed. */
1657
+ getStaleDerivations(limit?: number, offset?: number): Promise<StaleDerivation[]>;
1375
1658
  getPendingApprovals(): Promise<GraphNode[]>;
1376
1659
  ingestChunk(req: IngestChunkRequest): Promise<IngestChunkResponse>;
1377
1660
  ingestDocument(req: IngestDocumentRequest): Promise<IngestDocumentResponse>;
@@ -1477,10 +1760,18 @@ declare class MindGraph {
1477
1760
  addOntologyRelationType(schemaId: string, req: OntologyRelationTypeInput): Promise<OntologyRelationType>;
1478
1761
  updateOntologyRelationType(schemaId: string, typeId: string, req: Partial<OntologyRelationTypeInput>): Promise<OntologyRelationType>;
1479
1762
  deleteOntologyRelationType(schemaId: string, typeId: string): Promise<OntologyRelationType>;
1763
+ /** Generate inert semantic classifications for individual human review. */
1764
+ analyzeOntologySemanticGuidance(schemaId: string): Promise<{
1765
+ created: number;
1766
+ }>;
1767
+ /** Read-only exact-identity collision audit; never merges graph data. */
1768
+ auditOntologyDuplicates(schemaId: string): Promise<OntologyDuplicateAudit>;
1480
1769
  listOntologyProposals(opts?: {
1481
1770
  status?: string;
1482
1771
  schema_id?: string;
1483
1772
  object_type?: string;
1773
+ proposal_type?: string;
1774
+ extract_job_id?: string;
1484
1775
  limit?: number;
1485
1776
  offset?: number;
1486
1777
  }): Promise<{
@@ -1558,6 +1849,37 @@ declare class MindGraph {
1558
1849
  score: number;
1559
1850
  }>;
1560
1851
  }>;
1852
+ /**
1853
+ * Per-object-type coverage stats for a schema (C2f): field fill rates
1854
+ * (with a `near_empty` flag < 5%) and identity collisions, over a bounded
1855
+ * per-type sample (default 500, max 2000).
1856
+ */
1857
+ ontologyStats(schemaId: string, sample?: number): Promise<{
1858
+ schema_id: string;
1859
+ object_types: Array<{
1860
+ object_type: string;
1861
+ count: number;
1862
+ sampled: boolean;
1863
+ fields: Array<{
1864
+ name: string;
1865
+ fill_rate: number;
1866
+ near_empty: boolean;
1867
+ }>;
1868
+ collisions: Array<{
1869
+ identity: string;
1870
+ uids: string[];
1871
+ }>;
1872
+ }>;
1873
+ }>;
1874
+ /**
1875
+ * Create a domain object by hand (auto-approved). Returns the created node
1876
+ * uid + the audit proposal id. Throws 409 if an object of the same type +
1877
+ * canonical_name already exists, unless `allow_duplicate` is set.
1878
+ */
1879
+ createDomainObject(req: CreateDomainObjectRequest): Promise<{
1880
+ uid: string;
1881
+ proposal_id: string;
1882
+ }>;
1561
1883
  linkDomainObjects(req: LinkDomainObjectsRequest): Promise<{
1562
1884
  edge_uid: string;
1563
1885
  }>;
@@ -1566,4 +1888,4 @@ declare class MindGraph {
1566
1888
  }>;
1567
1889
  }
1568
1890
 
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 };
1891
+ export { type AnalogyCandidate, type ArgumentRequest, type ArticleResult, type BatchRequest, type BelievedBy, type CanonicalAttachmentAuthority, type CanonicalAttachmentBinding, type CanonicalAttachmentDirection, type CaptureRequest, type ClaimHub, type ClearResponse, type ClusterClaimSample, type ClusteredClaimHub, type CommitmentRequest, type ConceptCluster, type CreateOntologySchemaRequest, 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 FieldDefinition, type FieldSemantic, type FieldSemanticKind, 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 NormativeKind, type ObjectBacking, type OntologicalBaseKind, type OntologyDuplicateAudit, type OntologyObjectType, type OntologyObjectTypeInput, type OntologyProposal, type OntologyRelationType, type OntologyRelationTypeInput, type OntologySchema, type OntologySchemaDetail, type OrganizationProps, type Participant, type ParticipantSlotKind, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type ProposalEdits, type PurgeRequest, type RankedClaimHub, type RelationBacking, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SemanticDependence, type SemanticEvidenceRef, type SemanticEvidenceSourceKind, type SemanticGeneratorRef, type SemanticIdentityMode, type SemanticMatch, type SemanticMatchAlternative, type SemanticMatchStatus, type SemanticModifier, type SemanticModifierMatch, type SemanticNegativeControl, type SemanticParticipantSlot, type SemanticRelationKind, type SemanticReviewDecision, type SemanticRigidity, type SemanticRuntimeTemplate, type SemanticSignal, type SemanticSignalKind, type SemanticTemplateRef, type SemanticTemporalMode, type SemanticTenantBindings, type SemanticValidationAuthoringMode, type SemanticValidationMode, type SessionRequest, type SignalsQuery, type SignalsResponse, type SourceChunk, type StructureRequest, type SynthesisJobResponse, type TextSelector, type TheorySupportGap, type TraverseRequest, type UpdateOntologySchemaRequest };
package/dist/index.js CHANGED
@@ -564,6 +564,10 @@ var MindGraph = class {
564
564
  async getMergeCandidates() {
565
565
  return this.post("/retrieve", { action: "merge_candidates" });
566
566
  }
567
+ /** Load-bearing conclusions awaiting repair after a premise changed. */
568
+ async getStaleDerivations(limit = 50, offset = 0) {
569
+ return this.post("/retrieve", { action: "stale_derivations", limit, offset });
570
+ }
567
571
  async getPendingApprovals() {
568
572
  return this.get("/approvals/pending");
569
573
  }
@@ -745,12 +749,25 @@ var MindGraph = class {
745
749
  `/v1/ontology/schemas/${schemaId}/relation-types/${typeId}`
746
750
  );
747
751
  }
752
+ /** Generate inert semantic classifications for individual human review. */
753
+ async analyzeOntologySemanticGuidance(schemaId) {
754
+ return this.post(
755
+ `/v1/ontology/schemas/${schemaId}/semantic-guidance/analyze`,
756
+ {}
757
+ );
758
+ }
759
+ /** Read-only exact-identity collision audit; never merges graph data. */
760
+ async auditOntologyDuplicates(schemaId) {
761
+ return this.post(`/v1/ontology/schemas/${schemaId}/duplicates/audit`, {});
762
+ }
748
763
  // ---- Proposals ----
749
764
  async listOntologyProposals(opts) {
750
765
  const q = new URLSearchParams();
751
766
  if (opts?.status) q.set("status", opts.status);
752
767
  if (opts?.schema_id) q.set("schema_id", opts.schema_id);
753
768
  if (opts?.object_type) q.set("object_type", opts.object_type);
769
+ if (opts?.proposal_type) q.set("proposal_type", opts.proposal_type);
770
+ if (opts?.extract_job_id) q.set("extract_job_id", opts.extract_job_id);
754
771
  if (opts?.limit != null) q.set("limit", String(opts.limit));
755
772
  if (opts?.offset != null) q.set("offset", String(opts.offset));
756
773
  const qs = q.toString();
@@ -812,6 +829,24 @@ var MindGraph = class {
812
829
  async searchDomainObjects(query, opts) {
813
830
  return this.post("/ontology/objects/search", { query, ...opts ?? {} });
814
831
  }
832
+ /**
833
+ * Per-object-type coverage stats for a schema (C2f): field fill rates
834
+ * (with a `near_empty` flag < 5%) and identity collisions, over a bounded
835
+ * per-type sample (default 500, max 2000).
836
+ */
837
+ async ontologyStats(schemaId, sample) {
838
+ const q = new URLSearchParams({ schema_id: schemaId });
839
+ if (sample != null) q.set("sample", String(sample));
840
+ return this.get(`/ontology/stats?${q.toString()}`);
841
+ }
842
+ /**
843
+ * Create a domain object by hand (auto-approved). Returns the created node
844
+ * uid + the audit proposal id. Throws 409 if an object of the same type +
845
+ * canonical_name already exists, unless `allow_duplicate` is set.
846
+ */
847
+ async createDomainObject(req) {
848
+ return this.post("/v1/ontology/objects", req);
849
+ }
815
850
  async linkDomainObjects(req) {
816
851
  return this.post("/ontology/relation", { action: "create", ...req });
817
852
  }
package/dist/index.mjs CHANGED
@@ -537,6 +537,10 @@ var MindGraph = class {
537
537
  async getMergeCandidates() {
538
538
  return this.post("/retrieve", { action: "merge_candidates" });
539
539
  }
540
+ /** Load-bearing conclusions awaiting repair after a premise changed. */
541
+ async getStaleDerivations(limit = 50, offset = 0) {
542
+ return this.post("/retrieve", { action: "stale_derivations", limit, offset });
543
+ }
540
544
  async getPendingApprovals() {
541
545
  return this.get("/approvals/pending");
542
546
  }
@@ -718,12 +722,25 @@ var MindGraph = class {
718
722
  `/v1/ontology/schemas/${schemaId}/relation-types/${typeId}`
719
723
  );
720
724
  }
725
+ /** Generate inert semantic classifications for individual human review. */
726
+ async analyzeOntologySemanticGuidance(schemaId) {
727
+ return this.post(
728
+ `/v1/ontology/schemas/${schemaId}/semantic-guidance/analyze`,
729
+ {}
730
+ );
731
+ }
732
+ /** Read-only exact-identity collision audit; never merges graph data. */
733
+ async auditOntologyDuplicates(schemaId) {
734
+ return this.post(`/v1/ontology/schemas/${schemaId}/duplicates/audit`, {});
735
+ }
721
736
  // ---- Proposals ----
722
737
  async listOntologyProposals(opts) {
723
738
  const q = new URLSearchParams();
724
739
  if (opts?.status) q.set("status", opts.status);
725
740
  if (opts?.schema_id) q.set("schema_id", opts.schema_id);
726
741
  if (opts?.object_type) q.set("object_type", opts.object_type);
742
+ if (opts?.proposal_type) q.set("proposal_type", opts.proposal_type);
743
+ if (opts?.extract_job_id) q.set("extract_job_id", opts.extract_job_id);
727
744
  if (opts?.limit != null) q.set("limit", String(opts.limit));
728
745
  if (opts?.offset != null) q.set("offset", String(opts.offset));
729
746
  const qs = q.toString();
@@ -785,6 +802,24 @@ var MindGraph = class {
785
802
  async searchDomainObjects(query, opts) {
786
803
  return this.post("/ontology/objects/search", { query, ...opts ?? {} });
787
804
  }
805
+ /**
806
+ * Per-object-type coverage stats for a schema (C2f): field fill rates
807
+ * (with a `near_empty` flag < 5%) and identity collisions, over a bounded
808
+ * per-type sample (default 500, max 2000).
809
+ */
810
+ async ontologyStats(schemaId, sample) {
811
+ const q = new URLSearchParams({ schema_id: schemaId });
812
+ if (sample != null) q.set("sample", String(sample));
813
+ return this.get(`/ontology/stats?${q.toString()}`);
814
+ }
815
+ /**
816
+ * Create a domain object by hand (auto-approved). Returns the created node
817
+ * uid + the audit proposal id. Throws 409 if an object of the same type +
818
+ * canonical_name already exists, unless `allow_duplicate` is set.
819
+ */
820
+ async createDomainObject(req) {
821
+ return this.post("/v1/ontology/objects", req);
822
+ }
788
823
  async linkDomainObjects(req) {
789
824
  return this.post("/ontology/relation", { action: "create", ...req });
790
825
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "TypeScript client for the MindGraph Cloud API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",