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,298 @@
1
+ import { compositionParameters } from "./parameters.js";
2
+ import { policyParameter } from "./policies.js";
3
+ import { contextOf } from "./context.js";
4
+ import { observeBasis, ReadSet } from "./dependencies.js";
5
+ import { evaluateIn, instanceId, isUnknown, selectedAddition, truth, vars } from "./evaluation.js";
6
+ import { Unknown, } from "./model.js";
7
+ import { structuralObservation } from "./provenance.js";
8
+ import { semanticJson } from "./result-digest.js";
9
+ import { timed } from "./scheduling.js";
10
+ export const rankCache = new WeakMap();
11
+ export const componentRanks = (p) => {
12
+ const cached = rankCache.get(p);
13
+ if (cached !== undefined)
14
+ return cached;
15
+ const reachable = new Set(p.roots.map((r) => r.component));
16
+ for (const name of reachable)
17
+ for (const slot of p.components.get(name).slots)
18
+ reachable.add(slot.component);
19
+ const incoming = new Map([...reachable].map((name) => [name, 0]));
20
+ for (const name of reachable)
21
+ for (const slot of p.components.get(name).slots)
22
+ incoming.set(slot.component, incoming.get(slot.component) + 1);
23
+ const ready = [...reachable].filter((name) => incoming.get(name) === 0);
24
+ const ranks = new Map();
25
+ for (let i = 0; i < ready.length; i++) {
26
+ const name = ready[i];
27
+ ranks.set(name, i);
28
+ for (const slot of p.components.get(name).slots) {
29
+ const remaining = incoming.get(slot.component) - 1;
30
+ incoming.set(slot.component, remaining);
31
+ if (remaining === 0)
32
+ ready.push(slot.component);
33
+ }
34
+ }
35
+ const result = ranks.size === reachable.size ? ranks : null;
36
+ rankCache.set(p, result);
37
+ return result;
38
+ };
39
+ export const make = (ctx, p, component, key, inputs, cycle, parameters) => {
40
+ const id = instanceId(component, key, cycle);
41
+ let inst = ctx.instances.get(id);
42
+ if (!inst) {
43
+ inst = {
44
+ id,
45
+ account: p.account.name,
46
+ component,
47
+ key,
48
+ inputs,
49
+ ...(parameters ? { params: parameters } : {}),
50
+ cycle,
51
+ attached: [],
52
+ parents: new Set(),
53
+ children: [],
54
+ prior: cycle > 1 ? instanceId(component, key, cycle - 1) : null,
55
+ };
56
+ ctx.instances.set(id, inst);
57
+ ctx.programOf.set(id, p);
58
+ }
59
+ return inst;
60
+ };
61
+ export const truthOf = (cx, e) => {
62
+ if (!e)
63
+ return { truth: true, reason: "Always applies" };
64
+ const v = evaluateIn(cx, e);
65
+ return {
66
+ truth: truth(v),
67
+ reason: isUnknown(v) ? `Unknown: ${v.why}` : v === true ? "true" : "false",
68
+ };
69
+ };
70
+ export const bindKey = (ctx, cx, slot, child) => {
71
+ const bindings = timed(ctx, cx, ["slot", slot.name, "bind"], `${slot.name}: bindings change`, (active) => slot.bind.map((binding) => [binding.input, evaluateIn(active, binding.expr)]), semanticJson, { discovery: true });
72
+ const inputs = new Map(bindings);
73
+ return { inputs, key: child.key.map((k) => inputs.get(k) ?? new Unknown(k)) };
74
+ };
75
+ export const unresolvedKey = (parent, slot, key) => {
76
+ const missing = key.filter(isUnknown);
77
+ if (missing.length === 0)
78
+ return false;
79
+ parent.children[parent.children.indexOf(slot)] = {
80
+ ...slot,
81
+ applies: "unknown",
82
+ reason: `Unresolved key: ${missing.map((v) => v.why).join("; ")}`,
83
+ };
84
+ return true;
85
+ };
86
+ export const cyclesOf = (ctx, p, component, attached, inputs, reads, parameters) => {
87
+ if (!component.cycle)
88
+ return [attached];
89
+ const env = vars([
90
+ ...inputs,
91
+ ...component.params.map((param) => [param.name, parameters?.get(param.name) ?? p.params.get(param.name) ?? null]),
92
+ ["attached", attached],
93
+ ]);
94
+ const spells = timed(ctx, { p, b: observeBasis(ctx.b, reads), inst: undefined, env, k: ctx.state, reads }, ["composition", "cycle"], `${component.name}: cycle membership changes`, (active) => {
95
+ if (!component.paramBounds?.length)
96
+ return evaluateIn(active, component.cycle);
97
+ const inst = {
98
+ id: instanceId(component.name, component.key.map((name) => inputs.get(name)), 1),
99
+ account: p.account.name,
100
+ component: component.name,
101
+ key: component.key.map((name) => inputs.get(name)),
102
+ inputs,
103
+ ...(parameters ? { params: parameters } : {}),
104
+ cycle: 1,
105
+ attached: [...attached],
106
+ parents: new Set(),
107
+ children: [],
108
+ prior: null,
109
+ };
110
+ const cx = { ...active, inst };
111
+ return evaluateIn({
112
+ ...cx,
113
+ env: vars(component.params.map((param) => [
114
+ param.name,
115
+ policyParameter(cx, param.name, parameters?.get(param.name) ?? p.params.get(param.name)),
116
+ ]), env),
117
+ }, component.cycle);
118
+ }, semanticJson, {
119
+ discovery: true,
120
+ instance: instanceId(component.name, component.key.map((name) => inputs.get(name)), 1),
121
+ });
122
+ return Array.isArray(spells) ? spells : [attached];
123
+ };
124
+ export const slotFor = (slot, applies) => ({
125
+ name: slot.name,
126
+ component: slot.component,
127
+ mode: slot.mode,
128
+ applies: applies.truth,
129
+ reason: applies.reason,
130
+ instances: [],
131
+ });
132
+ export const membersOf = (group) => {
133
+ const members = [...group.members];
134
+ if (group.links.some((link) => link.parent !== group.links[0].parent))
135
+ members.sort();
136
+ return members;
137
+ };
138
+ export const buildInstanceGraph = (ctx) => {
139
+ const recursive = ctx.programs.some((p) => componentRanks(p) === null);
140
+ let previous = new Map();
141
+ while (true) {
142
+ ctx.instances.clear();
143
+ ctx.programOf.clear();
144
+ ctx.contexts.clear();
145
+ ctx.observations.clear();
146
+ ctx.results.clear();
147
+ ctx.evaluating.clear();
148
+ ctx.resolvingOutputs.clear();
149
+ ctx.roots.length = 0;
150
+ ctx.rootFocus.clear();
151
+ ctx.blockedTotal = 0;
152
+ ctx.temporalJobs.length = 0;
153
+ ctx.discoveryJobs.length = 0;
154
+ const groups = new Map();
155
+ const seeds = [];
156
+ const buckets = Array.from({
157
+ length: recursive
158
+ ? 1
159
+ : Math.max(0, ...ctx.programs.map((p) => componentRanks(p).size)) + 1,
160
+ }, () => []);
161
+ const addGroup = (p, component, key, inputs, members) => {
162
+ const id = `${p.account.name}|${instanceId(component.name, key, 1)}`;
163
+ let group = groups.get(id);
164
+ if (!group) {
165
+ group = {
166
+ id,
167
+ p,
168
+ component,
169
+ key,
170
+ inputs,
171
+ members: new Set(),
172
+ links: [],
173
+ resolved: [],
174
+ root: false,
175
+ };
176
+ groups.set(id, group);
177
+ buckets[recursive ? 0 : componentRanks(p).get(component.name)].push(group);
178
+ }
179
+ members.forEach((member) => group.members.add(member));
180
+ return group;
181
+ };
182
+ for (const p of ctx.programs)
183
+ for (const root of p.roots) {
184
+ const component = p.components.get(root.component);
185
+ const subjects = ctx.scope
186
+ ? ctx.scope.subjects(component.name, root.namespaces)
187
+ : root.namespaces.flatMap((ns) => ctx.b.entities(ns)).sort();
188
+ for (const subject of subjects) {
189
+ const group = addGroup(p, component, [subject], new Map([[component.key[0], subject]]), [
190
+ subject,
191
+ ]);
192
+ group.root = true;
193
+ seeds.push({ group, subject });
194
+ }
195
+ }
196
+ // A DAG can collect every parent before visiting its children. Recursive definitions
197
+ // rebuild from the preceding membership solution, so late paths can also add or remove cycles.
198
+ for (const bucket of buckets)
199
+ for (let cursor = 0; cursor < bucket.length; cursor++) {
200
+ const group = bucket[cursor];
201
+ const { p, component, key, inputs } = group;
202
+ const members = (recursive ? previous.get(group.id) : undefined) ?? membersOf(group);
203
+ const parameters = compositionParameters(p, component, group.links.flatMap((link) => link.with ?? []));
204
+ const cycleReads = new ReadSet();
205
+ const cycles = group.root
206
+ ? [members]
207
+ : cyclesOf(ctx, p, component, members, inputs, cycleReads, parameters);
208
+ group.resolved = cycles.map((attached, index) => {
209
+ const inst = make(ctx, p, component.name, key, inputs, index + 1, parameters);
210
+ inst.attached.push(...attached);
211
+ const reads = new ReadSet();
212
+ reads.merge(cycleReads.entries());
213
+ ctx.observations.set(inst.id, reads);
214
+ return inst;
215
+ });
216
+ if (!group.root && component.cycle)
217
+ ctx.discoveryJobs.push(() => {
218
+ // A cycle can be empty now; its parents must still retain the reads that can create it.
219
+ const ids = [
220
+ ...group.resolved.map((inst) => inst.id),
221
+ ...group.links.map((link) => link.parent.id),
222
+ ];
223
+ for (const id of ids)
224
+ ctx.observations.get(id).merge(cycleReads.entries(), structuralObservation);
225
+ });
226
+ for (const parent of group.resolved) {
227
+ if (!component.slots.length)
228
+ continue;
229
+ const cx = contextOf(ctx, parent);
230
+ for (const slot of component.slots) {
231
+ const applies = timed(ctx, cx, ["slot", slot.name, "applies"], `${slot.name}: applicability changes`, (active) => {
232
+ const addition = slot.discretionary
233
+ ? selectedAddition(active, slot.name, (date) => active.temporal?.add(date))
234
+ : null;
235
+ if (slot.discretionary && !addition)
236
+ return { truth: false, reason: "No standing addition" };
237
+ const applies = truthOf(active, slot.appliesWhen);
238
+ return addition
239
+ ? {
240
+ ...applies,
241
+ reason: `${applies.reason}; added by ${addition.record.by} on ${addition.record.at} (${addition.record.id})`,
242
+ }
243
+ : applies;
244
+ }, (value) => (slot.discretionary ? semanticJson(value) : String(value.truth)), { discovery: true });
245
+ const childSlot = slotFor(slot, applies);
246
+ parent.children.push(childSlot);
247
+ if (childSlot.applies !== true)
248
+ continue;
249
+ const child = p.components.get(slot.component);
250
+ const bound = bindKey(ctx, cx, slot, child);
251
+ if (unresolvedKey(parent, childSlot, bound.key))
252
+ continue;
253
+ addGroup(p, child, bound.key, bound.inputs, parent.attached).links.push({
254
+ parent,
255
+ slot: childSlot,
256
+ members: parent.attached,
257
+ ...(slot.with ? { with: slot.with } : {}),
258
+ });
259
+ }
260
+ }
261
+ }
262
+ if (recursive) {
263
+ const current = new Map([...groups].map(([id, group]) => [id, membersOf(group)]));
264
+ if (current.size !== previous.size ||
265
+ [...current].some(([id, members]) => JSON.stringify(members) !== JSON.stringify(previous.get(id)))) {
266
+ previous = current;
267
+ continue;
268
+ }
269
+ }
270
+ for (const group of groups.values())
271
+ for (const inst of group.resolved) {
272
+ const attached = new Set(inst.attached);
273
+ for (const link of group.links)
274
+ if (link.members.some((member) => attached.has(member))) {
275
+ inst.parents.add(link.parent.id);
276
+ if (!link.slot.instances.includes(inst.id))
277
+ link.slot.instances.push(inst.id);
278
+ }
279
+ }
280
+ for (const { group, subject } of seeds)
281
+ for (const inst of group.resolved)
282
+ if (inst.attached.includes(subject)) {
283
+ ctx.roots.push({ subject, account: group.p.account.name, instance: inst.id });
284
+ ctx.rootFocus.set(inst.id, subject);
285
+ }
286
+ ctx.discoveryReadSets = new Map([...ctx.contexts].map(([id, cx]) => [id, cx.reads]));
287
+ for (const [id, cx] of ctx.contexts)
288
+ ctx.observations.get(id).merge(cx.reads.entries(), structuralObservation);
289
+ // Applicability can read a parent's requirements while discovering slots. Those partial
290
+ // projections must not survive the final membership and link graph.
291
+ ctx.results.clear();
292
+ ctx.evaluating.clear();
293
+ ctx.contexts.clear();
294
+ ctx.blockedTotal = 0;
295
+ ctx.temporalJobs.length = 0;
296
+ break;
297
+ }
298
+ };
@@ -0,0 +1,6 @@
1
+ import type { EvaluationContext } from "./context.js";
2
+ import type * as IR from "../world-ir/types.generated.js";
3
+ import type { Cx, HoldResult } from "./model.js";
4
+ export declare const evaluateHolds: (ctx: EvaluationContext, cx: Cx, component: IR.Component) => HoldResult[];
5
+ /** Missing authority to proceed conservatively pauses work; facts can resolve it later. */
6
+ export declare const activeHolds: (holds: readonly HoldResult[], policy: IR.Hold["pauses"][number]) => HoldResult[];
@@ -0,0 +1,18 @@
1
+ import { evaluateIn, isUnknown, truth } from "./evaluation.js";
2
+ import { timed } from "./scheduling.js";
3
+ export const evaluateHolds = (ctx, cx, component) => (component.holds ?? []).map((hold, index) => {
4
+ const read = timed(ctx, cx, ["hold", String(index), hold.name], `${hold.label ?? hold.name}: hold changes`, (c) => {
5
+ const value = evaluateIn(c, hold.while);
6
+ return { condition: truth(value), unknown: isUnknown(value) ? value.why : null };
7
+ });
8
+ return {
9
+ name: hold.name,
10
+ label: hold.label ?? hold.name,
11
+ ...read,
12
+ pauses: hold.pauses,
13
+ ...(hold.cites ? { cites: hold.cites } : {}),
14
+ at: hold.at,
15
+ };
16
+ });
17
+ /** Missing authority to proceed conservatively pauses work; facts can resolve it later. */
18
+ export const activeHolds = (holds, policy) => holds.filter((hold) => hold.condition !== false && hold.pauses.includes(policy));
@@ -0,0 +1,11 @@
1
+ import type * as IR from "../world-ir/types.generated.js";
2
+ export interface HomeDefinitions {
3
+ readonly ir: {
4
+ readonly roles: readonly Pick<IR.Role, "name">[];
5
+ readonly entities: readonly Pick<IR.Entity, "name">[];
6
+ };
7
+ readonly components: ReadonlyMap<string, Pick<IR.Component, "key" | "inputs">>;
8
+ }
9
+ export declare const inferEntityHome: (p: HomeDefinitions, component: string, seen?: Set<string>) => Extract<IR.Home, {
10
+ readonly kind: "input";
11
+ }> | undefined;
@@ -0,0 +1,25 @@
1
+ export const inferEntityHome = (p, component, seen = new Set()) => {
2
+ if (seen.has(component))
3
+ return undefined;
4
+ const c = p.components.get(component);
5
+ const first = c.key[0];
6
+ const targetOf = (t) => {
7
+ if (!Array.isArray(t))
8
+ return undefined;
9
+ return t[0] === "Option"
10
+ ? targetOf(t[1])
11
+ : t[0] === "Id" && typeof t[1] === "string"
12
+ ? t[1]
13
+ : undefined;
14
+ };
15
+ const target = targetOf(c.inputs.find((f) => f.name === first)?.type);
16
+ if (first &&
17
+ target &&
18
+ (p.ir.roles.some((r) => r.name === target) || p.ir.entities.some((e) => e.name === target)))
19
+ return { kind: "input", path: [first] };
20
+ if (first && target && p.components.has(target)) {
21
+ const nested = inferEntityHome(p, target, new Set([...seen, component]));
22
+ return nested ? { kind: "input", path: [first, ...nested.path] } : undefined;
23
+ }
24
+ return undefined;
25
+ };
@@ -0,0 +1,6 @@
1
+ import { type Instance, type Program, type SubjectHome } from "./model.js";
2
+ export { inferEntityHome } from "./home-definitions.js";
3
+ export declare const homesCache: WeakMap<Program, ReadonlyMap<string, readonly string[]>>;
4
+ export declare const entityHomes: (p: Program) => ReadonlyMap<string, readonly string[]>;
5
+ /** A missing home input stays unresolved; it does not acquire a different owner. */
6
+ export declare const occurrenceHome: (p: Program, inst: Instance, instances: ReadonlyMap<string, Instance>) => SubjectHome | null;
@@ -0,0 +1,32 @@
1
+ import { isInst } from "./evaluation.js";
2
+ import {} from "./model.js";
3
+ import { inferEntityHome } from "./home-definitions.js";
4
+ export { inferEntityHome } from "./home-definitions.js";
5
+ export const homesCache = new WeakMap();
6
+ export const entityHomes = (p) => {
7
+ const cached = homesCache.get(p);
8
+ if (cached)
9
+ return cached;
10
+ const homes = new Map();
11
+ for (const name of p.components.keys()) {
12
+ const home = inferEntityHome(p, name);
13
+ if (!home || home.kind !== "input")
14
+ throw new Error(`E_NO_HOME: ${name} must have an entity-reference first key. Republish this model.`);
15
+ homes.set(name, home.path);
16
+ }
17
+ homesCache.set(p, homes);
18
+ return homes;
19
+ };
20
+ /** A missing home input stays unresolved; it does not acquire a different owner. */
21
+ export const occurrenceHome = (p, inst, instances) => {
22
+ const path = entityHomes(p).get(inst.component);
23
+ let value = { inst: inst.id };
24
+ for (const field of path) {
25
+ if (!value || !isInst(value))
26
+ return null;
27
+ value = instances.get(value.inst)?.inputs.get(field);
28
+ }
29
+ if (typeof value === "string")
30
+ return { kind: "entity", id: value };
31
+ return null;
32
+ };
@@ -0,0 +1,42 @@
1
+ export { sensitivePayload, sensitivityOfType } from "../ir-checks/index.js";
2
+ export { operationsFor, invokeOperation, type OperationTarget, type OperationRequest, type OperationResult, type PublicOperation, } from "./component-operations.js";
3
+ export * from "./reconcile.js";
4
+ export * from "./basis.js";
5
+ export { collectionTasks, collectFacts, type CollectionTask, type CollectionField, } from "./collections.js";
6
+ export { projectInteractionFields } from "./interaction-fields.js";
7
+ export * from "./memory.js";
8
+ export { recordMilestones } from "./milestones.js";
9
+ export * from "./discovery.js";
10
+ export * from "./dates.js";
11
+ export * from "./instants.js";
12
+ export * as IR from "./wire.js";
13
+ export { Compiled, WorldIR, decodeCompiled } from "./wire.js";
14
+ export { dependencyKey, type Dependency } from "./dependencies.js";
15
+ export { sha256 } from "./sha256.js";
16
+ export { canonicalJson, canonicalResult, resultDigest } from "./result-digest.js";
17
+ export { subjectChanged } from "./change-detection.js";
18
+ export { createScenarioRunner, type ScenarioRunner, runScenario, runScenarios, type ScenarioResult, type ScenarioFailure, type ScenarioCommandOutcome, } from "./scenarios.js";
19
+ export { log, perform, signal, command, validEvidence, type Perform, type WorkActor, type Command, } from "./commands.js";
20
+ export { evaluateProperty } from "./property-eval.js";
21
+ export { generatePropertyCase, validatePropertyOptions, type PropertyOptions, } from "./property-generator.js";
22
+ export { checkProperty, checkProperties, type PropertyResult, type PropertyFailure, } from "./properties.js";
23
+ export { shrinkPropertyFailure, type ShrunkPropertyFailure } from "./property-shrink.js";
24
+ export { createCoverageCollector, type RequirementCoverage, type CoverageOutcomes, type CoverageTruth, type CoverageReference, } from "./coverage.js";
25
+ export { decide, type DecisionRequest, type DecisionResult } from "./decide.js";
26
+ export { priorCycleDecisionName, priorCycleOperationName, reuseDecisionName, } from "../ir-checks/index.js";
27
+ export { previewPolicyParameters, type PolicyParameterPreview } from "./policy-edits.js";
28
+ export { workItems, type ProjectedWork, type WorkMember } from "./work.js";
29
+ export { bundleFor, type BundleItem, type BundleSession } from "./bundles.js";
30
+ export { fileDigest, fileAllowed, factFileAllowed } from "./files.js";
31
+ export { validFact } from "./fact-validation.js";
32
+ export { documentIntents, type DocumentIntent, type DocumentCorrection } from "./documents.js";
33
+ export { noticeProjection, type NoticeCopy } from "./notices.js";
34
+ export { signatureValid, type SignatureTrail } from "./signatures.js";
35
+ export { amendEvidence } from "./commands.js";
36
+ export { resourceProjection, resourceIntentKey, type ResourceView } from "./resources.js";
37
+ export type { LifecycleRecord, ResourceRecord, ResourceIntent } from "./basis.js";
38
+ export { resourceProgramDigest } from "./resource-generation.js";
39
+ export { amendmentAction } from "./amendments.js";
40
+ export { dataReadInfo, agentReadInfo, agentReadDiagnostics, type DataReadSelector, type AgentReadPermission, } from "../ir-checks/index.js";
41
+ export type { Missing } from "./missing.js";
42
+ export { resourceMachineScope } from "./resource-generation.js";
@@ -0,0 +1,58 @@
1
+ export { sensitivePayload, sensitivityOfType } from "../ir-checks/index.js";
2
+ export { operationsFor, invokeOperation, } from "./component-operations.js";
3
+ // world-ir owns generated wire schemas/types; wire preserves the public decode boundary.
4
+ // Kernel map: model/context define the explicit evaluation state; linking/homes resolve
5
+ // scopes; graph discovers instances; requirements/actions/outputs evaluate them;
6
+ // decision-evaluation/decision-records select standing human grants and additions;
7
+ // escalations derives finite due-relative intents with visible Unknown/hold projections;
8
+ // policies adds cited account constraints and authority intersections; policy-linking checks bounds/releases;
9
+ // effective applies fixed release windows with located proof and boundary wakeups;
10
+ // recurrence derives anchored periods directly, with period-local proof and bounded wakeups;
11
+ // reuse queries indexed immutable proof scopes and standing human confirmations;
12
+ // evidence-validity reads signed expiry fields and deadline-keyed early renewal work;
13
+ // milestones projects immutable first reaches and visible later regression findings;
14
+ // holds overlays occurrence-local dispatch/reminders without changing deadlines;
15
+ // interaction-fields projects missing, known and path-bound facts through observed reads;
16
+ // action-intents derives dispatch and ineligibility policy without storing work;
17
+ // bundles orders supplied actor-scoped work for presentation without changing eligibility;
18
+ // work projects identity/provenance and suppresses conflicting multi-target dispatch;
19
+ // scheduling/projections/proofs retain wakeups, dependencies and digests; invariants/upgrades
20
+ // handle write admission and release planning. reconcile preserves the public entry points.
21
+ export * from "./reconcile.js";
22
+ export * from "./basis.js";
23
+ export { collectionTasks, collectFacts, } from "./collections.js";
24
+ export { projectInteractionFields } from "./interaction-fields.js";
25
+ export * from "./memory.js";
26
+ export { recordMilestones } from "./milestones.js";
27
+ export * from "./discovery.js";
28
+ export * from "./dates.js";
29
+ export * from "./instants.js";
30
+ export * as IR from "./wire.js";
31
+ export { Compiled, WorldIR, decodeCompiled } from "./wire.js";
32
+ export { dependencyKey } from "./dependencies.js";
33
+ export { sha256 } from "./sha256.js";
34
+ export { canonicalJson, canonicalResult, resultDigest } from "./result-digest.js";
35
+ export { subjectChanged } from "./change-detection.js";
36
+ export { createScenarioRunner, runScenario, runScenarios, } from "./scenarios.js";
37
+ export { log, perform, signal, command, validEvidence, } from "./commands.js";
38
+ export { evaluateProperty } from "./property-eval.js";
39
+ export { generatePropertyCase, validatePropertyOptions, } from "./property-generator.js";
40
+ export { checkProperty, checkProperties, } from "./properties.js";
41
+ export { shrinkPropertyFailure } from "./property-shrink.js";
42
+ export { createCoverageCollector, } from "./coverage.js";
43
+ export { decide } from "./decide.js";
44
+ export { priorCycleDecisionName, priorCycleOperationName, reuseDecisionName, } from "../ir-checks/index.js";
45
+ export { previewPolicyParameters } from "./policy-edits.js";
46
+ export { workItems } from "./work.js";
47
+ export { bundleFor } from "./bundles.js";
48
+ export { fileDigest, fileAllowed, factFileAllowed } from "./files.js";
49
+ export { validFact } from "./fact-validation.js";
50
+ export { documentIntents } from "./documents.js";
51
+ export { noticeProjection } from "./notices.js";
52
+ export { signatureValid } from "./signatures.js";
53
+ export { amendEvidence } from "./commands.js";
54
+ export { resourceProjection, resourceIntentKey } from "./resources.js";
55
+ export { resourceProgramDigest } from "./resource-generation.js";
56
+ export { amendmentAction } from "./amendments.js";
57
+ export { dataReadInfo, agentReadInfo, agentReadDiagnostics, } from "../ir-checks/index.js";
58
+ export { resourceMachineScope } from "./resource-generation.js";
@@ -0,0 +1,17 @@
1
+ import { type LocalDate } from "./dates.js";
2
+ export { isInstant, normalizeInstant } from "../ir-checks/index.js";
3
+ export type Instant = string;
4
+ export type TimePoint = LocalDate | Instant;
5
+ export type TimeUnit = "minutes" | "hours" | "days" | "months" | "years";
6
+ /** Mixed ordering treats a date as its UTC midnight; it never rewrites the stored date. */
7
+ export declare const compareTime: (a: TimePoint, b: TimePoint) => -1 | 0 | 1;
8
+ /** The current in-memory clock has a UTC date projection; per-worksite zones are separate. */
9
+ export declare const localDateAt: (point: TimePoint) => LocalDate;
10
+ export declare const isPastDeadline: (now: TimePoint, due: TimePoint) => boolean;
11
+ export declare const shiftTime: (point: TimePoint, n: number, unit: TimeUnit) => TimePoint;
12
+ /** Next representable predicate boundary; stop at the supported calendar's end. */
13
+ export declare const nextTime: (point: TimePoint) => TimePoint | null;
14
+ /** Host/command timestamps are normalized; preserve the old date-only hot path. */
15
+ export declare const timeOrder: (a: TimePoint, b: TimePoint) => -1 | 0 | 1;
16
+ /** Date deadlines include their final millisecond; instant deadlines keep their exact end. */
17
+ export declare const deadlineOrder: (a: TimePoint, b: TimePoint) => -1 | 0 | 1;
@@ -0,0 +1,56 @@
1
+ import { isInstant, isLocalDate, timePointKey } from "../ir-checks/index.js";
2
+ import { addDays, addMonths, addYears } from "./dates.js";
3
+ export { isInstant, normalizeInstant } from "../ir-checks/index.js";
4
+ const checked = (value) => {
5
+ if (!isLocalDate(value) && !isInstant(value))
6
+ throw new RangeError("Expected a local date or canonical UTC millisecond instant");
7
+ return value;
8
+ };
9
+ /** Mixed ordering treats a date as its UTC midnight; it never rewrites the stored date. */
10
+ export const compareTime = (a, b) => {
11
+ const left = timePointKey(a), right = timePointKey(b);
12
+ return left === right ? 0 : left < right ? -1 : 1;
13
+ };
14
+ /** The current in-memory clock has a UTC date projection; per-worksite zones are separate. */
15
+ export const localDateAt = (point) => checked(point).slice(0, 10);
16
+ export const isPastDeadline = (now, due) => isLocalDate(due) ? localDateAt(now) > due : compareTime(now, due) > 0;
17
+ export const shiftTime = (point, n, unit) => {
18
+ checked(point);
19
+ if (!Number.isSafeInteger(n))
20
+ throw new RangeError("Time offsets must be safe integers");
21
+ const date = point.slice(0, 10), instant = point.length !== 10;
22
+ if (!instant && (unit === "minutes" || unit === "hours"))
23
+ throw new RangeError("Sub-day offsets require an instant");
24
+ let result;
25
+ if (unit === "years" || unit === "months" || (!instant && unit === "days")) {
26
+ const shifted = unit === "years"
27
+ ? addYears(date, n)
28
+ : unit === "months"
29
+ ? addMonths(date, n)
30
+ : addDays(date, n);
31
+ result = instant ? `${shifted}${point.slice(10)}` : shifted;
32
+ }
33
+ else {
34
+ const scale = unit === "minutes" ? 60_000 : unit === "hours" ? 3_600_000 : 86_400_000;
35
+ result = new Date(Date.parse(point) + n * scale).toISOString();
36
+ }
37
+ return checked(result);
38
+ };
39
+ /** Next representable predicate boundary; stop at the supported calendar's end. */
40
+ export const nextTime = (point) => {
41
+ checked(point);
42
+ try {
43
+ return point.length === 10
44
+ ? shiftTime(point, 1, "days")
45
+ : checked(new Date(Date.parse(point) + 1).toISOString());
46
+ }
47
+ catch (error) {
48
+ if (!(error instanceof RangeError))
49
+ throw error;
50
+ return null;
51
+ }
52
+ };
53
+ /** Host/command timestamps are normalized; preserve the old date-only hot path. */
54
+ export const timeOrder = (a, b) => a.length === b.length ? (a === b ? 0 : a < b ? -1 : 1) : compareTime(a, b);
55
+ /** Date deadlines include their final millisecond; instant deadlines keep their exact end. */
56
+ export const deadlineOrder = (a, b) => timeOrder(a.length === 10 ? `${a}T23:59:59.999Z` : a, b.length === 10 ? `${b}T23:59:59.999Z` : b);
@@ -0,0 +1,10 @@
1
+ import type { Basis } from "./basis.js";
2
+ import type { TimePoint } from "./instants.js";
3
+ import type * as IR from "../world-ir/types.generated.js";
4
+ import type { InteractionField, Program, Value } from "./model.js";
5
+ export declare const bindingReadOnly: (p: Program, binding: IR.InteractionBinding) => boolean;
6
+ /** The caller supplies its observed evaluation context, keeping fact reads in the proof. */
7
+ export declare const projectInteractionFields: (p: Program, interaction: IR.Interaction, read: (expr: IR.Expr) => Value, source?: {
8
+ readonly basis: Basis;
9
+ readonly temporal?: Set<TimePoint>;
10
+ }) => readonly InteractionField[];
@@ -0,0 +1,30 @@
1
+ import { collectionState } from "./collection-rules.js";
2
+ import { isUnknown } from "./evaluation.js";
3
+ export const bindingReadOnly = (p, binding) => {
4
+ const expr = binding.target ?? binding.from;
5
+ return (expr?.k === "attr" && !!expr.meta.via && (p.bindings.get(expr.meta.via)?.attrs.length ?? 0) > 1);
6
+ };
7
+ /** The caller supplies its observed evaluation context, keeping fact reads in the proof. */
8
+ export const projectInteractionFields = (p, interaction, read, source) => (p.evidence.get(interaction.produces)?.fields ?? [])
9
+ .filter(({ name }) => !interaction.fixes?.some((fixed) => fixed.field === name))
10
+ .map(({ name: field }) => {
11
+ const binding = interaction.binds.find((b) => b.field === field);
12
+ const expr = binding?.from ?? binding?.target;
13
+ const value = expr ? read(expr) : null;
14
+ const known = typeof value === "string" || typeof value === "number" || typeof value === "boolean";
15
+ const entity = source && expr?.k === "attr" && p.ir.collects?.length ? read(expr.of) : null;
16
+ const collection = source && expr?.k === "attr" && typeof entity === "string"
17
+ ? collectionState(p, source.basis, entity, expr.attr, source.temporal)
18
+ : undefined;
19
+ return {
20
+ ...(collection ? { collection } : {}),
21
+ field,
22
+ mode: binding && bindingReadOnly(p, binding) ? "read-only" : known ? "confirm" : "ask",
23
+ value: known ? value : null,
24
+ ...(isUnknown(value)
25
+ ? { unknown: value.why }
26
+ : expr && !known
27
+ ? { unknown: `${field} has no scalar fact value` }
28
+ : {}),
29
+ };
30
+ });
@@ -0,0 +1,8 @@
1
+ import { type Basis } from "./basis.js";
2
+ import { type LocalDate } from "./dates.js";
3
+ import { type Violation, type WorldReconciliation } from "./model.js";
4
+ /** Would a command of `kind` against `subject` violate a declared invariant at `now`? */
5
+ export declare const admit: (recon: WorldReconciliation, b: Basis, now: LocalDate, command: {
6
+ readonly kind: string;
7
+ readonly subject: string;
8
+ }) => readonly Violation[];