@decaf-ts/as-graph 0.2.0 → 0.4.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 (374) hide show
  1. package/README.md +160 -2
  2. package/dist/as-graph.cjs +1 -1
  3. package/dist/as-graph.cjs.map +1 -1
  4. package/dist/as-graph.js +1 -1
  5. package/dist/as-graph.js.map +1 -1
  6. package/lib/cjs/dagster/DagsterGraphEventBridge.cjs +344 -0
  7. package/lib/cjs/dagster/DagsterGraphEventBridge.cjs.map +1 -0
  8. package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs +789 -0
  9. package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs.map +1 -0
  10. package/lib/cjs/dagster/DagsterResultMapper.cjs +56 -0
  11. package/lib/cjs/dagster/DagsterResultMapper.cjs.map +1 -0
  12. package/lib/cjs/dagster/DagsterTypes.cjs +4 -0
  13. package/lib/cjs/dagster/DagsterTypes.cjs.map +1 -0
  14. package/lib/cjs/dagster/capabilities.cjs +102 -0
  15. package/lib/cjs/dagster/capabilities.cjs.map +1 -0
  16. package/lib/cjs/dagster/constants.cjs +92 -0
  17. package/lib/cjs/dagster/constants.cjs.map +1 -0
  18. package/lib/cjs/dagster/index.cjs +32 -0
  19. package/lib/cjs/dagster/index.cjs.map +1 -0
  20. package/lib/cjs/engine/constants.cjs +6 -1
  21. package/lib/cjs/engine/constants.cjs.map +1 -1
  22. package/lib/cjs/engine/execution/GraphCodeMode.cjs +137 -0
  23. package/lib/cjs/engine/execution/GraphCodeMode.cjs.map +1 -0
  24. package/lib/cjs/engine/execution/GraphExecutionBackend.cjs +89 -0
  25. package/lib/cjs/engine/execution/GraphExecutionBackend.cjs.map +1 -0
  26. package/lib/cjs/engine/execution/GraphExecutionBackendRegistry.cjs +107 -0
  27. package/lib/cjs/engine/execution/GraphExecutionBackendRegistry.cjs.map +1 -0
  28. package/lib/cjs/engine/execution/GraphExecutionEngine.cjs +250 -733
  29. package/lib/cjs/engine/execution/GraphExecutionEngine.cjs.map +1 -1
  30. package/lib/cjs/engine/execution/LocalGraphExecutionBackend.cjs +804 -0
  31. package/lib/cjs/engine/execution/LocalGraphExecutionBackend.cjs.map +1 -0
  32. package/lib/cjs/engine/execution/index.cjs +4 -0
  33. package/lib/cjs/engine/execution/index.cjs.map +1 -1
  34. package/lib/cjs/engine/index.cjs +5 -0
  35. package/lib/cjs/engine/index.cjs.map +1 -1
  36. package/lib/cjs/engine/loops/ConditionEvaluator.cjs +116 -0
  37. package/lib/cjs/engine/loops/ConditionEvaluator.cjs.map +1 -0
  38. package/lib/cjs/engine/loops/GraphConditionEvaluator.cjs +25 -2
  39. package/lib/cjs/engine/loops/GraphConditionEvaluator.cjs.map +1 -1
  40. package/lib/cjs/engine/loops/index.cjs +1 -0
  41. package/lib/cjs/engine/loops/index.cjs.map +1 -1
  42. package/lib/cjs/engine/runs/GraphRunService.cjs +121 -3
  43. package/lib/cjs/engine/runs/GraphRunService.cjs.map +1 -1
  44. package/lib/cjs/engine/runs/InMemoryGraphRunStore.cjs +33 -0
  45. package/lib/cjs/engine/runs/InMemoryGraphRunStore.cjs.map +1 -1
  46. package/lib/cjs/engine/runs/ownership.cjs +100 -11
  47. package/lib/cjs/engine/runs/ownership.cjs.map +1 -1
  48. package/lib/cjs/engine/services/GraphRunModelService.cjs +16 -0
  49. package/lib/cjs/engine/services/GraphRunModelService.cjs.map +1 -1
  50. package/lib/cjs/engine/services/GraphWorkflowService.cjs +153 -16
  51. package/lib/cjs/engine/services/GraphWorkflowService.cjs.map +1 -1
  52. package/lib/cjs/mastra/MastraCapabilities.cjs +171 -0
  53. package/lib/cjs/mastra/MastraCapabilities.cjs.map +1 -0
  54. package/lib/cjs/mastra/MastraConditionBridge.cjs +39 -0
  55. package/lib/cjs/mastra/MastraConditionBridge.cjs.map +1 -0
  56. package/lib/cjs/mastra/MastraEventBridge.cjs +486 -0
  57. package/lib/cjs/mastra/MastraEventBridge.cjs.map +1 -0
  58. package/lib/cjs/mastra/MastraGraphExecutionBackend.cjs +351 -0
  59. package/lib/cjs/mastra/MastraGraphExecutionBackend.cjs.map +1 -0
  60. package/lib/cjs/mastra/MastraResumeGuard.cjs +127 -0
  61. package/lib/cjs/mastra/MastraResumeGuard.cjs.map +1 -0
  62. package/lib/cjs/mastra/MastraSchemaConverter.cjs +124 -0
  63. package/lib/cjs/mastra/MastraSchemaConverter.cjs.map +1 -0
  64. package/lib/cjs/mastra/MastraWorkflowCompiler.cjs +461 -0
  65. package/lib/cjs/mastra/MastraWorkflowCompiler.cjs.map +1 -0
  66. package/lib/cjs/mastra/MastraWorkflowManager.cjs +401 -0
  67. package/lib/cjs/mastra/MastraWorkflowManager.cjs.map +1 -0
  68. package/lib/cjs/mastra/index.cjs +35 -0
  69. package/lib/cjs/mastra/index.cjs.map +1 -0
  70. package/lib/cjs/mastra/types.cjs +34 -0
  71. package/lib/cjs/mastra/types.cjs.map +1 -0
  72. package/lib/cjs/nest/graph/GraphEngineCapabilityManifest.cjs +136 -0
  73. package/lib/cjs/nest/graph/GraphEngineCapabilityManifest.cjs.map +1 -0
  74. package/lib/cjs/nest/graph/GraphEngineCapabilityService.cjs +140 -0
  75. package/lib/cjs/nest/graph/GraphEngineCapabilityService.cjs.map +1 -0
  76. package/lib/cjs/nest/graph/GraphEngineController.cjs +227 -0
  77. package/lib/cjs/nest/graph/GraphEngineController.cjs.map +1 -0
  78. package/lib/cjs/nest/graph/GraphExecutionModule.cjs +30 -2
  79. package/lib/cjs/nest/graph/GraphExecutionModule.cjs.map +1 -1
  80. package/lib/cjs/nest/graph/GraphRunController.cjs +208 -28
  81. package/lib/cjs/nest/graph/GraphRunController.cjs.map +1 -1
  82. package/lib/cjs/nest/graph/GraphWorkflowController.cjs +97 -14
  83. package/lib/cjs/nest/graph/GraphWorkflowController.cjs.map +1 -1
  84. package/lib/cjs/nest/graph/index.cjs +3 -0
  85. package/lib/cjs/nest/graph/index.cjs.map +1 -1
  86. package/lib/cjs/nest/graph/main.cjs +54 -0
  87. package/lib/cjs/nest/graph/main.cjs.map +1 -0
  88. package/lib/cjs/nest/graph/servingDates.cjs +53 -0
  89. package/lib/cjs/nest/graph/servingDates.cjs.map +1 -0
  90. package/lib/cjs/nest/graph/servingErrors.cjs +68 -0
  91. package/lib/cjs/nest/graph/servingErrors.cjs.map +1 -0
  92. package/lib/cjs/node/flow/if/node.cjs +27 -9
  93. package/lib/cjs/node/flow/if/node.cjs.map +1 -1
  94. package/lib/cjs/node/flow/loop/until/node.cjs +5 -2
  95. package/lib/cjs/node/flow/loop/until/node.cjs.map +1 -1
  96. package/lib/cjs/node/flow/loop/while/node.cjs +8 -2
  97. package/lib/cjs/node/flow/loop/while/node.cjs.map +1 -1
  98. package/lib/cjs/node/flow/switch/node.cjs +2 -37
  99. package/lib/cjs/node/flow/switch/node.cjs.map +1 -1
  100. package/lib/cjs/node/utility/code/node.cjs +11 -3
  101. package/lib/cjs/node/utility/code/node.cjs.map +1 -1
  102. package/lib/cjs/ram/GraphRunStore.cjs +14 -0
  103. package/lib/cjs/ram/GraphRunStore.cjs.map +1 -1
  104. package/lib/cjs/shared/graph/catalog/GraphManifestCompiler.cjs +2 -3
  105. package/lib/cjs/shared/graph/catalog/GraphManifestCompiler.cjs.map +1 -1
  106. package/lib/cjs/shared/graph/constants.cjs +8 -0
  107. package/lib/cjs/shared/graph/constants.cjs.map +1 -1
  108. package/lib/cjs/shared/graph/index.cjs +2 -1
  109. package/lib/cjs/shared/graph/index.cjs.map +1 -1
  110. package/lib/cjs/shared/graph/layout/GraphWorkflowLayout.cjs +146 -0
  111. package/lib/cjs/shared/graph/layout/GraphWorkflowLayout.cjs.map +1 -0
  112. package/lib/cjs/shared/graph/layout/index.cjs +23 -0
  113. package/lib/cjs/shared/graph/layout/index.cjs.map +1 -0
  114. package/lib/cjs/shared/graph/layout/layout-options.cjs +93 -0
  115. package/lib/cjs/shared/graph/layout/layout-options.cjs.map +1 -0
  116. package/lib/cjs/shared/ui/index.cjs +8 -10
  117. package/lib/cjs/shared/ui/index.cjs.map +1 -1
  118. package/lib/esm/dagster/DagsterGraphEventBridge.js +339 -0
  119. package/lib/esm/dagster/DagsterGraphEventBridge.js.map +1 -0
  120. package/lib/esm/dagster/DagsterGraphExecutionBackend.js +781 -0
  121. package/lib/esm/dagster/DagsterGraphExecutionBackend.js.map +1 -0
  122. package/lib/esm/dagster/DagsterResultMapper.js +51 -0
  123. package/lib/esm/dagster/DagsterResultMapper.js.map +1 -0
  124. package/lib/esm/dagster/DagsterTypes.js +2 -0
  125. package/lib/esm/dagster/DagsterTypes.js.map +1 -0
  126. package/lib/esm/dagster/capabilities.js +97 -0
  127. package/lib/esm/dagster/capabilities.js.map +1 -0
  128. package/lib/esm/dagster/constants.js +88 -0
  129. package/lib/esm/dagster/constants.js.map +1 -0
  130. package/lib/esm/dagster/index.js +15 -0
  131. package/lib/esm/dagster/index.js.map +1 -0
  132. package/lib/esm/engine/constants.js +5 -0
  133. package/lib/esm/engine/constants.js.map +1 -1
  134. package/lib/esm/engine/execution/GraphCodeMode.js +132 -0
  135. package/lib/esm/engine/execution/GraphCodeMode.js.map +1 -0
  136. package/lib/esm/engine/execution/GraphExecutionBackend.js +83 -0
  137. package/lib/esm/engine/execution/GraphExecutionBackend.js.map +1 -0
  138. package/lib/esm/engine/execution/GraphExecutionBackendRegistry.js +102 -0
  139. package/lib/esm/engine/execution/GraphExecutionBackendRegistry.js.map +1 -0
  140. package/lib/esm/engine/execution/GraphExecutionEngine.js +232 -716
  141. package/lib/esm/engine/execution/GraphExecutionEngine.js.map +1 -1
  142. package/lib/esm/engine/execution/LocalGraphExecutionBackend.js +799 -0
  143. package/lib/esm/engine/execution/LocalGraphExecutionBackend.js.map +1 -0
  144. package/lib/esm/engine/execution/index.js +4 -0
  145. package/lib/esm/engine/execution/index.js.map +1 -1
  146. package/lib/esm/engine/index.js +5 -0
  147. package/lib/esm/engine/index.js.map +1 -1
  148. package/lib/esm/engine/loops/ConditionEvaluator.js +108 -0
  149. package/lib/esm/engine/loops/ConditionEvaluator.js.map +1 -0
  150. package/lib/esm/engine/loops/GraphConditionEvaluator.js +25 -2
  151. package/lib/esm/engine/loops/GraphConditionEvaluator.js.map +1 -1
  152. package/lib/esm/engine/loops/index.js +1 -0
  153. package/lib/esm/engine/loops/index.js.map +1 -1
  154. package/lib/esm/engine/runs/GraphRunService.js +123 -5
  155. package/lib/esm/engine/runs/GraphRunService.js.map +1 -1
  156. package/lib/esm/engine/runs/InMemoryGraphRunStore.js +33 -0
  157. package/lib/esm/engine/runs/InMemoryGraphRunStore.js.map +1 -1
  158. package/lib/esm/engine/runs/ownership.js +97 -11
  159. package/lib/esm/engine/runs/ownership.js.map +1 -1
  160. package/lib/esm/engine/services/GraphRunModelService.js +16 -0
  161. package/lib/esm/engine/services/GraphRunModelService.js.map +1 -1
  162. package/lib/esm/engine/services/GraphWorkflowService.js +155 -18
  163. package/lib/esm/engine/services/GraphWorkflowService.js.map +1 -1
  164. package/lib/esm/mastra/MastraCapabilities.js +164 -0
  165. package/lib/esm/mastra/MastraCapabilities.js.map +1 -0
  166. package/lib/esm/mastra/MastraConditionBridge.js +34 -0
  167. package/lib/esm/mastra/MastraConditionBridge.js.map +1 -0
  168. package/lib/esm/mastra/MastraEventBridge.js +481 -0
  169. package/lib/esm/mastra/MastraEventBridge.js.map +1 -0
  170. package/lib/esm/mastra/MastraGraphExecutionBackend.js +346 -0
  171. package/lib/esm/mastra/MastraGraphExecutionBackend.js.map +1 -0
  172. package/lib/esm/mastra/MastraResumeGuard.js +123 -0
  173. package/lib/esm/mastra/MastraResumeGuard.js.map +1 -0
  174. package/lib/esm/mastra/MastraSchemaConverter.js +119 -0
  175. package/lib/esm/mastra/MastraSchemaConverter.js.map +1 -0
  176. package/lib/esm/mastra/MastraWorkflowCompiler.js +456 -0
  177. package/lib/esm/mastra/MastraWorkflowCompiler.js.map +1 -0
  178. package/lib/esm/mastra/MastraWorkflowManager.js +396 -0
  179. package/lib/esm/mastra/MastraWorkflowManager.js.map +1 -0
  180. package/lib/esm/mastra/index.js +18 -0
  181. package/lib/esm/mastra/index.js.map +1 -0
  182. package/lib/esm/mastra/types.js +30 -0
  183. package/lib/esm/mastra/types.js.map +1 -0
  184. package/lib/esm/nest/graph/GraphEngineCapabilityManifest.js +129 -0
  185. package/lib/esm/nest/graph/GraphEngineCapabilityManifest.js.map +1 -0
  186. package/lib/esm/nest/graph/GraphEngineCapabilityService.js +131 -0
  187. package/lib/esm/nest/graph/GraphEngineCapabilityService.js.map +1 -0
  188. package/lib/esm/nest/graph/GraphEngineController.js +218 -0
  189. package/lib/esm/nest/graph/GraphEngineController.js.map +1 -0
  190. package/lib/esm/nest/graph/GraphExecutionModule.js +30 -2
  191. package/lib/esm/nest/graph/GraphExecutionModule.js.map +1 -1
  192. package/lib/esm/nest/graph/GraphRunController.js +209 -29
  193. package/lib/esm/nest/graph/GraphRunController.js.map +1 -1
  194. package/lib/esm/nest/graph/GraphWorkflowController.js +98 -15
  195. package/lib/esm/nest/graph/GraphWorkflowController.js.map +1 -1
  196. package/lib/esm/nest/graph/index.js +3 -0
  197. package/lib/esm/nest/graph/index.js.map +1 -1
  198. package/lib/esm/nest/graph/main.js +51 -0
  199. package/lib/esm/nest/graph/main.js.map +1 -0
  200. package/lib/esm/nest/graph/servingDates.js +49 -0
  201. package/lib/esm/nest/graph/servingDates.js.map +1 -0
  202. package/lib/esm/nest/graph/servingErrors.js +63 -0
  203. package/lib/esm/nest/graph/servingErrors.js.map +1 -0
  204. package/lib/esm/node/flow/if/node.js +27 -9
  205. package/lib/esm/node/flow/if/node.js.map +1 -1
  206. package/lib/esm/node/flow/loop/until/node.js +5 -2
  207. package/lib/esm/node/flow/loop/until/node.js.map +1 -1
  208. package/lib/esm/node/flow/loop/while/node.js +8 -2
  209. package/lib/esm/node/flow/loop/while/node.js.map +1 -1
  210. package/lib/esm/node/flow/switch/node.js +2 -37
  211. package/lib/esm/node/flow/switch/node.js.map +1 -1
  212. package/lib/esm/node/utility/code/node.js +11 -3
  213. package/lib/esm/node/utility/code/node.js.map +1 -1
  214. package/lib/esm/ram/GraphRunStore.js +14 -0
  215. package/lib/esm/ram/GraphRunStore.js.map +1 -1
  216. package/lib/esm/shared/graph/GraphExecutionStateMapper.js.map +1 -1
  217. package/lib/esm/shared/graph/catalog/GraphManifestCompiler.js +2 -3
  218. package/lib/esm/shared/graph/catalog/GraphManifestCompiler.js.map +1 -1
  219. package/lib/esm/shared/graph/constants.js +8 -0
  220. package/lib/esm/shared/graph/constants.js.map +1 -1
  221. package/lib/esm/shared/graph/document/GraphFlowBuilder.js.map +1 -1
  222. package/lib/esm/shared/graph/index.js +2 -1
  223. package/lib/esm/shared/graph/index.js.map +1 -1
  224. package/lib/esm/shared/graph/layout/GraphWorkflowLayout.js +107 -0
  225. package/lib/esm/shared/graph/layout/GraphWorkflowLayout.js.map +1 -0
  226. package/lib/esm/shared/graph/layout/index.js +6 -0
  227. package/lib/esm/shared/graph/layout/index.js.map +1 -0
  228. package/lib/esm/shared/graph/layout/layout-options.js +96 -0
  229. package/lib/esm/shared/graph/layout/layout-options.js.map +1 -0
  230. package/lib/esm/shared/ui/index.js +8 -10
  231. package/lib/esm/shared/ui/index.js.map +1 -1
  232. package/lib/types/dagster/DagsterGraphEventBridge.d.cts +142 -0
  233. package/lib/types/dagster/DagsterGraphEventBridge.d.mts +142 -0
  234. package/lib/types/dagster/DagsterGraphExecutionBackend.d.cts +323 -0
  235. package/lib/types/dagster/DagsterGraphExecutionBackend.d.mts +323 -0
  236. package/lib/types/dagster/DagsterResultMapper.d.cts +50 -0
  237. package/lib/types/dagster/DagsterResultMapper.d.mts +50 -0
  238. package/lib/types/dagster/DagsterTypes.d.cts +355 -0
  239. package/lib/types/dagster/DagsterTypes.d.mts +355 -0
  240. package/lib/types/dagster/capabilities.d.cts +34 -0
  241. package/lib/types/dagster/capabilities.d.mts +34 -0
  242. package/lib/types/dagster/constants.d.cts +87 -0
  243. package/lib/types/dagster/constants.d.mts +87 -0
  244. package/lib/types/dagster/index.d.cts +14 -0
  245. package/lib/types/dagster/index.d.mts +14 -0
  246. package/lib/types/engine/constants.d.cts +5 -0
  247. package/lib/types/engine/constants.d.mts +5 -0
  248. package/lib/types/engine/execution/GraphCodeMode.d.cts +52 -0
  249. package/lib/types/engine/execution/GraphCodeMode.d.mts +52 -0
  250. package/lib/types/engine/execution/GraphExecutionBackend.d.cts +306 -0
  251. package/lib/types/engine/execution/GraphExecutionBackend.d.mts +306 -0
  252. package/lib/types/engine/execution/GraphExecutionBackendRegistry.d.cts +59 -0
  253. package/lib/types/engine/execution/GraphExecutionBackendRegistry.d.mts +59 -0
  254. package/lib/types/engine/execution/GraphExecutionEngine.d.cts +116 -135
  255. package/lib/types/engine/execution/GraphExecutionEngine.d.mts +116 -135
  256. package/lib/types/engine/execution/LocalGraphExecutionBackend.d.cts +232 -0
  257. package/lib/types/engine/execution/LocalGraphExecutionBackend.d.mts +232 -0
  258. package/lib/types/engine/execution/index.d.cts +4 -0
  259. package/lib/types/engine/execution/index.d.mts +4 -0
  260. package/lib/types/engine/index.d.cts +5 -0
  261. package/lib/types/engine/index.d.mts +5 -0
  262. package/lib/types/engine/loops/ConditionEvaluator.d.cts +87 -0
  263. package/lib/types/engine/loops/ConditionEvaluator.d.mts +87 -0
  264. package/lib/types/engine/loops/GraphConditionEvaluator.d.cts +27 -7
  265. package/lib/types/engine/loops/GraphConditionEvaluator.d.mts +27 -7
  266. package/lib/types/engine/loops/index.d.cts +1 -0
  267. package/lib/types/engine/loops/index.d.mts +1 -0
  268. package/lib/types/engine/runs/GraphRunService.d.cts +60 -1
  269. package/lib/types/engine/runs/GraphRunService.d.mts +60 -1
  270. package/lib/types/engine/runs/InMemoryGraphRunStore.d.cts +29 -0
  271. package/lib/types/engine/runs/InMemoryGraphRunStore.d.mts +29 -0
  272. package/lib/types/engine/runs/ownership.d.cts +89 -4
  273. package/lib/types/engine/runs/ownership.d.mts +89 -4
  274. package/lib/types/engine/runs/types.d.cts +12 -1
  275. package/lib/types/engine/runs/types.d.mts +12 -1
  276. package/lib/types/engine/services/GraphRunModelService.d.cts +13 -0
  277. package/lib/types/engine/services/GraphRunModelService.d.mts +13 -0
  278. package/lib/types/engine/services/GraphWorkflowService.d.cts +74 -2
  279. package/lib/types/engine/services/GraphWorkflowService.d.mts +74 -2
  280. package/lib/types/engine/types.d.cts +11 -4
  281. package/lib/types/engine/types.d.mts +11 -4
  282. package/lib/types/mastra/MastraCapabilities.d.cts +91 -0
  283. package/lib/types/mastra/MastraCapabilities.d.mts +91 -0
  284. package/lib/types/mastra/MastraConditionBridge.d.cts +38 -0
  285. package/lib/types/mastra/MastraConditionBridge.d.mts +38 -0
  286. package/lib/types/mastra/MastraEventBridge.d.cts +189 -0
  287. package/lib/types/mastra/MastraEventBridge.d.mts +189 -0
  288. package/lib/types/mastra/MastraGraphExecutionBackend.d.cts +119 -0
  289. package/lib/types/mastra/MastraGraphExecutionBackend.d.mts +119 -0
  290. package/lib/types/mastra/MastraResumeGuard.d.cts +58 -0
  291. package/lib/types/mastra/MastraResumeGuard.d.mts +58 -0
  292. package/lib/types/mastra/MastraSchemaConverter.d.cts +39 -0
  293. package/lib/types/mastra/MastraSchemaConverter.d.mts +39 -0
  294. package/lib/types/mastra/MastraWorkflowCompiler.d.cts +218 -0
  295. package/lib/types/mastra/MastraWorkflowCompiler.d.mts +218 -0
  296. package/lib/types/mastra/MastraWorkflowManager.d.cts +220 -0
  297. package/lib/types/mastra/MastraWorkflowManager.d.mts +220 -0
  298. package/lib/types/mastra/index.d.cts +17 -0
  299. package/lib/types/mastra/index.d.mts +17 -0
  300. package/lib/types/mastra/types.d.cts +222 -0
  301. package/lib/types/mastra/types.d.mts +222 -0
  302. package/lib/types/nest/graph/GraphEngineCapabilityManifest.d.cts +87 -0
  303. package/lib/types/nest/graph/GraphEngineCapabilityManifest.d.mts +87 -0
  304. package/lib/types/nest/graph/GraphEngineCapabilityService.d.cts +98 -0
  305. package/lib/types/nest/graph/GraphEngineCapabilityService.d.mts +98 -0
  306. package/lib/types/nest/graph/GraphEngineController.d.cts +74 -0
  307. package/lib/types/nest/graph/GraphEngineController.d.mts +74 -0
  308. package/lib/types/nest/graph/GraphExecutionModule.d.cts +14 -1
  309. package/lib/types/nest/graph/GraphExecutionModule.d.mts +14 -1
  310. package/lib/types/nest/graph/GraphRunController.d.cts +69 -14
  311. package/lib/types/nest/graph/GraphRunController.d.mts +69 -14
  312. package/lib/types/nest/graph/GraphWorkflowController.d.cts +50 -17
  313. package/lib/types/nest/graph/GraphWorkflowController.d.mts +50 -17
  314. package/lib/types/nest/graph/index.d.cts +3 -0
  315. package/lib/types/nest/graph/index.d.mts +3 -0
  316. package/lib/types/nest/graph/main.d.cts +1 -0
  317. package/lib/types/nest/graph/main.d.mts +1 -0
  318. package/lib/types/nest/graph/servingDates.d.cts +35 -0
  319. package/lib/types/nest/graph/servingDates.d.mts +35 -0
  320. package/lib/types/nest/graph/servingErrors.d.cts +44 -0
  321. package/lib/types/nest/graph/servingErrors.d.mts +44 -0
  322. package/lib/types/node/flow/if/node.d.cts +20 -8
  323. package/lib/types/node/flow/if/node.d.mts +20 -8
  324. package/lib/types/node/flow/loop/until/node.d.cts +4 -1
  325. package/lib/types/node/flow/loop/until/node.d.mts +4 -1
  326. package/lib/types/node/flow/loop/while/node.d.cts +4 -1
  327. package/lib/types/node/flow/loop/while/node.d.mts +4 -1
  328. package/lib/types/node/utility/code/node.d.cts +1 -1
  329. package/lib/types/node/utility/code/node.d.mts +1 -1
  330. package/lib/types/ram/GraphRunStore.d.cts +12 -0
  331. package/lib/types/ram/GraphRunStore.d.mts +12 -0
  332. package/lib/types/shared/graph/GraphExecutionStateMapper.d.cts +5 -5
  333. package/lib/types/shared/graph/GraphExecutionStateMapper.d.mts +5 -5
  334. package/lib/types/shared/graph/constants.d.cts +8 -0
  335. package/lib/types/shared/graph/constants.d.mts +8 -0
  336. package/lib/types/shared/graph/document/GraphFlowBuilder.d.cts +5 -5
  337. package/lib/types/shared/graph/document/GraphFlowBuilder.d.mts +5 -5
  338. package/lib/types/shared/graph/index.d.cts +2 -1
  339. package/lib/types/shared/graph/index.d.mts +2 -1
  340. package/lib/types/shared/graph/layout/GraphWorkflowLayout.d.cts +49 -0
  341. package/lib/types/shared/graph/layout/GraphWorkflowLayout.d.mts +49 -0
  342. package/lib/types/shared/graph/layout/index.d.cts +5 -0
  343. package/lib/types/shared/graph/layout/index.d.mts +5 -0
  344. package/lib/types/shared/graph/layout/layout-options.d.cts +46 -0
  345. package/lib/types/shared/graph/layout/layout-options.d.mts +46 -0
  346. package/lib/types/shared/graph/types.d.cts +12 -4
  347. package/lib/types/shared/graph/types.d.mts +12 -4
  348. package/lib/types/shared/ui/index.d.cts +8 -10
  349. package/lib/types/shared/ui/index.d.mts +8 -10
  350. package/package.json +49 -6
  351. package/lib/cjs/shared/ui/GraphNodeView.cjs +0 -114
  352. package/lib/cjs/shared/ui/GraphNodeView.cjs.map +0 -1
  353. package/lib/cjs/shared/ui/GraphRunView.cjs +0 -96
  354. package/lib/cjs/shared/ui/GraphRunView.cjs.map +0 -1
  355. package/lib/cjs/shared/ui/GraphWorkflowView.cjs +0 -78
  356. package/lib/cjs/shared/ui/GraphWorkflowView.cjs.map +0 -1
  357. package/lib/cjs/shared/ui/types.cjs +0 -4
  358. package/lib/cjs/shared/ui/types.cjs.map +0 -1
  359. package/lib/esm/shared/ui/GraphNodeView.js +0 -107
  360. package/lib/esm/shared/ui/GraphNodeView.js.map +0 -1
  361. package/lib/esm/shared/ui/GraphRunView.js +0 -90
  362. package/lib/esm/shared/ui/GraphRunView.js.map +0 -1
  363. package/lib/esm/shared/ui/GraphWorkflowView.js +0 -72
  364. package/lib/esm/shared/ui/GraphWorkflowView.js.map +0 -1
  365. package/lib/esm/shared/ui/types.js +0 -2
  366. package/lib/esm/shared/ui/types.js.map +0 -1
  367. package/lib/types/shared/ui/GraphNodeView.d.cts +0 -48
  368. package/lib/types/shared/ui/GraphNodeView.d.mts +0 -48
  369. package/lib/types/shared/ui/GraphRunView.d.cts +0 -88
  370. package/lib/types/shared/ui/GraphRunView.d.mts +0 -88
  371. package/lib/types/shared/ui/GraphWorkflowView.d.cts +0 -18
  372. package/lib/types/shared/ui/GraphWorkflowView.d.mts +0 -18
  373. package/lib/types/shared/ui/types.d.cts +0 -200
  374. package/lib/types/shared/ui/types.d.mts +0 -200
