mindgraph 0.12.0 → 0.13.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
@@ -415,6 +415,8 @@ interface RetrieveRequest {
415
415
  * reflect what the user likes.
416
416
  */
417
417
  query?: string;
418
+ /** Corpus Project whose member sources define the retrieval boundary. */
419
+ project_uid?: string;
418
420
  k?: number;
419
421
  threshold?: number;
420
422
  layer?: string;
@@ -528,6 +530,8 @@ interface IngestChunkResponse {
528
530
  interface IngestDocumentRequest {
529
531
  content: string;
530
532
  title?: string;
533
+ /** Corpus Project to attach the ingested document to. */
534
+ project_uid?: string;
531
535
  document_type?: string;
532
536
  /** Semantic content type: "article" (default), "meeting_notes", "journal". Drives default extraction layers. */
533
537
  content_type?: string;
@@ -592,6 +596,8 @@ interface IngestSessionRequest {
592
596
  }
593
597
  interface RetrieveContextRequest {
594
598
  query: string;
599
+ /** Corpus Project whose member sources define the retrieval boundary. */
600
+ project_uid?: string;
595
601
  /** Max graph nodes to return (default 10). */
596
602
  node_limit?: number;
597
603
  /** Max wiki articles to return (default 3). Set to 0 to skip. */
@@ -869,6 +875,12 @@ interface MindGraphConfig {
869
875
  apiKey?: string;
870
876
  jwt?: string;
871
877
  orgId?: string;
878
+ /**
879
+ * Non-security telemetry hint for first-party adapters. The cloud accepts
880
+ * only `dashboard`/`mcp`, normalizes everything else to `api`, and never
881
+ * uses this value for authorization or result membership.
882
+ */
883
+ telemetrySurface?: "dashboard" | "mcp";
872
884
  /** Max retries for 503 (server warming up) responses. Default: 3. Set to 0 to disable. */
873
885
  maxRetries?: number;
874
886
  /** Initial backoff in ms before first retry. Doubles each attempt. Default: 1000. */
@@ -1146,8 +1158,10 @@ interface OntologyToolDescriptor {
1146
1158
  description: string;
1147
1159
  schema_id: string;
1148
1160
  object_type: string;
1149
- /** "search" | "object" | "object_context" */
1150
- maps_to: string;
1161
+ maps_to: "search" | "object" | "object_context" | "related" | "structured_query";
1162
+ relation?: string;
1163
+ entry_role?: "source" | "target";
1164
+ far_type?: string;
1151
1165
  input_schema: Record<string, unknown>;
1152
1166
  }
1153
1167
  interface CreateOntologySchemaRequest {
@@ -1278,20 +1292,125 @@ interface ProposeOntologySchemaRequest {
1278
1292
  interface OntologyQueryRequest {
1279
1293
  query: string;
1280
1294
  schema_id: string;
1295
+ project_uid?: string;
1281
1296
  object_types?: string[];
1282
1297
  include_cognitive_context?: boolean;
1283
1298
  include_sources?: boolean;
1284
1299
  depth?: number;
1285
1300
  limit?: number;
1286
1301
  }
1302
+ type OntologyPredicateOperator = "eq" | "neq" | "in" | "contains" | "gte" | "lte" | "exists";
1303
+ interface OntologyQueryPredicate {
1304
+ field: string;
1305
+ op: OntologyPredicateOperator;
1306
+ value?: unknown;
1307
+ }
1308
+ interface StructuredOntologyQueryRequest {
1309
+ schema_id: string;
1310
+ select: string;
1311
+ project_uid?: string;
1312
+ anchor?: {
1313
+ type: string;
1314
+ uid?: string;
1315
+ match?: {
1316
+ value: string;
1317
+ field?: string;
1318
+ };
1319
+ };
1320
+ path?: Array<{
1321
+ relation: string;
1322
+ entry_role: "source" | "target";
1323
+ }>;
1324
+ where?: OntologyQueryPredicate[];
1325
+ include?: {
1326
+ provenance?: boolean;
1327
+ related?: string[];
1328
+ };
1329
+ page?: {
1330
+ limit?: number;
1331
+ offset?: number;
1332
+ };
1333
+ aggregate?: {
1334
+ op: "count" | "customer_demand_rank";
1335
+ group_by?: string;
1336
+ };
1337
+ }
1338
+ interface StructuredOntologyQueryResponse {
1339
+ plan: Record<string, unknown>;
1340
+ rows: Array<{
1341
+ object: DomainObject;
1342
+ related?: Record<string, DomainObject[]>;
1343
+ }>;
1344
+ relations: Array<{
1345
+ uid: string;
1346
+ relation: string;
1347
+ from_uid: string;
1348
+ to_uid: string;
1349
+ fields: unknown;
1350
+ leg_index?: number;
1351
+ }>;
1352
+ provenance: Array<{
1353
+ node_uid: string;
1354
+ source_uid: string;
1355
+ text_span: string;
1356
+ }>;
1357
+ aggregate?: unknown;
1358
+ total_count: number;
1359
+ total_count_exact: boolean;
1360
+ returned_count: number;
1361
+ has_more: boolean;
1362
+ coverage_complete: boolean;
1363
+ truncation_reasons: string[];
1364
+ diagnostics: string[];
1365
+ metrics: Record<string, unknown>;
1366
+ }
1367
+ interface RelatedDomainObjectsRequest {
1368
+ schema_id: string;
1369
+ entry_type: string;
1370
+ uid: string;
1371
+ relation: string;
1372
+ entry_role: "source" | "target";
1373
+ far_type: string;
1374
+ where?: OntologyQueryPredicate[];
1375
+ include_provenance?: boolean;
1376
+ limit?: number;
1377
+ offset?: number;
1378
+ project_uid?: string;
1379
+ }
1287
1380
  interface OntologyQueryResponse {
1288
1381
  objects: GraphNode[];
1289
- relations: GraphEdge[];
1290
- cognitive_context: Record<string, GraphNode[]>;
1382
+ relations: Array<{
1383
+ edge_uid: string | null;
1384
+ from_uid: string;
1385
+ to_uid: string;
1386
+ edge_type: string;
1387
+ traversal_role: string;
1388
+ depth: number;
1389
+ }>;
1390
+ cognitive_context: Record<string, Array<{
1391
+ uid: string;
1392
+ label: string;
1393
+ node_type: string;
1394
+ layer: string;
1395
+ depth: number;
1396
+ }>>;
1291
1397
  external_refs: unknown[];
1292
1398
  graph: {
1293
- nodes: GraphNode[];
1294
- edges: GraphEdge[];
1399
+ nodes: Array<{
1400
+ uid: string;
1401
+ label: string;
1402
+ node_type: string;
1403
+ layer: string;
1404
+ depth: number;
1405
+ }>;
1406
+ edges: Array<{
1407
+ edge_uid: string | null;
1408
+ from_uid: string;
1409
+ to_uid: string;
1410
+ edge_type: string;
1411
+ traversal_role: string;
1412
+ depth: number;
1413
+ }>;
1295
1414
  };
1296
1415
  provenance: Array<{
1297
1416
  node_uid: string;
@@ -1301,6 +1420,9 @@ interface OntologyQueryResponse {
1301
1420
  confidence: {
1302
1421
  overall: number;
1303
1422
  };
1423
+ returned_count: number;
1424
+ has_more: boolean;
1425
+ seed_cap_hit: boolean;
1304
1426
  truncated?: Record<string, boolean>;
1305
1427
  }
1306
1428
  interface LinkDomainObjectsRequest {
@@ -1339,6 +1461,7 @@ declare class MindGraph {
1339
1461
  private headers;
1340
1462
  private maxRetries;
1341
1463
  private retryBackoffMs;
1464
+ private telemetrySurface?;
1342
1465
  constructor(config: MindGraphConfig);
1343
1466
  private request;
1344
1467
  private get;
@@ -1555,6 +1678,7 @@ declare class MindGraph {
1555
1678
  edge_type?: string;
1556
1679
  }): Promise<GraphEdge[]>;
1557
1680
  search(query: string, opts?: {
1681
+ project_uid?: string;
1558
1682
  node_type?: string;
1559
1683
  layer?: string;
1560
1684
  limit?: number;
@@ -1568,6 +1692,7 @@ declare class MindGraph {
1568
1692
  * the "why retrieved" detail (server ≥ 1.2.0; older servers ignore it).
1569
1693
  */
1570
1694
  hybridSearch(query: string, opts?: {
1695
+ project_uid?: string;
1571
1696
  k?: number;
1572
1697
  node_types?: string[];
1573
1698
  layer?: string;
@@ -1807,17 +1932,26 @@ declare class MindGraph {
1807
1932
  }[];
1808
1933
  }>;
1809
1934
  queryOntology(req: OntologyQueryRequest): Promise<OntologyQueryResponse>;
1935
+ queryDomainStructured(req: StructuredOntologyQueryRequest): Promise<StructuredOntologyQueryResponse>;
1936
+ queryRelatedDomainObjects(req: RelatedDomainObjectsRequest): Promise<StructuredOntologyQueryResponse>;
1810
1937
  /**
1811
- * Read-only agent tool descriptors generated from the active ontology
1812
- * schema(s). Each maps to a generic `/ontology` read endpoint with
1813
- * `object_type` bound. Used by the MCP server to expose typed per-object
1814
- * tools (`search_customers`, `summarize_customer`, …).
1938
+ * Schema-qualified read-tool descriptors generated from every active
1939
+ * ontology. Includes per-object discovery/point/context tools,
1940
+ * relation-and-role-specific related tools, and one structured composite.
1815
1941
  */
1816
1942
  listOntologyTools(): Promise<{
1817
1943
  tools: OntologyToolDescriptor[];
1818
1944
  }>;
1819
- getDomainObject(uid: string): Promise<DomainObject>;
1820
- getDomainObjectContext(uid: string, depth?: number): Promise<OntologyQueryResponse>;
1945
+ getDomainObject(uid: string, binding?: {
1946
+ schema_id: string;
1947
+ object_type: string;
1948
+ project_uid?: string;
1949
+ }): Promise<DomainObject>;
1950
+ getDomainObjectContext(uid: string, depth?: number, binding?: {
1951
+ schema_id: string;
1952
+ object_type: string;
1953
+ project_uid?: string;
1954
+ }): Promise<OntologyQueryResponse>;
1821
1955
  getDomainObjectHistory(uid: string): Promise<{
1822
1956
  versions: Array<{
1823
1957
  version: number;
@@ -1842,12 +1976,19 @@ declare class MindGraph {
1842
1976
  searchDomainObjects(query: string, opts?: {
1843
1977
  schema_id?: string;
1844
1978
  object_types?: string[];
1979
+ filters?: OntologyQueryPredicate[];
1845
1980
  limit?: number;
1846
1981
  }): Promise<{
1847
1982
  items: Array<{
1848
1983
  object: DomainObject;
1849
1984
  score: number;
1850
1985
  }>;
1986
+ returned_count: number;
1987
+ has_more: boolean;
1988
+ seed_cap_hit: boolean;
1989
+ truncation_reasons: string[];
1990
+ total_count: null;
1991
+ total_count_exact: false;
1851
1992
  }>;
1852
1993
  /**
1853
1994
  * Per-object-type coverage stats for a schema (C2f): field fill rates
@@ -1888,4 +2029,4 @@ declare class MindGraph {
1888
2029
  }>;
1889
2030
  }
1890
2031
 
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 };
2032
+ 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 OntologyPredicateOperator, type OntologyProposal, type OntologyQueryPredicate, type OntologyRelationType, type OntologyRelationTypeInput, type OntologySchema, type OntologySchemaDetail, type OntologyToolDescriptor, type OrganizationProps, type Participant, type ParticipantSlotKind, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type ProposalEdits, type PurgeRequest, type RankedClaimHub, type RelatedDomainObjectsRequest, 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 StructuredOntologyQueryRequest, type StructuredOntologyQueryResponse, type SynthesisJobResponse, type TextSelector, type TheorySupportGap, type TraverseRequest, type UpdateOntologySchemaRequest };
package/dist/index.d.ts CHANGED
@@ -415,6 +415,8 @@ interface RetrieveRequest {
415
415
  * reflect what the user likes.
416
416
  */
417
417
  query?: string;
418
+ /** Corpus Project whose member sources define the retrieval boundary. */
419
+ project_uid?: string;
418
420
  k?: number;
419
421
  threshold?: number;
420
422
  layer?: string;
@@ -528,6 +530,8 @@ interface IngestChunkResponse {
528
530
  interface IngestDocumentRequest {
529
531
  content: string;
530
532
  title?: string;
533
+ /** Corpus Project to attach the ingested document to. */
534
+ project_uid?: string;
531
535
  document_type?: string;
532
536
  /** Semantic content type: "article" (default), "meeting_notes", "journal". Drives default extraction layers. */
533
537
  content_type?: string;
@@ -592,6 +596,8 @@ interface IngestSessionRequest {
592
596
  }
593
597
  interface RetrieveContextRequest {
594
598
  query: string;
599
+ /** Corpus Project whose member sources define the retrieval boundary. */
600
+ project_uid?: string;
595
601
  /** Max graph nodes to return (default 10). */
596
602
  node_limit?: number;
597
603
  /** Max wiki articles to return (default 3). Set to 0 to skip. */
@@ -869,6 +875,12 @@ interface MindGraphConfig {
869
875
  apiKey?: string;
870
876
  jwt?: string;
871
877
  orgId?: string;
878
+ /**
879
+ * Non-security telemetry hint for first-party adapters. The cloud accepts
880
+ * only `dashboard`/`mcp`, normalizes everything else to `api`, and never
881
+ * uses this value for authorization or result membership.
882
+ */
883
+ telemetrySurface?: "dashboard" | "mcp";
872
884
  /** Max retries for 503 (server warming up) responses. Default: 3. Set to 0 to disable. */
873
885
  maxRetries?: number;
874
886
  /** Initial backoff in ms before first retry. Doubles each attempt. Default: 1000. */
@@ -1146,8 +1158,10 @@ interface OntologyToolDescriptor {
1146
1158
  description: string;
1147
1159
  schema_id: string;
1148
1160
  object_type: string;
1149
- /** "search" | "object" | "object_context" */
1150
- maps_to: string;
1161
+ maps_to: "search" | "object" | "object_context" | "related" | "structured_query";
1162
+ relation?: string;
1163
+ entry_role?: "source" | "target";
1164
+ far_type?: string;
1151
1165
  input_schema: Record<string, unknown>;
1152
1166
  }
1153
1167
  interface CreateOntologySchemaRequest {
@@ -1278,20 +1292,125 @@ interface ProposeOntologySchemaRequest {
1278
1292
  interface OntologyQueryRequest {
1279
1293
  query: string;
1280
1294
  schema_id: string;
1295
+ project_uid?: string;
1281
1296
  object_types?: string[];
1282
1297
  include_cognitive_context?: boolean;
1283
1298
  include_sources?: boolean;
1284
1299
  depth?: number;
1285
1300
  limit?: number;
1286
1301
  }
1302
+ type OntologyPredicateOperator = "eq" | "neq" | "in" | "contains" | "gte" | "lte" | "exists";
1303
+ interface OntologyQueryPredicate {
1304
+ field: string;
1305
+ op: OntologyPredicateOperator;
1306
+ value?: unknown;
1307
+ }
1308
+ interface StructuredOntologyQueryRequest {
1309
+ schema_id: string;
1310
+ select: string;
1311
+ project_uid?: string;
1312
+ anchor?: {
1313
+ type: string;
1314
+ uid?: string;
1315
+ match?: {
1316
+ value: string;
1317
+ field?: string;
1318
+ };
1319
+ };
1320
+ path?: Array<{
1321
+ relation: string;
1322
+ entry_role: "source" | "target";
1323
+ }>;
1324
+ where?: OntologyQueryPredicate[];
1325
+ include?: {
1326
+ provenance?: boolean;
1327
+ related?: string[];
1328
+ };
1329
+ page?: {
1330
+ limit?: number;
1331
+ offset?: number;
1332
+ };
1333
+ aggregate?: {
1334
+ op: "count" | "customer_demand_rank";
1335
+ group_by?: string;
1336
+ };
1337
+ }
1338
+ interface StructuredOntologyQueryResponse {
1339
+ plan: Record<string, unknown>;
1340
+ rows: Array<{
1341
+ object: DomainObject;
1342
+ related?: Record<string, DomainObject[]>;
1343
+ }>;
1344
+ relations: Array<{
1345
+ uid: string;
1346
+ relation: string;
1347
+ from_uid: string;
1348
+ to_uid: string;
1349
+ fields: unknown;
1350
+ leg_index?: number;
1351
+ }>;
1352
+ provenance: Array<{
1353
+ node_uid: string;
1354
+ source_uid: string;
1355
+ text_span: string;
1356
+ }>;
1357
+ aggregate?: unknown;
1358
+ total_count: number;
1359
+ total_count_exact: boolean;
1360
+ returned_count: number;
1361
+ has_more: boolean;
1362
+ coverage_complete: boolean;
1363
+ truncation_reasons: string[];
1364
+ diagnostics: string[];
1365
+ metrics: Record<string, unknown>;
1366
+ }
1367
+ interface RelatedDomainObjectsRequest {
1368
+ schema_id: string;
1369
+ entry_type: string;
1370
+ uid: string;
1371
+ relation: string;
1372
+ entry_role: "source" | "target";
1373
+ far_type: string;
1374
+ where?: OntologyQueryPredicate[];
1375
+ include_provenance?: boolean;
1376
+ limit?: number;
1377
+ offset?: number;
1378
+ project_uid?: string;
1379
+ }
1287
1380
  interface OntologyQueryResponse {
1288
1381
  objects: GraphNode[];
1289
- relations: GraphEdge[];
1290
- cognitive_context: Record<string, GraphNode[]>;
1382
+ relations: Array<{
1383
+ edge_uid: string | null;
1384
+ from_uid: string;
1385
+ to_uid: string;
1386
+ edge_type: string;
1387
+ traversal_role: string;
1388
+ depth: number;
1389
+ }>;
1390
+ cognitive_context: Record<string, Array<{
1391
+ uid: string;
1392
+ label: string;
1393
+ node_type: string;
1394
+ layer: string;
1395
+ depth: number;
1396
+ }>>;
1291
1397
  external_refs: unknown[];
1292
1398
  graph: {
1293
- nodes: GraphNode[];
1294
- edges: GraphEdge[];
1399
+ nodes: Array<{
1400
+ uid: string;
1401
+ label: string;
1402
+ node_type: string;
1403
+ layer: string;
1404
+ depth: number;
1405
+ }>;
1406
+ edges: Array<{
1407
+ edge_uid: string | null;
1408
+ from_uid: string;
1409
+ to_uid: string;
1410
+ edge_type: string;
1411
+ traversal_role: string;
1412
+ depth: number;
1413
+ }>;
1295
1414
  };
1296
1415
  provenance: Array<{
1297
1416
  node_uid: string;
@@ -1301,6 +1420,9 @@ interface OntologyQueryResponse {
1301
1420
  confidence: {
1302
1421
  overall: number;
1303
1422
  };
1423
+ returned_count: number;
1424
+ has_more: boolean;
1425
+ seed_cap_hit: boolean;
1304
1426
  truncated?: Record<string, boolean>;
1305
1427
  }
1306
1428
  interface LinkDomainObjectsRequest {
@@ -1339,6 +1461,7 @@ declare class MindGraph {
1339
1461
  private headers;
1340
1462
  private maxRetries;
1341
1463
  private retryBackoffMs;
1464
+ private telemetrySurface?;
1342
1465
  constructor(config: MindGraphConfig);
1343
1466
  private request;
1344
1467
  private get;
@@ -1555,6 +1678,7 @@ declare class MindGraph {
1555
1678
  edge_type?: string;
1556
1679
  }): Promise<GraphEdge[]>;
1557
1680
  search(query: string, opts?: {
1681
+ project_uid?: string;
1558
1682
  node_type?: string;
1559
1683
  layer?: string;
1560
1684
  limit?: number;
@@ -1568,6 +1692,7 @@ declare class MindGraph {
1568
1692
  * the "why retrieved" detail (server ≥ 1.2.0; older servers ignore it).
1569
1693
  */
1570
1694
  hybridSearch(query: string, opts?: {
1695
+ project_uid?: string;
1571
1696
  k?: number;
1572
1697
  node_types?: string[];
1573
1698
  layer?: string;
@@ -1807,17 +1932,26 @@ declare class MindGraph {
1807
1932
  }[];
1808
1933
  }>;
1809
1934
  queryOntology(req: OntologyQueryRequest): Promise<OntologyQueryResponse>;
1935
+ queryDomainStructured(req: StructuredOntologyQueryRequest): Promise<StructuredOntologyQueryResponse>;
1936
+ queryRelatedDomainObjects(req: RelatedDomainObjectsRequest): Promise<StructuredOntologyQueryResponse>;
1810
1937
  /**
1811
- * Read-only agent tool descriptors generated from the active ontology
1812
- * schema(s). Each maps to a generic `/ontology` read endpoint with
1813
- * `object_type` bound. Used by the MCP server to expose typed per-object
1814
- * tools (`search_customers`, `summarize_customer`, …).
1938
+ * Schema-qualified read-tool descriptors generated from every active
1939
+ * ontology. Includes per-object discovery/point/context tools,
1940
+ * relation-and-role-specific related tools, and one structured composite.
1815
1941
  */
1816
1942
  listOntologyTools(): Promise<{
1817
1943
  tools: OntologyToolDescriptor[];
1818
1944
  }>;
1819
- getDomainObject(uid: string): Promise<DomainObject>;
1820
- getDomainObjectContext(uid: string, depth?: number): Promise<OntologyQueryResponse>;
1945
+ getDomainObject(uid: string, binding?: {
1946
+ schema_id: string;
1947
+ object_type: string;
1948
+ project_uid?: string;
1949
+ }): Promise<DomainObject>;
1950
+ getDomainObjectContext(uid: string, depth?: number, binding?: {
1951
+ schema_id: string;
1952
+ object_type: string;
1953
+ project_uid?: string;
1954
+ }): Promise<OntologyQueryResponse>;
1821
1955
  getDomainObjectHistory(uid: string): Promise<{
1822
1956
  versions: Array<{
1823
1957
  version: number;
@@ -1842,12 +1976,19 @@ declare class MindGraph {
1842
1976
  searchDomainObjects(query: string, opts?: {
1843
1977
  schema_id?: string;
1844
1978
  object_types?: string[];
1979
+ filters?: OntologyQueryPredicate[];
1845
1980
  limit?: number;
1846
1981
  }): Promise<{
1847
1982
  items: Array<{
1848
1983
  object: DomainObject;
1849
1984
  score: number;
1850
1985
  }>;
1986
+ returned_count: number;
1987
+ has_more: boolean;
1988
+ seed_cap_hit: boolean;
1989
+ truncation_reasons: string[];
1990
+ total_count: null;
1991
+ total_count_exact: false;
1851
1992
  }>;
1852
1993
  /**
1853
1994
  * Per-object-type coverage stats for a schema (C2f): field fill rates
@@ -1888,4 +2029,4 @@ declare class MindGraph {
1888
2029
  }>;
1889
2030
  }
1890
2031
 
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 };
2032
+ 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 OntologyPredicateOperator, type OntologyProposal, type OntologyQueryPredicate, type OntologyRelationType, type OntologyRelationTypeInput, type OntologySchema, type OntologySchemaDetail, type OntologyToolDescriptor, type OrganizationProps, type Participant, type ParticipantSlotKind, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type ProposalEdits, type PurgeRequest, type RankedClaimHub, type RelatedDomainObjectsRequest, 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 StructuredOntologyQueryRequest, type StructuredOntologyQueryResponse, type SynthesisJobResponse, type TextSelector, type TheorySupportGap, type TraverseRequest, type UpdateOntologySchemaRequest };
package/dist/index.js CHANGED
@@ -46,15 +46,21 @@ var MindGraph = class {
46
46
  if (config.orgId) {
47
47
  this.headers["X-MindGraph-Org"] = config.orgId;
48
48
  }
49
+ this.telemetrySurface = config.telemetrySurface;
49
50
  this.maxRetries = config.maxRetries ?? 3;
50
51
  this.retryBackoffMs = config.retryBackoffMs ?? 1e3;
51
52
  }
52
53
  // ---- HTTP helpers ----
53
54
  async request(method, path, body) {
54
55
  const url = `${this.baseUrl}${path}`;
56
+ const requestId = createRequestId();
55
57
  const init = {
56
58
  method,
57
- headers: this.headers
59
+ headers: {
60
+ ...this.headers,
61
+ "X-MindGraph-Request-ID": requestId,
62
+ ...this.telemetrySurface ? { "X-MindGraph-Surface": this.telemetrySurface } : {}
63
+ }
58
64
  };
59
65
  if (body !== void 0) {
60
66
  init.body = JSON.stringify(body);
@@ -798,21 +804,55 @@ var MindGraph = class {
798
804
  async queryOntology(req) {
799
805
  return this.post("/ontology/query", req);
800
806
  }
807
+ async queryDomainStructured(req) {
808
+ return this.post("/ontology/query/structured", req);
809
+ }
810
+ async queryRelatedDomainObjects(req) {
811
+ return this.queryDomainStructured({
812
+ schema_id: req.schema_id,
813
+ select: req.far_type,
814
+ ...req.project_uid ? { project_uid: req.project_uid } : {},
815
+ anchor: { type: req.entry_type, uid: req.uid },
816
+ path: [{
817
+ relation: req.relation,
818
+ entry_role: req.entry_role
819
+ }],
820
+ ...req.where ? { where: req.where } : {},
821
+ ...req.include_provenance ? { include: { provenance: true } } : {},
822
+ page: {
823
+ ...req.limit != null ? { limit: req.limit } : {},
824
+ ...req.offset != null ? { offset: req.offset } : {}
825
+ }
826
+ });
827
+ }
801
828
  /**
802
- * Read-only agent tool descriptors generated from the active ontology
803
- * schema(s). Each maps to a generic `/ontology` read endpoint with
804
- * `object_type` bound. Used by the MCP server to expose typed per-object
805
- * tools (`search_customers`, `summarize_customer`, …).
829
+ * Schema-qualified read-tool descriptors generated from every active
830
+ * ontology. Includes per-object discovery/point/context tools,
831
+ * relation-and-role-specific related tools, and one structured composite.
806
832
  */
807
833
  async listOntologyTools() {
808
834
  return this.get("/v1/ontology/tools");
809
835
  }
810
- async getDomainObject(uid) {
811
- return this.get(`/ontology/object/${uid}`);
812
- }
813
- async getDomainObjectContext(uid, depth) {
814
- const qs = depth != null ? `?depth=${depth}` : "";
815
- return this.get(`/ontology/object/${uid}/context${qs}`);
836
+ async getDomainObject(uid, binding) {
837
+ const query = new URLSearchParams();
838
+ if (binding) {
839
+ query.set("schema_id", binding.schema_id);
840
+ query.set("object_type", binding.object_type);
841
+ if (binding.project_uid) query.set("project_uid", binding.project_uid);
842
+ }
843
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
844
+ return this.get(`/ontology/object/${uid}${suffix}`);
845
+ }
846
+ async getDomainObjectContext(uid, depth, binding) {
847
+ const query = new URLSearchParams();
848
+ if (depth != null) query.set("depth", String(depth));
849
+ if (binding) {
850
+ query.set("schema_id", binding.schema_id);
851
+ query.set("object_type", binding.object_type);
852
+ if (binding.project_uid) query.set("project_uid", binding.project_uid);
853
+ }
854
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
855
+ return this.get(`/ontology/object/${uid}/context${suffix}`);
816
856
  }
817
857
  async getDomainObjectHistory(uid) {
818
858
  return this.get(`/ontology/object/${uid}/history`);
@@ -855,6 +895,12 @@ var MindGraph = class {
855
895
  return this.post("/ontology/extract", req);
856
896
  }
857
897
  };
898
+ function createRequestId() {
899
+ if (typeof globalThis.crypto?.randomUUID === "function") {
900
+ return globalThis.crypto.randomUUID();
901
+ }
902
+ return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
903
+ }
858
904
  // Annotate the CommonJS export names for ESM import in node:
859
905
  0 && (module.exports = {
860
906
  MindGraph,
package/dist/index.mjs CHANGED
@@ -19,15 +19,21 @@ var MindGraph = class {
19
19
  if (config.orgId) {
20
20
  this.headers["X-MindGraph-Org"] = config.orgId;
21
21
  }
22
+ this.telemetrySurface = config.telemetrySurface;
22
23
  this.maxRetries = config.maxRetries ?? 3;
23
24
  this.retryBackoffMs = config.retryBackoffMs ?? 1e3;
24
25
  }
25
26
  // ---- HTTP helpers ----
26
27
  async request(method, path, body) {
27
28
  const url = `${this.baseUrl}${path}`;
29
+ const requestId = createRequestId();
28
30
  const init = {
29
31
  method,
30
- headers: this.headers
32
+ headers: {
33
+ ...this.headers,
34
+ "X-MindGraph-Request-ID": requestId,
35
+ ...this.telemetrySurface ? { "X-MindGraph-Surface": this.telemetrySurface } : {}
36
+ }
31
37
  };
32
38
  if (body !== void 0) {
33
39
  init.body = JSON.stringify(body);
@@ -771,21 +777,55 @@ var MindGraph = class {
771
777
  async queryOntology(req) {
772
778
  return this.post("/ontology/query", req);
773
779
  }
780
+ async queryDomainStructured(req) {
781
+ return this.post("/ontology/query/structured", req);
782
+ }
783
+ async queryRelatedDomainObjects(req) {
784
+ return this.queryDomainStructured({
785
+ schema_id: req.schema_id,
786
+ select: req.far_type,
787
+ ...req.project_uid ? { project_uid: req.project_uid } : {},
788
+ anchor: { type: req.entry_type, uid: req.uid },
789
+ path: [{
790
+ relation: req.relation,
791
+ entry_role: req.entry_role
792
+ }],
793
+ ...req.where ? { where: req.where } : {},
794
+ ...req.include_provenance ? { include: { provenance: true } } : {},
795
+ page: {
796
+ ...req.limit != null ? { limit: req.limit } : {},
797
+ ...req.offset != null ? { offset: req.offset } : {}
798
+ }
799
+ });
800
+ }
774
801
  /**
775
- * Read-only agent tool descriptors generated from the active ontology
776
- * schema(s). Each maps to a generic `/ontology` read endpoint with
777
- * `object_type` bound. Used by the MCP server to expose typed per-object
778
- * tools (`search_customers`, `summarize_customer`, …).
802
+ * Schema-qualified read-tool descriptors generated from every active
803
+ * ontology. Includes per-object discovery/point/context tools,
804
+ * relation-and-role-specific related tools, and one structured composite.
779
805
  */
780
806
  async listOntologyTools() {
781
807
  return this.get("/v1/ontology/tools");
782
808
  }
783
- async getDomainObject(uid) {
784
- return this.get(`/ontology/object/${uid}`);
785
- }
786
- async getDomainObjectContext(uid, depth) {
787
- const qs = depth != null ? `?depth=${depth}` : "";
788
- return this.get(`/ontology/object/${uid}/context${qs}`);
809
+ async getDomainObject(uid, binding) {
810
+ const query = new URLSearchParams();
811
+ if (binding) {
812
+ query.set("schema_id", binding.schema_id);
813
+ query.set("object_type", binding.object_type);
814
+ if (binding.project_uid) query.set("project_uid", binding.project_uid);
815
+ }
816
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
817
+ return this.get(`/ontology/object/${uid}${suffix}`);
818
+ }
819
+ async getDomainObjectContext(uid, depth, binding) {
820
+ const query = new URLSearchParams();
821
+ if (depth != null) query.set("depth", String(depth));
822
+ if (binding) {
823
+ query.set("schema_id", binding.schema_id);
824
+ query.set("object_type", binding.object_type);
825
+ if (binding.project_uid) query.set("project_uid", binding.project_uid);
826
+ }
827
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
828
+ return this.get(`/ontology/object/${uid}/context${suffix}`);
789
829
  }
790
830
  async getDomainObjectHistory(uid) {
791
831
  return this.get(`/ontology/object/${uid}/history`);
@@ -828,6 +868,12 @@ var MindGraph = class {
828
868
  return this.post("/ontology/extract", req);
829
869
  }
830
870
  };
871
+ function createRequestId() {
872
+ if (typeof globalThis.crypto?.randomUUID === "function") {
873
+ return globalThis.crypto.randomUUID();
874
+ }
875
+ return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
876
+ }
831
877
  export {
832
878
  MindGraph,
833
879
  MindGraphError
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "TypeScript client for the MindGraph Cloud API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",