@orkestrel/reason 0.0.4 → 0.0.6
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/src/core/index.cjs +318 -8
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +213 -3
- package/dist/src/core/index.d.ts +213 -3
- package/dist/src/core/index.js +308 -10
- package/dist/src/core/index.js.map +1 -1
- package/package.json +12 -10
|
@@ -1844,9 +1844,9 @@ export declare interface AggregatorOptions {
|
|
|
1844
1844
|
* findDuplicates([{ id: 'a' }, { id: 'b' }, { id: 'a' }, { id: 'a' }]) // ['a']
|
|
1845
1845
|
* ```
|
|
1846
1846
|
*/
|
|
1847
|
-
export declare function findDuplicates(items:
|
|
1847
|
+
export declare function findDuplicates(items: ReadonlyArray<{
|
|
1848
1848
|
readonly id: string;
|
|
1849
|
-
}
|
|
1849
|
+
}>): readonly string[];
|
|
1850
1850
|
|
|
1851
1851
|
/**
|
|
1852
1852
|
* The `formatField`-flattened overlay keys an array-path conclusion atom
|
|
@@ -2427,6 +2427,22 @@ export declare interface AggregatorOptions {
|
|
|
2427
2427
|
*/
|
|
2428
2428
|
export declare function isCheck(value: unknown): value is Check;
|
|
2429
2429
|
|
|
2430
|
+
/**
|
|
2431
|
+
* Determine whether a value is a {@link CheckResult}.
|
|
2432
|
+
*
|
|
2433
|
+
* @param value - The value to test
|
|
2434
|
+
* @returns `true` when every published check-result member is valid
|
|
2435
|
+
*
|
|
2436
|
+
* @example
|
|
2437
|
+
* ```ts
|
|
2438
|
+
* import { isCheckResult } from '@src/core'
|
|
2439
|
+
*
|
|
2440
|
+
* isCheckResult({ field: 'age', met: true, actual: 30 }) // true
|
|
2441
|
+
* isCheckResult({ field: 'age', met: 'yes', actual: 30 }) // false
|
|
2442
|
+
* ```
|
|
2443
|
+
*/
|
|
2444
|
+
export declare function isCheckResult(value: unknown): value is CheckResult;
|
|
2445
|
+
|
|
2430
2446
|
/**
|
|
2431
2447
|
* Determine whether a value is a {@link Comparison} literal.
|
|
2432
2448
|
*
|
|
@@ -2602,6 +2618,22 @@ export declare interface AggregatorOptions {
|
|
|
2602
2618
|
*/
|
|
2603
2619
|
export declare function isFactorRange(value: unknown): value is FactorRange;
|
|
2604
2620
|
|
|
2621
|
+
/**
|
|
2622
|
+
* Determine whether a value is a {@link FactorResult}.
|
|
2623
|
+
*
|
|
2624
|
+
* @param value - The value to test
|
|
2625
|
+
* @returns `true` when every published factor-result member is valid
|
|
2626
|
+
*
|
|
2627
|
+
* @example
|
|
2628
|
+
* ```ts
|
|
2629
|
+
* import { isFactorResult } from '@src/core'
|
|
2630
|
+
*
|
|
2631
|
+
* isFactorResult({ id: 'age', applied: true, value: 5 }) // true
|
|
2632
|
+
* isFactorResult({ id: 'age', applied: true, value: '5' }) // false
|
|
2633
|
+
* ```
|
|
2634
|
+
*/
|
|
2635
|
+
export declare function isFactorResult(value: unknown): value is FactorResult;
|
|
2636
|
+
|
|
2605
2637
|
/**
|
|
2606
2638
|
* Determine whether a value is a {@link FieldPath} — a single string key or an
|
|
2607
2639
|
* array of keys descending into nested objects.
|
|
@@ -2620,6 +2652,22 @@ export declare interface AggregatorOptions {
|
|
|
2620
2652
|
*/
|
|
2621
2653
|
export declare const isFieldPath: Guard<FieldPath>;
|
|
2622
2654
|
|
|
2655
|
+
/**
|
|
2656
|
+
* Determine whether a value is a {@link GroupResult}.
|
|
2657
|
+
*
|
|
2658
|
+
* @param value - The value to test
|
|
2659
|
+
* @returns `true` when every published group-result member is valid
|
|
2660
|
+
*
|
|
2661
|
+
* @example
|
|
2662
|
+
* ```ts
|
|
2663
|
+
* import { isGroupResult } from '@src/core'
|
|
2664
|
+
*
|
|
2665
|
+
* isGroupResult({ id: 'risk', applied: true, value: 5, factors: [] }) // true
|
|
2666
|
+
* isGroupResult({ id: 'risk', applied: true, value: 5 }) // false
|
|
2667
|
+
* ```
|
|
2668
|
+
*/
|
|
2669
|
+
export declare function isGroupResult(value: unknown): value is GroupResult;
|
|
2670
|
+
|
|
2623
2671
|
/**
|
|
2624
2672
|
* Determine whether a value is an {@link Inference} — premise patterns and a
|
|
2625
2673
|
* conclusion pattern.
|
|
@@ -2653,6 +2701,22 @@ export declare interface AggregatorOptions {
|
|
|
2653
2701
|
*/
|
|
2654
2702
|
export declare function isInferentialDefinition(value: unknown): value is InferentialDefinition;
|
|
2655
2703
|
|
|
2704
|
+
/**
|
|
2705
|
+
* Determine whether a value is an {@link InferentialResult}.
|
|
2706
|
+
*
|
|
2707
|
+
* @param value - The value to test
|
|
2708
|
+
* @returns `true` when every published inferential-result member is valid
|
|
2709
|
+
*
|
|
2710
|
+
* @example
|
|
2711
|
+
* ```ts
|
|
2712
|
+
* import { isInferentialResult } from '@src/core'
|
|
2713
|
+
*
|
|
2714
|
+
* isInferentialResult({ reasoning: 'inferential', derived: [], success: true, trace: [], errors: [] }) // true
|
|
2715
|
+
* isInferentialResult({ reasoning: 'inferential', derived: [null], success: true, trace: [], errors: [] }) // false
|
|
2716
|
+
* ```
|
|
2717
|
+
*/
|
|
2718
|
+
export declare function isInferentialResult(value: unknown): value is InferentialResult;
|
|
2719
|
+
|
|
2656
2720
|
/**
|
|
2657
2721
|
* Determine whether a value is a {@link LogicalDefinition}.
|
|
2658
2722
|
*
|
|
@@ -2685,6 +2749,22 @@ export declare interface AggregatorOptions {
|
|
|
2685
2749
|
*/
|
|
2686
2750
|
export declare const isLogicalOperator: Guard<LogicalOperator>;
|
|
2687
2751
|
|
|
2752
|
+
/**
|
|
2753
|
+
* Determine whether a value is a {@link LogicalResult}.
|
|
2754
|
+
*
|
|
2755
|
+
* @param value - The value to test
|
|
2756
|
+
* @returns `true` when every published logical-result member is valid
|
|
2757
|
+
*
|
|
2758
|
+
* @example
|
|
2759
|
+
* ```ts
|
|
2760
|
+
* import { isLogicalResult } from '@src/core'
|
|
2761
|
+
*
|
|
2762
|
+
* isLogicalResult({ reasoning: 'logical', conclusion: false, rules: [], count: 0, success: true, trace: [], errors: [] }) // true
|
|
2763
|
+
* isLogicalResult({ reasoning: 'logical', rules: [] }) // false
|
|
2764
|
+
* ```
|
|
2765
|
+
*/
|
|
2766
|
+
export declare function isLogicalResult(value: unknown): value is LogicalResult;
|
|
2767
|
+
|
|
2688
2768
|
/**
|
|
2689
2769
|
* Determine whether a value is a {@link MathOperation} literal.
|
|
2690
2770
|
*
|
|
@@ -2718,6 +2798,30 @@ export declare interface AggregatorOptions {
|
|
|
2718
2798
|
*/
|
|
2719
2799
|
export declare const isNumberRecord: Guard<Readonly<Record<string, number>>>;
|
|
2720
2800
|
|
|
2801
|
+
/**
|
|
2802
|
+
* Determine whether a value is a depth-bounded, acyclic {@link ProofNode} tree.
|
|
2803
|
+
*
|
|
2804
|
+
* @remarks
|
|
2805
|
+
* Traversal is iterative and reuses `GUARD_DEPTH_LIMIT`. Active ancestors refuse cycles, and a
|
|
2806
|
+
* settled-depth record prevents repeated validation of shared subtrees while keeping the bound
|
|
2807
|
+
* exact: a node revisited no deeper than its validated depth is skipped, and one reached deeper
|
|
2808
|
+
* is walked again. The traversal accepts an acyclic graph only when every reachable node is
|
|
2809
|
+
* valid and every root-to-node path contains at most `GUARD_DEPTH_LIMIT` nodes; shared aliases
|
|
2810
|
+
* and sibling order do not affect the verdict.
|
|
2811
|
+
*
|
|
2812
|
+
* @param value - The value to test
|
|
2813
|
+
* @returns `true` when every proof node is valid within the runtime guard bound
|
|
2814
|
+
*
|
|
2815
|
+
* @example
|
|
2816
|
+
* ```ts
|
|
2817
|
+
* import { isProofNode } from '@src/core'
|
|
2818
|
+
*
|
|
2819
|
+
* isProofNode({ fact: 'bird', depth: 0, children: [{ fact: 'feathers', depth: 1 }] }) // true
|
|
2820
|
+
* isProofNode({ fact: 'bird', children: [] }) // false
|
|
2821
|
+
* ```
|
|
2822
|
+
*/
|
|
2823
|
+
export declare function isProofNode(value: unknown): value is ProofNode;
|
|
2824
|
+
|
|
2721
2825
|
/**
|
|
2722
2826
|
* Determine whether a value is a {@link QuantitativeDefinition}.
|
|
2723
2827
|
*
|
|
@@ -2734,6 +2838,22 @@ export declare interface AggregatorOptions {
|
|
|
2734
2838
|
*/
|
|
2735
2839
|
export declare function isQuantitativeDefinition(value: unknown): value is QuantitativeDefinition;
|
|
2736
2840
|
|
|
2841
|
+
/**
|
|
2842
|
+
* Determine whether a value is a {@link QuantitativeResult}.
|
|
2843
|
+
*
|
|
2844
|
+
* @param value - The value to test
|
|
2845
|
+
* @returns `true` when every published quantitative-result member is valid
|
|
2846
|
+
*
|
|
2847
|
+
* @example
|
|
2848
|
+
* ```ts
|
|
2849
|
+
* import { isQuantitativeResult } from '@src/core'
|
|
2850
|
+
*
|
|
2851
|
+
* isQuantitativeResult({ reasoning: 'quantitative', value: 0, groups: [], count: 0, success: true, trace: [], errors: [] }) // true
|
|
2852
|
+
* isQuantitativeResult({ reasoning: 'quantitative' }) // false
|
|
2853
|
+
* ```
|
|
2854
|
+
*/
|
|
2855
|
+
export declare function isQuantitativeResult(value: unknown): value is QuantitativeResult;
|
|
2856
|
+
|
|
2737
2857
|
/**
|
|
2738
2858
|
* Narrow an unknown caught value to a {@link ReasonError}.
|
|
2739
2859
|
*
|
|
@@ -2767,6 +2887,58 @@ export declare interface AggregatorOptions {
|
|
|
2767
2887
|
*/
|
|
2768
2888
|
export declare const isReasoning: Guard<Reasoning>;
|
|
2769
2889
|
|
|
2890
|
+
/**
|
|
2891
|
+
* Determine whether a value is any {@link ReasonResult} arm.
|
|
2892
|
+
*
|
|
2893
|
+
* @param value - The value to test
|
|
2894
|
+
* @returns `true` when one complete reasoning-result guard accepts the value
|
|
2895
|
+
*
|
|
2896
|
+
* @example
|
|
2897
|
+
* ```ts
|
|
2898
|
+
* import { isReasonResult } from '@src/core'
|
|
2899
|
+
*
|
|
2900
|
+
* isReasonResult({ reasoning: 'symbolic', solutions: {}, success: true, trace: [], errors: [] }) // true
|
|
2901
|
+
* isReasonResult({ reasoning: 'unknown' }) // false
|
|
2902
|
+
* ```
|
|
2903
|
+
*/
|
|
2904
|
+
export declare function isReasonResult(value: unknown): value is ReasonResult;
|
|
2905
|
+
|
|
2906
|
+
/**
|
|
2907
|
+
* Determine whether a value is a {@link ReasonValidationResult}.
|
|
2908
|
+
*
|
|
2909
|
+
* @param value - The value to test
|
|
2910
|
+
* @returns `true` when every published validation-result member is valid
|
|
2911
|
+
*
|
|
2912
|
+
* @example
|
|
2913
|
+
* ```ts
|
|
2914
|
+
* import { isReasonValidationResult } from '@src/core'
|
|
2915
|
+
*
|
|
2916
|
+
* isReasonValidationResult({ valid: true, errors: [], warnings: [] }) // true
|
|
2917
|
+
* isReasonValidationResult({ valid: true, errors: [] }) // false
|
|
2918
|
+
* ```
|
|
2919
|
+
*/
|
|
2920
|
+
export declare function isReasonValidationResult(value: unknown): value is ReasonValidationResult;
|
|
2921
|
+
|
|
2922
|
+
/**
|
|
2923
|
+
* Determine whether a value is a result-side {@link Fact}.
|
|
2924
|
+
*
|
|
2925
|
+
* @remarks
|
|
2926
|
+
* Unlike the exact input guard {@link isFact}, this guard accepts unknown
|
|
2927
|
+
* members, class instances, and every JavaScript `number` confidence.
|
|
2928
|
+
*
|
|
2929
|
+
* @param value - The value to test
|
|
2930
|
+
* @returns `true` when every published fact member is valid for a result
|
|
2931
|
+
*
|
|
2932
|
+
* @example
|
|
2933
|
+
* ```ts
|
|
2934
|
+
* import { isResultFact } from '@src/core'
|
|
2935
|
+
*
|
|
2936
|
+
* isResultFact({ id: 'f1', predicate: 'bird', terms: ['tweety'], note: 'derived' }) // true
|
|
2937
|
+
* isResultFact({ id: 'f1', predicate: 'bird' }) // false
|
|
2938
|
+
* ```
|
|
2939
|
+
*/
|
|
2940
|
+
export declare function isResultFact(value: unknown): value is Fact;
|
|
2941
|
+
|
|
2770
2942
|
/**
|
|
2771
2943
|
* Determine whether a value is a {@link Rule} — premises and a conclusion.
|
|
2772
2944
|
*
|
|
@@ -2783,6 +2955,22 @@ export declare interface AggregatorOptions {
|
|
|
2783
2955
|
*/
|
|
2784
2956
|
export declare function isRule(value: unknown): value is Rule;
|
|
2785
2957
|
|
|
2958
|
+
/**
|
|
2959
|
+
* Determine whether a value is a {@link RuleResult}.
|
|
2960
|
+
*
|
|
2961
|
+
* @param value - The value to test
|
|
2962
|
+
* @returns `true` when every published rule-result member is valid
|
|
2963
|
+
*
|
|
2964
|
+
* @example
|
|
2965
|
+
* ```ts
|
|
2966
|
+
* import { isRuleResult } from '@src/core'
|
|
2967
|
+
*
|
|
2968
|
+
* isRuleResult({ id: 'adult', applied: true, premises: [true], conclusion: true }) // true
|
|
2969
|
+
* isRuleResult({ id: 'adult', applied: true, premises: [1], conclusion: true }) // false
|
|
2970
|
+
* ```
|
|
2971
|
+
*/
|
|
2972
|
+
export declare function isRuleResult(value: unknown): value is RuleResult;
|
|
2973
|
+
|
|
2786
2974
|
/**
|
|
2787
2975
|
* Determine whether a value is a {@link Source} — any of the four factor
|
|
2788
2976
|
* sources, discriminated by `origin`.
|
|
@@ -2883,6 +3071,27 @@ export declare interface AggregatorOptions {
|
|
|
2883
3071
|
*/
|
|
2884
3072
|
export declare function isSymbolicExpression(value: unknown): value is SymbolicExpression;
|
|
2885
3073
|
|
|
3074
|
+
/**
|
|
3075
|
+
* Determine whether a value is a {@link SymbolicResult}.
|
|
3076
|
+
*
|
|
3077
|
+
* @remarks
|
|
3078
|
+
* `solutions` is checked across its OWN string-named members, enumerable or
|
|
3079
|
+
* not. Inherited members are deliberately unread: they belong to the
|
|
3080
|
+
* accepted-prototype property, not to the record this guard certifies.
|
|
3081
|
+
*
|
|
3082
|
+
* @param value - The value to test
|
|
3083
|
+
* @returns `true` when every published symbolic-result member is valid
|
|
3084
|
+
*
|
|
3085
|
+
* @example
|
|
3086
|
+
* ```ts
|
|
3087
|
+
* import { isSymbolicResult } from '@src/core'
|
|
3088
|
+
*
|
|
3089
|
+
* isSymbolicResult({ reasoning: 'symbolic', solutions: { x: 4 }, success: true, trace: [], errors: [] }) // true
|
|
3090
|
+
* isSymbolicResult({ reasoning: 'symbolic', solutions: { x: '4' }, success: true, trace: [], errors: [] }) // false
|
|
3091
|
+
* ```
|
|
3092
|
+
*/
|
|
3093
|
+
export declare function isSymbolicResult(value: unknown): value is SymbolicResult;
|
|
3094
|
+
|
|
2886
3095
|
/**
|
|
2887
3096
|
* Determine whether a value is a {@link Transform} — one math step.
|
|
2888
3097
|
*
|
|
@@ -4720,13 +4929,14 @@ export declare interface AggregatorOptions {
|
|
|
4720
4929
|
* a strict left fold — `NaN` flows through untouched. Stateless and
|
|
4721
4930
|
* deterministic.
|
|
4722
4931
|
*/
|
|
4723
|
-
|
|
4932
|
+
declare class Transformer_2 implements TransformerInterface {
|
|
4724
4933
|
#private;
|
|
4725
4934
|
constructor(options?: TransformerOptions);
|
|
4726
4935
|
get id(): string;
|
|
4727
4936
|
apply(value: number, transform: Transform): number;
|
|
4728
4937
|
chain(value: number, transforms: readonly Transform[]): number;
|
|
4729
4938
|
}
|
|
4939
|
+
export { Transformer_2 as Transformer }
|
|
4730
4940
|
|
|
4731
4941
|
/** Default `id` for a `Transformer`. */
|
|
4732
4942
|
export declare const TRANSFORMER_ID = "transformer";
|
package/dist/src/core/index.d.ts
CHANGED
|
@@ -1844,9 +1844,9 @@ export declare interface AggregatorOptions {
|
|
|
1844
1844
|
* findDuplicates([{ id: 'a' }, { id: 'b' }, { id: 'a' }, { id: 'a' }]) // ['a']
|
|
1845
1845
|
* ```
|
|
1846
1846
|
*/
|
|
1847
|
-
export declare function findDuplicates(items:
|
|
1847
|
+
export declare function findDuplicates(items: ReadonlyArray<{
|
|
1848
1848
|
readonly id: string;
|
|
1849
|
-
}
|
|
1849
|
+
}>): readonly string[];
|
|
1850
1850
|
|
|
1851
1851
|
/**
|
|
1852
1852
|
* The `formatField`-flattened overlay keys an array-path conclusion atom
|
|
@@ -2427,6 +2427,22 @@ export declare interface AggregatorOptions {
|
|
|
2427
2427
|
*/
|
|
2428
2428
|
export declare function isCheck(value: unknown): value is Check;
|
|
2429
2429
|
|
|
2430
|
+
/**
|
|
2431
|
+
* Determine whether a value is a {@link CheckResult}.
|
|
2432
|
+
*
|
|
2433
|
+
* @param value - The value to test
|
|
2434
|
+
* @returns `true` when every published check-result member is valid
|
|
2435
|
+
*
|
|
2436
|
+
* @example
|
|
2437
|
+
* ```ts
|
|
2438
|
+
* import { isCheckResult } from '@src/core'
|
|
2439
|
+
*
|
|
2440
|
+
* isCheckResult({ field: 'age', met: true, actual: 30 }) // true
|
|
2441
|
+
* isCheckResult({ field: 'age', met: 'yes', actual: 30 }) // false
|
|
2442
|
+
* ```
|
|
2443
|
+
*/
|
|
2444
|
+
export declare function isCheckResult(value: unknown): value is CheckResult;
|
|
2445
|
+
|
|
2430
2446
|
/**
|
|
2431
2447
|
* Determine whether a value is a {@link Comparison} literal.
|
|
2432
2448
|
*
|
|
@@ -2602,6 +2618,22 @@ export declare interface AggregatorOptions {
|
|
|
2602
2618
|
*/
|
|
2603
2619
|
export declare function isFactorRange(value: unknown): value is FactorRange;
|
|
2604
2620
|
|
|
2621
|
+
/**
|
|
2622
|
+
* Determine whether a value is a {@link FactorResult}.
|
|
2623
|
+
*
|
|
2624
|
+
* @param value - The value to test
|
|
2625
|
+
* @returns `true` when every published factor-result member is valid
|
|
2626
|
+
*
|
|
2627
|
+
* @example
|
|
2628
|
+
* ```ts
|
|
2629
|
+
* import { isFactorResult } from '@src/core'
|
|
2630
|
+
*
|
|
2631
|
+
* isFactorResult({ id: 'age', applied: true, value: 5 }) // true
|
|
2632
|
+
* isFactorResult({ id: 'age', applied: true, value: '5' }) // false
|
|
2633
|
+
* ```
|
|
2634
|
+
*/
|
|
2635
|
+
export declare function isFactorResult(value: unknown): value is FactorResult;
|
|
2636
|
+
|
|
2605
2637
|
/**
|
|
2606
2638
|
* Determine whether a value is a {@link FieldPath} — a single string key or an
|
|
2607
2639
|
* array of keys descending into nested objects.
|
|
@@ -2620,6 +2652,22 @@ export declare interface AggregatorOptions {
|
|
|
2620
2652
|
*/
|
|
2621
2653
|
export declare const isFieldPath: Guard<FieldPath>;
|
|
2622
2654
|
|
|
2655
|
+
/**
|
|
2656
|
+
* Determine whether a value is a {@link GroupResult}.
|
|
2657
|
+
*
|
|
2658
|
+
* @param value - The value to test
|
|
2659
|
+
* @returns `true` when every published group-result member is valid
|
|
2660
|
+
*
|
|
2661
|
+
* @example
|
|
2662
|
+
* ```ts
|
|
2663
|
+
* import { isGroupResult } from '@src/core'
|
|
2664
|
+
*
|
|
2665
|
+
* isGroupResult({ id: 'risk', applied: true, value: 5, factors: [] }) // true
|
|
2666
|
+
* isGroupResult({ id: 'risk', applied: true, value: 5 }) // false
|
|
2667
|
+
* ```
|
|
2668
|
+
*/
|
|
2669
|
+
export declare function isGroupResult(value: unknown): value is GroupResult;
|
|
2670
|
+
|
|
2623
2671
|
/**
|
|
2624
2672
|
* Determine whether a value is an {@link Inference} — premise patterns and a
|
|
2625
2673
|
* conclusion pattern.
|
|
@@ -2653,6 +2701,22 @@ export declare interface AggregatorOptions {
|
|
|
2653
2701
|
*/
|
|
2654
2702
|
export declare function isInferentialDefinition(value: unknown): value is InferentialDefinition;
|
|
2655
2703
|
|
|
2704
|
+
/**
|
|
2705
|
+
* Determine whether a value is an {@link InferentialResult}.
|
|
2706
|
+
*
|
|
2707
|
+
* @param value - The value to test
|
|
2708
|
+
* @returns `true` when every published inferential-result member is valid
|
|
2709
|
+
*
|
|
2710
|
+
* @example
|
|
2711
|
+
* ```ts
|
|
2712
|
+
* import { isInferentialResult } from '@src/core'
|
|
2713
|
+
*
|
|
2714
|
+
* isInferentialResult({ reasoning: 'inferential', derived: [], success: true, trace: [], errors: [] }) // true
|
|
2715
|
+
* isInferentialResult({ reasoning: 'inferential', derived: [null], success: true, trace: [], errors: [] }) // false
|
|
2716
|
+
* ```
|
|
2717
|
+
*/
|
|
2718
|
+
export declare function isInferentialResult(value: unknown): value is InferentialResult;
|
|
2719
|
+
|
|
2656
2720
|
/**
|
|
2657
2721
|
* Determine whether a value is a {@link LogicalDefinition}.
|
|
2658
2722
|
*
|
|
@@ -2685,6 +2749,22 @@ export declare interface AggregatorOptions {
|
|
|
2685
2749
|
*/
|
|
2686
2750
|
export declare const isLogicalOperator: Guard<LogicalOperator>;
|
|
2687
2751
|
|
|
2752
|
+
/**
|
|
2753
|
+
* Determine whether a value is a {@link LogicalResult}.
|
|
2754
|
+
*
|
|
2755
|
+
* @param value - The value to test
|
|
2756
|
+
* @returns `true` when every published logical-result member is valid
|
|
2757
|
+
*
|
|
2758
|
+
* @example
|
|
2759
|
+
* ```ts
|
|
2760
|
+
* import { isLogicalResult } from '@src/core'
|
|
2761
|
+
*
|
|
2762
|
+
* isLogicalResult({ reasoning: 'logical', conclusion: false, rules: [], count: 0, success: true, trace: [], errors: [] }) // true
|
|
2763
|
+
* isLogicalResult({ reasoning: 'logical', rules: [] }) // false
|
|
2764
|
+
* ```
|
|
2765
|
+
*/
|
|
2766
|
+
export declare function isLogicalResult(value: unknown): value is LogicalResult;
|
|
2767
|
+
|
|
2688
2768
|
/**
|
|
2689
2769
|
* Determine whether a value is a {@link MathOperation} literal.
|
|
2690
2770
|
*
|
|
@@ -2718,6 +2798,30 @@ export declare interface AggregatorOptions {
|
|
|
2718
2798
|
*/
|
|
2719
2799
|
export declare const isNumberRecord: Guard<Readonly<Record<string, number>>>;
|
|
2720
2800
|
|
|
2801
|
+
/**
|
|
2802
|
+
* Determine whether a value is a depth-bounded, acyclic {@link ProofNode} tree.
|
|
2803
|
+
*
|
|
2804
|
+
* @remarks
|
|
2805
|
+
* Traversal is iterative and reuses `GUARD_DEPTH_LIMIT`. Active ancestors refuse cycles, and a
|
|
2806
|
+
* settled-depth record prevents repeated validation of shared subtrees while keeping the bound
|
|
2807
|
+
* exact: a node revisited no deeper than its validated depth is skipped, and one reached deeper
|
|
2808
|
+
* is walked again. The traversal accepts an acyclic graph only when every reachable node is
|
|
2809
|
+
* valid and every root-to-node path contains at most `GUARD_DEPTH_LIMIT` nodes; shared aliases
|
|
2810
|
+
* and sibling order do not affect the verdict.
|
|
2811
|
+
*
|
|
2812
|
+
* @param value - The value to test
|
|
2813
|
+
* @returns `true` when every proof node is valid within the runtime guard bound
|
|
2814
|
+
*
|
|
2815
|
+
* @example
|
|
2816
|
+
* ```ts
|
|
2817
|
+
* import { isProofNode } from '@src/core'
|
|
2818
|
+
*
|
|
2819
|
+
* isProofNode({ fact: 'bird', depth: 0, children: [{ fact: 'feathers', depth: 1 }] }) // true
|
|
2820
|
+
* isProofNode({ fact: 'bird', children: [] }) // false
|
|
2821
|
+
* ```
|
|
2822
|
+
*/
|
|
2823
|
+
export declare function isProofNode(value: unknown): value is ProofNode;
|
|
2824
|
+
|
|
2721
2825
|
/**
|
|
2722
2826
|
* Determine whether a value is a {@link QuantitativeDefinition}.
|
|
2723
2827
|
*
|
|
@@ -2734,6 +2838,22 @@ export declare interface AggregatorOptions {
|
|
|
2734
2838
|
*/
|
|
2735
2839
|
export declare function isQuantitativeDefinition(value: unknown): value is QuantitativeDefinition;
|
|
2736
2840
|
|
|
2841
|
+
/**
|
|
2842
|
+
* Determine whether a value is a {@link QuantitativeResult}.
|
|
2843
|
+
*
|
|
2844
|
+
* @param value - The value to test
|
|
2845
|
+
* @returns `true` when every published quantitative-result member is valid
|
|
2846
|
+
*
|
|
2847
|
+
* @example
|
|
2848
|
+
* ```ts
|
|
2849
|
+
* import { isQuantitativeResult } from '@src/core'
|
|
2850
|
+
*
|
|
2851
|
+
* isQuantitativeResult({ reasoning: 'quantitative', value: 0, groups: [], count: 0, success: true, trace: [], errors: [] }) // true
|
|
2852
|
+
* isQuantitativeResult({ reasoning: 'quantitative' }) // false
|
|
2853
|
+
* ```
|
|
2854
|
+
*/
|
|
2855
|
+
export declare function isQuantitativeResult(value: unknown): value is QuantitativeResult;
|
|
2856
|
+
|
|
2737
2857
|
/**
|
|
2738
2858
|
* Narrow an unknown caught value to a {@link ReasonError}.
|
|
2739
2859
|
*
|
|
@@ -2767,6 +2887,58 @@ export declare interface AggregatorOptions {
|
|
|
2767
2887
|
*/
|
|
2768
2888
|
export declare const isReasoning: Guard<Reasoning>;
|
|
2769
2889
|
|
|
2890
|
+
/**
|
|
2891
|
+
* Determine whether a value is any {@link ReasonResult} arm.
|
|
2892
|
+
*
|
|
2893
|
+
* @param value - The value to test
|
|
2894
|
+
* @returns `true` when one complete reasoning-result guard accepts the value
|
|
2895
|
+
*
|
|
2896
|
+
* @example
|
|
2897
|
+
* ```ts
|
|
2898
|
+
* import { isReasonResult } from '@src/core'
|
|
2899
|
+
*
|
|
2900
|
+
* isReasonResult({ reasoning: 'symbolic', solutions: {}, success: true, trace: [], errors: [] }) // true
|
|
2901
|
+
* isReasonResult({ reasoning: 'unknown' }) // false
|
|
2902
|
+
* ```
|
|
2903
|
+
*/
|
|
2904
|
+
export declare function isReasonResult(value: unknown): value is ReasonResult;
|
|
2905
|
+
|
|
2906
|
+
/**
|
|
2907
|
+
* Determine whether a value is a {@link ReasonValidationResult}.
|
|
2908
|
+
*
|
|
2909
|
+
* @param value - The value to test
|
|
2910
|
+
* @returns `true` when every published validation-result member is valid
|
|
2911
|
+
*
|
|
2912
|
+
* @example
|
|
2913
|
+
* ```ts
|
|
2914
|
+
* import { isReasonValidationResult } from '@src/core'
|
|
2915
|
+
*
|
|
2916
|
+
* isReasonValidationResult({ valid: true, errors: [], warnings: [] }) // true
|
|
2917
|
+
* isReasonValidationResult({ valid: true, errors: [] }) // false
|
|
2918
|
+
* ```
|
|
2919
|
+
*/
|
|
2920
|
+
export declare function isReasonValidationResult(value: unknown): value is ReasonValidationResult;
|
|
2921
|
+
|
|
2922
|
+
/**
|
|
2923
|
+
* Determine whether a value is a result-side {@link Fact}.
|
|
2924
|
+
*
|
|
2925
|
+
* @remarks
|
|
2926
|
+
* Unlike the exact input guard {@link isFact}, this guard accepts unknown
|
|
2927
|
+
* members, class instances, and every JavaScript `number` confidence.
|
|
2928
|
+
*
|
|
2929
|
+
* @param value - The value to test
|
|
2930
|
+
* @returns `true` when every published fact member is valid for a result
|
|
2931
|
+
*
|
|
2932
|
+
* @example
|
|
2933
|
+
* ```ts
|
|
2934
|
+
* import { isResultFact } from '@src/core'
|
|
2935
|
+
*
|
|
2936
|
+
* isResultFact({ id: 'f1', predicate: 'bird', terms: ['tweety'], note: 'derived' }) // true
|
|
2937
|
+
* isResultFact({ id: 'f1', predicate: 'bird' }) // false
|
|
2938
|
+
* ```
|
|
2939
|
+
*/
|
|
2940
|
+
export declare function isResultFact(value: unknown): value is Fact;
|
|
2941
|
+
|
|
2770
2942
|
/**
|
|
2771
2943
|
* Determine whether a value is a {@link Rule} — premises and a conclusion.
|
|
2772
2944
|
*
|
|
@@ -2783,6 +2955,22 @@ export declare interface AggregatorOptions {
|
|
|
2783
2955
|
*/
|
|
2784
2956
|
export declare function isRule(value: unknown): value is Rule;
|
|
2785
2957
|
|
|
2958
|
+
/**
|
|
2959
|
+
* Determine whether a value is a {@link RuleResult}.
|
|
2960
|
+
*
|
|
2961
|
+
* @param value - The value to test
|
|
2962
|
+
* @returns `true` when every published rule-result member is valid
|
|
2963
|
+
*
|
|
2964
|
+
* @example
|
|
2965
|
+
* ```ts
|
|
2966
|
+
* import { isRuleResult } from '@src/core'
|
|
2967
|
+
*
|
|
2968
|
+
* isRuleResult({ id: 'adult', applied: true, premises: [true], conclusion: true }) // true
|
|
2969
|
+
* isRuleResult({ id: 'adult', applied: true, premises: [1], conclusion: true }) // false
|
|
2970
|
+
* ```
|
|
2971
|
+
*/
|
|
2972
|
+
export declare function isRuleResult(value: unknown): value is RuleResult;
|
|
2973
|
+
|
|
2786
2974
|
/**
|
|
2787
2975
|
* Determine whether a value is a {@link Source} — any of the four factor
|
|
2788
2976
|
* sources, discriminated by `origin`.
|
|
@@ -2883,6 +3071,27 @@ export declare interface AggregatorOptions {
|
|
|
2883
3071
|
*/
|
|
2884
3072
|
export declare function isSymbolicExpression(value: unknown): value is SymbolicExpression;
|
|
2885
3073
|
|
|
3074
|
+
/**
|
|
3075
|
+
* Determine whether a value is a {@link SymbolicResult}.
|
|
3076
|
+
*
|
|
3077
|
+
* @remarks
|
|
3078
|
+
* `solutions` is checked across its OWN string-named members, enumerable or
|
|
3079
|
+
* not. Inherited members are deliberately unread: they belong to the
|
|
3080
|
+
* accepted-prototype property, not to the record this guard certifies.
|
|
3081
|
+
*
|
|
3082
|
+
* @param value - The value to test
|
|
3083
|
+
* @returns `true` when every published symbolic-result member is valid
|
|
3084
|
+
*
|
|
3085
|
+
* @example
|
|
3086
|
+
* ```ts
|
|
3087
|
+
* import { isSymbolicResult } from '@src/core'
|
|
3088
|
+
*
|
|
3089
|
+
* isSymbolicResult({ reasoning: 'symbolic', solutions: { x: 4 }, success: true, trace: [], errors: [] }) // true
|
|
3090
|
+
* isSymbolicResult({ reasoning: 'symbolic', solutions: { x: '4' }, success: true, trace: [], errors: [] }) // false
|
|
3091
|
+
* ```
|
|
3092
|
+
*/
|
|
3093
|
+
export declare function isSymbolicResult(value: unknown): value is SymbolicResult;
|
|
3094
|
+
|
|
2886
3095
|
/**
|
|
2887
3096
|
* Determine whether a value is a {@link Transform} — one math step.
|
|
2888
3097
|
*
|
|
@@ -4720,13 +4929,14 @@ export declare interface AggregatorOptions {
|
|
|
4720
4929
|
* a strict left fold — `NaN` flows through untouched. Stateless and
|
|
4721
4930
|
* deterministic.
|
|
4722
4931
|
*/
|
|
4723
|
-
|
|
4932
|
+
declare class Transformer_2 implements TransformerInterface {
|
|
4724
4933
|
#private;
|
|
4725
4934
|
constructor(options?: TransformerOptions);
|
|
4726
4935
|
get id(): string;
|
|
4727
4936
|
apply(value: number, transform: Transform): number;
|
|
4728
4937
|
chain(value: number, transforms: readonly Transform[]): number;
|
|
4729
4938
|
}
|
|
4939
|
+
export { Transformer_2 as Transformer }
|
|
4730
4940
|
|
|
4731
4941
|
/** Default `id` for a `Transformer`. */
|
|
4732
4942
|
export declare const TRANSFORMER_ID = "transformer";
|