@decaf-ts/as-graph 0.2.1 → 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 (285) hide show
  1. package/README.md +158 -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 +4 -0
  35. package/lib/cjs/engine/index.cjs.map +1 -1
  36. package/lib/cjs/engine/runs/GraphRunService.cjs +61 -0
  37. package/lib/cjs/engine/runs/GraphRunService.cjs.map +1 -1
  38. package/lib/cjs/engine/services/GraphWorkflowService.cjs +33 -14
  39. package/lib/cjs/engine/services/GraphWorkflowService.cjs.map +1 -1
  40. package/lib/cjs/mastra/MastraCapabilities.cjs +171 -0
  41. package/lib/cjs/mastra/MastraCapabilities.cjs.map +1 -0
  42. package/lib/cjs/mastra/MastraConditionBridge.cjs +39 -0
  43. package/lib/cjs/mastra/MastraConditionBridge.cjs.map +1 -0
  44. package/lib/cjs/mastra/MastraEventBridge.cjs +486 -0
  45. package/lib/cjs/mastra/MastraEventBridge.cjs.map +1 -0
  46. package/lib/cjs/mastra/MastraGraphExecutionBackend.cjs +351 -0
  47. package/lib/cjs/mastra/MastraGraphExecutionBackend.cjs.map +1 -0
  48. package/lib/cjs/mastra/MastraResumeGuard.cjs +127 -0
  49. package/lib/cjs/mastra/MastraResumeGuard.cjs.map +1 -0
  50. package/lib/cjs/mastra/MastraSchemaConverter.cjs +124 -0
  51. package/lib/cjs/mastra/MastraSchemaConverter.cjs.map +1 -0
  52. package/lib/cjs/mastra/MastraWorkflowCompiler.cjs +461 -0
  53. package/lib/cjs/mastra/MastraWorkflowCompiler.cjs.map +1 -0
  54. package/lib/cjs/mastra/MastraWorkflowManager.cjs +401 -0
  55. package/lib/cjs/mastra/MastraWorkflowManager.cjs.map +1 -0
  56. package/lib/cjs/mastra/index.cjs +35 -0
  57. package/lib/cjs/mastra/index.cjs.map +1 -0
  58. package/lib/cjs/mastra/types.cjs +34 -0
  59. package/lib/cjs/mastra/types.cjs.map +1 -0
  60. package/lib/cjs/nest/graph/GraphEngineCapabilityManifest.cjs +136 -0
  61. package/lib/cjs/nest/graph/GraphEngineCapabilityManifest.cjs.map +1 -0
  62. package/lib/cjs/nest/graph/GraphEngineCapabilityService.cjs +140 -0
  63. package/lib/cjs/nest/graph/GraphEngineCapabilityService.cjs.map +1 -0
  64. package/lib/cjs/nest/graph/GraphEngineController.cjs +227 -0
  65. package/lib/cjs/nest/graph/GraphEngineController.cjs.map +1 -0
  66. package/lib/cjs/nest/graph/GraphExecutionModule.cjs +30 -2
  67. package/lib/cjs/nest/graph/GraphExecutionModule.cjs.map +1 -1
  68. package/lib/cjs/nest/graph/index.cjs +3 -0
  69. package/lib/cjs/nest/graph/index.cjs.map +1 -1
  70. package/lib/cjs/nest/graph/main.cjs +54 -0
  71. package/lib/cjs/nest/graph/main.cjs.map +1 -0
  72. package/lib/cjs/nest/graph/servingErrors.cjs +3 -0
  73. package/lib/cjs/nest/graph/servingErrors.cjs.map +1 -1
  74. package/lib/cjs/node/utility/code/node.cjs +11 -3
  75. package/lib/cjs/node/utility/code/node.cjs.map +1 -1
  76. package/lib/cjs/shared/graph/catalog/GraphManifestCompiler.cjs +2 -3
  77. package/lib/cjs/shared/graph/catalog/GraphManifestCompiler.cjs.map +1 -1
  78. package/lib/cjs/shared/graph/constants.cjs +8 -0
  79. package/lib/cjs/shared/graph/constants.cjs.map +1 -1
  80. package/lib/cjs/shared/graph/index.cjs +2 -1
  81. package/lib/cjs/shared/graph/index.cjs.map +1 -1
  82. package/lib/cjs/shared/graph/layout/GraphWorkflowLayout.cjs +146 -0
  83. package/lib/cjs/shared/graph/layout/GraphWorkflowLayout.cjs.map +1 -0
  84. package/lib/cjs/shared/graph/layout/index.cjs +23 -0
  85. package/lib/cjs/shared/graph/layout/index.cjs.map +1 -0
  86. package/lib/cjs/shared/graph/layout/layout-options.cjs +93 -0
  87. package/lib/cjs/shared/graph/layout/layout-options.cjs.map +1 -0
  88. package/lib/cjs/shared/ui/index.cjs +8 -10
  89. package/lib/cjs/shared/ui/index.cjs.map +1 -1
  90. package/lib/esm/dagster/DagsterGraphEventBridge.js +339 -0
  91. package/lib/esm/dagster/DagsterGraphEventBridge.js.map +1 -0
  92. package/lib/esm/dagster/DagsterGraphExecutionBackend.js +781 -0
  93. package/lib/esm/dagster/DagsterGraphExecutionBackend.js.map +1 -0
  94. package/lib/esm/dagster/DagsterResultMapper.js +51 -0
  95. package/lib/esm/dagster/DagsterResultMapper.js.map +1 -0
  96. package/lib/esm/dagster/DagsterTypes.js +2 -0
  97. package/lib/esm/dagster/DagsterTypes.js.map +1 -0
  98. package/lib/esm/dagster/capabilities.js +97 -0
  99. package/lib/esm/dagster/capabilities.js.map +1 -0
  100. package/lib/esm/dagster/constants.js +88 -0
  101. package/lib/esm/dagster/constants.js.map +1 -0
  102. package/lib/esm/dagster/index.js +15 -0
  103. package/lib/esm/dagster/index.js.map +1 -0
  104. package/lib/esm/engine/constants.js +5 -0
  105. package/lib/esm/engine/constants.js.map +1 -1
  106. package/lib/esm/engine/execution/GraphCodeMode.js +132 -0
  107. package/lib/esm/engine/execution/GraphCodeMode.js.map +1 -0
  108. package/lib/esm/engine/execution/GraphExecutionBackend.js +83 -0
  109. package/lib/esm/engine/execution/GraphExecutionBackend.js.map +1 -0
  110. package/lib/esm/engine/execution/GraphExecutionBackendRegistry.js +102 -0
  111. package/lib/esm/engine/execution/GraphExecutionBackendRegistry.js.map +1 -0
  112. package/lib/esm/engine/execution/GraphExecutionEngine.js +232 -716
  113. package/lib/esm/engine/execution/GraphExecutionEngine.js.map +1 -1
  114. package/lib/esm/engine/execution/LocalGraphExecutionBackend.js +799 -0
  115. package/lib/esm/engine/execution/LocalGraphExecutionBackend.js.map +1 -0
  116. package/lib/esm/engine/execution/index.js +4 -0
  117. package/lib/esm/engine/execution/index.js.map +1 -1
  118. package/lib/esm/engine/index.js +4 -0
  119. package/lib/esm/engine/index.js.map +1 -1
  120. package/lib/esm/engine/runs/GraphRunService.js +62 -1
  121. package/lib/esm/engine/runs/GraphRunService.js.map +1 -1
  122. package/lib/esm/engine/services/GraphWorkflowService.js +33 -14
  123. package/lib/esm/engine/services/GraphWorkflowService.js.map +1 -1
  124. package/lib/esm/mastra/MastraCapabilities.js +164 -0
  125. package/lib/esm/mastra/MastraCapabilities.js.map +1 -0
  126. package/lib/esm/mastra/MastraConditionBridge.js +34 -0
  127. package/lib/esm/mastra/MastraConditionBridge.js.map +1 -0
  128. package/lib/esm/mastra/MastraEventBridge.js +481 -0
  129. package/lib/esm/mastra/MastraEventBridge.js.map +1 -0
  130. package/lib/esm/mastra/MastraGraphExecutionBackend.js +346 -0
  131. package/lib/esm/mastra/MastraGraphExecutionBackend.js.map +1 -0
  132. package/lib/esm/mastra/MastraResumeGuard.js +123 -0
  133. package/lib/esm/mastra/MastraResumeGuard.js.map +1 -0
  134. package/lib/esm/mastra/MastraSchemaConverter.js +119 -0
  135. package/lib/esm/mastra/MastraSchemaConverter.js.map +1 -0
  136. package/lib/esm/mastra/MastraWorkflowCompiler.js +456 -0
  137. package/lib/esm/mastra/MastraWorkflowCompiler.js.map +1 -0
  138. package/lib/esm/mastra/MastraWorkflowManager.js +396 -0
  139. package/lib/esm/mastra/MastraWorkflowManager.js.map +1 -0
  140. package/lib/esm/mastra/index.js +18 -0
  141. package/lib/esm/mastra/index.js.map +1 -0
  142. package/lib/esm/mastra/types.js +30 -0
  143. package/lib/esm/mastra/types.js.map +1 -0
  144. package/lib/esm/nest/graph/GraphEngineCapabilityManifest.js +129 -0
  145. package/lib/esm/nest/graph/GraphEngineCapabilityManifest.js.map +1 -0
  146. package/lib/esm/nest/graph/GraphEngineCapabilityService.js +131 -0
  147. package/lib/esm/nest/graph/GraphEngineCapabilityService.js.map +1 -0
  148. package/lib/esm/nest/graph/GraphEngineController.js +218 -0
  149. package/lib/esm/nest/graph/GraphEngineController.js.map +1 -0
  150. package/lib/esm/nest/graph/GraphExecutionModule.js +30 -2
  151. package/lib/esm/nest/graph/GraphExecutionModule.js.map +1 -1
  152. package/lib/esm/nest/graph/index.js +3 -0
  153. package/lib/esm/nest/graph/index.js.map +1 -1
  154. package/lib/esm/nest/graph/main.js +51 -0
  155. package/lib/esm/nest/graph/main.js.map +1 -0
  156. package/lib/esm/nest/graph/servingErrors.js +3 -0
  157. package/lib/esm/nest/graph/servingErrors.js.map +1 -1
  158. package/lib/esm/node/utility/code/node.js +11 -3
  159. package/lib/esm/node/utility/code/node.js.map +1 -1
  160. package/lib/esm/shared/graph/GraphExecutionStateMapper.js.map +1 -1
  161. package/lib/esm/shared/graph/catalog/GraphManifestCompiler.js +2 -3
  162. package/lib/esm/shared/graph/catalog/GraphManifestCompiler.js.map +1 -1
  163. package/lib/esm/shared/graph/constants.js +8 -0
  164. package/lib/esm/shared/graph/constants.js.map +1 -1
  165. package/lib/esm/shared/graph/index.js +2 -1
  166. package/lib/esm/shared/graph/index.js.map +1 -1
  167. package/lib/esm/shared/graph/layout/GraphWorkflowLayout.js +107 -0
  168. package/lib/esm/shared/graph/layout/GraphWorkflowLayout.js.map +1 -0
  169. package/lib/esm/shared/graph/layout/index.js +6 -0
  170. package/lib/esm/shared/graph/layout/index.js.map +1 -0
  171. package/lib/esm/shared/graph/layout/layout-options.js +96 -0
  172. package/lib/esm/shared/graph/layout/layout-options.js.map +1 -0
  173. package/lib/esm/shared/ui/index.js +8 -10
  174. package/lib/esm/shared/ui/index.js.map +1 -1
  175. package/lib/types/dagster/DagsterGraphEventBridge.d.cts +142 -0
  176. package/lib/types/dagster/DagsterGraphEventBridge.d.mts +142 -0
  177. package/lib/types/dagster/DagsterGraphExecutionBackend.d.cts +323 -0
  178. package/lib/types/dagster/DagsterGraphExecutionBackend.d.mts +323 -0
  179. package/lib/types/dagster/DagsterResultMapper.d.cts +50 -0
  180. package/lib/types/dagster/DagsterResultMapper.d.mts +50 -0
  181. package/lib/types/dagster/DagsterTypes.d.cts +355 -0
  182. package/lib/types/dagster/DagsterTypes.d.mts +355 -0
  183. package/lib/types/dagster/capabilities.d.cts +34 -0
  184. package/lib/types/dagster/capabilities.d.mts +34 -0
  185. package/lib/types/dagster/constants.d.cts +87 -0
  186. package/lib/types/dagster/constants.d.mts +87 -0
  187. package/lib/types/dagster/index.d.cts +14 -0
  188. package/lib/types/dagster/index.d.mts +14 -0
  189. package/lib/types/engine/constants.d.cts +5 -0
  190. package/lib/types/engine/constants.d.mts +5 -0
  191. package/lib/types/engine/execution/GraphCodeMode.d.cts +52 -0
  192. package/lib/types/engine/execution/GraphCodeMode.d.mts +52 -0
  193. package/lib/types/engine/execution/GraphExecutionBackend.d.cts +306 -0
  194. package/lib/types/engine/execution/GraphExecutionBackend.d.mts +306 -0
  195. package/lib/types/engine/execution/GraphExecutionBackendRegistry.d.cts +59 -0
  196. package/lib/types/engine/execution/GraphExecutionBackendRegistry.d.mts +59 -0
  197. package/lib/types/engine/execution/GraphExecutionEngine.d.cts +116 -135
  198. package/lib/types/engine/execution/GraphExecutionEngine.d.mts +116 -135
  199. package/lib/types/engine/execution/LocalGraphExecutionBackend.d.cts +232 -0
  200. package/lib/types/engine/execution/LocalGraphExecutionBackend.d.mts +232 -0
  201. package/lib/types/engine/execution/index.d.cts +4 -0
  202. package/lib/types/engine/execution/index.d.mts +4 -0
  203. package/lib/types/engine/index.d.cts +4 -0
  204. package/lib/types/engine/index.d.mts +4 -0
  205. package/lib/types/engine/runs/GraphRunService.d.cts +19 -0
  206. package/lib/types/engine/runs/GraphRunService.d.mts +19 -0
  207. package/lib/types/engine/services/GraphWorkflowService.d.cts +22 -0
  208. package/lib/types/engine/services/GraphWorkflowService.d.mts +22 -0
  209. package/lib/types/mastra/MastraCapabilities.d.cts +91 -0
  210. package/lib/types/mastra/MastraCapabilities.d.mts +91 -0
  211. package/lib/types/mastra/MastraConditionBridge.d.cts +38 -0
  212. package/lib/types/mastra/MastraConditionBridge.d.mts +38 -0
  213. package/lib/types/mastra/MastraEventBridge.d.cts +189 -0
  214. package/lib/types/mastra/MastraEventBridge.d.mts +189 -0
  215. package/lib/types/mastra/MastraGraphExecutionBackend.d.cts +119 -0
  216. package/lib/types/mastra/MastraGraphExecutionBackend.d.mts +119 -0
  217. package/lib/types/mastra/MastraResumeGuard.d.cts +58 -0
  218. package/lib/types/mastra/MastraResumeGuard.d.mts +58 -0
  219. package/lib/types/mastra/MastraSchemaConverter.d.cts +39 -0
  220. package/lib/types/mastra/MastraSchemaConverter.d.mts +39 -0
  221. package/lib/types/mastra/MastraWorkflowCompiler.d.cts +218 -0
  222. package/lib/types/mastra/MastraWorkflowCompiler.d.mts +218 -0
  223. package/lib/types/mastra/MastraWorkflowManager.d.cts +220 -0
  224. package/lib/types/mastra/MastraWorkflowManager.d.mts +220 -0
  225. package/lib/types/mastra/index.d.cts +17 -0
  226. package/lib/types/mastra/index.d.mts +17 -0
  227. package/lib/types/mastra/types.d.cts +222 -0
  228. package/lib/types/mastra/types.d.mts +222 -0
  229. package/lib/types/nest/graph/GraphEngineCapabilityManifest.d.cts +87 -0
  230. package/lib/types/nest/graph/GraphEngineCapabilityManifest.d.mts +87 -0
  231. package/lib/types/nest/graph/GraphEngineCapabilityService.d.cts +98 -0
  232. package/lib/types/nest/graph/GraphEngineCapabilityService.d.mts +98 -0
  233. package/lib/types/nest/graph/GraphEngineController.d.cts +74 -0
  234. package/lib/types/nest/graph/GraphEngineController.d.mts +74 -0
  235. package/lib/types/nest/graph/GraphExecutionModule.d.cts +8 -0
  236. package/lib/types/nest/graph/GraphExecutionModule.d.mts +8 -0
  237. package/lib/types/nest/graph/index.d.cts +3 -0
  238. package/lib/types/nest/graph/index.d.mts +3 -0
  239. package/lib/types/nest/graph/main.d.cts +1 -0
  240. package/lib/types/nest/graph/main.d.mts +1 -0
  241. package/lib/types/nest/graph/servingErrors.d.cts +3 -1
  242. package/lib/types/nest/graph/servingErrors.d.mts +3 -1
  243. package/lib/types/node/utility/code/node.d.cts +1 -1
  244. package/lib/types/node/utility/code/node.d.mts +1 -1
  245. package/lib/types/shared/graph/GraphExecutionStateMapper.d.cts +5 -5
  246. package/lib/types/shared/graph/GraphExecutionStateMapper.d.mts +5 -5
  247. package/lib/types/shared/graph/constants.d.cts +8 -0
  248. package/lib/types/shared/graph/constants.d.mts +8 -0
  249. package/lib/types/shared/graph/index.d.cts +2 -1
  250. package/lib/types/shared/graph/index.d.mts +2 -1
  251. package/lib/types/shared/graph/layout/GraphWorkflowLayout.d.cts +49 -0
  252. package/lib/types/shared/graph/layout/GraphWorkflowLayout.d.mts +49 -0
  253. package/lib/types/shared/graph/layout/index.d.cts +5 -0
  254. package/lib/types/shared/graph/layout/index.d.mts +5 -0
  255. package/lib/types/shared/graph/layout/layout-options.d.cts +46 -0
  256. package/lib/types/shared/graph/layout/layout-options.d.mts +46 -0
  257. package/lib/types/shared/graph/types.d.cts +4 -3
  258. package/lib/types/shared/graph/types.d.mts +4 -3
  259. package/lib/types/shared/ui/index.d.cts +8 -10
  260. package/lib/types/shared/ui/index.d.mts +8 -10
  261. package/package.json +49 -6
  262. package/lib/cjs/shared/ui/GraphNodeView.cjs +0 -114
  263. package/lib/cjs/shared/ui/GraphNodeView.cjs.map +0 -1
  264. package/lib/cjs/shared/ui/GraphRunView.cjs +0 -96
  265. package/lib/cjs/shared/ui/GraphRunView.cjs.map +0 -1
  266. package/lib/cjs/shared/ui/GraphWorkflowView.cjs +0 -78
  267. package/lib/cjs/shared/ui/GraphWorkflowView.cjs.map +0 -1
  268. package/lib/cjs/shared/ui/types.cjs +0 -4
  269. package/lib/cjs/shared/ui/types.cjs.map +0 -1
  270. package/lib/esm/shared/ui/GraphNodeView.js +0 -107
  271. package/lib/esm/shared/ui/GraphNodeView.js.map +0 -1
  272. package/lib/esm/shared/ui/GraphRunView.js +0 -90
  273. package/lib/esm/shared/ui/GraphRunView.js.map +0 -1
  274. package/lib/esm/shared/ui/GraphWorkflowView.js +0 -72
  275. package/lib/esm/shared/ui/GraphWorkflowView.js.map +0 -1
  276. package/lib/esm/shared/ui/types.js +0 -2
  277. package/lib/esm/shared/ui/types.js.map +0 -1
  278. package/lib/types/shared/ui/GraphNodeView.d.cts +0 -48
  279. package/lib/types/shared/ui/GraphNodeView.d.mts +0 -48
  280. package/lib/types/shared/ui/GraphRunView.d.cts +0 -88
  281. package/lib/types/shared/ui/GraphRunView.d.mts +0 -88
  282. package/lib/types/shared/ui/GraphWorkflowView.d.cts +0 -18
  283. package/lib/types/shared/ui/GraphWorkflowView.d.mts +0 -18
  284. package/lib/types/shared/ui/types.d.cts +0 -200
  285. package/lib/types/shared/ui/types.d.mts +0 -200
