@ajna-inc/workflow 0.5.38 → 0.6.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 (337) hide show
  1. package/.npmvc/attestations.jsonld +43 -0
  2. package/.npmvc/sbom.cdx.json +23758 -0
  3. package/LICENSE +202 -0
  4. package/build/WorkflowEvents.d.mts +40 -0
  5. package/build/WorkflowEvents.d.mts.map +1 -0
  6. package/build/WorkflowEvents.mjs +11 -0
  7. package/build/WorkflowEvents.mjs.map +1 -0
  8. package/build/WorkflowModule.d.mts +17 -0
  9. package/build/WorkflowModule.d.mts.map +1 -0
  10. package/build/WorkflowModule.mjs +446 -0
  11. package/build/WorkflowModule.mjs.map +1 -0
  12. package/build/WorkflowModuleConfig.d.mts +39 -0
  13. package/build/WorkflowModuleConfig.d.mts.map +1 -0
  14. package/build/WorkflowModuleConfig.mjs +19 -0
  15. package/build/WorkflowModuleConfig.mjs.map +1 -0
  16. package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorate.mjs +14 -0
  17. package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateMetadata.mjs +11 -0
  18. package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateParam.mjs +9 -0
  19. package/build/_virtual/rolldown_runtime.mjs +41 -0
  20. package/build/actions/ActionRegistry.d.mts +64 -0
  21. package/build/actions/ActionRegistry.d.mts.map +1 -0
  22. package/build/actions/ActionRegistry.mjs +304 -0
  23. package/build/actions/ActionRegistry.mjs.map +1 -0
  24. package/build/api/WorkflowApi.d.mts +99 -0
  25. package/build/api/WorkflowApi.d.mts.map +1 -0
  26. package/build/api/WorkflowApi.mjs +228 -0
  27. package/build/api/WorkflowApi.mjs.map +1 -0
  28. package/build/engine/AttributePlanner.d.mts +12 -0
  29. package/build/engine/AttributePlanner.d.mts.map +1 -0
  30. package/build/engine/AttributePlanner.mjs +58 -0
  31. package/build/engine/AttributePlanner.mjs.map +1 -0
  32. package/build/engine/GuardEvaluator.d.mts +16 -0
  33. package/build/engine/GuardEvaluator.d.mts.map +1 -0
  34. package/build/engine/GuardEvaluator.mjs +38 -0
  35. package/build/engine/GuardEvaluator.mjs.map +1 -0
  36. package/build/index.d.mts +46 -0
  37. package/build/index.mjs +53 -0
  38. package/build/index.mjs.map +1 -0
  39. package/build/model/TemplateValidation.d.mts +8 -0
  40. package/build/model/TemplateValidation.d.mts.map +1 -0
  41. package/build/model/TemplateValidation.mjs +278 -0
  42. package/build/model/TemplateValidation.mjs.map +1 -0
  43. package/build/model/types.d.mts +120 -0
  44. package/build/model/types.d.mts.map +1 -0
  45. package/build/model/types.mjs +11 -0
  46. package/build/model/types.mjs.map +1 -0
  47. package/build/protocol/WorkflowMessageTypes.d.mts +19 -0
  48. package/build/protocol/WorkflowMessageTypes.d.mts.map +1 -0
  49. package/build/protocol/WorkflowMessageTypes.mjs +20 -0
  50. package/build/protocol/WorkflowMessageTypes.mjs.map +1 -0
  51. package/build/protocol/handlers/AdvanceHandler.d.mts +16 -0
  52. package/build/protocol/handlers/AdvanceHandler.d.mts.map +1 -0
  53. package/build/protocol/handlers/AdvanceHandler.mjs +148 -0
  54. package/build/protocol/handlers/AdvanceHandler.mjs.map +1 -0
  55. package/build/protocol/handlers/CancelHandler.d.mts +16 -0
  56. package/build/protocol/handlers/CancelHandler.d.mts.map +1 -0
  57. package/build/protocol/handlers/CancelHandler.mjs +103 -0
  58. package/build/protocol/handlers/CancelHandler.mjs.map +1 -0
  59. package/build/protocol/handlers/CompleteHandler.d.mts +16 -0
  60. package/build/protocol/handlers/CompleteHandler.d.mts.map +1 -0
  61. package/build/protocol/handlers/CompleteHandler.mjs +103 -0
  62. package/build/protocol/handlers/CompleteHandler.mjs.map +1 -0
  63. package/build/protocol/handlers/DiscoverHandler.d.mts +15 -0
  64. package/build/protocol/handlers/DiscoverHandler.d.mts.map +1 -0
  65. package/build/protocol/handlers/DiscoverHandler.mjs +73 -0
  66. package/build/protocol/handlers/DiscoverHandler.mjs.map +1 -0
  67. package/build/protocol/handlers/FetchTemplateHandler.d.mts +16 -0
  68. package/build/protocol/handlers/FetchTemplateHandler.d.mts.map +1 -0
  69. package/build/protocol/handlers/FetchTemplateHandler.mjs +64 -0
  70. package/build/protocol/handlers/FetchTemplateHandler.mjs.map +1 -0
  71. package/build/protocol/handlers/PauseHandler.d.mts +16 -0
  72. package/build/protocol/handlers/PauseHandler.d.mts.map +1 -0
  73. package/build/protocol/handlers/PauseHandler.mjs +103 -0
  74. package/build/protocol/handlers/PauseHandler.mjs.map +1 -0
  75. package/build/protocol/handlers/ProblemReportHandler.d.mts +11 -0
  76. package/build/protocol/handlers/ProblemReportHandler.d.mts.map +1 -0
  77. package/build/protocol/handlers/ProblemReportHandler.mjs +26 -0
  78. package/build/protocol/handlers/ProblemReportHandler.mjs.map +1 -0
  79. package/build/protocol/handlers/PublishTemplateHandler.d.mts +15 -0
  80. package/build/protocol/handlers/PublishTemplateHandler.d.mts.map +1 -0
  81. package/build/protocol/handlers/PublishTemplateHandler.mjs +47 -0
  82. package/build/protocol/handlers/PublishTemplateHandler.mjs.map +1 -0
  83. package/build/protocol/handlers/ResumeHandler.d.mts +16 -0
  84. package/build/protocol/handlers/ResumeHandler.d.mts.map +1 -0
  85. package/build/protocol/handlers/ResumeHandler.mjs +103 -0
  86. package/build/protocol/handlers/ResumeHandler.mjs.map +1 -0
  87. package/build/protocol/handlers/StartHandler.d.mts +16 -0
  88. package/build/protocol/handlers/StartHandler.d.mts.map +1 -0
  89. package/build/protocol/handlers/StartHandler.mjs +238 -0
  90. package/build/protocol/handlers/StartHandler.mjs.map +1 -0
  91. package/build/protocol/handlers/StatusHandler.d.mts +16 -0
  92. package/build/protocol/handlers/StatusHandler.d.mts.map +1 -0
  93. package/build/protocol/handlers/StatusHandler.mjs +169 -0
  94. package/build/protocol/handlers/StatusHandler.mjs.map +1 -0
  95. package/build/protocol/handlers/TemplateHandler.d.mts +14 -0
  96. package/build/protocol/handlers/TemplateHandler.d.mts.map +1 -0
  97. package/build/protocol/handlers/TemplateHandler.mjs +66 -0
  98. package/build/protocol/handlers/TemplateHandler.mjs.map +1 -0
  99. package/build/protocol/messages/AdvanceMessage.d.mts +22 -0
  100. package/build/protocol/messages/AdvanceMessage.d.mts.map +1 -0
  101. package/build/protocol/messages/AdvanceMessage.mjs +25 -0
  102. package/build/protocol/messages/AdvanceMessage.mjs.map +1 -0
  103. package/build/protocol/messages/CancelMessage.d.mts +20 -0
  104. package/build/protocol/messages/CancelMessage.d.mts.map +1 -0
  105. package/build/protocol/messages/CancelMessage.mjs +25 -0
  106. package/build/protocol/messages/CancelMessage.mjs.map +1 -0
  107. package/build/protocol/messages/CompleteMessage.d.mts +20 -0
  108. package/build/protocol/messages/CompleteMessage.d.mts.map +1 -0
  109. package/build/protocol/messages/CompleteMessage.mjs +25 -0
  110. package/build/protocol/messages/CompleteMessage.mjs.map +1 -0
  111. package/build/protocol/messages/DiscoverMessage.d.mts +29 -0
  112. package/build/protocol/messages/DiscoverMessage.d.mts.map +1 -0
  113. package/build/protocol/messages/DiscoverMessage.mjs +25 -0
  114. package/build/protocol/messages/DiscoverMessage.mjs.map +1 -0
  115. package/build/protocol/messages/FetchTemplateMessage.d.mts +21 -0
  116. package/build/protocol/messages/FetchTemplateMessage.d.mts.map +1 -0
  117. package/build/protocol/messages/FetchTemplateMessage.mjs +31 -0
  118. package/build/protocol/messages/FetchTemplateMessage.mjs.map +1 -0
  119. package/build/protocol/messages/PauseMessage.d.mts +20 -0
  120. package/build/protocol/messages/PauseMessage.d.mts.map +1 -0
  121. package/build/protocol/messages/PauseMessage.mjs +25 -0
  122. package/build/protocol/messages/PauseMessage.mjs.map +1 -0
  123. package/build/protocol/messages/ProblemReportMessage.d.mts +21 -0
  124. package/build/protocol/messages/ProblemReportMessage.d.mts.map +1 -0
  125. package/build/protocol/messages/ProblemReportMessage.mjs +25 -0
  126. package/build/protocol/messages/ProblemReportMessage.mjs.map +1 -0
  127. package/build/protocol/messages/PublishTemplateMessage.d.mts +23 -0
  128. package/build/protocol/messages/PublishTemplateMessage.d.mts.map +1 -0
  129. package/build/protocol/messages/PublishTemplateMessage.mjs +24 -0
  130. package/build/protocol/messages/PublishTemplateMessage.mjs.map +1 -0
  131. package/build/protocol/messages/ResumeMessage.d.mts +20 -0
  132. package/build/protocol/messages/ResumeMessage.d.mts.map +1 -0
  133. package/build/protocol/messages/ResumeMessage.mjs +25 -0
  134. package/build/protocol/messages/ResumeMessage.mjs.map +1 -0
  135. package/build/protocol/messages/StartMessage.d.mts +27 -0
  136. package/build/protocol/messages/StartMessage.d.mts.map +1 -0
  137. package/build/protocol/messages/StartMessage.mjs +25 -0
  138. package/build/protocol/messages/StartMessage.mjs.map +1 -0
  139. package/build/protocol/messages/StatusMessage.d.mts +35 -0
  140. package/build/protocol/messages/StatusMessage.d.mts.map +1 -0
  141. package/build/protocol/messages/StatusMessage.mjs +25 -0
  142. package/build/protocol/messages/StatusMessage.mjs.map +1 -0
  143. package/build/protocol/messages/StatusRequestMessage.d.mts +29 -0
  144. package/build/protocol/messages/StatusRequestMessage.d.mts.map +1 -0
  145. package/build/protocol/messages/StatusRequestMessage.mjs +25 -0
  146. package/build/protocol/messages/StatusRequestMessage.mjs.map +1 -0
  147. package/build/protocol/messages/TemplateMessage.d.mts +20 -0
  148. package/build/protocol/messages/TemplateMessage.d.mts.map +1 -0
  149. package/build/protocol/messages/TemplateMessage.mjs +25 -0
  150. package/build/protocol/messages/TemplateMessage.mjs.map +1 -0
  151. package/build/protocol/messages/WorkflowsMessage.d.mts +28 -0
  152. package/build/protocol/messages/WorkflowsMessage.d.mts.map +1 -0
  153. package/build/protocol/messages/WorkflowsMessage.mjs +25 -0
  154. package/build/protocol/messages/WorkflowsMessage.mjs.map +1 -0
  155. package/build/queue/CommandQueue.d.mts +22 -0
  156. package/build/queue/CommandQueue.d.mts.map +1 -0
  157. package/build/queue/CommandQueue.mjs +6 -0
  158. package/build/queue/CommandQueue.mjs.map +1 -0
  159. package/build/queue/PersistentCommandQueue.d.mts +56 -0
  160. package/build/queue/PersistentCommandQueue.d.mts.map +1 -0
  161. package/build/queue/PersistentCommandQueue.mjs +273 -0
  162. package/build/queue/PersistentCommandQueue.mjs.map +1 -0
  163. package/build/repository/WorkflowCommandRecord.d.mts +50 -0
  164. package/build/repository/WorkflowCommandRecord.d.mts.map +1 -0
  165. package/build/repository/WorkflowCommandRecord.mjs +48 -0
  166. package/build/repository/WorkflowCommandRecord.mjs.map +1 -0
  167. package/build/repository/WorkflowCommandRepository.d.mts +59 -0
  168. package/build/repository/WorkflowCommandRepository.d.mts.map +1 -0
  169. package/build/repository/WorkflowCommandRepository.mjs +136 -0
  170. package/build/repository/WorkflowCommandRepository.mjs.map +1 -0
  171. package/build/repository/WorkflowInstanceRecord.d.mts +65 -0
  172. package/build/repository/WorkflowInstanceRecord.d.mts.map +1 -0
  173. package/build/repository/WorkflowInstanceRecord.mjs +44 -0
  174. package/build/repository/WorkflowInstanceRecord.mjs.map +1 -0
  175. package/build/repository/WorkflowInstanceRepository.d.mts +15 -0
  176. package/build/repository/WorkflowInstanceRepository.d.mts.map +1 -0
  177. package/build/repository/WorkflowInstanceRepository.mjs +48 -0
  178. package/build/repository/WorkflowInstanceRepository.mjs.map +1 -0
  179. package/build/repository/WorkflowTemplateRecord.d.mts +27 -0
  180. package/build/repository/WorkflowTemplateRecord.d.mts.map +1 -0
  181. package/build/repository/WorkflowTemplateRecord.mjs +29 -0
  182. package/build/repository/WorkflowTemplateRecord.mjs.map +1 -0
  183. package/build/repository/WorkflowTemplateRepository.d.mts +11 -0
  184. package/build/repository/WorkflowTemplateRepository.d.mts.map +1 -0
  185. package/build/repository/WorkflowTemplateRepository.mjs +43 -0
  186. package/build/repository/WorkflowTemplateRepository.mjs.map +1 -0
  187. package/build/services/WorkflowService.d.mts +107 -0
  188. package/build/services/WorkflowService.d.mts.map +1 -0
  189. package/build/services/WorkflowService.mjs +582 -0
  190. package/build/services/WorkflowService.mjs.map +1 -0
  191. package/build/ui/UiFilter.mjs +85 -0
  192. package/build/ui/UiFilter.mjs.map +1 -0
  193. package/package.json +27 -33
  194. package/build/WorkflowEvents.d.ts +0 -35
  195. package/build/WorkflowEvents.js +0 -10
  196. package/build/WorkflowEvents.js.map +0 -1
  197. package/build/WorkflowModule.d.ts +0 -13
  198. package/build/WorkflowModule.js +0 -647
  199. package/build/WorkflowModule.js.map +0 -1
  200. package/build/WorkflowModuleConfig.d.ts +0 -35
  201. package/build/WorkflowModuleConfig.js +0 -19
  202. package/build/WorkflowModuleConfig.js.map +0 -1
  203. package/build/actions/ActionRegistry.d.ts +0 -59
  204. package/build/actions/ActionRegistry.js +0 -367
  205. package/build/actions/ActionRegistry.js.map +0 -1
  206. package/build/api/WorkflowApi.d.ts +0 -94
  207. package/build/api/WorkflowApi.js +0 -241
  208. package/build/api/WorkflowApi.js.map +0 -1
  209. package/build/engine/AttributePlanner.d.ts +0 -7
  210. package/build/engine/AttributePlanner.js +0 -81
  211. package/build/engine/AttributePlanner.js.map +0 -1
  212. package/build/engine/GuardEvaluator.d.ts +0 -11
  213. package/build/engine/GuardEvaluator.js +0 -40
  214. package/build/engine/GuardEvaluator.js.map +0 -1
  215. package/build/index.d.ts +0 -45
  216. package/build/index.js +0 -69
  217. package/build/index.js.map +0 -1
  218. package/build/model/TemplateValidation.d.ts +0 -3
  219. package/build/model/TemplateValidation.js +0 -231
  220. package/build/model/TemplateValidation.js.map +0 -1
  221. package/build/model/types.d.ts +0 -116
  222. package/build/model/types.js +0 -15
  223. package/build/model/types.js.map +0 -1
  224. package/build/protocol/WorkflowMessageTypes.d.ts +0 -15
  225. package/build/protocol/WorkflowMessageTypes.js +0 -22
  226. package/build/protocol/WorkflowMessageTypes.js.map +0 -1
  227. package/build/protocol/handlers/AdvanceHandler.d.ts +0 -12
  228. package/build/protocol/handlers/AdvanceHandler.js +0 -149
  229. package/build/protocol/handlers/AdvanceHandler.js.map +0 -1
  230. package/build/protocol/handlers/CancelHandler.d.ts +0 -12
  231. package/build/protocol/handlers/CancelHandler.js +0 -124
  232. package/build/protocol/handlers/CancelHandler.js.map +0 -1
  233. package/build/protocol/handlers/CompleteHandler.d.ts +0 -12
  234. package/build/protocol/handlers/CompleteHandler.js +0 -125
  235. package/build/protocol/handlers/CompleteHandler.js.map +0 -1
  236. package/build/protocol/handlers/DiscoverHandler.d.ts +0 -11
  237. package/build/protocol/handlers/DiscoverHandler.js +0 -71
  238. package/build/protocol/handlers/DiscoverHandler.js.map +0 -1
  239. package/build/protocol/handlers/FetchTemplateHandler.d.ts +0 -12
  240. package/build/protocol/handlers/FetchTemplateHandler.js +0 -71
  241. package/build/protocol/handlers/FetchTemplateHandler.js.map +0 -1
  242. package/build/protocol/handlers/PauseHandler.d.ts +0 -12
  243. package/build/protocol/handlers/PauseHandler.js +0 -124
  244. package/build/protocol/handlers/PauseHandler.js.map +0 -1
  245. package/build/protocol/handlers/ProblemReportHandler.d.ts +0 -6
  246. package/build/protocol/handlers/ProblemReportHandler.js +0 -28
  247. package/build/protocol/handlers/ProblemReportHandler.js.map +0 -1
  248. package/build/protocol/handlers/PublishTemplateHandler.d.ts +0 -11
  249. package/build/protocol/handlers/PublishTemplateHandler.js +0 -53
  250. package/build/protocol/handlers/PublishTemplateHandler.js.map +0 -1
  251. package/build/protocol/handlers/ResumeHandler.d.ts +0 -12
  252. package/build/protocol/handlers/ResumeHandler.js +0 -124
  253. package/build/protocol/handlers/ResumeHandler.js.map +0 -1
  254. package/build/protocol/handlers/StartHandler.d.ts +0 -12
  255. package/build/protocol/handlers/StartHandler.js +0 -274
  256. package/build/protocol/handlers/StartHandler.js.map +0 -1
  257. package/build/protocol/handlers/StatusHandler.d.ts +0 -12
  258. package/build/protocol/handlers/StatusHandler.js +0 -202
  259. package/build/protocol/handlers/StatusHandler.js.map +0 -1
  260. package/build/protocol/handlers/TemplateHandler.d.ts +0 -9
  261. package/build/protocol/handlers/TemplateHandler.js +0 -83
  262. package/build/protocol/handlers/TemplateHandler.js.map +0 -1
  263. package/build/protocol/messages/AdvanceMessage.d.ts +0 -16
  264. package/build/protocol/messages/AdvanceMessage.js +0 -33
  265. package/build/protocol/messages/AdvanceMessage.js.map +0 -1
  266. package/build/protocol/messages/CancelMessage.d.ts +0 -14
  267. package/build/protocol/messages/CancelMessage.js +0 -33
  268. package/build/protocol/messages/CancelMessage.js.map +0 -1
  269. package/build/protocol/messages/CompleteMessage.d.ts +0 -14
  270. package/build/protocol/messages/CompleteMessage.js +0 -33
  271. package/build/protocol/messages/CompleteMessage.js.map +0 -1
  272. package/build/protocol/messages/DiscoverMessage.d.ts +0 -23
  273. package/build/protocol/messages/DiscoverMessage.js +0 -33
  274. package/build/protocol/messages/DiscoverMessage.js.map +0 -1
  275. package/build/protocol/messages/FetchTemplateMessage.d.ts +0 -15
  276. package/build/protocol/messages/FetchTemplateMessage.js +0 -33
  277. package/build/protocol/messages/FetchTemplateMessage.js.map +0 -1
  278. package/build/protocol/messages/PauseMessage.d.ts +0 -14
  279. package/build/protocol/messages/PauseMessage.js +0 -33
  280. package/build/protocol/messages/PauseMessage.js.map +0 -1
  281. package/build/protocol/messages/ProblemReportMessage.d.ts +0 -15
  282. package/build/protocol/messages/ProblemReportMessage.js +0 -33
  283. package/build/protocol/messages/ProblemReportMessage.js.map +0 -1
  284. package/build/protocol/messages/PublishTemplateMessage.d.ts +0 -17
  285. package/build/protocol/messages/PublishTemplateMessage.js +0 -31
  286. package/build/protocol/messages/PublishTemplateMessage.js.map +0 -1
  287. package/build/protocol/messages/ResumeMessage.d.ts +0 -14
  288. package/build/protocol/messages/ResumeMessage.js +0 -33
  289. package/build/protocol/messages/ResumeMessage.js.map +0 -1
  290. package/build/protocol/messages/StartMessage.d.ts +0 -21
  291. package/build/protocol/messages/StartMessage.js +0 -33
  292. package/build/protocol/messages/StartMessage.js.map +0 -1
  293. package/build/protocol/messages/StatusMessage.d.ts +0 -29
  294. package/build/protocol/messages/StatusMessage.js +0 -33
  295. package/build/protocol/messages/StatusMessage.js.map +0 -1
  296. package/build/protocol/messages/StatusRequestMessage.d.ts +0 -23
  297. package/build/protocol/messages/StatusRequestMessage.js +0 -33
  298. package/build/protocol/messages/StatusRequestMessage.js.map +0 -1
  299. package/build/protocol/messages/TemplateMessage.d.ts +0 -14
  300. package/build/protocol/messages/TemplateMessage.js +0 -33
  301. package/build/protocol/messages/TemplateMessage.js.map +0 -1
  302. package/build/protocol/messages/WorkflowsMessage.d.ts +0 -22
  303. package/build/protocol/messages/WorkflowsMessage.js +0 -33
  304. package/build/protocol/messages/WorkflowsMessage.js.map +0 -1
  305. package/build/queue/CommandQueue.d.ts +0 -18
  306. package/build/queue/CommandQueue.js +0 -8
  307. package/build/queue/CommandQueue.js.map +0 -1
  308. package/build/queue/PersistentCommandQueue.d.ts +0 -51
  309. package/build/queue/PersistentCommandQueue.js +0 -348
  310. package/build/queue/PersistentCommandQueue.js.map +0 -1
  311. package/build/repository/WorkflowCommandRecord.d.ts +0 -46
  312. package/build/repository/WorkflowCommandRecord.js +0 -52
  313. package/build/repository/WorkflowCommandRecord.js.map +0 -1
  314. package/build/repository/WorkflowCommandRepository.d.ts +0 -55
  315. package/build/repository/WorkflowCommandRepository.js +0 -149
  316. package/build/repository/WorkflowCommandRepository.js.map +0 -1
  317. package/build/repository/WorkflowInstanceRecord.d.ts +0 -61
  318. package/build/repository/WorkflowInstanceRecord.js +0 -43
  319. package/build/repository/WorkflowInstanceRecord.js.map +0 -1
  320. package/build/repository/WorkflowInstanceRepository.d.ts +0 -10
  321. package/build/repository/WorkflowInstanceRepository.js +0 -52
  322. package/build/repository/WorkflowInstanceRepository.js.map +0 -1
  323. package/build/repository/WorkflowTemplateRecord.d.ts +0 -23
  324. package/build/repository/WorkflowTemplateRecord.js +0 -28
  325. package/build/repository/WorkflowTemplateRecord.js.map +0 -1
  326. package/build/repository/WorkflowTemplateRepository.d.ts +0 -6
  327. package/build/repository/WorkflowTemplateRepository.js +0 -56
  328. package/build/repository/WorkflowTemplateRepository.js.map +0 -1
  329. package/build/services/WorkflowService.d.ts +0 -102
  330. package/build/services/WorkflowService.js +0 -712
  331. package/build/services/WorkflowService.js.map +0 -1
  332. package/build/ui/UiFilter.d.ts +0 -5
  333. package/build/ui/UiFilter.js +0 -104
  334. package/build/ui/UiFilter.js.map +0 -1
  335. package/build/ui/UiTypes.d.ts +0 -28
  336. package/build/ui/UiTypes.js +0 -3
  337. package/build/ui/UiTypes.js.map +0 -1
