@plures/praxis 1.0.2 → 1.1.0

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 (518) hide show
  1. package/FRAMEWORK.md +55 -5
  2. package/LICENSE +21 -21
  3. package/README.md +162 -375
  4. package/core/codegen/docs-generator.ts +5 -2
  5. package/core/codegen/index.ts +1 -1
  6. package/core/codegen/ts-generator.ts +15 -15
  7. package/core/db-adapter/index.ts +2 -2
  8. package/core/db-adapter/sync-engine.ts +17 -6
  9. package/core/logic-engine/engine.ts +1 -1
  10. package/core/logic-engine/index.ts +2 -2
  11. package/core/logic-engine/protocol.ts +1 -1
  12. package/core/logic-engine/psf-adapter.ts +8 -4
  13. package/core/logic-engine/rules.ts +1 -1
  14. package/core/schema-engine/compiler.ts +53 -11
  15. package/core/schema-engine/generator.ts +17 -7
  16. package/core/schema-engine/index.ts +2 -2
  17. package/core/schema-engine/psf.ts +12 -3
  18. package/core/schema-engine/types.ts +3 -11
  19. package/core/schema-engine/validator.ts +112 -22
  20. package/dist/browser/engine-BjdqxeXG.d.ts +333 -0
  21. package/dist/browser/index.d.ts +3004 -0
  22. package/dist/browser/index.js +2892 -0
  23. package/dist/{src → browser}/integrations/svelte.d.ts +19 -17
  24. package/dist/browser/integrations/svelte.js +298 -0
  25. package/dist/node/auth-STARLY7I.js +207 -0
  26. package/dist/node/build-Y7OT5VBF.js +144 -0
  27. package/dist/node/canvas-UERZHJYW.js +362 -0
  28. package/dist/node/chunk-DSDC2JWZ.js +256 -0
  29. package/dist/node/chunk-FXQZXAWF.js +175 -0
  30. package/dist/node/chunk-N5Y37EUV.js +202 -0
  31. package/dist/node/chunk-QGM4M3NI.js +37 -0
  32. package/dist/node/chunk-RJMWCNHR.js +175 -0
  33. package/dist/node/chunk-SRM3OPPM.js +404 -0
  34. package/dist/node/chunk-UATVJBNV.js +175 -0
  35. package/dist/node/chunk-UY7YEBE2.js +159 -0
  36. package/dist/node/chunk-XCY2VIFX.js +143 -0
  37. package/dist/node/chunk-YXH4Y7ZZ.js +349 -0
  38. package/dist/node/cli/index.cjs +217418 -0
  39. package/dist/node/cli/index.d.cts +1 -0
  40. package/dist/node/cli/index.d.ts +1 -0
  41. package/dist/node/cli/index.js +690 -0
  42. package/dist/node/cloud/index.cjs +1043 -0
  43. package/dist/node/cloud/index.d.cts +864 -0
  44. package/dist/node/cloud/index.d.ts +864 -0
  45. package/dist/node/cloud/index.js +456 -0
  46. package/dist/node/cloud-AXOK4PSN.js +212 -0
  47. package/dist/node/component.cjs +374 -0
  48. package/dist/node/component.d.cts +125 -0
  49. package/dist/{src/core/component/generator.d.ts → node/component.d.ts} +11 -8
  50. package/dist/node/component.js +9 -0
  51. package/dist/node/components/index.cjs +216 -0
  52. package/dist/node/components/index.d.cts +43 -0
  53. package/dist/{src → node}/components/index.d.ts +8 -8
  54. package/dist/node/components/index.js +7 -0
  55. package/dist/node/create-TRLSVCNQ.js +584 -0
  56. package/dist/node/dev-PMJZUYGE.js +65 -0
  57. package/dist/node/engine-1iqLe6_P.d.ts +214 -0
  58. package/dist/node/engine-CVJobhHm.d.cts +214 -0
  59. package/dist/node/index.cjs +3247 -0
  60. package/dist/node/index.d.cts +2579 -0
  61. package/dist/node/index.d.ts +2579 -0
  62. package/dist/node/index.js +2098 -0
  63. package/dist/node/integrations/svelte.cjs +330 -0
  64. package/dist/node/integrations/svelte.d.cts +309 -0
  65. package/dist/node/integrations/svelte.d.ts +309 -0
  66. package/dist/node/integrations/svelte.js +300 -0
  67. package/dist/node/orchestrate-737TCL5H.js +127 -0
  68. package/dist/{src/core/protocol.d.ts → node/protocol-Qek7ebBl.d.cts} +11 -10
  69. package/dist/node/protocol-Qek7ebBl.d.ts +122 -0
  70. package/dist/node/schema.cjs +200 -0
  71. package/dist/{src/core/schema/types.d.ts → node/schema.d.cts} +30 -29
  72. package/dist/node/schema.d.ts +371 -0
  73. package/dist/node/schema.js +9 -0
  74. package/dist/{src/runtime/terminal-adapter.d.ts → node/terminal-adapter-07HGftGQ.d.ts} +86 -11
  75. package/dist/node/terminal-adapter-XLtCjjb_.d.cts +231 -0
  76. package/dist/node/verify-YBZ7W24H.js +213239 -0
  77. package/docs/MONETIZATION.md +21 -16
  78. package/docs/REACTIVE_REDESIGN.md +132 -0
  79. package/docs/README.md +47 -36
  80. package/docs/SVELTE_INTEGRATION_STRATEGY.md +68 -0
  81. package/docs/TERMINAL_NODE.md +27 -24
  82. package/docs/core/building-extensions.md +58 -61
  83. package/docs/core/cli-usage.md +59 -59
  84. package/docs/core/code-canvas-sync.md +28 -16
  85. package/docs/core/logic-engine.md +77 -82
  86. package/docs/core/pluresdb-integration.md +29 -39
  87. package/docs/core/schema-model.md +66 -52
  88. package/docs/core/ui-generation.md +57 -49
  89. package/docs/core/what-is-praxis.md +32 -15
  90. package/docs/guides/canvas.md +21 -5
  91. package/docs/guides/getting-started.md +13 -7
  92. package/docs/guides/history-state-pattern.md +65 -51
  93. package/docs/guides/orchestration.md +46 -32
  94. package/docs/guides/parallel-state-pattern.md +56 -72
  95. package/docs/guides/svelte-integration.md +45 -53
  96. package/docs/tutorials/README.md +16 -0
  97. package/docs/tutorials/ecommerce-cart.md +177 -95
  98. package/docs/tutorials/first-app.md +26 -41
  99. package/docs/tutorials/form-builder.md +191 -138
  100. package/docs/tutorials/todo-pluresdb.md +71 -69
  101. package/package.json +132 -96
  102. package/src/__tests__/actors.test.ts +68 -68
  103. package/src/__tests__/billing.test.ts +32 -32
  104. package/src/__tests__/canvas-components.test.ts +94 -73
  105. package/src/__tests__/cli-create.test.ts +28 -28
  106. package/src/__tests__/cloud.test.ts +36 -36
  107. package/src/__tests__/code-canvas-integration.test.ts +132 -141
  108. package/src/__tests__/docs-generator.test.ts +3 -9
  109. package/src/__tests__/dsl.test.ts +58 -64
  110. package/src/__tests__/edge-cases.test.ts +106 -108
  111. package/src/__tests__/engine.test.ts +51 -25
  112. package/src/__tests__/generators.test.ts +42 -44
  113. package/src/__tests__/introspection.test.ts +104 -114
  114. package/src/__tests__/pluresdb.test.ts +189 -187
  115. package/src/__tests__/protocol.test.ts +15 -15
  116. package/src/__tests__/provisioning.test.ts +61 -61
  117. package/src/__tests__/schema.test.ts +7 -11
  118. package/src/__tests__/state-docs-integration.test.ts +162 -145
  119. package/src/__tests__/svelte-integration.test.ts +16 -19
  120. package/src/__tests__/tauri-integration.test.ts +149 -147
  121. package/src/__tests__/terminal-node.test.ts +12 -7
  122. package/src/__tests__/unum-integration.test.ts +68 -68
  123. package/src/adapters/cli.ts +21 -15
  124. package/src/cli/commands/auth.ts +82 -78
  125. package/src/cli/commands/build.ts +29 -27
  126. package/src/cli/commands/canvas.ts +338 -127
  127. package/src/cli/commands/cloud.ts +47 -47
  128. package/src/cli/commands/create.ts +59 -47
  129. package/src/cli/commands/dev.ts +12 -12
  130. package/src/cli/commands/generate.ts +29 -40
  131. package/src/cli/commands/orchestrate.ts +24 -24
  132. package/src/cli/commands/verify.ts +49 -0
  133. package/src/cli/index.ts +21 -2
  134. package/src/cloud/README.md +28 -15
  135. package/src/cloud/auth.ts +55 -70
  136. package/src/cloud/billing.ts +59 -58
  137. package/src/cloud/client.ts +29 -35
  138. package/src/cloud/index.ts +19 -40
  139. package/src/cloud/marketplace.ts +69 -78
  140. package/src/cloud/provisioning.ts +42 -51
  141. package/src/cloud/relay/endpoints.ts +30 -34
  142. package/src/cloud/relay/health/index.ts +1 -1
  143. package/src/cloud/relay/stats/index.ts +1 -1
  144. package/src/cloud/relay/sync/index.ts +1 -1
  145. package/src/cloud/relay/usage/index.ts +1 -1
  146. package/src/cloud/sponsors.ts +31 -34
  147. package/src/cloud/types.ts +4 -4
  148. package/src/components/README.md +1 -0
  149. package/src/components/TerminalNode.svelte +457 -457
  150. package/src/components/index.ts +3 -4
  151. package/src/core/actors.ts +7 -7
  152. package/src/core/component/generator.ts +10 -28
  153. package/src/core/engine.ts +51 -24
  154. package/src/core/introspection.ts +37 -35
  155. package/src/core/logic/generator.ts +62 -62
  156. package/src/core/pluresdb/adapter.ts +8 -8
  157. package/src/core/pluresdb/generator.ts +39 -35
  158. package/src/core/pluresdb/index.ts +9 -12
  159. package/src/core/pluresdb/schema-registry.ts +22 -25
  160. package/src/core/pluresdb/store.ts +57 -57
  161. package/src/core/protocol.ts +14 -14
  162. package/src/core/reactive-engine.svelte.ts +65 -0
  163. package/src/core/reactive-engine.ts +67 -0
  164. package/src/core/rules.ts +4 -4
  165. package/src/core/schema/loader.common.ts +150 -0
  166. package/src/core/schema/loader.ts +19 -149
  167. package/src/core/schema/normalize.ts +34 -51
  168. package/src/core/schema/types.ts +47 -11
  169. package/src/dsl/index.ts +8 -8
  170. package/src/dsl.ts +11 -17
  171. package/src/examples/advanced-todo/App.svelte +506 -506
  172. package/src/examples/advanced-todo/README.md +58 -40
  173. package/src/examples/advanced-todo/index.ts +3 -3
  174. package/src/examples/auth-basic/index.ts +30 -30
  175. package/src/examples/cart/index.ts +50 -50
  176. package/src/examples/hero-ecommerce/index.ts +130 -157
  177. package/src/examples/svelte-counter/index.ts +22 -26
  178. package/src/flows.ts +6 -17
  179. package/src/index.browser.ts +204 -0
  180. package/src/index.ts +37 -42
  181. package/src/integrations/code-canvas.ts +237 -193
  182. package/src/integrations/pluresdb.ts +55 -35
  183. package/src/integrations/state-docs.ts +104 -104
  184. package/src/integrations/svelte.ts +35 -35
  185. package/src/integrations/tauri.ts +75 -73
  186. package/src/integrations/unum.ts +68 -61
  187. package/src/registry.ts +7 -14
  188. package/src/runtime/terminal-adapter.ts +31 -26
  189. package/src/step.ts +10 -16
  190. package/src/types.ts +1 -1
  191. package/templates/basic-app/README.md +6 -9
  192. package/templates/fullstack-app/README.md +10 -0
  193. package/dist/core/codegen/docs-generator.d.ts +0 -123
  194. package/dist/core/codegen/docs-generator.d.ts.map +0 -1
  195. package/dist/core/codegen/docs-generator.js +0 -674
  196. package/dist/core/codegen/docs-generator.js.map +0 -1
  197. package/dist/core/codegen/index.d.ts +0 -11
  198. package/dist/core/codegen/index.d.ts.map +0 -1
  199. package/dist/core/codegen/index.js +0 -13
  200. package/dist/core/codegen/index.js.map +0 -1
  201. package/dist/core/codegen/ts-generator.d.ts +0 -8
  202. package/dist/core/codegen/ts-generator.d.ts.map +0 -1
  203. package/dist/core/codegen/ts-generator.js +0 -8
  204. package/dist/core/codegen/ts-generator.js.map +0 -1
  205. package/dist/core/db-adapter/index.d.ts +0 -18
  206. package/dist/core/db-adapter/index.d.ts.map +0 -1
  207. package/dist/core/db-adapter/index.js +0 -23
  208. package/dist/core/db-adapter/index.js.map +0 -1
  209. package/dist/core/db-adapter/sync-engine.d.ts +0 -180
  210. package/dist/core/db-adapter/sync-engine.d.ts.map +0 -1
  211. package/dist/core/db-adapter/sync-engine.js +0 -342
  212. package/dist/core/db-adapter/sync-engine.js.map +0 -1
  213. package/dist/core/logic-engine/engine.d.ts +0 -8
  214. package/dist/core/logic-engine/engine.d.ts.map +0 -1
  215. package/dist/core/logic-engine/engine.js +0 -8
  216. package/dist/core/logic-engine/engine.js.map +0 -1
  217. package/dist/core/logic-engine/index.d.ts +0 -16
  218. package/dist/core/logic-engine/index.d.ts.map +0 -1
  219. package/dist/core/logic-engine/index.js +0 -16
  220. package/dist/core/logic-engine/index.js.map +0 -1
  221. package/dist/core/logic-engine/protocol.d.ts +0 -7
  222. package/dist/core/logic-engine/protocol.d.ts.map +0 -1
  223. package/dist/core/logic-engine/protocol.js +0 -7
  224. package/dist/core/logic-engine/protocol.js.map +0 -1
  225. package/dist/core/logic-engine/psf-adapter.d.ts +0 -88
  226. package/dist/core/logic-engine/psf-adapter.d.ts.map +0 -1
  227. package/dist/core/logic-engine/psf-adapter.js +0 -207
  228. package/dist/core/logic-engine/psf-adapter.js.map +0 -1
  229. package/dist/core/logic-engine/rules.d.ts +0 -7
  230. package/dist/core/logic-engine/rules.d.ts.map +0 -1
  231. package/dist/core/logic-engine/rules.js +0 -7
  232. package/dist/core/logic-engine/rules.js.map +0 -1
  233. package/dist/core/schema-engine/compiler.d.ts +0 -198
  234. package/dist/core/schema-engine/compiler.d.ts.map +0 -1
  235. package/dist/core/schema-engine/compiler.js +0 -262
  236. package/dist/core/schema-engine/compiler.js.map +0 -1
  237. package/dist/core/schema-engine/generator.d.ts +0 -115
  238. package/dist/core/schema-engine/generator.d.ts.map +0 -1
  239. package/dist/core/schema-engine/generator.js +0 -506
  240. package/dist/core/schema-engine/generator.js.map +0 -1
  241. package/dist/core/schema-engine/index.d.ts +0 -18
  242. package/dist/core/schema-engine/index.d.ts.map +0 -1
  243. package/dist/core/schema-engine/index.js +0 -18
  244. package/dist/core/schema-engine/index.js.map +0 -1
  245. package/dist/core/schema-engine/psf.d.ts +0 -612
  246. package/dist/core/schema-engine/psf.d.ts.map +0 -1
  247. package/dist/core/schema-engine/psf.js +0 -45
  248. package/dist/core/schema-engine/psf.js.map +0 -1
  249. package/dist/core/schema-engine/types.d.ts +0 -10
  250. package/dist/core/schema-engine/types.d.ts.map +0 -1
  251. package/dist/core/schema-engine/types.js +0 -7
  252. package/dist/core/schema-engine/types.js.map +0 -1
  253. package/dist/core/schema-engine/validator.d.ts +0 -140
  254. package/dist/core/schema-engine/validator.d.ts.map +0 -1
  255. package/dist/core/schema-engine/validator.js +0 -407
  256. package/dist/core/schema-engine/validator.js.map +0 -1
  257. package/dist/src/adapters/cli.d.ts +0 -43
  258. package/dist/src/adapters/cli.d.ts.map +0 -1
  259. package/dist/src/adapters/cli.js +0 -126
  260. package/dist/src/adapters/cli.js.map +0 -1
  261. package/dist/src/cli/commands/auth.d.ts +0 -26
  262. package/dist/src/cli/commands/auth.d.ts.map +0 -1
  263. package/dist/src/cli/commands/auth.js +0 -233
  264. package/dist/src/cli/commands/auth.js.map +0 -1
  265. package/dist/src/cli/commands/build.d.ts +0 -23
  266. package/dist/src/cli/commands/build.d.ts.map +0 -1
  267. package/dist/src/cli/commands/build.js +0 -162
  268. package/dist/src/cli/commands/build.js.map +0 -1
  269. package/dist/src/cli/commands/canvas.d.ts +0 -23
  270. package/dist/src/cli/commands/canvas.d.ts.map +0 -1
  271. package/dist/src/cli/commands/canvas.js +0 -215
  272. package/dist/src/cli/commands/canvas.js.map +0 -1
  273. package/dist/src/cli/commands/cloud.d.ts +0 -27
  274. package/dist/src/cli/commands/cloud.d.ts.map +0 -1
  275. package/dist/src/cli/commands/cloud.js +0 -232
  276. package/dist/src/cli/commands/cloud.js.map +0 -1
  277. package/dist/src/cli/commands/create.d.ts +0 -21
  278. package/dist/src/cli/commands/create.d.ts.map +0 -1
  279. package/dist/src/cli/commands/create.js +0 -621
  280. package/dist/src/cli/commands/create.js.map +0 -1
  281. package/dist/src/cli/commands/dev.d.ts +0 -21
  282. package/dist/src/cli/commands/dev.d.ts.map +0 -1
  283. package/dist/src/cli/commands/dev.js +0 -71
  284. package/dist/src/cli/commands/dev.js.map +0 -1
  285. package/dist/src/cli/commands/generate.d.ts +0 -25
  286. package/dist/src/cli/commands/generate.d.ts.map +0 -1
  287. package/dist/src/cli/commands/generate.js +0 -168
  288. package/dist/src/cli/commands/generate.js.map +0 -1
  289. package/dist/src/cli/commands/orchestrate.d.ts +0 -44
  290. package/dist/src/cli/commands/orchestrate.d.ts.map +0 -1
  291. package/dist/src/cli/commands/orchestrate.js +0 -150
  292. package/dist/src/cli/commands/orchestrate.js.map +0 -1
  293. package/dist/src/cli/index.d.ts +0 -8
  294. package/dist/src/cli/index.d.ts.map +0 -1
  295. package/dist/src/cli/index.js +0 -211
  296. package/dist/src/cli/index.js.map +0 -1
  297. package/dist/src/cloud/auth.d.ts +0 -51
  298. package/dist/src/cloud/auth.d.ts.map +0 -1
  299. package/dist/src/cloud/auth.js +0 -194
  300. package/dist/src/cloud/auth.js.map +0 -1
  301. package/dist/src/cloud/billing.d.ts +0 -184
  302. package/dist/src/cloud/billing.d.ts.map +0 -1
  303. package/dist/src/cloud/billing.js +0 -179
  304. package/dist/src/cloud/billing.js.map +0 -1
  305. package/dist/src/cloud/client.d.ts +0 -39
  306. package/dist/src/cloud/client.d.ts.map +0 -1
  307. package/dist/src/cloud/client.js +0 -176
  308. package/dist/src/cloud/client.js.map +0 -1
  309. package/dist/src/cloud/index.d.ts +0 -44
  310. package/dist/src/cloud/index.d.ts.map +0 -1
  311. package/dist/src/cloud/index.js +0 -44
  312. package/dist/src/cloud/index.js.map +0 -1
  313. package/dist/src/cloud/marketplace.d.ts +0 -166
  314. package/dist/src/cloud/marketplace.d.ts.map +0 -1
  315. package/dist/src/cloud/marketplace.js +0 -159
  316. package/dist/src/cloud/marketplace.js.map +0 -1
  317. package/dist/src/cloud/provisioning.d.ts +0 -110
  318. package/dist/src/cloud/provisioning.d.ts.map +0 -1
  319. package/dist/src/cloud/provisioning.js +0 -148
  320. package/dist/src/cloud/provisioning.js.map +0 -1
  321. package/dist/src/cloud/relay/endpoints.d.ts +0 -62
  322. package/dist/src/cloud/relay/endpoints.d.ts.map +0 -1
  323. package/dist/src/cloud/relay/endpoints.js +0 -217
  324. package/dist/src/cloud/relay/endpoints.js.map +0 -1
  325. package/dist/src/cloud/relay/health/index.d.ts +0 -5
  326. package/dist/src/cloud/relay/health/index.d.ts.map +0 -1
  327. package/dist/src/cloud/relay/health/index.js +0 -9
  328. package/dist/src/cloud/relay/health/index.js.map +0 -1
  329. package/dist/src/cloud/relay/stats/index.d.ts +0 -5
  330. package/dist/src/cloud/relay/stats/index.d.ts.map +0 -1
  331. package/dist/src/cloud/relay/stats/index.js +0 -9
  332. package/dist/src/cloud/relay/stats/index.js.map +0 -1
  333. package/dist/src/cloud/relay/sync/index.d.ts +0 -5
  334. package/dist/src/cloud/relay/sync/index.d.ts.map +0 -1
  335. package/dist/src/cloud/relay/sync/index.js +0 -9
  336. package/dist/src/cloud/relay/sync/index.js.map +0 -1
  337. package/dist/src/cloud/relay/usage/index.d.ts +0 -5
  338. package/dist/src/cloud/relay/usage/index.d.ts.map +0 -1
  339. package/dist/src/cloud/relay/usage/index.js +0 -9
  340. package/dist/src/cloud/relay/usage/index.js.map +0 -1
  341. package/dist/src/cloud/sponsors.d.ts +0 -81
  342. package/dist/src/cloud/sponsors.d.ts.map +0 -1
  343. package/dist/src/cloud/sponsors.js +0 -130
  344. package/dist/src/cloud/sponsors.js.map +0 -1
  345. package/dist/src/cloud/types.d.ts +0 -169
  346. package/dist/src/cloud/types.d.ts.map +0 -1
  347. package/dist/src/cloud/types.js +0 -7
  348. package/dist/src/cloud/types.js.map +0 -1
  349. package/dist/src/components/index.d.ts.map +0 -1
  350. package/dist/src/components/index.js +0 -17
  351. package/dist/src/components/index.js.map +0 -1
  352. package/dist/src/core/actors.d.ts +0 -95
  353. package/dist/src/core/actors.d.ts.map +0 -1
  354. package/dist/src/core/actors.js +0 -158
  355. package/dist/src/core/actors.js.map +0 -1
  356. package/dist/src/core/component/generator.d.ts.map +0 -1
  357. package/dist/src/core/component/generator.js +0 -349
  358. package/dist/src/core/component/generator.js.map +0 -1
  359. package/dist/src/core/engine.d.ts +0 -92
  360. package/dist/src/core/engine.d.ts.map +0 -1
  361. package/dist/src/core/engine.js +0 -199
  362. package/dist/src/core/engine.js.map +0 -1
  363. package/dist/src/core/introspection.d.ts +0 -141
  364. package/dist/src/core/introspection.d.ts.map +0 -1
  365. package/dist/src/core/introspection.js +0 -208
  366. package/dist/src/core/introspection.js.map +0 -1
  367. package/dist/src/core/logic/generator.d.ts +0 -76
  368. package/dist/src/core/logic/generator.d.ts.map +0 -1
  369. package/dist/src/core/logic/generator.js +0 -370
  370. package/dist/src/core/logic/generator.js.map +0 -1
  371. package/dist/src/core/pluresdb/adapter.d.ts +0 -72
  372. package/dist/src/core/pluresdb/adapter.d.ts.map +0 -1
  373. package/dist/src/core/pluresdb/adapter.js +0 -73
  374. package/dist/src/core/pluresdb/adapter.js.map +0 -1
  375. package/dist/src/core/pluresdb/generator.d.ts +0 -58
  376. package/dist/src/core/pluresdb/generator.d.ts.map +0 -1
  377. package/dist/src/core/pluresdb/generator.js +0 -191
  378. package/dist/src/core/pluresdb/generator.js.map +0 -1
  379. package/dist/src/core/pluresdb/index.d.ts +0 -15
  380. package/dist/src/core/pluresdb/index.d.ts.map +0 -1
  381. package/dist/src/core/pluresdb/index.js +0 -11
  382. package/dist/src/core/pluresdb/index.js.map +0 -1
  383. package/dist/src/core/pluresdb/schema-registry.d.ts +0 -104
  384. package/dist/src/core/pluresdb/schema-registry.d.ts.map +0 -1
  385. package/dist/src/core/pluresdb/schema-registry.js +0 -130
  386. package/dist/src/core/pluresdb/schema-registry.js.map +0 -1
  387. package/dist/src/core/pluresdb/store.d.ts +0 -199
  388. package/dist/src/core/pluresdb/store.d.ts.map +0 -1
  389. package/dist/src/core/pluresdb/store.js +0 -344
  390. package/dist/src/core/pluresdb/store.js.map +0 -1
  391. package/dist/src/core/protocol.d.ts.map +0 -1
  392. package/dist/src/core/protocol.js +0 -46
  393. package/dist/src/core/protocol.js.map +0 -1
  394. package/dist/src/core/rules.d.ts +0 -120
  395. package/dist/src/core/rules.d.ts.map +0 -1
  396. package/dist/src/core/rules.js +0 -81
  397. package/dist/src/core/rules.js.map +0 -1
  398. package/dist/src/core/schema/loader.d.ts +0 -47
  399. package/dist/src/core/schema/loader.d.ts.map +0 -1
  400. package/dist/src/core/schema/loader.js +0 -189
  401. package/dist/src/core/schema/loader.js.map +0 -1
  402. package/dist/src/core/schema/normalize.d.ts +0 -72
  403. package/dist/src/core/schema/normalize.d.ts.map +0 -1
  404. package/dist/src/core/schema/normalize.js +0 -190
  405. package/dist/src/core/schema/normalize.js.map +0 -1
  406. package/dist/src/core/schema/types.d.ts.map +0 -1
  407. package/dist/src/core/schema/types.js +0 -161
  408. package/dist/src/core/schema/types.js.map +0 -1
  409. package/dist/src/dsl/index.d.ts +0 -152
  410. package/dist/src/dsl/index.d.ts.map +0 -1
  411. package/dist/src/dsl/index.js +0 -132
  412. package/dist/src/dsl/index.js.map +0 -1
  413. package/dist/src/dsl.d.ts +0 -124
  414. package/dist/src/dsl.d.ts.map +0 -1
  415. package/dist/src/dsl.js +0 -130
  416. package/dist/src/dsl.js.map +0 -1
  417. package/dist/src/examples/advanced-todo/index.d.ts +0 -55
  418. package/dist/src/examples/advanced-todo/index.d.ts.map +0 -1
  419. package/dist/src/examples/advanced-todo/index.js +0 -222
  420. package/dist/src/examples/advanced-todo/index.js.map +0 -1
  421. package/dist/src/examples/auth-basic/index.d.ts +0 -17
  422. package/dist/src/examples/auth-basic/index.d.ts.map +0 -1
  423. package/dist/src/examples/auth-basic/index.js +0 -122
  424. package/dist/src/examples/auth-basic/index.js.map +0 -1
  425. package/dist/src/examples/cart/index.d.ts +0 -19
  426. package/dist/src/examples/cart/index.d.ts.map +0 -1
  427. package/dist/src/examples/cart/index.js +0 -202
  428. package/dist/src/examples/cart/index.js.map +0 -1
  429. package/dist/src/examples/hero-ecommerce/index.d.ts +0 -39
  430. package/dist/src/examples/hero-ecommerce/index.d.ts.map +0 -1
  431. package/dist/src/examples/hero-ecommerce/index.js +0 -506
  432. package/dist/src/examples/hero-ecommerce/index.js.map +0 -1
  433. package/dist/src/examples/svelte-counter/index.d.ts +0 -31
  434. package/dist/src/examples/svelte-counter/index.d.ts.map +0 -1
  435. package/dist/src/examples/svelte-counter/index.js +0 -123
  436. package/dist/src/examples/svelte-counter/index.js.map +0 -1
  437. package/dist/src/flows.d.ts +0 -125
  438. package/dist/src/flows.d.ts.map +0 -1
  439. package/dist/src/flows.js +0 -160
  440. package/dist/src/flows.js.map +0 -1
  441. package/dist/src/index.d.ts +0 -77
  442. package/dist/src/index.d.ts.map +0 -1
  443. package/dist/src/index.js +0 -64
  444. package/dist/src/index.js.map +0 -1
  445. package/dist/src/integrations/code-canvas.d.ts +0 -265
  446. package/dist/src/integrations/code-canvas.d.ts.map +0 -1
  447. package/dist/src/integrations/code-canvas.js +0 -451
  448. package/dist/src/integrations/code-canvas.js.map +0 -1
  449. package/dist/src/integrations/pluresdb.d.ts +0 -117
  450. package/dist/src/integrations/pluresdb.d.ts.map +0 -1
  451. package/dist/src/integrations/pluresdb.js +0 -117
  452. package/dist/src/integrations/pluresdb.js.map +0 -1
  453. package/dist/src/integrations/state-docs.d.ts +0 -191
  454. package/dist/src/integrations/state-docs.d.ts.map +0 -1
  455. package/dist/src/integrations/state-docs.js +0 -515
  456. package/dist/src/integrations/state-docs.js.map +0 -1
  457. package/dist/src/integrations/svelte.d.ts.map +0 -1
  458. package/dist/src/integrations/svelte.js +0 -447
  459. package/dist/src/integrations/svelte.js.map +0 -1
  460. package/dist/src/integrations/tauri.d.ts +0 -360
  461. package/dist/src/integrations/tauri.d.ts.map +0 -1
  462. package/dist/src/integrations/tauri.js +0 -278
  463. package/dist/src/integrations/tauri.js.map +0 -1
  464. package/dist/src/integrations/unum.d.ts +0 -159
  465. package/dist/src/integrations/unum.d.ts.map +0 -1
  466. package/dist/src/integrations/unum.js +0 -240
  467. package/dist/src/integrations/unum.js.map +0 -1
  468. package/dist/src/registry.d.ts +0 -94
  469. package/dist/src/registry.d.ts.map +0 -1
  470. package/dist/src/registry.js +0 -181
  471. package/dist/src/registry.js.map +0 -1
  472. package/dist/src/runtime/terminal-adapter.d.ts.map +0 -1
  473. package/dist/src/runtime/terminal-adapter.js +0 -239
  474. package/dist/src/runtime/terminal-adapter.js.map +0 -1
  475. package/dist/src/step.d.ts +0 -34
  476. package/dist/src/step.d.ts.map +0 -1
  477. package/dist/src/step.js +0 -111
  478. package/dist/src/step.js.map +0 -1
  479. package/dist/src/types.d.ts +0 -63
  480. package/dist/src/types.d.ts.map +0 -1
  481. package/dist/src/types.js +0 -6
  482. package/dist/src/types.js.map +0 -1
  483. package/dist/tools/cli/commands/index.d.ts +0 -7
  484. package/dist/tools/cli/commands/index.d.ts.map +0 -1
  485. package/dist/tools/cli/commands/index.js +0 -7
  486. package/dist/tools/cli/commands/index.js.map +0 -1
  487. package/dist/tools/cli/index.d.ts +0 -8
  488. package/dist/tools/cli/index.d.ts.map +0 -1
  489. package/dist/tools/cli/index.js +0 -9
  490. package/dist/tools/cli/index.js.map +0 -1
  491. package/dist/tools/watcher/index.d.ts +0 -105
  492. package/dist/tools/watcher/index.d.ts.map +0 -1
  493. package/dist/tools/watcher/index.js +0 -213
  494. package/dist/tools/watcher/index.js.map +0 -1
  495. package/dist/ui/canvas/canvas-projection.d.ts +0 -78
  496. package/dist/ui/canvas/canvas-projection.d.ts.map +0 -1
  497. package/dist/ui/canvas/canvas-projection.js +0 -416
  498. package/dist/ui/canvas/canvas-projection.js.map +0 -1
  499. package/dist/ui/canvas/canvas-state.d.ts +0 -200
  500. package/dist/ui/canvas/canvas-state.d.ts.map +0 -1
  501. package/dist/ui/canvas/canvas-state.js +0 -464
  502. package/dist/ui/canvas/canvas-state.js.map +0 -1
  503. package/dist/ui/canvas/components/index.d.ts +0 -95
  504. package/dist/ui/canvas/components/index.d.ts.map +0 -1
  505. package/dist/ui/canvas/components/index.js +0 -19
  506. package/dist/ui/canvas/components/index.js.map +0 -1
  507. package/dist/ui/canvas/index.d.ts +0 -32
  508. package/dist/ui/canvas/index.d.ts.map +0 -1
  509. package/dist/ui/canvas/index.js +0 -32
  510. package/dist/ui/canvas/index.js.map +0 -1
  511. package/dist/ui/svelte-generator/index.d.ts +0 -9
  512. package/dist/ui/svelte-generator/index.d.ts.map +0 -1
  513. package/dist/ui/svelte-generator/index.js +0 -11
  514. package/dist/ui/svelte-generator/index.js.map +0 -1
  515. package/dist/ui/svelte-generator/psf-generator.d.ts +0 -128
  516. package/dist/ui/svelte-generator/psf-generator.d.ts.map +0 -1
  517. package/dist/ui/svelte-generator/psf-generator.js +0 -506
  518. package/dist/ui/svelte-generator/psf-generator.js.map +0 -1
