mindgraph 0.4.1 → 0.5.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
@@ -617,6 +617,208 @@ interface MindGraphConfig {
617
617
  /** Initial backoff in ms before first retry. Doubles each attempt. Default: 1000. */
618
618
  retryBackoffMs?: number;
619
619
  }
620
+ /** Field schema entry inside `OntologyObjectType.fields_json`. */
621
+ interface FieldDefinition {
622
+ name: string;
623
+ /** One of: string|number|integer|boolean|date|datetime|enum|reference|array|object|json */
624
+ type: string;
625
+ required?: boolean;
626
+ description?: string;
627
+ default?: unknown;
628
+ enum?: string[];
629
+ reference_object_type?: string;
630
+ array_item_type?: string;
631
+ extraction_hint?: string;
632
+ }
633
+ interface OntologySchema {
634
+ id: string;
635
+ org_id: string;
636
+ name: string;
637
+ description?: string;
638
+ status: "draft" | "active" | "deprecated" | "archived";
639
+ version: number;
640
+ propose_status?: "pending" | "running" | "ready" | "failed" | null;
641
+ propose_job_id?: string | null;
642
+ propose_error?: string | null;
643
+ created_by?: string | null;
644
+ updated_by?: string | null;
645
+ created_at: string;
646
+ updated_at: string;
647
+ activated_at?: string | null;
648
+ archived_at?: string | null;
649
+ }
650
+ interface OntologyObjectType {
651
+ id: string;
652
+ schema_id: string;
653
+ org_id: string;
654
+ name: string;
655
+ display_name?: string | null;
656
+ description?: string | null;
657
+ fields_json: FieldDefinition[];
658
+ required_fields: string[];
659
+ identity_fields: string[];
660
+ aliases: string[];
661
+ examples_json: Record<string, unknown>[];
662
+ extraction_hints?: string | null;
663
+ default_confidence: number;
664
+ review_policy: "always" | "low_confidence" | "never";
665
+ status: "active" | "deprecated" | "archived";
666
+ version: number;
667
+ created_at: string;
668
+ updated_at: string;
669
+ }
670
+ interface OntologyRelationType {
671
+ id: string;
672
+ schema_id: string;
673
+ org_id: string;
674
+ name: string;
675
+ display_name?: string | null;
676
+ description?: string | null;
677
+ source_type: string;
678
+ target_type: string;
679
+ cardinality?: "one_to_one" | "one_to_many" | "many_to_many" | null;
680
+ symmetric: boolean;
681
+ transitive: boolean;
682
+ inverse_relation_type?: string | null;
683
+ fields_json: FieldDefinition[];
684
+ extraction_hints?: string | null;
685
+ review_policy: "always" | "low_confidence" | "never";
686
+ status: "active" | "deprecated" | "archived";
687
+ version: number;
688
+ created_at: string;
689
+ updated_at: string;
690
+ }
691
+ interface OntologySchemaDetail extends OntologySchema {
692
+ object_types: OntologyObjectType[];
693
+ relation_types: OntologyRelationType[];
694
+ }
695
+ interface CreateOntologySchemaRequest {
696
+ name: string;
697
+ description?: string;
698
+ }
699
+ interface UpdateOntologySchemaRequest {
700
+ name?: string;
701
+ description?: string;
702
+ }
703
+ interface OntologyObjectTypeInput {
704
+ name: string;
705
+ display_name?: string;
706
+ description?: string;
707
+ fields?: FieldDefinition[];
708
+ required_fields?: string[];
709
+ identity_fields?: string[];
710
+ aliases?: string[];
711
+ examples?: Record<string, unknown>[];
712
+ extraction_hints?: string;
713
+ default_confidence?: number;
714
+ review_policy?: "always" | "low_confidence" | "never";
715
+ }
716
+ interface OntologyRelationTypeInput {
717
+ name: string;
718
+ display_name?: string;
719
+ description?: string;
720
+ source_type: string;
721
+ target_type: string;
722
+ cardinality?: "one_to_one" | "one_to_many" | "many_to_many";
723
+ symmetric?: boolean;
724
+ transitive?: boolean;
725
+ inverse_relation_type?: string;
726
+ fields?: FieldDefinition[];
727
+ extraction_hints?: string;
728
+ review_policy?: "always" | "low_confidence" | "never";
729
+ }
730
+ /** Status: pending | approved | approval_required | rejected | applied | apply_failed. */
731
+ interface OntologyProposal {
732
+ id: string;
733
+ org_id: string;
734
+ schema_id: string;
735
+ proposal_type: string;
736
+ proposed_by_agent_id?: string | null;
737
+ source_uids: string[];
738
+ source_scope_ids: string[];
739
+ changes_json: {
740
+ adds: Array<Record<string, unknown>>;
741
+ updates: Array<Record<string, unknown>>;
742
+ removes: Array<Record<string, unknown>>;
743
+ };
744
+ rationale?: string | null;
745
+ confidence?: number | null;
746
+ risk_level?: string | null;
747
+ review_status: string;
748
+ approval_uid?: string | null;
749
+ proposed_node_uid?: string | null;
750
+ applied_job_id?: string | null;
751
+ applied_error?: string | null;
752
+ apply_attempt_count: number;
753
+ edited_by?: string | null;
754
+ edited_at?: string | null;
755
+ original_snapshot?: Record<string, unknown> | null;
756
+ requires_manual_resolution: boolean;
757
+ created_at: string;
758
+ resolved_at?: string | null;
759
+ resolved_by?: string | null;
760
+ }
761
+ interface ProposalEdits {
762
+ canonical_name?: string;
763
+ fields?: Record<string, unknown>;
764
+ aliases?: string[];
765
+ }
766
+ interface ProposeOntologySchemaRequest {
767
+ description?: string;
768
+ template_hint?: "client_services" | "healthcare" | "supply_chain" | "research_intel" | "custom";
769
+ source_uids?: string[];
770
+ source_documents?: Array<{
771
+ content: string;
772
+ title?: string;
773
+ }>;
774
+ target_use_case?: string;
775
+ example_objects?: string[];
776
+ example_queries?: string[];
777
+ desired_workflows?: string[];
778
+ parent_schema_id?: string;
779
+ }
780
+ interface OntologyQueryRequest {
781
+ query: string;
782
+ schema_id: string;
783
+ object_types?: string[];
784
+ include_cognitive_context?: boolean;
785
+ include_sources?: boolean;
786
+ depth?: number;
787
+ limit?: number;
788
+ }
789
+ interface OntologyQueryResponse {
790
+ objects: GraphNode[];
791
+ relations: GraphEdge[];
792
+ cognitive_context: Record<string, GraphNode[]>;
793
+ external_refs: unknown[];
794
+ graph: {
795
+ nodes: GraphNode[];
796
+ edges: GraphEdge[];
797
+ };
798
+ provenance: Array<{
799
+ node_uid: string;
800
+ source_uid: string;
801
+ text_span: string;
802
+ }>;
803
+ confidence: {
804
+ overall: number;
805
+ };
806
+ truncated?: Record<string, boolean>;
807
+ }
808
+ interface LinkDomainObjectsRequest {
809
+ from_uid: string;
810
+ to_uid: string;
811
+ relation_type: string;
812
+ fields?: Record<string, unknown>;
813
+ confidence?: number;
814
+ agent_id?: string;
815
+ }
816
+ interface ExtractOntologyRequest {
817
+ ontology_schema_id: string;
818
+ source_uids: string[];
819
+ mode?: "propose_only" | "respect_policies" | "force_auto_apply";
820
+ }
821
+ type DomainObject = GraphNode;
620
822
 