@@ -1,10 +1,95 @@
1
1
  /**
2
- * Centralized graph resource ownership check (SAA-595 security hardening).
2
+ * Centralized graph resource access predicate (SAA-595 security hardening).
3
3
  *
4
- * Fail-closed by default: a resource that carries an owner is only accessible
5
- * to that owner; an absent caller identity is denied unless the explicit
4
+ * Fail-closed by default: a resource that carries an owner is only visible to
5
+ * that owner; an absent caller identity is denied unless the explicit
6
6
  * `allowAnonymousAccess` tolerance (DECAF-48 §4.15 standalone runs) is set.
7
- * Owner-less resources remain accessible to everyone.
7
+ * Owner-less resources remain accessible to everyone. Returns a boolean so list
8
+ * endpoints can filter a collection without aborting on the first foreign row.
9
+ *
10
+ * @param resource - The guarded resource (or its persisted record); only its
11
+ * `owner` member is read. `null`/`undefined` counts as owner-less.
12
+ * @param callerOwner - Identity of the caller resolved from the request
13
+ * context; `null`/`undefined`/`""` represent anonymous callers.
14
+ * @param options - `allowAnonymousAccess` opts in to the DECAF-48 §4.15
15
+ * standalone tolerance (default `false`).
16
+ * @return `true` when the caller may access the resource.
17
+ */
18
+ export declare function canAccessGraphResource(resource: {
19
+ owner?: string | null;
20
+ } | null | undefined, callerOwner: string | null | undefined, options?: {
21
+ allowAnonymousAccess?: boolean;
22
+ }): boolean;
23
+ /**
24
+ * Payload-scoped companion to {@link canAccessGraphResource} (SAA-93 F1).
25
+ *
26
+ * Read *visibility* of an owner-less resource is intentionally open to every
27
+ * caller, but the sensitive payload members a list projection serves
28
+ * (`inputs`/`result`/`error` on run rows) must not be. This predicate is
29
+ * fail-closed: a caller may see a row's payload only when the row's recorded
30
+ * owner equals the caller's resolved owner. An owner-less row (no recorded
31
+ * owner) therefore exposes its payload only to an owner-less caller (an
32
+ * anonymous/standalone caller); a named caller — even one allowed to see the row
33
+ * by {@link canAccessGraphResource} — receives the summary-only projection.
34
+ * That closes the cross-caller exposure where an unrelated authenticated caller
35
+ * could read another anonymous caller's `inputs`/`result`/`error` through
36
+ * `GET /graph/workflows/{workflowId}/runs`.
37
+ *
38
+ * @param resource - The guarded resource (or its persisted record); only its
39
+ * `owner` member is read. `null`/`undefined` counts as owner-less.
40
+ * @param callerOwner - Identity of the caller resolved from the request
41
+ * context; `null`/`undefined`/`""` represent owner-less callers.
42
+ * @return `true` when the caller may see the resource's payload members.
43
+ */
44
+ export declare function canAccessGraphResourcePayload(resource: {
45
+ owner?: string | null;
46
+ } | null | undefined, callerOwner: string | null | undefined): boolean;
47
+ /**
48
+ * Write-path ownership assertion for graph resources (SAA-105 R3).
49
+ *
50
+ * Mutation authorization is strict owner equality, deliberately stricter than the
51
+ * read-visibility predicate {@link canAccessGraphResource}: the owner-less
52
+ * visibility branch that lets any caller *read* an owner-less resource must never
53
+ * authorize a write. Concretely this denies a named caller mutating an owner-less
54
+ * resource (the R3 cross-caller hole) and denies an anonymous caller mutating an
55
+ * owned resource even when the read tolerance `allowAnonymousAccess` is set.
56
+ *
57
+ * The normative effects are:
58
+ * - owner-less resource + owner-less (anonymous) caller → allow;
59
+ * - owner-less resource + named caller → `ForbiddenError`;
60
+ * - owned resource + its owner → allow;
61
+ * - owned resource + any other caller (including anonymous with the read
62
+ * tolerance) → `ForbiddenError`.
63
+ *
64
+ * `allowAnonymousAccess` is intentionally not a parameter here: it is a
65
+ * read-visibility tolerance and never grants a write.
66
+ *
67
+ * @param resource - The guarded resource (or its persisted record); only its
68
+ * `owner` member is read. `null`/`undefined` counts as owner-less.
69
+ * @param callerOwner - Identity of the caller resolved from the request
70
+ * context; `null`/`undefined`/`""` represent owner-less callers.
71
+ * @param options - `resourceKind`/`resourceId` name the resource in the
72
+ * denial message.
73
+ * @throws ForbiddenError when the caller is not the resource's recorded owner
74
+ * (owner equality).
75
+ */
76
+ export declare function assertGraphResourceWriteOwnership(resource: {
77
+ owner?: string | null;
78
+ } | null | undefined, callerOwner: string | null | undefined, options: {
79
+ resourceKind: string;
80
+ resourceId: string;
81
+ }): void;
82
+ /**
83
+ * Centralized graph resource ownership check (SAA-595 security hardening).
84
+ *
85
+ * Read-visibility check. Fail-closed by default: a resource that carries an
86
+ * owner is only accessible to that owner; an absent caller identity is denied
87
+ * unless the explicit `allowAnonymousAccess` tolerance (DECAF-48 §4.15 standalone
88
+ * runs) is set. Owner-less resources remain accessible to everyone.
89
+ *
90
+ * Writes must NOT use this predicate; use
91
+ * {@link assertGraphResourceWriteOwnership} so the owner-less visibility branch
92
+ * and the `allowAnonymousAccess` tolerance cannot authorize a mutation.
8
93
  *
9
94
  * @param resource - The guarded resource (or its persisted record); only its
10
95
  * `owner` member is read. `null`/`undefined` counts as owner-less.
@@ -13,6 +13,7 @@
13
13
  */
