@decaf-ts/integrations 0.3.1 → 0.3.2

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 (354) hide show
  1. package/dist/integrations.cjs +1 -1
  2. package/lib/cjs/graph/constants.cjs +94 -0
  3. package/lib/cjs/graph/constants.cjs.map +1 -0
  4. package/lib/cjs/graph/decorators.cjs +4 -0
  5. package/lib/cjs/graph/decorators.cjs.map +1 -0
  6. package/lib/cjs/graph/errors/GraphCycleError.cjs +20 -0
  7. package/lib/cjs/graph/errors/GraphCycleError.cjs.map +1 -0
  8. package/lib/cjs/graph/errors/GraphExecutionError.cjs +27 -0
  9. package/lib/cjs/graph/errors/GraphExecutionError.cjs.map +1 -0
  10. package/lib/cjs/graph/errors/GraphInputError.cjs +20 -0
  11. package/lib/cjs/graph/errors/GraphInputError.cjs.map +1 -0
  12. package/lib/cjs/graph/errors/GraphLoopLimitError.cjs +20 -0
  13. package/lib/cjs/graph/errors/GraphLoopLimitError.cjs.map +1 -0
  14. package/lib/cjs/graph/errors/GraphPinningError.cjs +20 -0
  15. package/lib/cjs/graph/errors/GraphPinningError.cjs.map +1 -0
  16. package/lib/cjs/graph/errors/GraphPortError.cjs +20 -0
  17. package/lib/cjs/graph/errors/GraphPortError.cjs.map +1 -0
  18. package/lib/cjs/graph/errors/GraphStoreError.cjs +20 -0
  19. package/lib/cjs/graph/errors/GraphStoreError.cjs.map +1 -0
  20. package/lib/cjs/graph/errors/GraphTopologyError.cjs +20 -0
  21. package/lib/cjs/graph/errors/GraphTopologyError.cjs.map +1 -0
  22. package/lib/cjs/graph/errors/index.cjs +31 -0
  23. package/lib/cjs/graph/errors/index.cjs.map +1 -0
  24. package/lib/cjs/graph/events/GraphExecutionEvent.cjs +4 -0
  25. package/lib/cjs/graph/events/GraphExecutionEvent.cjs.map +1 -0
  26. package/lib/cjs/graph/events/GraphExecutionEventEmitter.cjs +40 -0
  27. package/lib/cjs/graph/events/GraphExecutionEventEmitter.cjs.map +1 -0
  28. package/lib/cjs/graph/events/GraphExecutionEventFactory.cjs +37 -0
  29. package/lib/cjs/graph/events/GraphExecutionEventFactory.cjs.map +1 -0
  30. package/lib/cjs/graph/events/GraphExecutionObserver.cjs +4 -0
  31. package/lib/cjs/graph/events/GraphExecutionObserver.cjs.map +1 -0
  32. package/lib/cjs/graph/events/index.cjs +27 -0
  33. package/lib/cjs/graph/events/index.cjs.map +1 -0
  34. package/lib/cjs/graph/execution/GraphExecutionContext.cjs +79 -0
  35. package/lib/cjs/graph/execution/GraphExecutionContext.cjs.map +1 -0
  36. package/lib/cjs/graph/execution/GraphExecutionEngine.cjs +405 -0
  37. package/lib/cjs/graph/execution/GraphExecutionEngine.cjs.map +1 -0
  38. package/lib/cjs/graph/execution/GraphExecutionFrame.cjs +32 -0
  39. package/lib/cjs/graph/execution/GraphExecutionFrame.cjs.map +1 -0
  40. package/lib/cjs/graph/execution/GraphExecutionResult.cjs +30 -0
  41. package/lib/cjs/graph/execution/GraphExecutionResult.cjs.map +1 -0
  42. package/lib/cjs/graph/execution/GraphNodeExecutor.cjs +4 -0
  43. package/lib/cjs/graph/execution/GraphNodeExecutor.cjs.map +1 -0
  44. package/lib/cjs/graph/execution/index.cjs +28 -0
  45. package/lib/cjs/graph/execution/index.cjs.map +1 -0
  46. package/lib/cjs/graph/index.cjs +74 -0
  47. package/lib/cjs/graph/index.cjs.map +1 -0
  48. package/lib/cjs/graph/loops/ForeachGraphNodeExecutor.cjs +84 -0
  49. package/lib/cjs/graph/loops/ForeachGraphNodeExecutor.cjs.map +1 -0
  50. package/lib/cjs/graph/loops/GraphConditionEvaluator.cjs +63 -0
  51. package/lib/cjs/graph/loops/GraphConditionEvaluator.cjs.map +1 -0
  52. package/lib/cjs/graph/loops/GraphLoopExecutionContext.cjs +16 -0
  53. package/lib/cjs/graph/loops/GraphLoopExecutionContext.cjs.map +1 -0
  54. package/lib/cjs/graph/loops/UntilGraphNodeExecutor.cjs +76 -0
  55. package/lib/cjs/graph/loops/UntilGraphNodeExecutor.cjs.map +1 -0
  56. package/lib/cjs/graph/loops/WhileGraphNodeExecutor.cjs +77 -0
  57. package/lib/cjs/graph/loops/WhileGraphNodeExecutor.cjs.map +1 -0
  58. package/lib/cjs/graph/loops/index.cjs +28 -0
  59. package/lib/cjs/graph/loops/index.cjs.map +1 -0
  60. package/lib/cjs/graph/pinning/GraphPinningDependencyResolver.cjs +28 -0
  61. package/lib/cjs/graph/pinning/GraphPinningDependencyResolver.cjs.map +1 -0
  62. package/lib/cjs/graph/pinning/GraphPinningMetadata.cjs +20 -0
  63. package/lib/cjs/graph/pinning/GraphPinningMetadata.cjs.map +1 -0
  64. package/lib/cjs/graph/pinning/GraphPinningPolicy.cjs +34 -0
  65. package/lib/cjs/graph/pinning/GraphPinningPolicy.cjs.map +1 -0
  66. package/lib/cjs/graph/pinning/GraphPinningService.cjs +191 -0
  67. package/lib/cjs/graph/pinning/GraphPinningService.cjs.map +1 -0
  68. package/lib/cjs/graph/pinning/index.cjs +27 -0
  69. package/lib/cjs/graph/pinning/index.cjs.map +1 -0
  70. package/lib/cjs/graph/planning/GraphExecutionPlan.cjs +4 -0
  71. package/lib/cjs/graph/planning/GraphExecutionPlan.cjs.map +1 -0
  72. package/lib/cjs/graph/planning/GraphExecutionPlanEdge.cjs +4 -0
  73. package/lib/cjs/graph/planning/GraphExecutionPlanEdge.cjs.map +1 -0
  74. package/lib/cjs/graph/planning/GraphExecutionPlanLayer.cjs +4 -0
  75. package/lib/cjs/graph/planning/GraphExecutionPlanLayer.cjs.map +1 -0
  76. package/lib/cjs/graph/planning/GraphExecutionPlanNode.cjs +4 -0
  77. package/lib/cjs/graph/planning/GraphExecutionPlanNode.cjs.map +1 -0
  78. package/lib/cjs/graph/planning/GraphExecutionPlanner.cjs +197 -0
  79. package/lib/cjs/graph/planning/GraphExecutionPlanner.cjs.map +1 -0
  80. package/lib/cjs/graph/planning/GraphRelationResolver.cjs +172 -0
  81. package/lib/cjs/graph/planning/GraphRelationResolver.cjs.map +1 -0
  82. package/lib/cjs/graph/planning/GraphTopology.cjs +57 -0
  83. package/lib/cjs/graph/planning/GraphTopology.cjs.map +1 -0
  84. package/lib/cjs/graph/planning/index.cjs +30 -0
  85. package/lib/cjs/graph/planning/index.cjs.map +1 -0
  86. package/lib/cjs/graph/registry/GraphNodeExecutorRegistry.cjs +44 -0
  87. package/lib/cjs/graph/registry/GraphNodeExecutorRegistry.cjs.map +1 -0
  88. package/lib/cjs/graph/registry/GraphNodeExecutorResolver.cjs +27 -0
  89. package/lib/cjs/graph/registry/GraphNodeExecutorResolver.cjs.map +1 -0
  90. package/lib/cjs/graph/registry/index.cjs +25 -0
  91. package/lib/cjs/graph/registry/index.cjs.map +1 -0
  92. package/lib/cjs/graph/snapshots/GraphExecutionSnapshotMapper.cjs +53 -0
  93. package/lib/cjs/graph/snapshots/GraphExecutionSnapshotMapper.cjs.map +1 -0
  94. package/lib/cjs/graph/snapshots/index.cjs +24 -0
  95. package/lib/cjs/graph/snapshots/index.cjs.map +1 -0
  96. package/lib/cjs/graph/store/GraphCachedValue.cjs +4 -0
  97. package/lib/cjs/graph/store/GraphCachedValue.cjs.map +1 -0
  98. package/lib/cjs/graph/store/GraphValueKey.cjs +4 -0
  99. package/lib/cjs/graph/store/GraphValueKey.cjs.map +1 -0
  100. package/lib/cjs/graph/store/GraphValueStore.cjs +76 -0
  101. package/lib/cjs/graph/store/GraphValueStore.cjs.map +1 -0
  102. package/lib/cjs/graph/store/GraphValueStoreAdapter.cjs +4 -0
  103. package/lib/cjs/graph/store/GraphValueStoreAdapter.cjs.map +1 -0
  104. package/lib/cjs/graph/store/InMemoryGraphValueStoreAdapter.cjs +69 -0
  105. package/lib/cjs/graph/store/InMemoryGraphValueStoreAdapter.cjs.map +1 -0
  106. package/lib/cjs/graph/store/index.cjs +28 -0
  107. package/lib/cjs/graph/store/index.cjs.map +1 -0
  108. package/lib/cjs/graph/types.cjs +4 -0
  109. package/lib/cjs/graph/types.cjs.map +1 -0
  110. package/lib/cjs/graph/validation/GraphDefinitionValidator.cjs +33 -0
  111. package/lib/cjs/graph/validation/GraphDefinitionValidator.cjs.map +1 -0
  112. package/lib/cjs/graph/validation/GraphPortSchemaResolver.cjs +58 -0
  113. package/lib/cjs/graph/validation/GraphPortSchemaResolver.cjs.map +1 -0
  114. package/lib/cjs/graph/validation/GraphValueValidator.cjs +52 -0
  115. package/lib/cjs/graph/validation/GraphValueValidator.cjs.map +1 -0
  116. package/lib/cjs/graph/validation/index.cjs +26 -0
  117. package/lib/cjs/graph/validation/index.cjs.map +1 -0
  118. package/lib/cjs/index.cjs +3 -3
  119. package/lib/esm/graph/constants.js +106 -0
  120. package/lib/esm/graph/constants.js.map +1 -0
  121. package/lib/esm/graph/decorators.js +2 -0
  122. package/lib/esm/graph/decorators.js.map +1 -0
  123. package/lib/esm/graph/errors/GraphCycleError.js +15 -0
  124. package/lib/esm/graph/errors/GraphCycleError.js.map +1 -0
  125. package/lib/esm/graph/errors/GraphExecutionError.js +22 -0
  126. package/lib/esm/graph/errors/GraphExecutionError.js.map +1 -0
  127. package/lib/esm/graph/errors/GraphInputError.js +15 -0
  128. package/lib/esm/graph/errors/GraphInputError.js.map +1 -0
  129. package/lib/esm/graph/errors/GraphLoopLimitError.js +15 -0
  130. package/lib/esm/graph/errors/GraphLoopLimitError.js.map +1 -0
  131. package/lib/esm/graph/errors/GraphPinningError.js +15 -0
  132. package/lib/esm/graph/errors/GraphPinningError.js.map +1 -0
  133. package/lib/esm/graph/errors/GraphPortError.js +15 -0
  134. package/lib/esm/graph/errors/GraphPortError.js.map +1 -0
  135. package/lib/esm/graph/errors/GraphStoreError.js +15 -0
  136. package/lib/esm/graph/errors/GraphStoreError.js.map +1 -0
  137. package/lib/esm/graph/errors/GraphTopologyError.js +15 -0
  138. package/lib/esm/graph/errors/GraphTopologyError.js.map +1 -0
  139. package/lib/esm/graph/errors/index.js +14 -0
  140. package/lib/esm/graph/errors/index.js.map +1 -0
  141. package/lib/esm/graph/events/GraphExecutionEvent.js +2 -0
  142. package/lib/esm/graph/events/GraphExecutionEvent.js.map +1 -0
  143. package/lib/esm/graph/events/GraphExecutionEventEmitter.js +35 -0
  144. package/lib/esm/graph/events/GraphExecutionEventEmitter.js.map +1 -0
  145. package/lib/esm/graph/events/GraphExecutionEventFactory.js +32 -0
  146. package/lib/esm/graph/events/GraphExecutionEventFactory.js.map +1 -0
  147. package/lib/esm/graph/events/GraphExecutionObserver.js +2 -0
  148. package/lib/esm/graph/events/GraphExecutionObserver.js.map +1 -0
  149. package/lib/esm/graph/events/index.js +10 -0
  150. package/lib/esm/graph/events/index.js.map +1 -0
  151. package/lib/esm/graph/execution/GraphExecutionContext.js +74 -0
  152. package/lib/esm/graph/execution/GraphExecutionContext.js.map +1 -0
  153. package/lib/esm/graph/execution/GraphExecutionEngine.js +400 -0
  154. package/lib/esm/graph/execution/GraphExecutionEngine.js.map +1 -0
  155. package/lib/esm/graph/execution/GraphExecutionFrame.js +27 -0
  156. package/lib/esm/graph/execution/GraphExecutionFrame.js.map +1 -0
  157. package/lib/esm/graph/execution/GraphExecutionResult.js +26 -0
  158. package/lib/esm/graph/execution/GraphExecutionResult.js.map +1 -0
  159. package/lib/esm/graph/execution/GraphNodeExecutor.js +2 -0
  160. package/lib/esm/graph/execution/GraphNodeExecutor.js.map +1 -0
  161. package/lib/esm/graph/execution/index.js +11 -0
  162. package/lib/esm/graph/execution/index.js.map +1 -0
  163. package/lib/esm/graph/index.js +57 -0
  164. package/lib/esm/graph/index.js.map +1 -0
  165. package/lib/esm/graph/loops/ForeachGraphNodeExecutor.js +79 -0
  166. package/lib/esm/graph/loops/ForeachGraphNodeExecutor.js.map +1 -0
  167. package/lib/esm/graph/loops/GraphConditionEvaluator.js +58 -0
  168. package/lib/esm/graph/loops/GraphConditionEvaluator.js.map +1 -0
  169. package/lib/esm/graph/loops/GraphLoopExecutionContext.js +11 -0
  170. package/lib/esm/graph/loops/GraphLoopExecutionContext.js.map +1 -0
  171. package/lib/esm/graph/loops/UntilGraphNodeExecutor.js +71 -0
  172. package/lib/esm/graph/loops/UntilGraphNodeExecutor.js.map +1 -0
  173. package/lib/esm/graph/loops/WhileGraphNodeExecutor.js +72 -0
  174. package/lib/esm/graph/loops/WhileGraphNodeExecutor.js.map +1 -0
  175. package/lib/esm/graph/loops/index.js +11 -0
  176. package/lib/esm/graph/loops/index.js.map +1 -0
  177. package/lib/esm/graph/pinning/GraphPinningDependencyResolver.js +23 -0
  178. package/lib/esm/graph/pinning/GraphPinningDependencyResolver.js.map +1 -0
  179. package/lib/esm/graph/pinning/GraphPinningMetadata.js +15 -0
  180. package/lib/esm/graph/pinning/GraphPinningMetadata.js.map +1 -0
  181. package/lib/esm/graph/pinning/GraphPinningPolicy.js +29 -0
  182. package/lib/esm/graph/pinning/GraphPinningPolicy.js.map +1 -0
  183. package/lib/esm/graph/pinning/GraphPinningService.js +186 -0
  184. package/lib/esm/graph/pinning/GraphPinningService.js.map +1 -0
  185. package/lib/esm/graph/pinning/index.js +10 -0
  186. package/lib/esm/graph/pinning/index.js.map +1 -0
  187. package/lib/esm/graph/planning/GraphExecutionPlan.js +2 -0
  188. package/lib/esm/graph/planning/GraphExecutionPlan.js.map +1 -0
  189. package/lib/esm/graph/planning/GraphExecutionPlanEdge.js +7 -0
  190. package/lib/esm/graph/planning/GraphExecutionPlanEdge.js.map +1 -0
  191. package/lib/esm/graph/planning/GraphExecutionPlanLayer.js +2 -0
  192. package/lib/esm/graph/planning/GraphExecutionPlanLayer.js.map +1 -0
  193. package/lib/esm/graph/planning/GraphExecutionPlanNode.js +2 -0
  194. package/lib/esm/graph/planning/GraphExecutionPlanNode.js.map +1 -0
  195. package/lib/esm/graph/planning/GraphExecutionPlanner.js +192 -0
  196. package/lib/esm/graph/planning/GraphExecutionPlanner.js.map +1 -0
  197. package/lib/esm/graph/planning/GraphRelationResolver.js +167 -0
  198. package/lib/esm/graph/planning/GraphRelationResolver.js.map +1 -0
  199. package/lib/esm/graph/planning/GraphTopology.js +52 -0
  200. package/lib/esm/graph/planning/GraphTopology.js.map +1 -0
  201. package/lib/esm/graph/planning/index.js +13 -0
  202. package/lib/esm/graph/planning/index.js.map +1 -0
  203. package/lib/esm/graph/registry/GraphNodeExecutorRegistry.js +39 -0
  204. package/lib/esm/graph/registry/GraphNodeExecutorRegistry.js.map +1 -0
  205. package/lib/esm/graph/registry/GraphNodeExecutorResolver.js +22 -0
  206. package/lib/esm/graph/registry/GraphNodeExecutorResolver.js.map +1 -0
  207. package/lib/esm/graph/registry/index.js +8 -0
  208. package/lib/esm/graph/registry/index.js.map +1 -0
  209. package/lib/esm/graph/snapshots/GraphExecutionSnapshotMapper.js +48 -0
  210. package/lib/esm/graph/snapshots/GraphExecutionSnapshotMapper.js.map +1 -0
  211. package/lib/esm/graph/snapshots/index.js +7 -0
  212. package/lib/esm/graph/snapshots/index.js.map +1 -0
  213. package/lib/esm/graph/store/GraphCachedValue.js +2 -0
  214. package/lib/esm/graph/store/GraphCachedValue.js.map +1 -0
  215. package/lib/esm/graph/store/GraphValueKey.js +7 -0
  216. package/lib/esm/graph/store/GraphValueKey.js.map +1 -0
  217. package/lib/esm/graph/store/GraphValueStore.js +71 -0
  218. package/lib/esm/graph/store/GraphValueStore.js.map +1 -0
  219. package/lib/esm/graph/store/GraphValueStoreAdapter.js +2 -0
  220. package/lib/esm/graph/store/GraphValueStoreAdapter.js.map +1 -0
  221. package/lib/esm/graph/store/InMemoryGraphValueStoreAdapter.js +64 -0
  222. package/lib/esm/graph/store/InMemoryGraphValueStoreAdapter.js.map +1 -0
  223. package/lib/esm/graph/store/index.js +11 -0
  224. package/lib/esm/graph/store/index.js.map +1 -0
  225. package/lib/esm/graph/types.js +2 -0
  226. package/lib/esm/graph/types.js.map +1 -0
  227. package/lib/esm/graph/validation/GraphDefinitionValidator.js +28 -0
  228. package/lib/esm/graph/validation/GraphDefinitionValidator.js.map +1 -0
  229. package/lib/esm/graph/validation/GraphPortSchemaResolver.js +53 -0
  230. package/lib/esm/graph/validation/GraphPortSchemaResolver.js.map +1 -0
  231. package/lib/esm/graph/validation/GraphValueValidator.js +47 -0
  232. package/lib/esm/graph/validation/GraphValueValidator.js.map +1 -0
  233. package/lib/esm/graph/validation/index.js +9 -0
  234. package/lib/esm/graph/validation/index.js.map +1 -0
  235. package/lib/esm/index.js +3 -3
  236. package/lib/types/graph/constants.d.cts +101 -0
  237. package/lib/types/graph/constants.d.mts +101 -0
  238. package/lib/types/graph/decorators.d.cts +6 -0
  239. package/lib/types/graph/decorators.d.mts +6 -0
  240. package/lib/types/graph/errors/GraphCycleError.d.cts +12 -0
  241. package/lib/types/graph/errors/GraphCycleError.d.mts +12 -0
  242. package/lib/types/graph/errors/GraphExecutionError.d.cts +19 -0
  243. package/lib/types/graph/errors/GraphExecutionError.d.mts +19 -0
  244. package/lib/types/graph/errors/GraphInputError.d.cts +12 -0
  245. package/lib/types/graph/errors/GraphInputError.d.mts +12 -0
  246. package/lib/types/graph/errors/GraphLoopLimitError.d.cts +12 -0
  247. package/lib/types/graph/errors/GraphLoopLimitError.d.mts +12 -0
  248. package/lib/types/graph/errors/GraphPinningError.d.cts +12 -0
  249. package/lib/types/graph/errors/GraphPinningError.d.mts +12 -0
  250. package/lib/types/graph/errors/GraphPortError.d.cts +12 -0
  251. package/lib/types/graph/errors/GraphPortError.d.mts +12 -0
  252. package/lib/types/graph/errors/GraphStoreError.d.cts +12 -0
  253. package/lib/types/graph/errors/GraphStoreError.d.mts +12 -0
  254. package/lib/types/graph/errors/GraphTopologyError.d.cts +12 -0
  255. package/lib/types/graph/errors/GraphTopologyError.d.mts +12 -0
  256. package/lib/types/graph/errors/index.d.cts +13 -0
  257. package/lib/types/graph/errors/index.d.mts +13 -0
  258. package/lib/types/graph/events/GraphExecutionEvent.d.cts +6 -0
  259. package/lib/types/graph/events/GraphExecutionEvent.d.mts +6 -0
  260. package/lib/types/graph/events/GraphExecutionEventEmitter.d.cts +26 -0
  261. package/lib/types/graph/events/GraphExecutionEventEmitter.d.mts +26 -0
  262. package/lib/types/graph/events/GraphExecutionEventFactory.d.cts +25 -0
  263. package/lib/types/graph/events/GraphExecutionEventFactory.d.mts +25 -0
  264. package/lib/types/graph/events/GraphExecutionObserver.d.cts +17 -0
  265. package/lib/types/graph/events/GraphExecutionObserver.d.mts +17 -0
  266. package/lib/types/graph/events/index.d.cts +9 -0
  267. package/lib/types/graph/events/index.d.mts +9 -0
  268. package/lib/types/graph/execution/GraphExecutionContext.d.cts +50 -0
  269. package/lib/types/graph/execution/GraphExecutionContext.d.mts +50 -0
  270. package/lib/types/graph/execution/GraphExecutionEngine.d.cts +112 -0
  271. package/lib/types/graph/execution/GraphExecutionEngine.d.mts +112 -0
  272. package/lib/types/graph/execution/GraphExecutionFrame.d.cts +29 -0
  273. package/lib/types/graph/execution/GraphExecutionFrame.d.mts +29 -0
  274. package/lib/types/graph/execution/GraphExecutionResult.d.cts +13 -0
  275. package/lib/types/graph/execution/GraphExecutionResult.d.mts +13 -0
  276. package/lib/types/graph/execution/GraphNodeExecutor.d.cts +23 -0
  277. package/lib/types/graph/execution/GraphNodeExecutor.d.mts +23 -0
  278. package/lib/types/graph/execution/index.d.cts +10 -0
  279. package/lib/types/graph/execution/index.d.mts +10 -0
  280. package/lib/types/graph/index.d.cts +52 -0
  281. package/lib/types/graph/index.d.mts +52 -0
  282. package/lib/types/graph/loops/ForeachGraphNodeExecutor.d.cts +27 -0
  283. package/lib/types/graph/loops/ForeachGraphNodeExecutor.d.mts +27 -0
  284. package/lib/types/graph/loops/GraphConditionEvaluator.d.cts +23 -0
  285. package/lib/types/graph/loops/GraphConditionEvaluator.d.mts +23 -0
  286. package/lib/types/graph/loops/GraphLoopExecutionContext.d.cts +15 -0
  287. package/lib/types/graph/loops/GraphLoopExecutionContext.d.mts +15 -0
  288. package/lib/types/graph/loops/UntilGraphNodeExecutor.d.cts +22 -0
  289. package/lib/types/graph/loops/UntilGraphNodeExecutor.d.mts +22 -0
  290. package/lib/types/graph/loops/WhileGraphNodeExecutor.d.cts +26 -0
  291. package/lib/types/graph/loops/WhileGraphNodeExecutor.d.mts +26 -0
  292. package/lib/types/graph/loops/index.d.cts +10 -0
  293. package/lib/types/graph/loops/index.d.mts +10 -0
  294. package/lib/types/graph/pinning/GraphPinningDependencyResolver.d.cts +21 -0
  295. package/lib/types/graph/pinning/GraphPinningDependencyResolver.d.mts +21 -0
  296. package/lib/types/graph/pinning/GraphPinningMetadata.d.cts +14 -0
  297. package/lib/types/graph/pinning/GraphPinningMetadata.d.mts +14 -0
  298. package/lib/types/graph/pinning/GraphPinningPolicy.d.cts +20 -0
  299. package/lib/types/graph/pinning/GraphPinningPolicy.d.mts +20 -0
  300. package/lib/types/graph/pinning/GraphPinningService.d.cts +59 -0
  301. package/lib/types/graph/pinning/GraphPinningService.d.mts +59 -0
  302. package/lib/types/graph/pinning/index.d.cts +9 -0
  303. package/lib/types/graph/pinning/index.d.mts +9 -0
  304. package/lib/types/graph/planning/GraphExecutionPlan.d.cts +21 -0
  305. package/lib/types/graph/planning/GraphExecutionPlan.d.mts +21 -0
  306. package/lib/types/graph/planning/GraphExecutionPlanEdge.d.cts +21 -0
  307. package/lib/types/graph/planning/GraphExecutionPlanEdge.d.mts +21 -0
  308. package/lib/types/graph/planning/GraphExecutionPlanLayer.d.cts +13 -0
  309. package/lib/types/graph/planning/GraphExecutionPlanLayer.d.mts +13 -0
  310. package/lib/types/graph/planning/GraphExecutionPlanNode.d.cts +20 -0
  311. package/lib/types/graph/planning/GraphExecutionPlanNode.d.mts +20 -0
  312. package/lib/types/graph/planning/GraphExecutionPlanner.d.cts +60 -0
  313. package/lib/types/graph/planning/GraphExecutionPlanner.d.mts +60 -0
  314. package/lib/types/graph/planning/GraphRelationResolver.d.cts +62 -0
  315. package/lib/types/graph/planning/GraphRelationResolver.d.mts +62 -0
  316. package/lib/types/graph/planning/GraphTopology.d.cts +23 -0
  317. package/lib/types/graph/planning/GraphTopology.d.mts +23 -0
  318. package/lib/types/graph/planning/index.d.cts +12 -0
  319. package/lib/types/graph/planning/index.d.mts +12 -0
  320. package/lib/types/graph/registry/GraphNodeExecutorRegistry.d.cts +25 -0
  321. package/lib/types/graph/registry/GraphNodeExecutorRegistry.d.mts +25 -0
  322. package/lib/types/graph/registry/GraphNodeExecutorResolver.d.cts +21 -0
  323. package/lib/types/graph/registry/GraphNodeExecutorResolver.d.mts +21 -0
  324. package/lib/types/graph/registry/index.d.cts +7 -0
  325. package/lib/types/graph/registry/index.d.mts +7 -0
  326. package/lib/types/graph/snapshots/GraphExecutionSnapshotMapper.d.cts +10 -0
  327. package/lib/types/graph/snapshots/GraphExecutionSnapshotMapper.d.mts +10 -0
  328. package/lib/types/graph/snapshots/index.d.cts +6 -0
  329. package/lib/types/graph/snapshots/index.d.mts +6 -0
  330. package/lib/types/graph/store/GraphCachedValue.d.cts +20 -0
  331. package/lib/types/graph/store/GraphCachedValue.d.mts +20 -0
  332. package/lib/types/graph/store/GraphValueKey.d.cts +18 -0
  333. package/lib/types/graph/store/GraphValueKey.d.mts +18 -0
  334. package/lib/types/graph/store/GraphValueStore.d.cts +41 -0
  335. package/lib/types/graph/store/GraphValueStore.d.mts +41 -0
  336. package/lib/types/graph/store/GraphValueStoreAdapter.d.cts +32 -0
  337. package/lib/types/graph/store/GraphValueStoreAdapter.d.mts +32 -0
  338. package/lib/types/graph/store/InMemoryGraphValueStoreAdapter.d.cts +33 -0
  339. package/lib/types/graph/store/InMemoryGraphValueStoreAdapter.d.mts +33 -0
  340. package/lib/types/graph/store/index.d.cts +10 -0
  341. package/lib/types/graph/store/index.d.mts +10 -0
  342. package/lib/types/graph/types.d.cts +197 -0
  343. package/lib/types/graph/types.d.mts +197 -0
  344. package/lib/types/graph/validation/GraphDefinitionValidator.d.cts +21 -0
  345. package/lib/types/graph/validation/GraphDefinitionValidator.d.mts +21 -0
  346. package/lib/types/graph/validation/GraphPortSchemaResolver.d.cts +39 -0
  347. package/lib/types/graph/validation/GraphPortSchemaResolver.d.mts +39 -0
  348. package/lib/types/graph/validation/GraphValueValidator.d.cts +27 -0
  349. package/lib/types/graph/validation/GraphValueValidator.d.mts +27 -0
  350. package/lib/types/graph/validation/index.d.cts +8 -0
  351. package/lib/types/graph/validation/index.d.mts +8 -0
  352. package/lib/types/index.d.cts +2 -2
  353. package/lib/types/index.d.mts +2 -2
  354. package/package.json +17 -3
