@plures/praxis 1.2.0 → 1.2.10

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 (63) hide show
  1. package/README.md +10 -96
  2. package/dist/browser/{adapter-TM4IS5KT.js → adapter-CIMBGDC7.js} +5 -3
  3. package/dist/browser/{chunk-LE2ZJYFC.js → chunk-K377RW4V.js} +76 -0
  4. package/dist/{node/chunk-JQ64KMLN.js → browser/chunk-MBVHLOU2.js} +12 -1
  5. package/dist/browser/index.d.ts +32 -5
  6. package/dist/browser/index.js +15 -7
  7. package/dist/browser/integrations/svelte.d.ts +2 -2
  8. package/dist/browser/integrations/svelte.js +1 -1
  9. package/dist/browser/{reactive-engine.svelte-C9OpcTHf.d.ts → reactive-engine.svelte-9aS0kTa8.d.ts} +136 -1
  10. package/dist/node/{adapter-K6DOX6XS.js → adapter-75ISSMWD.js} +5 -3
  11. package/dist/node/chunk-5RH7UAQC.js +486 -0
  12. package/dist/{browser/chunk-JQ64KMLN.js → node/chunk-MBVHLOU2.js} +12 -1
  13. package/dist/node/{chunk-LE2ZJYFC.js → chunk-PRPQO6R5.js} +3 -72
  14. package/dist/node/chunk-R2PSBPKQ.js +150 -0
  15. package/dist/node/chunk-WZ6B3LZ6.js +638 -0
  16. package/dist/node/cli/index.cjs +2316 -832
  17. package/dist/node/cli/index.js +18 -0
  18. package/dist/node/components/index.d.cts +3 -2
  19. package/dist/node/components/index.d.ts +3 -2
  20. package/dist/node/index.cjs +620 -38
  21. package/dist/node/index.d.cts +259 -5
  22. package/dist/node/index.d.ts +259 -5
  23. package/dist/node/index.js +55 -65
  24. package/dist/node/integrations/svelte.cjs +76 -0
  25. package/dist/node/integrations/svelte.d.cts +2 -2
  26. package/dist/node/integrations/svelte.d.ts +2 -2
  27. package/dist/node/integrations/svelte.js +2 -1
  28. package/dist/node/{reactive-engine.svelte-1M4m_C_v.d.cts → reactive-engine.svelte-BFIZfawz.d.cts} +199 -1
  29. package/dist/node/{reactive-engine.svelte-ChNFn4Hj.d.ts → reactive-engine.svelte-CRNqHlbv.d.ts} +199 -1
  30. package/dist/node/reverse-W7THPV45.js +193 -0
  31. package/dist/node/{terminal-adapter-CWka-yL8.d.ts → terminal-adapter-B-UK_Vdz.d.ts} +28 -3
  32. package/dist/node/{terminal-adapter-CDzxoLKR.d.cts → terminal-adapter-BQSIF5bf.d.cts} +28 -3
  33. package/dist/node/validate-CNHUULQE.js +180 -0
  34. package/docs/core/pluresdb-integration.md +15 -15
  35. package/docs/decision-ledger/BEHAVIOR_LEDGER.md +225 -0
  36. package/docs/decision-ledger/DecisionLedger.tla +180 -0
  37. package/docs/decision-ledger/IMPLEMENTATION_SUMMARY.md +217 -0
  38. package/docs/decision-ledger/LATEST.md +166 -0
  39. package/docs/guides/cicd-pipeline.md +142 -0
  40. package/package.json +2 -2
  41. package/src/__tests__/cli-validate.test.ts +197 -0
  42. package/src/__tests__/decision-ledger.test.ts +485 -0
  43. package/src/__tests__/reverse-generator.test.ts +189 -0
  44. package/src/__tests__/scanner.test.ts +215 -0
  45. package/src/cli/commands/reverse.ts +289 -0
  46. package/src/cli/commands/validate.ts +264 -0
  47. package/src/cli/index.ts +47 -0
  48. package/src/core/pluresdb/adapter.ts +45 -2
  49. package/src/core/rules.ts +133 -0
  50. package/src/decision-ledger/README.md +400 -0
  51. package/src/decision-ledger/REVERSE_ENGINEERING.md +484 -0
  52. package/src/decision-ledger/facts-events.ts +121 -0
  53. package/src/decision-ledger/index.ts +70 -0
  54. package/src/decision-ledger/ledger.ts +246 -0
  55. package/src/decision-ledger/logic-ledger.ts +158 -0
  56. package/src/decision-ledger/reverse-generator.ts +426 -0
  57. package/src/decision-ledger/scanner.ts +506 -0
  58. package/src/decision-ledger/types.ts +247 -0
  59. package/src/decision-ledger/validation.ts +336 -0
  60. package/src/dsl/index.ts +13 -2
  61. package/src/index.browser.ts +2 -0
  62. package/src/index.ts +36 -0
  63. package/src/integrations/pluresdb.ts +14 -2