14
14
  import type { Context, MaybeContextualArg } from "@decaf-ts/core";
15
15
  import type { GraphWorkflowDocument } from "../../shared/graph/index.d.cts";
16
+ import type { GraphRunModel } from "../../shared/graph/index.d.cts";
16
17
  import type { GraphExecutionResult, GraphExecutionValues } from "../types.d.cts";
17
18
  import type { GraphExecutionErrorPayload } from "../../shared/graph/index.d.cts";
18
19
  import type { GraphRunEventEnvelope, GraphRunStatus } from "../../shared/graph/index.d.cts";
@@ -63,10 +64,20 @@ export interface GraphRunEventStore {
63
64
  */
64
65
  release?(runId: string): void;
65
66
  }
66
- /** Persistence port for run records: save and read {@link GraphRun}s by id, with optional leading {@link Context}. */
67
+ /** Persistence port for run records: save, read by id, and list by workflow, with optional leading {@link Context}. */
67
68
  export interface GraphRunStore {
68
69
  saveRun(run: GraphRun, ...args: MaybeContextualArg<Context>): Promise<void>;
69
70
  readRun(runId: string, ...args: MaybeContextualArg<Context>): Promise<GraphRun | null>;
71
+ /**
72
+ * Lists every persisted run row that executed the given workflow document.
73
+ *
74
+ * Rows are returned as their persisted {@link GraphRunModel} shape so the
75
+ * serving list keeps the storage-derived fields (`updatedAt`, `inputs`) that
76
+ * the engine {@link GraphRun} does not carry. Implementations are free to
77
+ * return the rows in any order; the run service orders the serving result.
78
+ * An unknown workflow yields an empty list.
79
+ */
80
+ listRuns(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphRunModel[]>;
70
81
  }
71
82
  /** A run-creation request: an inline workflow document, or a saved `workflowId` plus optional input values. */
72
83
  export interface GraphRunCreateRequest {
@@ -13,6 +13,7 @@
13
13
  */
14
14
  import type { Context, MaybeContextualArg } from "@decaf-ts/core";
15
15
  import type { GraphWorkflowDocument } from "../../shared/graph/index.d.mts";
16
+ import type { GraphRunModel } from "../../shared/graph/index.d.mts";
16
17
  import type { GraphExecutionResult, GraphExecutionValues } from "../types.d.mts";
17
18
  import type { GraphExecutionErrorPayload } from "../../shared/graph/index.d.mts";
18
19
  import type { GraphRunEventEnvelope, GraphRunStatus } from "../../shared/graph/index.d.mts";
@@ -63,10 +64,20 @@ export interface GraphRunEventStore {
63
64
  */
64
65
  release?(runId: string): void;
65
66
  }
66
- /** Persistence port for run records: save and read {@link GraphRun}s by id, with optional leading {@link Context}. */
67
+ /** Persistence port for run records: save, read by id, and list by workflow, with optional leading {@link Context}. */
67
68
  export interface GraphRunStore {
68
69
  saveRun(run: GraphRun, ...args: MaybeContextualArg<Context>): Promise<void>;
69
70
  readRun(runId: string, ...args: MaybeContextualArg<Context>): Promise<GraphRun | null>;
71
+ /**
72
+ * Lists every persisted run row that executed the given workflow document.
73
+ *
74
+ * Rows are returned as their persisted {@link GraphRunModel} shape so the
75
+ * serving list keeps the storage-derived fields (`updatedAt`, `inputs`) that
76
+ * the engine {@link GraphRun} does not carry. Implementations are free to
77
+ * return the rows in any order; the run service orders the serving result.
78
+ * An unknown workflow yields an empty list.
79
+ */
80
+ listRuns(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphRunModel[]>;
70
81
  }
71
82
  /** A run-creation request: an inline workflow document, or a saved `workflowId` plus optional input values. */
72
83
  export interface GraphRunCreateRequest {
@@ -34,4 +34,17 @@ export declare class GraphRunModelService extends ModelService<GraphRunModel> im
34
34
  * @return {Promise<GraphRun | null>} The run, or `null` when no row exists.
35
35
  */
36
36
  readRun(runId: string, ...args: MaybeContextualArg<Context>): Promise<GraphRun | null>;
37
+ /**
38
+ * Lists every persisted run row for the given workflow document as its
39
+ * persisted {@link GraphRunModel} shape (keeping storage-derived fields such
40
+ * as `updatedAt` and `inputs`).
41
+ *
42
+ * A store failure propagates instead of being swallowed as `[]` (SAA-93 F4):
43
+ * silently emptying the list masks an outage as "no runs".
44
+ *
45
+ * @param {string} workflowId - Workflow document id the runs executed.
46
+ * @param args - An optional decaf `Context` forwarded to the model service.
47
+ * @return {Promise<GraphRunModel[]>} The matching rows (empty when none exist).
48
+ */
49
+ listRuns(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphRunModel[]>;
37
50
  }
@@ -34,4 +34,17 @@ export declare class GraphRunModelService extends ModelService<GraphRunModel> im
34
34
  * @return {Promise<GraphRun | null>} The run, or `null` when no row exists.
35
35
  */
36
36
  readRun(runId: string, ...args: MaybeContextualArg<Context>): Promise<GraphRun | null>;
37
+ /**
38
+ * Lists every persisted run row for the given workflow document as its
39
+ * persisted {@link GraphRunModel} shape (keeping storage-derived fields such
40
+ * as `updatedAt` and `inputs`).
41
+ *
42
+ * A store failure propagates instead of being swallowed as `[]` (SAA-93 F4):
43
+ * silently emptying the list masks an outage as "no runs".
44
+ *
45
+ * @param {string} workflowId - Workflow document id the runs executed.
46
+ * @param args - An optional decaf `Context` forwarded to the model service.
47
+ * @return {Promise<GraphRunModel[]>} The matching rows (empty when none exist).
48
+ */
49
+ listRuns(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphRunModel[]>;
37
50
  }
@@ -20,7 +20,16 @@ export declare function graphWorkflowOwnerOf(ctx: Context | undefined): string |
20
20
  * previously persisted legacy snapshots to canonical documents on read.
21
21
  * Enforces per-user ownership; absent caller identities are denied on owned
22
22
  * workflows unless the explicit DECAF-48 §4.15 standalone tolerance
23
- * (`allowAnonymousAccess`) is set (SAA-595 F3).
23
+ * (`allowAnonymousAccess`) is set for reads (SAA-595 F3). Overwriting an
24
+ * existing row is a write and is authorized by strict owner equality, so the
25
+ * read tolerance never grants an overwrite (SAA-105 R3).
26
+ *
27
+ * @remarks The overwrite gate is a read-then-write check, so it depends on the
28
+ * persistence adapter's contract (SAA-105 R3-b): `read` must throw
29
+ * `NotFoundError` for an absent row, and `create` must be create-only — it must
30
+ * reject a duplicate primary key rather than upsert. An adapter whose `create`
31
+ * upserts (or whose `read` hides an existing row) would let a named caller
32
+ * silently overwrite an owner-less row and bypass the owner-equality gate.
24
33
  */
25
34
  export declare class GraphWorkflowService extends ModelService<GraphWorkflowModel> {
26
35
  protected catalogue: GraphNodeCatalogue | undefined;
@@ -43,6 +52,15 @@ export declare class GraphWorkflowService extends ModelService<GraphWorkflowMode
43
52
  * validation, and the DECAF-48 ownership tuple; creates or updates the
44
53
  * {@link GraphWorkflowModel} row accordingly.
45
54
  *
55
+ * A fresh create stamps the caller's own owner and is unconditional. An
56
+ * overwrite of an existing row is a write authorized by strict owner equality
57
+ * (SAA-105 R3): a named caller cannot overwrite an owner-less workflow and
58
+ * the `allowAnonymousAccess` read tolerance never grants an overwrite.
59
+ *
60
+ * @remarks Relies on the class-level adapter contract that `read` throws
61
+ * `NotFoundError` for an absent row and `create` rejects a duplicate primary
62
+ * key instead of upserting (SAA-105 R3-b).
63
+ *
46
64
  * @param {string} workflowId - Workflow id from the request path.
47
65
  * @param {GraphWorkflowDocument} document - Canonical document to persist (its `id` must equal `workflowId`).
48
66
  * @param args - An optional decaf `Context` carrying the owning principal.
@@ -61,6 +79,38 @@ export declare class GraphWorkflowService extends ModelService<GraphWorkflowMode
61
79
  * @throws {NotFoundError} When the workflow does not exist or has no canonical document.
62
80
  */
63
81
  getDocument(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowDocument>;
82
+ /**
83
+ * Lists the workflows visible to the requesting caller, newest update first.
84
+ *
85
+ * The collection is ownership-filtered with
86
+ * {@link canAccessGraphResource}: owner-less system workflows stay visible to
87
+ * everyone, a named caller sees their own plus owner-less workflows, and an
88
+ * anonymous caller without the explicit `allowAnonymousAccess` tolerance sees
89
+ * only owner-less workflows (SAA-595 F3). The full rows are returned so the
90
+ * HTTP boundary can project the serving summary it exposes.
91
+ *
92
+ * A store failure propagates instead of being swallowed as `[]` (SAA-93 F4):
93
+ * silently emptying the list masks an outage as "no workflows" and hides it
94
+ * from monitoring. The sort key is computed through a corrupt-date-safe helper
95
+ * so a bad persisted `updatedAt` cannot throw before the per-row projection
96
+ * guard at the HTTP boundary skips that row.
97
+ *
98
+ * @param args - An optional decaf `Context` carrying the requesting principal.
99
+ * @return {Promise<GraphWorkflowModel[]>} Visible workflows, newest first.
100
+ */
101
+ listWorkflows(...args: MaybeContextualArg<Context>): Promise<GraphWorkflowModel[]>;
102
+ /**
103
+ * Asserts that the workflow exists and is visible to the requesting caller,
104
+ * returning the persisted row. Foreign owners surface as a `ForbiddenError`;
105
+ * unknown workflows as a `NotFoundError` (the read path's own contract).
106
+ *
107
+ * @param {string} workflowId - Workflow id to check.
108
+ * @param args - An optional decaf `Context` carrying the requesting principal.
109
+ * @return {Promise<GraphWorkflowModel>} The accessible workflow row.
110
+ * @throws {NotFoundError} When the workflow does not exist.
111
+ * @throws {ForbiddenError} When the workflow is owned by another user.
112
+ */
113
+ assertAccess(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowModel>;
64
114
  /**
65
115
  * Runs the nine-stage boundary validation gate over a canonical document
66
116
  * without persisting anything.
@@ -76,6 +126,14 @@ export declare class GraphWorkflowService extends ModelService<GraphWorkflowMode
76
126
  * enforcing the DECAF-48 ownership tuple and mirroring the wrapper's
77
127
  * document onto the row's canonical columns.
78
128
  *
129
+ * A fresh create is unconditional; an overwrite of an existing row is a write
130
+ * authorized by strict owner equality (SAA-105 R3) — see
131
+ * {@link saveDocument}.
132
+ *
133
+ * @remarks Relies on the class-level adapter contract that `read` throws
134
+ * `NotFoundError` for an absent row and `create` rejects a duplicate primary
135
+ * key instead of upserting (SAA-105 R3-b).
136
+ *
79
137
  * @param {string} workflowId - Workflow id from the request path.
80
138
  * @param {Record<string, unknown>} snapshot - JSON-safe canonical snapshot wrapper.
81
139
  * @param args - An optional decaf `Context` carrying the owning principal.
@@ -93,10 +151,24 @@ export declare class GraphWorkflowService extends ModelService<GraphWorkflowMode
93
151
  */
94
152
  loadSnapshot(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowModel | null>;
95
153
  /**
96
- * Guards a persisted workflow record with the centralized
154
+ * Existence probe for the owner-equality overwrite gate (SAA-105 R3-a): only a
155
+ * genuine absence (`NotFoundError`) resolves to `null`; every other read
156
+ * failure propagates so a transient store fault is never mistaken for absence
157
+ * and downgraded into an unconditional create.
158
+ */
159
+ private readExistingForWrite;
160
+ /**
161
+ * Read-visibility guard for a persisted workflow record via the centralized
97
162
  * {@link assertGraphResourceOwnership} check, honouring this service's
98
163
  * configured `allowAnonymousAccess` tolerance (SAA-595 F3).
99
164
  */
100
165
  private assertOwnership;
166
+ /**
167
+ * Write-path guard for an existing workflow record via the centralized
168
+ * {@link assertGraphResourceWriteOwnership} check: strict owner equality,
169
+ * never the read tolerance (SAA-105 R3). Only applied to overwrites; fresh
170
+ * creates are unconditional.
171
+ */
172
+ private assertWriteOwnership;
101
173
  private applyCanonicalWrapper;
102
174
  }
@@ -20,7 +20,16 @@ export declare function graphWorkflowOwnerOf(ctx: Context | undefined): string |
20
20
  * previously persisted legacy snapshots to canonical documents on read.
21
21
  * Enforces per-user ownership; absent caller identities are denied on owned
22
22
  * workflows unless the explicit DECAF-48 §4.15 standalone tolerance
23
- * (`allowAnonymousAccess`) is set (SAA-595 F3).
23
+ * (`allowAnonymousAccess`) is set for reads (SAA-595 F3). Overwriting an
24
+ * existing row is a write and is authorized by strict owner equality, so the
25
+ * read tolerance never grants an overwrite (SAA-105 R3).
26
+ *
27
+ * @remarks The overwrite gate is a read-then-write check, so it depends on the
28
+ * persistence adapter's contract (SAA-105 R3-b): `read` must throw
29
+ * `NotFoundError` for an absent row, and `create` must be create-only — it must
30
+ * reject a duplicate primary key rather than upsert. An adapter whose `create`
31
+ * upserts (or whose `read` hides an existing row) would let a named caller
32
+ * silently overwrite an owner-less row and bypass the owner-equality gate.
24
33
  */
25
34
  export declare class GraphWorkflowService extends ModelService<GraphWorkflowModel> {
26
35
  protected catalogue: GraphNodeCatalogue | undefined;
@@ -43,6 +52,15 @@ export declare class GraphWorkflowService extends ModelService<GraphWorkflowMode
43
52
  * validation, and the DECAF-48 ownership tuple; creates or updates the
44
53
  * {@link GraphWorkflowModel} row accordingly.
45
54
  *
55
+ * A fresh create stamps the caller's own owner and is unconditional. An
56
+ * overwrite of an existing row is a write authorized by strict owner equality
57
+ * (SAA-105 R3): a named caller cannot overwrite an owner-less workflow and
58
+ * the `allowAnonymousAccess` read tolerance never grants an overwrite.
59
+ *
60
+ * @remarks Relies on the class-level adapter contract that `read` throws
61
+ * `NotFoundError` for an absent row and `create` rejects a duplicate primary
62
+ * key instead of upserting (SAA-105 R3-b).
63
+ *
46
64
  * @param {string} workflowId - Workflow id from the request path.
47
65
  * @param {GraphWorkflowDocument} document - Canonical document to persist (its `id` must equal `workflowId`).
48
66
  * @param args - An optional decaf `Context` carrying the owning principal.
@@ -61,6 +79,38 @@ export declare class GraphWorkflowService extends ModelService<GraphWorkflowMode
61
79
  * @throws {NotFoundError} When the workflow does not exist or has no canonical document.
62
80
  */
63
81
  getDocument(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowDocument>;
82
+ /**
83
+ * Lists the workflows visible to the requesting caller, newest update first.
84
+ *
85
+ * The collection is ownership-filtered with
86
+ * {@link canAccessGraphResource}: owner-less system workflows stay visible to
87
+ * everyone, a named caller sees their own plus owner-less workflows, and an
88
+ * anonymous caller without the explicit `allowAnonymousAccess` tolerance sees
89
+ * only owner-less workflows (SAA-595 F3). The full rows are returned so the
90
+ * HTTP boundary can project the serving summary it exposes.
91
+ *
92
+ * A store failure propagates instead of being swallowed as `[]` (SAA-93 F4):
93
+ * silently emptying the list masks an outage as "no workflows" and hides it
94
+ * from monitoring. The sort key is computed through a corrupt-date-safe helper
95
+ * so a bad persisted `updatedAt` cannot throw before the per-row projection
96
+ * guard at the HTTP boundary skips that row.
97
+ *
98
+ * @param args - An optional decaf `Context` carrying the requesting principal.
99
+ * @return {Promise<GraphWorkflowModel[]>} Visible workflows, newest first.
100
+ */
101
+ listWorkflows(...args: MaybeContextualArg<Context>): Promise<GraphWorkflowModel[]>;
102
+ /**
103
+ * Asserts that the workflow exists and is visible to the requesting caller,
104
+ * returning the persisted row. Foreign owners surface as a `ForbiddenError`;
105
+ * unknown workflows as a `NotFoundError` (the read path's own contract).
106
+ *
107
+ * @param {string} workflowId - Workflow id to check.
108
+ * @param args - An optional decaf `Context` carrying the requesting principal.
109
+ * @return {Promise<GraphWorkflowModel>} The accessible workflow row.
110
+ * @throws {NotFoundError} When the workflow does not exist.
111
+ * @throws {ForbiddenError} When the workflow is owned by another user.
112
+ */
113
+ assertAccess(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowModel>;
64
114
  /**
65
115
  * Runs the nine-stage boundary validation gate over a canonical document
66
116
  * without persisting anything.
@@ -76,6 +126,14 @@ export declare class GraphWorkflowService extends ModelService<GraphWorkflowMode
76
126
  * enforcing the DECAF-48 ownership tuple and mirroring the wrapper's
77
127
  * document onto the row's canonical columns.
78
128
  *
129
+ * A fresh create is unconditional; an overwrite of an existing row is a write
130
+ * authorized by strict owner equality (SAA-105 R3) — see
131
+ * {@link saveDocument}.
132
+ *
133
+ * @remarks Relies on the class-level adapter contract that `read` throws
134
+ * `NotFoundError` for an absent row and `create` rejects a duplicate primary
135
+ * key instead of upserting (SAA-105 R3-b).
136
+ *
79
137
  * @param {string} workflowId - Workflow id from the request path.
80
138
  * @param {Record<string, unknown>} snapshot - JSON-safe canonical snapshot wrapper.
81
139
  * @param args - An optional decaf `Context` carrying the owning principal.
@@ -93,10 +151,24 @@ export declare class GraphWorkflowService extends ModelService<GraphWorkflowMode
93
151
  */
94
152
  loadSnapshot(workflowId: string, ...args: MaybeContextualArg<Context>): Promise<GraphWorkflowModel | null>;
95
153
  /**
96
- * Guards a persisted workflow record with the centralized
154
+ * Existence probe for the owner-equality overwrite gate (SAA-105 R3-a): only a
155
+ * genuine absence (`NotFoundError`) resolves to `null`; every other read
156
+ * failure propagates so a transient store fault is never mistaken for absence
157
+ * and downgraded into an unconditional create.
158
+ */
159
+ private readExistingForWrite;
160
+ /**
161
+ * Read-visibility guard for a persisted workflow record via the centralized
97
162
  * {@link assertGraphResourceOwnership} check, honouring this service's
98
163
  * configured `allowAnonymousAccess` tolerance (SAA-595 F3).
99
164
  */
100
165
  private assertOwnership;
166
+ /**
167
+ * Write-path guard for an existing workflow record via the centralized
168
+ * {@link assertGraphResourceWriteOwnership} check: strict owner equality,
169
+ * never the read tolerance (SAA-105 R3). Only applied to overwrites; fresh
170
+ * creates are unconditional.
171
+ */
172
+ private assertWriteOwnership;
101
173
  private applyCanonicalWrapper;
102
174
  }
@@ -11,7 +11,7 @@
11
11
  import type { GraphCredentialReference, GraphJsonValue, GraphNodeInstance, GraphWorkflowDocument } from "../shared/graph/index.d.cts";
12
12
  import type { GraphResolvedNodeManifest } from "../shared/graph/index.d.cts";
13
13
  import type { GraphExecutionStatus } from "../shared/graph/index.d.cts";
14
- import type { GraphExecutionErrorPayload, GraphExecutionEvent } from "../shared/graph/index.d.cts";
14
+ import type { Condition, GraphExecutionErrorPayload, GraphExecutionEvent } from "../shared/graph/index.d.cts";
15
15
  import type { GraphAuthData } from "./auth/GraphAuth.d.cts";
16
16
  /**
17
17
  * Unique identifier for a single graph execution run.
@@ -140,6 +140,12 @@ export interface GraphExecutionContextOptions {
140
140
  path: string[];
141
141
  metadata?: Record<string, unknown>;
142
142
  }
143
+ /**
144
+ * A loop condition — a built-in `GraphConditionDefinition`, a graphical
145
+ * `ConditionExpression`, or a code `CodeCondition`. The loop node classes accept
146
+ * all three and dispatch them through {@link GraphConditionEvaluator}.
147
+ */
148
+ export type LoopCondition = GraphConditionDefinition | Condition;
143
149
  /**
144
150
  * Metadata describing a loop node's behaviour.
145
151
  */
@@ -148,7 +154,7 @@ export interface GraphLoopMetadata {
148
154
  body: GraphWorkflowDocument;
149
155
  maxIterations?: number;
150
156
  timeoutMs?: number;
151
- condition?: GraphConditionDefinition;
157
+ condition?: LoopCondition;
152
158
  concurrency?: number;
153
159
  inputPort?: string;
154
160
  outputPort?: string;
@@ -166,8 +172,9 @@ export interface GraphLoopMetadata {
166
172
  * Definition of a condition evaluated by the loop condition evaluator.
167
173
  *
168
174
  * When the condition object carries an `op` field (see {@link ConditionExpression}),
169
- * the {@link GraphConditionEvaluator} dispatches to the {@link ConditionExpressionEvaluator}
170
- * instead of the built-in `type`-based switch.
175
+ * the {@link GraphConditionEvaluator} dispatches to the {@link ConditionExpressionEvaluator};
176
+ * when it carries `type: "code"` (see {@link CodeCondition}) it dispatches to the
177
+ * registered `CodeSandboxEvaluator`; otherwise the built-in `type`-based switch is used.
171
178
  */
172
179
  export interface GraphConditionDefinition {
173
180
  type: "truthy" | "falsy" | "equals" | "notEquals" | "greaterThan" | "greaterThanOrEqual" | "lessThan" | "lessThanOrEqual" | "exists" | "custom";
@@ -11,7 +11,7 @@
11
11
  import type { GraphCredentialReference, GraphJsonValue, GraphNodeInstance, GraphWorkflowDocument } from "../shared/graph/index.d.mts";
12
12
  import type { GraphResolvedNodeManifest } from "../shared/graph/index.d.mts";
13
13
  import type { GraphExecutionStatus } from "../shared/graph/index.d.mts";
14
- import type { GraphExecutionErrorPayload, GraphExecutionEvent } from "../shared/graph/index.d.mts";
14
+ import type { Condition, GraphExecutionErrorPayload, GraphExecutionEvent } from "../shared/graph/index.d.mts";
15
15
  import type { GraphAuthData } from "./auth/GraphAuth.d.mts";
16
16
  /**
17
17
  * Unique identifier for a single graph execution run.
@@ -140,6 +140,12 @@ export interface GraphExecutionContextOptions {
140
140
  path: string[];
141
141
  metadata?: Record<string, unknown>;
142
142
  }
143
+ /**
144
+ * A loop condition — a built-in `GraphConditionDefinition`, a graphical
145
+ * `ConditionExpression`, or a code `CodeCondition`. The loop node classes accept
146
+ * all three and dispatch them through {@link GraphConditionEvaluator}.
147
+ */
148
+ export type LoopCondition = GraphConditionDefinition | Condition;
143
149
  /**
144
150
  * Metadata describing a loop node's behaviour.
145
151
  */
@@ -148,7 +154,7 @@ export interface GraphLoopMetadata {
148
154
  body: GraphWorkflowDocument;
149
155
  maxIterations?: number;
150
156
  timeoutMs?: number;
151
- condition?: GraphConditionDefinition;
157
+ condition?: LoopCondition;
152
158
  concurrency?: number;
153
159
  inputPort?: string;
154
160
  outputPort?: string;
@@ -166,8 +172,9 @@ export interface GraphLoopMetadata {
166
172
  * Definition of a condition evaluated by the loop condition evaluator.
167
173
  *
168
174
  * When the condition object carries an `op` field (see {@link ConditionExpression}),
169
- * the {@link GraphConditionEvaluator} dispatches to the {@link ConditionExpressionEvaluator}
170
- * instead of the built-in `type`-based switch.
175
+ * the {@link GraphConditionEvaluator} dispatches to the {@link ConditionExpressionEvaluator};
176
+ * when it carries `type: "code"` (see {@link CodeCondition}) it dispatches to the
177
+ * registered `CodeSandboxEvaluator`; otherwise the built-in `type`-based switch is used.
171
178
  */
172
179
  export interface GraphConditionDefinition {
173
180
  type: "truthy" | "falsy" | "equals" | "notEquals" | "greaterThan" | "greaterThanOrEqual" | "lessThan" | "lessThanOrEqual" | "exists" | "custom";
@@ -0,0 +1,91 @@
1
+ /**
2
+ * @module as-graph/mastra/MastraCapabilities
3
+ * @summary Exported Mastra capability table (SAA-196).
4
+ * @description The Mastra wrapper declares, per feature, whether the backend
5
+ * supports it natively, not at all, or only through an extension point. The
6
+ * table is exported alongside the engine-agnostic
7
+ * {@link GraphBackendCapabilities} projection (code-mode + workflow
8
+ * listing/lookup) so hosts and servers can surface honest limitations without
9
+ * probing the backend.
10
+ */
11
+ import type { GraphBackendCapabilities, GraphBackendCapabilityStatus } from "../engine/execution/GraphExecutionBackend.d.cts";
12
+ /**
13
+ * Whether Mastra supports a feature natively, not at all, only partially, or
14
+ * exclusively through a declared extension point.
15
+ */
16
+ export type MastraFeatureVerdict = "SUPPORTED" | "NOT-SUPPORTED" | "EXTENSION-POINT" | "PARTIAL";
17
+ /** A single row of the exported Mastra capability table (SAA-196). */
18
+ export interface MastraFeatureCapability {
19
+ /** The engine feature being described. */
20
+ feature: string;
21
+ /** The declared Mastra verdict for the feature. */
22
+ verdict: MastraFeatureVerdict;
23
+ /** Human-readable detail for the verdict. */
24
+ detail?: string;
25
+ }
26
+ /**
27
+ * The exported Mastra capability table (SAA-196). Every row names a feature and
28
+ * whether Mastra supports it natively, not at all, or through a declared
29
+ * extension point. `parallel` and `pinning` are declared NOT-SUPPORTED, and
30
+ * code-mode conditions fail closed, so the wrapper fails loudly rather than
31
+ * silently degrading behaviour.
32
+ */
33
+ export declare const MASTRA_FEATURE_CAPABILITIES: readonly MastraFeatureCapability[];
34
+ /**
35
+ * The three-valued management status a Mastra workflow-management capability row
36
+ * resolves to. Extends the engine-agnostic two-valued
37
+ * {@link GraphBackendCapabilityStatus} with the honest `extension_point` state.
38
+ */
39
+ export type MastraWorkflowCapabilityStatus = GraphBackendCapabilityStatus | "extension_point";
40
+ /**
41
+ * The Mastra workflow-management capability projection (SAA-346): the real
42
+ * `@mastra/core` management operations the driver exposes, each resolved honestly
43
+ * from the exported feature table.
44
+ */
45
+ export interface MastraWorkflowManagementCapabilities {
46
+ /** Create (register a translated canonical document) support. */
47
+ create: MastraWorkflowCapabilityStatus;
48
+ /** Update/edit (recompile and replace the registration) support. */
49
+ update: MastraWorkflowCapabilityStatus;
50
+ /** Delete (remove the registration) support. */
51
+ delete: MastraWorkflowCapabilityStatus;
52
+ /** Serialization (real `serializedStepGraph`) support. */
53
+ serialize: MastraWorkflowCapabilityStatus;
54
+ /** Persistence (real `addDynamicWorkflow`) support. */
55
+ persist: MastraWorkflowCapabilityStatus;
56
+ /** Native workflow versioning support. */
57
+ version: MastraWorkflowCapabilityStatus;
58
+ }
59
+ /**
60
+ * The full Mastra backend capability projection: the engine-agnostic
61
+ * {@link GraphBackendCapabilities} plus the Mastra-specific workflow-management
62
+ * statuses.
63
+ */
64
+ export interface MastraBackendCapabilities extends GraphBackendCapabilities {
65
+ /** Workflow list/lookup plus the management statuses. */
66
+ workflows: GraphBackendCapabilities["workflows"] & MastraWorkflowManagementCapabilities;
67
+ }
68
+ /**
69
+ * Resolves a feature row's three-valued management status from the exported
70
+ * table, mapping the wrapper's `SUPPORTED`/`NOT-SUPPORTED`/`EXTENSION-POINT`
71
+ * verdicts onto the projection's lowercase vocabulary.
72
+ *
73
+ * @param feature - The feature row name to resolve.
74
+ * @returns The three-valued management status.
75
+ */
76
+ export declare function mastraCapabilityStatusOf(feature: string): MastraWorkflowCapabilityStatus;
77
+ /**
78
+ * Engine-agnostic capability projection of the Mastra backend: no in-process
79
+ * code execution, workflow list/lookup supported over the compiled-workflow cache,
80
+ * and the SAA-346 workflow-management statuses resolved from the exported table.
81
+ *
82
+ * @returns The {@link MastraBackendCapabilities} served by the Mastra backend.
83
+ */
84
+ export declare function resolveMastraCapabilities(): MastraBackendCapabilities;
85
+ /**
86
+ * Looks up one capability row by feature name.
87
+ *
88
+ * @param feature - The engine feature name to look up.
89
+ * @returns The capability row, or `undefined` for an unknown feature.
90
+ */
91
+ export declare function mastraCapabilityOf(feature: string): MastraFeatureCapability | undefined;