@plures/praxis 1.4.4 → 2.0.3

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.
Files changed (59) hide show
  1. package/README.md +164 -1067
  2. package/dist/browser/chunk-IUEKGHQN.js +373 -0
  3. package/dist/browser/factory/index.d.ts +2 -1
  4. package/dist/browser/index.d.ts +7 -4
  5. package/dist/browser/index.js +18 -6
  6. package/dist/browser/integrations/svelte.d.ts +4 -3
  7. package/dist/browser/project/index.d.ts +2 -1
  8. package/dist/browser/{reactive-engine.svelte-DgVTqHLc.d.ts → reactive-engine.svelte-BwWadvAW.d.ts} +2 -1
  9. package/dist/browser/rule-result-DcXWe9tn.d.ts +206 -0
  10. package/dist/browser/{rules-i1LHpnGd.d.ts → rules-BaWMqxuG.d.ts} +2 -205
  11. package/dist/browser/unified/index.d.ts +239 -0
  12. package/dist/browser/unified/index.js +20 -0
  13. package/dist/node/chunk-IUEKGHQN.js +373 -0
  14. package/dist/node/cli/index.js +1 -1
  15. package/dist/node/index.cjs +377 -0
  16. package/dist/node/index.d.cts +4 -2
  17. package/dist/node/index.d.ts +4 -2
  18. package/dist/node/index.js +19 -7
  19. package/dist/node/integrations/svelte.d.cts +3 -2
  20. package/dist/node/integrations/svelte.d.ts +3 -2
  21. package/dist/node/integrations/svelte.js +2 -2
  22. package/dist/node/{reactive-engine.svelte-DekxqFu0.d.ts → reactive-engine.svelte-BBZLMzus.d.ts} +3 -79
  23. package/dist/node/{reactive-engine.svelte-Cg0Yc2Hs.d.cts → reactive-engine.svelte-Cbq_V20o.d.cts} +3 -79
  24. package/dist/node/rule-result-B9GMivAn.d.cts +80 -0
  25. package/dist/node/rule-result-Bo3sFMmN.d.ts +80 -0
  26. package/dist/node/unified/index.cjs +494 -0
  27. package/dist/node/unified/index.d.cts +240 -0
  28. package/dist/node/unified/index.d.ts +240 -0
  29. package/dist/node/unified/index.js +21 -0
  30. package/docs/README.md +58 -102
  31. package/docs/archive/1.x/CONVERSATIONS_IMPLEMENTATION.md +207 -0
  32. package/docs/archive/1.x/DECISION_LEDGER_IMPLEMENTATION.md +109 -0
  33. package/docs/archive/1.x/DECISION_LEDGER_SUMMARY.md +424 -0
  34. package/docs/archive/1.x/ELEVATION_SUMMARY.md +249 -0
  35. package/docs/archive/1.x/FEATURE_SUMMARY.md +238 -0
  36. package/docs/archive/1.x/GOLDEN_PATH_IMPLEMENTATION.md +280 -0
  37. package/docs/archive/1.x/IMPLEMENTATION.md +166 -0
  38. package/docs/archive/1.x/IMPLEMENTATION_COMPLETE.md +389 -0
  39. package/docs/archive/1.x/IMPLEMENTATION_SUMMARY.md +59 -0
  40. package/docs/archive/1.x/INTEGRATION_ENHANCEMENT_SUMMARY.md +238 -0
  41. package/docs/archive/1.x/KNO_ENG_REFACTORING_SUMMARY.md +198 -0
  42. package/docs/archive/1.x/MONOREPO_SUMMARY.md +158 -0
  43. package/docs/archive/1.x/README.md +28 -0
  44. package/docs/archive/1.x/SVELTE_INTEGRATION_SUMMARY.md +415 -0
  45. package/docs/archive/1.x/TASK_1_COMPLETE.md +235 -0
  46. package/docs/archive/1.x/TASK_1_SUMMARY.md +281 -0
  47. package/docs/archive/1.x/VERSION_0.2.0_RELEASE_NOTES.md +288 -0
  48. package/docs/archive/1.x/ValidationChecklist.md +7 -0
  49. package/package.json +13 -1
  50. package/src/index.browser.ts +20 -0
  51. package/src/index.ts +21 -0
  52. package/src/unified/__tests__/unified-qa.test.ts +761 -0
  53. package/src/unified/__tests__/unified.test.ts +396 -0
  54. package/src/unified/core.ts +534 -0
  55. package/src/unified/index.ts +32 -0
  56. package/src/unified/rules.ts +66 -0
  57. package/src/unified/types.ts +148 -0
  58. package/dist/node/{chunk-ZO2LU4G4.js → chunk-WFRHXZBP.js} +3 -3
  59. package/dist/node/{validate-5PSWJTIC.js → validate-BY7JNY7H.js} +1 -1