@@ -1,124 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CancelHandler = void 0;
13
- const core_1 = require("@credo-ts/core");
14
- const WorkflowModuleConfig_1 = require("../../WorkflowModuleConfig");
15
- const CommandQueue_1 = require("../../queue/CommandQueue");
16
- const WorkflowService_1 = require("../../services/WorkflowService");
17
- const CancelMessage_1 = require("../messages/CancelMessage");
18
- const ProblemReportMessage_1 = require("../messages/ProblemReportMessage");
19
- const StatusMessage_1 = require("../messages/StatusMessage");
20
- const WorkflowInstanceRepository_1 = require("../../repository/WorkflowInstanceRepository");
21
- let CancelHandler = class CancelHandler {
22
- constructor(service) {
23
- this.service = service;
24
- this.supportedMessages = [CancelMessage_1.CancelMessage];
25
- }
26
- async handle(messageContext) {
27
- const dm = messageContext.agentContext.dependencyManager;
28
- const logger = dm.resolve(core_1.AgentConfig).logger;
29
- const config = dm.resolve(WorkflowModuleConfig_1.WorkflowModuleConfig);
30
- const instId = messageContext.message.body?.instance_id;
31
- const thid = messageContext.message.threadId || messageContext.message.id;
32
- logger.info('[Workflow] cancel received', { instance_id: instId, thid });
33
- // Strict correlation: thid MUST equal instance_id
34
- try {
35
- const _id = messageContext.message.body?.instance_id;
36
- if (_id && thid && _id !== thid) {
37
- throw Object.assign(new Error('threadId does not match instance_id'), { code: 'correlation_mismatch' });
38
- }
39
- }
40
- catch (_e) {
41
- void 0;
42
- }
43
- try {
44
- // Enforce inbound connection matches instance binding
45
- const inboundConnId = messageContext.connection?.id;
46
- const instIdBody = messageContext.message.body?.instance_id;
47
- if (!inboundConnId || !instIdBody) {
48
- throw Object.assign(new Error('missing inbound connection'), { code: 'forbidden' });
49
- }
50
- const repo = messageContext.agentContext.dependencyManager.resolve(WorkflowInstanceRepository_1.WorkflowInstanceRepository);
51
- const instRec = await repo.getByInstanceId(messageContext.agentContext, instIdBody);
52
- if (!instRec) {
53
- throw Object.assign(new Error('instance not found'), { code: 'invalid_event' });
54
- }
55
- if (instRec.connectionId && instRec.connectionId !== inboundConnId) {
56
- throw Object.assign(new Error('connection mismatch'), { code: 'forbidden' });
57
- }
58
- // Enqueue command for async processing (always async now)
59
- const queue = dm.resolve(CommandQueue_1.CommandQueueService);
60
- if (queue && typeof queue.enqueue === 'function' && typeof queue.isReady === 'function') {
61
- const ready = await queue.isReady();
62
- if (ready) {
63
- await queue.enqueue(messageContext.agentContext, {
64
- cmd: 'cancel',
65
- thid: instIdBody,
66
- connectionId: inboundConnId,
67
- payload: messageContext.message.body,
68
- contextCorrelationId: messageContext.agentContext.contextCorrelationId,
69
- });
70
- // Immediate response with CURRENT state
71
- const status = await this.service.status(messageContext.agentContext, { instance_id: instIdBody }, instRec);
72
- const reply = new StatusMessage_1.StatusMessage({ thid, body: status });
73
- return new core_1.OutboundMessageContext(reply, {
74
- agentContext: messageContext.agentContext,
75
- inboundMessageContext: messageContext,
76
- connection: messageContext.connection,
77
- });
78
- }
79
- }
80
- // Fallback: queue not available, process synchronously
81
- logger.warn('[Workflow] Queue not available for cancel, processing synchronously');
82
- const updated = await this.service.cancel(messageContext.agentContext, messageContext.message.body, instRec);
83
- const status = await this.service.status(messageContext.agentContext, { instance_id: instId }, updated);
84
- const reply = new StatusMessage_1.StatusMessage({ thid, body: status });
85
- return new core_1.OutboundMessageContext(reply, {
86
- agentContext: messageContext.agentContext,
87
- inboundMessageContext: messageContext,
88
- connection: messageContext.connection,
89
- });
90
- }
91
- catch (e) {
92
- if (e?.code === 'invalid_event') {
93
- logger.info('[Workflow] cancel ignored (no local instance)', { instance_id: instId });
94
- return undefined;
95
- }
96
- if (config.enableProblemReport && messageContext.connection) {
97
- const code = e.code;
98
- const normalize = (c) => (c === 'queue_unavailable' ? 'temporary_unavailable' : c || 'action_error');
99
- const body = {
100
- code: normalize(code),
101
- comment: e.message,
102
- };
103
- if (code === 'queue_unavailable')
104
- body.args = { subcode: 'queue_unavailable' };
105
- const pr = new ProblemReportMessage_1.ProblemReportMessage({
106
- thid: messageContext.message.threadId || messageContext.message.id,
107
- body,
108
- });
109
- return new core_1.OutboundMessageContext(pr, {
110
- agentContext: messageContext.agentContext,
111
- inboundMessageContext: messageContext,
112
- connection: messageContext.connection,
113
- });
114
- }
115
- throw e;
116
- }
117
- }
118
- };
119
- exports.CancelHandler = CancelHandler;
120
- exports.CancelHandler = CancelHandler = __decorate([
121
- (0, core_1.injectable)(),
122
- __metadata("design:paramtypes", [WorkflowService_1.WorkflowService])
123
- ], CancelHandler);
124
- //# sourceMappingURL=CancelHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CancelHandler.js","sourceRoot":"","sources":["../../../src/protocol/handlers/CancelHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,yCAAgF;AAEhF,qEAAiE;AACjE,2DAA8D;AAC9D,oEAAgE;AAChE,6DAAyD;AACzD,2EAAuE;AACvE,6DAAyD;AACzD,4FAAwF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AAI,CAAC,+CAA+C,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAA;gBACrF,OAAO,SAAS,CAAA;YAClB,CAAC;YACD,IAAI,MAAM,CAAC,mBAAmB,IAAI,cAAc,CAAC,UAAU,EAAE,CAAC;gBAC5D,MAAM,IAAI,GAAI,CAAuB,CAAC,IAAI,CAAA;gBAC1C,MAAM,SAAS,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,mBAAmB,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,CAAA;gBAC7G,MAAM,IAAI,GAAsE;oBAC9E,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC;oBACrB,OAAO,EAAG,CAAW,CAAC,OAAO;iBAC9B,CAAA;gBACD,IAAI,IAAI,KAAK,mBAAmB;oBAAE,IAAI,CAAC,IAAI,GAAG,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAA;gBAC9E,MAAM,EAAE,GAAG,IAAI,2CAAoB,CAAC;oBAClC,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,QAAQ,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE;oBAClE,IAAI;iBACL,CAAC,CAAA;gBACF,OAAO,IAAI,6BAAsB,CAAC,EAAE,EAAE;oBACpC,YAAY,EAAE,cAAc,CAAC,YAAY;oBACzC,qBAAqB,EAAE,cAAc;oBACrC,UAAU,EAAE,cAAc,CAAC,UAAU;iBACtC,CAAC,CAAA;YACJ,CAAC;YACD,MAAM,CAAC,CAAA;QACT,CAAC;IACH,CAAC;CACF,CAAA;AAnGY,sCAAa;wBAAb,aAAa;IADzB,IAAA,iBAAU,GAAE;qCAGkC,iCAAe;GAFjD,aAAa,CAmGzB"}
@@ -1,12 +0,0 @@
1
- import type { MessageHandler, MessageHandlerInboundMessage } from '@credo-ts/core';
2
- import { OutboundMessageContext } from '@credo-ts/core';
3
- import { WorkflowService } from '../../services/WorkflowService';
4
- import { CompleteMessage } from '../messages/CompleteMessage';
5
- import { ProblemReportMessage } from '../messages/ProblemReportMessage';
6
- import { StatusMessage } from '../messages/StatusMessage';
7
- export declare class CompleteHandler implements MessageHandler {
8
- private readonly service;
9
- supportedMessages: (typeof CompleteMessage)[];
10
- constructor(service: WorkflowService);
11
- handle(messageContext: MessageHandlerInboundMessage<CompleteHandler>): Promise<OutboundMessageContext<StatusMessage> | OutboundMessageContext<ProblemReportMessage> | undefined>;
12
- }
@@ -1,125 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CompleteHandler = void 0;
13
- const core_1 = require("@credo-ts/core");
14
- const WorkflowModuleConfig_1 = require("../../WorkflowModuleConfig");
15
- const CommandQueue_1 = require("../../queue/CommandQueue");
16
- const WorkflowService_1 = require("../../services/WorkflowService");
17
- const CompleteMessage_1 = require("../messages/CompleteMessage");
18
- const ProblemReportMessage_1 = require("../messages/ProblemReportMessage");
19
- const StatusMessage_1 = require("../messages/StatusMessage");
20
- const WorkflowInstanceRepository_1 = require("../../repository/WorkflowInstanceRepository");
21
- let CompleteHandler = class CompleteHandler {
22
- constructor(service) {
23
- this.service = service;
24
- this.supportedMessages = [CompleteMessage_1.CompleteMessage];
25
- }
26
- async handle(messageContext) {
27
- const dm = messageContext.agentContext.dependencyManager;
28
- const logger = dm.resolve(core_1.AgentConfig).logger;
29
- const config = dm.resolve(WorkflowModuleConfig_1.WorkflowModuleConfig);
30
- const instId = messageContext.message.body?.instance_id;
31
- const thid = messageContext.message.threadId || messageContext.message.id;
32
- logger.info('[Workflow] complete received', { instance_id: instId, thid });
33
- // Strict correlation: thid MUST equal instance_id
34
- try {
35
- const _id = messageContext.message.body?.instance_id;
36
- if (_id && thid && _id !== thid) {
37
- throw Object.assign(new Error('threadId does not match instance_id'), { code: 'correlation_mismatch' });
38
- }
39
- }
40
- catch (_e) {
41
- void 0;
42
- }
43
- try {
44
- // Enforce inbound connection matches instance binding
45
- const inboundConnId = messageContext.connection?.id;
46
- const instIdBody = messageContext.message.body?.instance_id;
47
- if (!inboundConnId || !instIdBody) {
48
- throw Object.assign(new Error('missing inbound connection'), { code: 'forbidden' });
49
- }
50
- const repo = messageContext.agentContext.dependencyManager.resolve(WorkflowInstanceRepository_1.WorkflowInstanceRepository);
51
- const instRec = await repo.getByInstanceId(messageContext.agentContext, instIdBody);
52
- if (!instRec) {
53
- throw Object.assign(new Error('instance not found'), { code: 'invalid_event' });
54
- }
55
- if (instRec.connectionId && instRec.connectionId !== inboundConnId) {
56
- throw Object.assign(new Error('connection mismatch'), { code: 'forbidden' });
57
- }
58
- // Enqueue command for async processing (always async now)
59
- const queue = dm.resolve(CommandQueue_1.CommandQueueService);
60
- if (queue && typeof queue.enqueue === 'function' && typeof queue.isReady === 'function') {
61
- const ready = await queue.isReady();
62
- if (ready) {
63
- await queue.enqueue(messageContext.agentContext, {
64
- cmd: 'complete',
65
- thid: instIdBody,
66
- connectionId: inboundConnId,
67
- payload: messageContext.message.body,
68
- contextCorrelationId: messageContext.agentContext.contextCorrelationId,
69
- });
70
- // Immediate response with CURRENT state
71
- const status = await this.service.status(messageContext.agentContext, { instance_id: instIdBody }, instRec);
72
- const reply = new StatusMessage_1.StatusMessage({ thid, body: status });
73
- return new core_1.OutboundMessageContext(reply, {
74
- agentContext: messageContext.agentContext,
75
- inboundMessageContext: messageContext,
76
- connection: messageContext.connection,
77
- });
78
- }
79
- }
80
- // Fallback: queue not available, process synchronously
81
- logger.warn('[Workflow] Queue not available for complete, processing synchronously');
82
- const updated = await this.service.complete(messageContext.agentContext, messageContext.message.body, instRec);
83
- const status = await this.service.status(messageContext.agentContext, { instance_id: instId }, updated);
84
- const reply = new StatusMessage_1.StatusMessage({ thid, body: status });
85
- return new core_1.OutboundMessageContext(reply, {
86
- agentContext: messageContext.agentContext,
87
- inboundMessageContext: messageContext,
88
- connection: messageContext.connection,
89
- });
90
- }
91
- catch (e) {
92
- // If the receiving agent doesn't host the instance, ignore silently (no problem-report)
93
- if (e?.code === 'invalid_event') {
94
- logger.info('[Workflow] complete ignored (no local instance)', { instance_id: instId });
95
- return undefined;
96
- }
97
- if (config.enableProblemReport && messageContext.connection) {
98
- const code = e.code;
99
- const normalize = (c) => (c === 'queue_unavailable' ? 'temporary_unavailable' : c || 'action_error');
100
- const body = {
101
- code: normalize(code),
102
- comment: e.message,
103
- };
104
- if (code === 'queue_unavailable')
105
- body.args = { subcode: 'queue_unavailable' };
106
- const pr = new ProblemReportMessage_1.ProblemReportMessage({
107
- thid,
108
- body,
109
- });
110
- return new core_1.OutboundMessageContext(pr, {
111
- agentContext: messageContext.agentContext,
112
- inboundMessageContext: messageContext,
113
- connection: messageContext.connection,
114
- });
115
- }
116
- throw e;
117
- }
118
- }
119
- };
120
- exports.CompleteHandler = CompleteHandler;
121
- exports.CompleteHandler = CompleteHandler = __decorate([
122
- (0, core_1.injectable)(),
123
- __metadata("design:paramtypes", [WorkflowService_1.WorkflowService])
124
- ], CompleteHandler);
125
- //# sourceMappingURL=CompleteHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CompleteHandler.js","sourceRoot":"","sources":["../../../src/protocol/handlers/CompleteHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,yCAAgF;AAEhF,qEAAiE;AACjE,2DAA8D;AAC9D,oEAAgE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ACxF,IAAK,CAAuB,EAAE,IAAI,KAAK,eAAe,EAAE,CAAC;gBACvD,MAAM,CAAC,IAAI,CAAC,iDAAiD,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAA;gBACvF,OAAO,SAAS,CAAA;YAClB,CAAC;YACD,IAAI,MAAM,CAAC,mBAAmB,IAAI,cAAc,CAAC,UAAU,EAAE,CAAC;gBAC5D,MAAM,IAAI,GAAI,CAAuB,CAAC,IAAI,CAAA;gBAC1C,MAAM,SAAS,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,mBAAmB,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,CAAA;gBAC7G,MAAM,IAAI,GAAsE;oBAC9E,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC;oBACrB,OAAO,EAAG,CAAW,CAAC,OAAO;iBAC9B,CAAA;gBACD,IAAI,IAAI,KAAK,mBAAmB;oBAAE,IAAI,CAAC,IAAI,GAAG,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAA;gBAC9E,MAAM,EAAE,GAAG,IAAI,2CAAoB,CAAC;oBAClC,IAAI;oBACJ,IAAI;iBACL,CAAC,CAAA;gBACF,OAAO,IAAI,6BAAsB,CAAC,EAAE,EAAE;oBACpC,YAAY,EAAE,cAAc,CAAC,YAAY;oBACzC,qBAAqB,EAAE,cAAc;oBACrC,UAAU,EAAE,cAAc,CAAC,UAAU;iBACtC,CAAC,CAAA;YACJ,CAAC;YACD,MAAM,CAAC,CAAA;QACT,CAAC;IACH,CAAC;CACF,CAAA;AApGY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,iBAAU,GAAE;qCAGkC,iCAAe;GAFjD,eAAe,CAoG3B"}
@@ -1,11 +0,0 @@
1
- import type { MessageHandler, MessageHandlerInboundMessage } from '@credo-ts/core';
2
- import { OutboundMessageContext } from '@credo-ts/core';
3
- import { WorkflowTemplateRepository } from '../../repository/WorkflowTemplateRepository';
4
- import { DiscoverMessage } from '../messages/DiscoverMessage';
5
- import { WorkflowsMessage } from '../messages/WorkflowsMessage';
6
- export declare class DiscoverHandler implements MessageHandler {
7
- private readonly templateRepo;
8
- supportedMessages: (typeof DiscoverMessage)[];
9
- constructor(templateRepo: WorkflowTemplateRepository);
10
- handle(messageContext: MessageHandlerInboundMessage<DiscoverHandler>): Promise<OutboundMessageContext<WorkflowsMessage>>;
11
- }
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.DiscoverHandler = void 0;
13
- const core_1 = require("@credo-ts/core");
14
- const WorkflowTemplateRepository_1 = require("../../repository/WorkflowTemplateRepository");
15
- const DiscoverMessage_1 = require("../messages/DiscoverMessage");
16
- const WorkflowsMessage_1 = require("../messages/WorkflowsMessage");
17
- let DiscoverHandler = class DiscoverHandler {
18
- constructor(templateRepo) {
19
- this.templateRepo = templateRepo;
20
- this.supportedMessages = [DiscoverMessage_1.DiscoverMessage];
21
- }
22
- async handle(messageContext) {
23
- const dm = messageContext.agentContext.dependencyManager;
24
- const logger = dm.resolve(core_1.AgentConfig).logger;
25
- const { filters, paging, include_hash } = messageContext.message.body || {};
26
- logger.info('[Workflow] discover received', { filters, include_hash });
27
- const all = await this.templateRepo.getAll(messageContext.agentContext);
28
- const filtered = all.filter((r) => {
29
- const matchesId = !filters?.template_id || r.template.template_id === filters?.template_id;
30
- const matchesVer = !filters?.version || r.template.version === filters?.version;
31
- return matchesId && matchesVer;
32
- });
33
- const byId = new Map();
34
- for (const rec of filtered) {
35
- const arr = byId.get(rec.template.template_id) || [];
36
- arr.push(rec);
37
- byId.set(rec.template.template_id, arr);
38
- }
39
- const items = [];
40
- for (const [templateId, recs] of byId.entries()) {
41
- const versions = recs.map((r) => r.template.version).sort((a, b) => b.localeCompare(a));
42
- const title = recs[0]?.template?.title;
43
- let hash;
44
- if (include_hash && versions.length === 1) {
45
- hash = recs[0]?.hash;
46
- }
47
- items.push({ template_id: templateId, versions, title, ...(hash ? { hash } : {}) });
48
- }
49
- // Simple paging
50
- const offset = paging?.offset ?? 0;
51
- const limit = paging?.limit ?? items.length;
52
- const pageItems = items.slice(offset, offset + limit);
53
- const body = { workflows: pageItems, paging: { total: items.length, next_offset: offset + pageItems.length } };
54
- const reply = new WorkflowsMessage_1.WorkflowsMessage({
55
- thid: messageContext.message.threadId || messageContext.message.id,
56
- body,
57
- });
58
- return new core_1.OutboundMessageContext(reply, {
59
- agentContext: messageContext.agentContext,
60
- // reply over the same inbound session when available for faster turnaround
61
- inboundMessageContext: messageContext,
62
- connection: messageContext.connection,
63
- });
64
- }
65
- };
66
- exports.DiscoverHandler = DiscoverHandler;
67
- exports.DiscoverHandler = DiscoverHandler = __decorate([
68
- (0, core_1.injectable)(),
69
- __metadata("design:paramtypes", [WorkflowTemplateRepository_1.WorkflowTemplateRepository])
70
- ], DiscoverHandler);
71
- //# sourceMappingURL=DiscoverHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DiscoverHandler.js","sourceRoot":"","sources":["../../../src/protocol/handlers/DiscoverHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,yCAAgF;AAEhF,4FAAwF;AACxF,iEAA6D;AAC7D,mEAA+D;AAGxD,IAAM,eAAe,GAArB,MAAM,eAAe;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AAM,GAAG,SAAS,CAAC,MAAM,EAAE,EAAE,CAAA;QAC9G,MAAM,KAAK,GAAG,IAAI,mCAAgB,CAAC;YACjC,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,QAAQ,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE;YAClE,IAAI;SACL,CAAC,CAAA;QACF,OAAO,IAAI,6BAAsB,CAAC,KAAK,EAAE;YACvC,YAAY,EAAE,cAAc,CAAC,YAAY;YACzC,2EAA2E;YAC3E,qBAAqB,EAAE,cAAc;YACrC,UAAU,EAAE,cAAc,CAAC,UAAU;SACtC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAjDY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,iBAAU,GAAE;qCAIuC,uDAA0B;GAHjE,eAAe,CAiD3B"}
@@ -1,12 +0,0 @@
1
- import type { MessageHandler, MessageHandlerInboundMessage } from '@credo-ts/core';
2
- import { OutboundMessageContext } from '@credo-ts/core';
3
- import { WorkflowTemplateRepository } from '../../repository/WorkflowTemplateRepository';
4
- import { FetchTemplateMessage } from '../messages/FetchTemplateMessage';
5
- import { ProblemReportMessage } from '../messages/ProblemReportMessage';
6
- import { TemplateMessage } from '../messages/TemplateMessage';
7
- export declare class FetchTemplateHandler implements MessageHandler {
8
- private readonly templateRepo;
9
- supportedMessages: (typeof FetchTemplateMessage)[];
10
- constructor(templateRepo: WorkflowTemplateRepository);
11
- handle(messageContext: MessageHandlerInboundMessage<FetchTemplateHandler>): Promise<OutboundMessageContext<ProblemReportMessage> | OutboundMessageContext<TemplateMessage>>;
12
- }
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.FetchTemplateHandler = void 0;
13
- const core_1 = require("@credo-ts/core");
14
- const WorkflowModuleConfig_1 = require("../../WorkflowModuleConfig");
15
- const WorkflowTemplateRepository_1 = require("../../repository/WorkflowTemplateRepository");
16
- const FetchTemplateMessage_1 = require("../messages/FetchTemplateMessage");
17
- const ProblemReportMessage_1 = require("../messages/ProblemReportMessage");
18
- const TemplateMessage_1 = require("../messages/TemplateMessage");
19
- let FetchTemplateHandler = class FetchTemplateHandler {
20
- constructor(templateRepo) {
21
- this.templateRepo = templateRepo;
22
- this.supportedMessages = [FetchTemplateMessage_1.FetchTemplateMessage];
23
- }
24
- async handle(messageContext) {
25
- const dm = messageContext.agentContext.dependencyManager;
26
- const logger = dm.resolve(core_1.AgentConfig).logger;
27
- const config = dm.resolve(WorkflowModuleConfig_1.WorkflowModuleConfig);
28
- const { template_id, template_version, prefer_hash } = messageContext.message.body || {};
29
- const thid = messageContext.message.threadId || messageContext.message.id;
30
- logger.info('[Workflow] fetch-template received', { template_id, template_version, thid });
31
- try {
32
- const rec = await this.templateRepo.findByTemplateIdAndVersion(messageContext.agentContext, template_id, template_version);
33
- if (!rec)
34
- throw Object.assign(new Error('template not found'), { code: 'not_found_remote_template' });
35
- if (prefer_hash && rec.hash && prefer_hash !== rec.hash) {
36
- throw Object.assign(new Error('template hash mismatch'), { code: 'not_found_remote_template' });
37
- }
38
- const reply = new TemplateMessage_1.TemplateMessage({
39
- thid,
40
- body: { template: rec.template },
41
- });
42
- return new core_1.OutboundMessageContext(reply, {
43
- agentContext: messageContext.agentContext,
44
- // reply over the same inbound session when available for faster turnaround
45
- inboundMessageContext: messageContext,
46
- connection: messageContext.connection,
47
- });
48
- }
49
- catch (e) {
50
- if (messageContext.connection) {
51
- const pr = new ProblemReportMessage_1.ProblemReportMessage({
52
- thid,
53
- body: { code: e.code || 'not_found_remote_template', comment: e.message },
54
- });
55
- return new core_1.OutboundMessageContext(pr, {
56
- agentContext: messageContext.agentContext,
57
- // reply over the same inbound session when available for faster turnaround
58
- inboundMessageContext: messageContext,
59
- connection: messageContext.connection,
60
- });
61
- }
62
- throw e;
63
- }
64
- }
65
- };
66
- exports.FetchTemplateHandler = FetchTemplateHandler;
67
- exports.FetchTemplateHandler = FetchTemplateHandler = __decorate([
68
- (0, core_1.injectable)(),
69
- __metadata("design:paramtypes", [WorkflowTemplateRepository_1.WorkflowTemplateRepository])
70
- ], FetchTemplateHandler);
71
- //# sourceMappingURL=FetchTemplateHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FetchTemplateHandler.js","sourceRoot":"","sources":["../../../src/protocol/handlers/FetchTemplateHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,yCAAgF;AAEhF,qEAAiE;AACjE,4FAAwF;AACxF,2EAAuE;AACvE,2EAAuE;AACvE,iEAA6D;AAGtD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAG/B,YAAoC,YAAwC;QAAxC,iBAAY,GAAZ,YAAY,CAA4B;QAFrE,sBAAiB,GAAG,CAAC,2CAAoB,CAAC,CAAA;IAE8B,CAAC;IAEzE,KAAK,CAAC,MAAM,CAAC,cAAkE;QACpF,MAAM,EAAE,GAAG,cAAc,CAAC,YAAY,CAAC,iBAAiB,CAAA;QACxD,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,kBAAW,CAAC,CAAC,MAAM,CAAA;QAC7C,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,2CAAoB,CAAC,CAAA;QAC/C,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,GAAG,cAAc,CAAC,OAAO,CA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G,CAAuB,CAAC,IAAI,IAAI,2BAA2B,EAAE,OAAO,EAAG,CAAW,CAAC,OAAO,EAAE;iBAC5G,CAAC,CAAA;gBACF,OAAO,IAAI,6BAAsB,CAAC,EAAE,EAAE;oBACpC,YAAY,EAAE,cAAc,CAAC,YAAY;oBACzC,2EAA2E;oBAC3E,qBAAqB,EAAE,cAAc;oBACrC,UAAU,EAAE,cAAc,CAAC,UAAU;iBACtC,CAAC,CAAA;YACJ,CAAC;YACD,MAAM,CAAC,CAAA;QACT,CAAC;IACH,CAAC;CACF,CAAA;AAjDY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,iBAAU,GAAE;qCAIuC,uDAA0B;GAHjE,oBAAoB,CAiDhC"}
@@ -1,12 +0,0 @@
1
- import type { MessageHandler, MessageHandlerInboundMessage } from '@credo-ts/core';
2
- import { OutboundMessageContext } from '@credo-ts/core';
3
- import { WorkflowService } from '../../services/WorkflowService';
4
- import { PauseMessage } from '../messages/PauseMessage';
5
- import { ProblemReportMessage } from '../messages/ProblemReportMessage';
6
- import { StatusMessage } from '../messages/StatusMessage';
7
- export declare class PauseHandler implements MessageHandler {
8
- private readonly service;
9
- supportedMessages: (typeof PauseMessage)[];
10
- constructor(service: WorkflowService);
11
- handle(messageContext: MessageHandlerInboundMessage<PauseHandler>): Promise<OutboundMessageContext<StatusMessage> | OutboundMessageContext<ProblemReportMessage> | undefined>;
12
- }
@@ -1,124 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.PauseHandler = void 0;
13
- const core_1 = require("@credo-ts/core");
14
- const WorkflowModuleConfig_1 = require("../../WorkflowModuleConfig");
15
- const CommandQueue_1 = require("../../queue/CommandQueue");
16
- const WorkflowService_1 = require("../../services/WorkflowService");
17
- const PauseMessage_1 = require("../messages/PauseMessage");
18
- const ProblemReportMessage_1 = require("../messages/ProblemReportMessage");
19
- const StatusMessage_1 = require("../messages/StatusMessage");
20
- const WorkflowInstanceRepository_1 = require("../../repository/WorkflowInstanceRepository");
21
- let PauseHandler = class PauseHandler {
22
- constructor(service) {
23
- this.service = service;
24
- this.supportedMessages = [PauseMessage_1.PauseMessage];
25
- }
26
- async handle(messageContext) {
27
- const dm = messageContext.agentContext.dependencyManager;
28
- const logger = dm.resolve(core_1.AgentConfig).logger;
29
- const config = dm.resolve(WorkflowModuleConfig_1.WorkflowModuleConfig);
30
- const instId = messageContext.message.body?.instance_id;
31
- const thid = messageContext.message.threadId || messageContext.message.id;
32
- logger.info('[Workflow] pause received', { instance_id: instId, thid });
33
- // Strict correlation: thid MUST equal instance_id
34
- try {
35
- const _id = messageContext.message.body?.instance_id;
36
- if (_id && thid && _id !== thid) {
37
- throw Object.assign(new Error('threadId does not match instance_id'), { code: 'correlation_mismatch' });
38
- }
39
- }
40
- catch (_e) {
41
- void 0;
42
- }
43
- try {
44
- // Enforce inbound connection matches instance binding
45
- const inboundConnId = messageContext.connection?.id;
46
- const instIdBody = messageContext.message.body?.instance_id;
47
- if (!inboundConnId || !instIdBody) {
48
- throw Object.assign(new Error('missing inbound connection'), { code: 'forbidden' });
49
- }
50
- const repo = messageContext.agentContext.dependencyManager.resolve(WorkflowInstanceRepository_1.WorkflowInstanceRepository);
51
- const instRec = await repo.getByInstanceId(messageContext.agentContext, instIdBody);
52
- if (!instRec) {
53
- throw Object.assign(new Error('instance not found'), { code: 'invalid_event' });
54
- }
55
- if (instRec.connectionId && instRec.connectionId !== inboundConnId) {
56
- throw Object.assign(new Error('connection mismatch'), { code: 'forbidden' });
57
- }
58
- // Enqueue command for async processing (always async now)
59
- const queue = dm.resolve(CommandQueue_1.CommandQueueService);
60
- if (queue && typeof queue.enqueue === 'function' && typeof queue.isReady === 'function') {
61
- const ready = await queue.isReady();
62
- if (ready) {
63
- await queue.enqueue(messageContext.agentContext, {
64
- cmd: 'pause',
65
- thid: instIdBody,
66
- connectionId: inboundConnId,
67
- payload: messageContext.message.body,
68
- contextCorrelationId: messageContext.agentContext.contextCorrelationId,
69
- });
70
- // Immediate response with CURRENT state
71
- const status = await this.service.status(messageContext.agentContext, { instance_id: instIdBody }, instRec);
72
- const reply = new StatusMessage_1.StatusMessage({ thid, body: status });
73
- return new core_1.OutboundMessageContext(reply, {
74
- agentContext: messageContext.agentContext,
75
- inboundMessageContext: messageContext,
76
- connection: messageContext.connection,
77
- });
78
- }
79
- }
80
- // Fallback: queue not available, process synchronously
81
- logger.warn('[Workflow] Queue not available for pause, processing synchronously');
82
- const updated = await this.service.pause(messageContext.agentContext, messageContext.message.body, instRec);
83
- const status = await this.service.status(messageContext.agentContext, { instance_id: instId }, updated);
84
- const reply = new StatusMessage_1.StatusMessage({ thid, body: status });
85
- return new core_1.OutboundMessageContext(reply, {
86
- agentContext: messageContext.agentContext,
87
- inboundMessageContext: messageContext,
88
- connection: messageContext.connection,
89
- });
90
- }
91
- catch (e) {
92
- if (e?.code === 'invalid_event') {
93
- logger.info('[Workflow] pause ignored (no local instance)', { instance_id: instId });
94
- return undefined;
95
- }
96
- if (config.enableProblemReport && messageContext.connection) {
97
- const code = e.code;
98
- const normalize = (c) => (c === 'queue_unavailable' ? 'temporary_unavailable' : c || 'action_error');
99
- const body = {
100
- code: normalize(code),
101
- comment: e.message,
102
- };
103
- if (code === 'queue_unavailable')
104
- body.args = { subcode: 'queue_unavailable' };
105
- const pr = new ProblemReportMessage_1.ProblemReportMessage({
106
- thid: messageContext.message.threadId || messageContext.message.id,
107
- body,
108
- });
109
- return new core_1.OutboundMessageContext(pr, {
110
- agentContext: messageContext.agentContext,
111
- inboundMessageContext: messageContext,
112
- connection: messageContext.connection,
113
- });
114
- }
115
- throw e;
116
- }
117
- }
118
- };
119
- exports.PauseHandler = PauseHandler;
120
- exports.PauseHandler = PauseHandler = __decorate([
121
- (0, core_1.injectable)(),
122
- __metadata("design:paramtypes", [WorkflowService_1.WorkflowService])
123
- ], PauseHandler);
124
- //# sourceMappingURL=PauseHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PauseHandler.js","sourceRoot":"","sources":["../../../src/protocol/handlers/PauseHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,yCAAgF;AAEhF,qEAAiE;AACjE,2DAA8D;AAC9D,oEAAgE;AAChE,2DAAuD;AACvD,2EAAuE;AACvE,6DAAyD;AACzD,4FAAwF;AAGjF,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEvB,YAAoC,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;QADrD,sBAAiB,GAAG,CAAC,2BAAY,CAAC,CAAA;IACsB,CAAC;IACzD,KAAK,CAAC,MAAM,CAAC,cAA0D;QAC5E,MAAM,EAAE,GAAG,cAAc,CAAC,YAAY,CAAC,iBAAiB,CAAA;QACxD,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,kBAAW,CAAC,CAAC,MAAM,CAAA;QAC7C,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,2CAAoB,CAAC,CAAA;QAC/C,MAAM,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAA;QACvD,MAAM,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,QAAQ,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE,CAAA;QACzE,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE,EAAE,WAAW,EA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AG,IAAI,2CAAoB,CAAC;oBAClC,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,QAAQ,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE;oBAClE,IAAI;iBACL,CAAC,CAAA;gBACF,OAAO,IAAI,6BAAsB,CAAC,EAAE,EAAE;oBACpC,YAAY,EAAE,cAAc,CAAC,YAAY;oBACzC,qBAAqB,EAAE,cAAc;oBACrC,UAAU,EAAE,cAAc,CAAC,UAAU;iBACtC,CAAC,CAAA;YACJ,CAAC;YACD,MAAM,CAAC,CAAA;QACT,CAAC;IACH,CAAC;CACF,CAAA;AAnGY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,iBAAU,GAAE;qCAGkC,iCAAe;GAFjD,YAAY,CAmGxB"}
@@ -1,6 +0,0 @@
1
- import type { MessageHandler, MessageHandlerInboundMessage } from '@credo-ts/core';
2
- import { ProblemReportMessage } from '../messages/ProblemReportMessage';
3
- export declare class ProblemReportHandler implements MessageHandler {
4
- supportedMessages: (typeof ProblemReportMessage)[];
5
- handle(messageContext: MessageHandlerInboundMessage<ProblemReportHandler>): Promise<undefined>;
6
- }