package/README.md CHANGED
@@ -1,5 +1,3 @@
1
- dotnet build
2
- dotnet test
3
1
  # Praxis
4
2
 
5
3
  **Typed, visual-first application logic for Svelte, Node, and the browser.**
@@ -10,37 +8,10 @@ dotnet test
10
8
  [![Node.js Version](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org/)
11
9
  [![Deno Compatible](https://img.shields.io/badge/deno-compatible-brightgreen)](https://deno.land/)
12
10
 
13
- Praxis is **the unified solution for declarative application development**, combining:
11
+ Praxis is a unified solution for declarative application development. The framework combines typed logic modeling (facts, events, rules, constraints), component generation (Svelte 5), and local-first data persistence (PluresDB). It includes visual tools (CodeCanvas, State-Docs), distributed system support (Unum), optional cloud relay, and a CLI for scaffolding and generation.
14
12
 
15
- - **Logic Modeling**: Typed facts, events, rules, and constraints for domain logic
16
- - **Component Auto-Generation**: Svelte 5 components generated from schemas
17
- - **Data Persistence**: PluresDB for local-first, reactive data storage
18
- - **Documentation**: Auto-generated docs with State-Docs and visual diagrams
19
- - **Visual Editing**: CodeCanvas for schema design and FSM visualization
20
- - **Distributed Systems**: Unum for identity and multi-node communication
13
+ The library delivers unified ESM/CJS builds with curated subpath exports (`./`, `./svelte`, `./schema`, `./component`, `./cloud`, `./components`), Svelte 5 runes support, and publish-ready packages for npm and JSR.
21
14
 
22
- The library delivers a unified ESM/CJS build, curated subpath exports, Svelte runes support, and a slimmer, publish-ready package for npm and JSR.
23
-
24
- ---
25
-
26
- ## What’s new
27
- - **Unified builds & exports**: `./`, `./svelte`, `./schema`, `./component`, `./cloud`, `./components`, and CLI all ship with ESM, CJS, and type definitions.
28
- - **Svelte 5 runes native**: Runes-friendly stores and helpers; server+client builds for integrations.
29
- - **Framework-agnostic reactivity**: Proxy-based reactive engine for use without Svelte, enabling reactive state management in Node.js, browsers, and any JavaScript environment.
30
- - **Logic engine refinements**: Typed registry, step diagnostics, and trace-friendly rule execution.
31
- - **Cloud relay & local-first**: Polished cloud connector alongside PluresDB-first workflows.
32
- - **Publish-ready**: npm public access + JSR exports aligned to source.
33
-
34
- ## Capabilities at a glance
35
- - **Logic Engine**: Facts, events, rules, constraints, registry, introspection, and reactive engine variants (Svelte 5 + framework-agnostic).
36
- - **Schema & Codegen**: PSF-style schema types plus component generator for Svelte UIs.
37
- - **Svelte Integration**: Typed helpers, runes-ready builds, and Svelte component typings.
38
- - **Local-First Data**: PluresDB integration for offline-first, reactive state with full persistence.
39
- - **Distributed Systems**: Unum integration for identity management and multi-node channels.
40
- - **Documentation**: State-Docs integration for auto-generated Markdown docs and Mermaid diagrams.
41
- - **Visual Editing**: CodeCanvas integration for visual schema design and FSM visualization.
42
- - **Cloud Relay**: Optional sync layer (GitHub-auth friendly) for distributed teams.
43
- - **CLI**: Scaffolding, generation, canvas helpers, docs generation, and cloud commands.
44
15
 
45
16
  ## Install
46
17
  Node 18+ recommended.
@@ -55,7 +26,7 @@ pnpm add @plures/praxis
55
26
 
56
27
  JSR (Deno):
57
28
  ```bash
58
- const result = engine.step([Login.create({ username: 'alice' })]);
29
+ deno add @plures/praxis
59
30
  # or via import map pointing to npm:
60
31
  # {
61
32
  # "imports": { "@plures/praxis": "npm:@plures/praxis@^1.1.2" }
@@ -538,7 +509,7 @@ Demonstrates the terminal node feature for command execution:
538
509
  - Terminal adapter creation and configuration
539
510
  - Command execution and history tracking
540
511
  - YAML schema loading with terminal nodes
541
- - PluresDB binding configuration (ready for integration)
512
+ - PluresDB binding configuration
542
513
  - Both text and widget input modes
543
514
 
544
515
  ```bash
@@ -673,7 +644,7 @@ Praxis integrates with the full Plures ecosystem:
673
644
 
674
645
  ### PluresDB Integration
675
646
 
676
- Local-first reactive datastore for offline-capable applications. **Now fully implemented** with 32 tests covering all features.
647
+ Local-first reactive datastore for offline-capable applications. Fully implemented with 32 tests covering all features.
677
648
 
678
649
  ```typescript
679
650
  import {
@@ -722,7 +693,7 @@ adapter.subscribeToEvents((events) => {
722
693
 
723
694
  ### Unum Integration
724
695
 
725
- Identity and channels for distributed systems. **Now fully implemented** with comprehensive channel and identity management.
696
+ Identity and channels for distributed systems. Fully implemented with comprehensive channel and identity management.
726
697
 
727
698
  ```typescript
728
699
  import {
@@ -772,40 +743,10 @@ attachUnumToEngine(engine, unum, channel.id);
772
743
  **Tests**: Comprehensive integration tests
773
744
  **Use Cases**: Distributed messaging, identity management, multi-user collaboration
774
745
 
775
- ### ADP Integration
776
-
777
- Architectural Decision Protocol for guardrails and governance.
778
-
779
- ```typescript
780
- import { createADP } from '@plures/adp';
781
-
782
- // Track architectural decisions from schemas
783
- const adp = createADP({
784
- source: 'praxis-schema',
785
- decisions: [
786
- {
787
- id: 'ADR-001',
788
- title: 'Use PluresDB for local-first storage',
789
- context: 'Need offline-capable data storage',
790
- decision: 'Adopt PluresDB',
791
- consequences: ['Offline support', 'Sync complexity'],
792
- },
793
- ],
794
- });
795
-
796
- // Enforce guardrails
797
- adp.enforce({
798
- rule: 'no-direct-database-access',
799
- check: (code) => !code.includes('direct-sql'),
800
- });
801
- ```
802
-
803
- **Status**: Planned
804
- **Use Cases**: Architecture documentation, compliance checking, guardrails
805
746
 
806
747
  ### State-Docs Integration
807
748
 
808
- Living documentation generated from Praxis schemas. **Now fully implemented** with Markdown and Mermaid diagram generation.
749
+ Living documentation generated from Praxis schemas. Fully implemented with Markdown and Mermaid diagram generation.
809
750
 
810
751
  ```typescript
811
752
  import {
@@ -855,12 +796,11 @@ const allDocs = generateDocs(appSchema, {
855
796
  - **Table of Contents**: Automatic ToC generation
856
797
 
857
798
  **Status**: ✅ Available (`src/integrations/state-docs.ts`)
858
- **CLI**: Use `praxis generate` with `--docs` flag (coming soon)
859
799
  **Documentation**: Auto-generates README, models.md, logic diagrams
860
800
 
861
801
  ### CodeCanvas Integration
862
802
 
863
- Visual IDE for schema and logic editing. **Now fully implemented** with schema visualization and canvas export.
803
+ Visual IDE for schema and logic editing. Fully implemented with schema visualization and canvas export.
864
804
 
865
805
  ```typescript
866
806
  import {
@@ -914,15 +854,13 @@ const updatedSchema = editor.toSchema();
914
854
  - **Guardian Validation**: Pre-commit lifecycle checks
915
855
 
916
856
  **Status**: ✅ Available (`src/integrations/code-canvas.ts`)
917
- **CLI**: Use `praxis canvas` commands (coming soon)
918
857
  **Documentation**: [docs/guides/canvas.md](./docs/guides/canvas.md)
919
858
 
920
- ### Svelte + Tauri Runtime
859
+ ### Svelte Integration
921
860
 
922
- Cross-platform runtime for web, desktop, and mobile.
861
+ Svelte v5 integration with reactive stores.
923
862
 
924
863
  ```typescript
925
- // Svelte v5 integration (available now)
926
864
  import { createPraxisStore } from '@plures/praxis/svelte';
927
865
 
928
866
  const stateStore = createPraxisStore(engine);
@@ -930,15 +868,8 @@ const userStore = createDerivedStore(engine, (ctx) => ctx.currentUser);
930
868
 
931
869
  // In Svelte component:
932
870
  // $: currentUser = $userStore;
933
-
934
- // Desktop app with Tauri
935
- npm run tauri:dev // Development
936
- npm run tauri:build // Production
937
871
  ```
938
872
 
939
- **Status**: Svelte integration available, Tauri templates planned
940
- **Platform Support**: Web (now), Desktop (planned), Mobile (future)
941
-
942
873
  ## Cross-Language Usage
943
874
 
944
875
  ### PowerShell
@@ -1012,23 +943,6 @@ Console.WriteLine($"Facts: {result.State.Facts.Count}"); // Facts: 1
1012
943
 
1013
944
  See [csharp/Praxis/README.md](./csharp/Praxis/README.md) for complete documentation.
1014
945
 
1015
- ## Roadmap
1016
-
1017
- ### Current Focus
1018
-
1019
- - Full CodeCanvas integration
1020
- - Enhanced Unum identity support
1021
- - Advanced State-Docs generation
1022
- - Multi-language schema support
1023
- - Real PluresDB sync with CRDT/offline-first capabilities
1024
-
1025
- ### Long Term
1026
-
1027
- - Mobile templates (iOS, Android)
1028
- - Enterprise features
1029
- - Advanced orchestration
1030
- - Performance optimizations
1031
- - Plugin ecosystem
1032
946
 
1033
947
  ## Cross-Language Support
1034
948
 
@@ -2,11 +2,13 @@ import {
2
2
  InMemoryPraxisDB,
3
3
  PluresDBPraxisAdapter,
4
4
  createInMemoryDB,
5
- createPluresDB
6
- } from "./chunk-JQ64KMLN.js";
5
+ createPluresDB,
6
+ createPraxisLocalFirst
7
+ } from "./chunk-MBVHLOU2.js";
7
8
  export {
8
9
  InMemoryPraxisDB,
9
10
  PluresDBPraxisAdapter,
10
11
  createInMemoryDB,
11
- createPluresDB
12
+ createPluresDB,
13
+ createPraxisLocalFirst
12
14
  };
@@ -6,6 +6,17 @@ import {
6
6
  var PraxisRegistry = class {
7
7
  rules = /* @__PURE__ */ new Map();
8
8
  constraints = /* @__PURE__ */ new Map();
9
+ compliance;
10
+ contractGaps = [];
11
+ constructor(options = {}) {
12
+ const defaultEnabled = typeof process !== "undefined" ? true : false;
13
+ this.compliance = {
14
+ enabled: defaultEnabled,
15
+ requiredFields: ["behavior", "examples", "invariants"],
16
+ missingSeverity: "warning",
17
+ ...options.compliance
18
+ };
19
+ }
9
20
  /**
10
21
  * Register a rule
11
22
  */
@@ -14,6 +25,7 @@ var PraxisRegistry = class {
14
25
  throw new Error(`Rule with id "${descriptor.id}" already registered`);
15
26
  }
16
27
  this.rules.set(descriptor.id, descriptor);
28
+ this.trackContractCompliance(descriptor.id, descriptor);
17
29
  }
18
30
  /**
19
31
  * Register a constraint
@@ -23,6 +35,7 @@ var PraxisRegistry = class {
23
35
  throw new Error(`Constraint with id "${descriptor.id}" already registered`);
24
36
  }
25
37
  this.constraints.set(descriptor.id, descriptor);
38
+ this.trackContractCompliance(descriptor.id, descriptor);
26
39
  }
27
40
  /**
28
41
  * Register a module (all its rules and constraints)
@@ -71,6 +84,69 @@ var PraxisRegistry = class {
71
84
  getAllConstraints() {
72
85
  return Array.from(this.constraints.values());
73
86
  }
87
+ /**
88
+ * Get collected contract gaps from registration-time validation.
89
+ */
90
+ getContractGaps() {
91
+ return [...this.contractGaps];
92
+ }
93
+ /**
94
+ * Clear collected contract gaps.
95
+ */
96
+ clearContractGaps() {
97
+ this.contractGaps = [];
98
+ }
99
+ trackContractCompliance(id, descriptor) {
100
+ if (!this.compliance.enabled) {
101
+ return;
102
+ }
103
+ const gaps = this.validateDescriptorContract(id, descriptor);
104
+ for (const gap of gaps) {
105
+ this.contractGaps.push(gap);
106
+ if (this.compliance.onGap) {
107
+ this.compliance.onGap(gap);
108
+ } else {
109
+ const label = gap.severity === "error" ? "ERROR" : gap.severity === "warning" ? "WARN" : "INFO";
110
+ console.warn(`[Praxis][${label}] Contract gap for "${gap.ruleId}": missing ${gap.missing.join(", ")}`);
111
+ }
112
+ }
113
+ }
114
+ validateDescriptorContract(id, descriptor) {
115
+ const requiredFields = this.compliance.requiredFields ?? ["behavior", "examples", "invariants"];
116
+ const missingSeverity = this.compliance.missingSeverity ?? "warning";
117
+ const contract = descriptor.contract ?? (descriptor.meta?.contract && typeof descriptor.meta.contract === "object" ? descriptor.meta.contract : void 0);
118
+ if (!contract) {
119
+ return [
120
+ {
121
+ ruleId: id,
122
+ missing: ["contract"],
123
+ severity: missingSeverity,
124
+ message: `Contract missing for "${id}"`
125
+ }
126
+ ];
127
+ }
128
+ const missing = [];
129
+ if (requiredFields.includes("behavior") && (!contract.behavior || contract.behavior.trim() === "")) {
130
+ missing.push("behavior");
131
+ }
132
+ if (requiredFields.includes("examples") && (!contract.examples || contract.examples.length === 0)) {
133
+ missing.push("examples");
134
+ }
135
+ if (requiredFields.includes("invariants") && (!contract.invariants || contract.invariants.length === 0)) {
136
+ missing.push("invariants");
137
+ }
138
+ if (missing.length === 0) {
139
+ return [];
140
+ }
141
+ return [
142
+ {
143
+ ruleId: id,
144
+ missing,
145
+ severity: "warning",
146
+ message: `Contract for "${id}" is incomplete: missing ${missing.join(", ")}`
147
+ }
148
+ ];
149
+ }
74
150
  };
75
151
 
76
152
  // src/core/reactive-engine.svelte.ts
@@ -132,10 +132,21 @@ var PluresDBPraxisAdapter = class {
132
132
  function createPluresDB(config) {
133
133
  return new PluresDBPraxisAdapter(config);
134
134
  }
135
+ async function createPraxisLocalFirst(options = {}) {
136
+ const { pollInterval, ...localOptions } = options;
137
+ const mod = await import("@plures/pluresdb/local-first");
138
+ const LocalFirstCtor = mod.PluresDBLocalFirst ?? mod.default;
139
+ if (!LocalFirstCtor) {
140
+ throw new Error("Failed to load PluresDBLocalFirst from @plures/pluresdb/local-first");
141
+ }
142
+ const db = new LocalFirstCtor(localOptions);
143
+ return new PluresDBPraxisAdapter({ db, pollInterval });
144
+ }
135
145
 
136
146
  export {
137
147
  InMemoryPraxisDB,
138
148
  createInMemoryDB,
139
149
  PluresDBPraxisAdapter,
140
- createPluresDB
150
+ createPluresDB,
151
+ createPraxisLocalFirst
141
152
  };
@@ -1,5 +1,6 @@
1
- import { L as LogicEngine, P as PraxisState, a as PraxisEvent, b as PraxisRegistry, R as RuleDescriptor, C as ConstraintDescriptor, c as PraxisFact, d as RuleFn, e as ConstraintFn, f as PraxisModule } from './reactive-engine.svelte-C9OpcTHf.js';
2
- export { m as ConstraintId, k as PRAXIS_PROTOCOL_VERSION, g as PraxisDiagnostics, n as PraxisEngineOptions, h as PraxisStepConfig, j as PraxisStepFn, i as PraxisStepResult, p as ReactiveEngineOptions, q as ReactiveLogicEngine, l as RuleId, o as createPraxisEngine, r as createReactiveEngine } from './reactive-engine.svelte-C9OpcTHf.js';
1
+ import { L as LogicEngine, P as PraxisState, a as PraxisEvent, b as PraxisRegistry, R as RuleDescriptor, C as ConstraintDescriptor, c as PraxisFact, d as RuleFn, e as Contract, f as ConstraintFn, g as PraxisModule } from './reactive-engine.svelte-9aS0kTa8.js';
2
+ export { n as ConstraintId, l as PRAXIS_PROTOCOL_VERSION, h as PraxisDiagnostics, o as PraxisEngineOptions, i as PraxisStepConfig, k as PraxisStepFn, j as PraxisStepResult, q as ReactiveEngineOptions, r as ReactiveLogicEngine, m as RuleId, p as createPraxisEngine, s as createReactiveEngine } from './reactive-engine.svelte-9aS0kTa8.js';
3
+ import { LocalFirstOptions } from '@plures/pluresdb/local-first';
3
4
 
4
5
  /**
5
6
  * Praxis Reactive Logic Engine
@@ -434,6 +435,7 @@ interface DefineRuleOptions<TContext = unknown> {
434
435
  id: string;
435
436
  description: string;
436
437
  impl: RuleFn<TContext>;
438
+ contract?: Contract;
437
439
  meta?: Record<string, unknown>;
438
440
  }
439
441
  /**
@@ -460,6 +462,7 @@ interface DefineConstraintOptions<TContext = unknown> {
460
462
  id: string;
461
463
  description: string;
462
464
  impl: ConstraintFn<TContext>;
465
+ contract?: Contract;
463
466
  meta?: Record<string, unknown>;
464
467
  }
465
468
  /**
@@ -943,6 +946,7 @@ declare function validateForGeneration(schema: PraxisSchema): ValidationResult;
943
946
  * Provides a minimal adapter layer for PluresDB integration.
944
947
  * This module defines the core interface and an in-memory implementation.
945
948
  */
949
+
946
950
  /**
947
951
  * Function to unsubscribe from a watch
948
952
  */
@@ -1013,7 +1017,10 @@ declare function createInMemoryDB(): InMemoryPraxisDB;
1013
1017
  */
1014
1018
  type PluresDBInstance = {
1015
1019
  get(key: string): Promise<any>;
1016
- put(key: string, value: any): Promise<void>;
1020
+ put(key: string, value: any): Promise<any>;
1021
+ delete?(key: string): Promise<void>;
1022
+ list?(): Promise<any[]>;
1023
+ close?(): Promise<void>;
1017
1024
  };
1018
1025
  /**
1019
1026
  * Configuration options for PluresDBPraxisAdapter
@@ -1055,7 +1062,7 @@ declare class PluresDBPraxisAdapter implements PraxisDB {
1055
1062
  *
1056
1063
  * @example
1057
1064
  * ```typescript
1058
- * import { PluresNode } from 'pluresdb';
1065
+ * import { PluresNode } from '@plures/pluresdb';
1059
1066
  * import { createPluresDB } from '@plures/praxis';
1060
1067
  *
1061
1068
  * const pluresdb = new PluresNode({ autoStart: true });
@@ -1075,6 +1082,26 @@ declare class PluresDBPraxisAdapter implements PraxisDB {
1075
1082
  * ```
1076
1083
  */
1077
1084
  declare function createPluresDB(config: PluresDBAdapterConfig | PluresDBInstance): PluresDBPraxisAdapter;
1085
+ /**
1086
+ * Options for creating a local-first PluresDB adapter using the unified API
1087
+ */
1088
+ interface PraxisLocalFirstOptions extends LocalFirstOptions {
1089
+ /** Optional polling interval override for watch semantics (ms). Defaults to 1000ms. */
1090
+ pollInterval?: number;
1091
+ }
1092
+ /**
1093
+ * Create a PraxisDB adapter backed by PluresDB's unified local-first API.
1094
+ *
1095
+ * This will auto-detect the best backend (WASM/Tauri/IPC/network) unless a mode is provided.
1096
+ * Uses dynamic import to avoid bundling the local-first module in environments that don't need it.
1097
+ *
1098
+ * @example
1099
+ * ```typescript
1100
+ * const db = await createPraxisLocalFirst({ mode: 'auto' });
1101
+ * await db.set('/_praxis/facts/user/1', { id: '1', name: 'Alice' });
1102
+ * ```
1103
+ */
1104
+ declare function createPraxisLocalFirst(options?: PraxisLocalFirstOptions): Promise<PluresDBPraxisAdapter>;
1078
1105
 
1079
1106
  /**
1080
1107
  * PraxisDB Store
@@ -3290,4 +3317,4 @@ declare function attachAllIntegrations<TContext = unknown>(engine: LogicEngine<T
3290
3317
  dispose: () => void;
3291
3318
  }>;
3292
3319
 
3293
- export { type ActivityState, type Actor, ActorManager, type CanvasDocument, type CanvasEdge, type CanvasEdgeStyle, type CanvasEditorConfig, type CanvasNode, type CanvasNodeStyle, type ComponentDefinition, ConstraintDescriptor, ConstraintFn, type ConstraintNode, type ConstraintSchema, type DefineConstraintOptions, type DefineModuleOptions, type DefineRuleOptions, type EventDefinition$1 as EventDefinition, type EventStreamEntry, type FactDefinition$1 as FactDefinition, ReactiveLogicEngine as FrameworkAgnosticReactiveEngine, type ReactiveEngineOptions as FrameworkAgnosticReactiveEngineOptions, type GeneratedDoc, type GeneratedPluresDBFile, type GraphEdge, type GuardianError, type GuardianResult, type GuardianWarning, InMemoryPraxisDB, type LifecycleState, type LoaderOptions, type LoaderResult, type LogicDefinition, LogicEngine, type ModelDefinition, type NodeBindings, type NodeDefinition, type OrchestrationDefinition, PRAXIS_PATHS, type PluresDBAdapter, type PluresDBAdapterConfig, type PluresDBAdapterOptions, PluresDBGenerator, type PluresDBGeneratorOptions, type PluresDBInstance, PluresDBPraxisAdapter, type PraxisDB, PraxisDBStore, type PraxisDBStoreOptions, PraxisEvent, PraxisFact, PraxisModule, PraxisRegistry, type PraxisSchema, PraxisSchemaRegistry, PraxisState, type RegistryGraph, RegistryIntrospector, type RegistrySchema, type RegistryStats, RuleDescriptor, RuleFn, type RuleNode, type RuleSchema, type StateChangeCallback, type StateDoc, type StateDocsConfig, StateDocsGenerator, type StateMachineDoc, type StoredSchema, type TauriAppConfig, type TauriBridge, type TauriCommand, type TauriEvent, type TauriFS, type TauriFileEntry, type TauriMenuItem, type TauriNotification, type TauriNotificationOptions, type TauriPlugin, type TauriPraxisAdapter, type TauriSecurityConfig, type TauriTray, type TauriUpdateConfig, type TauriUpdateInfo, type TauriWindowConfig, type TerminalNodeProps, type TransitionDoc, type UnifiedApp, type UnifiedAppConfig, type UnsubscribeFn, type UnumAdapter, type UnumAdapterConfig, type UnumChannel, type UnumIdentity, type UnumMessage, type UnumStore, type ValidationError, type ValidationResult, attachAllIntegrations, attachTauriToEngine, attachToEngine, attachUnumToEngine, canvasToMermaid, canvasToSchema, canvasToYaml, createCanvasEditor, createReactiveEngine as createFrameworkAgnosticReactiveEngine, createInMemoryDB, createIntrospector, createMockTauriBridge, createPluresDB, createPluresDBAdapter, createPluresDBGenerator, createPraxisDBStore, createSchema, createSchemaRegistry, createSchemaTemplate, createStateDocsGenerator, createTauriPraxisAdapter, createTimerActor, createUnifiedApp, createUnumAdapter, defineConstraint, defineEvent, defineFact, defineModule, defineRule, filterEvents, filterFacts, findEvent, findFact, generateDocs, generateId, generateTauriConfig, getEventPath, getFactPath, getSchemaPath, loadSchemaFromJson, loadSchemaFromYaml, registerSchema, schemaToCanvas, validateForGeneration, validateSchema, validateWithGuardian };
3320
+ export { type ActivityState, type Actor, ActorManager, type CanvasDocument, type CanvasEdge, type CanvasEdgeStyle, type CanvasEditorConfig, type CanvasNode, type CanvasNodeStyle, type ComponentDefinition, ConstraintDescriptor, ConstraintFn, type ConstraintNode, type ConstraintSchema, type DefineConstraintOptions, type DefineModuleOptions, type DefineRuleOptions, type EventDefinition$1 as EventDefinition, type EventStreamEntry, type FactDefinition$1 as FactDefinition, ReactiveLogicEngine as FrameworkAgnosticReactiveEngine, type ReactiveEngineOptions as FrameworkAgnosticReactiveEngineOptions, type GeneratedDoc, type GeneratedPluresDBFile, type GraphEdge, type GuardianError, type GuardianResult, type GuardianWarning, InMemoryPraxisDB, type LifecycleState, type LoaderOptions, type LoaderResult, type LogicDefinition, LogicEngine, type ModelDefinition, type NodeBindings, type NodeDefinition, type OrchestrationDefinition, PRAXIS_PATHS, type PluresDBAdapter, type PluresDBAdapterConfig, type PluresDBAdapterOptions, PluresDBGenerator, type PluresDBGeneratorOptions, type PluresDBInstance, PluresDBPraxisAdapter, type PraxisDB, PraxisDBStore, type PraxisDBStoreOptions, PraxisEvent, PraxisFact, type PraxisLocalFirstOptions, PraxisModule, PraxisRegistry, type PraxisSchema, PraxisSchemaRegistry, PraxisState, type RegistryGraph, RegistryIntrospector, type RegistrySchema, type RegistryStats, RuleDescriptor, RuleFn, type RuleNode, type RuleSchema, type StateChangeCallback, type StateDoc, type StateDocsConfig, StateDocsGenerator, type StateMachineDoc, type StoredSchema, type TauriAppConfig, type TauriBridge, type TauriCommand, type TauriEvent, type TauriFS, type TauriFileEntry, type TauriMenuItem, type TauriNotification, type TauriNotificationOptions, type TauriPlugin, type TauriPraxisAdapter, type TauriSecurityConfig, type TauriTray, type TauriUpdateConfig, type TauriUpdateInfo, type TauriWindowConfig, type TerminalNodeProps, type TransitionDoc, type UnifiedApp, type UnifiedAppConfig, type UnsubscribeFn, type UnumAdapter, type UnumAdapterConfig, type UnumChannel, type UnumIdentity, type UnumMessage, type UnumStore, type ValidationError, type ValidationResult, attachAllIntegrations, attachTauriToEngine, attachToEngine, attachUnumToEngine, canvasToMermaid, canvasToSchema, canvasToYaml, createCanvasEditor, createReactiveEngine as createFrameworkAgnosticReactiveEngine, createInMemoryDB, createIntrospector, createMockTauriBridge, createPluresDB, createPluresDBAdapter, createPluresDBGenerator, createPraxisDBStore, createPraxisLocalFirst, createSchema, createSchemaRegistry, createSchemaTemplate, createStateDocsGenerator, createTauriPraxisAdapter, createTimerActor, createUnifiedApp, createUnumAdapter, defineConstraint, defineEvent, defineFact, defineModule, defineRule, filterEvents, filterFacts, findEvent, findFact, generateDocs, generateId, generateTauriConfig, getEventPath, getFactPath, getSchemaPath, loadSchemaFromJson, loadSchemaFromYaml, registerSchema, schemaToCanvas, validateForGeneration, validateSchema, validateWithGuardian };
@@ -2,7 +2,7 @@ import {
2
2
  PraxisRegistry,
3
3
  ReactiveLogicEngine,
4
4
  createReactiveEngine
5
- } from "./chunk-LE2ZJYFC.js";
5
+ } from "./chunk-K377RW4V.js";
6
6
  import {
7
7
  LogicEngine,
8
8
  PRAXIS_PROTOCOL_VERSION,
@@ -12,8 +12,9 @@ import {
12
12
  InMemoryPraxisDB,
13
13
  PluresDBPraxisAdapter,
14
14
  createInMemoryDB,
15
- createPluresDB
16
- } from "./chunk-JQ64KMLN.js";
15
+ createPluresDB,
16
+ createPraxisLocalFirst
17
+ } from "./chunk-MBVHLOU2.js";
17
18
 
18
19
  // src/core/reactive-engine.ts
19
20
  var ReactiveLogicEngine2 = class _ReactiveLogicEngine {
@@ -579,19 +580,25 @@ function defineEvent(tag) {
579
580
  };
580
581
  }
581
582
  function defineRule(options) {
583
+ const contract = options.contract ?? options.meta?.contract;
584
+ const meta = contract ? { ...options.meta ?? {}, contract } : options.meta;
582
585
  return {
583
586
  id: options.id,
584
587
  description: options.description,
585
588
  impl: options.impl,
586
- meta: options.meta
589
+ contract,
590
+ meta
587
591
  };
588
592
  }
589
593
  function defineConstraint(options) {
594
+ const contract = options.contract ?? options.meta?.contract;
595
+ const meta = contract ? { ...options.meta ?? {}, contract } : options.meta;
590
596
  return {
591
597
  id: options.id,
592
598
  description: options.description,
593
599
  impl: options.impl,
594
- meta: options.meta
600
+ contract,
601
+ meta
595
602
  };
596
603
  }
597
604
  function defineModule(options) {
@@ -2707,7 +2714,7 @@ function generateTauriConfig(config) {
2707
2714
  // src/integrations/unified.ts
2708
2715
  async function createUnifiedApp(config) {
2709
2716
  const { createPraxisEngine: createPraxisEngine2 } = await import("./engine-YJZV4SLD.js");
2710
- const { createInMemoryDB: createInMemoryDB2 } = await import("./adapter-TM4IS5KT.js");
2717
+ const { createInMemoryDB: createInMemoryDB2 } = await import("./adapter-CIMBGDC7.js");
2711
2718
  const db = config.db || createInMemoryDB2();
2712
2719
  const pluresdb = createPluresDBAdapter({
2713
2720
  db,
@@ -2781,7 +2788,7 @@ async function createUnifiedApp(config) {
2781
2788
  };
2782
2789
  }
2783
2790
  async function attachAllIntegrations(engine, registry, options = {}) {
2784
- const { createInMemoryDB: createInMemoryDB2 } = await import("./adapter-TM4IS5KT.js");
2791
+ const { createInMemoryDB: createInMemoryDB2 } = await import("./adapter-CIMBGDC7.js");
2785
2792
  const db = options.db || createInMemoryDB2();
2786
2793
  const pluresdb = createPluresDBAdapter({
2787
2794
  db,
@@ -2867,6 +2874,7 @@ export {
2867
2874
  createPluresDBGenerator,
2868
2875
  createPraxisDBStore,
2869
2876
  createPraxisEngine,
2877
+ createPraxisLocalFirst,
2870
2878
  createReactiveEngine,
2871
2879
  createSchema,
2872
2880
  createSchemaRegistry,
@@ -1,5 +1,5 @@
1
- import { L as LogicEngine, P as PraxisState, a as PraxisEvent } from '../reactive-engine.svelte-C9OpcTHf.js';
2
- export { p as ReactiveEngineOptions, q as ReactiveLogicEngine, r as createReactiveEngine } from '../reactive-engine.svelte-C9OpcTHf.js';
1
+ import { L as LogicEngine, P as PraxisState, a as PraxisEvent } from '../reactive-engine.svelte-9aS0kTa8.js';
2
+ export { q as ReactiveEngineOptions, r as ReactiveLogicEngine, s as createReactiveEngine } from '../reactive-engine.svelte-9aS0kTa8.js';
3
3
 
4
4
  /**
5
5
  * Svelte v5 Integration
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ReactiveLogicEngine,
3
3
  createReactiveEngine
4
- } from "../chunk-LE2ZJYFC.js";
4
+ } from "../chunk-K377RW4V.js";
5
5
  import "../chunk-VOMLVI6V.js";
6
6
 
7
7
  // src/integrations/svelte.ts