@@ -0,0 +1,2579 @@
1
+ import { P as PraxisState, a as PraxisEvent, b as PraxisFact } from './protocol-Qek7ebBl.js';
2
+ export { g as PRAXIS_PROTOCOL_VERSION, e as PraxisDiagnostics, d as PraxisStepConfig, f as PraxisStepFn, c as PraxisStepResult } from './protocol-Qek7ebBl.js';
3
+ import { L as LogicEngine, P as PraxisRegistry, R as RuleDescriptor, C as ConstraintDescriptor, a as RuleFn, b as ConstraintFn, c as PraxisModule } from './engine-1iqLe6_P.js';
4
+ export { e as ConstraintId, f as PraxisEngineOptions, d as RuleId, g as createPraxisEngine } from './engine-1iqLe6_P.js';
5
+ import { P as PraxisDB, U as UnsubscribeFn } from './terminal-adapter-07HGftGQ.js';
6
+ export { C as CommandExecutor, I as InMemoryPraxisDB, T as TerminalAdapter, d as TerminalAdapterOptions, a as TerminalExecutionResult, b as TerminalNodeState, f as createInMemoryDB, e as createMockExecutor, c as createTerminalAdapter, r as runTerminalCommand } from './terminal-adapter-07HGftGQ.js';
7
+ import { PraxisSchema, ValidationResult, ModelDefinition, FieldDefinition, ComponentDefinition, LogicDefinition } from './schema.js';
8
+ export { NodeBindings, NodeDefinition, OrchestrationDefinition, TerminalNodeProps, ValidationError, createSchemaTemplate, validateSchema } from './schema.js';
9
+
10
+ /**
11
+ * Praxis Reactive Logic Engine
12
+ *
13
+ * A Svelte 5 native implementation of the Praxis Logic Engine.
14
+ * Uses Runes ($state, $derived, $effect) for fine-grained reactivity.
15
+ */
16
+ interface ReactiveEngineOptions<TContext> {
17
+ initialContext: TContext;
18
+ initialFacts?: any[];
19
+ initialMeta?: Record<string, unknown>;
20
+ }
21
+ declare class ReactiveLogicEngine<TContext extends object> {
22
+ state: {
23
+ context: TContext;
24
+ facts: any[];
25
+ meta: Record<string, unknown>;
26
+ };
27
+ constructor(options: ReactiveEngineOptions<TContext>);
28
+ /**
29
+ * Access the reactive context directly.
30
+ * Consumers can use this in $derived() or $effect().
31
+ */
32
+ get context(): TContext;
33
+ /**
34
+ * Access the reactive facts list.
35
+ */
36
+ get facts(): any[];
37
+ /**
38
+ * Apply a mutation to the state.
39
+ * This is the "Action" or "Rule" equivalent.
40
+ *
41
+ * @param mutator A function that receives the state and modifies it.
42
+ */
43
+ apply(mutator: (state: {
44
+ context: TContext;
45
+ facts: any[];
46
+ meta: Record<string, unknown>;
47
+ }) => void): void;
48
+ /**
49
+ * Access the reactive meta.
50
+ */
51
+ get meta(): Record<string, unknown>;
52
+ }
53
+
54
+ /**
55
+ * Actors System
56
+ *
57
+ * Actors are effectful units that:
58
+ * - Observe Praxis logic state
59
+ * - Perform side effects (network I/O, database operations, timers, etc.)
60
+ * - Feed new events/facts back into the engine
61
+ *
62
+ * Actors provide the bridge between pure logic and the effectful world.
63
+ */
64
+
65
+ /**
66
+ * Actor interface
67
+ *
68
+ * An actor observes state changes and can:
69
+ * - React to state changes (onStateChange)
70
+ * - Perform initialization (onStart)
71
+ * - Perform cleanup (onStop)
72
+ */
73
+ interface Actor<TContext = unknown> {
74
+ /** Unique identifier for the actor */
75
+ id: string;
76
+ /** Human-readable description */
77
+ description: string;
78
+ /** Called when the actor is started */
79
+ onStart?: (engine: LogicEngine<TContext>) => void | Promise<void>;
80
+ /** Called when state changes */
81
+ onStateChange?: (state: Readonly<PraxisState & {
82
+ context: TContext;
83
+ }>, engine: LogicEngine<TContext>) => void | Promise<void>;
84
+ /** Called when the actor is stopped */
85
+ onStop?: () => void | Promise<void>;
86
+ }
87
+ /**
88
+ * Actor manager
89
+ *
90
+ * Manages the lifecycle of actors and coordinates their interaction with the engine.
91
+ */
92
+ declare class ActorManager<TContext = unknown> {
93
+ private actors;
94
+ private activeActors;
95
+ private engine;
96
+ /**
97
+ * Register an actor
98
+ */
99
+ register(actor: Actor<TContext>): void;
100
+ /**
101
+ * Unregister an actor
102
+ */
103
+ unregister(actorId: string): void;
104
+ /**
105
+ * Attach the actor manager to an engine
106
+ */
107
+ attachEngine(engine: LogicEngine<TContext>): void;
108
+ /**
109
+ * Start an actor
110
+ */
111
+ start(actorId: string): Promise<void>;
112
+ /**
113
+ * Stop an actor
114
+ */
115
+ stop(actorId: string): Promise<void>;
116
+ /**
117
+ * Start all registered actors
118
+ */
119
+ startAll(): Promise<void>;
120
+ /**
121
+ * Stop all active actors
122
+ */
123
+ stopAll(): Promise<void>;
124
+ /**
125
+ * Notify active actors of a state change
126
+ */
127
+ notifyStateChange(state: Readonly<PraxisState & {
128
+ context: TContext;
129
+ }>): Promise<void>;
130
+ /**
131
+ * Get all registered actor IDs
132
+ */
133
+ getActorIds(): string[];
134
+ /**
135
+ * Get all active actor IDs
136
+ */
137
+ getActiveActorIds(): string[];
138
+ /**
139
+ * Check if an actor is active
140
+ */
141
+ isActive(actorId: string): boolean;
142
+ }
143
+ /**
144
+ * Helper to create a simple actor that dispatches events on a timer
145
+ */
146
+ declare function createTimerActor<TContext = unknown>(id: string, intervalMs: number, createEvent: () => PraxisEvent): Actor<TContext>;
147
+
148
+ /**
149
+ * Introspection and Visualization Utilities
150
+ *
151
+ * Provides APIs to introspect the registry, generate schemas,
152
+ * and export graph representations for external tools.
153
+ */
154
+
155
+ /**
156
+ * Graph node representing a rule in the system
157
+ */
158
+ interface RuleNode {
159
+ id: string;
160
+ type: 'rule';
161
+ description: string;
162
+ meta?: Record<string, unknown>;
163
+ }
164
+ /**
165
+ * Graph node representing a constraint in the system
166
+ */
167
+ interface ConstraintNode {
168
+ id: string;
169
+ type: 'constraint';
170
+ description: string;
171
+ meta?: Record<string, unknown>;
172
+ }
173
+ /**
174
+ * Graph edge representing a dependency or relationship
175
+ */
176
+ interface GraphEdge {
177
+ from: string;
178
+ to: string;
179
+ type: 'triggers' | 'constrains' | 'depends-on';
180
+ }
181
+ /**
182
+ * Complete graph representation of the registry
183
+ */
184
+ interface RegistryGraph {
185
+ nodes: (RuleNode | ConstraintNode)[];
186
+ edges: GraphEdge[];
187
+ meta: {
188
+ nodeCount: number;
189
+ ruleCount: number;
190
+ constraintCount: number;
191
+ };
192
+ }
193
+ /**
194
+ * JSON Schema-like representation of a rule
195
+ */
196
+ interface RuleSchema {
197
+ id: string;
198
+ description: string;
199
+ type: 'rule';
200
+ meta?: Record<string, unknown>;
201
+ }
202
+ /**
203
+ * JSON Schema-like representation of a constraint
204
+ */
205
+ interface ConstraintSchema {
206
+ id: string;
207
+ description: string;
208
+ type: 'constraint';
209
+ meta?: Record<string, unknown>;
210
+ }
211
+ /**
212
+ * Complete registry schema
213
+ */
214
+ interface RegistrySchema {
215
+ protocolVersion: string;
216
+ rules: RuleSchema[];
217
+ constraints: ConstraintSchema[];
218
+ meta: {
219
+ ruleCount: number;
220
+ constraintCount: number;
221
+ };
222
+ }
223
+ /**
224
+ * Statistics about the registry
225
+ */
226
+ interface RegistryStats {
227
+ ruleCount: number;
228
+ constraintCount: number;
229
+ moduleCount: number;
230
+ rulesById: string[];
231
+ constraintsById: string[];
232
+ }
233
+ /**
234
+ * Introspection utilities for a Praxis registry
235
+ */
236
+ declare class RegistryIntrospector<TContext = unknown> {
237
+ private registry;
238
+ constructor(registry: PraxisRegistry<TContext>);
239
+ /**
240
+ * Get basic statistics about the registry
241
+ */
242
+ getStats(): RegistryStats;
243
+ /**
244
+ * Generate a JSON schema representation of the registry
245
+ */
246
+ generateSchema(protocolVersion: string): RegistrySchema;
247
+ /**
248
+ * Generate a graph representation of the registry
249
+ *
250
+ * This creates nodes for rules and constraints.
251
+ * Edges can be inferred from metadata if rules/constraints
252
+ * document their dependencies.
253
+ */
254
+ generateGraph(): RegistryGraph;
255
+ /**
256
+ * Export graph in DOT format (Graphviz)
257
+ *
258
+ * This can be rendered with Graphviz tools or online services.
259
+ */
260
+ exportDOT(): string;
261
+ /**
262
+ * Export graph in Mermaid format
263
+ *
264
+ * Mermaid is a markdown-friendly diagramming language.
265
+ */
266
+ exportMermaid(): string;
267
+ /**
268
+ * Get detailed information about a specific rule
269
+ */
270
+ getRuleInfo(ruleId: string): RuleDescriptor<TContext> | undefined;
271
+ /**
272
+ * Get detailed information about a specific constraint
273
+ */
274
+ getConstraintInfo(constraintId: string): ConstraintDescriptor<TContext> | undefined;
275
+ /**
276
+ * Search for rules by description text
277
+ */
278
+ searchRules(query: string): RuleDescriptor<TContext>[];
279
+ /**
280
+ * Search for constraints by description text
281
+ */
282
+ searchConstraints(query: string): ConstraintDescriptor<TContext>[];
283
+ }
284
+ /**
285
+ * Create a registry introspector
286
+ */
287
+ declare function createIntrospector<TContext = unknown>(registry: PraxisRegistry<TContext>): RegistryIntrospector<TContext>;
288
+
289
+ /**
290
+ * DSL Helpers
291
+ *
292
+ * Ergonomic TypeScript helpers for defining facts, events, rules, constraints, and flows.
293
+ * These produce both strongly-typed APIs and serializable descriptors.
294
+ */
295
+
296
+ /**
297
+ * Strongly typed fact definition
298
+ */
299
+ interface FactDefinition<TTag extends string, TPayload> {
300
+ tag: TTag;
301
+ create(payload: TPayload): PraxisFact & {
302
+ tag: TTag;
303
+ payload: TPayload;
304
+ };
305
+ is(fact: PraxisFact): fact is PraxisFact & {
306
+ tag: TTag;
307
+ payload: TPayload;
308
+ };
309
+ }
310
+ /**
311
+ * Define a typed fact
312
+ *
313
+ * @example
314
+ * const UserLoggedIn = defineFact<"UserLoggedIn", { userId: string }>("UserLoggedIn");
315
+ * const fact = UserLoggedIn.create({ userId: "123" });
316
+ * if (UserLoggedIn.is(fact)) {
317
+ * console.log(fact.payload.userId); // Type-safe!
318
+ * }
319
+ */
320
+ declare function defineFact<TTag extends string, TPayload>(tag: TTag): FactDefinition<TTag, TPayload>;
321
+ /**
322
+ * Strongly typed event definition
323
+ */
324
+ interface EventDefinition<TTag extends string, TPayload> {
325
+ tag: TTag;
326
+ create(payload: TPayload): PraxisEvent & {
327
+ tag: TTag;
328
+ payload: TPayload;
329
+ };
330
+ is(event: PraxisEvent): event is PraxisEvent & {
331
+ tag: TTag;
332
+ payload: TPayload;
333
+ };
334
+ }
335
+ /**
336
+ * Define a typed event
337
+ *
338
+ * @example
339
+ * const Login = defineEvent<"LOGIN", { username: string; password: string }>("LOGIN");
340
+ * const event = Login.create({ username: "alice", password: "secret" });
341
+ */
342
+ declare function defineEvent<TTag extends string, TPayload>(tag: TTag): EventDefinition<TTag, TPayload>;
343
+ /**
344
+ * Options for defining a rule
345
+ */
346
+ interface DefineRuleOptions<TContext = unknown> {
347
+ id: string;
348
+ description: string;
349
+ impl: RuleFn<TContext>;
350
+ meta?: Record<string, unknown>;
351
+ }
352
+ /**
353
+ * Define a rule
354
+ *
355
+ * @example
356
+ * const loginRule = defineRule({
357
+ * id: "auth.login",
358
+ * description: "Process login event",
359
+ * impl: (state, events) => {
360
+ * const loginEvent = events.find(Login.is);
361
+ * if (loginEvent) {
362
+ * return [UserLoggedIn.create({ userId: loginEvent.payload.username })];
363
+ * }
364
+ * return [];
365
+ * }
366
+ * });
367
+ */
368
+ declare function defineRule<TContext = unknown>(options: DefineRuleOptions<TContext>): RuleDescriptor<TContext>;
369
+ /**
370
+ * Options for defining a constraint
371
+ */
372
+ interface DefineConstraintOptions<TContext = unknown> {
373
+ id: string;
374
+ description: string;
375
+ impl: ConstraintFn<TContext>;
376
+ meta?: Record<string, unknown>;
377
+ }
378
+ /**
379
+ * Define a constraint
380
+ *
381
+ * @example
382
+ * const maxCartItems = defineConstraint({
383
+ * id: "cart.maxItems",
384
+ * description: "Cart cannot exceed 100 items",
385
+ * impl: (state) => {
386
+ * const itemCount = state.context.items?.length ?? 0;
387
+ * return itemCount <= 100 || `Cart has ${itemCount} items, maximum is 100`;
388
+ * }
389
+ * });
390
+ */
391
+ declare function defineConstraint<TContext = unknown>(options: DefineConstraintOptions<TContext>): ConstraintDescriptor<TContext>;
392
+ /**
393
+ * Options for defining a module
394
+ */
395
+ interface DefineModuleOptions<TContext = unknown> {
396
+ rules?: RuleDescriptor<TContext>[];
397
+ constraints?: ConstraintDescriptor<TContext>[];
398
+ meta?: Record<string, unknown>;
399
+ }
400
+ /**
401
+ * Define a module (bundle of rules and constraints)
402
+ *
403
+ * @example
404
+ * const authModule = defineModule({
405
+ * rules: [loginRule, logoutRule],
406
+ * constraints: [maxSessionsConstraint],
407
+ * meta: { version: "1.0.0" }
408
+ * });
409
+ */
410
+ declare function defineModule<TContext = unknown>(options: DefineModuleOptions<TContext>): PraxisModule<TContext>;
411
+ /**
412
+ * Helper to filter events by definition
413
+ */
414
+ declare function filterEvents<TTag extends string, TPayload>(events: PraxisEvent[], definition: EventDefinition<TTag, TPayload>): Array<PraxisEvent & {
415
+ tag: TTag;
416
+ payload: TPayload;
417
+ }>;
418
+ /**
419
+ * Helper to filter facts by definition
420
+ */
421
+ declare function filterFacts<TTag extends string, TPayload>(facts: PraxisFact[], definition: FactDefinition<TTag, TPayload>): Array<PraxisFact & {
422
+ tag: TTag;
423
+ payload: TPayload;
424
+ }>;
425
+ /**
426
+ * Helper to find first event matching definition
427
+ */
428
+ declare function findEvent<TTag extends string, TPayload>(events: PraxisEvent[], definition: EventDefinition<TTag, TPayload>): (PraxisEvent & {
429
+ tag: TTag;
430
+ payload: TPayload;
431
+ }) | undefined;
432
+ /**
433
+ * Helper to find first fact matching definition
434
+ */
435
+ declare function findFact<TTag extends string, TPayload>(facts: PraxisFact[], definition: FactDefinition<TTag, TPayload>): (PraxisFact & {
436
+ tag: TTag;
437
+ payload: TPayload;
438
+ }) | undefined;
439
+
440
+ /**
441
+ * Praxis Schema Loader (Common/Browser Compatible)
442
+ *
443
+ * Core schema loading and validation functions that don't depend on Node.js APIs.
444
+ */
445
+
446
+ /**
447
+ * Loader options
448
+ */
449
+ interface LoaderOptions {
450
+ /** Validate schema after loading */
451
+ validate?: boolean;
452
+ /** Base directory for resolving relative paths */
453
+ baseDir?: string;
454
+ }
455
+ /**
456
+ * Loader result
457
+ */
458
+ interface LoaderResult {
459
+ /** Loaded schema */
460
+ schema?: PraxisSchema;
461
+ /** Validation result */
462
+ validation?: ValidationResult;
463
+ /** Load errors */
464
+ errors: string[];
465
+ }
466
+ /**
467
+ * Load schema from JSON string
468
+ */
469
+ declare function loadSchemaFromJson(json: string, options?: LoaderOptions): LoaderResult;
470
+ /**
471
+ * Load schema from YAML string
472
+ */
473
+ declare function loadSchemaFromYaml(yaml: string, options?: LoaderOptions): LoaderResult;
474
+ /**
475
+ * Validate that a loaded schema has required fields for generation
476
+ */
477
+ declare function validateForGeneration(schema: PraxisSchema): ValidationResult;
478
+
479
+ /**
480
+ * Praxis Schema Loader
481
+ *
482
+ * Loads and validates Praxis schema files.
483
+ */
484
+
485
+ /**
486
+ * Load a Praxis schema from a file
487
+ */
488
+ declare function loadSchema(filePath: string, options?: LoaderOptions): Promise<LoaderResult>;
489
+ /**
490
+ * Load schema from file (supports .ts, .json, and .yaml/.yml)
491
+ */
492
+ declare function loadSchemaFromFile(filePath: string, options?: LoaderOptions): Promise<LoaderResult>;
493
+
494
+ /**
495
+ * PraxisDB Store
496
+ *
497
+ * Connects Praxis Facts, Events, Rules, and Constraints to PluresDB.
498
+ * Provides CRDT-backed storage for facts and append-only event streams.
499
+ */
500
+
501
+ /**
502
+ * Key paths for Praxis data in PluresDB
503
+ */
504
+ declare const PRAXIS_PATHS: {
505
+ /** Base path for all Praxis data */
506
+ readonly BASE: "/_praxis";
507
+ /** Path for facts storage */
508
+ readonly FACTS: "/_praxis/facts";
509
+ /** Path for events storage */
510
+ readonly EVENTS: "/_praxis/events";
511
+ /** Path for schema registry */
512
+ readonly SCHEMAS: "/_praxis/schemas";
513
+ };
514
+ /**
515
+ * Generate a fact key path
516
+ * @param factTag The fact type tag
517
+ * @param id Optional unique identifier for the fact instance
518
+ */
519
+ declare function getFactPath(factTag: string, id?: string): string;
520
+ /**
521
+ * Generate an event stream key path
522
+ * @param eventTag The event type tag
523
+ */
524
+ declare function getEventPath(eventTag: string): string;
525
+ /**
526
+ * Generate a unique ID for facts or events
527
+ * Uses timestamp and random string for uniqueness
528
+ */
529
+ declare function generateId(): string;
530
+ /**
531
+ * Event stream entry with timestamp
532
+ */
533
+ interface EventStreamEntry {
534
+ /** The event data */
535
+ event: PraxisEvent;
536
+ /** Timestamp when the event was appended */
537
+ timestamp: number;
538
+ /** Optional sequence number */
539
+ sequence?: number;
540
+ }
541
+ /**
542
+ * Options for creating a PraxisDBStore
543
+ */
544
+ interface PraxisDBStoreOptions<TContext = unknown> {
545
+ /** The PraxisDB instance to use */
546
+ db: PraxisDB;
547
+ /** The PraxisRegistry for rules and constraints */
548
+ registry: PraxisRegistry<TContext>;
549
+ /** Initial context for rule evaluation */
550
+ initialContext?: TContext;
551
+ }
552
+ /**
553
+ * PraxisDBStore
554
+ *
555
+ * Manages persistence and reactive updates for Praxis state in PluresDB.
556
+ *
557
+ * - Facts are stored as CRDT-backed documents under `/_praxis/facts/<factTag>/<id>`
558
+ * - Events are stored as append-only streams under `/_praxis/events/<eventTag>`
559
+ * - Rules are triggered automatically when watched keys change
560
+ * - Constraints are run before writing mutated state
561
+ */
562
+ /**
563
+ * Error handler callback for rule execution errors
564
+ */
565
+ type RuleErrorHandler = (ruleId: string, error: unknown) => void;
566
+ declare class PraxisDBStore<TContext = unknown> {
567
+ private db;
568
+ private registry;
569
+ private context;
570
+ private subscriptions;
571
+ private factWatchers;
572
+ private onRuleError;
573
+ constructor(options: PraxisDBStoreOptions<TContext> & {
574
+ onRuleError?: RuleErrorHandler;
575
+ });
576
+ /**
577
+ * Store a fact in PluresDB
578
+ *
579
+ * Facts are stored under `/_praxis/facts/<factTag>/<id>`
580
+ * If no id is provided in the payload, a timestamp-based id is used.
581
+ *
582
+ * @param fact The fact to store
583
+ * @returns Promise that resolves when the fact is stored
584
+ */
585
+ storeFact(fact: PraxisFact): Promise<void>;
586
+ /**
587
+ * Store multiple facts in PluresDB
588
+ *
589
+ * @param facts The facts to store
590
+ */
591
+ storeFacts(facts: PraxisFact[]): Promise<void>;
592
+ /**
593
+ * Internal method to persist a fact without constraint checking
594
+ * Used by both storeFact and derived fact storage
595
+ */
596
+ private persistFact;
597
+ /**
598
+ * Get a fact by tag and id
599
+ *
600
+ * @param factTag The fact type tag
601
+ * @param id The fact id
602
+ * @returns The fact or undefined if not found
603
+ */
604
+ getFact(factTag: string, id: string): Promise<PraxisFact | undefined>;
605
+ /**
606
+ * Append an event to the event stream
607
+ *
608
+ * Events are stored as append-only streams under `/_praxis/events/<eventTag>`
609
+ *
610
+ * @param event The event to append
611
+ */
612
+ appendEvent(event: PraxisEvent): Promise<void>;
613
+ /**
614
+ * Append multiple events to their respective streams
615
+ *
616
+ * @param events The events to append
617
+ */
618
+ appendEvents(events: PraxisEvent[]): Promise<void>;
619
+ /**
620
+ * Get events from a stream
621
+ *
622
+ * @param eventTag The event type tag
623
+ * @param options Query options
624
+ * @returns Array of event stream entries
625
+ */
626
+ getEvents(eventTag: string, options?: {
627
+ since?: number;
628
+ limit?: number;
629
+ }): Promise<EventStreamEntry[]>;
630
+ /**
631
+ * Watch a fact path for changes
632
+ *
633
+ * @param factTag The fact type tag to watch
634
+ * @param callback Called when facts of this type change
635
+ * @returns Unsubscribe function
636
+ */
637
+ watchFacts(factTag: string, callback: (facts: PraxisFact[]) => void): UnsubscribeFn;
638
+ /**
639
+ * Check constraints against the current state with new facts
640
+ */
641
+ private checkConstraints;
642
+ /**
643
+ * Trigger rules when new facts are added
644
+ *
645
+ * This method is called after facts are stored. It can be extended
646
+ * for derived fact computation where rules generate new facts based
647
+ * on existing facts. Currently implemented as a hook point for future
648
+ * enhancements.
649
+ *
650
+ * @param _newFacts The newly stored facts (unused in current implementation)
651
+ */
652
+ private triggerRules;
653
+ /**
654
+ * Trigger rules when events are appended
655
+ */
656
+ private triggerRulesForEvents;
657
+ /**
658
+ * Update the context
659
+ */
660
+ updateContext(context: TContext): void;
661
+ /**
662
+ * Get the current context
663
+ */
664
+ getContext(): TContext;
665
+ /**
666
+ * Dispose of all subscriptions
667
+ */
668
+ dispose(): void;
669
+ }
670
+ /**
671
+ * Create a new PraxisDBStore
672
+ *
673
+ * @param db The PraxisDB instance to use
674
+ * @param registry The PraxisRegistry for rules and constraints
675
+ * @param initialContext Optional initial context
676
+ * @param onRuleError Optional error handler for rule execution errors
677
+ * @returns PraxisDBStore instance
678
+ *
679
+ * @example
680
+ * ```typescript
681
+ * const db = createInMemoryDB();
682
+ * const registry = new PraxisRegistry();
683
+ * const store = createPraxisDBStore(db, registry);
684
+ *
685
+ * await store.storeFact({ tag: "UserLoggedIn", payload: { userId: "alice" } });
686
+ * await store.appendEvent({ tag: "LOGIN", payload: { username: "alice" } });
687
+ * ```
688
+ */
689
+ declare function createPraxisDBStore<TContext = unknown>(db: PraxisDB, registry: PraxisRegistry<TContext>, initialContext?: TContext, onRuleError?: RuleErrorHandler): PraxisDBStore<TContext>;
690
+
691
+ /**
692
+ * Praxis Schema Registry for PluresDB
693
+ *
694
+ * Registers Praxis schema definitions in PluresDB for type-safe storage
695
+ * and cross-agent schema discovery.
696
+ */
697
+
698
+ /**
699
+ * Get the path for a schema in PluresDB
700
+ * @param schemaName The schema name
701
+ */
702
+ declare function getSchemaPath(schemaName: string): string;
703
+ /**
704
+ * Stored schema entry with metadata
705
+ */
706
+ interface StoredSchema {
707
+ /** The schema definition */
708
+ schema: PraxisSchema;
709
+ /** When the schema was registered */
710
+ registeredAt: number;
711
+ /** Schema version */
712
+ version: string;
713
+ }
714
+ /**
715
+ * PraxisSchemaRegistry
716
+ *
717
+ * Manages schema definitions in PluresDB.
718
+ * Schemas are stored under `/_praxis/schemas/<schemaName>`
719
+ */
720
+ declare class PraxisSchemaRegistry {
721
+ private db;
722
+ constructor(db: PraxisDB);
723
+ /**
724
+ * Register a schema in PluresDB
725
+ *
726
+ * @param schema The schema to register
727
+ */
728
+ register(schema: PraxisSchema): Promise<void>;
729
+ /**
730
+ * Get a schema by name
731
+ *
732
+ * @param schemaName The schema name
733
+ * @returns The stored schema or undefined if not found
734
+ */
735
+ get(schemaName: string): Promise<StoredSchema | undefined>;
736
+ /**
737
+ * Check if a schema is registered
738
+ *
739
+ * @param schemaName The schema name
740
+ * @returns True if the schema exists
741
+ */
742
+ exists(schemaName: string): Promise<boolean>;
743
+ /**
744
+ * Update a schema (replaces existing)
745
+ *
746
+ * @param schema The updated schema
747
+ */
748
+ update(schema: PraxisSchema): Promise<void>;
749
+ /**
750
+ * List all registered schema names
751
+ *
752
+ * Implementation note: This method uses an index stored at `/_praxis/schemas/_index`.
753
+ * When using InMemoryPraxisDB, schemas must be registered using `registerWithIndex()`
754
+ * for them to appear in this listing. When using a full PluresDB implementation,
755
+ * native listing capabilities should be used instead.
756
+ *
757
+ * @returns Array of registered schema names
758
+ */
759
+ list(): Promise<string[]>;
760
+ /**
761
+ * Register a schema and update the index
762
+ *
763
+ * @param schema The schema to register
764
+ */
765
+ registerWithIndex(schema: PraxisSchema): Promise<void>;
766
+ }
767
+ /**
768
+ * Register a schema in PluresDB
769
+ *
770
+ * Convenience function for one-off schema registration.
771
+ *
772
+ * @param db The PraxisDB instance
773
+ * @param schema The schema to register
774
+ *
775
+ * @example
776
+ * ```typescript
777
+ * const db = createInMemoryDB();
778
+ * await registerSchema(db, {
779
+ * version: "1.0.0",
780
+ * name: "MyApp",
781
+ * description: "My application schema"
782
+ * });
783
+ * ```
784
+ */
785
+ declare function registerSchema(db: PraxisDB, schema: PraxisSchema): Promise<void>;
786
+ /**
787
+ * Create a PraxisSchemaRegistry instance
788
+ *
789
+ * @param db The PraxisDB instance
790
+ * @returns PraxisSchemaRegistry instance
791
+ */
792
+ declare function createSchemaRegistry(db: PraxisDB): PraxisSchemaRegistry;
793
+
794
+ /**
795
+ * Praxis Schema Normalizer
796
+ *
797
+ * Expands and normalizes schema definitions for code generation.
798
+ */
799
+
800
+ /**
801
+ * Normalized schema with expanded and validated definitions
802
+ */
803
+ interface NormalizedSchema extends PraxisSchema {
804
+ /** Normalized models with expanded references */
805
+ models: NormalizedModel[];
806
+ /** Normalized components */
807
+ components: NormalizedComponent[];
808
+ /** Normalized logic */
809
+ logic: NormalizedLogic[];
810
+ }
811
+ /**
812
+ * Normalized model definition
813
+ */
814
+ interface NormalizedModel extends ModelDefinition {
815
+ /** Fully qualified name */
816
+ fullName: string;
817
+ /** All fields including inherited ones */
818
+ allFields: FieldDefinition[];
819
+ /** Model dependencies */
820
+ dependencies: string[];
821
+ }
822
+ /**
823
+ * Normalized component definition
824
+ */
825
+ interface NormalizedComponent extends ComponentDefinition {
826
+ /** Fully qualified name */
827
+ fullName: string;
828
+ /** Resolved model reference */
829
+ resolvedModel?: NormalizedModel;
830
+ }
831
+ /**
832
+ * Normalized logic definition
833
+ */
834
+ interface NormalizedLogic extends LogicDefinition {
835
+ /** Fully qualified identifier */
836
+ fullId: string;
837
+ }
838
+
839
+ /**
840
+ * PluresDB Config Generator
841
+ *
842
+ * Generates PluresDB configuration from schema definitions.
843
+ */
844
+
845
+ /**
846
+ * PluresDB config generation options
847
+ */
848
+ interface PluresDBGeneratorOptions {
849
+ /** Output directory */
850
+ outputDir: string;
851
+ /** Database name */
852
+ dbName?: string;
853
+ /** Database version */
854
+ dbVersion?: number;
855
+ /** Enable sync */
856
+ enableSync?: boolean;
857
+ /** Sync endpoint */
858
+ syncEndpoint?: string;
859
+ /** Auto-index strategy: 'all' indexes all string/number/date fields, 'explicit' only indexes fields defined in schema, 'none' disables auto-indexing */
860
+ autoIndex?: 'all' | 'explicit' | 'none';
861
+ }
862
+ /**
863
+ * Generated PluresDB config file
864
+ */
865
+ interface GeneratedPluresDBFile {
866
+ /** File path */
867
+ path: string;
868
+ /** File content */
869
+ content: string;
870
+ /** File type */
871
+ type: 'config' | 'types';
872
+ }
873
+ /**
874
+ * PluresDB generator class
875
+ */
876
+ declare class PluresDBGenerator {
877
+ private options;
878
+ constructor(options: PluresDBGeneratorOptions);
879
+ /**
880
+ * Generate PluresDB configuration from schema
881
+ */
882
+ generateConfig(schema: NormalizedSchema): GeneratedPluresDBFile[];
883
+ /**
884
+ * Generate pluresdb-config.ts file
885
+ */
886
+ private generateConfigFile;
887
+ /**
888
+ * Generate store configuration for a model
889
+ */
890
+ private generateStoreConfig;
891
+ }
892
+ /**
893
+ * Create a PluresDB generator
894
+ */
895
+ declare function createPluresDBGenerator(outputDir: string, options?: Partial<PluresDBGeneratorOptions>): PluresDBGenerator;
896
+
897
+ /**
898
+ * PluresDB Integration
899
+ *
900
+ * Integration with pluresdb - reactive graph datastore and event source/sink.
901
+ * This module provides adapters for:
902
+ * - Storing Praxis state in pluresdb
903
+ * - Sourcing events from pluresdb
904
+ * - Sinking events to pluresdb
905
+ * - Reactive queries and subscriptions
906
+ */
907
+
908
+ /**
909
+ * PluresDB adapter interface for engine integration
910
+ *
911
+ * Provides:
912
+ * - Event sourcing (persist events to pluresdb)
913
+ * - State snapshots (persist state to pluresdb)
914
+ * - Event replay (rebuild state from events)
915
+ * - Reactive queries (subscribe to state changes)
916
+ */
917
+ interface PluresDBAdapter<TContext = unknown> {
918
+ /**
919
+ * Persist events to pluresdb
920
+ */
921
+ persistEvents(events: PraxisEvent[]): Promise<void>;
922
+ /**
923
+ * Persist facts to pluresdb
924
+ */
925
+ persistFacts(facts: PraxisFact[]): Promise<void>;
926
+ /**
927
+ * Load events from pluresdb
928
+ */
929
+ loadEvents(query?: unknown): Promise<PraxisEvent[]>;
930
+ /**
931
+ * Subscribe to changes for a given tag
932
+ *
933
+ * Note: This watches for derived facts that are created when events are processed.
934
+ * The callback receives the new facts as event-like objects for convenience.
935
+ */
936
+ subscribeToEvents(callback: (events: PraxisEvent[]) => void, query?: unknown): () => void;
937
+ /**
938
+ * Attach the adapter to an engine
939
+ */
940
+ attachEngine(engine: LogicEngine<TContext>): void;
941
+ /**
942
+ * Dispose of resources
943
+ */
944
+ dispose(): void;
945
+ }
946
+ /**
947
+ * Options for creating a PluresDB adapter
948
+ */
949
+ interface PluresDBAdapterOptions<TContext = unknown> {
950
+ /** The PraxisDB instance to use */
951
+ db: PraxisDB;
952
+ /** The PraxisRegistry for rules and constraints */
953
+ registry: PraxisRegistry<TContext>;
954
+ /** Initial context */
955
+ initialContext?: TContext;
956
+ }
957
+ /**
958
+ * Create a PluresDB adapter with full implementation
959
+ *
960
+ * @example
961
+ * ```typescript
962
+ * const db = createInMemoryDB();
963
+ * const registry = new PraxisRegistry();
964
+ * const adapter = createPluresDBAdapter({ db, registry });
965
+ *
966
+ * const engine = createPraxisEngine({ initialContext: {}, registry });
967
+ * adapter.attachEngine(engine);
968
+ *
969
+ * await adapter.persistFacts([{ tag: "UserLoggedIn", payload: { userId: "alice" } }]);
970
+ * ```
971
+ */
972
+ declare function createPluresDBAdapter<TContext = unknown>(options: PluresDBAdapterOptions<TContext>): PluresDBAdapter<TContext>;
973
+ /**
974
+ * Attach a PraxisDBStore to a LogicEngine
975
+ *
976
+ * This function creates a bidirectional connection between the store and engine:
977
+ * - Events processed by the engine are persisted to the store
978
+ * - Facts from the store are synchronized to the engine
979
+ *
980
+ * @param store The PraxisDBStore instance
981
+ * @param engine The LogicEngine instance
982
+ * @returns Cleanup function to detach the store
983
+ *
984
+ * @example
985
+ * ```typescript
986
+ * const db = createInMemoryDB();
987
+ * const registry = new PraxisRegistry();
988
+ * const store = createPraxisDBStore(db, registry);
989
+ * const engine = createPraxisEngine({ initialContext: {}, registry });
990
+ *
991
+ * const detach = attachToEngine(store, engine);
992
+ *
993
+ * // Events are now automatically persisted
994
+ * engine.step([{ tag: "LOGIN", payload: { username: "alice" } }]);
995
+ *
996
+ * // Cleanup
997
+ * detach();
998
+ * ```
999
+ */
1000
+ declare function attachToEngine<TContext = unknown>(store: PraxisDBStore<TContext>, engine: LogicEngine<TContext>): UnsubscribeFn;
1001
+
1002
+ /**
1003
+ * Unum Integration
1004
+ *
1005
+ * Integration with plures/unum - A modern Svelte binding library for PluresDB
1006
+ * with full Svelte 5 compatibility. Provides identity and channels support.
1007
+ *
1008
+ * Features:
1009
+ * - Svelte 4 & 5 Compatible: Works with both store-based and runes-based reactivity
1010
+ * - Type-Safe: Full TypeScript support with proper types
1011
+ * - Action-Based: Modern Svelte actions for DOM binding
1012
+ * - Store-Based: Writable store implementation for reactive data
1013
+ * - Collection Support: Easy handling of PluresDB collections
1014
+ *
1015
+ * @see https://github.com/plures/unum
1016
+ */
1017
+
1018
+ /**
1019
+ * Unum store interface for reactive PluresDB data
1020
+ */
1021
+ interface UnumStore<T> {
1022
+ subscribe(run: (value: T) => void): () => void;
1023
+ set(value: T): void;
1024
+ update(updater: (value: T) => T): void;
1025
+ }
1026
+ /**
1027
+ * Unum channel for real-time communication
1028
+ */
1029
+ interface UnumChannel {
1030
+ /** Channel identifier */
1031
+ id: string;
1032
+ /** Channel name */
1033
+ name: string;
1034
+ /** Subscribe to channel messages */
1035
+ subscribe(handler: (message: UnumMessage) => void): () => void;
1036
+ /** Publish a message to the channel */
1037
+ publish(message: Omit<UnumMessage, 'timestamp' | 'channelId'>): Promise<void>;
1038
+ /** Get channel members */
1039
+ getMembers(): Promise<UnumIdentity[]>;
1040
+ /** Leave the channel */
1041
+ leave(): Promise<void>;
1042
+ }
1043
+ /**
1044
+ * Message sent through a Unum channel
1045
+ */
1046
+ interface UnumMessage {
1047
+ /** Message ID */
1048
+ id: string;
1049
+ /** Channel ID */
1050
+ channelId: string;
1051
+ /** Sender identity */
1052
+ sender: UnumIdentity;
1053
+ /** Message content */
1054
+ content: unknown;
1055
+ /** Message type */
1056
+ type: 'text' | 'event' | 'fact' | 'system';
1057
+ /** Timestamp */
1058
+ timestamp: number;
1059
+ }
1060
+ /**
1061
+ * Unum identity representing a user or system
1062
+ */
1063
+ interface UnumIdentity {
1064
+ /** Unique identifier */
1065
+ id: string;
1066
+ /** Display name */
1067
+ name?: string;
1068
+ /** Public key for encryption */
1069
+ publicKey?: string;
1070
+ /** Identity metadata */
1071
+ metadata?: Record<string, unknown>;
1072
+ /** Creation timestamp */
1073
+ createdAt: number;
1074
+ /** Last seen timestamp */
1075
+ lastSeen?: number;
1076
+ }
1077
+ /**
1078
+ * Unum adapter configuration
1079
+ */
1080
+ interface UnumAdapterConfig {
1081
+ /** PluresDB instance to use */
1082
+ db: PraxisDB;
1083
+ /** Current user identity */
1084
+ identity?: UnumIdentity;
1085
+ /** Whether to enable real-time sync */
1086
+ realtime?: boolean;
1087
+ /** Sync interval in milliseconds */
1088
+ syncInterval?: number;
1089
+ }
1090
+ /**
1091
+ * Unum adapter for Praxis engine integration
1092
+ *
1093
+ * Provides identity management and channel-based communication
1094
+ * for distributed Praxis applications.
1095
+ */
1096
+ interface UnumAdapter {
1097
+ /** Current identity */
1098
+ identity: UnumIdentity | null;
1099
+ /** Create or update identity */
1100
+ setIdentity(identity: Omit<UnumIdentity, 'id' | 'createdAt'>): Promise<UnumIdentity>;
1101
+ /** Get identity by ID */
1102
+ getIdentity(id: string): Promise<UnumIdentity | null>;
1103
+ /** Create a new channel */
1104
+ createChannel(name: string, members?: string[]): Promise<UnumChannel>;
1105
+ /** Join an existing channel */
1106
+ joinChannel(channelId: string): Promise<UnumChannel>;
1107
+ /** List available channels */
1108
+ listChannels(): Promise<UnumChannel[]>;
1109
+ /** Broadcast a Praxis event to a channel */
1110
+ broadcastEvent(channelId: string, event: PraxisEvent): Promise<void>;
1111
+ /** Broadcast a Praxis fact to a channel */
1112
+ broadcastFact(channelId: string, fact: PraxisFact): Promise<void>;
1113
+ /** Subscribe to events from a channel */
1114
+ subscribeToEvents(channelId: string, handler: (event: PraxisEvent) => void): () => void;
1115
+ /** Subscribe to facts from a channel */
1116
+ subscribeToFacts(channelId: string, handler: (fact: PraxisFact) => void): () => void;
1117
+ /** Disconnect and cleanup */
1118
+ disconnect(): Promise<void>;
1119
+ }
1120
+ /**
1121
+ * Create a Unum adapter for Praxis engine integration
1122
+ *
1123
+ * @example
1124
+ * ```typescript
1125
+ * import { createUnumAdapter } from '@plures/praxis/integrations/unum';
1126
+ * import { createInMemoryDB } from '@plures/praxis/integrations/pluresdb';
1127
+ *
1128
+ * const db = createInMemoryDB();
1129
+ * const unum = await createUnumAdapter({
1130
+ * db,
1131
+ * identity: {
1132
+ * name: 'Alice',
1133
+ * },
1134
+ * realtime: true,
1135
+ * });
1136
+ *
1137
+ * // Create a channel
1138
+ * const channel = await unum.createChannel('my-channel');
1139
+ *
1140
+ * // Broadcast events to the channel
1141
+ * await unum.broadcastEvent(channel.id, myEvent);
1142
+ * ```
1143
+ */
1144
+ declare function createUnumAdapter(config: UnumAdapterConfig): Promise<UnumAdapter>;
1145
+ /**
1146
+ * Attach Unum adapter to a Praxis engine
1147
+ *
1148
+ * Enables automatic event/fact broadcasting to connected channels.
1149
+ * This is a placeholder for future integration where the engine
1150
+ * would emit events that get broadcast to channels.
1151
+ *
1152
+ * @param _engine - The Praxis logic engine
1153
+ * @param _adapter - The Unum adapter
1154
+ * @param _channelId - The channel to broadcast to
1155
+ * @returns Cleanup function
1156
+ */
1157
+ declare function attachUnumToEngine<TContext>(_engine: LogicEngine<TContext>, _adapter: UnumAdapter, _channelId: string): () => void;
1158
+
1159
+ /**
1160
+ * Praxis Schema Format (PSF) Types
1161
+ *
1162
+ * PSF is the canonical AST format that serves as the single source of truth.
1163
+ * All code, canvas, and documentation are derived from or synchronized with PSF.
1164
+ *
1165
+ * Design principles:
1166
+ * - JSON-serializable for persistence and transmission
1167
+ * - Supports bidirectional code ↔ canvas sync
1168
+ * - Complete representation of all Praxis concepts
1169
+ * - Extensible with metadata and custom properties
1170
+ */
1171
+ /**
1172
+ * PSF Schema version
1173
+ */
1174
+ declare const PSF_VERSION: "1.0.0";
1175
+ /**
1176
+ * Root PSF Schema Document
1177
+ */
1178
+ interface PSFSchema {
1179
+ /** PSF format version */
1180
+ $version: typeof PSF_VERSION;
1181
+ /** Schema identifier */
1182
+ id: string;
1183
+ /** Human-readable name */
1184
+ name: string;
1185
+ /** Description */
1186
+ description?: string;
1187
+ /** Creation timestamp */
1188
+ createdAt?: string;
1189
+ /** Last modified timestamp */
1190
+ modifiedAt?: string;
1191
+ /** Facts defined in this schema */
1192
+ facts: PSFFact[];
1193
+ /** Events defined in this schema */
1194
+ events: PSFEvent[];
1195
+ /** Rules defined in this schema */
1196
+ rules: PSFRule[];
1197
+ /** Constraints defined in this schema */
1198
+ constraints: PSFConstraint[];
1199
+ /** Data models */
1200
+ models: PSFModel[];
1201
+ /** UI Components */
1202
+ components: PSFComponent[];
1203
+ /** Flows/Orchestrations */
1204
+ flows: PSFFlow[];
1205
+ /** Documentation metadata */
1206
+ docs?: PSFDocs;
1207
+ /** Additional metadata */
1208
+ metadata?: Record<string, unknown>;
1209
+ /** Canvas layout information for visual editing */
1210
+ canvas?: PSFCanvasLayout;
1211
+ }
1212
+ /**
1213
+ * PSF Fact Definition
1214
+ */
1215
+ interface PSFFact {
1216
+ /** Unique identifier */
1217
+ id: string;
1218
+ /** Fact tag (for type discrimination) */
1219
+ tag: string;
1220
+ /** Description */
1221
+ description?: string;
1222
+ /** Payload schema */
1223
+ payload: PSFPayloadSchema;
1224
+ /** Documentation hints */
1225
+ docs?: PSFDocsHint;
1226
+ /** Canvas position */
1227
+ position?: PSFPosition;
1228
+ /** Metadata */
1229
+ meta?: Record<string, unknown>;
1230
+ }
1231
+ /**
1232
+ * PSF Event Definition
1233
+ */
1234
+ interface PSFEvent {
1235
+ /** Unique identifier */
1236
+ id: string;
1237
+ /** Event tag (for type discrimination) */
1238
+ tag: string;
1239
+ /** Description */
1240
+ description?: string;
1241
+ /** Payload schema */
1242
+ payload: PSFPayloadSchema;
1243
+ /** Documentation hints */
1244
+ docs?: PSFDocsHint;
1245
+ /** Canvas position */
1246
+ position?: PSFPosition;
1247
+ /** Metadata */
1248
+ meta?: Record<string, unknown>;
1249
+ }
1250
+ /**
1251
+ * PSF Rule Definition
1252
+ */
1253
+ interface PSFRule {
1254
+ /** Unique identifier */
1255
+ id: string;
1256
+ /** Human-readable name */
1257
+ name?: string;
1258
+ /** Description */
1259
+ description: string;
1260
+ /** Events that trigger this rule */
1261
+ triggers?: string[];
1262
+ /** Condition expression (DSL or reference) */
1263
+ when?: PSFExpression;
1264
+ /** Action expression (DSL or reference) */
1265
+ then: PSFExpression;
1266
+ /** Priority (higher executes first) */
1267
+ priority?: number;
1268
+ /** Documentation hints */
1269
+ docs?: PSFDocsHint;
1270
+ /** Canvas position */
1271
+ position?: PSFPosition;
1272
+ /** Metadata */
1273
+ meta?: Record<string, unknown>;
1274
+ }
1275
+ /**
1276
+ * PSF Constraint Definition
1277
+ */
1278
+ interface PSFConstraint {
1279
+ /** Unique identifier */
1280
+ id: string;
1281
+ /** Human-readable name */
1282
+ name?: string;
1283
+ /** Description */
1284
+ description: string;
1285
+ /** Check expression */
1286
+ check: PSFExpression;
1287
+ /** Error message when violated */
1288
+ errorMessage: string;
1289
+ /** Severity level */
1290
+ severity?: 'error' | 'warning' | 'info';
1291
+ /** Documentation hints */
1292
+ docs?: PSFDocsHint;
1293
+ /** Canvas position */
1294
+ position?: PSFPosition;
1295
+ /** Metadata */
1296
+ meta?: Record<string, unknown>;
1297
+ }
1298
+ /**
1299
+ * PSF Data Model
1300
+ */
1301
+ interface PSFModel {
1302
+ /** Unique identifier */
1303
+ id: string;
1304
+ /** Model name */
1305
+ name: string;
1306
+ /** Description */
1307
+ description?: string;
1308
+ /** Fields */
1309
+ fields: PSFField[];
1310
+ /** Relationships to other models */
1311
+ relationships?: PSFRelationship[];
1312
+ /** Indexes */
1313
+ indexes?: PSFIndex[];
1314
+ /** Model-level constraints */
1315
+ constraints?: PSFModelConstraint[];
1316
+ /** Documentation hints */
1317
+ docs?: PSFDocsHint;
1318
+ /** Canvas position */
1319
+ position?: PSFPosition;
1320
+ /** Metadata */
1321
+ meta?: Record<string, unknown>;
1322
+ }
1323
+ /**
1324
+ * PSF Model Field
1325
+ */
1326
+ interface PSFField {
1327
+ /** Field name */
1328
+ name: string;
1329
+ /** Field type */
1330
+ type: PSFFieldType;
1331
+ /** Is optional */
1332
+ optional?: boolean;
1333
+ /** Default value */
1334
+ default?: unknown;
1335
+ /** Description */
1336
+ description?: string;
1337
+ /** Validation rules */
1338
+ validation?: PSFValidation[];
1339
+ /** UI hints for form generation */
1340
+ ui?: PSFUIHint;
1341
+ }
1342
+ /**
1343
+ * PSF Field Type
1344
+ */
1345
+ type PSFFieldType = 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'uuid' | {
1346
+ array: PSFFieldType;
1347
+ } | {
1348
+ object: Record<string, PSFField>;
1349
+ } | {
1350
+ reference: string;
1351
+ } | {
1352
+ enum: string[];
1353
+ } | {
1354
+ union: PSFFieldType[];
1355
+ };
1356
+ /**
1357
+ * PSF Validation Rule
1358
+ */
1359
+ interface PSFValidation {
1360
+ /** Validation type */
1361
+ type: 'required' | 'min' | 'max' | 'minLength' | 'maxLength' | 'pattern' | 'email' | 'url' | 'custom';
1362
+ /** Validation value */
1363
+ value?: unknown;
1364
+ /** Error message */
1365
+ message?: string;
1366
+ }
1367
+ /**
1368
+ * PSF Model Constraint
1369
+ */
1370
+ interface PSFModelConstraint {
1371
+ /** Constraint identifier */
1372
+ id: string;
1373
+ /** Constraint type */
1374
+ type: 'unique' | 'check' | 'foreign_key';
1375
+ /** Fields involved */
1376
+ fields: string[];
1377
+ /** Description */
1378
+ description?: string;
1379
+ /** Additional options */
1380
+ options?: Record<string, unknown>;
1381
+ }
1382
+ /**
1383
+ * PSF Relationship
1384
+ */
1385
+ interface PSFRelationship {
1386
+ /** Relationship name */
1387
+ name: string;
1388
+ /** Relationship type */
1389
+ type: 'one-to-one' | 'one-to-many' | 'many-to-many';
1390
+ /** Target model */
1391
+ target: string;
1392
+ /** Foreign key field */
1393
+ foreignKey?: string;
1394
+ /** Cascade behavior */
1395
+ cascade?: boolean;
1396
+ }
1397
+ /**
1398
+ * PSF Index
1399
+ */
1400
+ interface PSFIndex {
1401
+ /** Index name */
1402
+ name: string;
1403
+ /** Fields to index */
1404
+ fields: string[];
1405
+ /** Is unique index */
1406
+ unique?: boolean;
1407
+ /** Index type */
1408
+ type?: 'btree' | 'hash' | 'fulltext';
1409
+ }
1410
+ /**
1411
+ * PSF Component Definition
1412
+ */
1413
+ interface PSFComponent {
1414
+ /** Unique identifier */
1415
+ id: string;
1416
+ /** Component name */
1417
+ name: string;
1418
+ /** Component type */
1419
+ type: 'form' | 'display' | 'list' | 'navigation' | 'editor' | 'custom';
1420
+ /** Description */
1421
+ description?: string;
1422
+ /** Bound model */
1423
+ model?: string;
1424
+ /** Component properties */
1425
+ props: PSFComponentProp[];
1426
+ /** Component events */
1427
+ events: PSFComponentEvent[];
1428
+ /** Layout configuration */
1429
+ layout?: PSFLayout;
1430
+ /** Styling configuration */
1431
+ styling?: PSFStyling;
1432
+ /** Documentation hints */
1433
+ docs?: PSFDocsHint;
1434
+ /** Canvas position */
1435
+ position?: PSFPosition;
1436
+ /** Metadata */
1437
+ meta?: Record<string, unknown>;
1438
+ }
1439
+ /**
1440
+ * PSF Component Property
1441
+ */
1442
+ interface PSFComponentProp {
1443
+ /** Property name */
1444
+ name: string;
1445
+ /** Property type */
1446
+ type: string;
1447
+ /** Is required */
1448
+ required?: boolean;
1449
+ /** Default value */
1450
+ default?: unknown;
1451
+ /** Description */
1452
+ description?: string;
1453
+ /** Binding expression */
1454
+ binding?: PSFExpression;
1455
+ }
1456
+ /**
1457
+ * PSF Component Event
1458
+ */
1459
+ interface PSFComponentEvent {
1460
+ /** Event name */
1461
+ name: string;
1462
+ /** Payload type */
1463
+ payload?: string;
1464
+ /** Description */
1465
+ description?: string;
1466
+ /** Handler expression */
1467
+ handler?: PSFExpression;
1468
+ }
1469
+ /**
1470
+ * PSF Layout Configuration
1471
+ */
1472
+ interface PSFLayout {
1473
+ /** Layout type */
1474
+ type: 'stack' | 'grid' | 'flex' | 'absolute';
1475
+ /** Direction */
1476
+ direction?: 'horizontal' | 'vertical';
1477
+ /** Gap between items */
1478
+ gap?: number | string;
1479
+ /** Padding */
1480
+ padding?: number | string;
1481
+ /** Alignment */
1482
+ align?: 'start' | 'center' | 'end' | 'stretch';
1483
+ /** Justify */
1484
+ justify?: 'start' | 'center' | 'end' | 'between' | 'around';
1485
+ }
1486
+ /**
1487
+ * PSF Styling Configuration
1488
+ */
1489
+ interface PSFStyling {
1490
+ /** CSS classes */
1491
+ classes?: string[];
1492
+ /** Inline styles */
1493
+ styles?: Record<string, string>;
1494
+ /** Theme tokens */
1495
+ theme?: Record<string, string>;
1496
+ /** Variant */
1497
+ variant?: string;
1498
+ }
1499
+ /**
1500
+ * PSF Flow/Orchestration
1501
+ */
1502
+ interface PSFFlow {
1503
+ /** Unique identifier */
1504
+ id: string;
1505
+ /** Flow name */
1506
+ name: string;
1507
+ /** Description */
1508
+ description?: string;
1509
+ /** Flow type */
1510
+ type: 'sequence' | 'parallel' | 'state-machine' | 'saga';
1511
+ /** Flow steps */
1512
+ steps: PSFFlowStep[];
1513
+ /** Initial state/step */
1514
+ initial?: string;
1515
+ /** Error handling */
1516
+ errorHandling?: PSFErrorHandling;
1517
+ /** Documentation hints */
1518
+ docs?: PSFDocsHint;
1519
+ /** Canvas position */
1520
+ position?: PSFPosition;
1521
+ /** Metadata */
1522
+ meta?: Record<string, unknown>;
1523
+ }
1524
+ /**
1525
+ * PSF Flow Step
1526
+ */
1527
+ interface PSFFlowStep {
1528
+ /** Step identifier */
1529
+ id: string;
1530
+ /** Step name */
1531
+ name?: string;
1532
+ /** Step type */
1533
+ type: 'action' | 'condition' | 'wait' | 'parallel' | 'terminal';
1534
+ /** Action expression */
1535
+ action?: PSFExpression;
1536
+ /** Condition expression */
1537
+ condition?: PSFExpression;
1538
+ /** Next step(s) */
1539
+ next?: string | {
1540
+ [key: string]: string;
1541
+ };
1542
+ /** Timeout in milliseconds */
1543
+ timeout?: number;
1544
+ /** Retry configuration */
1545
+ retry?: PSFRetry;
1546
+ }
1547
+ /**
1548
+ * PSF Retry Configuration
1549
+ */
1550
+ interface PSFRetry {
1551
+ /** Maximum retry attempts */
1552
+ maxAttempts: number;
1553
+ /** Delay between retries (ms) */
1554
+ delay: number;
1555
+ /** Exponential backoff factor */
1556
+ backoff?: number;
1557
+ }
1558
+ /**
1559
+ * PSF Error Handling
1560
+ */
1561
+ interface PSFErrorHandling {
1562
+ /** Global error handler */
1563
+ handler?: PSFExpression;
1564
+ /** Compensation flow */
1565
+ compensation?: string;
1566
+ /** Error policy */
1567
+ policy: 'fail-fast' | 'continue' | 'compensate';
1568
+ }
1569
+ /**
1570
+ * PSF Documentation
1571
+ */
1572
+ interface PSFDocs {
1573
+ /** Overview */
1574
+ overview?: string;
1575
+ /** Getting started guide */
1576
+ gettingStarted?: string;
1577
+ /** Examples */
1578
+ examples?: PSFExample[];
1579
+ /** Additional sections */
1580
+ sections?: PSFDocSection[];
1581
+ /** API documentation configuration */
1582
+ api?: PSFAPIDoc;
1583
+ }
1584
+ /**
1585
+ * PSF Documentation Hint (for individual elements)
1586
+ */
1587
+ interface PSFDocsHint {
1588
+ /** Brief summary */
1589
+ summary?: string;
1590
+ /** Detailed description */
1591
+ details?: string;
1592
+ /** Examples */
1593
+ examples?: string[];
1594
+ /** See also references */
1595
+ seeAlso?: string[];
1596
+ /** Tags for categorization */
1597
+ tags?: string[];
1598
+ /** Deprecation notice */
1599
+ deprecated?: string | boolean;
1600
+ }
1601
+ /**
1602
+ * PSF Example
1603
+ */
1604
+ interface PSFExample {
1605
+ /** Example name */
1606
+ name: string;
1607
+ /** Description */
1608
+ description?: string;
1609
+ /** Code snippet */
1610
+ code: string;
1611
+ /** Language */
1612
+ language?: string;
1613
+ }
1614
+ /**
1615
+ * PSF Documentation Section
1616
+ */
1617
+ interface PSFDocSection {
1618
+ /** Section title */
1619
+ title: string;
1620
+ /** Section content (markdown) */
1621
+ content: string;
1622
+ /** Subsections */
1623
+ children?: PSFDocSection[];
1624
+ }
1625
+ /**
1626
+ * PSF API Documentation Configuration
1627
+ */
1628
+ interface PSFAPIDoc {
1629
+ /** Generate API docs */
1630
+ generate?: boolean;
1631
+ /** Output format */
1632
+ format?: 'markdown' | 'html' | 'json';
1633
+ /** Include private members */
1634
+ includePrivate?: boolean;
1635
+ }
1636
+ /**
1637
+ * PSF Expression (can be inline or reference)
1638
+ */
1639
+ type PSFExpression = {
1640
+ inline: string;
1641
+ language?: 'typescript' | 'javascript';
1642
+ } | {
1643
+ ref: string;
1644
+ };
1645
+ /**
1646
+ * PSF Position (for canvas layout)
1647
+ */
1648
+ interface PSFPosition {
1649
+ /** X coordinate */
1650
+ x: number;
1651
+ /** Y coordinate */
1652
+ y: number;
1653
+ /** Width (optional) */
1654
+ width?: number;
1655
+ /** Height (optional) */
1656
+ height?: number;
1657
+ }
1658
+ /**
1659
+ * PSF UI Hint (for form generation)
1660
+ */
1661
+ interface PSFUIHint {
1662
+ /** Display label */
1663
+ label?: string;
1664
+ /** Placeholder text */
1665
+ placeholder?: string;
1666
+ /** Help text */
1667
+ help?: string;
1668
+ /** Input type override */
1669
+ inputType?: string;
1670
+ /** Component to use */
1671
+ component?: string;
1672
+ /** Hidden from UI */
1673
+ hidden?: boolean;
1674
+ /** Read-only */
1675
+ readonly?: boolean;
1676
+ /** Display order */
1677
+ order?: number;
1678
+ }
1679
+ /**
1680
+ * PSF Payload Schema
1681
+ */
1682
+ interface PSFPayloadSchema {
1683
+ /** Schema type (usually 'object') */
1684
+ type: 'object';
1685
+ /** Properties */
1686
+ properties: Record<string, PSFPropertySchema>;
1687
+ /** Required properties */
1688
+ required?: string[];
1689
+ }
1690
+ /**
1691
+ * PSF Property Schema
1692
+ */
1693
+ interface PSFPropertySchema {
1694
+ /** Property type */
1695
+ type: PSFFieldType | 'string' | 'number' | 'boolean' | 'array' | 'object';
1696
+ /** Description */
1697
+ description?: string;
1698
+ /** Default value */
1699
+ default?: unknown;
1700
+ /** Array items schema */
1701
+ items?: PSFPropertySchema;
1702
+ /** Nested properties (for object type) */
1703
+ properties?: Record<string, PSFPropertySchema>;
1704
+ }
1705
+ /**
1706
+ * PSF Canvas Layout (for visual editor)
1707
+ */
1708
+ interface PSFCanvasLayout {
1709
+ /** Viewport settings */
1710
+ viewport?: {
1711
+ x: number;
1712
+ y: number;
1713
+ zoom: number;
1714
+ };
1715
+ /** Grid settings */
1716
+ grid?: {
1717
+ enabled: boolean;
1718
+ size: number;
1719
+ snap: boolean;
1720
+ };
1721
+ /** Node groups */
1722
+ groups?: PSFCanvasGroup[];
1723
+ /** Connections between nodes */
1724
+ connections?: PSFCanvasConnection[];
1725
+ }
1726
+ /**
1727
+ * PSF Canvas Group
1728
+ */
1729
+ interface PSFCanvasGroup {
1730
+ /** Group identifier */
1731
+ id: string;
1732
+ /** Group name */
1733
+ name: string;
1734
+ /** Color */
1735
+ color?: string;
1736
+ /** Collapsed state */
1737
+ collapsed?: boolean;
1738
+ /** Position */
1739
+ position: PSFPosition;
1740
+ /** Member node IDs */
1741
+ members: string[];
1742
+ }
1743
+ /**
1744
+ * PSF Canvas Connection
1745
+ */
1746
+ interface PSFCanvasConnection {
1747
+ /** Connection identifier */
1748
+ id: string;
1749
+ /** Source node ID */
1750
+ source: string;
1751
+ /** Source port */
1752
+ sourcePort?: string;
1753
+ /** Target node ID */
1754
+ target: string;
1755
+ /** Target port */
1756
+ targetPort?: string;
1757
+ /** Connection type */
1758
+ type?: 'data' | 'control' | 'event';
1759
+ /** Label */
1760
+ label?: string;
1761
+ }
1762
+
1763
+ /**
1764
+ * CodeCanvas Integration
1765
+ *
1766
+ * Integration with plures/code-canvas - A visual schema editor and FSM enforcement tool.
1767
+ * Provides visual editing capabilities for Praxis schemas and logic flows.
1768
+ *
1769
+ * Features:
1770
+ * - Visual Schema Editor: Drag-and-drop interface for schema design
1771
+ * - FSM Visualization: Mermaid and DOT graph generation
1772
+ * - State Lifecycle Management: Activity tracking and validation
1773
+ * - Canvas Export/Import: YAML and JSON Canvas formats
1774
+ * - Guardian Integration: Pre-commit validation and rules enforcement
1775
+ *
1776
+ * @see https://github.com/plures/code-canvas
1777
+ */
1778
+
1779
+ /**
1780
+ * Canvas node representing a visual element
1781
+ */
1782
+ interface CanvasNode {
1783
+ /** Unique node identifier */
1784
+ id: string;
1785
+ /** Node type */
1786
+ type: 'model' | 'component' | 'event' | 'fact' | 'rule' | 'constraint' | 'state' | 'transition';
1787
+ /** Node label/name */
1788
+ label: string;
1789
+ /** X position */
1790
+ x: number;
1791
+ /** Y position */
1792
+ y: number;
1793
+ /** Width */
1794
+ width: number;
1795
+ /** Height */
1796
+ height: number;
1797
+ /** Node data (model, component, etc.) */
1798
+ data?: unknown;
1799
+ /** Node style */
1800
+ style?: CanvasNodeStyle;
1801
+ /** FSM state reference */
1802
+ fsmState?: string;
1803
+ }
1804
+ /**
1805
+ * Canvas edge representing a connection between nodes
1806
+ */
1807
+ interface CanvasEdge {
1808
+ /** Unique edge identifier */
1809
+ id: string;
1810
+ /** Source node ID */
1811
+ source: string;
1812
+ /** Target node ID */
1813
+ target: string;
1814
+ /** Edge label */
1815
+ label?: string;
1816
+ /** Edge type */
1817
+ type?: 'dependency' | 'transition' | 'trigger' | 'reference' | 'event';
1818
+ /** Edge style */
1819
+ style?: CanvasEdgeStyle;
1820
+ }
1821
+ /**
1822
+ * Node style configuration
1823
+ */
1824
+ interface CanvasNodeStyle {
1825
+ /** Background color */
1826
+ backgroundColor?: string;
1827
+ /** Border color */
1828
+ borderColor?: string;
1829
+ /** Border width */
1830
+ borderWidth?: number;
1831
+ /** Text color */
1832
+ textColor?: string;
1833
+ /** Font size */
1834
+ fontSize?: number;
1835
+ /** Border radius */
1836
+ borderRadius?: number;
1837
+ }
1838
+ /**
1839
+ * Edge style configuration
1840
+ */
1841
+ interface CanvasEdgeStyle {
1842
+ /** Stroke color */
1843
+ strokeColor?: string;
1844
+ /** Stroke width */
1845
+ strokeWidth?: number;
1846
+ /** Stroke style */
1847
+ strokeDasharray?: string;
1848
+ /** Arrow type */
1849
+ arrowType?: 'arrow' | 'none' | 'circle';
1850
+ }
1851
+ /**
1852
+ * Canvas document containing nodes and edges
1853
+ */
1854
+ interface CanvasDocument {
1855
+ /** Document identifier */
1856
+ id: string;
1857
+ /** Document name */
1858
+ name: string;
1859
+ /** Document version */
1860
+ version: string;
1861
+ /** All nodes in the canvas */
1862
+ nodes: CanvasNode[];
1863
+ /** All edges in the canvas */
1864
+ edges: CanvasEdge[];
1865
+ /** Logic flows */
1866
+ flows?: PSFFlow[];
1867
+ /** Document metadata */
1868
+ metadata?: {
1869
+ created: number;
1870
+ modified: number;
1871
+ author?: string;
1872
+ description?: string;
1873
+ };
1874
+ /** Viewport settings */
1875
+ viewport?: {
1876
+ x: number;
1877
+ y: number;
1878
+ zoom: number;
1879
+ };
1880
+ }
1881
+ /**
1882
+ * FSM lifecycle state
1883
+ */
1884
+ interface LifecycleState {
1885
+ /** State identifier */
1886
+ id: string;
1887
+ /** State name */
1888
+ name: string;
1889
+ /** State description */
1890
+ description?: string;
1891
+ /** Allowed transitions from this state */
1892
+ transitions: string[];
1893
+ /** Entry actions */
1894
+ onEntry?: string[];
1895
+ /** Exit actions */
1896
+ onExit?: string[];
1897
+ /** Is this an initial state */
1898
+ initial?: boolean;
1899
+ /** Is this a final state */
1900
+ final?: boolean;
1901
+ }
1902
+ /**
1903
+ * Activity tracking for current work context
1904
+ */
1905
+ interface ActivityState {
1906
+ /** Current activity type */
1907
+ activity: 'designing' | 'implementing' | 'testing' | 'documenting' | 'reviewing';
1908
+ /** Actor performing the activity */
1909
+ actor: string;
1910
+ /** Current intent/goal */
1911
+ intent?: string;
1912
+ /** Started timestamp */
1913
+ startedAt: number;
1914
+ /** Allowed file patterns for this activity */
1915
+ allowedPaths?: string[];
1916
+ }
1917
+ /**
1918
+ * Canvas editor configuration
1919
+ */
1920
+ interface CanvasEditorConfig {
1921
+ /** Canvas document to edit */
1922
+ document?: CanvasDocument;
1923
+ /** Schema to visualize */
1924
+ schema?: PSFSchema;
1925
+ /** Enable FSM validation */
1926
+ enableFSM?: boolean;
1927
+ /** Custom node styles by type */
1928
+ nodeStyles?: Record<string, CanvasNodeStyle>;
1929
+ /** Custom edge styles by type */
1930
+ edgeStyles?: Record<string, CanvasEdgeStyle>;
1931
+ /** Auto-layout algorithm */
1932
+ layout?: 'hierarchical' | 'force' | 'grid' | 'circular';
1933
+ }
1934
+ /**
1935
+ * Guardian validation result
1936
+ */
1937
+ interface GuardianResult {
1938
+ /** Whether validation passed */
1939
+ valid: boolean;
1940
+ /** Validation errors */
1941
+ errors: GuardianError[];
1942
+ /** Validation warnings */
1943
+ warnings: GuardianWarning[];
1944
+ /** Files validated */
1945
+ filesChecked: string[];
1946
+ /** Current activity state */
1947
+ activity?: ActivityState;
1948
+ }
1949
+ /**
1950
+ * Guardian validation error
1951
+ */
1952
+ interface GuardianError {
1953
+ /** Error code */
1954
+ code: string;
1955
+ /** Error message */
1956
+ message: string;
1957
+ /** File path (if applicable) */
1958
+ file?: string;
1959
+ /** Line number (if applicable) */
1960
+ line?: number;
1961
+ /** Rule that was violated */
1962
+ rule?: string;
1963
+ }
1964
+ /**
1965
+ * Guardian validation warning
1966
+ */
1967
+ interface GuardianWarning {
1968
+ /** Warning code */
1969
+ code: string;
1970
+ /** Warning message */
1971
+ message: string;
1972
+ /** File path (if applicable) */
1973
+ file?: string;
1974
+ /** Suggestion for resolution */
1975
+ suggestion?: string;
1976
+ }
1977
+ /**
1978
+ * Create a canvas document from a Praxis schema
1979
+ *
1980
+ * @example
1981
+ * ```typescript
1982
+ * import { schemaToCanvas } from '@plures/praxis/integrations/code-canvas';
1983
+ *
1984
+ * const canvas = schemaToCanvas(mySchema, {
1985
+ * layout: 'hierarchical',
1986
+ * });
1987
+ *
1988
+ * // Export to YAML
1989
+ * const yaml = canvasToYaml(canvas);
1990
+ * ```
1991
+ */
1992
+ declare function schemaToCanvas(schema: PSFSchema, _options?: {
1993
+ layout?: 'hierarchical' | 'force' | 'grid' | 'circular';
1994
+ }): CanvasDocument;
1995
+ /**
1996
+ * Convert a canvas document back to a Praxis schema
1997
+ */
1998
+ declare function canvasToSchema(canvas: CanvasDocument): PSFSchema;
1999
+ /**
2000
+ * Export canvas to YAML format (compatible with Obsidian Canvas)
2001
+ */
2002
+ declare function canvasToYaml(canvas: CanvasDocument): string;
2003
+ /**
2004
+ * Export canvas to Mermaid diagram format
2005
+ */
2006
+ declare function canvasToMermaid(canvas: CanvasDocument): string;
2007
+ /**
2008
+ * Validate files against FSM lifecycle rules
2009
+ *
2010
+ * This provides integration with the CodeCanvas Guardian for pre-commit validation.
2011
+ */
2012
+ declare function validateWithGuardian(files: string[], activity: ActivityState, lifecycle: LifecycleState[]): GuardianResult;
2013
+ /**
2014
+ * Create a CodeCanvas editor instance
2015
+ *
2016
+ * Note: This is a placeholder for the visual editor integration.
2017
+ * The actual visual editor requires a browser environment.
2018
+ */
2019
+ declare function createCanvasEditor(config: CanvasEditorConfig): {
2020
+ document: CanvasDocument;
2021
+ addNode: (node: Omit<CanvasNode, 'id'>) => CanvasNode;
2022
+ removeNode: (id: string) => void;
2023
+ addEdge: (edge: Omit<CanvasEdge, 'id'>) => CanvasEdge;
2024
+ removeEdge: (id: string) => void;
2025
+ toSchema: () => PSFSchema;
2026
+ toYaml: () => string;
2027
+ toMermaid: () => string;
2028
+ };
2029
+
2030
+ /**
2031
+ * State-Docs Integration
2032
+ *
2033
+ * Integration with plures/state-docs - FSM documentation generator for XState projects.
2034
+ * Generates Markdown and Mermaid documentation from Praxis state machines and logic.
2035
+ *
2036
+ * Features:
2037
+ * - Auto-generate documentation from Praxis schemas
2038
+ * - Markdown output with Mermaid diagrams
2039
+ * - State machine visualization
2040
+ * - Transition documentation
2041
+ * - Integration with Praxis logic engine
2042
+ *
2043
+ * @see https://github.com/plures/state-docs
2044
+ */
2045
+
2046
+ /**
2047
+ * State-Docs configuration
2048
+ */
2049
+ interface StateDocsConfig {
2050
+ /** Project title */
2051
+ projectTitle: string;
2052
+ /** Source directory containing schemas */
2053
+ source?: string;
2054
+ /** Target directory for generated docs */
2055
+ target?: string;
2056
+ /** File patterns to include */
2057
+ globs?: string[];
2058
+ /** Visualization settings */
2059
+ visualization?: {
2060
+ /** Output format */
2061
+ format?: 'mermaid' | 'dot';
2062
+ /** Export as PNG */
2063
+ exportPng?: boolean;
2064
+ /** Diagram theme */
2065
+ theme?: 'default' | 'dark' | 'forest' | 'neutral';
2066
+ };
2067
+ /** Template settings */
2068
+ template?: {
2069
+ /** Include table of contents */
2070
+ toc?: boolean;
2071
+ /** Include timestamp */
2072
+ timestamp?: boolean;
2073
+ /** Custom header content */
2074
+ header?: string;
2075
+ /** Custom footer content */
2076
+ footer?: string;
2077
+ };
2078
+ }
2079
+ /**
2080
+ * Generated documentation file
2081
+ */
2082
+ interface GeneratedDoc {
2083
+ /** File path */
2084
+ path: string;
2085
+ /** File content */
2086
+ content: string;
2087
+ /** File type */
2088
+ type: 'markdown' | 'mermaid' | 'dot' | 'json';
2089
+ }
2090
+ /**
2091
+ * State machine representation for documentation
2092
+ */
2093
+ interface StateMachineDoc {
2094
+ /** Machine identifier */
2095
+ id: string;
2096
+ /** Machine name */
2097
+ name: string;
2098
+ /** Machine description */
2099
+ description?: string;
2100
+ /** Initial state */
2101
+ initial?: string;
2102
+ /** All states */
2103
+ states: StateDoc[];
2104
+ /** All transitions */
2105
+ transitions: TransitionDoc[];
2106
+ /** Context type description */
2107
+ context?: string;
2108
+ /** Events that this machine handles */
2109
+ events?: string[];
2110
+ }
2111
+ /**
2112
+ * State documentation
2113
+ */
2114
+ interface StateDoc {
2115
+ /** State identifier */
2116
+ id: string;
2117
+ /** State name */
2118
+ name: string;
2119
+ /** State description */
2120
+ description?: string;
2121
+ /** Is this an initial state */
2122
+ initial?: boolean;
2123
+ /** Is this a final state */
2124
+ final?: boolean;
2125
+ /** Entry actions */
2126
+ onEntry?: string[];
2127
+ /** Exit actions */
2128
+ onExit?: string[];
2129
+ /** State tags */
2130
+ tags?: string[];
2131
+ }
2132
+ /**
2133
+ * Transition documentation
2134
+ */
2135
+ interface TransitionDoc {
2136
+ /** Source state */
2137
+ from: string;
2138
+ /** Target state */
2139
+ to: string;
2140
+ /** Event that triggers the transition */
2141
+ event: string;
2142
+ /** Transition guard condition */
2143
+ guard?: string;
2144
+ /** Actions executed during transition */
2145
+ actions?: string[];
2146
+ /** Transition description */
2147
+ description?: string;
2148
+ }
2149
+ /**
2150
+ * Documentation generator for Praxis schemas
2151
+ */
2152
+ declare class StateDocsGenerator {
2153
+ private config;
2154
+ constructor(config: StateDocsConfig);
2155
+ /**
2156
+ * Generate documentation from a Praxis schema
2157
+ */
2158
+ generateFromSchema(schema: PraxisSchema): GeneratedDoc[];
2159
+ /**
2160
+ * Generate documentation from a Praxis registry
2161
+ */
2162
+ generateFromModule<TContext>(module: PraxisModule<TContext>): GeneratedDoc[];
2163
+ /**
2164
+ * Generate the main schema README
2165
+ */
2166
+ private generateSchemaReadme;
2167
+ /**
2168
+ * Generate models documentation
2169
+ */
2170
+ private generateModelsDoc;
2171
+ /**
2172
+ * Generate components documentation
2173
+ */
2174
+ private generateComponentsDoc;
2175
+ /**
2176
+ * Generate logic documentation
2177
+ */
2178
+ private generateLogicDoc;
2179
+ /**
2180
+ * Generate Mermaid diagram for logic
2181
+ */
2182
+ private generateLogicDiagram;
2183
+ /**
2184
+ * Generate rules documentation
2185
+ */
2186
+ private generateRulesDoc;
2187
+ /**
2188
+ * Generate constraints documentation
2189
+ */
2190
+ private generateConstraintsDoc;
2191
+ /**
2192
+ * Generate state diagram from registry
2193
+ */
2194
+ private generateRegistryDiagram;
2195
+ }
2196
+ /**
2197
+ * Create a State-Docs generator instance
2198
+ *
2199
+ * @example
2200
+ * ```typescript
2201
+ * import { createStateDocsGenerator } from '@plures/praxis/integrations/state-docs';
2202
+ *
2203
+ * const generator = createStateDocsGenerator({
2204
+ * projectTitle: 'My Project',
2205
+ * target: './docs/api',
2206
+ * });
2207
+ *
2208
+ * const docs = generator.generateFromSchema(mySchema);
2209
+ * for (const doc of docs) {
2210
+ * await writeFile(doc.path, doc.content);
2211
+ * }
2212
+ * ```
2213
+ */
2214
+ declare function createStateDocsGenerator(config: StateDocsConfig): StateDocsGenerator;
2215
+ /**
2216
+ * Generate documentation from a schema (convenience function)
2217
+ */
2218
+ declare function generateDocs(schema: PraxisSchema, config: StateDocsConfig): GeneratedDoc[];
2219
+
2220
+ /**
2221
+ * Tauri Integration
2222
+ *
2223
+ * Integration with plures/svelte-tauri-template for cross-platform desktop applications.
2224
+ * Provides Praxis engine integration with Tauri 2 for native desktop capabilities.
2225
+ *
2226
+ * Features:
2227
+ * - Cross-Platform: Windows, macOS, Linux, Android, iOS
2228
+ * - Native Integration: File system, system tray, notifications
2229
+ * - IPC Bridge: Type-safe communication between Rust and TypeScript
2230
+ * - Auto-Updates: Built-in update system
2231
+ * - Code Signing: Support for signed releases
2232
+ *
2233
+ * @see https://github.com/plures/svelte-tauri-template
2234
+ */
2235
+
2236
+ /**
2237
+ * Tauri app configuration
2238
+ */
2239
+ interface TauriAppConfig {
2240
+ /** Application name */
2241
+ name: string;
2242
+ /** Application version */
2243
+ version: string;
2244
+ /** Application identifier (e.g., com.example.myapp) */
2245
+ identifier: string;
2246
+ /** Window configuration */
2247
+ window?: TauriWindowConfig;
2248
+ /** Security configuration */
2249
+ security?: TauriSecurityConfig;
2250
+ /** Update configuration */
2251
+ updates?: TauriUpdateConfig;
2252
+ /** Plugins to enable */
2253
+ plugins?: TauriPlugin[];
2254
+ }
2255
+ /**
2256
+ * Window configuration
2257
+ */
2258
+ interface TauriWindowConfig {
2259
+ /** Window title */
2260
+ title?: string;
2261
+ /** Window width */
2262
+ width?: number;
2263
+ /** Window height */
2264
+ height?: number;
2265
+ /** Minimum width */
2266
+ minWidth?: number;
2267
+ /** Minimum height */
2268
+ minHeight?: number;
2269
+ /** Whether window is resizable */
2270
+ resizable?: boolean;
2271
+ /** Whether window is fullscreen */
2272
+ fullscreen?: boolean;
2273
+ /** Whether to show title bar */
2274
+ decorations?: boolean;
2275
+ /** Whether window is transparent */
2276
+ transparent?: boolean;
2277
+ /** Whether to always be on top */
2278
+ alwaysOnTop?: boolean;
2279
+ /** Center window on screen */
2280
+ center?: boolean;
2281
+ }
2282
+ /**
2283
+ * Security configuration
2284
+ */
2285
+ interface TauriSecurityConfig {
2286
+ /** Content Security Policy */
2287
+ csp?: string;
2288
+ /** Allowed domains for fetch */
2289
+ allowedDomains?: string[];
2290
+ /** Enable dev tools in production */
2291
+ devTools?: boolean;
2292
+ /** Dangerous features to allow */
2293
+ dangerousAllowList?: string[];
2294
+ }
2295
+ /**
2296
+ * Auto-update configuration
2297
+ */
2298
+ interface TauriUpdateConfig {
2299
+ /** Enable auto-updates */
2300
+ enabled: boolean;
2301
+ /** Update endpoint URL */
2302
+ endpoint?: string;
2303
+ /** Update check interval (ms) */
2304
+ checkInterval?: number;
2305
+ /** Whether to install silently */
2306
+ silent?: boolean;
2307
+ /** Public key for update verification */
2308
+ publicKey?: string;
2309
+ }
2310
+ /**
2311
+ * Tauri plugin definition
2312
+ */
2313
+ interface TauriPlugin {
2314
+ /** Plugin name */
2315
+ name: string;
2316
+ /** Plugin version */
2317
+ version?: string;
2318
+ /** Plugin configuration */
2319
+ config?: Record<string, unknown>;
2320
+ }
2321
+ /**
2322
+ * IPC message from frontend to backend
2323
+ */
2324
+ interface TauriCommand<T = unknown> {
2325
+ /** Command name */
2326
+ cmd: string;
2327
+ /** Command payload */
2328
+ payload?: T;
2329
+ }
2330
+ /**
2331
+ * IPC event from backend to frontend
2332
+ */
2333
+ interface TauriEvent<T = unknown> {
2334
+ /** Event name */
2335
+ event: string;
2336
+ /** Event payload */
2337
+ payload?: T;
2338
+ /** Window label that emitted the event */
2339
+ windowLabel?: string;
2340
+ }
2341
+ /**
2342
+ * File system operations
2343
+ */
2344
+ interface TauriFS {
2345
+ /** Read a file */
2346
+ readFile(path: string): Promise<Uint8Array>;
2347
+ /** Read a file as text */
2348
+ readTextFile(path: string): Promise<string>;
2349
+ /** Write to a file */
2350
+ writeFile(path: string, data: Uint8Array): Promise<void>;
2351
+ /** Write text to a file */
2352
+ writeTextFile(path: string, data: string): Promise<void>;
2353
+ /** Check if path exists */
2354
+ exists(path: string): Promise<boolean>;
2355
+ /** Create directory */
2356
+ mkdir(path: string, options?: {
2357
+ recursive?: boolean;
2358
+ }): Promise<void>;
2359
+ /** Remove file or directory */
2360
+ remove(path: string, options?: {
2361
+ recursive?: boolean;
2362
+ }): Promise<void>;
2363
+ /** Rename/move file */
2364
+ rename(oldPath: string, newPath: string): Promise<void>;
2365
+ /** List directory contents */
2366
+ readDir(path: string): Promise<TauriFileEntry[]>;
2367
+ }
2368
+ /**
2369
+ * File entry from directory listing
2370
+ */
2371
+ interface TauriFileEntry {
2372
+ /** File name */
2373
+ name: string;
2374
+ /** Full path */
2375
+ path: string;
2376
+ /** Is directory */
2377
+ isDirectory: boolean;
2378
+ /** Is file */
2379
+ isFile: boolean;
2380
+ /** File size in bytes */
2381
+ size?: number;
2382
+ /** Last modified timestamp */
2383
+ modifiedAt?: number;
2384
+ }
2385
+ /**
2386
+ * System tray operations
2387
+ */
2388
+ interface TauriTray {
2389
+ /** Set tray icon */
2390
+ setIcon(icon: string | Uint8Array): Promise<void>;
2391
+ /** Set tray tooltip */
2392
+ setTooltip(tooltip: string): Promise<void>;
2393
+ /** Set tray menu */
2394
+ setMenu(menu: TauriMenuItem[]): Promise<void>;
2395
+ /** Show tray */
2396
+ show(): Promise<void>;
2397
+ /** Hide tray */
2398
+ hide(): Promise<void>;
2399
+ }
2400
+ /**
2401
+ * Tray menu item
2402
+ */
2403
+ interface TauriMenuItem {
2404
+ /** Item ID */
2405
+ id: string;
2406
+ /** Item label */
2407
+ label: string;
2408
+ /** Is item enabled */
2409
+ enabled?: boolean;
2410
+ /** Is item checked (for checkboxes) */
2411
+ checked?: boolean;
2412
+ /** Submenu items */
2413
+ submenu?: TauriMenuItem[];
2414
+ /** Click handler */
2415
+ onClick?: () => void;
2416
+ }
2417
+ /**
2418
+ * Notification API
2419
+ */
2420
+ interface TauriNotification {
2421
+ /** Send a notification */
2422
+ send(options: TauriNotificationOptions): Promise<void>;
2423
+ /** Request notification permission */
2424
+ requestPermission(): Promise<'granted' | 'denied' | 'default'>;
2425
+ /** Check notification permission */
2426
+ checkPermission(): Promise<'granted' | 'denied' | 'default'>;
2427
+ }
2428
+ /**
2429
+ * Notification options
2430
+ */
2431
+ interface TauriNotificationOptions {
2432
+ /** Notification title */
2433
+ title: string;
2434
+ /** Notification body */
2435
+ body?: string;
2436
+ /** Notification icon */
2437
+ icon?: string;
2438
+ /** Sound to play */
2439
+ sound?: string;
2440
+ }
2441
+ /**
2442
+ * Tauri bridge for Praxis integration
2443
+ *
2444
+ * Provides type-safe access to Tauri APIs from Praxis applications.
2445
+ */
2446
+ interface TauriBridge {
2447
+ /** Application info */
2448
+ app: {
2449
+ name: string;
2450
+ version: string;
2451
+ tauriVersion: string;
2452
+ };
2453
+ /** File system operations */
2454
+ fs: TauriFS;
2455
+ /** System tray operations */
2456
+ tray: TauriTray;
2457
+ /** Notification operations */
2458
+ notification: TauriNotification;
2459
+ /** Invoke a Tauri command */
2460
+ invoke<T = unknown>(cmd: string, payload?: unknown): Promise<T>;
2461
+ /** Listen to a Tauri event */
2462
+ listen<T = unknown>(event: string, handler: (event: TauriEvent<T>) => void): Promise<() => void>;
2463
+ /** Emit a Tauri event */
2464
+ emit(event: string, payload?: unknown): Promise<void>;
2465
+ /** Get window operations */
2466
+ window: {
2467
+ /** Minimize window */
2468
+ minimize(): Promise<void>;
2469
+ /** Maximize window */
2470
+ maximize(): Promise<void>;
2471
+ /** Unmaximize window */
2472
+ unmaximize(): Promise<void>;
2473
+ /** Close window */
2474
+ close(): Promise<void>;
2475
+ /** Toggle fullscreen */
2476
+ toggleFullscreen(): Promise<void>;
2477
+ /** Set window title */
2478
+ setTitle(title: string): Promise<void>;
2479
+ /** Show window */
2480
+ show(): Promise<void>;
2481
+ /** Hide window */
2482
+ hide(): Promise<void>;
2483
+ /** Focus window */
2484
+ focus(): Promise<void>;
2485
+ };
2486
+ /** Check for updates */
2487
+ checkForUpdates(): Promise<TauriUpdateInfo | null>;
2488
+ /** Install update */
2489
+ installUpdate(): Promise<void>;
2490
+ }
2491
+ /**
2492
+ * Update information
2493
+ */
2494
+ interface TauriUpdateInfo {
2495
+ /** New version available */
2496
+ version: string;
2497
+ /** Release date */
2498
+ date: string;
2499
+ /** Release notes */
2500
+ notes?: string;
2501
+ /** Download URL */
2502
+ url: string;
2503
+ }
2504
+ /**
2505
+ * Praxis-Tauri adapter for engine persistence
2506
+ */
2507
+ interface TauriPraxisAdapter<TContext = unknown> {
2508
+ /** Save engine state to file */
2509
+ saveState(state: TContext): Promise<void>;
2510
+ /** Load engine state from file */
2511
+ loadState(): Promise<TContext | null>;
2512
+ /** Save events to file */
2513
+ saveEvents(events: PraxisEvent[]): Promise<void>;
2514
+ /** Load events from file */
2515
+ loadEvents(): Promise<PraxisEvent[]>;
2516
+ /** Watch for file changes */
2517
+ watchStateFile(handler: (state: TContext) => void): Promise<() => void>;
2518
+ /** Get state file path */
2519
+ getStatePath(): string;
2520
+ /** Get events file path */
2521
+ getEventsPath(): string;
2522
+ }
2523
+ /**
2524
+ * Create a mock Tauri bridge for development/testing
2525
+ *
2526
+ * This provides a mock implementation that works without Tauri runtime.
2527
+ */
2528
+ declare function createMockTauriBridge(): TauriBridge;
2529
+ /**
2530
+ * Create a Tauri-Praxis adapter for engine persistence
2531
+ *
2532
+ * @example
2533
+ * ```typescript
2534
+ * import { createTauriPraxisAdapter } from '@plures/praxis/integrations/tauri';
2535
+ *
2536
+ * const adapter = createTauriPraxisAdapter({
2537
+ * bridge: tauriBridge,
2538
+ * statePath: 'app-state.json',
2539
+ * eventsPath: 'app-events.json',
2540
+ * });
2541
+ *
2542
+ * // Save state
2543
+ * await adapter.saveState(engine.getContext());
2544
+ *
2545
+ * // Load state
2546
+ * const savedState = await adapter.loadState();
2547
+ * ```
2548
+ */
2549
+ declare function createTauriPraxisAdapter<TContext = unknown>(options: {
2550
+ bridge: TauriBridge;
2551
+ statePath?: string;
2552
+ eventsPath?: string;
2553
+ }): TauriPraxisAdapter<TContext>;
2554
+ /**
2555
+ * Attach Tauri bridge to a Praxis engine for auto-save
2556
+ *
2557
+ * @example
2558
+ * ```typescript
2559
+ * import { attachTauriToEngine } from '@plures/praxis/integrations/tauri';
2560
+ *
2561
+ * const cleanup = attachTauriToEngine(engine, adapter, {
2562
+ * autoSave: true,
2563
+ * saveInterval: 5000,
2564
+ * });
2565
+ *
2566
+ * // Later, cleanup subscriptions
2567
+ * cleanup();
2568
+ * ```
2569
+ */
2570
+ declare function attachTauriToEngine<TContext>(engine: LogicEngine<TContext>, adapter: TauriPraxisAdapter<TContext>, options?: {
2571
+ autoSave?: boolean;
2572
+ saveInterval?: number;
2573
+ }): () => void;
2574
+ /**
2575
+ * Generate Tauri configuration from Praxis app config
2576
+ */
2577
+ declare function generateTauriConfig(config: TauriAppConfig): Record<string, unknown>;
2578
+
2579
+ export { type ActivityState, type Actor, ActorManager, type CanvasDocument, type CanvasEdge, type CanvasEdgeStyle, type CanvasEditorConfig, type CanvasNode, type CanvasNodeStyle, ComponentDefinition, ConstraintDescriptor, ConstraintFn, type ConstraintNode, type ConstraintSchema, type DefineConstraintOptions, type DefineModuleOptions, type DefineRuleOptions, type EventDefinition, type EventStreamEntry, type FactDefinition, type GeneratedDoc, type GeneratedPluresDBFile, type GraphEdge, type GuardianError, type GuardianResult, type GuardianWarning, type LifecycleState, type LoaderOptions, type LoaderResult, LogicDefinition, LogicEngine, ModelDefinition, PRAXIS_PATHS, type PluresDBAdapter, type PluresDBAdapterOptions, PluresDBGenerator, type PluresDBGeneratorOptions, PraxisDB, PraxisDBStore, type PraxisDBStoreOptions, PraxisEvent, PraxisFact, PraxisModule, PraxisRegistry, PraxisSchema, PraxisSchemaRegistry, PraxisState, type ReactiveEngineOptions, ReactiveLogicEngine, type RegistryGraph, RegistryIntrospector, type RegistrySchema, type RegistryStats, RuleDescriptor, RuleFn, type RuleNode, type RuleSchema, 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 TransitionDoc, UnsubscribeFn, type UnumAdapter, type UnumAdapterConfig, type UnumChannel, type UnumIdentity, type UnumMessage, type UnumStore, ValidationResult, attachTauriToEngine, attachToEngine, attachUnumToEngine, canvasToMermaid, canvasToSchema, canvasToYaml, createCanvasEditor, createIntrospector, createMockTauriBridge, createPluresDBAdapter, createPluresDBGenerator, createPraxisDBStore, createSchemaRegistry, createStateDocsGenerator, createTauriPraxisAdapter, createTimerActor, createUnumAdapter, defineConstraint, defineEvent, defineFact, defineModule, defineRule, filterEvents, filterFacts, findEvent, findFact, generateDocs, generateId, generateTauriConfig, getEventPath, getFactPath, getSchemaPath, loadSchema, loadSchemaFromFile, loadSchemaFromJson, loadSchemaFromYaml, registerSchema, schemaToCanvas, validateForGeneration, validateWithGuardian };