@sunshaobei/dsh-workflow 0.0.0-stage → 2.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 (386) hide show
  1. package/README.md +43 -2
  2. package/cordis.patch.yml +17 -0
  3. package/lib/client.js +14708 -0
  4. package/lib/core.js +137 -0
  5. package/lib/engine-adapter.js +1387 -0
  6. package/lib/host-driver.js +298 -0
  7. package/lib/index.js +536 -0
  8. package/lib/projection.js +159 -0
  9. package/lib/registry.js +218 -0
  10. package/lib/session-records.js +54 -0
  11. package/lib/submission-commit.js +34 -0
  12. package/lib/world-driver.js +275 -0
  13. package/package.json +64 -4
  14. package/vendor/PROVENANCE.md +9 -0
  15. package/vendor/dynamic-workflow/analysis/actor-graph.d.ts +47 -0
  16. package/vendor/dynamic-workflow/analysis/actor-graph.d.ts.map +1 -0
  17. package/vendor/dynamic-workflow/analysis/actor-graph.js +95 -0
  18. package/vendor/dynamic-workflow/analysis/actor-models.d.ts +60 -0
  19. package/vendor/dynamic-workflow/analysis/actor-models.d.ts.map +1 -0
  20. package/vendor/dynamic-workflow/analysis/actor-models.js +208 -0
  21. package/vendor/dynamic-workflow/analysis/actor-names.d.ts +56 -0
  22. package/vendor/dynamic-workflow/analysis/actor-names.d.ts.map +1 -0
  23. package/vendor/dynamic-workflow/analysis/actor-names.js +155 -0
  24. package/vendor/dynamic-workflow/analysis/analyze.d.ts +63 -0
  25. package/vendor/dynamic-workflow/analysis/analyze.d.ts.map +1 -0
  26. package/vendor/dynamic-workflow/analysis/analyze.js +92 -0
  27. package/vendor/dynamic-workflow/analysis/array-methods.d.ts +21 -0
  28. package/vendor/dynamic-workflow/analysis/array-methods.d.ts.map +1 -0
  29. package/vendor/dynamic-workflow/analysis/array-methods.js +132 -0
  30. package/vendor/dynamic-workflow/analysis/artifact-types.d.ts +39 -0
  31. package/vendor/dynamic-workflow/analysis/artifact-types.d.ts.map +1 -0
  32. package/vendor/dynamic-workflow/analysis/artifact-types.js +114 -0
  33. package/vendor/dynamic-workflow/analysis/artifacts.d.ts +67 -0
  34. package/vendor/dynamic-workflow/analysis/artifacts.d.ts.map +1 -0
  35. package/vendor/dynamic-workflow/analysis/artifacts.js +263 -0
  36. package/vendor/dynamic-workflow/analysis/assign.d.ts +42 -0
  37. package/vendor/dynamic-workflow/analysis/assign.d.ts.map +1 -0
  38. package/vendor/dynamic-workflow/analysis/assign.js +287 -0
  39. package/vendor/dynamic-workflow/analysis/callbacks.d.ts +71 -0
  40. package/vendor/dynamic-workflow/analysis/callbacks.d.ts.map +1 -0
  41. package/vendor/dynamic-workflow/analysis/callbacks.js +133 -0
  42. package/vendor/dynamic-workflow/analysis/calls.d.ts +40 -0
  43. package/vendor/dynamic-workflow/analysis/calls.d.ts.map +1 -0
  44. package/vendor/dynamic-workflow/analysis/calls.js +495 -0
  45. package/vendor/dynamic-workflow/analysis/causality-graph-lanes.d.ts +25 -0
  46. package/vendor/dynamic-workflow/analysis/causality-graph-lanes.d.ts.map +1 -0
  47. package/vendor/dynamic-workflow/analysis/causality-graph-lanes.js +161 -0
  48. package/vendor/dynamic-workflow/analysis/causality-graph-types.d.ts +163 -0
  49. package/vendor/dynamic-workflow/analysis/causality-graph-types.d.ts.map +1 -0
  50. package/vendor/dynamic-workflow/analysis/causality-graph-types.js +8 -0
  51. package/vendor/dynamic-workflow/analysis/causality-graph.d.ts +39 -0
  52. package/vendor/dynamic-workflow/analysis/causality-graph.d.ts.map +1 -0
  53. package/vendor/dynamic-workflow/analysis/causality-graph.js +530 -0
  54. package/vendor/dynamic-workflow/analysis/causality-order-calls.d.ts +29 -0
  55. package/vendor/dynamic-workflow/analysis/causality-order-calls.d.ts.map +1 -0
  56. package/vendor/dynamic-workflow/analysis/causality-order-calls.js +266 -0
  57. package/vendor/dynamic-workflow/analysis/causality-order-functions.d.ts +26 -0
  58. package/vendor/dynamic-workflow/analysis/causality-order-functions.d.ts.map +1 -0
  59. package/vendor/dynamic-workflow/analysis/causality-order-functions.js +116 -0
  60. package/vendor/dynamic-workflow/analysis/causality-order-loops.d.ts +5 -0
  61. package/vendor/dynamic-workflow/analysis/causality-order-loops.d.ts.map +1 -0
  62. package/vendor/dynamic-workflow/analysis/causality-order-loops.js +148 -0
  63. package/vendor/dynamic-workflow/analysis/causality-order-settle.d.ts +39 -0
  64. package/vendor/dynamic-workflow/analysis/causality-order-settle.d.ts.map +1 -0
  65. package/vendor/dynamic-workflow/analysis/causality-order-settle.js +263 -0
  66. package/vendor/dynamic-workflow/analysis/causality-order-state.d.ts +110 -0
  67. package/vendor/dynamic-workflow/analysis/causality-order-state.d.ts.map +1 -0
  68. package/vendor/dynamic-workflow/analysis/causality-order-state.js +162 -0
  69. package/vendor/dynamic-workflow/analysis/causality-order-strands.d.ts +79 -0
  70. package/vendor/dynamic-workflow/analysis/causality-order-strands.d.ts.map +1 -0
  71. package/vendor/dynamic-workflow/analysis/causality-order-strands.js +154 -0
  72. package/vendor/dynamic-workflow/analysis/causality-order-types.d.ts +174 -0
  73. package/vendor/dynamic-workflow/analysis/causality-order-types.d.ts.map +1 -0
  74. package/vendor/dynamic-workflow/analysis/causality-order-types.js +1 -0
  75. package/vendor/dynamic-workflow/analysis/causality-order-walk.d.ts +17 -0
  76. package/vendor/dynamic-workflow/analysis/causality-order-walk.d.ts.map +1 -0
  77. package/vendor/dynamic-workflow/analysis/causality-order-walk.js +282 -0
  78. package/vendor/dynamic-workflow/analysis/causality-order.d.ts +60 -0
  79. package/vendor/dynamic-workflow/analysis/causality-order.d.ts.map +1 -0
  80. package/vendor/dynamic-workflow/analysis/causality-order.js +110 -0
  81. package/vendor/dynamic-workflow/analysis/causality-reduce.d.ts +60 -0
  82. package/vendor/dynamic-workflow/analysis/causality-reduce.d.ts.map +1 -0
  83. package/vendor/dynamic-workflow/analysis/causality-reduce.js +198 -0
  84. package/vendor/dynamic-workflow/analysis/classes.d.ts +47 -0
  85. package/vendor/dynamic-workflow/analysis/classes.d.ts.map +1 -0
  86. package/vendor/dynamic-workflow/analysis/classes.js +264 -0
  87. package/vendor/dynamic-workflow/analysis/constants.d.ts +35 -0
  88. package/vendor/dynamic-workflow/analysis/constants.d.ts.map +1 -0
  89. package/vendor/dynamic-workflow/analysis/constants.js +23 -0
  90. package/vendor/dynamic-workflow/analysis/control-flow.d.ts +26 -0
  91. package/vendor/dynamic-workflow/analysis/control-flow.d.ts.map +1 -0
  92. package/vendor/dynamic-workflow/analysis/control-flow.js +132 -0
  93. package/vendor/dynamic-workflow/analysis/core-json.d.ts +45 -0
  94. package/vendor/dynamic-workflow/analysis/core-json.d.ts.map +1 -0
  95. package/vendor/dynamic-workflow/analysis/core-json.js +49 -0
  96. package/vendor/dynamic-workflow/analysis/core.d.ts +194 -0
  97. package/vendor/dynamic-workflow/analysis/core.d.ts.map +1 -0
  98. package/vendor/dynamic-workflow/analysis/core.js +204 -0
  99. package/vendor/dynamic-workflow/analysis/domain.d.ts +269 -0
  100. package/vendor/dynamic-workflow/analysis/domain.d.ts.map +1 -0
  101. package/vendor/dynamic-workflow/analysis/domain.js +523 -0
  102. package/vendor/dynamic-workflow/analysis/facade-misuse.d.ts +56 -0
  103. package/vendor/dynamic-workflow/analysis/facade-misuse.d.ts.map +1 -0
  104. package/vendor/dynamic-workflow/analysis/facade-misuse.js +350 -0
  105. package/vendor/dynamic-workflow/analysis/fanout-cardinality.d.ts +11 -0
  106. package/vendor/dynamic-workflow/analysis/fanout-cardinality.d.ts.map +1 -0
  107. package/vendor/dynamic-workflow/analysis/fanout-cardinality.js +121 -0
  108. package/vendor/dynamic-workflow/analysis/flow-graph.d.ts +113 -0
  109. package/vendor/dynamic-workflow/analysis/flow-graph.d.ts.map +1 -0
  110. package/vendor/dynamic-workflow/analysis/flow-graph.js +411 -0
  111. package/vendor/dynamic-workflow/analysis/flow-phase.d.ts +28 -0
  112. package/vendor/dynamic-workflow/analysis/flow-phase.d.ts.map +1 -0
  113. package/vendor/dynamic-workflow/analysis/flow-phase.js +104 -0
  114. package/vendor/dynamic-workflow/analysis/flow-strands.d.ts +39 -0
  115. package/vendor/dynamic-workflow/analysis/flow-strands.d.ts.map +1 -0
  116. package/vendor/dynamic-workflow/analysis/flow-strands.js +47 -0
  117. package/vendor/dynamic-workflow/analysis/flow-tree.d.ts +35 -0
  118. package/vendor/dynamic-workflow/analysis/flow-tree.d.ts.map +1 -0
  119. package/vendor/dynamic-workflow/analysis/flow-tree.js +33 -0
  120. package/vendor/dynamic-workflow/analysis/graph.d.ts +5 -0
  121. package/vendor/dynamic-workflow/analysis/graph.d.ts.map +1 -0
  122. package/vendor/dynamic-workflow/analysis/graph.js +199 -0
  123. package/vendor/dynamic-workflow/analysis/handoff-graph.d.ts +48 -0
  124. package/vendor/dynamic-workflow/analysis/handoff-graph.d.ts.map +1 -0
  125. package/vendor/dynamic-workflow/analysis/handoff-graph.js +0 -0
  126. package/vendor/dynamic-workflow/analysis/heap-ops.d.ts +14 -0
  127. package/vendor/dynamic-workflow/analysis/heap-ops.d.ts.map +1 -0
  128. package/vendor/dynamic-workflow/analysis/heap-ops.js +70 -0
  129. package/vendor/dynamic-workflow/analysis/hole-id.d.ts +28 -0
  130. package/vendor/dynamic-workflow/analysis/hole-id.d.ts.map +1 -0
  131. package/vendor/dynamic-workflow/analysis/hole-id.js +41 -0
  132. package/vendor/dynamic-workflow/analysis/hole-sites.d.ts +32 -0
  133. package/vendor/dynamic-workflow/analysis/hole-sites.d.ts.map +1 -0
  134. package/vendor/dynamic-workflow/analysis/hole-sites.js +215 -0
  135. package/vendor/dynamic-workflow/analysis/hole-splice.d.ts +45 -0
  136. package/vendor/dynamic-workflow/analysis/hole-splice.d.ts.map +1 -0
  137. package/vendor/dynamic-workflow/analysis/hole-splice.js +100 -0
  138. package/vendor/dynamic-workflow/analysis/interpret.d.ts +26 -0
  139. package/vendor/dynamic-workflow/analysis/interpret.d.ts.map +1 -0
  140. package/vendor/dynamic-workflow/analysis/interpret.js +200 -0
  141. package/vendor/dynamic-workflow/analysis/literals.d.ts +18 -0
  142. package/vendor/dynamic-workflow/analysis/literals.d.ts.map +1 -0
  143. package/vendor/dynamic-workflow/analysis/literals.js +125 -0
  144. package/vendor/dynamic-workflow/analysis/mermaid.d.ts +60 -0
  145. package/vendor/dynamic-workflow/analysis/mermaid.d.ts.map +1 -0
  146. package/vendor/dynamic-workflow/analysis/mermaid.js +477 -0
  147. package/vendor/dynamic-workflow/analysis/patterns.d.ts +31 -0
  148. package/vendor/dynamic-workflow/analysis/patterns.d.ts.map +1 -0
  149. package/vendor/dynamic-workflow/analysis/patterns.js +94 -0
  150. package/vendor/dynamic-workflow/analysis/phase-graph.d.ts +47 -0
  151. package/vendor/dynamic-workflow/analysis/phase-graph.d.ts.map +1 -0
  152. package/vendor/dynamic-workflow/analysis/phase-graph.js +334 -0
  153. package/vendor/dynamic-workflow/analysis/phases.d.ts +24 -0
  154. package/vendor/dynamic-workflow/analysis/phases.d.ts.map +1 -0
  155. package/vendor/dynamic-workflow/analysis/phases.js +54 -0
  156. package/vendor/dynamic-workflow/analysis/promise-ops.d.ts +52 -0
  157. package/vendor/dynamic-workflow/analysis/promise-ops.d.ts.map +1 -0
  158. package/vendor/dynamic-workflow/analysis/promise-ops.js +123 -0
  159. package/vendor/dynamic-workflow/analysis/relays.d.ts +12 -0
  160. package/vendor/dynamic-workflow/analysis/relays.d.ts.map +1 -0
  161. package/vendor/dynamic-workflow/analysis/relays.js +78 -0
  162. package/vendor/dynamic-workflow/analysis/serialize.d.ts +125 -0
  163. package/vendor/dynamic-workflow/analysis/serialize.d.ts.map +1 -0
  164. package/vendor/dynamic-workflow/analysis/serialize.js +321 -0
  165. package/vendor/dynamic-workflow/analysis/site-phases.d.ts +32 -0
  166. package/vendor/dynamic-workflow/analysis/site-phases.d.ts.map +1 -0
  167. package/vendor/dynamic-workflow/analysis/site-phases.js +69 -0
  168. package/vendor/dynamic-workflow/analysis/sites-labels.d.ts +71 -0
  169. package/vendor/dynamic-workflow/analysis/sites-labels.d.ts.map +1 -0
  170. package/vendor/dynamic-workflow/analysis/sites-labels.js +189 -0
  171. package/vendor/dynamic-workflow/analysis/sites.d.ts +267 -0
  172. package/vendor/dynamic-workflow/analysis/sites.d.ts.map +1 -0
  173. package/vendor/dynamic-workflow/analysis/sites.js +225 -0
  174. package/vendor/dynamic-workflow/analysis/state.d.ts +254 -0
  175. package/vendor/dynamic-workflow/analysis/state.d.ts.map +1 -0
  176. package/vendor/dynamic-workflow/analysis/state.js +569 -0
  177. package/vendor/dynamic-workflow/analysis/taint.d.ts +97 -0
  178. package/vendor/dynamic-workflow/analysis/taint.d.ts.map +1 -0
  179. package/vendor/dynamic-workflow/analysis/taint.js +649 -0
  180. package/vendor/dynamic-workflow/analysis/types.d.ts +100 -0
  181. package/vendor/dynamic-workflow/analysis/types.d.ts.map +1 -0
  182. package/vendor/dynamic-workflow/analysis/types.js +1 -0
  183. package/vendor/dynamic-workflow/analysis/world-run.d.ts +27 -0
  184. package/vendor/dynamic-workflow/analysis/world-run.d.ts.map +1 -0
  185. package/vendor/dynamic-workflow/analysis/world-run.js +44 -0
  186. package/vendor/dynamic-workflow/compiler/compile.d.ts +59 -0
  187. package/vendor/dynamic-workflow/compiler/compile.d.ts.map +1 -0
  188. package/vendor/dynamic-workflow/compiler/compile.js +159 -0
  189. package/vendor/dynamic-workflow/compiler/libs.generated.d.ts +3 -0
  190. package/vendor/dynamic-workflow/compiler/libs.generated.d.ts.map +1 -0
  191. package/vendor/dynamic-workflow/compiler/libs.generated.js +64 -0
  192. package/vendor/dynamic-workflow/engine/artifact-spec.d.ts +26 -0
  193. package/vendor/dynamic-workflow/engine/artifact-spec.d.ts.map +1 -0
  194. package/vendor/dynamic-workflow/engine/artifact-spec.js +173 -0
  195. package/vendor/dynamic-workflow/engine/ask-observation-types.d.ts +54 -0
  196. package/vendor/dynamic-workflow/engine/ask-observation-types.d.ts.map +1 -0
  197. package/vendor/dynamic-workflow/engine/ask-observation-types.js +19 -0
  198. package/vendor/dynamic-workflow/engine/cached-ask-facts.d.ts +28 -0
  199. package/vendor/dynamic-workflow/engine/cached-ask-facts.d.ts.map +1 -0
  200. package/vendor/dynamic-workflow/engine/cached-ask-facts.js +35 -0
  201. package/vendor/dynamic-workflow/engine/concurrency.d.ts +151 -0
  202. package/vendor/dynamic-workflow/engine/concurrency.d.ts.map +1 -0
  203. package/vendor/dynamic-workflow/engine/concurrency.js +282 -0
  204. package/vendor/dynamic-workflow/engine/engine-artifacts-primary.d.ts +17 -0
  205. package/vendor/dynamic-workflow/engine/engine-artifacts-primary.d.ts.map +1 -0
  206. package/vendor/dynamic-workflow/engine/engine-artifacts-primary.js +29 -0
  207. package/vendor/dynamic-workflow/engine/engine-artifacts.d.ts +55 -0
  208. package/vendor/dynamic-workflow/engine/engine-artifacts.d.ts.map +1 -0
  209. package/vendor/dynamic-workflow/engine/engine-artifacts.js +367 -0
  210. package/vendor/dynamic-workflow/engine/engine-config.d.ts +90 -0
  211. package/vendor/dynamic-workflow/engine/engine-config.d.ts.map +1 -0
  212. package/vendor/dynamic-workflow/engine/engine-config.js +6 -0
  213. package/vendor/dynamic-workflow/engine/engine-holes.d.ts +116 -0
  214. package/vendor/dynamic-workflow/engine/engine-holes.d.ts.map +1 -0
  215. package/vendor/dynamic-workflow/engine/engine-holes.js +142 -0
  216. package/vendor/dynamic-workflow/engine/engine-launch.d.ts +34 -0
  217. package/vendor/dynamic-workflow/engine/engine-launch.d.ts.map +1 -0
  218. package/vendor/dynamic-workflow/engine/engine-launch.js +26 -0
  219. package/vendor/dynamic-workflow/engine/engine-phase-stamp.d.ts +35 -0
  220. package/vendor/dynamic-workflow/engine/engine-phase-stamp.d.ts.map +1 -0
  221. package/vendor/dynamic-workflow/engine/engine-phase-stamp.js +74 -0
  222. package/vendor/dynamic-workflow/engine/engine-report.d.ts +27 -0
  223. package/vendor/dynamic-workflow/engine/engine-report.d.ts.map +1 -0
  224. package/vendor/dynamic-workflow/engine/engine-report.js +151 -0
  225. package/vendor/dynamic-workflow/engine/engine-resume.d.ts +18 -0
  226. package/vendor/dynamic-workflow/engine/engine-resume.d.ts.map +1 -0
  227. package/vendor/dynamic-workflow/engine/engine-resume.js +38 -0
  228. package/vendor/dynamic-workflow/engine/engine-settlement.d.ts +30 -0
  229. package/vendor/dynamic-workflow/engine/engine-settlement.d.ts.map +1 -0
  230. package/vendor/dynamic-workflow/engine/engine-settlement.js +79 -0
  231. package/vendor/dynamic-workflow/engine/engine-state.d.ts +99 -0
  232. package/vendor/dynamic-workflow/engine/engine-state.d.ts.map +1 -0
  233. package/vendor/dynamic-workflow/engine/engine-state.js +13 -0
  234. package/vendor/dynamic-workflow/engine/engine-world.d.ts +36 -0
  235. package/vendor/dynamic-workflow/engine/engine-world.d.ts.map +1 -0
  236. package/vendor/dynamic-workflow/engine/engine-world.js +189 -0
  237. package/vendor/dynamic-workflow/engine/engine.d.ts +263 -0
  238. package/vendor/dynamic-workflow/engine/engine.d.ts.map +1 -0
  239. package/vendor/dynamic-workflow/engine/engine.js +602 -0
  240. package/vendor/dynamic-workflow/engine/errors.d.ts +87 -0
  241. package/vendor/dynamic-workflow/engine/errors.d.ts.map +1 -0
  242. package/vendor/dynamic-workflow/engine/errors.js +56 -0
  243. package/vendor/dynamic-workflow/engine/hash-mismatch.d.ts +10 -0
  244. package/vendor/dynamic-workflow/engine/hash-mismatch.d.ts.map +1 -0
  245. package/vendor/dynamic-workflow/engine/hash-mismatch.js +15 -0
  246. package/vendor/dynamic-workflow/engine/hash.d.ts +16 -0
  247. package/vendor/dynamic-workflow/engine/hash.d.ts.map +1 -0
  248. package/vendor/dynamic-workflow/engine/hash.js +48 -0
  249. package/vendor/dynamic-workflow/engine/imported-cache-types.d.ts +96 -0
  250. package/vendor/dynamic-workflow/engine/imported-cache-types.d.ts.map +1 -0
  251. package/vendor/dynamic-workflow/engine/imported-cache-types.js +6 -0
  252. package/vendor/dynamic-workflow/engine/imported-cache.d.ts +127 -0
  253. package/vendor/dynamic-workflow/engine/imported-cache.d.ts.map +1 -0
  254. package/vendor/dynamic-workflow/engine/imported-cache.js +244 -0
  255. package/vendor/dynamic-workflow/engine/index.d.ts +11 -0
  256. package/vendor/dynamic-workflow/engine/index.d.ts.map +1 -0
  257. package/vendor/dynamic-workflow/engine/index.js +10 -0
  258. package/vendor/dynamic-workflow/engine/journal-memory.d.ts +32 -0
  259. package/vendor/dynamic-workflow/engine/journal-memory.d.ts.map +1 -0
  260. package/vendor/dynamic-workflow/engine/journal-memory.js +243 -0
  261. package/vendor/dynamic-workflow/engine/journal-read-types.d.ts +72 -0
  262. package/vendor/dynamic-workflow/engine/journal-read-types.d.ts.map +1 -0
  263. package/vendor/dynamic-workflow/engine/journal-read-types.js +28 -0
  264. package/vendor/dynamic-workflow/engine/persona.d.ts +20 -0
  265. package/vendor/dynamic-workflow/engine/persona.d.ts.map +1 -0
  266. package/vendor/dynamic-workflow/engine/persona.js +43 -0
  267. package/vendor/dynamic-workflow/engine/replay-order.d.ts +96 -0
  268. package/vendor/dynamic-workflow/engine/replay-order.d.ts.map +1 -0
  269. package/vendor/dynamic-workflow/engine/replay-order.js +229 -0
  270. package/vendor/dynamic-workflow/engine/run-terminal.d.ts +35 -0
  271. package/vendor/dynamic-workflow/engine/run-terminal.d.ts.map +1 -0
  272. package/vendor/dynamic-workflow/engine/run-terminal.js +7 -0
  273. package/vendor/dynamic-workflow/engine/scheduler-submit.d.ts +22 -0
  274. package/vendor/dynamic-workflow/engine/scheduler-submit.d.ts.map +1 -0
  275. package/vendor/dynamic-workflow/engine/scheduler-submit.js +84 -0
  276. package/vendor/dynamic-workflow/engine/scheduler-types.d.ts +105 -0
  277. package/vendor/dynamic-workflow/engine/scheduler-types.d.ts.map +1 -0
  278. package/vendor/dynamic-workflow/engine/scheduler-types.js +17 -0
  279. package/vendor/dynamic-workflow/engine/scheduler.d.ts +113 -0
  280. package/vendor/dynamic-workflow/engine/scheduler.d.ts.map +1 -0
  281. package/vendor/dynamic-workflow/engine/scheduler.js +484 -0
  282. package/vendor/dynamic-workflow/engine/types.d.ts +979 -0
  283. package/vendor/dynamic-workflow/engine/types.d.ts.map +1 -0
  284. package/vendor/dynamic-workflow/engine/types.js +26 -0
  285. package/vendor/dynamic-workflow/engine/world-read-input.d.ts +10 -0
  286. package/vendor/dynamic-workflow/engine/world-read-input.d.ts.map +1 -0
  287. package/vendor/dynamic-workflow/engine/world-read-input.js +55 -0
  288. package/vendor/dynamic-workflow/facade/artifact-caps.d.ts +48 -0
  289. package/vendor/dynamic-workflow/facade/artifact-caps.d.ts.map +1 -0
  290. package/vendor/dynamic-workflow/facade/artifact-caps.js +47 -0
  291. package/vendor/dynamic-workflow/facade/dts-hole.d.ts +16 -0
  292. package/vendor/dynamic-workflow/facade/dts-hole.d.ts.map +1 -0
  293. package/vendor/dynamic-workflow/facade/dts-hole.js +26 -0
  294. package/vendor/dynamic-workflow/facade/dts-model.d.ts +11 -0
  295. package/vendor/dynamic-workflow/facade/dts-model.d.ts.map +1 -0
  296. package/vendor/dynamic-workflow/facade/dts-model.js +18 -0
  297. package/vendor/dynamic-workflow/facade/dts-stream.d.ts +15 -0
  298. package/vendor/dynamic-workflow/facade/dts-stream.d.ts.map +1 -0
  299. package/vendor/dynamic-workflow/facade/dts-stream.js +41 -0
  300. package/vendor/dynamic-workflow/facade/dts.d.ts +29 -0
  301. package/vendor/dynamic-workflow/facade/dts.d.ts.map +1 -0
  302. package/vendor/dynamic-workflow/facade/dts.js +324 -0
  303. package/vendor/dynamic-workflow/facade/registry.d.ts +218 -0
  304. package/vendor/dynamic-workflow/facade/registry.d.ts.map +1 -0
  305. package/vendor/dynamic-workflow/facade/registry.js +203 -0
  306. package/vendor/dynamic-workflow/facade/report-caps.d.ts +40 -0
  307. package/vendor/dynamic-workflow/facade/report-caps.d.ts.map +1 -0
  308. package/vendor/dynamic-workflow/facade/report-caps.js +39 -0
  309. package/vendor/dynamic-workflow/facade/world-read-caps.d.ts +37 -0
  310. package/vendor/dynamic-workflow/facade/world-read-caps.d.ts.map +1 -0
  311. package/vendor/dynamic-workflow/facade/world-read-caps.js +36 -0
  312. package/vendor/dynamic-workflow/index.d.ts +41 -0
  313. package/vendor/dynamic-workflow/index.d.ts.map +1 -0
  314. package/vendor/dynamic-workflow/index.js +51 -0
  315. package/vendor/dynamic-workflow/lowering/index.d.ts +2 -0
  316. package/vendor/dynamic-workflow/lowering/index.d.ts.map +1 -0
  317. package/vendor/dynamic-workflow/lowering/index.js +1 -0
  318. package/vendor/dynamic-workflow/lowering/lower-hole.d.ts +16 -0
  319. package/vendor/dynamic-workflow/lowering/lower-hole.d.ts.map +1 -0
  320. package/vendor/dynamic-workflow/lowering/lower-hole.js +63 -0
  321. package/vendor/dynamic-workflow/lowering/lower.d.ts +82 -0
  322. package/vendor/dynamic-workflow/lowering/lower.d.ts.map +1 -0
  323. package/vendor/dynamic-workflow/lowering/lower.js +333 -0
  324. package/vendor/dynamic-workflow/projections.d.ts +26 -0
  325. package/vendor/dynamic-workflow/projections.d.ts.map +1 -0
  326. package/vendor/dynamic-workflow/projections.js +23 -0
  327. package/vendor/dynamic-workflow/schema/actor-submit-profiles.d.ts +49 -0
  328. package/vendor/dynamic-workflow/schema/actor-submit-profiles.d.ts.map +1 -0
  329. package/vendor/dynamic-workflow/schema/actor-submit-profiles.js +69 -0
  330. package/vendor/dynamic-workflow/schema/emit.d.ts +55 -0
  331. package/vendor/dynamic-workflow/schema/emit.d.ts.map +1 -0
  332. package/vendor/dynamic-workflow/schema/emit.js +325 -0
  333. package/vendor/dynamic-workflow/schema/jsdoc.d.ts +10 -0
  334. package/vendor/dynamic-workflow/schema/jsdoc.d.ts.map +1 -0
  335. package/vendor/dynamic-workflow/schema/jsdoc.js +83 -0
  336. package/vendor/dynamic-workflow/schema/serialize.d.ts +8 -0
  337. package/vendor/dynamic-workflow/schema/serialize.d.ts.map +1 -0
  338. package/vendor/dynamic-workflow/schema/serialize.js +20 -0
  339. package/vendor/dynamic-workflow/schema/synthesize.d.ts +48 -0
  340. package/vendor/dynamic-workflow/schema/synthesize.d.ts.map +1 -0
  341. package/vendor/dynamic-workflow/schema/synthesize.js +138 -0
  342. package/vendor/dynamic-workflow/schema/types.d.ts +67 -0
  343. package/vendor/dynamic-workflow/schema/types.d.ts.map +1 -0
  344. package/vendor/dynamic-workflow/schema/types.js +18 -0
  345. package/vendor/dynamic-workflow/schema/validate.d.ts +15 -0
  346. package/vendor/dynamic-workflow/schema/validate.d.ts.map +1 -0
  347. package/vendor/dynamic-workflow/schema/validate.js +213 -0
  348. package/vendor/dynamic-workflow/testing/index.d.ts +6 -0
  349. package/vendor/dynamic-workflow/testing/index.d.ts.map +1 -0
  350. package/vendor/dynamic-workflow/testing/index.js +5 -0
  351. package/vendor/dynamic-workflow/testing/journal-contract-artifacts.d.ts +9 -0
  352. package/vendor/dynamic-workflow/testing/journal-contract-artifacts.d.ts.map +1 -0
  353. package/vendor/dynamic-workflow/testing/journal-contract-artifacts.js +195 -0
  354. package/vendor/dynamic-workflow/testing/journal-contract-events.d.ts +9 -0
  355. package/vendor/dynamic-workflow/testing/journal-contract-events.d.ts.map +1 -0
  356. package/vendor/dynamic-workflow/testing/journal-contract-events.js +163 -0
  357. package/vendor/dynamic-workflow/testing/journal-contract-helpers.d.ts +9 -0
  358. package/vendor/dynamic-workflow/testing/journal-contract-helpers.d.ts.map +1 -0
  359. package/vendor/dynamic-workflow/testing/journal-contract-helpers.js +12 -0
  360. package/vendor/dynamic-workflow/testing/journal-contract-isolation.d.ts +9 -0
  361. package/vendor/dynamic-workflow/testing/journal-contract-isolation.d.ts.map +1 -0
  362. package/vendor/dynamic-workflow/testing/journal-contract-isolation.js +46 -0
  363. package/vendor/dynamic-workflow/testing/journal-contract-nodes.d.ts +9 -0
  364. package/vendor/dynamic-workflow/testing/journal-contract-nodes.d.ts.map +1 -0
  365. package/vendor/dynamic-workflow/testing/journal-contract-nodes.js +234 -0
  366. package/vendor/dynamic-workflow/testing/journal-contract-reads.d.ts +11 -0
  367. package/vendor/dynamic-workflow/testing/journal-contract-reads.d.ts.map +1 -0
  368. package/vendor/dynamic-workflow/testing/journal-contract-reads.js +281 -0
  369. package/vendor/dynamic-workflow/testing/journal-contract-runs.d.ts +9 -0
  370. package/vendor/dynamic-workflow/testing/journal-contract-runs.d.ts.map +1 -0
  371. package/vendor/dynamic-workflow/testing/journal-contract-runs.js +396 -0
  372. package/vendor/dynamic-workflow/testing/journal-contract-script.d.ts +12 -0
  373. package/vendor/dynamic-workflow/testing/journal-contract-script.d.ts.map +1 -0
  374. package/vendor/dynamic-workflow/testing/journal-contract-script.js +82 -0
  375. package/vendor/dynamic-workflow/testing/journal-contract.d.ts +15 -0
  376. package/vendor/dynamic-workflow/testing/journal-contract.d.ts.map +1 -0
  377. package/vendor/dynamic-workflow/testing/journal-contract.js +31 -0
  378. package/vendor/dynamic-workflow-runtime/child-cell-streams.js +128 -0
  379. package/vendor/dynamic-workflow-runtime/child-entry-file.js +43 -0
  380. package/vendor/dynamic-workflow-runtime/child-source.js +299 -0
  381. package/vendor/dynamic-workflow-runtime/harness.js +302 -0
  382. package/vendor/dynamic-workflow-runtime/index.js +4 -0
  383. package/vendor/dynamic-workflow-runtime/protocol.js +2 -0
  384. package/vendor/mcode-host/dynamic-workflow-import.js +269 -0
  385. package/vendor/mcode-host/workflow-git-world-read.js +183 -0
  386. package/vendor/mcode-host/workflow-world-read.js +282 -0
