@orkestrel/reason 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/dist/src/core/index.cjs +4775 -4096
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +5306 -4608
- package/dist/src/core/index.d.ts +5306 -4608
- package/dist/src/core/index.js +4741 -4071
- package/dist/src/core/index.js.map +1 -1
- package/package.json +19 -15
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @orkestrel/reason
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A synchronous, deterministic **reasoning engine**: declarative,
|
|
4
4
|
JSON-serializable **definitions** are evaluated against **subjects** (plain
|
|
5
5
|
data records) to produce traceable **results**. Four strategies behind one
|
|
6
6
|
dispatch surface — `quantitative` (factor-based numeric scoring), `logical`
|
|
@@ -22,27 +22,27 @@ npm install @orkestrel/reason
|
|
|
22
22
|
|
|
23
23
|
## Requirements
|
|
24
24
|
|
|
25
|
-
- Node.js >=
|
|
25
|
+
- Node.js >= 22.12.0, matching the package engine declaration
|
|
26
26
|
- ESM-only (no CommonJS build)
|
|
27
27
|
|
|
28
28
|
## Usage
|
|
29
29
|
|
|
30
30
|
```ts
|
|
31
31
|
import {
|
|
32
|
+
createFactorGroup,
|
|
33
|
+
createFieldFactor,
|
|
34
|
+
createQuantitativeDefinition,
|
|
32
35
|
createQuantitativeReasoner,
|
|
33
36
|
createReason,
|
|
34
|
-
|
|
35
|
-
fieldFactor,
|
|
36
|
-
quantitativeDefinition,
|
|
37
|
-
staticFactor,
|
|
37
|
+
createStaticFactor,
|
|
38
38
|
} from '@orkestrel/reason'
|
|
39
39
|
|
|
40
40
|
const reason = createReason({ reasoners: [createQuantitativeReasoner()] })
|
|
41
41
|
|
|
42
|
-
const definition =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
const definition = createQuantitativeDefinition('risk', 'Risk score', [
|
|
43
|
+
createFactorGroup('drivers', 'sum', [
|
|
44
|
+
createFieldFactor('age', 'age'), // reads subject.age, parseNumber-coerced
|
|
45
|
+
createStaticFactor('floor', 10), // a fixed contribution
|
|
46
46
|
]),
|
|
47
47
|
])
|
|
48
48
|
|
|
@@ -62,7 +62,7 @@ the discriminant and read the strategy-specific payload (`value` /
|
|
|
62
62
|
For the full surface — the orchestrator, the four reasoners, the three
|
|
63
63
|
operators, the definitions & subjects capability layer, the two workspace
|
|
64
64
|
builders (`DefinitionBuilder` / `SubjectBuilder`), validators, errors, and the
|
|
65
|
-
observation surface — see [`guides/
|
|
65
|
+
observation surface — see [`guides/reason.md`](guides/reason.md).
|
|
66
66
|
|
|
67
67
|
## Package
|
|
68
68
|
|