@claude-flow/plugin-hyperbolic-reasoning 3.0.0-alpha.1

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.
@@ -0,0 +1,1013 @@
1
+ /**
2
+ * Hyperbolic Reasoning Plugin - Type Definitions
3
+ *
4
+ * Types for hyperbolic geometry operations including Poincare ball embeddings,
5
+ * taxonomic reasoning, hierarchy comparison, and entailment graphs.
6
+ */
7
+ import { z } from 'zod';
8
+ /**
9
+ * Point in hyperbolic space (Poincare ball model)
10
+ */
11
+ export interface HyperbolicPoint {
12
+ /** Coordinates in the Poincare ball (norm < 1) */
13
+ readonly coordinates: Float32Array;
14
+ /** Curvature parameter (negative) */
15
+ readonly curvature: number;
16
+ /** Dimension of the space */
17
+ readonly dimension: number;
18
+ }
19
+ /**
20
+ * Hyperbolic model type
21
+ */
22
+ export type HyperbolicModel = 'poincare_ball' | 'lorentz' | 'klein' | 'half_plane';
23
+ /**
24
+ * Mobius transformation parameters
25
+ */
26
+ export interface MobiusTransform {
27
+ /** Translation vector */
28
+ readonly translation: Float32Array;
29
+ /** Rotation matrix (flattened) */
30
+ readonly rotation?: Float32Array;
31
+ /** Scale factor */
32
+ readonly scale: number;
33
+ }
34
+ /**
35
+ * Node in a hierarchy
36
+ */
37
+ export interface HierarchyNode {
38
+ /** Unique node identifier */
39
+ readonly id: string;
40
+ /** Parent node ID (null for root) */
41
+ readonly parent: string | null;
42
+ /** Node features for embedding */
43
+ readonly features?: Record<string, unknown>;
44
+ /** Node label/name */
45
+ readonly label?: string;
46
+ /** Depth in tree (0 for root) */
47
+ readonly depth?: number;
48
+ }
49
+ /**
50
+ * Edge in a hierarchy (for DAGs)
51
+ */
52
+ export interface HierarchyEdge {
53
+ /** Source node ID */
54
+ readonly source: string;
55
+ /** Target node ID */
56
+ readonly target: string;
57
+ /** Edge weight */
58
+ readonly weight?: number;
59
+ /** Edge type */
60
+ readonly type?: string;
61
+ }
62
+ /**
63
+ * Complete hierarchy structure
64
+ */
65
+ export interface Hierarchy {
66
+ /** All nodes */
67
+ readonly nodes: ReadonlyArray<HierarchyNode>;
68
+ /** Optional edges (for DAGs) */
69
+ readonly edges?: ReadonlyArray<HierarchyEdge>;
70
+ /** Root node ID */
71
+ readonly root?: string;
72
+ }
73
+ /**
74
+ * Embedded hierarchy with hyperbolic coordinates
75
+ */
76
+ export interface EmbeddedHierarchy {
77
+ /** Node embeddings as id -> HyperbolicPoint */
78
+ readonly embeddings: Map<string, HyperbolicPoint>;
79
+ /** Model parameters */
80
+ readonly model: HyperbolicModel;
81
+ /** Learned or fixed curvature */
82
+ readonly curvature: number;
83
+ /** Embedding dimension */
84
+ readonly dimension: number;
85
+ /** Embedding quality metrics */
86
+ readonly metrics: {
87
+ readonly distortionMean: number;
88
+ readonly distortionMax: number;
89
+ readonly mapScore: number;
90
+ };
91
+ }
92
+ /**
93
+ * Taxonomic query type
94
+ */
95
+ export type TaxonomicQueryType = 'is_a' | 'subsumption' | 'lowest_common_ancestor' | 'path' | 'similarity';
96
+ /**
97
+ * Taxonomic query
98
+ */
99
+ export interface TaxonomicQuery {
100
+ /** Query type */
101
+ readonly type: TaxonomicQueryType;
102
+ /** Subject concept */
103
+ readonly subject: string;
104
+ /** Object concept (optional for some queries) */
105
+ readonly object?: string;
106
+ }
107
+ /**
108
+ * Inference configuration
109
+ */
110
+ export interface InferenceConfig {
111
+ /** Allow transitive reasoning */
112
+ readonly transitive: boolean;
113
+ /** Enable fuzzy matching */
114
+ readonly fuzzy: boolean;
115
+ /** Confidence threshold */
116
+ readonly confidence: number;
117
+ }
118
+ /**
119
+ * Taxonomic reasoning result
120
+ */
121
+ export interface TaxonomicResult {
122
+ /** Query result (boolean for is_a, etc.) */
123
+ readonly result: boolean | string | string[] | number;
124
+ /** Confidence in the result */
125
+ readonly confidence: number;
126
+ /** Explanation of reasoning path */
127
+ readonly explanation: string;
128
+ /** Intermediate steps if transitive */
129
+ readonly steps?: ReadonlyArray<{
130
+ readonly from: string;
131
+ readonly to: string;
132
+ readonly relation: string;
133
+ readonly confidence: number;
134
+ }>;
135
+ }
136
+ /**
137
+ * Search mode for hierarchical search
138
+ */
139
+ export type SearchMode = 'nearest' | 'subtree' | 'ancestors' | 'siblings' | 'cone';
140
+ /**
141
+ * Search constraints
142
+ */
143
+ export interface SearchConstraints {
144
+ /** Maximum depth from root */
145
+ readonly maxDepth?: number;
146
+ /** Minimum depth from root */
147
+ readonly minDepth?: number;
148
+ /** Restrict to subtree of this node */
149
+ readonly subtreeRoot?: string;
150
+ /** Filter by node type */
151
+ readonly nodeTypes?: ReadonlyArray<string>;
152
+ }
153
+ /**
154
+ * Search result item
155
+ */
156
+ export interface SearchResultItem {
157
+ /** Node ID */
158
+ readonly id: string;
159
+ /** Hyperbolic distance */
160
+ readonly distance: number;
161
+ /** Euclidean similarity (for comparison) */
162
+ readonly similarity?: number;
163
+ /** Node metadata */
164
+ readonly metadata?: Record<string, unknown>;
165
+ /** Path from root */
166
+ readonly path?: ReadonlyArray<string>;
167
+ }
168
+ /**
169
+ * Search result
170
+ */
171
+ export interface SearchResult {
172
+ /** Matching items */
173
+ readonly items: ReadonlyArray<SearchResultItem>;
174
+ /** Total candidates considered */
175
+ readonly totalCandidates: number;
176
+ /** Search time in ms */
177
+ readonly searchTimeMs: number;
178
+ }
179
+ /**
180
+ * Alignment method for comparing hierarchies
181
+ */
182
+ export type AlignmentMethod = 'wasserstein' | 'gromov_wasserstein' | 'tree_edit' | 'subtree_isomorphism';
183
+ /**
184
+ * Comparison metric
185
+ */
186
+ export type ComparisonMetric = 'structural_similarity' | 'semantic_similarity' | 'coverage' | 'precision';
187
+ /**
188
+ * Node alignment pair
189
+ */
190
+ export interface NodeAlignment {
191
+ /** Source node ID */
192
+ readonly source: string;
193
+ /** Target node ID */
194
+ readonly target: string;
195
+ /** Alignment confidence */
196
+ readonly confidence: number;
197
+ }
198
+ /**
199
+ * Hierarchy comparison result
200
+ */
201
+ export interface ComparisonResult {
202
+ /** Overall similarity score (0-1) */
203
+ readonly similarity: number;
204
+ /** Node alignments */
205
+ readonly alignments: ReadonlyArray<NodeAlignment>;
206
+ /** Metrics */
207
+ readonly metrics: Record<ComparisonMetric, number>;
208
+ /** Unmatched source nodes */
209
+ readonly unmatchedSource: ReadonlyArray<string>;
210
+ /** Unmatched target nodes */
211
+ readonly unmatchedTarget: ReadonlyArray<string>;
212
+ /** Edit operations for tree edit distance */
213
+ readonly editOperations?: ReadonlyArray<{
214
+ readonly type: 'insert' | 'delete' | 'rename' | 'move';
215
+ readonly node: string;
216
+ readonly cost: number;
217
+ }>;
218
+ }
219
+ /**
220
+ * Concept for entailment graph
221
+ */
222
+ export interface Concept {
223
+ /** Unique concept ID */
224
+ readonly id: string;
225
+ /** Concept text/description */
226
+ readonly text: string;
227
+ /** Concept type/category */
228
+ readonly type?: string;
229
+ /** Pre-computed embedding */
230
+ readonly embedding?: Float32Array;
231
+ }
232
+ /**
233
+ * Entailment relation
234
+ */
235
+ export interface EntailmentRelation {
236
+ /** Premise concept ID */
237
+ readonly premise: string;
238
+ /** Hypothesis concept ID */
239
+ readonly hypothesis: string;
240
+ /** Entailment confidence */
241
+ readonly confidence: number;
242
+ /** Relation type */
243
+ readonly type: 'entails' | 'contradicts' | 'neutral';
244
+ }
245
+ /**
246
+ * Entailment graph action
247
+ */
248
+ export type EntailmentAction = 'build' | 'query' | 'expand' | 'prune';
249
+ /**
250
+ * Prune strategy
251
+ */
252
+ export type PruneStrategy = 'none' | 'transitive_reduction' | 'confidence_threshold';
253
+ /**
254
+ * Entailment graph
255
+ */
256
+ export interface EntailmentGraph {
257
+ /** All concepts */
258
+ readonly concepts: ReadonlyArray<Concept>;
259
+ /** Entailment relations */
260
+ readonly relations: ReadonlyArray<EntailmentRelation>;
261
+ /** Whether transitive closure is computed */
262
+ readonly transitiveClosure: boolean;
263
+ /** Graph statistics */
264
+ readonly stats: {
265
+ readonly nodeCount: number;
266
+ readonly edgeCount: number;
267
+ readonly density: number;
268
+ readonly maxDepth: number;
269
+ };
270
+ }
271
+ /**
272
+ * Entailment query result
273
+ */
274
+ export interface EntailmentQueryResult {
275
+ /** Direct entailments */
276
+ readonly direct: ReadonlyArray<EntailmentRelation>;
277
+ /** Transitive entailments */
278
+ readonly transitive?: ReadonlyArray<EntailmentRelation>;
279
+ /** Contradiction paths */
280
+ readonly contradictions?: ReadonlyArray<ReadonlyArray<string>>;
281
+ }
282
+ export declare const HierarchyNodeSchema: z.ZodObject<{
283
+ id: z.ZodString;
284
+ parent: z.ZodNullable<z.ZodString>;
285
+ features: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
286
+ label: z.ZodOptional<z.ZodString>;
287
+ depth: z.ZodOptional<z.ZodNumber>;
288
+ }, "strip", z.ZodTypeAny, {
289
+ id: string;
290
+ parent: string | null;
291
+ features?: Record<string, unknown> | undefined;
292
+ label?: string | undefined;
293
+ depth?: number | undefined;
294
+ }, {
295
+ id: string;
296
+ parent: string | null;
297
+ features?: Record<string, unknown> | undefined;
298
+ label?: string | undefined;
299
+ depth?: number | undefined;
300
+ }>;
301
+ export declare const HierarchyEdgeSchema: z.ZodObject<{
302
+ source: z.ZodString;
303
+ target: z.ZodString;
304
+ weight: z.ZodOptional<z.ZodNumber>;
305
+ type: z.ZodOptional<z.ZodString>;
306
+ }, "strip", z.ZodTypeAny, {
307
+ source: string;
308
+ target: string;
309
+ type?: string | undefined;
310
+ weight?: number | undefined;
311
+ }, {
312
+ source: string;
313
+ target: string;
314
+ type?: string | undefined;
315
+ weight?: number | undefined;
316
+ }>;
317
+ export declare const HierarchySchema: z.ZodObject<{
318
+ nodes: z.ZodArray<z.ZodObject<{
319
+ id: z.ZodString;
320
+ parent: z.ZodNullable<z.ZodString>;
321
+ features: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
322
+ label: z.ZodOptional<z.ZodString>;
323
+ depth: z.ZodOptional<z.ZodNumber>;
324
+ }, "strip", z.ZodTypeAny, {
325
+ id: string;
326
+ parent: string | null;
327
+ features?: Record<string, unknown> | undefined;
328
+ label?: string | undefined;
329
+ depth?: number | undefined;
330
+ }, {
331
+ id: string;
332
+ parent: string | null;
333
+ features?: Record<string, unknown> | undefined;
334
+ label?: string | undefined;
335
+ depth?: number | undefined;
336
+ }>, "many">;
337
+ edges: z.ZodOptional<z.ZodArray<z.ZodObject<{
338
+ source: z.ZodString;
339
+ target: z.ZodString;
340
+ weight: z.ZodOptional<z.ZodNumber>;
341
+ type: z.ZodOptional<z.ZodString>;
342
+ }, "strip", z.ZodTypeAny, {
343
+ source: string;
344
+ target: string;
345
+ type?: string | undefined;
346
+ weight?: number | undefined;
347
+ }, {
348
+ source: string;
349
+ target: string;
350
+ type?: string | undefined;
351
+ weight?: number | undefined;
352
+ }>, "many">>;
353
+ root: z.ZodOptional<z.ZodString>;
354
+ }, "strip", z.ZodTypeAny, {
355
+ nodes: {
356
+ id: string;
357
+ parent: string | null;
358
+ features?: Record<string, unknown> | undefined;
359
+ label?: string | undefined;
360
+ depth?: number | undefined;
361
+ }[];
362
+ edges?: {
363
+ source: string;
364
+ target: string;
365
+ type?: string | undefined;
366
+ weight?: number | undefined;
367
+ }[] | undefined;
368
+ root?: string | undefined;
369
+ }, {
370
+ nodes: {
371
+ id: string;
372
+ parent: string | null;
373
+ features?: Record<string, unknown> | undefined;
374
+ label?: string | undefined;
375
+ depth?: number | undefined;
376
+ }[];
377
+ edges?: {
378
+ source: string;
379
+ target: string;
380
+ type?: string | undefined;
381
+ weight?: number | undefined;
382
+ }[] | undefined;
383
+ root?: string | undefined;
384
+ }>;
385
+ export declare const EmbedHierarchyInputSchema: z.ZodObject<{
386
+ hierarchy: z.ZodObject<{
387
+ nodes: z.ZodArray<z.ZodObject<{
388
+ id: z.ZodString;
389
+ parent: z.ZodNullable<z.ZodString>;
390
+ features: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
391
+ label: z.ZodOptional<z.ZodString>;
392
+ depth: z.ZodOptional<z.ZodNumber>;
393
+ }, "strip", z.ZodTypeAny, {
394
+ id: string;
395
+ parent: string | null;
396
+ features?: Record<string, unknown> | undefined;
397
+ label?: string | undefined;
398
+ depth?: number | undefined;
399
+ }, {
400
+ id: string;
401
+ parent: string | null;
402
+ features?: Record<string, unknown> | undefined;
403
+ label?: string | undefined;
404
+ depth?: number | undefined;
405
+ }>, "many">;
406
+ edges: z.ZodOptional<z.ZodArray<z.ZodObject<{
407
+ source: z.ZodString;
408
+ target: z.ZodString;
409
+ weight: z.ZodOptional<z.ZodNumber>;
410
+ type: z.ZodOptional<z.ZodString>;
411
+ }, "strip", z.ZodTypeAny, {
412
+ source: string;
413
+ target: string;
414
+ type?: string | undefined;
415
+ weight?: number | undefined;
416
+ }, {
417
+ source: string;
418
+ target: string;
419
+ type?: string | undefined;
420
+ weight?: number | undefined;
421
+ }>, "many">>;
422
+ root: z.ZodOptional<z.ZodString>;
423
+ }, "strip", z.ZodTypeAny, {
424
+ nodes: {
425
+ id: string;
426
+ parent: string | null;
427
+ features?: Record<string, unknown> | undefined;
428
+ label?: string | undefined;
429
+ depth?: number | undefined;
430
+ }[];
431
+ edges?: {
432
+ source: string;
433
+ target: string;
434
+ type?: string | undefined;
435
+ weight?: number | undefined;
436
+ }[] | undefined;
437
+ root?: string | undefined;
438
+ }, {
439
+ nodes: {
440
+ id: string;
441
+ parent: string | null;
442
+ features?: Record<string, unknown> | undefined;
443
+ label?: string | undefined;
444
+ depth?: number | undefined;
445
+ }[];
446
+ edges?: {
447
+ source: string;
448
+ target: string;
449
+ type?: string | undefined;
450
+ weight?: number | undefined;
451
+ }[] | undefined;
452
+ root?: string | undefined;
453
+ }>;
454
+ model: z.ZodDefault<z.ZodEnum<["poincare_ball", "lorentz", "klein", "half_plane"]>>;
455
+ parameters: z.ZodOptional<z.ZodObject<{
456
+ dimensions: z.ZodDefault<z.ZodNumber>;
457
+ curvature: z.ZodDefault<z.ZodNumber>;
458
+ learnCurvature: z.ZodDefault<z.ZodBoolean>;
459
+ epochs: z.ZodDefault<z.ZodNumber>;
460
+ learningRate: z.ZodDefault<z.ZodNumber>;
461
+ }, "strip", z.ZodTypeAny, {
462
+ dimensions: number;
463
+ curvature: number;
464
+ learnCurvature: boolean;
465
+ epochs: number;
466
+ learningRate: number;
467
+ }, {
468
+ dimensions?: number | undefined;
469
+ curvature?: number | undefined;
470
+ learnCurvature?: boolean | undefined;
471
+ epochs?: number | undefined;
472
+ learningRate?: number | undefined;
473
+ }>>;
474
+ }, "strip", z.ZodTypeAny, {
475
+ hierarchy: {
476
+ nodes: {
477
+ id: string;
478
+ parent: string | null;
479
+ features?: Record<string, unknown> | undefined;
480
+ label?: string | undefined;
481
+ depth?: number | undefined;
482
+ }[];
483
+ edges?: {
484
+ source: string;
485
+ target: string;
486
+ type?: string | undefined;
487
+ weight?: number | undefined;
488
+ }[] | undefined;
489
+ root?: string | undefined;
490
+ };
491
+ model: "poincare_ball" | "lorentz" | "klein" | "half_plane";
492
+ parameters?: {
493
+ dimensions: number;
494
+ curvature: number;
495
+ learnCurvature: boolean;
496
+ epochs: number;
497
+ learningRate: number;
498
+ } | undefined;
499
+ }, {
500
+ hierarchy: {
501
+ nodes: {
502
+ id: string;
503
+ parent: string | null;
504
+ features?: Record<string, unknown> | undefined;
505
+ label?: string | undefined;
506
+ depth?: number | undefined;
507
+ }[];
508
+ edges?: {
509
+ source: string;
510
+ target: string;
511
+ type?: string | undefined;
512
+ weight?: number | undefined;
513
+ }[] | undefined;
514
+ root?: string | undefined;
515
+ };
516
+ model?: "poincare_ball" | "lorentz" | "klein" | "half_plane" | undefined;
517
+ parameters?: {
518
+ dimensions?: number | undefined;
519
+ curvature?: number | undefined;
520
+ learnCurvature?: boolean | undefined;
521
+ epochs?: number | undefined;
522
+ learningRate?: number | undefined;
523
+ } | undefined;
524
+ }>;
525
+ export type EmbedHierarchyInput = z.infer<typeof EmbedHierarchyInputSchema>;
526
+ export declare const TaxonomicReasonInputSchema: z.ZodObject<{
527
+ query: z.ZodObject<{
528
+ type: z.ZodEnum<["is_a", "subsumption", "lowest_common_ancestor", "path", "similarity"]>;
529
+ subject: z.ZodString;
530
+ object: z.ZodOptional<z.ZodString>;
531
+ }, "strip", z.ZodTypeAny, {
532
+ type: "is_a" | "subsumption" | "lowest_common_ancestor" | "path" | "similarity";
533
+ subject: string;
534
+ object?: string | undefined;
535
+ }, {
536
+ type: "is_a" | "subsumption" | "lowest_common_ancestor" | "path" | "similarity";
537
+ subject: string;
538
+ object?: string | undefined;
539
+ }>;
540
+ taxonomy: z.ZodString;
541
+ inference: z.ZodOptional<z.ZodObject<{
542
+ transitive: z.ZodDefault<z.ZodBoolean>;
543
+ fuzzy: z.ZodDefault<z.ZodBoolean>;
544
+ confidence: z.ZodDefault<z.ZodNumber>;
545
+ }, "strip", z.ZodTypeAny, {
546
+ transitive: boolean;
547
+ fuzzy: boolean;
548
+ confidence: number;
549
+ }, {
550
+ transitive?: boolean | undefined;
551
+ fuzzy?: boolean | undefined;
552
+ confidence?: number | undefined;
553
+ }>>;
554
+ }, "strip", z.ZodTypeAny, {
555
+ query: {
556
+ type: "is_a" | "subsumption" | "lowest_common_ancestor" | "path" | "similarity";
557
+ subject: string;
558
+ object?: string | undefined;
559
+ };
560
+ taxonomy: string;
561
+ inference?: {
562
+ transitive: boolean;
563
+ fuzzy: boolean;
564
+ confidence: number;
565
+ } | undefined;
566
+ }, {
567
+ query: {
568
+ type: "is_a" | "subsumption" | "lowest_common_ancestor" | "path" | "similarity";
569
+ subject: string;
570
+ object?: string | undefined;
571
+ };
572
+ taxonomy: string;
573
+ inference?: {
574
+ transitive?: boolean | undefined;
575
+ fuzzy?: boolean | undefined;
576
+ confidence?: number | undefined;
577
+ } | undefined;
578
+ }>;
579
+ export type TaxonomicReasonInput = z.infer<typeof TaxonomicReasonInputSchema>;
580
+ export declare const SemanticSearchInputSchema: z.ZodObject<{
581
+ query: z.ZodString;
582
+ index: z.ZodString;
583
+ searchMode: z.ZodDefault<z.ZodEnum<["nearest", "subtree", "ancestors", "siblings", "cone"]>>;
584
+ constraints: z.ZodOptional<z.ZodObject<{
585
+ maxDepth: z.ZodOptional<z.ZodNumber>;
586
+ minDepth: z.ZodOptional<z.ZodNumber>;
587
+ subtreeRoot: z.ZodOptional<z.ZodString>;
588
+ nodeTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
589
+ }, "strip", z.ZodTypeAny, {
590
+ maxDepth?: number | undefined;
591
+ minDepth?: number | undefined;
592
+ subtreeRoot?: string | undefined;
593
+ nodeTypes?: string[] | undefined;
594
+ }, {
595
+ maxDepth?: number | undefined;
596
+ minDepth?: number | undefined;
597
+ subtreeRoot?: string | undefined;
598
+ nodeTypes?: string[] | undefined;
599
+ }>>;
600
+ topK: z.ZodDefault<z.ZodNumber>;
601
+ }, "strip", z.ZodTypeAny, {
602
+ query: string;
603
+ index: string;
604
+ searchMode: "nearest" | "subtree" | "ancestors" | "siblings" | "cone";
605
+ topK: number;
606
+ constraints?: {
607
+ maxDepth?: number | undefined;
608
+ minDepth?: number | undefined;
609
+ subtreeRoot?: string | undefined;
610
+ nodeTypes?: string[] | undefined;
611
+ } | undefined;
612
+ }, {
613
+ query: string;
614
+ index: string;
615
+ searchMode?: "nearest" | "subtree" | "ancestors" | "siblings" | "cone" | undefined;
616
+ constraints?: {
617
+ maxDepth?: number | undefined;
618
+ minDepth?: number | undefined;
619
+ subtreeRoot?: string | undefined;
620
+ nodeTypes?: string[] | undefined;
621
+ } | undefined;
622
+ topK?: number | undefined;
623
+ }>;
624
+ export type SemanticSearchInput = z.infer<typeof SemanticSearchInputSchema>;
625
+ export declare const HierarchyCompareInputSchema: z.ZodObject<{
626
+ source: z.ZodObject<{
627
+ nodes: z.ZodArray<z.ZodObject<{
628
+ id: z.ZodString;
629
+ parent: z.ZodNullable<z.ZodString>;
630
+ features: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
631
+ label: z.ZodOptional<z.ZodString>;
632
+ depth: z.ZodOptional<z.ZodNumber>;
633
+ }, "strip", z.ZodTypeAny, {
634
+ id: string;
635
+ parent: string | null;
636
+ features?: Record<string, unknown> | undefined;
637
+ label?: string | undefined;
638
+ depth?: number | undefined;
639
+ }, {
640
+ id: string;
641
+ parent: string | null;
642
+ features?: Record<string, unknown> | undefined;
643
+ label?: string | undefined;
644
+ depth?: number | undefined;
645
+ }>, "many">;
646
+ edges: z.ZodOptional<z.ZodArray<z.ZodObject<{
647
+ source: z.ZodString;
648
+ target: z.ZodString;
649
+ weight: z.ZodOptional<z.ZodNumber>;
650
+ type: z.ZodOptional<z.ZodString>;
651
+ }, "strip", z.ZodTypeAny, {
652
+ source: string;
653
+ target: string;
654
+ type?: string | undefined;
655
+ weight?: number | undefined;
656
+ }, {
657
+ source: string;
658
+ target: string;
659
+ type?: string | undefined;
660
+ weight?: number | undefined;
661
+ }>, "many">>;
662
+ root: z.ZodOptional<z.ZodString>;
663
+ }, "strip", z.ZodTypeAny, {
664
+ nodes: {
665
+ id: string;
666
+ parent: string | null;
667
+ features?: Record<string, unknown> | undefined;
668
+ label?: string | undefined;
669
+ depth?: number | undefined;
670
+ }[];
671
+ edges?: {
672
+ source: string;
673
+ target: string;
674
+ type?: string | undefined;
675
+ weight?: number | undefined;
676
+ }[] | undefined;
677
+ root?: string | undefined;
678
+ }, {
679
+ nodes: {
680
+ id: string;
681
+ parent: string | null;
682
+ features?: Record<string, unknown> | undefined;
683
+ label?: string | undefined;
684
+ depth?: number | undefined;
685
+ }[];
686
+ edges?: {
687
+ source: string;
688
+ target: string;
689
+ type?: string | undefined;
690
+ weight?: number | undefined;
691
+ }[] | undefined;
692
+ root?: string | undefined;
693
+ }>;
694
+ target: z.ZodObject<{
695
+ nodes: z.ZodArray<z.ZodObject<{
696
+ id: z.ZodString;
697
+ parent: z.ZodNullable<z.ZodString>;
698
+ features: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
699
+ label: z.ZodOptional<z.ZodString>;
700
+ depth: z.ZodOptional<z.ZodNumber>;
701
+ }, "strip", z.ZodTypeAny, {
702
+ id: string;
703
+ parent: string | null;
704
+ features?: Record<string, unknown> | undefined;
705
+ label?: string | undefined;
706
+ depth?: number | undefined;
707
+ }, {
708
+ id: string;
709
+ parent: string | null;
710
+ features?: Record<string, unknown> | undefined;
711
+ label?: string | undefined;
712
+ depth?: number | undefined;
713
+ }>, "many">;
714
+ edges: z.ZodOptional<z.ZodArray<z.ZodObject<{
715
+ source: z.ZodString;
716
+ target: z.ZodString;
717
+ weight: z.ZodOptional<z.ZodNumber>;
718
+ type: z.ZodOptional<z.ZodString>;
719
+ }, "strip", z.ZodTypeAny, {
720
+ source: string;
721
+ target: string;
722
+ type?: string | undefined;
723
+ weight?: number | undefined;
724
+ }, {
725
+ source: string;
726
+ target: string;
727
+ type?: string | undefined;
728
+ weight?: number | undefined;
729
+ }>, "many">>;
730
+ root: z.ZodOptional<z.ZodString>;
731
+ }, "strip", z.ZodTypeAny, {
732
+ nodes: {
733
+ id: string;
734
+ parent: string | null;
735
+ features?: Record<string, unknown> | undefined;
736
+ label?: string | undefined;
737
+ depth?: number | undefined;
738
+ }[];
739
+ edges?: {
740
+ source: string;
741
+ target: string;
742
+ type?: string | undefined;
743
+ weight?: number | undefined;
744
+ }[] | undefined;
745
+ root?: string | undefined;
746
+ }, {
747
+ nodes: {
748
+ id: string;
749
+ parent: string | null;
750
+ features?: Record<string, unknown> | undefined;
751
+ label?: string | undefined;
752
+ depth?: number | undefined;
753
+ }[];
754
+ edges?: {
755
+ source: string;
756
+ target: string;
757
+ type?: string | undefined;
758
+ weight?: number | undefined;
759
+ }[] | undefined;
760
+ root?: string | undefined;
761
+ }>;
762
+ alignment: z.ZodDefault<z.ZodEnum<["wasserstein", "gromov_wasserstein", "tree_edit", "subtree_isomorphism"]>>;
763
+ metrics: z.ZodOptional<z.ZodArray<z.ZodEnum<["structural_similarity", "semantic_similarity", "coverage", "precision"]>, "many">>;
764
+ }, "strip", z.ZodTypeAny, {
765
+ source: {
766
+ nodes: {
767
+ id: string;
768
+ parent: string | null;
769
+ features?: Record<string, unknown> | undefined;
770
+ label?: string | undefined;
771
+ depth?: number | undefined;
772
+ }[];
773
+ edges?: {
774
+ source: string;
775
+ target: string;
776
+ type?: string | undefined;
777
+ weight?: number | undefined;
778
+ }[] | undefined;
779
+ root?: string | undefined;
780
+ };
781
+ target: {
782
+ nodes: {
783
+ id: string;
784
+ parent: string | null;
785
+ features?: Record<string, unknown> | undefined;
786
+ label?: string | undefined;
787
+ depth?: number | undefined;
788
+ }[];
789
+ edges?: {
790
+ source: string;
791
+ target: string;
792
+ type?: string | undefined;
793
+ weight?: number | undefined;
794
+ }[] | undefined;
795
+ root?: string | undefined;
796
+ };
797
+ alignment: "wasserstein" | "gromov_wasserstein" | "tree_edit" | "subtree_isomorphism";
798
+ metrics?: ("structural_similarity" | "semantic_similarity" | "coverage" | "precision")[] | undefined;
799
+ }, {
800
+ source: {
801
+ nodes: {
802
+ id: string;
803
+ parent: string | null;
804
+ features?: Record<string, unknown> | undefined;
805
+ label?: string | undefined;
806
+ depth?: number | undefined;
807
+ }[];
808
+ edges?: {
809
+ source: string;
810
+ target: string;
811
+ type?: string | undefined;
812
+ weight?: number | undefined;
813
+ }[] | undefined;
814
+ root?: string | undefined;
815
+ };
816
+ target: {
817
+ nodes: {
818
+ id: string;
819
+ parent: string | null;
820
+ features?: Record<string, unknown> | undefined;
821
+ label?: string | undefined;
822
+ depth?: number | undefined;
823
+ }[];
824
+ edges?: {
825
+ source: string;
826
+ target: string;
827
+ type?: string | undefined;
828
+ weight?: number | undefined;
829
+ }[] | undefined;
830
+ root?: string | undefined;
831
+ };
832
+ alignment?: "wasserstein" | "gromov_wasserstein" | "tree_edit" | "subtree_isomorphism" | undefined;
833
+ metrics?: ("structural_similarity" | "semantic_similarity" | "coverage" | "precision")[] | undefined;
834
+ }>;
835
+ export type HierarchyCompareInput = z.infer<typeof HierarchyCompareInputSchema>;
836
+ export declare const ConceptSchema: z.ZodObject<{
837
+ id: z.ZodString;
838
+ text: z.ZodString;
839
+ type: z.ZodOptional<z.ZodString>;
840
+ }, "strip", z.ZodTypeAny, {
841
+ id: string;
842
+ text: string;
843
+ type?: string | undefined;
844
+ }, {
845
+ id: string;
846
+ text: string;
847
+ type?: string | undefined;
848
+ }>;
849
+ export declare const EntailmentGraphInputSchema: z.ZodObject<{
850
+ action: z.ZodEnum<["build", "query", "expand", "prune"]>;
851
+ concepts: z.ZodOptional<z.ZodArray<z.ZodObject<{
852
+ id: z.ZodString;
853
+ text: z.ZodString;
854
+ type: z.ZodOptional<z.ZodString>;
855
+ }, "strip", z.ZodTypeAny, {
856
+ id: string;
857
+ text: string;
858
+ type?: string | undefined;
859
+ }, {
860
+ id: string;
861
+ text: string;
862
+ type?: string | undefined;
863
+ }>, "many">>;
864
+ graphId: z.ZodOptional<z.ZodString>;
865
+ query: z.ZodOptional<z.ZodObject<{
866
+ premise: z.ZodOptional<z.ZodString>;
867
+ hypothesis: z.ZodOptional<z.ZodString>;
868
+ }, "strip", z.ZodTypeAny, {
869
+ premise?: string | undefined;
870
+ hypothesis?: string | undefined;
871
+ }, {
872
+ premise?: string | undefined;
873
+ hypothesis?: string | undefined;
874
+ }>>;
875
+ entailmentThreshold: z.ZodDefault<z.ZodNumber>;
876
+ transitiveClosure: z.ZodDefault<z.ZodBoolean>;
877
+ pruneStrategy: z.ZodOptional<z.ZodEnum<["none", "transitive_reduction", "confidence_threshold"]>>;
878
+ }, "strip", z.ZodTypeAny, {
879
+ action: "build" | "query" | "expand" | "prune";
880
+ entailmentThreshold: number;
881
+ transitiveClosure: boolean;
882
+ query?: {
883
+ premise?: string | undefined;
884
+ hypothesis?: string | undefined;
885
+ } | undefined;
886
+ concepts?: {
887
+ id: string;
888
+ text: string;
889
+ type?: string | undefined;
890
+ }[] | undefined;
891
+ graphId?: string | undefined;
892
+ pruneStrategy?: "none" | "transitive_reduction" | "confidence_threshold" | undefined;
893
+ }, {
894
+ action: "build" | "query" | "expand" | "prune";
895
+ query?: {
896
+ premise?: string | undefined;
897
+ hypothesis?: string | undefined;
898
+ } | undefined;
899
+ concepts?: {
900
+ id: string;
901
+ text: string;
902
+ type?: string | undefined;
903
+ }[] | undefined;
904
+ graphId?: string | undefined;
905
+ entailmentThreshold?: number | undefined;
906
+ transitiveClosure?: boolean | undefined;
907
+ pruneStrategy?: "none" | "transitive_reduction" | "confidence_threshold" | undefined;
908
+ }>;
909
+ export type EntailmentGraphInput = z.infer<typeof EntailmentGraphInputSchema>;
910
+ export interface MCPToolInputSchema {
911
+ type: 'object';
912
+ properties: Record<string, unknown>;
913
+ required?: string[];
914
+ }
915
+ export interface MCPToolResult {
916
+ content: Array<{
917
+ type: 'text' | 'image' | 'resource';
918
+ text?: string;
919
+ data?: string;
920
+ mimeType?: string;
921
+ }>;
922
+ isError?: boolean;
923
+ }
924
+ export interface MCPTool {
925
+ name: string;
926
+ description: string;
927
+ inputSchema: MCPToolInputSchema;
928
+ category?: string;
929
+ tags?: string[];
930
+ version?: string;
931
+ cacheable?: boolean;
932
+ cacheTTL?: number;
933
+ handler: (input: Record<string, unknown>, context?: ToolContext) => Promise<MCPToolResult>;
934
+ }
935
+ export interface Logger {
936
+ debug(message: string, meta?: Record<string, unknown>): void;
937
+ info(message: string, meta?: Record<string, unknown>): void;
938
+ warn(message: string, meta?: Record<string, unknown>): void;
939
+ error(message: string, meta?: Record<string, unknown>): void;
940
+ }
941
+ export interface HyperbolicReasoningConfig {
942
+ embedding: {
943
+ defaultDimensions: number;
944
+ defaultCurvature: number;
945
+ maxNodes: number;
946
+ };
947
+ search: {
948
+ maxTopK: number;
949
+ defaultTopK: number;
950
+ };
951
+ entailment: {
952
+ defaultThreshold: number;
953
+ maxConcepts: number;
954
+ };
955
+ resourceLimits: {
956
+ maxMemoryBytes: number;
957
+ maxCpuTimeMs: number;
958
+ maxDepth: number;
959
+ };
960
+ }
961
+ export interface HyperbolicReasoningBridge {
962
+ initialized: boolean;
963
+ initialize(): Promise<void>;
964
+ dispose(): Promise<void>;
965
+ embedHierarchy(hierarchy: Hierarchy, config: EmbedHierarchyInput['parameters']): Promise<EmbeddedHierarchy>;
966
+ computeDistance(a: HyperbolicPoint, b: HyperbolicPoint): number;
967
+ search(query: HyperbolicPoint, index: string, k: number): Promise<SearchResult>;
968
+ }
969
+ export interface ToolContext {
970
+ bridge?: HyperbolicReasoningBridge;
971
+ config?: HyperbolicReasoningConfig;
972
+ logger?: Logger;
973
+ }
974
+ /**
975
+ * Create a successful MCP tool result
976
+ */
977
+ export declare function successResult(data: unknown): MCPToolResult;
978
+ /**
979
+ * Create an error MCP tool result
980
+ */
981
+ export declare function errorResult(error: Error | string): MCPToolResult;
982
+ export declare const POINCARE_BALL_EPS = 1e-10;
983
+ export declare const MAX_NORM: number;
984
+ export declare const RESOURCE_LIMITS: {
985
+ readonly MAX_NODES: 1000000;
986
+ readonly MAX_EDGES: 10000000;
987
+ readonly MAX_DIMENSIONS: 512;
988
+ readonly MAX_DEPTH: 100;
989
+ readonly MAX_BRANCHING: 10000;
990
+ readonly MAX_MEMORY_BYTES: 2147483648;
991
+ readonly MAX_CPU_TIME_MS: 300000;
992
+ };
993
+ /**
994
+ * Clip vector to stay within Poincare ball
995
+ */
996
+ export declare function clipToBall(vector: Float32Array, curvature: number): Float32Array;
997
+ /**
998
+ * Compute hyperbolic distance in Poincare ball
999
+ */
1000
+ export declare function poincareDistance(x: Float32Array, y: Float32Array, c: number): number;
1001
+ /**
1002
+ * Mobius addition in Poincare ball
1003
+ */
1004
+ export declare function mobiusAdd(x: Float32Array, y: Float32Array, c: number): Float32Array;
1005
+ /**
1006
+ * Exponential map from tangent space to Poincare ball
1007
+ */
1008
+ export declare function expMap(v: Float32Array, c: number): Float32Array;
1009
+ /**
1010
+ * Logarithmic map from Poincare ball to tangent space
1011
+ */
1012
+ export declare function logMap(x: Float32Array, c: number): Float32Array;
1013
+ //# sourceMappingURL=types.d.ts.map