@@ -0,0 +1,649 @@
1
+ import ts from "typescript";
2
+ import { addPlaceholder, clearExact, cloneValue, collapse, collapseInto, COMPOUND_ASSIGNMENT_OPS, emptyValue, isNonArrowFunctionLike, liveField, mergeInto, peelPlace, readField, staticIndexKey, unionValues, } from "./domain.js";
3
+ import { applyCall, evalCall } from "./calls.js";
4
+ import { applyConstructor, applyMixinConstructor, evalAwait, handleNewUnknown } from "./promise-ops.js";
5
+ import { classConstructor, classNodeOfSymbol, enclosingBaseInstance, enclosingClassInstance, evalClasses, hasUnresolvedHeritage, resolveClassNode, } from "./classes.js";
6
+ import { handleAssignment, handleCompoundAssignment } from "./assign.js";
7
+ import { handleForIn, handleForOf, visitForStatement } from "./control-flow.js";
8
+ import { evalArrayLiteral, evalObjectLiteral } from "./literals.js";
9
+ import { bindPattern, extractField, selectField } from "./patterns.js";
10
+ import { TaintState } from "./state.js";
11
+ /**
12
+ * The taint pass: a gen-only, may-flow dataflow analysis over the typed AST that
13
+ * turns the site table into edge-bearing facts. It is the data half of the fused
14
+ * interpreter (interpret.ts): the fixpoint here runs taint-only, and after
15
+ * convergence the temporal walk (causality-order.ts) reads this pass's state as its
16
+ * oracle. See domain.ts for the
17
+ * abstract-value algebra, state.ts for the fixpoint storage, and calls.ts for the
18
+ * call/relay transfer rules.
19
+ *
20
+ * ## Why flow-INsensitivity is sound here
21
+ *
22
+ * The analysis is gen-only: taint is a union over a finite powerset lattice, there
23
+ * are no sanitizers and no strong updates (no kills). With no kills, the order in
24
+ * which statements execute cannot remove a fact, so a single global environment with
25
+ * weak (join-only) updates over-approximates every execution order at once. That is
26
+ * exactly what a may-flow graph wants ("A may feed B"), and it makes loop-carried
27
+ * variables (the planner/reviewer `feedback`) fall out for free: the reassignment
28
+ * inside the loop just unions into the same binding the loop head reads. We iterate
29
+ * the whole-script transfer to a fixpoint; monotonicity + the finite lattice
30
+ * guarantee termination (a defensive cap throws if it ever fails to converge — a
31
+ * thrown cap is a bug, never a silent truncation).
32
+ */
33
+ const ITERATION_CAP = 100;
34
+ /**
35
+ * The taint half of the fused interpreter:
36
+ * drive the whole-script transfer to a fixpoint. Emission is the caller's business —
37
+ * interpret.ts reads the converged state through `emitFacts` / `emitOracle` and runs
38
+ * the temporal walk over the same state.
39
+ */
40
+ export class Evaluator {
41
+ s;
42
+ checker;
43
+ constructor(workflow, table) {
44
+ this.s = new TaintState(workflow, table);
45
+ this.checker = this.s.checker;
46
+ }
47
+ converge() {
48
+ let iterations = 0;
49
+ do {
50
+ this.s.changed = false;
51
+ iterations += 1;
52
+ if (iterations > ITERATION_CAP) {
53
+ throw new Error(`taint analysis failed to converge after ${ITERATION_CAP} iterations`);
54
+ }
55
+ this.iterate();
56
+ this.s.propagateReachability();
57
+ this.s.recomputePromotion();
58
+ } while (this.s.changed);
59
+ }
60
+ iterate() {
61
+ // Pre-bind function-declaration names to their function value (hoisting).
62
+ for (const fn of this.s.functions) {
63
+ if (ts.isFunctionDeclaration(fn) && fn.name !== undefined) {
64
+ const sym = this.checker.getSymbolAtLocation(fn.name);
65
+ if (sym !== undefined) {
66
+ const val = emptyValue();
67
+ val.fns.add(fn);
68
+ this.s.bindSymbol(sym, val);
69
+ }
70
+ }
71
+ }
72
+ const topCtx = {
73
+ onReturn: (value) => this.s.mergeReturn(collapse(value)),
74
+ regionStack: ["top"],
75
+ };
76
+ for (const stmt of this.s.body.statements)
77
+ this.visit(stmt, topCtx);
78
+ // Class bodies run after top-level statements (field initializers may read top-level
79
+ // bindings) and before the function pass (methods must be registered as instance
80
+ // fields before dispatch): field/static initializers, static blocks, method/accessor
81
+ // field registration, and the `extends` merge. The fixpoint reconciles any ordering.
82
+ evalClasses(this);
83
+ for (const fn of this.s.functions)
84
+ this.evalFunction(fn);
85
+ }
86
+ evalFunction(fn) {
87
+ const id = this.s.fnId.get(fn);
88
+ if (id === undefined)
89
+ return;
90
+ this.s.bindPlaceholderParams(fn, id);
91
+ const ctx = {
92
+ onReturn: (value) => {
93
+ if (mergeInto(this.s.summaryOf(id), value))
94
+ this.s.changed = true;
95
+ },
96
+ regionStack: [`fn@${id}`],
97
+ };
98
+ // Binding-pattern parameters (`function f([x, y]) {}`, a `.then(([x, y]) => …)` callback)
99
+ // carry no symbol in fnParamSymbols, so bindPlaceholderParams cannot bind them. Bind the
100
+ // whole pattern to this param's placeholder through the shared pattern machinery, so the
101
+ // extracted names resolve to the recorded actuals (incl. the keystone rule's pessimistic
102
+ // application). Before this loop existed, these params stayed undefined, so the
103
+ // body's reads of the destructured names saw nothing — a dropped may-flow.
104
+ fn.parameters.forEach((param, index) => {
105
+ if (ts.isIdentifier(param.name))
106
+ return;
107
+ const val = emptyValue();
108
+ const rest = param.dotDotDotToken !== undefined;
109
+ addPlaceholder(val, { fnId: id, param: index, ...(rest ? { rest: true } : {}) });
110
+ this.bindPattern(param.name, val, ctx);
111
+ });
112
+ // Default parameter initializers join into the parameter alongside call actuals.
113
+ // Previously they were never evaluated, so `build(prefix = s)` called with no
114
+ // argument dropped `s`'s taint entirely (the placeholder resolved to nothing).
115
+ for (const param of fn.parameters) {
116
+ if (param.initializer === undefined)
117
+ continue;
118
+ this.bindPattern(param.name, this.evalExpr(param.initializer, ctx), ctx);
119
+ }
120
+ const bodyNode = fn.body;
121
+ if (bodyNode === undefined)
122
+ return;
123
+ if (ts.isBlock(bodyNode)) {
124
+ for (const stmt of bodyNode.statements)
125
+ this.visit(stmt, ctx);
126
+ }
127
+ else {
128
+ // Concise arrow body: the body expression is the return value.
129
+ ctx.onReturn(this.evalExpr(bodyNode, ctx));
130
+ }
131
+ }
132
+ /**
133
+ * Record a guard expression's value as the control-dependence oracle, keyed by the
134
+ * guard node's START OFFSET — the same node `traceOrder` hands to `controllersOf`, so a
135
+ * parenthesized guard is keyed by its ParenthesizedExpression. This is a SINK, not a
136
+ * flow: the value is recorded and not joined into anything, because a condition does not
137
+ * join the data contract (see the ConditionalExpression case in evalExpr). Consumed only
138
+ * by the causality graph.
139
+ */
140
+ recordGuard(node, value) {
141
+ this.s.mergeSink(this.s.guardVal, node.getStart(this.s.scriptFile), value);
142
+ }
143
+ // -- statement visitor ---------------------------------------------------
144
+ visit(node, ctx) {
145
+ if (ts.isVariableStatement(node)) {
146
+ for (const decl of node.declarationList.declarations)
147
+ this.handleDeclaration(decl, ctx);
148
+ }
149
+ else if (ts.isExpressionStatement(node)) {
150
+ this.evalExpr(node.expression, ctx);
151
+ }
152
+ else if (ts.isReturnStatement(node)) {
153
+ ctx.onReturn(node.expression === undefined ? emptyValue() : this.evalExpr(node.expression, ctx));
154
+ }
155
+ else if (ts.isForOfStatement(node)) {
156
+ handleForOf(this, node, ctx);
157
+ }
158
+ else if (ts.isIfStatement(node)) {
159
+ this.recordGuard(node.expression, this.evalExpr(node.expression, ctx));
160
+ this.visit(node.thenStatement, ctx);
161
+ if (node.elseStatement !== undefined)
162
+ this.visit(node.elseStatement, ctx);
163
+ }
164
+ else if (ts.isBlock(node)) {
165
+ for (const stmt of node.statements)
166
+ this.visit(stmt, ctx);
167
+ }
168
+ else if (ts.isForStatement(node)) {
169
+ visitForStatement(this, node, ctx);
170
+ }
171
+ else if (ts.isForInStatement(node)) {
172
+ handleForIn(this, node, ctx);
173
+ }
174
+ else if (ts.isWhileStatement(node)) {
175
+ // A `while` condition decides whether the body runs at all, so it is a guard sink.
176
+ this.recordGuard(node.expression, this.evalExpr(node.expression, ctx));
177
+ this.visit(node.statement, ctx);
178
+ }
179
+ else if (ts.isDoStatement(node)) {
180
+ // Split out of the shared while/do arm deliberately: a `do…while` body is
181
+ // unconditional on first entry, so its condition guards nothing and must NOT be
182
+ // recorded. Same fact that makes that region `entered` in the ordering walk. Evaluation order is unchanged.
183
+ this.evalExpr(node.expression, ctx);
184
+ this.visit(node.statement, ctx);
185
+ }
186
+ else if (ts.isSwitchStatement(node)) {
187
+ // Recorded ONCE on the switch expression, not per clause: the ordering walk opens a
188
+ // branch region per clause but reads every one of their controllers off this node.
189
+ this.recordGuard(node.expression, this.evalExpr(node.expression, ctx));
190
+ for (const clause of node.caseBlock.clauses) {
191
+ if (ts.isCaseClause(clause))
192
+ this.evalExpr(clause.expression, ctx);
193
+ for (const stmt of clause.statements)
194
+ this.visit(stmt, ctx);
195
+ }
196
+ }
197
+ else if (ts.isTryStatement(node)) {
198
+ this.visit(node.tryBlock, ctx);
199
+ if (node.catchClause !== undefined) {
200
+ // Every catch binding reads the whole script-global thrown-value set (a clone
201
+ // each pass so binding stays monotone). Previously the catch variable was never
202
+ // bound, so throw→catch dataflow (and any read of the caught value) was lost.
203
+ const vd = node.catchClause.variableDeclaration;
204
+ if (vd !== undefined)
205
+ this.bindPattern(vd.name, cloneValue(this.s.thrownVal), ctx);
206
+ this.visit(node.catchClause.block, ctx);
207
+ }
208
+ if (node.finallyBlock !== undefined)
209
+ this.visit(node.finallyBlock, ctx);
210
+ }
211
+ else if (ts.isThrowStatement(node)) {
212
+ // `throw e` joins collapse(e) into the global thrown set. ThrowStatement
213
+ // was absent from the visitor, so its subexpression's facade sites (e.g. an
214
+ // `agent().ask()` in the thrown value) were never evaluated at all.
215
+ this.s.mergeThrown(collapse(this.evalExpr(node.expression, ctx)));
216
+ }
217
+ else if (ts.isLabeledStatement(node)) {
218
+ this.visit(node.statement, ctx);
219
+ }
220
+ // Function/class declarations carry no top-level dataflow here: functions are
221
+ // evaluated in their own pass and their names are pre-bound (hoisting).
222
+ }
223
+ handleDeclaration(decl, ctx) {
224
+ if (decl.initializer === undefined)
225
+ return;
226
+ // Aliasing binding: `const alias = box` / `const b = arr[0]` bind the symbol to the
227
+ // LIVE value the place denotes (shared reference), so a later write through any
228
+ // alias is visible through the original. Destructuring off a place aliases each
229
+ // extracted element to a live field (see bindPattern). Non-place RHS keeps value
230
+ // semantics.
231
+ const place = this.resolvePlace(decl.initializer);
232
+ if (ts.isIdentifier(decl.name)) {
233
+ if (place !== undefined) {
234
+ const sym = this.checker.getSymbolAtLocation(decl.name);
235
+ if (sym !== undefined) {
236
+ // Evaluate the initializer for its side effects before aliasing: a place peeled
237
+ // out of a comma (`(f(), box)`) or an `await` discards operands / a thenable's
238
+ // `then` whose facade sinks must still be visited. For the plain place forms
239
+ // (identifier / static field chain) this is a graph no-op (reads emit no sinks).
240
+ this.evalExpr(decl.initializer, ctx);
241
+ this.s.bindSymbol(sym, place);
242
+ return;
243
+ }
244
+ }
245
+ this.bindPattern(decl.name, this.evalExpr(decl.initializer, ctx), ctx);
246
+ return;
247
+ }
248
+ // Destructuring off a live place aliases each extracted element to a live field. When the
249
+ // place is present, still evaluate the initializer for effect (a join's edges, an awaited
250
+ // thenable's `then`) — the alias binds to the place, not the discarded snapshot.
251
+ // `const [sec, alias] = await Promise.all([secret, box])` needs both the join edges AND
252
+ // the element aliasing (alias IS box) so a write through `alias` reaches box.
253
+ if (place !== undefined) {
254
+ this.evalExpr(decl.initializer, ctx);
255
+ this.bindPattern(decl.name, place, ctx, place);
256
+ return;
257
+ }
258
+ this.bindPattern(decl.name, this.evalExpr(decl.initializer, ctx), ctx);
259
+ }
260
+ /**
261
+ * The LIVE (shared, unclonable) abstract value a *place expression* denotes, or
262
+ * undefined for non-places (calls, literals, computed access, operators). A place is
263
+ * an identifier (its env slot) or a chain of static property / literal-index element
264
+ * accesses rooted at a place. Value-preserving wrappers (parens / `as` / `satisfies` /
265
+ * non-null / type assertion) are peeled at every level. This is the single primitive
266
+ * behind aliasing: bindings, container-literal fields, write receivers and param
267
+ * write-back all resolve places through it. Reads must NOT call this (they clone).
268
+ *
269
+ * `create` governs missing field slots. WRITE receivers create empty fields on demand
270
+ * (`arr[0].f = t` materializes `arr[0]`). Read-side callers (aliasing binds,
271
+ * container-literal embedding, write-back actuals) pass `create=false`: an absent field
272
+ * returns undefined so the caller falls back to value semantics (readField's collapse),
273
+ * which correctly surfaces the container's own occurrences. Fabricating an empty field
274
+ * there would alias to a phantom and DROP the opaque container's taint (e.g. reading
275
+ * `review.feedback` off an opaque ask result must yield collapse(review), not ∅).
276
+ */
277
+ resolvePlace(expr, create = false) {
278
+ const e = peelPlace(expr);
279
+ if (ts.isAwaitExpression(e)) {
280
+ // `await p` settles to the promise's ONE resolved object, so it IS the operand's
281
+ // place — awaiting the same promise twice yields the same object, and a mutation
282
+ // between the awaits is visible through the second (`async-promise-double-await-mutate`).
283
+ // A custom THENABLE is the exception: its `then` transforms the value, so the result
284
+ // is NOT the operand; detect that by a tracked `then` field and fall back to value
285
+ // semantics (evalAwait models the continuation flow there).
286
+ const inner = this.resolvePlace(e.expression, create);
287
+ if (inner === undefined)
288
+ return undefined;
289
+ const thenField = inner.fields.get("then");
290
+ return thenField !== undefined && thenField.fns.size > 0 ? undefined : inner;
291
+ }
292
+ if (e.kind === ts.SyntaxKind.ThisKeyword) {
293
+ // `this` is the LIVE shared instance, so `this.x = v` mutates the value every alias
294
+ // (and every other instance of the class) sees.
295
+ return enclosingClassInstance(this, e);
296
+ }
297
+ if (e.kind === ts.SyntaxKind.SuperKeyword) {
298
+ // `super.x = v` writes the BASE class's shared instance (which the derived instance
299
+ // weak-merges in), so the write is visible through the derived `this` too.
300
+ return enclosingBaseInstance(this, e);
301
+ }
302
+ if (ts.isIdentifier(e)) {
303
+ const sym = this.checker.getSymbolAtLocation(e);
304
+ if (sym === undefined)
305
+ return undefined;
306
+ // A class-name place (`C.staticField = v`) is the shared instance — static writes
307
+ // conflate with instance state.
308
+ const cls = classNodeOfSymbol(this, sym);
309
+ if (cls !== undefined)
310
+ return this.s.instanceOf(cls);
311
+ return this.s.envSlot(sym);
312
+ }
313
+ if (ts.isPropertyAccessExpression(e)) {
314
+ const base = this.resolvePlace(e.expression, create);
315
+ return base === undefined ? undefined : this.placeField(base, e.name.text, create);
316
+ }
317
+ if (ts.isElementAccessExpression(e)) {
318
+ const key = staticIndexKey(e.argumentExpression);
319
+ if (key === undefined)
320
+ return undefined;
321
+ const base = this.resolvePlace(e.expression, create);
322
+ return base === undefined ? undefined : this.placeField(base, key, create);
323
+ }
324
+ if (ts.isConditionalExpression(e)) {
325
+ // `flag ? box1 : box2` may BE either arm at runtime, so a write through the binding
326
+ // must weakly reach BOTH (never strong-update one). Return a value carrying mayAlias =
327
+ // {each arm's place}; writeField/handleHeapMutator replay the write into every target
328
+ // inexactly. The value also snapshots the arms' current taint (a read of the binding
329
+ // unions the arms, matching the prior evalExpr union).
330
+ // The ternary was not a place, so the alias write
331
+ // reached neither box. Requires ALL arms to be places — if any arm is a non-place value
332
+ // (e.g. `flag ? plain : f.bind(null, pre)`, whose bound prefix only evalExpr computes),
333
+ // fall back to value semantics so that arm's value is not lost. Nothing is persisted on
334
+ // that failure path: an expression that is not a place owns no heap node.
335
+ const whenTrue = this.resolvePlace(e.whenTrue, create);
336
+ const whenFalse = this.resolvePlace(e.whenFalse, create);
337
+ if (whenTrue === undefined || whenFalse === undefined)
338
+ return undefined;
339
+ // The wrapper is the PERSISTENT node of this ConditionalExpression (state.ts
340
+ // condPlaceOf), never a fresh value per pass — the canonical-heap invariant
341
+ // (see joinResultOf). Without it, a syntactically NESTED ternary place
342
+ // (`f2 ? (f ? box1 : box2) : box3`) would put the inner pass-fresh wrapper into
343
+ // the outer's mayAlias set, which dedups by IDENTITY, so `changed` would never
344
+ // settle and the fixpoint would hit ITERATION_CAP. (A ternary chained through
345
+ // `const` bindings converged only because env-slot adoption happened to make its
346
+ // wrapper persistent.)
347
+ const out = this.s.condPlaceOf(e);
348
+ const targets = (out.mayAlias ??= new Set());
349
+ for (const arm of [whenTrue, whenFalse]) {
350
+ if (!targets.has(arm)) {
351
+ targets.add(arm);
352
+ this.s.changed = true;
353
+ }
354
+ // The wrapper also snapshots the arms' current taint, so a READ of the binding
355
+ // unions the arms (matching the prior evalExpr union).
356
+ if (mergeInto(out, arm))
357
+ this.s.changed = true;
358
+ }
359
+ return out;
360
+ }
361
+ if (ts.isCallExpression(e)) {
362
+ // A `Promise.all` join result is a live place: its element fields carry may-alias
363
+ // back-references to the (place) inputs (see handleJoin), so destructuring / indexing
364
+ // the awaited result aliases the originals. Any other call is not a place.
365
+ //
366
+ // Gated on `joinResults` — the registry handleJoin populates — NOT on the site table:
367
+ // several read-side callers are `resolvePlace(x) ?? evalExpr(x)` (literals.ts
368
+ // fieldValue, heap-ops.ts Object.assign source, array-methods.ts reduce seed), and
369
+ // their contract is that a place resolves only once it has been EVALUATED. Resolving a
370
+ // join eagerly off `joinByCall` short-circuits those callers, so handleJoin never runs
371
+ // for a join in one of those positions and the site, its edges, markFacade and fan-out
372
+ // promotion all vanish. Undefined-until-first-evaluated is therefore load-bearing; the
373
+ // node handed out is still the one canonical object, which is all the fixpoint needs.
374
+ return this.s.joinResults.get(e);
375
+ }
376
+ return undefined;
377
+ }
378
+ placeField(container, key, create) {
379
+ const field = container.fields.get(key);
380
+ if (field !== undefined)
381
+ return field;
382
+ return create ? liveField(container, key) : undefined;
383
+ }
384
+ /**
385
+ * The parameter write-back target for an actual argument `arg` whose evaluated value is
386
+ * `value`. A place actual resolves to its live slot (write-back aliases through it, as
387
+ * before). An object/array LITERAL's evaluated value IS its allocation-site place
388
+ * (state.literalPlaceOf), and its FIELDS hold live places (`poke({ box })` — the literal's
389
+ * `box` field IS the box slot), so that value is the write-back target: `mergeHeapEffects`
390
+ * descends into it and a field the callee wrote through `p.box` lands on the shared `box`
391
+ * slot, while a field written on the literal itself (`tag({ name }, t)` → `box.note = t`)
392
+ * persists on the place and reaches whoever the callee hands the object to.
393
+ * A literal argument once skipped write-back entirely, so mutations through its live
394
+ * sub-objects were invisible to the caller; and when the literal was a per-pass fresh
395
+ * value, that write-back re-reported a change on every pass and the fixpoint never
396
+ * settled.
397
+ */
398
+ argWriteBackPlace(arg, value) {
399
+ const place = this.resolvePlace(arg);
400
+ if (place !== undefined)
401
+ return place;
402
+ const peeled = peelPlace(arg);
403
+ return ts.isObjectLiteralExpression(peeled) || ts.isArrayLiteralExpression(peeled) ? value : undefined;
404
+ }
405
+ /**
406
+ * Bind a destructuring pattern (or a single name). See {@link bindPattern} in patterns.ts;
407
+ * exposed as a thin method because the aliasing-bind machinery is used across modules.
408
+ */
409
+ bindPattern(name, value, ctx, sourcePlace) {
410
+ bindPattern(this, name, value, ctx, sourcePlace);
411
+ }
412
+ /** The live field at `key` of a place, for destructuring aliasing (see patterns.ts). */
413
+ extractField(container, key) {
414
+ return extractField(this, container, key);
415
+ }
416
+ /** Read a statically-known field with smear-on-read, else collapse (see patterns.ts). */
417
+ selectField(value, key) {
418
+ return selectField(value, key);
419
+ }
420
+ // -- expression evaluator ------------------------------------------------
421
+ evalExpr(node, ctx) {
422
+ switch (node.kind) {
423
+ case ts.SyntaxKind.Identifier:
424
+ return this.evalIdentifier(node);
425
+ case ts.SyntaxKind.ParenthesizedExpression:
426
+ return this.evalExpr(node.expression, ctx);
427
+ case ts.SyntaxKind.AwaitExpression:
428
+ return evalAwait(this, node, ctx);
429
+ case ts.SyntaxKind.AsExpression:
430
+ case ts.SyntaxKind.SatisfiesExpression:
431
+ return this.evalExpr(node.expression, ctx);
432
+ case ts.SyntaxKind.NonNullExpression:
433
+ return this.evalExpr(node.expression, ctx);
434
+ case ts.SyntaxKind.TypeAssertionExpression:
435
+ return this.evalExpr(node.expression, ctx);
436
+ case ts.SyntaxKind.FunctionExpression:
437
+ case ts.SyntaxKind.ArrowFunction: {
438
+ const out = emptyValue();
439
+ out.fns.add(node);
440
+ return out;
441
+ }
442
+ case ts.SyntaxKind.ThisKeyword: {
443
+ // `this` resolves to the enclosing class's shared instance (a live reference, read
444
+ // here as a clone like an identifier). Outside any class it is empty. Writes
445
+ // (`this.x = v`) go through resolvePlace's ThisKeyword case, which returns the
446
+ // live instance so the mutation lands on the shared value.
447
+ const instance = enclosingClassInstance(this, node);
448
+ return instance === undefined ? emptyValue() : cloneValue(instance);
449
+ }
450
+ case ts.SyntaxKind.SuperKeyword: {
451
+ // `super` resolves to the BASE class's shared instance, so `super.reveal()` dispatches
452
+ // to the base method summary and `super.x` reads the base field. (`super(args)` is a
453
+ // CallExpression intercepted in evalCall before this.) Empty outside a derived class.
454
+ // SuperKeyword previously had no case → emptyValue → `super.m` had no fns → unknown call.
455
+ const base = enclosingBaseInstance(this, node);
456
+ return base === undefined ? emptyValue() : cloneValue(base);
457
+ }
458
+ default:
459
+ break;
460
+ }
461
+ if (ts.isCallExpression(node))
462
+ return evalCall(this, node, ctx);
463
+ if (ts.isPropertyAccessExpression(node))
464
+ return this.evalPropertyAccess(node, ctx);
465
+ if (ts.isElementAccessExpression(node))
466
+ return this.evalElementAccess(node, ctx);
467
+ if (ts.isBinaryExpression(node))
468
+ return this.evalBinary(node, ctx);
469
+ if (ts.isTemplateExpression(node)) {
470
+ const out = emptyValue();
471
+ for (const span of node.templateSpans)
472
+ collapseInto(out, this.evalExpr(span.expression, ctx));
473
+ return out;
474
+ }
475
+ if (ts.isTaggedTemplateExpression(node)) {
476
+ // A tagged template calls tag(strings, ...values). Without this case,
477
+ // evalExpr would fall through to emptyValue() and lose all interpolated
478
+ // taint, for both String.raw and user-defined tags.
479
+ const argVals = [emptyValue()]; // the frozen strings array (untainted)
480
+ if (ts.isTemplateExpression(node.template)) {
481
+ for (const span of node.template.templateSpans)
482
+ argVals.push(this.evalExpr(span.expression, ctx));
483
+ }
484
+ return applyCall(this, node.tag, argVals, ctx, undefined, undefined, node);
485
+ }
486
+ if (ts.isYieldExpression(node)) {
487
+ // `yield e` / `yield* e` joins the operand into the enclosing function's return
488
+ // summary; the yield expression's own value is empty. Previously `yield` had no
489
+ // case, so a generator's yielded (tainted) values never entered its summary.
490
+ if (node.expression !== undefined)
491
+ ctx.onReturn(this.evalExpr(node.expression, ctx));
492
+ return emptyValue();
493
+ }
494
+ if (ts.isConditionalExpression(node)) {
495
+ // Evaluate the condition for effect (asks/reads inside it must be visited so their
496
+ // in/out edges are emitted); its taint is NOT unioned into the result — control
497
+ // dependence is not part of the may-flow data contract, mirroring how `if`/`while`
498
+ // conditions are handled. Previously the condition was never visited, so a facade
499
+ // sink sitting in it (`(await ask()) ? … : …`) vanished from the graph entirely.
500
+ // Phase 2 RECORDS it as a guard sink, which does not contradict the above: a sink
501
+ // says what the branch reads, it still joins nothing into the value.
502
+ this.recordGuard(node.condition, this.evalExpr(node.condition, ctx));
503
+ return unionValues(this.evalExpr(node.whenTrue, ctx), this.evalExpr(node.whenFalse, ctx));
504
+ }
505
+ if (ts.isPrefixUnaryExpression(node) || ts.isPostfixUnaryExpression(node)) {
506
+ return collapse(this.evalExpr(node.operand, ctx));
507
+ }
508
+ // `typeof`/`void`/`delete` are DISTINCT node kinds (not PrefixUnaryExpression), so the
509
+ // operand needs its own evaluation or a facade call inside it loses all edges. All three evaluate the operand for effects; `typeof` yields a string derived
510
+ // from it (collapse — "strings launder nothing"), `void`/`delete` yield undefined /
511
+ // boolean (empty), and `delete` performs NO kill (gen-only).
512
+ if (ts.isTypeOfExpression(node))
513
+ return collapse(this.evalExpr(node.expression, ctx));
514
+ if (ts.isVoidExpression(node) || ts.isDeleteExpression(node)) {
515
+ this.evalExpr(node.expression, ctx);
516
+ return emptyValue();
517
+ }
518
+ // A container literal evaluates to its allocation-site PLACE (state.literalPlaceOf): the
519
+ // fresh per-pass evaluation is merged into the persistent place and the place is what
520
+ // flows on — so a write through it (parameter write-back, a later field assignment through
521
+ // an alias) lands on storage that survives the pass.
522
+ if (ts.isArrayLiteralExpression(node))
523
+ return this.s.literalPlaceOf(node, evalArrayLiteral(this, node, ctx));
524
+ if (ts.isObjectLiteralExpression(node))
525
+ return this.s.literalPlaceOf(node, evalObjectLiteral(this, node, ctx));
526
+ if (ts.isNewExpression(node)) {
527
+ // `new C(args)` on a script-local class applies the constructor (placeholder actuals
528
+ // + param write-back) and returns a REFERENCE to the class's shared abstract
529
+ // instance, so `const h = new C(s)` aliases h to that instance (all instances of a
530
+ // class are conflated — weak).
531
+ const cls = resolveClassNode(this, node.expression);
532
+ if (cls !== undefined) {
533
+ const ctor = classConstructor(this, cls);
534
+ const ctorId = ctor === undefined ? undefined : this.s.fnId.get(ctor);
535
+ const args = node.arguments ?? [];
536
+ const argVals = args.map((arg) => this.evalExpr(arg, ctx));
537
+ if (ctorId !== undefined) {
538
+ const argPlaces = args.map((arg, i) => this.argWriteBackPlace(arg, argVals[i]));
539
+ applyConstructor(this, ctorId, ctx, argVals, argPlaces, node);
540
+ }
541
+ else if (hasUnresolvedHeritage(this, cls)) {
542
+ // No resolvable constructor because the base is a mixin CALL (`class D extends
543
+ // mix(Base)`): the inherited ctor may store any argument in any field, so smear the
544
+ // args (inexact) into the instance. Sound over-approximation (see applyMixinConstructor).
545
+ applyMixinConstructor(this, ctx, this.s.instanceOf(cls), argVals);
546
+ }
547
+ return this.s.instanceOf(cls);
548
+ }
549
+ // Non-class callee (`new Set([x])`, `new Promise(exec)`): the unknown-`new` keystone —
550
+ // union of the argument collapses PLUS pessimistic application of function-valued args
551
+ // AND the promise-executor rule (what a function arg feeds to its own params joins the
552
+ // result). The old branch only collapsed arguments, so `new Promise((resolve) =>
553
+ // resolve(draft))` never let draft reach the promise's value (no keystone for `new`).
554
+ return handleNewUnknown(this, node, ctx);
555
+ }
556
+ if (ts.isSpreadElement(node))
557
+ return collapse(this.evalExpr(node.expression, ctx));
558
+ return emptyValue();
559
+ }
560
+ evalIdentifier(node) {
561
+ const sym = this.checker.getSymbolAtLocation(node);
562
+ if (sym === undefined)
563
+ return this.argumentsValue(node) ?? emptyValue();
564
+ // A class-name reference reads the class's shared instance (static access conflates
565
+ // with instance access — `C.staticProp` and `this.prop` hit the one instance value).
566
+ const cls = classNodeOfSymbol(this, sym);
567
+ if (cls !== undefined)
568
+ return cloneValue(this.s.instanceOf(cls));
569
+ const slot = this.s.env.get(sym);
570
+ if (slot !== undefined)
571
+ return cloneValue(slot);
572
+ // Unbound identifier: the implicit `arguments` object of the enclosing (non-arrow)
573
+ // function resolves to a rest-like placeholder over ALL its actuals; everything else
574
+ // is empty.
575
+ return this.argumentsValue(node) ?? emptyValue();
576
+ }
577
+ /**
578
+ * The implicit `arguments` object as a rest-like placeholder gathering every actual of
579
+ * the nearest enclosing NON-arrow function (param index 0, rest). `arguments[i]` then
580
+ * reads a field of it → collapse keeps the placeholder → emission expands it to all
581
+ * recorded actuals (a sound over-approximation: `arguments[0]` yields the whole list).
582
+ * Arrow functions have no own `arguments`, so the ancestor walk skips them and binds the
583
+ * enclosing function's — matching JS's lexical `arguments`. Previously `arguments`
584
+ * resolved to the lib symbol with no env slot, so `arguments[0]` dropped every
585
+ * actual's taint.
586
+ */
587
+ argumentsValue(node) {
588
+ if (node.text !== "arguments")
589
+ return undefined;
590
+ const fn = ts.findAncestor(node, (a) => isNonArrowFunctionLike(a));
591
+ const id = fn === undefined ? undefined : this.s.fnId.get(fn);
592
+ if (id === undefined)
593
+ return undefined;
594
+ const val = emptyValue();
595
+ addPlaceholder(val, { fnId: id, param: 0, rest: true });
596
+ return val;
597
+ }
598
+ evalBinary(node, ctx) {
599
+ const op = node.operatorToken.kind;
600
+ if (op === ts.SyntaxKind.EqualsToken)
601
+ return handleAssignment(this, node, ctx);
602
+ if (COMPOUND_ASSIGNMENT_OPS.has(op))
603
+ return handleCompoundAssignment(this, node, ctx);
604
+ if (op === ts.SyntaxKind.CommaToken) {
605
+ // The comma (sequence) operator evaluates its left operand for effect (facade sinks
606
+ // inside it must be visited) and yields the RIGHT operand's value UNCOLLAPSED — the
607
+ // sequence's result IS the right operand, so its field structure is preserved (a
608
+ // later `(f(), box).note` read and comma-aliasing both need that). Previously the
609
+ // comma fell through to the value-producing default, which collapsed the result
610
+ // and unioned the discarded left operand's taint into it.
611
+ this.evalExpr(node.left, ctx);
612
+ return this.evalExpr(node.right, ctx);
613
+ }
614
+ if (op === ts.SyntaxKind.AmpersandAmpersandToken ||
615
+ op === ts.SyntaxKind.BarBarToken ||
616
+ op === ts.SyntaxKind.QuestionQuestionToken) {
617
+ // Short-circuit: the LEFT operand decides whether the right one evaluates, so it is
618
+ // a guard sink — the ordering walk opens a `branch` region over the right operand
619
+ // and reads its controllers off this same node.
620
+ const left = this.evalExpr(node.left, ctx);
621
+ this.recordGuard(node.left, left);
622
+ return unionValues(left, this.evalExpr(node.right, ctx));
623
+ }
624
+ // Value-producing operators (concat, arithmetic, comparison): union of operand
625
+ // taints, fields dropped — the result is a primitive.
626
+ return unionValues(collapse(this.evalExpr(node.left, ctx)), collapse(this.evalExpr(node.right, ctx)));
627
+ }
628
+ evalPropertyAccess(node, ctx) {
629
+ const receiver = this.evalExpr(node.expression, ctx);
630
+ // Field-sensitive read with smear-on-read (readField unions the container's own
631
+ // container-level occurrences); unknown field folds to the whole-value read.
632
+ return readField(receiver, node.name.text);
633
+ }
634
+ evalElementAccess(node, ctx) {
635
+ const receiver = this.evalExpr(node.expression, ctx);
636
+ const literalKey = staticIndexKey(node.argumentExpression);
637
+ if (literalKey !== undefined)
638
+ return readField(receiver, literalKey);
639
+ // Computed index: evaluate the key for effect (a facade sink can sit in it, e.g.
640
+ // `o[await ask()]`); its taint is NOT joined into the read value — the value stored at a
641
+ // key does not textually contain the key, same convention as a ternary condition. THE
642
+ // widening rule: whole-container read, exactness cleared.
643
+ this.evalExpr(node.argumentExpression, ctx);
644
+ return clearExact(collapse(receiver));
645
+ }
646
+ receiverSymbol(expr) {
647
+ return ts.isIdentifier(expr) ? this.checker.getSymbolAtLocation(expr) : undefined;
648
+ }
649
+ }