@@ -0,0 +1,192 @@
1
+ import { graphDefinitionOf } from "@decaf-ts/ui-decorators/graph";
2
+ import { GRAPH_WORKFLOW_BOUNDARY } from "./../constants.js";
3
+ import { GraphCycleError } from "./../errors/GraphCycleError.js";
4
+ import { GraphTopologyError } from "./../errors/GraphTopologyError.js";
5
+ import { GraphRelationResolver } from "./GraphRelationResolver.js";
6
+ /**
7
+ * Planner that turns a {@link GraphWorkflowDefinition} into a
8
+ * {@link GraphExecutionPlan} with topological layers.
9
+ */
10
+ export class GraphExecutionPlanner {
11
+ constructor(resolver) {
12
+ this.resolver = resolver ?? new GraphRelationResolver();
13
+ }
14
+ /**
15
+ * Plans a workflow for execution.
16
+ *
17
+ * @param workflow - The workflow definition to plan.
18
+ * @returns The execution plan with nodes, edges, layers, and maps.
19
+ * @throws {GraphTopologyError} when node IDs are not unique.
20
+ * @throws {GraphCycleError} when the workflow contains an unsupported cycle.
21
+ */
22
+ plan(workflow) {
23
+ this.validateUniqueNodeIds(workflow);
24
+ const nodes = this.resolveNodes(workflow);
25
+ const edges = this.resolver.resolve(workflow);
26
+ const incomingByNode = this.buildIncomingMap(edges);
27
+ const outgoingByNode = this.buildOutgoingMap(edges);
28
+ const layers = this.topologicalLayers(nodes, edges);
29
+ return {
30
+ workflow,
31
+ workflowId: workflow.name,
32
+ nodes,
33
+ edges,
34
+ layers,
35
+ incomingByNode,
36
+ outgoingByNode,
37
+ };
38
+ }
39
+ /**
40
+ * Validates that all workflow node IDs are unique.
41
+ */
42
+ validateUniqueNodeIds(workflow) {
43
+ const seen = new Set();
44
+ for (const node of workflow.nodes ?? []) {
45
+ if (seen.has(node.id)) {
46
+ throw new GraphTopologyError(`Duplicate node id '${node.id}' in workflow '${workflow.name}'`, { nodeId: node.id, workflowId: workflow.name });
47
+ }
48
+ seen.add(node.id);
49
+ }
50
+ }
51
+ /**
52
+ * Resolves workflow node metadata into plan nodes with full definitions.
53
+ */
54
+ resolveNodes(workflow) {
55
+ const result = [];
56
+ for (const nodeMeta of workflow.nodes ?? []) {
57
+ const definition = this.resolveDefinition(nodeMeta);
58
+ const inputPorts = (definition.ports ?? [])
59
+ .filter((p) => p.direction === "input")
60
+ .map((p) => p.name);
61
+ const outputPorts = (definition.ports ?? [])
62
+ .filter((p) => p.direction === "output")
63
+ .map((p) => p.name);
64
+ result.push({
65
+ id: nodeMeta.id,
66
+ kind: nodeMeta.kind ?? definition.kind ?? nodeMeta.id,
67
+ label: nodeMeta.label,
68
+ source: nodeMeta,
69
+ definition,
70
+ inputPorts,
71
+ outputPorts,
72
+ metadata: nodeMeta.metadata,
73
+ });
74
+ }
75
+ return result;
76
+ }
77
+ /**
78
+ * Attempts to resolve the full graph node definition from metadata.
79
+ *
80
+ * Accepts either a decorated Model class/instance (resolved via
81
+ * `graphDefinitionOf`) or a plain `GraphNodeDefinition`-shaped object
82
+ * (useful for serialized workflows that inline node definitions).
83
+ */
84
+ resolveDefinition(nodeMeta) {
85
+ if (nodeMeta.node) {
86
+ if (this.isRawDefinition(nodeMeta.node)) {
87
+ return nodeMeta.node;
88
+ }
89
+ try {
90
+ return graphDefinitionOf(nodeMeta.node);
91
+ }
92
+ catch {
93
+ // fall through to stub
94
+ }
95
+ }
96
+ // Return a minimal stub definition so planning can proceed
97
+ return {
98
+ name: nodeMeta.id,
99
+ tag: nodeMeta.id,
100
+ kind: nodeMeta.kind ?? nodeMeta.id,
101
+ labels: [],
102
+ ports: [],
103
+ };
104
+ }
105
+ /**
106
+ * Returns `true` when a value looks like a raw {@link GraphNodeDefinition}
107
+ * (a plain object with a `ports` array and a `name` string).
108
+ */
109
+ isRawDefinition(value) {
110
+ return (typeof value === "object" &&
111
+ value !== null &&
112
+ !Array.isArray(value) &&
113
+ typeof value.name === "string" &&
114
+ Array.isArray(value.ports));
115
+ }
116
+ /**
117
+ * Builds a map of node id -> incoming edges.
118
+ */
119
+ buildIncomingMap(edges) {
120
+ const map = new Map();
121
+ for (const edge of edges) {
122
+ const list = map.get(edge.targetNodeId) ?? [];
123
+ list.push(edge);
124
+ map.set(edge.targetNodeId, list);
125
+ }
126
+ return map;
127
+ }
128
+ /**
129
+ * Builds a map of node id -> outgoing edges.
130
+ */
131
+ buildOutgoingMap(edges) {
132
+ const map = new Map();
133
+ for (const edge of edges) {
134
+ const list = map.get(edge.sourceNodeId) ?? [];
135
+ list.push(edge);
136
+ map.set(edge.sourceNodeId, list);
137
+ }
138
+ return map;
139
+ }
140
+ /**
141
+ * Produces topological layers using Kahn's algorithm.
142
+ *
143
+ * Workflow boundary edges do not count as executable-node dependencies.
144
+ */
145
+ topologicalLayers(nodes, edges) {
146
+ const executableNodes = nodes.filter((n) => n.id !== GRAPH_WORKFLOW_BOUNDARY);
147
+ const nodeIds = new Set(executableNodes.map((n) => n.id));
148
+ // Only edges between two executable nodes count as dependencies
149
+ const execEdges = edges.filter((e) => nodeIds.has(e.sourceNodeId) && nodeIds.has(e.targetNodeId));
150
+ // Compute in-degree
151
+ const indegree = new Map();
152
+ for (const node of executableNodes)
153
+ indegree.set(node.id, 0);
154
+ for (const edge of execEdges) {
155
+ indegree.set(edge.targetNodeId, (indegree.get(edge.targetNodeId) ?? 0) + 1);
156
+ }
157
+ const layers = [];
158
+ const planned = new Set();
159
+ let ready = executableNodes.filter((n) => (indegree.get(n.id) ?? 0) === 0);
160
+ let layerIndex = 0;
161
+ while (ready.length > 0) {
162
+ const layer = { index: layerIndex++, nodes: ready };
163
+ layers.push(layer);
164
+ const nextReady = [];
165
+ for (const node of ready) {
166
+ planned.add(node.id);
167
+ const outgoing = execEdges.filter((e) => e.sourceNodeId === node.id);
168
+ for (const edge of outgoing) {
169
+ const deg = (indegree.get(edge.targetNodeId) ?? 1) - 1;
170
+ indegree.set(edge.targetNodeId, deg);
171
+ if (deg === 0 && !planned.has(edge.targetNodeId)) {
172
+ const next = executableNodes.find((n) => n.id === edge.targetNodeId);
173
+ if (next)
174
+ nextReady.push(next);
175
+ }
176
+ }
177
+ }
178
+ ready = nextReady;
179
+ }
180
+ if (planned.size !== executableNodes.length) {
181
+ const unplanned = executableNodes
182
+ .filter((n) => !planned.has(n.id))
183
+ .map((n) => n.id);
184
+ throw new GraphCycleError({
185
+ unplannedNodes: unplanned,
186
+ workflowId: nodes[0]?.definition?.name,
187
+ });
188
+ }
189
+ return layers;
190
+ }
191
+ }
192
+ //# sourceMappingURL=GraphExecutionPlanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphExecutionPlanner.js","sourceRoot":"","sources":["../../../../src/graph/planning/GraphExecutionPlanner.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,uBAAuB,EAAE,0BAAqB;AACvD,OAAO,EAAE,eAAe,EAAE,uCAAkC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,0CAAqC;AAKlE,OAAO,EAAE,qBAAqB,EAAE,mCAAgC;AAEhE;;;GAGG;AACH,MAAM,OAAO,qBAAqB;IAGhC,YAAY,QAAgC;QAC1C,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,IAAI,qBAAqB,EAAE,CAAC;IAC1D,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,CAAC,QAAiC;QACpC,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QAErC,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAE9C,MAAM,cAAc,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAA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,EAAE,SAAS;gBACzB,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI;aACvC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,167 @@
1
+ import { graphDefinitionOf } from "@decaf-ts/ui-decorators/graph";
2
+ import { GRAPH_WORKFLOW_BOUNDARY } from "./../constants.js";
3
+ import { GraphPortError } from "./../errors/GraphPortError.js";
4
+ import { GraphTopologyError } from "./../errors/GraphTopologyError.js";
5
+ /**
6
+ * Resolves raw workflow relation metadata into normalized execution edges.
7
+ */
8
+ export class GraphRelationResolver {
9
+ /**
10
+ * Resolves all relations of a workflow into execution edges.
11
+ *
12
+ * @param workflow - The workflow definition.
13
+ * @returns Array of normalized edges.
14
+ * @throws {GraphTopologyError} when an endpoint is unknown or ambiguous.
15
+ * @throws {GraphPortError} when a referenced port is missing or unknown.
16
+ */
17
+ resolve(workflow) {
18
+ const nodeIds = new Set(workflow.nodes.map((n) => n.id));
19
+ const boundaryAliases = this.boundaryAliases(workflow);
20
+ const inputPorts = this.portNames(workflow.inputs);
21
+ const outputPorts = this.portNames(workflow.outputs);
22
+ const nodePortMap = this.buildNodePortMap(workflow);
23
+ const edges = [];
24
+ for (const relation of workflow.relations ?? []) {
25
+ const edge = this.resolveRelation(relation, nodeIds, boundaryAliases, inputPorts, outputPorts, nodePortMap);
26
+ edges.push(edge);
27
+ }
28
+ return edges;
29
+ }
30
+ /**
31
+ * Resolves a single relation into an edge.
32
+ */
33
+ resolveRelation(relation, nodeIds, boundaryAliases, inputPorts, outputPorts, nodePortMap) {
34
+ const sourceNodeId = this.resolveEndpoint(relation.source, nodeIds, boundaryAliases);
35
+ const targetNodeId = this.resolveEndpoint(relation.target, nodeIds, boundaryAliases);
36
+ const sourcePort = relation.sourcePort;
37
+ const targetPort = relation.targetPort;
38
+ if (!sourcePort) {
39
+ throw new GraphPortError(`Relation is missing sourcePort (source: ${String(relation.source)}, target: ${String(relation.target)})`, { relation });
40
+ }
41
+ if (!targetPort) {
42
+ throw new GraphPortError(`Relation is missing targetPort (source: ${String(relation.source)}, target: ${String(relation.target)})`, { relation });
43
+ }
44
+ this.validatePort(sourceNodeId, sourcePort, true, boundaryAliases, inputPorts, outputPorts, nodePortMap);
45
+ this.validatePort(targetNodeId, targetPort, false, boundaryAliases, inputPorts, outputPorts, nodePortMap);
46
+ return {
47
+ id: this.createEdgeId(sourceNodeId, sourcePort, targetNodeId, targetPort),
48
+ sourceNodeId,
49
+ sourcePort,
50
+ targetNodeId,
51
+ targetPort,
52
+ label: relation.label,
53
+ metadata: relation.metadata,
54
+ };
55
+ }
56
+ /**
57
+ * Resolves an endpoint (source or target) to a node id or the workflow boundary.
58
+ */
59
+ resolveEndpoint(endpoint, nodeIds, boundaryAliases) {
60
+ const name = String(endpoint);
61
+ if (boundaryAliases.has(name))
62
+ return GRAPH_WORKFLOW_BOUNDARY;
63
+ if (nodeIds.has(name))
64
+ return name;
65
+ throw new GraphTopologyError(`Unknown endpoint '${name}'`, { endpoint: name, knownNodes: Array.from(nodeIds) });
66
+ }
67
+ /**
68
+ * Validates that a port exists on the given node or boundary.
69
+ */
70
+ validatePort(nodeId, port, isSource, boundaryAliases, inputPorts, outputPorts, nodePortMap) {
71
+ if (nodeId === GRAPH_WORKFLOW_BOUNDARY) {
72
+ const ports = isSource ? inputPorts : outputPorts;
73
+ if (!ports.has(port)) {
74
+ throw new GraphPortError(`Unknown ${isSource ? "input" : "output"} port '${port}' on workflow boundary`, { nodeId, port, isSource, available: Array.from(ports) });
75
+ }
76
+ return;
77
+ }
78
+ const nodePorts = nodePortMap.get(nodeId);
79
+ if (!nodePorts) {
80
+ throw new GraphTopologyError(`No port map for node '${nodeId}'`, {
81
+ nodeId,
82
+ });
83
+ }
84
+ const ports = isSource ? nodePorts.output : nodePorts.input;
85
+ if (!ports.has(port)) {
86
+ throw new GraphPortError(`Unknown ${isSource ? "output" : "input"} port '${port}' on node '${nodeId}'`, { nodeId, port, isSource, available: Array.from(ports) });
87
+ }
88
+ }
89
+ /**
90
+ * Builds the set of boundary aliases for a workflow.
91
+ */
92
+ boundaryAliases(workflow) {
93
+ return new Set([
94
+ GRAPH_WORKFLOW_BOUNDARY,
95
+ "workflow",
96
+ "graph",
97
+ workflow.name,
98
+ ]);
99
+ }
100
+ /**
101
+ * Extracts port names from a list of port definitions.
102
+ */
103
+ portNames(ports) {
104
+ return new Set((ports ?? []).map((p) => p.name));
105
+ }
106
+ /**
107
+ * Builds a map of node id -> { input ports, output ports }.
108
+ */
109
+ buildNodePortMap(workflow) {
110
+ const map = new Map();
111
+ for (const nodeMeta of workflow.nodes ?? []) {
112
+ const input = new Set();
113
+ const output = new Set();
114
+ const def = this.resolveNodeDefinition(nodeMeta);
115
+ if (def) {
116
+ for (const port of def.ports ?? []) {
117
+ if (port.direction === "input")
118
+ input.add(port.name);
119
+ else
120
+ output.add(port.name);
121
+ }
122
+ }
123
+ map.set(nodeMeta.id, { input, output });
124
+ }
125
+ return map;
126
+ }
127
+ /**
128
+ * Attempts to resolve a node's full definition from its metadata.
129
+ *
130
+ * Accepts either a decorated Model class/instance (resolved via
131
+ * `graphDefinitionOf`) or a plain `GraphNodeDefinition`-shaped object
132
+ * (useful for serialized workflows that inline node definitions).
133
+ */
134
+ resolveNodeDefinition(nodeMeta) {
135
+ if (nodeMeta.node) {
136
+ if (this.isRawDefinition(nodeMeta.node)) {
137
+ return nodeMeta.node;
138
+ }
139
+ try {
140
+ const def = graphDefinitionOf(nodeMeta.node);
141
+ return def;
142
+ }
143
+ catch {
144
+ return undefined;
145
+ }
146
+ }
147
+ return undefined;
148
+ }
149
+ /**
150
+ * Returns `true` when a value looks like a raw {@link GraphNodeDefinition}
151
+ * (a plain object with a `ports` array and a `name` string).
152
+ */
153
+ isRawDefinition(value) {
154
+ return (typeof value === "object" &&
155
+ value !== null &&
156
+ !Array.isArray(value) &&
157
+ typeof value.name === "string" &&
158
+ Array.isArray(value.ports));
159
+ }
160
+ /**
161
+ * Creates a stable edge id from its endpoints and ports.
162
+ */
163
+ createEdgeId(sourceNodeId, sourcePort, targetNodeId, targetPort) {
164
+ return `${sourceNodeId}:${sourcePort}->${targetNodeId}:${targetPort}`;
165
+ }
166
+ }
167
+ //# sourceMappingURL=GraphRelationResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphRelationResolver.js","sourceRoot":"","sources":["../../../../src/graph/planning/GraphRelationResolver.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,uBAAuB,EAAE,0BAAqB;AACvD,OAAO,EAAE,cAAc,EAAE,sCAAiC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,0CAAqC;AAGlE;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAChC;;;;;;;OAOG;IACH,OAAO,CAAC,QAAiC;QACvC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACzD,MAAM,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QACvD,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACnD,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACrD,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAEpD,MAAM,KAAK,GAA6B,EAAE,CAAC;QAE3C,KAAK,MAAM,QAAQ,IAAI,QAAQ,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;YAChD,MAAM,IAAI,GAAG,IAAI,CAAC,eAAe,CAC/B,QAAQ,EACR,OAAO,EACP,eAAe,EACf,UAAU,EACV,WAAW,EACX,WA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UAAkB,EAClB,YAAoB,EACpB,UAAkB;QAElB,OAAO,GAAG,YAAY,IAAI,UAAU,KAAK,YAAY,IAAI,UAAU,EAAE,CAAC;IACxE,CAAC;CACF"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Topology utility for traversing the execution plan's edges.
3
+ */
4
+ export class GraphTopology {
5
+ /**
6
+ * Returns the set of upstream node ids reachable from `nodeId` by following
7
+ * incoming edges. The workflow boundary node is excluded.
8
+ */
9
+ static upstreamNodes(nodeId, incomingByNode, includeBoundary = false) {
10
+ const visited = new Set();
11
+ const stack = [nodeId];
12
+ while (stack.length) {
13
+ const current = stack.pop();
14
+ const incoming = incomingByNode.get(current) ?? [];
15
+ for (const edge of incoming) {
16
+ if (!includeBoundary && this.isBoundary(edge.sourceNodeId))
17
+ continue;
18
+ if (!visited.has(edge.sourceNodeId)) {
19
+ visited.add(edge.sourceNodeId);
20
+ stack.push(edge.sourceNodeId);
21
+ }
22
+ }
23
+ }
24
+ return visited;
25
+ }
26
+ /**
27
+ * Returns the set of downstream node ids reachable from `nodeId` by following
28
+ * outgoing edges. The workflow boundary node is excluded.
29
+ */
30
+ static downstreamNodes(nodeId, outgoingByNode, includeBoundary = false) {
31
+ const visited = new Set();
32
+ const stack = [nodeId];
33
+ while (stack.length) {
34
+ const current = stack.pop();
35
+ const outgoing = outgoingByNode.get(current) ?? [];
36
+ for (const edge of outgoing) {
37
+ if (!includeBoundary && this.isBoundary(edge.targetNodeId))
38
+ continue;
39
+ if (!visited.has(edge.targetNodeId)) {
40
+ visited.add(edge.targetNodeId);
41
+ stack.push(edge.targetNodeId);
42
+ }
43
+ }
44
+ }
45
+ return visited;
46
+ }
47
+ /** Returns whether a node id is the workflow boundary. */
48
+ static isBoundary(nodeId) {
49
+ return nodeId === "$workflow";
50
+ }
51
+ }
52
+ //# sourceMappingURL=GraphTopology.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphTopology.js","sourceRoot":"","sources":["../../../../src/graph/planning/GraphT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AE,CAAC;gBAC5B,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC;oBAAE,SAAS;gBACrE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;oBACpC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;oBAC/B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBAChC,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,0DAA0D;IAC1D,MAAM,CAAC,UAAU,CAAC,MAAc;QAC9B,OAAO,MAAM,KAAK,WAAW,CAAC;IAChC,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @module integrations/graph/planning
3
+ * @summary Graph execution planning.
4
+ * @description Re-exports the execution plan types, relation resolver, and topological planner.
5
+ */
6
+ export * from "./GraphExecutionPlanNode.js";
7
+ export * from "./GraphExecutionPlanEdge.js";
8
+ export * from "./GraphExecutionPlanLayer.js";
9
+ export * from "./GraphExecutionPlan.js";
10
+ export * from "./GraphRelationResolver.js";
11
+ export * from "./GraphExecutionPlanner.js";
12
+ export * from "./GraphTopology.js";
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/graph/planning/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,4CAAyC;AACzC,4CAAyC;AACzC,6CAA0C;AAC1C,wCAAqC;AACrC,2CAAwC;AACxC,2CAAwC;AACxC,mCAAgC"}
@@ -0,0 +1,39 @@
1
+ import { GraphExecutionError } from "./../errors/GraphExecutionError.js";
2
+ /**
3
+ * Registry that maps node `kind` strings to {@link GraphNodeExecutor}
4
+ * instances.
5
+ */
6
+ export class GraphNodeExecutorRegistry {
7
+ constructor() {
8
+ this.executors = new Map();
9
+ }
10
+ /** Registers an executor for the given node kind. */
11
+ register(kind, executor) {
12
+ if (!kind)
13
+ throw new GraphExecutionError("Graph executor kind is required");
14
+ this.executors.set(kind, executor);
15
+ return this;
16
+ }
17
+ /** Removes the executor for the given node kind. */
18
+ unregister(kind) {
19
+ this.executors.delete(kind);
20
+ return this;
21
+ }
22
+ /** Returns whether an executor is registered for the given kind. */
23
+ has(kind) {
24
+ return this.executors.has(kind);
25
+ }
26
+ /**
27
+ * Resolves the executor for the given node kind.
28
+ *
29
+ * @throws {GraphExecutionError} when no executor is registered for `kind`.
30
+ */
31
+ resolve(kind) {
32
+ const executor = this.executors.get(kind);
33
+ if (!executor) {
34
+ throw new GraphExecutionError(`No graph executor registered for kind '${kind}'`, "GRAPH_EXECUTOR_NOT_FOUND", { kind });
35
+ }
36
+ return executor;
37
+ }
38
+ }
39
+ //# sourceMappingURL=GraphNodeExecutorRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNodeExecutorRegistry.js","sourceRoot":"","sources":["../../../../src/graph/registry/GraphNodeExecutorRegistry.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,2CAAsC;AAEpE;;;GAGG;AACH,MAAM,OAAO,yBAAyB;IAAtC;QACmB,cAAS,GAAG,IAAI,GAAG,EAA6B,CAAC;IAoCpE,CAAC;IAlCC,qDAAqD;IACrD,QAAQ,CAAC,IAAY,EAAE,QAA2B;QAChD,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,mBAAmB,CAAC,iCAAiC,CAAC,CAAC;QAC5E,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oDAAoD;IACpD,UAAU,CAAC,IAAY;QACrB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oEAAoE;IACpE,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,IAAY;QAClB,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,mBAAmB,CAC3B,0CAA0C,IAAI,GAAG,EACjD,0BAA0B,EAC1B,EAAE,IAAI,EAAE,CACT,CAAC;QACJ,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Resolver that wraps a {@link GraphNodeExecutorRegistry} and optionally
3
+ * falls back to a default executor when a kind is not found.
4
+ */
5
+ export class GraphNodeExecutorResolver {
6
+ constructor(registry, defaultExecutor) {
7
+ this.registry = registry;
8
+ this.defaultExecutor = defaultExecutor;
9
+ }
10
+ /**
11
+ * Resolves the executor for `kind`, falling back to the default executor
12
+ * when provided.
13
+ */
14
+ resolve(kind) {
15
+ if (this.registry.has(kind))
16
+ return this.registry.resolve(kind);
17
+ if (this.defaultExecutor)
18
+ return this.defaultExecutor;
19
+ return this.registry.resolve(kind);
20
+ }
21
+ }
22
+ //# sourceMappingURL=GraphNodeExecutorResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphNodeExecutorResolver.js","sourceRoot":"","sources":["../../../../src/graph/registry/GraphNodeExecutorResolver.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,MAAM,OAAO,yBAAyB;IAGpC,YACmB,QAAmC,EACpD,eAAmC;QADlB,aAAQ,GAAR,QAAQ,CAA2B;QAGpD,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,IAAY;QAClB,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChE,IAAI,IAAI,CAAC,eAAe;YAAE,OAAO,IAAI,CAAC,eAAe,CAAC;QACtD,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @module integrations/graph/registry
3
+ * @summary Graph node executor registry and resolver.
4
+ * @description Re-exports the executor registry and resolver.
5
+ */
6
+ export * from "./GraphNodeExecutorRegistry.js";
7
+ export * from "./GraphNodeExecutorResolver.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/graph/registry/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,+CAA4C;AAC5C,+CAA4C"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @module integrations/graph/snapshots/GraphExecutionSnapshotMapper
3
+ * @summary Maps execution results to snapshot patches.
4
+ * @description Produces a GraphExecutionSnapshotPatch consumable by `@decaf-ts/ui-decorators/graph` snapshots, rather than replacing the snapshot system.
5
+ */
6
+ import { GraphExecutionStatus } from "./../constants.js";
7
+ /**
8
+ * Maps a {@link GraphExecutionResult} to a {@link GraphExecutionSnapshotPatch}.
9
+ */
10
+ export class GraphExecutionSnapshotMapper {
11
+ /**
12
+ * Creates a snapshot patch from an execution result.
13
+ */
14
+ map(result) {
15
+ const nodes = {};
16
+ for (const [id, nodeResult] of Object.entries(result.nodeResults)) {
17
+ nodes[id] = {
18
+ status: nodeResult.status,
19
+ startedAt: nodeResult.startedAt?.toISOString(),
20
+ finishedAt: nodeResult.finishedAt?.toISOString(),
21
+ error: nodeResult.error,
22
+ outputs: nodeResult.outputs,
23
+ fromCache: nodeResult.fromCache,
24
+ pinned: nodeResult.pinned,
25
+ };
26
+ }
27
+ const edges = {};
28
+ for (const event of result.events) {
29
+ if (event.edgeId && event.type === "edge.valueRouted") {
30
+ edges[event.edgeId] = {
31
+ status: GraphExecutionStatus.SUCCEEDED,
32
+ lastValue: event.payload?.value,
33
+ updatedAt: event.timestamp.toISOString(),
34
+ };
35
+ }
36
+ }
37
+ const events = [...result.events];
38
+ return {
39
+ runId: result.runId,
40
+ status: result.status,
41
+ nodes,
42
+ edges,
43
+ outputs: result.outputs,
44
+ events,
45
+ };
46
+ }
47
+ }
48
+ //# sourceMappingURL=GraphExecutionSnapshotMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphExecutionSnapshotMapper.js","sourceRoot":"","sources":["../../../../src/graph/snapshots/GraphExecutionSnapshotMapper.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,oBAAoB,EAAE,0BAAqB;AAOpD;;GAEG;AACH,MAAM,OAAO,4BAA4B;IACvC;;OAEG;IACH,GAAG,CAAC,MAA4B;QAC9B,MAAM,KAAK,GAAyC,EAAE,CAAC;QACvD,KAAK,MAAM,CAAC,EAAE,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;YAClE,KAAK,CAAC,EAAE,CAAC,GAAG;gBACV,MAAM,EAAE,UAAU,CAAC,MAAM;gBACzB,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,WAAW,EAAE;gBAC9C,UAAU,EAAE,UAAU,CAAC,UAAU,EAAE,WAAW,EAAE;gBAChD,KAAK,EAAE,UAAU,CAAC,KAAK;gBACvB,OAAO,EAAE,UAAU,CAAC,OAAO;gBAC3B,SAAS,EAAE,UAAU,CAAC,SAAS;gBAC/B,MAAM,EAAE,UAAU,CAAC,MAAM;aAC1B,CAAC;QACJ,CAAC;QAED,MAAM,KAAK,GAAyC,EAAE,CAAC;QACvD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClC,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;gBACtD,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG;oBACpB,MAAM,EAAE,oBAAoB,CAAC,SAAS;oBACtC,SAAS,EAAG,KAAK,CAAC,OAAe,EAAE,KAAK;oBACxC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE;iBACzC,CAAC;YACJ,CAAC;QACH,CAAC;QAED,MAAM,MAAM,GAA0B,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QAEzD,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,KAAK;YACL,KAAK;YACL,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,MAAM;SACP,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @module integrations/graph/snapshots
3
+ * @summary Graph execution snapshot mapping.
4
+ * @description Re-exports the snapshot patch mapper.
5
+ */
6
+ export * from "./GraphExecutionSnapshotMapper.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/graph/snapshots/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAA+C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=GraphCachedValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphCachedValue.js","sourceRoot":"","sources":["../../../../src/graph/store/GraphCachedValue.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @module integrations/graph/store/GraphValueKey
3
+ * @summary Stable key for cached graph values.
4
+ * @description Identifies a cached value in the store by workflow, node, fingerprint, and optional namespace/version.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=GraphValueKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphValueKey.js","sourceRoot":"","sources":["../../../../src/graph/store/GraphValueKey.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}