@plures/praxis 1.4.0 → 1.4.4

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 (51) hide show
  1. package/dist/browser/{chunk-N63K4KWS.js → chunk-4IRUGWR3.js} +1 -1
  2. package/dist/browser/chunk-6SJ44Q64.js +473 -0
  3. package/dist/browser/chunk-BQOYZBWA.js +282 -0
  4. package/dist/browser/chunk-IG5BJ2MT.js +91 -0
  5. package/dist/browser/{chunk-MJK3IYTJ.js → chunk-JZDJU2DO.js} +4 -84
  6. package/dist/browser/chunk-ZEW4LJAJ.js +353 -0
  7. package/dist/browser/{engine-YIEGSX7U.js → engine-3B5WJPGT.js} +2 -1
  8. package/dist/browser/expectations/index.d.ts +180 -0
  9. package/dist/browser/expectations/index.js +14 -0
  10. package/dist/browser/factory/index.d.ts +149 -0
  11. package/dist/browser/factory/index.js +15 -0
  12. package/dist/browser/index.d.ts +274 -3
  13. package/dist/browser/index.js +407 -54
  14. package/dist/browser/integrations/svelte.d.ts +3 -2
  15. package/dist/browser/integrations/svelte.js +3 -2
  16. package/dist/browser/project/index.d.ts +176 -0
  17. package/dist/browser/project/index.js +19 -0
  18. package/dist/browser/reactive-engine.svelte-DgVTqHLc.d.ts +223 -0
  19. package/dist/browser/{reactive-engine.svelte-DjynI82A.d.ts → rules-i1LHpnGd.d.ts} +13 -221
  20. package/dist/node/chunk-AZLNISFI.js +1690 -0
  21. package/dist/node/chunk-IG5BJ2MT.js +91 -0
  22. package/dist/node/{chunk-KMJWAFZV.js → chunk-JZDJU2DO.js} +4 -89
  23. package/dist/node/{chunk-7M3HV4XR.js → chunk-ZO2LU4G4.js} +1 -1
  24. package/dist/node/cli/index.cjs +48 -0
  25. package/dist/node/cli/index.js +2 -2
  26. package/dist/node/{engine-FEN5IYZ5.js → engine-VFHCIEM4.js} +2 -1
  27. package/dist/node/index.cjs +1747 -0
  28. package/dist/node/index.d.cts +960 -278
  29. package/dist/node/index.d.ts +960 -278
  30. package/dist/node/index.js +559 -6
  31. package/dist/node/integrations/svelte.js +3 -2
  32. package/dist/node/{server-SYZPDULV.js → server-FKLVY57V.js} +4 -2
  33. package/dist/node/{validate-TQGVIG7G.js → validate-5PSWJTIC.js} +2 -1
  34. package/package.json +32 -11
  35. package/src/__tests__/chronos-project.test.ts +799 -0
  36. package/src/__tests__/decision-ledger.test.ts +857 -402
  37. package/src/chronos/diff.ts +336 -0
  38. package/src/chronos/hooks.ts +227 -0
  39. package/src/chronos/index.ts +83 -0
  40. package/src/chronos/project-chronicle.ts +198 -0
  41. package/src/chronos/timeline.ts +152 -0
  42. package/src/decision-ledger/analyzer-types.ts +280 -0
  43. package/src/decision-ledger/analyzer.ts +518 -0
  44. package/src/decision-ledger/contract-verification.ts +456 -0
  45. package/src/decision-ledger/derivation.ts +158 -0
  46. package/src/decision-ledger/index.ts +59 -0
  47. package/src/decision-ledger/report.ts +378 -0
  48. package/src/decision-ledger/suggestions.ts +287 -0
  49. package/src/index.browser.ts +83 -0
  50. package/src/index.ts +77 -0
  51. package/dist/node/chunk-FWOXU4MM.js +0 -487
