@travisliu/open-dynamic-workflow 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (466) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/LICENSE +21 -0
  3. package/README.md +312 -0
  4. package/dist/agents/antigravity-cli.d.ts +19 -0
  5. package/dist/agents/antigravity-cli.js +177 -0
  6. package/dist/agents/antigravity-cli.js.map +1 -0
  7. package/dist/agents/codex-exec.d.ts +12 -0
  8. package/dist/agents/codex-exec.js +283 -0
  9. package/dist/agents/codex-exec.js.map +1 -0
  10. package/dist/agents/execute-agent.d.ts +21 -0
  11. package/dist/agents/execute-agent.js +593 -0
  12. package/dist/agents/execute-agent.js.map +1 -0
  13. package/dist/agents/execution-types.d.ts +20 -0
  14. package/dist/agents/execution-types.js +2 -0
  15. package/dist/agents/execution-types.js.map +1 -0
  16. package/dist/agents/gemini-cli.d.ts +14 -0
  17. package/dist/agents/gemini-cli.js +176 -0
  18. package/dist/agents/gemini-cli.js.map +1 -0
  19. package/dist/agents/github-copilot-cli.d.ts +16 -0
  20. package/dist/agents/github-copilot-cli.js +256 -0
  21. package/dist/agents/github-copilot-cli.js.map +1 -0
  22. package/dist/agents/mock-adapter.d.ts +12 -0
  23. package/dist/agents/mock-adapter.js +66 -0
  24. package/dist/agents/mock-adapter.js.map +1 -0
  25. package/dist/agents/model-args.d.ts +2 -0
  26. package/dist/agents/model-args.js +15 -0
  27. package/dist/agents/model-args.js.map +1 -0
  28. package/dist/agents/opencode-cli.d.ts +22 -0
  29. package/dist/agents/opencode-cli.js +245 -0
  30. package/dist/agents/opencode-cli.js.map +1 -0
  31. package/dist/agents/pi-coding-agent.d.ts +31 -0
  32. package/dist/agents/pi-coding-agent.js +317 -0
  33. package/dist/agents/pi-coding-agent.js.map +1 -0
  34. package/dist/agents/process-runner.d.ts +2 -0
  35. package/dist/agents/process-runner.js +130 -0
  36. package/dist/agents/process-runner.js.map +1 -0
  37. package/dist/agents/provider-health.d.ts +3 -0
  38. package/dist/agents/provider-health.js +30 -0
  39. package/dist/agents/provider-health.js.map +1 -0
  40. package/dist/agents/registry.d.ts +12 -0
  41. package/dist/agents/registry.js +45 -0
  42. package/dist/agents/registry.js.map +1 -0
  43. package/dist/agents/resolve-model.d.ts +11 -0
  44. package/dist/agents/resolve-model.js +30 -0
  45. package/dist/agents/resolve-model.js.map +1 -0
  46. package/dist/agents/types.d.ts +2 -0
  47. package/dist/agents/types.js +2 -0
  48. package/dist/agents/types.js.map +1 -0
  49. package/dist/artifacts/call-cache.d.ts +117 -0
  50. package/dist/artifacts/call-cache.js +449 -0
  51. package/dist/artifacts/call-cache.js.map +1 -0
  52. package/dist/artifacts/logs.d.ts +13 -0
  53. package/dist/artifacts/logs.js +24 -0
  54. package/dist/artifacts/logs.js.map +1 -0
  55. package/dist/artifacts/manifest.d.ts +18 -0
  56. package/dist/artifacts/manifest.js +29 -0
  57. package/dist/artifacts/manifest.js.map +1 -0
  58. package/dist/artifacts/run-store.d.ts +22 -0
  59. package/dist/artifacts/run-store.js +148 -0
  60. package/dist/artifacts/run-store.js.map +1 -0
  61. package/dist/bin/open-dynamic-workflow.d.ts +2 -0
  62. package/dist/bin/open-dynamic-workflow.js +45 -0
  63. package/dist/bin/open-dynamic-workflow.js.map +1 -0
  64. package/dist/cli/args.d.ts +36 -0
  65. package/dist/cli/args.js +68 -0
  66. package/dist/cli/args.js.map +1 -0
  67. package/dist/cli/commands/doctor.d.ts +9 -0
  68. package/dist/cli/commands/doctor.js +109 -0
  69. package/dist/cli/commands/doctor.js.map +1 -0
  70. package/dist/cli/commands/init.d.ts +23 -0
  71. package/dist/cli/commands/init.js +147 -0
  72. package/dist/cli/commands/init.js.map +1 -0
  73. package/dist/cli/commands/list.d.ts +12 -0
  74. package/dist/cli/commands/list.js +65 -0
  75. package/dist/cli/commands/list.js.map +1 -0
  76. package/dist/cli/commands/resume.d.ts +5 -0
  77. package/dist/cli/commands/resume.js +81 -0
  78. package/dist/cli/commands/resume.js.map +1 -0
  79. package/dist/cli/commands/run.d.ts +18 -0
  80. package/dist/cli/commands/run.js +318 -0
  81. package/dist/cli/commands/run.js.map +1 -0
  82. package/dist/cli/commands/validate.d.ts +14 -0
  83. package/dist/cli/commands/validate.js +66 -0
  84. package/dist/cli/commands/validate.js.map +1 -0
  85. package/dist/cli/index.d.ts +2 -0
  86. package/dist/cli/index.js +169 -0
  87. package/dist/cli/index.js.map +1 -0
  88. package/dist/cli/init/defaults.d.ts +12 -0
  89. package/dist/cli/init/defaults.js +54 -0
  90. package/dist/cli/init/defaults.js.map +1 -0
  91. package/dist/cli/init/planner.d.ts +10 -0
  92. package/dist/cli/init/planner.js +163 -0
  93. package/dist/cli/init/planner.js.map +1 -0
  94. package/dist/cli/init/prompts.d.ts +15 -0
  95. package/dist/cli/init/prompts.js +83 -0
  96. package/dist/cli/init/prompts.js.map +1 -0
  97. package/dist/cli/init/providers.d.ts +13 -0
  98. package/dist/cli/init/providers.js +100 -0
  99. package/dist/cli/init/providers.js.map +1 -0
  100. package/dist/cli/init/renderer.d.ts +8 -0
  101. package/dist/cli/init/renderer.js +84 -0
  102. package/dist/cli/init/renderer.js.map +1 -0
  103. package/dist/cli/init/smoke-test.d.ts +15 -0
  104. package/dist/cli/init/smoke-test.js +47 -0
  105. package/dist/cli/init/smoke-test.js.map +1 -0
  106. package/dist/cli/init/summary.d.ts +11 -0
  107. package/dist/cli/init/summary.js +65 -0
  108. package/dist/cli/init/summary.js.map +1 -0
  109. package/dist/cli/init/types.d.ts +81 -0
  110. package/dist/cli/init/types.js +2 -0
  111. package/dist/cli/init/types.js.map +1 -0
  112. package/dist/cli/init/writer.d.ts +3 -0
  113. package/dist/cli/init/writer.js +57 -0
  114. package/dist/cli/init/writer.js.map +1 -0
  115. package/dist/cli/package-info.d.ts +1 -0
  116. package/dist/cli/package-info.js +13 -0
  117. package/dist/cli/package-info.js.map +1 -0
  118. package/dist/cli/paths.d.ts +2 -0
  119. package/dist/cli/paths.js +8 -0
  120. package/dist/cli/paths.js.map +1 -0
  121. package/dist/cli/print.d.ts +22 -0
  122. package/dist/cli/print.js +48 -0
  123. package/dist/cli/print.js.map +1 -0
  124. package/dist/config/defaults.d.ts +3 -0
  125. package/dist/config/defaults.js +116 -0
  126. package/dist/config/defaults.js.map +1 -0
  127. package/dist/config/load.d.ts +10 -0
  128. package/dist/config/load.js +72 -0
  129. package/dist/config/load.js.map +1 -0
  130. package/dist/config/merge.d.ts +10 -0
  131. package/dist/config/merge.js +58 -0
  132. package/dist/config/merge.js.map +1 -0
  133. package/dist/config/schema.d.ts +2 -0
  134. package/dist/config/schema.js +236 -0
  135. package/dist/config/schema.js.map +1 -0
  136. package/dist/config/types.d.ts +93 -0
  137. package/dist/config/types.js +2 -0
  138. package/dist/config/types.js.map +1 -0
  139. package/dist/discovery/collect-files.d.ts +10 -0
  140. package/dist/discovery/collect-files.js +189 -0
  141. package/dist/discovery/collect-files.js.map +1 -0
  142. package/dist/discovery/definition-call.d.ts +10 -0
  143. package/dist/discovery/definition-call.js +37 -0
  144. package/dist/discovery/definition-call.js.map +1 -0
  145. package/dist/discovery/diagnostics.d.ts +17 -0
  146. package/dist/discovery/diagnostics.js +32 -0
  147. package/dist/discovery/diagnostics.js.map +1 -0
  148. package/dist/discovery/directories.d.ts +8 -0
  149. package/dist/discovery/directories.js +32 -0
  150. package/dist/discovery/directories.js.map +1 -0
  151. package/dist/discovery/duplicate-detector.d.ts +8 -0
  152. package/dist/discovery/duplicate-detector.js +40 -0
  153. package/dist/discovery/duplicate-detector.js.map +1 -0
  154. package/dist/discovery/extract-agent.d.ts +2 -0
  155. package/dist/discovery/extract-agent.js +166 -0
  156. package/dist/discovery/extract-agent.js.map +1 -0
  157. package/dist/discovery/extract-tool.d.ts +2 -0
  158. package/dist/discovery/extract-tool.js +188 -0
  159. package/dist/discovery/extract-tool.js.map +1 -0
  160. package/dist/discovery/extract-workflow.d.ts +2 -0
  161. package/dist/discovery/extract-workflow.js +180 -0
  162. package/dist/discovery/extract-workflow.js.map +1 -0
  163. package/dist/discovery/file-patterns.d.ts +3 -0
  164. package/dist/discovery/file-patterns.js +93 -0
  165. package/dist/discovery/file-patterns.js.map +1 -0
  166. package/dist/discovery/index.d.ts +7 -0
  167. package/dist/discovery/index.js +8 -0
  168. package/dist/discovery/index.js.map +1 -0
  169. package/dist/discovery/schema-summary.d.ts +13 -0
  170. package/dist/discovery/schema-summary.js +37 -0
  171. package/dist/discovery/schema-summary.js.map +1 -0
  172. package/dist/discovery/service.d.ts +4 -0
  173. package/dist/discovery/service.js +135 -0
  174. package/dist/discovery/service.js.map +1 -0
  175. package/dist/discovery/static-values.d.ts +13 -0
  176. package/dist/discovery/static-values.js +68 -0
  177. package/dist/discovery/static-values.js.map +1 -0
  178. package/dist/discovery/types.d.ts +95 -0
  179. package/dist/discovery/types.js +2 -0
  180. package/dist/discovery/types.js.map +1 -0
  181. package/dist/doctors/public.d.ts +15 -0
  182. package/dist/doctors/public.js +2 -0
  183. package/dist/doctors/public.js.map +1 -0
  184. package/dist/errors/codes.d.ts +53 -0
  185. package/dist/errors/codes.js +53 -0
  186. package/dist/errors/codes.js.map +1 -0
  187. package/dist/errors/exit-codes.d.ts +13 -0
  188. package/dist/errors/exit-codes.js +72 -0
  189. package/dist/errors/exit-codes.js.map +1 -0
  190. package/dist/errors/list-errors.d.ts +4 -0
  191. package/dist/errors/list-errors.js +11 -0
  192. package/dist/errors/list-errors.js.map +1 -0
  193. package/dist/errors/serialize.d.ts +2 -0
  194. package/dist/errors/serialize.js +38 -0
  195. package/dist/errors/serialize.js.map +1 -0
  196. package/dist/errors/types.d.ts +15 -0
  197. package/dist/errors/types.js +13 -0
  198. package/dist/errors/types.js.map +1 -0
  199. package/dist/index.d.ts +3 -0
  200. package/dist/index.js +3 -0
  201. package/dist/index.js.map +1 -0
  202. package/dist/orchestration/cancellation.d.ts +13 -0
  203. package/dist/orchestration/cancellation.js +41 -0
  204. package/dist/orchestration/cancellation.js.map +1 -0
  205. package/dist/orchestration/event-bus.d.ts +24 -0
  206. package/dist/orchestration/event-bus.js +50 -0
  207. package/dist/orchestration/event-bus.js.map +1 -0
  208. package/dist/orchestration/fail-fast.d.ts +8 -0
  209. package/dist/orchestration/fail-fast.js +21 -0
  210. package/dist/orchestration/fail-fast.js.map +1 -0
  211. package/dist/orchestration/scheduler.d.ts +37 -0
  212. package/dist/orchestration/scheduler.js +330 -0
  213. package/dist/orchestration/scheduler.js.map +1 -0
  214. package/dist/orchestration/tool-limiter.d.ts +10 -0
  215. package/dist/orchestration/tool-limiter.js +62 -0
  216. package/dist/orchestration/tool-limiter.js.map +1 -0
  217. package/dist/output/events.d.ts +290 -0
  218. package/dist/output/events.js +10 -0
  219. package/dist/output/events.js.map +1 -0
  220. package/dist/output/failed-artifacts.d.ts +5 -0
  221. package/dist/output/failed-artifacts.js +62 -0
  222. package/dist/output/failed-artifacts.js.map +1 -0
  223. package/dist/output/json-reporter.d.ts +13 -0
  224. package/dist/output/json-reporter.js +31 -0
  225. package/dist/output/json-reporter.js.map +1 -0
  226. package/dist/output/jsonl-reporter.d.ts +12 -0
  227. package/dist/output/jsonl-reporter.js +29 -0
  228. package/dist/output/jsonl-reporter.js.map +1 -0
  229. package/dist/output/list-json-reporter.d.ts +9 -0
  230. package/dist/output/list-json-reporter.js +22 -0
  231. package/dist/output/list-json-reporter.js.map +1 -0
  232. package/dist/output/list-jsonl-reporter.d.ts +9 -0
  233. package/dist/output/list-jsonl-reporter.js +43 -0
  234. package/dist/output/list-jsonl-reporter.js.map +1 -0
  235. package/dist/output/list-pretty-reporter.d.ts +13 -0
  236. package/dist/output/list-pretty-reporter.js +120 -0
  237. package/dist/output/list-pretty-reporter.js.map +1 -0
  238. package/dist/output/list-reporter.d.ts +14 -0
  239. package/dist/output/list-reporter.js +20 -0
  240. package/dist/output/list-reporter.js.map +1 -0
  241. package/dist/output/pretty-format.d.ts +19 -0
  242. package/dist/output/pretty-format.js +75 -0
  243. package/dist/output/pretty-format.js.map +1 -0
  244. package/dist/output/pretty-renderer.d.ts +2 -0
  245. package/dist/output/pretty-renderer.js +97 -0
  246. package/dist/output/pretty-renderer.js.map +1 -0
  247. package/dist/output/pretty-reporter.d.ts +14 -0
  248. package/dist/output/pretty-reporter.js +155 -0
  249. package/dist/output/pretty-reporter.js.map +1 -0
  250. package/dist/output/pretty-view-builder.d.ts +26 -0
  251. package/dist/output/pretty-view-builder.js +374 -0
  252. package/dist/output/pretty-view-builder.js.map +1 -0
  253. package/dist/output/pretty-view.d.ts +85 -0
  254. package/dist/output/pretty-view.js +6 -0
  255. package/dist/output/pretty-view.js.map +1 -0
  256. package/dist/output/reporter.d.ts +34 -0
  257. package/dist/output/reporter.js +24 -0
  258. package/dist/output/reporter.js.map +1 -0
  259. package/dist/output/verbose-formatter.d.ts +6 -0
  260. package/dist/output/verbose-formatter.js +137 -0
  261. package/dist/output/verbose-formatter.js.map +1 -0
  262. package/dist/pipeline/artifacts.d.ts +6 -0
  263. package/dist/pipeline/artifacts.js +44 -0
  264. package/dist/pipeline/artifacts.js.map +1 -0
  265. package/dist/pipeline/concurrency.d.ts +11 -0
  266. package/dist/pipeline/concurrency.js +60 -0
  267. package/dist/pipeline/concurrency.js.map +1 -0
  268. package/dist/pipeline/context.d.ts +15 -0
  269. package/dist/pipeline/context.js +17 -0
  270. package/dist/pipeline/context.js.map +1 -0
  271. package/dist/pipeline/events.d.ts +10 -0
  272. package/dist/pipeline/events.js +83 -0
  273. package/dist/pipeline/events.js.map +1 -0
  274. package/dist/pipeline/id.d.ts +10 -0
  275. package/dist/pipeline/id.js +61 -0
  276. package/dist/pipeline/id.js.map +1 -0
  277. package/dist/pipeline/item-streaming.d.ts +3 -0
  278. package/dist/pipeline/item-streaming.js +122 -0
  279. package/dist/pipeline/item-streaming.js.map +1 -0
  280. package/dist/pipeline/results.d.ts +10 -0
  281. package/dist/pipeline/results.js +88 -0
  282. package/dist/pipeline/results.js.map +1 -0
  283. package/dist/pipeline/run.d.ts +10 -0
  284. package/dist/pipeline/run.js +93 -0
  285. package/dist/pipeline/run.js.map +1 -0
  286. package/dist/pipeline/stage-barrier.d.ts +3 -0
  287. package/dist/pipeline/stage-barrier.js +135 -0
  288. package/dist/pipeline/stage-barrier.js.map +1 -0
  289. package/dist/pipeline/stage-runner.d.ts +13 -0
  290. package/dist/pipeline/stage-runner.js +185 -0
  291. package/dist/pipeline/stage-runner.js.map +1 -0
  292. package/dist/pipeline/summary.d.ts +12 -0
  293. package/dist/pipeline/summary.js +24 -0
  294. package/dist/pipeline/summary.js.map +1 -0
  295. package/dist/pipeline/types.d.ts +92 -0
  296. package/dist/pipeline/types.js +2 -0
  297. package/dist/pipeline/types.js.map +1 -0
  298. package/dist/pipeline/validate.d.ts +11 -0
  299. package/dist/pipeline/validate.js +139 -0
  300. package/dist/pipeline/validate.js.map +1 -0
  301. package/dist/runtime/public.d.ts +3 -0
  302. package/dist/runtime/public.js +4 -0
  303. package/dist/runtime/public.js.map +1 -0
  304. package/dist/security/env.d.ts +38 -0
  305. package/dist/security/env.js +186 -0
  306. package/dist/security/env.js.map +1 -0
  307. package/dist/security/metadata.d.ts +6 -0
  308. package/dist/security/metadata.js +41 -0
  309. package/dist/security/metadata.js.map +1 -0
  310. package/dist/shared-agents/context.d.ts +2 -0
  311. package/dist/shared-agents/context.js +5 -0
  312. package/dist/shared-agents/context.js.map +1 -0
  313. package/dist/shared-agents/define-agent.d.ts +3 -0
  314. package/dist/shared-agents/define-agent.js +15 -0
  315. package/dist/shared-agents/define-agent.js.map +1 -0
  316. package/dist/shared-agents/execute.d.ts +24 -0
  317. package/dist/shared-agents/execute.js +63 -0
  318. package/dist/shared-agents/execute.js.map +1 -0
  319. package/dist/shared-agents/index.d.ts +5 -0
  320. package/dist/shared-agents/index.js +6 -0
  321. package/dist/shared-agents/index.js.map +1 -0
  322. package/dist/shared-agents/load.d.ts +8 -0
  323. package/dist/shared-agents/load.js +141 -0
  324. package/dist/shared-agents/load.js.map +1 -0
  325. package/dist/shared-agents/registry.d.ts +8 -0
  326. package/dist/shared-agents/registry.js +25 -0
  327. package/dist/shared-agents/registry.js.map +1 -0
  328. package/dist/shared-agents/render.d.ts +11 -0
  329. package/dist/shared-agents/render.js +31 -0
  330. package/dist/shared-agents/render.js.map +1 -0
  331. package/dist/shared-agents/resolver.d.ts +7 -0
  332. package/dist/shared-agents/resolver.js +22 -0
  333. package/dist/shared-agents/resolver.js.map +1 -0
  334. package/dist/shared-agents/types.d.ts +33 -0
  335. package/dist/shared-agents/types.js +2 -0
  336. package/dist/shared-agents/types.js.map +1 -0
  337. package/dist/shared-agents/validate.d.ts +7 -0
  338. package/dist/shared-agents/validate.js +223 -0
  339. package/dist/shared-agents/validate.js.map +1 -0
  340. package/dist/structured/extract-json.d.ts +11 -0
  341. package/dist/structured/extract-json.js +79 -0
  342. package/dist/structured/extract-json.js.map +1 -0
  343. package/dist/structured/normalize-agent-output.d.ts +18 -0
  344. package/dist/structured/normalize-agent-output.js +89 -0
  345. package/dist/structured/normalize-agent-output.js.map +1 -0
  346. package/dist/structured/structured-output.d.ts +14 -0
  347. package/dist/structured/structured-output.js +51 -0
  348. package/dist/structured/structured-output.js.map +1 -0
  349. package/dist/structured/validate-json.d.ts +13 -0
  350. package/dist/structured/validate-json.js +32 -0
  351. package/dist/structured/validate-json.js.map +1 -0
  352. package/dist/tools/artifacts.d.ts +8 -0
  353. package/dist/tools/artifacts.js +31 -0
  354. package/dist/tools/artifacts.js.map +1 -0
  355. package/dist/tools/define-tool.d.ts +10 -0
  356. package/dist/tools/define-tool.js +24 -0
  357. package/dist/tools/define-tool.js.map +1 -0
  358. package/dist/tools/executor-types.d.ts +40 -0
  359. package/dist/tools/executor-types.js +2 -0
  360. package/dist/tools/executor-types.js.map +1 -0
  361. package/dist/tools/executor.d.ts +23 -0
  362. package/dist/tools/executor.js +455 -0
  363. package/dist/tools/executor.js.map +1 -0
  364. package/dist/tools/index.d.ts +6 -0
  365. package/dist/tools/index.js +5 -0
  366. package/dist/tools/index.js.map +1 -0
  367. package/dist/tools/load.d.ts +7 -0
  368. package/dist/tools/load.js +133 -0
  369. package/dist/tools/load.js.map +1 -0
  370. package/dist/tools/registry.d.ts +9 -0
  371. package/dist/tools/registry.js +97 -0
  372. package/dist/tools/registry.js.map +1 -0
  373. package/dist/tools/serialization.d.ts +11 -0
  374. package/dist/tools/serialization.js +68 -0
  375. package/dist/tools/serialization.js.map +1 -0
  376. package/dist/tools/validate.d.ts +18 -0
  377. package/dist/tools/validate.js +55 -0
  378. package/dist/tools/validate.js.map +1 -0
  379. package/dist/types/agent.d.ts +136 -0
  380. package/dist/types/agent.js +2 -0
  381. package/dist/types/agent.js.map +1 -0
  382. package/dist/types/artifacts.d.ts +88 -0
  383. package/dist/types/artifacts.js +2 -0
  384. package/dist/types/artifacts.js.map +1 -0
  385. package/dist/types/common.d.ts +15 -0
  386. package/dist/types/common.js +2 -0
  387. package/dist/types/common.js.map +1 -0
  388. package/dist/types/config.d.ts +119 -0
  389. package/dist/types/config.js +2 -0
  390. package/dist/types/config.js.map +1 -0
  391. package/dist/types/errors.d.ts +21 -0
  392. package/dist/types/errors.js +50 -0
  393. package/dist/types/errors.js.map +1 -0
  394. package/dist/types/events.d.ts +4 -0
  395. package/dist/types/events.js +2 -0
  396. package/dist/types/events.js.map +1 -0
  397. package/dist/types/index.d.ts +11 -0
  398. package/dist/types/index.js +12 -0
  399. package/dist/types/index.js.map +1 -0
  400. package/dist/types/process.d.ts +20 -0
  401. package/dist/types/process.js +2 -0
  402. package/dist/types/process.js.map +1 -0
  403. package/dist/types/reporter.d.ts +1 -0
  404. package/dist/types/reporter.js +2 -0
  405. package/dist/types/reporter.js.map +1 -0
  406. package/dist/types/scheduler.d.ts +30 -0
  407. package/dist/types/scheduler.js +2 -0
  408. package/dist/types/scheduler.js.map +1 -0
  409. package/dist/types/tool.d.ts +129 -0
  410. package/dist/types/tool.js +2 -0
  411. package/dist/types/tool.js.map +1 -0
  412. package/dist/types/workflow.d.ts +127 -0
  413. package/dist/types/workflow.js +2 -0
  414. package/dist/types/workflow.js.map +1 -0
  415. package/dist/workflow/discovery.d.ts +15 -0
  416. package/dist/workflow/discovery.js +134 -0
  417. package/dist/workflow/discovery.js.map +1 -0
  418. package/dist/workflow/dsl.d.ts +13 -0
  419. package/dist/workflow/dsl.js +683 -0
  420. package/dist/workflow/dsl.js.map +1 -0
  421. package/dist/workflow/errors.d.ts +18 -0
  422. package/dist/workflow/errors.js +33 -0
  423. package/dist/workflow/errors.js.map +1 -0
  424. package/dist/workflow/invocation-artifacts.d.ts +42 -0
  425. package/dist/workflow/invocation-artifacts.js +114 -0
  426. package/dist/workflow/invocation-artifacts.js.map +1 -0
  427. package/dist/workflow/invocation-manager.d.ts +31 -0
  428. package/dist/workflow/invocation-manager.js +516 -0
  429. package/dist/workflow/invocation-manager.js.map +1 -0
  430. package/dist/workflow/invocation-types.d.ts +63 -0
  431. package/dist/workflow/invocation-types.js +15 -0
  432. package/dist/workflow/invocation-types.js.map +1 -0
  433. package/dist/workflow/json.d.ts +10 -0
  434. package/dist/workflow/json.js +117 -0
  435. package/dist/workflow/json.js.map +1 -0
  436. package/dist/workflow/load.d.ts +2 -0
  437. package/dist/workflow/load.js +18 -0
  438. package/dist/workflow/load.js.map +1 -0
  439. package/dist/workflow/parse.d.ts +2 -0
  440. package/dist/workflow/parse.js +135 -0
  441. package/dist/workflow/parse.js.map +1 -0
  442. package/dist/workflow/registry.d.ts +18 -0
  443. package/dist/workflow/registry.js +55 -0
  444. package/dist/workflow/registry.js.map +1 -0
  445. package/dist/workflow/resolve-target.d.ts +45 -0
  446. package/dist/workflow/resolve-target.js +162 -0
  447. package/dist/workflow/resolve-target.js.map +1 -0
  448. package/dist/workflow/runtime.d.ts +46 -0
  449. package/dist/workflow/runtime.js +398 -0
  450. package/dist/workflow/runtime.js.map +1 -0
  451. package/dist/workflow/sandbox.d.ts +14 -0
  452. package/dist/workflow/sandbox.js +79 -0
  453. package/dist/workflow/sandbox.js.map +1 -0
  454. package/dist/workflow/scope.d.ts +18 -0
  455. package/dist/workflow/scope.js +108 -0
  456. package/dist/workflow/scope.js.map +1 -0
  457. package/dist/workflow/types.d.ts +65 -0
  458. package/dist/workflow/types.js +2 -0
  459. package/dist/workflow/types.js.map +1 -0
  460. package/dist/workflow/validate.d.ts +28 -0
  461. package/dist/workflow/validate.js +1059 -0
  462. package/dist/workflow/validate.js.map +1 -0
  463. package/dist/workflow/workflow-call.d.ts +12 -0
  464. package/dist/workflow/workflow-call.js +61 -0
  465. package/dist/workflow/workflow-call.js.map +1 -0
  466. package/package.json +67 -0