@@ -1,4 +1,5 @@
1
- import { b as PraxisFact, P as PraxisState, a as PraxisEvent, c as PraxisStepResult, d as PraxisStepConfig, e as PraxisDiagnostics } from './protocol-DcyGMmWY.cjs';
1
+ import { P as PraxisState, a as PraxisEvent, b as PraxisFact, c as PraxisStepResult, d as PraxisStepConfig, e as PraxisDiagnostics } from './protocol-DcyGMmWY.cjs';
2
+ import { R as RuleResult } from './rule-result-B9GMivAn.cjs';
2
3
 
3
4
  /**
4
5
  * Decision Ledger - Contract Types
@@ -162,83 +163,6 @@ interface ValidationReport {
162
163
  timestamp: string;
163
164
  }
164
165
 
165
- /**
166
- * The result of evaluating a rule. Every rule MUST return one of:
167
- * - `RuleResult.emit(facts)` — rule produced facts
168
- * - `RuleResult.noop(reason?)` — rule evaluated but had nothing to say
169
- * - `RuleResult.skip(reason?)` — rule decided to skip (preconditions not met)
170
- * - `RuleResult.retract(tags)` — rule retracts previously emitted facts
171
- */
172
- declare class RuleResult {
173
- /** The kind of result */
174
- readonly kind: 'emit' | 'noop' | 'skip' | 'retract';
175
- /** Facts produced (only for 'emit') */
176
- readonly facts: PraxisFact[];
177
- /** Fact tags to retract (only for 'retract') */
178
- readonly retractTags: string[];
179
- /** Optional reason (for noop/skip/retract — useful for debugging) */
180
- readonly reason?: string;
181
- /** The rule ID that produced this result (set by engine) */
182
- ruleId?: string;
183
- private constructor();
184
- /**
185
- * Rule produced facts.
186
- *
187
- * @example
188
- * return RuleResult.emit([
189
- * { tag: 'sprint.behind', payload: { deficit: 5 } }
190
- * ]);
191
- */
192
- static emit(facts: PraxisFact[]): RuleResult;
193
- /**
194
- * Rule evaluated but had nothing to report.
195
- * Unlike returning [], this is explicit and traceable.
196
- *
197
- * @example
198
- * if (ctx.completedHours >= expectedHours) {
199
- * return RuleResult.noop('Sprint is on pace');
200
- * }
201
- */
202
- static noop(reason?: string): RuleResult;
203
- /**
204
- * Rule decided to skip because preconditions were not met.
205
- * Distinct from noop: skip means "I can't evaluate", noop means "I evaluated and found nothing".
206
- *
207
- * @example
208
- * if (!ctx.sprintName) {
209
- * return RuleResult.skip('No active sprint');
210
- * }
211
- */
212
- static skip(reason?: string): RuleResult;
213
- /**
214
- * Rule retracts previously emitted facts by tag.
215
- * Used when a condition that previously produced facts is no longer true.
216
- *
217
- * @example
218
- * // Sprint was behind, but caught up
219
- * if (ctx.completedHours >= expectedHours) {
220
- * return RuleResult.retract(['sprint.behind'], 'Sprint caught up');
221
- * }
222
- */
223
- static retract(tags: string[], reason?: string): RuleResult;
224
- /** Whether this result produced facts */
225
- get hasFacts(): boolean;
226
- /** Whether this result retracts facts */
227
- get hasRetractions(): boolean;
228
- }
229
- /**
230
- * A rule function that returns a typed RuleResult.
231
- * New API — replaces the old PraxisFact[] return type.
232
- */
233
- type TypedRuleFn<TContext = unknown> = (state: PraxisState & {
234
- context: TContext;
235
- events: PraxisEvent[];
236
- }, events: PraxisEvent[]) => RuleResult;
237
- /**
238
- * Convenience: create a fact object (just a shorthand)
239
- */
240
- declare function fact(tag: string, payload: unknown): PraxisFact;
241
-
242
166
  /**
243
167
  * Rules and Constraints System
244
168
  *
@@ -634,4 +558,4 @@ declare class ReactiveLogicEngine<TContext extends object> {
634
558
  */