@@ -11,21 +11,39 @@ import {
11
11
  ContractUpdated,
12
12
  ContractValidated,
13
13
  ValidateContracts,
14
+ analyzeDependencyGraph,
14
15
  createBehaviorLedger,
16
+ crossReferenceContracts,
15
17
  defineConstraint,
16
18
  defineEvent,
17
19
  defineFact,
18
20
  defineModule,
19
21
  defineRule,
22
+ diffLedgers,
20
23
  filterEvents,
21
24
  filterFacts,
25
+ findContractGaps,
26
+ findContradictions,
27
+ findDeadRules,
22
28
  findEvent,
23
29
  findFact,
30
+ findGaps,
31
+ findShadowedRules,
32
+ findUnreachableStates,
33
+ formatBuildOutput,
34
+ formatLedger,
24
35
  formatValidationReport,
25
36
  formatValidationReportJSON,
26
37
  formatValidationReportSARIF,
27
- validateContracts
28
- } from "./chunk-FWOXU4MM.js";
38
+ generateLedger,
39
+ suggest,
40
+ suggestAll,
41
+ traceDerivation,
42
+ traceImpact,
43
+ validateContracts,
44
+ verifyContractExamples,
45
+ verifyInvariants
46
+ } from "./chunk-AZLNISFI.js";
29
47
  import "./chunk-7CSWBDFL.js";
