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 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ export * from "./manual/text.js";
2
+ export * from "./manual/catalog.js";
3
+ export * from "./manual/examples.js";
4
+ export * from "./manual/prose.js";
5
+ export * from "./manual/projections.js";
6
+ export * from "./manual/render.js";
7
+ export * from "./release/nodes.js";
8
+ export * from "./release/diff.js";
9
+ export * from "./release/impact.js";
@@ -0,0 +1,10 @@
1
+ // Filesystem-free authoring projections shared by the CLI and the browser World IDE.
2
+ export * from "./manual/text.js";
3
+ export * from "./manual/catalog.js";
4
+ export * from "./manual/examples.js";
5
+ export * from "./manual/prose.js";
6
+ export * from "./manual/projections.js";
7
+ export * from "./manual/render.js";
8
+ export * from "./release/nodes.js";
9
+ export * from "./release/diff.js";
10
+ export * from "./release/impact.js";
@@ -0,0 +1,20 @@
1
+ export interface CatalogueEntry {
2
+ /** One-line summary. */
3
+ readonly title: string;
4
+ /** Why authors usually see this. */
5
+ readonly cause: string;
6
+ /** A short source fragment that triggers it (or a command line). */
7
+ readonly example: string;
8
+ /** What to change. */
9
+ readonly fix: string;
10
+ }
11
+ export declare const GENERIC_HELP = "Review this declaration and correct the reported syntax, type or reference.";
12
+ export declare const CATALOGUE: Readonly<Record<string, CatalogueEntry>>;
13
+ export declare const catalogueEntry: (code: string) => CatalogueEntry | undefined;
14
+ /** Plain-text explanation used by `worldvm explain`. */
15
+ export declare const explain: (code: string) => string | undefined;
16
+ /** Edit distance for did-you-mean suggestions. */
17
+ export declare const distance: (a: string, b: string) => number;
18
+ export declare const closest: (word: string, candidates: readonly string[]) => string | undefined;
19
+ /** The diagnostics catalogue section of AUTHORING.md, generated from the table. */
20
+ export declare const catalogueMarkdown: () => string;
@@ -0,0 +1,531 @@
1
+ /**
2
+ * The authoring diagnostics catalogue: one row per diagnostic code an author is likely to
3
+ * meet. It is the single source of truth for `worldvm explain <code>`, for the default help
4
+ * attached to compiler diagnostics that carry none, and for the catalogue in
5
+ * AUTHORING.md (a test checks that the document lists every row).
6
+ *
7
+ * The compiler's own messages and help strings are left untouched so compiled lab goldens
8
+ * stay byte-identical; the CLI layers this table and contextual refinements on top.
9
+ */
10
+ import { DIAGNOSTIC_RENAMES, TOP_LEVEL_FORMS } from "./_internal/forma/world/index.js";
11
+ const generic = "Review this declaration and correct the reported syntax, type or reference.";
12
+ export const GENERIC_HELP = generic;
13
+ export const CATALOGUE = {
14
+ ...Object.fromEntries(Object.entries(DIAGNOSTIC_RENAMES).map(([old, code]) => [
15
+ code,
16
+ {
17
+ title: `Compiler diagnostic (${old})`,
18
+ cause: `The compiler reported ${code}, formerly ${old}.`,
19
+ example: "",
20
+ fix: generic,
21
+ },
22
+ ])),
23
+ E_RENAMED_OPERATOR: {
24
+ title: "An operator was renamed",
25
+ cause: "The source uses all?, any?, negate or not=.",
26
+ example: "(negate condition)",
27
+ fix: "Use and, or, not and !=. Apply the diagnostic's machine fix; and/or take positional operands or a collection.",
28
+ },
29
+ I_EXTENDED_FORM: {
30
+ title: "This form is outside the core language",
31
+ cause: "check --core found an extended declaration or child form.",
32
+ example: "(calendar …)",
33
+ fix: "Use the ten core forms when possible, or keep this form and consult AUTHORING.md for its extended semantics.",
34
+ },
35
+ // ── Reader and elaboration (Forma) ──
36
+ E_READ_SYNTAX: {
37
+ title: "The file does not parse",
38
+ cause: "Unbalanced parentheses/brackets, an unterminated string or a stray character.",
39
+ example: '(library example.vendor "Doc." :version "1.0"',
40
+ fix: "Balance every ( [ { with its closer and close every string; the location points at the first unreadable token.",
41
+ },
42
+ E_ELABORATE_UNKNOWN_FORM: {
43
+ title: "A top-level form name is not a world declaration",
44
+ cause: "The head of a top-level list is not one of the world forms, or a component/account/evidence child form was written at top level.",
45
+ example: "(requirement questionnaire :satisfied-by (valid SecurityQuestionnaire))",
46
+ fix: `Use one of: ${TOP_LEVEL_FORMS.join(", ")}. Child forms such as requirement, action, output and invariant go inside (component ...).`,
47
+ },
48
+ E_ELABORATE_HOLE_TYPE: {
49
+ title: "An expression has the wrong type for its slot",
50
+ cause: "Most often a Bool where a three-valued Truth is expected: a bare true/false or (if …) in :applies-when/:satisfied-by. Also unbound names and misspelled fields.",
51
+ example: "(requirement dpa :applies-when (and (= vendor.tier :high) vendor.active) ...)",
52
+ fix: "Use and, or, not, = and != in every context; collapse Truth to Bool only with (true? x) inside if.",
53
+ },
54
+ E_ELABORATE_UNKNOWN_REFERENCE: {
55
+ title: "A reference names nothing declared",
56
+ cause: "A role, entity, component, evidence, decision or interaction name is misspelled or not declared in any file of the world.",
57
+ example: "(interaction Entry :produces SecurityQuestionaire ...)",
58
+ fix: "Declare the target or correct the spelling; names are case-sensitive and global to the world directory.",
59
+ },
60
+ E_ELABORATE_REFERENCE_TYPE: {
61
+ title: "A reference names the wrong kind of declaration",
62
+ cause: "For example :produces names a role instead of an evidence type, or :of names an entity instead of a component.",
63
+ example: '(evidence Review "…" :of vendor/record {...})',
64
+ fix: "Point the option at a declaration of the expected kind (see the message).",
65
+ },
66
+ E_ELABORATE_MISSING_SLOT: {
67
+ title: "A required option or part is missing",
68
+ cause: "The form needs a name, docstring, option or field map that was omitted.",
69
+ example: '(library example.vendor :version "1.0")',
70
+ fix: "Add the missing part named in the message; compare with the minimal world in AUTHORING.md.",
71
+ },
72
+ E_ELABORATE_INVALID_SLOT_VALUE: {
73
+ title: "An option has a value of the wrong shape",
74
+ cause: "A keyword, vector or map was expected but something else was supplied.",
75
+ example: ":key vendor",
76
+ fix: "Use the shape named in the message, for example :key [vendor].",
77
+ },
78
+ E_ELABORATE_MALFORMED_FORM: {
79
+ title: "A form's parts are out of order or malformed",
80
+ cause: "Positional parts (name, docstring, field map) are missing or in the wrong order.",
81
+ example: '(role {:name String} vendor/person "A person.")',
82
+ fix: 'Write (form name "Doc." :option value ... {fields} children...).',
83
+ },
84
+ E_ELABORATE_DUPLICATE_DECLARATION: {
85
+ title: "Two declarations share a name",
86
+ cause: "Names are global across every .forma file in the world directory.",
87
+ example: "(type Tier (Union :a)) … (type Tier (Union :b))",
88
+ fix: "Rename or delete one declaration.",
89
+ },
90
+ E_ELABORATE_FORM_CHECK: {
91
+ title: "A declaration failed one of its publish checks",
92
+ cause: "The prelude's per-form checks (key closure, unknown fields, and similar) rejected it.",
93
+ example: ":key [vendor] :inputs {:owner (Id vendor/person)}",
94
+ fix: "Follow the message; it names the field or child that failed.",
95
+ },
96
+ E_ELABORATE_MISSING_IDENTIFIER: {
97
+ title: "A form is missing its name",
98
+ cause: "The first argument after the form head must be a symbol naming the declaration.",
99
+ example: '(component "Track one vendor." ...)',
100
+ fix: 'Insert a name: (component VendorReview "Track one vendor." ...).',
101
+ },
102
+ E_ELABORATE_VALIDATION_FAILED: {
103
+ title: "A child form is not valid inside its parent",
104
+ cause: 'Usually "Expected child form X-child": a misspelt child inside component, layout, step or evidence.',
105
+ example: '(component C "Doc." :key [x] :inputs {:x (Id r)} (requirment r :satisfied-by …))',
106
+ fix: "Help lists the valid children of that parent; correct the child form's head.",
107
+ },
108
+ // ── Lowering and publish checks ──
109
+ E_LOWER: {
110
+ title: "An expression cannot be lowered to the kernel",
111
+ cause: "A name is not in scope, a dotted path names no field, or a call is neither a kernel function nor a derive.",
112
+ example: ":applies-when (or (= vendor.tier :high) (= vendor.tier :standard))",
113
+ fix: "Use kernel functions only: and/or/not for logic, in? for membership; declare a (derive ...) for reusable logic.",
114
+ },
115
+ E_MISSING_DOC: {
116
+ title: "A published declaration has no docstring",
117
+ cause: "Libraries, roles, entities, components, evidence, decisions, scenarios and properties need a nonempty docstring.",
118
+ example: "(component VendorReview :key [vendor] ...)",
119
+ fix: 'Add a docstring right after the name: (component VendorReview "Track one vendor." ...).',
120
+ },
121
+ E_LINK: {
122
+ title: "An account does not link against its library",
123
+ cause: "The account's :requires names a library/version that is not declared, or an entity does not :implements every role field the library needs.",
124
+ example: '(account example "…" :requires {example.vendor "2.0"} ...)',
125
+ fix: "Match :requires to the (library … :version …) declaration and map every role field in the entity's :implements.",
126
+ },
127
+ E_UNBOUND_ROLE_FIELD: {
128
+ title: "An entity does not map a role field",
129
+ cause: "The entity's :implements omits a field the role declares.",
130
+ example: ":implements {vendor/record {:name name}} ; role also has :owner",
131
+ fix: "Map every role field: {role-field entity-field}.",
132
+ },
133
+ E_ROLE_TYPE_MISMATCH: {
134
+ title: "A mapped entity field has the wrong type",
135
+ cause: "The entity field bound to a role field has a different type.",
136
+ example: "role {:owner (Id vendor/person)} mapped to entity {:owner String}",
137
+ fix: "Make the types match, using (Id Entity) where the role has (Id role).",
138
+ },
139
+ E_UNKNOWN_REQUIREMENT: {
140
+ title: "A name refers to a requirement that is not declared here",
141
+ cause: "An action's :advances, an output or a decision's :applies names a requirement not declared in the same component.",
142
+ example: "(action submit :advances questionnaires ...)",
143
+ fix: "Name only requirements declared in the same component.",
144
+ },
145
+ E_UNKNOWN_FIELD: {
146
+ title: "A field name is not declared",
147
+ cause: "A rule, layout or binding names a field missing from the evidence or role.",
148
+ example: '(step record "Record" (field sumary) (sign))',
149
+ fix: "Use a declared evidence or role field name.",
150
+ },
151
+ E_UNKNOWN_SOURCE: {
152
+ title: "A citation names an undeclared source",
153
+ cause: ":cites refers to a source that has no (source ...) declaration.",
154
+ example: ':cites [(policy "1: questionnaire")]',
155
+ fix: "Declare the source with (source name ...), then cite its specific clause.",
156
+ },
157
+ E_CITATION: {
158
+ title: "A :cites value is malformed",
159
+ cause: ':cites must be a vector of (source "clause") pairs.',
160
+ example: ':cites (brief-policy "1")',
161
+ fix: 'Write :cites [(brief-policy "1: clause text")].',
162
+ },
163
+ E_SOURCE_KIND: {
164
+ title: "A source has an unsupported :kind",
165
+ cause: "Only a fixed set of source kinds is accepted.",
166
+ example: '(source p "…" :kind :memo ...)',
167
+ fix: "Choose :law, :regulation, :guidance, :framework, :contract or :policy.",
168
+ },
169
+ E_SOURCE_DATE: {
170
+ title: "A source :as-of is not a real YYYY-MM-DD date",
171
+ cause: "Dates are zero-padded ISO calendar dates.",
172
+ example: ':as-of "2026-1-2"',
173
+ fix: 'Pad the date ("2026-01-02"); a machine fix is offered when the date is otherwise valid.',
174
+ },
175
+ E_NO_HOME: {
176
+ title: "A component has no entity home",
177
+ cause: "The first :key input must be an entity reference (Id E), directly or through another component.",
178
+ example: ":key [client] :inputs {:client Keyword}",
179
+ fix: "Put an (Id role) input first in :key, for example :key [vendor].",
180
+ },
181
+ E_KEY_NOT_INPUT: {
182
+ title: "A :key name is not an input",
183
+ cause: "Every :key entry must also appear in :inputs.",
184
+ example: ":key [vendor] :inputs {:record (Id vendor/record)}",
185
+ fix: "Rename the key or the input so they match.",
186
+ },
187
+ E_READ_OUTSIDE_KEY: {
188
+ title: "An expression reads a non-key input",
189
+ cause: "Shared/keyed components and decisions may only read key inputs and their reference paths.",
190
+ example: ':key [vendor] … (= owner.name "x")',
191
+ fix: "Read only key inputs and their reference paths, or include this input in the component key.",
192
+ },
193
+ E_ADVANCES: {
194
+ title: "An action's :advances is malformed",
195
+ cause: ":advances must name one requirement or a vector of distinct requirement names.",
196
+ example: "(action submit :advances [] ...)",
197
+ fix: "Use one declared requirement name or a nonempty vector of distinct local names.",
198
+ },
199
+ E_OUTPUT: {
200
+ title: "An output expression is not supported",
201
+ cause: "Outputs combine statuses; they are not general expressions.",
202
+ example: "(output done (and a b))",
203
+ fix: "Write (output name (all-of a b)), (any-of a b) or (status-of a).",
204
+ },
205
+ E_EXPIRES_SCOPE: {
206
+ title: "An evidence :expires reads outside its signed fields",
207
+ cause: "Expiry may read only the evidence's own signed fields, signed-on (the signing date) and pure date logic.",
208
+ example: ":expires (days-after vendor.opened 365)",
209
+ fix: "Compute expiry from the signing date, :expires (months-after signed-on 12), or from a signed date field, :expires valid-until.",
210
+ },
211
+ E_UNBOUNDED_TIME: {
212
+ title: "A time expression has no finite bound",
213
+ cause: "Clock reads must compare against a fact-based cutoff so the reconciler can schedule wakeups.",
214
+ example: ":due (days-after today 3)",
215
+ fix: "Shift a fact-based date, not the clock: :due (days-after vendor.opened 3).",
216
+ },
217
+ E_DECISION_EFFECT: {
218
+ title: "Unsupported decision effect",
219
+ cause: "Decision :effect must be one of the kernel effects.",
220
+ example: ":effect :allow",
221
+ fix: "Choose :approve, :reject, :waive, :defer, :accept or :add.",
222
+ },
223
+ E_DECISION_REASON: {
224
+ title: "Unsupported decision reason type",
225
+ cause: ":reason must be a scalar, a keyword union, or an Option/alias of one.",
226
+ example: ":reason {:text String}",
227
+ fix: "Use :reason String (or a keyword union); structured records belong in evidence.",
228
+ },
229
+ E_DECISION_TARGET: {
230
+ title: "A decision applies to something its component does not own",
231
+ cause: ":applies names a requirement not declared in the :of component.",
232
+ example: "(decision approve-exception :of VendorReview :applies soc2 ...)",
233
+ fix: "Name a requirement declared in the :of component.",
234
+ },
235
+ E_SELF_APPROVAL: {
236
+ title: "The decision authority is excluded from signing",
237
+ cause: ":by names exactly the principal that :distinct-from excludes.",
238
+ example: ":by change.author :distinct-from [change.author]",
239
+ fix: "Choose a different principal or a reviewer group.",
240
+ },
241
+ E_TABLE_SHAPE: {
242
+ title: "A (table …) is malformed",
243
+ cause: "Tables select on a keyword parameter of a derive.",
244
+ example: "(table tier :high)",
245
+ fix: "Use (table keyword-parameter :value result ... :else fallback) inside a derive.",
246
+ },
247
+ E_TABLE_NOT_EXHAUSTIVE: {
248
+ title: "A table does not cover every keyword",
249
+ cause: "A keyword-union selector has a value with no row.",
250
+ example: "(table tier :high true) ; tier is (Union :high :standard :none)",
251
+ fix: "Cover every value of the union, or add :else.",
252
+ },
253
+ // ── Properties ──
254
+ E_PROPERTY_SHAPE: {
255
+ title: "A property expression uses an unsupported form",
256
+ cause: "Properties are closed finite predicates with their own small operator set; runtime vocabulary (valid, decided, days-after …) is not available there.",
257
+ example: ":for-all (v Vendor) (and (= v.status :active))",
258
+ fix: "Use :world, :at and one :for-all (alias Entity), then implies, and, or, not, =, !=, <, <=, >, >=, known?, unknown?, satisfied?, not-applicable?, (status (C alias) name), (attested (C alias) Evidence), work, due, occurrence-count.",
259
+ },
260
+ E_PROPERTY_REF: {
261
+ title: "A property names an unknown world, binding, field or clause",
262
+ cause: "The :world account, :for-all entity, a field path or a status/evidence name is not declared.",
263
+ example: "(status (VendorReview v) reviewd)",
264
+ fix: "Use an entity in this account package, its declared fields, and a component requirement/output or evidence type.",
265
+ },
266
+ E_PROPERTY_TYPE: {
267
+ title: "A property operand has the wrong type",
268
+ cause: "Comparison of incompatible values, or a non-boolean under and/or/implies.",
269
+ example: '(= v.tier "high")',
270
+ fix: 'Compare like with like (keywords as :high, dates as "YYYY-MM-DD"); logic needs booleans; status predicates need (status …).',
271
+ },
272
+ E_PROPERTY_DATE: {
273
+ title: "A property :at is not a real date",
274
+ cause: "Properties never read the system clock; :at must be a fixed date or zoned instant.",
275
+ example: ':at "2026-11-6"',
276
+ fix: 'Use YYYY-MM-DD, e.g. :at "2026-11-06".',
277
+ },
278
+ E_PROPERTY_ASSERT: {
279
+ title: "A property was false or Unknown for a generated case",
280
+ cause: "The predicate failed; the report includes a shrunk counterexample scenario.",
281
+ example: "worldvm test my-world --seed 42",
282
+ fix: "Replay the counterexample source; then correct the rule, or narrow the property with implies/known?.",
283
+ },
284
+ W_PROPERTY_VACUOUS: {
285
+ title: "An implication was never exercised",
286
+ cause: "No generated case made this implies antecedent true; passing does not establish its consequent.",
287
+ example: "(implies false true)",
288
+ fix: "Add a property given block with facts and evidence that exercise the antecedent. Vacuity warns without failing test or coverage.",
289
+ },
290
+ E_FIXES_SHAPE: {
291
+ title: "Interaction fixed values need a map",
292
+ cause: ":fixes accepts evidence field names and scalar literals.",
293
+ example: ":fixes [:examination :remote]",
294
+ fix: "Use :fixes {:examination :remote}.",
295
+ },
296
+ E_FIXES_TYPE: {
297
+ title: "A fixed value has the wrong evidence field type",
298
+ cause: "The literal does not fit the declared field, including keyword union membership.",
299
+ example: ":fixes {:examination :unknown}",
300
+ fix: "Use a scalar literal of the evidence field's declared type.",
301
+ },
302
+ E_FIXES_CONFLICT: {
303
+ title: "A fixed field has another value source",
304
+ cause: "A field is fixed more than once or also uses binds, prefill or proposes.",
305
+ example: ":fixes {:examination :remote} :prefill {:examination person.examination}",
306
+ fix: "Give each fixed field exactly one literal value source.",
307
+ },
308
+ E_FIXES_LAYOUT: {
309
+ title: "A layout shows an interaction fixed field",
310
+ cause: "The interaction supplies this value, so the signer must not be prompted for it.",
311
+ example: ":fixes {:examination :remote} with (field examination) in its layout",
312
+ fix: "Remove the fixed field from the layout, including nested groups.",
313
+ },
314
+ // ── Scenarios ──
315
+ E_SCENARIO_SHAPE: {
316
+ title: "A scenario block is malformed",
317
+ cause: 'Scenarios are (scenario name "Doc." :world account (given …) (do …) (at "date" (expect …)) …).',
318
+ example: "(scenario s :world example (expect …))",
319
+ fix: "Use finite given entity/evidence/signal records, do commands, and dated at/expect blocks.",
320
+ },
321
+ E_SCENARIO_REF: {
322
+ title: "A scenario names something undeclared",
323
+ cause: "An entity alias, account, component, requirement or property is unknown in this scenario.",
324
+ example: "(expect (status (VendorReview v) questionaire) :Open)",
325
+ fix: "Use names declared in this world, and declare local aliases in given.",
326
+ },
327
+ E_SCENARIO_TYPE: {
328
+ title: "A scenario value has the wrong type",
329
+ cause: "A literal does not match the declared field or key type.",
330
+ example: '(entity Vendor v {:tier "high"})',
331
+ fix: 'Use a literal of the declared type (:high for a keyword union, "YYYY-MM-DD" for Date).',
332
+ },
333
+ E_SCENARIO_DATE: {
334
+ title: "A scenario date is invalid or goes backwards",
335
+ cause: "Observation dates must be real dates and nondecreasing.",
336
+ example: '(at "2026-11-31" …)',
337
+ fix: "Use YYYY-MM-DD dates in nondecreasing order.",
338
+ },
339
+ E_SCENARIO_ASSERT: {
340
+ title: "A scenario expectation did not hold",
341
+ cause: "The observed status, work, rejection or property differed from (expect …).",
342
+ example: "(expect (status (VendorReview v) questionnaire) :Satisfied)",
343
+ fix: "Inspect the expected/actual values; correct the rule if the example is right, or the example if the rule is right.",
344
+ },
345
+ E_SCENARIO_RUN: {
346
+ title: "A scenario command could not run",
347
+ cause: 'Most often "Unasserted command rejection": a do command was rejected and no (expect (rejected n) …) follows. Also commands that reference state the scenario did not create.',
348
+ example: "(do (decide (VendorReview v) approve-exception :by owner)) ; owner is not a CISO",
349
+ fix: "Assert the rejection with (expect (rejected 1) :decision-authority), or fix the command; AUTHORING.md section 9 lists the rejection codes.",
350
+ },
351
+ E_SCENARIO_NOT_FOUND: {
352
+ title: "--scenario names no scenario",
353
+ cause: "The name passed to worldvm test --scenario is not declared.",
354
+ example: "worldvm test my-world --scenario typo",
355
+ fix: "Use one of the names listed in the help.",
356
+ },
357
+ // ── CLI ──
358
+ E_USAGE: {
359
+ title: "Invalid command line",
360
+ cause: "Unknown subcommand, missing directory or an option the subcommand does not accept.",
361
+ example: "worldvm chek my-world",
362
+ fix: "Run worldvm --help or worldvm <command> --help.",
363
+ },
364
+ E_NO_SOURCES: {
365
+ title: "The directory has no .forma files",
366
+ cause: "check/test/coverage compile every visible .forma file under the directory.",
367
+ example: "worldvm check ./empty",
368
+ fix: "Point at the world directory, or scaffold one with worldvm init <dir>.",
369
+ },
370
+ E_PROJECT_IO: {
371
+ title: "The directory cannot be read",
372
+ cause: "The path does not exist or is not readable.",
373
+ example: "worldvm check ./missing",
374
+ fix: "Pass a readable directory containing .forma source files.",
375
+ },
376
+ E_CHECK_THROW: {
377
+ title: "The compiler threw",
378
+ cause: "An internal compiler failure, not an authoring error.",
379
+ example: "",
380
+ fix: "Reduce the failing source to the smallest example and report it.",
381
+ },
382
+ E_TEST_RUNTIME: {
383
+ title: "The test engine threw",
384
+ cause: "An internal failure while running a scenario or property.",
385
+ example: "",
386
+ fix: "Reduce the failing scenario/property to its source example and report it.",
387
+ },
388
+ // ── Warnings ──
389
+ W_NO_PRODUCER: {
390
+ title: "No action advances this requirement",
391
+ cause: "Nothing can be done to satisfy the requirement from inside the world: no (action … :advances r) and no machine signal. Common and fine for detection requirements that flag a state.",
392
+ example: "(requirement active-only-if-reviewed :applies-when (= vendor.status :active) :satisfied-by (satisfied? self.review-complete))",
393
+ fix: "If people should act, add (action do-r :advances r :assignee … :via (interaction …)). If it is a detection, keep it in an output and accept this warning; to block the state instead of flagging it, add an (invariant …) (see AUTHORING.md, Detect vs prevent).",
394
+ },
395
+ W_NO_SCENARIO: {
396
+ title: "No scenario observes this requirement",
397
+ cause: "No scenario expects its status, an output containing it, or work/evidence advancing it.",
398
+ example: "(requirement dpa …) with no (expect (status (VendorReview v) dpa) …)",
399
+ fix: "Add a scenario with (expect (status (Component alias) requirement) :Open) and a step that satisfies it; worldvm coverage shows branches actually taken.",
400
+ },
401
+ W_UNREACHABLE_REQUIREMENT: {
402
+ title: "Nothing reads this requirement's status",
403
+ cause: "The requirement is in no output and no expression reads it, so it never affects a result.",
404
+ example: "(output review-complete (all-of questionnaire soc2)) ; dpa missing",
405
+ fix: "Add it to an output, e.g. (output review-complete (all-of questionnaire soc2 dpa)), or remove it. A machine fix is offered when the component has exactly one all-of output.",
406
+ },
407
+ W_UNCITED: {
408
+ title: "A requirement/invariant/retention has no citation",
409
+ cause: "Every obligation should say which source clause it implements.",
410
+ example: "(requirement dpa :satisfied-by …)",
411
+ fix: 'Add :cites [(source-name "clause")].',
412
+ },
413
+ W_NS_DEFAULTED: {
414
+ title: "An entity's attribute namespace was defaulted",
415
+ cause: "Without :ns, renaming the entity changes every stored attribute name.",
416
+ example: '(entity Vendor "…" :implements {…} {…})',
417
+ fix: "Pin it: :ns :example.vendor.",
418
+ },
419
+ W_CROSS_HOME_READ: {
420
+ title: "A read crosses into a home not proven equal",
421
+ cause: "A parent reads a child's output through a reference whose home may differ.",
422
+ example: "(output ready (all-of hire.i9.complete))",
423
+ fix: "Usually advisory; route the read through a child declared with :bind on the same home if possible.",
424
+ },
425
+ W_UNHANDLED_STATUS: {
426
+ title: "A custom child-output expression ignores a status",
427
+ cause: "The expression does not say what happens for NotApplicable or Unknown.",
428
+ example: "(output ok (status-of child.done))",
429
+ fix: "Handle NotApplicable/Unknown explicitly or use all-of/any-of.",
430
+ },
431
+ W_SHOW_COVERAGE_UNPROVEN: {
432
+ title: "Layout coverage of a required field cannot be proven",
433
+ cause: "A rule's predicate reads non-enum fields, so the checker cannot enumerate cases.",
434
+ example: "(rule r :when (> amount 10) :requires [note])",
435
+ fix: "Use keyword enums in rule predicates, or show the field unconditionally.",
436
+ },
437
+ W_ERASURE_CONFLICT: {
438
+ title: "Erasure may conflict with retention",
439
+ cause: "A vault allows on-request erasure while a cited retention obligation still applies.",
440
+ example: "",
441
+ fix: "Resolve the retention obligation before shredding.",
442
+ },
443
+ // ── Authoring lints added by the CLI ──
444
+ W_ATTESTED_EXPIRING: {
445
+ title: "attested ignores this evidence's :expires",
446
+ cause: "(attested E) is true once any record was signed, even after it expired. The evidence declares :expires, which suggests validity was intended.",
447
+ example: "(evidence Questionnaire … :expires valid-until …)\n(requirement q :satisfied-by (attested Questionnaire))",
448
+ fix: "Use (valid E), which is false once the signed expiry passes. A machine fix replaces attested with valid. Keep attested only when historical signing is what matters.",
449
+ },
450
+ W_SATISFIED_NOT_APPLICABLE: {
451
+ title: "satisfied? is false for NotApplicable",
452
+ cause: "(satisfied? r) is true only for Satisfied or Waived. Reading a requirement with :applies-when inside and or :needs means the conjunction can never hold when r does not apply. Reading an all-of output whose members can all be NotApplicable has the same effect: the output is then NotApplicable too.",
453
+ example: "(and (satisfied? questionnaire) (satisfied? dpa)) ; dpa applies only to high tier\n(satisfied? self.review-complete) ; every member has :applies-when",
454
+ fix: "Use (met? r), which is true for Satisfied, Waived or NotApplicable, on the requirement or the output. The machine fix replaces satisfied? with met?.",
455
+ },
456
+ I_DETECT_ONLY: {
457
+ title: "This requirement detects a state it could prevent",
458
+ cause: "The requirement has no producer and applies when a fact field has a particular value, so it only flags the state after the write. Nothing blocks the write itself.",
459
+ example: "(requirement active-only-if-reviewed :applies-when (= vendor.status :active) …)",
460
+ fix: "Keep the detection, and add an invariant that rejects the labelled write while the review is incomplete: (invariant no-activation-before-review :forbids (action-kind :activate :subject vendor) :while (not (met? self.review-complete))). Scenarios exercise it with (set v :status :active :kind :activate :subject v :by buyer) and (expect (rejected 1) :no-activation-before-review). Only writes submitted as commands with that :kind are checked, and an Unknown :while admits the write.",
461
+ },
462
+ };
463
+ export const catalogueEntry = (code) => {
464
+ const renamed = Object.hasOwn(DIAGNOSTIC_RENAMES, code) ? DIAGNOSTIC_RENAMES[code] : undefined;
465
+ if (renamed)
466
+ return (CATALOGUE[renamed] ?? {
467
+ title: `Diagnostic renamed to ${renamed}`,
468
+ cause: `${code} now uses the uniform diagnostic code ${renamed}.`,
469
+ example: "",
470
+ fix: generic,
471
+ });
472
+ return Object.hasOwn(CATALOGUE, code) ? CATALOGUE[code] : undefined;
473
+ };
474
+ /** Plain-text explanation used by `worldvm explain`. */
475
+ export const explain = (code) => {
476
+ const entry = catalogueEntry(code);
477
+ if (!entry)
478
+ return undefined;
479
+ return [
480
+ `${code}${DIAGNOSTIC_RENAMES[code] ? ` was renamed to ${DIAGNOSTIC_RENAMES[code]}` : ""}: ${entry.title}`,
481
+ "",
482
+ `Cause: ${entry.cause}`,
483
+ ...(entry.example ? ["", "Example:", ...entry.example.split("\n").map((l) => ` ${l}`)] : []),
484
+ "",
485
+ `Fix: ${entry.fix}`,
486
+ ].join("\n");
487
+ };
488
+ /** Edit distance for did-you-mean suggestions. */
489
+ export const distance = (a, b) => {
490
+ const row = Array.from({ length: b.length + 1 }, (_, i) => i);
491
+ for (let i = 1; i <= a.length; i++) {
492
+ let prev = row[0];
493
+ row[0] = i;
494
+ for (let j = 1; j <= b.length; j++) {
495
+ const tmp = row[j];
496
+ row[j] = Math.min(row[j] + 1, row[j - 1] + 1, prev + (a[i - 1] === b[j - 1] ? 0 : 1));
497
+ prev = tmp;
498
+ }
499
+ }
500
+ return row[b.length];
501
+ };
502
+ export const closest = (word, candidates) => {
503
+ let best, score = Infinity;
504
+ for (const c of candidates) {
505
+ const d = distance(word, c);
506
+ if (d < score)
507
+ [best, score] = [c, d];
508
+ }
509
+ return best !== undefined && score <= Math.max(2, Math.floor(word.length / 3)) ? best : undefined;
510
+ };
511
+ /** The diagnostics catalogue section of AUTHORING.md, generated from the table. */
512
+ export const catalogueMarkdown = () => {
513
+ const cell = (text) => text.replace(/\|/g, "\\|").replace(/\n/g, "<br>");
514
+ const rows = Object.keys(CATALOGUE)
515
+ .sort()
516
+ .map((code) => {
517
+ const e = CATALOGUE[code];
518
+ return `| \`${code}\` | ${cell(e.title)} | ${cell(e.cause)} | ${cell(e.fix)} |`;
519
+ });
520
+ return [
521
+ "| Code | Meaning | Usual cause | Fix |",
522
+ "| ---- | ------- | ----------- | --- |",
523
+ ...rows,
524
+ "",
525
+ "### Renamed diagnostic codes",
526
+ "",
527
+ "| Old code | New code |",
528
+ "| --- | --- |",
529
+ ...Object.entries(DIAGNOSTIC_RENAMES).map(([old, next]) => `| \`${old}\` | \`${next}\` |`),
530
+ ].join("\n");
531
+ };
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare const main: () => Promise<number>;
2
+ export * from "./index.js";