635
559
  declare function createReactiveEngine<TContext extends object>(options: ReactiveEngineOptions<TContext>): ReactiveLogicEngine<TContext>;
636
560
 
637
- export { type Assumption as A, type ConstraintDescriptor as C, type DefineContractOptions as D, type Example as E, LogicEngine as L, type MissingArtifact as M, PraxisRegistry as P, type ReactiveEngineOptions as R, type Severity as S, type TypedRuleFn as T, type ValidationReport as V, ReactiveLogicEngine as a, type RuleDescriptor as b, createReactiveEngine as c, type ConstraintFn as d, type Contract as e, type RuleFn as f, type PraxisModule as g, type ConstraintId as h, type ContractGap as i, type PraxisEngineOptions as j, type Reference as k, type RuleId as l, RuleResult as m, createPraxisEngine as n, defineContract as o, fact as p, getContract as q, isContract as r };
561
+ export { type Assumption as A, type ConstraintDescriptor as C, type DefineContractOptions as D, type Example as E, LogicEngine as L, type MissingArtifact as M, PraxisRegistry as P, type ReactiveEngineOptions as R, type Severity as S, type ValidationReport as V, ReactiveLogicEngine as a, type RuleDescriptor as b, createReactiveEngine as c, type ConstraintFn as d, type Contract as e, type RuleFn as f, type PraxisModule as g, type ConstraintId as h, type ContractGap as i, type PraxisEngineOptions as j, type Reference as k, type RuleId as l, createPraxisEngine as m, defineContract as n, getContract as o, isContract as p };
@@ -0,0 +1,80 @@
1
+ import { b as PraxisFact, P as PraxisState, a as PraxisEvent } from './protocol-DcyGMmWY.cjs';
2
+
3
+ /**
4
+ * The result of evaluating a rule. Every rule MUST return one of:
5
+ * - `RuleResult.emit(facts)` — rule produced facts
6
+ * - `RuleResult.noop(reason?)` — rule evaluated but had nothing to say
7
+ * - `RuleResult.skip(reason?)` — rule decided to skip (preconditions not met)
8
+ * - `RuleResult.retract(tags)` — rule retracts previously emitted facts
9
+ */
10
+ declare class RuleResult {
11
+ /** The kind of result */
12
+ readonly kind: 'emit' | 'noop' | 'skip' | 'retract';
13
+ /** Facts produced (only for 'emit') */
14
+ readonly facts: PraxisFact[];
15
+ /** Fact tags to retract (only for 'retract') */
16
+ readonly retractTags: string[];
17
+ /** Optional reason (for noop/skip/retract — useful for debugging) */
18
+ readonly reason?: string;
19
+ /** The rule ID that produced this result (set by engine) */
20
+ ruleId?: string;
21
+ private constructor();
22
+ /**
23
+ * Rule produced facts.
24
+ *
25
+ * @example
26
+ * return RuleResult.emit([
27
+ * { tag: 'sprint.behind', payload: { deficit: 5 } }
28
+ * ]);
29
+ */
30
+ static emit(facts: PraxisFact[]): RuleResult;
31
+ /**
32
+ * Rule evaluated but had nothing to report.
33
+ * Unlike returning [], this is explicit and traceable.
34
+ *
35
+ * @example
36
+ * if (ctx.completedHours >= expectedHours) {
37
+ * return RuleResult.noop('Sprint is on pace');
38
+ * }
39
+ */
40
+ static noop(reason?: string): RuleResult;
41
+ /**
42
+ * Rule decided to skip because preconditions were not met.
43
+ * Distinct from noop: skip means "I can't evaluate", noop means "I evaluated and found nothing".
44
+ *
45
+ * @example
46
+ * if (!ctx.sprintName) {
47
+ * return RuleResult.skip('No active sprint');
48
+ * }
49
+ */
50
+ static skip(reason?: string): RuleResult;
51
+ /**
52
+ * Rule retracts previously emitted facts by tag.
53
+ * Used when a condition that previously produced facts is no longer true.
54
+ *
55
+ * @example
56
+ * // Sprint was behind, but caught up
57
+ * if (ctx.completedHours >= expectedHours) {
58
+ * return RuleResult.retract(['sprint.behind'], 'Sprint caught up');
59
+ * }
60
+ */
61
+ static retract(tags: string[], reason?: string): RuleResult;
62
+ /** Whether this result produced facts */
63
+ get hasFacts(): boolean;
64
+ /** Whether this result retracts facts */
65
+ get hasRetractions(): boolean;
66
+ }
67
+ /**
68
+ * A rule function that returns a typed RuleResult.
69
+ * New API — replaces the old PraxisFact[] return type.
70
+ */
71
+ type TypedRuleFn<TContext = unknown> = (state: PraxisState & {
72
+ context: TContext;
73
+ events: PraxisEvent[];
74
+ }, events: PraxisEvent[]) => RuleResult;
75
+ /**
76
+ * Convenience: create a fact object (just a shorthand)
77
+ */
78
+ declare function fact(tag: string, payload: unknown): PraxisFact;
79
+
80
+ export { RuleResult as R, type TypedRuleFn as T, fact as f };
@@ -0,0 +1,80 @@
1
+ import { b as PraxisFact, P as PraxisState, a as PraxisEvent } from './protocol-DcyGMmWY.js';
2
+
3
+ /**
4
+ * The result of evaluating a rule. Every rule MUST return one of:
5
+ * - `RuleResult.emit(facts)` — rule produced facts
6
+ * - `RuleResult.noop(reason?)` — rule evaluated but had nothing to say
7
+ * - `RuleResult.skip(reason?)` — rule decided to skip (preconditions not met)
8
+ * - `RuleResult.retract(tags)` — rule retracts previously emitted facts
9
+ */
10
+ declare class RuleResult {
11
+ /** The kind of result */
12
+ readonly kind: 'emit' | 'noop' | 'skip' | 'retract';
13
+ /** Facts produced (only for 'emit') */
14
+ readonly facts: PraxisFact[];
15
+ /** Fact tags to retract (only for 'retract') */
16
+ readonly retractTags: string[];
17
+ /** Optional reason (for noop/skip/retract — useful for debugging) */
18
+ readonly reason?: string;
19
+ /** The rule ID that produced this result (set by engine) */
20
+ ruleId?: string;
21
+ private constructor();
22
+ /**
23
+ * Rule produced facts.
24
+ *
25
+ * @example
26
+ * return RuleResult.emit([
27
+ * { tag: 'sprint.behind', payload: { deficit: 5 } }
28
+ * ]);
29
+ */
30
+ static emit(facts: PraxisFact[]): RuleResult;
31
+ /**
32
+ * Rule evaluated but had nothing to report.
33
+ * Unlike returning [], this is explicit and traceable.
34
+ *
35
+ * @example
36
+ * if (ctx.completedHours >= expectedHours) {
37
+ * return RuleResult.noop('Sprint is on pace');
38
+ * }
39
+ */
40
+ static noop(reason?: string): RuleResult;
41
+ /**
42
+ * Rule decided to skip because preconditions were not met.
43
+ * Distinct from noop: skip means "I can't evaluate", noop means "I evaluated and found nothing".
44
+ *
45
+ * @example
46
+ * if (!ctx.sprintName) {
47
+ * return RuleResult.skip('No active sprint');
48
+ * }
49
+ */
50
+ static skip(reason?: string): RuleResult;
51
+ /**
52
+ * Rule retracts previously emitted facts by tag.
53
+ * Used when a condition that previously produced facts is no longer true.
54
+ *
55
+ * @example
56
+ * // Sprint was behind, but caught up
57
+ * if (ctx.completedHours >= expectedHours) {
58
+ * return RuleResult.retract(['sprint.behind'], 'Sprint caught up');
59
+ * }
60
+ */
61
+ static retract(tags: string[], reason?: string): RuleResult;
62
+ /** Whether this result produced facts */
63
+ get hasFacts(): boolean;
64
+ /** Whether this result retracts facts */
65
+ get hasRetractions(): boolean;
66
+ }
67
+ /**
68
+ * A rule function that returns a typed RuleResult.
69
+ * New API — replaces the old PraxisFact[] return type.
70
+ */
71
+ type TypedRuleFn<TContext = unknown> = (state: PraxisState & {
72
+ context: TContext;
73
+ events: PraxisEvent[];
74
+ }, events: PraxisEvent[]) => RuleResult;
75
+ /**
76
+ * Convenience: create a fact object (just a shorthand)
77
+ */
78
+ declare function fact(tag: string, payload: unknown): PraxisFact;
79
+
80
+ export { RuleResult as R, type TypedRuleFn as T, fact as f };