worldvm 0.0.0-stage → 0.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 (426) hide show
  1. package/AUTHORING.md +833 -0
  2. package/README.md +154 -2
  3. package/bin/worldvm.mjs +3 -0
  4. package/dist/_internal/forma/index.d.ts +1 -0
  5. package/dist/_internal/forma/index.js +1 -0
  6. package/dist/_internal/forma/world/authoring-help.d.ts +25 -0
  7. package/dist/_internal/forma/world/authoring-help.js +130 -0
  8. package/dist/_internal/forma/world/citations.d.ts +3 -0
  9. package/dist/_internal/forma/world/citations.js +26 -0
  10. package/dist/_internal/forma/world/clock-bindings.d.ts +4 -0
  11. package/dist/_internal/forma/world/clock-bindings.js +45 -0
  12. package/dist/_internal/forma/world/compile.d.ts +13 -0
  13. package/dist/_internal/forma/world/compile.js +190 -0
  14. package/dist/_internal/forma/world/coverage.d.ts +10 -0
  15. package/dist/_internal/forma/world/coverage.js +242 -0
  16. package/dist/_internal/forma/world/digest.d.ts +1 -0
  17. package/dist/_internal/forma/world/digest.js +1 -0
  18. package/dist/_internal/forma/world/documentation.d.ts +3 -0
  19. package/dist/_internal/forma/world/documentation.js +38 -0
  20. package/dist/_internal/forma/world/homes.d.ts +4 -0
  21. package/dist/_internal/forma/world/homes.js +202 -0
  22. package/dist/_internal/forma/world/index.d.ts +6 -0
  23. package/dist/_internal/forma/world/index.js +5 -0
  24. package/dist/_internal/forma/world/lowering/accounts.d.ts +4 -0
  25. package/dist/_internal/forma/world/lowering/accounts.js +36 -0
  26. package/dist/_internal/forma/world/lowering/action-policy.d.ts +5 -0
  27. package/dist/_internal/forma/world/lowering/action-policy.js +16 -0
  28. package/dist/_internal/forma/world/lowering/agents.d.ts +6 -0
  29. package/dist/_internal/forma/world/lowering/agents.js +116 -0
  30. package/dist/_internal/forma/world/lowering/bundles.d.ts +3 -0
  31. package/dist/_internal/forma/world/lowering/bundles.js +13 -0
  32. package/dist/_internal/forma/world/lowering/child-parameters.d.ts +14 -0
  33. package/dist/_internal/forma/world/lowering/child-parameters.js +36 -0
  34. package/dist/_internal/forma/world/lowering/collects.d.ts +3 -0
  35. package/dist/_internal/forma/world/lowering/collects.js +51 -0
  36. package/dist/_internal/forma/world/lowering/component-operations.d.ts +6 -0
  37. package/dist/_internal/forma/world/lowering/component-operations.js +26 -0
  38. package/dist/_internal/forma/world/lowering/components.d.ts +7 -0
  39. package/dist/_internal/forma/world/lowering/components.js +236 -0
  40. package/dist/_internal/forma/world/lowering/connectors.d.ts +4 -0
  41. package/dist/_internal/forma/world/lowering/connectors.js +31 -0
  42. package/dist/_internal/forma/world/lowering/context.d.ts +80 -0
  43. package/dist/_internal/forma/world/lowering/context.js +316 -0
  44. package/dist/_internal/forma/world/lowering/contracts.d.ts +7 -0
  45. package/dist/_internal/forma/world/lowering/contracts.js +73 -0
  46. package/dist/_internal/forma/world/lowering/decisions.d.ts +3 -0
  47. package/dist/_internal/forma/world/lowering/decisions.js +164 -0
  48. package/dist/_internal/forma/world/lowering/derives.d.ts +3 -0
  49. package/dist/_internal/forma/world/lowering/derives.js +22 -0
  50. package/dist/_internal/forma/world/lowering/discretionary.d.ts +7 -0
  51. package/dist/_internal/forma/world/lowering/discretionary.js +15 -0
  52. package/dist/_internal/forma/world/lowering/documents.d.ts +3 -0
  53. package/dist/_internal/forma/world/lowering/documents.js +68 -0
  54. package/dist/_internal/forma/world/lowering/effective.d.ts +5 -0
  55. package/dist/_internal/forma/world/lowering/effective.js +26 -0
  56. package/dist/_internal/forma/world/lowering/entities.d.ts +3 -0
  57. package/dist/_internal/forma/world/lowering/entities.js +43 -0
  58. package/dist/_internal/forma/world/lowering/escalations.d.ts +6 -0
  59. package/dist/_internal/forma/world/lowering/escalations.js +31 -0
  60. package/dist/_internal/forma/world/lowering/evidence.d.ts +3 -0
  61. package/dist/_internal/forma/world/lowering/evidence.js +75 -0
  62. package/dist/_internal/forma/world/lowering/files.d.ts +4 -0
  63. package/dist/_internal/forma/world/lowering/files.js +56 -0
  64. package/dist/_internal/forma/world/lowering/holds.d.ts +6 -0
  65. package/dist/_internal/forma/world/lowering/holds.js +35 -0
  66. package/dist/_internal/forma/world/lowering/index.d.ts +89 -0
  67. package/dist/_internal/forma/world/lowering/index.js +115 -0
  68. package/dist/_internal/forma/world/lowering/interactions.d.ts +7 -0
  69. package/dist/_internal/forma/world/lowering/interactions.js +190 -0
  70. package/dist/_internal/forma/world/lowering/library.d.ts +5 -0
  71. package/dist/_internal/forma/world/lowering/library.js +41 -0
  72. package/dist/_internal/forma/world/lowering/milestones.d.ts +6 -0
  73. package/dist/_internal/forma/world/lowering/milestones.js +17 -0
  74. package/dist/_internal/forma/world/lowering/notices.d.ts +3 -0
  75. package/dist/_internal/forma/world/lowering/notices.js +33 -0
  76. package/dist/_internal/forma/world/lowering/param-bounds.d.ts +15 -0
  77. package/dist/_internal/forma/world/lowering/param-bounds.js +71 -0
  78. package/dist/_internal/forma/world/lowering/policies.d.ts +6 -0
  79. package/dist/_internal/forma/world/lowering/policies.js +95 -0
  80. package/dist/_internal/forma/world/lowering/principals.d.ts +62 -0
  81. package/dist/_internal/forma/world/lowering/principals.js +32 -0
  82. package/dist/_internal/forma/world/lowering/recurrences.d.ts +9 -0
  83. package/dist/_internal/forma/world/lowering/recurrences.js +56 -0
  84. package/dist/_internal/forma/world/lowering/renewal.d.ts +5 -0
  85. package/dist/_internal/forma/world/lowering/renewal.js +21 -0
  86. package/dist/_internal/forma/world/lowering/resources.d.ts +6 -0
  87. package/dist/_internal/forma/world/lowering/resources.js +19 -0
  88. package/dist/_internal/forma/world/lowering/reuse.d.ts +5 -0
  89. package/dist/_internal/forma/world/lowering/reuse.js +75 -0
  90. package/dist/_internal/forma/world/lowering/sources.d.ts +10 -0
  91. package/dist/_internal/forma/world/lowering/sources.js +47 -0
  92. package/dist/_internal/forma/world/lowering/syntax.d.ts +84 -0
  93. package/dist/_internal/forma/world/lowering/syntax.js +94 -0
  94. package/dist/_internal/forma/world/lowering/vaults.d.ts +11 -0
  95. package/dist/_internal/forma/world/lowering/vaults.js +148 -0
  96. package/dist/_internal/forma/world/prelude.generated.d.ts +1 -0
  97. package/dist/_internal/forma/world/prelude.generated.js +2 -0
  98. package/dist/_internal/forma/world/properties.d.ts +9 -0
  99. package/dist/_internal/forma/world/properties.js +387 -0
  100. package/dist/_internal/forma/world/scenarios.d.ts +10 -0
  101. package/dist/_internal/forma/world/scenarios.js +757 -0
  102. package/dist/_internal/forma/world/sensitivity.d.ts +3 -0
  103. package/dist/_internal/forma/world/sensitivity.js +118 -0
  104. package/dist/_internal/forma/world/source-syntax.d.ts +6 -0
  105. package/dist/_internal/forma/world/source-syntax.js +27 -0
  106. package/dist/_internal/forma/world/status-handling.d.ts +3 -0
  107. package/dist/_internal/forma/world/status-handling.js +143 -0
  108. package/dist/_internal/forma/world/surface.d.ts +30 -0
  109. package/dist/_internal/forma/world/surface.js +213 -0
  110. package/dist/_internal/forma/world/table-expressions.d.ts +3 -0
  111. package/dist/_internal/forma/world/table-expressions.js +41 -0
  112. package/dist/_internal/forma-tools/index.d.ts +17 -0
  113. package/dist/_internal/forma-tools/index.js +124 -0
  114. package/dist/_internal/ir-checks/advances.d.ts +7 -0
  115. package/dist/_internal/ir-checks/advances.js +6 -0
  116. package/dist/_internal/ir-checks/agent-reads.d.ts +14 -0
  117. package/dist/_internal/ir-checks/agent-reads.js +118 -0
  118. package/dist/_internal/ir-checks/amendments.d.ts +3 -0
  119. package/dist/_internal/ir-checks/amendments.js +21 -0
  120. package/dist/_internal/ir-checks/canonical-json.d.ts +3 -0
  121. package/dist/_internal/ir-checks/canonical-json.js +85 -0
  122. package/dist/_internal/ir-checks/child-parameters.d.ts +2 -0
  123. package/dist/_internal/ir-checks/child-parameters.js +43 -0
  124. package/dist/_internal/ir-checks/clock-bindings.d.ts +3 -0
  125. package/dist/_internal/ir-checks/clock-bindings.js +43 -0
  126. package/dist/_internal/ir-checks/collect-types.d.ts +14 -0
  127. package/dist/_internal/ir-checks/collect-types.js +34 -0
  128. package/dist/_internal/ir-checks/component-operations.d.ts +4 -0
  129. package/dist/_internal/ir-checks/component-operations.js +23 -0
  130. package/dist/_internal/ir-checks/content-digest.d.ts +4 -0
  131. package/dist/_internal/ir-checks/content-digest.js +78 -0
  132. package/dist/_internal/ir-checks/contract-validation.d.ts +3 -0
  133. package/dist/_internal/ir-checks/contract-validation.js +307 -0
  134. package/dist/_internal/ir-checks/contracts.d.ts +25 -0
  135. package/dist/_internal/ir-checks/contracts.js +80 -0
  136. package/dist/_internal/ir-checks/dates.d.ts +2 -0
  137. package/dist/_internal/ir-checks/dates.js +7 -0
  138. package/dist/_internal/ir-checks/documents.d.ts +3 -0
  139. package/dist/_internal/ir-checks/documents.js +45 -0
  140. package/dist/_internal/ir-checks/evidence.d.ts +20 -0
  141. package/dist/_internal/ir-checks/evidence.js +56 -0
  142. package/dist/_internal/ir-checks/files.d.ts +7 -0
  143. package/dist/_internal/ir-checks/files.js +47 -0
  144. package/dist/_internal/ir-checks/index.d.ts +59 -0
  145. package/dist/_internal/ir-checks/index.js +166 -0
  146. package/dist/_internal/ir-checks/instants.d.ts +7 -0
  147. package/dist/_internal/ir-checks/instants.js +61 -0
  148. package/dist/_internal/ir-checks/notices.d.ts +4 -0
  149. package/dist/_internal/ir-checks/notices.js +58 -0
  150. package/dist/_internal/ir-checks/policy-bounds.d.ts +5 -0
  151. package/dist/_internal/ir-checks/policy-bounds.js +28 -0
  152. package/dist/_internal/ir-checks/principals.d.ts +26 -0
  153. package/dist/_internal/ir-checks/principals.js +162 -0
  154. package/dist/_internal/ir-checks/prior-cycle.d.ts +41 -0
  155. package/dist/_internal/ir-checks/prior-cycle.js +21 -0
  156. package/dist/_internal/ir-checks/read-classification.d.ts +12 -0
  157. package/dist/_internal/ir-checks/read-classification.js +67 -0
  158. package/dist/_internal/ir-checks/read-types.d.ts +2 -0
  159. package/dist/_internal/ir-checks/read-types.js +40 -0
  160. package/dist/_internal/ir-checks/resource-proofs.d.ts +4 -0
  161. package/dist/_internal/ir-checks/resource-proofs.js +98 -0
  162. package/dist/_internal/ir-checks/resources.d.ts +3 -0
  163. package/dist/_internal/ir-checks/resources.js +30 -0
  164. package/dist/_internal/ir-checks/reuse.d.ts +10 -0
  165. package/dist/_internal/ir-checks/reuse.js +99 -0
  166. package/dist/_internal/ir-checks/sealing.d.ts +14 -0
  167. package/dist/_internal/ir-checks/sealing.js +123 -0
  168. package/dist/_internal/ir-checks/sensitive-flow.d.ts +4 -0
  169. package/dist/_internal/ir-checks/sensitive-flow.js +240 -0
  170. package/dist/_internal/ir-checks/sensitivity.d.ts +19 -0
  171. package/dist/_internal/ir-checks/sensitivity.js +133 -0
  172. package/dist/_internal/ir-checks/signatures.d.ts +4 -0
  173. package/dist/_internal/ir-checks/signatures.js +22 -0
  174. package/dist/_internal/ir-checks/vaults.d.ts +10 -0
  175. package/dist/_internal/ir-checks/vaults.js +140 -0
  176. package/dist/_internal/protocol/index.d.ts +1234 -0
  177. package/dist/_internal/protocol/index.js +215 -0
  178. package/dist/_internal/reconciler/action-intents.d.ts +17 -0
  179. package/dist/_internal/reconciler/action-intents.js +161 -0
  180. package/dist/_internal/reconciler/actions.d.ts +7 -0
  181. package/dist/_internal/reconciler/actions.js +134 -0
  182. package/dist/_internal/reconciler/amendments.d.ts +12 -0
  183. package/dist/_internal/reconciler/amendments.js +52 -0
  184. package/dist/_internal/reconciler/basis.d.ts +253 -0
  185. package/dist/_internal/reconciler/basis.js +16 -0
  186. package/dist/_internal/reconciler/bundles.d.ts +22 -0
  187. package/dist/_internal/reconciler/bundles.js +110 -0
  188. package/dist/_internal/reconciler/change-detection.d.ts +5 -0
  189. package/dist/_internal/reconciler/change-detection.js +82 -0
  190. package/dist/_internal/reconciler/collection-rules.d.ts +7 -0
  191. package/dist/_internal/reconciler/collection-rules.js +46 -0
  192. package/dist/_internal/reconciler/collection-state.d.ts +11 -0
  193. package/dist/_internal/reconciler/collection-state.js +62 -0
  194. package/dist/_internal/reconciler/collection-values.d.ts +5 -0
  195. package/dist/_internal/reconciler/collection-values.js +60 -0
  196. package/dist/_internal/reconciler/collections.d.ts +35 -0
  197. package/dist/_internal/reconciler/collections.js +141 -0
  198. package/dist/_internal/reconciler/commands.d.ts +60 -0
  199. package/dist/_internal/reconciler/commands.js +468 -0
  200. package/dist/_internal/reconciler/component-operations.d.ts +48 -0
  201. package/dist/_internal/reconciler/component-operations.js +256 -0
  202. package/dist/_internal/reconciler/context.d.ts +38 -0
  203. package/dist/_internal/reconciler/context.js +44 -0
  204. package/dist/_internal/reconciler/coverage.d.ts +31 -0
  205. package/dist/_internal/reconciler/coverage.js +124 -0
  206. package/dist/_internal/reconciler/dates.d.ts +38 -0
  207. package/dist/_internal/reconciler/dates.js +121 -0
  208. package/dist/_internal/reconciler/decide.d.ts +25 -0
  209. package/dist/_internal/reconciler/decide.js +263 -0
  210. package/dist/_internal/reconciler/decision-evaluation.d.ts +9 -0
  211. package/dist/_internal/reconciler/decision-evaluation.js +67 -0
  212. package/dist/_internal/reconciler/decision-records.d.ts +14 -0
  213. package/dist/_internal/reconciler/decision-records.js +77 -0
  214. package/dist/_internal/reconciler/decision-release.d.ts +3 -0
  215. package/dist/_internal/reconciler/decision-release.js +12 -0
  216. package/dist/_internal/reconciler/dependencies.d.ts +179 -0
  217. package/dist/_internal/reconciler/dependencies.js +372 -0
  218. package/dist/_internal/reconciler/discovery.d.ts +9 -0
  219. package/dist/_internal/reconciler/discovery.js +65 -0
  220. package/dist/_internal/reconciler/document-corrections.d.ts +18 -0
  221. package/dist/_internal/reconciler/document-corrections.js +59 -0
  222. package/dist/_internal/reconciler/documents.d.ts +26 -0
  223. package/dist/_internal/reconciler/documents.js +88 -0
  224. package/dist/_internal/reconciler/effective.d.ts +6 -0
  225. package/dist/_internal/reconciler/effective.js +17 -0
  226. package/dist/_internal/reconciler/escalations.d.ts +4 -0
  227. package/dist/_internal/reconciler/escalations.js +76 -0
  228. package/dist/_internal/reconciler/evaluation.d.ts +56 -0
  229. package/dist/_internal/reconciler/evaluation.js +704 -0
  230. package/dist/_internal/reconciler/evidence-authority.d.ts +6 -0
  231. package/dist/_internal/reconciler/evidence-authority.js +70 -0
  232. package/dist/_internal/reconciler/evidence-history.d.ts +5 -0
  233. package/dist/_internal/reconciler/evidence-history.js +22 -0
  234. package/dist/_internal/reconciler/evidence-validity.d.ts +17 -0
  235. package/dist/_internal/reconciler/evidence-validity.js +135 -0
  236. package/dist/_internal/reconciler/fact-validation.d.ts +5 -0
  237. package/dist/_internal/reconciler/fact-validation.js +49 -0
  238. package/dist/_internal/reconciler/files.d.ts +9 -0
  239. package/dist/_internal/reconciler/files.js +56 -0
  240. package/dist/_internal/reconciler/graph.d.ts +40 -0
  241. package/dist/_internal/reconciler/graph.js +298 -0
  242. package/dist/_internal/reconciler/holds.d.ts +6 -0
  243. package/dist/_internal/reconciler/holds.js +18 -0
  244. package/dist/_internal/reconciler/home-definitions.d.ts +11 -0
  245. package/dist/_internal/reconciler/home-definitions.js +25 -0
  246. package/dist/_internal/reconciler/homes.d.ts +6 -0
  247. package/dist/_internal/reconciler/homes.js +32 -0
  248. package/dist/_internal/reconciler/index.d.ts +42 -0
  249. package/dist/_internal/reconciler/index.js +58 -0
  250. package/dist/_internal/reconciler/instants.d.ts +17 -0
  251. package/dist/_internal/reconciler/instants.js +56 -0
  252. package/dist/_internal/reconciler/interaction-fields.d.ts +10 -0
  253. package/dist/_internal/reconciler/interaction-fields.js +30 -0
  254. package/dist/_internal/reconciler/invariants.d.ts +8 -0
  255. package/dist/_internal/reconciler/invariants.js +34 -0
  256. package/dist/_internal/reconciler/journal.d.ts +3 -0
  257. package/dist/_internal/reconciler/journal.js +4 -0
  258. package/dist/_internal/reconciler/linking.d.ts +10 -0
  259. package/dist/_internal/reconciler/linking.js +259 -0
  260. package/dist/_internal/reconciler/memory.d.ts +32 -0
  261. package/dist/_internal/reconciler/memory.js +190 -0
  262. package/dist/_internal/reconciler/milestones.d.ts +7 -0
  263. package/dist/_internal/reconciler/milestones.js +58 -0
  264. package/dist/_internal/reconciler/missing.d.ts +18 -0
  265. package/dist/_internal/reconciler/missing.js +79 -0
  266. package/dist/_internal/reconciler/model.d.ts +350 -0
  267. package/dist/_internal/reconciler/model.js +9 -0
  268. package/dist/_internal/reconciler/notices.d.ts +14 -0
  269. package/dist/_internal/reconciler/notices.js +80 -0
  270. package/dist/_internal/reconciler/occurrences.d.ts +3 -0
  271. package/dist/_internal/reconciler/occurrences.js +30 -0
  272. package/dist/_internal/reconciler/outputs.d.ts +12 -0
  273. package/dist/_internal/reconciler/outputs.js +132 -0
  274. package/dist/_internal/reconciler/parameters.d.ts +4 -0
  275. package/dist/_internal/reconciler/parameters.js +27 -0
  276. package/dist/_internal/reconciler/policies.d.ts +22 -0
  277. package/dist/_internal/reconciler/policies.js +94 -0
  278. package/dist/_internal/reconciler/policy-edits.d.ts +11 -0
  279. package/dist/_internal/reconciler/policy-edits.js +42 -0
  280. package/dist/_internal/reconciler/policy-linking.d.ts +4 -0
  281. package/dist/_internal/reconciler/policy-linking.js +104 -0
  282. package/dist/_internal/reconciler/principal-types.d.ts +2 -0
  283. package/dist/_internal/reconciler/principal-types.js +38 -0
  284. package/dist/_internal/reconciler/prior-decisions.d.ts +3 -0
  285. package/dist/_internal/reconciler/prior-decisions.js +34 -0
  286. package/dist/_internal/reconciler/projections.d.ts +4 -0
  287. package/dist/_internal/reconciler/projections.js +85 -0
  288. package/dist/_internal/reconciler/proofs.d.ts +9 -0
  289. package/dist/_internal/reconciler/proofs.js +24 -0
  290. package/dist/_internal/reconciler/properties.d.ts +25 -0
  291. package/dist/_internal/reconciler/properties.js +67 -0
  292. package/dist/_internal/reconciler/property-eval.d.ts +5 -0
  293. package/dist/_internal/reconciler/property-eval.js +101 -0
  294. package/dist/_internal/reconciler/property-generator.d.ts +9 -0
  295. package/dist/_internal/reconciler/property-generator.js +288 -0
  296. package/dist/_internal/reconciler/property-shrink.d.ts +14 -0
  297. package/dist/_internal/reconciler/property-shrink.js +183 -0
  298. package/dist/_internal/reconciler/provenance.d.ts +8 -0
  299. package/dist/_internal/reconciler/provenance.js +61 -0
  300. package/dist/_internal/reconciler/reconcile.d.ts +32 -0
  301. package/dist/_internal/reconciler/reconcile.js +164 -0
  302. package/dist/_internal/reconciler/recurrence.d.ts +9 -0
  303. package/dist/_internal/reconciler/recurrence.js +44 -0
  304. package/dist/_internal/reconciler/requirements.d.ts +5 -0
  305. package/dist/_internal/reconciler/requirements.js +331 -0
  306. package/dist/_internal/reconciler/resource-generation.d.ts +9 -0
  307. package/dist/_internal/reconciler/resource-generation.js +17 -0
  308. package/dist/_internal/reconciler/resource-scenarios.d.ts +26 -0
  309. package/dist/_internal/reconciler/resource-scenarios.js +78 -0
  310. package/dist/_internal/reconciler/resources.d.ts +24 -0
  311. package/dist/_internal/reconciler/resources.js +178 -0
  312. package/dist/_internal/reconciler/result-digest.d.ts +13 -0
  313. package/dist/_internal/reconciler/result-digest.js +66 -0
  314. package/dist/_internal/reconciler/reuse.d.ts +16 -0
  315. package/dist/_internal/reconciler/reuse.js +119 -0
  316. package/dist/_internal/reconciler/scenarios.d.ts +32 -0
  317. package/dist/_internal/reconciler/scenarios.js +442 -0
  318. package/dist/_internal/reconciler/scheduling.d.ts +9 -0
  319. package/dist/_internal/reconciler/scheduling.js +203 -0
  320. package/dist/_internal/reconciler/sha256.d.ts +1 -0
  321. package/dist/_internal/reconciler/sha256.js +1 -0
  322. package/dist/_internal/reconciler/signatures.d.ts +13 -0
  323. package/dist/_internal/reconciler/signatures.js +37 -0
  324. package/dist/_internal/reconciler/temporal.d.ts +10 -0
  325. package/dist/_internal/reconciler/temporal.js +46 -0
  326. package/dist/_internal/reconciler/upgrades.d.ts +6 -0
  327. package/dist/_internal/reconciler/upgrades.js +65 -0
  328. package/dist/_internal/reconciler/wire.d.ts +2 -0
  329. package/dist/_internal/reconciler/wire.js +5 -0
  330. package/dist/_internal/reconciler/work.d.ts +32 -0
  331. package/dist/_internal/reconciler/work.js +101 -0
  332. package/dist/_internal/world-ir/schema.generated.d.ts +180 -0
  333. package/dist/_internal/world-ir/schema.generated.js +1127 -0
  334. package/dist/_internal/world-ir/types.generated.d.ts +1011 -0
  335. package/dist/_internal/world-ir/types.generated.js +1 -0
  336. package/dist/authoring.d.ts +9 -0
  337. package/dist/authoring.js +10 -0
  338. package/dist/catalogue.d.ts +20 -0
  339. package/dist/catalogue.js +531 -0
  340. package/dist/cli.d.ts +2 -0
  341. package/dist/cli.js +553 -0
  342. package/dist/codegen.d.ts +6 -0
  343. package/dist/codegen.js +89 -0
  344. package/dist/coverage.d.ts +60 -0
  345. package/dist/coverage.js +128 -0
  346. package/dist/deploy.d.ts +21 -0
  347. package/dist/deploy.js +72 -0
  348. package/dist/diagnostics.d.ts +9 -0
  349. package/dist/diagnostics.js +37 -0
  350. package/dist/diff.d.ts +17 -0
  351. package/dist/diff.js +19 -0
  352. package/dist/durable-object.d.ts +14 -0
  353. package/dist/durable-object.js +30 -0
  354. package/dist/explain.d.ts +113 -0
  355. package/dist/explain.js +225 -0
  356. package/dist/fixes.d.ts +4 -0
  357. package/dist/fixes.js +70 -0
  358. package/dist/fmt.d.ts +12 -0
  359. package/dist/fmt.js +39 -0
  360. package/dist/handle/open.d.ts +18 -0
  361. package/dist/handle/open.js +28 -0
  362. package/dist/handle/protocol.d.ts +12 -0
  363. package/dist/handle/protocol.js +96 -0
  364. package/dist/handle/store.d.ts +31 -0
  365. package/dist/handle/store.js +11 -0
  366. package/dist/handle/types.d.ts +37 -0
  367. package/dist/handle/types.js +1 -0
  368. package/dist/handle/world.d.ts +190 -0
  369. package/dist/handle/world.js +533 -0
  370. package/dist/http.d.ts +3 -0
  371. package/dist/http.js +72 -0
  372. package/dist/impact.d.ts +21 -0
  373. package/dist/impact.js +57 -0
  374. package/dist/index.d.ts +30 -0
  375. package/dist/index.js +43 -0
  376. package/dist/init.d.ts +13 -0
  377. package/dist/init.js +99 -0
  378. package/dist/ir-schema.json +4213 -0
  379. package/dist/lints.d.ts +8 -0
  380. package/dist/lints.js +154 -0
  381. package/dist/lsp.d.ts +14 -0
  382. package/dist/lsp.js +380 -0
  383. package/dist/manual/catalog.d.ts +12 -0
  384. package/dist/manual/catalog.js +23 -0
  385. package/dist/manual/examples.d.ts +15 -0
  386. package/dist/manual/examples.js +39 -0
  387. package/dist/manual/projections.d.ts +77 -0
  388. package/dist/manual/projections.js +344 -0
  389. package/dist/manual/prose.d.ts +19 -0
  390. package/dist/manual/prose.js +215 -0
  391. package/dist/manual/render.d.ts +76 -0
  392. package/dist/manual/render.js +250 -0
  393. package/dist/manual/text.d.ts +7 -0
  394. package/dist/manual/text.js +15 -0
  395. package/dist/mcp.d.ts +32 -0
  396. package/dist/mcp.js +269 -0
  397. package/dist/mutate.d.ts +36 -0
  398. package/dist/mutate.js +123 -0
  399. package/dist/project.d.ts +26 -0
  400. package/dist/project.js +80 -0
  401. package/dist/refine.d.ts +18 -0
  402. package/dist/refine.js +197 -0
  403. package/dist/release/diff.d.ts +45 -0
  404. package/dist/release/diff.js +103 -0
  405. package/dist/release/impact.d.ts +83 -0
  406. package/dist/release/impact.js +214 -0
  407. package/dist/release/nodes.d.ts +20 -0
  408. package/dist/release/nodes.js +118 -0
  409. package/dist/render.d.ts +19 -0
  410. package/dist/render.js +43 -0
  411. package/dist/serve.d.ts +18 -0
  412. package/dist/serve.js +140 -0
  413. package/dist/snapshot.d.ts +19 -0
  414. package/dist/snapshot.js +45 -0
  415. package/dist/sqlite.d.ts +16 -0
  416. package/dist/sqlite.js +151 -0
  417. package/dist/test.d.ts +54 -0
  418. package/dist/test.js +131 -0
  419. package/dist/world.d.ts +7 -0
  420. package/dist/world.js +5 -0
  421. package/docs/authoring/vendor-risk/example.forma +11 -0
  422. package/docs/authoring/vendor-risk/library/vendor.forma +76 -0
  423. package/docs/authoring/vendor-risk/scenarios/reviews.forma +107 -0
  424. package/docs/protocol.md +195 -0
  425. package/docs/reference.md +258 -0
  426. package/package.json +81 -3
