@plures/praxis 2.0.0 → 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.
- package/README.md +164 -1067
- package/dist/browser/{chunk-6MVRT7CK.js → chunk-IUEKGHQN.js} +13 -3
- package/dist/browser/index.js +1 -1
- package/dist/browser/unified/index.js +1 -1
- package/dist/node/{chunk-6MVRT7CK.js → chunk-IUEKGHQN.js} +13 -3
- package/dist/node/index.cjs +13 -3
- package/dist/node/index.js +1 -1
- package/dist/node/unified/index.cjs +13 -3
- package/dist/node/unified/index.js +1 -1
- package/docs/README.md +58 -102
- package/docs/archive/1.x/CONVERSATIONS_IMPLEMENTATION.md +207 -0
- package/docs/archive/1.x/DECISION_LEDGER_IMPLEMENTATION.md +109 -0
- package/docs/archive/1.x/DECISION_LEDGER_SUMMARY.md +424 -0
- package/docs/archive/1.x/ELEVATION_SUMMARY.md +249 -0
- package/docs/archive/1.x/FEATURE_SUMMARY.md +238 -0
- package/docs/archive/1.x/GOLDEN_PATH_IMPLEMENTATION.md +280 -0
- package/docs/archive/1.x/IMPLEMENTATION.md +166 -0
- package/docs/archive/1.x/IMPLEMENTATION_COMPLETE.md +389 -0
- package/docs/archive/1.x/IMPLEMENTATION_SUMMARY.md +59 -0
- package/docs/archive/1.x/INTEGRATION_ENHANCEMENT_SUMMARY.md +238 -0
- package/docs/archive/1.x/KNO_ENG_REFACTORING_SUMMARY.md +198 -0
- package/docs/archive/1.x/MONOREPO_SUMMARY.md +158 -0
- package/docs/archive/1.x/README.md +28 -0
- package/docs/archive/1.x/SVELTE_INTEGRATION_SUMMARY.md +415 -0
- package/docs/archive/1.x/TASK_1_COMPLETE.md +235 -0
- package/docs/archive/1.x/TASK_1_SUMMARY.md +281 -0
- package/docs/archive/1.x/VERSION_0.2.0_RELEASE_NOTES.md +288 -0
- package/docs/archive/1.x/ValidationChecklist.md +7 -0
- package/package.json +11 -5
- package/src/unified/__tests__/unified-qa.test.ts +761 -0
- package/src/unified/core.ts +19 -2
package/src/unified/core.ts
CHANGED
|
@@ -37,6 +37,8 @@ interface PathState<T = unknown> {
|
|
|
37
37
|
interface RuleState {
|
|
38
38
|
rule: UnifiedRule;
|
|
39
39
|
lastResult: RuleResult | null;
|
|
40
|
+
/** Tags this rule has emitted — used for auto-retraction on skip/noop */
|
|
41
|
+
emittedTags: Set<string>;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
// ── Timeline Entry (Chronos-compatible) ─────────────────────────────────────
|
|
@@ -148,6 +150,7 @@ export function createApp(config: PraxisAppConfig): PraxisApp {
|
|
|
148
150
|
const ruleStates: RuleState[] = (config.rules ?? []).map(rule => ({
|
|
149
151
|
rule,
|
|
150
152
|
lastResult: null,
|
|
153
|
+
emittedTags: new Set<string>(),
|
|
151
154
|
}));
|
|
152
155
|
|
|
153
156
|
// ── Constraints ──
|
|
@@ -250,12 +253,27 @@ export function createApp(config: PraxisAppConfig): PraxisApp {
|
|
|
250
253
|
switch (result.kind) {
|
|
251
254
|
case 'emit':
|
|
252
255
|
newFacts.push(...result.facts);
|
|
256
|
+
// Track which tags this rule has emitted
|
|
257
|
+
for (const f of result.facts) {
|
|
258
|
+
rs.emittedTags.add(f.tag);
|
|
259
|
+
}
|
|
253
260
|
break;
|
|
254
261
|
case 'retract':
|
|
255
262
|
retractions.push(...result.retractTags);
|
|
263
|
+
// Also clear tracked tags that are being retracted
|
|
264
|
+
for (const tag of result.retractTags) {
|
|
265
|
+
rs.emittedTags.delete(tag);
|
|
266
|
+
}
|
|
256
267
|
break;
|
|
257
268
|
case 'noop':
|
|
258
269
|
case 'skip':
|
|
270
|
+
// Auto-retract: if a rule previously emitted facts and now
|
|
271
|
+
// skips/noops, those facts should be cleaned up. Otherwise
|
|
272
|
+
// stale facts persist when preconditions become unmet.
|
|
273
|
+
if (rs.emittedTags.size > 0) {
|
|
274
|
+
retractions.push(...rs.emittedTags);
|
|
275
|
+
rs.emittedTags.clear();
|
|
276
|
+
}
|
|
259
277
|
break;
|
|
260
278
|
}
|
|
261
279
|
} catch (err) {
|
|
@@ -456,9 +474,8 @@ export function createApp(config: PraxisAppConfig): PraxisApp {
|
|
|
456
474
|
const state = paths.get(p);
|
|
457
475
|
const lastUpdated = state?.lastUpdated ?? 0;
|
|
458
476
|
const elapsed = lastUpdated > 0 ? now - lastUpdated : now - initTime;
|
|
459
|
-
const timeout = livenessConfig?.timeoutMs ?? 5000;
|
|
460
477
|
result[p] = {
|
|
461
|
-
stale: state
|
|
478
|
+
stale: !state || state.updateCount === 0,
|
|
462
479
|
lastUpdated,
|
|
463
480
|
elapsed,
|
|
464
481
|
};
|