621
823
  declare class MindGraphError extends Error {
622
824
  status: number;
@@ -980,6 +1182,113 @@ declare class MindGraph {
980
1182
  * Returns a `job_id` immediately; poll `getJob(id)` for progress.
981
1183
  */
982
1184
  runSynthesis(projectUid: string): Promise<SynthesisJobResponse>;
1185
+ listOntologySchemas(): Promise<{
1186
+ items: OntologySchema[];
1187
+ }>;
1188
+ getOntologySchema(id: string): Promise<OntologySchemaDetail>;
1189
+ createOntologySchema(req: CreateOntologySchemaRequest): Promise<OntologySchema>;
1190
+ updateOntologySchema(id: string, req: UpdateOntologySchemaRequest): Promise<OntologySchema>;
1191
+ activateOntologySchema(id: string): Promise<OntologySchema>;
1192
+ deprecateOntologySchema(id: string): Promise<OntologySchema>;
1193
+ archiveOntologySchema(id: string): Promise<OntologySchema>;
1194
+ /**
1195
+ * Kick off an LLM-driven schema proposal job.
1196
+ * Returns immediately with `{ schema_id, job_id }`; poll
1197
+ * `getOntologySchema(schema_id)` for streaming progress.
1198
+ */
1199
+ proposeOntologySchema(req: ProposeOntologySchemaRequest): Promise<{
1200
+ schema_id: string;
1201
+ job_id: string;
1202
+ }>;
1203
+ testOntologySchema(id: string, opts?: {
1204
+ example_queries?: string[];
1205
+ }): Promise<{
1206
+ job_id: string;
1207
+ }>;
1208
+ addOntologyObjectType(schemaId: string, req: OntologyObjectTypeInput): Promise<OntologyObjectType>;
1209
+ updateOntologyObjectType(schemaId: string, typeId: string, req: Partial<OntologyObjectTypeInput>): Promise<OntologyObjectType>;
1210
+ deleteOntologyObjectType(schemaId: string, typeId: string): Promise<OntologyObjectType>;
1211
+ addOntologyRelationType(schemaId: string, req: OntologyRelationTypeInput): Promise<OntologyRelationType>;
1212
+ updateOntologyRelationType(schemaId: string, typeId: string, req: Partial<OntologyRelationTypeInput>): Promise<OntologyRelationType>;
1213
+ deleteOntologyRelationType(schemaId: string, typeId: string): Promise<OntologyRelationType>;
1214
+ listOntologyProposals(opts?: {
1215
+ status?: string;
1216
+ schema_id?: string;
1217
+ object_type?: string;
1218
+ limit?: number;
1219
+ offset?: number;
1220
+ }): Promise<{
1221
+ items: OntologyProposal[];
1222
+ limit: number;
1223
+ offset: number;
1224
+ }>;
1225
+ getOntologyProposal(id: string): Promise<OntologyProposal>;
1226
+ patchOntologyProposal(id: string, req: {
1227
+ edits: ProposalEdits;
1228
+ }): Promise<OntologyProposal>;
1229
+ approveOntologyProposal(id: string, opts?: {
1230
+ feedback?: string;
1231
+ edits?: ProposalEdits;
1232
+ }): Promise<OntologyProposal>;
1233
+ rejectOntologyProposal(id: string, reason?: string): Promise<OntologyProposal>;
1234
+ applyOntologyProposal(id: string): Promise<{
1235
+ id: string;
1236
+ queued: boolean;
1237
+ }>;
1238
+ batchApproveOntologyProposals(ids: string[], feedback?: string): Promise<{
1239
+ processed: string[];
1240
+ skipped: {
1241
+ id: string;
1242
+ reason: string;
1243
+ }[];
1244
+ }>;
1245
+ batchRejectOntologyProposals(ids: string[], reason?: string): Promise<{
1246
+ processed: string[];
1247
+ skipped: {
1248
+ id: string;
1249
+ reason: string;
1250
+ }[];
1251
+ }>;
1252
+ queryOntology(req: OntologyQueryRequest): Promise<OntologyQueryResponse>;
1253
+ getDomainObject(uid: string): Promise<DomainObject>;
1254
+ getDomainObjectContext(uid: string, depth?: number): Promise<OntologyQueryResponse>;
1255
+ getDomainObjectHistory(uid: string): Promise<{
1256
+ versions: Array<{
1257
+ version: number;
1258
+ changed_at: string;
1259
+ changed_by: string;
1260
+ change_reason?: string;
1261
+ snapshot: unknown;
1262
+ }>;
1263
+ }>;
1264
+ listDomainObjects(opts: {
1265
+ schema_id: string;
1266
+ object_type?: string;
1267
+ limit?: number;
1268
+ offset?: number;
1269
+ sort?: string;
1270
+ }): Promise<{
1271
+ items: DomainObject[];
1272
+ limit: number;
1273
+ offset: number;
1274
+ has_more: boolean;
1275
+ }>;
1276
+ searchDomainObjects(query: string, opts?: {
1277
+ schema_id?: string;
1278
+ object_types?: string[];
1279
+ limit?: number;
1280
+ }): Promise<{
1281
+ items: Array<{
1282
+ object: DomainObject;
1283
+ score: number;
1284
+ }>;
1285
+ }>;
1286
+ linkDomainObjects(req: LinkDomainObjectsRequest): Promise<{
1287
+ edge_uid: string;
1288
+ }>;
1289
+ extractOntology(req: ExtractOntologyRequest): Promise<{
1290
+ job_id: string;
1291
+ }>;
983
1292
  }
984
1293
 
985
1294
  export { type AnalogyCandidate, type ArgumentRequest, type ArticleResult, type BatchRequest, 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 StructureRequest, type SynthesisJobResponse, type TheorySupportGap, type TraverseRequest };
package/dist/index.d.ts CHANGED
@@ -617,6 +617,208 @@ interface MindGraphConfig {
617
617
  /** Initial backoff in ms before first retry. Doubles each attempt. Default: 1000. */
618
618
  retryBackoffMs?: number;
619
619
  }
620
+ /** Field schema entry inside `OntologyObjectType.fields_json`. */
621
+ interface FieldDefinition {
622
+ name: string;
623
+ /** One of: string|number|integer|boolean|date|datetime|enum|reference|array|object|json */
624
+ type: string;
625
+ required?: boolean;
626
+ description?: string;
627
+ default?: unknown;
628
+ enum?: string[];
629
+ reference_object_type?: string;
630
+ array_item_type?: string;
631
+ extraction_hint?: string;
632
+ }
633
+ interface OntologySchema {
634
+ id: string;
635
+ org_id: string;
636
+ name: string;
637
+ description?: string;
638
+ status: "draft" | "active" | "deprecated" | "archived";
639
+ version: number;
640
+ propose_status?: "pending" | "running" | "ready" | "failed" | null;
641
+ propose_job_id?: string | null;
642
+ propose_error?: string | null;
643
+ created_by?: string | null;
644
+ updated_by?: string | null;
645
+ created_at: string;
646
+ updated_at: string;
647
+ activated_at?: string | null;
648
+ archived_at?: string | null;
649
+ }
650
+ interface OntologyObjectType {
651
+ id: string;
652
+ schema_id: string;
653
+ org_id: string;
654
+ name: string;
655
+ display_name?: string | null;
656
+ description?: string | null;
657
+ fields_json: FieldDefinition[];
658
+ required_fields: string[];
659
+ identity_fields: string[];
660
+ aliases: string[];
661
+ examples_json: Record<string, unknown>[];
662
+ extraction_hints?: string | null;
663
+ default_confidence: number;
664
+ review_policy: "always" | "low_confidence" | "never";
665
+ status: "active" | "deprecated" | "archived";
666
+ version: number;
667
+ created_at: string;
668
+ updated_at: string;
669
+ }
670
+ interface OntologyRelationType {
671
+ id: string;
672
+ schema_id: string;
673
+ org_id: string;
674
+ name: string;
675
+ display_name?: string | null;
676
+ description?: string | null;
677
+ source_type: string;
678
+ target_type: string;
679
+ cardinality?: "one_to_one" | "one_to_many" | "many_to_many" | null;
680
+ symmetric: boolean;
681
+ transitive: boolean;
682
+ inverse_relation_type?: string | null;
683
+ fields_json: FieldDefinition[];
684
+ extraction_hints?: string | null;
685
+ review_policy: "always" | "low_confidence" | "never";
686
+ status: "active" | "deprecated" | "archived";
687
+ version: number;
688
+ created_at: string;
689
+ updated_at: string;
690
+ }
691
+ interface OntologySchemaDetail extends OntologySchema {
692
+ object_types: OntologyObjectType[];
693
+ relation_types: OntologyRelationType[];
694
+ }
695
+ interface CreateOntologySchemaRequest {
696
+ name: string;
697
+ description?: string;
698
+ }
699
+ interface UpdateOntologySchemaRequest {
700
+ name?: string;
701
+ description?: string;
702
+ }
703
+ interface OntologyObjectTypeInput {
704
+ name: string;
705
+ display_name?: string;
706
+ description?: string;
707
+ fields?: FieldDefinition[];
708
+ required_fields?: string[];
709
+ identity_fields?: string[];
710
+ aliases?: string[];
711
+ examples?: Record<string, unknown>[];
712
+ extraction_hints?: string;
713
+ default_confidence?: number;
714
+ review_policy?: "always" | "low_confidence" | "never";
715
+ }
716
+ interface OntologyRelationTypeInput {
717
+ name: string;
718
+ display_name?: string;
719
+ description?: string;
720
+ source_type: string;
721
+ target_type: string;
722
+ cardinality?: "one_to_one" | "one_to_many" | "many_to_many";
723
+ symmetric?: boolean;
724
+ transitive?: boolean;
725
+ inverse_relation_type?: string;
726
+ fields?: FieldDefinition[];
727
+ extraction_hints?: string;
728
+ review_policy?: "always" | "low_confidence" | "never";
729
+ }
730
+ /** Status: pending | approved | approval_required | rejected | applied | apply_failed. */
731
+ interface OntologyProposal {
732
+ id: string;
733
+ org_id: string;
734
+ schema_id: string;
735
+ proposal_type: string;
736
+ proposed_by_agent_id?: string | null;
737
+ source_uids: string[];
738
+ source_scope_ids: string[];
739
+ changes_json: {
740
+ adds: Array<Record<string, unknown>>;
741
+ updates: Array<Record<string, unknown>>;
742
+ removes: Array<Record<string, unknown>>;
743
+ };
744
+ rationale?: string | null;
745
+ confidence?: number | null;
746
+ risk_level?: string | null;
747
+ review_status: string;
748
+ approval_uid?: string | null;
749
+ proposed_node_uid?: string | null;
750
+ applied_job_id?: string | null;
751
+ applied_error?: string | null;
752
+ apply_attempt_count: number;
753
+ edited_by?: string | null;
754
+ edited_at?: string | null;
755
+ original_snapshot?: Record<string, unknown> | null;
756
+ requires_manual_resolution: boolean;
757
+ created_at: string;
758
+ resolved_at?: string | null;
759
+ resolved_by?: string | null;
760
+ }
761
+ interface ProposalEdits {
762
+ canonical_name?: string;
763
+ fields?: Record<string, unknown>;
764
+ aliases?: string[];
765
+ }
766
+ interface ProposeOntologySchemaRequest {
767
+ description?: string;
768
+ template_hint?: "client_services" | "healthcare" | "supply_chain" | "research_intel" | "custom";
769
+ source_uids?: string[];
770
+ source_documents?: Array<{
771
+ content: string;
772
+ title?: string;
773
+ }>;
774
+ target_use_case?: string;
775
+ example_objects?: string[];
776
+ example_queries?: string[];
777
+ desired_workflows?: string[];
778
+ parent_schema_id?: string;
779
+ }
780
+ interface OntologyQueryRequest {
781
+ query: string;
782
+ schema_id: string;
783
+ object_types?: string[];
784
+ include_cognitive_context?: boolean;
785
+ include_sources?: boolean;
786
+ depth?: number;
787
+ limit?: number;
788
+ }
789
+ interface OntologyQueryResponse {
790
+ objects: GraphNode[];
791
+ relations: GraphEdge[];
792
+ cognitive_context: Record<string, GraphNode[]>;
793
+ external_refs: unknown[];
794
+ graph: {
795
+ nodes: GraphNode[];
796
+ edges: GraphEdge[];
797
+ };
798
+ provenance: Array<{
799
+ node_uid: string;
800
+ source_uid: string;
801
+ text_span: string;
802
+ }>;
803
+ confidence: {
804
+ overall: number;
805
+ };
806
+ truncated?: Record<string, boolean>;
807
+ }
808
+ interface LinkDomainObjectsRequest {
809
+ from_uid: string;
810
+ to_uid: string;
811
+ relation_type: string;
812
+ fields?: Record<string, unknown>;
813
+ confidence?: number;
814
+ agent_id?: string;
815
+ }
816
+ interface ExtractOntologyRequest {
817
+ ontology_schema_id: string;
818
+ source_uids: string[];
819
+ mode?: "propose_only" | "respect_policies" | "force_auto_apply";
820
+ }
821
+ type DomainObject = GraphNode;
620
822
 
621
823
  declare class MindGraphError extends Error {
622
824
  status: number;
@@ -980,6 +1182,113 @@ declare class MindGraph {
980
1182
  * Returns a `job_id` immediately; poll `getJob(id)` for progress.
981
1183
  */
982
1184
  runSynthesis(projectUid: string): Promise<SynthesisJobResponse>;
1185
+ listOntologySchemas(): Promise<{
1186
+ items: OntologySchema[];
1187
+ }>;
1188
+ getOntologySchema(id: string): Promise<OntologySchemaDetail>;
1189
+ createOntologySchema(req: CreateOntologySchemaRequest): Promise<OntologySchema>;
1190
+ updateOntologySchema(id: string, req: UpdateOntologySchemaRequest): Promise<OntologySchema>;
1191
+ activateOntologySchema(id: string): Promise<OntologySchema>;
1192
+ deprecateOntologySchema(id: string): Promise<OntologySchema>;
1193
+ archiveOntologySchema(id: string): Promise<OntologySchema>;
1194
+ /**
1195
+ * Kick off an LLM-driven schema proposal job.
1196
+ * Returns immediately with `{ schema_id, job_id }`; poll
1197
+ * `getOntologySchema(schema_id)` for streaming progress.
1198
+ */
1199
+ proposeOntologySchema(req: ProposeOntologySchemaRequest): Promise<{
1200
+ schema_id: string;
1201
+ job_id: string;
1202
+ }>;
1203
+ testOntologySchema(id: string, opts?: {
1204
+ example_queries?: string[];
1205
+ }): Promise<{
1206
+ job_id: string;
1207
+ }>;
1208
+ addOntologyObjectType(schemaId: string, req: OntologyObjectTypeInput): Promise<OntologyObjectType>;
1209
+ updateOntologyObjectType(schemaId: string, typeId: string, req: Partial<OntologyObjectTypeInput>): Promise<OntologyObjectType>;
1210
+ deleteOntologyObjectType(schemaId: string, typeId: string): Promise<OntologyObjectType>;
1211
+ addOntologyRelationType(schemaId: string, req: OntologyRelationTypeInput): Promise<OntologyRelationType>;
1212
+ updateOntologyRelationType(schemaId: string, typeId: string, req: Partial<OntologyRelationTypeInput>): Promise<OntologyRelationType>;
1213
+ deleteOntologyRelationType(schemaId: string, typeId: string): Promise<OntologyRelationType>;
1214
+ listOntologyProposals(opts?: {
1215
+ status?: string;
1216
+ schema_id?: string;
1217
+ object_type?: string;
1218
+ limit?: number;
1219
+ offset?: number;
1220
+ }): Promise<{
1221
+ items: OntologyProposal[];
1222
+ limit: number;
1223
+ offset: number;
1224
+ }>;
1225
+ getOntologyProposal(id: string): Promise<OntologyProposal>;
1226
+ patchOntologyProposal(id: string, req: {
1227
+ edits: ProposalEdits;
1228
+ }): Promise<OntologyProposal>;
1229
+ approveOntologyProposal(id: string, opts?: {
1230
+ feedback?: string;
1231
+ edits?: ProposalEdits;
1232
+ }): Promise<OntologyProposal>;
1233
+ rejectOntologyProposal(id: string, reason?: string): Promise<OntologyProposal>;
1234
+ applyOntologyProposal(id: string): Promise<{
1235
+ id: string;
1236
+ queued: boolean;
1237
+ }>;
1238
+ batchApproveOntologyProposals(ids: string[], feedback?: string): Promise<{
1239
+ processed: string[];
1240
+ skipped: {
1241
+ id: string;
1242
+ reason: string;
1243
+ }[];
1244
+ }>;
1245
+ batchRejectOntologyProposals(ids: string[], reason?: string): Promise<{
1246
+ processed: string[];
1247
+ skipped: {
1248
+ id: string;
1249
+ reason: string;
1250
+ }[];
1251
+ }>;
1252
+ queryOntology(req: OntologyQueryRequest): Promise<OntologyQueryResponse>;
1253
+ getDomainObject(uid: string): Promise<DomainObject>;
1254
+ getDomainObjectContext(uid: string, depth?: number): Promise<OntologyQueryResponse>;
1255
+ getDomainObjectHistory(uid: string): Promise<{
1256
+ versions: Array<{
1257
+ version: number;
1258
+ changed_at: string;
1259
+ changed_by: string;
1260
+ change_reason?: string;
1261
+ snapshot: unknown;
1262
+ }>;
1263
+ }>;
1264
+ listDomainObjects(opts: {
1265
+ schema_id: string;
1266
+ object_type?: string;
1267
+ limit?: number;
1268
+ offset?: number;
1269
+ sort?: string;
1270
+ }): Promise<{
1271
+ items: DomainObject[];
1272
+ limit: number;
1273
+ offset: number;
1274
+ has_more: boolean;
1275
+ }>;
1276
+ searchDomainObjects(query: string, opts?: {
1277
+ schema_id?: string;
1278
+ object_types?: string[];
1279
+ limit?: number;
1280
+ }): Promise<{
1281
+ items: Array<{
1282
+ object: DomainObject;
1283
+ score: number;
1284
+ }>;
1285
+ }>;
1286
+ linkDomainObjects(req: LinkDomainObjectsRequest): Promise<{
1287
+ edge_uid: string;
1288
+ }>;
1289
+ extractOntology(req: ExtractOntologyRequest): Promise<{
1290
+ job_id: string;
1291
+ }>;
983
1292
  }
984
1293
 
985
1294
  export { type AnalogyCandidate, type ArgumentRequest, type ArticleResult, type BatchRequest, 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 StructureRequest, type SynthesisJobResponse, type TheorySupportGap, type TraverseRequest };
package/dist/index.js CHANGED
@@ -639,6 +639,136 @@ var MindGraph = class {
639
639
  async runSynthesis(projectUid) {
640
640
  return this.post(`/synthesis/run/${projectUid}`, {});
641
641
  }
642
+ // ============================================================================
643
+ // Operational Ontology Layer (Layer 7)
644
+ // ============================================================================
645
+ // ---- Schema management (cloud Postgres) ----
646
+ async listOntologySchemas() {
647
+ return this.get("/v1/ontology/schemas");
648
+ }
649
+ async getOntologySchema(id) {
650
+ return this.get(`/v1/ontology/schemas/${id}`);
651
+ }
652
+ async createOntologySchema(req) {
653
+ return this.post("/v1/ontology/schemas", req);
654
+ }
655
+ async updateOntologySchema(id, req) {
656
+ return this.patch(`/v1/ontology/schemas/${id}`, req);
657
+ }
658
+ async activateOntologySchema(id) {
659
+ return this.post(`/v1/ontology/schemas/${id}/activate`, {});
660
+ }
661
+ async deprecateOntologySchema(id) {
662
+ return this.post(`/v1/ontology/schemas/${id}/deprecate`, {});
663
+ }
664
+ async archiveOntologySchema(id) {
665
+ return this.del(`/v1/ontology/schemas/${id}`);
666
+ }
667
+ /**
668
+ * Kick off an LLM-driven schema proposal job.
669
+ * Returns immediately with `{ schema_id, job_id }`; poll
670
+ * `getOntologySchema(schema_id)` for streaming progress.
671
+ */
672
+ async proposeOntologySchema(req) {
673
+ return this.post("/v1/ontology/propose-schema", req);
674
+ }
675
+ async testOntologySchema(id, opts) {
676
+ return this.post(`/v1/ontology/schemas/${id}/test`, opts ?? {});
677
+ }
678
+ // ---- Schema sub-resources ----
679
+ async addOntologyObjectType(schemaId, req) {
680
+ return this.post(`/v1/ontology/schemas/${schemaId}/object-types`, req);
681
+ }
682
+ async updateOntologyObjectType(schemaId, typeId, req) {
683
+ return this.patch(
684
+ `/v1/ontology/schemas/${schemaId}/object-types/${typeId}`,
685
+ req
686
+ );
687
+ }
688
+ async deleteOntologyObjectType(schemaId, typeId) {
689
+ return this.del(
690
+ `/v1/ontology/schemas/${schemaId}/object-types/${typeId}`
691
+ );
692
+ }
693
+ async addOntologyRelationType(schemaId, req) {
694
+ return this.post(`/v1/ontology/schemas/${schemaId}/relation-types`, req);
695
+ }
696
+ async updateOntologyRelationType(schemaId, typeId, req) {
697
+ return this.patch(
698
+ `/v1/ontology/schemas/${schemaId}/relation-types/${typeId}`,
699
+ req
700
+ );
701
+ }
702
+ async deleteOntologyRelationType(schemaId, typeId) {
703
+ return this.del(
704
+ `/v1/ontology/schemas/${schemaId}/relation-types/${typeId}`
705
+ );
706
+ }
707
+ // ---- Proposals ----
708
+ async listOntologyProposals(opts) {
709
+ const q = new URLSearchParams();
710
+ if (opts?.status) q.set("status", opts.status);
711
+ if (opts?.schema_id) q.set("schema_id", opts.schema_id);
712
+ if (opts?.object_type) q.set("object_type", opts.object_type);
713
+ if (opts?.limit != null) q.set("limit", String(opts.limit));
714
+ if (opts?.offset != null) q.set("offset", String(opts.offset));
715
+ const qs = q.toString();
716
+ return this.get(`/v1/ontology/proposals${qs ? `?${qs}` : ""}`);
717
+ }
718
+ async getOntologyProposal(id) {
719
+ return this.get(`/v1/ontology/proposals/${id}`);
720
+ }
721
+ async patchOntologyProposal(id, req) {
722
+ return this.patch(`/v1/ontology/proposals/${id}`, req);
723
+ }
724
+ async approveOntologyProposal(id, opts) {
725
+ return this.post(`/v1/ontology/proposals/${id}/approve`, opts ?? {});
726
+ }
727
+ async rejectOntologyProposal(id, reason) {
728
+ return this.post(`/v1/ontology/proposals/${id}/reject`, { reason });
729
+ }
730
+ async applyOntologyProposal(id) {
731
+ return this.post(`/v1/ontology/proposals/${id}/apply`, {});
732
+ }
733
+ async batchApproveOntologyProposals(ids, feedback) {
734
+ return this.post("/v1/ontology/proposals/batch-approve", { ids, feedback });
735
+ }
736
+ async batchRejectOntologyProposals(ids, reason) {
737
+ return this.post("/v1/ontology/proposals/batch-reject", { ids, reason });
738
+ }
739
+ // ---- Retrieval (graph server) ----
740
+ async queryOntology(req) {
741
+ return this.post("/ontology/query", req);
742
+ }
743
+ async getDomainObject(uid) {
744
+ return this.get(`/ontology/object/${uid}`);
745
+ }
746
+ async getDomainObjectContext(uid, depth) {
747
+ const qs = depth != null ? `?depth=${depth}` : "";
748
+ return this.get(`/ontology/object/${uid}/context${qs}`);
749
+ }
750
+ async getDomainObjectHistory(uid) {
751
+ return this.get(`/ontology/object/${uid}/history`);
752
+ }
753
+ async listDomainObjects(opts) {
754
+ const q = new URLSearchParams();
755
+ q.set("schema_id", opts.schema_id);
756
+ if (opts.object_type) q.set("object_type", opts.object_type);
757
+ if (opts.limit != null) q.set("limit", String(opts.limit));
758
+ if (opts.offset != null) q.set("offset", String(opts.offset));
759
+ if (opts.sort) q.set("sort", opts.sort);
760
+ return this.get(`/ontology/objects?${q.toString()}`);
761
+ }
762
+ async searchDomainObjects(query, opts) {
763
+ return this.post("/ontology/objects/search", { query, ...opts ?? {} });
764
+ }
765
+ async linkDomainObjects(req) {
766
+ return this.post("/ontology/relation", { action: "create", ...req });
767
+ }
768
+ // ---- Extraction ----
769
+ async extractOntology(req) {
770
+ return this.post("/ontology/extract", req);
771
+ }
642
772
  };
643
773
  // Annotate the CommonJS export names for ESM import in node:
644
774
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -612,6 +612,136 @@ var MindGraph = class {
612
612
  async runSynthesis(projectUid) {
613
613
  return this.post(`/synthesis/run/${projectUid}`, {});
614
614
  }
615
+ // ============================================================================
616
+ // Operational Ontology Layer (Layer 7)
617
+ // ============================================================================
618
+ // ---- Schema management (cloud Postgres) ----
619
+ async listOntologySchemas() {
620
+ return this.get("/v1/ontology/schemas");
621
+ }
622
+ async getOntologySchema(id) {
623
+ return this.get(`/v1/ontology/schemas/${id}`);
624
+ }
625
+ async createOntologySchema(req) {
626
+ return this.post("/v1/ontology/schemas", req);
627
+ }
628
+ async updateOntologySchema(id, req) {
629
+ return this.patch(`/v1/ontology/schemas/${id}`, req);
630
+ }
631
+ async activateOntologySchema(id) {
632
+ return this.post(`/v1/ontology/schemas/${id}/activate`, {});
633
+ }
634
+ async deprecateOntologySchema(id) {
635
+ return this.post(`/v1/ontology/schemas/${id}/deprecate`, {});
636
+ }
637
+ async archiveOntologySchema(id) {
638
+ return this.del(`/v1/ontology/schemas/${id}`);
639
+ }
640
+ /**
641
+ * Kick off an LLM-driven schema proposal job.
642
+ * Returns immediately with `{ schema_id, job_id }`; poll
643
+ * `getOntologySchema(schema_id)` for streaming progress.
644
+ */
645
+ async proposeOntologySchema(req) {
646
+ return this.post("/v1/ontology/propose-schema", req);
647
+ }
648
+ async testOntologySchema(id, opts) {
649
+ return this.post(`/v1/ontology/schemas/${id}/test`, opts ?? {});
650
+ }
651
+ // ---- Schema sub-resources ----
652
+ async addOntologyObjectType(schemaId, req) {
653
+ return this.post(`/v1/ontology/schemas/${schemaId}/object-types`, req);
654
+ }
655
+ async updateOntologyObjectType(schemaId, typeId, req) {
656
+ return this.patch(
657
+ `/v1/ontology/schemas/${schemaId}/object-types/${typeId}`,
658
+ req
659
+ );
660
+ }
661
+ async deleteOntologyObjectType(schemaId, typeId) {
662
+ return this.del(
663
+ `/v1/ontology/schemas/${schemaId}/object-types/${typeId}`
664
+ );
665
+ }
666
+ async addOntologyRelationType(schemaId, req) {
667
+ return this.post(`/v1/ontology/schemas/${schemaId}/relation-types`, req);
668
+ }
669
+ async updateOntologyRelationType(schemaId, typeId, req) {
670
+ return this.patch(
671
+ `/v1/ontology/schemas/${schemaId}/relation-types/${typeId}`,
672
+ req
673
+ );
674
+ }
675
+ async deleteOntologyRelationType(schemaId, typeId) {
676
+ return this.del(
677
+ `/v1/ontology/schemas/${schemaId}/relation-types/${typeId}`
678
+ );
679
+ }
680
+ // ---- Proposals ----
681
+ async listOntologyProposals(opts) {
682
+ const q = new URLSearchParams();
683
+ if (opts?.status) q.set("status", opts.status);
684
+ if (opts?.schema_id) q.set("schema_id", opts.schema_id);
685
+ if (opts?.object_type) q.set("object_type", opts.object_type);
686
+ if (opts?.limit != null) q.set("limit", String(opts.limit));
687
+ if (opts?.offset != null) q.set("offset", String(opts.offset));
688
+ const qs = q.toString();
689
+ return this.get(`/v1/ontology/proposals${qs ? `?${qs}` : ""}`);
690
+ }
691
+ async getOntologyProposal(id) {
692
+ return this.get(`/v1/ontology/proposals/${id}`);
693
+ }
694
+ async patchOntologyProposal(id, req) {
695
+ return this.patch(`/v1/ontology/proposals/${id}`, req);
696
+ }
697
+ async approveOntologyProposal(id, opts) {
698
+ return this.post(`/v1/ontology/proposals/${id}/approve`, opts ?? {});
699
+ }
700
+ async rejectOntologyProposal(id, reason) {
701
+ return this.post(`/v1/ontology/proposals/${id}/reject`, { reason });
702
+ }
703
+ async applyOntologyProposal(id) {
704
+ return this.post(`/v1/ontology/proposals/${id}/apply`, {});
705
+ }
706
+ async batchApproveOntologyProposals(ids, feedback) {
707
+ return this.post("/v1/ontology/proposals/batch-approve", { ids, feedback });
708
+ }
709
+ async batchRejectOntologyProposals(ids, reason) {
710
+ return this.post("/v1/ontology/proposals/batch-reject", { ids, reason });
711
+ }
712
+ // ---- Retrieval (graph server) ----
713
+ async queryOntology(req) {
714
+ return this.post("/ontology/query", req);
715
+ }
716
+ async getDomainObject(uid) {
717
+ return this.get(`/ontology/object/${uid}`);
718
+ }
719
+ async getDomainObjectContext(uid, depth) {
720
+ const qs = depth != null ? `?depth=${depth}` : "";
721
+ return this.get(`/ontology/object/${uid}/context${qs}`);
722
+ }
723
+ async getDomainObjectHistory(uid) {
724
+ return this.get(`/ontology/object/${uid}/history`);
725
+ }
726
+ async listDomainObjects(opts) {
727
+ const q = new URLSearchParams();
728
+ q.set("schema_id", opts.schema_id);
729
+ if (opts.object_type) q.set("object_type", opts.object_type);
730
+ if (opts.limit != null) q.set("limit", String(opts.limit));
731
+ if (opts.offset != null) q.set("offset", String(opts.offset));
732
+ if (opts.sort) q.set("sort", opts.sort);
733
+ return this.get(`/ontology/objects?${q.toString()}`);
734
+ }
735
+ async searchDomainObjects(query, opts) {
736
+ return this.post("/ontology/objects/search", { query, ...opts ?? {} });
737
+ }
738
+ async linkDomainObjects(req) {
739
+ return this.post("/ontology/relation", { action: "create", ...req });
740
+ }
741
+ // ---- Extraction ----
742
+ async extractOntology(req) {
743
+ return this.post("/ontology/extract", req);
744
+ }
615
745
  };
616
746
  export {
617
747
  MindGraph,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "TypeScript client for the MindGraph Cloud API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",