@@ -0,0 +1,339 @@
1
+ import { GraphExecutionEventType, GraphExecutionStatus, } from "./../shared/graph/index.js";
2
+ import { GraphExecutionError } from "./../engine/errors/index.js";
3
+ import { DAGSTER_ERROR } from "./constants.js";
4
+ /**
5
+ * The documented Dagster → engine-agnostic event mapping table (§4.3).
6
+ */
7
+ const DAGSTER_EVENT_MAP = {
8
+ STEP_START: GraphExecutionEventType.NODE_STARTED,
9
+ STEP_SUCCESS: GraphExecutionEventType.NODE_COMPLETED,
10
+ STEP_FAILURE: GraphExecutionEventType.NODE_FAILED,
11
+ STEP_SKIPPED: GraphExecutionEventType.NODE_SKIPPED,
12
+ STEP_OUTPUT: GraphExecutionEventType.NODE_OUTPUT,
13
+ RUN_START: GraphExecutionEventType.WORKFLOW_STARTED,
14
+ RUN_SUCCESS: GraphExecutionEventType.WORKFLOW_COMPLETED,
15
+ RUN_FAILURE: GraphExecutionEventType.WORKFLOW_FAILED,
16
+ RUN_CANCELED: GraphExecutionEventType.WORKFLOW_CANCELLED,
17
+ };
18
+ /** Dagster event types that terminate a run. */
19
+ const DAGSTER_TERMINAL_EVENTS = new Set([
20
+ "RUN_SUCCESS",
21
+ "RUN_FAILURE",
22
+ "RUN_CANCELED",
23
+ ]);
24
+ /**
25
+ * Default hard cap on the number of events the bridge processes before failing
26
+ * the observation closed. Bounds a gateway that never emits a terminal event.
27
+ */
28
+ const DEFAULT_MAX_EVENTS = 10000;
29
+ /**
30
+ * Default hard cap on the transport pagination depth. Bounds a gateway whose
31
+ * `eventConnection` never reports `hasMore: false`.
32
+ */
33
+ const DEFAULT_MAX_PAGES = 100;
34
+ /**
35
+ * Default maximum time (ms) to await the terminal record before failing the
36
+ * observation closed. Callers observing a genuinely long-lived run raise this.
37
+ */
38
+ const DEFAULT_TERMINAL_TIMEOUT_MS = 5 * 60 * 1000;
39
+ /**
40
+ * Bridges a Dagster run's raw event stream onto the engine-agnostic event sink.
41
+ */
42
+ export class DagsterGraphEventBridge {
43
+ /**
44
+ * @param options - The run identity, op-name map, sink, client port, and bounds.
45
+ */
46
+ constructor(options) {
47
+ this.options = options;
48
+ this.nodeResults = new Map();
49
+ this.workflowOutputs = {};
50
+ this.eventCount = 0;
51
+ this.processing = [];
52
+ this.terminalPromise = new Promise((resolve, reject) => {
53
+ this.resolveTerminal = resolve;
54
+ this.rejectTerminal = reject;
55
+ });
56
+ // A scripted client can overflow the event cap during the synchronous replay
57
+ // inside `subscribeRun`, before `waitForTerminal` attaches its handler. Keep a
58
+ // no-op rejection handler so that early failure is never "unhandled".
59
+ this.terminalPromise.catch(() => { });
60
+ }
61
+ /** Subscribes to the run's event stream. */
62
+ async start() {
63
+ if (this.failure)
64
+ throw this.failure;
65
+ if (this.options.signal?.aborted) {
66
+ throw this.failClosed(this.abortError());
67
+ }
68
+ this.subscription = await this.options.client.subscribeRun(this.options.dagsterRunId, (event) => {
69
+ this.processing.push(this.handleEvent(event));
70
+ }, {
71
+ ...(this.options.signal ? { signal: this.options.signal } : {}),
72
+ maxEvents: this.options.maxEvents ?? DEFAULT_MAX_EVENTS,
73
+ maxPages: this.options.maxPages ?? DEFAULT_MAX_PAGES,
74
+ });
75
+ }
76
+ /** Stops the subscription and waits for in-flight event processing. */
77
+ async stop() {
78
+ await this.subscription?.unsubscribe();
79
+ await Promise.all(this.processing);
80
+ if (this.failure)
81
+ throw this.failure;
82
+ }
83
+ /**
84
+ * Waits for the run's terminal record, bounded by the observation's
85
+ * `terminalTimeoutMs` and `signal`. Exceeding the timeout, or an abort, fails
86
+ * the wait closed instead of hanging on a stalled or hostile gateway.
87
+ *
88
+ * @returns The terminal Dagster run record.
89
+ * @throws {GraphExecutionError} `GRAPH_DAGSTER_OBSERVE_TIMEOUT` when the run
90
+ * does not terminate in time, or `GRAPH_DAGSTER_OBSERVE_ABORTED` on abort.
91
+ */
92
+ async waitForTerminal() {
93
+ if (this.terminal)
94
+ return this.terminal;
95
+ if (this.failure)
96
+ throw this.failure;
97
+ const signal = this.options.signal;
98
+ if (signal?.aborted) {
99
+ throw this.failClosed(this.abortError());
100
+ }
101
+ const timeoutMs = this.options.terminalTimeoutMs ?? DEFAULT_TERMINAL_TIMEOUT_MS;
102
+ return await new Promise((resolve, reject) => {
103
+ let timer;
104
+ const onAbort = () => {
105
+ cleanup();
106
+ this.failClosed(this.abortError());
107
+ };
108
+ const cleanup = () => {
109
+ if (timer)
110
+ clearTimeout(timer);
111
+ signal?.removeEventListener("abort", onAbort);
112
+ };
113
+ if (signal)
114
+ signal.addEventListener("abort", onAbort, { once: true });
115
+ if (timeoutMs > 0) {
116
+ timer = setTimeout(() => {
117
+ this.failClosed(this.timeoutError(timeoutMs));
118
+ }, timeoutMs);
119
+ }
120
+ this.terminalPromise.then((record) => {
121
+ cleanup();
122
+ resolve(record);
123
+ }, (error) => {
124
+ cleanup();
125
+ reject(error);
126
+ });
127
+ });
128
+ }
129
+ /** The node results collected from step events. */
130
+ collectedNodeResults() {
131
+ return Object.fromEntries(this.nodeResults);
132
+ }
133
+ /** The workflow output values collected from the terminal record. */
134
+ collectedWorkflowOutputs() {
135
+ return this.workflowOutputs;
136
+ }
137
+ /**
138
+ * Resolves a Dagster step key to a canonical node id through the inspected
139
+ * job's op-name map.
140
+ *
141
+ * @param stepKey - The Dagster step key.
142
+ * @returns The canonical node id, or `undefined` for non-graph steps.
143
+ */
144
+ resolveNodeId(stepKey) {
145
+ if (!stepKey)
146
+ return undefined;
147
+ const direct = this.options.nodeIdsByOpName[stepKey];
148
+ if (direct)
149
+ return direct;
150
+ const tail = stepKey.split(".").pop();
151
+ return tail ? this.options.nodeIdsByOpName[tail] : undefined;
152
+ }
153
+ /**
154
+ * Handles a single raw Dagster event.
155
+ *
156
+ * @param event - The raw event.
157
+ */
158
+ async handleEvent(event) {
159
+ if (this.failure)
160
+ return;
161
+ this.eventCount += 1;
162
+ const maxEvents = this.options.maxEvents ?? DEFAULT_MAX_EVENTS;
163
+ if (this.eventCount > maxEvents) {
164
+ this.failClosed(this.limitError(maxEvents));
165
+ return;
166
+ }
167
+ const type = DAGSTER_EVENT_MAP[event.type];
168
+ if (!type) {
169
+ if (event.stepKey !== undefined || event.type.startsWith("STEP_")) {
170
+ throw new GraphExecutionError(`Dagster step event '${event.type}' has no engine-agnostic mapping`, DAGSTER_ERROR.EVENT_UNSUPPORTED, { eventType: event.type, stepKey: event.stepKey });
171
+ }
172
+ // Unknown run/engine-level telemetry is ignored: it is not a graph
173
+ // transition and must not break the run.
174
+ return;
175
+ }
176
+ if (DAGSTER_TERMINAL_EVENTS.has(event.type)) {
177
+ const record = await this.options.client.getRun(this.options.dagsterRunId);
178
+ this.terminal = record;
179
+ if (record.outputs) {
180
+ for (const [key, value] of Object.entries(record.outputs)) {
181
+ this.workflowOutputs[key] = value;
182
+ }
183
+ }
184
+ await this.options.sink.emit({
185
+ type,
186
+ runId: this.options.graphRunId,
187
+ workflowId: this.options.workflowId,
188
+ path: [],
189
+ status: this.terminalStatus(record),
190
+ ...(record.error
191
+ ? { error: this.toErrorPayload(record.error) }
192
+ : {}),
193
+ payload: { outputs: this.workflowOutputs },
194
+ });
195
+ this.resolveTerminal?.(record);
196
+ return;
197
+ }
198
+ const nodeId = this.resolveNodeId(event.stepKey);
199
+ if (!nodeId) {
200
+ // Run-level, non-terminal transitions (e.g. `RUN_START`) carry no step
201
+ // key and map onto the workflow without a node id. A step event whose key
202
+ // the inspected job does not know is still ignored.
203
+ if (event.stepKey !== undefined)
204
+ return;
205
+ await this.options.sink.emit({
206
+ type,
207
+ runId: this.options.graphRunId,
208
+ workflowId: this.options.workflowId,
209
+ path: [],
210
+ });
211
+ return;
212
+ }
213
+ const status = this.nodeStatus(event.type);
214
+ const outputs = this.extractOutputs(event);
215
+ if (outputs) {
216
+ this.workflowOutputs[nodeId] = outputs;
217
+ }
218
+ this.nodeResults.set(nodeId, {
219
+ nodeId,
220
+ status,
221
+ inputs: {},
222
+ ...(outputs ? { outputs } : {}),
223
+ startedAt: new Date(),
224
+ finishedAt: new Date(),
225
+ events: [],
226
+ ...(status === GraphExecutionStatus.FAILED && event.message
227
+ ? { error: this.toErrorPayload({ message: event.message }) }
228
+ : {}),
229
+ });
230
+ await this.options.sink.emit({
231
+ type,
232
+ runId: this.options.graphRunId,
233
+ workflowId: this.options.workflowId,
234
+ nodeId,
235
+ path: [nodeId],
236
+ status,
237
+ ...(outputs ? { payload: { outputs } } : {}),
238
+ ...(status === GraphExecutionStatus.FAILED && event.message
239
+ ? { error: this.toErrorPayload({ message: event.message }) }
240
+ : {}),
241
+ });
242
+ }
243
+ /**
244
+ * Maps a Dagster event type to an engine-agnostic execution status.
245
+ *
246
+ * @param eventType - The Dagster event type.
247
+ * @returns The engine-agnostic status.
248
+ */
249
+ nodeStatus(eventType) {
250
+ switch (eventType) {
251
+ case "STEP_SUCCESS":
252
+ return GraphExecutionStatus.SUCCEEDED;
253
+ case "STEP_FAILURE":
254
+ return GraphExecutionStatus.FAILED;
255
+ case "STEP_SKIPPED":
256
+ return GraphExecutionStatus.SKIPPED;
257
+ default:
258
+ return GraphExecutionStatus.RUNNING;
259
+ }
260
+ }
261
+ /**
262
+ * Maps a terminal Dagster run record to an engine-agnostic status.
263
+ *
264
+ * @param record - The terminal run record.
265
+ * @returns The engine-agnostic status.
266
+ */
267
+ terminalStatus(record) {
268
+ switch (record.status) {
269
+ case "success":
270
+ return GraphExecutionStatus.SUCCEEDED;
271
+ case "canceled":
272
+ return GraphExecutionStatus.CANCELLED;
273
+ default:
274
+ return GraphExecutionStatus.FAILED;
275
+ }
276
+ }
277
+ /**
278
+ * Extracts output values from a Dagster step event payload.
279
+ *
280
+ * @param event - The raw event.
281
+ * @returns The extracted outputs, or `undefined`.
282
+ */
283
+ extractOutputs(event) {
284
+ if (event.type !== "STEP_OUTPUT")
285
+ return undefined;
286
+ const payload = event.payload ?? {};
287
+ const raw = payload["outputs"];
288
+ if (raw && typeof raw === "object" && !Array.isArray(raw)) {
289
+ return raw;
290
+ }
291
+ return payload;
292
+ }
293
+ /**
294
+ * Fails the observation closed exactly once: records the failure, rejects the
295
+ * terminal wait, and cancels the underlying subscription so a stalled transport
296
+ * stops working.
297
+ *
298
+ * @param error - The graph error the observation failed with.
299
+ * @returns The same error, for convenient `throw`/`return` use.
300
+ */
301
+ failClosed(error) {
302
+ if (!this.failure) {
303
+ this.failure = error;
304
+ this.rejectTerminal?.(error);
305
+ const subscription = this.subscription;
306
+ if (subscription) {
307
+ void Promise.resolve(subscription.unsubscribe()).catch(() => { });
308
+ }
309
+ }
310
+ return this.failure;
311
+ }
312
+ /** The error raised when the caller aborts the observation. */
313
+ abortError() {
314
+ return new GraphExecutionError(`Dagster run '${this.options.dagsterRunId}' observation was aborted by the caller`, DAGSTER_ERROR.OBSERVE_ABORTED, { runId: this.options.dagsterRunId });
315
+ }
316
+ /** The error raised when the run misses the terminal-wait timeout. */
317
+ timeoutError(timeoutMs) {
318
+ return new GraphExecutionError(`Dagster run '${this.options.dagsterRunId}' did not reach a terminal state within ${timeoutMs}ms`, DAGSTER_ERROR.OBSERVE_TIMEOUT, { runId: this.options.dagsterRunId, timeoutMs });
319
+ }
320
+ /** The error raised when the run exceeds the event cap. */
321
+ limitError(maxEvents) {
322
+ return new GraphExecutionError(`Dagster run '${this.options.dagsterRunId}' emitted more than ${maxEvents} events without reaching a terminal state`, DAGSTER_ERROR.EVENT_LIMIT_EXCEEDED, { runId: this.options.dagsterRunId, maxEvents });
323
+ }
324
+ /**
325
+ * Builds a frontend-safe error payload. Raw Dagster details are never
326
+ * forwarded to clients (standing hardening rule).
327
+ *
328
+ * @param error - The raw error.
329
+ * @returns The frontend-safe error payload.
330
+ */
331
+ toErrorPayload(error) {
332
+ return {
333
+ name: "DagsterRunError",
334
+ message: error.message ?? "Dagster run failed",
335
+ ...(error.code ? { code: error.code } : {}),
336
+ };
337
+ }
338
+ }
339
+ //# sourceMappingURL=DagsterGraphEventBridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DagsterGraphEventBridge.js","sourceRoot":"","sources":["../../../src/dagster/DagsterGraphEventBridge.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GACrB,mCAAwB;AAIzB,OAAO,EAAE,mBAAmB,EAAE,oCAAyB;AACvD,OAAO,EAAE,aAAa,EAAE,uBAAoB;AAQ5C;;GAEG;AACH,MAAM,iBAAiB,GAA4C;IACjE,UAAU,EAAE,uBAAuB,CAAC,YAAY;IAChD,YAAY,EAAE,uBAAuB,CAAC,cAAc;IACpD,YAAY,EAAE,uBAAuB,CAAC,WAAW;IACjD,YAAY,EAAE,uBAAuB,CAAC,YAAY;IAClD,WAAW,EAAE,uBAAuB,CAAC,WAAW;IAChD,SAAS,EAAE,uBAAuB,CAAC,gBAAgB;IACnD,WAAW,EAAE,uBAAuB,CAAC,kBAAkB;IACvD,WAAW,EAAE,uBAAuB,CAAC,eAAe;IACpD,YAAY,EAAE,uBAAuB,CAAC,kBAAkB;CACzD,CAAC;AAEF,gDAAgD;AAChD,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAS;IAC9C,aAAa;IACb,aAAa;IACb,cAAc;CACf,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAEjC;;;GAGG;AACH,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B;;;GAGG;AACH,MAAM,2BAA2B,GAAG,CAAC,GAAG,EAAE,GA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