@@ -0,0 +1,46 @@
1
+ import type { ParsedWorkflow, WorkflowRunResult, ResolvedWorkflowIdentity } from "../types/workflow.js";
2
+ import type { ResolvedConfig, CliRunOptions } from "../types/config.js";
3
+ import type { ArtifactStore } from "../types/artifacts.js";
4
+ import type { AgentExecutor } from "../agents/execution-types.js";
5
+ import type { RuntimeEventSink } from "../orchestration/scheduler.js";
6
+ import type { RuntimeState } from "./types.js";
7
+ import { type WorkflowRegistry } from "./registry.js";
8
+ import type { SharedAgentRegistry } from "../shared-agents/registry.js";
9
+ import type { WorkflowInvocationContext } from "./invocation-types.js";
10
+ import type { ToolRegistry } from "../types/tool.js";
11
+ import type { ToolExecutor } from "../tools/executor-types.js";
12
+ export interface Clock {
13
+ now(): Date;
14
+ }
15
+ export interface IdGenerator {
16
+ nextId(prefix: string): string;
17
+ }
18
+ export interface RuntimeRunInput {
19
+ parsedWorkflow: ParsedWorkflow;
20
+ workflowRegistry?: WorkflowRegistry;
21
+ workflowIdentity?: ResolvedWorkflowIdentity;
22
+ config: ResolvedConfig;
23
+ cli: CliRunOptions;
24
+ signal?: AbortSignal;
25
+ sharedAgentRegistry?: SharedAgentRegistry;
26
+ toolRegistry?: ToolRegistry;
27
+ }
28
+ export interface RuntimeDependencies {
29
+ agentExecutor: AgentExecutor;
30
+ eventSink: RuntimeEventSink;
31
+ artifactStore?: ArtifactStore;
32
+ clock?: Clock;
33
+ idGenerator?: IdGenerator;
34
+ sharedAgentRegistry?: SharedAgentRegistry;
35
+ toolExecutor?: ToolExecutor;
36
+ }
37
+ export interface RuntimeRunner {
38
+ run(input: RuntimeRunInput, deps: RuntimeDependencies): Promise<WorkflowRunResult>;
39
+ }
40
+ export declare class DefaultRuntimeRunner implements RuntimeRunner {
41
+ run(input: RuntimeRunInput, deps: RuntimeDependencies): Promise<WorkflowRunResult>;
42
+ }
43
+ export declare function executeWorkflowModule(runtime: RuntimeState, invocationContext?: WorkflowInvocationContext): Promise<unknown>;
44
+ export declare function buildSucceededRunResult(runtime: RuntimeState, workflowResult: unknown, durationMs: number, finishedAt: string, artifactStore?: ArtifactStore): WorkflowRunResult;
45
+ export declare function buildFailedRunResult(runtime: RuntimeState, error: unknown, durationMs: number, finishedAt: string, artifactStore?: ArtifactStore): WorkflowRunResult;
46
+ export declare function buildCancelledRunResult(runtime: RuntimeState, durationMs: number, finishedAt: string, reason?: string, artifactStore?: ArtifactStore): WorkflowRunResult;
@@ -0,0 +1,398 @@
1
+ import * as path from "node:path";
2
+ import * as vm from "node:vm";
3
+ import { DefaultScheduler } from "../orchestration/scheduler.js";
4
+ import { createDsl } from "./dsl.js";
5
+ import { createSandboxContext } from "./sandbox.js";
6
+ import { createRootWorkflowRegistry } from "./registry.js";
7
+ import { serializeError } from "../errors/serialize.js";
8
+ import { createLinkedAbortController } from "../orchestration/cancellation.js";
9
+ import { OpenDynamicWorkflowError } from "../errors/types.js";
10
+ import { ErrorCode } from "../errors/codes.js";
11
+ import { loadRuntimeCallCache } from "../artifacts/call-cache.js";
12
+ import { DefaultWorkflowInvocationManager } from "./invocation-manager.js";
13
+ import { getActiveWorkflowInvocation } from "./invocation-types.js";
14
+ import { cloneJsonValue, cloneJsonObject } from "./json.js";
15
+ import { withDslExecutionScope, withToolTopLevelWindow } from "./scope.js";
16
+ export class DefaultRuntimeRunner {
17
+ async run(input, deps) {
18
+ const startTime = deps.clock ? deps.clock.now() : new Date();
19
+ const runId = deps.idGenerator ? deps.idGenerator.nextId("run") : crypto.randomUUID();
20
+ const cwd = input.cli.cwd || input.config.cwd || process.cwd();
21
+ const artifactsDir = input.cli.outDir || input.config.outDir || path.resolve(cwd, ".open-dynamic-workflow/runs", runId);
22
+ const schedulerConcurrency = input.cli.concurrency ?? input.config.concurrency ?? 1;
23
+ const scheduler = new DefaultScheduler({
24
+ concurrency: schedulerConcurrency,
25
+ failFast: !!(input.cli.failFast || input.config.failFast)
26
+ }, { eventSink: deps.eventSink });
27
+ const runtimeAbortController = createLinkedAbortController(input.signal);
28
+ const callCache = await loadRuntimeCallCache({
29
+ resume: input.cli.resume,
30
+ noCache: input.cli.noCache,
31
+ outDir: input.config.outDir
32
+ });
33
+ const registry = input.workflowRegistry || createRootWorkflowRegistry(input.parsedWorkflow);
34
+ const runtime = {
35
+ artifactStore: deps.artifactStore,
36
+ workflowRegistry: registry,
37
+ runId,
38
+ parsedWorkflow: input.parsedWorkflow,
39
+ config: input.config,
40
+ cli: input.cli,
41
+ args: input.cli.args || {},
42
+ cwd,
43
+ artifactsDir,
44
+ agentResults: [],
45
+ toolResults: [],
46
+ scheduler,
47
+ agentExecutor: deps.agentExecutor,
48
+ eventSink: deps.eventSink,
49
+ abortController: runtimeAbortController,
50
+ agentCounter: 0,
51
+ callSequence: 0,
52
+ callCache,
53
+ pipelineCounter: 0,
54
+ pipelineSummaries: [],
55
+ workflowSummaries: [],
56
+ startedAt: startTime.toISOString(),
57
+ idGenerator: deps.idGenerator !== undefined ? deps.idGenerator : undefined,
58
+ failFast: input.cli.failFast,
59
+ sharedAgentRegistry: input.sharedAgentRegistry || deps.sharedAgentRegistry,
60
+ schedulerConcurrency,
61
+ toolRegistry: input.toolRegistry,
62
+ toolExecutor: deps.toolExecutor,
63
+ toolCallIds: new Set(),
64
+ toolCounter: 0
65
+ };
66
+ const invocationManager = new DefaultWorkflowInvocationManager({
67
+ runtime,
68
+ registry,
69
+ evaluate: (ctx) => executeWorkflowModule(runtime, ctx)
70
+ });
71
+ runtime.invocationManager = invocationManager;
72
+ if (deps.artifactStore && !deps.artifactStore.isRunCreated()) {
73
+ await deps.artifactStore.createRun({
74
+ runId,
75
+ outDir: artifactsDir,
76
+ workflowPath: input.parsedWorkflow.sourcePath,
77
+ workflowSource: input.parsedWorkflow.sourceText || "",
78
+ workflowHash: input.parsedWorkflow.sourceHash,
79
+ resolvedConfig: input.config,
80
+ openDynamicWorkflowVersion: input.parsedWorkflow.meta.version || "0.0.0",
81
+ cwd,
82
+ configPath: input.config.configPath
83
+ });
84
+ }
85
+ // Listen to external signals / cancellation
86
+ if (input.signal) {
87
+ if (input.signal.aborted) {
88
+ scheduler.abort({ type: "user", message: input.signal.reason || "External cancellation" });
89
+ runtimeAbortController.abort(input.signal.reason || "External cancellation");
90
+ }
91
+ else {
92
+ input.signal.addEventListener("abort", () => {
93
+ scheduler.abort({ type: "user", message: input.signal?.reason || "External cancellation" });
94
+ runtimeAbortController.abort(input.signal?.reason || "External cancellation");
95
+ });
96
+ }
97
+ }
98
+ // Emit workflow.resolved if present
99
+ if (deps.eventSink && input.workflowIdentity) {
100
+ deps.eventSink.emit("workflow.resolved", {
101
+ requestedTarget: input.workflowIdentity.requestedTarget,
102
+ targetKind: input.workflowIdentity.targetKind,
103
+ workflowName: input.workflowIdentity.name,
104
+ workflowFile: input.workflowIdentity.workflowFile,
105
+ workflowFileRelative: input.workflowIdentity.workflowFileRelative,
106
+ discoverySource: input.workflowIdentity.discoverySource
107
+ });
108
+ }
109
+ // Emit workflow.started
110
+ if (deps.eventSink) {
111
+ deps.eventSink.emit("workflow.started", {
112
+ meta: input.parsedWorkflow.meta,
113
+ cwd,
114
+ artifactsDir
115
+ });
116
+ }
117
+ try {
118
+ if (runtimeAbortController.signal.aborted) {
119
+ throw new OpenDynamicWorkflowError(ErrorCode.WORKFLOW_CANCELLED, String(runtimeAbortController.signal.reason || "Workflow cancelled before execution started."));
120
+ }
121
+ const workflowResult = await withDslExecutionScope({
122
+ runId: runtime.runId,
123
+ workflowInvocationId: runtime.runId,
124
+ location: "workflow-top-level",
125
+ toolAllowed: true,
126
+ topLevelWindow: false
127
+ }, () => invocationManager.executeRoot(registry.require(input.parsedWorkflow.meta.name), runtime.args));
128
+ // Wait for scheduler to drain all pending tasks
129
+ await scheduler.drain();
130
+ // Check if scheduler is aborted
131
+ const schedulerSnapshot = scheduler.getSnapshot();
132
+ if (schedulerSnapshot.aborted) {
133
+ const abortReason = schedulerSnapshot.abortReason;
134
+ const isFailFast = abortReason?.type === "fail-fast";
135
+ const reasonMsg = typeof abortReason === "string" ? abortReason : abortReason?.message;
136
+ if (isFailFast) {
137
+ if (runtime.toolExecutor) {
138
+ runtime.toolExecutor.cancel({ name: "FailFastError", message: reasonMsg || "Fail-fast triggered", code: "FAIL_FAST" });
139
+ await runtime.toolExecutor.close().catch(() => { });
140
+ }
141
+ const finishTime = deps.clock ? deps.clock.now() : new Date();
142
+ const durationMs = finishTime.getTime() - startTime.getTime();
143
+ // Build failed run result for fail-fast
144
+ const result = buildFailedRunResult(runtime, new Error(reasonMsg), durationMs, finishTime.toISOString(), deps.artifactStore);
145
+ if (deps.eventSink) {
146
+ deps.eventSink.emit("workflow.failed", {
147
+ status: "failed",
148
+ durationMs,
149
+ error: result.error
150
+ });
151
+ }
152
+ if (deps.artifactStore) {
153
+ await deps.artifactStore.updateManifest("failed", result.error);
154
+ }
155
+ return result;
156
+ }
157
+ else {
158
+ if (runtime.toolExecutor) {
159
+ runtime.toolExecutor.cancel({ name: "WorkflowCancelledError", message: reasonMsg || "Workflow cancelled", code: "USER_CANCELLED" });
160
+ await runtime.toolExecutor.close().catch(() => { });
161
+ }
162
+ const finishTime = deps.clock ? deps.clock.now() : new Date();
163
+ const durationMs = finishTime.getTime() - startTime.getTime();
164
+ // Build cancelled run result
165
+ const result = buildCancelledRunResult(runtime, durationMs, finishTime.toISOString(), reasonMsg, deps.artifactStore);
166
+ if (deps.eventSink) {
167
+ deps.eventSink.emit("workflow.cancelled", {
168
+ status: "cancelled",
169
+ durationMs,
170
+ reason: reasonMsg || "Workflow cancelled"
171
+ });
172
+ }
173
+ if (deps.artifactStore) {
174
+ await deps.artifactStore.updateManifest("cancelled", result.error);
175
+ }
176
+ return result;
177
+ }
178
+ }
179
+ if (runtime.toolExecutor) {
180
+ await runtime.toolExecutor.close();
181
+ }
182
+ const finishTime = deps.clock ? deps.clock.now() : new Date();
183
+ const durationMs = finishTime.getTime() - startTime.getTime();
184
+ // Build succeeded run result
185
+ const result = buildSucceededRunResult(runtime, workflowResult, durationMs, finishTime.toISOString(), deps.artifactStore);
186
+ if (deps.eventSink) {
187
+ deps.eventSink.emit("workflow.completed", {
188
+ status: "succeeded",
189
+ durationMs,
190
+ result: workflowResult
191
+ });
192
+ }
193
+ if (deps.artifactStore) {
194
+ await deps.artifactStore.updateManifest("succeeded");
195
+ }
196
+ return result;
197
+ }
198
+ catch (err) {
199
+ let abortType = "other";
200
+ if (err?.code === ErrorCode.WORKFLOW_TIMEOUT) {
201
+ abortType = "timeout";
202
+ }
203
+ else if (err?.code === ErrorCode.WORKFLOW_CANCELLED ||
204
+ err?.code === ErrorCode.USER_CANCELLED ||
205
+ err?.name === "AbortError" ||
206
+ err?.name === "WorkflowCancelledError" ||
207
+ (err?.name === "OpenDynamicWorkflowError" && (err?.code === ErrorCode.WORKFLOW_CANCELLED || err?.code === ErrorCode.USER_CANCELLED))) {
208
+ abortType = "user";
209
+ }
210
+ scheduler.abort({
211
+ type: abortType,
212
+ message: err.message || "Workflow error"
213
+ });
214
+ await scheduler.drain().catch(() => { });
215
+ if (runtime.toolExecutor) {
216
+ runtime.toolExecutor.cancel(serializeError(err));
217
+ await runtime.toolExecutor.close().catch(() => { });
218
+ }
219
+ const finishTime = deps.clock ? deps.clock.now() : new Date();
220
+ const durationMs = finishTime.getTime() - startTime.getTime();
221
+ const isCancellation = err?.code === ErrorCode.WORKFLOW_CANCELLED ||
222
+ err?.code === ErrorCode.USER_CANCELLED ||
223
+ err?.name === "AbortError" ||
224
+ err?.name === "WorkflowCancelledError" ||
225
+ (err?.name === "OpenDynamicWorkflowError" && (err?.code === ErrorCode.WORKFLOW_CANCELLED || err?.code === ErrorCode.USER_CANCELLED));
226
+ if (isCancellation) {
227
+ const result = buildCancelledRunResult(runtime, durationMs, finishTime.toISOString(), err.message, deps.artifactStore);
228
+ if (deps.eventSink) {
229
+ deps.eventSink.emit("workflow.cancelled", {
230
+ status: "cancelled",
231
+ durationMs,
232
+ reason: err.message || "Workflow cancelled"
233
+ });
234
+ }
235
+ if (deps.artifactStore) {
236
+ await deps.artifactStore.updateManifest("cancelled", result.error);
237
+ }
238
+ return result;
239
+ }
240
+ // Build failed run result
241
+ const result = buildFailedRunResult(runtime, err, durationMs, finishTime.toISOString(), deps.artifactStore);
242
+ if (deps.eventSink) {
243
+ deps.eventSink.emit("workflow.failed", {
244
+ status: "failed",
245
+ durationMs,
246
+ error: result.error
247
+ });
248
+ }
249
+ if (deps.artifactStore) {
250
+ await deps.artifactStore.updateManifest("failed", result.error);
251
+ }
252
+ return result;
253
+ }
254
+ }
255
+ }
256
+ export async function executeWorkflowModule(runtime, invocationContext) {
257
+ let context;
258
+ try {
259
+ context = createSandboxContext(runtime);
260
+ }
261
+ catch (err) {
262
+ throw new OpenDynamicWorkflowError(ErrorCode.SECURITY_POLICY_VIOLATION, `Failed to create secure sandbox context: ${err.message}`, { cause: err });
263
+ }
264
+ const parsedWorkflow = invocationContext ? invocationContext.definition.parsedWorkflow : runtime.parsedWorkflow;
265
+ const body = parsedWorkflow.body;
266
+ const transformedBody = body.replace(/export\s+default\s+/, "__default = ");
267
+ const wrappedBody = `(async () => {\n${transformedBody}\n})()`;
268
+ try {
269
+ const promise = withToolTopLevelWindow(parsedWorkflow.sourcePath, () => vm.runInContext(wrappedBody, context, {
270
+ filename: parsedWorkflow.sourcePath,
271
+ lineOffset: -1
272
+ }));
273
+ await withToolTopLevelWindow(parsedWorkflow.sourcePath, async () => {
274
+ await promise;
275
+ });
276
+ const workflowFn = context.__default;
277
+ let result;
278
+ if (typeof workflowFn === "function") {
279
+ const dsl = createDsl(runtime);
280
+ const activeInvocation = getActiveWorkflowInvocation();
281
+ const args = activeInvocation ? activeInvocation.args : runtime.args;
282
+ const dslContext = {
283
+ ...dsl,
284
+ args: Object.freeze(cloneJsonObject(args, "workflow args")),
285
+ cwd: runtime.cwd,
286
+ runId: runtime.runId,
287
+ artifactsDir: runtime.artifactsDir,
288
+ signal: activeInvocation?.signal || runtime.abortController.signal
289
+ };
290
+ result = await withToolTopLevelWindow(parsedWorkflow.sourcePath, () => workflowFn(dslContext));
291
+ }
292
+ else {
293
+ result = workflowFn;
294
+ }
295
+ if (result === undefined)
296
+ return undefined;
297
+ if (result === null)
298
+ return null;
299
+ try {
300
+ return cloneJsonValue(result, "workflow result");
301
+ }
302
+ catch (err) {
303
+ throw new OpenDynamicWorkflowError(ErrorCode.WORKFLOW_RESULT_SERIALIZATION_FAILED, `Failed to serialize workflow result: ${err.message}`, { cause: err });
304
+ }
305
+ }
306
+ catch (err) {
307
+ // Check if it's already an OpenDynamicWorkflowError (e.g. from DSL)
308
+ // We check both instanceof and the presence of the 'code' property
309
+ // to handle errors coming from the VM context.
310
+ if (err instanceof OpenDynamicWorkflowError || (err && typeof err === "object" && "code" in err && "name" in err && err.name === "OpenDynamicWorkflowError")) {
311
+ throw err;
312
+ }
313
+ // Map potential sandbox escapes or violations to SECURITY_POLICY_VIOLATION
314
+ const isSecurityViolation = err.name === "SecurityError";
315
+ if (isSecurityViolation) {
316
+ throw new OpenDynamicWorkflowError(ErrorCode.SECURITY_POLICY_VIOLATION, `Workflow execution violated security policy: ${err.message}`, { cause: err });
317
+ }
318
+ throw err;
319
+ }
320
+ }
321
+ export function buildSucceededRunResult(runtime, workflowResult, durationMs, finishedAt, artifactStore) {
322
+ const runArtifacts = artifactStore ? artifactStore.getRunArtifacts() : undefined;
323
+ const reportPath = runArtifacts?.reportPath || path.join(runtime.artifactsDir, "report.json");
324
+ const eventsPath = runArtifacts?.eventsPath || path.join(runtime.artifactsDir, "events.jsonl");
325
+ const result = {
326
+ schemaVersion: "open-dynamic-workflow.report.v1",
327
+ runId: runtime.runId,
328
+ status: "succeeded",
329
+ meta: runtime.parsedWorkflow.meta,
330
+ agents: runtime.agentResults,
331
+ pipelines: runtime.pipelineSummaries,
332
+ workflows: runtime.workflowSummaries,
333
+ tools: runtime.toolExecutor && runtime.toolExecutor.getSummaries().length > 0 ? [...runtime.toolExecutor.getSummaries()] : undefined,
334
+ startedAt: runtime.startedAt,
335
+ finishedAt,
336
+ durationMs,
337
+ artifactsDir: runtime.artifactsDir,
338
+ reportPath,
339
+ eventsPath
340
+ };
341
+ if (workflowResult !== undefined) {
342
+ result.result = workflowResult;
343
+ }
344
+ return result;
345
+ }
346
+ export function buildFailedRunResult(runtime, error, durationMs, finishedAt, artifactStore) {
347
+ const runArtifacts = artifactStore ? artifactStore.getRunArtifacts() : undefined;
348
+ const reportPath = runArtifacts?.reportPath || path.join(runtime.artifactsDir, "report.json");
349
+ const eventsPath = runArtifacts?.eventsPath || path.join(runtime.artifactsDir, "events.jsonl");
350
+ const serialized = serializeError(error);
351
+ const result = {
352
+ schemaVersion: "open-dynamic-workflow.report.v1",
353
+ runId: runtime.runId,
354
+ status: "failed",
355
+ meta: runtime.parsedWorkflow.meta,
356
+ agents: runtime.agentResults,
357
+ pipelines: runtime.pipelineSummaries,
358
+ workflows: runtime.workflowSummaries,
359
+ tools: runtime.toolExecutor && runtime.toolExecutor.getSummaries().length > 0 ? [...runtime.toolExecutor.getSummaries()] : undefined,
360
+ startedAt: runtime.startedAt,
361
+ finishedAt,
362
+ durationMs,
363
+ artifactsDir: runtime.artifactsDir,
364
+ reportPath,
365
+ eventsPath,
366
+ error: serialized
367
+ };
368
+ return result;
369
+ }
370
+ export function buildCancelledRunResult(runtime, durationMs, finishedAt, reason, artifactStore) {
371
+ const runArtifacts = artifactStore ? artifactStore.getRunArtifacts() : undefined;
372
+ const reportPath = runArtifacts?.reportPath || path.join(runtime.artifactsDir, "report.json");
373
+ const eventsPath = runArtifacts?.eventsPath || path.join(runtime.artifactsDir, "events.jsonl");
374
+ const errorPayload = {
375
+ name: "WorkflowCancelledError",
376
+ message: reason || "Workflow was cancelled",
377
+ code: "USER_CANCELLED"
378
+ };
379
+ const result = {
380
+ schemaVersion: "open-dynamic-workflow.report.v1",
381
+ runId: runtime.runId,
382
+ status: "cancelled",
383
+ meta: runtime.parsedWorkflow.meta,
384
+ agents: runtime.agentResults,
385
+ pipelines: runtime.pipelineSummaries,
386
+ workflows: runtime.workflowSummaries,
387
+ tools: runtime.toolExecutor && runtime.toolExecutor.getSummaries().length > 0 ? [...runtime.toolExecutor.getSummaries()] : undefined,
388
+ startedAt: runtime.startedAt,
389
+ finishedAt,
390
+ durationMs,
391
+ artifactsDir: runtime.artifactsDir,
392
+ reportPath,
393
+ eventsPath,
394
+ error: errorPayload
395
+ };
396
+ return result;
397
+ }
398
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/workflow/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAQ9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAyB,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAE/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,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AAC,YAAY,EAAE,cAAc,CAAC,CAAC;IAE/F,MAAM,YAAY,GAAG;QACnB,IAAI,EAAE,wBAAwB;QAC9B,OAAO,EAAE,MAAM,IAAI,wBAAwB;QAC3C,IAAI,EAAE,gBAAgB;KACvB,CAAC;IAEF,MAAM,MAAM,GAAsB;QAChC,aAAa,EAAE,iCAAiC;QAChD,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,WAAW;QACnB,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,IAAI;QACjC,MAAM,EAAE,OAAO,CAAC,YAAY;QAC5B,SAAS,EAAE,OAAO,CAAC,iBAAiB;QACpC,SAAS,EAAE,OAAO,CAAC,iBAAiB;QACpC,KAAK,EAAE,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;QACpI,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,UAAU;QACV,UAAU;QACV,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,UAAU;QACV,UAAU;QACV,KAAK,EAAE,YAAY;KACpB,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import * as vm from "node:vm";
2
+ import type { RuntimeState } from "./types.js";
3
+ /**
4
+ * Creates a restricted sandbox context for running a workflow.
5
+ *
6
+ * Safety model:
7
+ * 1. We use a fresh VM context which provides its own globals (Object, Array, etc.)
8
+ * that are distinct from the host's versions. This prevents simple prototype
9
+ * pollution and constructor.constructor escapes back to host Function.
10
+ * 2. We only expose safe, necessary DSL functions and data.
11
+ * 3. We do not provide host-level modules like 'fs' or 'process'.
12
+ * 4. The sandbox object itself is frozen after setup to prevent modifications to the global scope.
13
+ */
14
+ export declare function createSandboxContext(runtime: RuntimeState): vm.Context;
@@ -0,0 +1,79 @@
1
+ import * as vm from "node:vm";
2
+ import { createDsl } from "./dsl.js";
3
+ import { getActiveWorkflowInvocation } from "./invocation-types.js";
4
+ import { cloneJsonObject } from "./json.js";
5
+ import { withToolForbidden } from "./scope.js";
6
+ /**
7
+ * Creates a restricted sandbox context for running a workflow.
8
+ *
9
+ * Safety model:
10
+ * 1. We use a fresh VM context which provides its own globals (Object, Array, etc.)
11
+ * that are distinct from the host's versions. This prevents simple prototype
12
+ * pollution and constructor.constructor escapes back to host Function.
13
+ * 2. We only expose safe, necessary DSL functions and data.
14
+ * 3. We do not provide host-level modules like 'fs' or 'process'.
15
+ * 4. The sandbox object itself is frozen after setup to prevent modifications to the global scope.
16
+ */
17
+ export function createSandboxContext(runtime) {
18
+ const dsl = createDsl(runtime);
19
+ const activeInvocation = getActiveWorkflowInvocation();
20
+ const args = activeInvocation ? activeInvocation.args : runtime.args;
21
+ // Use a clean object for the sandbox global scope
22
+ const sandbox = Object.create(null);
23
+ // Wrap Promise to forbid tool calls in callbacks
24
+ const OriginalPromise = Promise;
25
+ class WrappedPromise extends OriginalPromise {
26
+ then(onfulfilled, onrejected) {
27
+ const wrappedOnFulfilled = onfulfilled
28
+ ? (value) => withToolForbidden("asynchronous-callback", () => onfulfilled(value))
29
+ : undefined;
30
+ const wrappedOnRejected = onrejected
31
+ ? (reason) => withToolForbidden("asynchronous-callback", () => onrejected(reason))
32
+ : undefined;
33
+ return super.then(wrappedOnFulfilled, wrappedOnRejected);
34
+ }
35
+ catch(onrejected) {
36
+ const wrappedOnRejected = onrejected
37
+ ? (reason) => withToolForbidden("asynchronous-callback", () => onrejected(reason))
38
+ : undefined;
39
+ return super.catch(wrappedOnRejected);
40
+ }
41
+ finally(onfinally) {
42
+ const wrappedOnFinally = onfinally
43
+ ? () => withToolForbidden("asynchronous-callback", () => onfinally())
44
+ : undefined;
45
+ return super.finally(wrappedOnFinally);
46
+ }
47
+ }
48
+ // Define properties on the sandbox
49
+ // We keep them writable: false where possible, but __default must be writable
50
+ Object.defineProperties(sandbox, {
51
+ agent: { value: dsl.agent, enumerable: true, configurable: false, writable: false },
52
+ tool: { value: dsl.tool, enumerable: true, configurable: false, writable: false },
53
+ parallel: { value: dsl.parallel, enumerable: true, configurable: false, writable: false },
54
+ phase: { value: dsl.phase, enumerable: true, configurable: false, writable: false },
55
+ log: { value: dsl.log, enumerable: true, configurable: false, writable: false },
56
+ pipeline: { value: dsl.pipeline, enumerable: true, configurable: false, writable: false },
57
+ workflow: { value: dsl.workflow, enumerable: true, configurable: false, writable: false },
58
+ args: { value: Object.freeze(cloneJsonObject(args, "workflow args")), enumerable: true, configurable: false, writable: false },
59
+ cwd: { value: runtime.cwd, enumerable: true, configurable: false, writable: false },
60
+ runId: { value: runtime.runId, enumerable: true, configurable: false, writable: false },
61
+ artifactsDir: { value: runtime.artifactsDir, enumerable: true, configurable: false, writable: false },
62
+ setTimeout: {
63
+ value: (fn, ms, ...args) => {
64
+ if (typeof fn !== "function") {
65
+ return setTimeout(fn, ms, ...args);
66
+ }
67
+ return setTimeout(() => withToolForbidden("asynchronous-callback", () => fn(...args)), ms);
68
+ },
69
+ enumerable: true, configurable: false, writable: false
70
+ },
71
+ clearTimeout: { value: clearTimeout, enumerable: true, configurable: false, writable: false },
72
+ Promise: { value: WrappedPromise, enumerable: true, configurable: false, writable: false },
73
+ // Placeholder for the default export capture.
74
+ __default: { value: undefined, enumerable: false, configurable: false, writable: true }
75
+ });
76
+ const context = vm.createContext(sandbox);
77
+ return context;
78
+ }
79
+ //# sourceMappingURL=sandbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../../src/workflow/sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,M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AI,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE;QAC7F,OAAO,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE;QAE1F,+CAA+C;QAC/C,SAAS,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;KACxF,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAE1C,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { type WorkflowInvocationContext } from "./invocation-types.js";
2
+ export type DslExecutionLocation = "workflow-top-level" | "parallel-task" | "pipeline-stage" | "shared-agent-definition" | "tool-definition" | "provider-callback" | "asynchronous-callback";
3
+ export interface DslExecutionScope {
4
+ runId: string;
5
+ workflowInvocationId: string;
6
+ parentWorkflowInvocationId?: string | undefined;
7
+ location: DslExecutionLocation;
8
+ toolAllowed: boolean;
9
+ topLevelWindow: boolean;
10
+ sourcePath?: string | undefined;
11
+ inheritedToolRestriction?: DslExecutionLocation | undefined;
12
+ }
13
+ export declare function withDslExecutionScope<T>(scope: DslExecutionScope, fn: () => T): T;
14
+ export declare function withToolTopLevelWindow<T>(sourcePath: string | undefined, fn: () => T): T;
15
+ export declare function getDslExecutionScope(): DslExecutionScope | undefined;
16
+ export declare function assertToolAllowed(): DslExecutionScope;
17
+ export declare function deriveChildWorkflowToolScope(parentScope: DslExecutionScope | undefined, childInvocation: WorkflowInvocationContext): DslExecutionScope;
18
+ export declare function withToolForbidden<T>(location: DslExecutionLocation, fn: () => T): T;