@@ -0,0 +1,195 @@
1
+ # Operating protocol
2
+
3
+ The library, HTTP server and operating MCP share one protocol: Effect schemas, inferred
4
+ request/response types, and generated JSON Schema (`requestJsonSchema`,
5
+ `responseJsonSchema`, `resultJsonSchema`).
6
+
7
+ In process, call `await world.request(verb, input, actor)`. HTTP and MCP return the same
8
+ envelope: `{ "ok": true, "value": ... }` or
9
+ `{ "ok": false, "error": { "code": "human-required", "message": "...", "details": [] } }`.
10
+ The convenience methods (`subject.assert`, `subject.perform`, `subject.propose`,
11
+ `subject.acceptProposal`, `subject.rejectProposal`) return an `Outcome` with `accepted`,
12
+ `codes`, `status` and `change` instead.
13
+
14
+ ## Verbs
15
+
16
+ Trusted actors accept `kind: "human"`, `"agent"`, `"service"` or `"connector"`.
17
+ A connector can perform connector work only when its id matches the work's assignee,
18
+ for example `{"id":"connector:everify","kind":"connector"}`. It cannot perform
19
+ human interaction work or make human decisions. HTTP accepts the same actor JSON in
20
+ `x-worldvm-actor`; the trusted host still authenticates that identity.
21
+
22
+ `operations` reports action states `eligible`, `waiting`, `dispatched` and `held`
23
+ while work exists. An action whose target requirements are all NotApplicable reports
24
+ `not-applicable`; a finished action reports `complete`. Decisions report `decision`.
25
+ `work` omits actions whose requirements do not apply.
26
+
27
+ `type` is an entity type, such as `Vendor`; `subject` is its id. Every mutation requires
28
+ a nonempty command `id`. Retrying the same id and content, including actor, replays the
29
+ original result, even after reopen. Reusing an id for different content returns
30
+ `command-duplicate`. Ids are unique across the account's verbs and subjects.
31
+
32
+ | Verb | Input | Result value |
33
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
34
+ | `status` | `type`, `subject`, optional `at` | Status, requirements, outputs, revision, next wake |
35
+ | `facts` | `type`, `subject`, optional `at` | Current fact values and assertion provenance |
36
+ | `work` | `type`, `subject`, optional `at` | Work items, including pending proposal reviews |
37
+ | `operations` | `type`, `subject`, optional `at` | Declared actions and decisions with their state |
38
+ | `explain` | `type`, `subject`, optional `requirement`, `at` | Requirement rules, citations and proof trees |
39
+ | `subjects` | `type` | Recorded subject ids |
40
+ | `assert` | `type`, `subject`, `id`, `values`, optional `kind` | Write outcome; null values retract facts |
41
+ | `perform` | `type`, `subject`, `id`, `operation`, optional `values`, `instance`, `reason`, `signature`, `unsigned`, `amend`, `revoke` | Evidence or decision write outcome; accepts stable work ids |
42
+ | `signal` | `type`, `subject`, `id`, `machine`, `state`, optional `instance` | Machine observation write outcome |
43
+ | `propose` | `type`, `subject`, `id`, `rationale`, `draft` | Write outcome; proposal id equals command id |
44
+ | `proposals` | Optional `type`, `subject`, `state` | Durable proposals (`pending`, `accepted`, `rejected`) |
45
+ | `accept-proposal` | `type`, `subject`, `id`, `proposal`, optional `signature` | Human-authorized write outcome |
46
+ | `reject-proposal` | `type`, `subject`, `id`, `proposal`, `reason` | Resolution outcome; draft is not written |
47
+ | `changes` | `{}` | Current `revision` and `nextWake`; HTTP GET streams live changes |
48
+
49
+ An assertion draft is `{ "kind": "assert", "values": { "tier": "high" } }`, with
50
+ optional `factKind`. An evidence draft is
51
+ `{ "kind": "evidence", "operation": "submit-questionnaire", "values": { "summary": "Reviewed" } }`,
52
+ with optional `instance`. A draft is unsigned: proposing it does not assert facts or
53
+ create attested evidence. Evidence drafts target interaction work, not decisions or connectors.
54
+
55
+ Agents propose; they cannot assert facts, attest evidence, signal machines or resolve
56
+ proposals. Acceptance requires a human and rechecks current invariants and operation
57
+ authority under that human's identity. A refused acceptance leaves the proposal pending;
58
+ retry with a new command id after correcting authority or world state. Successful
59
+ acceptance atomically stores the write, resolution and audit citation to the proposal.
60
+ For evidence with an audit policy, the accepting human supplies `signature` with
61
+ `consent`, `intent`, `method` and `device`; this metadata never comes from the agent draft.
62
+ Rejection requires a human and a reason. Pending proposals appear as `kind: "proposal"`
63
+ work with a `proposal` id; clients resolve them with the corresponding verb.
64
+
65
+ Stable protocol error codes are `invalid-request`, `unauthenticated`, `human-required`,
66
+ `forbidden`, `not-found`, `command-duplicate`, `proposal-resolved`, `write-refused` and
67
+ `internal`. Kernel refusal codes, such as `operation-authority`, appear in `details`.
68
+ Identity is supplied separately from command bodies; body fields such as `by` are rejected.
69
+
70
+ ## HTTP
71
+
72
+ ```sh
73
+ npx worldvm serve node_modules/worldvm/docs/authoring/vendor-risk --db vendor.db --port 3000
74
+ # For deterministic local sessions, add --clock 2026-11-06.
75
+ ```
76
+
77
+ The server binds to `127.0.0.1`. The `x-worldvm-actor` JSON header is a **dev-only,
78
+ trusted identity**, not authentication. The embedding application must authenticate
79
+ callers and supply trusted ids, kinds and groups before exposing it beyond local use.
80
+ There is no read ceiling or per-subject read authorization in this initial adapter.
81
+
82
+ ```sh
83
+ curl http://127.0.0.1:3000/v1/assert \
84
+ -H 'content-type: application/json' \
85
+ -H 'x-worldvm-actor: {"id":"connector:crm","kind":"service"}' \
86
+ -d '{"type":"Vendor","subject":"acme","id":"crm-1","values":{"name":"Acme","tier":"standard"}}'
87
+
88
+ curl http://127.0.0.1:3000/v1/propose \
89
+ -H 'content-type: application/json' \
90
+ -H 'x-worldvm-actor: {"id":"agent:review","kind":"agent"}' \
91
+ -d '{"type":"Vendor","subject":"acme","id":"proposal-1","rationale":"Handles sensitive data","draft":{"kind":"assert","values":{"tier":"high"}}}'
92
+
93
+ curl http://127.0.0.1:3000/v1/accept-proposal \
94
+ -H 'content-type: application/json' \
95
+ -H 'x-worldvm-actor: {"id":"ana","kind":"human"}' \
96
+ -d '{"type":"Vendor","subject":"acme","id":"approval-1","proposal":"proposal-1"}'
97
+
98
+ curl -N http://127.0.0.1:3000/v1/changes \
99
+ -H 'x-worldvm-actor: {"id":"ana","kind":"human"}'
100
+ ```
101
+
102
+ All verbs accept POST `/v1/<verb>`. GET `/v1/changes` is an SSE stream of `event: change`
103
+ with a JSON `Change` as data. It starts with a comment and carries live events only;
104
+ reconnect by reading current status/work. It has no replay cursor. Disconnecting
105
+ unsubscribes. Time-driven changes use `tick()` scheduled from `nextWake()` with a
106
+ one-minute maximum interval. `--clock` freezes logical time; wall time will not expire
107
+ evidence in that mode. No listening socket is needed to use or test `createHandler(world)`
108
+ from `worldvm/serve`, a plain `(Request) => Promise<Response>`.
109
+
110
+ Use one owning handle/process per SQLite database. The initial embedded store does not
111
+ coordinate independent HTTP and MCP processes opening the same file; stop one before
112
+ starting the other. Embedders can share one handle between both adapters.
113
+
114
+ ## MCP for Claude Code and Codex
115
+
116
+ The existing `worldvm mcp` authoring mode is unchanged. Operate mode opens the durable
117
+ world and fixes its actor for the process:
118
+
119
+ ```sh
120
+ npx worldvm mcp \
121
+ --world /absolute/path/my-world \
122
+ --db /absolute/path/vendor.db \
123
+ --actor '{"id":"agent:review","kind":"agent"}'
124
+ ```
125
+
126
+ Claude Code `.mcp.json` entry (substitute absolute paths):
127
+
128
+ ```json
129
+ {
130
+ "mcpServers": {
131
+ "worldvm": {
132
+ "command": "node",
133
+ "args": [
134
+ "/absolute/path/node_modules/worldvm/bin/worldvm.mjs",
135
+ "mcp",
136
+ "--world",
137
+ "/absolute/path/my-world",
138
+ "--db",
139
+ "/data/vendor.db",
140
+ "--actor",
141
+ "{\"id\":\"agent:review\",\"kind\":\"agent\"}"
142
+ ]
143
+ }
144
+ }
145
+ }
146
+ ```
147
+
148
+ Codex `config.toml` entry:
149
+
150
+ ```toml
151
+ [mcp_servers.worldvm]
152
+ command = "node"
153
+ args = ["/absolute/path/node_modules/worldvm/bin/worldvm.mjs", "mcp", "--world", "/absolute/path/my-world", "--db", "/data/vendor.db", "--actor", '{"id":"agent:review","kind":"agent"}']
154
+ ```
155
+
156
+ Agents discover `status`, `facts`, `work`, `operations`, `explain`, `subjects`, `propose`,
157
+ `proposals` and `changes`. Human/service actors also discover `assert`, `perform`,
158
+ `signal`, `accept-proposal` and `reject-proposal`; services still cannot resolve proposals
159
+ or make human decisions. Calling an undiscovered forbidden mutation still returns the
160
+ protocol refusal code. Authoring tools remain available; the source/scenario explanation
161
+ tool is named `authoring-explain` in operate mode to reserve `explain` for live subjects.
162
+
163
+ ## Structured subject reads
164
+
165
+ `work[].missing` contains objects with canonical `text` and a `kind`: `requirement`,
166
+ `evidence`, `fact`, `machine`, or `other`. Requirement conditions carry `requirement`
167
+ and resolved `instance`; evidence conditions carry `evidence` and `producedBy`, an
168
+ array of `{requirement, instance}` addresses in the subject's scope. Both `attested`
169
+ and `valid` evidence checks name their producers. Fact conditions carry the authored
170
+ `fact` path. Machine conditions carry `machine` and, for `in-state?`, `states` (the authored set of acceptable states).
171
+ Compound conditions (`and`, `or`, `not`) and assignment/hold reasons remain `other`;
172
+ they are not flattened. Consumers can display `text` without interpreting it.
173
+
174
+ `status.machines` lists `{instance, machine, state, since}` for every declared
175
+ machine instance. `state` and `since` are null before its first accepted signal.
176
+ `since` is the start of the current consecutive run of that state, in the current
177
+ resource generation. A declared initial state is not an observation.
178
+
179
+ `facts` accepts `{type, subject, at?}` and returns current declared subject facts as
180
+ `{fact, value, by, at, command}`. `fact` is the stored attribute address, `at` is valid
181
+ time, and `command` is the protocol command ID that wrote it (null for imported
182
+ records without a retained command). Retracted facts are absent. The same basis
183
+ projection used by the inspection views selects current assertions; provenance is
184
+ read from the retained assertion, never inferred from timestamps or rule source.
185
+
186
+ HTTP exposes `POST /v1/facts`; operating MCP exposes the read-only `facts` tool with
187
+ the same schema and response. `explain[].evidence.values` contains the selected
188
+ record's values in addition to its ID, type, status, signer and time.
189
+
190
+ Hosts can supply `canRead({actor, type, subject})` to `open`/`host`. The protocol
191
+ checks it before `status`, `work`, `operations`, `facts` and `explain`, returning
192
+ `forbidden` on denial, including for evidence values. Without the hook, authenticated
193
+ host actors retain the existing trusted read access. Direct subject methods are
194
+ privileged embedding APIs; a host must authenticate and scope access before exposing
195
+ them. This hook does not replace the separate runtime's `ReadAuthority` policy.
@@ -0,0 +1,258 @@
1
+ # Core world-language reference
2
+
3
+ A world is a directory of `.forma` files: a library with roles and components, entities
4
+ and an account that binds them, plus scenarios and properties. Start with `worldvm init`;
5
+ loop `worldvm check .`, `worldvm test .`, `worldvm coverage . --mutate`.
6
+
7
+ Syntax below uses `…` for repetition and `[optional]` for optional syntax; those markers
8
+ are not source. The fenced examples **together form one complete world**, in order.
9
+ Synthetic policy and data; illustrative only. This page is compiled and tested.
10
+ For the deeper guide, see `AUTHORING.md` in the installed package
11
+ (`node_modules/worldvm/AUTHORING.md`). In a scaffold, this file is `REFERENCE.md`; the examples stand alone.
12
+
13
+ The **core forms** are `source`, `entity`, `evidence`, `component`, `requirement`,
14
+ `action`, `output`, `decision`, `scenario` and `property`. `worldvm check . --core`
15
+ adds an `I_EXTENDED_FORM` info diagnostic at each extended declaration or child form;
16
+ it does not reject a valid world. LSP clients can set `initializationOptions.core: true`. The surrounding declarations shown below (`library`,
17
+ `role`, `interaction`, `layout`, `account`, plus their children) are **extended**.
18
+ All forms outside the ten-name core set are extended, including `attest`, `step`,
19
+ `field`, `sign` and `for-each`; expression calls and scenario data are not declarations.
20
+
21
+ First declare the library that owns the forms:
22
+
23
+ ```lisp
24
+ (library example.training "Annual safety training." :version "1.0" :subject training/worker)
25
+ ```
26
+
27
+ | Form | Syntax | Common mistakes |
28
+ | ------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
29
+ | `source` | `(source name "doc" :kind :policy :url "url" :as-of "YYYY-MM-DD")` | Cite a declared name, not a URL; use a real calendar date. |
30
+ | `role` | `(role ns/name "doc" {:field Type …})` | Roles describe interfaces, not stored records; include every field components read. |
31
+ | `entity` | `(entity Name "doc" :ns :pkg.name :display field :implements {role {role-field field}} {:field Type …})` | Namespace must start with the account package; map every role field with the same type. |
32
+ | `evidence` | `(evidence Name "doc" :of Component [:expires date-expr] {:field Type …} (attest …))` | Declare it at top level; use `valid` for expiring evidence (`attested` ignores expiry); expiry may only read signed fields and `signed-on`. |
33
+ | `interaction` | `(interaction Name "doc" :actor who :produces Evidence :layout Layout)` | Actor must resolve to a person or group; evidence fields belong in the evidence declaration. |
34
+ | `layout` | `(layout Name "doc" (step id "Label" (field field) … (sign)))` | Use declared evidence fields; include a signing step for attested evidence. |
35
+ | `component` | `(component Name "doc" :key [input …] :inputs {:input Type …} children …)` | Put an entity-reference input first in the key; requirements go inside this form; list callable actions/decisions in `:operations`. |
36
+ | `requirement` | `(requirement name :cites [(source "clause")] [:applies-when truth] :satisfied-by truth)` | Child of a component, never top level; conditions use Kleene Truth with `and`, `or`, `not`; `satisfied?` is false for NotApplicable. |
37
+ | `action` | `(action name :advances requirement :assignee who :via (interaction Name))` | Child of a component; match the interaction actor and signer; an action does not itself set arbitrary facts. |
38
+ | `output` | `(output name (all-of requirement-or-output …))` | Child of a component; `all-of` accepts NotApplicable, unlike conjoining `satisfied?` checks; read locally as `self.name`. |
39
+ | `decision` | `(decision name "doc" :of Component :applies requirement :by who :effect :approve :reason String [:expires duration] :cites […])` | Top level, not a component child; name a requirement of that component; approval requires the declared authority. |
40
+ | `account` | `(account name "doc" :requires {library "version"} :package pkg (for-each role Component))` | Require the exact library version; map roles with entities' `:implements` before running components. |
41
+ | `scenario` | `(scenario name "doc" :world account (given …) (at "date" …) (do …) …)` | `:world` names an account; time must advance; `given` is trusted history, `do` exercises command checks. |
42
+ | `property` | `(property name "doc" :world account :at "date" :for-all (x Entity) predicate)` | Quantify an entity, not a role; use Bool `and`/`or`/`not` and `=`/`!=` here; a reference is not an assertion. |
43
+
44
+ ## Library forms
45
+
46
+ `source`, `role`, `evidence`, `interaction` and `layout`, respectively:
47
+
48
+ ```lisp
49
+ (source safety-policy "Synthetic annual safety policy."
50
+ :kind :policy :url "https://example.invalid/safety" :as-of "2026-11-01")
51
+ ```
52
+
53
+ ```lisp
54
+ (role training/worker "A worker and their reviewing group." {:name String :reviewers Group})
55
+ ```
56
+
57
+ ```lisp
58
+ (evidence Completion "Signed course completion." :of Training
59
+ :expires (months-after signed-on 12)
60
+ {:course String}
61
+ (attest :signer worker :covers :all :method :otp))
62
+ ```
63
+
64
+ Evidence can contain `(rule name :when condition :requires fields)`. The optional
65
+ `:when` reads signed evidence fields and uses three-valued Truth. An omitted condition
66
+ always applies; a false condition skips the rule, and Unknown prevents attestation.
67
+ `:requires` accepts a single `field`, `(one-of a b …)` to require at least one filled
68
+ field, or `(all-of a b …)` to require every listed field. Groups must be nonempty
69
+ and contain declared field names. For example,
70
+ `(rule documents :when (= document-choice :list-b-and-c) :requires (all-of list-b list-c))`
71
+ requires both document fields for that signed choice. The interaction's layout must
72
+ show required fields whenever the rule applies; a `one-of` group needs a visible alternative.
73
+
74
+ For a signal-driven protocol, declare `(machine Protocol … :signal updated …)` and
75
+ a `(connector provider … :capabilities [] :signals [updated] :owns [Protocol])`.
76
+ An inbound-only connector uses an empty capabilities vector. A `component-contract`
77
+ may omit `:capabilities`; it defaults to `[]`.
78
+
79
+ ```lisp
80
+ (interaction CompletionEntry "Record the finished course."
81
+ :actor worker :produces Completion :layout CompletionLayout)
82
+ ```
83
+
84
+ An interaction can supply signed evidence fields with `:fixes`, for example
85
+ `:fixes {:examination :remote}` for an evidence field typed `(Union :in-person :remote)`.
86
+ Fixed values must be scalar literals matching the evidence field type. Omit these
87
+ fields from the layout; they count as covered by the interaction. They cannot also
88
+ use `:binds`, `:prefill` or `:proposes`. Conflicting submissions are refused, including
89
+ unsigned drafts. The stored evidence and signature include the fixed values, so
90
+ evidence rules and explanations read them as signed fields. Two actions can share
91
+ one evidence type through different interactions; a remote action can use `:needs`
92
+ to require enrollment before that interaction is eligible.
93
+
94
+ ```lisp
95
+ (layout CompletionLayout "Record and sign."
96
+ (step record "Record" (field course) (sign)))
97
+ ```
98
+
99
+ `component` contains `requirement`, `action` and `output`. This single fence keeps the
100
+ parentheses and child scope visible:
101
+
102
+ ```lisp
103
+ (component Training "Track one worker's training."
104
+ :key [worker] :inputs {:worker (Id training/worker)} :operations [complete waive-training]
105
+ (requirement completed
106
+ :cites [(safety-policy "1: workers complete training every year")]
107
+ :satisfied-by (valid Completion))
108
+ (action complete :advances completed :assignee worker :via (interaction CompletionEntry))
109
+ (output done (all-of completed)))
110
+ ```
111
+
112
+ Explanations follow the branch that decides a condition, in source order. A passing
113
+ `or` reports the first passing branch and that branch's evidence. A failing `and`
114
+ reports the first failing branch. A failing `or` reports every branch's failure;
115
+ a passing `and` reports every branch's success. Combined details do not select a
116
+ single evidence record. If no `or` branch passes and at least one is Unknown, the
117
+ result is Unknown and the explanation includes the unresolved branches and the
118
+ failed branches. An `and` with no failing branch and at least one Unknown likewise
119
+ reports all branches. Every branch is evaluated, including its dependencies and
120
+ time cutoffs; choosing an explanation does not short-circuit evaluation.
121
+
122
+ `decision` records a judgment; it affects satisfaction only when a rule reads it with
123
+ `(decided waive-training)`. This example deliberately keeps completion evidence required:
124
+
125
+ ```lisp
126
+ (decision waive-training "Record a reviewer's approval."
127
+ :of Training :applies completed :by (members worker.reviewers)
128
+ :effect :approve :reason String :expires (months 6)
129
+ :cites [(safety-policy "2: reviewers document exceptions")])
130
+ ```
131
+
132
+ ## Account and proof
133
+
134
+ A machine declared inside a component can anchor a case clock:
135
+ `:due (business-days-after (entered-at case :referred) 10 :calendar us-federal)`.
136
+ Declare the calendar and the machine's protocol state. This works for plain signal-driven
137
+ machines, including connector-owned machines, without a resource or a separate date fact.
138
+ `entered-at` returns the UTC Date of the first observation in the latest visit to the state.
139
+ Consecutive duplicate states preserve it; leaving and re-entering resets it. After departure
140
+ the last entry date remains available; before an observed entry it is Unknown. Managed-resource
141
+ machines restrict history to the current acquisition generation. `resource-generation` and
142
+ `attested-for` require a managed resource.
143
+
144
+ `entity` and `account` bind stored records to the library:
145
+
146
+ ```lisp
147
+ (entity Person "A synthetic worker." :ns :example.person :display name
148
+ :implements {training/worker {:name name :reviewers reviewers}}
149
+ {:name String :reviewers Group})
150
+ ```
151
+
152
+ ```lisp
153
+ (account example "A synthetic training account."
154
+ :requires {example.training "1.0"} :package example
155
+ (for-each training/worker Training))
156
+ ```
157
+
158
+ `scenario` tests missing, current and expired evidence through the action:
159
+
160
+ ```lisp
161
+ (scenario completes-and-expires "Training lasts twelve months." :world example
162
+ (given (entity Person ana {:name "Ana" :reviewers "Safety"}) (actor ana))
163
+ (at "2026-11-02" (expect (status (Training ana) completed) :Open))
164
+ (do (perform (Training ana) complete :by ana :values {:course "Safety 101"}))
165
+ (at "2026-11-03" (expect (status (Training ana) done) :Satisfied))
166
+ (at "2027-11-03" (expect (status (Training ana) completed) :Open)))
167
+ ```
168
+
169
+ `property` explores generated worlds at a fixed instant:
170
+
171
+ ```lisp
172
+ (property done-needs-evidence "Completion requires signed evidence."
173
+ :world example :at "2026-11-03" :for-all (p Person)
174
+ (given (entity Person p {:name "Synthetic worker" :reviewers "Safety"})
175
+ (evidence Completion :for (Training p) :requirement completed :by p
176
+ :values {:course "Safety 101"}))
177
+ (implies (= (status (Training p) done) :Satisfied)
178
+ (attested (Training p) Completion)))
179
+ ```
180
+
181
+ An optional `given` block before the predicate uses scenario entity, evidence and
182
+ signal records. It must declare the quantified alias with the quantified entity type.
183
+ Each generated case keeps those entities and explicit facts and varies unspecified
184
+ fields. Seeded evidence and signals are retained; random history does not replace
185
+ the same evidence type or machine on the same occurrence. As in scenarios, `given`
186
+ is trusted history, not an exercise of action eligibility.
187
+ Counterexample shrinking preserves the authored seed facts and records.
188
+
189
+ `test` and `coverage`, in text and JSON, count the generated cases in which each
190
+ `implies` antecedent was true, once per case even with multiple quantified entities.
191
+ Zero produces `W_PROPERTY_VACUOUS`. This is a warning: vacuity alone does not fail
192
+ either command. A false or Unknown property still fails. Add seed facts and evidence
193
+ that reach the antecedent to test the claim.
194
+
195
+ Use calendar `(months N)` and `(months-after signed-on N)` for calendar periods. Comparisons use `=` and `!=` everywhere. Logic uses `and`, `or`, `not`: Kleene Truth
196
+ in conditions and ordinary Bool in properties. Write `(and a b)` or `(or a b)`;
197
+ Truth contexts also accept a collection as a single argument. To roll up
198
+ optional requirements use an `all-of` output and read it with `(met? self.done)`.
199
+ `worldvm explain W_ATTESTED_EXPIRING` explains why expiry requires `valid`.
200
+
201
+ ## Structured host reads
202
+
203
+ The operating protocol exposes `facts` alongside `status`, `work`, `operations` and
204
+ `explain`. Facts include the asserting actor, valid time and retained command ID.
205
+ Work prerequisites are structured addresses derived from IR, with canonical display
206
+ text; evidence prerequisites name their producing requirements. Compound conditions
207
+ remain opaque display reasons. Status includes observed machine states and entry
208
+ times. Explanations include selected evidence values. Hosts can gate subject reads
209
+ with `canRead`; see `docs/protocol.md` in the installed package ("Structured subject reads") for schemas
210
+ and the trusted embedding boundary.
211
+
212
+ ## CLI: impact on a live world
213
+
214
+ Deploy checked source, then serve the stored release without the source directory:
215
+
216
+ ```sh
217
+ worldvm deploy deployed-world --db world.db --account example
218
+ worldvm serve --db world.db
219
+ # In another terminal, while serve is running (or after it stops):
220
+ worldvm snapshot --db world.db --account example --out snapshot.json
221
+ worldvm impact deployed-world proposed-world --world snapshot.json --at 2026-11-10
222
+ worldvm explain deployed-world --world snapshot.json --subject hire-123 --at 2026-11-10
223
+ ```
224
+
225
+ `snapshot` reads committed state in one read transaction without changing the database.
226
+ `--account` must name the account used by the server. Deploy stores that account with the release.
227
+ Without `--out`, the JSON goes to stdout. The `worldvm/world@1` snapshot contains
228
+ `accounts`, `world` and an optional `release` identifying the release that last wrote
229
+ the records. The evaluation instant is supplied to `impact` or `explain` with `--at`.
230
+
231
+ Stop `serve` before deploying another release. One process per SQLite file is required;
232
+ a busy SQLite write lock is refused with a message to stop `serve`, but an idle server
233
+ cannot be detected. Snapshot export is a read-only exception to this rule.
234
+
235
+ ```sh
236
+ worldvm deploy proposed-world --db world.db --account example --at 2026-11-10 --dry-run
237
+ worldvm deploy proposed-world --db world.db --account example --at 2026-11-10 --json
238
+ worldvm serve --db world.db --clock 2026-11-11 --ui
239
+ worldvm mcp --db world.db --actor '{"id":"agent:ops","kind":"agent"}'
240
+ ```
241
+
242
+ Deploy refuses the same compile and authoring errors as `check`, before opening SQLite.
243
+ It reports old and new release IDs, requirement and work changes, and every changed
244
+ subject. `--at` controls impact evaluation and defaults to now. `--dry-run` checks and
245
+ previews without changing or creating the database. Deployment retains compiled IR,
246
+ account and deployment timestamp in the `releases` table, in deployment order. The last
247
+ row is active, including when an earlier release is deployed again. Records, receipts
248
+ and proposals are preserved; statuses are recomputed under the new rules, with no data
249
+ migration. The SQLite format is `worldvm/sqlite-store@3`; older files are refused and
250
+ require a new database.
251
+
252
+ `serve <directory> --db world.db` is a development shortcut for deploy, then serve;
253
+ it requires a world with one account. `serve --db` and `mcp --db` use stored IR.
254
+ Embedders can use `open({ store: sqlite("world.db") })` for the deployed release.
255
+ Explicit `open({ source, store })` still refuses records from another release unless
256
+ `activate: true` is supplied. That embedding option recomputes status and preserves
257
+ records; use CLI deploy to retain deployment history. Time passing requires a tick or
258
+ a later server clock, not another deployment.
package/package.json CHANGED
@@ -1,6 +1,84 @@
1
1
  {
2
2
  "name": "worldvm",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "A requirement runtime for declarative worlds, evidence and actions.",
5
+ "keywords": [
6
+ "declarative",
7
+ "evidence",
8
+ "requirements",
9
+ "runtime",
10
+ "worldvm"
11
+ ],
12
+ "homepage": "https://worldvm.com/worldvm/",
13
+ "license": "UNLICENSED",
14
+ "bin": {
15
+ "worldvm": "./bin/worldvm.mjs"
16
+ },
17
+ "files": [
18
+ "bin/worldvm.mjs",
19
+ "dist/**/*.js",
20
+ "dist/**/*.d.ts",
21
+ "dist/ir-schema.json",
22
+ "AUTHORING.md",
23
+ "docs/**/*.md",
24
+ "docs/authoring/**/*.forma"
25
+ ],
26
+ "type": "module",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/world.d.ts",
30
+ "import": "./dist/world.js"
31
+ },
32
+ "./sqlite": {
33
+ "types": "./dist/sqlite.d.ts",
34
+ "import": "./dist/sqlite.js"
35
+ },
36
+ "./serve": {
37
+ "types": "./dist/serve.d.ts",
38
+ "import": "./dist/serve.js"
39
+ },
40
+ "./cli": {
41
+ "types": "./dist/cli.d.ts",
42
+ "import": "./dist/cli.js"
43
+ },
44
+ "./authoring": {
45
+ "types": "./dist/authoring.d.ts",
46
+ "import": "./dist/authoring.js"
47
+ },
48
+ "./diagnostics": {
49
+ "types": "./dist/diagnostics.d.ts",
50
+ "import": "./dist/diagnostics.js"
51
+ },
52
+ "./durable-object": {
53
+ "types": "./dist/durable-object.d.ts",
54
+ "import": "./dist/durable-object.js"
55
+ },
56
+ "./ir-schema.json": "./dist/ir-schema.json",
57
+ "./http": {
58
+ "types": "./dist/http.d.ts",
59
+ "import": "./dist/http.js"
60
+ }
61
+ },
62
+ "publishConfig": {
63
+ "access": "public"
64
+ },
65
+ "devDependencies": {
66
+ "@worldvm/forma": "0.0.0",
67
+ "@worldvm/forma-tools": "0.0.0",
68
+ "@worldvm/protocol": "0.0.0",
69
+ "@worldvm/reconciler": "0.0.0"
70
+ },
71
+ "peerDependencies": {
72
+ "@forma-language/forma": "^0.6.0",
73
+ "effect": "^4.1.1"
74
+ },
75
+ "engines": {
76
+ "node": ">=22.5.0"
77
+ },
78
+ "scripts": {
79
+ "build": "tsc -p tsconfig.json && node scripts/bundle-internal.mjs && node scripts/copy-docs.mjs",
80
+ "typecheck": "tsc -p tsconfig.check.json",
81
+ "test": "vitest run --no-file-parallelism --testTimeout=20000",
82
+ "docs:catalogue": "node scripts/authoring-catalogue.mjs"
83
+ }
6
84
  }