30
48
  import {
31
49
  defineContract,
@@ -55,14 +73,16 @@ import {
55
73
  import {
56
74
  ReactiveLogicEngine,
57
75
  createReactiveEngine
58
- } from "./chunk-7M3HV4XR.js";
76
+ } from "./chunk-ZO2LU4G4.js";
59
77
  import {
60
78
  LogicEngine,
61
79
  PRAXIS_PROTOCOL_VERSION,
80
+ createPraxisEngine
81
+ } from "./chunk-JZDJU2DO.js";
82
+ import {
62
83
  RuleResult,
63
- createPraxisEngine,
64
84
  fact
65
- } from "./chunk-KMJWAFZV.js";
85
+ } from "./chunk-IG5BJ2MT.js";
66
86
  import {
67
87
  TerminalAdapter,
68
88
  createMockExecutor,
@@ -1780,7 +1800,7 @@ function generateTauriConfig(config) {
1780
1800
 
1781
1801
  // src/integrations/unified.ts
1782
1802
  async function createUnifiedApp(config) {
1783
- const { createPraxisEngine: createPraxisEngine2 } = await import("./engine-FEN5IYZ5.js");
1803
+ const { createPraxisEngine: createPraxisEngine2 } = await import("./engine-VFHCIEM4.js");
1784
1804
  const { createInMemoryDB: createInMemoryDB2 } = await import("./adapter-75ISSMWD.js");
1785
1805
  const db = config.db || createInMemoryDB2();
1786
1806
  const pluresdb = createPluresDBAdapter({
@@ -3193,6 +3213,509 @@ function expectationGate(config = {}) {
3193
3213
  onViolation: "expectations-failed"
3194
3214
  });
3195
3215
  }
3216
+
3217
+ // src/chronos/project-chronicle.ts
3218
+ var ProjectChronicle = class {
3219
+ events = [];
3220
+ maxEvents;
3221
+ now;
3222
+ constructor(options = {}) {
3223
+ this.maxEvents = options.maxEvents ?? 1e4;
3224
+ this.now = options.now ?? (() => Date.now());
3225
+ }
3226
+ // ── Recording ───────────────────────────────────────────────────────────
3227
+ /**
3228
+ * Record a project event. Returns the recorded event (with timestamp filled in).
3229
+ */
3230
+ record(event) {
3231
+ const full = {
3232
+ kind: event.kind,
3233
+ action: event.action,
3234
+ subject: event.subject,
3235
+ timestamp: event.timestamp ?? this.now(),
3236
+ metadata: event.metadata,
3237
+ diff: event.diff
3238
+ };
3239
+ this.events.push(full);
3240
+ if (this.maxEvents > 0 && this.events.length > this.maxEvents) {
3241
+ this.events = this.events.slice(this.events.length - this.maxEvents);
3242
+ }
3243
+ return full;
3244
+ }
3245
+ // ── Convenience recorders ─────────────────────────────────────────────
3246
+ recordRuleRegistered(ruleId, meta = {}) {
3247
+ return this.record({ kind: "rule", action: "registered", subject: ruleId, metadata: meta });
3248
+ }
3249
+ recordRuleModified(ruleId, diff, meta = {}) {
3250
+ return this.record({ kind: "rule", action: "modified", subject: ruleId, metadata: meta, diff });
3251
+ }
3252
+ recordRuleRemoved(ruleId, meta = {}) {
3253
+ return this.record({ kind: "rule", action: "removed", subject: ruleId, metadata: meta });
3254
+ }
3255
+ recordContractAdded(contractId, meta = {}) {
3256
+ return this.record({ kind: "contract", action: "added", subject: contractId, metadata: meta });
3257
+ }
3258
+ recordContractModified(contractId, diff, meta = {}) {
3259
+ return this.record({ kind: "contract", action: "modified", subject: contractId, metadata: meta, diff });
3260
+ }
3261
+ recordExpectationSatisfied(name, meta = {}) {
3262
+ return this.record({ kind: "expectation", action: "satisfied", subject: name, metadata: meta });
3263
+ }
3264
+ recordExpectationViolated(name, meta = {}) {
3265
+ return this.record({ kind: "expectation", action: "violated", subject: name, metadata: meta });
3266
+ }
3267
+ recordGateTransition(gateName, from, to, meta = {}) {
3268
+ return this.record({
3269
+ kind: "gate",
3270
+ action: to,
3271
+ subject: gateName,
3272
+ metadata: { ...meta, from, to },
3273
+ diff: { before: from, after: to }
3274
+ });
3275
+ }
3276
+ recordBuildAudit(score, delta, meta = {}) {
3277
+ return this.record({
3278
+ kind: "build",
3279
+ action: "audit-complete",
3280
+ subject: "completeness",
3281
+ metadata: { ...meta, score, delta }
3282
+ });
3283
+ }
3284
+ recordFactIntroduced(factTag, meta = {}) {
3285
+ return this.record({ kind: "fact", action: "introduced", subject: factTag, metadata: meta });
3286
+ }
3287
+ recordFactDeprecated(factTag, meta = {}) {
3288
+ return this.record({ kind: "fact", action: "deprecated", subject: factTag, metadata: meta });
3289
+ }
3290
+ // ── Access ──────────────────────────────────────────────────────────────
3291
+ /** Return a shallow copy of all events. */
3292
+ getEvents() {
3293
+ return [...this.events];
3294
+ }
3295
+ /** Total number of recorded events. */
3296
+ get size() {
3297
+ return this.events.length;
3298
+ }
3299
+ /** Clear all events (primarily for testing). */
3300
+ clear() {
3301
+ this.events = [];
3302
+ }
3303
+ };
3304
+ function createProjectChronicle(options) {
3305
+ return new ProjectChronicle(options);
3306
+ }
3307
+
3308
+ // src/chronos/timeline.ts
3309
+ var Timeline = class {
3310
+ constructor(chronicle) {
3311
+ this.chronicle = chronicle;
3312
+ }
3313
+ // ── Queries ─────────────────────────────────────────────────────────────
3314
+ /**
3315
+ * Query events with optional filtering.
3316
+ * Returns matching events sorted chronologically (oldest first).
3317
+ */
3318
+ getTimeline(filter) {
3319
+ let events = this.chronicle.getEvents();
3320
+ if (!filter) return events;
3321
+ events = applyFilter(events, filter);
3322
+ return events;
3323
+ }
3324
+ /**
3325
+ * Get all events since a timestamp (inclusive).
3326
+ */
3327
+ getEventsSince(timestamp) {
3328
+ return this.getTimeline({ since: timestamp });
3329
+ }
3330
+ /**
3331
+ * Compute a behavioral delta between two timestamps.
3332
+ */
3333
+ getDelta(from, to) {
3334
+ const events = this.getTimeline({ since: from, until: to });
3335
+ return buildDelta(from, to, events);
3336
+ }
3337
+ /**
3338
+ * Get full history for a specific subject (rule id, gate name, etc.).
3339
+ * Sorted chronologically.
3340
+ */
3341
+ getHistory(subjectId) {
3342
+ return this.getTimeline({ subject: subjectId });
3343
+ }
3344
+ };
3345
+ function applyFilter(events, filter) {
3346
+ return events.filter((e) => {
3347
+ if (filter.kind) {
3348
+ const kinds = Array.isArray(filter.kind) ? filter.kind : [filter.kind];
3349
+ if (!kinds.includes(e.kind)) return false;
3350
+ }
3351
+ if (filter.action) {
3352
+ const actions = Array.isArray(filter.action) ? filter.action : [filter.action];
3353
+ if (!actions.includes(e.action)) return false;
3354
+ }
3355
+ if (filter.subject) {
3356
+ const subjects = Array.isArray(filter.subject) ? filter.subject : [filter.subject];
3357
+ if (!subjects.includes(e.subject)) return false;
3358
+ }
3359
+ if (filter.since != null && e.timestamp < filter.since) return false;
3360
+ if (filter.until != null && e.timestamp > filter.until) return false;
3361
+ return true;
3362
+ });
3363
+ }
3364
+ var ADD_ACTIONS = /* @__PURE__ */ new Set(["registered", "added", "introduced", "opened"]);
3365
+ var REMOVE_ACTIONS = /* @__PURE__ */ new Set(["removed", "deprecated", "closed"]);
3366
+ var MODIFY_ACTIONS = /* @__PURE__ */ new Set(["modified", "updated"]);
3367
+ function buildDelta(from, to, events) {
3368
+ const summary = {};
3369
+ const added = /* @__PURE__ */ new Set();
3370
+ const removed = /* @__PURE__ */ new Set();
3371
+ const modified = /* @__PURE__ */ new Set();
3372
+ for (const e of events) {
3373
+ summary[e.kind] = (summary[e.kind] ?? 0) + 1;
3374
+ if (ADD_ACTIONS.has(e.action)) {
3375
+ added.add(e.subject);
3376
+ removed.delete(e.subject);
3377
+ } else if (REMOVE_ACTIONS.has(e.action)) {
3378
+ removed.add(e.subject);
3379
+ added.delete(e.subject);
3380
+ } else if (MODIFY_ACTIONS.has(e.action)) {
3381
+ modified.add(e.subject);
3382
+ }
3383
+ }
3384
+ return {
3385
+ from,
3386
+ to,
3387
+ events,
3388
+ summary,
3389
+ added: [...added],
3390
+ removed: [...removed],
3391
+ modified: [...modified]
3392
+ };
3393
+ }
3394
+ function createTimeline(chronicle) {
3395
+ return new Timeline(chronicle);
3396
+ }
3397
+
3398
+ // src/chronos/hooks.ts
3399
+ function enableProjectChronicle(registry, engine, options = {}) {
3400
+ const chronicle = options.chronicle ?? createProjectChronicle();
3401
+ const recordSteps = options.recordSteps ?? true;
3402
+ const recordConstraints = options.recordConstraints ?? true;
3403
+ const origRegisterRule = registry.registerRule.bind(registry);
3404
+ const origRegisterModule = registry.registerModule.bind(registry);
3405
+ const origStep = engine.step.bind(engine);
3406
+ const origCheckConstraints = engine.checkConstraints.bind(engine);
3407
+ registry.registerRule = function hookedRegisterRule(descriptor) {
3408
+ origRegisterRule(descriptor);
3409
+ chronicle.recordRuleRegistered(descriptor.id, {
3410
+ description: descriptor.description,
3411
+ hasContract: !!descriptor.contract,
3412
+ eventTypes: descriptor.eventTypes
3413
+ });
3414
+ if (descriptor.contract) {
3415
+ chronicle.recordContractAdded(descriptor.id, {
3416
+ behavior: descriptor.contract.behavior,
3417
+ examplesCount: descriptor.contract.examples?.length ?? 0,
3418
+ invariantsCount: descriptor.contract.invariants?.length ?? 0
3419
+ });
3420
+ }
3421
+ };
3422
+ registry.registerModule = function hookedRegisterModule(module) {
3423
+ origRegisterModule(module);
3424
+ for (const rule of module.rules) {
3425
+ chronicle.recordRuleRegistered(rule.id, {
3426
+ description: rule.description,
3427
+ hasContract: !!rule.contract,
3428
+ eventTypes: rule.eventTypes,
3429
+ registeredVia: "module"
3430
+ });
3431
+ if (rule.contract) {
3432
+ chronicle.recordContractAdded(rule.id, {
3433
+ behavior: rule.contract.behavior,
3434
+ examplesCount: rule.contract.examples?.length ?? 0,
3435
+ invariantsCount: rule.contract.invariants?.length ?? 0
3436
+ });
3437
+ }
3438
+ }
3439
+ };
3440
+ if (recordSteps) {
3441
+ engine.step = function hookedStep(events) {
3442
+ const result = origStep(events);
3443
+ const factTags = /* @__PURE__ */ new Set();
3444
+ for (const fact2 of result.state.facts) {
3445
+ factTags.add(fact2.tag);
3446
+ }
3447
+ chronicle.record({
3448
+ kind: "build",
3449
+ action: "step-complete",
3450
+ subject: "engine",
3451
+ metadata: {
3452
+ eventsProcessed: events.length,
3453
+ eventTags: events.map((e) => e.tag),
3454
+ factsAfter: result.state.facts.length,
3455
+ diagnosticsCount: result.diagnostics.length
3456
+ }
3457
+ });
3458
+ for (const diag of result.diagnostics) {
3459
+ if (diag.kind === "constraint-violation") {
3460
+ chronicle.record({
3461
+ kind: "expectation",
3462
+ action: "violated",
3463
+ subject: extractSubjectFromDiag(diag),
3464
+ metadata: { message: diag.message, data: diag.data }
3465
+ });
3466
+ }
3467
+ }
3468
+ return result;
3469
+ };
3470
+ }
3471
+ if (recordConstraints) {
3472
+ engine.checkConstraints = function hookedCheckConstraints() {
3473
+ const diagnostics = origCheckConstraints();
3474
+ chronicle.record({
3475
+ kind: "build",
3476
+ action: "constraints-checked",
3477
+ subject: "engine",
3478
+ metadata: {
3479
+ violations: diagnostics.length
3480
+ }
3481
+ });
3482
+ for (const diag of diagnostics) {
3483
+ chronicle.record({
3484
+ kind: "expectation",
3485
+ action: "violated",
3486
+ subject: extractSubjectFromDiag(diag),
3487
+ metadata: { message: diag.message }
3488
+ });
3489
+ }
3490
+ return diagnostics;
3491
+ };
3492
+ }
3493
+ function disconnect() {
3494
+ registry.registerRule = origRegisterRule;
3495
+ registry.registerModule = origRegisterModule;
3496
+ engine.step = origStep;
3497
+ engine.checkConstraints = origCheckConstraints;
3498
+ }
3499
+ return { chronicle, disconnect };
3500
+ }
3501
+ function recordAudit(chronicle, report, previousScore) {
3502
+ const delta = previousScore != null ? report.score - previousScore : 0;
3503
+ chronicle.recordBuildAudit(report.score, delta, {
3504
+ rating: report.rating,
3505
+ rulesCovered: report.rules.covered,
3506
+ rulesTotal: report.rules.total,
3507
+ constraintsCovered: report.constraints.covered,
3508
+ constraintsTotal: report.constraints.total,
3509
+ contractsCovered: report.contracts.withContracts,
3510
+ contractsTotal: report.contracts.total
3511
+ });
3512
+ }
3513
+ function extractSubjectFromDiag(diag) {
3514
+ const data = diag.data;
3515
+ if (data?.constraintId && typeof data.constraintId === "string") return data.constraintId;
3516
+ if (data?.ruleId && typeof data.ruleId === "string") return data.ruleId;
3517
+ return "unknown";
3518
+ }
3519
+
3520
+ // src/chronos/diff.ts
3521
+ function diffRegistries(before, after) {
3522
+ const beforeRules = toIdMap(before.rules);
3523
+ const afterRules = toIdMap(after.rules);
3524
+ const beforeConstraints = toIdMap(before.constraints);
3525
+ const afterConstraints = toIdMap(after.constraints);
3526
+ return {
3527
+ rulesAdded: setDiff(afterRules, beforeRules),
3528
+ rulesRemoved: setDiff(beforeRules, afterRules),
3529
+ rulesModified: findModified(beforeRules, afterRules),
3530
+ constraintsAdded: setDiff(afterConstraints, beforeConstraints),
3531
+ constraintsRemoved: setDiff(beforeConstraints, afterConstraints),
3532
+ constraintsModified: findModified(beforeConstraints, afterConstraints)
3533
+ };
3534
+ }
3535
+ function diffContracts(before, after) {
3536
+ const beforeMap = toRecord(before.coverage);
3537
+ const afterMap = toRecord(after.coverage);
3538
+ const contractsAdded = [];
3539
+ const contractsRemoved = [];
3540
+ for (const [id, has] of Object.entries(afterMap)) {
3541
+ if (has && !beforeMap[id]) {
3542
+ contractsAdded.push(id);
3543
+ }
3544
+ }
3545
+ for (const [id, had] of Object.entries(beforeMap)) {
3546
+ if (had && !afterMap[id]) {
3547
+ contractsRemoved.push(id);
3548
+ }
3549
+ }
3550
+ const countTrue = (r) => Object.values(r).filter(Boolean).length;
3551
+ const totalBefore = Object.keys(beforeMap).length;
3552
+ const totalAfter = Object.keys(afterMap).length;
3553
+ return {
3554
+ contractsAdded,
3555
+ contractsRemoved,
3556
+ coverageBefore: totalBefore > 0 ? countTrue(beforeMap) / totalBefore : 0,
3557
+ coverageAfter: totalAfter > 0 ? countTrue(afterMap) / totalAfter : 0
3558
+ };
3559
+ }
3560
+ function diffExpectations(before, after) {
3561
+ const beforeMap = toRecord(before.expectations);
3562
+ const afterMap = toRecord(after.expectations);
3563
+ const allKeys = /* @__PURE__ */ new Set([...Object.keys(beforeMap), ...Object.keys(afterMap)]);
3564
+ const newlySatisfied = [];
3565
+ const newlyViolated = [];
3566
+ const unchanged = [];
3567
+ for (const key of allKeys) {
3568
+ const was = beforeMap[key] ?? false;
3569
+ const is = afterMap[key] ?? false;
3570
+ if (!was && is) {
3571
+ newlySatisfied.push(key);
3572
+ } else if (was && !is) {
3573
+ newlyViolated.push(key);
3574
+ } else {
3575
+ unchanged.push(key);
3576
+ }
3577
+ }
3578
+ return { newlySatisfied, newlyViolated, unchanged };
3579
+ }
3580
+ function formatDelta(diff) {
3581
+ const lines = [];
3582
+ if (diff.rulesAdded.length > 0)
3583
+ lines.push(`+ Rules added: ${diff.rulesAdded.join(", ")}`);
3584
+ if (diff.rulesRemoved.length > 0)
3585
+ lines.push(`- Rules removed: ${diff.rulesRemoved.join(", ")}`);
3586
+ if (diff.rulesModified.length > 0)
3587
+ lines.push(`~ Rules modified: ${diff.rulesModified.join(", ")}`);
3588
+ if (diff.constraintsAdded.length > 0)
3589
+ lines.push(`+ Constraints added: ${diff.constraintsAdded.join(", ")}`);
3590
+ if (diff.constraintsRemoved.length > 0)
3591
+ lines.push(`- Constraints removed: ${diff.constraintsRemoved.join(", ")}`);
3592
+ if (diff.constraintsModified.length > 0)
3593
+ lines.push(`~ Constraints modified: ${diff.constraintsModified.join(", ")}`);
3594
+ return lines.length > 0 ? lines.join("\n") : "No behavioral changes.";
3595
+ }
3596
+ function formatCommitMessage(diff) {
3597
+ const praxisDiff = {
3598
+ rulesAdded: diff.rulesAdded,
3599
+ rulesRemoved: diff.rulesRemoved,
3600
+ rulesModified: diff.rulesModified,
3601
+ contractsAdded: [],
3602
+ contractsRemoved: [],
3603
+ expectationsAdded: diff.constraintsAdded,
3604
+ expectationsRemoved: diff.constraintsRemoved,
3605
+ gateChanges: []
3606
+ };
3607
+ return commitFromDiff(praxisDiff);
3608
+ }
3609
+ function formatReleaseNotes(diffs) {
3610
+ const sections = [];
3611
+ const allAdded = [];
3612
+ const allRemoved = [];
3613
+ const allModified = [];
3614
+ for (const diff of diffs) {
3615
+ allAdded.push(...diff.rulesAdded, ...diff.constraintsAdded);
3616
+ allRemoved.push(...diff.rulesRemoved, ...diff.constraintsRemoved);
3617
+ allModified.push(...diff.rulesModified, ...diff.constraintsModified);
3618
+ }
3619
+ const added = [...new Set(allAdded)];
3620
+ const removed = [...new Set(allRemoved)];
3621
+ const modified = [...new Set(allModified)];
3622
+ if (added.length > 0) {
3623
+ sections.push(`### Added
3624
+ ${added.map((id) => `- ${id}`).join("\n")}`);
3625
+ }
3626
+ if (modified.length > 0) {
3627
+ sections.push(`### Changed
3628
+ ${modified.map((id) => `- ${id}`).join("\n")}`);
3629
+ }
3630
+ if (removed.length > 0) {
3631
+ sections.push(`### Removed
3632
+ ${removed.map((id) => `- ${id}`).join("\n")}`);
3633
+ }
3634
+ if (sections.length === 0) return "No behavioral changes in this release.";
3635
+ return `## Release Notes
3636
+
3637
+ ${sections.join("\n\n")}`;
3638
+ }
3639
+ function toIdMap(input) {
3640
+ if (input instanceof Map) return input;
3641
+ const map = /* @__PURE__ */ new Map();
3642
+ for (const item of input) map.set(item.id, item);
3643
+ return map;
3644
+ }
3645
+ function setDiff(a, b) {
3646
+ const result = [];
3647
+ for (const key of a.keys()) {
3648
+ if (!b.has(key)) result.push(key);
3649
+ }
3650
+ return result;
3651
+ }
3652
+ function findModified(before, after) {
3653
+ const result = [];
3654
+ for (const [key, beforeVal] of before) {
3655
+ const afterVal = after.get(key);
3656
+ if (afterVal && beforeVal.description !== afterVal.description) {
3657
+ result.push(key);
3658
+ }
3659
+ }
3660
+ return result;
3661
+ }
3662
+ function toRecord(input) {
3663
+ if (input instanceof Map) {
3664
+ const result = {};
3665
+ for (const [k, v] of input) result[k] = v;
3666
+ return result;
3667
+ }
3668
+ return input;
3669
+ }
3670
+ function commitFromDiff(diff) {
3671
+ const parts = [];
3672
+ const bodyParts = [];
3673
+ const totalAdded = diff.rulesAdded.length + diff.contractsAdded.length + diff.expectationsAdded.length;
3674
+ const totalRemoved = diff.rulesRemoved.length + diff.contractsRemoved.length + diff.expectationsRemoved.length;
3675
+ const totalModified = diff.rulesModified.length;
3676
+ if (totalAdded > 0 && totalRemoved === 0 && totalModified === 0) {
3677
+ if (diff.rulesAdded.length > 0) {
3678
+ const scope = inferScope2(diff.rulesAdded);
3679
+ parts.push(`feat(${scope}): add ${fmtIds(diff.rulesAdded)}`);
3680
+ } else if (diff.contractsAdded.length > 0) {
3681
+ parts.push(`feat(contracts): add contracts for ${fmtIds(diff.contractsAdded)}`);
3682
+ } else {
3683
+ parts.push(`feat(expectations): add ${fmtIds(diff.expectationsAdded)}`);
3684
+ }
3685
+ } else if (totalRemoved > 0 && totalAdded === 0) {
3686
+ if (diff.rulesRemoved.length > 0) {
3687
+ const scope = inferScope2(diff.rulesRemoved);
3688
+ parts.push(`refactor(${scope}): remove ${fmtIds(diff.rulesRemoved)}`);
3689
+ } else {
3690
+ parts.push(`refactor: remove ${totalRemoved} item(s)`);
3691
+ }
3692
+ } else if (totalModified > 0) {
3693
+ const scope = inferScope2(diff.rulesModified);
3694
+ parts.push(`refactor(${scope}): update ${fmtIds(diff.rulesModified)}`);
3695
+ } else {
3696
+ parts.push("chore: behavioral state update");
3697
+ }
3698
+ if (diff.rulesAdded.length > 0) bodyParts.push(`Rules added: ${diff.rulesAdded.join(", ")}`);
3699
+ if (diff.rulesRemoved.length > 0) bodyParts.push(`Rules removed: ${diff.rulesRemoved.join(", ")}`);
3700
+ if (diff.rulesModified.length > 0) bodyParts.push(`Rules modified: ${diff.rulesModified.join(", ")}`);
3701
+ const subject = parts[0] || "chore: update";
3702
+ return bodyParts.length > 0 ? `${subject}
3703
+
3704
+ ${bodyParts.join("\n")}` : subject;
3705
+ }
3706
+ function inferScope2(ids) {
3707
+ if (ids.length === 0) return "rules";
3708
+ const prefixes = ids.map((id) => {
3709
+ const slash = id.indexOf("/");
3710
+ return slash > 0 ? id.slice(0, slash) : id;
3711
+ });
3712
+ const unique = new Set(prefixes);
3713
+ return unique.size === 1 ? prefixes[0] : "rules";
3714
+ }
3715
+ function fmtIds(ids) {
3716
+ if (ids.length <= 3) return ids.join(", ");
3717
+ return `${ids.slice(0, 2).join(", ")} (+${ids.length - 2} more)`;
3718
+ }
3196
3719
  export {
3197
3720
  AcknowledgeContractGap,
3198
3721
  ActorManager,
@@ -3217,12 +3740,15 @@ export {
3217
3740
  PraxisDBStore,
3218
3741
  PraxisRegistry,
3219
3742
  PraxisSchemaRegistry,
3743
+ ProjectChronicle,
3220
3744
  ReactiveLogicEngine,
3221
3745
  RegistryIntrospector,
3222
3746
  RuleResult,
3223
3747
  StateDocsGenerator,
3224
3748
  TerminalAdapter,
3749
+ Timeline,
3225
3750
  ValidateContracts,
3751
+ analyzeDependencyGraph,
3226
3752
  attachAllIntegrations,
3227
3753
  attachTauriToEngine,
3228
3754
  attachToEngine,
@@ -3248,16 +3774,19 @@ export {
3248
3774
  createPraxisDBStore,
3249
3775
  createPraxisEngine,
3250
3776
  createPraxisLocalFirst,
3777
+ createProjectChronicle,
3251
3778
  createReactiveEngine,
3252
3779
  createSchemaRegistry,
3253
3780
  createSchemaTemplate,
3254
3781
  createStateDocsGenerator,
3255
3782
  createTauriPraxisAdapter,
3256
3783
  createTerminalAdapter,
3784
+ createTimeline,
3257
3785
  createTimerActor,
3258
3786
  createUIModule,
3259
3787
  createUnifiedApp,
3260
3788
  createUnumAdapter,
3789
+ crossReferenceContracts,
3261
3790
  dataRules,
3262
3791
  defineConstraint,
3263
3792
  defineContract,
@@ -3266,17 +3795,33 @@ export {
3266
3795
  defineGate,
3267
3796
  defineModule,
3268
3797
  defineRule,
3798
+ diffContracts,
3799
+ diffExpectations,
3800
+ diffLedgers,
3801
+ diffRegistries,
3269
3802
  dirtyGuardRule,
3803
+ enableProjectChronicle,
3270
3804
  errorDisplayRule,
3271
3805
  expectBehavior,
3272
3806
  expectationGate,
3273
3807
  fact,
3274
3808
  filterEvents,
3275
3809
  filterFacts,
3810
+ findContractGaps,
3811
+ findContradictions,
3812
+ findDeadRules,
3276
3813
  findEvent,
3277
3814
  findFact,
3815
+ findGaps,
3816
+ findShadowedRules,
3817
+ findUnreachableStates,
3278
3818
  formRules,
3819
+ formatCommitMessage as formatBehavioralCommit,
3820
+ formatBuildOutput,
3821
+ formatDelta,
3279
3822
  formatGate,
3823
+ formatLedger,
3824
+ formatReleaseNotes,
3280
3825
  formatReport,
3281
3826
  formatValidationReport,
3282
3827
  formatValidationReportJSON,
@@ -3284,6 +3829,7 @@ export {
3284
3829
  formatVerificationReport,
3285
3830
  generateDocs,
3286
3831
  generateId,
3832
+ generateLedger,
3287
3833
  generateTauriConfig,
3288
3834
  getContract,
3289
3835
  getEventPath,
@@ -3303,12 +3849,17 @@ export {
3303
3849
  navigationRules,
3304
3850
  noInteractionWhileLoadingConstraint,
3305
3851
  offlineIndicatorRule,
3852
+ recordAudit,
3306
3853
  registerSchema,
3307
3854
  resizeEvent,
3308
3855
  runTerminalCommand,
3309
3856
  schemaToCanvas,
3310
3857
  semverContract,
3858
+ suggest,
3859
+ suggestAll,
3311
3860
  toastRules,
3861
+ traceDerivation,
3862
+ traceImpact,
3312
3863
  uiModule,
3313
3864
  uiStateChanged,
3314
3865
  validateContracts,
@@ -3316,5 +3867,7 @@ export {
3316
3867
  validateSchema,
3317
3868
  validateWithGuardian,
3318
3869
  verify,
3870
+ verifyContractExamples,
3871
+ verifyInvariants,
3319
3872
  viewportRule
3320
3873
  };
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  ReactiveLogicEngine,
3
3
  createReactiveEngine
4
- } from "../chunk-7M3HV4XR.js";
5
- import "../chunk-KMJWAFZV.js";
4
+ } from "../chunk-ZO2LU4G4.js";
5
+ import "../chunk-JZDJU2DO.js";
6
+ import "../chunk-IG5BJ2MT.js";
6
7
  import "../chunk-TEMFJOIH.js";
7
8
  import "../chunk-QGM4M3NI.js";
8
9
 
@@ -6,9 +6,11 @@ import {
6
6
  getContractFromDescriptor
7
7
  } from "./chunk-PGVSB6NR.js";
8
8
  import {
9
- LogicEngine,
9
+ LogicEngine
10
+ } from "./chunk-JZDJU2DO.js";
11
+ import {
10
12
  RuleResult
11
- } from "./chunk-KMJWAFZV.js";
13
+ } from "./chunk-IG5BJ2MT.js";
12
14
  import "./chunk-QGM4M3NI.js";
13
15
 
14
16
  // src/mcp/server.ts